@rongcloud/engine 5.2.1-alpha.2 → 5.2.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RCEngine={})}(this,(function(e){"use strict";var t;!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"}(t||(t={}));var n=t;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){h(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 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)}function a(e,t,n,r,i,s,a){try{var o=e[s](a),u=o.value}catch(e){return void n(e)}o.done?t(u):Promise.resolve(u).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){a(s,r,i,o,u,"next",e)}function u(e){a(s,r,i,o,u,"throw",e)}o(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(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&&p(e,t)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function v(){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}}function y(e,t,n){return y=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i},y.apply(null,arguments)}function m(e){var t="function"==typeof Map?new Map:void 0;return m=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return y(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)},m(e)}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function T(e){var t=v();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return E(this,n)}}function R(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}function I(){return I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=R(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},I.apply(this,arguments)}function C(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,s=[],a=!0,o=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);a=!0);}catch(e){o=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(o)throw i}}return s}(e,t)||b(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 S(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(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 b(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(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}var O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function N(e){var t={exports:{}};return e(t,t.exports),t.exports}var k,A,M=function(e){return e&&e.Math==Math&&e},U=M("object"==typeof globalThis&&globalThis)||M("object"==typeof window&&window)||M("object"==typeof self&&self)||M("object"==typeof O&&O)||function(){return this}()||Function("return this")(),L=function(e){try{return!!e()}catch(e){return!0}},x=!L((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),P=!L((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),D=Function.prototype.call,V=P?D.bind(D):function(){return D.apply(D,arguments)},B={}.propertyIsEnumerable,F=Object.getOwnPropertyDescriptor,G={f:F&&!B.call({1:2},1)?function(e){var t=F(this,e);return!!t&&t.enumerable}:B},j=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},q=Function.prototype,K=q.bind,H=q.call,Y=P&&K.bind(H,H),Q=P?function(e){return e&&Y(e)}:function(e){return e&&function(){return H.apply(e,arguments)}},W=Q({}.toString),J=Q("".slice),z=function(e){return J(W(e),8,-1)},Z=U.Object,X=Q("".split),$=L((function(){return!Z("z").propertyIsEnumerable(0)}))?function(e){return"String"==z(e)?X(e,""):Z(e)}:Z,ee=U.TypeError,te=function(e){if(null==e)throw ee("Can't call method on "+e);return e},ne=function(e){return $(te(e))},re=function(e){return"function"==typeof e},ie=function(e){return"object"==typeof e?null!==e:re(e)},se=function(e){return re(e)?e:void 0},ae=function(e,t){return arguments.length<2?se(U[e]):U[e]&&U[e][t]},oe=Q({}.isPrototypeOf),ue=ae("navigator","userAgent")||"",ce=U.process,le=U.Deno,he=ce&&ce.versions||le&&le.version,fe=he&&he.v8;fe&&(A=(k=fe.split("."))[0]>0&&k[0]<4?1:+(k[0]+k[1])),!A&&ue&&(!(k=ue.match(/Edge\/(\d+)/))||k[1]>=74)&&(k=ue.match(/Chrome\/(\d+)/))&&(A=+k[1]);var de=A,ge=!!Object.getOwnPropertySymbols&&!L((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&de&&de<41})),pe=ge&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ve=U.Object,ye=pe?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return re(t)&&oe(t.prototype,ve(e))},me=U.String,_e=function(e){try{return me(e)}catch(e){return"Object"}},Ee=U.TypeError,Te=function(e){if(re(e))return e;throw Ee(_e(e)+" is not a function")},Re=function(e,t){var n=e[t];return null==n?void 0:Te(n)},Ie=U.TypeError,Ce=Object.defineProperty,Se=function(e,t){try{Ce(U,e,{value:t,configurable:!0,writable:!0})}catch(n){U[e]=t}return t},be="__core-js_shared__",we=U[be]||Se(be,{}),Oe=N((function(e){(e.exports=function(e,t){return we[e]||(we[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),Ne=U.Object,ke=function(e){return Ne(te(e))},Ae=Q({}.hasOwnProperty),Me=Object.hasOwn||function(e,t){return Ae(ke(e),t)},Ue=0,Le=Math.random(),xe=Q(1..toString),Pe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+xe(++Ue+Le,36)},De=Oe("wks"),Ve=U.Symbol,Be=Ve&&Ve.for,Fe=pe?Ve:Ve&&Ve.withoutSetter||Pe,Ge=function(e){if(!Me(De,e)||!ge&&"string"!=typeof De[e]){var t="Symbol."+e;ge&&Me(Ve,e)?De[e]=Ve[e]:De[e]=pe&&Be?Be(t):Fe(t)}return De[e]},je=U.TypeError,qe=Ge("toPrimitive"),Ke=function(e,t){if(!ie(e)||ye(e))return e;var n,r=Re(e,qe);if(r){if(void 0===t&&(t="default"),n=V(r,e,t),!ie(n)||ye(n))return n;throw je("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&re(n=e.toString)&&!ie(r=V(n,e)))return r;if(re(n=e.valueOf)&&!ie(r=V(n,e)))return r;if("string"!==t&&re(n=e.toString)&&!ie(r=V(n,e)))return r;throw Ie("Can't convert object to primitive value")}(e,t)},He=function(e){var t=Ke(e,"string");return ye(t)?t:t+""},Ye=U.document,Qe=ie(Ye)&&ie(Ye.createElement),We=function(e){return Qe?Ye.createElement(e):{}},Je=!x&&!L((function(){return 7!=Object.defineProperty(We("div"),"a",{get:function(){return 7}}).a})),ze=Object.getOwnPropertyDescriptor,Ze={f:x?ze:function(e,t){if(e=ne(e),t=He(t),Je)try{return ze(e,t)}catch(e){}if(Me(e,t))return j(!V(G.f,e,t),e[t])}},Xe=x&&L((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),$e=U.String,et=U.TypeError,tt=function(e){if(ie(e))return e;throw et($e(e)+" is not an object")},nt=U.TypeError,rt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,st="enumerable",at="configurable",ot="writable",ut={f:x?Xe?function(e,t,n){if(tt(e),t=He(t),tt(n),"function"==typeof e&&"prototype"===t&&"value"in n&&ot in n&&!n.writable){var r=it(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:at in n?n.configurable:r.configurable,enumerable:st in n?n.enumerable:r.enumerable,writable:!1})}return rt(e,t,n)}:rt:function(e,t,n){if(tt(e),t=He(t),tt(n),Je)try{return rt(e,t,n)}catch(e){}if("get"in n||"set"in n)throw nt("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},ct=x?function(e,t,n){return ut.f(e,t,j(1,n))}:function(e,t,n){return e[t]=n,e},lt=Q(Function.toString);re(we.inspectSource)||(we.inspectSource=function(e){return lt(e)});var ht,ft,dt,gt=we.inspectSource,pt=U.WeakMap,vt=re(pt)&&/native code/.test(gt(pt)),yt=Oe("keys"),mt=function(e){return yt[e]||(yt[e]=Pe(e))},_t={},Et="Object already initialized",Tt=U.TypeError,Rt=U.WeakMap;if(vt||we.state){var It=we.state||(we.state=new Rt),Ct=Q(It.get),St=Q(It.has),bt=Q(It.set);ht=function(e,t){if(St(It,e))throw new Tt(Et);return t.facade=e,bt(It,e,t),t},ft=function(e){return Ct(It,e)||{}},dt=function(e){return St(It,e)}}else{var wt=mt("state");_t[wt]=!0,ht=function(e,t){if(Me(e,wt))throw new Tt(Et);return t.facade=e,ct(e,wt,t),t},ft=function(e){return Me(e,wt)?e[wt]:{}},dt=function(e){return Me(e,wt)}}var Ot={set:ht,get:ft,has:dt,enforce:function(e){return dt(e)?ft(e):ht(e,{})},getterFor:function(e){return function(t){var n;if(!ie(t)||(n=ft(t)).type!==e)throw Tt("Incompatible receiver, "+e+" required");return n}}},Nt=Function.prototype,kt=x&&Object.getOwnPropertyDescriptor,At=Me(Nt,"name"),Mt={EXISTS:At,PROPER:At&&"something"===function(){}.name,CONFIGURABLE:At&&(!x||x&&kt(Nt,"name").configurable)},Ut=N((function(e){var t=Mt.CONFIGURABLE,n=Ot.get,r=Ot.enforce,i=String(String).split("String");(e.exports=function(e,n,s,a){var o,u=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,l=!!a&&!!a.noTargetGet,h=a&&void 0!==a.name?a.name:n;re(s)&&("Symbol("===String(h).slice(0,7)&&(h="["+String(h).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Me(s,"name")||t&&s.name!==h)&&ct(s,"name",h),(o=r(s)).source||(o.source=i.join("string"==typeof h?h:""))),e!==U?(u?!l&&e[n]&&(c=!0):delete e[n],c?e[n]=s:ct(e,n,s)):c?e[n]=s:Se(n,s)})(Function.prototype,"toString",(function(){return re(this)&&n(this).source||gt(this)}))})),Lt=Math.ceil,xt=Math.floor,Pt=function(e){var t=+e;return t!=t||0===t?0:(t>0?xt:Lt)(t)},Dt=Math.max,Vt=Math.min,Bt=function(e,t){var n=Pt(e);return n<0?Dt(n+t,0):Vt(n,t)},Ft=Math.min,Gt=function(e){return e>0?Ft(Pt(e),9007199254740991):0},jt=function(e){return Gt(e.length)},qt=function(e){return function(t,n,r){var i,s=ne(t),a=jt(s),o=Bt(r,a);if(e&&n!=n){for(;a>o;)if((i=s[o++])!=i)return!0}else for(;a>o;o++)if((e||o in s)&&s[o]===n)return e||o||0;return!e&&-1}},Kt={includes:qt(!0),indexOf:qt(!1)},Ht=Kt.indexOf,Yt=Q([].push),Qt=function(e,t){var n,r=ne(e),i=0,s=[];for(n in r)!Me(_t,n)&&Me(r,n)&&Yt(s,n);for(;t.length>i;)Me(r,n=t[i++])&&(~Ht(s,n)||Yt(s,n));return s},Wt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Jt=Wt.concat("length","prototype"),zt={f:Object.getOwnPropertyNames||function(e){return Qt(e,Jt)}},Zt={f:Object.getOwnPropertySymbols},Xt=Q([].concat),$t=ae("Reflect","ownKeys")||function(e){var t=zt.f(tt(e)),n=Zt.f;return n?Xt(t,n(e)):t},en=function(e,t,n){for(var r=$t(t),i=ut.f,s=Ze.f,a=0;a<r.length;a++){var o=r[a];Me(e,o)||n&&Me(n,o)||i(e,o,s(t,o))}},tn=/#|\.prototype\./,nn=function(e,t){var n=sn[rn(e)];return n==on||n!=an&&(re(t)?L(t):!!t)},rn=nn.normalize=function(e){return String(e).replace(tn,".").toLowerCase()},sn=nn.data={},an=nn.NATIVE="N",on=nn.POLYFILL="P",un=nn,cn=Ze.f,ln=function(e,t){var n,r,i,s,a,o=e.target,u=e.global,c=e.stat;if(n=u?U:c?U[o]||Se(o,{}):(U[o]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=cn(n,r))&&a.value:n[r],!un(u?r:o+(c?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;en(s,i)}(e.sham||i&&i.sham)&&ct(s,"sham",!0),Ut(n,r,s,e)}},hn={};hn[Ge("toStringTag")]="z";var fn,dn="[object z]"===String(hn),gn=Ge("toStringTag"),pn=U.Object,vn="Arguments"==z(function(){return arguments}()),yn=dn?z:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=pn(e),gn))?n:vn?z(t):"Object"==(r=z(t))&&re(t.callee)?"Arguments":r},mn=U.String,_n=function(e){if("Symbol"===yn(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},En=function(){var e=tt(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Tn=U.RegExp,Rn=L((function(){var e=Tn("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),In=Rn||L((function(){return!Tn("a","y").sticky})),Cn={BROKEN_CARET:Rn||L((function(){var e=Tn("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:In,UNSUPPORTED_Y:Rn},Sn=Object.keys||function(e){return Qt(e,Wt)},bn=x&&!Xe?Object.defineProperties:function(e,t){tt(e);for(var n,r=ne(t),i=Sn(t),s=i.length,a=0;s>a;)ut.f(e,n=i[a++],r[n]);return e},wn={f:bn},On=ae("document","documentElement"),Nn=mt("IE_PROTO"),kn=function(){},An=function(e){return"<script>"+e+"</"+"script>"},Mn=function(e){e.write(An("")),e.close();var t=e.parentWindow.Object;return e=null,t},Un=function(){try{fn=new ActiveXObject("htmlfile")}catch(e){}var e,t;Un="undefined"!=typeof document?document.domain&&fn?Mn(fn):((t=We("iframe")).style.display="none",On.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(An("document.F=Object")),e.close(),e.F):Mn(fn);for(var n=Wt.length;n--;)delete Un.prototype[Wt[n]];return Un()};_t[Nn]=!0;var Ln=Object.create||function(e,t){var n;return null!==e?(kn.prototype=tt(e),n=new kn,kn.prototype=null,n[Nn]=e):n=Un(),void 0===t?n:wn.f(n,t)},xn=U.RegExp,Pn=L((function(){var e=xn(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Dn=U.RegExp,Vn=L((function(){var e=Dn("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Bn=Ot.get,Fn=Oe("native-string-replace",String.prototype.replace),Gn=RegExp.prototype.exec,jn=Gn,qn=Q("".charAt),Kn=Q("".indexOf),Hn=Q("".replace),Yn=Q("".slice),Qn=function(){var e=/a/,t=/b*/g;return V(Gn,e,"a"),V(Gn,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Wn=Cn.BROKEN_CARET,Jn=void 0!==/()??/.exec("")[1];(Qn||Jn||Wn||Pn||Vn)&&(jn=function(e){var t,n,r,i,s,a,o,u=this,c=Bn(u),l=_n(e),h=c.raw;if(h)return h.lastIndex=u.lastIndex,t=V(jn,h,l),u.lastIndex=h.lastIndex,t;var f=c.groups,d=Wn&&u.sticky,g=V(En,u),p=u.source,v=0,y=l;if(d&&(g=Hn(g,"y",""),-1===Kn(g,"g")&&(g+="g"),y=Yn(l,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==qn(l,u.lastIndex-1))&&(p="(?: "+p+")",y=" "+y,v++),n=new RegExp("^(?:"+p+")",g)),Jn&&(n=new RegExp("^"+p+"$(?!\\s)",g)),Qn&&(r=u.lastIndex),i=V(Gn,d?n:u,y),d?i?(i.input=Yn(i.input,v),i[0]=Yn(i[0],v),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:Qn&&i&&(u.lastIndex=u.global?i.index+i[0].length:r),Jn&&i&&i.length>1&&V(Fn,i[0],n,(function(){for(s=1;s<arguments.length-2;s++)void 0===arguments[s]&&(i[s]=void 0)})),i&&f)for(i.groups=a=Ln(null),s=0;s<f.length;s++)a[(o=f[s])[0]]=i[o[1]];return i});var zn=jn;ln({target:"RegExp",proto:!0,forced:/./.exec!==zn},{exec:zn});var Zn=Ge("species"),Xn=RegExp.prototype,$n=function(e,t,n,r){var i=Ge(e),s=!L((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=s&&!L((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Zn]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!s||!a||n){var o=Q(/./[i]),u=t(i,""[e],(function(e,t,n,r,i){var a=Q(e),u=t.exec;return u===zn||u===Xn.exec?s&&!i?{done:!0,value:o(t,n,r)}:{done:!0,value:a(n,t,r)}:{done:!1}}));Ut(String.prototype,e,u[0]),Ut(Xn,i,u[1])}r&&ct(Xn[i],"sham",!0)},er=Q("".charAt),tr=Q("".charCodeAt),nr=Q("".slice),rr=function(e){return function(t,n){var r,i,s=_n(te(t)),a=Pt(n),o=s.length;return a<0||a>=o?e?"":void 0:(r=tr(s,a))<55296||r>56319||a+1===o||(i=tr(s,a+1))<56320||i>57343?e?er(s,a):r:e?nr(s,a,a+2):i-56320+(r-55296<<10)+65536}},ir={codeAt:rr(!1),charAt:rr(!0)},sr=ir.charAt,ar=function(e,t,n){return t+(n?sr(e,t).length:1)},or=U.TypeError,ur=function(e,t){var n=e.exec;if(re(n)){var r=V(n,e,t);return null!==r&&tt(r),r}if("RegExp"===z(e))return V(zn,e,t);throw or("RegExp#exec called on incompatible receiver")};$n("match",(function(e,t,n){return[function(t){var n=te(this),r=null==t?void 0:Re(t,e);return r?V(r,t,n):new RegExp(t)[e](_n(n))},function(e){var r=tt(this),i=_n(e),s=n(t,r,i);if(s.done)return s.value;if(!r.global)return ur(r,i);var a=r.unicode;r.lastIndex=0;for(var o,u=[],c=0;null!==(o=ur(r,i));){var l=_n(o[0]);u[c]=l,""===l&&(r.lastIndex=ar(i,Gt(r.lastIndex),a)),c++}return 0===c?null:u}]}));var cr=Array.isArray||function(e){return"Array"==z(e)},lr=function(e,t,n){var r=He(t);r in e?ut.f(e,r,j(0,n)):e[r]=n},hr=function(){},fr=[],dr=ae("Reflect","construct"),gr=/^\s*(?:class|function)\b/,pr=Q(gr.exec),vr=!gr.exec(hr),yr=function(e){if(!re(e))return!1;try{return dr(hr,fr,e),!0}catch(e){return!1}},mr=function(e){if(!re(e))return!1;switch(yn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return vr||!!pr(gr,gt(e))}catch(e){return!0}};mr.sham=!0;var _r=!dr||L((function(){var e;return yr(yr.call)||!yr(Object)||!yr((function(){e=!0}))||e}))?mr:yr,Er=Ge("species"),Tr=U.Array,Rr=function(e,t){return new(function(e){var t;return cr(e)&&(t=e.constructor,(_r(t)&&(t===Tr||cr(t.prototype))||ie(t)&&null===(t=t[Er]))&&(t=void 0)),void 0===t?Tr:t}(e))(0===t?0:t)},Ir=Ge("species"),Cr=function(e){return de>=51||!L((function(){var t=[];return(t.constructor={})[Ir]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Sr=Ge("isConcatSpreadable"),br=9007199254740991,wr="Maximum allowed index exceeded",Or=U.TypeError,Nr=de>=51||!L((function(){var e=[];return e[Sr]=!1,e.concat()[0]!==e})),kr=Cr("concat"),Ar=function(e){if(!ie(e))return!1;var t=e[Sr];return void 0!==t?!!t:cr(e)};ln({target:"Array",proto:!0,forced:!Nr||!kr},{concat:function(e){var t,n,r,i,s,a=ke(this),o=Rr(a,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(Ar(s=-1===t?a:arguments[t])){if(u+(i=jt(s))>br)throw Or(wr);for(n=0;n<i;n++,u++)n in s&&lr(o,u,s[n])}else{if(u>=br)throw Or(wr);lr(o,u++,s)}return o.length=u,o}});var Mr,Ur,Lr=72e5,xr=5e3,Pr=5e3,Dr=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],Vr=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],Br=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],Fr=3e4,Gr=131072,jr="RCV4-",qr={"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}},Kr=["RC:TypSts","RC:InterceptMsg"];e.CONNECTION_TYPE=void 0,(Mr=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",Mr.COMET="comet";var Hr=function(e){return Ur||(Ur={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}}),Ur},Yr=function(){function e(t){u(this,e),this._caches={},t&&(this._caches=t)}return l(e,[{key:"set",value:function(e,t){this._caches[e]=t}},{key:"remove",value:function(e){var t=this.get(e);return delete this._caches[e],t}},{key:"get",value:function(e){return this._caches[e]}},{key:"getKeys",value:function(){var e=[];for(var t in this._caches)e.push(t);return e}}]),e}(),Qr=function(){function e(t,n){u(this,e);var r=n?"".concat(jr).concat(n):jr;this._rootStorage=Hr(t);var i=this._rootStorage.get(r)||{};this._cache=new Yr(h({},r,i)),this._storageKey=r}return l(e,[{key:"_get",value:function(){var e=this._storageKey;return this._cache.get(e)||{}}},{key:"_set",value:function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)}},{key:"set",value:function(e,t){var n=this._get();n[e]=t,this._set(n)}},{key:"remove",value:function(e){var t=this._get();delete t[e],this._set(t)}},{key:"clear",value:function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)}},{key:"get",value:function(e){return this._get()[e]}},{key:"getKeys",value:function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t}},{key:"getValues",value:function(){return this._get()||{}}}]),e}(),Wr=function(e){f(n,e);var t=T(n);function n(e){return u(this,n),t.call(this,"TODO => ".concat(e))}return l(n)}(m(Error)),Jr=Q([].slice),zr=Cr("slice"),Zr=Ge("species"),Xr=U.Array,$r=Math.max;ln({target:"Array",proto:!0,forced:!zr},{slice:function(e,t){var n,r,i,s=ne(this),a=jt(s),o=Bt(e,a),u=Bt(void 0===t?a:t,a);if(cr(s)&&(n=s.constructor,(_r(n)&&(n===Xr||cr(n.prototype))||ie(n)&&null===(n=n[Zr]))&&(n=void 0),n===Xr||void 0===n))return Jr(s,o,u);for(r=new(void 0===n?Xr:n)($r(u-o,0)),i=0;o<u;o++,i++)o in s&&lr(r,i,s[o]);return r.length=i,r}});var ei=Function.prototype,ti=ei.apply,ni=ei.call,ri="object"==typeof Reflect&&Reflect.apply||(P?ni.bind(ti):function(){return ni.apply(ti,arguments)}),ii=Math.floor,si=Q("".charAt),ai=Q("".replace),oi=Q("".slice),ui=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ci=/\$([$&'`]|\d{1,2})/g,li=function(e,t,n,r,i,s){var a=n+e.length,o=r.length,u=ci;return void 0!==i&&(i=ke(i),u=ui),ai(s,u,(function(s,u){var c;switch(si(u,0)){case"$":return"$";case"&":return e;case"`":return oi(t,0,n);case"'":return oi(t,a);case"<":c=i[oi(u,1,-1)];break;default:var l=+u;if(0===l)return s;if(l>o){var h=ii(l/10);return 0===h?s:h<=o?void 0===r[h-1]?si(u,1):r[h-1]+si(u,1):s}c=r[l-1]}return void 0===c?"":c}))},hi=Ge("replace"),fi=Math.max,di=Math.min,gi=Q([].concat),pi=Q([].push),vi=Q("".indexOf),yi=Q("".slice),mi="$0"==="a".replace(/./,"$0"),_i=!!/./[hi]&&""===/./[hi]("a","$0");$n("replace",(function(e,t,n){var r=_i?"$":"$0";return[function(e,n){var r=te(this),i=null==e?void 0:Re(e,hi);return i?V(i,e,r,n):V(t,_n(r),e,n)},function(e,i){var s=tt(this),a=_n(e);if("string"==typeof i&&-1===vi(i,r)&&-1===vi(i,"$<")){var o=n(t,s,a,i);if(o.done)return o.value}var u=re(i);u||(i=_n(i));var c=s.global;if(c){var l=s.unicode;s.lastIndex=0}for(var h=[];;){var f=ur(s,a);if(null===f)break;if(pi(h,f),!c)break;""===_n(f[0])&&(s.lastIndex=ar(a,Gt(s.lastIndex),l))}for(var d,g="",p=0,v=0;v<h.length;v++){for(var y=_n((f=h[v])[0]),m=fi(di(Pt(f.index),a.length),0),_=[],E=1;E<f.length;E++)pi(_,void 0===(d=f[E])?d:String(d));var T=f.groups;if(u){var R=gi([y],_,m,a);void 0!==T&&pi(R,T);var I=_n(ri(i,void 0,R))}else I=li(y,a,m,_,T,i);m>=p&&(g+=yi(a,p,m)+I,p=m+y.length)}return g+yi(a,p)}]}),!!L((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!mi||_i);var Ei=Q(Q.bind),Ti=function(e,t){return Te(e),void 0===t?e:P?Ei(e,t):function(){return e.apply(t,arguments)}},Ri=Q([].push),Ii=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,a=7==e,o=5==e||s;return function(u,c,l,h){for(var f,d,g=ke(u),p=$(g),v=Ti(c,l),y=jt(p),m=0,_=h||Rr,E=t?_(u,y):n||a?_(u,0):void 0;y>m;m++)if((o||m in p)&&(d=v(f=p[m],m,g),e))if(t)E[m]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return m;case 2:Ri(E,f)}else switch(e){case 4:return!1;case 7:Ri(E,f)}return s?-1:r||i?i:E}},Ci={forEach:Ii(0),map:Ii(1),filter:Ii(2),some:Ii(3),every:Ii(4),find:Ii(5),findIndex:Ii(6),filterReject:Ii(7)},Si=Ci.filter,bi=Cr("filter");ln({target:"Array",proto:!0,forced:!bi},{filter:function(e){return Si(this,e,arguments.length>1?arguments[1]:void 0)}});var wi=dn?{}.toString:function(){return"[object "+yn(this)+"]"};dn||Ut(Object.prototype,"toString",wi,{unsafe:!0});var Oi=Ci.map,Ni=Cr("map");ln({target:"Array",proto:!0,forced:!Ni},{map:function(e){return Oi(this,e,arguments.length>1?arguments[1]:void 0)}});var ki=L((function(){Sn(1)}));ln({target:"Object",stat:!0,forced:ki},{keys:function(e){return Sn(ke(e))}});var Ai=function(e,t){var n=[][e];return!!n&&L((function(){n.call(null,t||function(){return 1},1)}))},Mi=Q([].join),Ui=$!=Object,Li=Ai("join",",");ln({target:"Array",proto:!0,forced:Ui||!Li},{join:function(e){return Mi(ne(this),void 0===e?",":e)}});var xi=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e=e.replace(r,(function(e){return e.toUpperCase()}))},Pi=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8",r=0;if("utf-16"===n)for(var i=0,s=e.length;i<s;i++)r+=(t=e.charCodeAt(i))<=65535?2:4;else for(var a=0,o=e.length;a<o;a++)r+=(t=e.charCodeAt(a))<127?1:t<=2047?2:t<=65535?3:4;return r},Di=function(e){return e.match(/\d+(\.\d+){2}/)[0]};N((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,s=Object.create(i.prototype),a=new O(r||[]);return s._invoke=function(e,t,n){var r=h;return function(i,s){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===i)throw s;return k()}for(n.method=i,n.arg=s;;){var a=n.delegate;if(a){var o=S(a,n);if(o){if(o===p)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(e,t,n);if("normal"===u.type){if(r=n.done?g:f,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=g,n.method="throw",n.arg=u.arg)}}}(e,n,a),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",f="suspendedYield",d="executing",g="completed",p={};function v(){}function y(){}function m(){}var _={};u(_,s,(function(){return this}));var E=Object.getPrototypeOf,T=E&&E(E(N([])));T&&T!==n&&r.call(T,s)&&(_=T);var R=m.prototype=v.prototype=Object.create(_);function I(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(i,s,a,o){var u=l(e[i],e,s);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,o)}),(function(e){n("throw",e,a,o)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,o)}))}o(u.arg)}var i;this._invoke=function(e,r){function s(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(s,s):s()}}function S(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=l(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var s=i.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function N(e){if(e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=m,u(R,"constructor",m),u(m,"constructor",y),y.displayName=u(m,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,o,"GeneratorFunction")),e.prototype=Object.create(R),e},e.awrap=function(e){return{__await:e}},I(C.prototype),u(C.prototype,a,(function(){return this})),e.AsyncIterator=C,e.async=function(t,n,r,i,s){void 0===s&&(s=Promise);var a=new C(c(t,n,r,i),s);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},I(R),u(R,o,"Generator"),u(R,s,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=N,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return o.type="throw",o.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));var Vi=Mt.EXISTS,Bi=ut.f,Fi=Function.prototype,Gi=Q(Fi.toString),ji=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,qi=Q(ji.exec);x&&!Vi&&Bi(Fi,"name",{configurable:!0,get:function(){try{return qi(ji,Gi(this))[1]}catch(e){return""}}});var Ki=Ge("unscopables"),Hi=Array.prototype;null==Hi[Ki]&&ut.f(Hi,Ki,{configurable:!0,value:Ln(null)});var Yi,Qi,Wi=function(e){Hi[Ki][e]=!0},Ji=Kt.includes;ln({target:"Array",proto:!0},{includes:function(e){return Ji(this,e,arguments.length>1?arguments[1]:void 0)}}),Wi("includes"),e.LogLevel=void 0,(Yi=e.LogLevel||(e.LogLevel={}))[Yi.LOG=0]="LOG",Yi[Yi.DEBUG=0]="DEBUG",Yi[Yi.INFO=1]="INFO",Yi[Yi.WARN=2]="WARN",Yi[Yi.ERROR=3]="ERROR",Yi[Yi.FATAL=4]="FATAL",Yi[Yi.NONE=1e3]="NONE",e.LogType=void 0,(Qi=e.LogType||(e.LogType={})).IM="IM",Qi.RTC="RTC";var zi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Zi=We("span").classList,Xi=Zi&&Zi.constructor&&Zi.constructor.prototype,$i=Xi===Object.prototype?void 0:Xi,es=Ci.forEach,ts=Ai("forEach")?[].forEach:function(e){return es(this,e,arguments.length>1?arguments[1]:void 0)},ns=function(e){if(e&&e.forEach!==ts)try{ct(e,"forEach",ts)}catch(t){e.forEach=ts}};for(var rs in zi)zi[rs]&&ns(U[rs]&&U[rs].prototype);ns($i);var is=U.Promise,ss=function(e,t,n){for(var r in t)Ut(e,r,t[r],n);return e},as=U.String,os=U.TypeError,us=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Q(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return tt(n),function(e){if("object"==typeof e||re(e))return e;throw os("Can't set "+as(e)+" as a prototype")}(r),t?e(n,r):n.__proto__=r,n}}():void 0),cs=ut.f,ls=Ge("toStringTag"),hs=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Me(e,ls)&&cs(e,ls,{configurable:!0,value:t})},fs=Ge("species"),ds=function(e){var t=ae(e),n=ut.f;x&&t&&!t[fs]&&n(t,fs,{configurable:!0,get:function(){return this}})},gs=U.TypeError,ps=function(e,t){if(oe(t,e))return e;throw gs("Incorrect invocation")},vs={},ys=Ge("iterator"),ms=Array.prototype,_s=function(e){return void 0!==e&&(vs.Array===e||ms[ys]===e)},Es=Ge("iterator"),Ts=function(e){if(null!=e)return Re(e,Es)||Re(e,"@@iterator")||vs[yn(e)]},Rs=U.TypeError,Is=function(e,t){var n=arguments.length<2?Ts(e):t;if(Te(n))return tt(V(n,e));throw Rs(_e(e)+" is not iterable")},Cs=function(e,t,n){var r,i;tt(e);try{if(!(r=Re(e,"return"))){if("throw"===t)throw n;return n}r=V(r,e)}catch(e){i=!0,r=e}if("throw"===t)throw n;if(i)throw r;return tt(r),n},Ss=U.TypeError,bs=function(e,t){this.stopped=e,this.result=t},ws=bs.prototype,Os=function(e,t,n){var r,i,s,a,o,u,c,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=Ti(t,l),p=function(e){return r&&Cs(r,"normal",e),new bs(!0,e)},v=function(e){return h?(tt(e),d?g(e[0],e[1],p):g(e[0],e[1])):d?g(e,p):g(e)};if(f)r=e;else{if(!(i=Ts(e)))throw Ss(_e(e)+" is not iterable");if(_s(i)){for(s=0,a=jt(e);a>s;s++)if((o=v(e[s]))&&oe(ws,o))return o;return new bs(!1)}r=Is(e,i)}for(u=r.next;!(c=V(u,r)).done;){try{o=v(c.value)}catch(e){Cs(r,"throw",e)}if("object"==typeof o&&o&&oe(ws,o))return o}return new bs(!1)},Ns=Ge("iterator"),ks=!1;try{var As=0,Ms={next:function(){return{done:!!As++}},return:function(){ks=!0}};Ms[Ns]=function(){return this},Array.from(Ms,(function(){throw 2}))}catch(e){}var Us,Ls,xs,Ps,Ds=function(e,t){if(!t&&!ks)return!1;var n=!1;try{var r={};r[Ns]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Vs=U.TypeError,Bs=function(e){if(_r(e))return e;throw Vs(_e(e)+" is not a constructor")},Fs=Ge("species"),Gs=function(e,t){var n,r=tt(e).constructor;return void 0===r||null==(n=tt(r)[Fs])?t:Bs(n)},js=U.TypeError,qs=function(e,t){if(e<t)throw js("Not enough arguments");return e},Ks=/(?:ipad|iphone|ipod).*applewebkit/i.test(ue),Hs="process"==z(U.process),Ys=U.setImmediate,Qs=U.clearImmediate,Ws=U.process,Js=U.Dispatch,zs=U.Function,Zs=U.MessageChannel,Xs=U.String,$s=0,ea={},ta="onreadystatechange";try{Us=U.location}catch(e){}var na=function(e){if(Me(ea,e)){var t=ea[e];delete ea[e],t()}},ra=function(e){return function(){na(e)}},ia=function(e){na(e.data)},sa=function(e){U.postMessage(Xs(e),Us.protocol+"//"+Us.host)};Ys&&Qs||(Ys=function(e){qs(arguments.length,1);var t=re(e)?e:zs(e),n=Jr(arguments,1);return ea[++$s]=function(){ri(t,void 0,n)},Ls($s),$s},Qs=function(e){delete ea[e]},Hs?Ls=function(e){Ws.nextTick(ra(e))}:Js&&Js.now?Ls=function(e){Js.now(ra(e))}:Zs&&!Ks?(Ps=(xs=new Zs).port2,xs.port1.onmessage=ia,Ls=Ti(Ps.postMessage,Ps)):U.addEventListener&&re(U.postMessage)&&!U.importScripts&&Us&&"file:"!==Us.protocol&&!L(sa)?(Ls=sa,U.addEventListener("message",ia,!1)):Ls=ta in We("script")?function(e){On.appendChild(We("script")).onreadystatechange=function(){On.removeChild(this),na(e)}}:function(e){setTimeout(ra(e),0)});var aa,oa,ua,ca,la,ha,fa,da,ga={set:Ys,clear:Qs},pa=/ipad|iphone|ipod/i.test(ue)&&void 0!==U.Pebble,va=/web0s(?!.*chrome)/i.test(ue),ya=Ze.f,ma=ga.set,_a=U.MutationObserver||U.WebKitMutationObserver,Ea=U.document,Ta=U.process,Ra=U.Promise,Ia=ya(U,"queueMicrotask"),Ca=Ia&&Ia.value;Ca||(aa=function(){var e,t;for(Hs&&(e=Ta.domain)&&e.exit();oa;){t=oa.fn,oa=oa.next;try{t()}catch(e){throw oa?ca():ua=void 0,e}}ua=void 0,e&&e.enter()},Ks||Hs||va||!_a||!Ea?!pa&&Ra&&Ra.resolve?((fa=Ra.resolve(void 0)).constructor=Ra,da=Ti(fa.then,fa),ca=function(){da(aa)}):Hs?ca=function(){Ta.nextTick(aa)}:(ma=Ti(ma,U),ca=function(){ma(aa)}):(la=!0,ha=Ea.createTextNode(""),new _a(aa).observe(ha,{characterData:!0}),ca=function(){ha.data=la=!la}));var Sa=Ca||function(e){var t={fn:e,next:void 0};ua&&(ua.next=t),oa||(oa=t,ca()),ua=t},ba=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=Te(t),this.reject=Te(n)},wa={f:function(e){return new ba(e)}},Oa=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Na=function(){this.head=null,this.tail=null};Na.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var ka,Aa,Ma,Ua,La=Na,xa="object"==typeof window,Pa=ga.set,Da=Ge("species"),Va="Promise",Ba=Ot.getterFor(Va),Fa=Ot.set,Ga=Ot.getterFor(Va),ja=is&&is.prototype,qa=is,Ka=ja,Ha=U.TypeError,Ya=U.document,Qa=U.process,Wa=wa.f,Ja=Wa,za=!!(Ya&&Ya.createEvent&&U.dispatchEvent),Za=re(U.PromiseRejectionEvent),Xa="unhandledrejection",$a=!1,eo=un(Va,(function(){var e=gt(qa),t=e!==String(qa);if(!t&&66===de)return!0;if(de>=51&&/native code/.test(e))return!1;var n=new qa((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(n.constructor={})[Da]=r,!($a=n.then((function(){}))instanceof r)||!t&&xa&&!Za})),to=eo||!Ds((function(e){qa.all(e).catch((function(){}))})),no=function(e){var t;return!(!ie(e)||!re(t=e.then))&&t},ro=function(e,t){var n,r,i,s=t.value,a=1==t.state,o=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{o?(a||(2===t.rejection&&uo(t),t.rejection=1),!0===o?n=s:(l&&l.enter(),n=o(s),l&&(l.exit(),i=!0)),n===e.promise?c(Ha("Promise-chain cycle")):(r=no(n))?V(r,n,u,c):u(n)):c(s)}catch(e){l&&!i&&l.exit(),c(e)}},io=function(e,t){e.notified||(e.notified=!0,Sa((function(){for(var n,r=e.reactions;n=r.get();)ro(n,e);e.notified=!1,t&&!e.rejection&&ao(e)})))},so=function(e,t,n){var r,i;za?((r=Ya.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),U.dispatchEvent(r)):r={promise:t,reason:n},!Za&&(i=U["on"+e])?i(r):e===Xa&&function(e,t){var n=U.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},ao=function(e){V(Pa,U,(function(){var t,n=e.facade,r=e.value;if(oo(e)&&(t=Oa((function(){Hs?Qa.emit("unhandledRejection",r,n):so(Xa,n,r)})),e.rejection=Hs||oo(e)?2:1,t.error))throw t.value}))},oo=function(e){return 1!==e.rejection&&!e.parent},uo=function(e){V(Pa,U,(function(){var t=e.facade;Hs?Qa.emit("rejectionHandled",t):so("rejectionhandled",t,e.value)}))},co=function(e,t,n){return function(r){e(t,r,n)}},lo=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,io(e,!0))},ho=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Ha("Promise can't be resolved itself");var r=no(t);r?Sa((function(){var n={done:!1};try{V(r,t,co(ho,n,e),co(lo,n,e))}catch(t){lo(n,t,e)}})):(e.value=t,e.state=1,io(e,!1))}catch(t){lo({done:!1},t,e)}}};if(eo&&(Ka=(qa=function(e){ps(this,Ka),Te(e),V(ka,this);var t=Ba(this);try{e(co(ho,t),co(lo,t))}catch(e){lo(t,e)}}).prototype,(ka=function(e){Fa(this,{type:Va,done:!1,notified:!1,parent:!1,reactions:new La,rejection:!1,state:0,value:void 0})}).prototype=ss(Ka,{then:function(e,t){var n=Ga(this),r=Wa(Gs(this,qa));return n.parent=!0,r.ok=!re(e)||e,r.fail=re(t)&&t,r.domain=Hs?Qa.domain:void 0,0==n.state?n.reactions.add(r):Sa((function(){ro(r,n)})),r.promise},catch:function(e){return this.then(void 0,e)}}),Aa=function(){var e=new ka,t=Ba(e);this.promise=e,this.resolve=co(ho,t),this.reject=co(lo,t)},wa.f=Wa=function(e){return e===qa||e===Ma?new Aa(e):Ja(e)},re(is)&&ja!==Object.prototype)){Ua=ja.then,$a||(Ut(ja,"then",(function(e,t){var n=this;return new qa((function(e,t){V(Ua,n,e,t)})).then(e,t)}),{unsafe:!0}),Ut(ja,"catch",Ka.catch,{unsafe:!0}));try{delete ja.constructor}catch(e){}us&&us(ja,Ka)}ln({global:!0,wrap:!0,forced:eo},{Promise:qa}),hs(qa,Va,!1),ds(Va),Ma=ae(Va),ln({target:Va,stat:!0,forced:eo},{reject:function(e){var t=Wa(this);return V(t.reject,void 0,e),t.promise}}),ln({target:Va,stat:!0,forced:eo},{resolve:function(e){return function(e,t){if(tt(e),ie(t)&&t.constructor===e)return t;var n=wa.f(e);return(0,n.resolve)(t),n.promise}(this,e)}}),ln({target:Va,stat:!0,forced:to},{all:function(e){var t=this,n=Wa(t),r=n.resolve,i=n.reject,s=Oa((function(){var n=Te(t.resolve),s=[],a=0,o=1;Os(e,(function(e){var u=a++,c=!1;o++,V(n,t,e).then((function(e){c||(c=!0,s[u]=e,--o||r(s))}),i)})),--o||r(s)}));return s.error&&i(s.value),n.promise},race:function(e){var t=this,n=Wa(t),r=n.reject,i=Oa((function(){var i=Te(t.resolve);Os(e,(function(e){V(i,t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var fo="RC_Logs";function go(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(fo),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var s=i({},n.objectStoreParams);r=e.createObjectStore(t,s),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,fo,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var po=function(){function e(){u(this,e)}return l(e,[{key:"addList",value:function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),s=i.objectStore(t);n.forEach((function(e){null==s||s.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))}},{key:"getRangeData",value:function(t,n,r,i){return new Promise((function(s){if(e._db){var a=e._db.transaction([t],"readwrite").objectStore(t),o=IDBKeyRange.bound(r,i),u=a.index(n),c=[],l=u.openCursor(o);l.onsuccess=function(e){var t=e.target.result;t?(c.push(t.value),t.continue()):s(c)},l.onerror=function(e){console.error(e),s([])}}else s([])}))}},{key:"getCount",value: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)}))}},{key:"removeFirstData",value:function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),s=i.getAllKeys(IDBKeyRange.lowerBound(0),r);s.onsuccess=function(){var e=s.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))}}],[{key:"init",value: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 ".concat(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 ".concat(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 ".concat(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,go(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();po._db=null;var vo=Ge("match"),yo=function(e){var t;return ie(e)&&(void 0!==(t=e[vo])?!!t:"RegExp"==z(e))},mo=U.Array,_o=Math.max,Eo=function(e,t,n){for(var r=jt(e),i=Bt(t,r),s=Bt(void 0===n?r:n,r),a=mo(_o(s-i,0)),o=0;i<s;i++,o++)lr(a,o,e[i]);return a.length=o,a},To=Cn.UNSUPPORTED_Y,Ro=4294967295,Io=Math.min,Co=[].push,So=Q(/./.exec),bo=Q(Co),wo=Q("".slice),Oo=!L((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));$n("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=_n(te(this)),i=void 0===n?Ro:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!yo(e))return V(t,r,e,i);for(var s,a,o,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(s=V(zn,h,r))&&!((a=h.lastIndex)>l&&(bo(u,wo(r,l,s.index)),s.length>1&&s.index<r.length&&ri(Co,u,Eo(s,1)),o=s[0].length,l=a,u.length>=i));)h.lastIndex===s.index&&h.lastIndex++;return l===r.length?!o&&So(h,"")||bo(u,""):bo(u,wo(r,l)),u.length>i?Eo(u,0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:V(t,this,e,n)}:t,[function(t,n){var i=te(this),s=null==t?void 0:Re(t,e);return s?V(s,t,i,n):V(r,_n(i),t,n)},function(e,i){var s=tt(this),a=_n(e),o=n(r,s,a,i,r!==t);if(o.done)return o.value;var u=Gs(s,RegExp),c=s.unicode,l=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(To?"g":"y"),h=new u(To?"^(?:"+s.source+")":s,l),f=void 0===i?Ro:i>>>0;if(0===f)return[];if(0===a.length)return null===ur(h,a)?[a]:[];for(var d=0,g=0,p=[];g<a.length;){h.lastIndex=To?0:g;var v,y=ur(h,To?wo(a,g):a);if(null===y||(v=Io(Gt(h.lastIndex+(To?g:0)),a.length))===d)g=ar(a,g,c);else{if(bo(p,wo(a,d,g)),p.length===f)return p;for(var m=1;m<=y.length-1;m++)if(bo(p,y[m]),p.length===f)return p;g=d=v}}return bo(p,wo(a,d)),p}]}),!Oo,To);var No=Mt.PROPER,ko="toString",Ao=RegExp.prototype,Mo=Ao.toString,Uo=Q(En),Lo=L((function(){return"/a/b"!=Mo.call({source:"a",flags:"b"})})),xo=No&&Mo.name!=ko;(Lo||xo)&&Ut(RegExp.prototype,ko,(function(){var e=tt(this),t=_n(e.source),n=e.flags;return"/"+t+"/"+_n(void 0===n&&oe(Ao,e)&&!("flags"in Ao)?Uo(e):n)}),{unsafe:!0});var Po,Do=function(e,t){return e+Math.floor(Math.random()*(t-e))},Vo=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)}))},Bo=function(){var e=Vo();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var s=r%n;r=(r-s)/n,i.unshift(t[s])}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.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(Po||(Po={}));var Fo,Go=Po;!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"}(Fo||(Fo={}));var jo,qo=Fo,Ko=function(e){return"string"==typeof e},Ho=function(e){return"boolean"==typeof e},Yo=function(e){return"number"==typeof e&&!isNaN(e)},Qo=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Wo=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Jo=function(e){return Ko(e)&&e.length>0},zo=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Zo=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Xo=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},$o=function(e){return"[object Null]"===Object.prototype.toString.call(e)},eu=function(e){for(var t in e)return!0;return!1},tu=function(e){var t=!1;if(zo(e))for(var n in e)if(t=Ko(n)&&!/^[A-Za-z0-9_=+-]+$/.test(n))break;return t},nu={};console&&(h(jo={},e.LogLevel.DEBUG,console.debug.bind(console)),h(jo,e.LogLevel.INFO,console.info.bind(console)),h(jo,e.LogLevel.WARN,console.warn.bind(console)),h(jo,e.LogLevel.ERROR,console.error.bind(console)),h(jo,e.LogLevel.FATAL,console.log.bind(console)),nu=jo);var ru=function(e){return Ko(e)||Yo(e)||Xo(e)||Ho(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},iu=function(){function t(n,r,i){u(this,t),this.tag=n,this.type=r,this.initiator=i,this._outLevel=e.LogLevel.WARN,this.debug=this.log.bind(this,e.LogLevel.DEBUG),this.info=this.log.bind(this,e.LogLevel.INFO),this.warn=this.log.bind(this,e.LogLevel.WARN),this.error=this.log.bind(this,e.LogLevel.ERROR),this.fatal=this.log.bind(this,e.LogLevel.FATAL)}var n;return l(t,[{key:"_defaultStdout",value:function(e,t){if(nu[e]){for(var n,r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];(n=nu)[e].apply(n,["".concat(t,":")].concat(i))}}},{key:"__pushLocalLog",value:function(n,r,i){var s;s=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?e.LogType.RTC:e.LogType.IM;var a=Date.now();Pi(r)>=1e3&&(r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf-8";if(!e||!t)return"";var r="utf-8"===n?3:2,i=0,s=0,a="";for(s=0;s<e.length;s++){if(e.charCodeAt(s)>255?i+=r:i++,i>t)return a;a+=e.charAt(s)}return e}(r,1e3));var o=JSON.stringify({message:r,userId:t.userId}).replace(/"/g,'""'),u=/^[\w]+-[\w]+-[\w]+?/.test(i)?i:"".concat(this.initiator||"L","-").concat(i,"-O"),c={sessionId:t.sessionId,time:a,level:4-n,content:"".concat(t.sessionId,",").concat(Date.now(),",").concat(s,",").concat(4-n,",").concat(u,',"').concat(o,'"\n'),userId:t.userId};t.databaseLogList.push(c),(t.databaseLogList.length>=100||n===e.LogLevel.FATAL)&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=o(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=S(t.databaseLogList),t.databaseLogList=[],!(r=po.getInstance())){e.next=14;break}return e.next=6,r.addList(fo,n);case 6:return i=e.sent,e.next=9,r.getCount(fo,"time");case 9:return e.sent>1e5&&r.removeFirstData(fo,"time",2e3),e.abrupt("return",i);case 14:return e.abrupt("return",!1);case 15:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"setLogLevel",value:function(t){this._outLevel="number"!=typeof t?e.LogLevel.WARN:t}},{key:"setLogStdout",value:function(e){this._logStdout=e}},{key:"log",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(t>e.LogLevel.DEBUG&&this.__pushLocalLog(t,r.map(ru).join(" "),this.tag),!(t<this._outLevel)){var s="".concat((new Date).toISOString(),"[").concat(this.tag,"][").concat(e.LogLevel[t],"]"),a="".concat(s," - ").concat(r.map(ru).join(" "));this._logStdout?this._logStdout(t,a):this._stdout?this._stdout(t,a):this._defaultStdout.apply(this,[t,s].concat(r))}}},{key:"reportLog",value:function(e,n,r){this.__pushLocalLog(4-e,r,n);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'.concat(i,'"');var s={level:e,content:[t.sessionId,Date.now(),this.type,e,n,i].join()+"\n"};t.realTimeLogList.push(s),t.realTimeLogList.length>=600&&(t.realTimeLogList=t.realTimeLogList.slice(-500))}},{key:"set",value:function(e,t){this.warn("logger.set has being deprecated!")}},{key:"setStdout",value:function(e){this._stdout=e}},{key:"__clearRealTimeLog",value:function(){t.realTimeLogList=[]}}],[{key:"init",value:function(e){t.userId=e}},{key:"reset",value:function(){t.userId=""}}]),t}();iu.databaseLogList=[],iu.realTimeLogList=[],iu.sessionId=Bo(),iu.userId="";var su=new iu("RCLog"),au=Cr("splice"),ou=U.TypeError,uu=Math.max,cu=Math.min,lu=9007199254740991,hu="Maximum allowed length exceeded";ln({target:"Array",proto:!0,forced:!au},{splice:function(e,t){var n,r,i,s,a,o,u=ke(this),c=jt(u),l=Bt(e,c),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=cu(uu(Pt(t),0),c-l)),c+n-r>lu)throw ou(hu);for(i=Rr(u,r),s=0;s<r;s++)(a=l+s)in u&&lr(i,s,u[a]);if(i.length=r,n<r){for(s=l;s<c-r;s++)o=s+n,(a=s+r)in u?u[o]=u[a]:delete u[o];for(s=c;s>c-r+n;s--)delete u[s-1]}else if(n>r)for(s=c-r;s>l;s--)o=s+n-1,(a=s+r-1)in u?u[o]=u[a]:delete u[o];for(s=0;s<n;s++)u[s+l]=arguments[s+2];return u.length=c-r+n,i}});var fu,du=function(){function e(){u(this,e),this._map={}}return l(e,[{key:"on",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})}},{key:"once",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})}},{key:"off",value:function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])}},{key:"emit",value:function(e){var t=this._map[e];if(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var s=t.length-1;s>=0;s-=1){var a=t[s],o=a.target,u=a.once,c=a.listener;u&&t.splice(s,1);try{c.call.apply(c,[o].concat(r))}catch(e){su.error(e)}}}}},{key:"removeAll",value:function(e){delete this._map[e]}},{key:"clear",value:function(){Object.keys(this._map).forEach(this.removeAll,this)}}]),e}();!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(fu||(fu={}));var gu,pu=fu;!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.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",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"}(gu||(gu={}));var vu,yu=gu;!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"}(vu||(vu={}));var mu,_u=vu,Eu={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR: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"}(mu||(mu={}));var Tu,Ru=mu;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Tu||(Tu={}));var Iu,Cu=Tu;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Iu||(Iu={}));var Su,bu=Iu;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(Su||(Su={}));var wu,Ou=Su;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(wu||(wu={}));var Nu,ku=wu;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Nu||(Nu={}));var Au,Mu=Nu;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Au||(Au={}));var Uu,Lu,xu,Pu=Au;e.RTCMode=void 0,(Uu=e.RTCMode||(e.RTCMode={}))[Uu.RTC=0]="RTC",Uu[Uu.LIVE=2]="LIVE",e.LiveType=void 0,(Lu=e.LiveType||(e.LiveType={}))[Lu.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",Lu[Lu.AUDIO=1]="AUDIO",e.LiveRole=void 0,(xu=e.LiveRole||(e.LiveRole={}))[xu.ANCHOR=1]="ANCHOR",xu[xu.AUDIENCE=2]="AUDIENCE";var Du,Vu,Bu,Fu={"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"};e.RTCApiType=void 0,(Du=e.RTCApiType||(e.RTCApiType={}))[Du.ROOM=1]="ROOM",Du[Du.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(Vu=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[Vu.AnchorToViewer=1]="AnchorToViewer",Vu[Vu.ViewerToAnchor=2]="ViewerToAnchor",e.RTCJoinType=void 0,(Bu=e.RTCJoinType||(e.RTCJoinType={}))[Bu.KICK=0]="KICK",Bu[Bu.REFUSE=1]="REFUSE",Bu[Bu.COEXIST=2]="COEXIST";var Gu=U.RangeError,ju=Q((function(e){var t=_n(te(this)),n="",r=Pt(e);if(r<0||r==1/0)throw Gu("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n})),qu=Q("".slice),Ku=Math.ceil,Hu=function(e){return function(t,n,r){var i,s,a=_n(te(t)),o=Gt(n),u=a.length,c=void 0===r?" ":_n(r);return o<=u||""==c?a:((s=ju(c,Ku((i=o-u)/c.length))).length>i&&(s=qu(s,0,i)),e?a+s:s+a)}},Yu={start:Hu(!1),end:Hu(!0)},Qu=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(ue),Wu=Yu.start;ln({target:"String",proto:!0,forced:Qu},{padStart:function(e){return Wu(this,e,arguments.length>1?arguments[1]:void 0)}});var Ju,zu,Zu={engine:"5.2.1-alpha.2"},Xu=function(){function e(){u(this,e)}return l(e,null,[{key:"add",value:function(e,t){Zu[e]=t}},{key:"validEngine",value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return su.warn("The validation engine version '".concat(e,"' is invalid!")),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Zu.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n}},{key:"getInfo",value:function(){return Zu}}]),e}();e.AssertRules=void 0,(zu=e.AssertRules||(e.AssertRules={}))[zu.STRING=0]="STRING",zu[zu.ONLY_STRING=1]="ONLY_STRING",zu[zu.NUMBER=2]="NUMBER",zu[zu.BOOLEAN=3]="BOOLEAN",zu[zu.OBJECT=4]="OBJECT",zu[zu.ARRAY=5]="ARRAY",zu[zu.CALLBACK=6]="CALLBACK",zu[zu.CHANNEL_ID=7]="CHANNEL_ID";var $u=(h(Ju={},e.AssertRules.STRING,Jo),h(Ju,e.AssertRules.ONLY_STRING,Ko),h(Ju,e.AssertRules.NUMBER,Yo),h(Ju,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),h(Ju,e.AssertRules.OBJECT,zo),h(Ju,e.AssertRules.ARRAY,Qo),h(Ju,e.AssertRules.CALLBACK,(function(e){var t=!0;return zo(e)||(t=!1),(e=e||{}).onSuccess&&!Zo(e.onSuccess)&&(t=!1),e.onError&&!Zo(e.onError)&&(t=!1),t})),h(Ju,e.AssertRules.CHANNEL_ID,(function(e){var t=!1;return Ko(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t})),Ju),ec=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,e)).name="RCAssertError",r}return l(n)}(m(Error)),tc=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=$u[n]||n;var i=r&&!n(t)||!r&&!(Xo(t)||null===t||n(t));return i&&su.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},nc=/MSIE .\./.test(ue),rc=U.Function,ic=function(e){return function(t,n){var r=qs(arguments.length,1)>2,i=re(t)?t:rc(t),s=r?Jr(arguments,2):void 0;return e(r?function(){ri(i,this,s)}:i,n)}};ln({global:!0,bind:!0,forced:nc},{setTimeout:ic(U.setTimeout),setInterval:ic(U.setInterval)});var sc=function(e,t,n){var r,i;return us&&re(r=t.constructor)&&r!==n&&ie(i=r.prototype)&&i!==n.prototype&&us(e,i),e},ac=ut.f,oc=zt.f,uc=Ot.enforce,cc=Ge("match"),lc=U.RegExp,hc=lc.prototype,fc=U.SyntaxError,dc=Q(En),gc=Q(hc.exec),pc=Q("".charAt),vc=Q("".replace),yc=Q("".indexOf),mc=Q("".slice),_c=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Ec=/a/g,Tc=/a/g,Rc=new lc(Ec)!==Ec,Ic=Cn.MISSED_STICKY,Cc=Cn.UNSUPPORTED_Y,Sc=x&&(!Rc||Ic||Pn||Vn||L((function(){return Tc[cc]=!1,lc(Ec)!=Ec||lc(Tc)==Tc||"/a/i"!=lc(Ec,"i")})));if(un("RegExp",Sc)){for(var bc=function(e,t){var n,r,i,s,a,o,u=oe(hc,this),c=yo(e),l=void 0===t,h=[],f=e;if(!u&&c&&l&&e.constructor===bc)return e;if((c||oe(hc,e))&&(e=e.source,l&&(t="flags"in f?f.flags:dc(f))),e=void 0===e?"":_n(e),t=void 0===t?"":_n(t),f=e,Pn&&"dotAll"in Ec&&(r=!!t&&yc(t,"s")>-1)&&(t=vc(t,/s/g,"")),n=t,Ic&&"sticky"in Ec&&(i=!!t&&yc(t,"y")>-1)&&Cc&&(t=vc(t,/y/g,"")),Vn&&(s=function(e){for(var t,n=e.length,r=0,i="",s=[],a={},o=!1,u=!1,c=0,l="";r<=n;r++){if("\\"===(t=pc(e,r)))t+=pc(e,++r);else if("]"===t)o=!1;else if(!o)switch(!0){case"["===t:o=!0;break;case"("===t:gc(_c,mc(e,r+1))&&(r+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===l||Me(a,l))throw new fc("Invalid capture group name");a[l]=!0,s[s.length]=[l,c],u=!1,l="";continue}u?l+=t:i+=t}return[i,s]}(e),e=s[0],h=s[1]),a=sc(lc(e,t),u?this:hc,bc),(r||i||h.length)&&(o=uc(a),r&&(o.dotAll=!0,o.raw=bc(function(e){for(var t,n=e.length,r=0,i="",s=!1;r<=n;r++)"\\"!==(t=pc(e,r))?s||"."!==t?("["===t?s=!0:"]"===t&&(s=!1),i+=t):i+="[\\s\\S]":i+=t+pc(e,++r);return i}(e),n)),i&&(o.sticky=!0),h.length&&(o.groups=h)),e!==f)try{ct(a,"source",""===f?"(?:)":f)}catch(e){}return a},wc=function(e){e in bc||ac(bc,e,{configurable:!0,get:function(){return lc[e]},set:function(t){lc[e]=t}})},Oc=oc(lc),Nc=0;Oc.length>Nc;)wc(Oc[Nc++]);hc.constructor=bc,bc.prototype=hc,Ut(U,"RegExp",bc)}ds("RegExp");var kc,Ac,Mc,Uc=function(e){if(!zo(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)},Lc=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Vo(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),s=(new Date).getTime(),a="";if(t){var o=t.split(".");a="."+o[o.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(s).concat(r).concat(a)},xc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.threadId,r=e.apnsCollapseId,i=e.category,s=e.richMediaUri,a=t.channelIdMi,o=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h={};h["thread-id"]=n||"",h["apns-collapse-id"]=r||"",h.category=i||"",h.richMediaUri=s||"";var f={};f.collapse_key=null==l?void 0:l.collapseKey,f.imageUrl=null==l?void 0:l.imageUrl;var d=null==l?void 0:l.priority;d&&!["high","normal"].includes(d)&&(d="normal"),f.priority=d;var g=[{HW:{channelId:o||""}},{MI:{channelId:a||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:h},{FCM:f}];return JSON.stringify(g)},Pc=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,s,a,o=Object.keys(e);if(0!==o.length){var u=o[0];switch(u){case"HW":return void(r.channelIdHW=null===(t=e[u])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[u])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(s=e[u])||void 0===s?void 0:s.channelId);case"VIVO":return void(r.typeVivo=null===(a=e[u])||void 0===a?void 0:a.classification);case"APNS":return n.threadId=e[u]["thread-id"],n.apnsCollapseId=e[u]["apns-collapse-id"],n.category=e[u].category,void(n.richMediaUri=e[u].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[u].collapse_key||"",imageUrl:e[u].imageUrl||"",priority:e[u].priority||""}}}}))}catch(t){su.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},Dc=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Vc=function(e){var t=e.length;return t<=4096&&t>=1},Bc=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;zo(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Qo(e)||Ko(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,s=e.length;i<s;i++)t(e[i],i)}()},Fc=function(e,t){return Bc(e,(function(n,r){e[r]=t(n,r)})),e},Gc=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return Bc(e,(function(e,r){t===e&&(n=r)})),n},jc=function(e,t){var n=[];return Bc(e,(function(e){n.push(e)})),-1!==Gc(n,t)},qc=function(e){return JSON.parse(JSON.stringify(e))},Kc=function(){return"undefined"!=typeof RCCppEngine},Hc=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 s in i)if(i.hasOwnProperty(s)){var a=r.match(i[s]);if(a){n=s,t=a[1]||a[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Yc=function(e){switch(e){case Eu.SERVER_UNAVAILABLE:return yu.SERVER_UNAVAILABLE;case Eu.TOKEN_INCORRECT:return yu.RC_CONN_USER_OR_PASSWD_ERROR;case Eu.REDIRECT:return yu.RC_CONN_REDIRECTED;case Eu.APP_BLOCK_OR_DELETE:return yu.RC_CONN_APP_BLOCKED_OR_DELETED;case Eu.BLOCK:return yu.RC_CONN_USER_BLOCKED;case Eu.TOKEN_EXPIRE:return yu.RC_CONN_USER_OR_PASSWD_ERROR;case Eu.HOSTNAME_ERROR:return yu.HOSTNAME_ERROR;case Eu.HASOHTERSAMECLIENTONLINE:return yu.HAS_OHTER_SAME_CLIENT_ON_LINE;case Eu.APP_AUTH_NOT_PASS:return yu.RC_APP_AUTH_NOT_PASS;case Eu.OTP_USED:return yu.RC_OTP_USED;case Eu.PLATFORM_ERROR:return yu.RC_PLATFORM_ERROR;default:return yu.RC_NET_UNAVAILABLE}},Qc=function e(t){var n;if("object"===s(t))if(Array.isArray(t))for(var r in n=[],t)n.push(e(t[r]));else for(var i in n={},t)n[i]=e(t[i]);else n=t;return n},Wc=function(e){var t;try{t=Qc(e)}catch(n){su.error("clone err:",n),t=JSON.parse(JSON.stringify(e))}return t},Jc=function(e){var t={},n=JSON.parse(e);return Bc(n,(function(e,n){t[n]=e.v})),t},zc={_delayTime:0,setTime:function(e){var t=(new Date).getTime();zc._delayTime=t-e},getTime:function(){var e=zc._delayTime;return(new Date).getTime()-e}},Zc=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},Xc=!L((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),$c=mt("IE_PROTO"),el=U.Object,tl=el.prototype,nl=Xc?el.getPrototypeOf:function(e){var t=ke(e);if(Me(t,$c))return t[$c];var n=t.constructor;return re(n)&&t instanceof n?n.prototype:t instanceof el?tl:null},rl=Ge("iterator"),il=!1;[].keys&&("next"in(Mc=[].keys())?(Ac=nl(nl(Mc)))!==Object.prototype&&(kc=Ac):il=!0);var sl=null==kc||L((function(){var e={};return kc[rl].call(e)!==e}));sl&&(kc={}),re(kc[rl])||Ut(kc,rl,(function(){return this}));var al={IteratorPrototype:kc,BUGGY_SAFARI_ITERATORS:il},ol=al.IteratorPrototype,ul=function(){return this},cl=Mt.PROPER,ll=Mt.CONFIGURABLE,hl=al.IteratorPrototype,fl=al.BUGGY_SAFARI_ITERATORS,dl=Ge("iterator"),gl="keys",pl="values",vl="entries",yl=function(){return this},ml=function(e,t,n,r,i,s,a){!function(e,t,n,r){var i=t+" Iterator";e.prototype=Ln(ol,{next:j(+!r,n)}),hs(e,i,!1),vs[i]=ul}(n,t,r);var o,u,c,l=function(e){if(e===i&&p)return p;if(!fl&&e in d)return d[e];switch(e){case gl:case pl:case vl:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",f=!1,d=e.prototype,g=d[dl]||d["@@iterator"]||i&&d[i],p=!fl&&g||l(i),v="Array"==t&&d.entries||g;if(v&&(o=nl(v.call(new e)))!==Object.prototype&&o.next&&(nl(o)!==hl&&(us?us(o,hl):re(o[dl])||Ut(o,dl,yl)),hs(o,h,!0)),cl&&i==pl&&g&&g.name!==pl&&(ll?ct(d,"name",pl):(f=!0,p=function(){return V(g,this)})),i)if(u={values:l(pl),keys:s?p:l(gl),entries:l(vl)},a)for(c in u)(fl||f||!(c in d))&&Ut(d,c,u[c]);else ln({target:t,proto:!0,forced:fl||f},u);return d[dl]!==p&&Ut(d,dl,p,{name:i}),vs[t]=p,u},_l=ut.f,El="Array Iterator",Tl=Ot.set,Rl=Ot.getterFor(El),Il=ml(Array,"Array",(function(e,t){Tl(this,{type:El,target:ne(e),index:0,kind:t})}),(function(){var e=Rl(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),Cl=vs.Arguments=vs.Array;if(Wi("keys"),Wi("values"),Wi("entries"),x&&"values"!==Cl.name)try{_l(Cl,"name",{value:"values"})}catch(e){}var Sl="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,bl=U.RangeError,wl=function(e){if(void 0===e)return 0;var t=Pt(e),n=Gt(t);if(t!==n)throw bl("Wrong length or index");return n},Ol=U.Array,Nl=Math.abs,kl=Math.pow,Al=Math.floor,Ml=Math.log,Ul=Math.LN2,Ll=function(e,t,n){var r,i,s,a=Ol(n),o=8*n-t-1,u=(1<<o)-1,c=u>>1,l=23===t?kl(2,-24)-kl(2,-77):0,h=e<0||0===e&&1/e<0?1:0,f=0;for((e=Nl(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=Al(Ml(e)/Ul),e*(s=kl(2,-r))<1&&(r--,s*=2),(e+=r+c>=1?l/s:l*kl(2,1-c))*s>=2&&(r++,s/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*s-1)*kl(2,t),r+=c):(i=e*kl(2,c-1)*kl(2,t),r=0));t>=8;)a[f++]=255&i,i/=256,t-=8;for(r=r<<t|i,o+=t;o>0;)a[f++]=255&r,r/=256,o-=8;return a[--f]|=128*h,a},xl=function(e,t){var n,r=e.length,i=8*r-t-1,s=(1<<i)-1,a=s>>1,o=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;o>0;)l=256*l+e[u--],o-=8;for(n=l&(1<<-o)-1,l>>=-o,o+=t;o>0;)n=256*n+e[u--],o-=8;if(0===l)l=1-a;else{if(l===s)return n?NaN:c?-1/0:1/0;n+=kl(2,t),l-=a}return(c?-1:1)*n*kl(2,l-t)},Pl=function(e){for(var t=ke(this),n=jt(t),r=arguments.length,i=Bt(r>1?arguments[1]:void 0,n),s=r>2?arguments[2]:void 0,a=void 0===s?n:Bt(s,n);a>i;)t[i++]=e;return t},Dl=zt.f,Vl=ut.f,Bl=Mt.PROPER,Fl=Mt.CONFIGURABLE,Gl=Ot.get,jl=Ot.set,ql="ArrayBuffer",Kl="DataView",Hl="Wrong index",Yl=U.ArrayBuffer,Ql=Yl,Wl=Ql&&Ql.prototype,Jl=U.DataView,zl=Jl&&Jl.prototype,Zl=Object.prototype,Xl=U.Array,$l=U.RangeError,eh=Q(Pl),th=Q([].reverse),nh=Ll,rh=xl,ih=function(e){return[255&e]},sh=function(e){return[255&e,e>>8&255]},ah=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},oh=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},uh=function(e){return nh(e,23,4)},ch=function(e){return nh(e,52,8)},lh=function(e,t){Vl(e.prototype,t,{get:function(){return Gl(this)[t]}})},hh=function(e,t,n,r){var i=wl(n),s=Gl(e);if(i+t>s.byteLength)throw $l(Hl);var a=Gl(s.buffer).bytes,o=i+s.byteOffset,u=Eo(a,o,o+t);return r?u:th(u)},fh=function(e,t,n,r,i,s){var a=wl(n),o=Gl(e);if(a+t>o.byteLength)throw $l(Hl);for(var u=Gl(o.buffer).bytes,c=a+o.byteOffset,l=r(+i),h=0;h<t;h++)u[c+h]=l[s?h:t-h-1]};if(Sl){var dh=Bl&&Yl.name!==ql;if(L((function(){Yl(1)}))&&L((function(){new Yl(-1)}))&&!L((function(){return new Yl,new Yl(1.5),new Yl(NaN),dh&&!Fl})))dh&&Fl&&ct(Yl,"name",ql);else{(Ql=function(e){return ps(this,Wl),new Yl(wl(e))}).prototype=Wl;for(var gh,ph=Dl(Yl),vh=0;ph.length>vh;)(gh=ph[vh++])in Ql||ct(Ql,gh,Yl[gh]);Wl.constructor=Ql}us&&nl(zl)!==Zl&&us(zl,Zl);var yh=new Jl(new Ql(2)),mh=Q(zl.setInt8);yh.setInt8(0,2147483648),yh.setInt8(1,2147483649),!yh.getInt8(0)&&yh.getInt8(1)||ss(zl,{setInt8:function(e,t){mh(this,e,t<<24>>24)},setUint8:function(e,t){mh(this,e,t<<24>>24)}},{unsafe:!0})}else Wl=(Ql=function(e){ps(this,Wl);var t=wl(e);jl(this,{bytes:eh(Xl(t),0),byteLength:t}),x||(this.byteLength=t)}).prototype,zl=(Jl=function(e,t,n){ps(this,zl),ps(e,Wl);var r=Gl(e).byteLength,i=Pt(t);if(i<0||i>r)throw $l("Wrong offset");if(i+(n=void 0===n?r-i:Gt(n))>r)throw $l("Wrong length");jl(this,{buffer:e,byteLength:n,byteOffset:i}),x||(this.buffer=e,this.byteLength=n,this.byteOffset=i)}).prototype,x&&(lh(Ql,"byteLength"),lh(Jl,"buffer"),lh(Jl,"byteLength"),lh(Jl,"byteOffset")),ss(zl,{getInt8:function(e){return hh(this,1,e)[0]<<24>>24},getUint8:function(e){return hh(this,1,e)[0]},getInt16:function(e){var t=hh(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=hh(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return oh(hh(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return oh(hh(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return rh(hh(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return rh(hh(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){fh(this,1,e,ih,t)},setUint8:function(e,t){fh(this,1,e,ih,t)},setInt16:function(e,t){fh(this,2,e,sh,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){fh(this,2,e,sh,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){fh(this,4,e,ah,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){fh(this,4,e,ah,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){fh(this,4,e,uh,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){fh(this,8,e,ch,t,arguments.length>2?arguments[2]:void 0)}});hs(Ql,ql),hs(Jl,Kl);var _h={ArrayBuffer:Ql,DataView:Jl},Eh=_h.ArrayBuffer,Th=_h.DataView,Rh=Th.prototype,Ih=Q(Eh.prototype.slice),Ch=Q(Rh.getUint8),Sh=Q(Rh.setUint8),bh=L((function(){return!new Eh(2).slice(1,void 0).byteLength}));ln({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:bh},{slice:function(e,t){if(Ih&&void 0===t)return Ih(tt(this),e);for(var n=tt(this).byteLength,r=Bt(e,n),i=Bt(void 0===t?n:t,n),s=new(Gs(this,Eh))(Gt(i-r)),a=new Th(this),o=new Th(s),u=0;r<i;)Sh(o,u++,Ch(a,r++));return s}});var wh,Oh,Nh,kh=ut.f,Ah=U.Int8Array,Mh=Ah&&Ah.prototype,Uh=U.Uint8ClampedArray,Lh=Uh&&Uh.prototype,xh=Ah&&nl(Ah),Ph=Mh&&nl(Mh),Dh=Object.prototype,Vh=U.TypeError,Bh=Ge("toStringTag"),Fh=Pe("TYPED_ARRAY_TAG"),Gh=Pe("TYPED_ARRAY_CONSTRUCTOR"),jh=Sl&&!!us&&"Opera"!==yn(U.opera),qh=!1,Kh={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Hh={BigInt64Array:8,BigUint64Array:8},Yh=function(e){if(!ie(e))return!1;var t=yn(e);return Me(Kh,t)||Me(Hh,t)};for(wh in Kh)(Nh=(Oh=U[wh])&&Oh.prototype)?ct(Nh,Gh,Oh):jh=!1;for(wh in Hh)(Nh=(Oh=U[wh])&&Oh.prototype)&&ct(Nh,Gh,Oh);if((!jh||!re(xh)||xh===Function.prototype)&&(xh=function(){throw Vh("Incorrect invocation")},jh))for(wh in Kh)U[wh]&&us(U[wh],xh);if((!jh||!Ph||Ph===Dh)&&(Ph=xh.prototype,jh))for(wh in Kh)U[wh]&&us(U[wh].prototype,Ph);if(jh&&nl(Lh)!==Ph&&us(Lh,Ph),x&&!Me(Ph,Bh))for(wh in qh=!0,kh(Ph,Bh,{get:function(){return ie(this)?this[Fh]:void 0}}),Kh)U[wh]&&ct(U[wh],Fh,wh);var Qh={NATIVE_ARRAY_BUFFER_VIEWS:jh,TYPED_ARRAY_CONSTRUCTOR:Gh,TYPED_ARRAY_TAG:qh&&Fh,aTypedArray:function(e){if(Yh(e))return e;throw Vh("Target is not a typed array")},aTypedArrayConstructor:function(e){if(re(e)&&(!us||oe(xh,e)))return e;throw Vh(_e(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(x){if(n)for(var i in Kh){var s=U[i];if(s&&Me(s.prototype,e))try{delete s.prototype[e]}catch(n){try{s.prototype[e]=t}catch(e){}}}Ph[e]&&!n||Ut(Ph,e,n?t:jh&&Mh[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(x){if(us){if(n)for(r in Kh)if((i=U[r])&&Me(i,e))try{delete i[e]}catch(e){}if(xh[e]&&!n)return;try{return Ut(xh,e,n?t:jh&&xh[e]||t)}catch(e){}}for(r in Kh)!(i=U[r])||i[e]&&!n||Ut(i,e,t)}},isView:function(e){if(!ie(e))return!1;var t=yn(e);return"DataView"===t||Me(Kh,t)||Me(Hh,t)},isTypedArray:Yh,TypedArray:xh,TypedArrayPrototype:Ph},Wh=Qh.NATIVE_ARRAY_BUFFER_VIEWS,Jh=U.ArrayBuffer,zh=U.Int8Array,Zh=!Wh||!L((function(){zh(1)}))||!L((function(){new zh(-1)}))||!Ds((function(e){new zh,new zh(null),new zh(1.5),new zh(e)}),!0)||L((function(){return 1!==new zh(new Jh(2),1,void 0).length})),Xh=Math.floor,$h=Number.isInteger||function(e){return!ie(e)&&isFinite(e)&&Xh(e)===e},ef=U.RangeError,tf=U.RangeError,nf=function(e,t){var n=function(e){var t=Pt(e);if(t<0)throw ef("The argument can't be less than 0");return t}(e);if(n%t)throw tf("Wrong offset");return n},rf=Qh.aTypedArrayConstructor,sf=function(e){var t,n,r,i,s,a,o=Bs(this),u=ke(e),c=arguments.length,l=c>1?arguments[1]:void 0,h=void 0!==l,f=Ts(u);if(f&&!_s(f))for(a=(s=Is(u,f)).next,u=[];!(i=V(a,s)).done;)u.push(i.value);for(h&&c>2&&(l=Ti(l,arguments[2])),n=jt(u),r=new(rf(o))(n),t=0;n>t;t++)r[t]=h?l(u[t],t):u[t];return r},af=N((function(e){var t=zt.f,n=Ci.forEach,r=Ot.get,i=Ot.set,s=ut.f,a=Ze.f,o=Math.round,u=U.RangeError,c=_h.ArrayBuffer,l=c.prototype,h=_h.DataView,f=Qh.NATIVE_ARRAY_BUFFER_VIEWS,d=Qh.TYPED_ARRAY_CONSTRUCTOR,g=Qh.TYPED_ARRAY_TAG,p=Qh.TypedArray,v=Qh.TypedArrayPrototype,y=Qh.aTypedArrayConstructor,m=Qh.isTypedArray,_="BYTES_PER_ELEMENT",E="Wrong length",T=function(e,t){y(e);for(var n=0,r=t.length,i=new e(r);r>n;)i[n]=t[n++];return i},R=function(e,t){s(e,t,{get:function(){return r(this)[t]}})},I=function(e){var t;return oe(l,e)||"ArrayBuffer"==(t=yn(e))||"SharedArrayBuffer"==t},C=function(e,t){return m(e)&&!ye(t)&&t in e&&$h(+t)&&t>=0},S=function(e,t){return t=He(t),C(e,t)?j(2,e[t]):a(e,t)},b=function(e,t,n){return t=He(t),!(C(e,t)&&ie(n)&&Me(n,"value"))||Me(n,"get")||Me(n,"set")||n.configurable||Me(n,"writable")&&!n.writable||Me(n,"enumerable")&&!n.enumerable?s(e,t,n):(e[t]=n.value,e)};x?(f||(Ze.f=S,ut.f=b,R(v,"buffer"),R(v,"byteOffset"),R(v,"byteLength"),R(v,"length")),ln({target:"Object",stat:!0,forced:!f},{getOwnPropertyDescriptor:S,defineProperty:b}),e.exports=function(e,a,l){var y=e.match(/\d+$/)[0]/8,R=e+(l?"Clamped":"")+"Array",C="get"+e,S="set"+e,b=U[R],w=b,O=w&&w.prototype,N={},k=function(e,t){s(e,t,{get:function(){return function(e,t){var n=r(e);return n.view[C](t*y+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var i=r(e);l&&(n=(n=o(n))<0?0:n>255?255:255&n),i.view[S](t*y+i.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};f?Zh&&(w=a((function(e,t,n,r){return ps(e,O),sc(ie(t)?I(t)?void 0!==r?new b(t,nf(n,y),r):void 0!==n?new b(t,nf(n,y)):new b(t):m(t)?T(w,t):V(sf,w,t):new b(wl(t)),e,w)})),us&&us(w,p),n(t(b),(function(e){e in w||ct(w,e,b[e])})),w.prototype=O):(w=a((function(e,t,n,r){ps(e,O);var s,a,o,l=0,f=0;if(ie(t)){if(!I(t))return m(t)?T(w,t):V(sf,w,t);s=t,f=nf(n,y);var d=t.byteLength;if(void 0===r){if(d%y)throw u(E);if((a=d-f)<0)throw u(E)}else if((a=Gt(r)*y)+f>d)throw u(E);o=a/y}else o=wl(t),s=new c(a=o*y);for(i(e,{buffer:s,byteOffset:f,byteLength:a,length:o,view:new h(s)});l<o;)k(e,l++)})),us&&us(w,p),O=w.prototype=Ln(v)),O.constructor!==w&&ct(O,"constructor",w),ct(O,d,w),g&&ct(O,g,R),N[R]=w,ln({global:!0,forced:w!=b,sham:!f},N),_ in w||ct(w,_,y),_ in O||ct(O,_,y),ds(R)}):e.exports=function(){}}));af("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var of=Math.min,uf=[].copyWithin||function(e,t){var n=ke(this),r=jt(n),i=Bt(e,r),s=Bt(t,r),a=arguments.length>2?arguments[2]:void 0,o=of((void 0===a?r:Bt(a,r))-s,r-i),u=1;for(s<i&&i<s+o&&(u=-1,s+=o-1,i+=o-1);o-- >0;)s in n?n[i]=n[s]:delete n[i],i+=u,s+=u;return n},cf=Q(uf),lf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("copyWithin",(function(e,t){return cf(lf(this),e,t,arguments.length>2?arguments[2]:void 0)}));var hf=Ci.every,ff=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("every",(function(e){return hf(ff(this),e,arguments.length>1?arguments[1]:void 0)}));var df=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return V(Pl,df(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var gf=Qh.TYPED_ARRAY_CONSTRUCTOR,pf=Qh.aTypedArrayConstructor,vf=function(e){return pf(Gs(e,e[gf]))},yf=function(e,t){return function(e,t){for(var n=0,r=jt(t),i=new e(r);r>n;)i[n]=t[n++];return i}(vf(e),t)},mf=Ci.filter,_f=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("filter",(function(e){var t=mf(_f(this),e,arguments.length>1?arguments[1]:void 0);return yf(this,t)}));var Ef=Ci.find,Tf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("find",(function(e){return Ef(Tf(this),e,arguments.length>1?arguments[1]:void 0)}));var Rf=Ci.findIndex,If=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("findIndex",(function(e){return Rf(If(this),e,arguments.length>1?arguments[1]:void 0)}));var Cf=Ci.forEach,Sf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("forEach",(function(e){Cf(Sf(this),e,arguments.length>1?arguments[1]:void 0)}));var bf=Kt.includes,wf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("includes",(function(e){return bf(wf(this),e,arguments.length>1?arguments[1]:void 0)}));var Of=Kt.indexOf,Nf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("indexOf",(function(e){return Of(Nf(this),e,arguments.length>1?arguments[1]:void 0)}));var kf=Ge("iterator"),Af=U.Uint8Array,Mf=Q(Il.values),Uf=Q(Il.keys),Lf=Q(Il.entries),xf=Qh.aTypedArray,Pf=Qh.exportTypedArrayMethod,Df=Af&&Af.prototype,Vf=!L((function(){Df[kf].call([1])})),Bf=!!Df&&Df.values&&Df[kf]===Df.values&&"values"===Df.values.name,Ff=function(){return Mf(xf(this))};Pf("entries",(function(){return Lf(xf(this))}),Vf),Pf("keys",(function(){return Uf(xf(this))}),Vf),Pf("values",Ff,Vf||!Bf,{name:"values"}),Pf(kf,Ff,Vf||!Bf,{name:"values"});var Gf=Qh.aTypedArray,jf=Qh.exportTypedArrayMethod,qf=Q([].join);jf("join",(function(e){return qf(Gf(this),e)}));var Kf=Math.min,Hf=[].lastIndexOf,Yf=!!Hf&&1/[1].lastIndexOf(1,-0)<0,Qf=Ai("lastIndexOf"),Wf=Yf||!Qf?function(e){if(Yf)return ri(Hf,this,arguments)||0;var t=ne(this),n=jt(t),r=n-1;for(arguments.length>1&&(r=Kf(r,Pt(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Hf,Jf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return ri(Wf,Jf(this),t>1?[e,arguments[1]]:[e])}));var zf=Ci.map,Zf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("map",(function(e){return zf(Zf(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(vf(e))(t)}))}));var Xf=U.TypeError,$f=function(e){return function(t,n,r,i){Te(n);var s=ke(t),a=$(s),o=jt(s),u=e?o-1:0,c=e?-1:1;if(r<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:o<=u)throw Xf("Reduce of empty array with no initial value")}for(;e?u>=0:o>u;u+=c)u in a&&(i=n(i,a[u],u,s));return i}},ed={left:$f(!1),right:$f(!0)},td=ed.left,nd=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return td(nd(this),e,t,t>1?arguments[1]:void 0)}));var rd=ed.right,id=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return rd(id(this),e,t,t>1?arguments[1]:void 0)}));var sd=Qh.aTypedArray,ad=Qh.exportTypedArrayMethod,od=Math.floor;ad("reverse",(function(){for(var e,t=this,n=sd(t).length,r=od(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var ud=U.RangeError,cd=U.Int8Array,ld=cd&&cd.prototype,hd=ld&&ld.set,fd=Qh.aTypedArray,dd=Qh.exportTypedArrayMethod,gd=!L((function(){var e=new Uint8ClampedArray(2);return V(hd,e,{length:1,0:3},1),3!==e[1]})),pd=gd&&Qh.NATIVE_ARRAY_BUFFER_VIEWS&&L((function(){var e=new cd(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));dd("set",(function(e){fd(this);var t=nf(arguments.length>1?arguments[1]:void 0,1),n=ke(e);if(gd)return V(hd,this,n,t);var r=this.length,i=jt(n),s=0;if(i+t>r)throw ud("Wrong length");for(;s<i;)this[t+s]=n[s++]}),!gd||pd);var vd=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("slice",(function(e,t){for(var n=Jr(vd(this),e,t),r=vf(this),i=0,s=n.length,a=new r(s);s>i;)a[i]=n[i++];return a}),L((function(){new Int8Array(1).slice()})));var yd=Ci.some,md=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("some",(function(e){return yd(md(this),e,arguments.length>1?arguments[1]:void 0)}));var _d=Math.floor,Ed=function(e,t){var n=e.length,r=_d(n/2);return n<8?Td(e,t):Rd(e,Ed(Eo(e,0,r),t),Ed(Eo(e,r),t),t)},Td=function(e,t){for(var n,r,i=e.length,s=1;s<i;){for(r=s,n=e[s];r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==s++&&(e[r]=n)}return e},Rd=function(e,t,n,r){for(var i=t.length,s=n.length,a=0,o=0;a<i||o<s;)e[a+o]=a<i&&o<s?r(t[a],n[o])<=0?t[a++]:n[o++]:a<i?t[a++]:n[o++];return e},Id=Ed,Cd=ue.match(/firefox\/(\d+)/i),Sd=!!Cd&&+Cd[1],bd=/MSIE|Trident/.test(ue),wd=ue.match(/AppleWebKit\/(\d+)\./),Od=!!wd&&+wd[1],Nd=U.Array,kd=Qh.aTypedArray,Ad=Qh.exportTypedArrayMethod,Md=U.Uint16Array,Ud=Md&&Q(Md.prototype.sort),Ld=!(!Ud||L((function(){Ud(new Md(2),null)}))&&L((function(){Ud(new Md(2),{})}))),xd=!!Ud&&!L((function(){if(de)return de<74;if(Sd)return Sd<67;if(bd)return!0;if(Od)return Od<602;var e,t,n=new Md(516),r=Nd(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(Ud(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==r[e])return!0}));Ad("sort",(function(e){return void 0!==e&&Te(e),xd?Ud(this,e):Id(kd(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))}),!xd||Ld);var Pd=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("subarray",(function(e,t){var n=Pd(this),r=n.length,i=Bt(e,r);return new(vf(n))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,Gt((void 0===t?r:Bt(t,r))-i))}));var Dd=U.Int8Array,Vd=Qh.aTypedArray,Bd=Qh.exportTypedArrayMethod,Fd=[].toLocaleString,Gd=!!Dd&&L((function(){Fd.call(new Dd(1))}));Bd("toLocaleString",(function(){return ri(Fd,Gd?Jr(Vd(this)):Vd(this),Jr(arguments))}),L((function(){return[1,2].toLocaleString()!=new Dd([1,2]).toLocaleString()}))||!L((function(){Dd.prototype.toLocaleString.call([1,2])})));var jd=Qh.exportTypedArrayMethod,qd=U.Uint8Array,Kd=qd&&qd.prototype||{},Hd=[].toString,Yd=Q([].join);L((function(){Hd.call({})}))&&(Hd=function(){return Yd(this)});var Qd=Kd.toString!=Hd;jd("toString",Hd,Qd);var Wd=Ge("iterator"),Jd=Ge("toStringTag"),zd=Il.values,Zd=function(e,t){if(e){if(e[Wd]!==zd)try{ct(e,Wd,zd)}catch(t){e[Wd]=zd}if(e[Jd]||ct(e,Jd,t),zi[t])for(var n in Il)if(e[n]!==Il[n])try{ct(e,n,Il[n])}catch(t){e[n]=Il[n]}}};for(var Xd in zi)Zd(U[Xd]&&U[Xd].prototype,Xd);Zd($i,"DOMTokenList");var $d=Object.assign,eg=Object.defineProperty,tg=Q([].concat),ng=!$d||L((function(){if(x&&1!==$d({b:1},$d(eg({},"a",{enumerable:!0,get:function(){eg(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=$d({},e)[n]||Sn($d({},t)).join("")!=r}))?function(e,t){for(var n=ke(e),r=arguments.length,i=1,s=Zt.f,a=G.f;r>i;)for(var o,u=$(arguments[i++]),c=s?tg(Sn(u),s(u)):Sn(u),l=c.length,h=0;l>h;)o=c[h++],x&&!V(a,u,o)||(n[o]=u[o]);return n}:$d;ln({target:"Object",stat:!0,forced:Object.assign!==ng},{assign:ng});var rg=U.TypeError,ig=function(e){if(yo(e))throw rg("The method doesn't accept regular expressions");return e},sg=Ge("match"),ag=Q("".indexOf);ln({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[sg]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~ag(_n(te(this)),_n(ig(e)),arguments.length>1?arguments[1]:void 0)}});var og,ug,cg,lg,hg,fg=Q(1..valueOf),dg=Q("".replace),gg="[\t\n\v\f\r                 \u2028\u2029\ufeff]",pg=RegExp("^"+gg+gg+"*"),vg=RegExp(gg+gg+"*$"),yg=function(e){return function(t){var n=_n(te(t));return 1&e&&(n=dg(n,pg,"")),2&e&&(n=dg(n,vg,"")),n}},mg={start:yg(1),end:yg(2),trim:yg(3)},_g=zt.f,Eg=Ze.f,Tg=ut.f,Rg=mg.trim,Ig="Number",Cg=U.Number,Sg=Cg.prototype,bg=U.TypeError,wg=Q("".slice),Og=Q("".charCodeAt),Ng=function(e){var t=Ke(e,"number");return"bigint"==typeof t?t:kg(t)},kg=function(e){var t,n,r,i,s,a,o,u,c=Ke(e,"number");if(ye(c))throw bg("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=Rg(c),43===(t=Og(c,0))||45===t){if(88===(n=Og(c,2))||120===n)return NaN}else if(48===t){switch(Og(c,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(a=(s=wg(c,2)).length,o=0;o<a;o++)if((u=Og(s,o))<48||u>i)return NaN;return parseInt(s,r)}return+c};if(un(Ig,!Cg(" 0o1")||!Cg("0b1")||Cg("+0x1"))){for(var Ag,Mg=function(e){var t=arguments.length<1?0:Cg(Ng(e)),n=this;return oe(Sg,n)&&L((function(){fg(n)}))?sc(Object(t),n,Mg):t},Ug=x?_g(Cg):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),Lg=0;Ug.length>Lg;Lg++)Me(Cg,Ag=Ug[Lg])&&!Me(Mg,Ag)&&Tg(Mg,Ag,Eg(Cg,Ag));Mg.prototype=Sg,Sg.constructor=Mg,Ut(U,Ig,Mg)}!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"}(og||(og={})),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"}(ug||(ug={})),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"}(cg||(cg={})),function(e){e.PUB="pub",e.QUERY="qry"}(lg||(lg={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(hg||(hg={}));var xg,Pg=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:og.AT_LEAST_ONCE,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];u(this,e),this._retain=!1,this.qos=og.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var s=t>0;t&&s&&1===arguments.length?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=8==(8&t)):(this.type=t,this._retain=n,this.qos=r,this._dup=i)}return l(e,[{key:"encode",value:function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0}}]),e}(),Dg=function(){function e(){u(this,e)}return l(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ko(e))for(var i=0,s=e.length;i<s;i++){var a=e.charCodeAt(i);a>=0&&a<=127?(r+=1,n.push(a)):a>=128&&a<=2047?(r+=2,n.push(192|31&a>>6),n.push(128|63&a)):a>=2048&&a<=65535&&(r+=3,n.push(224|15&a>>12),n.push(128|63&a>>6),n.push(128|63&a))}for(var o=0,u=n.length;o<u;o++)n[o]>255&&(n[o]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)}},{key:"readUTF",value:function(e){for(var t,n,r=[],i=-1,s=e,a="";++i<s.length;){var o=Number(s[i]);if(o===(127&o)||(240==(240&o)?o=(o=(o=(o^=240)<<6|128^s[++i])<<6|128^s[++i])<<6|128^s[++i]:224==(224&o)?o=(o=(o^=224)<<6|128^s[++i])<<6|128^s[++i]:192==(192&o)&&(o=(o^=192)<<6|128^s[++i])),!isFinite(o)||o<0||o>1114111||Math.floor(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(t=(o-=65536)>>10|55296,n=o%1024|56320,r.push(t,n)),(i+1===s.length||r.length>16384)&&(a+=String.fromCharCode.apply(null,r),r.length=0)}return a}}]),e}(),Vg=function(){function e(t){u(this,e),this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return l(e,[{key:"check",value:function(){return this._position>=this._pool.length}},{key:"read2Byte",value: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)}},{key:"readInt",value: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)}},{key:"readLong",value: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)}},{key:"readByte",value:function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e}},{key:"readUTF",value:function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return Dg.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),Bg=function(){function e(){u(this,e),this._pool=[],this._position=0,this._writen=0}return l(e,[{key:"write",value: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}},{key:"writeArr",value:function(e){return this._pool=this._pool.concat(e),e}},{key:"writeUTF",value:function(e){var t=Dg.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),Fg="UpStreamMessage",Gg="PushExtra",jg="DownStreamMessage",qg="DownStreamMessages",Kg="SessionsAttQryInput",Hg="SessionsAttOutput",Yg="SyncRequestMsg",Qg="ChrmPullMsg",Wg="NotifyMsg",Jg="HistoryMsgInput",zg="HistoryMsgOuput",Zg="RelationQryInput",Xg="RelationsOutput",$g="DeleteSessionsInput",ep="SessionInfo",tp="DeleteSessionsOutput",np="RelationsInput",rp="DeleteMsgInput",ip="CleanHisMsgInput",sp="SessionMsgReadInput",ap="ChrmInput",op="ChrmOutput",up="QueryChatRoomInfoInput",cp="QueryChatRoomInfoOutput",lp="RtcInput",hp="RtcUserListOutput",fp="SetUserStatusInput",dp="RtcSetDataInput",gp="RtcUserSetDataInput",pp="RtcDataInput",vp="RtcSetOutDataInput",yp="MCFollowInput",mp="RtcTokenOutput",_p="RtcQryOutput",Ep="RtcQryUserOutDataInput",Tp="RtcUserOutDataOutput",Rp="RtcQueryListInput",Ip="RtcRoomInfoOutput",Cp="RtcValueInfo",Sp="RtcKeyDeleteInput",bp="GetQNupTokenInput",wp="GetQNupTokenOutput",Op="GetQNdownloadUrlInput",Np="GetDownloadUrlInput",kp="GetQNdownloadUrlOutput",Ap="GetDownloadUrlOutput",Mp="SetChrmKV",Up="SetChrmKVS",Lp="DeleteChrmKVS",xp="ChrmKVOutput",Pp="ChrmKVSOutput",Dp="ChrmKVSOutputEntity",Vp="QueryChrmKV",Bp="SetUserSettingInput",Fp="SetUserSettingOutput",Gp="PullUserSettingInput",jp="PullUserSettingOutput",qp="UserSettingNotification",Kp="SessionReq",Hp="SessionStates",Yp="SessionState",Qp="SessionStateItem",Wp="SessionStateModifyReq",Jp="SessionStateModifyResp",zp="GrpReadReceiptMsg",Zp="GrpReadReceiptQryReq",Xp="GrpReadReceiptQryResp",$p="GrpMsgReadUser",ev="SessionTagAddInput",tv="SessionTagItem",nv="SessionTagDelInput",rv="SessionDisTagReq",iv="ReportSDKInput",sv="ReportSDKOutput",av="UltraGrpPullSes",ov="UltraGrpPullMsg",uv="MsgChangeReq",cv="QueryMsgChange",lv="MsgChange",hv="MsgChangeList",fv="MsgQuery",dv="MessageQueryInfo",gv="MsgQueryAck",pv="OperateStatus",vv="OperateStatusNotify",yv="OperateInfo",mv="OperateSummary",_v="RtcNotifyMsg",Ev="RtcPullKV",Tv="RtcKVOutput",Rv="RtcQueryUserJoinedInput",Iv="RtcQueryUserJoinedOutput",Cv="RtcViewerJoinedOutput",Sv="RtcInviteInput",bv="RtcCancelInviteInput",wv="RtcInviteAnswerInput",Ov="RtcEndInviteInput",Nv=(h(xg={},Fg,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"]),h(xg,qg,["list","syncTime","finished"]),h(xg,jg,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"]),h(xg,Gg,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),h(xg,Kg,["nothing"]),h(xg,Hg,["inboxTime","sendboxTime","totalUnreadCount"]),h(xg,Yg,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),h(xg,Qg,["syncTime","count"]),h(xg,Wg,["type","time","chrmId"]),h(xg,Jg,["targetId","time","count","order","busChannel"]),h(xg,zg,["list","syncTime","hasMsg"]),h(xg,Zg,["type","count","startTime","order"]),h(xg,Xg,["info","isFinished"]),h(xg,$g,["sessions"]),h(xg,ep,["type","channelId","busChannel"]),h(xg,tp,["nothing"]),h(xg,np,["type","msg","count","busChannel","startTime","endTime"]),h(xg,rp,["type","conversationId","msgs","busChannel"]),h(xg,ip,["targetId","dataTime","conversationType","busChannel"]),h(xg,sp,["type","msgTime","channelId","busChannel"]),h(xg,ap,["nothing"]),h(xg,op,["nothing","sessionId","joinTime"]),h(xg,up,["count","order"]),h(xg,cp,["userTotalNums","userInfos"]),h(xg,bp,["type","key","httpMethod","queryString"]),h(xg,Op,["type","key","fileName"]),h(xg,Np,["type","key","fileName"]),h(xg,wp,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),h(xg,kp,["downloadUrl"]),h(xg,Ap,["downloadUrl"]),h(xg,Mp,["entry","bNotify","notification","type"]),h(xg,Up,["entry","bNotify","notification","type"]),h(xg,Lp,["entry","bNotify","notification","type"]),h(xg,xp,["entries","bFullUpdate","syncTime"]),h(xg,Pp,["timestamp","errorKeys"]),h(xg,Dp,["key","errorCode"]),h(xg,Vp,["timestamp"]),h(xg,Bp,["version","value"]),h(xg,Fp,["version","reserve"]),h(xg,Gp,["version","reserve"]),h(xg,jp,["items","version"]),h(xg,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),h(xg,Kp,["time"]),h(xg,Hp,["version","state"]),h(xg,Yp,["type","channelId","time","stateItem","busChannel"]),h(xg,Qp,["sessionStateType","value","tags"]),h(xg,Wp,["version","state"]),h(xg,Jp,["version"]),h(xg,zp,["msgId","busChannel"]),h(xg,Zp,["msgId","busChannel"]),h(xg,Xp,["totalMemberNum","list"]),h(xg,$p,["readTime","userId"]),h(xg,ev,["version","tags"]),h(xg,tv,["tagId","name","createdTime","isTop"]),h(xg,nv,["version","tags"]),h(xg,rv,["tagId"]),h(xg,qp,["version","reserve"]),h(xg,iv,["sdkInfo"]),h(xg,sv,["nothing"]),h(xg,av,["syncTime","isEraseMsgContent"]),h(xg,ov,["syncTime"]),h(xg,uv,["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"]),h(xg,cv,["syncTime"]),h(xg,hv,["list","syncTime","hasNext"]),h(xg,lv,["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId"]),h(xg,fv,["targetId","type","query"]),h(xg,dv,["msgTime","msgUID","busChannel"]),h(xg,gv,["list"]),h(xg,pv,["targetId","type","opType","busChannel"]),h(xg,vv,["type","notifyType","info","summary"]),h(xg,yv,["targetId","busChannel","userId","opType","optime"]),h(xg,mv,["targetId","busChannel","count","opType"]),h(xg,lp,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"]),h(xg,hp,["users","token","sessionId","roomInfo"]),h(xg,fp,["status"]),h(xg,dp,["interior","target","key","value","objectName","content"]),h(xg,gp,["valueInfo","objectName","content"]),h(xg,pp,["interior","target","key","objectName","content"]),h(xg,vp,["target","valueInfo","objectName","content"]),h(xg,yp,["state"]),h(xg,mp,["rtcToken"]),h(xg,_p,["outInfo"]),h(xg,Ep,["userId"]),h(xg,Tp,["user"]),h(xg,Rp,["order"]),h(xg,Ip,["roomId","roomData","userCount","list"]),h(xg,Cp,["key","value"]),h(xg,Sp,["key"]),h(xg,_v,["type","time","roomId"]),h(xg,Ev,["timestamp","roomId"]),h(xg,Tv,["entries","bFullUpdate","syncTime"]),h(xg,Rv,["userId"]),h(xg,Iv,["info"]),h(xg,Sv,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),h(xg,bv,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),h(xg,wv,["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),h(xg,Ov,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),xg),kv={},Av=function(e){var t=Nv[e];kv[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(xi(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},kv[e].decode=function(e){var t={};Ko(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(xi(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Mv in Nv)Av(Mv);kv.getModule=function(e){return kv[e]()},af("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Uv,Lv="\npackage Modules;\nmessage probuf {\n message ".concat(fp,"\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 ").concat(Wg," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Yg," {\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 ").concat(Fg," {\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 ").concat(Gg," {\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 ").concat(qg," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(jg," {\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 optional int64 extStatus = 20; // 消息的扩展标记 第0位,表示送达状态: 0x01 表示已送达;断档: 0x02 表示是否需要执行断档策略; 消息修改: 0x04 拉取历史消息时表示该消息是否修改过\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(qo.IMAGE,";\n audio = ").concat(qo.AUDIO,";\n video = ").concat(qo.VIDEO,";\n file = ").concat(qo.FILE,";\n }\n message ").concat(bp," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(Op," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Np," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(wp," {\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 ").concat(kp," {\n required string downloadUrl = 1;\n }\n message ").concat(Ap," {\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 ").concat(ap," {\n required int32 nothing = 1;\n }\n message ").concat(op," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(Qg," {\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 ").concat(Zg,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(np,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(Xg,"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\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 optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(ip,"\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 ").concat(up,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(cp,"\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 ").concat(yp,"\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 ").concat(Jg,"\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 ").concat(zg,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Rp,"{\n optional int32 order=1;\n }\n\n message ").concat(Sp,"{\n repeated string key=1;\n }\n\n message ").concat(Cp,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Cp," userData=2; //用户资源信息\n }\n\n message ").concat(hp,"{\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 ").concat(Cp," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(lp,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(Cp," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Cp," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\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 ").concat(_p,"{\n repeated ").concat(Cp," outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message ").concat(pp,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(dp,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(gp," {\n repeated ").concat(Cp," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Cp," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(mp,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(vp,"{\n required targetType target=1;\n repeated ").concat(Cp," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Ep,"{\n repeated string userId = 1;\n }\n message ").concat(Tp,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Kg,"{\n required int32 nothing = 1;\n }\n message ").concat(Hg,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(sp,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat($g,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(ep,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(tp,"\n {\n optional int32 nothing=1;\n }\n message ").concat(rp,"\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 ").concat(Mp," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Up," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Lp," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(xp," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(Pp," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message ").concat(Dp,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Vp," {\n required int64 timestamp = 1;\n }\n message ").concat(Bp," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Fp," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Gp," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(jp," {\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 ").concat(Kp," {\n required int64 time = 1;\n }\n message ").concat(Hp," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Yp," {\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 ").concat(Qp," {\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 ").concat(Wp," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Jp," {\n required int64 version=1;\n }\n message ").concat(zp," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Zp," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Xp," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat($p," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(ev," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(tv," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(nv," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(rv," {\n repeated string tagId=1;\n }\n message ").concat(qp," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(iv,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(sv,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(_v," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Ev,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(Tv,"\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 ").concat(Rv,"\n {\n required string userId = 1;\n }\n message ").concat(Iv,"\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 ").concat(Cv,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Sv,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(bv,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(wv,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(Ov,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(av,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(ov,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(uv,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(cv," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(hv," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message MsgChange //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0,设为 1 时,IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 新加 - 消息变更的操作人Id\n }\n message ").concat(fv," //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message ").concat(gv," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(pv," //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message ").concat(vv," //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message ").concat(yv," {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message ").concat(mv," {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n}\n"),xv=/"/g,Pv=Q("".replace);ln({target:"String",proto:!0,forced:(Uv="sub",L((function(){var e=""[Uv]('"');return e!==e.toLowerCase()||e.split('"').length>3})))},{sub:function(){return e="sub",t="",n="",r=_n(te(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+Pv(_n(n),xv,"&quot;")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var Dv="ArrayBuffer",Vv=_h.ArrayBuffer,Bv=U.ArrayBuffer;ln({global:!0,forced:Bv!==Vv},{ArrayBuffer:Vv}),ds(Dv),ln({target:"Array",proto:!0},{fill:Pl}),Wi("fill");var Fv,Gv,jv,qv,Kv,Hv,Yv,Qv=(Fv=Lv,Gv=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,s;return t?(s=(e>>>=0)>=0&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),s&&(u[e]=n),n):(s=(e|=0)>=-128&&e<128)&&(r=o[e])?r:(n=i(e,e<0?-1:0,!1),s&&(o[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?p:g;if(t){if(e<0)return p;if(e>=h)return E}else{if(-f>=e)return T;if(e+1>=f)return _}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function s(e,t,n){var i,a,o,u,l,h,f;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;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 s(e.substring(1),t,n).neg();for(a=r(c(n,8)),o=g,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(f=r(c(n,l)),o=o.mul(f).add(r(h))):o=(o=o.mul(a)).add(r(h));return o.unsigned=t,o}function a(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?s(t):i(t.low,t.high,t.unsigned)}var o,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,o={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=s,e.fromValue=a,f=(h=(l=4294967296)*l)/2,d=n(16777216),g=n(0),e.ZERO=g,p=n(0,!0),e.UZERO=p,v=n(1),e.ONE=v,y=n(1,!0),e.UONE=y,m=n(-1),e.NEG_ONE=m,_=i(-1,2147483647,!1),e.MAX_VALUE=_,E=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=E,T=i(0,-2147483648,!1),e.MIN_VALUE=T,(R=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},R.toString=function(e){var t,n,i,s,a,o,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(T)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(s=r(c(e,6),this.unsigned),a=this,o="";;){if(u=a.div(s),l=(a.sub(u.mul(s)).toInt()>>>0).toString(e),(a=u).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(T)?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},R.isZero=function(){return 0===this.high&&0===this.low},R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return 1==(1&this.low)},R.isEven=function(){return 0==(1&this.low)},R.equals=function(e){return t(e)||(e=a(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.compare=function(e){if(t(e)||(e=a(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},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},R.neg=R.negate,R.add=function(e){var n,r,s,o,u,c,l,h,f,d,g;return t(e)||(e=a(e)),n=this.high>>>16,r=65535&this.high,s=this.low>>>16,o=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,f=0,d=0,g=0,d+=(g+=o+(65535&e.low))>>>16,f+=(d+=s+l)>>>16,h+=(f+=r+c)>>>16,h+=n+u,i((d&=65535)<<16|(g&=65535),(h&=65535)<<16|(f&=65535),this.unsigned)},R.subtract=function(e){return t(e)||(e=a(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){var n,s,o,u,c,l,h,f,p,v,y,m;return this.isZero()?g:(t(e)||(e=a(e)),e.isZero()?g:this.eq(T)?e.isOdd()?T:g:e.eq(T)?this.isOdd()?T:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(d)&&e.lt(d)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,s=65535&this.high,o=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=0,v=0,y=0,m=0,y+=(m+=u*(f=65535&e.low))>>>16,v+=(y+=o*f)>>>16,y&=65535,v+=(y+=u*h)>>>16,p+=(v+=s*f)>>>16,v&=65535,p+=(v+=o*h)>>>16,v&=65535,p+=(v+=u*l)>>>16,p+=n*f+s*h+o*l+u*c,i((y&=65535)<<16|(m&=65535),(p&=65535)<<16|(v&=65535),this.unsigned)))},R.mul=R.multiply,R.divide=function(e){var n,i,s,o,u,l,h;if(t(e)||(e=a(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return p;if(e.gt(this.shru(1)))return y;s=p}else{if(this.eq(T))return e.eq(v)||e.eq(m)?T:e.eq(T)?v:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:m:(i=this.sub(e.mul(n)),s=n.add(i.div(e)));if(e.eq(T))return this.unsigned?p:g;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();s=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),u=(o=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,o-48),h=(l=r(n)).mul(e);h.isNegative()||h.gt(i);)h=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=v),s=s.add(l),i=i.sub(h)}return s},R.div=R.divide,R.modulo=function(e){return t(e)||(e=a(e)),this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.not=function(){return i(~this.low,~this.high,this.unsigned)},R.and=function(e){return t(e)||(e=a(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return t(e)||(e=a(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return t(e)||(e=a(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},R.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)},R.shl=R.shiftLeft,R.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)},R.shr=R.shiftRight,R.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))},R.shru=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.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]},R.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}(),jv=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("")+u.apply(String,e):(e.length+arguments.length>1024&&(t.push(u.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var s,a,o=8*i-r-1,u=(1<<o)-1,c=u>>1,l=-7,h=n?i-1:0,f=n?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=o;l>0;s=256*s+e[t+h],h+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=r;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),s-=c}return(d?-1:1)*a*Math.pow(2,s-r)}function i(e,t,n,r,i,s){var a,o,u,c=8*s-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,g=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(t*u-1)*Math.pow(2,i),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&o,d+=g,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;e[n+d]=255&a,d+=g,a/=256,c-=8);e[n+d-g]|=128*p}var a,o,u,c,l,h=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?o: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 h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=e||null,(a=h.prototype).__isByteBuffer__,Object.defineProperty(a,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),u=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(e,t,n){return new h(e,t,n)},h.concat=function(e,t,n,r){var i,s,a,o,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,a=0,o=e.length;o>a;++a)h.isByteBuffer(e[a])||(e[a]=h.wrap(e[a],t)),(s=e[a].limit-e[a].offset)>0&&(i+=s);if(0===i)return new h(0,n,r);for(c=new h(i,n,r),a=0;o>a;)(s=(u=e[a++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=s);return c.limit=c.offset,c.offset=0,c},h.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},h.type=function(){return ArrayBuffer},h.wrap=function(e,t,n,r){var i,o;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return h.fromBase64(e,n);case"hex":return h.fromHex(e,n);case"binary":return h.fromBinary(e,n);case"utf8":return h.fromUTF8(e,n);case"debug":return h.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!==s(e))throw TypeError("Illegal buffer");if(h.isByteBuffer(e))return(i=a.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new h(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 h(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 h(e.length,n,r)).limit=e.length,o=0;o<e.length;++o)i.view[o]=e[o]}return i},a.writeBitSet=function(e,t){var n,r,i,s,a,o,u=void 0===t;if(u&&(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,s=(i=e.length)>>3,a=0,t+=this.writeVarint32(i,t);s--;)n=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(n,t++);if(i>a){for(o=0,n=0;i>a;)n|=(1&!!e[a++])<<o++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},a.readBitSet=function(e){var t,n,r,i,s,a,o,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,s=0,a=[],e+=n.length;i--;)t=this.readByte(e++),a[s++]=!!(1&t),a[s++]=!!(2&t),a[s++]=!!(4&t),a[s++]=!!(8&t),a[s++]=!!(16&t),a[s++]=!!(32&t),a[s++]=!!(64&t),a[s++]=!!(128&t);if(r>s)for(o=0,t=this.readByte(e++);r>s;)a[s++]=!!(1&t>>o++);return u&&(this.offset=e),a},a.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},a.writeBytes=a.append,a.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},a.writeByte=a.writeInt8,a.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},a.readByte=a.readInt8,a.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},a.writeUInt8=a.writeUint8,a.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},a.readUInt8=a.readUint8,a.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},a.writeShort=a.writeInt16,a.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},a.readShort=a.readInt16,a.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},a.writeUInt16=a.writeUint16,a.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},a.readUInt16=a.readUint16,a.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},a.writeInt=a.writeInt32,a.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},a.readInt=a.readInt32,a.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},a.writeUInt32=a.writeUint32,a.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},a.readUInt32=a.readUint32,e&&(a.writeInt64=function(t,n){var r,i,s,a=void 0===n;if(a&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),a&&(this.offset+=8),this},a.writeLong=a.writeInt64,a.readInt64=function(t){var n,r,i,s=void 0===t;if(s&&(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),s&&(this.offset+=8),i},a.readLong=a.readInt64,a.writeUint64=function(t,n){var r,i,s,a=void 0===n;if(a&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),a&&(this.offset+=8),this},a.writeUInt64=a.writeUint64,a.readUint64=function(t){var n,r,i,s=void 0===t;if(s&&(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),s&&(this.offset+=8),i},a.readUInt64=a.readUint64),a.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},a.writeFloat=a.writeFloat32,a.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},a.readFloat=a.readFloat32,a.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},a.writeDouble=a.writeFloat64,a.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},a.readDouble=a.readFloat64,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},h.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},h.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},a.writeVarint32=function(e,t){var n,r,i,s=void 0===t;if(s&&(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=h.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,s?(this.offset=t,this):r},a.writeVarint32ZigZag=function(e,t){return this.writeVarint32(h.zigZagEncode32(e),t)},a.readVarint32=function(e){var t,n,r,i,s=void 0===e;if(s&&(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,s?(this.offset=e,r):{value:r,length:n}},a.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"===s(t)?t.value=h.zigZagDecode32(t.value):t=h.zigZagDecode32(t),t},e&&(h.MAX_VARINT64_BYTES=10,h.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},h.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()},h.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()},a.writeVarint64=function(t,n){var r,i,s,a,o,u=void 0===n;if(u&&(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=h.calculateVarint64(t),i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,a=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,r){case 10:this.view[n+9]=1&a>>>7;case 9:this.view[n+8]=9!==r?128|a:127&a;case 8:this.view[n+7]=8!==r?128|s>>>21:127&s>>>21;case 7:this.view[n+6]=7!==r?128|s>>>14:127&s>>>14;case 6:this.view[n+5]=6!==r?128|s>>>7:127&s>>>7;case 5:this.view[n+4]=5!==r?128|s:127&s;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 u?(this.offset+=r,this):r},a.writeVarint64ZigZag=function(e,t){return this.writeVarint64(h.zigZagEncode64(e),t)},a.readVarint64=function(t){var n,r,i,s,a,o,u=void 0===t;if(u&&(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,s=0,a=0,r=127&(a=this.view[t++]),128&a&&(r|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(i=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(s=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");return o=e.fromBits(r|i<<28,i>>>4|s<<24,!1),u?(this.offset=t,o):{value:o,length:t-n}},a.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=h.zigZagDecode64(n.value):n=h.zigZagDecode64(n),n}),a.writeCString=function(e,n){var r,i,s,a=void 0===n;if(a&&(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=l.calculateUTF16asUTF8(t(e))[1],n+=i+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+1,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,a?(this.offset=n,this):i},a.readCString=function(e){var t,r,i,s=void 0===e;if(s&&(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,l.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),s?(this.offset=e,r()):{string:r(),length:e-t}},a.writeIString=function(e,n){var r,i,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(i=n,r=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s: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,l.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 a?(this.offset=n,this):n-i},a.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,h.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",a.writeUTF8String=function(e,n){var r,i,s,a=void 0===n;if(a&&(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=l.calculateUTF16asUTF8(t(e))[1],n+=r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),a?(this.offset=n,this):n-i},a.writeString=a.writeUTF8String,h.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(t(e))[0]},h.calculateString=h.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(t(e))[1]},a.readUTF8String=function(e,t,r){var i,s,a,o,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=h.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(a=0,o=r,t===h.METRICS_CHARS){if(s=n(),l.decodeUTF8(function(){return e>a&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++a,l.UTF8toUTF16(e,s)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-o}}if(t===h.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(u=r+e,l.decodeUTF8toUTF16(function(){return u>r?this.view[r++]:null}.bind(this),s=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return i?(this.offset=r,s()):{string:s(),length:r-o}}throw TypeError("Unsupported metrics: "+t)},a.readString=a.readUTF8String,a.writeVString=function(e,n){var r,i,s,a,o=void 0===n;if(o&&(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(s=n,r=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=h.calculateVarint32(r),n+=i+r,a=this.buffer.byteLength,n>a&&this.resize((a*=2)>n?a:n),n-=i+r,n+=this.writeVarint32(r,n),l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return o?(this.offset=n,this):n-s},a.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,h.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},a.append=function(e,t,n){var r,i,s;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 h||(e=h.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},a.appendTo=function(e,t){return e.append(this,t),this},a.assert=function(e){return this.noAssert=!e,this},a.capacity=function(){return this.buffer.byteLength},a.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},a.clone=function(e){var t=new h(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},a.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=o,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)},a.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 h(0,this.littleEndian,this.noAssert);var n=t-e,r=new h(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},a.copyTo=function(e,t,n,r){var i,s,a;if(!this.noAssert&&!h.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=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==(a=r-n)?e:(e.ensureCapacity(t+a),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=a),s&&(e.offset+=a),this)},a.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},a.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},a.flip=function(){return this.limit=this.offset,this.offset=0,this},a.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},a.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},a.LE=function(e){return this.littleEndian=void 0===e||!!e,this},a.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},a.prepend=function(e,t,n){var r,i,s,a,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 h||(e=h.wrap(e,t)),(i=e.limit-e.offset)<=0||((s=i-n)>0?(a=new ArrayBuffer(this.buffer.byteLength+s),(o=new Uint8Array(a)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=a,this.view=o,this.offset+=s,this.markedOffset>=0&&(this.markedOffset+=s),this.limit+=s,n+=s):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},a.prependTo=function(e,t){return e.prepend(this,t),this},a.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},a.remaining=function(){return this.limit-this.offset},a.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},a.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},a.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},a.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},a.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},a.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?o:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},a.toArrayBuffer=a.toBuffer,a.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,s,a;null!==(r=e());)if(void 0===(s=i[r])&&n(r),null!==(r=e())&&(void 0===(a=i[r])&&n(r),t(s<<2>>>0|(48&a)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;n(r)}if(t((15&a)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(a=i[r])){if(61===r)break;n(r)}t((3&s)<<6>>>0|a)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),a.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()},h.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new h(e.length/4*3,n),i=0;return c.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},h.btoa=function(e){return h.fromBinary(e).toBase64()},h.atob=function(e){return h.fromBase64(e).toBinary()},a.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)},h.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new h(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);s.view[r++]=n}return s.limit=i,s},a.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",a="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";a+=i+s+"\n",i=s=""}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+=" ";a+=i+s+"\n"}return e?a:i},h.fromDebug=function(e,t,n){for(var r,i,s=e.length,a=new h(0|(s+1)/3,t,n),o=0,u=0,c=!1,l=!1,f=!1,d=!1,g=!1;s>o;){switch(r=e.charAt(o++)){case"!":if(!n){if(l||f||d){g=!0;break}l=f=d=!0}a.offset=a.markedOffset=a.limit=u,c=!1;break;case"|":if(!n){if(l||d){g=!0;break}l=d=!0}a.offset=a.limit=u,c=!1;break;case"[":if(!n){if(l||f){g=!0;break}l=f=!0}a.offset=a.markedOffset=u,c=!1;break;case"<":if(!n){if(l){g=!0;break}l=!0}a.offset=u,c=!1;break;case"]":if(!n){if(d||f){g=!0;break}d=f=!0}a.limit=a.markedOffset=u,c=!1;break;case">":if(!n){if(d){g=!0;break}d=!0}a.limit=u,c=!1;break;case"'":if(!n){if(f){g=!0;break}f=!0}a.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(o++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+o)}if(!n){if(!l||!d)throw TypeError("Illegal str: Missing offset or limit");if(u<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return a},a.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("")},h.fromHex=function(e,t,n){var r,i,s,a,o;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,s=new h(0|i/2,t),a=0,o=0;i>a;a+=2){if(r=parseInt(e.substring(a,a+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[o++]=r}return s.limit=o,s},l=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,s,a=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())&&a([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&a([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===(s=e()))&&a([n,r,i,s]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&s)}},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}(),a.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return 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()},h.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new h(l.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return l.encodeUTF16toUTF8(t(e),(function(e){i.view[s++]=e})),i.limit=s,i},h}(Gv),qv=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 s,a,o={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._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]},c.next=function(){var e,n,r,i,s;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('"'===(s=this.source.substring(this.index,this.index=i))||"'"===s)&&(this._stringOpen=s),s},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},o.Tokenizer=u,s=function(e){this.tn=new u(e),this.proto3=!1},(a=s.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},s.parse=function(e){return new s(e).parse()},a._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},a._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)},a._parseOption=function(e,n){var r,i=this.tn.next(),s=!1;if("("===i&&(s=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,s&&(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(";")},a._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)}},a._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)},a._parseServiceRPC=function(e){var n,r,i="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);if(n=s,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(r.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.response_stream=!0,s=this.tn.next()),r.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},a._parseMessage=function(e,r){var i=!!r,s=this.tn.next(),a={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(i?"group":"message")+" name: "+s);for(a.name=s,i&&(this.tn.skip("="),r.id=n(this.tn.next()),a.isGroup=!0),"["===(s=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(a,s);else if("oneof"===s)this._parseMessageOneOf(a);else if("enum"===s)this._parseEnum(a);else if("message"===s)this._parseMessage(a);else if("option"===s)this._parseOption(a);else if("service"===s)this._parseService(a);else if("extensions"===s)a.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(a);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(a,"optional",s)}return this.tn.omit(";"),e.messages.push(a),a},a._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},a._parseMessageField=function(e,r,i){var s,a,o;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(s={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field type: "+a);if(s.keytype=a,this.tn.skip(","),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field: "+a);if(s.type=a,this.tn.skip(">"),a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);s.name=a,this.tn.skip("="),s.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(o=this._parseMessage(e,s),!/^[A-Z]/.test(o.name))throw Error("illegal group name: "+o.name);s.type=o.name,s.name=o.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(s.type=i,a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);s.name=a,this.tn.skip("="),s.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},a._parseMessageOneOf=function(e){var n,r,i,s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal oneof name: "+s);for(r=s,i=[],this.tn.skip("{");"}"!==(s=this.tn.next());)(n=this._parseMessageField(e,"optional",s)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},a._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},a._parseEnum=function(e){var r,i={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(i.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(i);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("="),r={name:s,id:n(this.tn.next(),!0)},"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},a._parseExtensionRanges=function(){var t,n,i,s=[];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()}s.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),s},a._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},a.toString=function(){return"Parser at line "+this.tn.line},o.Parser=s,o}(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(),s=7&r,a=r>>>3;switch(s){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(a,n);break;case t.WIRE_TYPES.ENDGROUP:if(a===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+a+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+s)}return!0}var a,o,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=I,a=function(e,t,n,r,i){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(o=a.prototype=Object.create(I.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},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof l.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof l.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},o.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},o.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,s=0;if(""===r[s]){for(;null!==i.parent;)i=i.parent;s++}do{do{if(!(i instanceof R.Namespace)){i=null;break}if(!((n=i.getChild(r[s]))&&n instanceof R.T&&(!t||n instanceof R.Namespace))){i=null;break}i=n,s++}while(s<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},o.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 R.Namespace))return n.join(".");return e.fqn()},o.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof a&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},o.buildOpt=function(){var e,t,n,r,i={},s=Object.keys(this.options);for(e=0,t=s.length;t>e;++e)n=s[e],r=this.options[s[e]],i[n]=r;return i},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},R.Namespace=a,u=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)},c=u.prototype,u.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,a,o,u=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)&&u(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)&&u(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){u(s(n),e.message)}else u(s(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){u(s(n),e.message)}else u(s(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&u(s(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&u(s(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||u(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),o=0;o<i.length;o++){if(i[o].name==n)return i[o].id;if(i[o].id==n)return i[o].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&u(s(n),"not an integer"),(n>4294967295||n<0)&&u(s(n),"not in range for uint32"),n;u(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"===s(n)||u(s(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(o in a={},n)n.hasOwnProperty(o)&&(a[o]=n[o]);n=a}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 s,a;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");s=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=s;break;case t.TYPES.message:a=(new n).LE(),this.resolvedType.encode(r,a),i.writeVarint32(a.offset),i.append(a.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,s;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(s=e.readVarint32(),e.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+s,e.offset+=s,i;case t.TYPES.message:return s=e.readVarint32(),this.resolvedType.decode(e,s);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()},R.Element=u,l=function(e,t,n,r,i,s){a.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},(h=l.prototype=Object.create(a.prototype)).build=function(r){var i,a,o,u;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,a,o){var u,c,l,h,f,d,g;if(null===e||"object"!==s(e))return o&&o instanceof t.Reflect.Enum&&null!==(u=t.Reflect.Enum.getName(o.object,e))?u:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return a?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(e,t){c[t]=i(e,r,a,o)})),c;if(c={},e instanceof t.Map){for(h=(l=e.entries()).next();!h.done;h=l.next())c[e.keyElem.valueToString(h.value[0])]=i(h.value[1],r,a,e.valueElem.resolvedType);return c}for(g in f=e.$type,d=void 0,e)e.hasOwnProperty(g)&&(c[g]=f&&(d=f.getChild(g))?i(e[g],r,a,d.resolvedType):i(e[g],r,a));return c}var a,o,u=r.getChildren(t.Reflect.Message.Field),c=r.getChildren(t.Reflect.Message.OneOf),l=function e(i){var a,o,l,h;for(t.Builder.Message.call(this),a=0,o=c.length;o>a;++a)this[c[a].name]=null;for(a=0,o=u.length;o>a;++a)this[(l=u[a]).name]=l.repeated?[]:l.map?new t.Map(l):null,!l.required&&"proto3"!==r.syntax||null===l.defaultValue||(this[l.name]=l.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(a=0,o=arguments.length;o>a;++a)void 0!==(h=arguments[a])&&this.$set(u[a].name,h);else this.$set(i)},h=l.prototype=Object.create(t.Builder.Message.prototype);for(h.add=function(e,n,i){var s=r._fieldsByName[e];if(!i){if(!s)throw Error(this+"#"+e+" is undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));if(!s.repeated)throw Error(this+"#"+e+" is not a repeated field");n=s.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},h.$add=h.add,h.set=function(e,n,i){var a,o,u;if(e&&"object"===s(e)){for(a in i=n,e)e.hasOwnProperty(a)&&void 0!==(n=e[a])&&this.$set(a,n,i);return this}if(o=r._fieldsByName[e],i)this[e]=n;else{if(!o)throw Error(this+"#"+e+" is not a field: undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));this[o.name]=n=o.verifyValue(n)}return o&&o.oneof&&(u=this[o.oneof.name],null!==n?(null!==u&&u!==o.name&&(this[u]=null),this[o.oneof.name]=o.name):u===e&&(this[o.oneof.name]=null)),this},h.$set=h.set,h.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]},h.$get=h.get,a=0;a<u.length;a++)(o=u[a])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,i,s=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));s=s.substring(0,1).toUpperCase()+s.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"+s)&&(h["set"+s]=n),null===r.getChild("set_"+t)&&(h["set_"+t]=n),null===r.getChild("get"+s)&&(h["get"+s]=i),null===r.getChild("get_"+t)&&(h["get_"+t]=i)}(o);return h.encode=function(t,n){var i,s;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),s=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(s)}catch(e){throw t.LE(s),e}},l.encode=function(e,t,n){return new l(e).encode(t,n)},h.calculate=function(){return r.calculate(this)},h.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},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},l.decode=function(e,t){var i,s;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return s=r.decode(e.LE()),e.LE(i),s}catch(t){throw e.LE(i),t}},l.decodeDelimited=function(e,t){var i,s,a;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,s=e.readVarint32(),e.remaining()<s)return e.offset=i,null;try{return a=r.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,a}catch(t){throw e.offset+=s,t}},l.decode64=function(e){return l.decode(e,"base64")},l.decodeHex=function(e){return l.decode(e,"hex")},l.decodeJSON=function(e){return new l(JSON.parse(e))},h.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(l,"$options",{value:r.buildOpt()}),Object.defineProperty(h,"$options",{value:l.$options}),Object.defineProperty(l,"$type",{value:r}),Object.defineProperty(h,"$type",{value:r})),l}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,u=this.children.length;u>o;o++)if((a=this.children[o])instanceof v||a instanceof l||a instanceof _){if(i.hasOwnProperty(a.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+a.toString(!0)+" cannot override static property '"+a.name+"'");i[a.name]=a.build()}else if(a instanceof l.Field)a.build(),this._fields.push(a),this._fieldsById[a.id]=a,this._fieldsByName[a.name]=a;else if(!(a instanceof l.OneOf||a instanceof m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=i},h.encode=function(e,t,n){var r,i,s,a,o,u=null;for(s=0,a=this._fields.length;a>s;++s)i=e[(r=this._fields[s]).name],r.required&&null===i?null===u&&(u=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==u)throw(o=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,o;return t},h.calculate=function(e){for(var t,n,r=0,i=0,s=this._fields.length;s>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},h.decode=function(e,n,r){var s,a,o,u,c,l,h,f,d,g,p,v;for(n="number"==typeof n?n:-1,c=e.offset,l=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(o=(s=e.readVarint32())>>>3,(a=7&s)===t.WIRE_TYPES.ENDGROUP){if(o!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+o+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[o])u.repeated&&!u.options.packed?l[u.name].push(u.decode(a,e)):u.map?(f=u.decode(a,e),l[u.name].set(f[0],f[1])):(l[u.name]=u.decode(a,e),u.oneof&&(null!==(d=l[u.oneof.name])&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name));else switch(a){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:h=e.readVarint32(),e.offset+=h;break;case t.WIRE_TYPES.STARTGROUP:for(;i(o,e););break;default:throw Error("Illegal wire type for unknown field "+o+" in "+this.toString(!0)+"#decode: "+a)}}for(g=0,p=this._fields.length;p>g;++g)if(null===l[(u=this._fields[g]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(v=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,v;t.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},R.Message=l,f=function(e,n,r,i,s,a,o,u,c,h){I.call(this,e,n,a),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=s,this.resolvedType=null,this.id=o,this.options=u||{},this.defaultValue=null,this.oneof=c||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof l.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=f.prototype=Object.create(I.prototype)).build=function(){this.element=new u(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new u(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=u.defaultFieldValue(this.type)},d.verifyValue=function(e,n){var r,i,a;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]),a=[],i=0;i<e.length;i++)a.push(this.element.verifyValue(e[i]));return a}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))},d.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}},d.encode=function(e,r,i){var a,o,u,c,l;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),o=r.offset,a=0;a<e.length;a++)this.element.encodeValue(this.id,e[a],r);u=r.offset-o,(c=n.calculateVarint32(u))>1&&(l=r.slice(o,r.offset),o+=c-1,r.offset=o,r.append(l)),r.writeVarint32(u,o-c)}else for(a=0;a<e.length;a++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[a],r);else this.map?e.forEach((function(e,i){var s=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(s),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},d.calculate=function(e,r){var i,a,o;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),o=0,a=0;a<e.length;a++)o+=this.element.calculateLength(this.id,e[a]);i+=n.calculateVarint32(o),i+=o}else for(a=0;a<e.length;a++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[a]);else this.map?e.forEach((function(e,r){var s=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(s),i+=s}),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},d.decode=function(e,n,r){var i,s,a,o,c,l,h;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(s=n.readVarint32(),s=n.offset+s,a=[];n.offset<s;)a.push(this.decode(this.type.wireType,n,!0));return a}if(this.map){if(o=u.defaultFieldValue(this.keyType),i=u.defaultFieldValue(this.type),s=n.readVarint32(),n.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+s,n.offset+=s;c.remaining()>0;)if(e=7&(l=c.readVarint32()),1==(h=l>>>3))o=this.keyElement.decode(c,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,e,h)}return[o,i]}return this.element.decode(n,e,this.id)},R.Message.Field=f,g=function(e,t,n,r,i,s,a){f.call(this,e,t,n,null,r,i,s,a),this.extension},g.prototype=Object.create(f.prototype),R.Message.ExtensionField=g,p=function(e,t,n){I.call(this,e,t,n),this.fields=[]},R.Message.OneOf=p,v=function(e,t,n,r,i){a.call(this,e,t,n,r,i),this.className="Enum",this.object=null},v.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},(v.prototype=Object.create(a.prototype)).build=function(e){var n,r,i,s;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,s=(r=this.getChildren(v.Value)).length;s>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},R.Enum=v,y=function(e,t,n,r){I.call(this,e,t,n),this.className="Enum.Value",this.id=r},y.prototype=Object.create(I.prototype),R.Enum.Value=y,m=function(e,t,n,r){I.call(this,e,t,n),this.field=r},m.prototype=Object.create(I.prototype),R.Extension=m,_=function(e,t,n,r){a.call(this,e,t,n,r),this.className="Service",this.clazz=null},(_.prototype=Object.create(a.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)}},a=i.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<o.length;r++)!function(e){a[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(a[e.name],"$options",{value:i[e.name].$options}))}(o[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(a,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(a,"$type",{value:t})),i}(t,this)},R.Service=_,E=function(e,t,n,r){I.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(E.prototype=Object.create(I.prototype)).buildOpt=o.buildOpt,R.Service.Method=E,T=function(e,t,n,r,i,s,a,o){E.call(this,e,t,n,o),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=s,this.responseStream=a,this.resolvedRequestType=null,this.resolvedResponseType=null},T.prototype=Object.create(E.prototype),R.Service.RPCMethod=T,R}(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||{}},a=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},a.reset=function(){return this.ptr=this.ns,this},a.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},a.create=function(t){var r,a,o,u,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(a=t.shift(),i.isMessage(a)){if(o=new n.Message(this,this.ptr,a.name,a.options,a.isGroup,a.syntax),u={},a.oneofs&&Object.keys(a.oneofs).forEach((function(e){o.addChild(u[e]=new n.Message.OneOf(this,o,e))}),this),a.fields&&a.fields.forEach((function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!==s(e.options))throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=u[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,a.syntax),t&&t.fields.push(e),o.addChild(e)}),this),c=[],a.enums&&a.enums.forEach((function(e){c.push(e)})),a.messages&&a.messages.forEach((function(e){c.push(e)})),a.services&&a.services.forEach((function(e){c.push(e)})),a.extensions&&(o.extensions="number"==typeof a.extensions[0]?[a.extensions]:a.extensions),this.ptr.addChild(o),c.length>0){r.push(t),t=c,c=null,this.ptr=o,o=null;continue}c=null}else if(i.isEnum(a))o=new n.Enum(this,this.ptr,a.name,a.options,a.syntax),a.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(i.isService(a))o=new n.Service(this,this.ptr,a.name,a.options),Object.keys(a.rpc).forEach((function(e){var t=a.rpc[e];o.addChild(new n.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!i.isExtend(a))throw Error("not a valid definition: "+JSON.stringify(a));if(o=this.ptr.resolve(a.ref,!0))a.fields.forEach((function(t){var r,i,s,a;if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions&&(r=!1,o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),s=new n.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,s),s.extension=a,this.ptr.addChild(a),o.addChild(s)}),this);else if(!/\.?google\.protobuf\./.test(a.ref))throw Error("extended message "+a.ref+" is not defined")}a=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},a.import=function(t,n){var i,a,o,u,c,l,h,f,d="/";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)&&(d="\\"),a=i+d+n.file,!0===this.files[a])return this.reset();this.files[a]=!0}if(t.imports&&t.imports.length>0){for(u=!1,"object"===s(n)?(this.importRoot=n.root,u=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),d="\\"):o=".":o=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(l=t.imports[c]))continue;if(l=o+d+l,!0===this.files[l])continue;if(/\.proto$/i.test(l)&&!e.DotProto&&(l=l.replace(/\.proto$/,".json")),null===(h=e.Util.fetch(l)))throw Error("failed to import '"+l+"' in '"+n+"': file not found");/\.json$/i.test(l)?this.import(JSON.parse(h+""),l):this.import(e.DotProto.Parser.parse(h),l)}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]);u&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),f=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){f.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=f),t.enums&&(this.create(t.enums),this.ptr=f),t.services&&(this.create(t.services),this.ptr=f),t.extends&&this.create(t.extends),this.reset()},a.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()},a.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},a.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},a.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,s,a;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++)s=this.keyElem.valueFromString(r[i]),a=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(s)]={key:s,value:a}},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=Fv,i.loadProto(r,void 0,"").build("Modules").probuf}(jv,Gv),qv);Qv.getModule=function(e){var t=new Qv[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Wo(e)?[].slice.call(new Int8Array(e)):e},t};var Wv="pgMsgP",Jv="chatMsg",zv="pcMsgP",Zv={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Xv="delMsg",$v="joinChrm",ey="joinChrmR",ty="exitChrm",ny="setKV",ry="delKV",iy="setKVS",sy="delKVS",ay="qryRelationR",oy="delRelation",uy="setSeAtt",cy={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},ly="qryPMsg",hy="qryGMsg",fy="qryCHMsg",dy="qryCMsg",gy="qrySMsg",py=(h(Kv={},"ppMsgP",Go.PRIVATE),h(Kv,Wv,Go.GROUP),h(Kv,Jv,Go.CHATROOM),h(Kv,zv,Go.CUSTOMER_SERVICE),Kv),vy=(h(Hv={},Go.PRIVATE,ly),h(Hv,Go.GROUP,hy),h(Hv,Go.CHATROOM,fy),h(Hv,Go.CUSTOMER_SERVICE,dy),h(Hv,Go.SYSTEM,gy),Hv),yy=(h(Yv={},Go.PRIVATE,cy.PRIVATE),h(Yv,Go.GROUP,cy.GROUP),h(Yv,Go.ULTRA_GROUP,cy.ULTRA_GROUP),h(Yv,Go.CUSTOMER_SERVICE,cy.CUSTOMER_SERVICE),h(Yv,Go.SYSTEM,cy.SYSTEM),Yv),my="1",_y="0",Ey=1,Ty=2,Ry=3,Iy=function(){function t(e){u(this,t),this._codec="websocket"===e?Qv:kv,this._connectType=e}return l(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,a=(h(r={},qg,i._formatSyncMessages),h(r,jg,i._formatReceivedMessage),h(r,Fg,i._formatSentMessage),h(r,zg,i._formatHistoryMessages),h(r,Xg,i._formatConversationList),h(r,cp,i._formatChatRoomInfos),h(r,hp,i._formatRTCUserList),h(r,_p,i._formatRTCData),h(r,xp,i._formatChatRoomKVList),h(r,jp,i._formatUserSetting),h(r,Hp,i._formatConversationStatus),h(r,Xp,i._formatGrpReadReceiptQryResp),h(r,Fp,i._formatSetUserSettingOutput),h(r,qp,i._formatUserSettingNotification),h(r,hv,i._formatUltraMsgChangeList),h(r,vv,i._formatUltraOperateStatusNotifyList),h(r,gv,i._formatUltraMsgList),h(r,Tv,i._formatRTCRoomKVList),h(r,mp,i._formatRTCAuidenceJoinRoomData),h(r,Iv,i._formatRTCJoinedUserInfo),r)[t];try{s=e.length>0&&i._codec[t].decode(e),zo(s)&&(s=function(e){for(var t in e)zo(e[t])&&(e[t]=Uc(e[t]));return e}(s)),Zo(a)&&(s=a.call(this,s,n))}catch(n){su.error("PB parse error\n",n,e,t)}return s}},{key:"_readBytes",value:function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=Wo(n)?new Uint8Array(n):n;return Dg.readUTF(i.subarray(t,r))}catch(e){su.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){su.info("formatBytes error\n",e)}return t||e}},{key:"_formatSyncMessages",value:function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,s=e.finished;return(Xo(s)||null===s)&&(e.finished=!0),e.syncTime=Uc(i),e.list=Fc(r,(function(e){return n._formatReceivedMessage(e,t)})),e}},{key:"_formatReceivedMessage",value:function(e,t){if(!e)return e;var r=t=t||{},s=r.currentUserId,a=r.connectedTime,o=e.content,u=e.fromUserId,c=e.type,l=e.groupId,h=e.status,f=e.dataTime,d=e.classname,g=e.msgId,p=e.extraContent,v=e.pushContent,y=e.pushExt,m=e.configFlag,_=e.extStatus,E=(e.direction||pu.RECEIVE)===pu.SEND,T=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(h),R=T.isPersited,I=T.isCounted,C=T.isMentioned,S=T.disableNotification,b=T.receivedStatus,w=T.canIncludeExpansion,O=!!(2&(_||0)),N=!!(4&(_||0)),k=[Go.GROUP,Go.CHATROOM,Go.RTC_ROOM,Go.ULTRA_GROUP].indexOf(c)>-1?l:u,A=E?s:u,M=Uc(f),U=M<a,L=c===Go.CHATROOM,x=this._formatBytes(o),P={};if(y&&(P=Pc(y.pushConfigs,y.pushId)),x.user){var D=x.user,V=D.portrait,B=D.portraitUri,F=V||B;F&&(x.user.portrait=x.user.portraitUri=F)}var G,j=i(i({},P),{},{pushTitle:null==y?void 0:y.title,pushContent:v,pushData:v,disablePushTitle:!!m&&Boolean(4&m),forceShowDetailContent:!!m&&Boolean(8&m),templateId:null==y?void 0:y.templateId}),q=E?pu.SEND:pu.RECEIVE;L&&u===s&&(q=pu.SEND),p&&(G={},G=Jc(p));var K={conversationType:c,targetId:k,senderUserId:A,messageType:d,messageUId:g,isPersited:R,isCounted:I,isMentioned:C,sentTime:M,messageDirection:q,receivedTime:zc.getTime(),disableNotification:S,receivedStatus:b,canIncludeExpansion:w,content:x,expansion:G,configFlag:m,pushConfig:j,channelId:e.busChannel||"",isInterrupt:O,isModifyMessage:N};return c!==Go.ULTRA_GROUP&&(K.isOffLineMessage=U),K}},{key:"_formatSentMessage",value:function(e,t){var n,r=e.content,s=e.classname,a=e.sessionId,o=e.msgId,u=e.extraContent,c=e.pushExt,l=e.pushContent,h=e.configFlag,f=e.extStatus,d=t.signal,g=t.currentUserId,p=d.date,v=d.topic,y=d.targetId,m=!!(2&(f||0)),_=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(a),E=_.isPersited,T=_.isCounted,R=_.disableNotification,I=_.canIncludeExpansion,C=py[v]||Go.PRIVATE,S=jc(Zv,v),b=this._formatBytes(r),w=y;s===Ru.RECALL&&(C=b.conversationType||C,w=b.targetId||y),u&&(n={},n=Jc(u));var O={};c&&(O=Pc(c.pushConfigs,c.pushId));var N=i(i({},O),{},{pushTitle:null==c?void 0:c.title,pushContent:l,pushData:l,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==c?void 0:c.templateId});return{conversationType:C,targetId:w,messageType:s,messageUId:o,isPersited:E,isCounted:T,isStatusMessage:S,senderUserId:g,content:this._formatBytes(r),sentTime:1e3*p,receivedTime:zc.getTime(),messageDirection:pu.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:I,expansion:n,pushConfig:N,channelId:e.busChannel||"",isInterrupt:m}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,a=r.targetId,o=Uc(e.syncTime),u=[];return Bc(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===Go.ULTRA_GROUP?i.targetId=e.groupId||r.targetId:i.targetId=a,u.push(i)}),{isReverse:!0}),{syncTime:o,list:u,hasMore:!!s}}},{key:"_formatUltraMsgChangeList",value:function(e){var t=e.list,n=e.syncTime,r=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,r=e.time,i=e.changeType,s=e.msgUID,a=e.msgTime,o=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId;return{targetId:t,conversationType:n,changeType:i,messageUId:s,changeTime:Uc(r),sendTime:Uc(a),channelId:o,isAdmin:u,isDel:c,operatorId:l}})),hasNext:r}}},{key:"_formatUltraOperateStatusNotifyList",value:function(e){var t=e.type,n=e.notifyType,r=e.info,i=e.summary,s=[],a=[],o=2==(2&n),u=1==(1&n);return u&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.userId,i=e.opType,a=e.optime,o=Uc(a);s.push({targetId:t,channelId:n,userId:r,operationType:i,operationTime:o})})),o&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,i=e.opType;a.push({targetId:t,channelId:n,count:r,operationType:i})})),{conversationType:t,info:s,summary:a,hasInfo:u,hasSummary:o}}},{key:"_formatUltraMsgList",value:function(e,t){var n=this,r=e.list;return{list:r&&r.map((function(e){return n._formatReceivedMessage(e,t)}))}}},{key:"_formatConversationList",value:function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){},s={list:r=Fc(r,(function(e){var r=e.msg,s=e.userId,a=e.type,o=e.unreadCount,u=e.busChannel,c=e.versionTime,l=e.remindCount,h=null;r&&((h=n._formatReceivedMessage(r,t)).targetId=s);var f={targetId:s,conversationType:a,unreadMessageCount:Uc(o)||0,latestMessage:h||{},channelId:u||""};return a===Go.ULTRA_GROUP&&(f.versionTime=Uc(c)||0,f.unreadMentionedCount=Uc(l)||0),i(f)||f}))};return((null==t?void 0:t.conversationType)||Go.NONE)===Go.ULTRA_GROUP&&(s.isFinished=e.isFinished),s}},{key:"_formatSetUserSettingOutput",value:function(e){return e}},{key:"_formatChatRoomInfos",value:function(e){var t=e.userTotalNums,n=e.userInfos,r=Fc(n,(function(e){var t=e.id,n=e.time;return{id:t,time:Uc(n)}}));return{userCount:t,userInfos:r}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=Fc(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,s=e.uid,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?ku.DELETE:ku.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:s,timestamp:Uc(i)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return Bc(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=Uc(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=Uc(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return Bc(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,a=e.busChannel,o=Cu.CLOSE,u=!1,c=[];Bc(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Ey:o=n===my?Cu.OPEN:Cu.CLOSE;break;case Ty:u=n===my;break;case Ry:c=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:o,isTop:u,updatedTime:Uc(i),tags:c,channelId:a||""})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,s=e.entries,a={};return Bc(t,(function(e){var t=e.userId,n=e.userData,r={};Bc(n,(function(e){var t=e.key,n=e.value;r[t]=n})),a[t]=r})),{users:a,token:n,sessionId:r,roomInfo:i,kvEntries:s}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return Bc(t,(function(e){n[e.key]=e.value})),n}},{key:"_formatRTCRoomInfo",value:function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return Bc(r,(function(e){i[e.key]=e.value})),i}},{key:"_formatGrpReadReceiptQryResp",value:function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=Uc(e.readTime)})),{totalMemberCount:t,list:n}}},{key:"_formatUserSettingNotification",value:function(e){return e}},{key:"_formatRTCRoomKVList",value: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:Uc(t)})})),isFullUpdate:n,syncTime:r}}},{key:"_formatRTCAuidenceJoinRoomData",value:function(e){return e}},{key:"_formatRTCJoinedUserInfo",value:function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Uc(e.joinTime)}}))}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(Kg);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=e.conversationType,i=t.messageType,s=t.isMentioned,a=t.mentionedType,o=t.mentionedUserIdList,u=t.content,c=t.pushContent,l=t.pushData,h=t.directionalUserIdList,f=t.isFilerWhiteBlacklist,d=t.isVoipPush,g=t.canIncludeExpansion,p=t.expansion,v=t.pushConfig,y=t.channelId;[Go.GROUP,Go.ULTRA_GROUP].includes(r);var m,_,E,T=this._codec.getModule(Fg),R=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),I=v||{},C=I.pushTitle,S=I.pushContent,b=I.pushData,w=I.iOSConfig,O=I.androidConfig,N=I.templateId,k=I.disablePushTitle,A=I.forceShowDetailContent,M=0;(T.setSessionId(R),s&&u)&&(u.mentionedInfo={userIdList:(null===(m=u.mentionedInfo)||void 0===m?void 0:m.userIdList)||o||[],type:(null===(_=u.mentionedInfo)||void 0===_?void 0:_.type)||a||bu.ALL,mentionedContent:(null===(E=u.mentionedInfo)||void 0===E?void 0:E.mentionedContent)||""});var U=S||c||"",L=b||l||"";if(U&&T.setPushText(U),L&&T.setAppData(L),h&&T.setUserId(h),M|=d?1:0,M|=f?2:0,M|=k?4:0,M|=A?8:0,T.setConfigFlag(M),T.setClassname(i),u.user&&u.user.portraitUri&&(u.user.portrait=u.user.portraitUri),T.setContent(JSON.stringify(u)),g&&p){var x={};Bc(p,(function(e,t){x[t]={v:e}})),T.setExtraContent(JSON.stringify(x))}if(v){var P=this._codec.getModule(Gg);if(C&&P.setTitle(C),w&&O){var D=xc(w,O);P.setPushConfigs(D)}(null==O?void 0:O.notificationId)&&P.setPushId(null==O?void 0:O.notificationId),P.setTemplateId(N||""),T.setPushExt(n?P.getArrayData():P)}return Xo(y)||T.setBusChannel(y),T}},{key:"encodeUpMsg",value:function(e,t){return this._getUpMsgModule(e,t).getArrayData()}},{key:"encodeSyncMsg",value:function(e){var t=e.sendboxTime,n=e.inboxTime,r=this._codec.getModule(Yg);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.getArrayData()}},{key:"encodeChrmSyncMsg",value:function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Qg);return n.setCount(t),n.setSyncTime(e),n.getArrayData()}},{key:"encodeGetHistoryMsg",value:function(e,t){var n=t.count,r=t.order,i=t.timestamp,s=t.channelId,a=this._codec.getModule(Jg);return a.setTargetId(e),a.setTime(i),a.setCount(n),a.setOrder(r),a.setBusChannel(s||""),a.getArrayData()}},{key:"encodeSuperSyncMsg",value:function(e){var t=this._codec.getModule(ov);return t.setSyncTime(e),t.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(Zg);return i.setType(1),i.setCount(n),i.setStartTime(r),i.getArrayData()}},{key:"encodeOldConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.type,i=t.startTime,s=t.order;n=n||0,i=i||0,s=s||0;var a=this._codec.getModule(Zg);return a.setType(r),a.setCount(n),a.setStartTime(i),a.setOrder(s),a.getArrayData()}},{key:"encodeRemoveOldConversationList",value:function(e){var t=e=e||{},n=t.conversationType,r=t.channelId,i=this._codec.getModule(np);return i.setType(n),r&&i.setBusChannel([r]),i.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule($g),r=[];return Bc(e,(function(e){var n=e.conversationType,i=e.targetId,s=t._codec.getModule(ep);s.setType(n),s.setChannelId(i),r.push(s)})),n.setSessions(r),n.getArrayData()}},{key:"encodeDeleteMessages",value:function(e,t,n,r){var i=this._codec.getModule(rp),s=[];return Bc(n,(function(e){s.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(s),i.setBusChannel(r),i.getArrayData()}},{key:"encodeClearMessages",value:function(e,t,n,r){var i=this._codec.getModule(ip);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(r),i.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.channelId,s=t.timestamp,a=this._codec.getModule(sp);return s=s||+new Date,a.setType(n),a.setChannelId(r),a.setMsgTime(s),a.setBusChannel(i),a.getArrayData()}},{key:"encodeExpandUltraMessage",value:function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,s=e.messageUId,a=e.sendTime,o=e.keys,u={mid:s,put:e.expansion,del:o,clear:e.removeAll?1:0},c=this._codec.getModule(uv);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(s),c.setMsgTime(a),c.setContent(JSON.stringify(u)),c.getArrayData()}},{key:"encodemodifyMessage",value:function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,s=e.messageUId,a=e.sendTime,o=e.content,u=this._codec.getModule(uv);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(s),u.setMsgTime(a),u.setContent(JSON.stringify(o)),u.getArrayData()}},{key:"encodeQueryMsgChange",value:function(e){var t=this._codec.getModule(cv);return t.setSyncTime(e),t.getArrayData()}},{key:"encodeMsgQuery",value:function(e){var t=e.targetId,n=e.conversationType,r=e.messages,i=this._codec.getModule(fv),s=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return i.setTargetId(t),i.setType(n),i.setQuery(s),i.getArrayData()}},{key:"encodeOperateStatus",value:function(e,t,n,r){var i=this._codec.getModule(pv);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()}},{key:"encodeJoinOrQuitChatRoom",value:function(){var e=this._codec.getModule(ap);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(up);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(bp);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()}},{key:"encodeGetFileUrl",value:function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()}},{key:"encodeModifyChatRoomKV",value:function(e,t,n){var r="comet"===this._connectType,i=this._codec.getModule(Mp),s=t.key,a=t.value,o=t.notificationExtra,u=t.isSendNotification,c=t.type||ku.UPDATE,l=Zc(t,c),h={key:s,value:a||"",uid:n};if(Xo(l)||(h.status=l),i.setEntry(h),u){var f={conversationType:Go.CHATROOM,targetId:e},d={key:s,value:a,extra:o,type:c},g=this._getUpMsgModule(f,{messageType:Ru.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(Go.CHATROOM)}return i.getArrayData()}},{key:"encodeModifyChatRoomKVS",value:function(e,t,n){this._connectType;var r=this._codec.getModule(Up),i=t.entries,s=t.type||ku.UPDATE,a=Zc(t,s),o=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};Xo(a)||(t.status=a),o.push(t)})),r.setEntry(o),r.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(Vp);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(Gp);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(Kp);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(Wp),i=zc.getTime(),s=[];return Bc(e,(function(e){var r=t._codec.getModule(Yp),a=e.conversationType,o=e.targetId,u=e.notificationStatus,c=e.isTop,l=e.channelId,h=[];r.setType(a),r.setChannelId(o),r.setTime(i),r.setBusChannel(l);var f=u===Cu.OPEN,d={};Xo(u)||(d[Ey]=f),Xo(c)||(d[Ty]=c),Bc(d,(function(e,r){if(!Xo(e)){var i=t._codec.getModule(Qp);e=e?my:_y,i.setSessionStateType(Number(r)),i.setValue(e);var s=n?i.getArrayData():i;h.push(s)}})),r.setStateItem(h);var g=n?r.getArrayData():r;s.push(g)})),r.setVersion(i),r.setState(s),r.getArrayData()}},{key:"encodeReadReceipt",value:function(e,t){var n=this._codec.getModule(zp);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeCreateTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(ev),s=[];return e.forEach((function(e){var t=n._codec.getModule(tv);t.setTagId(e.tagId),t.setName(e.tagName),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeMessageReader",value:function(e,t){var n=this._codec.getModule(zp);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeRemoveTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(nv),s=[];return e.forEach((function(e){var t=n._codec.getModule(tv);t.setTagId(e),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeDisConversationTag",value:function(e){var t=this._codec.getModule(rv);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Wp),s=[];return t.forEach((function(t){var i=n._codec.getModule(Yp),a=n._codec.getModule(Qp),o=[];e.forEach((function(e){var t=n._codec.getModule(tv);t.setTagId(e.tagId),Xo(e.isTop)||t.setIsTop(e.isTop),o.push(r?t.getArrayData():t)})),a.setSessionStateType(Ry),a.setValue(JSON.stringify(o)),a.setTags(o),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?a.getArrayData():a]),s.push(r?i.getArrayData():i)})),i.setState(s),i.setVersion(zc.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(iv);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeUltraGroup",value:function(e,t){var n=this._codec.getModule(av);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t,n,r,i){var s=this,a="comet"===this._connectType,o=this._codec.getModule(lp);if(e=e||0,o.setRoomType(e),Xo(t)||o.setBroadcastType(t),Xo(n)||o.setJoinType(n),r){var u=[],c=this._codec.getModule(Cp);for(var l in r)c.setKey(l),c.setValue(r[l]),a?u.push(c.getArrayData()):u.push(c);o.setInnerDatas(u)}if(i){var h=[];Object.keys(i).forEach((function(e){var t=s._codec.getModule(Cp);t.setKey(e),t.setValue(i[e]),a?h.push(t.getArrayData()):h.push(t)})),o.setOuterDatas(h)}return o.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(fp).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(dp);if(s.setInterior(n),s.setTarget(r),s.setKey(e),s.setValue(t),i){i.name&&s.setObjectName(i.name);var a=i.content;a&&(zo(a)&&(a=JSON.stringify(a)),s.setContent(a))}return s.getArrayData()}},{key:"encodeUserSetRTCData",value:function(e,t,n,r){var i=this,s="comet"===this._connectType,a=this._codec.getModule(gp);a.setObjectName(n);var o=this._codec.getModule(Cp);o.setKey(e.name),o.setValue(e.content),s?a.setContent(o.getArrayData()):a.setContent(o);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(Cp);n.setKey(e);var a="uris"===e?t:r;n.setValue(a),s?u.push(n.getArrayData()):u.push(n)})),a.setValueInfo(u),a.getArrayData()}},{key:"encodeUserSetRTCCDNUris",value:function(e,t){this._connectType;var n=this._codec.getModule(gp);n.setObjectName(e);var r=this._codec.getModule(Cp);return r.setKey("cdn_uris"),r.setValue(t),n.setValueInfo(r),n.getArrayData()}},{key:"encodeGetRTCData",value:function(e,t,n){var r=this._codec.getModule(pp);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()}},{key:"encodeRemoveRTCData",value:function(e,t,n,r){var i=this._codec.getModule(pp);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},a=s.name,o=s.content;return!Xo(a)&&i.setObjectName(a),Xo(o)||(zo(o)&&(o=JSON.stringify(o)),i.setContent(o)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(vp);r.setTarget(t),Qo(e)||(e=[e]),Bc(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||{},s=i.name,a=i.content;return!Xo(s)&&r.setObjectName(s),Xo(a)||(zo(a)&&(a=JSON.stringify(a)),r.setContent(a)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Ep);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(yp);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(Rp);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(Cp);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(Sp);return t.setKey(e),t.getArrayData()}},{key:"encodeIdentityChangeInfo",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this._codec.getModule(lp);return i.setRoomType(e.RTCMode.LIVE),n&&i.setBroadcastType(n),i.setIdentityChangeType(t),i.setNeedSysChatroom(r),i.getArrayData()}},{key:"encodePullRTCRoomKV",value:function(e,t){var n=this._codec.getModule(Ev);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}},{key:"encodeQueryUserJoinedInfo",value:function(e){var t=this._codec.getModule(Rv);return t.setUserId(e),t.getArrayData()}},{key:"encodeRequestRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,s=e.inviteInfo,a=this._codec.getModule(Sv);return a.setInvitedRoomId(t),a.setInvitedUserId(n),a.setInviteSessionId(r),a.setTimeoutTime(i),a.setInviteInfo(s),a.getArrayData()}},{key:"encodeCancelRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,s=this._codec.getModule(bv);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setInviteInfo(i),s.getArrayData()}},{key:"encodeResponseRoomPK",value:function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,s=e.key,a=e.value,o=e.agree?1:0,u=this._codec.getModule(wv);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(s),u.setValue(a),u.setAnswerCode(o),u.getArrayData()}},{key:"encodeEndRoomPK",value:function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,s=this._codec.getModule(Ov);return s.setInviteRoomId(t),s.setInviteSessionId(n),s.setInviteContent(r),s.setInviteRoomKeys(i),s.getArrayData()}}]),t}(),Cy=l((function e(t,n){u(this,e),this._watcher=n,this.codec=new Iy(t)})),Sy=function(e,t){return e&&t?t+"_"+e:e||Date.now()},by=function(){function e(t){u(this,e),this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return l(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return Sy(e,t)}},{key:"read",value:function(e,t,n){this.readMessage(e,t,n)}},{key:"readMessage",value:function(e,t,n){return{stream:e,length:t}}}]),e}(),wy=function(){function e(t){u(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Pg(t,!1,og.AT_MOST_ONCE,!1)}return l(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return Sy(e,t)}},{key:"write",value:function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)}},{key:"setHeaderQos",value:function(e){this._header.qos=e}},{key:"getHeaderFlag",value:function(){return this._header.encode()}},{key:"getLengthSize",value:function(){return this.lengthSize}},{key:"getBufferData",value:function(){var e=new Bg;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),Oy=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return l(n,[{key:"readMessage",value:function(e,t,r){if(e.readByte(),this.status=+e.readByte(),t<=n.MESSAGE_LENGTH)return{stream:e,length:t};if(r===hg.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 s=e.readUTF();su.debug("server sessionId -> "+s),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(by);Oy.MESSAGE_LENGTH=2;var Ny=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.DISCONNECT,e.status=0,e}return l(n,[{key:"readMessage",value:function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}}}]),n}(by);Ny.MESSAGE_LENGTH=2;var ky=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.call(this,ug.PING_REQ))._name=cg.PING_REQ,e}return l(n,[{key:"writeMessage",value:function(e){}}]),n}(wy),Ay=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,e))._name=cg.PING_RESP,r}return l(n)}(by),My=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments)).messageId=0,e}return l(n,[{key:"readMessage",value:function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}}}]),n}(by),Uy=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments)).messageId=0,e}return l(n,[{key:"writeMessage",value:function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)}}]),n}(wy),Ly=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=lg.PUB,e}return l(n,[{key:"readMessage",value:function(e,t){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),I(d(n.prototype),"readMessage",this).call(this,e,t),this.data=e.readAll(),{stream:e,length:t}}}]),n}(My),xy=function(e){f(n,e);var t=T(n);function n(e,r,i){var s;return u(this,n),(s=t.call(this,ug.PUBLISH))._name=cg.PUBLISH,s.syncMsg=!1,s.identifier=lg.PUB,s.topic=e,s.data=Ko(r)?Dg.writeUTF(r):r,s.targetId=i,s}return l(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),I(d(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Uy),Py=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=lg.PUB,e.topic="",e.targetId="",e}return l(n,[{key:"readMessage",value:function(e,t){return I(d(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:t}}}]),n}(My),Dy=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,ug.PUB_ACK))._name=cg.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return l(n,[{key:"writeMessage",value:function(e){I(d(n.prototype),"writeMessage",this).call(this,e)}}]),n}(Uy),Vy=function(e){f(n,e);var t=T(n);function n(e,r,i){var s;return u(this,n),(s=t.call(this,ug.QUERY)).name=cg.QUERY,s.identifier=lg.QUERY,s.topic=e,s.data=Ko(r)?Dg.writeUTF(r):r,s.targetId=i,s}return l(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),I(d(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Uy),By=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,ug.QUERY_CONFIRM))._name=cg.QUERY_CON,r.messageId=e,r}return l(n)}(Uy),Fy=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.QUERY_ACK,e.status=0,e.identifier=lg.QUERY,e.topic="",e.targetId="",e}return l(n,[{key:"readMessage",value:function(e,t){return I(d(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}]),n}(My),Gy=function(e){var t,n=e.type;switch(n){case ug.CONN_ACK:t=new Oy(e);break;case ug.PUBLISH:(t=new Ly(e)).syncMsg=e.syncMsg;break;case ug.PUB_ACK:t=new Py(e);break;case ug.QUERY_ACK:t=new Fy(e);break;case ug.SUB_ACK:case ug.UNSUB_ACK:case ug.PING_RESP:t=new Ay(e);break;case ug.DISCONNECT:t=new Ny(e);break;default:t=new by(e),su.error("No support for deserializing "+n+" messages")}return t},jy=function(e,t){var n=new Uint8Array(e),r=new Vg(n),i=r.readByte(),s=new Pg(i),a=Gy(s);return a.read(r,n.length-1,t),a},qy=function(e){var t=e.headerCode,n=new Pg(t),r=Gy(n);for(var i in e)r[i]=e[i];return r},Ky=ir.charAt,Hy="String Iterator",Yy=Ot.set,Qy=Ot.getterFor(Hy);ml(String,"String",(function(e){Yy(this,{type:Hy,string:_n(e),index:0})}),(function(){var e,t=Qy(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Ky(n,r),t.index+=e.length,{value:e,done:!1})}));var Wy,Jy=[],zy=Q(Jy.sort),Zy=Q(Jy.push),Xy=L((function(){Jy.sort(void 0)})),$y=L((function(){Jy.sort(null)})),em=Ai("sort"),tm=!L((function(){if(de)return de<70;if(!(Sd&&Sd>3)){if(bd)return!0;if(Od)return Od<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)Jy.push({k:t+r,v:n})}for(Jy.sort((function(e,t){return t.v-e.v})),r=0;r<Jy.length;r++)t=Jy[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));ln({target:"Array",proto:!0,forced:Xy||!$y||!em||!tm},{sort:function(e){void 0!==e&&Te(e);var t=ke(this);if(tm)return void 0===e?zy(t):zy(t,e);var n,r,i=[],s=jt(t);for(r=0;r<s;r++)r in t&&Zy(i,t[r]);for(Id(i,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:_n(t)>_n(n)?1:-1}}(e)),n=i.length,r=0;r<n;)t[r]=i[r++];for(;r<s;)delete t[r++];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.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf"}(Wy||(Wy={}));var nm=Wy;o(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(){var e=o(regeneratorRuntime.mark((function e(t){var i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Date.now(),s="".concat(n,"://").concat(t,"/ping?r=").concat(Do(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:xr});case 4:return a=e.sent,e.abrupt("return",{status:a.status,host:t,cost:Date.now()-i});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return(i=(i=e.sent).filter((function(e){return 200===e.status}))).length>1&&(i=i.sort((function(e,t){return e.cost-t.cost}))),e.abrupt("return",i.map((function(e){return e.host})));case 6:case"end":return e.stop()}}),e)})));var rm,im,sm=(rm=o(regeneratorRuntime.mark((function e(t,n,r,i){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=0,t.forEach(function(){var e=o(regeneratorRuntime.mark((function e(a){var o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u="".concat(n,"://").concat(a,"/ping?r=").concat(Do(1e3,9999)),su.debug("start ping",u),s++,e.prev=3,e.next=6,r.httpReq({url:u,timeout:xr});case 6:c=e.sent,e.next=14;break;case 9:return e.prev=9,e.t0=e.catch(3),su.error("ping error: ",e.t0),i({finished:s===t.length,code:-2,host:a}),e.abrupt("return");case 14:su.debug("end ping",s,u,null===(o=c)||void 0===o?void 0:o.status),i({finished:s===t.length,code:c.status,host:a});case 16:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return rm.apply(this,arguments)}),am=function(e,t,n,r,i,s,a,o){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(s,"&pid=").concat(a,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(o?"&protocolVer="+o:"")},om=function(e){return[nm.ppMsgS,nm.pgMsgS,nm.chatMsgS].map((function(e){return nm[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"}(im||(im={}));var um,cm=function(e,t){su.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)},lm=function(e){f(c,e);var t,n,r,i,s,a=T(c);function c(e,t){var n;return u(this,c),(n=a.call(this,"websocket",t))._runtime=e,n._socket=null,n._messageIds={},n._syncMessageIds={},n._failedCount=0,n.ALLOW_FAILED_TIMES=2,n._timer=null,n._idCount=0,n._generateMessageId=function(){return n._idCount>=65535&&(n._idCount=0),++n._idCount},n}return l(c,[{key:"connect",value:(s=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var c=[],l=0,h=!1,f=!1,d=function(){var r=o(regeneratorRuntime.mark((function r(){var o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==c.length&&!h){r.next=2;break}return r.abrupt("return");case 2:return h=!0,r.next=5,u._connect(t,n,c.shift(),i,s,a);case 5:if((o=r.sent)!==yu.SUCCESS){r.next=11;break}u._checkAlive(),e(o),r.next=20;break;case 11:if(o!==Eu.REDIRECT){r.next=15;break}e(o),r.next=20;break;case 15:if(!f||0!==c.length){r.next=18;break}return e(Yc(o)),r.abrupt("return");case 18:h=!1,d();case 20:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();s=Di(s),u._watcher.status(_u.CONNECTING),sm(r,i,u._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;f=r,200===n&&(c.push(i),l++,d()),r&&0===l&&(su.error("No valid websocket server hosts!"),e(yu.RC_SOCKET_NOT_CREATED))}))})));case 1:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,a){return s.apply(this,arguments)})},{key:"_connect",value:(i=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.replace("http","ws"),u=am(o,r,t,n,this._runtime,s,"",a),su.debug("conenct start -> ".concat(u)),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(u),l=function(e){f._timer&&(clearTimeout(f._timer),f._timer=null),f._socket===c&&(f._socket=null,f._watcher.status(e))},e.next=8,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=jy(t,a);if(n instanceof Ay&&f._pingResolve)return f._pingResolve(yu.SUCCESS),void(f._pingResolve=void 0);if(n instanceof Oy)return su.debug("recv connect ack -> ".concat(n.status)),n.status!==Eu.ACCEPTED?(su.warn("connect failed: ".concat(n.status)),void e(n.status)):(su.info("connect success -> ".concat(u)),f.connectedTime=n.timestamp,f.userId=n.userId||"",f._idCount=n.messageId,void e(yu.SUCCESS));if(n instanceof Ny){var r=n.status;switch(su.warn("recv disconnect signal -> status: ".concat(r)),r){case im.BLOCK_NEW:case im.BLOCK:f._watcher.status(_u.BLOCKED);break;case im.OTHER_DEVICE_LOGIN:f._watcher.status(_u.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case im.REDIRECT_NEW:case im.REDIRECT:f._watcher.status(_u.REDIRECT);break;default:f._watcher.status(_u.DISCONNECT_BY_SERVER)}}else f._onReceiveSignal(n)}else su.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in su.warn("websocket closed! code:",t,"reason:",n),l(_u.CONNECTION_CLOSED),f._messageIds){var i=f._messageIds[r];delete f._messageIds[r],i(yu.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in su.error("websocket error!",null==t?void 0:t.stack),l(_u.WEBSOCKET_ERROR),f._messageIds){var r=f._messageIds[n];delete f._messageIds[n],r(yu.RC_NET_CHANNEL_INVALID)}e(yu.NETWORK_ERROR)})),c.onOpen((function(){return su.debug("websocket open =>",u)})),setTimeout((function(){e(yu.TIMEOUT)}),Pr)}));case 8:return(h=e.sent)===yu.SUCCESS?this._socket=c:(su.warn("connect result -> code: ".concat(h,", url: ").concat(u)),c.close()),e.abrupt("return",h);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s,a){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=o(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._socket){e.next=2;break}return e.abrupt("return");case 2:return su.debug("send ping ->"),this.sendOnly(new ky),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(yu.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===yu.SUCCESS){e.next=12;break}return this._failedCount+=1,su.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,su.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close(),this._watcher.status(_u.NETWORK_UNAVAILABLE)):this._checkAlive(),e.abrupt("return");case 12:su.debug("recv pong <-"),this._failedCount=0,setTimeout((function(){return r._checkAlive()}),15e3);case 15:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_onReceiveSignal",value:(n=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.messageId,t.header&&t.header.qos!==og.AT_MOST_ONCE&&(t instanceof Ly&&!t.syncMsg&&(su.info("send pubAck -> ".concat(n," ").concat(t.topic)),this.sendOnly(new Dy(n))),t instanceof Fy&&(su.info("send queryCon -> ".concat(n," ").concat(t.topic)),this.sendOnly(new By(n)))),n>0&&(t instanceof Py||t instanceof Fy)&&(su.info("recv ack -> messageId: ".concat(n," ").concat(t.topic)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof Ly)){e.next=17;break}if(s=t.syncMsg,a=t.topic,su.info("recv PublishReader -> messageId: ".concat(n," ").concat(a)),a!==nm[nm.userSetData]){e.next=9;break}return e.abrupt("return");case 9:if(s&&!om(a)){e.next=12;break}return this._watcher.signal(t),e.abrupt("return");case 12:return e.next=14,new Promise((function(e){u._syncMessageIds[n]=e}));case 14:o=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,o);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&((e instanceof xy||e instanceof Vy)&&(e.messageId=this._generateMessageId()),cm(e,this._socket))}},{key:"send",value:(t=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=c.length>3&&void 0!==c[3]?c[3]:Fr,!this._socket){e.next=18;break}return s=this._generateMessageId(),t.messageId=s,cm(t,this._socket),e.next=7,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){u._messageIds[s]&&delete u._messageIds[s],e()}),i)}));case 7:if(a=e.sent){e.next=11;break}return su.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:yu.TIMEOUT});case 11:if(a instanceof Fy||a instanceof Py){e.next=13;break}return e.abrupt("return",{code:a});case 13:if(o=n&&a.data?this.codec.decodeByPBName(a.data,n,r):a,0===a.status){e.next=17;break}return su.warn("send failed -> message: ".concat(s,", respPBName: ").concat(n,", status: ").concat(a.status)),e.abrupt("return",{code:a.status,data:n&&a.data?o:null});case 17:return e.abrupt("return",{code:yu.SUCCESS,data:o});case 18:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 19:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"close",value:function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(_u.DISCONNECTED))}}]),c}(Cy);e.HttpMethod=void 0,(um=e.HttpMethod||(e.HttpMethod={})).GET="GET",um.POST="POST";var hm=function(e){if(zo(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},fm=function(t){f(h,t);var n,r,i,s,a,c=T(h);function h(e,t){var n;return u(this,h),(n=c.call(this,"comet",t))._runtime=e,n._messageIds={},n._syncMessageIds={},n._idCount=0,n._generateMessageId=function(){return++n._idCount},n._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),n}return l(h,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ko(e.data)?JSON.parse(e.data):e.data;return n?!Qo(n)||(Bc(n,function(){var e=o(regeneratorRuntime.mark((function e(n){var r,i,s,a,o,u,c,l,h,f,d,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=n.sessionid)&&(t._sessionid=r),i=qy(n),s=i.messageId,a=i._header,o=i.status,u=a&&a.qos!==og.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof Ly&&!i.syncMsg&&(l=new Dy(s),t.sendOnly(l)),i instanceof Fy&&(h=new By(s),t.sendOnly(h))),!(i instanceof Ny)){e.next=20;break}e.t0=o,e.next=e.t0===im.OTHER_DEVICE_LOGIN?11:e.t0===im.BLOCK||e.t0===im.BLOCK_NEW?13:e.t0===im.REDIRECT_NEW||e.t0===im.REDIRECT?15:17;break;case 11:return t._watcher.status(_u.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(_u.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(_u.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(_u.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof Ly)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!om(d)){e.next=25;break}return t._watcher.signal(i),e.abrupt("return",!1);case 25:return e.next=27,new Promise((function(e){t._syncMessageIds[s]=e}));case 27:g=e.sent,delete t._syncMessageIds[s],t._watcher.signal(i,g);case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),!0):(su.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(a=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),r="".concat(t,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"&timestrap=").concat(n,"&pid=").concat(this._pid),e.next=4,this._runtime.httpReq({url:r,body:{pid:this._pid},timeout:45e3});case 4:i=e.sent,s=this.handleCometRes(i),this._isDisconnected||(s?this._startPullSignal(t):(this._isDisconnected=!0,this._watcher.status(_u.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"connect",value:(s=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Di(s),this._protocol=i,this._isDisconnected=!1,this._watcher.status(_u.CONNECTING),u=[],c=0,l=!1,h=!1,e.abrupt("return",new Promise((function(e){var a,d=(a=o(regeneratorRuntime.mark((function r(){var a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==u.length&&!l){r.next=2;break}return r.abrupt("return");case 2:return l=!0,r.next=5,f._connect(t,n,u.shift(),i,s);case 5:if((a=r.sent)!==yu.SUCCESS){r.next=11;break}f._startPullSignal(i),e(a),r.next=20;break;case 11:if(a!==Eu.REDIRECT){r.next=15;break}e(a),r.next=20;break;case 15:if(!h||0!==u.length){r.next=18;break}return e(Yc(a)),r.abrupt("return");case 18:l=!1,d();case 20:case"end":return r.stop()}}),r)}))),function(){return a.apply(this,arguments)});f._watcher.status(_u.CONNECTING),sm(r,i,f._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;h=r,200===n&&(u.push(i),c++,d()),r&&0===c&&(su.error("No valid websocket server hosts!"),e(yu.RC_SOCKET_NOT_CREATED))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,a){return s.apply(this,arguments)})},{key:"_connect",value:(i=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e){return 200!==e.status&&202!==e.status?(su.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(hm(e.data)?zo(e.data)?e.data:JSON.parse(e.data):(su.error("received data is not a validJson",e.data),!1))},o=am(i,r,t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),su.debug("conenct start -> ".concat(o)),e.next=6,this._runtime.httpReq({url:o,body:{pid:this._pid},timeout:Pr});case 6:return u=e.sent,c=a(u),this._domain=r,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):su.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(o)),e.abrupt("return",null==c?void 0:c.status);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"sendCometData",value:(r=o(regeneratorRuntime.mark((function t(n){var r,i,s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._domain,i=this._sessionid,s=this._pid,a=n.messageId,o=n.topic,u=n.targetId,c=n.getHeaderFlag(),l=o?"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(a,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(o,"&targetid=").concat(u,"&pid=").concat(s):"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(a,"&header=").concat(c,"&sessionid=").concat(i,"&pid=").concat(s),t.next=7,this._runtime.httpReq({url:l,method:e.HttpMethod.POST,body:n.getCometData()});case 7:h=t.sent,this.handleCometRes(h);case 9:case"end":return t.stop()}}),t,this)}))),function(e){return r.apply(this,arguments)})},{key:"sendOnly",value:function(e){this.sendCometData(e)}},{key:"send",value:(n=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=c.length>3&&void 0!==c[3]?c[3]:Fr,s=this._generateMessageId(),t.messageId=s,this.sendCometData(t),e.next=6,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){delete u._messageIds[s],e()}),i)}));case 6:if(a=e.sent){e.next=9;break}return e.abrupt("return",{code:yu.TIMEOUT});case 9:if(o=n&&a.data?this.codec.decodeByPBName(a.data,n,r):a,0===a.status){e.next=12;break}return e.abrupt("return",{code:a.status,data:n&&a.data?o:null});case 12:return e.abrupt("return",{code:yu.SUCCESS,data:o});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:function(){this._isDisconnected=!0,this._watcher.status(_u.DISCONNECTED)}}]),h}(Cy),dm=l((function e(t,n,r){u(this,e),this.runtime=t,this._watcher=n,this._options=r,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()})),gm=Ci.find,pm="find",vm=!0;pm in[]&&Array(1).find((function(){vm=!1})),ln({target:"Array",proto:!0,forced:vm},{find:function(e){return gm(this,e,arguments.length>1?arguments[1]:void 0)}}),Wi(pm);var ym=function(e){return["navi",e].join("_")},mm=function(e,t,n){var r,i,s=ym(e);try{var a=n.getItem(s);i=a?JSON.parse(a):[]}catch(e){i=[]}var o=Date.now();return i.length>0&&(i=i.filter((function(e){return o-e.timestamp<Lr}))),0===i.length?n.removeItem(s):n.setItem(s,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null},_m=function(){function e(t,n){u(this,e),this._runtime=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Di(this._options.apiVersion)}var t;return l(e,[{key:"getInfo",value:(t=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&this._clear(t),!(s=mm(this._appkey,t,this._runtime.localStorage))){e.next=5;break}return this._naviInfo=s,e.abrupt("return",s);case 5:return a=this._options.navigators.slice(),n.length&&n.forEach((function(e){a.indexOf(e)<0&&a.unshift(e)})),e.next=9,this._reqNavi(a,this._appkey,t,i);case 9:if(!(s=e.sent)){e.next=14;break}return this._naviInfo=s,this.setNaviInfo2Cache(t,s),e.abrupt("return",s);case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"setNaviInfo2Cache",value:function(e,t){this._naviInfo=t,function(e,t,n,r){var i,s=ym(e);try{var a=r.getItem(s);i=a?JSON.parse(a):[]}catch(e){i=[]}var o=Date.now();i.length>0&&(i=i.filter((function(e){return o-e.timestamp<Lr&&t!==e.token}))),i.push({timestamp:o,naviInfo:n,token:t}),r.setItem(s,JSON.stringify(i))}(this._appkey,e,t,this._runtime.localStorage)}},{key:"getInfoFromCache",value:function(e){return this._naviInfo}},{key:"_clear",value:function(e){!function(e,t,n){var r,i=ym(e);try{var s=n.getItem(i);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();r.length>0&&(r=r.filter((function(e){return a-e.timestamp<Lr&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)}}]),e}(),Em=Ci.findIndex,Tm="findIndex",Rm=!0;Tm in[]&&Array(1).findIndex((function(){Rm=!1})),ln({target:"Array",proto:!0,forced:Rm},{findIndex:function(e){return Em(this,e,arguments.length>1?arguments[1]:void 0)}}),Wi(Tm);var Im=Q(G.f),Cm=Q([].push),Sm=function(e){return function(t){for(var n,r=ne(t),i=Sn(r),s=i.length,a=0,o=[];s>a;)n=i[a++],x&&!Im(r,n)||Cm(o,e?[n,r[n]]:r[n]);return o}},bm={entries:Sm(!0),values:Sm(!1)}.values;ln({target:"Object",stat:!0},{values:function(e){return bm(e)}});var wm=zt.f,Om="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Nm={f:function(e){return Om&&"Window"==z(e)?function(e){try{return wm(e)}catch(e){return Eo(Om)}}(e):wm(ne(e))}},km=L((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Am=Object.isExtensible,Mm=L((function(){Am(1)}))||km?function(e){return!!ie(e)&&((!km||"ArrayBuffer"!=z(e))&&(!Am||Am(e)))}:Am,Um=!L((function(){return Object.isExtensible(Object.preventExtensions({}))})),Lm=N((function(e){var t=ut.f,n=!1,r=Pe("meta"),i=0,s=function(e){t(e,r,{value:{objectID:"O"+i++,weakData:{}}})},a=e.exports={enable:function(){a.enable=function(){},n=!0;var e=zt.f,t=Q([].splice),i={};i[r]=1,e(i).length&&(zt.f=function(n){for(var i=e(n),s=0,a=i.length;s<a;s++)if(i[s]===r){t(i,s,1);break}return i},ln({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Nm.f}))},fastKey:function(e,t){if(!ie(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Me(e,r)){if(!Mm(e))return"F";if(!t)return"E";s(e)}return e[r].objectID},getWeakData:function(e,t){if(!Me(e,r)){if(!Mm(e))return!0;if(!t)return!1;s(e)}return e[r].weakData},onFreeze:function(e){return Um&&n&&Mm(e)&&!Me(e,r)&&s(e),e}};_t[r]=!0})),xm=ut.f,Pm=Lm.fastKey,Dm=Ot.set,Vm=Ot.getterFor,Bm={getConstructor:function(e,t,n,r){var i=e((function(e,i){ps(e,s),Dm(e,{type:t,index:Ln(null),first:void 0,last:void 0,size:0}),x||(e.size=0),null!=i&&Os(i,e[r],{that:e,AS_ENTRIES:n})})),s=i.prototype,a=Vm(t),o=function(e,t,n){var r,i,s=a(e),o=u(e,t);return o?o.value=n:(s.last=o={index:i=Pm(t,!0),key:t,value:n,previous:r=s.last,next:void 0,removed:!1},s.first||(s.first=o),r&&(r.next=o),x?s.size++:e.size++,"F"!==i&&(s.index[i]=o)),e},u=function(e,t){var n,r=a(e),i=Pm(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return ss(s,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,x?e.size=0:this.size=0},delete:function(e){var t=this,n=a(t),r=u(t,e);if(r){var i=r.next,s=r.previous;delete n.index[r.index],r.removed=!0,s&&(s.next=i),i&&(i.previous=s),n.first==r&&(n.first=i),n.last==r&&(n.last=s),x?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=a(this),r=Ti(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),ss(s,n?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return o(this,0===e?0:e,t)}}:{add:function(e){return o(this,e=0===e?0:e,e)}}),x&&xm(s,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=Vm(t),s=Vm(r);ml(e,t,(function(e,t){Dm(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=s(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),ds(t)}};!function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),s=r?"set":"add",a=U[e],o=a&&a.prototype,u=a,c={},l=function(e){var t=Q(o[e]);Ut(o,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!ie(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!ie(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!ie(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(un(e,!re(a)||!(i||o.forEach&&!L((function(){(new a).entries().next()})))))u=n.getConstructor(t,e,r,s),Lm.enable();else if(un(e,!0)){var h=new u,f=h[s](i?{}:-0,1)!=h,d=L((function(){h.has(1)})),g=Ds((function(e){new a(e)})),p=!i&&L((function(){for(var e=new a,t=5;t--;)e[s](t,t);return!e.has(-0)}));g||((u=t((function(e,t){ps(e,o);var n=sc(new a,e,u);return null!=t&&Os(t,n[s],{that:n,AS_ENTRIES:r}),n}))).prototype=o,o.constructor=u),(d||p)&&(l("delete"),l("has"),r&&l("get")),(p||f)&&l(s),i&&o.clear&&delete o.clear}c[e]=u,ln({global:!0,forced:u!=a},c),hs(u,e),i||n.setStrong(u,e,r)}("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Bm);var Fm="outbox",Gm="inbox",jm=function(e,t,n){return[e,t,n].join("_")},qm=function(){function e(t,n){u(this,e),this._runtime=t,this._appkey=n,this._users={}}return l(e,[{key:"_getMemData",value:function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})}},{key:"setInboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=jm(Gm,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getInboxTime",value:function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=jm(Gm,this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime}},{key:"setOutboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=jm(Fm,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getOutboxTime",value:function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=jm(Fm,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime}}]),e}(),Km={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Hm=function(){function e(t,n){u(this,e),this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return l(e,[{key:"_add",value:function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e}},{key:"_remove",value:function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)}},{key:"_setEntry",value:function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,s=e.userId,a=this._getSetUserId(n),o=r===ku.DELETE,u=a===s,c=!this._isExisted(n),l=o?this._remove:this._add;(t||i||u||c)&&l.call(this,e)}},{key:"getValue",value:function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value}},{key:"getAllValue",value:function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e}},{key:"_getSetUserId",value:function(e){return(this._kvCaches[e]||{}).userId}},{key:"_isExisted",value:function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r}},{key:"setEntries",value: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)})),su.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),Ym=function(){function e(t){u(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return l(e,[{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.chrmId,r=t.timestamp,!((i=Km.get(n))>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullChatroomEntry(n,i);case 11:s=e.sent,a=s.code,o=s.data,this._isPulling=!1,a===yu.SUCCESS?(Km.set(n,o.syncTime||0),this._startPull()):this._startPull();case 16:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(e){Km.clear(e);var t=this._storeCaches[e];t&&t.clear()}},{key:"pullEntry",value:function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()}},{key:"setLocal",value:function(e,t,n){var r=this._storeCaches[e];eu(r)||(r=new Hm(e,n)),r.setEntries(t),this._storeCaches[e]=r}},{key:"getValue",value:function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null}},{key:"getAll",value:function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n}}]),e}(),Qm=function(){function e(t,n,r,i){u(this,e),this._runtime=t,this._appkey=n,this._userId=r,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return l(e,[{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))}},{key:"get",value:function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){su.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],eu(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()}},{key:"clear",value:function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)}}]),e}(),Wm="converStatusChanged",Jm=function(){function e(t,n,r){u(this,e),this._eventEmitter=new du,this._pullQueue=[],this._isPulling=!1,this._storage=Hr(t.runtime),this._appkey=n,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(n,"-").concat(r)}var t;return l(e,[{key:"_set",value:function(e){var t=this;if(!Xo(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var s=e.updatedTime||0;n=s>n?s:n,e.conversationType=e.type,t._eventEmitter.emit(Wm,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullConversationStatus(t);case 6:n=e.sent,r=n.code,i=n.data,r===yu.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull();case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pull",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"watch",value:function(e){this._eventEmitter.on(Wm,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(Wm,(function(e){}))}}]),e}(),zm={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}},Zm={};for(var Xm in zm){var $m=zm[Xm].keyName;Zm[$m]=Xm}var e_,t_=function(){function e(t,n,r){u(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new Qr(t,i),this._localStore=new Qr(t,"CONVER-".concat(n,"-").concat(r))}return l(e,[{key:"_getStoreKey",value:function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)}},{key:"_getConOptionByKey",value: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:Go.PRIVATE,targetId:"",channelId:""}}},{key:"updateMentionedData",value:function(e){var t,n=this,r=e.conversationType,i=e.targetId,s=e.messageType,a=e.isMentioned,o=e.content,u=e.senderUserId,c=e.channelId,l=this._getStoreKey(r,i,c),h=this._localStore.get(l)||{},f=Zm.mentionedInfo,d=Zm.hasMentioned,g=h[f]||{},p=g.userIdList||[],v=o.mentionedInfo;if(v){if(a&&r===Go.GROUP)(v.userIdList||[]).forEach((function(e){e===n._currentUserId&&p.indexOf(u)<0&&p.push(u)})),v.type===bu.ALL&&p.indexOf(u)<0&&p.push(u);if(s===Ru.RECALL&&r===Go.GROUP){var y=p.indexOf(u);y>=0&&p.splice(y,1)}v={userIdList:p,type:(null===(t=v)||void 0===t?void 0:t.type)||g.type},0!==p.length?(h[f]=v,h[d]=!0):(delete h[f],delete h[d]),eu(h)?this._localStore.set(l,h):this._localStore.remove(l)}}},{key:"set",value:function(e,t,n,r){var i=this._getStoreKey(e,t,r),s=this._localStore.get(i)||{};for(var a in n){var o=Zm[a],u=n[a];if(!Xo(o)&&!Xo(u)&&"hasMentioned"!==a&&"MentionedInfo"!==a){if(u===zm[o].defaultVal||"tags"===a&&!eu(u))delete s[o];else if("tags"===a){var c=u;for(var l in c)c[l].isTop||delete c[l].isTop;s[o]=u}else s[o]=u;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}eu(s)?this._localStore.set(i,s):this._localStore.remove(i)}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},s={};for(var a in zm){var o=zm[a],u=o.keyName,c=o.defaultVal;s[u]=i[a]||qc(c)}return s}},{key:"getValue",value:function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),s={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},a=t[r];for(var o in a){var u=zm[o],c=u.keyName,l=u.defaultVal;s[c]=a[o]||qc(l)}s=e?e(s):s,n.push(s)}return n}},{key:"getValueForTag",value:function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,s=r.targetId,a={},o=e[n];for(var u in o){var c=zm[u],l=c.keyName,h=c.defaultVal;a[l]=o[u]||qc(h)}for(var f in a.tags){Xo(t[f])&&(t[f]=[]);var d=Object.assign({},a,{conversationType:i,targetId:s});delete d.tags,t[f].push(d)}}return t}},{key:"adaptOldStore",value:function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}}catch(e){su.error("adaptOldStore error: ".concat(e.message))}}}]),e}(),n_=[Go.PRIVATE,Go.GROUP,Go.SYSTEM,Go.PUBLIC_SERVICE,Go.APP_PUBLIC_SERVICE],r_="conversationChanged",i_="conTagStatusChanged",s_=function(){function e(t,n,r,i,s){var a=this;u(this,e),this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new du,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new t_(t.runtime,n,r),this._statusManager=new Jm(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;a.addStatus(t,n)})),this._eventEmitter.on(r_,(function(e){i(e)})),this._eventEmitter.on(i_,(function(){s()}))}return l(e,[{key:"_calcUnreadCount",value:function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,s=e.isCounted,a=e.messageDirection,o=e.senderUserId,u=a===pu.SEND&&o===this._loginUserId,c=r===Ru.RECALL,l=zo(n),h=!1,f={},d=t.lastUnreadTime||0,g=t.unreadMessageCount||0;if(d>i||u)return{hasChanged:h,localConversation:t,updateItems:f};(s&&(t.unreadMessageCount=g+1,t.lastUnreadTime=i,h=!0),c&&l)&&(d>=n.sentTime&&g&&(t.unreadMessageCount=g-1,h=!0));return h&&(f.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:h,localConversation:t,updateItems:f}}},{key:"_calcMentionedInfo",value:function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;pu.SEND;var s=zo(n),a=!1,o={};return r&&s&&n.mentionedInfo&&(t.hasMentioned=!0,a=!0,o.hasMentioned={val:!0,time:i},o.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:a,localConversation:t,updateItems:o}}},{key:"_calcMentionedCount",value:function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===pu.RECEIVE&&null!=n&&n.mentionedInfo){var s=n.mentionedInfo,a=s.type,o=s.userIdList;if(a===bu.ALL||(o||[]).includes(this._loginUserId)){i=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:i,localConversation:t}}},{key:"_setUpdatedConversation",value:function(e){if(zo(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),s=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(s,e)}}},{key:"_setConTagStatusChanged",value: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 s in i)if(!n[s]||i[s].isTop!==n[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0}},{key:"addStatus",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,s=e.notificationStatus,a=e.isTop,o=e.tags,u=e.channelId,c={},l={};n!==Go.ULTRA_GROUP&&(Xo(s)||(l.notificationStatus={time:i,val:s}),Xo(a)||(l.isTop={time:i,val:a}),Xo(o)||(l.tags={time:i,val:o},null==o||o.forEach((function(e){c[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,c,u),this._store.set(n,r,{notificationStatus:s,isTop:a,tags:c},u),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:l,channelId:u}),t&&this._notifyConversationChanged())}},{key:"_notifyConversationChanged",value:function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(r_,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(i_),this._conTagStatusChanged=!1))}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,s=e.isPersited,a=e.targetId,o=e.channelId;if(n_.indexOf(r)>=0){var u=!1,c=this._store.get(r,a,o),l={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,c),s=r.hasChanged,a=r.localConversation,o=r.updateItems;u=u||s,l=i(i({},l),o),c=qc(a)})),u&&this._store.set(r,a,c,o),this._store.updateMentionedData(e),s){var h=this._store.get(r,a,o);h.updatedItems=i({latestMessage:{time:e.sentTime,val:e}},l),h.latestMessage=e;var f=Object.assign(h,{conversationType:r,targetId:a,channelId:o});this._setUpdatedConversation(f)}(u||s)&&this._notifyConversationChanged()}}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._store.get(e,t,n)}},{key:"getAllUnreadCount",value:function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,s=e.notificationStatus,a=e.conversationType;r=r||0,(n||1!==s)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),i}},{key:"getUnreadCountByTag",value: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}},{key:"getUnreadCount",value:function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0}},{key:"clearUnreadCount",value:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=this._store.get(e,t,n),s=i.unreadMessageCount,a=i.hasMentioned,o={};if(s&&(i.unreadMessageCount=0,o.unreadMessageCount={val:0,time:Date.now()}),a&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,o.hasMentioned={val:!1,time:Date.now()},o.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(o).length){var u=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:o});this._setUpdatedConversation(u),this._notifyConversationChanged()}}},{key:"clearAllUnreadCount",value: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))}))}},{key:"startPullConversationStatus",value:function(e){this._statusManager.pull(e)}},{key:"setDraft",value:function(e,t,n,r){var i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=n}},{key:"getDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]}},{key:"clearDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]}},{key:"addTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;s=Object.assign(s,n),this._store.set(e,t,{tags:s},r)}},{key:"deleteTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;n.forEach((function(e){delete s[e]})),this._store.set(e,t,{tags:s},r)}},{key:"getConversationListForTag",value:function(){return this._store.getValueForTag()}},{key:"getBlockConversationList",value:function(){return this._store.getValue().filter((function(e){return e.notificationStatus===Cu.OPEN})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"getTopConversationList",value:function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"adaptOldStore",value:function(){this._store.adaptOldStore()}},{key:"getUnreadMentionedCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=this.get(t,n,e);return r.unreadMentionedCount||0}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t}},{key:"getAllConversationState",value:function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))}}]),e}(),a_=function(){function e(t,n,r,i){u(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=Hr(t.runtime),this._engine=t,this._tagWatcherFunc=i}var t;return l(e,[{key:"_updateTag",value: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()}},{key:"addTag",value: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)}},{key:"deleteTag",value: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)}},{key:"getTagsInfo",value:function(){return this._storage.get(this._storageTagKey)||{}}},{key:"getTags",value: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)}))}},{key:"getTagById",value: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}},{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullUserSettings(t);case 6:n=e.sent,r=n.code,i=n.data,r!==yu.SUCCESS||Xo(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,a=i.version,o=s.Tag,Xo(o)||this._updateTag(o),this._storage.set(this._storagePullTimeKey,a),this._isPulling=!1,this._startPull());case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullUserSettings",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"getVersion",value:function(){return this._storage.get(this._storagePullTimeKey)||0}}]),e}(),o_=function(e){f(i,e);var t,n,r=T(i);function i(e,t){var n;return u(this,i),(n=r.call(this,e,t))._miniConnectUrl="",n._connectType=t.connectionType,n}return l(i,[{key:"_formatJSONPUrl",value:function(e,t,n,r){var i=this._runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(i,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(r,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())}},{key:"getInfo",value:(n=o(regeneratorRuntime.mark((function e(t,n,r){var s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._runtime.useNavi||(a=this._runtime.isSupportSocket()&&"websocket"===this._connectType?Vr.join(","):Br.join(","),this._miniConnectUrl=null!==(s=this._options.miniCMPProxy)&&void 0!==s&&s.length?this._options.miniCMPProxy.join(","):a||"",n=[]),e.abrupt("return",I(d(i.prototype),"getInfo",this).call(this,t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"_reqNavi",value:(t=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i="getServerEndpoint",s=0,a=t.length;case 2:if(!(s<a)){e.next=28;break}return o=this._formatJSONPUrl(t[s],r,n,i),su.debug("req navi => ".concat(o)),e.next=7,this._runtime.httpReq({url:o,timeout:1e4,dataType:"text"});case 7:if(200===(u=e.sent).status){e.next=11;break}return 403===u.status?su.error("request navi error: "+yu.RC_CONN_USER_OR_PASSWD_ERROR):401===u.status&&su.error("request navi error: "+yu.RC_CONN_APP_BLOCKED_OR_DELETED),e.abrupt("continue",25);case 11:return e.prev=11,c=u.data.match(/{[\d\D]+}/),0===(l=c&&c[0]?c[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),h=JSON.parse(l),f=/^https/.test(o)?"https":"http",h.protocol=f,this._runtime.useNavi||(h.server="",h.backupServer=this._miniConnectUrl,h.logSwitch=0),e.abrupt("return",h);case 22:e.prev=22,e.t0=e.catch(11),su.error("parse navi err =>",e.t0);case 25:s+=1,e.next=2;break;case 28:if(this._runtime.useNavi){e.next=31;break}return d={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},e.abrupt("return",d);case 31:return e.abrupt("return",null);case 32:case"end":return e.stop()}}),e,this,[[11,22]])}))),function(e,n,r){return t.apply(this,arguments)})}]),i}(_m),u_=function(){function e(t){u(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return l(e,[{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.roomId,r=t.timestamp,!((i=this._pullTime)>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullRTCRoomEntry(n,i);case 11:s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS?(this._isPulling=!1,this._pullTime=o.syncTime||0,this._startPull()):this._startPull();case 15:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullEntry",value:function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()}},{key:"reset",value:function(){this._pullTime=0,this._isPulling=!1}}]),e}(),c_=function(e,t){return["send_msg",e,t].join("_")},l_=function(){function e(t,n){u(this,e),this._runtime=t,this._appkey=n,this._sendMessageMap={},this._userId=""}return l(e,[{key:"init",value:function(e){this._userId=e;var t=c_(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)}},{key:"_getLocalInfo",value:function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}}},{key:"setMessage",value:function(e,t){this._sendMessageMap[e]=t;var n=c_(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))}},{key:"getSendMessageMap",value:function(){return this._sendMessageMap}},{key:"removeByUID",value:function(e){delete this._sendMessageMap[e]}},{key:"removeByTimestamp",value:function(e){var t=c_(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}(),h_=function(e){var t="RCDeviceId",n=Hr(e),r="",i=n.get(t);return i?r=i:(r=Bo(),n.set(t,r)),r};h(e_={},Go.PRIVATE,nm.qryPMsg),h(e_,Go.GROUP,nm.qryGMsg),h(e_,Go.CHATROOM,nm.qryCHMsg),h(e_,Go.CUSTOMER_SERVICE,nm.qryCMsg),h(e_,Go.SYSTEM,nm.qrySMsg);var f_=[nm[nm.recallMsg],nm[nm.ppMsgS],nm[nm.pgMsgS],nm[nm.ppMsgP],nm[nm.pgMsgP],nm[nm.chatMsg],nm[nm.pcMsgP],nm[nm.prMsgS],nm[nm.updUgRTime]],d_=function(e){var t;return(t={},h(t,Go.PRIVATE,nm.ppMsgP),h(t,Go.GROUP,nm.pgMsgP),h(t,Go.CHATROOM,nm.chatMsg),h(t,Go.CUSTOMER_SERVICE,nm.pcMsgP),h(t,Go.RTC_ROOM,nm.prMsgS),t)[e]},g_=function(e,t,r,i,s,a){return{conversationType:e,targetId:t,senderUserId:a,messageDirection:pu.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:s,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig,channelId:r.channelId,isInterrupt:r.isInterrupt}},p_=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},v_=function(e){return e.sort((function(e,t){var n,r,i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i}))},y_=function(t){f(qe,t);var n,r,s,a,c,d,g,p,v,y,m,E,R,I,b,w,O,N,k,A,M,U,L,x,P,D,V,B,F,G,j,q,K,H,Y,Q,W,J,z,Z,X,$,ee,te,ne,re,ie,se,ae,oe,ue,ce,le,he,fe,de,ge,pe,ve,ye,me,_e,Ee,Te,Re,Ie,Ce,Se,be,we,Oe,Ne,ke,Ae,Me,Ue,Le,xe,Pe,De,Ve,Be,Fe,Ge,je=T(qe);function qe(e,t,n){var r;return u(this,qe),(r=je.call(this,e,t,n))._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._connectedTime=0,r._localConnectedTime=0,r._status=_u.DISCONNECTED,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._lastSyncUltraMsgTimeStamp=0,r._lastSyncUltraMsgLocalTimeStamp=0,r._ultraGroupTimer=-1,r._isUltraPulling=!1,r._ultraGroupTimeQue=[],r._isUltraGroupListExist=!1,r._ultraGroupMap={},r._firstPullUltraGroupTime=0,r._ultraMsgMap={},r._pullUltraChangeMessageQue=[],r._isPullingUltraChangeMessage=!1,r._lastPullingUltraChangeMessageTime=0,r._ultraMsgChangeMap={},r._letterbox=new qm(e,n.appkey),r._sendMessageStore=new l_(e,n.appkey),r._chrmEntryHandler=new Ym(_(r)),r}return l(qe,[{key:"_createNavi",value:function(){return new o_(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(Ge=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=[],this._naviInfo=n,n.server?r.push(n.server):su.warn("navi.server is invalid"),(i=n.backupServer)&&i.split(",").forEach((function(e){r.indexOf(e)<0&&r.push(e)})),0!==r.length){e.next=8;break}return su.error("navi invaild.",r),e.abrupt("return",yu.UNKNOWN);case 8:return s=this.runtime.createDataChannel({status:function(e){u._connectionStatusHandler(e,t,r,n.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),a=hg.V3,1===n.openAnti&&(a=hg.V4),e.next=13,s.connect(this._appkey,t,r,n.protocol,this._apiVer,a);case 13:return(o=e.sent)===yu.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(_u.CONNECTED),this._status=_u.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new s_(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new a_(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new u_(this),this._joinedChrmManager=new Qm(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval(),1===n.ugMsg&&this._startUltraSyncInterval()):s.close(),e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ge.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(su.warn("connection status changed:",e),this._status=e,e!==_u.CONNECTING)if(e!==_u.CONNECTED){if(this._channel&&e!==_u.DISCONNECTED)return e===_u.BLOCKED||e===_u.KICKED_OFFLINE_BY_OTHER_CLIENT||e===_u.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==_u.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)}},{key:"_try2Reconnect",value:(Fe=o(regeneratorRuntime.mark((function e(t,n,r){var i,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return");case 2:return i=hg.V3,1===this._naviInfo.openAnti&&(i=hg.V4),e.next=6,this._channel.connect(this._appkey,t,n,r,this._apiVer,i);case 6:if(e.sent!==yu.SUCCESS){e.next=16;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(_u.CONNECTED),this._status=_u.CONNECTED,this._startUltraSyncInterval(),this._rejoinChrm(),su.__insertLogIntoDatabase(),e.abrupt("return");case 16:this._watcher.status(_u.WEBSOCKET_UNAVAILABLE),this._status=_u.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(t,n,r)}),5e3);case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Fe.apply(this,arguments)})},{key:"_signalHandler",value:function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=nm[r];if(i)switch(i){case nm.s_ntf:su.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case nm.s_msg:this._receiveMsg(e);break;case nm.s_cmd:this._receiveStateNotify(e);break;case nm.s_us:this._receiveSettingNotify(e);break;case nm.rtc_ntf:this._receiveRtcKv(e);break;case nm.s_opNtf:this._pullOperateStatusNotify(e)}else su.error("unknown topic:",r)}}},{key:"_receiveStateNotify",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Wg),r=n.time,i=n.type,s=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(s,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(s),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(r),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(r),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}}},{key:"_receiveSettingNotify",value:function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,qp)).version;this._userSettingManager.pullUserSettings(n)}},{key:"_receiveRtcKv",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,_v),r=n.time,i=n.type,s=n.roomId;if(1===i)this._rtcKVManager.pullEntry(s,r)}},{key:"_receiveMessageExpansion",value: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}})}},{key:"_receiveSyncMsg",value:function(e,t){var n;if(f_.includes(e.topic)){if(e.topic===nm[nm.updUgRTime]){var r,i=null===(r=this._channel)||void 0===r?void 0:r.codec.decodeByPBName(e.data,sp),s=i.channelId,a=i.busChannel,o=this._ultraGroupMap[a+"_"+s];return o&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.lastReadTime=t.timestamp,this._watcher.conversation(Wc([o]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var u=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,Fg,{currentUserId:this.currentUserId,signal:e});u=this._handleMsgProperties(u),t&&(u.sentTime=t.timestamp,u.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||u.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),u.messageType!==Ru.EXPANSION_NOTIFY?(u.messageType===Ru.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(u.conversationType,u.targetId,u.channelId),this._conversationManager.setConversationCacheByMessage(u,!0),this._watcher.batchMessage([u])):this._receiveMessageExpansion(u))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Wg),n=t.type,r=t.chrmId,i=t.time;if(su.info("s_ntf -> type: ".concat(n,", chrmId: ").concat(r,", time: ").concat(i)),2===n){var s=this._chrmsQueue[r];if(!s)return;s.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),this._syncMsg()}}},{key:"_startSyncInterval",value:function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()}},{key:"_stopSyncInterval",value:function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)}},{key:"_syncMsg",value:(Be=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._pullingMsg){e.next=2;break}return e.abrupt("return");case 2:if(this._channel){e.next=5;break}return this._pullingMsg=!1,e.abrupt("return");case 5:return this._pullingMsg=!0,n=this._letterbox.getOutboxTime(this.currentUserId),r=this._letterbox.getInboxTime(this.currentUserId),su.info("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new Vy(nm[nm.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,qg,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(a=e.sent,o=a.code,u=a.data,this._latestSyncTimestamp=Date.now(),o===yu.SUCCESS&&u&&!Xo(u.finished)&&!Xo(u.list)&&!Xo(u.syncTime)){e.next=21;break}return su.warn("pullMsg failed -> code:",o,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,su.info("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,d=[],c.forEach((function(e){if(e.messageDirection===pu.SEND&&(f=Math.max(e.sentTime,f),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==Ru.EXPANSION_NOTIFY){if(e.messageType===Ru.SYNC_READ_STATUS){if(e.senderUserId!==p.currentUserId)return;p._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=p._handleMsgProperties(e);p._conversationManager.setConversationCacheByMessage(t,!0),d.push(t)}else p._receiveMessageExpansion(e)})),this._watcher.batchMessage(d),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,g=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(t=this._pullQueue).push.apply(t,S(g)),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!l||g.length>0)&&this._syncMsg();case 36:case"end":return e.stop()}}),e,this)}))),function(){return Be.apply(this,arguments)})},{key:"_receiveMsg",value:function(e){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var t=this._channel.codec.decodeByPBName(e.data,jg,{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!==Ru.EXPANSION_NOTIFY?t.messageType===Ru.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}}},{key:"_handleMsgProperties",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.messageType,s=e.isCounted,a=e.isPersited,o=e.isStatusMessage,u=r in qr,c=r in this._customMessageType;if(t=u?i(i({},qr[r]),{},{isStatusMessage:Kr.includes(r)}):c?this._customMessageType[r]:{isCounted:!$o(s)&&s,isPersited:!$o(a)&&a,isStatusMessage:!1},Object.assign(e,t),n&&!Xo(o)&&(e.isStatusMessage=o),!n){var l=e.content.user;if(l){var h=l.portrait,f=l.portraitUri,d=h||f;d&&(l.portrait=l.portraitUri=d)}}return e}},{key:"getHistoryMessage",value:(Ve=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c,l,h,f,d,g,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=p.length>5&&void 0!==p[5]?p[5]:"",o=this.currentUserId,u=this._channel,c=vy[t]||ly,l=1===i&&0===r,!u){e.next=15;break}return h=u.codec.encodeGetHistoryMsg(n,{timestamp:r,count:l?2:i,order:s,channelId:a}),e.next=8,u.send(new Vy(c,h,o),zg,{currentUserId:o,connectedTime:u.connectedTime,conversation:{targetId:n}});case 8:if(f=e.sent,(d=f.code)===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:d});case 12:return g=f.data,l&&2===g.list.length&&(g.hasMore=!0,0===s?g.list.shift():g.list.pop()),e.abrupt("return",{code:d,data:{list:g.list,hasMore:g.hasMore}});case 15:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return Ve.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){su.info("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Vy(nm[nm.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==yu.SUCCESS&&su.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(De=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(a=this._channel)){e.next=11;break}return o=a.codec.encodeDeleteMessages(t,n,r,i),u=new Vy(Xv,o,s),e.next=6,a.send(u);case 6:if(c=e.sent,(l=c.code)===yu.SUCCESS){e.next=10;break}return e.abrupt("return",l);case 10:return e.abrupt("return",l);case 11:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return De.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(Pe=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(a=this._channel)){e.next=12;break}return o=a.codec.encodeClearMessages(n,r,i,t),u=new Vy(yy[t],o,s),e.next=7,a.send(u);case 7:if(c=e.sent,(l=c.code)===yu.SUCCESS){e.next=11;break}return e.abrupt("return",l);case 11:return e.abrupt("return",l);case 12:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return Pe.apply(this,arguments)})},{key:"getConversationList",value:(xe=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o,u,c,l,h,f=this,d=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=d.length>0&&void 0!==d[0]?d[0]:300,n=d.length>1?d[1]:void 0,r=d.length>2?d[2]:void 0,i=d.length>3?d[3]:void 0,s=this.currentUserId,a=this._channel,n=n||Go.PRIVATE,!a){e.next=17;break}return o=a.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new Vy(ay,o,s),e.next=12,a.send(u,Xg,{currentUserId:s,connectedTime:a.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=f._conversationManager.get(t,n,r);return Object.assign(e,i),e}});case 12:if(c=e.sent,l=c.code,h=c.data,l===yu.SUCCESS){e.next=16;break}return e.abrupt("return",{code:l});case 16:return e.abrupt("return",{code:l,data:null==h?void 0:h.list});case 17:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return xe.apply(this,arguments)})},{key:"removeConversation",value:(Le=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=this._channel)){e.next=12;break}return s=i.codec.encodeRemoveOldConversationList({conversationType:t,channelId:r,targetId:n}),a=new Vy(oy,s,n),e.next=6,i.send(a);case 6:if(o=e.sent,su.info("RemoveConversation =>",o),(u=o.code)===yu.SUCCESS){e.next=11;break}return e.abrupt("return",u);case 11:return e.abrupt("return",u);case 12:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Le.apply(this,arguments)})},{key:"getConversation",value:(Ue=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==Go.ULTRA_GROUP){e.next=6;break}if(i=this._ultraGroupMap[r+"_"+n]){e.next=4;break}return e.abrupt("return",{code:yu.CONVER_GET_ERROR});case 4:e.next=18;break;case 6:if(s=this._conversationManager.get(t,n,r)){e.next=9;break}return e.abrupt("return",{code:yu.CONVER_GET_ERROR});case 9:return e.next=11,this.getHistoryMessage(t,n,0,1,0);case 11:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=16;break}return e.abrupt("return",{code:yu.CONVER_GET_ERROR});case 16:c=(null==u?void 0:u.list[0])||null,i={conversationType:t,targetId:n,channelId:r,unreadMessageCount:s.unreadMessageCount||0,latestMessage:c,notificationStatus:s.notificationStatus||Cu.CLOSE,isTop:s.isTop||!1,lastUnreadTime:s.lastUnreadTime||0,unreadMentionedCount:s.unreadMentionedCount||0};case 18:return e.abrupt("return",{code:yu.SUCCESS,data:i});case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Ue.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:yu.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t,n){var r,i;e===Go.ULTRA_GROUP?r=(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0:r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:yu.SUCCESS,data:r})}},{key:"clearConversationUnreadCount",value:function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(yu.SUCCESS)}},{key:"clearAllUnreadCount",value:function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(yu.SUCCESS)}},{key:"getFirstUnreadMessage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"saveConversationMessageDraft",value:function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(yu.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:yu.SUCCESS,data:r})}},{key:"clearConversationMessageDraft",value:function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(yu.SUCCESS)}},{key:"pullConversationStatus",value:(Me=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,!n){e.next=13;break}return i=n.codec.encodeGetConversationStatus(t),s=new Vy(nm[nm.pullSeAtts],i,r),e.next=6,n.send(s,Hp);case 6:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.channelId,s=e.isTop,a=l._ultraGroupMap[i+"_"+n];t===Go.ULTRA_GROUP?a&&(void 0!==r&&(a.notificationStatus=r),"boolean"==typeof s&&(a.isTop=s)):c.push(e)})),e.abrupt("return",{code:o,data:c});case 13:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return Me.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(Ae=o(regeneratorRuntime.mark((function e(t){var n,r,s,a,o,u,c,l,h,f,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.currentUserId,!(r=this._channel)){e.next=15;break}return s=r.codec.encodeSetConversationStatus(t),a=new Vy(uy,s,n),e.next=6,r.send(a,Jp);case 6:if(o=e.sent,u=o.code,c=o.data,u!==yu.SUCCESS){e.next=14;break}return l=c,h=[],t.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,s=e.channelId,a=e.isTop;if(t===Go.ULTRA_GROUP){var o=d._ultraGroupMap[s+"_"+n];o&&(void 0!==r&&(o.notificationStatus=r),void 0!==a&&(o.isTop=a),h.push(o))}else d._conversationManager.addStatus(i(i({},e),{},{updatedTime:l.version}),!0)})),h.length>0&&(f=Wc(h),f=v_(f),this._watcher.conversation(f)),e.abrupt("return",u);case 14:return e.abrupt("return",u);case 15:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return Ae.apply(this,arguments)})},{key:"_joinChrm",value:(ke=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),a=new Vy(r?ey:$v,s,t),e.next=8,i.send(a,op);case 8:return o=e.sent,u=o.code,c=o.data,u===yu.SUCCESS&&(l=c.joinTime,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,n,l),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,n)),e.abrupt("return",u);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ke.apply(this,arguments)})},{key:"_rejoinChrm",value:(Ne=o(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this._joinedChrmManager.get(),e.t0=regeneratorRuntime.keys(t);case 2:if((e.t1=e.t0()).done){e.next=10;break}return n=e.t1.value,e.next=6,this._joinChrm(n,t[n]||10,!0);case 6:(r=e.sent)===yu.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:n,count:t[n]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:n,errorCode:r}}),e.next=2;break;case 10:case"end":return e.stop()}}),e,this)}))),function(){return Ne.apply(this,arguments)})},{key:"_pullChrmMsg",value:(Oe=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=v.length>1&&void 0!==v[1]?v[1]:10,r=v.length>2&&void 0!==v[2]?v[2]:0,this._channel){e.next=4;break}return e.abrupt("return");case 4:if(i=this._chrmsQueue[t],s=i.pulling,a=i.timestamp,!s){e.next=8;break}return e.abrupt("return");case 8:return i.pulling=!0,o=this._channel.codec.encodeChrmSyncMsg(a,n),u=new Vy(nm[nm.chrmPull],o,t),e.next=13,this._channel.send(u,qg,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===yu.SUCCESS&&h){e.next=20;break}return su.warn("pull chatroom msg failed, code:",l,", data:",h),e.abrupt("return");case 20:f=h.list,d=h.syncTime,g=h.finished,i.timestamp=r?Math.max(d,r):d,i.queue=i.queue.filter((function(e){return e>d})),p=[],f.forEach((function(e){e.sentTime<a||p.push(e)})),this._watcher.batchMessage(p),(!g||i.queue.length>0)&&this._pullChrmMsg(t);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return Oe.apply(this,arguments)})},{key:"joinChatroom",value:(we=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!1));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return we.apply(this,arguments)})},{key:"joinExistChatroom",value:(be=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!0));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return be.apply(this,arguments)})},{key:"quitChatroom",value:(Se=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel){e.next=3;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new Vy(ty,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(a=s.code)===yu.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return Se.apply(this,arguments)})},{key:"getChatroomInfo",value:(Ce=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),a=new Vy(nm[nm.queryChrmI],s,t),e.next=7,i.send(a,cp);case 7:if(o=e.sent,u=o.code,c=o.data,u===yu.SUCCESS){e.next=11;break}return e.abrupt("return",{code:u});case 11:return e.abrupt("return",{code:u,data:c});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Ce.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(Ie=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this._channel){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return a=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),o=new Vy(fy,a,t),e.next=7,s.send(o,zg,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:c});case 12:return e.abrupt("return",{code:c,data:{list:l.list,hasMore:l.hasMore}});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return Ie.apply(this,arguments)})},{key:"_modifyChatroomKV",value:(Re=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),a=n.type===ku.UPDATE?ny:ry,o=new Vy(a,s,t),e.next=8,r.send(o);case 8:if(u=e.sent,(c=u.code)!==yu.SUCCESS){e.next=13;break}return this._chrmEntryHandler.setLocal(t,{kvEntries:[n],syncTime:(new Date).getTime()},i),e.abrupt("return",c);case 13:return e.abrupt("return",c);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"_modifyChatroomKVS",value:(Te=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodeModifyChatRoomKVS(t,n,i),a=n.type===ku.UPDATE?iy:sy,o=new Vy(a,s,t),e.next=8,r.send(o,Pp);case 8:return u=e.sent,c=u.code,-1!==[yu.SUCCESS,yu.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(h=[],delete(f=Object.assign({},n)).entries,n.entries.forEach((function(e){h.push(Object.assign({},e,f))})),c===yu.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(d=u.data,su.warn("设置失败的属性:",d.errorKeys),l=d.errorKeys,d&&Array.isArray(d.errorKeys)&&d.errorKeys.forEach((function(e){var t=h.findIndex((function(t){return e.key===t.key}));-1!==t&&h.splice(t,1)}))),su.warn("设置成功的属性:",h),this._chrmEntryHandler.setLocal(t,{kvEntries:h,syncTime:(new Date).getTime()},i)),e.abrupt("return",{code:c,data:l});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"setChatroomEntry",value:(Ee=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.UPDATE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"setChatroomEntries",value:(_e=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.UPDATE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKVS(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return _e.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(me=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.UPDATE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return me.apply(this,arguments)})},{key:"removeChatroomEntry",value:(ye=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.DELETE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return ye.apply(this,arguments)})},{key:"removeChatroomEntries",value:(ve=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.DELETE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKVS(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return ve.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(pe=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.DELETE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return pe.apply(this,arguments)})},{key:"getChatroomEntry",value:(ge=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._chrmEntryHandler.getValue(t,n))){e.next=5;break}return e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:r}));case 5:if(i=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:yu.RC_NET_CHANNEL_INVALID}));case 8:return s=i.codec.encodePullChatRoomKV(0),a=new Vy(nm[nm.pullKV],s,t),e.next=12,i.send(a,xp);case 12:if(o=e.sent,!((u=o.data||{})&&u.kvEntries&&u.kvEntries.length)){e.next=18;break}if(c=u.kvEntries.find((function(e){return e.key===n})),void 0===c){e.next=18;break}return e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:null==c?void 0:c.value}));case 18:return e.abrupt("return",Promise.resolve({code:yu.CHATROOM_KEY_NOT_EXIST}));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return ge.apply(this,arguments)})},{key:"getAllChatroomEntry",value:(de=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this._chrmEntryHandler.getAll(t))||!Object.keys(n).length){e.next=5;break}return e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:n}));case 5:if(r=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:yu.RC_NET_CHANNEL_INVALID}));case 8:return i={},s=r.codec.encodePullChatRoomKV(0),a=new Vy(nm[nm.pullKV],s,t),e.next=13,r.send(a,xp);case 13:return o=e.sent,(u=o.data||{})&&u.kvEntries&&u.kvEntries.length&&u.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:i}));case 17:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"pullChatroomEntry",value:(fe=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),a=new Vy(nm[nm.pullKV],s,t),e.next=7,r.send(a,xp);case 7:if(o=e.sent,u=o.code,c=o.data,u!==yu.SUCCESS){e.next=17;break}return su.info("Pull success ChrmKV, "+JSON.stringify(o)),this._chrmEntryHandler.setLocal(t,c,i),su.info("Save into cache success!"),l=c.kvEntries,h=[],l.length>0&&(l.forEach((function(e){var n=e.key,r=e.value,i=e.type,s=e.timestamp;h.push({key:n,value:r,type:i,timestamp:s,chatroomId:t})})),this._watcher.chatroom({updatedEntries:h})),e.abrupt("return",{code:u,data:c});case 17:return e.abrupt("return",{code:u});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return fe.apply(this,arguments)})},{key:"sendMessage",value:(he=o(regeneratorRuntime.mark((function e(t,n,r){var s,a,o,u,c,l,f,d,g,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(r=p_(r,this.currentUserId),r=this._handleMsgProperties(r,!0),s=!![Go.PRIVATE,Go.GROUP].includes(t)&&r.isStatusMessage,a=s?(v=t,y=void 0,(y={},h(y,Go.PRIVATE,nm.ppMsgS),h(y,Go.GROUP,nm.pgMsgS),y)[v]):d_(t)||nm.ppMsgP,s&&(r.isPersited=!1,r.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},r),(u=new xy(nm[a],o,n)).setHeaderQos(og.AT_LEAST_ONCE),!s){e.next=13;break}return this._channel.sendOnly(u),e.abrupt("return",{code:yu.SUCCESS,data:g_(t,n,i({},r),"",0,this.currentUserId)});case 13:return c=Date.now()-this._localConnectedTime+this._connectedTime,l=g_(t,n,i({},r),"",c,this.currentUserId),e.next=17,this._channel.send(u);case 17:if(f=e.sent,d=f.code,g=f.data,d===yu.SUCCESS){e.next=22;break}return e.abrupt("return",{code:d,data:l});case 22:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),l.sentTime=p.timestamp,l.messageUId=p.messageUId,this._conversationManager.setConversationCacheByMessage(l,!0),e.abrupt("return",{code:yu.SUCCESS,data:l});case 28:case"end":return e.stop()}var v,y}),e,this)}))),function(e,t,n){return he.apply(this,arguments)})},{key:"recallMsg",value:(le=o(regeneratorRuntime.mark((function e(t,n,r,s,a){var o,u,c,l,h,f,d,g,p,v,y;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return u=a.user,c={content:{conversationType:t,targetId:n,messageUId:r,sentTime:s,user:u},messageType:"RC:RcCmd",disableNotification:null==a?void 0:a.disableNotification,pushConfig:null==a?void 0:a.pushConfig,pushContent:(null===(o=a.pushConfig)||void 0===o?void 0:o.pushContent)||a.pushContent||"",channelId:a.channelId},l=nm[nm.recallMsg],h=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},c),(f=new xy(l,h,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=10,this._channel.send(f);case 10:if(d=e.sent,g=d.code,p=d.data,g===yu.SUCCESS){e.next=15;break}return e.abrupt("return",{code:g});case 15:if(v=p,t!==Go.ULTRA_GROUP){e.next=21;break}return this._ultraMsgMap[v.messageUId]=v.timestamp,e.abrupt("return",{code:yu.SUCCESS});case 21:return this._sendMessageStore.setMessage(v.messageUId,v.timestamp),y=g_(t,n,i(i({},c),{},{isPersited:!0}),v.messageUId,v.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(y,!0),e.abrupt("return",{code:yu.SUCCESS,data:y});case 25:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return le.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(ce=o(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new Vy(nm[nm.rrMsg],i,t),e.next=6,this._channel.send(s);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ce.apply(this,arguments)})},{key:"getMessageReader",value:(ue=o(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new Vy(nm[nm.rrList],i,t),e.next=6,this._channel.send(s,Xp);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ue.apply(this,arguments)})},{key:"pullUserSettings",value:(oe=o(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new Vy(nm[nm.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,jp));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return oe.apply(this,arguments)})},{key:"getFileToken",value:(ae=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":Lc(t,n),a=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),o=new Vy(nm[nm.qnTkn],a,this.currentUserId),e.next=7,this._channel.send(o,wp);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==yu.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c,data:l});case 13:return e.abrupt("return",{code:c});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return ae.apply(this,arguments)})},{key:"getFileUrl",value:(se=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return s="",a="",o="",n===Ou.QINIU?(a=Op,o=kp):(a=Np,o=Ap),s=n===Ou.QINIU?nm[nm.qnUrl]:n===Ou.AWS?nm[nm.s3Url]:n===Ou.STC?nm[nm.stcUrl]:nm[nm.aliUrl],u=this._channel.codec.encodeGetFileUrl(a,t,r,i),c=new Vy(s,u,this.currentUserId),e.next=11,this._channel.send(c,o);case 11:if(l=e.sent,h=l.code,f=l.data,d=f,h!==yu.SUCCESS){e.next=17;break}return e.abrupt("return",{code:h,data:d});case 17:return e.abrupt("return",{code:h});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return se.apply(this,arguments)})},{key:"disconnect",value: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(),this._stopUltraSyncInterval()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"getCurrentUserId",value:function(){return this.currentUserId}},{key:"createTag",value:(ie=o(regeneratorRuntime.mark((function e(t){var n,r,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),s=new Vy(nm[nm.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(s,Fp);case 7:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return c=u.version,this._userSettingManager.addTag([i(i({},t),{},{createdTime:c})],c),e.abrupt("return",{code:yu.SUCCESS,data:u});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return ie.apply(this,arguments)})},{key:"removeTag",value:(re=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new Vy(nm[nm.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,Fp);case 7:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return u=o.version,this._userSettingManager.deleteTag([t],u),e.abrupt("return",{code:yu.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"updateTag",value:(ne=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Vy(nm[nm.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,Fp);case 7:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return u=o.version,this._userSettingManager.addTag([t],u),e.abrupt("return",{code:yu.SUCCESS,data:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getTagList",value:(te=o(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._userSettingManager.getTags(),n=this._conversationManager.getConversationListForTag(),t.forEach((function(e){e.conversationCount=n[e.tagId]?n[e.tagId].length:0})),e.abrupt("return",{code:yu.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return te.apply(this,arguments)})},{key:"addTagForConversations",value:(ee=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:yu.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Vy(nm[nm.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(a=s.code)===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return(o={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),e.abrupt("return",{code:yu.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return ee.apply(this,arguments)})},{key:"removeTagForConversations",value:($=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Vy(nm[nm.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(a=s.code)===yu.SUCCESS){e.next=10;break}return e.abrupt("return",{code:a});case 10:return n.forEach((function(e){o._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),e.abrupt("return",{code:yu.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"removeTagsForConversation",value:(X=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return r=t.conversationType,i=t.targetId,s=t.channelId,a=n.map((function(e){return{tagId:e}})),o=this._channel.codec.encodeUpdateConversationTag(a,[t]),u=new Vy(nm[nm.delTag],o,this.currentUserId),e.next=8,this._channel.send(u);case 8:if(c=e.sent,(l=c.code)===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:l});case 12:return this._conversationManager.deleteTagStatus(r,i,n,s),e.abrupt("return",{code:yu.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"getConversationListByTag",value:(Z=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,s=this._channel){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return a=s.codec.encodeOldConversationList({count:r,type:Go.PRIVATE,startTime:n}),o=new Vy(ay,a,i),e.next=7,s.send(o,Xg,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,null==l?void 0:l.list),su.info("GetConversationListByTag",h),c===yu.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c});case 13:return e.abrupt("return",{code:c,data:h});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Z.apply(this,arguments)})},{key:"_conversationHasTagFilter",value:function(e,t){var n=this,r=[],s=[];function a(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var a=t.conversationType,o=t.targetId,u=t.channelId,c=n._conversationManager.get(a,o,u),l=c.hasMentioned,h=c.mentionedInfo,f=c.lastUnreadTime,d=c.notificationStatus,g=c.isTop,p=c.tags,v=c.unreadMessageCount,y=p&&p[e];if(y){var m=i(i({},t),{},{hasMentioned:l,mentionedInfo:h,lastUnreadTime:f,notificationStatus:d,isTop:g,unreadMessageCount:v});y.isTop?r.push(i(i({},m),{},{isTopInTag:!0})):s.push(i(i({},m),{},{isTopInTag:!1}))}})),[].concat(S(r.sort(a)),S(s.sort(a)))}},{key:"getUnreadCountByTag",value:(z=o(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:yu.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return z.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(J=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l,h,f,d,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.conversationType,a=n.channelId,o=r.isTop,u=[{tagId:t,isTop:o}],(c=this._conversationManager.get(s,i,a)).tags&&Object.hasOwnProperty.call(c.tags,t)){e.next=8;break}return e.abrupt("return",{code:yu.NO_TAG_IN_CONVER});case 8:return l=this._channel.codec.encodeUpdateConversationTag(u,[n]),h=new Vy(nm[nm.addTag],l,this.currentUserId),e.next=12,this._channel.send(h);case 12:if(f=e.sent,(d=f.code)===yu.SUCCESS){e.next=16;break}return e.abrupt("return",{code:d});case 16:return(g={})[t]={},o&&(g[t].isTop=!0),this._conversationManager.addTagStatus(s,i,g,a),e.abrupt("return",{code:yu.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return J.apply(this,arguments)})},{key:"getTagsForConversation",value:(W=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(s in n.tags)i.push({tagId:s,tagName:null===(a=r[s])||void 0===a?void 0:a.tagName});return e.abrupt("return",{code:yu.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return W.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:yu.SUCCESS,data:e})}},{key:"getTopConversationList",value:function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:yu.SUCCESS,data:e})}},{key:"getUnreadMentionedCount",value:function(e){var t,n;e.conversationType===Go.ULTRA_GROUP?t=(null===(n=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===n?void 0:n.unreadMentionedCount)||0:t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:yu.SUCCESS,data:e})}},{key:"getUltraGroupList",value:(Q=o(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isUltraGroupListExist){e.next=2;break}return e.abrupt("return",{code:yu.METHOD_NOT_AVAILABLE});case 2:return t=Object.values(this._ultraGroupMap),t=v_(t),n=Wc(t),e.abrupt("return",{code:yu.SUCCESS,data:n});case 6:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getBlockUltraGroupList",value:function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:yu.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===Cu.OPEN&&t.push({conversationType:Go.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"getTopUltraGroupList",value:function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:yu.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:Go.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"getUltraGroupUnreadMentionedCountByTargetId",value:function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:yu.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap){n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount)}return Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"clearUltraUnreadcount",value:(Y=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:"",this._isUltraGroupListExist){e.next=3;break}return e.abrupt("return",Promise.resolve(yu.METHOD_NOT_AVAILABLE));case 3:if(this._channel){e.next=5;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 5:if(this._status===_u.CONNECTED){e.next=7;break}return e.abrupt("return",yu.RC_NET_UNAVAILABLE);case 7:return r=Date.now(),i=this._channel.codec.encodeClearUnreadCount({conversationType:Go.ULTRA_GROUP,targetId:t,channelId:n},{timestamp:r}),(s=new xy(nm[nm.updUgRTime],i,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=13,this._channel.send(s);case 13:return a=e.sent,(o=a.code)===yu.SUCCESS&&(u=this._ultraGroupMap[n+"_"+t])&&(u.unreadMessageCount=0,u.unreadMentionedCount=0,u.lastReadTime=r),e.abrupt("return",o);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"_getUltraGroupList",value:(H=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel&&this._status===_u.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:return n=this._channel.codec.encodeUltraGroup(t,!1),r=new Vy(nm[nm.pullUgSes],n,this.currentUserId),e.next=7,this._channel.send(r,Xg,{currentUserId:this.currentUserId,conversationType:Go.ULTRA_GROUP});case 7:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS&&a){e.next=14;break}return su.warn("pull super conversation failed, code:",s,", data:",a,"retrying..."),o=setTimeout((function(){p._firstPullUltraGroupTime=t,p._getUltraGroupList(t),clearTimeout(o)}),3e3),e.abrupt("return");case 14:if(u=(null==a?void 0:a.list)||[],c=null==a?void 0:a.isFinished,u.forEach((function(e){e.notificationStatus=Cu.CLOSE,e.isTop=!1,p._ultraGroupMap[e.channelId+"_"+e.targetId]=e})),!1!==c){e.next=22;break}l=u.length>0&&u[u.length-1].versionTime||0,this._getUltraGroupList(l),e.next=33;break;case 22:return e.next=24,this.pullConversationStatus(this._firstPullUltraGroupTime);case 24:h=e.sent,f=h.code,d=h.data,f!==yu.SUCCESS&&su.warn("pullConversationStatus fail code: ".concat(f,", data: ").concat(d)),g=Object.values(this._ultraGroupMap),g=v_(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Wc(g)),0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);case 33:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_startUltraSyncInterval",value:function(){var e=this;this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._syncUltraMsg(0),function t(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)}()}},{key:"_stopUltraSyncInterval",value:function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)}},{key:"_syncUltraMsg",value:(K=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel&&this._status===_u.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(!this._isUltraPulling){e.next=4;break}return e.abrupt("return");case 4:return su.info("start pull ultra msg, time: ".concat(t)),this._isUltraPulling=!0,r=this._channel.codec.encodeSuperSyncMsg(t),i=new Vy(nm[nm.pullUgMsg],r,this.currentUserId),e.next=10,this._channel.send(i,qg,{currentUserId:this.currentUserId,conversation:{conversationType:Go.ULTRA_GROUP}});case 10:if(s=e.sent,a=s.code,o=s.data,su.info("end pull ultra msg, code: ".concat(a,", syncTime: ").concat(null==o?void 0:o.syncTime,", count: ").concat(null==o||null===(n=o.list)||void 0===n?void 0:n.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),a===yu.SUCCESS&&o){e.next=19;break}return su.warn("sync super message failed, code:",a,", data:",o),this._isUltraPulling=!1,e.abrupt("return");case 19:if(this._isUltraPulling=!1,u=o.list,c=o.syncTime,l=o.finished,this._isUltraGroupListExist){e.next=27;break}return su.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=c,e.abrupt("return");case 27:for(g in h={},f=[],u.forEach((function(e){var t,n,r,i=e.targetId,s=e.content,a=e.messageType,o=e.messageUId,u=e.channelId,l=e.isCounted;if(p._ultraMsgMap[o])delete p._ultraMsgMap[o];else{var d=0;((null==s||null===(t=s.mentionedInfo)||void 0===t?void 0:t.type)===bu.ALL||null!=s&&null!==(n=s.mentionedInfo)&&void 0!==n&&null!==(r=n.userIdList)&&void 0!==r&&r.includes(p.currentUserId))&&(d=1);var g=p._ultraGroupMap[u+"_"+i];if(g)l&&(a===Ru.RECALL?g.unreadMessageCount>0&&(g.unreadMessageCount-=1):(g.unreadMessageCount+=1,g.unreadMentionedCount+=d)),g.versionTime=c,g.latestMessage=e,h[u+"_"+i]=g;else{var v={conversationType:Go.ULTRA_GROUP,targetId:i,channelId:u,unreadMessageCount:1,unreadMentionedCount:d,versionTime:c,latestMessage:e,notificationStatus:Cu.CLOSE,isTop:!1};p._ultraGroupMap[u+"_"+i]=v,h[u+"_"+i]=v}f.push(e)}})),Object.keys(h).length>0&&(su.info("notice ultragroups"),d=Object.values(h),d=v_(d),this._watcher.conversation(Wc(d))),su.info("notice ultragroup message"),this._watcher.batchMessage(f),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>c})),this._ultraMsgMap)this._ultraMsgMap[g]<c&&delete this._ultraMsgMap[g];!1===l?this._syncUltraMsg(c):u&&u.length>0&&(this._lastSyncUltraMsgTimeStamp=c),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);case 37:case"end":return e.stop()}}),e,this)}))),function(e){return K.apply(this,arguments)})},{key:"sendUltraMessage",value:(q=o(regeneratorRuntime.mark((function e(t,n){var r,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return"RC:SRSMsg"===n.messageType&&su.warn("ultra group -> direction message convert to message"),n=this._handleMsgProperties(n,!0),r=this._channel.codec.encodeUpMsg({conversationType:Go.ULTRA_GROUP,targetId:t},n),(s=new xy(nm[nm.ugMsg],r,t)).setHeaderQos(og.AT_LEAST_ONCE),a=Date.now()-this._localConnectedTime+this._connectedTime,o=g_(Go.ULTRA_GROUP,t,i({},n),"",a,this.currentUserId),e.next=13,this._channel.send(s);case 13:if(u=e.sent,c=u.code,l=u.data,c===yu.SUCCESS){e.next=18;break}return e.abrupt("return",{code:c,data:o});case 18:return h=l,o.sentTime=h.timestamp,o.messageUId=h.messageUId,this._ultraMsgMap[h.messageUId]=h.timestamp,f=n.channelId||"",(d=this._ultraGroupMap[f+"_"+t])?d.latestMessage=o:(d={conversationType:Go.ULTRA_GROUP,targetId:t,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:o.sentTime,latestMessage:o,notificationStatus:Cu.CLOSE,isTop:!1},this._ultraGroupMap[f+"_"+t]=d),this._watcher.conversation(Wc([d])),e.abrupt("return",{code:c,data:o});case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"sendUltraGroupTypingStatus",value:(j=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return r=t.conversationType,i=t.channelId,s=t.targetId,a=this._channel.codec.encodeOperateStatus(s,r,i||"",n||0),(o=new xy(nm[nm.operate],a,s)).setHeaderQos(og.AT_LEAST_ONCE),e.next=10,this._channel.send(o);case 10:if(u=e.sent,(c=u.code)===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:c,msg:yu[c]});case 14:return e.abrupt("return",{code:c});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"getUltraGroupMessageListByMessageUId",value:(G=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:if(!(t.messages&&t.messages.length<1)){e.next=6;break}return e.abrupt("return",{code:yu.MSG_LIMIT_ERROR});case 6:if(!(t.messages&&t.messages.length>20)){e.next=8;break}return e.abrupt("return",{code:yu.MSG_LIMIT_ERROR});case 8:return n={},t.messages.forEach((function(e){n[e.messageUId]=void 0})),r=this._channel.codec.encodeMsgQuery(t),(i=new xy(nm[nm.qryMsg],r,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=16,this._channel.send(i,gv);case 16:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS){e.next=21;break}return e.abrupt("return",{code:a,msg:yu[a]});case 21:return u=(o||{}).list,Array.isArray(u)&&u.forEach((function(e){var t=e.messageUId;n[t]=e})),e.abrupt("return",{code:0,data:n});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"_pullOperateStatusNotify",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,vv),n=t.conversationType,r=t.info,i=t.summary;su.info("s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}}},{key:"expandUltraMessage",value:(F=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodeExpandUltraMessage(t,this.currentUserId),(r=new xy(nm[nm.upMsgEx],n,t.targetId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=9,this._channel.send(r);case 9:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:yu[s]});case 14:return o=a,this._ultraMsgMap[o.messageUId]=o.timestamp,e.abrupt("return",{code:s});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"modifyMessage",value:(B=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodemodifyMessage(t,this.currentUserId),(r=new xy(nm[nm.modifyMsg],n,t.targetId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=9,this._channel.send(r);case 9:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:yu[s]});case 14:return o=a,this._ultraMsgMap[o.messageUId]=o.timestamp,e.abrupt("return",{code:s});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"_pullUltraChangeMessageList",value:(V=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v,y,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return");case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return");case 4:if(!this._isPullingUltraChangeMessage){e.next=6;break}return e.abrupt("return");case 6:return this._isPullingUltraChangeMessage=!0,r=this._channel.codec.encodeQueryMsgChange(t),(i=new xy(nm[nm.qryMsgChange],r,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=12,this._channel.send(i,hv);case 12:if(s=e.sent,a=s.code,o=s.data,this._isPullingUltraChangeMessage=!1,a===yu.SUCCESS){e.next=18;break}return e.abrupt("return");case 18:for(p in c=(u=o||{}).hasNext,l=u.list,h=(null==o?void 0:o.syncTime)||0,f=[],d={},Array.isArray(l)&&l.forEach((function(e){var t=e.targetId,n=e.conversationType,r=e.sendTime,i=e.messageUId,s=e.changeType,a=e.operatorId,o=e.channelId||"",u=n+"_"+t,c=i+"_"+o+"_"+r,l=d[u];if(l)l.add(c);else{var h=new Set([c]);d[u]=h}3!==s?m._ultraMsgChangeMap[i]=s:f.push({targetId:t,conversationType:n,sendTime:r,messageUId:i,senderUserId:a,channelId:o})})),Array.isArray(f)&&f.length>0&&this._watcher.ultraGroupMessageRecalled(f),g=function(e){var t=e.split("_"),n=t.shift(),r=t.join("_"),i=d[e],s=[];i.forEach((function(e){var t=C(e.split("_"),3),n=t[0],r=t[1],i=t[2];s.push({sendTime:Number(i),messageUId:n,channelId:r})}));var a={targetId:r,conversationType:Number(n),messages:s};m._pullUltraMessageList(a)},d)g(p);for(y in v=this._pullUltraChangeMessageQue.filter((function(e){return e>h})),this._pullUltraChangeMessageQue.length=0,(n=this._pullUltraChangeMessageQue).push.apply(n,S(v)),this._ultraMsgMap)this._ultraMsgMap[y]<h&&delete this._ultraMsgMap[y];c?this._pullUltraChangeMessageList(h):this._lastPullingUltraChangeMessageTime=h;case 31:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"_pullUltraMessageList",value:(D=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodeMsgQuery(t),(r=new xy(nm[nm.qryMsg],n,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=9,this._channel.send(r,gv);case 9:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:yu[s]});case 14:o=(a||{}).list,u=[],c=[],Array.isArray(o)&&o.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=l._ultraGroupMap[n+"_"+t];i&&i.latestMessage.messageUId===e.messageUId&&(i.latestMessage=e);var s=l._ultraMsgChangeMap[r+""];1===s?u.push(e):2===s&&c.push(e)})),u.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(u||[]),c.length>0&&this._watcher.ultraGroupMessageModified(c||[]);case 20:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"getUltraHistoryMsg",value:(P=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return r=this._channel.codec.encodeGetHistoryMsg(t,n),i=new Vy(nm[nm.qryUgMsg],r,this.currentUserId),e.next=8,this._channel.send(i,zg,{currentUserId:this.currentUserId,conversation:{conversationType:Go.ULTRA_GROUP,targetId:t}});case 8:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS&&o){e.next=14;break}return su.warn("get super history message failed, code:",a,", data:",o),e.abrupt("return",{code:a});case 14:return e.abrupt("return",{code:a,data:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return P.apply(this,arguments)})},{key:"searchUltraGroupMessages",value:(x=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return e.abrupt("return",{code:yu.SUCCESS});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"getAllConversationState",value:function(){return Promise.resolve({code:yu.SUCCESS,data:this._conversationManager.getAllConversationState()})}},{key:"joinRTCRoom",value:(L=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return o=this._channel.codec.encodeJoinRTCRoom(n,r,i,s,a),u=new Vy(nm[nm.rtcRJoin_data],o,t),e.abrupt("return",this._channel.send(u,hp));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return L.apply(this,arguments)})},{key:"quitRTCRoom",value:(U=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Vy(nm[nm.rtcRExit],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,e.abrupt("return",s);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"rtcPing",value:(M=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Vy(nm[nm.rtcPing],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return M.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(A=o(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Vy(nm[nm.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,Ip));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(k=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Vy(nm[nm.rtcUData],n,t),e.next=6,this._channel.send(r,hp);case 6:return i=e.sent,s=i.code,a=i.data,e.abrupt("return",{code:s,data:a?{users:a.users}:a});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"setRTCUserInfo",value:(N=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new Vy(nm[nm.rtcUPut],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return N.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(O=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new xy(nm[nm.rtcUDel],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,a=s.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"setRTCData",value:(w=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeSetRTCData(n,r,i,s,a),u=new xy(nm[nm.rtcSetData],o,t),e.next=6,this._channel.send(u);case 6:return c=e.sent,l=c.code,e.abrupt("return",l);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return w.apply(this,arguments)})},{key:"setRTCTotalRes",value:(b=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeUserSetRTCData(n,r,i,s),o=new Vy(nm[nm.userSetData],a,t),e.next=6,this._channel.send(o);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return b.apply(this,arguments)})},{key:"setRTCCDNUris",value:(I=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeUserSetRTCCDNUris(n,r),s=new Vy(nm[nm.userSetData],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return I.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:yu.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new Vy(nm[nm.rtcQryData],i,e);return this._channel.send(s,_p)}},{key:"removeRTCData",value:(R=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeRemoveRTCData(n,r,i,s),o=new xy(nm[nm.rtcDelData],a,t),e.next=6,this._channel.send(o);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return R.apply(this,arguments)})},{key:"setRTCOutData",value:function(e,t,n,r){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCOutData",value:function(e,t){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCToken",value:(E=o(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Vy(nm[nm.rtcToken],i,t),e.abrupt("return",this._channel.send(s,mp));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return E.apply(this,arguments)})},{key:"setRTCState",value:(m=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new Vy(nm[nm.rtcUserState],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,a=s.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"getRTCUserInfo",value:(y=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Method not implemented.");case 1:case"end":return e.stop()}}),e)}))),function(e){return y.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:yu.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Vy(nm[nm.rtcUList],t,e);return this._channel.send(n,hp)}},{key:"joinLivingRoomAsAudience",value:(v=o(regeneratorRuntime.mark((function t(n){var r,i,s,a,o,u,c,l,h,f=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=f.length>1&&void 0!==f[1]?f[1]:e.RTCMode.LIVE,i=f.length>2?f[2]:void 0,this._channel){t.next=4;break}return t.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),a=new Vy(nm[nm.viewerJoinR],s,n),t.next=8,this._channel.send(a,Cv);case 8:if(o=t.sent,u=o.code,c=o.data,u===yu.SUCCESS){t.next=13;break}return t.abrupt("return",{code:u});case 13:return l=c.rtcToken,h=c.entries,t.abrupt("return",{code:u,data:{token:l,kvEntries:h}});case 15:case"end":return t.stop()}}),t,this)}))),function(e){return v.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(p=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Vy(nm[nm.viewerExitR],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"rtcIdentityChange",value:(g=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeIdentityChangeInfo(n,r),s=new Vy(nm[nm.rtcIdentityChange],i,t),e.next=6,this._channel.send(s,hp);case 6:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=11;break}return e.abrupt("return",{code:o});case 11:return e.abrupt("return",{code:o,data:u});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return g.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(d=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return su.info("audience in room start pull KV"),s=r.codec.encodePullRTCRoomKV(t,0),a=new Vy(nm[nm.rtcPullKv],s,i),e.next=8,r.send(a,Tv);case 8:if(o=e.sent,u=o.code,c=o.data,su.info("audience in room end pull KV, code: ".concat(u,", data: ").concat(JSON.stringify(c||{}))),u!==yu.SUCCESS){e.next=16;break}return l=c.kvEntries,this._watcher.onRTCDataChange(l,t),e.abrupt("return",{code:u,data:c});case 16:return e.abrupt("return",{code:u});case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getRTCJoinedUserInfo",value:(c=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,n){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return i=n.codec.encodeQueryUserJoinedInfo(t),s=new Vy(nm[nm.rtcQueryJoined],i,r),e.next=7,n.send(s,Iv);case 7:if(a=e.sent,o=a.code,u=a.data,o!==yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o,data:u});case 12:return e.abrupt("return",{code:o});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"getDeviceId",value:function(){return h_(this.runtime)}},{key:"requestRoomPK",value:(a=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeRequestRoomPK(t),r=new Vy(nm[nm.rtcInvite],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"cancelRoomPK",value:(s=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeCancelRoomPK(t),r=new Vy(nm[nm.rtcCancelInvite],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"responseRoomPK",value:(r=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeResponseRoomPK(t),r=new Vy(nm[nm.rtcInviteAnswer],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"endRoomPK",value:(n=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeEndRoomPK(t),r=new Vy(nm[nm.rtcEndInvite],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"callExtra",value:function(e){return Promise.resolve({code:yu.EXTRA_METHOD_UNDEFINED})}},{key:"getConversationListWithAllChannel",value:function(){throw new Error("Method not implemented.")}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"clearConversations",value:function(){throw new Error("Method not implemented.")}},{key:"setUserStatusListener",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"subscribeUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"getUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"addToBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"removeFromBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"getBlacklist",value:function(){throw new Error("Method not implemented.")}},{key:"getBlacklistStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"insertMessage",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"deleteMessages",value:function(e){throw new Error("Method not implemented.")}},{key:"deleteMessagesByTimestamp",value:function(e,t,n,r,i){throw new Error("Method not implemented.")}},{key:"clearMessages",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"getMessage",value:function(e){throw new Error("Method not implemented.")}},{key:"setMessageContent",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"setMessageSearchField",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"searchConversationByContent",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"searchMessageByContent",value:function(e,t,n,r,i,s){throw new Error("Method not implemented.")}},{key:"getUnreadMentionedMessages",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageSentStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageReceivedStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"getConversationNotificationStatus",value:function(e,t,n){var r=this._conversationManager.get(e,t,n);return r?Promise.resolve({code:yu.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:yu.CONVER_GET_ERROR})}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this.getHistoryMessage(e,t,n,r,i,s)}}]),qe}(dm),m_=function(){function e(t){u(this,e),this._context=t}return l(e,[{key:"__getContext",value:function(){return this._context}},{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"getCoreVersion",value:function(){return this._context.coreVersion}},{key:"getAPIVersion",value:function(){return this._context.apiVersion}},{key:"getAppkey",value:function(){return this._context.appkey}},{key:"getCurrentId",value:function(){return this._context.getCurrentUserId()}},{key:"getConnectionStatus",value:function(){return this._context.getConnectionStatus()}},{key:"getDeviceId",value:function(){return this._context.getDeviceId()}},{key:"sendMessage",value:function(e,t,n){return this._context.sendMessage(e,t,n)}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];this._context.registerMessageType(e,t,n,r)}},{key:"getServerTime",value:function(){return this._context.getServerTime()}},{key:"getRTCJoinedUserInfo",value:function(e){return this._context.getRTCJoinedUserInfo(e)}}]),e}(),__=function(e){f(n,e);var t=T(n);function n(){return u(this,n),t.apply(this,arguments)}return l(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._context.joinRTCRoom(e,t,n,r,i,s)}},{key:"quitRTCRoom",value:function(e){return this._context.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._context.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._context.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._context.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._context.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._context.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._context.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._context.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)}},{key:"setRTCCDNUris",value:function(e,t,n){return this._context.setRTCCDNUris(e,t,n)}},{key:"getRTCData",value:function(e,t,n,r){return this._context.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._context.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._context.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._context.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._context.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._context.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._context.rtcIdentityChange(e,t,n)}},{key:"requestRoomPK",value:function(e){return this._context.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._context.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._context.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._context.endRoomPK(e)}}]),n}(m_),E_=function(){function e(){u(this,e)}return l(e,null,[{key:"compress",value: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 s=[],a=[],o=function(){if(a.length>0){var e=a.join("");if(a=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);s.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);s.push(i)}s.push(e)}},u=0;u<e.length;){var c=t.indexOf(n,e,u);if(c.length<2)a.push(e.charAt(u++));else if(c.length<4)a.push(e.substr(u,c.length)),u+=c.length;else{var l=t.numberEncode(u-c.offset),h=t.numberEncode(c.length);if(l.length+h.length>=c.length)a.push(e.substr(u,c.length)),u+=c.length;else{o();var f=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);s.push(f+l+h),u+=c.length}}}o();var d=t.numberEncode(e.length),g=String.fromCharCode(t.dataType.Tail|d.length);return s.push(g+d),s.join("")}},{key:"uncompress",value:function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),s=i&t.dataType.Mark,a=15&i,o=void 0;switch(s){case t.dataType.Compressed:var u=a>>2,c=3&a;if(0===u||0===c)throw new Error("Data parsing error,at "+n);var l=t.numberDecode(e.substr(n,u)),h=t.numberDecode(e.substr(n+=u,c));if((l=r.length-l)+h>r.length)throw new Error("Data parsing error,at "+n);n+=c,r+=r.substr(l,h);break;case t.dataType.Tail:if((o=t.numberDecode(e.substr(n,a)))!==r.length)throw console.log(r.length),console.log(o),new Error("Data parsing error,at "+n);n+=a;break e;case t.dataType.NormalExt:o=t.numberDecode(e.substr(n,a)),r+=e.substr(n+=a,o),n+=o;break;case t.dataType.Normal:r+=e.substr(n,a),n+=a;break;case t.dataType.Mark:if(a>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+a),n+=16+a;break;default:throw new Error("Data parsing error,at "+n+" header:"+s)}}while(n<e.length);return r}},{key:"indexOf",value: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 s=t.length-n,a=0,o=i.length;a<o;a++){var u=i[a],c=n-u;if(!(c>this.max)){var l=Math.min(s,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var h=2,f=h;f<l&&t.charAt(u+f)===t.charAt(n+f);f++)h++;h>=r.length&&(r.length=h,r.offset=u)}}}return r}},{key:"numberEncode",value: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("")}},{key:"numberDecode",value: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}();E_.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},E_.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",E_.scale=E_.chars.length,E_.max=238327;var T_=1,R_=!1,I_="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",C_=function(){function e(t){u(this,e),this.info=t,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=t.logPolicy.url||this.logUrl,this.level=t.logPolicy.level||this.level,this.itv=t.logPolicy.itv||this.itv,this.times=t.logPolicy.times||this.times,this.deviceId=h_(t.runtime),this.logSwitch=t.logSwitch;var n=Hc(t.runtime);this.deviceInfo="".concat(n.type,"|").concat(n.version,"|").concat(iu.sessionId),this.startReport()}var t;return l(e,[{key:"startReport",value:function(){var e=this;if(this.logSwitch&&R_){var t=this.itv*Math.pow(2,T_-1);T_<this.times&&T_++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}}},{key:"reportRealtimeLog",value:function(){var e=this,t=iu.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=E_.compress(t.map((function(e){return e.content})).join("")),r="".concat(I_).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");this.info.runtime.httpReq({method:"POST",url:r,body:n}).then((function(t){su.__clearRealTimeLog(),su.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,T_=1),e.startReport()})).catch((function(t){su.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.startTime,r=t.endTime,i=t.platform,s=t.logId,a=t.uri,o=po.getInstance(),su.debug("received report log msg, ".concat(i.toLowerCase()),o),"web"===i.toLowerCase()&&o){e.next=5;break}return e.abrupt("return");case 5:if(!(n>r)){e.next=8;break}return su.warn("report error: The start time(".concat(n,") cannot be greater than the end time(").concat(n,")")),e.abrupt("return");case 8:return e.next=10,su.__insertLogIntoDatabase();case 10:return e.next=12,o.getRangeData(fo,"time",n,r);case 12:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=E_.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&R_){var t=a||h.logUrl,n="".concat(I_).concat(t,"?version=").concat(h.info.version,"&appkey=").concat(h.info.appkey,"&userId=").concat(h.info.userId,"&logId=").concat(s,"&deviceId=").concat(h.deviceId,"&deviceInfo=").concat(h.deviceInfo,"&platform=Web"),r=5e3*(l-1);l++,setTimeout((function(){R_&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){su.debug("report full log success!")})).catch((function(t){e(),su.warn("report full log error -> "+t)}))}),r)}}();case 19:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"distroy",value:function(){T_=1,R_=!1}}],[{key:"init",value:function(t){return R_=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function S_(e){return Object.assign({},e)}var b_,w_=function(){function e(t,n){var r;(u(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.2.1-alpha.2",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=_u.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,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},n),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)&&(r=this._options.navigators).push.apply(r,S(Dr));var i={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),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this)};this._engine=Kc()?new RCCppEngine(t,i,this._options):new y_(t,i,this._options)}var t,n,r,i,s,a,c,f,d,g,p,v,y,m,_,E,T,R,I,b,w,O,N,k,A,M,U,L,x,P,D,V,B,F,G,j,q,K,H,Y,Q;return l(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return su.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new __(this):new m_(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){su.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}},{key:"_handleRedirect",value:(Q=o(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return su.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:t=e.sent,(n=t.code)!==yu.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(n),setTimeout((function(){r._handleRedirect()}),5e3));case 6:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"_connectionStatusListener",value:(Y=o(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===_u.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(t),this._handleRedirect()):t===_u.BLOCKED||t===_u.KICKED_OFFLINE_BY_OTHER_CLIENT||t===_u.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(t)):t===_u.CONNECTING?this._handleConnecting():t===_u.CONNECTED?this._handleConnected():t===_u.DISCONNECTED?this._handleDisconnect(t):t===_u.NETWORK_UNAVAILABLE&&this._handleSuspend(t),this._connectionStatus=t,(null===(n=this._watcher.rtcInnerWatcher)||void 0===n?void 0:n.status)&&this._watcher.rtcInnerWatcher.status(t),this._pluginContextQueue.forEach((function(e){e.onconnectionstatechange&&e.onconnectionstatechange(t)})),this._watcher.connectionState&&this._watcher.connectionState(t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"_handleConnecting",value:function(){this._watcher.onConnecting&&this._watcher.onConnecting()}},{key:"_handleConnected",value:function(){this._watcher.onConnected&&this._watcher.onConnected()}},{key:"_handleDisconnect",value:function(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)}},{key:"_handleSuspend",value:function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)}},{key:"_messageReceiver",value:function(e,t,n){if((e.conversationType===Go.RTC_ROOM||Object.prototype.hasOwnProperty.call(Fu,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(S_(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==Ru.TYPING_STATUS||(this._addTypingInfo(S_(e)),!this._watcher.typingState))if(e.messageType!==Ru.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==Ru.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(S_(e))}catch(e){return su.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(S_(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var r,i=null===(r=e.content)||void 0===r?void 0:r.receiptMessageDic;i&&Array.isArray(i[this._engine.currentUserId])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,i[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 s,a=e.content,o=a.startTime,u=a.endTime,c=a.platform,l=a.logId,f=a.uri,d=a.packageName,g={startTime:parseInt(o),endTime:parseInt(u),platform:c,logId:l,uri:f,packageName:d};null===(s=C_.getInstance())||void 0===s||s.reportFullLog(g)}}else if("function"==typeof this._watcher.chatroomState){var p={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){p[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:p,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:h({},e.senderUserId,"RC:ChrmQuitNtf"===e.messageType?Mu.QUIT:Mu.JOIN),chatroomId:e.targetId}})}},{key:"_batchMessageReceiver",value:function(e,t,n){var r=this,i=[];e.forEach((function(e){var s=r._messageReceiver(e,t,n);s&&i.push(s)})),i.length&&this._watcher.batchMessage&&this._watcher.batchMessage(i)}},{key:"_chatroomInfoListener",value:function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)}},{key:"_conversationInfoListener",value:function(e){this._watcher.conversationState&&this._watcher.conversationState(e)}},{key:"_expansionInfoListener",value:function(e){this._watcher.expansion&&this._watcher.expansion(e)}},{key:"_tagListener",value:function(){this._watcher.tag&&this._watcher.tag()}},{key:"_conversationTagListener",value:function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()}},{key:"_typingStatusListener",value:function(e){this._watcher.typingState&&this._watcher.typingState(e)}},{key:"_pullFinishedListener",value:function(){this._watcher.pullFinished&&this._watcher.pullFinished()}},{key:"_MessageBlockedListener",value:function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)}},{key:"_ultraGroupEnableListener",value:function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)}},{key:"_operateStatusListener",value:function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)}},{key:"_ultraGroupMessageExpansionUpdatedListener",value:function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)}},{key:"_ultraGroupMessageModifiedListener",value:function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)}},{key:"_ultraGroupMessageRecalledListener",value:function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)}},{key:"_rtcDataChange",value:function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))}},{key:"assignWatcher",value: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]=Zo(r)||zo(r)?r:void 0}}))}},{key:"resetWatcher",value:function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))}},{key:"_addTypingInfo",value:function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,s=e.channelId,a=i.typingContentType,o=s||"",u="".concat(n,"#").concat(r,"#").concat(o);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===a?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:a,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())}},{key:"_startCheckTypingInfo",value: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))}},{key:"getConnectedTime",value:function(){return this._engine.getConnectedTime()}},{key:"getServerTime",value:function(){return this._engine.getServerTime()}},{key:"getDeviceId",value:function(){return this._engine.getDeviceId()}},{key:"getCurrentUserId",value:function(){return this._engine.currentUserId}},{key:"getConnectionStatus",value:function(){return this._connectionStatus}},{key:"token",get:function(){return this._token}},{key:"connect",value:(H=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>1&&void 0!==h[1]&&h[1],r=h.length>2?h[2]:void 0,this._connectionStatus!==_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.SUCCESS,userId:this._engine.currentUserId});case 4:if(this._connectionStatus!==_u.CONNECTING){e.next=6;break}return e.abrupt("return",{code:yu.BIZ_ERROR_CONNECTING});case 6:if("string"==typeof t&&0!==t.length){e.next=8;break}return e.abrupt("return",{code:yu.RC_CONN_USER_OR_PASSWD_ERROR});case 8:return this._token=t,i=t.split("@"),s=C(i,2),a=s[1],o=a?a.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=13,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,n,this._options.checkCA);case 13:if(u=e.sent){e.next=16;break}return e.abrupt("return",{code:yu.RC_NAVI_RESOURCE_ERROR});case 16:if(1!==(null==u?void 0:u.type)){e.next=18;break}return e.abrupt("return",{code:yu.PACKAGE_ENVIRONMENT_ERROR});case 18:return c=Xu.getInfo(),e.next=21,this._engine.connect(this._getTokenWithoutNavi(),u,r);case 21:if(l=e.sent,su.__insertLogIntoDatabase(),l!==Eu.REDIRECT){e.next=28;break}return this._connectionStatus=_u.REDIRECT,e.next=27,this.connect(t,!0);case 27:return e.abrupt("return",e.sent);case 28:return l===yu.SUCCESS&&(su.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==u?void 0:u.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(c),C_.init({runtime:this._runtime,logSwitch:(null==u?void 0:u.logSwitch)||0,logPolicy:JSON.parse((null==u?void 0:u.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),iu.init(this._engine.currentUserId),this._isInternalConnected=!0),l!==yu.SUCCESS||Kc()||1===u.openUS&&this._pullUserSettings(),l!==yu.SUCCESS&&(this._connectionStatus=_u.CONNECTION_CLOSED),e.abrupt("return",{code:l,userId:this._engine.currentUserId});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_pullUserSettings",value:(K=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case 1:case"end":return e.stop()}}),e)}))),function(){return K.apply(this,arguments)})},{key:"disconnect",value:function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=C_.getInstance())||void 0===e||e.distroy(),su.__insertLogIntoDatabase(),iu.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){su.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(e){return this._isInternalConnected?Promise.resolve({code:yu.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)}},{key:"_getTokenWithoutNavi",value:function(){return this._token.replace(/@.+$/,"@")}},{key:"getInfoFromCache",value:function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._engine.registerMessageType(e,t,n,r,i)}},{key:"sendMessage",value:function(e,t,n,r){if(e!==Go.ULTRA_GROUP){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===Ru.READ_RECEIPT_RESPONSE)return Promise.resolve({code:yu.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,o=n.expansion;if(a&&tu(o))return Promise.resolve({code:yu.BIZ_ERROR_INVALID_PARAMETER});var u=JSON.stringify(n.content);return Pi(u)>Gr?Promise.resolve({code:yu.RC_MSG_CONTENT_EXCEED_LIMIT}):e===Go.ULTRA_GROUP?this._engine.sendUltraMessage(t,n):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(q=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v,y;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channelId,r=t.conversationType,i=t.targetId,s=t.messageUId,a=t.keys,o=t.expansion,u=t.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:yu.MESSAGE_KV_NOT_SUPPORT});case 3:if(c=!1,l=tu(o),h=!1,!zo(o)){e.next=18;break}f=Object.keys(o).length,c=f>20,e.t0=regeneratorRuntime.keys(o);case 10:if((e.t1=e.t0()).done){e.next=18;break}if(d=e.t1.value,g=o[d],!(h=d.length>32||g.length>4096)&&!l){e.next=16;break}return e.abrupt("break",18);case 16:e.next=10;break;case 18:if(!c&&!h){e.next=20;break}return e.abrupt("return",{code:yu.EXPANSION_LIMIT_EXCEET});case 20:if(!l){e.next=22;break}return e.abrupt("return",{code:yu.BIZ_ERROR_INVALID_PARAMETER});case 22:return p={mid:s},o&&(p.put=o),a&&(p.del=a),u&&(p.removeAll=1),e.next=28,this._engine.sendMessage(r,i,{content:p,messageType:Ru.EXPANSION_NOTIFY,channelId:n});case 28:return v=e.sent,y=v.code,e.abrupt("return",{code:y});case 31:case"end":return e.stop()}}),e,this)}))),function(e){return q.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(j=o(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:yu.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"});case 4:return e.abrupt("return",this._engine.sendReadReceiptMessage(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return j.apply(this,arguments)})},{key:"getMessageReader",value:(G=o(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:yu.READ_RECEIPT_ERROR});case 4:return e.abrupt("return",this._engine.getMessageReader(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return G.apply(this,arguments)})},{key:"_destroy",value: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){su.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=C_.getInstance())||void 0===e||e.distroy(),iu.reset()}},{key:"getHistoryMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:20,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";if(e===Go.ULTRA_GROUP){var o={timestamp:n,count:r,order:i,channelId:s};return this._engine.getUltraHistoryMsg(t,o)}return this._engine.getHistoryMessage(e,t,n,r,i,s,a||"")}},{key:"getConversationList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(t===Go.ULTRA_GROUP){var s=yu.METHOD_NOT_SUPPORT;return Promise.resolve({code:s,msg:yu[s]})}return this._engine.getConversationList(e,t,n,r,i)}},{key:"getConversation",value:function(e,t,n){return this._engine.getConversation(e,t,n)}},{key:"removeConversation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e===Go.ULTRA_GROUP?Promise.resolve(yu.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)}},{key:"getUltraGroupList",value:function(){return this._engine.getUltraGroupList()}},{key:"getBlockUltraGroupList",value:function(){return this._engine.getBlockUltraGroupList()}},{key:"getTopUltraGroupList",value:function(){return this._engine.getTopUltraGroupList()}},{key:"clearUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e===Go.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)}},{key:"clearAllUnreadCount",value:function(){return this._engine.clearAllUnreadCount()}},{key:"getUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationUnreadCount(e,t,n)}},{key:"getTotalUnreadCount",value:function(e,t,n){if(t&&t.includes(Go.ULTRA_GROUP)){var r=yu.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:yu[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[Go.PRIVATE,Go.GROUP,Go.SYSTEM,Go.PUBLIC_SERVICE],!!n)}},{key:"getFirstUnreadMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getFirstUnreadMessage(e,t,n)}},{key:"setConversationStatus",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(e===Go.ULTRA_GROUP&&void 0!==n)return Promise.resolve(yu.METHOD_NOT_SUPPORT);var s=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(s)}},{key:"saveConversationMessageDraft",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.saveConversationMessageDraft(e,t,n,r)}},{key:"getConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationMessageDraft(e,t,n)}},{key:"clearConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.clearConversationMessageDraft(e,t,n)}},{key:"recallMessage",value:function(e,t,n,r,i){return this._engine.recallMsg(e,t,n,r,i)}},{key:"deleteRemoteMessage",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return e===Go.ULTRA_GROUP?Promise.resolve(yu.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,r)}},{key:"deleteRemoteMessageByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)}},{key:"joinChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinChatroom(e,t)}},{key:"joinExistChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinExistChatroom(e,t)}},{key:"quitChatroom",value:function(e){return this._engine.quitChatroom(e)}},{key:"getChatroomInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this._engine.getChatroomInfo(e,t,n)}},{key:"setChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return Dc(n)&&Vc(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"setChatroomEntries",value:function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,s=r.value;if(!Dc(i)||!Vc(s))return Promise.resolve({code:yu.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return Dc(n)&&Vc(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return Dc(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntries",value:function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!Dc(r))return Promise.resolve({code:yu.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return Dc(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"getChatroomEntry",value:function(e,t){return this._engine.getChatroomEntry(e,t)}},{key:"getAllChatroomEntries",value:function(e){return this._engine.getAllChatroomEntry(e)}},{key:"getChatroomHistoryMessages",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this._engine.getChatroomHistoryMessages(e,r,t,n)}},{key:"getFileToken",value:(F=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this.getInfoFromCache(),a=(null==s?void 0:s.bosAddr)||"",o=(null==s?void 0:s.uploadServer)||"",u=(null==s?void 0:s.ossConfig)||"",e.next=6,this._engine.getFileToken(t,n,r,i);case 6:if(c=e.sent,l=c.code,h=c.data,l!==yu.SUCCESS){e.next=11;break}return e.abrupt("return",Promise.resolve(Object.assign(h,{bos:a,qiniu:o,ossConfig:u})));case 11:return e.abrupt("return",Promise.reject(l));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return F.apply(this,arguments)})},{key:"getFileUrl",value:(B=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=c.length>4&&void 0!==c[4]?c[4]:Ou.QINIU,null==i||!i.isBosRes){e.next=3;break}return e.abrupt("return",Promise.resolve(i));case 3:return e.next=5,this._engine.getFileUrl(t,s,n,r);case 5:if(a=e.sent,o=a.code,u=a.data,o!==yu.SUCCESS){e.next=10;break}return e.abrupt("return",Promise.resolve(u));case 10:return e.abrupt("return",Promise.reject(o));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return B.apply(this,arguments)})},{key:"createTag",value:(V=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.createTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"removeTag",value:(D=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"updateTag",value:(P=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.updateTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"getTagList",value:(x=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagList());case 1:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"addTagForConversations",value:(L=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n.length>1e3)){e.next=2;break}return e.abrupt("return",Promise.reject(yu.CONVER_OUT_LIMIT_ERROR));case 2:return e.abrupt("return",this._engine.addTagForConversations(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return L.apply(this,arguments)})},{key:"removeTagForConversations",value:(U=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagForConversations(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"removeTagsForConversation",value:(M=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagsForConversation(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return M.apply(this,arguments)})},{key:"getConversationListByTag",value:(A=o(regeneratorRuntime.mark((function e(t,n,r,i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getConversationListByTag(t,n,r,i));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return A.apply(this,arguments)})},{key:"getUnreadCountByTag",value:(k=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUnreadCountByTag(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(N=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setConversationStatusInTag(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return N.apply(this,arguments)})},{key:"getTagsForConversation",value:(O=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagsForConversation(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){return this._engine.getBlockConversationList()}},{key:"getTopConversationList",value:function(){return this._engine.getTopConversationList()}},{key:"getUnreadMentionedCount",value:function(e){return this._engine.getUnreadMentionedCount(e)}},{key:"getAllUnreadMentionedCount",value:function(){return this._engine.getAllUnreadMentionedCount()}},{key:"sendUltraGroupTypingStatus",value:function(e){if(e.conversationType!==Go.ULTRA_GROUP){var t=yu.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:yu[t]})}return this._engine.sendUltraGroupTypingStatus(e)}},{key:"getUltraGroupMessageListByMessageUId",value:function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)}},{key:"expandUltraMessage",value:(w=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.conversationType,r=t.expansion,i=t.canIncludeExpansion,n===Go.ULTRA_GROUP){e.next=4;break}return s=yu.METHOD_ONLY_SUPPORT_ULTRA_GROUP,e.abrupt("return",{code:s,msg:yu[s]});case 4:if(i){e.next=6;break}return e.abrupt("return",{code:yu.MESSAGE_KV_NOT_SUPPORT});case 6:if(a=!1,o=tu(r),u=!1,!zo(r)){e.next=21;break}c=Object.keys(r).length,a=c>20,e.t0=regeneratorRuntime.keys(r);case 13:if((e.t1=e.t0()).done){e.next=21;break}if(l=e.t1.value,h=r[l],!(u=l.length>32||h.length>64)){e.next=19;break}return e.abrupt("break",21);case 19:e.next=13;break;case 21:if(!a&&!u){e.next=23;break}return e.abrupt("return",{code:yu.EXPANSION_LIMIT_EXCEET});case 23:if(!o){e.next=25;break}return e.abrupt("return",{code:yu.BIZ_ERROR_INVALID_PARAMETER});case 25:return e.next=27,this._engine.expandUltraMessage(t);case 27:return f=e.sent,d=f.code,e.abrupt("return",{code:d});case 30:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"modifyMessage",value:(b=o(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.conversationType===Go.ULTRA_GROUP){e.next=3;break}return n=yu.METHOD_ONLY_SUPPORT_ULTRA_GROUP,e.abrupt("return",{code:n,msg:yu[n]});case 3:return e.next=5,this._engine.modifyMessage(t);case 5:return r=e.sent,i=r.code,e.abrupt("return",{code:i});case 8:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"getUltraGroupUnreadMentionedCountByTargetId",value:function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)}},{key:"getAllConversationState",value:function(){return this._engine.getAllConversationState()}},{key:"callExtra",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,[e].concat(r))}},{key:"clearConversations",value:(I=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._engine.clearConversations(t,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"setUserStatusListener",value:function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){su.error(e)}}))}},{key:"addToBlacklist",value:(R=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.addToBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"removeFromBlacklist",value:(T=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeFromBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"getBlacklist",value:(E=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklist());case 1:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"getBlacklistStatus",value:(_=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklistStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"insertMessage",value:(m=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.insertMessage(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return m.apply(this,arguments)})},{key:"deleteMessages",value:(y=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.deleteMessages(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"deleteMessagesByTimestamp",value:(v=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=a.length>4&&void 0!==a[4]?a[4]:"",e.abrupt("return",this._engine.deleteMessagesByTimestamp(t,n,r,i,s));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return v.apply(this,arguments)})},{key:"clearMessages",value:(p=o(regeneratorRuntime.mark((function e(t,n){var r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>2&&void 0!==i[2]?i[2]:"",e.abrupt("return",this._engine.clearMessages(t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"getMessage",value:(g=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getMessage(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"setMessageContent",value:(d=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageContent(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"setMessageSearchField",value:(f=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSearchField(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return f.apply(this,arguments)})},{key:"setMessageSentStatus",value:(c=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSentStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"setMessageReceivedStatus",value:(a=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageReceivedStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"setUserStatus",value:(s=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"subscribeUserStatus",value:(i=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.subscribeUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getUserStatus",value:(r=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchConversationByContent",value:(n=o(regeneratorRuntime.mark((function e(t){var n,r,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:[],r=s.length>2&&void 0!==s[2]?s[2]:"",i=s.length>3?s[3]:void 0,e.abrupt("return",this._engine.searchConversationByContent(t,n,r,i));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"searchMessageByContent",value:(t=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=u.length>6&&void 0!==u[6]?u[6]:"",e.abrupt("return",this._engine.searchMessageByContent(t,n,r,i,s,a,o));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i,s,a){return t.apply(this,arguments)})},{key:"getUnreadMentionedMessages",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getUnreadMentionedMessages(e,t,n)}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.clearUnreadCountByTimestamp(e,t,n,r)}},{key:"getConversationNotificationStatus",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationNotificationStatus(e,t,n)}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,s)}},{key:"getConversationListWithAllChannel",value:function(){return this._engine.getConversationListWithAllChannel()}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._engine.joinRTCRoom(e,t,n,r,i,s)}},{key:"quitRTCRoom",value:function(e){return this._engine.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._engine.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._engine.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._engine.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._engine.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._engine.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._engine.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return this._engine.setRTCTotalRes(e,t,n,r,i)}},{key:"setRTCCDNUris",value:function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)}},{key:"getRTCData",value:function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._engine.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._engine.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._engine.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._engine.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._engine.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)}},{key:"getRTCJoinedUserInfo",value:function(e){return this._engine.getRTCJoinedUserInfo(e)}},{key:"requestRoomPK",value:function(e){return this._engine.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._engine.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._engine.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._engine.endRoomPK(e)}}],[{key:"init",value:function(t,n){return su.setLogLevel(n.logLevel),su.setLogStdout(n.logStdout),(n.indexDBSwitch||Xo(n.indexDBSwitch))&&po.init(),su.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(su.error("Repeat initialize!"),this._context):(su.warn("RCEngine Commit:","dd7ef7feba5b7d52ab85eca736707953c9652394"),this._context=new e(t,n),su.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(b_=e.TagChangeType||(e.TagChangeType={}))[b_.add=1]="add",b_[b_.update=2]="update",b_[b_.delete=3]="delete";e.AEngine=dm,e.ANavi=_m,e.APIContext=w_,e.AppStorage=Qr,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=Fu,e.ChatroomEntryType=ku,e.ChatroomMemberChangeType=Mu,e.CometChannel=fm,e.ConnectResultCode=Eu,e.ConnectionStatus=_u,e.ConversationType=Go,e.DelayTimer=zc,e.ErrorCode=yu,e.EventEmitter=du,e.FileType=qo,e.IM_COMET_PULLMSG_TIMEOUT=45e3,e.IM_PING_INTERVAL_TIME=15e3,e.IM_PING_MIN_TIMEOUT=2e3,e.IM_PING_TIMEOUT=15e3,e.IM_SIGNAL_TIMEOUT=Fr,e.Logger=iu,e.MAX_MESSAGE_CONTENT_BYTES=Gr,e.MINI_COMET_CONNECT_URIS=Br,e.MINI_SOCKET_CONNECT_URIS=Vr,e.MentionedType=bu,e.MessageBlockType=Pu,e.MessageDirection=pu,e.MessageType=Ru,e.NAVI_CACHE_DURATION=Lr,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=Cu,e.PING_REQ_TIMEOUT=xr,e.PUBLIC_CLOUD_NAVI_URIS=Dr,e.PluginContext=m_,e.RCAssertError=ec,e.RTCPluginContext=__,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=qr,e.STATUS_MESSAGE=Kr,e.STORAGE_ROOT_KEY=jr,e.UploadMethod=Ou,e.VersionManage=Xu,e.WEB_SOCKET_TIMEOUT=Pr,e.WebSocketChannel=lm,e.appendUrl=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},e.assert=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!tc(e,t,n,r))throw new ec("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.clone=Wc,e.cloneByJSON=qc,e.forEach=Bc,e.formatConnectResponseCode=Yc,e.getBrowser=Hc,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case qo.IMAGE:t="image/jpeg";break;case qo.AUDIO:t="audio/amr";break;case qo.VIDEO:t="video/3gpp";break;case qo.SIGHT:t="video/mpeg4";break;case qo.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=Lc,e.indexOf=Gc,e.isArray=Qo,e.isArrayBuffer=Wo,e.isBoolean=Ho,e.isFunction=Zo,e.isHttpUrl=function(e){return Ko(e)&&/https?:\/\//.test(e)},e.isInObject=jc,e.isInclude=function(e,t){return-1!==Gc(e,t)},e.isNull=$o,e.isNumber=Yo,e.isObject=zo,e.isString=Ko,e.isUndefined=Xo,e.isValidChrmEntryKey=Dc,e.isValidChrmEntryValue=Vc,e.isValidConversationType=function(e){return Yo(e)&&Object.prototype.hasOwnProperty.call(Go,e)},e.isValidExpansion=tu,e.isValidFileType=function(e){return Yo(e)&&Object.prototype.hasOwnProperty.call(qo,e)},e.map=Fc,e.notEmptyArray=function(e){return Qo(e)&&e.length>0},e.notEmptyObject=eu,e.notEmptyString=Jo,e.pushConfigsToJSON=xc,e.pushJSONToConfigs=Pc,e.todo=function(e){return new Wr(e)},e.usingCppEngine=Kc,e.validate=tc,e.version="5.2.1-alpha.2",Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RCEngine={})}(this,(function(e){"use strict";var t;!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"}(t||(t={}));var n=t;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){h(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 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)}function a(e,t,n,r,i,s,a){try{var o=e[s](a),u=o.value}catch(e){return void n(e)}o.done?t(u):Promise.resolve(u).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){a(s,r,i,o,u,"next",e)}function u(e){a(s,r,i,o,u,"throw",e)}o(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(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&&p(e,t)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function v(){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}}function y(e,t,n){return y=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i},y.apply(null,arguments)}function m(e){var t="function"==typeof Map?new Map:void 0;return m=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return y(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)},m(e)}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function T(e){var t=v();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return E(this,n)}}function R(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}function I(){return I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=R(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},I.apply(this,arguments)}function C(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,s=[],a=!0,o=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);a=!0);}catch(e){o=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(o)throw i}}return s}(e,t)||b(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 S(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(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 b(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(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}var O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function N(e){var t={exports:{}};return e(t,t.exports),t.exports}var k,A,M=function(e){return e&&e.Math==Math&&e},U=M("object"==typeof globalThis&&globalThis)||M("object"==typeof window&&window)||M("object"==typeof self&&self)||M("object"==typeof O&&O)||function(){return this}()||Function("return this")(),L=function(e){try{return!!e()}catch(e){return!0}},x=!L((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),P=!L((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),D=Function.prototype.call,V=P?D.bind(D):function(){return D.apply(D,arguments)},B={}.propertyIsEnumerable,F=Object.getOwnPropertyDescriptor,G={f:F&&!B.call({1:2},1)?function(e){var t=F(this,e);return!!t&&t.enumerable}:B},j=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},q=Function.prototype,K=q.bind,H=q.call,Y=P&&K.bind(H,H),Q=P?function(e){return e&&Y(e)}:function(e){return e&&function(){return H.apply(e,arguments)}},W=Q({}.toString),J=Q("".slice),z=function(e){return J(W(e),8,-1)},Z=U.Object,X=Q("".split),$=L((function(){return!Z("z").propertyIsEnumerable(0)}))?function(e){return"String"==z(e)?X(e,""):Z(e)}:Z,ee=U.TypeError,te=function(e){if(null==e)throw ee("Can't call method on "+e);return e},ne=function(e){return $(te(e))},re=function(e){return"function"==typeof e},ie=function(e){return"object"==typeof e?null!==e:re(e)},se=function(e){return re(e)?e:void 0},ae=function(e,t){return arguments.length<2?se(U[e]):U[e]&&U[e][t]},oe=Q({}.isPrototypeOf),ue=ae("navigator","userAgent")||"",ce=U.process,le=U.Deno,he=ce&&ce.versions||le&&le.version,fe=he&&he.v8;fe&&(A=(k=fe.split("."))[0]>0&&k[0]<4?1:+(k[0]+k[1])),!A&&ue&&(!(k=ue.match(/Edge\/(\d+)/))||k[1]>=74)&&(k=ue.match(/Chrome\/(\d+)/))&&(A=+k[1]);var de=A,ge=!!Object.getOwnPropertySymbols&&!L((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&de&&de<41})),pe=ge&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ve=U.Object,ye=pe?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return re(t)&&oe(t.prototype,ve(e))},me=U.String,_e=function(e){try{return me(e)}catch(e){return"Object"}},Ee=U.TypeError,Te=function(e){if(re(e))return e;throw Ee(_e(e)+" is not a function")},Re=function(e,t){var n=e[t];return null==n?void 0:Te(n)},Ie=U.TypeError,Ce=Object.defineProperty,Se=function(e,t){try{Ce(U,e,{value:t,configurable:!0,writable:!0})}catch(n){U[e]=t}return t},be="__core-js_shared__",we=U[be]||Se(be,{}),Oe=N((function(e){(e.exports=function(e,t){return we[e]||(we[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),Ne=U.Object,ke=function(e){return Ne(te(e))},Ae=Q({}.hasOwnProperty),Me=Object.hasOwn||function(e,t){return Ae(ke(e),t)},Ue=0,Le=Math.random(),xe=Q(1..toString),Pe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+xe(++Ue+Le,36)},De=Oe("wks"),Ve=U.Symbol,Be=Ve&&Ve.for,Fe=pe?Ve:Ve&&Ve.withoutSetter||Pe,Ge=function(e){if(!Me(De,e)||!ge&&"string"!=typeof De[e]){var t="Symbol."+e;ge&&Me(Ve,e)?De[e]=Ve[e]:De[e]=pe&&Be?Be(t):Fe(t)}return De[e]},je=U.TypeError,qe=Ge("toPrimitive"),Ke=function(e,t){if(!ie(e)||ye(e))return e;var n,r=Re(e,qe);if(r){if(void 0===t&&(t="default"),n=V(r,e,t),!ie(n)||ye(n))return n;throw je("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&re(n=e.toString)&&!ie(r=V(n,e)))return r;if(re(n=e.valueOf)&&!ie(r=V(n,e)))return r;if("string"!==t&&re(n=e.toString)&&!ie(r=V(n,e)))return r;throw Ie("Can't convert object to primitive value")}(e,t)},He=function(e){var t=Ke(e,"string");return ye(t)?t:t+""},Ye=U.document,Qe=ie(Ye)&&ie(Ye.createElement),We=function(e){return Qe?Ye.createElement(e):{}},Je=!x&&!L((function(){return 7!=Object.defineProperty(We("div"),"a",{get:function(){return 7}}).a})),ze=Object.getOwnPropertyDescriptor,Ze={f:x?ze:function(e,t){if(e=ne(e),t=He(t),Je)try{return ze(e,t)}catch(e){}if(Me(e,t))return j(!V(G.f,e,t),e[t])}},Xe=x&&L((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),$e=U.String,et=U.TypeError,tt=function(e){if(ie(e))return e;throw et($e(e)+" is not an object")},nt=U.TypeError,rt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,st="enumerable",at="configurable",ot="writable",ut={f:x?Xe?function(e,t,n){if(tt(e),t=He(t),tt(n),"function"==typeof e&&"prototype"===t&&"value"in n&&ot in n&&!n.writable){var r=it(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:at in n?n.configurable:r.configurable,enumerable:st in n?n.enumerable:r.enumerable,writable:!1})}return rt(e,t,n)}:rt:function(e,t,n){if(tt(e),t=He(t),tt(n),Je)try{return rt(e,t,n)}catch(e){}if("get"in n||"set"in n)throw nt("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},ct=x?function(e,t,n){return ut.f(e,t,j(1,n))}:function(e,t,n){return e[t]=n,e},lt=Q(Function.toString);re(we.inspectSource)||(we.inspectSource=function(e){return lt(e)});var ht,ft,dt,gt=we.inspectSource,pt=U.WeakMap,vt=re(pt)&&/native code/.test(gt(pt)),yt=Oe("keys"),mt=function(e){return yt[e]||(yt[e]=Pe(e))},_t={},Et="Object already initialized",Tt=U.TypeError,Rt=U.WeakMap;if(vt||we.state){var It=we.state||(we.state=new Rt),Ct=Q(It.get),St=Q(It.has),bt=Q(It.set);ht=function(e,t){if(St(It,e))throw new Tt(Et);return t.facade=e,bt(It,e,t),t},ft=function(e){return Ct(It,e)||{}},dt=function(e){return St(It,e)}}else{var wt=mt("state");_t[wt]=!0,ht=function(e,t){if(Me(e,wt))throw new Tt(Et);return t.facade=e,ct(e,wt,t),t},ft=function(e){return Me(e,wt)?e[wt]:{}},dt=function(e){return Me(e,wt)}}var Ot={set:ht,get:ft,has:dt,enforce:function(e){return dt(e)?ft(e):ht(e,{})},getterFor:function(e){return function(t){var n;if(!ie(t)||(n=ft(t)).type!==e)throw Tt("Incompatible receiver, "+e+" required");return n}}},Nt=Function.prototype,kt=x&&Object.getOwnPropertyDescriptor,At=Me(Nt,"name"),Mt={EXISTS:At,PROPER:At&&"something"===function(){}.name,CONFIGURABLE:At&&(!x||x&&kt(Nt,"name").configurable)},Ut=N((function(e){var t=Mt.CONFIGURABLE,n=Ot.get,r=Ot.enforce,i=String(String).split("String");(e.exports=function(e,n,s,a){var o,u=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,l=!!a&&!!a.noTargetGet,h=a&&void 0!==a.name?a.name:n;re(s)&&("Symbol("===String(h).slice(0,7)&&(h="["+String(h).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Me(s,"name")||t&&s.name!==h)&&ct(s,"name",h),(o=r(s)).source||(o.source=i.join("string"==typeof h?h:""))),e!==U?(u?!l&&e[n]&&(c=!0):delete e[n],c?e[n]=s:ct(e,n,s)):c?e[n]=s:Se(n,s)})(Function.prototype,"toString",(function(){return re(this)&&n(this).source||gt(this)}))})),Lt=Math.ceil,xt=Math.floor,Pt=function(e){var t=+e;return t!=t||0===t?0:(t>0?xt:Lt)(t)},Dt=Math.max,Vt=Math.min,Bt=function(e,t){var n=Pt(e);return n<0?Dt(n+t,0):Vt(n,t)},Ft=Math.min,Gt=function(e){return e>0?Ft(Pt(e),9007199254740991):0},jt=function(e){return Gt(e.length)},qt=function(e){return function(t,n,r){var i,s=ne(t),a=jt(s),o=Bt(r,a);if(e&&n!=n){for(;a>o;)if((i=s[o++])!=i)return!0}else for(;a>o;o++)if((e||o in s)&&s[o]===n)return e||o||0;return!e&&-1}},Kt={includes:qt(!0),indexOf:qt(!1)},Ht=Kt.indexOf,Yt=Q([].push),Qt=function(e,t){var n,r=ne(e),i=0,s=[];for(n in r)!Me(_t,n)&&Me(r,n)&&Yt(s,n);for(;t.length>i;)Me(r,n=t[i++])&&(~Ht(s,n)||Yt(s,n));return s},Wt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Jt=Wt.concat("length","prototype"),zt={f:Object.getOwnPropertyNames||function(e){return Qt(e,Jt)}},Zt={f:Object.getOwnPropertySymbols},Xt=Q([].concat),$t=ae("Reflect","ownKeys")||function(e){var t=zt.f(tt(e)),n=Zt.f;return n?Xt(t,n(e)):t},en=function(e,t,n){for(var r=$t(t),i=ut.f,s=Ze.f,a=0;a<r.length;a++){var o=r[a];Me(e,o)||n&&Me(n,o)||i(e,o,s(t,o))}},tn=/#|\.prototype\./,nn=function(e,t){var n=sn[rn(e)];return n==on||n!=an&&(re(t)?L(t):!!t)},rn=nn.normalize=function(e){return String(e).replace(tn,".").toLowerCase()},sn=nn.data={},an=nn.NATIVE="N",on=nn.POLYFILL="P",un=nn,cn=Ze.f,ln=function(e,t){var n,r,i,s,a,o=e.target,u=e.global,c=e.stat;if(n=u?U:c?U[o]||Se(o,{}):(U[o]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=cn(n,r))&&a.value:n[r],!un(u?r:o+(c?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;en(s,i)}(e.sham||i&&i.sham)&&ct(s,"sham",!0),Ut(n,r,s,e)}},hn={};hn[Ge("toStringTag")]="z";var fn,dn="[object z]"===String(hn),gn=Ge("toStringTag"),pn=U.Object,vn="Arguments"==z(function(){return arguments}()),yn=dn?z:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=pn(e),gn))?n:vn?z(t):"Object"==(r=z(t))&&re(t.callee)?"Arguments":r},mn=U.String,_n=function(e){if("Symbol"===yn(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},En=function(){var e=tt(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Tn=U.RegExp,Rn=L((function(){var e=Tn("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),In=Rn||L((function(){return!Tn("a","y").sticky})),Cn={BROKEN_CARET:Rn||L((function(){var e=Tn("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:In,UNSUPPORTED_Y:Rn},Sn=Object.keys||function(e){return Qt(e,Wt)},bn=x&&!Xe?Object.defineProperties:function(e,t){tt(e);for(var n,r=ne(t),i=Sn(t),s=i.length,a=0;s>a;)ut.f(e,n=i[a++],r[n]);return e},wn={f:bn},On=ae("document","documentElement"),Nn=mt("IE_PROTO"),kn=function(){},An=function(e){return"<script>"+e+"</"+"script>"},Mn=function(e){e.write(An("")),e.close();var t=e.parentWindow.Object;return e=null,t},Un=function(){try{fn=new ActiveXObject("htmlfile")}catch(e){}var e,t;Un="undefined"!=typeof document?document.domain&&fn?Mn(fn):((t=We("iframe")).style.display="none",On.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(An("document.F=Object")),e.close(),e.F):Mn(fn);for(var n=Wt.length;n--;)delete Un.prototype[Wt[n]];return Un()};_t[Nn]=!0;var Ln=Object.create||function(e,t){var n;return null!==e?(kn.prototype=tt(e),n=new kn,kn.prototype=null,n[Nn]=e):n=Un(),void 0===t?n:wn.f(n,t)},xn=U.RegExp,Pn=L((function(){var e=xn(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Dn=U.RegExp,Vn=L((function(){var e=Dn("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Bn=Ot.get,Fn=Oe("native-string-replace",String.prototype.replace),Gn=RegExp.prototype.exec,jn=Gn,qn=Q("".charAt),Kn=Q("".indexOf),Hn=Q("".replace),Yn=Q("".slice),Qn=function(){var e=/a/,t=/b*/g;return V(Gn,e,"a"),V(Gn,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Wn=Cn.BROKEN_CARET,Jn=void 0!==/()??/.exec("")[1];(Qn||Jn||Wn||Pn||Vn)&&(jn=function(e){var t,n,r,i,s,a,o,u=this,c=Bn(u),l=_n(e),h=c.raw;if(h)return h.lastIndex=u.lastIndex,t=V(jn,h,l),u.lastIndex=h.lastIndex,t;var f=c.groups,d=Wn&&u.sticky,g=V(En,u),p=u.source,v=0,y=l;if(d&&(g=Hn(g,"y",""),-1===Kn(g,"g")&&(g+="g"),y=Yn(l,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==qn(l,u.lastIndex-1))&&(p="(?: "+p+")",y=" "+y,v++),n=new RegExp("^(?:"+p+")",g)),Jn&&(n=new RegExp("^"+p+"$(?!\\s)",g)),Qn&&(r=u.lastIndex),i=V(Gn,d?n:u,y),d?i?(i.input=Yn(i.input,v),i[0]=Yn(i[0],v),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:Qn&&i&&(u.lastIndex=u.global?i.index+i[0].length:r),Jn&&i&&i.length>1&&V(Fn,i[0],n,(function(){for(s=1;s<arguments.length-2;s++)void 0===arguments[s]&&(i[s]=void 0)})),i&&f)for(i.groups=a=Ln(null),s=0;s<f.length;s++)a[(o=f[s])[0]]=i[o[1]];return i});var zn=jn;ln({target:"RegExp",proto:!0,forced:/./.exec!==zn},{exec:zn});var Zn=Ge("species"),Xn=RegExp.prototype,$n=function(e,t,n,r){var i=Ge(e),s=!L((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=s&&!L((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Zn]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!s||!a||n){var o=Q(/./[i]),u=t(i,""[e],(function(e,t,n,r,i){var a=Q(e),u=t.exec;return u===zn||u===Xn.exec?s&&!i?{done:!0,value:o(t,n,r)}:{done:!0,value:a(n,t,r)}:{done:!1}}));Ut(String.prototype,e,u[0]),Ut(Xn,i,u[1])}r&&ct(Xn[i],"sham",!0)},er=Q("".charAt),tr=Q("".charCodeAt),nr=Q("".slice),rr=function(e){return function(t,n){var r,i,s=_n(te(t)),a=Pt(n),o=s.length;return a<0||a>=o?e?"":void 0:(r=tr(s,a))<55296||r>56319||a+1===o||(i=tr(s,a+1))<56320||i>57343?e?er(s,a):r:e?nr(s,a,a+2):i-56320+(r-55296<<10)+65536}},ir={codeAt:rr(!1),charAt:rr(!0)},sr=ir.charAt,ar=function(e,t,n){return t+(n?sr(e,t).length:1)},or=U.TypeError,ur=function(e,t){var n=e.exec;if(re(n)){var r=V(n,e,t);return null!==r&&tt(r),r}if("RegExp"===z(e))return V(zn,e,t);throw or("RegExp#exec called on incompatible receiver")};$n("match",(function(e,t,n){return[function(t){var n=te(this),r=null==t?void 0:Re(t,e);return r?V(r,t,n):new RegExp(t)[e](_n(n))},function(e){var r=tt(this),i=_n(e),s=n(t,r,i);if(s.done)return s.value;if(!r.global)return ur(r,i);var a=r.unicode;r.lastIndex=0;for(var o,u=[],c=0;null!==(o=ur(r,i));){var l=_n(o[0]);u[c]=l,""===l&&(r.lastIndex=ar(i,Gt(r.lastIndex),a)),c++}return 0===c?null:u}]}));var cr=Array.isArray||function(e){return"Array"==z(e)},lr=function(e,t,n){var r=He(t);r in e?ut.f(e,r,j(0,n)):e[r]=n},hr=function(){},fr=[],dr=ae("Reflect","construct"),gr=/^\s*(?:class|function)\b/,pr=Q(gr.exec),vr=!gr.exec(hr),yr=function(e){if(!re(e))return!1;try{return dr(hr,fr,e),!0}catch(e){return!1}},mr=function(e){if(!re(e))return!1;switch(yn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return vr||!!pr(gr,gt(e))}catch(e){return!0}};mr.sham=!0;var _r=!dr||L((function(){var e;return yr(yr.call)||!yr(Object)||!yr((function(){e=!0}))||e}))?mr:yr,Er=Ge("species"),Tr=U.Array,Rr=function(e,t){return new(function(e){var t;return cr(e)&&(t=e.constructor,(_r(t)&&(t===Tr||cr(t.prototype))||ie(t)&&null===(t=t[Er]))&&(t=void 0)),void 0===t?Tr:t}(e))(0===t?0:t)},Ir=Ge("species"),Cr=function(e){return de>=51||!L((function(){var t=[];return(t.constructor={})[Ir]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Sr=Ge("isConcatSpreadable"),br=9007199254740991,wr="Maximum allowed index exceeded",Or=U.TypeError,Nr=de>=51||!L((function(){var e=[];return e[Sr]=!1,e.concat()[0]!==e})),kr=Cr("concat"),Ar=function(e){if(!ie(e))return!1;var t=e[Sr];return void 0!==t?!!t:cr(e)};ln({target:"Array",proto:!0,forced:!Nr||!kr},{concat:function(e){var t,n,r,i,s,a=ke(this),o=Rr(a,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(Ar(s=-1===t?a:arguments[t])){if(u+(i=jt(s))>br)throw Or(wr);for(n=0;n<i;n++,u++)n in s&&lr(o,u,s[n])}else{if(u>=br)throw Or(wr);lr(o,u++,s)}return o.length=u,o}});var Mr,Ur,Lr=72e5,xr=5e3,Pr=5e3,Dr=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],Vr=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],Br=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],Fr=3e4,Gr=131072,jr="RCV4-",qr={"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}},Kr=["RC:TypSts","RC:InterceptMsg"];e.CONNECTION_TYPE=void 0,(Mr=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",Mr.COMET="comet";var Hr=function(e){return Ur||(Ur={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}}),Ur},Yr=function(){function e(t){u(this,e),this._caches={},t&&(this._caches=t)}return l(e,[{key:"set",value:function(e,t){this._caches[e]=t}},{key:"remove",value:function(e){var t=this.get(e);return delete this._caches[e],t}},{key:"get",value:function(e){return this._caches[e]}},{key:"getKeys",value:function(){var e=[];for(var t in this._caches)e.push(t);return e}}]),e}(),Qr=function(){function e(t,n){u(this,e);var r=n?"".concat(jr).concat(n):jr;this._rootStorage=Hr(t);var i=this._rootStorage.get(r)||{};this._cache=new Yr(h({},r,i)),this._storageKey=r}return l(e,[{key:"_get",value:function(){var e=this._storageKey;return this._cache.get(e)||{}}},{key:"_set",value:function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)}},{key:"set",value:function(e,t){var n=this._get();n[e]=t,this._set(n)}},{key:"remove",value:function(e){var t=this._get();delete t[e],this._set(t)}},{key:"clear",value:function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)}},{key:"get",value:function(e){return this._get()[e]}},{key:"getKeys",value:function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t}},{key:"getValues",value:function(){return this._get()||{}}}]),e}(),Wr=function(e){f(n,e);var t=T(n);function n(e){return u(this,n),t.call(this,"TODO => ".concat(e))}return l(n)}(m(Error)),Jr=Q([].slice),zr=Cr("slice"),Zr=Ge("species"),Xr=U.Array,$r=Math.max;ln({target:"Array",proto:!0,forced:!zr},{slice:function(e,t){var n,r,i,s=ne(this),a=jt(s),o=Bt(e,a),u=Bt(void 0===t?a:t,a);if(cr(s)&&(n=s.constructor,(_r(n)&&(n===Xr||cr(n.prototype))||ie(n)&&null===(n=n[Zr]))&&(n=void 0),n===Xr||void 0===n))return Jr(s,o,u);for(r=new(void 0===n?Xr:n)($r(u-o,0)),i=0;o<u;o++,i++)o in s&&lr(r,i,s[o]);return r.length=i,r}});var ei=Function.prototype,ti=ei.apply,ni=ei.call,ri="object"==typeof Reflect&&Reflect.apply||(P?ni.bind(ti):function(){return ni.apply(ti,arguments)}),ii=Math.floor,si=Q("".charAt),ai=Q("".replace),oi=Q("".slice),ui=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ci=/\$([$&'`]|\d{1,2})/g,li=function(e,t,n,r,i,s){var a=n+e.length,o=r.length,u=ci;return void 0!==i&&(i=ke(i),u=ui),ai(s,u,(function(s,u){var c;switch(si(u,0)){case"$":return"$";case"&":return e;case"`":return oi(t,0,n);case"'":return oi(t,a);case"<":c=i[oi(u,1,-1)];break;default:var l=+u;if(0===l)return s;if(l>o){var h=ii(l/10);return 0===h?s:h<=o?void 0===r[h-1]?si(u,1):r[h-1]+si(u,1):s}c=r[l-1]}return void 0===c?"":c}))},hi=Ge("replace"),fi=Math.max,di=Math.min,gi=Q([].concat),pi=Q([].push),vi=Q("".indexOf),yi=Q("".slice),mi="$0"==="a".replace(/./,"$0"),_i=!!/./[hi]&&""===/./[hi]("a","$0");$n("replace",(function(e,t,n){var r=_i?"$":"$0";return[function(e,n){var r=te(this),i=null==e?void 0:Re(e,hi);return i?V(i,e,r,n):V(t,_n(r),e,n)},function(e,i){var s=tt(this),a=_n(e);if("string"==typeof i&&-1===vi(i,r)&&-1===vi(i,"$<")){var o=n(t,s,a,i);if(o.done)return o.value}var u=re(i);u||(i=_n(i));var c=s.global;if(c){var l=s.unicode;s.lastIndex=0}for(var h=[];;){var f=ur(s,a);if(null===f)break;if(pi(h,f),!c)break;""===_n(f[0])&&(s.lastIndex=ar(a,Gt(s.lastIndex),l))}for(var d,g="",p=0,v=0;v<h.length;v++){for(var y=_n((f=h[v])[0]),m=fi(di(Pt(f.index),a.length),0),_=[],E=1;E<f.length;E++)pi(_,void 0===(d=f[E])?d:String(d));var T=f.groups;if(u){var R=gi([y],_,m,a);void 0!==T&&pi(R,T);var I=_n(ri(i,void 0,R))}else I=li(y,a,m,_,T,i);m>=p&&(g+=yi(a,p,m)+I,p=m+y.length)}return g+yi(a,p)}]}),!!L((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!mi||_i);var Ei=Q(Q.bind),Ti=function(e,t){return Te(e),void 0===t?e:P?Ei(e,t):function(){return e.apply(t,arguments)}},Ri=Q([].push),Ii=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,a=7==e,o=5==e||s;return function(u,c,l,h){for(var f,d,g=ke(u),p=$(g),v=Ti(c,l),y=jt(p),m=0,_=h||Rr,E=t?_(u,y):n||a?_(u,0):void 0;y>m;m++)if((o||m in p)&&(d=v(f=p[m],m,g),e))if(t)E[m]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return m;case 2:Ri(E,f)}else switch(e){case 4:return!1;case 7:Ri(E,f)}return s?-1:r||i?i:E}},Ci={forEach:Ii(0),map:Ii(1),filter:Ii(2),some:Ii(3),every:Ii(4),find:Ii(5),findIndex:Ii(6),filterReject:Ii(7)},Si=Ci.filter,bi=Cr("filter");ln({target:"Array",proto:!0,forced:!bi},{filter:function(e){return Si(this,e,arguments.length>1?arguments[1]:void 0)}});var wi=dn?{}.toString:function(){return"[object "+yn(this)+"]"};dn||Ut(Object.prototype,"toString",wi,{unsafe:!0});var Oi=Ci.map,Ni=Cr("map");ln({target:"Array",proto:!0,forced:!Ni},{map:function(e){return Oi(this,e,arguments.length>1?arguments[1]:void 0)}});var ki=L((function(){Sn(1)}));ln({target:"Object",stat:!0,forced:ki},{keys:function(e){return Sn(ke(e))}});var Ai=function(e,t){var n=[][e];return!!n&&L((function(){n.call(null,t||function(){return 1},1)}))},Mi=Q([].join),Ui=$!=Object,Li=Ai("join",",");ln({target:"Array",proto:!0,forced:Ui||!Li},{join:function(e){return Mi(ne(this),void 0===e?",":e)}});var xi=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e=e.replace(r,(function(e){return e.toUpperCase()}))},Pi=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8",r=0;if("utf-16"===n)for(var i=0,s=e.length;i<s;i++)r+=(t=e.charCodeAt(i))<=65535?2:4;else for(var a=0,o=e.length;a<o;a++)r+=(t=e.charCodeAt(a))<127?1:t<=2047?2:t<=65535?3:4;return r},Di=function(e){return e.match(/\d+(\.\d+){2}/)[0]};N((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,s=Object.create(i.prototype),a=new O(r||[]);return s._invoke=function(e,t,n){var r=h;return function(i,s){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===i)throw s;return k()}for(n.method=i,n.arg=s;;){var a=n.delegate;if(a){var o=S(a,n);if(o){if(o===p)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(e,t,n);if("normal"===u.type){if(r=n.done?g:f,u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=g,n.method="throw",n.arg=u.arg)}}}(e,n,a),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",f="suspendedYield",d="executing",g="completed",p={};function v(){}function y(){}function m(){}var _={};u(_,s,(function(){return this}));var E=Object.getPrototypeOf,T=E&&E(E(N([])));T&&T!==n&&r.call(T,s)&&(_=T);var R=m.prototype=v.prototype=Object.create(_);function I(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(i,s,a,o){var u=l(e[i],e,s);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,o)}),(function(e){n("throw",e,a,o)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,o)}))}o(u.arg)}var i;this._invoke=function(e,r){function s(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(s,s):s()}}function S(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=l(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var s=i.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function N(e){if(e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=m,u(R,"constructor",m),u(m,"constructor",y),y.displayName=u(m,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,o,"GeneratorFunction")),e.prototype=Object.create(R),e},e.awrap=function(e){return{__await:e}},I(C.prototype),u(C.prototype,a,(function(){return this})),e.AsyncIterator=C,e.async=function(t,n,r,i,s){void 0===s&&(s=Promise);var a=new C(c(t,n,r,i),s);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},I(R),u(R,o,"Generator"),u(R,s,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=N,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return o.type="throw",o.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));var Vi=Mt.EXISTS,Bi=ut.f,Fi=Function.prototype,Gi=Q(Fi.toString),ji=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,qi=Q(ji.exec);x&&!Vi&&Bi(Fi,"name",{configurable:!0,get:function(){try{return qi(ji,Gi(this))[1]}catch(e){return""}}});var Ki=Ge("unscopables"),Hi=Array.prototype;null==Hi[Ki]&&ut.f(Hi,Ki,{configurable:!0,value:Ln(null)});var Yi,Qi,Wi=function(e){Hi[Ki][e]=!0},Ji=Kt.includes;ln({target:"Array",proto:!0},{includes:function(e){return Ji(this,e,arguments.length>1?arguments[1]:void 0)}}),Wi("includes"),e.LogLevel=void 0,(Yi=e.LogLevel||(e.LogLevel={}))[Yi.LOG=0]="LOG",Yi[Yi.DEBUG=0]="DEBUG",Yi[Yi.INFO=1]="INFO",Yi[Yi.WARN=2]="WARN",Yi[Yi.ERROR=3]="ERROR",Yi[Yi.FATAL=4]="FATAL",Yi[Yi.NONE=1e3]="NONE",e.LogType=void 0,(Qi=e.LogType||(e.LogType={})).IM="IM",Qi.RTC="RTC";var zi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Zi=We("span").classList,Xi=Zi&&Zi.constructor&&Zi.constructor.prototype,$i=Xi===Object.prototype?void 0:Xi,es=Ci.forEach,ts=Ai("forEach")?[].forEach:function(e){return es(this,e,arguments.length>1?arguments[1]:void 0)},ns=function(e){if(e&&e.forEach!==ts)try{ct(e,"forEach",ts)}catch(t){e.forEach=ts}};for(var rs in zi)zi[rs]&&ns(U[rs]&&U[rs].prototype);ns($i);var is=U.Promise,ss=function(e,t,n){for(var r in t)Ut(e,r,t[r],n);return e},as=U.String,os=U.TypeError,us=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Q(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return tt(n),function(e){if("object"==typeof e||re(e))return e;throw os("Can't set "+as(e)+" as a prototype")}(r),t?e(n,r):n.__proto__=r,n}}():void 0),cs=ut.f,ls=Ge("toStringTag"),hs=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Me(e,ls)&&cs(e,ls,{configurable:!0,value:t})},fs=Ge("species"),ds=function(e){var t=ae(e),n=ut.f;x&&t&&!t[fs]&&n(t,fs,{configurable:!0,get:function(){return this}})},gs=U.TypeError,ps=function(e,t){if(oe(t,e))return e;throw gs("Incorrect invocation")},vs={},ys=Ge("iterator"),ms=Array.prototype,_s=function(e){return void 0!==e&&(vs.Array===e||ms[ys]===e)},Es=Ge("iterator"),Ts=function(e){if(null!=e)return Re(e,Es)||Re(e,"@@iterator")||vs[yn(e)]},Rs=U.TypeError,Is=function(e,t){var n=arguments.length<2?Ts(e):t;if(Te(n))return tt(V(n,e));throw Rs(_e(e)+" is not iterable")},Cs=function(e,t,n){var r,i;tt(e);try{if(!(r=Re(e,"return"))){if("throw"===t)throw n;return n}r=V(r,e)}catch(e){i=!0,r=e}if("throw"===t)throw n;if(i)throw r;return tt(r),n},Ss=U.TypeError,bs=function(e,t){this.stopped=e,this.result=t},ws=bs.prototype,Os=function(e,t,n){var r,i,s,a,o,u,c,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=Ti(t,l),p=function(e){return r&&Cs(r,"normal",e),new bs(!0,e)},v=function(e){return h?(tt(e),d?g(e[0],e[1],p):g(e[0],e[1])):d?g(e,p):g(e)};if(f)r=e;else{if(!(i=Ts(e)))throw Ss(_e(e)+" is not iterable");if(_s(i)){for(s=0,a=jt(e);a>s;s++)if((o=v(e[s]))&&oe(ws,o))return o;return new bs(!1)}r=Is(e,i)}for(u=r.next;!(c=V(u,r)).done;){try{o=v(c.value)}catch(e){Cs(r,"throw",e)}if("object"==typeof o&&o&&oe(ws,o))return o}return new bs(!1)},Ns=Ge("iterator"),ks=!1;try{var As=0,Ms={next:function(){return{done:!!As++}},return:function(){ks=!0}};Ms[Ns]=function(){return this},Array.from(Ms,(function(){throw 2}))}catch(e){}var Us,Ls,xs,Ps,Ds=function(e,t){if(!t&&!ks)return!1;var n=!1;try{var r={};r[Ns]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Vs=U.TypeError,Bs=function(e){if(_r(e))return e;throw Vs(_e(e)+" is not a constructor")},Fs=Ge("species"),Gs=function(e,t){var n,r=tt(e).constructor;return void 0===r||null==(n=tt(r)[Fs])?t:Bs(n)},js=U.TypeError,qs=function(e,t){if(e<t)throw js("Not enough arguments");return e},Ks=/(?:ipad|iphone|ipod).*applewebkit/i.test(ue),Hs="process"==z(U.process),Ys=U.setImmediate,Qs=U.clearImmediate,Ws=U.process,Js=U.Dispatch,zs=U.Function,Zs=U.MessageChannel,Xs=U.String,$s=0,ea={},ta="onreadystatechange";try{Us=U.location}catch(e){}var na=function(e){if(Me(ea,e)){var t=ea[e];delete ea[e],t()}},ra=function(e){return function(){na(e)}},ia=function(e){na(e.data)},sa=function(e){U.postMessage(Xs(e),Us.protocol+"//"+Us.host)};Ys&&Qs||(Ys=function(e){qs(arguments.length,1);var t=re(e)?e:zs(e),n=Jr(arguments,1);return ea[++$s]=function(){ri(t,void 0,n)},Ls($s),$s},Qs=function(e){delete ea[e]},Hs?Ls=function(e){Ws.nextTick(ra(e))}:Js&&Js.now?Ls=function(e){Js.now(ra(e))}:Zs&&!Ks?(Ps=(xs=new Zs).port2,xs.port1.onmessage=ia,Ls=Ti(Ps.postMessage,Ps)):U.addEventListener&&re(U.postMessage)&&!U.importScripts&&Us&&"file:"!==Us.protocol&&!L(sa)?(Ls=sa,U.addEventListener("message",ia,!1)):Ls=ta in We("script")?function(e){On.appendChild(We("script")).onreadystatechange=function(){On.removeChild(this),na(e)}}:function(e){setTimeout(ra(e),0)});var aa,oa,ua,ca,la,ha,fa,da,ga={set:Ys,clear:Qs},pa=/ipad|iphone|ipod/i.test(ue)&&void 0!==U.Pebble,va=/web0s(?!.*chrome)/i.test(ue),ya=Ze.f,ma=ga.set,_a=U.MutationObserver||U.WebKitMutationObserver,Ea=U.document,Ta=U.process,Ra=U.Promise,Ia=ya(U,"queueMicrotask"),Ca=Ia&&Ia.value;Ca||(aa=function(){var e,t;for(Hs&&(e=Ta.domain)&&e.exit();oa;){t=oa.fn,oa=oa.next;try{t()}catch(e){throw oa?ca():ua=void 0,e}}ua=void 0,e&&e.enter()},Ks||Hs||va||!_a||!Ea?!pa&&Ra&&Ra.resolve?((fa=Ra.resolve(void 0)).constructor=Ra,da=Ti(fa.then,fa),ca=function(){da(aa)}):Hs?ca=function(){Ta.nextTick(aa)}:(ma=Ti(ma,U),ca=function(){ma(aa)}):(la=!0,ha=Ea.createTextNode(""),new _a(aa).observe(ha,{characterData:!0}),ca=function(){ha.data=la=!la}));var Sa=Ca||function(e){var t={fn:e,next:void 0};ua&&(ua.next=t),oa||(oa=t,ca()),ua=t},ba=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=Te(t),this.reject=Te(n)},wa={f:function(e){return new ba(e)}},Oa=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Na=function(){this.head=null,this.tail=null};Na.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var ka,Aa,Ma,Ua,La=Na,xa="object"==typeof window,Pa=ga.set,Da=Ge("species"),Va="Promise",Ba=Ot.getterFor(Va),Fa=Ot.set,Ga=Ot.getterFor(Va),ja=is&&is.prototype,qa=is,Ka=ja,Ha=U.TypeError,Ya=U.document,Qa=U.process,Wa=wa.f,Ja=Wa,za=!!(Ya&&Ya.createEvent&&U.dispatchEvent),Za=re(U.PromiseRejectionEvent),Xa="unhandledrejection",$a=!1,eo=un(Va,(function(){var e=gt(qa),t=e!==String(qa);if(!t&&66===de)return!0;if(de>=51&&/native code/.test(e))return!1;var n=new qa((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(n.constructor={})[Da]=r,!($a=n.then((function(){}))instanceof r)||!t&&xa&&!Za})),to=eo||!Ds((function(e){qa.all(e).catch((function(){}))})),no=function(e){var t;return!(!ie(e)||!re(t=e.then))&&t},ro=function(e,t){var n,r,i,s=t.value,a=1==t.state,o=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{o?(a||(2===t.rejection&&uo(t),t.rejection=1),!0===o?n=s:(l&&l.enter(),n=o(s),l&&(l.exit(),i=!0)),n===e.promise?c(Ha("Promise-chain cycle")):(r=no(n))?V(r,n,u,c):u(n)):c(s)}catch(e){l&&!i&&l.exit(),c(e)}},io=function(e,t){e.notified||(e.notified=!0,Sa((function(){for(var n,r=e.reactions;n=r.get();)ro(n,e);e.notified=!1,t&&!e.rejection&&ao(e)})))},so=function(e,t,n){var r,i;za?((r=Ya.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),U.dispatchEvent(r)):r={promise:t,reason:n},!Za&&(i=U["on"+e])?i(r):e===Xa&&function(e,t){var n=U.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},ao=function(e){V(Pa,U,(function(){var t,n=e.facade,r=e.value;if(oo(e)&&(t=Oa((function(){Hs?Qa.emit("unhandledRejection",r,n):so(Xa,n,r)})),e.rejection=Hs||oo(e)?2:1,t.error))throw t.value}))},oo=function(e){return 1!==e.rejection&&!e.parent},uo=function(e){V(Pa,U,(function(){var t=e.facade;Hs?Qa.emit("rejectionHandled",t):so("rejectionhandled",t,e.value)}))},co=function(e,t,n){return function(r){e(t,r,n)}},lo=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,io(e,!0))},ho=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Ha("Promise can't be resolved itself");var r=no(t);r?Sa((function(){var n={done:!1};try{V(r,t,co(ho,n,e),co(lo,n,e))}catch(t){lo(n,t,e)}})):(e.value=t,e.state=1,io(e,!1))}catch(t){lo({done:!1},t,e)}}};if(eo&&(Ka=(qa=function(e){ps(this,Ka),Te(e),V(ka,this);var t=Ba(this);try{e(co(ho,t),co(lo,t))}catch(e){lo(t,e)}}).prototype,(ka=function(e){Fa(this,{type:Va,done:!1,notified:!1,parent:!1,reactions:new La,rejection:!1,state:0,value:void 0})}).prototype=ss(Ka,{then:function(e,t){var n=Ga(this),r=Wa(Gs(this,qa));return n.parent=!0,r.ok=!re(e)||e,r.fail=re(t)&&t,r.domain=Hs?Qa.domain:void 0,0==n.state?n.reactions.add(r):Sa((function(){ro(r,n)})),r.promise},catch:function(e){return this.then(void 0,e)}}),Aa=function(){var e=new ka,t=Ba(e);this.promise=e,this.resolve=co(ho,t),this.reject=co(lo,t)},wa.f=Wa=function(e){return e===qa||e===Ma?new Aa(e):Ja(e)},re(is)&&ja!==Object.prototype)){Ua=ja.then,$a||(Ut(ja,"then",(function(e,t){var n=this;return new qa((function(e,t){V(Ua,n,e,t)})).then(e,t)}),{unsafe:!0}),Ut(ja,"catch",Ka.catch,{unsafe:!0}));try{delete ja.constructor}catch(e){}us&&us(ja,Ka)}ln({global:!0,wrap:!0,forced:eo},{Promise:qa}),hs(qa,Va,!1),ds(Va),Ma=ae(Va),ln({target:Va,stat:!0,forced:eo},{reject:function(e){var t=Wa(this);return V(t.reject,void 0,e),t.promise}}),ln({target:Va,stat:!0,forced:eo},{resolve:function(e){return function(e,t){if(tt(e),ie(t)&&t.constructor===e)return t;var n=wa.f(e);return(0,n.resolve)(t),n.promise}(this,e)}}),ln({target:Va,stat:!0,forced:to},{all:function(e){var t=this,n=Wa(t),r=n.resolve,i=n.reject,s=Oa((function(){var n=Te(t.resolve),s=[],a=0,o=1;Os(e,(function(e){var u=a++,c=!1;o++,V(n,t,e).then((function(e){c||(c=!0,s[u]=e,--o||r(s))}),i)})),--o||r(s)}));return s.error&&i(s.value),n.promise},race:function(e){var t=this,n=Wa(t),r=n.reject,i=Oa((function(){var i=Te(t.resolve);Os(e,(function(e){V(i,t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var fo="RC_Logs";function go(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(fo),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var s=i({},n.objectStoreParams);r=e.createObjectStore(t,s),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,fo,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var po=function(){function e(){u(this,e)}return l(e,[{key:"addList",value:function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),s=i.objectStore(t);n.forEach((function(e){null==s||s.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))}},{key:"getRangeData",value:function(t,n,r,i){return new Promise((function(s){if(e._db){var a=e._db.transaction([t],"readwrite").objectStore(t),o=IDBKeyRange.bound(r,i),u=a.index(n),c=[],l=u.openCursor(o);l.onsuccess=function(e){var t=e.target.result;t?(c.push(t.value),t.continue()):s(c)},l.onerror=function(e){console.error(e),s([])}}else s([])}))}},{key:"getCount",value: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)}))}},{key:"removeFirstData",value:function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),s=i.getAllKeys(IDBKeyRange.lowerBound(0),r);s.onsuccess=function(){var e=s.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))}}],[{key:"init",value: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 ".concat(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 ".concat(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 ".concat(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,go(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();po._db=null;var vo=Ge("match"),yo=function(e){var t;return ie(e)&&(void 0!==(t=e[vo])?!!t:"RegExp"==z(e))},mo=U.Array,_o=Math.max,Eo=function(e,t,n){for(var r=jt(e),i=Bt(t,r),s=Bt(void 0===n?r:n,r),a=mo(_o(s-i,0)),o=0;i<s;i++,o++)lr(a,o,e[i]);return a.length=o,a},To=Cn.UNSUPPORTED_Y,Ro=4294967295,Io=Math.min,Co=[].push,So=Q(/./.exec),bo=Q(Co),wo=Q("".slice),Oo=!L((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));$n("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=_n(te(this)),i=void 0===n?Ro:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!yo(e))return V(t,r,e,i);for(var s,a,o,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(s=V(zn,h,r))&&!((a=h.lastIndex)>l&&(bo(u,wo(r,l,s.index)),s.length>1&&s.index<r.length&&ri(Co,u,Eo(s,1)),o=s[0].length,l=a,u.length>=i));)h.lastIndex===s.index&&h.lastIndex++;return l===r.length?!o&&So(h,"")||bo(u,""):bo(u,wo(r,l)),u.length>i?Eo(u,0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:V(t,this,e,n)}:t,[function(t,n){var i=te(this),s=null==t?void 0:Re(t,e);return s?V(s,t,i,n):V(r,_n(i),t,n)},function(e,i){var s=tt(this),a=_n(e),o=n(r,s,a,i,r!==t);if(o.done)return o.value;var u=Gs(s,RegExp),c=s.unicode,l=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(To?"g":"y"),h=new u(To?"^(?:"+s.source+")":s,l),f=void 0===i?Ro:i>>>0;if(0===f)return[];if(0===a.length)return null===ur(h,a)?[a]:[];for(var d=0,g=0,p=[];g<a.length;){h.lastIndex=To?0:g;var v,y=ur(h,To?wo(a,g):a);if(null===y||(v=Io(Gt(h.lastIndex+(To?g:0)),a.length))===d)g=ar(a,g,c);else{if(bo(p,wo(a,d,g)),p.length===f)return p;for(var m=1;m<=y.length-1;m++)if(bo(p,y[m]),p.length===f)return p;g=d=v}}return bo(p,wo(a,d)),p}]}),!Oo,To);var No=Mt.PROPER,ko="toString",Ao=RegExp.prototype,Mo=Ao.toString,Uo=Q(En),Lo=L((function(){return"/a/b"!=Mo.call({source:"a",flags:"b"})})),xo=No&&Mo.name!=ko;(Lo||xo)&&Ut(RegExp.prototype,ko,(function(){var e=tt(this),t=_n(e.source),n=e.flags;return"/"+t+"/"+_n(void 0===n&&oe(Ao,e)&&!("flags"in Ao)?Uo(e):n)}),{unsafe:!0});var Po,Do=function(e,t){return e+Math.floor(Math.random()*(t-e))},Vo=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)}))},Bo=function(){var e=Vo();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var s=r%n;r=(r-s)/n,i.unshift(t[s])}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.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(Po||(Po={}));var Fo,Go=Po;!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"}(Fo||(Fo={}));var jo,qo=Fo,Ko=function(e){return"string"==typeof e},Ho=function(e){return"boolean"==typeof e},Yo=function(e){return"number"==typeof e&&!isNaN(e)},Qo=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Wo=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Jo=function(e){return Ko(e)&&e.length>0},zo=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Zo=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Xo=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},$o=function(e){return"[object Null]"===Object.prototype.toString.call(e)},eu=function(e){for(var t in e)return!0;return!1},tu=function(e){var t=!1;if(zo(e))for(var n in e)if(t=Ko(n)&&!/^[A-Za-z0-9_=+-]+$/.test(n))break;return t},nu={};console&&(h(jo={},e.LogLevel.DEBUG,console.debug.bind(console)),h(jo,e.LogLevel.INFO,console.info.bind(console)),h(jo,e.LogLevel.WARN,console.warn.bind(console)),h(jo,e.LogLevel.ERROR,console.error.bind(console)),h(jo,e.LogLevel.FATAL,console.log.bind(console)),nu=jo);var ru=function(e){return Ko(e)||Yo(e)||Xo(e)||Ho(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},iu=function(){function t(n,r,i){u(this,t),this.tag=n,this.type=r,this.initiator=i,this._outLevel=e.LogLevel.WARN,this.debug=this.log.bind(this,e.LogLevel.DEBUG),this.info=this.log.bind(this,e.LogLevel.INFO),this.warn=this.log.bind(this,e.LogLevel.WARN),this.error=this.log.bind(this,e.LogLevel.ERROR),this.fatal=this.log.bind(this,e.LogLevel.FATAL)}var n;return l(t,[{key:"_defaultStdout",value:function(e,t){if(nu[e]){for(var n,r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];(n=nu)[e].apply(n,["".concat(t,":")].concat(i))}}},{key:"__pushLocalLog",value:function(n,r,i){var s;s=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?e.LogType.RTC:e.LogType.IM;var a=Date.now();Pi(r)>=1e3&&(r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf-8";if(!e||!t)return"";var r="utf-8"===n?3:2,i=0,s=0,a="";for(s=0;s<e.length;s++){if(e.charCodeAt(s)>255?i+=r:i++,i>t)return a;a+=e.charAt(s)}return e}(r,1e3));var o=JSON.stringify({message:r,userId:t.userId}).replace(/"/g,'""'),u=/^[\w]+-[\w]+-[\w]+?/.test(i)?i:"".concat(this.initiator||"L","-").concat(i,"-O"),c={sessionId:t.sessionId,time:a,level:4-n,content:"".concat(t.sessionId,",").concat(Date.now(),",").concat(s,",").concat(4-n,",").concat(u,',"').concat(o,'"\n'),userId:t.userId};t.databaseLogList.push(c),(t.databaseLogList.length>=100||n===e.LogLevel.FATAL)&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=o(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=S(t.databaseLogList),t.databaseLogList=[],!(r=po.getInstance())){e.next=14;break}return e.next=6,r.addList(fo,n);case 6:return i=e.sent,e.next=9,r.getCount(fo,"time");case 9:return e.sent>1e5&&r.removeFirstData(fo,"time",2e3),e.abrupt("return",i);case 14:return e.abrupt("return",!1);case 15:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"setLogLevel",value:function(t){this._outLevel="number"!=typeof t?e.LogLevel.WARN:t}},{key:"setLogStdout",value:function(e){this._logStdout=e}},{key:"log",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(t>e.LogLevel.DEBUG&&this.__pushLocalLog(t,r.map(ru).join(" "),this.tag),!(t<this._outLevel)){var s="".concat((new Date).toISOString(),"[").concat(this.tag,"][").concat(e.LogLevel[t],"]"),a="".concat(s," - ").concat(r.map(ru).join(" "));this._logStdout?this._logStdout(t,a):this._stdout?this._stdout(t,a):this._defaultStdout.apply(this,[t,s].concat(r))}}},{key:"reportLog",value:function(e,n,r){this.__pushLocalLog(4-e,r,n);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'.concat(i,'"');var s={level:e,content:[t.sessionId,Date.now(),this.type,e,n,i].join()+"\n"};t.realTimeLogList.push(s),t.realTimeLogList.length>=600&&(t.realTimeLogList=t.realTimeLogList.slice(-500))}},{key:"set",value:function(e,t){this.warn("logger.set has being deprecated!")}},{key:"setStdout",value:function(e){this._stdout=e}},{key:"__clearRealTimeLog",value:function(){t.realTimeLogList=[]}}],[{key:"init",value:function(e){t.userId=e}},{key:"reset",value:function(){t.userId=""}}]),t}();iu.databaseLogList=[],iu.realTimeLogList=[],iu.sessionId=Bo(),iu.userId="";var su=new iu("RCLog"),au=Cr("splice"),ou=U.TypeError,uu=Math.max,cu=Math.min,lu=9007199254740991,hu="Maximum allowed length exceeded";ln({target:"Array",proto:!0,forced:!au},{splice:function(e,t){var n,r,i,s,a,o,u=ke(this),c=jt(u),l=Bt(e,c),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=cu(uu(Pt(t),0),c-l)),c+n-r>lu)throw ou(hu);for(i=Rr(u,r),s=0;s<r;s++)(a=l+s)in u&&lr(i,s,u[a]);if(i.length=r,n<r){for(s=l;s<c-r;s++)o=s+n,(a=s+r)in u?u[o]=u[a]:delete u[o];for(s=c;s>c-r+n;s--)delete u[s-1]}else if(n>r)for(s=c-r;s>l;s--)o=s+n-1,(a=s+r-1)in u?u[o]=u[a]:delete u[o];for(s=0;s<n;s++)u[s+l]=arguments[s+2];return u.length=c-r+n,i}});var fu,du=function(){function e(){u(this,e),this._map={}}return l(e,[{key:"on",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})}},{key:"once",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})}},{key:"off",value:function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])}},{key:"emit",value:function(e){var t=this._map[e];if(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var s=t.length-1;s>=0;s-=1){var a=t[s],o=a.target,u=a.once,c=a.listener;u&&t.splice(s,1);try{c.call.apply(c,[o].concat(r))}catch(e){su.error(e)}}}}},{key:"removeAll",value:function(e){delete this._map[e]}},{key:"clear",value:function(){Object.keys(this._map).forEach(this.removeAll,this)}}]),e}();!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(fu||(fu={}));var gu,pu=fu;!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.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",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"}(gu||(gu={}));var vu,yu=gu;!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"}(vu||(vu={}));var mu,_u=vu,Eu={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR: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"}(mu||(mu={}));var Tu,Ru=mu;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Tu||(Tu={}));var Iu,Cu=Tu;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Iu||(Iu={}));var Su,bu=Iu;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(Su||(Su={}));var wu,Ou=Su;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(wu||(wu={}));var Nu,ku=wu;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Nu||(Nu={}));var Au,Mu=Nu;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Au||(Au={}));var Uu,Lu,xu,Pu=Au;e.RTCMode=void 0,(Uu=e.RTCMode||(e.RTCMode={}))[Uu.RTC=0]="RTC",Uu[Uu.LIVE=2]="LIVE",e.LiveType=void 0,(Lu=e.LiveType||(e.LiveType={}))[Lu.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",Lu[Lu.AUDIO=1]="AUDIO",e.LiveRole=void 0,(xu=e.LiveRole||(e.LiveRole={}))[xu.ANCHOR=1]="ANCHOR",xu[xu.AUDIENCE=2]="AUDIENCE";var Du,Vu,Bu,Fu={"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"};e.RTCApiType=void 0,(Du=e.RTCApiType||(e.RTCApiType={}))[Du.ROOM=1]="ROOM",Du[Du.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(Vu=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[Vu.AnchorToViewer=1]="AnchorToViewer",Vu[Vu.ViewerToAnchor=2]="ViewerToAnchor",e.RTCJoinType=void 0,(Bu=e.RTCJoinType||(e.RTCJoinType={}))[Bu.KICK=0]="KICK",Bu[Bu.REFUSE=1]="REFUSE",Bu[Bu.COEXIST=2]="COEXIST";var Gu=U.RangeError,ju=Q((function(e){var t=_n(te(this)),n="",r=Pt(e);if(r<0||r==1/0)throw Gu("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n})),qu=Q("".slice),Ku=Math.ceil,Hu=function(e){return function(t,n,r){var i,s,a=_n(te(t)),o=Gt(n),u=a.length,c=void 0===r?" ":_n(r);return o<=u||""==c?a:((s=ju(c,Ku((i=o-u)/c.length))).length>i&&(s=qu(s,0,i)),e?a+s:s+a)}},Yu={start:Hu(!1),end:Hu(!0)},Qu=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(ue),Wu=Yu.start;ln({target:"String",proto:!0,forced:Qu},{padStart:function(e){return Wu(this,e,arguments.length>1?arguments[1]:void 0)}});var Ju,zu,Zu={engine:"5.2.1-alpha.3"},Xu=function(){function e(){u(this,e)}return l(e,null,[{key:"add",value:function(e,t){Zu[e]=t}},{key:"validEngine",value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return su.warn("The validation engine version '".concat(e,"' is invalid!")),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Zu.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n}},{key:"getInfo",value:function(){return Zu}}]),e}();e.AssertRules=void 0,(zu=e.AssertRules||(e.AssertRules={}))[zu.STRING=0]="STRING",zu[zu.ONLY_STRING=1]="ONLY_STRING",zu[zu.NUMBER=2]="NUMBER",zu[zu.BOOLEAN=3]="BOOLEAN",zu[zu.OBJECT=4]="OBJECT",zu[zu.ARRAY=5]="ARRAY",zu[zu.CALLBACK=6]="CALLBACK",zu[zu.CHANNEL_ID=7]="CHANNEL_ID";var $u=(h(Ju={},e.AssertRules.STRING,Jo),h(Ju,e.AssertRules.ONLY_STRING,Ko),h(Ju,e.AssertRules.NUMBER,Yo),h(Ju,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),h(Ju,e.AssertRules.OBJECT,zo),h(Ju,e.AssertRules.ARRAY,Qo),h(Ju,e.AssertRules.CALLBACK,(function(e){var t=!0;return zo(e)||(t=!1),(e=e||{}).onSuccess&&!Zo(e.onSuccess)&&(t=!1),e.onError&&!Zo(e.onError)&&(t=!1),t})),h(Ju,e.AssertRules.CHANNEL_ID,(function(e){var t=!1;return Ko(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t})),Ju),ec=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,e)).name="RCAssertError",r}return l(n)}(m(Error)),tc=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=$u[n]||n;var i=r&&!n(t)||!r&&!(Xo(t)||null===t||n(t));return i&&su.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},nc=/MSIE .\./.test(ue),rc=U.Function,ic=function(e){return function(t,n){var r=qs(arguments.length,1)>2,i=re(t)?t:rc(t),s=r?Jr(arguments,2):void 0;return e(r?function(){ri(i,this,s)}:i,n)}};ln({global:!0,bind:!0,forced:nc},{setTimeout:ic(U.setTimeout),setInterval:ic(U.setInterval)});var sc=function(e,t,n){var r,i;return us&&re(r=t.constructor)&&r!==n&&ie(i=r.prototype)&&i!==n.prototype&&us(e,i),e},ac=ut.f,oc=zt.f,uc=Ot.enforce,cc=Ge("match"),lc=U.RegExp,hc=lc.prototype,fc=U.SyntaxError,dc=Q(En),gc=Q(hc.exec),pc=Q("".charAt),vc=Q("".replace),yc=Q("".indexOf),mc=Q("".slice),_c=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Ec=/a/g,Tc=/a/g,Rc=new lc(Ec)!==Ec,Ic=Cn.MISSED_STICKY,Cc=Cn.UNSUPPORTED_Y,Sc=x&&(!Rc||Ic||Pn||Vn||L((function(){return Tc[cc]=!1,lc(Ec)!=Ec||lc(Tc)==Tc||"/a/i"!=lc(Ec,"i")})));if(un("RegExp",Sc)){for(var bc=function(e,t){var n,r,i,s,a,o,u=oe(hc,this),c=yo(e),l=void 0===t,h=[],f=e;if(!u&&c&&l&&e.constructor===bc)return e;if((c||oe(hc,e))&&(e=e.source,l&&(t="flags"in f?f.flags:dc(f))),e=void 0===e?"":_n(e),t=void 0===t?"":_n(t),f=e,Pn&&"dotAll"in Ec&&(r=!!t&&yc(t,"s")>-1)&&(t=vc(t,/s/g,"")),n=t,Ic&&"sticky"in Ec&&(i=!!t&&yc(t,"y")>-1)&&Cc&&(t=vc(t,/y/g,"")),Vn&&(s=function(e){for(var t,n=e.length,r=0,i="",s=[],a={},o=!1,u=!1,c=0,l="";r<=n;r++){if("\\"===(t=pc(e,r)))t+=pc(e,++r);else if("]"===t)o=!1;else if(!o)switch(!0){case"["===t:o=!0;break;case"("===t:gc(_c,mc(e,r+1))&&(r+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===l||Me(a,l))throw new fc("Invalid capture group name");a[l]=!0,s[s.length]=[l,c],u=!1,l="";continue}u?l+=t:i+=t}return[i,s]}(e),e=s[0],h=s[1]),a=sc(lc(e,t),u?this:hc,bc),(r||i||h.length)&&(o=uc(a),r&&(o.dotAll=!0,o.raw=bc(function(e){for(var t,n=e.length,r=0,i="",s=!1;r<=n;r++)"\\"!==(t=pc(e,r))?s||"."!==t?("["===t?s=!0:"]"===t&&(s=!1),i+=t):i+="[\\s\\S]":i+=t+pc(e,++r);return i}(e),n)),i&&(o.sticky=!0),h.length&&(o.groups=h)),e!==f)try{ct(a,"source",""===f?"(?:)":f)}catch(e){}return a},wc=function(e){e in bc||ac(bc,e,{configurable:!0,get:function(){return lc[e]},set:function(t){lc[e]=t}})},Oc=oc(lc),Nc=0;Oc.length>Nc;)wc(Oc[Nc++]);hc.constructor=bc,bc.prototype=hc,Ut(U,"RegExp",bc)}ds("RegExp");var kc,Ac,Mc,Uc=function(e){if(!zo(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)},Lc=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Vo(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),s=(new Date).getTime(),a="";if(t){var o=t.split(".");a="."+o[o.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(s).concat(r).concat(a)},xc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.threadId,r=e.apnsCollapseId,i=e.category,s=e.richMediaUri,a=t.channelIdMi,o=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h={};h["thread-id"]=n||"",h["apns-collapse-id"]=r||"",h.category=i||"",h.richMediaUri=s||"";var f={};f.collapse_key=null==l?void 0:l.collapseKey,f.imageUrl=null==l?void 0:l.imageUrl;var d=null==l?void 0:l.priority;d&&!["high","normal"].includes(d)&&(d="normal"),f.priority=d;var g=[{HW:{channelId:o||""}},{MI:{channelId:a||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:h},{FCM:f}];return JSON.stringify(g)},Pc=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,s,a,o=Object.keys(e);if(0!==o.length){var u=o[0];switch(u){case"HW":return void(r.channelIdHW=null===(t=e[u])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[u])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(s=e[u])||void 0===s?void 0:s.channelId);case"VIVO":return void(r.typeVivo=null===(a=e[u])||void 0===a?void 0:a.classification);case"APNS":return n.threadId=e[u]["thread-id"],n.apnsCollapseId=e[u]["apns-collapse-id"],n.category=e[u].category,void(n.richMediaUri=e[u].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[u].collapse_key||"",imageUrl:e[u].imageUrl||"",priority:e[u].priority||""}}}}))}catch(t){su.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},Dc=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Vc=function(e){var t=e.length;return t<=4096&&t>=1},Bc=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;zo(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Qo(e)||Ko(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,s=e.length;i<s;i++)t(e[i],i)}()},Fc=function(e,t){return Bc(e,(function(n,r){e[r]=t(n,r)})),e},Gc=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return Bc(e,(function(e,r){t===e&&(n=r)})),n},jc=function(e,t){var n=[];return Bc(e,(function(e){n.push(e)})),-1!==Gc(n,t)},qc=function(e){return JSON.parse(JSON.stringify(e))},Kc=function(){return"undefined"!=typeof RCCppEngine},Hc=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 s in i)if(i.hasOwnProperty(s)){var a=r.match(i[s]);if(a){n=s,t=a[1]||a[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Yc=function(e){switch(e){case Eu.SERVER_UNAVAILABLE:return yu.SERVER_UNAVAILABLE;case Eu.TOKEN_INCORRECT:return yu.RC_CONN_USER_OR_PASSWD_ERROR;case Eu.REDIRECT:return yu.RC_CONN_REDIRECTED;case Eu.APP_BLOCK_OR_DELETE:return yu.RC_CONN_APP_BLOCKED_OR_DELETED;case Eu.BLOCK:return yu.RC_CONN_USER_BLOCKED;case Eu.TOKEN_EXPIRE:return yu.RC_CONN_USER_OR_PASSWD_ERROR;case Eu.HOSTNAME_ERROR:return yu.HOSTNAME_ERROR;case Eu.HASOHTERSAMECLIENTONLINE:return yu.HAS_OHTER_SAME_CLIENT_ON_LINE;case Eu.APP_AUTH_NOT_PASS:return yu.RC_APP_AUTH_NOT_PASS;case Eu.OTP_USED:return yu.RC_OTP_USED;case Eu.PLATFORM_ERROR:return yu.RC_PLATFORM_ERROR;default:return yu.RC_NET_UNAVAILABLE}},Qc=function e(t){var n;if("object"===s(t))if(Array.isArray(t))for(var r in n=[],t)n.push(e(t[r]));else for(var i in n={},t)n[i]=e(t[i]);else n=t;return n},Wc=function(e){var t;try{t=Qc(e)}catch(n){su.error("clone err:",n),t=JSON.parse(JSON.stringify(e))}return t},Jc=function(e){var t={},n=JSON.parse(e);return Bc(n,(function(e,n){t[n]=e.v})),t},zc={_delayTime:0,setTime:function(e){var t=(new Date).getTime();zc._delayTime=t-e},getTime:function(){var e=zc._delayTime;return(new Date).getTime()-e}},Zc=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},Xc=!L((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),$c=mt("IE_PROTO"),el=U.Object,tl=el.prototype,nl=Xc?el.getPrototypeOf:function(e){var t=ke(e);if(Me(t,$c))return t[$c];var n=t.constructor;return re(n)&&t instanceof n?n.prototype:t instanceof el?tl:null},rl=Ge("iterator"),il=!1;[].keys&&("next"in(Mc=[].keys())?(Ac=nl(nl(Mc)))!==Object.prototype&&(kc=Ac):il=!0);var sl=null==kc||L((function(){var e={};return kc[rl].call(e)!==e}));sl&&(kc={}),re(kc[rl])||Ut(kc,rl,(function(){return this}));var al={IteratorPrototype:kc,BUGGY_SAFARI_ITERATORS:il},ol=al.IteratorPrototype,ul=function(){return this},cl=Mt.PROPER,ll=Mt.CONFIGURABLE,hl=al.IteratorPrototype,fl=al.BUGGY_SAFARI_ITERATORS,dl=Ge("iterator"),gl="keys",pl="values",vl="entries",yl=function(){return this},ml=function(e,t,n,r,i,s,a){!function(e,t,n,r){var i=t+" Iterator";e.prototype=Ln(ol,{next:j(+!r,n)}),hs(e,i,!1),vs[i]=ul}(n,t,r);var o,u,c,l=function(e){if(e===i&&p)return p;if(!fl&&e in d)return d[e];switch(e){case gl:case pl:case vl:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",f=!1,d=e.prototype,g=d[dl]||d["@@iterator"]||i&&d[i],p=!fl&&g||l(i),v="Array"==t&&d.entries||g;if(v&&(o=nl(v.call(new e)))!==Object.prototype&&o.next&&(nl(o)!==hl&&(us?us(o,hl):re(o[dl])||Ut(o,dl,yl)),hs(o,h,!0)),cl&&i==pl&&g&&g.name!==pl&&(ll?ct(d,"name",pl):(f=!0,p=function(){return V(g,this)})),i)if(u={values:l(pl),keys:s?p:l(gl),entries:l(vl)},a)for(c in u)(fl||f||!(c in d))&&Ut(d,c,u[c]);else ln({target:t,proto:!0,forced:fl||f},u);return d[dl]!==p&&Ut(d,dl,p,{name:i}),vs[t]=p,u},_l=ut.f,El="Array Iterator",Tl=Ot.set,Rl=Ot.getterFor(El),Il=ml(Array,"Array",(function(e,t){Tl(this,{type:El,target:ne(e),index:0,kind:t})}),(function(){var e=Rl(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),Cl=vs.Arguments=vs.Array;if(Wi("keys"),Wi("values"),Wi("entries"),x&&"values"!==Cl.name)try{_l(Cl,"name",{value:"values"})}catch(e){}var Sl="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,bl=U.RangeError,wl=function(e){if(void 0===e)return 0;var t=Pt(e),n=Gt(t);if(t!==n)throw bl("Wrong length or index");return n},Ol=U.Array,Nl=Math.abs,kl=Math.pow,Al=Math.floor,Ml=Math.log,Ul=Math.LN2,Ll=function(e,t,n){var r,i,s,a=Ol(n),o=8*n-t-1,u=(1<<o)-1,c=u>>1,l=23===t?kl(2,-24)-kl(2,-77):0,h=e<0||0===e&&1/e<0?1:0,f=0;for((e=Nl(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=Al(Ml(e)/Ul),e*(s=kl(2,-r))<1&&(r--,s*=2),(e+=r+c>=1?l/s:l*kl(2,1-c))*s>=2&&(r++,s/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*s-1)*kl(2,t),r+=c):(i=e*kl(2,c-1)*kl(2,t),r=0));t>=8;)a[f++]=255&i,i/=256,t-=8;for(r=r<<t|i,o+=t;o>0;)a[f++]=255&r,r/=256,o-=8;return a[--f]|=128*h,a},xl=function(e,t){var n,r=e.length,i=8*r-t-1,s=(1<<i)-1,a=s>>1,o=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;o>0;)l=256*l+e[u--],o-=8;for(n=l&(1<<-o)-1,l>>=-o,o+=t;o>0;)n=256*n+e[u--],o-=8;if(0===l)l=1-a;else{if(l===s)return n?NaN:c?-1/0:1/0;n+=kl(2,t),l-=a}return(c?-1:1)*n*kl(2,l-t)},Pl=function(e){for(var t=ke(this),n=jt(t),r=arguments.length,i=Bt(r>1?arguments[1]:void 0,n),s=r>2?arguments[2]:void 0,a=void 0===s?n:Bt(s,n);a>i;)t[i++]=e;return t},Dl=zt.f,Vl=ut.f,Bl=Mt.PROPER,Fl=Mt.CONFIGURABLE,Gl=Ot.get,jl=Ot.set,ql="ArrayBuffer",Kl="DataView",Hl="Wrong index",Yl=U.ArrayBuffer,Ql=Yl,Wl=Ql&&Ql.prototype,Jl=U.DataView,zl=Jl&&Jl.prototype,Zl=Object.prototype,Xl=U.Array,$l=U.RangeError,eh=Q(Pl),th=Q([].reverse),nh=Ll,rh=xl,ih=function(e){return[255&e]},sh=function(e){return[255&e,e>>8&255]},ah=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},oh=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},uh=function(e){return nh(e,23,4)},ch=function(e){return nh(e,52,8)},lh=function(e,t){Vl(e.prototype,t,{get:function(){return Gl(this)[t]}})},hh=function(e,t,n,r){var i=wl(n),s=Gl(e);if(i+t>s.byteLength)throw $l(Hl);var a=Gl(s.buffer).bytes,o=i+s.byteOffset,u=Eo(a,o,o+t);return r?u:th(u)},fh=function(e,t,n,r,i,s){var a=wl(n),o=Gl(e);if(a+t>o.byteLength)throw $l(Hl);for(var u=Gl(o.buffer).bytes,c=a+o.byteOffset,l=r(+i),h=0;h<t;h++)u[c+h]=l[s?h:t-h-1]};if(Sl){var dh=Bl&&Yl.name!==ql;if(L((function(){Yl(1)}))&&L((function(){new Yl(-1)}))&&!L((function(){return new Yl,new Yl(1.5),new Yl(NaN),dh&&!Fl})))dh&&Fl&&ct(Yl,"name",ql);else{(Ql=function(e){return ps(this,Wl),new Yl(wl(e))}).prototype=Wl;for(var gh,ph=Dl(Yl),vh=0;ph.length>vh;)(gh=ph[vh++])in Ql||ct(Ql,gh,Yl[gh]);Wl.constructor=Ql}us&&nl(zl)!==Zl&&us(zl,Zl);var yh=new Jl(new Ql(2)),mh=Q(zl.setInt8);yh.setInt8(0,2147483648),yh.setInt8(1,2147483649),!yh.getInt8(0)&&yh.getInt8(1)||ss(zl,{setInt8:function(e,t){mh(this,e,t<<24>>24)},setUint8:function(e,t){mh(this,e,t<<24>>24)}},{unsafe:!0})}else Wl=(Ql=function(e){ps(this,Wl);var t=wl(e);jl(this,{bytes:eh(Xl(t),0),byteLength:t}),x||(this.byteLength=t)}).prototype,zl=(Jl=function(e,t,n){ps(this,zl),ps(e,Wl);var r=Gl(e).byteLength,i=Pt(t);if(i<0||i>r)throw $l("Wrong offset");if(i+(n=void 0===n?r-i:Gt(n))>r)throw $l("Wrong length");jl(this,{buffer:e,byteLength:n,byteOffset:i}),x||(this.buffer=e,this.byteLength=n,this.byteOffset=i)}).prototype,x&&(lh(Ql,"byteLength"),lh(Jl,"buffer"),lh(Jl,"byteLength"),lh(Jl,"byteOffset")),ss(zl,{getInt8:function(e){return hh(this,1,e)[0]<<24>>24},getUint8:function(e){return hh(this,1,e)[0]},getInt16:function(e){var t=hh(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=hh(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return oh(hh(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return oh(hh(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return rh(hh(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return rh(hh(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){fh(this,1,e,ih,t)},setUint8:function(e,t){fh(this,1,e,ih,t)},setInt16:function(e,t){fh(this,2,e,sh,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){fh(this,2,e,sh,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){fh(this,4,e,ah,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){fh(this,4,e,ah,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){fh(this,4,e,uh,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){fh(this,8,e,ch,t,arguments.length>2?arguments[2]:void 0)}});hs(Ql,ql),hs(Jl,Kl);var _h={ArrayBuffer:Ql,DataView:Jl},Eh=_h.ArrayBuffer,Th=_h.DataView,Rh=Th.prototype,Ih=Q(Eh.prototype.slice),Ch=Q(Rh.getUint8),Sh=Q(Rh.setUint8),bh=L((function(){return!new Eh(2).slice(1,void 0).byteLength}));ln({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:bh},{slice:function(e,t){if(Ih&&void 0===t)return Ih(tt(this),e);for(var n=tt(this).byteLength,r=Bt(e,n),i=Bt(void 0===t?n:t,n),s=new(Gs(this,Eh))(Gt(i-r)),a=new Th(this),o=new Th(s),u=0;r<i;)Sh(o,u++,Ch(a,r++));return s}});var wh,Oh,Nh,kh=ut.f,Ah=U.Int8Array,Mh=Ah&&Ah.prototype,Uh=U.Uint8ClampedArray,Lh=Uh&&Uh.prototype,xh=Ah&&nl(Ah),Ph=Mh&&nl(Mh),Dh=Object.prototype,Vh=U.TypeError,Bh=Ge("toStringTag"),Fh=Pe("TYPED_ARRAY_TAG"),Gh=Pe("TYPED_ARRAY_CONSTRUCTOR"),jh=Sl&&!!us&&"Opera"!==yn(U.opera),qh=!1,Kh={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Hh={BigInt64Array:8,BigUint64Array:8},Yh=function(e){if(!ie(e))return!1;var t=yn(e);return Me(Kh,t)||Me(Hh,t)};for(wh in Kh)(Nh=(Oh=U[wh])&&Oh.prototype)?ct(Nh,Gh,Oh):jh=!1;for(wh in Hh)(Nh=(Oh=U[wh])&&Oh.prototype)&&ct(Nh,Gh,Oh);if((!jh||!re(xh)||xh===Function.prototype)&&(xh=function(){throw Vh("Incorrect invocation")},jh))for(wh in Kh)U[wh]&&us(U[wh],xh);if((!jh||!Ph||Ph===Dh)&&(Ph=xh.prototype,jh))for(wh in Kh)U[wh]&&us(U[wh].prototype,Ph);if(jh&&nl(Lh)!==Ph&&us(Lh,Ph),x&&!Me(Ph,Bh))for(wh in qh=!0,kh(Ph,Bh,{get:function(){return ie(this)?this[Fh]:void 0}}),Kh)U[wh]&&ct(U[wh],Fh,wh);var Qh={NATIVE_ARRAY_BUFFER_VIEWS:jh,TYPED_ARRAY_CONSTRUCTOR:Gh,TYPED_ARRAY_TAG:qh&&Fh,aTypedArray:function(e){if(Yh(e))return e;throw Vh("Target is not a typed array")},aTypedArrayConstructor:function(e){if(re(e)&&(!us||oe(xh,e)))return e;throw Vh(_e(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(x){if(n)for(var i in Kh){var s=U[i];if(s&&Me(s.prototype,e))try{delete s.prototype[e]}catch(n){try{s.prototype[e]=t}catch(e){}}}Ph[e]&&!n||Ut(Ph,e,n?t:jh&&Mh[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(x){if(us){if(n)for(r in Kh)if((i=U[r])&&Me(i,e))try{delete i[e]}catch(e){}if(xh[e]&&!n)return;try{return Ut(xh,e,n?t:jh&&xh[e]||t)}catch(e){}}for(r in Kh)!(i=U[r])||i[e]&&!n||Ut(i,e,t)}},isView:function(e){if(!ie(e))return!1;var t=yn(e);return"DataView"===t||Me(Kh,t)||Me(Hh,t)},isTypedArray:Yh,TypedArray:xh,TypedArrayPrototype:Ph},Wh=Qh.NATIVE_ARRAY_BUFFER_VIEWS,Jh=U.ArrayBuffer,zh=U.Int8Array,Zh=!Wh||!L((function(){zh(1)}))||!L((function(){new zh(-1)}))||!Ds((function(e){new zh,new zh(null),new zh(1.5),new zh(e)}),!0)||L((function(){return 1!==new zh(new Jh(2),1,void 0).length})),Xh=Math.floor,$h=Number.isInteger||function(e){return!ie(e)&&isFinite(e)&&Xh(e)===e},ef=U.RangeError,tf=U.RangeError,nf=function(e,t){var n=function(e){var t=Pt(e);if(t<0)throw ef("The argument can't be less than 0");return t}(e);if(n%t)throw tf("Wrong offset");return n},rf=Qh.aTypedArrayConstructor,sf=function(e){var t,n,r,i,s,a,o=Bs(this),u=ke(e),c=arguments.length,l=c>1?arguments[1]:void 0,h=void 0!==l,f=Ts(u);if(f&&!_s(f))for(a=(s=Is(u,f)).next,u=[];!(i=V(a,s)).done;)u.push(i.value);for(h&&c>2&&(l=Ti(l,arguments[2])),n=jt(u),r=new(rf(o))(n),t=0;n>t;t++)r[t]=h?l(u[t],t):u[t];return r},af=N((function(e){var t=zt.f,n=Ci.forEach,r=Ot.get,i=Ot.set,s=ut.f,a=Ze.f,o=Math.round,u=U.RangeError,c=_h.ArrayBuffer,l=c.prototype,h=_h.DataView,f=Qh.NATIVE_ARRAY_BUFFER_VIEWS,d=Qh.TYPED_ARRAY_CONSTRUCTOR,g=Qh.TYPED_ARRAY_TAG,p=Qh.TypedArray,v=Qh.TypedArrayPrototype,y=Qh.aTypedArrayConstructor,m=Qh.isTypedArray,_="BYTES_PER_ELEMENT",E="Wrong length",T=function(e,t){y(e);for(var n=0,r=t.length,i=new e(r);r>n;)i[n]=t[n++];return i},R=function(e,t){s(e,t,{get:function(){return r(this)[t]}})},I=function(e){var t;return oe(l,e)||"ArrayBuffer"==(t=yn(e))||"SharedArrayBuffer"==t},C=function(e,t){return m(e)&&!ye(t)&&t in e&&$h(+t)&&t>=0},S=function(e,t){return t=He(t),C(e,t)?j(2,e[t]):a(e,t)},b=function(e,t,n){return t=He(t),!(C(e,t)&&ie(n)&&Me(n,"value"))||Me(n,"get")||Me(n,"set")||n.configurable||Me(n,"writable")&&!n.writable||Me(n,"enumerable")&&!n.enumerable?s(e,t,n):(e[t]=n.value,e)};x?(f||(Ze.f=S,ut.f=b,R(v,"buffer"),R(v,"byteOffset"),R(v,"byteLength"),R(v,"length")),ln({target:"Object",stat:!0,forced:!f},{getOwnPropertyDescriptor:S,defineProperty:b}),e.exports=function(e,a,l){var y=e.match(/\d+$/)[0]/8,R=e+(l?"Clamped":"")+"Array",C="get"+e,S="set"+e,b=U[R],w=b,O=w&&w.prototype,N={},k=function(e,t){s(e,t,{get:function(){return function(e,t){var n=r(e);return n.view[C](t*y+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var i=r(e);l&&(n=(n=o(n))<0?0:n>255?255:255&n),i.view[S](t*y+i.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};f?Zh&&(w=a((function(e,t,n,r){return ps(e,O),sc(ie(t)?I(t)?void 0!==r?new b(t,nf(n,y),r):void 0!==n?new b(t,nf(n,y)):new b(t):m(t)?T(w,t):V(sf,w,t):new b(wl(t)),e,w)})),us&&us(w,p),n(t(b),(function(e){e in w||ct(w,e,b[e])})),w.prototype=O):(w=a((function(e,t,n,r){ps(e,O);var s,a,o,l=0,f=0;if(ie(t)){if(!I(t))return m(t)?T(w,t):V(sf,w,t);s=t,f=nf(n,y);var d=t.byteLength;if(void 0===r){if(d%y)throw u(E);if((a=d-f)<0)throw u(E)}else if((a=Gt(r)*y)+f>d)throw u(E);o=a/y}else o=wl(t),s=new c(a=o*y);for(i(e,{buffer:s,byteOffset:f,byteLength:a,length:o,view:new h(s)});l<o;)k(e,l++)})),us&&us(w,p),O=w.prototype=Ln(v)),O.constructor!==w&&ct(O,"constructor",w),ct(O,d,w),g&&ct(O,g,R),N[R]=w,ln({global:!0,forced:w!=b,sham:!f},N),_ in w||ct(w,_,y),_ in O||ct(O,_,y),ds(R)}):e.exports=function(){}}));af("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var of=Math.min,uf=[].copyWithin||function(e,t){var n=ke(this),r=jt(n),i=Bt(e,r),s=Bt(t,r),a=arguments.length>2?arguments[2]:void 0,o=of((void 0===a?r:Bt(a,r))-s,r-i),u=1;for(s<i&&i<s+o&&(u=-1,s+=o-1,i+=o-1);o-- >0;)s in n?n[i]=n[s]:delete n[i],i+=u,s+=u;return n},cf=Q(uf),lf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("copyWithin",(function(e,t){return cf(lf(this),e,t,arguments.length>2?arguments[2]:void 0)}));var hf=Ci.every,ff=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("every",(function(e){return hf(ff(this),e,arguments.length>1?arguments[1]:void 0)}));var df=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return V(Pl,df(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var gf=Qh.TYPED_ARRAY_CONSTRUCTOR,pf=Qh.aTypedArrayConstructor,vf=function(e){return pf(Gs(e,e[gf]))},yf=function(e,t){return function(e,t){for(var n=0,r=jt(t),i=new e(r);r>n;)i[n]=t[n++];return i}(vf(e),t)},mf=Ci.filter,_f=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("filter",(function(e){var t=mf(_f(this),e,arguments.length>1?arguments[1]:void 0);return yf(this,t)}));var Ef=Ci.find,Tf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("find",(function(e){return Ef(Tf(this),e,arguments.length>1?arguments[1]:void 0)}));var Rf=Ci.findIndex,If=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("findIndex",(function(e){return Rf(If(this),e,arguments.length>1?arguments[1]:void 0)}));var Cf=Ci.forEach,Sf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("forEach",(function(e){Cf(Sf(this),e,arguments.length>1?arguments[1]:void 0)}));var bf=Kt.includes,wf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("includes",(function(e){return bf(wf(this),e,arguments.length>1?arguments[1]:void 0)}));var Of=Kt.indexOf,Nf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("indexOf",(function(e){return Of(Nf(this),e,arguments.length>1?arguments[1]:void 0)}));var kf=Ge("iterator"),Af=U.Uint8Array,Mf=Q(Il.values),Uf=Q(Il.keys),Lf=Q(Il.entries),xf=Qh.aTypedArray,Pf=Qh.exportTypedArrayMethod,Df=Af&&Af.prototype,Vf=!L((function(){Df[kf].call([1])})),Bf=!!Df&&Df.values&&Df[kf]===Df.values&&"values"===Df.values.name,Ff=function(){return Mf(xf(this))};Pf("entries",(function(){return Lf(xf(this))}),Vf),Pf("keys",(function(){return Uf(xf(this))}),Vf),Pf("values",Ff,Vf||!Bf,{name:"values"}),Pf(kf,Ff,Vf||!Bf,{name:"values"});var Gf=Qh.aTypedArray,jf=Qh.exportTypedArrayMethod,qf=Q([].join);jf("join",(function(e){return qf(Gf(this),e)}));var Kf=Math.min,Hf=[].lastIndexOf,Yf=!!Hf&&1/[1].lastIndexOf(1,-0)<0,Qf=Ai("lastIndexOf"),Wf=Yf||!Qf?function(e){if(Yf)return ri(Hf,this,arguments)||0;var t=ne(this),n=jt(t),r=n-1;for(arguments.length>1&&(r=Kf(r,Pt(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Hf,Jf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return ri(Wf,Jf(this),t>1?[e,arguments[1]]:[e])}));var zf=Ci.map,Zf=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("map",(function(e){return zf(Zf(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(vf(e))(t)}))}));var Xf=U.TypeError,$f=function(e){return function(t,n,r,i){Te(n);var s=ke(t),a=$(s),o=jt(s),u=e?o-1:0,c=e?-1:1;if(r<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:o<=u)throw Xf("Reduce of empty array with no initial value")}for(;e?u>=0:o>u;u+=c)u in a&&(i=n(i,a[u],u,s));return i}},ed={left:$f(!1),right:$f(!0)},td=ed.left,nd=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return td(nd(this),e,t,t>1?arguments[1]:void 0)}));var rd=ed.right,id=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return rd(id(this),e,t,t>1?arguments[1]:void 0)}));var sd=Qh.aTypedArray,ad=Qh.exportTypedArrayMethod,od=Math.floor;ad("reverse",(function(){for(var e,t=this,n=sd(t).length,r=od(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var ud=U.RangeError,cd=U.Int8Array,ld=cd&&cd.prototype,hd=ld&&ld.set,fd=Qh.aTypedArray,dd=Qh.exportTypedArrayMethod,gd=!L((function(){var e=new Uint8ClampedArray(2);return V(hd,e,{length:1,0:3},1),3!==e[1]})),pd=gd&&Qh.NATIVE_ARRAY_BUFFER_VIEWS&&L((function(){var e=new cd(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));dd("set",(function(e){fd(this);var t=nf(arguments.length>1?arguments[1]:void 0,1),n=ke(e);if(gd)return V(hd,this,n,t);var r=this.length,i=jt(n),s=0;if(i+t>r)throw ud("Wrong length");for(;s<i;)this[t+s]=n[s++]}),!gd||pd);var vd=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("slice",(function(e,t){for(var n=Jr(vd(this),e,t),r=vf(this),i=0,s=n.length,a=new r(s);s>i;)a[i]=n[i++];return a}),L((function(){new Int8Array(1).slice()})));var yd=Ci.some,md=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("some",(function(e){return yd(md(this),e,arguments.length>1?arguments[1]:void 0)}));var _d=Math.floor,Ed=function(e,t){var n=e.length,r=_d(n/2);return n<8?Td(e,t):Rd(e,Ed(Eo(e,0,r),t),Ed(Eo(e,r),t),t)},Td=function(e,t){for(var n,r,i=e.length,s=1;s<i;){for(r=s,n=e[s];r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==s++&&(e[r]=n)}return e},Rd=function(e,t,n,r){for(var i=t.length,s=n.length,a=0,o=0;a<i||o<s;)e[a+o]=a<i&&o<s?r(t[a],n[o])<=0?t[a++]:n[o++]:a<i?t[a++]:n[o++];return e},Id=Ed,Cd=ue.match(/firefox\/(\d+)/i),Sd=!!Cd&&+Cd[1],bd=/MSIE|Trident/.test(ue),wd=ue.match(/AppleWebKit\/(\d+)\./),Od=!!wd&&+wd[1],Nd=U.Array,kd=Qh.aTypedArray,Ad=Qh.exportTypedArrayMethod,Md=U.Uint16Array,Ud=Md&&Q(Md.prototype.sort),Ld=!(!Ud||L((function(){Ud(new Md(2),null)}))&&L((function(){Ud(new Md(2),{})}))),xd=!!Ud&&!L((function(){if(de)return de<74;if(Sd)return Sd<67;if(bd)return!0;if(Od)return Od<602;var e,t,n=new Md(516),r=Nd(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(Ud(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==r[e])return!0}));Ad("sort",(function(e){return void 0!==e&&Te(e),xd?Ud(this,e):Id(kd(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))}),!xd||Ld);var Pd=Qh.aTypedArray;(0,Qh.exportTypedArrayMethod)("subarray",(function(e,t){var n=Pd(this),r=n.length,i=Bt(e,r);return new(vf(n))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,Gt((void 0===t?r:Bt(t,r))-i))}));var Dd=U.Int8Array,Vd=Qh.aTypedArray,Bd=Qh.exportTypedArrayMethod,Fd=[].toLocaleString,Gd=!!Dd&&L((function(){Fd.call(new Dd(1))}));Bd("toLocaleString",(function(){return ri(Fd,Gd?Jr(Vd(this)):Vd(this),Jr(arguments))}),L((function(){return[1,2].toLocaleString()!=new Dd([1,2]).toLocaleString()}))||!L((function(){Dd.prototype.toLocaleString.call([1,2])})));var jd=Qh.exportTypedArrayMethod,qd=U.Uint8Array,Kd=qd&&qd.prototype||{},Hd=[].toString,Yd=Q([].join);L((function(){Hd.call({})}))&&(Hd=function(){return Yd(this)});var Qd=Kd.toString!=Hd;jd("toString",Hd,Qd);var Wd=Ge("iterator"),Jd=Ge("toStringTag"),zd=Il.values,Zd=function(e,t){if(e){if(e[Wd]!==zd)try{ct(e,Wd,zd)}catch(t){e[Wd]=zd}if(e[Jd]||ct(e,Jd,t),zi[t])for(var n in Il)if(e[n]!==Il[n])try{ct(e,n,Il[n])}catch(t){e[n]=Il[n]}}};for(var Xd in zi)Zd(U[Xd]&&U[Xd].prototype,Xd);Zd($i,"DOMTokenList");var $d=Object.assign,eg=Object.defineProperty,tg=Q([].concat),ng=!$d||L((function(){if(x&&1!==$d({b:1},$d(eg({},"a",{enumerable:!0,get:function(){eg(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=$d({},e)[n]||Sn($d({},t)).join("")!=r}))?function(e,t){for(var n=ke(e),r=arguments.length,i=1,s=Zt.f,a=G.f;r>i;)for(var o,u=$(arguments[i++]),c=s?tg(Sn(u),s(u)):Sn(u),l=c.length,h=0;l>h;)o=c[h++],x&&!V(a,u,o)||(n[o]=u[o]);return n}:$d;ln({target:"Object",stat:!0,forced:Object.assign!==ng},{assign:ng});var rg=U.TypeError,ig=function(e){if(yo(e))throw rg("The method doesn't accept regular expressions");return e},sg=Ge("match"),ag=Q("".indexOf);ln({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[sg]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~ag(_n(te(this)),_n(ig(e)),arguments.length>1?arguments[1]:void 0)}});var og,ug,cg,lg,hg,fg=Q(1..valueOf),dg=Q("".replace),gg="[\t\n\v\f\r                 \u2028\u2029\ufeff]",pg=RegExp("^"+gg+gg+"*"),vg=RegExp(gg+gg+"*$"),yg=function(e){return function(t){var n=_n(te(t));return 1&e&&(n=dg(n,pg,"")),2&e&&(n=dg(n,vg,"")),n}},mg={start:yg(1),end:yg(2),trim:yg(3)},_g=zt.f,Eg=Ze.f,Tg=ut.f,Rg=mg.trim,Ig="Number",Cg=U.Number,Sg=Cg.prototype,bg=U.TypeError,wg=Q("".slice),Og=Q("".charCodeAt),Ng=function(e){var t=Ke(e,"number");return"bigint"==typeof t?t:kg(t)},kg=function(e){var t,n,r,i,s,a,o,u,c=Ke(e,"number");if(ye(c))throw bg("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=Rg(c),43===(t=Og(c,0))||45===t){if(88===(n=Og(c,2))||120===n)return NaN}else if(48===t){switch(Og(c,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(a=(s=wg(c,2)).length,o=0;o<a;o++)if((u=Og(s,o))<48||u>i)return NaN;return parseInt(s,r)}return+c};if(un(Ig,!Cg(" 0o1")||!Cg("0b1")||Cg("+0x1"))){for(var Ag,Mg=function(e){var t=arguments.length<1?0:Cg(Ng(e)),n=this;return oe(Sg,n)&&L((function(){fg(n)}))?sc(Object(t),n,Mg):t},Ug=x?_g(Cg):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),Lg=0;Ug.length>Lg;Lg++)Me(Cg,Ag=Ug[Lg])&&!Me(Mg,Ag)&&Tg(Mg,Ag,Eg(Cg,Ag));Mg.prototype=Sg,Sg.constructor=Mg,Ut(U,Ig,Mg)}!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"}(og||(og={})),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"}(ug||(ug={})),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"}(cg||(cg={})),function(e){e.PUB="pub",e.QUERY="qry"}(lg||(lg={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(hg||(hg={}));var xg,Pg=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:og.AT_LEAST_ONCE,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];u(this,e),this._retain=!1,this.qos=og.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var s=t>0;t&&s&&1===arguments.length?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=8==(8&t)):(this.type=t,this._retain=n,this.qos=r,this._dup=i)}return l(e,[{key:"encode",value:function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0}}]),e}(),Dg=function(){function e(){u(this,e)}return l(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ko(e))for(var i=0,s=e.length;i<s;i++){var a=e.charCodeAt(i);a>=0&&a<=127?(r+=1,n.push(a)):a>=128&&a<=2047?(r+=2,n.push(192|31&a>>6),n.push(128|63&a)):a>=2048&&a<=65535&&(r+=3,n.push(224|15&a>>12),n.push(128|63&a>>6),n.push(128|63&a))}for(var o=0,u=n.length;o<u;o++)n[o]>255&&(n[o]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)}},{key:"readUTF",value:function(e){for(var t,n,r=[],i=-1,s=e,a="";++i<s.length;){var o=Number(s[i]);if(o===(127&o)||(240==(240&o)?o=(o=(o=(o^=240)<<6|128^s[++i])<<6|128^s[++i])<<6|128^s[++i]:224==(224&o)?o=(o=(o^=224)<<6|128^s[++i])<<6|128^s[++i]:192==(192&o)&&(o=(o^=192)<<6|128^s[++i])),!isFinite(o)||o<0||o>1114111||Math.floor(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(t=(o-=65536)>>10|55296,n=o%1024|56320,r.push(t,n)),(i+1===s.length||r.length>16384)&&(a+=String.fromCharCode.apply(null,r),r.length=0)}return a}}]),e}(),Vg=function(){function e(t){u(this,e),this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return l(e,[{key:"check",value:function(){return this._position>=this._pool.length}},{key:"read2Byte",value: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)}},{key:"readInt",value: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)}},{key:"readLong",value: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)}},{key:"readByte",value:function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e}},{key:"readUTF",value:function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return Dg.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),Bg=function(){function e(){u(this,e),this._pool=[],this._position=0,this._writen=0}return l(e,[{key:"write",value: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}},{key:"writeArr",value:function(e){return this._pool=this._pool.concat(e),e}},{key:"writeUTF",value:function(e){var t=Dg.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),Fg="UpStreamMessage",Gg="PushExtra",jg="DownStreamMessage",qg="DownStreamMessages",Kg="SessionsAttQryInput",Hg="SessionsAttOutput",Yg="SyncRequestMsg",Qg="ChrmPullMsg",Wg="NotifyMsg",Jg="HistoryMsgInput",zg="HistoryMsgOuput",Zg="RelationQryInput",Xg="RelationsOutput",$g="DeleteSessionsInput",ep="SessionInfo",tp="DeleteSessionsOutput",np="RelationsInput",rp="DeleteMsgInput",ip="CleanHisMsgInput",sp="SessionMsgReadInput",ap="ChrmInput",op="ChrmOutput",up="QueryChatRoomInfoInput",cp="QueryChatRoomInfoOutput",lp="RtcInput",hp="RtcUserListOutput",fp="SetUserStatusInput",dp="RtcSetDataInput",gp="RtcUserSetDataInput",pp="RtcDataInput",vp="RtcSetOutDataInput",yp="MCFollowInput",mp="RtcTokenOutput",_p="RtcQryOutput",Ep="RtcQryUserOutDataInput",Tp="RtcUserOutDataOutput",Rp="RtcQueryListInput",Ip="RtcRoomInfoOutput",Cp="RtcValueInfo",Sp="RtcKeyDeleteInput",bp="GetQNupTokenInput",wp="GetQNupTokenOutput",Op="GetQNdownloadUrlInput",Np="GetDownloadUrlInput",kp="GetQNdownloadUrlOutput",Ap="GetDownloadUrlOutput",Mp="SetChrmKV",Up="SetChrmKVS",Lp="DeleteChrmKVS",xp="ChrmKVOutput",Pp="ChrmKVSOutput",Dp="ChrmKVSOutputEntity",Vp="QueryChrmKV",Bp="SetUserSettingInput",Fp="SetUserSettingOutput",Gp="PullUserSettingInput",jp="PullUserSettingOutput",qp="UserSettingNotification",Kp="SessionReq",Hp="SessionStates",Yp="SessionState",Qp="SessionStateItem",Wp="SessionStateModifyReq",Jp="SessionStateModifyResp",zp="GrpReadReceiptMsg",Zp="GrpReadReceiptQryReq",Xp="GrpReadReceiptQryResp",$p="GrpMsgReadUser",ev="SessionTagAddInput",tv="SessionTagItem",nv="SessionTagDelInput",rv="SessionDisTagReq",iv="ReportSDKInput",sv="ReportSDKOutput",av="UltraGrpPullSes",ov="UltraGrpPullMsg",uv="MsgChangeReq",cv="QueryMsgChange",lv="MsgChange",hv="MsgChangeList",fv="MsgQuery",dv="MessageQueryInfo",gv="MsgQueryAck",pv="OperateStatus",vv="OperateStatusNotify",yv="OperateInfo",mv="OperateSummary",_v="RtcNotifyMsg",Ev="RtcPullKV",Tv="RtcKVOutput",Rv="RtcQueryUserJoinedInput",Iv="RtcQueryUserJoinedOutput",Cv="RtcViewerJoinedOutput",Sv="RtcInviteInput",bv="RtcCancelInviteInput",wv="RtcInviteAnswerInput",Ov="RtcEndInviteInput",Nv=(h(xg={},Fg,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"]),h(xg,qg,["list","syncTime","finished"]),h(xg,jg,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"]),h(xg,Gg,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),h(xg,Kg,["nothing"]),h(xg,Hg,["inboxTime","sendboxTime","totalUnreadCount"]),h(xg,Yg,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),h(xg,Qg,["syncTime","count"]),h(xg,Wg,["type","time","chrmId"]),h(xg,Jg,["targetId","time","count","order","busChannel"]),h(xg,zg,["list","syncTime","hasMsg"]),h(xg,Zg,["type","count","startTime","order"]),h(xg,Xg,["info","isFinished"]),h(xg,$g,["sessions"]),h(xg,ep,["type","channelId","busChannel"]),h(xg,tp,["nothing"]),h(xg,np,["type","msg","count","busChannel","startTime","endTime"]),h(xg,rp,["type","conversationId","msgs","busChannel"]),h(xg,ip,["targetId","dataTime","conversationType","busChannel"]),h(xg,sp,["type","msgTime","channelId","busChannel"]),h(xg,ap,["nothing"]),h(xg,op,["nothing","sessionId","joinTime"]),h(xg,up,["count","order"]),h(xg,cp,["userTotalNums","userInfos"]),h(xg,bp,["type","key","httpMethod","queryString"]),h(xg,Op,["type","key","fileName"]),h(xg,Np,["type","key","fileName"]),h(xg,wp,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),h(xg,kp,["downloadUrl"]),h(xg,Ap,["downloadUrl"]),h(xg,Mp,["entry","bNotify","notification","type"]),h(xg,Up,["entry","bNotify","notification","type"]),h(xg,Lp,["entry","bNotify","notification","type"]),h(xg,xp,["entries","bFullUpdate","syncTime"]),h(xg,Pp,["timestamp","errorKeys"]),h(xg,Dp,["key","errorCode"]),h(xg,Vp,["timestamp"]),h(xg,Bp,["version","value"]),h(xg,Fp,["version","reserve"]),h(xg,Gp,["version","reserve"]),h(xg,jp,["items","version"]),h(xg,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),h(xg,Kp,["time"]),h(xg,Hp,["version","state"]),h(xg,Yp,["type","channelId","time","stateItem","busChannel"]),h(xg,Qp,["sessionStateType","value","tags"]),h(xg,Wp,["version","state"]),h(xg,Jp,["version"]),h(xg,zp,["msgId","busChannel"]),h(xg,Zp,["msgId","busChannel"]),h(xg,Xp,["totalMemberNum","list"]),h(xg,$p,["readTime","userId"]),h(xg,ev,["version","tags"]),h(xg,tv,["tagId","name","createdTime","isTop"]),h(xg,nv,["version","tags"]),h(xg,rv,["tagId"]),h(xg,qp,["version","reserve"]),h(xg,iv,["sdkInfo"]),h(xg,sv,["nothing"]),h(xg,av,["syncTime","isEraseMsgContent"]),h(xg,ov,["syncTime"]),h(xg,uv,["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"]),h(xg,cv,["syncTime"]),h(xg,hv,["list","syncTime","hasNext"]),h(xg,lv,["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId"]),h(xg,fv,["targetId","type","query"]),h(xg,dv,["msgTime","msgUID","busChannel"]),h(xg,gv,["list"]),h(xg,pv,["targetId","type","opType","busChannel"]),h(xg,vv,["type","notifyType","info","summary"]),h(xg,yv,["targetId","busChannel","userId","opType","optime"]),h(xg,mv,["targetId","busChannel","count","opType"]),h(xg,lp,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"]),h(xg,hp,["users","token","sessionId","roomInfo"]),h(xg,fp,["status"]),h(xg,dp,["interior","target","key","value","objectName","content"]),h(xg,gp,["valueInfo","objectName","content"]),h(xg,pp,["interior","target","key","objectName","content"]),h(xg,vp,["target","valueInfo","objectName","content"]),h(xg,yp,["state"]),h(xg,mp,["rtcToken"]),h(xg,_p,["outInfo"]),h(xg,Ep,["userId"]),h(xg,Tp,["user"]),h(xg,Rp,["order"]),h(xg,Ip,["roomId","roomData","userCount","list"]),h(xg,Cp,["key","value"]),h(xg,Sp,["key"]),h(xg,_v,["type","time","roomId"]),h(xg,Ev,["timestamp","roomId"]),h(xg,Tv,["entries","bFullUpdate","syncTime"]),h(xg,Rv,["userId"]),h(xg,Iv,["info"]),h(xg,Sv,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),h(xg,bv,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),h(xg,wv,["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),h(xg,Ov,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),xg),kv={},Av=function(e){var t=Nv[e];kv[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(xi(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},kv[e].decode=function(e){var t={};Ko(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(xi(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Mv in Nv)Av(Mv);kv.getModule=function(e){return kv[e]()},af("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Uv,Lv="\npackage Modules;\nmessage probuf {\n message ".concat(fp,"\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 ").concat(Wg," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Yg," {\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 ").concat(Fg," {\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 ").concat(Gg," {\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 ").concat(qg," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(jg," {\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 optional int64 extStatus = 20; // 消息的扩展标记 第0位,表示送达状态: 0x01 表示已送达;断档: 0x02 表示是否需要执行断档策略; 消息修改: 0x04 拉取历史消息时表示该消息是否修改过\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(qo.IMAGE,";\n audio = ").concat(qo.AUDIO,";\n video = ").concat(qo.VIDEO,";\n file = ").concat(qo.FILE,";\n }\n message ").concat(bp," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(Op," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Np," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(wp," {\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 ").concat(kp," {\n required string downloadUrl = 1;\n }\n message ").concat(Ap," {\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 ").concat(ap," {\n required int32 nothing = 1;\n }\n message ").concat(op," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(Qg," {\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 ").concat(Zg,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(np,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(Xg,"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\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 optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(ip,"\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 ").concat(up,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(cp,"\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 ").concat(yp,"\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 ").concat(Jg,"\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 ").concat(zg,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Rp,"{\n optional int32 order=1;\n }\n\n message ").concat(Sp,"{\n repeated string key=1;\n }\n\n message ").concat(Cp,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Cp," userData=2; //用户资源信息\n }\n\n message ").concat(hp,"{\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 ").concat(Cp," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(lp,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(Cp," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Cp," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\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 ").concat(_p,"{\n repeated ").concat(Cp," outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message ").concat(pp,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(dp,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(gp," {\n repeated ").concat(Cp," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Cp," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(mp,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(vp,"{\n required targetType target=1;\n repeated ").concat(Cp," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Ep,"{\n repeated string userId = 1;\n }\n message ").concat(Tp,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Kg,"{\n required int32 nothing = 1;\n }\n message ").concat(Hg,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(sp,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat($g,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(ep,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(tp,"\n {\n optional int32 nothing=1;\n }\n message ").concat(rp,"\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 ").concat(Mp," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Up," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Lp," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(xp," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(Pp," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message ").concat(Dp,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Vp," {\n required int64 timestamp = 1;\n }\n message ").concat(Bp," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Fp," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Gp," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(jp," {\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 ").concat(Kp," {\n required int64 time = 1;\n }\n message ").concat(Hp," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Yp," {\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 ").concat(Qp," {\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 ").concat(Wp," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Jp," {\n required int64 version=1;\n }\n message ").concat(zp," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Zp," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Xp," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat($p," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(ev," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(tv," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(nv," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(rv," {\n repeated string tagId=1;\n }\n message ").concat(qp," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(iv,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(sv,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(_v," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Ev,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(Tv,"\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 ").concat(Rv,"\n {\n required string userId = 1;\n }\n message ").concat(Iv,"\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 ").concat(Cv,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Sv,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(bv,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(wv,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(Ov,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(av,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(ov,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(uv,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(cv," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(hv," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message MsgChange //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0,设为 1 时,IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 新加 - 消息变更的操作人Id\n }\n message ").concat(fv," //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message ").concat(gv," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(pv," //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message ").concat(vv," //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message ").concat(yv," {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message ").concat(mv," {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n}\n"),xv=/"/g,Pv=Q("".replace);ln({target:"String",proto:!0,forced:(Uv="sub",L((function(){var e=""[Uv]('"');return e!==e.toLowerCase()||e.split('"').length>3})))},{sub:function(){return e="sub",t="",n="",r=_n(te(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+Pv(_n(n),xv,"&quot;")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var Dv="ArrayBuffer",Vv=_h.ArrayBuffer,Bv=U.ArrayBuffer;ln({global:!0,forced:Bv!==Vv},{ArrayBuffer:Vv}),ds(Dv),ln({target:"Array",proto:!0},{fill:Pl}),Wi("fill");var Fv,Gv,jv,qv,Kv,Hv,Yv,Qv=(Fv=Lv,Gv=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,s;return t?(s=(e>>>=0)>=0&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),s&&(u[e]=n),n):(s=(e|=0)>=-128&&e<128)&&(r=o[e])?r:(n=i(e,e<0?-1:0,!1),s&&(o[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?p:g;if(t){if(e<0)return p;if(e>=h)return E}else{if(-f>=e)return T;if(e+1>=f)return _}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function s(e,t,n){var i,a,o,u,l,h,f;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;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 s(e.substring(1),t,n).neg();for(a=r(c(n,8)),o=g,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(f=r(c(n,l)),o=o.mul(f).add(r(h))):o=(o=o.mul(a)).add(r(h));return o.unsigned=t,o}function a(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?s(t):i(t.low,t.high,t.unsigned)}var o,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,o={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=s,e.fromValue=a,f=(h=(l=4294967296)*l)/2,d=n(16777216),g=n(0),e.ZERO=g,p=n(0,!0),e.UZERO=p,v=n(1),e.ONE=v,y=n(1,!0),e.UONE=y,m=n(-1),e.NEG_ONE=m,_=i(-1,2147483647,!1),e.MAX_VALUE=_,E=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=E,T=i(0,-2147483648,!1),e.MIN_VALUE=T,(R=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},R.toString=function(e){var t,n,i,s,a,o,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(T)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(s=r(c(e,6),this.unsigned),a=this,o="";;){if(u=a.div(s),l=(a.sub(u.mul(s)).toInt()>>>0).toString(e),(a=u).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(T)?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},R.isZero=function(){return 0===this.high&&0===this.low},R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return 1==(1&this.low)},R.isEven=function(){return 0==(1&this.low)},R.equals=function(e){return t(e)||(e=a(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.compare=function(e){if(t(e)||(e=a(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},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},R.neg=R.negate,R.add=function(e){var n,r,s,o,u,c,l,h,f,d,g;return t(e)||(e=a(e)),n=this.high>>>16,r=65535&this.high,s=this.low>>>16,o=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,f=0,d=0,g=0,d+=(g+=o+(65535&e.low))>>>16,f+=(d+=s+l)>>>16,h+=(f+=r+c)>>>16,h+=n+u,i((d&=65535)<<16|(g&=65535),(h&=65535)<<16|(f&=65535),this.unsigned)},R.subtract=function(e){return t(e)||(e=a(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){var n,s,o,u,c,l,h,f,p,v,y,m;return this.isZero()?g:(t(e)||(e=a(e)),e.isZero()?g:this.eq(T)?e.isOdd()?T:g:e.eq(T)?this.isOdd()?T:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(d)&&e.lt(d)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,s=65535&this.high,o=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=0,v=0,y=0,m=0,y+=(m+=u*(f=65535&e.low))>>>16,v+=(y+=o*f)>>>16,y&=65535,v+=(y+=u*h)>>>16,p+=(v+=s*f)>>>16,v&=65535,p+=(v+=o*h)>>>16,v&=65535,p+=(v+=u*l)>>>16,p+=n*f+s*h+o*l+u*c,i((y&=65535)<<16|(m&=65535),(p&=65535)<<16|(v&=65535),this.unsigned)))},R.mul=R.multiply,R.divide=function(e){var n,i,s,o,u,l,h;if(t(e)||(e=a(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return p;if(e.gt(this.shru(1)))return y;s=p}else{if(this.eq(T))return e.eq(v)||e.eq(m)?T:e.eq(T)?v:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:m:(i=this.sub(e.mul(n)),s=n.add(i.div(e)));if(e.eq(T))return this.unsigned?p:g;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();s=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),u=(o=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,o-48),h=(l=r(n)).mul(e);h.isNegative()||h.gt(i);)h=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=v),s=s.add(l),i=i.sub(h)}return s},R.div=R.divide,R.modulo=function(e){return t(e)||(e=a(e)),this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.not=function(){return i(~this.low,~this.high,this.unsigned)},R.and=function(e){return t(e)||(e=a(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return t(e)||(e=a(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return t(e)||(e=a(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},R.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)},R.shl=R.shiftLeft,R.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)},R.shr=R.shiftRight,R.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))},R.shru=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.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]},R.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}(),jv=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("")+u.apply(String,e):(e.length+arguments.length>1024&&(t.push(u.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var s,a,o=8*i-r-1,u=(1<<o)-1,c=u>>1,l=-7,h=n?i-1:0,f=n?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=o;l>0;s=256*s+e[t+h],h+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=r;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),s-=c}return(d?-1:1)*a*Math.pow(2,s-r)}function i(e,t,n,r,i,s){var a,o,u,c=8*s-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,g=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(t*u-1)*Math.pow(2,i),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&o,d+=g,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;e[n+d]=255&a,d+=g,a/=256,c-=8);e[n+d-g]|=128*p}var a,o,u,c,l,h=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?o: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 h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=e||null,(a=h.prototype).__isByteBuffer__,Object.defineProperty(a,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),u=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(e,t,n){return new h(e,t,n)},h.concat=function(e,t,n,r){var i,s,a,o,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,a=0,o=e.length;o>a;++a)h.isByteBuffer(e[a])||(e[a]=h.wrap(e[a],t)),(s=e[a].limit-e[a].offset)>0&&(i+=s);if(0===i)return new h(0,n,r);for(c=new h(i,n,r),a=0;o>a;)(s=(u=e[a++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=s);return c.limit=c.offset,c.offset=0,c},h.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},h.type=function(){return ArrayBuffer},h.wrap=function(e,t,n,r){var i,o;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return h.fromBase64(e,n);case"hex":return h.fromHex(e,n);case"binary":return h.fromBinary(e,n);case"utf8":return h.fromUTF8(e,n);case"debug":return h.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!==s(e))throw TypeError("Illegal buffer");if(h.isByteBuffer(e))return(i=a.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new h(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 h(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 h(e.length,n,r)).limit=e.length,o=0;o<e.length;++o)i.view[o]=e[o]}return i},a.writeBitSet=function(e,t){var n,r,i,s,a,o,u=void 0===t;if(u&&(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,s=(i=e.length)>>3,a=0,t+=this.writeVarint32(i,t);s--;)n=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(n,t++);if(i>a){for(o=0,n=0;i>a;)n|=(1&!!e[a++])<<o++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},a.readBitSet=function(e){var t,n,r,i,s,a,o,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,s=0,a=[],e+=n.length;i--;)t=this.readByte(e++),a[s++]=!!(1&t),a[s++]=!!(2&t),a[s++]=!!(4&t),a[s++]=!!(8&t),a[s++]=!!(16&t),a[s++]=!!(32&t),a[s++]=!!(64&t),a[s++]=!!(128&t);if(r>s)for(o=0,t=this.readByte(e++);r>s;)a[s++]=!!(1&t>>o++);return u&&(this.offset=e),a},a.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},a.writeBytes=a.append,a.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},a.writeByte=a.writeInt8,a.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},a.readByte=a.readInt8,a.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},a.writeUInt8=a.writeUint8,a.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},a.readUInt8=a.readUint8,a.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},a.writeShort=a.writeInt16,a.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},a.readShort=a.readInt16,a.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},a.writeUInt16=a.writeUint16,a.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},a.readUInt16=a.readUint16,a.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},a.writeInt=a.writeInt32,a.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},a.readInt=a.readInt32,a.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},a.writeUInt32=a.writeUint32,a.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},a.readUInt32=a.readUint32,e&&(a.writeInt64=function(t,n){var r,i,s,a=void 0===n;if(a&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),a&&(this.offset+=8),this},a.writeLong=a.writeInt64,a.readInt64=function(t){var n,r,i,s=void 0===t;if(s&&(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),s&&(this.offset+=8),i},a.readLong=a.readInt64,a.writeUint64=function(t,n){var r,i,s,a=void 0===n;if(a&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),a&&(this.offset+=8),this},a.writeUInt64=a.writeUint64,a.readUint64=function(t){var n,r,i,s=void 0===t;if(s&&(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),s&&(this.offset+=8),i},a.readUInt64=a.readUint64),a.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},a.writeFloat=a.writeFloat32,a.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},a.readFloat=a.readFloat32,a.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},a.writeDouble=a.writeFloat64,a.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},a.readDouble=a.readFloat64,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},h.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},h.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},a.writeVarint32=function(e,t){var n,r,i,s=void 0===t;if(s&&(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=h.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,s?(this.offset=t,this):r},a.writeVarint32ZigZag=function(e,t){return this.writeVarint32(h.zigZagEncode32(e),t)},a.readVarint32=function(e){var t,n,r,i,s=void 0===e;if(s&&(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,s?(this.offset=e,r):{value:r,length:n}},a.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"===s(t)?t.value=h.zigZagDecode32(t.value):t=h.zigZagDecode32(t),t},e&&(h.MAX_VARINT64_BYTES=10,h.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},h.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()},h.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()},a.writeVarint64=function(t,n){var r,i,s,a,o,u=void 0===n;if(u&&(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=h.calculateVarint64(t),i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,a=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,r){case 10:this.view[n+9]=1&a>>>7;case 9:this.view[n+8]=9!==r?128|a:127&a;case 8:this.view[n+7]=8!==r?128|s>>>21:127&s>>>21;case 7:this.view[n+6]=7!==r?128|s>>>14:127&s>>>14;case 6:this.view[n+5]=6!==r?128|s>>>7:127&s>>>7;case 5:this.view[n+4]=5!==r?128|s:127&s;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 u?(this.offset+=r,this):r},a.writeVarint64ZigZag=function(e,t){return this.writeVarint64(h.zigZagEncode64(e),t)},a.readVarint64=function(t){var n,r,i,s,a,o,u=void 0===t;if(u&&(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,s=0,a=0,r=127&(a=this.view[t++]),128&a&&(r|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(i=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(i|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(s=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");return o=e.fromBits(r|i<<28,i>>>4|s<<24,!1),u?(this.offset=t,o):{value:o,length:t-n}},a.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=h.zigZagDecode64(n.value):n=h.zigZagDecode64(n),n}),a.writeCString=function(e,n){var r,i,s,a=void 0===n;if(a&&(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=l.calculateUTF16asUTF8(t(e))[1],n+=i+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+1,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,a?(this.offset=n,this):i},a.readCString=function(e){var t,r,i,s=void 0===e;if(s&&(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,l.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),s?(this.offset=e,r()):{string:r(),length:e-t}},a.writeIString=function(e,n){var r,i,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(i=n,r=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s: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,l.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 a?(this.offset=n,this):n-i},a.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,h.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",a.writeUTF8String=function(e,n){var r,i,s,a=void 0===n;if(a&&(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=l.calculateUTF16asUTF8(t(e))[1],n+=r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),a?(this.offset=n,this):n-i},a.writeString=a.writeUTF8String,h.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(t(e))[0]},h.calculateString=h.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(t(e))[1]},a.readUTF8String=function(e,t,r){var i,s,a,o,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=h.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(a=0,o=r,t===h.METRICS_CHARS){if(s=n(),l.decodeUTF8(function(){return e>a&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++a,l.UTF8toUTF16(e,s)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-o}}if(t===h.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(u=r+e,l.decodeUTF8toUTF16(function(){return u>r?this.view[r++]:null}.bind(this),s=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return i?(this.offset=r,s()):{string:s(),length:r-o}}throw TypeError("Unsupported metrics: "+t)},a.readString=a.readUTF8String,a.writeVString=function(e,n){var r,i,s,a,o=void 0===n;if(o&&(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(s=n,r=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=h.calculateVarint32(r),n+=i+r,a=this.buffer.byteLength,n>a&&this.resize((a*=2)>n?a:n),n-=i+r,n+=this.writeVarint32(r,n),l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return o?(this.offset=n,this):n-s},a.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,h.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},a.append=function(e,t,n){var r,i,s;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 h||(e=h.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},a.appendTo=function(e,t){return e.append(this,t),this},a.assert=function(e){return this.noAssert=!e,this},a.capacity=function(){return this.buffer.byteLength},a.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},a.clone=function(e){var t=new h(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},a.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=o,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)},a.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 h(0,this.littleEndian,this.noAssert);var n=t-e,r=new h(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},a.copyTo=function(e,t,n,r){var i,s,a;if(!this.noAssert&&!h.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=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==(a=r-n)?e:(e.ensureCapacity(t+a),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=a),s&&(e.offset+=a),this)},a.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},a.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},a.flip=function(){return this.limit=this.offset,this.offset=0,this},a.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},a.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},a.LE=function(e){return this.littleEndian=void 0===e||!!e,this},a.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},a.prepend=function(e,t,n){var r,i,s,a,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 h||(e=h.wrap(e,t)),(i=e.limit-e.offset)<=0||((s=i-n)>0?(a=new ArrayBuffer(this.buffer.byteLength+s),(o=new Uint8Array(a)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=a,this.view=o,this.offset+=s,this.markedOffset>=0&&(this.markedOffset+=s),this.limit+=s,n+=s):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},a.prependTo=function(e,t){return e.prepend(this,t),this},a.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},a.remaining=function(){return this.limit-this.offset},a.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},a.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},a.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},a.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},a.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},a.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?o:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},a.toArrayBuffer=a.toBuffer,a.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,s,a;null!==(r=e());)if(void 0===(s=i[r])&&n(r),null!==(r=e())&&(void 0===(a=i[r])&&n(r),t(s<<2>>>0|(48&a)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;n(r)}if(t((15&a)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(a=i[r])){if(61===r)break;n(r)}t((3&s)<<6>>>0|a)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),a.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()},h.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new h(e.length/4*3,n),i=0;return c.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},h.btoa=function(e){return h.fromBinary(e).toBase64()},h.atob=function(e){return h.fromBase64(e).toBinary()},a.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)},h.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new h(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);s.view[r++]=n}return s.limit=i,s},a.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",a="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";a+=i+s+"\n",i=s=""}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+=" ";a+=i+s+"\n"}return e?a:i},h.fromDebug=function(e,t,n){for(var r,i,s=e.length,a=new h(0|(s+1)/3,t,n),o=0,u=0,c=!1,l=!1,f=!1,d=!1,g=!1;s>o;){switch(r=e.charAt(o++)){case"!":if(!n){if(l||f||d){g=!0;break}l=f=d=!0}a.offset=a.markedOffset=a.limit=u,c=!1;break;case"|":if(!n){if(l||d){g=!0;break}l=d=!0}a.offset=a.limit=u,c=!1;break;case"[":if(!n){if(l||f){g=!0;break}l=f=!0}a.offset=a.markedOffset=u,c=!1;break;case"<":if(!n){if(l){g=!0;break}l=!0}a.offset=u,c=!1;break;case"]":if(!n){if(d||f){g=!0;break}d=f=!0}a.limit=a.markedOffset=u,c=!1;break;case">":if(!n){if(d){g=!0;break}d=!0}a.limit=u,c=!1;break;case"'":if(!n){if(f){g=!0;break}f=!0}a.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(o++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+o)}if(!n){if(!l||!d)throw TypeError("Illegal str: Missing offset or limit");if(u<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return a},a.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("")},h.fromHex=function(e,t,n){var r,i,s,a,o;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,s=new h(0|i/2,t),a=0,o=0;i>a;a+=2){if(r=parseInt(e.substring(a,a+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[o++]=r}return s.limit=o,s},l=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,s,a=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())&&a([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&a([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===(s=e()))&&a([n,r,i,s]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&s)}},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}(),a.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return 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()},h.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new h(l.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return l.encodeUTF16toUTF8(t(e),(function(e){i.view[s++]=e})),i.limit=s,i},h}(Gv),qv=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 s,a,o={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._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]},c.next=function(){var e,n,r,i,s;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('"'===(s=this.source.substring(this.index,this.index=i))||"'"===s)&&(this._stringOpen=s),s},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},o.Tokenizer=u,s=function(e){this.tn=new u(e),this.proto3=!1},(a=s.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},s.parse=function(e){return new s(e).parse()},a._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},a._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)},a._parseOption=function(e,n){var r,i=this.tn.next(),s=!1;if("("===i&&(s=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,s&&(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(";")},a._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)}},a._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)},a._parseServiceRPC=function(e){var n,r,i="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);if(n=s,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(r.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.response_stream=!0,s=this.tn.next()),r.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},a._parseMessage=function(e,r){var i=!!r,s=this.tn.next(),a={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(i?"group":"message")+" name: "+s);for(a.name=s,i&&(this.tn.skip("="),r.id=n(this.tn.next()),a.isGroup=!0),"["===(s=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(a,s);else if("oneof"===s)this._parseMessageOneOf(a);else if("enum"===s)this._parseEnum(a);else if("message"===s)this._parseMessage(a);else if("option"===s)this._parseOption(a);else if("service"===s)this._parseService(a);else if("extensions"===s)a.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(a);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(a,"optional",s)}return this.tn.omit(";"),e.messages.push(a),a},a._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},a._parseMessageField=function(e,r,i){var s,a,o;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(s={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field type: "+a);if(s.keytype=a,this.tn.skip(","),a=this.tn.next(),!t.TYPE.test(a)&&!t.TYPEREF.test(a))throw Error("illegal message field: "+a);if(s.type=a,this.tn.skip(">"),a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);s.name=a,this.tn.skip("="),s.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(o=this._parseMessage(e,s),!/^[A-Z]/.test(o.name))throw Error("illegal group name: "+o.name);s.type=o.name,s.name=o.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(s.type=i,a=this.tn.next(),!t.NAME.test(a))throw Error("illegal message field name: "+a);s.name=a,this.tn.skip("="),s.id=n(this.tn.next()),"["===(a=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},a._parseMessageOneOf=function(e){var n,r,i,s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal oneof name: "+s);for(r=s,i=[],this.tn.skip("{");"}"!==(s=this.tn.next());)(n=this._parseMessageField(e,"optional",s)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},a._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},a._parseEnum=function(e){var r,i={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(i.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(i);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("="),r={name:s,id:n(this.tn.next(),!0)},"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},a._parseExtensionRanges=function(){var t,n,i,s=[];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()}s.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),s},a._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},a.toString=function(){return"Parser at line "+this.tn.line},o.Parser=s,o}(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(),s=7&r,a=r>>>3;switch(s){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(a,n);break;case t.WIRE_TYPES.ENDGROUP:if(a===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+a+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+s)}return!0}var a,o,u,c,l,h,f,d,g,p,v,y,m,_,E,T,R={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=I,a=function(e,t,n,r,i){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(o=a.prototype=Object.create(I.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},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof l.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof l.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},o.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},o.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,s=0;if(""===r[s]){for(;null!==i.parent;)i=i.parent;s++}do{do{if(!(i instanceof R.Namespace)){i=null;break}if(!((n=i.getChild(r[s]))&&n instanceof R.T&&(!t||n instanceof R.Namespace))){i=null;break}i=n,s++}while(s<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},o.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 R.Namespace))return n.join(".");return e.fqn()},o.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof a&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},o.buildOpt=function(){var e,t,n,r,i={},s=Object.keys(this.options);for(e=0,t=s.length;t>e;++e)n=s[e],r=this.options[s[e]],i[n]=r;return i},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},R.Namespace=a,u=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)},c=u.prototype,u.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,a,o,u=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)&&u(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)&&u(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){u(s(n),e.message)}else u(s(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){u(s(n),e.message)}else u(s(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&u(s(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&u(s(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||u(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),o=0;o<i.length;o++){if(i[o].name==n)return i[o].id;if(i[o].id==n)return i[o].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&u(s(n),"not an integer"),(n>4294967295||n<0)&&u(s(n),"not in range for uint32"),n;u(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"===s(n)||u(s(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(o in a={},n)n.hasOwnProperty(o)&&(a[o]=n[o]);n=a}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 s,a;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");s=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=s;break;case t.TYPES.message:a=(new n).LE(),this.resolvedType.encode(r,a),i.writeVarint32(a.offset),i.append(a.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,s;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(s=e.readVarint32(),e.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+s,e.offset+=s,i;case t.TYPES.message:return s=e.readVarint32(),this.resolvedType.decode(e,s);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()},R.Element=u,l=function(e,t,n,r,i,s){a.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},(h=l.prototype=Object.create(a.prototype)).build=function(r){var i,a,o,u;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,a,o){var u,c,l,h,f,d,g;if(null===e||"object"!==s(e))return o&&o instanceof t.Reflect.Enum&&null!==(u=t.Reflect.Enum.getName(o.object,e))?u:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return a?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(e,t){c[t]=i(e,r,a,o)})),c;if(c={},e instanceof t.Map){for(h=(l=e.entries()).next();!h.done;h=l.next())c[e.keyElem.valueToString(h.value[0])]=i(h.value[1],r,a,e.valueElem.resolvedType);return c}for(g in f=e.$type,d=void 0,e)e.hasOwnProperty(g)&&(c[g]=f&&(d=f.getChild(g))?i(e[g],r,a,d.resolvedType):i(e[g],r,a));return c}var a,o,u=r.getChildren(t.Reflect.Message.Field),c=r.getChildren(t.Reflect.Message.OneOf),l=function e(i){var a,o,l,h;for(t.Builder.Message.call(this),a=0,o=c.length;o>a;++a)this[c[a].name]=null;for(a=0,o=u.length;o>a;++a)this[(l=u[a]).name]=l.repeated?[]:l.map?new t.Map(l):null,!l.required&&"proto3"!==r.syntax||null===l.defaultValue||(this[l.name]=l.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(a=0,o=arguments.length;o>a;++a)void 0!==(h=arguments[a])&&this.$set(u[a].name,h);else this.$set(i)},h=l.prototype=Object.create(t.Builder.Message.prototype);for(h.add=function(e,n,i){var s=r._fieldsByName[e];if(!i){if(!s)throw Error(this+"#"+e+" is undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));if(!s.repeated)throw Error(this+"#"+e+" is not a repeated field");n=s.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},h.$add=h.add,h.set=function(e,n,i){var a,o,u;if(e&&"object"===s(e)){for(a in i=n,e)e.hasOwnProperty(a)&&void 0!==(n=e[a])&&this.$set(a,n,i);return this}if(o=r._fieldsByName[e],i)this[e]=n;else{if(!o)throw Error(this+"#"+e+" is not a field: undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));this[o.name]=n=o.verifyValue(n)}return o&&o.oneof&&(u=this[o.oneof.name],null!==n?(null!==u&&u!==o.name&&(this[u]=null),this[o.oneof.name]=o.name):u===e&&(this[o.oneof.name]=null)),this},h.$set=h.set,h.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]},h.$get=h.get,a=0;a<u.length;a++)(o=u[a])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,i,s=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));s=s.substring(0,1).toUpperCase()+s.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"+s)&&(h["set"+s]=n),null===r.getChild("set_"+t)&&(h["set_"+t]=n),null===r.getChild("get"+s)&&(h["get"+s]=i),null===r.getChild("get_"+t)&&(h["get_"+t]=i)}(o);return h.encode=function(t,n){var i,s;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),s=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(s)}catch(e){throw t.LE(s),e}},l.encode=function(e,t,n){return new l(e).encode(t,n)},h.calculate=function(){return r.calculate(this)},h.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},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},l.decode=function(e,t){var i,s;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return s=r.decode(e.LE()),e.LE(i),s}catch(t){throw e.LE(i),t}},l.decodeDelimited=function(e,t){var i,s,a;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,s=e.readVarint32(),e.remaining()<s)return e.offset=i,null;try{return a=r.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,a}catch(t){throw e.offset+=s,t}},l.decode64=function(e){return l.decode(e,"base64")},l.decodeHex=function(e){return l.decode(e,"hex")},l.decodeJSON=function(e){return new l(JSON.parse(e))},h.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(l,"$options",{value:r.buildOpt()}),Object.defineProperty(h,"$options",{value:l.$options}),Object.defineProperty(l,"$type",{value:r}),Object.defineProperty(h,"$type",{value:r})),l}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,u=this.children.length;u>o;o++)if((a=this.children[o])instanceof v||a instanceof l||a instanceof _){if(i.hasOwnProperty(a.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+a.toString(!0)+" cannot override static property '"+a.name+"'");i[a.name]=a.build()}else if(a instanceof l.Field)a.build(),this._fields.push(a),this._fieldsById[a.id]=a,this._fieldsByName[a.name]=a;else if(!(a instanceof l.OneOf||a instanceof m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=i},h.encode=function(e,t,n){var r,i,s,a,o,u=null;for(s=0,a=this._fields.length;a>s;++s)i=e[(r=this._fields[s]).name],r.required&&null===i?null===u&&(u=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==u)throw(o=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,o;return t},h.calculate=function(e){for(var t,n,r=0,i=0,s=this._fields.length;s>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},h.decode=function(e,n,r){var s,a,o,u,c,l,h,f,d,g,p,v;for(n="number"==typeof n?n:-1,c=e.offset,l=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(o=(s=e.readVarint32())>>>3,(a=7&s)===t.WIRE_TYPES.ENDGROUP){if(o!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+o+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[o])u.repeated&&!u.options.packed?l[u.name].push(u.decode(a,e)):u.map?(f=u.decode(a,e),l[u.name].set(f[0],f[1])):(l[u.name]=u.decode(a,e),u.oneof&&(null!==(d=l[u.oneof.name])&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name));else switch(a){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:h=e.readVarint32(),e.offset+=h;break;case t.WIRE_TYPES.STARTGROUP:for(;i(o,e););break;default:throw Error("Illegal wire type for unknown field "+o+" in "+this.toString(!0)+"#decode: "+a)}}for(g=0,p=this._fields.length;p>g;++g)if(null===l[(u=this._fields[g]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(v=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,v;t.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},R.Message=l,f=function(e,n,r,i,s,a,o,u,c,h){I.call(this,e,n,a),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=s,this.resolvedType=null,this.id=o,this.options=u||{},this.defaultValue=null,this.oneof=c||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof l.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=f.prototype=Object.create(I.prototype)).build=function(){this.element=new u(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new u(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=u.defaultFieldValue(this.type)},d.verifyValue=function(e,n){var r,i,a;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]),a=[],i=0;i<e.length;i++)a.push(this.element.verifyValue(e[i]));return a}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))},d.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}},d.encode=function(e,r,i){var a,o,u,c,l;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),o=r.offset,a=0;a<e.length;a++)this.element.encodeValue(this.id,e[a],r);u=r.offset-o,(c=n.calculateVarint32(u))>1&&(l=r.slice(o,r.offset),o+=c-1,r.offset=o,r.append(l)),r.writeVarint32(u,o-c)}else for(a=0;a<e.length;a++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[a],r);else this.map?e.forEach((function(e,i){var s=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(s),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},d.calculate=function(e,r){var i,a,o;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),o=0,a=0;a<e.length;a++)o+=this.element.calculateLength(this.id,e[a]);i+=n.calculateVarint32(o),i+=o}else for(a=0;a<e.length;a++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[a]);else this.map?e.forEach((function(e,r){var s=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(s),i+=s}),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},d.decode=function(e,n,r){var i,s,a,o,c,l,h;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(s=n.readVarint32(),s=n.offset+s,a=[];n.offset<s;)a.push(this.decode(this.type.wireType,n,!0));return a}if(this.map){if(o=u.defaultFieldValue(this.keyType),i=u.defaultFieldValue(this.type),s=n.readVarint32(),n.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+s,n.offset+=s;c.remaining()>0;)if(e=7&(l=c.readVarint32()),1==(h=l>>>3))o=this.keyElement.decode(c,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,e,h)}return[o,i]}return this.element.decode(n,e,this.id)},R.Message.Field=f,g=function(e,t,n,r,i,s,a){f.call(this,e,t,n,null,r,i,s,a),this.extension},g.prototype=Object.create(f.prototype),R.Message.ExtensionField=g,p=function(e,t,n){I.call(this,e,t,n),this.fields=[]},R.Message.OneOf=p,v=function(e,t,n,r,i){a.call(this,e,t,n,r,i),this.className="Enum",this.object=null},v.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},(v.prototype=Object.create(a.prototype)).build=function(e){var n,r,i,s;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,s=(r=this.getChildren(v.Value)).length;s>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},R.Enum=v,y=function(e,t,n,r){I.call(this,e,t,n),this.className="Enum.Value",this.id=r},y.prototype=Object.create(I.prototype),R.Enum.Value=y,m=function(e,t,n,r){I.call(this,e,t,n),this.field=r},m.prototype=Object.create(I.prototype),R.Extension=m,_=function(e,t,n,r){a.call(this,e,t,n,r),this.className="Service",this.clazz=null},(_.prototype=Object.create(a.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)}},a=i.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<o.length;r++)!function(e){a[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(a[e.name],"$options",{value:i[e.name].$options}))}(o[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(a,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(a,"$type",{value:t})),i}(t,this)},R.Service=_,E=function(e,t,n,r){I.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(E.prototype=Object.create(I.prototype)).buildOpt=o.buildOpt,R.Service.Method=E,T=function(e,t,n,r,i,s,a,o){E.call(this,e,t,n,o),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=s,this.responseStream=a,this.resolvedRequestType=null,this.resolvedResponseType=null},T.prototype=Object.create(E.prototype),R.Service.RPCMethod=T,R}(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||{}},a=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},a.reset=function(){return this.ptr=this.ns,this},a.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},a.create=function(t){var r,a,o,u,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(a=t.shift(),i.isMessage(a)){if(o=new n.Message(this,this.ptr,a.name,a.options,a.isGroup,a.syntax),u={},a.oneofs&&Object.keys(a.oneofs).forEach((function(e){o.addChild(u[e]=new n.Message.OneOf(this,o,e))}),this),a.fields&&a.fields.forEach((function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!==s(e.options))throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=u[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,a.syntax),t&&t.fields.push(e),o.addChild(e)}),this),c=[],a.enums&&a.enums.forEach((function(e){c.push(e)})),a.messages&&a.messages.forEach((function(e){c.push(e)})),a.services&&a.services.forEach((function(e){c.push(e)})),a.extensions&&(o.extensions="number"==typeof a.extensions[0]?[a.extensions]:a.extensions),this.ptr.addChild(o),c.length>0){r.push(t),t=c,c=null,this.ptr=o,o=null;continue}c=null}else if(i.isEnum(a))o=new n.Enum(this,this.ptr,a.name,a.options,a.syntax),a.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(i.isService(a))o=new n.Service(this,this.ptr,a.name,a.options),Object.keys(a.rpc).forEach((function(e){var t=a.rpc[e];o.addChild(new n.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!i.isExtend(a))throw Error("not a valid definition: "+JSON.stringify(a));if(o=this.ptr.resolve(a.ref,!0))a.fields.forEach((function(t){var r,i,s,a;if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions&&(r=!1,o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),s=new n.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,s),s.extension=a,this.ptr.addChild(a),o.addChild(s)}),this);else if(!/\.?google\.protobuf\./.test(a.ref))throw Error("extended message "+a.ref+" is not defined")}a=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},a.import=function(t,n){var i,a,o,u,c,l,h,f,d="/";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)&&(d="\\"),a=i+d+n.file,!0===this.files[a])return this.reset();this.files[a]=!0}if(t.imports&&t.imports.length>0){for(u=!1,"object"===s(n)?(this.importRoot=n.root,u=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),d="\\"):o=".":o=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(l=t.imports[c]))continue;if(l=o+d+l,!0===this.files[l])continue;if(/\.proto$/i.test(l)&&!e.DotProto&&(l=l.replace(/\.proto$/,".json")),null===(h=e.Util.fetch(l)))throw Error("failed to import '"+l+"' in '"+n+"': file not found");/\.json$/i.test(l)?this.import(JSON.parse(h+""),l):this.import(e.DotProto.Parser.parse(h),l)}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]);u&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),f=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){f.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=f),t.enums&&(this.create(t.enums),this.ptr=f),t.services&&(this.create(t.services),this.ptr=f),t.extends&&this.create(t.extends),this.reset()},a.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()},a.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},a.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},a.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,s,a;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++)s=this.keyElem.valueFromString(r[i]),a=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(s)]={key:s,value:a}},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=Fv,i.loadProto(r,void 0,"").build("Modules").probuf}(jv,Gv),qv);Qv.getModule=function(e){var t=new Qv[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Wo(e)?[].slice.call(new Int8Array(e)):e},t};var Wv="pgMsgP",Jv="chatMsg",zv="pcMsgP",Zv={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Xv="delMsg",$v="joinChrm",ey="joinChrmR",ty="exitChrm",ny="setKV",ry="delKV",iy="setKVS",sy="delKVS",ay="qryRelationR",oy="delRelation",uy="setSeAtt",cy={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},ly="qryPMsg",hy="qryGMsg",fy="qryCHMsg",dy="qryCMsg",gy="qrySMsg",py=(h(Kv={},"ppMsgP",Go.PRIVATE),h(Kv,Wv,Go.GROUP),h(Kv,Jv,Go.CHATROOM),h(Kv,zv,Go.CUSTOMER_SERVICE),Kv),vy=(h(Hv={},Go.PRIVATE,ly),h(Hv,Go.GROUP,hy),h(Hv,Go.CHATROOM,fy),h(Hv,Go.CUSTOMER_SERVICE,dy),h(Hv,Go.SYSTEM,gy),Hv),yy=(h(Yv={},Go.PRIVATE,cy.PRIVATE),h(Yv,Go.GROUP,cy.GROUP),h(Yv,Go.ULTRA_GROUP,cy.ULTRA_GROUP),h(Yv,Go.CUSTOMER_SERVICE,cy.CUSTOMER_SERVICE),h(Yv,Go.SYSTEM,cy.SYSTEM),Yv),my="1",_y="0",Ey=1,Ty=2,Ry=3,Iy=function(){function t(e){u(this,t),this._codec="websocket"===e?Qv:kv,this._connectType=e}return l(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,a=(h(r={},qg,i._formatSyncMessages),h(r,jg,i._formatReceivedMessage),h(r,Fg,i._formatSentMessage),h(r,zg,i._formatHistoryMessages),h(r,Xg,i._formatConversationList),h(r,cp,i._formatChatRoomInfos),h(r,hp,i._formatRTCUserList),h(r,_p,i._formatRTCData),h(r,xp,i._formatChatRoomKVList),h(r,jp,i._formatUserSetting),h(r,Hp,i._formatConversationStatus),h(r,Xp,i._formatGrpReadReceiptQryResp),h(r,Fp,i._formatSetUserSettingOutput),h(r,qp,i._formatUserSettingNotification),h(r,hv,i._formatUltraMsgChangeList),h(r,vv,i._formatUltraOperateStatusNotifyList),h(r,gv,i._formatUltraMsgList),h(r,Tv,i._formatRTCRoomKVList),h(r,mp,i._formatRTCAuidenceJoinRoomData),h(r,Iv,i._formatRTCJoinedUserInfo),r)[t];try{s=e.length>0&&i._codec[t].decode(e),zo(s)&&(s=function(e){for(var t in e)zo(e[t])&&(e[t]=Uc(e[t]));return e}(s)),Zo(a)&&(s=a.call(this,s,n))}catch(n){su.error("PB parse error\n",n,e,t)}return s}},{key:"_readBytes",value:function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=Wo(n)?new Uint8Array(n):n;return Dg.readUTF(i.subarray(t,r))}catch(e){su.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){su.info("formatBytes error\n",e)}return t||e}},{key:"_formatSyncMessages",value:function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,s=e.finished;return(Xo(s)||null===s)&&(e.finished=!0),e.syncTime=Uc(i),e.list=Fc(r,(function(e){return n._formatReceivedMessage(e,t)})),e}},{key:"_formatReceivedMessage",value:function(e,t){if(!e)return e;var r=t=t||{},s=r.currentUserId,a=r.connectedTime,o=e.content,u=e.fromUserId,c=e.type,l=e.groupId,h=e.status,f=e.dataTime,d=e.classname,g=e.msgId,p=e.extraContent,v=e.pushContent,y=e.pushExt,m=e.configFlag,_=e.extStatus,E=(e.direction||pu.RECEIVE)===pu.SEND,T=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(h),R=T.isPersited,I=T.isCounted,C=T.isMentioned,S=T.disableNotification,b=T.receivedStatus,w=T.canIncludeExpansion,O=!!(2&(_||0)),N=!!(4&(_||0)),k=[Go.GROUP,Go.CHATROOM,Go.RTC_ROOM,Go.ULTRA_GROUP].indexOf(c)>-1?l:u,A=E?s:u,M=Uc(f),U=M<a,L=c===Go.CHATROOM,x=this._formatBytes(o),P={};if(y&&(P=Pc(y.pushConfigs,y.pushId)),x.user){var D=x.user,V=D.portrait,B=D.portraitUri,F=V||B;F&&(x.user.portrait=x.user.portraitUri=F)}var G,j=i(i({},P),{},{pushTitle:null==y?void 0:y.title,pushContent:v,pushData:v,disablePushTitle:!!m&&Boolean(4&m),forceShowDetailContent:!!m&&Boolean(8&m),templateId:null==y?void 0:y.templateId}),q=E?pu.SEND:pu.RECEIVE;L&&u===s&&(q=pu.SEND),p&&(G={},G=Jc(p));var K={conversationType:c,targetId:k,senderUserId:A,messageType:d,messageUId:g,isPersited:R,isCounted:I,isMentioned:C,sentTime:M,messageDirection:q,receivedTime:zc.getTime(),disableNotification:S,receivedStatus:b,canIncludeExpansion:w,content:x,expansion:G,configFlag:m,pushConfig:j,channelId:e.busChannel||"",isInterrupt:O,isModifyMessage:N};return c!==Go.ULTRA_GROUP&&(K.isOffLineMessage=U),K}},{key:"_formatSentMessage",value:function(e,t){var n,r=e.content,s=e.classname,a=e.sessionId,o=e.msgId,u=e.extraContent,c=e.pushExt,l=e.pushContent,h=e.configFlag,f=e.extStatus,d=t.signal,g=t.currentUserId,p=d.date,v=d.topic,y=d.targetId,m=!!(2&(f||0)),_=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(a),E=_.isPersited,T=_.isCounted,R=_.disableNotification,I=_.canIncludeExpansion,C=py[v]||Go.PRIVATE,S=jc(Zv,v),b=this._formatBytes(r),w=y;s===Ru.RECALL&&(C=b.conversationType||C,w=b.targetId||y),u&&(n={},n=Jc(u));var O={};c&&(O=Pc(c.pushConfigs,c.pushId));var N=i(i({},O),{},{pushTitle:null==c?void 0:c.title,pushContent:l,pushData:l,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==c?void 0:c.templateId});return{conversationType:C,targetId:w,messageType:s,messageUId:o,isPersited:E,isCounted:T,isStatusMessage:S,senderUserId:g,content:this._formatBytes(r),sentTime:1e3*p,receivedTime:zc.getTime(),messageDirection:pu.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:I,expansion:n,pushConfig:N,channelId:e.busChannel||"",isInterrupt:m}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,a=r.targetId,o=Uc(e.syncTime),u=[];return Bc(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===Go.ULTRA_GROUP?i.targetId=e.groupId||r.targetId:i.targetId=a,u.push(i)}),{isReverse:!0}),{syncTime:o,list:u,hasMore:!!s}}},{key:"_formatUltraMsgChangeList",value:function(e){var t=e.list,n=e.syncTime,r=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,r=e.time,i=e.changeType,s=e.msgUID,a=e.msgTime,o=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId;return{targetId:t,conversationType:n,changeType:i,messageUId:s,changeTime:Uc(r),sendTime:Uc(a),channelId:o,isAdmin:u,isDel:c,operatorId:l}})),hasNext:r}}},{key:"_formatUltraOperateStatusNotifyList",value:function(e){var t=e.type,n=e.notifyType,r=e.info,i=e.summary,s=[],a=[],o=2==(2&n),u=1==(1&n);return u&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.userId,i=e.opType,a=e.optime,o=Uc(a);s.push({targetId:t,channelId:n,userId:r,operationType:i,operationTime:o})})),o&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,i=e.opType;a.push({targetId:t,channelId:n,count:r,operationType:i})})),{conversationType:t,info:s,summary:a,hasInfo:u,hasSummary:o}}},{key:"_formatUltraMsgList",value:function(e,t){var n=this,r=e.list;return{list:r&&r.map((function(e){return n._formatReceivedMessage(e,t)}))}}},{key:"_formatConversationList",value:function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){},s={list:r=Fc(r,(function(e){var r=e.msg,s=e.userId,a=e.type,o=e.unreadCount,u=e.busChannel,c=e.versionTime,l=e.remindCount,h=null;r&&((h=n._formatReceivedMessage(r,t)).targetId=s);var f={targetId:s,conversationType:a,unreadMessageCount:Uc(o)||0,latestMessage:h||{},channelId:u||""};return a===Go.ULTRA_GROUP&&(f.versionTime=Uc(c)||0,f.unreadMentionedCount=Uc(l)||0),i(f)||f}))};return((null==t?void 0:t.conversationType)||Go.NONE)===Go.ULTRA_GROUP&&(s.isFinished=e.isFinished),s}},{key:"_formatSetUserSettingOutput",value:function(e){return e}},{key:"_formatChatRoomInfos",value:function(e){var t=e.userTotalNums,n=e.userInfos,r=Fc(n,(function(e){var t=e.id,n=e.time;return{id:t,time:Uc(n)}}));return{userCount:t,userInfos:r}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=Fc(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,s=e.uid,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?ku.DELETE:ku.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:s,timestamp:Uc(i)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return Bc(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=Uc(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=Uc(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return Bc(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,a=e.busChannel,o=Cu.CLOSE,u=!1,c=[];Bc(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Ey:o=n===my?Cu.OPEN:Cu.CLOSE;break;case Ty:u=n===my;break;case Ry:c=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:o,isTop:u,updatedTime:Uc(i),tags:c,channelId:a||""})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,s=e.entries,a={};return Bc(t,(function(e){var t=e.userId,n=e.userData,r={};Bc(n,(function(e){var t=e.key,n=e.value;r[t]=n})),a[t]=r})),{users:a,token:n,sessionId:r,roomInfo:i,kvEntries:s}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return Bc(t,(function(e){n[e.key]=e.value})),n}},{key:"_formatRTCRoomInfo",value:function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return Bc(r,(function(e){i[e.key]=e.value})),i}},{key:"_formatGrpReadReceiptQryResp",value:function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=Uc(e.readTime)})),{totalMemberCount:t,list:n}}},{key:"_formatUserSettingNotification",value:function(e){return e}},{key:"_formatRTCRoomKVList",value: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:Uc(t)})})),isFullUpdate:n,syncTime:r}}},{key:"_formatRTCAuidenceJoinRoomData",value:function(e){return e}},{key:"_formatRTCJoinedUserInfo",value:function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Uc(e.joinTime)}}))}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(Kg);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=e.conversationType,i=t.messageType,s=t.isMentioned,a=t.mentionedType,o=t.mentionedUserIdList,u=t.content,c=t.pushContent,l=t.pushData,h=t.directionalUserIdList,f=t.isFilerWhiteBlacklist,d=t.isVoipPush,g=t.canIncludeExpansion,p=t.expansion,v=t.pushConfig,y=t.channelId;[Go.GROUP,Go.ULTRA_GROUP].includes(r);var m,_,E,T=this._codec.getModule(Fg),R=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),I=v||{},C=I.pushTitle,S=I.pushContent,b=I.pushData,w=I.iOSConfig,O=I.androidConfig,N=I.templateId,k=I.disablePushTitle,A=I.forceShowDetailContent,M=0;(T.setSessionId(R),s&&u)&&(u.mentionedInfo={userIdList:(null===(m=u.mentionedInfo)||void 0===m?void 0:m.userIdList)||o||[],type:(null===(_=u.mentionedInfo)||void 0===_?void 0:_.type)||a||bu.ALL,mentionedContent:(null===(E=u.mentionedInfo)||void 0===E?void 0:E.mentionedContent)||""});var U=S||c||"",L=b||l||"";if(U&&T.setPushText(U),L&&T.setAppData(L),h&&T.setUserId(h),M|=d?1:0,M|=f?2:0,M|=k?4:0,M|=A?8:0,T.setConfigFlag(M),T.setClassname(i),u.user&&u.user.portraitUri&&(u.user.portrait=u.user.portraitUri),T.setContent(JSON.stringify(u)),g&&p){var x={};Bc(p,(function(e,t){x[t]={v:e}})),T.setExtraContent(JSON.stringify(x))}if(v){var P=this._codec.getModule(Gg);if(C&&P.setTitle(C),w&&O){var D=xc(w,O);P.setPushConfigs(D)}(null==O?void 0:O.notificationId)&&P.setPushId(null==O?void 0:O.notificationId),P.setTemplateId(N||""),T.setPushExt(n?P.getArrayData():P)}return Xo(y)||T.setBusChannel(y),T}},{key:"encodeUpMsg",value:function(e,t){return this._getUpMsgModule(e,t).getArrayData()}},{key:"encodeSyncMsg",value:function(e){var t=e.sendboxTime,n=e.inboxTime,r=this._codec.getModule(Yg);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.getArrayData()}},{key:"encodeChrmSyncMsg",value:function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Qg);return n.setCount(t),n.setSyncTime(e),n.getArrayData()}},{key:"encodeGetHistoryMsg",value:function(e,t){var n=t.count,r=t.order,i=t.timestamp,s=t.channelId,a=this._codec.getModule(Jg);return a.setTargetId(e),a.setTime(i),a.setCount(n),a.setOrder(r),a.setBusChannel(s||""),a.getArrayData()}},{key:"encodeSuperSyncMsg",value:function(e){var t=this._codec.getModule(ov);return t.setSyncTime(e),t.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(Zg);return i.setType(1),i.setCount(n),i.setStartTime(r),i.getArrayData()}},{key:"encodeOldConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.type,i=t.startTime,s=t.order;n=n||0,i=i||0,s=s||0;var a=this._codec.getModule(Zg);return a.setType(r),a.setCount(n),a.setStartTime(i),a.setOrder(s),a.getArrayData()}},{key:"encodeRemoveOldConversationList",value:function(e){var t=e=e||{},n=t.conversationType,r=t.channelId,i=this._codec.getModule(np);return i.setType(n),r&&i.setBusChannel([r]),i.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule($g),r=[];return Bc(e,(function(e){var n=e.conversationType,i=e.targetId,s=t._codec.getModule(ep);s.setType(n),s.setChannelId(i),r.push(s)})),n.setSessions(r),n.getArrayData()}},{key:"encodeDeleteMessages",value:function(e,t,n,r){var i=this._codec.getModule(rp),s=[];return Bc(n,(function(e){s.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(s),i.setBusChannel(r),i.getArrayData()}},{key:"encodeClearMessages",value:function(e,t,n,r){var i=this._codec.getModule(ip);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(r),i.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.channelId,s=t.timestamp,a=this._codec.getModule(sp);return s=s||+new Date,a.setType(n),a.setChannelId(r),a.setMsgTime(s),a.setBusChannel(i),a.getArrayData()}},{key:"encodeExpandUltraMessage",value:function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,s=e.messageUId,a=e.sendTime,o=e.keys,u={mid:s,put:e.expansion,del:o,clear:e.removeAll?1:0},c=this._codec.getModule(uv);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(s),c.setMsgTime(a),c.setContent(JSON.stringify(u)),c.getArrayData()}},{key:"encodemodifyMessage",value:function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,s=e.messageUId,a=e.sendTime,o=e.content,u=this._codec.getModule(uv);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(s),u.setMsgTime(a),u.setContent(JSON.stringify(o)),u.getArrayData()}},{key:"encodeQueryMsgChange",value:function(e){var t=this._codec.getModule(cv);return t.setSyncTime(e),t.getArrayData()}},{key:"encodeMsgQuery",value:function(e){var t=e.targetId,n=e.conversationType,r=e.messages,i=this._codec.getModule(fv),s=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return i.setTargetId(t),i.setType(n),i.setQuery(s),i.getArrayData()}},{key:"encodeOperateStatus",value:function(e,t,n,r){var i=this._codec.getModule(pv);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()}},{key:"encodeJoinOrQuitChatRoom",value:function(){var e=this._codec.getModule(ap);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(up);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(bp);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()}},{key:"encodeGetFileUrl",value:function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()}},{key:"encodeModifyChatRoomKV",value:function(e,t,n){var r="comet"===this._connectType,i=this._codec.getModule(Mp),s=t.key,a=t.value,o=t.notificationExtra,u=t.isSendNotification,c=t.type||ku.UPDATE,l=Zc(t,c),h={key:s,value:a||"",uid:n};if(Xo(l)||(h.status=l),i.setEntry(h),u){var f={conversationType:Go.CHATROOM,targetId:e},d={key:s,value:a,extra:o,type:c},g=this._getUpMsgModule(f,{messageType:Ru.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(Go.CHATROOM)}return i.getArrayData()}},{key:"encodeModifyChatRoomKVS",value:function(e,t,n){this._connectType;var r=this._codec.getModule(Up),i=t.entries,s=t.type||ku.UPDATE,a=Zc(t,s),o=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};Xo(a)||(t.status=a),o.push(t)})),r.setEntry(o),r.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(Vp);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(Gp);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(Kp);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(Wp),i=zc.getTime(),s=[];return Bc(e,(function(e){var r=t._codec.getModule(Yp),a=e.conversationType,o=e.targetId,u=e.notificationStatus,c=e.isTop,l=e.channelId,h=[];r.setType(a),r.setChannelId(o),r.setTime(i),r.setBusChannel(l);var f=u===Cu.OPEN,d={};Xo(u)||(d[Ey]=f),Xo(c)||(d[Ty]=c),Bc(d,(function(e,r){if(!Xo(e)){var i=t._codec.getModule(Qp);e=e?my:_y,i.setSessionStateType(Number(r)),i.setValue(e);var s=n?i.getArrayData():i;h.push(s)}})),r.setStateItem(h);var g=n?r.getArrayData():r;s.push(g)})),r.setVersion(i),r.setState(s),r.getArrayData()}},{key:"encodeReadReceipt",value:function(e,t){var n=this._codec.getModule(zp);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeCreateTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(ev),s=[];return e.forEach((function(e){var t=n._codec.getModule(tv);t.setTagId(e.tagId),t.setName(e.tagName),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeMessageReader",value:function(e,t){var n=this._codec.getModule(zp);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()}},{key:"encodeRemoveTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(nv),s=[];return e.forEach((function(e){var t=n._codec.getModule(tv);t.setTagId(e),s.push(r?t.getArrayData():t)})),i.setTags(s),i.setVersion(t),i.getArrayData()}},{key:"encodeDisConversationTag",value:function(e){var t=this._codec.getModule(rv);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Wp),s=[];return t.forEach((function(t){var i=n._codec.getModule(Yp),a=n._codec.getModule(Qp),o=[];e.forEach((function(e){var t=n._codec.getModule(tv);t.setTagId(e.tagId),Xo(e.isTop)||t.setIsTop(e.isTop),o.push(r?t.getArrayData():t)})),a.setSessionStateType(Ry),a.setValue(JSON.stringify(o)),a.setTags(o),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?a.getArrayData():a]),s.push(r?i.getArrayData():i)})),i.setState(s),i.setVersion(zc.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(iv);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeUltraGroup",value:function(e,t){var n=this._codec.getModule(av);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t,n,r,i){var s=this,a="comet"===this._connectType,o=this._codec.getModule(lp);if(e=e||0,o.setRoomType(e),Xo(t)||o.setBroadcastType(t),Xo(n)||o.setJoinType(n),r){var u=[],c=this._codec.getModule(Cp);for(var l in r)c.setKey(l),c.setValue(r[l]),a?u.push(c.getArrayData()):u.push(c);o.setInnerDatas(u)}if(i){var h=[];Object.keys(i).forEach((function(e){var t=s._codec.getModule(Cp);t.setKey(e),t.setValue(i[e]),a?h.push(t.getArrayData()):h.push(t)})),o.setOuterDatas(h)}return o.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(fp).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(dp);if(s.setInterior(n),s.setTarget(r),s.setKey(e),s.setValue(t),i){i.name&&s.setObjectName(i.name);var a=i.content;a&&(zo(a)&&(a=JSON.stringify(a)),s.setContent(a))}return s.getArrayData()}},{key:"encodeUserSetRTCData",value:function(e,t,n,r){var i=this,s="comet"===this._connectType,a=this._codec.getModule(gp);a.setObjectName(n);var o=this._codec.getModule(Cp);o.setKey(e.name),o.setValue(e.content),s?a.setContent(o.getArrayData()):a.setContent(o);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(Cp);n.setKey(e);var a="uris"===e?t:r;n.setValue(a),s?u.push(n.getArrayData()):u.push(n)})),a.setValueInfo(u),a.getArrayData()}},{key:"encodeUserSetRTCCDNUris",value:function(e,t){this._connectType;var n=this._codec.getModule(gp);n.setObjectName(e);var r=this._codec.getModule(Cp);return r.setKey("cdn_uris"),r.setValue(t),n.setValueInfo(r),n.getArrayData()}},{key:"encodeGetRTCData",value:function(e,t,n){var r=this._codec.getModule(pp);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()}},{key:"encodeRemoveRTCData",value:function(e,t,n,r){var i=this._codec.getModule(pp);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},a=s.name,o=s.content;return!Xo(a)&&i.setObjectName(a),Xo(o)||(zo(o)&&(o=JSON.stringify(o)),i.setContent(o)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(vp);r.setTarget(t),Qo(e)||(e=[e]),Bc(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||{},s=i.name,a=i.content;return!Xo(s)&&r.setObjectName(s),Xo(a)||(zo(a)&&(a=JSON.stringify(a)),r.setContent(a)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Ep);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(yp);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(Rp);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(Cp);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(Sp);return t.setKey(e),t.getArrayData()}},{key:"encodeIdentityChangeInfo",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this._codec.getModule(lp);return i.setRoomType(e.RTCMode.LIVE),n&&i.setBroadcastType(n),i.setIdentityChangeType(t),i.setNeedSysChatroom(r),i.getArrayData()}},{key:"encodePullRTCRoomKV",value:function(e,t){var n=this._codec.getModule(Ev);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}},{key:"encodeQueryUserJoinedInfo",value:function(e){var t=this._codec.getModule(Rv);return t.setUserId(e),t.getArrayData()}},{key:"encodeRequestRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,s=e.inviteInfo,a=this._codec.getModule(Sv);return a.setInvitedRoomId(t),a.setInvitedUserId(n),a.setInviteSessionId(r),a.setTimeoutTime(i),a.setInviteInfo(s),a.getArrayData()}},{key:"encodeCancelRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,s=this._codec.getModule(bv);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setInviteInfo(i),s.getArrayData()}},{key:"encodeResponseRoomPK",value:function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,s=e.key,a=e.value,o=e.agree?1:0,u=this._codec.getModule(wv);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(s),u.setValue(a),u.setAnswerCode(o),u.getArrayData()}},{key:"encodeEndRoomPK",value:function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,s=this._codec.getModule(Ov);return s.setInviteRoomId(t),s.setInviteSessionId(n),s.setInviteContent(r),s.setInviteRoomKeys(i),s.getArrayData()}}]),t}(),Cy=l((function e(t,n){u(this,e),this._watcher=n,this.codec=new Iy(t)})),Sy=function(e,t){return e&&t?t+"_"+e:e||Date.now()},by=function(){function e(t){u(this,e),this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return l(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return Sy(e,t)}},{key:"read",value:function(e,t,n){this.readMessage(e,t,n)}},{key:"readMessage",value:function(e,t,n){return{stream:e,length:t}}}]),e}(),wy=function(){function e(t){u(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Pg(t,!1,og.AT_MOST_ONCE,!1)}return l(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return Sy(e,t)}},{key:"write",value:function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)}},{key:"setHeaderQos",value:function(e){this._header.qos=e}},{key:"getHeaderFlag",value:function(){return this._header.encode()}},{key:"getLengthSize",value:function(){return this.lengthSize}},{key:"getBufferData",value:function(){var e=new Bg;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),Oy=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return l(n,[{key:"readMessage",value:function(e,t,r){if(e.readByte(),this.status=+e.readByte(),t<=n.MESSAGE_LENGTH)return{stream:e,length:t};if(r===hg.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 s=e.readUTF();su.debug("server sessionId -> "+s),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(by);Oy.MESSAGE_LENGTH=2;var Ny=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.DISCONNECT,e.status=0,e}return l(n,[{key:"readMessage",value:function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}}}]),n}(by);Ny.MESSAGE_LENGTH=2;var ky=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.call(this,ug.PING_REQ))._name=cg.PING_REQ,e}return l(n,[{key:"writeMessage",value:function(e){}}]),n}(wy),Ay=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,e))._name=cg.PING_RESP,r}return l(n)}(by),My=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments)).messageId=0,e}return l(n,[{key:"readMessage",value:function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}}}]),n}(by),Uy=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments)).messageId=0,e}return l(n,[{key:"writeMessage",value:function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)}}]),n}(wy),Ly=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=lg.PUB,e}return l(n,[{key:"readMessage",value:function(e,t){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),I(d(n.prototype),"readMessage",this).call(this,e,t),this.data=e.readAll(),{stream:e,length:t}}}]),n}(My),xy=function(e){f(n,e);var t=T(n);function n(e,r,i){var s;return u(this,n),(s=t.call(this,ug.PUBLISH))._name=cg.PUBLISH,s.syncMsg=!1,s.identifier=lg.PUB,s.topic=e,s.data=Ko(r)?Dg.writeUTF(r):r,s.targetId=i,s}return l(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),I(d(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Uy),Py=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=lg.PUB,e.topic="",e.targetId="",e}return l(n,[{key:"readMessage",value:function(e,t){return I(d(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:t}}}]),n}(My),Dy=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,ug.PUB_ACK))._name=cg.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return l(n,[{key:"writeMessage",value:function(e){I(d(n.prototype),"writeMessage",this).call(this,e)}}]),n}(Uy),Vy=function(e){f(n,e);var t=T(n);function n(e,r,i){var s;return u(this,n),(s=t.call(this,ug.QUERY)).name=cg.QUERY,s.identifier=lg.QUERY,s.topic=e,s.data=Ko(r)?Dg.writeUTF(r):r,s.targetId=i,s}return l(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),I(d(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Uy),By=function(e){f(n,e);var t=T(n);function n(e){var r;return u(this,n),(r=t.call(this,ug.QUERY_CONFIRM))._name=cg.QUERY_CON,r.messageId=e,r}return l(n)}(Uy),Fy=function(e){f(n,e);var t=T(n);function n(){var e;return u(this,n),(e=t.apply(this,arguments))._name=cg.QUERY_ACK,e.status=0,e.identifier=lg.QUERY,e.topic="",e.targetId="",e}return l(n,[{key:"readMessage",value:function(e,t){return I(d(n.prototype),"readMessage",this).call(this,e,t),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}]),n}(My),Gy=function(e){var t,n=e.type;switch(n){case ug.CONN_ACK:t=new Oy(e);break;case ug.PUBLISH:(t=new Ly(e)).syncMsg=e.syncMsg;break;case ug.PUB_ACK:t=new Py(e);break;case ug.QUERY_ACK:t=new Fy(e);break;case ug.SUB_ACK:case ug.UNSUB_ACK:case ug.PING_RESP:t=new Ay(e);break;case ug.DISCONNECT:t=new Ny(e);break;default:t=new by(e),su.error("No support for deserializing "+n+" messages")}return t},jy=function(e,t){var n=new Uint8Array(e),r=new Vg(n),i=r.readByte(),s=new Pg(i),a=Gy(s);return a.read(r,n.length-1,t),a},qy=function(e){var t=e.headerCode,n=new Pg(t),r=Gy(n);for(var i in e)r[i]=e[i];return r},Ky=ir.charAt,Hy="String Iterator",Yy=Ot.set,Qy=Ot.getterFor(Hy);ml(String,"String",(function(e){Yy(this,{type:Hy,string:_n(e),index:0})}),(function(){var e,t=Qy(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Ky(n,r),t.index+=e.length,{value:e,done:!1})}));var Wy,Jy=[],zy=Q(Jy.sort),Zy=Q(Jy.push),Xy=L((function(){Jy.sort(void 0)})),$y=L((function(){Jy.sort(null)})),em=Ai("sort"),tm=!L((function(){if(de)return de<70;if(!(Sd&&Sd>3)){if(bd)return!0;if(Od)return Od<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)Jy.push({k:t+r,v:n})}for(Jy.sort((function(e,t){return t.v-e.v})),r=0;r<Jy.length;r++)t=Jy[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));ln({target:"Array",proto:!0,forced:Xy||!$y||!em||!tm},{sort:function(e){void 0!==e&&Te(e);var t=ke(this);if(tm)return void 0===e?zy(t):zy(t,e);var n,r,i=[],s=jt(t);for(r=0;r<s;r++)r in t&&Zy(i,t[r]);for(Id(i,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:_n(t)>_n(n)?1:-1}}(e)),n=i.length,r=0;r<n;)t[r]=i[r++];for(;r<s;)delete t[r++];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.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf"}(Wy||(Wy={}));var nm=Wy;o(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(){var e=o(regeneratorRuntime.mark((function e(t){var i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Date.now(),s="".concat(n,"://").concat(t,"/ping?r=").concat(Do(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:xr});case 4:return a=e.sent,e.abrupt("return",{status:a.status,host:t,cost:Date.now()-i});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return(i=(i=e.sent).filter((function(e){return 200===e.status}))).length>1&&(i=i.sort((function(e,t){return e.cost-t.cost}))),e.abrupt("return",i.map((function(e){return e.host})));case 6:case"end":return e.stop()}}),e)})));var rm,im,sm=(rm=o(regeneratorRuntime.mark((function e(t,n,r,i){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=0,t.forEach(function(){var e=o(regeneratorRuntime.mark((function e(a){var o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u="".concat(n,"://").concat(a,"/ping?r=").concat(Do(1e3,9999)),su.debug("start ping",u),s++,e.prev=3,e.next=6,r.httpReq({url:u,timeout:xr});case 6:c=e.sent,e.next=14;break;case 9:return e.prev=9,e.t0=e.catch(3),su.error("ping error: ",e.t0),i({finished:s===t.length,code:-2,host:a}),e.abrupt("return");case 14:su.debug("end ping",s,u,null===(o=c)||void 0===o?void 0:o.status),i({finished:s===t.length,code:c.status,host:a});case 16:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return rm.apply(this,arguments)}),am=function(e,t,n,r,i,s,a,o){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(s,"&pid=").concat(a,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(o?"&protocolVer="+o:"")},om=function(e){return[nm.ppMsgS,nm.pgMsgS,nm.chatMsgS].map((function(e){return nm[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"}(im||(im={}));var um,cm=function(e,t){su.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)},lm=function(e){f(c,e);var t,n,r,i,s,a=T(c);function c(e,t){var n;return u(this,c),(n=a.call(this,"websocket",t))._runtime=e,n._socket=null,n._messageIds={},n._syncMessageIds={},n._failedCount=0,n.ALLOW_FAILED_TIMES=2,n._timer=null,n._idCount=0,n._generateMessageId=function(){return n._idCount>=65535&&(n._idCount=0),++n._idCount},n}return l(c,[{key:"connect",value:(s=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var c=[],l=0,h=!1,f=!1,d=function(){var r=o(regeneratorRuntime.mark((function r(){var o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==c.length&&!h){r.next=2;break}return r.abrupt("return");case 2:return h=!0,r.next=5,u._connect(t,n,c.shift(),i,s,a);case 5:if((o=r.sent)!==yu.SUCCESS){r.next=11;break}u._checkAlive(),e(o),r.next=20;break;case 11:if(o!==Eu.REDIRECT){r.next=15;break}e(o),r.next=20;break;case 15:if(!f||0!==c.length){r.next=18;break}return e(Yc(o)),r.abrupt("return");case 18:h=!1,d();case 20:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();s=Di(s),u._watcher.status(_u.CONNECTING),sm(r,i,u._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;f=r,200===n&&(c.push(i),l++,d()),r&&0===l&&(su.error("No valid websocket server hosts!"),e(yu.RC_SOCKET_NOT_CREATED))}))})));case 1:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,a){return s.apply(this,arguments)})},{key:"_connect",value:(i=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.replace("http","ws"),u=am(o,r,t,n,this._runtime,s,"",a),su.debug("conenct start -> ".concat(u)),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(u),l=function(e){f._timer&&(clearTimeout(f._timer),f._timer=null),f._socket===c&&(f._socket=null,f._watcher.status(e))},e.next=8,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=jy(t,a);if(n instanceof Ay&&f._pingResolve)return f._pingResolve(yu.SUCCESS),void(f._pingResolve=void 0);if(n instanceof Oy)return su.debug("recv connect ack -> ".concat(n.status)),n.status!==Eu.ACCEPTED?(su.warn("connect failed: ".concat(n.status)),void e(n.status)):(su.info("connect success -> ".concat(u)),f.connectedTime=n.timestamp,f.userId=n.userId||"",f._idCount=n.messageId,void e(yu.SUCCESS));if(n instanceof Ny){var r=n.status;switch(su.warn("recv disconnect signal -> status: ".concat(r)),r){case im.BLOCK_NEW:case im.BLOCK:f._watcher.status(_u.BLOCKED);break;case im.OTHER_DEVICE_LOGIN:f._watcher.status(_u.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case im.REDIRECT_NEW:case im.REDIRECT:f._watcher.status(_u.REDIRECT);break;default:f._watcher.status(_u.DISCONNECT_BY_SERVER)}}else f._onReceiveSignal(n)}else su.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in su.warn("websocket closed! code:",t,"reason:",n),l(_u.CONNECTION_CLOSED),f._messageIds){var i=f._messageIds[r];delete f._messageIds[r],i(yu.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in su.error("websocket error!",null==t?void 0:t.stack),l(_u.WEBSOCKET_ERROR),f._messageIds){var r=f._messageIds[n];delete f._messageIds[n],r(yu.RC_NET_CHANNEL_INVALID)}e(yu.NETWORK_ERROR)})),c.onOpen((function(){return su.debug("websocket open =>",u)})),setTimeout((function(){e(yu.TIMEOUT)}),Pr)}));case 8:return(h=e.sent)===yu.SUCCESS?this._socket=c:(su.warn("connect result -> code: ".concat(h,", url: ").concat(u)),c.close()),e.abrupt("return",h);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s,a){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=o(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._socket){e.next=2;break}return e.abrupt("return");case 2:return su.debug("send ping ->"),this.sendOnly(new ky),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(yu.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===yu.SUCCESS){e.next=12;break}return this._failedCount+=1,su.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,su.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close(),this._watcher.status(_u.NETWORK_UNAVAILABLE)):this._checkAlive(),e.abrupt("return");case 12:su.debug("recv pong <-"),this._failedCount=0,setTimeout((function(){return r._checkAlive()}),15e3);case 15:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_onReceiveSignal",value:(n=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.messageId,t.header&&t.header.qos!==og.AT_MOST_ONCE&&(t instanceof Ly&&!t.syncMsg&&(su.info("send pubAck -> ".concat(n," ").concat(t.topic)),this.sendOnly(new Dy(n))),t instanceof Fy&&(su.info("send queryCon -> ".concat(n," ").concat(t.topic)),this.sendOnly(new By(n)))),n>0&&(t instanceof Py||t instanceof Fy)&&(su.info("recv ack -> messageId: ".concat(n," ").concat(t.topic)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof Ly)){e.next=17;break}if(s=t.syncMsg,a=t.topic,su.info("recv PublishReader -> messageId: ".concat(n," ").concat(a)),a!==nm[nm.userSetData]){e.next=9;break}return e.abrupt("return");case 9:if(s&&!om(a)){e.next=12;break}return this._watcher.signal(t),e.abrupt("return");case 12:return e.next=14,new Promise((function(e){u._syncMessageIds[n]=e}));case 14:o=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,o);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&((e instanceof xy||e instanceof Vy)&&(e.messageId=this._generateMessageId()),cm(e,this._socket))}},{key:"send",value:(t=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=c.length>3&&void 0!==c[3]?c[3]:Fr,!this._socket){e.next=18;break}return s=this._generateMessageId(),t.messageId=s,cm(t,this._socket),e.next=7,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){u._messageIds[s]&&delete u._messageIds[s],e()}),i)}));case 7:if(a=e.sent){e.next=11;break}return su.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:yu.TIMEOUT});case 11:if(a instanceof Fy||a instanceof Py){e.next=13;break}return e.abrupt("return",{code:a});case 13:if(o=n&&a.data?this.codec.decodeByPBName(a.data,n,r):a,0===a.status){e.next=17;break}return su.warn("send failed -> message: ".concat(s,", respPBName: ").concat(n,", status: ").concat(a.status)),e.abrupt("return",{code:a.status,data:n&&a.data?o:null});case 17:return e.abrupt("return",{code:yu.SUCCESS,data:o});case 18:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 19:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"close",value:function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(_u.DISCONNECTED))}}]),c}(Cy);e.HttpMethod=void 0,(um=e.HttpMethod||(e.HttpMethod={})).GET="GET",um.POST="POST";var hm=function(e){if(zo(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},fm=function(t){f(h,t);var n,r,i,s,a,c=T(h);function h(e,t){var n;return u(this,h),(n=c.call(this,"comet",t))._runtime=e,n._messageIds={},n._syncMessageIds={},n._idCount=0,n._generateMessageId=function(){return++n._idCount},n._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),n}return l(h,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ko(e.data)?JSON.parse(e.data):e.data;return n?!Qo(n)||(Bc(n,function(){var e=o(regeneratorRuntime.mark((function e(n){var r,i,s,a,o,u,c,l,h,f,d,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=n.sessionid)&&(t._sessionid=r),i=qy(n),s=i.messageId,a=i._header,o=i.status,u=a&&a.qos!==og.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof Ly&&!i.syncMsg&&(l=new Dy(s),t.sendOnly(l)),i instanceof Fy&&(h=new By(s),t.sendOnly(h))),!(i instanceof Ny)){e.next=20;break}e.t0=o,e.next=e.t0===im.OTHER_DEVICE_LOGIN?11:e.t0===im.BLOCK||e.t0===im.BLOCK_NEW?13:e.t0===im.REDIRECT_NEW||e.t0===im.REDIRECT?15:17;break;case 11:return t._watcher.status(_u.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(_u.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(_u.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(_u.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof Ly)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!om(d)){e.next=25;break}return t._watcher.signal(i),e.abrupt("return",!1);case 25:return e.next=27,new Promise((function(e){t._syncMessageIds[s]=e}));case 27:g=e.sent,delete t._syncMessageIds[s],t._watcher.signal(i,g);case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),!0):(su.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(a=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),r="".concat(t,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"&timestrap=").concat(n,"&pid=").concat(this._pid),e.next=4,this._runtime.httpReq({url:r,body:{pid:this._pid},timeout:45e3});case 4:i=e.sent,s=this.handleCometRes(i),this._isDisconnected||(s?this._startPullSignal(t):(this._isDisconnected=!0,this._watcher.status(_u.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"connect",value:(s=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Di(s),this._protocol=i,this._isDisconnected=!1,this._watcher.status(_u.CONNECTING),u=[],c=0,l=!1,h=!1,e.abrupt("return",new Promise((function(e){var a,d=(a=o(regeneratorRuntime.mark((function r(){var a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==u.length&&!l){r.next=2;break}return r.abrupt("return");case 2:return l=!0,r.next=5,f._connect(t,n,u.shift(),i,s);case 5:if((a=r.sent)!==yu.SUCCESS){r.next=11;break}f._startPullSignal(i),e(a),r.next=20;break;case 11:if(a!==Eu.REDIRECT){r.next=15;break}e(a),r.next=20;break;case 15:if(!h||0!==u.length){r.next=18;break}return e(Yc(a)),r.abrupt("return");case 18:l=!1,d();case 20:case"end":return r.stop()}}),r)}))),function(){return a.apply(this,arguments)});f._watcher.status(_u.CONNECTING),sm(r,i,f._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;h=r,200===n&&(u.push(i),c++,d()),r&&0===c&&(su.error("No valid websocket server hosts!"),e(yu.RC_SOCKET_NOT_CREATED))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,a){return s.apply(this,arguments)})},{key:"_connect",value:(i=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e){return 200!==e.status&&202!==e.status?(su.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(hm(e.data)?zo(e.data)?e.data:JSON.parse(e.data):(su.error("received data is not a validJson",e.data),!1))},o=am(i,r,t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),su.debug("conenct start -> ".concat(o)),e.next=6,this._runtime.httpReq({url:o,body:{pid:this._pid},timeout:Pr});case 6:return u=e.sent,c=a(u),this._domain=r,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):su.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(o)),e.abrupt("return",null==c?void 0:c.status);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"sendCometData",value:(r=o(regeneratorRuntime.mark((function t(n){var r,i,s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._domain,i=this._sessionid,s=this._pid,a=n.messageId,o=n.topic,u=n.targetId,c=n.getHeaderFlag(),l=o?"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(a,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(o,"&targetid=").concat(u,"&pid=").concat(s):"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(a,"&header=").concat(c,"&sessionid=").concat(i,"&pid=").concat(s),t.next=7,this._runtime.httpReq({url:l,method:e.HttpMethod.POST,body:n.getCometData()});case 7:h=t.sent,this.handleCometRes(h);case 9:case"end":return t.stop()}}),t,this)}))),function(e){return r.apply(this,arguments)})},{key:"sendOnly",value:function(e){this.sendCometData(e)}},{key:"send",value:(n=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u=this,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=c.length>3&&void 0!==c[3]?c[3]:Fr,s=this._generateMessageId(),t.messageId=s,this.sendCometData(t),e.next=6,new Promise((function(e){u._messageIds[s]=e,setTimeout((function(){delete u._messageIds[s],e()}),i)}));case 6:if(a=e.sent){e.next=9;break}return e.abrupt("return",{code:yu.TIMEOUT});case 9:if(o=n&&a.data?this.codec.decodeByPBName(a.data,n,r):a,0===a.status){e.next=12;break}return e.abrupt("return",{code:a.status,data:n&&a.data?o:null});case 12:return e.abrupt("return",{code:yu.SUCCESS,data:o});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:function(){this._isDisconnected=!0,this._watcher.status(_u.DISCONNECTED)}}]),h}(Cy),dm=l((function e(t,n,r){u(this,e),this.runtime=t,this._watcher=n,this._options=r,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()})),gm=Ci.find,pm="find",vm=!0;pm in[]&&Array(1).find((function(){vm=!1})),ln({target:"Array",proto:!0,forced:vm},{find:function(e){return gm(this,e,arguments.length>1?arguments[1]:void 0)}}),Wi(pm);var ym=function(e){return["navi",e].join("_")},mm=function(e,t,n){var r,i,s=ym(e);try{var a=n.getItem(s);i=a?JSON.parse(a):[]}catch(e){i=[]}var o=Date.now();return i.length>0&&(i=i.filter((function(e){return o-e.timestamp<Lr}))),0===i.length?n.removeItem(s):n.setItem(s,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null},_m=function(){function e(t,n){u(this,e),this._runtime=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Di(this._options.apiVersion)}var t;return l(e,[{key:"getInfo",value:(t=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&this._clear(t),!(s=mm(this._appkey,t,this._runtime.localStorage))){e.next=5;break}return this._naviInfo=s,e.abrupt("return",s);case 5:return a=this._options.navigators.slice(),n.length&&n.forEach((function(e){a.indexOf(e)<0&&a.unshift(e)})),e.next=9,this._reqNavi(a,this._appkey,t,i);case 9:if(!(s=e.sent)){e.next=14;break}return this._naviInfo=s,this.setNaviInfo2Cache(t,s),e.abrupt("return",s);case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i){return t.apply(this,arguments)})},{key:"setNaviInfo2Cache",value:function(e,t){this._naviInfo=t,function(e,t,n,r){var i,s=ym(e);try{var a=r.getItem(s);i=a?JSON.parse(a):[]}catch(e){i=[]}var o=Date.now();i.length>0&&(i=i.filter((function(e){return o-e.timestamp<Lr&&t!==e.token}))),i.push({timestamp:o,naviInfo:n,token:t}),r.setItem(s,JSON.stringify(i))}(this._appkey,e,t,this._runtime.localStorage)}},{key:"getInfoFromCache",value:function(e){return this._naviInfo}},{key:"_clear",value:function(e){!function(e,t,n){var r,i=ym(e);try{var s=n.getItem(i);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();r.length>0&&(r=r.filter((function(e){return a-e.timestamp<Lr&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)}}]),e}(),Em=Ci.findIndex,Tm="findIndex",Rm=!0;Tm in[]&&Array(1).findIndex((function(){Rm=!1})),ln({target:"Array",proto:!0,forced:Rm},{findIndex:function(e){return Em(this,e,arguments.length>1?arguments[1]:void 0)}}),Wi(Tm);var Im=Q(G.f),Cm=Q([].push),Sm=function(e){return function(t){for(var n,r=ne(t),i=Sn(r),s=i.length,a=0,o=[];s>a;)n=i[a++],x&&!Im(r,n)||Cm(o,e?[n,r[n]]:r[n]);return o}},bm={entries:Sm(!0),values:Sm(!1)}.values;ln({target:"Object",stat:!0},{values:function(e){return bm(e)}});var wm=zt.f,Om="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Nm={f:function(e){return Om&&"Window"==z(e)?function(e){try{return wm(e)}catch(e){return Eo(Om)}}(e):wm(ne(e))}},km=L((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Am=Object.isExtensible,Mm=L((function(){Am(1)}))||km?function(e){return!!ie(e)&&((!km||"ArrayBuffer"!=z(e))&&(!Am||Am(e)))}:Am,Um=!L((function(){return Object.isExtensible(Object.preventExtensions({}))})),Lm=N((function(e){var t=ut.f,n=!1,r=Pe("meta"),i=0,s=function(e){t(e,r,{value:{objectID:"O"+i++,weakData:{}}})},a=e.exports={enable:function(){a.enable=function(){},n=!0;var e=zt.f,t=Q([].splice),i={};i[r]=1,e(i).length&&(zt.f=function(n){for(var i=e(n),s=0,a=i.length;s<a;s++)if(i[s]===r){t(i,s,1);break}return i},ln({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Nm.f}))},fastKey:function(e,t){if(!ie(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Me(e,r)){if(!Mm(e))return"F";if(!t)return"E";s(e)}return e[r].objectID},getWeakData:function(e,t){if(!Me(e,r)){if(!Mm(e))return!0;if(!t)return!1;s(e)}return e[r].weakData},onFreeze:function(e){return Um&&n&&Mm(e)&&!Me(e,r)&&s(e),e}};_t[r]=!0})),xm=ut.f,Pm=Lm.fastKey,Dm=Ot.set,Vm=Ot.getterFor,Bm={getConstructor:function(e,t,n,r){var i=e((function(e,i){ps(e,s),Dm(e,{type:t,index:Ln(null),first:void 0,last:void 0,size:0}),x||(e.size=0),null!=i&&Os(i,e[r],{that:e,AS_ENTRIES:n})})),s=i.prototype,a=Vm(t),o=function(e,t,n){var r,i,s=a(e),o=u(e,t);return o?o.value=n:(s.last=o={index:i=Pm(t,!0),key:t,value:n,previous:r=s.last,next:void 0,removed:!1},s.first||(s.first=o),r&&(r.next=o),x?s.size++:e.size++,"F"!==i&&(s.index[i]=o)),e},u=function(e,t){var n,r=a(e),i=Pm(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return ss(s,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,x?e.size=0:this.size=0},delete:function(e){var t=this,n=a(t),r=u(t,e);if(r){var i=r.next,s=r.previous;delete n.index[r.index],r.removed=!0,s&&(s.next=i),i&&(i.previous=s),n.first==r&&(n.first=i),n.last==r&&(n.last=s),x?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=a(this),r=Ti(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),ss(s,n?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return o(this,0===e?0:e,t)}}:{add:function(e){return o(this,e=0===e?0:e,e)}}),x&&xm(s,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=Vm(t),s=Vm(r);ml(e,t,(function(e,t){Dm(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=s(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),ds(t)}};!function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),s=r?"set":"add",a=U[e],o=a&&a.prototype,u=a,c={},l=function(e){var t=Q(o[e]);Ut(o,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!ie(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!ie(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!ie(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(un(e,!re(a)||!(i||o.forEach&&!L((function(){(new a).entries().next()})))))u=n.getConstructor(t,e,r,s),Lm.enable();else if(un(e,!0)){var h=new u,f=h[s](i?{}:-0,1)!=h,d=L((function(){h.has(1)})),g=Ds((function(e){new a(e)})),p=!i&&L((function(){for(var e=new a,t=5;t--;)e[s](t,t);return!e.has(-0)}));g||((u=t((function(e,t){ps(e,o);var n=sc(new a,e,u);return null!=t&&Os(t,n[s],{that:n,AS_ENTRIES:r}),n}))).prototype=o,o.constructor=u),(d||p)&&(l("delete"),l("has"),r&&l("get")),(p||f)&&l(s),i&&o.clear&&delete o.clear}c[e]=u,ln({global:!0,forced:u!=a},c),hs(u,e),i||n.setStrong(u,e,r)}("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Bm);var Fm="outbox",Gm="inbox",jm=function(e,t,n){return[e,t,n].join("_")},qm=function(){function e(t,n){u(this,e),this._runtime=t,this._appkey=n,this._users={}}return l(e,[{key:"_getMemData",value:function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})}},{key:"setInboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=jm(Gm,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getInboxTime",value:function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=jm(Gm,this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime}},{key:"setOutboxTime",value:function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=jm(Fm,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}}},{key:"getOutboxTime",value:function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=jm(Fm,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime}}]),e}(),Km={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Hm=function(){function e(t,n){u(this,e),this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return l(e,[{key:"_add",value:function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e}},{key:"_remove",value:function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)}},{key:"_setEntry",value:function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,s=e.userId,a=this._getSetUserId(n),o=r===ku.DELETE,u=a===s,c=!this._isExisted(n),l=o?this._remove:this._add;(t||i||u||c)&&l.call(this,e)}},{key:"getValue",value:function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value}},{key:"getAllValue",value:function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e}},{key:"_getSetUserId",value:function(e){return(this._kvCaches[e]||{}).userId}},{key:"_isExisted",value:function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r}},{key:"setEntries",value: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)})),su.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),Ym=function(){function e(t){u(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return l(e,[{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.chrmId,r=t.timestamp,!((i=Km.get(n))>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullChatroomEntry(n,i);case 11:s=e.sent,a=s.code,o=s.data,this._isPulling=!1,a===yu.SUCCESS?(Km.set(n,o.syncTime||0),this._startPull()):this._startPull();case 16:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(e){Km.clear(e);var t=this._storeCaches[e];t&&t.clear()}},{key:"pullEntry",value:function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()}},{key:"setLocal",value:function(e,t,n){var r=this._storeCaches[e];eu(r)||(r=new Hm(e,n)),r.setEntries(t),this._storeCaches[e]=r}},{key:"getValue",value:function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null}},{key:"getAll",value:function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n}}]),e}(),Qm=function(){function e(t,n,r,i){u(this,e),this._runtime=t,this._appkey=n,this._userId=r,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return l(e,[{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))}},{key:"get",value:function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){su.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],eu(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()}},{key:"clear",value:function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)}}]),e}(),Wm="converStatusChanged",Jm=function(){function e(t,n,r){u(this,e),this._eventEmitter=new du,this._pullQueue=[],this._isPulling=!1,this._storage=Hr(t.runtime),this._appkey=n,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(n,"-").concat(r)}var t;return l(e,[{key:"_set",value:function(e){var t=this;if(!Xo(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var s=e.updatedTime||0;n=s>n?s:n,e.conversationType=e.type,t._eventEmitter.emit(Wm,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullConversationStatus(t);case 6:n=e.sent,r=n.code,i=n.data,r===yu.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull();case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pull",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"watch",value:function(e){this._eventEmitter.on(Wm,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(Wm,(function(e){}))}}]),e}(),zm={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}},Zm={};for(var Xm in zm){var $m=zm[Xm].keyName;Zm[$m]=Xm}var e_,t_=function(){function e(t,n,r){u(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new Qr(t,i),this._localStore=new Qr(t,"CONVER-".concat(n,"-").concat(r))}return l(e,[{key:"_getStoreKey",value:function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)}},{key:"_getConOptionByKey",value: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:Go.PRIVATE,targetId:"",channelId:""}}},{key:"updateMentionedData",value:function(e){var t,n=this,r=e.conversationType,i=e.targetId,s=e.messageType,a=e.isMentioned,o=e.content,u=e.senderUserId,c=e.channelId,l=this._getStoreKey(r,i,c),h=this._localStore.get(l)||{},f=Zm.mentionedInfo,d=Zm.hasMentioned,g=h[f]||{},p=g.userIdList||[],v=o.mentionedInfo;if(v){if(a&&r===Go.GROUP)(v.userIdList||[]).forEach((function(e){e===n._currentUserId&&p.indexOf(u)<0&&p.push(u)})),v.type===bu.ALL&&p.indexOf(u)<0&&p.push(u);if(s===Ru.RECALL&&r===Go.GROUP){var y=p.indexOf(u);y>=0&&p.splice(y,1)}v={userIdList:p,type:(null===(t=v)||void 0===t?void 0:t.type)||g.type},0!==p.length?(h[f]=v,h[d]=!0):(delete h[f],delete h[d]),eu(h)?this._localStore.set(l,h):this._localStore.remove(l)}}},{key:"set",value:function(e,t,n,r){var i=this._getStoreKey(e,t,r),s=this._localStore.get(i)||{};for(var a in n){var o=Zm[a],u=n[a];if(!Xo(o)&&!Xo(u)&&"hasMentioned"!==a&&"MentionedInfo"!==a){if(u===zm[o].defaultVal||"tags"===a&&!eu(u))delete s[o];else if("tags"===a){var c=u;for(var l in c)c[l].isTop||delete c[l].isTop;s[o]=u}else s[o]=u;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}eu(s)?this._localStore.set(i,s):this._localStore.remove(i)}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},s={};for(var a in zm){var o=zm[a],u=o.keyName,c=o.defaultVal;s[u]=i[a]||qc(c)}return s}},{key:"getValue",value:function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),s={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},a=t[r];for(var o in a){var u=zm[o],c=u.keyName,l=u.defaultVal;s[c]=a[o]||qc(l)}s=e?e(s):s,n.push(s)}return n}},{key:"getValueForTag",value:function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,s=r.targetId,a={},o=e[n];for(var u in o){var c=zm[u],l=c.keyName,h=c.defaultVal;a[l]=o[u]||qc(h)}for(var f in a.tags){Xo(t[f])&&(t[f]=[]);var d=Object.assign({},a,{conversationType:i,targetId:s});delete d.tags,t[f].push(d)}}return t}},{key:"adaptOldStore",value:function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}}catch(e){su.error("adaptOldStore error: ".concat(e.message))}}}]),e}(),n_=[Go.PRIVATE,Go.GROUP,Go.SYSTEM,Go.PUBLIC_SERVICE,Go.APP_PUBLIC_SERVICE],r_="conversationChanged",i_="conTagStatusChanged",s_=function(){function e(t,n,r,i,s){var a=this;u(this,e),this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new du,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new t_(t.runtime,n,r),this._statusManager=new Jm(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;a.addStatus(t,n)})),this._eventEmitter.on(r_,(function(e){i(e)})),this._eventEmitter.on(i_,(function(){s()}))}return l(e,[{key:"_calcUnreadCount",value:function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,s=e.isCounted,a=e.messageDirection,o=e.senderUserId,u=a===pu.SEND&&o===this._loginUserId,c=r===Ru.RECALL,l=zo(n),h=!1,f={},d=t.lastUnreadTime||0,g=t.unreadMessageCount||0;if(d>i||u)return{hasChanged:h,localConversation:t,updateItems:f};(s&&(t.unreadMessageCount=g+1,t.lastUnreadTime=i,h=!0),c&&l)&&(d>=n.sentTime&&g&&(t.unreadMessageCount=g-1,h=!0));return h&&(f.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:h,localConversation:t,updateItems:f}}},{key:"_calcMentionedInfo",value:function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;pu.SEND;var s=zo(n),a=!1,o={};return r&&s&&n.mentionedInfo&&(t.hasMentioned=!0,a=!0,o.hasMentioned={val:!0,time:i},o.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:a,localConversation:t,updateItems:o}}},{key:"_calcMentionedCount",value:function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===pu.RECEIVE&&null!=n&&n.mentionedInfo){var s=n.mentionedInfo,a=s.type,o=s.userIdList;if(a===bu.ALL||(o||[]).includes(this._loginUserId)){i=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:i,localConversation:t}}},{key:"_setUpdatedConversation",value:function(e){if(zo(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),s=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(s,e)}}},{key:"_setConTagStatusChanged",value: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 s in i)if(!n[s]||i[s].isTop!==n[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0}},{key:"addStatus",value:function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,s=e.notificationStatus,a=e.isTop,o=e.tags,u=e.channelId,c={},l={};n!==Go.ULTRA_GROUP&&(Xo(s)||(l.notificationStatus={time:i,val:s}),Xo(a)||(l.isTop={time:i,val:a}),Xo(o)||(l.tags={time:i,val:o},null==o||o.forEach((function(e){c[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,c,u),this._store.set(n,r,{notificationStatus:s,isTop:a,tags:c},u),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:l,channelId:u}),t&&this._notifyConversationChanged())}},{key:"_notifyConversationChanged",value:function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(r_,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(i_),this._conTagStatusChanged=!1))}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,s=e.isPersited,a=e.targetId,o=e.channelId;if(n_.indexOf(r)>=0){var u=!1,c=this._store.get(r,a,o),l={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,c),s=r.hasChanged,a=r.localConversation,o=r.updateItems;u=u||s,l=i(i({},l),o),c=qc(a)})),u&&this._store.set(r,a,c,o),this._store.updateMentionedData(e),s){var h=this._store.get(r,a,o);h.updatedItems=i({latestMessage:{time:e.sentTime,val:e}},l),h.latestMessage=e;var f=Object.assign(h,{conversationType:r,targetId:a,channelId:o});this._setUpdatedConversation(f)}(u||s)&&this._notifyConversationChanged()}}},{key:"get",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._store.get(e,t,n)}},{key:"getAllUnreadCount",value:function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,s=e.notificationStatus,a=e.conversationType;r=r||0,(n||1!==s)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),i}},{key:"getUnreadCountByTag",value: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}},{key:"getUnreadCount",value:function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0}},{key:"clearUnreadCount",value:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=this._store.get(e,t,n),s=i.unreadMessageCount,a=i.hasMentioned,o={};if(s&&(i.unreadMessageCount=0,o.unreadMessageCount={val:0,time:Date.now()}),a&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,o.hasMentioned={val:!1,time:Date.now()},o.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(o).length){var u=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:o});this._setUpdatedConversation(u),this._notifyConversationChanged()}}},{key:"clearAllUnreadCount",value: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))}))}},{key:"startPullConversationStatus",value:function(e){this._statusManager.pull(e)}},{key:"setDraft",value:function(e,t,n,r){var i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=n}},{key:"getDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]}},{key:"clearDraft",value:function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]}},{key:"addTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;s=Object.assign(s,n),this._store.set(e,t,{tags:s},r)}},{key:"deleteTagStatus",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=this._store.get(e,t,r),s=i.tags;n.forEach((function(e){delete s[e]})),this._store.set(e,t,{tags:s},r)}},{key:"getConversationListForTag",value:function(){return this._store.getValueForTag()}},{key:"getBlockConversationList",value:function(){return this._store.getValue().filter((function(e){return e.notificationStatus===Cu.OPEN})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"getTopConversationList",value:function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))}},{key:"adaptOldStore",value:function(){this._store.adaptOldStore()}},{key:"getUnreadMentionedCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=this.get(t,n,e);return r.unreadMentionedCount||0}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t}},{key:"getAllConversationState",value:function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))}}]),e}(),a_=function(){function e(t,n,r,i){u(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=Hr(t.runtime),this._engine=t,this._tagWatcherFunc=i}var t;return l(e,[{key:"_updateTag",value: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()}},{key:"addTag",value: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)}},{key:"deleteTag",value: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)}},{key:"getTagsInfo",value:function(){return this._storage.get(this._storageTagKey)||{}}},{key:"getTags",value: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)}))}},{key:"getTagById",value: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}},{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:return this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e.next=6,this._engine.pullUserSettings(t);case 6:n=e.sent,r=n.code,i=n.data,r!==yu.SUCCESS||Xo(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,a=i.version,o=s.Tag,Xo(o)||this._updateTag(o),this._storage.set(this._storagePullTimeKey,a),this._isPulling=!1,this._startPull());case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullUserSettings",value:function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}},{key:"getVersion",value:function(){return this._storage.get(this._storagePullTimeKey)||0}}]),e}(),o_=function(e){f(i,e);var t,n,r=T(i);function i(e,t){var n;return u(this,i),(n=r.call(this,e,t))._miniConnectUrl="",n._connectType=t.connectionType,n}return l(i,[{key:"_formatJSONPUrl",value:function(e,t,n,r){var i=this._runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(i,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(r,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())}},{key:"getInfo",value:(n=o(regeneratorRuntime.mark((function e(t,n,r){var s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._runtime.useNavi||(a=this._runtime.isSupportSocket()&&"websocket"===this._connectType?Vr.join(","):Br.join(","),this._miniConnectUrl=null!==(s=this._options.miniCMPProxy)&&void 0!==s&&s.length?this._options.miniCMPProxy.join(","):a||"",n=[]),e.abrupt("return",I(d(i.prototype),"getInfo",this).call(this,t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"_reqNavi",value:(t=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i="getServerEndpoint",s=0,a=t.length;case 2:if(!(s<a)){e.next=28;break}return o=this._formatJSONPUrl(t[s],r,n,i),su.debug("req navi => ".concat(o)),e.next=7,this._runtime.httpReq({url:o,timeout:1e4,dataType:"text"});case 7:if(200===(u=e.sent).status){e.next=11;break}return 403===u.status?su.error("request navi error: "+yu.RC_CONN_USER_OR_PASSWD_ERROR):401===u.status&&su.error("request navi error: "+yu.RC_CONN_APP_BLOCKED_OR_DELETED),e.abrupt("continue",25);case 11:return e.prev=11,c=u.data.match(/{[\d\D]+}/),0===(l=c&&c[0]?c[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),h=JSON.parse(l),f=/^https/.test(o)?"https":"http",h.protocol=f,this._runtime.useNavi||(h.server="",h.backupServer=this._miniConnectUrl,h.logSwitch=0),e.abrupt("return",h);case 22:e.prev=22,e.t0=e.catch(11),su.error("parse navi err =>",e.t0);case 25:s+=1,e.next=2;break;case 28:if(this._runtime.useNavi){e.next=31;break}return d={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},e.abrupt("return",d);case 31:return e.abrupt("return",null);case 32:case"end":return e.stop()}}),e,this,[[11,22]])}))),function(e,n,r){return t.apply(this,arguments)})}]),i}(_m),u_=function(){function e(t){u(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return l(e,[{key:"_startPull",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPulling&&0!==this._pullQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],n=t.roomId,r=t.timestamp,!((i=this._pullTime)>r)){e.next=9;break}return this._isPulling=!1,this._startPull(),e.abrupt("return");case 9:return e.next=11,this._engine.pullRTCRoomEntry(n,i);case 11:s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS?(this._isPulling=!1,this._pullTime=o.syncTime||0,this._startPull()):this._startPull();case 15:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pullEntry",value:function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()}},{key:"reset",value:function(){this._pullTime=0,this._isPulling=!1}}]),e}(),c_=function(e,t){return["send_msg",e,t].join("_")},l_=function(){function e(t,n){u(this,e),this._runtime=t,this._appkey=n,this._sendMessageMap={},this._userId=""}return l(e,[{key:"init",value:function(e){this._userId=e;var t=c_(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)}},{key:"_getLocalInfo",value:function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}}},{key:"setMessage",value:function(e,t){this._sendMessageMap[e]=t;var n=c_(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))}},{key:"getSendMessageMap",value:function(){return this._sendMessageMap}},{key:"removeByUID",value:function(e){delete this._sendMessageMap[e]}},{key:"removeByTimestamp",value:function(e){var t=c_(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}(),h_=function(e){var t="RCDeviceId",n=Hr(e),r="",i=n.get(t);return i?r=i:(r=Bo(),n.set(t,r)),r};h(e_={},Go.PRIVATE,nm.qryPMsg),h(e_,Go.GROUP,nm.qryGMsg),h(e_,Go.CHATROOM,nm.qryCHMsg),h(e_,Go.CUSTOMER_SERVICE,nm.qryCMsg),h(e_,Go.SYSTEM,nm.qrySMsg);var f_=[nm[nm.recallMsg],nm[nm.ppMsgS],nm[nm.pgMsgS],nm[nm.ppMsgP],nm[nm.pgMsgP],nm[nm.chatMsg],nm[nm.pcMsgP],nm[nm.prMsgS],nm[nm.updUgRTime]],d_=function(e){var t;return(t={},h(t,Go.PRIVATE,nm.ppMsgP),h(t,Go.GROUP,nm.pgMsgP),h(t,Go.CHATROOM,nm.chatMsg),h(t,Go.CUSTOMER_SERVICE,nm.pcMsgP),h(t,Go.RTC_ROOM,nm.prMsgS),t)[e]},g_=function(e,t,r,i,s,a){return{conversationType:e,targetId:t,senderUserId:a,messageDirection:pu.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:s,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig,channelId:r.channelId,isInterrupt:r.isInterrupt}},p_=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},v_=function(e){return e.sort((function(e,t){var n,r,i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i}))},y_=function(t){f(qe,t);var n,r,s,a,c,d,g,p,v,y,m,E,R,I,b,w,O,N,k,A,M,U,L,x,P,D,V,B,F,G,j,q,K,H,Y,Q,W,J,z,Z,X,$,ee,te,ne,re,ie,se,ae,oe,ue,ce,le,he,fe,de,ge,pe,ve,ye,me,_e,Ee,Te,Re,Ie,Ce,Se,be,we,Oe,Ne,ke,Ae,Me,Ue,Le,xe,Pe,De,Ve,Be,Fe,Ge,je=T(qe);function qe(e,t,n){var r;return u(this,qe),(r=je.call(this,e,t,n))._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._connectedTime=0,r._localConnectedTime=0,r._status=_u.DISCONNECTED,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._lastSyncUltraMsgTimeStamp=0,r._lastSyncUltraMsgLocalTimeStamp=0,r._ultraGroupTimer=-1,r._isUltraPulling=!1,r._ultraGroupTimeQue=[],r._isUltraGroupListExist=!1,r._ultraGroupMap={},r._firstPullUltraGroupTime=0,r._ultraMsgMap={},r._pullUltraChangeMessageQue=[],r._isPullingUltraChangeMessage=!1,r._lastPullingUltraChangeMessageTime=0,r._ultraMsgChangeMap={},r._letterbox=new qm(e,n.appkey),r._sendMessageStore=new l_(e,n.appkey),r._chrmEntryHandler=new Ym(_(r)),r}return l(qe,[{key:"_createNavi",value:function(){return new o_(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(Ge=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=[],this._naviInfo=n,n.server?r.push(n.server):su.warn("navi.server is invalid"),(i=n.backupServer)&&i.split(",").forEach((function(e){r.indexOf(e)<0&&r.push(e)})),0!==r.length){e.next=8;break}return su.error("navi invaild.",r),e.abrupt("return",yu.UNKNOWN);case 8:return s=this.runtime.createDataChannel({status:function(e){u._connectionStatusHandler(e,t,r,n.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),a=hg.V3,1===n.openAnti&&(a=hg.V4),e.next=13,s.connect(this._appkey,t,r,n.protocol,this._apiVer,a);case 13:return(o=e.sent)===yu.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(_u.CONNECTED),this._status=_u.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new s_(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new a_(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new u_(this),this._joinedChrmManager=new Qm(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval(),1===n.ugMsg&&this._startUltraSyncInterval()):s.close(),e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ge.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(su.warn("connection status changed:",e),this._status=e,e!==_u.CONNECTING)if(e!==_u.CONNECTED){if(this._channel&&e!==_u.DISCONNECTED)return e===_u.BLOCKED||e===_u.KICKED_OFFLINE_BY_OTHER_CLIENT||e===_u.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==_u.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)}},{key:"_try2Reconnect",value:(Fe=o(regeneratorRuntime.mark((function e(t,n,r){var i,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return");case 2:return i=hg.V3,1===this._naviInfo.openAnti&&(i=hg.V4),e.next=6,this._channel.connect(this._appkey,t,n,r,this._apiVer,i);case 6:if(e.sent!==yu.SUCCESS){e.next=16;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(_u.CONNECTED),this._status=_u.CONNECTED,this._startUltraSyncInterval(),this._rejoinChrm(),su.__insertLogIntoDatabase(),e.abrupt("return");case 16:this._watcher.status(_u.WEBSOCKET_UNAVAILABLE),this._status=_u.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(t,n,r)}),5e3);case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Fe.apply(this,arguments)})},{key:"_signalHandler",value:function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=nm[r];if(i)switch(i){case nm.s_ntf:su.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case nm.s_msg:this._receiveMsg(e);break;case nm.s_cmd:this._receiveStateNotify(e);break;case nm.s_us:this._receiveSettingNotify(e);break;case nm.rtc_ntf:this._receiveRtcKv(e);break;case nm.s_opNtf:this._pullOperateStatusNotify(e)}else su.error("unknown topic:",r)}}},{key:"_receiveStateNotify",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Wg),r=n.time,i=n.type,s=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(s,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(s),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(r),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(r),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}}},{key:"_receiveSettingNotify",value:function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,qp)).version;this._userSettingManager.pullUserSettings(n)}},{key:"_receiveRtcKv",value:function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,_v),r=n.time,i=n.type,s=n.roomId;if(1===i)this._rtcKVManager.pullEntry(s,r)}},{key:"_receiveMessageExpansion",value: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}})}},{key:"_receiveSyncMsg",value:function(e,t){var n;if(f_.includes(e.topic)){if(e.topic===nm[nm.updUgRTime]){var r,i=null===(r=this._channel)||void 0===r?void 0:r.codec.decodeByPBName(e.data,sp),s=i.channelId,a=i.busChannel,o=this._ultraGroupMap[a+"_"+s];return o&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.lastReadTime=t.timestamp,this._watcher.conversation(Wc([o]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var u=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,Fg,{currentUserId:this.currentUserId,signal:e});u=this._handleMsgProperties(u),t&&(u.sentTime=t.timestamp,u.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||u.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),u.messageType!==Ru.EXPANSION_NOTIFY?(u.messageType===Ru.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(u.conversationType,u.targetId,u.channelId),this._conversationManager.setConversationCacheByMessage(u,!0),this._watcher.batchMessage([u])):this._receiveMessageExpansion(u))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Wg),n=t.type,r=t.chrmId,i=t.time;if(su.info("s_ntf -> type: ".concat(n,", chrmId: ").concat(r,", time: ").concat(i)),2===n){var s=this._chrmsQueue[r];if(!s)return;s.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),this._syncMsg()}}},{key:"_startSyncInterval",value:function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()}},{key:"_stopSyncInterval",value:function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)}},{key:"_syncMsg",value:(Be=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._pullingMsg){e.next=2;break}return e.abrupt("return");case 2:if(this._channel){e.next=5;break}return this._pullingMsg=!1,e.abrupt("return");case 5:return this._pullingMsg=!0,n=this._letterbox.getOutboxTime(this.currentUserId),r=this._letterbox.getInboxTime(this.currentUserId),su.info("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new Vy(nm[nm.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,qg,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(a=e.sent,o=a.code,u=a.data,this._latestSyncTimestamp=Date.now(),o===yu.SUCCESS&&u&&!Xo(u.finished)&&!Xo(u.list)&&!Xo(u.syncTime)){e.next=21;break}return su.warn("pullMsg failed -> code:",o,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,su.info("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,d=[],c.forEach((function(e){if(e.messageDirection===pu.SEND&&(f=Math.max(e.sentTime,f),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==Ru.EXPANSION_NOTIFY){if(e.messageType===Ru.SYNC_READ_STATUS){if(e.senderUserId!==p.currentUserId)return;p._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=p._handleMsgProperties(e);p._conversationManager.setConversationCacheByMessage(t,!0),d.push(t)}else p._receiveMessageExpansion(e)})),this._watcher.batchMessage(d),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,g=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(t=this._pullQueue).push.apply(t,S(g)),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!l||g.length>0)&&this._syncMsg();case 36:case"end":return e.stop()}}),e,this)}))),function(){return Be.apply(this,arguments)})},{key:"_receiveMsg",value:function(e){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var t=this._channel.codec.decodeByPBName(e.data,jg,{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!==Ru.EXPANSION_NOTIFY?t.messageType===Ru.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}}},{key:"_handleMsgProperties",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.messageType,s=e.isCounted,a=e.isPersited,o=e.isStatusMessage,u=r in qr,c=r in this._customMessageType;if(t=u?i(i({},qr[r]),{},{isStatusMessage:Kr.includes(r)}):c?this._customMessageType[r]:{isCounted:!$o(s)&&s,isPersited:!$o(a)&&a,isStatusMessage:!1},Object.assign(e,t),n&&!Xo(o)&&(e.isStatusMessage=o),!n){var l=e.content.user;if(l){var h=l.portrait,f=l.portraitUri,d=h||f;d&&(l.portrait=l.portraitUri=d)}}return e}},{key:"getHistoryMessage",value:(Ve=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c,l,h,f,d,g,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=p.length>5&&void 0!==p[5]?p[5]:"",o=this.currentUserId,u=this._channel,c=vy[t]||ly,l=1===i&&0===r,!u){e.next=15;break}return h=u.codec.encodeGetHistoryMsg(n,{timestamp:r,count:l?2:i,order:s,channelId:a}),e.next=8,u.send(new Vy(c,h,o),zg,{currentUserId:o,connectedTime:u.connectedTime,conversation:{targetId:n}});case 8:if(f=e.sent,(d=f.code)===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:d});case 12:return g=f.data,l&&2===g.list.length&&(g.hasMore=!0,0===s?g.list.shift():g.list.pop()),e.abrupt("return",{code:d,data:{list:g.list,hasMore:g.hasMore}});case 15:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return Ve.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){su.info("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Vy(nm[nm.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==yu.SUCCESS&&su.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(De=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(a=this._channel)){e.next=11;break}return o=a.codec.encodeDeleteMessages(t,n,r,i),u=new Vy(Xv,o,s),e.next=6,a.send(u);case 6:if(c=e.sent,(l=c.code)===yu.SUCCESS){e.next=10;break}return e.abrupt("return",l);case 10:return e.abrupt("return",l);case 11:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return De.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(Pe=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(a=this._channel)){e.next=12;break}return o=a.codec.encodeClearMessages(n,r,i,t),u=new Vy(yy[t],o,s),e.next=7,a.send(u);case 7:if(c=e.sent,(l=c.code)===yu.SUCCESS){e.next=11;break}return e.abrupt("return",l);case 11:return e.abrupt("return",l);case 12:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return Pe.apply(this,arguments)})},{key:"getConversationList",value:(xe=o(regeneratorRuntime.mark((function e(){var t,n,r,i,s,a,o,u,c,l,h,f=this,d=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=d.length>0&&void 0!==d[0]?d[0]:300,n=d.length>1?d[1]:void 0,r=d.length>2?d[2]:void 0,i=d.length>3?d[3]:void 0,s=this.currentUserId,a=this._channel,n=n||Go.PRIVATE,!a){e.next=17;break}return o=a.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new Vy(ay,o,s),e.next=12,a.send(u,Xg,{currentUserId:s,connectedTime:a.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=f._conversationManager.get(t,n,r);return Object.assign(e,i),e}});case 12:if(c=e.sent,l=c.code,h=c.data,l===yu.SUCCESS){e.next=16;break}return e.abrupt("return",{code:l});case 16:return e.abrupt("return",{code:l,data:null==h?void 0:h.list});case 17:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return xe.apply(this,arguments)})},{key:"removeConversation",value:(Le=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=this._channel)){e.next=12;break}return s=i.codec.encodeRemoveOldConversationList({conversationType:t,channelId:r,targetId:n}),a=new Vy(oy,s,n),e.next=6,i.send(a);case 6:if(o=e.sent,su.info("RemoveConversation =>",o),(u=o.code)===yu.SUCCESS){e.next=11;break}return e.abrupt("return",u);case 11:return e.abrupt("return",u);case 12:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Le.apply(this,arguments)})},{key:"getConversation",value:(Ue=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==Go.ULTRA_GROUP){e.next=6;break}if(i=this._ultraGroupMap[r+"_"+n]){e.next=4;break}return e.abrupt("return",{code:yu.CONVER_GET_ERROR});case 4:e.next=18;break;case 6:if(s=this._conversationManager.get(t,n,r)){e.next=9;break}return e.abrupt("return",{code:yu.CONVER_GET_ERROR});case 9:return e.next=11,this.getHistoryMessage(t,n,0,1,0);case 11:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=16;break}return e.abrupt("return",{code:yu.CONVER_GET_ERROR});case 16:c=(null==u?void 0:u.list[0])||null,i={conversationType:t,targetId:n,channelId:r,unreadMessageCount:s.unreadMessageCount||0,latestMessage:c,notificationStatus:s.notificationStatus||Cu.CLOSE,isTop:s.isTop||!1,lastUnreadTime:s.lastUnreadTime||0,unreadMentionedCount:s.unreadMentionedCount||0};case 18:return e.abrupt("return",{code:yu.SUCCESS,data:i});case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Ue.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:yu.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t,n){var r,i;e===Go.ULTRA_GROUP?r=(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0:r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:yu.SUCCESS,data:r})}},{key:"clearConversationUnreadCount",value:function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(yu.SUCCESS)}},{key:"clearAllUnreadCount",value:function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(yu.SUCCESS)}},{key:"getFirstUnreadMessage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"saveConversationMessageDraft",value:function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(yu.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:yu.SUCCESS,data:r})}},{key:"clearConversationMessageDraft",value:function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(yu.SUCCESS)}},{key:"pullConversationStatus",value:(Me=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,!n){e.next=13;break}return i=n.codec.encodeGetConversationStatus(t),s=new Vy(nm[nm.pullSeAtts],i,r),e.next=6,n.send(s,Hp);case 6:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.channelId,s=e.isTop,a=l._ultraGroupMap[i+"_"+n];t===Go.ULTRA_GROUP?a&&(void 0!==r&&(a.notificationStatus=r),"boolean"==typeof s&&(a.isTop=s)):c.push(e)})),e.abrupt("return",{code:o,data:c});case 13:return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return Me.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(Ae=o(regeneratorRuntime.mark((function e(t){var n,r,s,a,o,u,c,l,h,f,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.currentUserId,!(r=this._channel)){e.next=15;break}return s=r.codec.encodeSetConversationStatus(t),a=new Vy(uy,s,n),e.next=6,r.send(a,Jp);case 6:if(o=e.sent,u=o.code,c=o.data,u!==yu.SUCCESS){e.next=14;break}return l=c,h=[],t.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,s=e.channelId,a=e.isTop;if(t===Go.ULTRA_GROUP){var o=d._ultraGroupMap[s+"_"+n];o&&(void 0!==r&&(o.notificationStatus=r),void 0!==a&&(o.isTop=a),h.push(o))}else d._conversationManager.addStatus(i(i({},e),{},{updatedTime:l.version}),!0)})),h.length>0&&(f=Wc(h),f=v_(f),this._watcher.conversation(f)),e.abrupt("return",u);case 14:return e.abrupt("return",u);case 15:return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return Ae.apply(this,arguments)})},{key:"_joinChrm",value:(ke=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),a=new Vy(r?ey:$v,s,t),e.next=8,i.send(a,op);case 8:return o=e.sent,u=o.code,c=o.data,u===yu.SUCCESS&&(l=c.joinTime,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,n,l),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,n)),e.abrupt("return",u);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ke.apply(this,arguments)})},{key:"_rejoinChrm",value:(Ne=o(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this._joinedChrmManager.get(),e.t0=regeneratorRuntime.keys(t);case 2:if((e.t1=e.t0()).done){e.next=10;break}return n=e.t1.value,e.next=6,this._joinChrm(n,t[n]||10,!0);case 6:(r=e.sent)===yu.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:n,count:t[n]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:n,errorCode:r}}),e.next=2;break;case 10:case"end":return e.stop()}}),e,this)}))),function(){return Ne.apply(this,arguments)})},{key:"_pullChrmMsg",value:(Oe=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=v.length>1&&void 0!==v[1]?v[1]:10,r=v.length>2&&void 0!==v[2]?v[2]:0,this._channel){e.next=4;break}return e.abrupt("return");case 4:if(i=this._chrmsQueue[t],s=i.pulling,a=i.timestamp,!s){e.next=8;break}return e.abrupt("return");case 8:return i.pulling=!0,o=this._channel.codec.encodeChrmSyncMsg(a,n),u=new Vy(nm[nm.chrmPull],o,t),e.next=13,this._channel.send(u,qg,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===yu.SUCCESS&&h){e.next=20;break}return su.warn("pull chatroom msg failed, code:",l,", data:",h),e.abrupt("return");case 20:f=h.list,d=h.syncTime,g=h.finished,i.timestamp=r?Math.max(d,r):d,i.queue=i.queue.filter((function(e){return e>d})),p=[],f.forEach((function(e){e.sentTime<a||p.push(e)})),this._watcher.batchMessage(p),(!g||i.queue.length>0)&&this._pullChrmMsg(t);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return Oe.apply(this,arguments)})},{key:"joinChatroom",value:(we=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!1));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return we.apply(this,arguments)})},{key:"joinExistChatroom",value:(be=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._joinChrm(t,n,!0));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return be.apply(this,arguments)})},{key:"quitChatroom",value:(Se=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel){e.next=3;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new Vy(ty,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(a=s.code)===yu.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return Se.apply(this,arguments)})},{key:"getChatroomInfo",value:(Ce=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._channel){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),a=new Vy(nm[nm.queryChrmI],s,t),e.next=7,i.send(a,cp);case 7:if(o=e.sent,u=o.code,c=o.data,u===yu.SUCCESS){e.next=11;break}return e.abrupt("return",{code:u});case 11:return e.abrupt("return",{code:u,data:c});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Ce.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(Ie=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this._channel){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return a=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),o=new Vy(fy,a,t),e.next=7,s.send(o,zg,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:c});case 12:return e.abrupt("return",{code:c,data:{list:l.list,hasMore:l.hasMore}});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return Ie.apply(this,arguments)})},{key:"_modifyChatroomKV",value:(Re=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),a=n.type===ku.UPDATE?ny:ry,o=new Vy(a,s,t),e.next=8,r.send(o);case 8:if(u=e.sent,(c=u.code)!==yu.SUCCESS){e.next=13;break}return this._chrmEntryHandler.setLocal(t,{kvEntries:[n],syncTime:(new Date).getTime()},i),e.abrupt("return",c);case 13:return e.abrupt("return",c);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"_modifyChatroomKVS",value:(Te=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodeModifyChatRoomKVS(t,n,i),a=n.type===ku.UPDATE?iy:sy,o=new Vy(a,s,t),e.next=8,r.send(o,Pp);case 8:return u=e.sent,c=u.code,-1!==[yu.SUCCESS,yu.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(h=[],delete(f=Object.assign({},n)).entries,n.entries.forEach((function(e){h.push(Object.assign({},e,f))})),c===yu.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(d=u.data,su.warn("设置失败的属性:",d.errorKeys),l=d.errorKeys,d&&Array.isArray(d.errorKeys)&&d.errorKeys.forEach((function(e){var t=h.findIndex((function(t){return e.key===t.key}));-1!==t&&h.splice(t,1)}))),su.warn("设置成功的属性:",h),this._chrmEntryHandler.setLocal(t,{kvEntries:h,syncTime:(new Date).getTime()},i)),e.abrupt("return",{code:c,data:l});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"setChatroomEntry",value:(Ee=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.UPDATE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"setChatroomEntries",value:(_e=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.UPDATE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKVS(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return _e.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(me=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.UPDATE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return me.apply(this,arguments)})},{key:"removeChatroomEntry",value:(ye=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.DELETE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return ye.apply(this,arguments)})},{key:"removeChatroomEntries",value:(ve=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.DELETE,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKVS(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return ve.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(pe=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=ku.DELETE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,e.abrupt("return",this._modifyChatroomKV(t,n));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return pe.apply(this,arguments)})},{key:"getChatroomEntry",value:(ge=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._chrmEntryHandler.getValue(t,n))){e.next=5;break}return e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:r}));case 5:if(i=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:yu.RC_NET_CHANNEL_INVALID}));case 8:return s=i.codec.encodePullChatRoomKV(0),a=new Vy(nm[nm.pullKV],s,t),e.next=12,i.send(a,xp);case 12:if(o=e.sent,!((u=o.data||{})&&u.kvEntries&&u.kvEntries.length)){e.next=18;break}if(c=u.kvEntries.find((function(e){return e.key===n})),void 0===c){e.next=18;break}return e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:null==c?void 0:c.value}));case 18:return e.abrupt("return",Promise.resolve({code:yu.CHATROOM_KEY_NOT_EXIST}));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return ge.apply(this,arguments)})},{key:"getAllChatroomEntry",value:(de=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this._chrmEntryHandler.getAll(t))||!Object.keys(n).length){e.next=5;break}return e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:n}));case 5:if(r=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:yu.RC_NET_CHANNEL_INVALID}));case 8:return i={},s=r.codec.encodePullChatRoomKV(0),a=new Vy(nm[nm.pullKV],s,t),e.next=13,r.send(a,xp);case 13:return o=e.sent,(u=o.data||{})&&u.kvEntries&&u.kvEntries.length&&u.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),e.abrupt("return",Promise.resolve({code:yu.SUCCESS,data:i}));case 17:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"pullChatroomEntry",value:(fe=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),a=new Vy(nm[nm.pullKV],s,t),e.next=7,r.send(a,xp);case 7:if(o=e.sent,u=o.code,c=o.data,u!==yu.SUCCESS){e.next=17;break}return su.info("Pull success ChrmKV, "+JSON.stringify(o)),this._chrmEntryHandler.setLocal(t,c,i),su.info("Save into cache success!"),l=c.kvEntries,h=[],l.length>0&&(l.forEach((function(e){var n=e.key,r=e.value,i=e.type,s=e.timestamp;h.push({key:n,value:r,type:i,timestamp:s,chatroomId:t})})),this._watcher.chatroom({updatedEntries:h})),e.abrupt("return",{code:u,data:c});case 17:return e.abrupt("return",{code:u});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return fe.apply(this,arguments)})},{key:"sendMessage",value:(he=o(regeneratorRuntime.mark((function e(t,n,r){var s,a,o,u,c,l,f,d,g,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(r=p_(r,this.currentUserId),r=this._handleMsgProperties(r,!0),s=!![Go.PRIVATE,Go.GROUP].includes(t)&&r.isStatusMessage,a=s?(v=t,y=void 0,(y={},h(y,Go.PRIVATE,nm.ppMsgS),h(y,Go.GROUP,nm.pgMsgS),y)[v]):d_(t)||nm.ppMsgP,s&&(r.isPersited=!1,r.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},r),(u=new xy(nm[a],o,n)).setHeaderQos(og.AT_LEAST_ONCE),!s){e.next=13;break}return this._channel.sendOnly(u),e.abrupt("return",{code:yu.SUCCESS,data:g_(t,n,i({},r),"",0,this.currentUserId)});case 13:return c=Date.now()-this._localConnectedTime+this._connectedTime,l=g_(t,n,i({},r),"",c,this.currentUserId),e.next=17,this._channel.send(u);case 17:if(f=e.sent,d=f.code,g=f.data,d===yu.SUCCESS){e.next=22;break}return e.abrupt("return",{code:d,data:l});case 22:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),l.sentTime=p.timestamp,l.messageUId=p.messageUId,this._conversationManager.setConversationCacheByMessage(l,!0),e.abrupt("return",{code:yu.SUCCESS,data:l});case 28:case"end":return e.stop()}var v,y}),e,this)}))),function(e,t,n){return he.apply(this,arguments)})},{key:"recallMsg",value:(le=o(regeneratorRuntime.mark((function e(t,n,r,s,a){var o,u,c,l,h,f,d,g,p,v,y;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return u=a.user,c={content:{conversationType:t,targetId:n,messageUId:r,sentTime:s,user:u},messageType:"RC:RcCmd",disableNotification:null==a?void 0:a.disableNotification,pushConfig:null==a?void 0:a.pushConfig,pushContent:(null===(o=a.pushConfig)||void 0===o?void 0:o.pushContent)||a.pushContent||"",channelId:a.channelId},l=nm[nm.recallMsg],h=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},c),(f=new xy(l,h,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=10,this._channel.send(f);case 10:if(d=e.sent,g=d.code,p=d.data,g===yu.SUCCESS){e.next=15;break}return e.abrupt("return",{code:g});case 15:if(v=p,t!==Go.ULTRA_GROUP){e.next=21;break}return this._ultraMsgMap[v.messageUId]=v.timestamp,e.abrupt("return",{code:yu.SUCCESS});case 21:return this._sendMessageStore.setMessage(v.messageUId,v.timestamp),y=g_(t,n,i(i({},c),{},{isPersited:!0}),v.messageUId,v.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(y,!0),e.abrupt("return",{code:yu.SUCCESS,data:y});case 25:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return le.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(ce=o(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new Vy(nm[nm.rrMsg],i,t),e.next=6,this._channel.send(s);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ce.apply(this,arguments)})},{key:"getMessageReader",value:(ue=o(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new Vy(nm[nm.rrList],i,t),e.next=6,this._channel.send(s,Xp);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ue.apply(this,arguments)})},{key:"pullUserSettings",value:(oe=o(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new Vy(nm[nm.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,jp));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return oe.apply(this,arguments)})},{key:"getFileToken",value:(ae=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":Lc(t,n),a=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),o=new Vy(nm[nm.qnTkn],a,this.currentUserId),e.next=7,this._channel.send(o,wp);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==yu.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c,data:l});case 13:return e.abrupt("return",{code:c});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return ae.apply(this,arguments)})},{key:"getFileUrl",value:(se=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return s="",a="",o="",n===Ou.QINIU?(a=Op,o=kp):(a=Np,o=Ap),s=n===Ou.QINIU?nm[nm.qnUrl]:n===Ou.AWS?nm[nm.s3Url]:n===Ou.STC?nm[nm.stcUrl]:nm[nm.aliUrl],u=this._channel.codec.encodeGetFileUrl(a,t,r,i),c=new Vy(s,u,this.currentUserId),e.next=11,this._channel.send(c,o);case 11:if(l=e.sent,h=l.code,f=l.data,d=f,h!==yu.SUCCESS){e.next=17;break}return e.abrupt("return",{code:h,data:d});case 17:return e.abrupt("return",{code:h});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return se.apply(this,arguments)})},{key:"disconnect",value: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(),this._stopUltraSyncInterval()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"getCurrentUserId",value:function(){return this.currentUserId}},{key:"createTag",value:(ie=o(regeneratorRuntime.mark((function e(t){var n,r,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),s=new Vy(nm[nm.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(s,Fp);case 7:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return c=u.version,this._userSettingManager.addTag([i(i({},t),{},{createdTime:c})],c),e.abrupt("return",{code:yu.SUCCESS,data:u});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return ie.apply(this,arguments)})},{key:"removeTag",value:(re=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new Vy(nm[nm.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,Fp);case 7:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return u=o.version,this._userSettingManager.deleteTag([t],u),e.abrupt("return",{code:yu.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"updateTag",value:(ne=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Vy(nm[nm.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,Fp);case 7:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return u=o.version,this._userSettingManager.addTag([t],u),e.abrupt("return",{code:yu.SUCCESS,data:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getTagList",value:(te=o(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._userSettingManager.getTags(),n=this._conversationManager.getConversationListForTag(),t.forEach((function(e){e.conversationCount=n[e.tagId]?n[e.tagId].length:0})),e.abrupt("return",{code:yu.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return te.apply(this,arguments)})},{key:"addTagForConversations",value:(ee=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:yu.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Vy(nm[nm.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(a=s.code)===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a});case 12:return(o={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),e.abrupt("return",{code:yu.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return ee.apply(this,arguments)})},{key:"removeTagForConversations",value:($=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Vy(nm[nm.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(a=s.code)===yu.SUCCESS){e.next=10;break}return e.abrupt("return",{code:a});case 10:return n.forEach((function(e){o._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),e.abrupt("return",{code:yu.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"removeTagsForConversation",value:(X=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return r=t.conversationType,i=t.targetId,s=t.channelId,a=n.map((function(e){return{tagId:e}})),o=this._channel.codec.encodeUpdateConversationTag(a,[t]),u=new Vy(nm[nm.delTag],o,this.currentUserId),e.next=8,this._channel.send(u);case 8:if(c=e.sent,(l=c.code)===yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:l});case 12:return this._conversationManager.deleteTagStatus(r,i,n,s),e.abrupt("return",{code:yu.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"getConversationListByTag",value:(Z=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.currentUserId,s=this._channel){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return a=s.codec.encodeOldConversationList({count:r,type:Go.PRIVATE,startTime:n}),o=new Vy(ay,a,i),e.next=7,s.send(o,Xg,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,null==l?void 0:l.list),su.info("GetConversationListByTag",h),c===yu.SUCCESS){e.next=13;break}return e.abrupt("return",{code:c});case 13:return e.abrupt("return",{code:c,data:h});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Z.apply(this,arguments)})},{key:"_conversationHasTagFilter",value:function(e,t){var n=this,r=[],s=[];function a(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var a=t.conversationType,o=t.targetId,u=t.channelId,c=n._conversationManager.get(a,o,u),l=c.hasMentioned,h=c.mentionedInfo,f=c.lastUnreadTime,d=c.notificationStatus,g=c.isTop,p=c.tags,v=c.unreadMessageCount,y=p&&p[e];if(y){var m=i(i({},t),{},{hasMentioned:l,mentionedInfo:h,lastUnreadTime:f,notificationStatus:d,isTop:g,unreadMessageCount:v});y.isTop?r.push(i(i({},m),{},{isTopInTag:!0})):s.push(i(i({},m),{},{isTopInTag:!1}))}})),[].concat(S(r.sort(a)),S(s.sort(a)))}},{key:"getUnreadCountByTag",value:(z=o(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:yu.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return z.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(J=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u,c,l,h,f,d,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.conversationType,a=n.channelId,o=r.isTop,u=[{tagId:t,isTop:o}],(c=this._conversationManager.get(s,i,a)).tags&&Object.hasOwnProperty.call(c.tags,t)){e.next=8;break}return e.abrupt("return",{code:yu.NO_TAG_IN_CONVER});case 8:return l=this._channel.codec.encodeUpdateConversationTag(u,[n]),h=new Vy(nm[nm.addTag],l,this.currentUserId),e.next=12,this._channel.send(h);case 12:if(f=e.sent,(d=f.code)===yu.SUCCESS){e.next=16;break}return e.abrupt("return",{code:d});case 16:return(g={})[t]={},o&&(g[t].isTop=!0),this._conversationManager.addTagStatus(s,i,g,a),e.abrupt("return",{code:yu.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return J.apply(this,arguments)})},{key:"getTagsForConversation",value:(W=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(s in n.tags)i.push({tagId:s,tagName:null===(a=r[s])||void 0===a?void 0:a.tagName});return e.abrupt("return",{code:yu.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return W.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:yu.SUCCESS,data:e})}},{key:"getTopConversationList",value:function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:yu.SUCCESS,data:e})}},{key:"getUnreadMentionedCount",value:function(e){var t,n;e.conversationType===Go.ULTRA_GROUP?t=(null===(n=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===n?void 0:n.unreadMentionedCount)||0:t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:yu.SUCCESS,data:e})}},{key:"getUltraGroupList",value:(Q=o(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isUltraGroupListExist){e.next=2;break}return e.abrupt("return",{code:yu.METHOD_NOT_AVAILABLE});case 2:return t=Object.values(this._ultraGroupMap),t=v_(t),n=Wc(t),e.abrupt("return",{code:yu.SUCCESS,data:n});case 6:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getBlockUltraGroupList",value:function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:yu.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===Cu.OPEN&&t.push({conversationType:Go.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"getTopUltraGroupList",value:function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:yu.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:Go.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"getUltraGroupUnreadMentionedCountByTargetId",value:function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:yu.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap){n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount)}return Promise.resolve({code:yu.SUCCESS,data:t})}},{key:"clearUltraUnreadcount",value:(Y=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:"",this._isUltraGroupListExist){e.next=3;break}return e.abrupt("return",Promise.resolve(yu.METHOD_NOT_AVAILABLE));case 3:if(this._channel){e.next=5;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 5:if(this._status===_u.CONNECTED){e.next=7;break}return e.abrupt("return",yu.RC_NET_UNAVAILABLE);case 7:return r=Date.now(),i=this._channel.codec.encodeClearUnreadCount({conversationType:Go.ULTRA_GROUP,targetId:t,channelId:n},{timestamp:r}),(s=new xy(nm[nm.updUgRTime],i,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=13,this._channel.send(s);case 13:return a=e.sent,(o=a.code)===yu.SUCCESS&&(u=this._ultraGroupMap[n+"_"+t])&&(u.unreadMessageCount=0,u.unreadMentionedCount=0,u.lastReadTime=r),e.abrupt("return",o);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"_getUltraGroupList",value:(H=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel&&this._status===_u.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:return n=this._channel.codec.encodeUltraGroup(t,!1),r=new Vy(nm[nm.pullUgSes],n,this.currentUserId),e.next=7,this._channel.send(r,Xg,{currentUserId:this.currentUserId,conversationType:Go.ULTRA_GROUP});case 7:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS&&a){e.next=14;break}return su.warn("pull super conversation failed, code:",s,", data:",a,"retrying..."),o=setTimeout((function(){p._firstPullUltraGroupTime=t,p._getUltraGroupList(t),clearTimeout(o)}),3e3),e.abrupt("return");case 14:if(u=(null==a?void 0:a.list)||[],c=null==a?void 0:a.isFinished,u.forEach((function(e){e.notificationStatus=Cu.CLOSE,e.isTop=!1,p._ultraGroupMap[e.channelId+"_"+e.targetId]=e})),!1!==c){e.next=22;break}l=u.length>0&&u[u.length-1].versionTime||0,this._getUltraGroupList(l),e.next=33;break;case 22:return e.next=24,this.pullConversationStatus(this._firstPullUltraGroupTime);case 24:h=e.sent,f=h.code,d=h.data,f!==yu.SUCCESS&&su.warn("pullConversationStatus fail code: ".concat(f,", data: ").concat(d)),g=Object.values(this._ultraGroupMap),g=v_(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Wc(g)),0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);case 33:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_startUltraSyncInterval",value:function(){var e=this;this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._syncUltraMsg(0),function t(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)}()}},{key:"_stopUltraSyncInterval",value:function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)}},{key:"_syncUltraMsg",value:(K=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel&&this._status===_u.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(!this._isUltraPulling){e.next=4;break}return e.abrupt("return");case 4:return su.info("start pull ultra msg, time: ".concat(t)),this._isUltraPulling=!0,r=this._channel.codec.encodeSuperSyncMsg(t),i=new Vy(nm[nm.pullUgMsg],r,this.currentUserId),e.next=10,this._channel.send(i,qg,{currentUserId:this.currentUserId,conversation:{conversationType:Go.ULTRA_GROUP}});case 10:if(s=e.sent,a=s.code,o=s.data,su.info("end pull ultra msg, code: ".concat(a,", syncTime: ").concat(null==o?void 0:o.syncTime,", count: ").concat(null==o||null===(n=o.list)||void 0===n?void 0:n.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),a===yu.SUCCESS&&o){e.next=19;break}return su.warn("sync super message failed, code:",a,", data:",o),this._isUltraPulling=!1,e.abrupt("return");case 19:if(this._isUltraPulling=!1,u=o.list,c=o.syncTime,l=o.finished,this._isUltraGroupListExist){e.next=27;break}return su.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=c,e.abrupt("return");case 27:for(g in h={},f=[],u.forEach((function(e){var t,n,r,i=e.targetId,s=e.content,a=e.messageType,o=e.messageUId,u=e.channelId,l=e.isCounted;if(p._ultraMsgMap[o])delete p._ultraMsgMap[o];else{var d=0;((null==s||null===(t=s.mentionedInfo)||void 0===t?void 0:t.type)===bu.ALL||null!=s&&null!==(n=s.mentionedInfo)&&void 0!==n&&null!==(r=n.userIdList)&&void 0!==r&&r.includes(p.currentUserId))&&(d=1);var g=p._ultraGroupMap[u+"_"+i];if(g)l&&(a===Ru.RECALL?g.unreadMessageCount>0&&(g.unreadMessageCount-=1):(g.unreadMessageCount+=1,g.unreadMentionedCount+=d)),g.versionTime=c,g.latestMessage=e,h[u+"_"+i]=g;else{var v={conversationType:Go.ULTRA_GROUP,targetId:i,channelId:u,unreadMessageCount:1,unreadMentionedCount:d,versionTime:c,latestMessage:e,notificationStatus:Cu.CLOSE,isTop:!1};p._ultraGroupMap[u+"_"+i]=v,h[u+"_"+i]=v}f.push(e)}})),Object.keys(h).length>0&&(su.info("notice ultragroups"),d=Object.values(h),d=v_(d),this._watcher.conversation(Wc(d))),su.info("notice ultragroup message"),this._watcher.batchMessage(f),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>c})),this._ultraMsgMap)this._ultraMsgMap[g]<c&&delete this._ultraMsgMap[g];!1===l?this._syncUltraMsg(c):u&&u.length>0&&(this._lastSyncUltraMsgTimeStamp=c),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);case 37:case"end":return e.stop()}}),e,this)}))),function(e){return K.apply(this,arguments)})},{key:"sendUltraMessage",value:(q=o(regeneratorRuntime.mark((function e(t,n){var r,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return"RC:SRSMsg"===n.messageType&&su.warn("ultra group -> direction message convert to message"),n=this._handleMsgProperties(n,!0),r=this._channel.codec.encodeUpMsg({conversationType:Go.ULTRA_GROUP,targetId:t},n),(s=new xy(nm[nm.ugMsg],r,t)).setHeaderQos(og.AT_LEAST_ONCE),a=Date.now()-this._localConnectedTime+this._connectedTime,o=g_(Go.ULTRA_GROUP,t,i({},n),"",a,this.currentUserId),e.next=13,this._channel.send(s);case 13:if(u=e.sent,c=u.code,l=u.data,c===yu.SUCCESS){e.next=18;break}return e.abrupt("return",{code:c,data:o});case 18:return h=l,o.sentTime=h.timestamp,o.messageUId=h.messageUId,this._ultraMsgMap[h.messageUId]=h.timestamp,f=n.channelId||"",(d=this._ultraGroupMap[f+"_"+t])?d.latestMessage=o:(d={conversationType:Go.ULTRA_GROUP,targetId:t,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:o.sentTime,latestMessage:o,notificationStatus:Cu.CLOSE,isTop:!1},this._ultraGroupMap[f+"_"+t]=d),this._watcher.conversation(Wc([d])),e.abrupt("return",{code:c,data:o});case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"sendUltraGroupTypingStatus",value:(j=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return r=t.conversationType,i=t.channelId,s=t.targetId,a=this._channel.codec.encodeOperateStatus(s,r,i||"",n||0),(o=new xy(nm[nm.operate],a,s)).setHeaderQos(og.AT_LEAST_ONCE),e.next=10,this._channel.send(o);case 10:if(u=e.sent,(c=u.code)===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:c,msg:yu[c]});case 14:return e.abrupt("return",{code:c});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"getUltraGroupMessageListByMessageUId",value:(G=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:if(!(t.messages&&t.messages.length<1)){e.next=6;break}return e.abrupt("return",{code:yu.MSG_LIMIT_ERROR});case 6:if(!(t.messages&&t.messages.length>20)){e.next=8;break}return e.abrupt("return",{code:yu.MSG_LIMIT_ERROR});case 8:return n={},t.messages.forEach((function(e){n[e.messageUId]=void 0})),r=this._channel.codec.encodeMsgQuery(t),(i=new Vy(nm[nm.qryMsg],r,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=16,this._channel.send(i,gv);case 16:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS){e.next=21;break}return e.abrupt("return",{code:a,msg:yu[a]});case 21:return u=(o||{}).list,Array.isArray(u)&&u.forEach((function(e){var t=e.messageUId;n[t]=e})),e.abrupt("return",{code:0,data:n});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"_pullOperateStatusNotify",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,vv),n=t.conversationType,r=t.info,i=t.summary;su.info("s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}}},{key:"expandUltraMessage",value:(F=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodeExpandUltraMessage(t,this.currentUserId),(r=new xy(nm[nm.upMsgEx],n,t.targetId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=9,this._channel.send(r);case 9:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:yu[s]});case 14:return o=a,this._ultraMsgMap[o.messageUId]=o.timestamp,e.abrupt("return",{code:s});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"modifyMessage",value:(B=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodemodifyMessage(t,this.currentUserId),(r=new xy(nm[nm.modifyMsg],n,t.targetId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=9,this._channel.send(r);case 9:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:yu[s]});case 14:return o=a,this._ultraMsgMap[o.messageUId]=o.timestamp,e.abrupt("return",{code:s});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"_pullUltraChangeMessageList",value:(V=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v,y,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return");case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return");case 4:if(!this._isPullingUltraChangeMessage){e.next=6;break}return e.abrupt("return");case 6:return this._isPullingUltraChangeMessage=!0,r=this._channel.codec.encodeQueryMsgChange(t),(i=new xy(nm[nm.qryMsgChange],r,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=12,this._channel.send(i,hv);case 12:if(s=e.sent,a=s.code,o=s.data,this._isPullingUltraChangeMessage=!1,a===yu.SUCCESS){e.next=18;break}return e.abrupt("return");case 18:for(p in c=(u=o||{}).hasNext,l=u.list,h=(null==o?void 0:o.syncTime)||0,f=[],d={},Array.isArray(l)&&l.forEach((function(e){var t=e.targetId,n=e.conversationType,r=e.sendTime,i=e.messageUId,s=e.changeType,a=e.operatorId,o=e.channelId||"",u=n+"_"+t,c=i+"_"+o+"_"+r,l=d[u];if(l)l.add(c);else{var h=new Set([c]);d[u]=h}3!==s?m._ultraMsgChangeMap[i]=s:f.push({targetId:t,conversationType:n,sendTime:r,messageUId:i,senderUserId:a,channelId:o})})),Array.isArray(f)&&f.length>0&&this._watcher.ultraGroupMessageRecalled(f),g=function(e){var t=e.split("_"),n=t.shift(),r=t.join("_"),i=d[e],s=[];i.forEach((function(e){var t=C(e.split("_"),3),n=t[0],r=t[1],i=t[2];s.push({sendTime:Number(i),messageUId:n,channelId:r})}));var a={targetId:r,conversationType:Number(n),messages:s};m._pullUltraMessageList(a)},d)g(p);for(y in v=this._pullUltraChangeMessageQue.filter((function(e){return e>h})),this._pullUltraChangeMessageQue.length=0,(n=this._pullUltraChangeMessageQue).push.apply(n,S(v)),this._ultraMsgMap)this._ultraMsgMap[y]<h&&delete this._ultraMsgMap[y];c?this._pullUltraChangeMessageList(h):this._lastPullingUltraChangeMessageTime=h;case 31:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"_pullUltraMessageList",value:(D=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return n=this._channel.codec.encodeMsgQuery(t),(r=new Vy(nm[nm.qryMsg],n,this.currentUserId)).setHeaderQos(og.AT_LEAST_ONCE),e.next=9,this._channel.send(r,gv);case 9:if(i=e.sent,s=i.code,a=i.data,s===yu.SUCCESS){e.next=14;break}return e.abrupt("return",{code:s,msg:yu[s]});case 14:o=(a||{}).list,u=[],c=[],Array.isArray(o)&&o.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=l._ultraGroupMap[n+"_"+t];i&&i.latestMessage.messageUId===e.messageUId&&(i.latestMessage=e);var s=l._ultraMsgChangeMap[r+""];1===s?u.push(e):2===s&&c.push(e)})),u.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(u||[]),c.length>0&&this._watcher.ultraGroupMessageModified(c||[]);case 20:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"getUltraHistoryMsg",value:(P=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return r=this._channel.codec.encodeGetHistoryMsg(t,n),i=new Vy(nm[nm.qryUgMsg],r,this.currentUserId),e.next=8,this._channel.send(i,zg,{currentUserId:this.currentUserId,conversation:{conversationType:Go.ULTRA_GROUP,targetId:t}});case 8:if(s=e.sent,a=s.code,o=s.data,a===yu.SUCCESS&&o){e.next=14;break}return su.warn("get super history message failed, code:",a,", data:",o),e.abrupt("return",{code:a});case 14:return e.abrupt("return",{code:a,data:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return P.apply(this,arguments)})},{key:"searchUltraGroupMessages",value:(x=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:if(this._status===_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.RC_NET_UNAVAILABLE});case 4:return e.abrupt("return",{code:yu.SUCCESS});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"getAllConversationState",value:function(){return Promise.resolve({code:yu.SUCCESS,data:this._conversationManager.getAllConversationState()})}},{key:"joinRTCRoom",value:(L=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return o=this._channel.codec.encodeJoinRTCRoom(n,r,i,s,a),u=new Vy(nm[nm.rtcRJoin_data],o,t),e.abrupt("return",this._channel.send(u,hp));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return L.apply(this,arguments)})},{key:"quitRTCRoom",value:(U=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Vy(nm[nm.rtcRExit],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,e.abrupt("return",s);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"rtcPing",value:(M=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Vy(nm[nm.rtcPing],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return M.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(A=o(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Vy(nm[nm.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,Ip));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(k=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Vy(nm[nm.rtcUData],n,t),e.next=6,this._channel.send(r,hp);case 6:return i=e.sent,s=i.code,a=i.data,e.abrupt("return",{code:s,data:a?{users:a.users}:a});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"setRTCUserInfo",value:(N=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new Vy(nm[nm.rtcUPut],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return N.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(O=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new xy(nm[nm.rtcUDel],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,a=s.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"setRTCData",value:(w=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeSetRTCData(n,r,i,s,a),u=new xy(nm[nm.rtcSetData],o,t),e.next=6,this._channel.send(u);case 6:return c=e.sent,l=c.code,e.abrupt("return",l);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,s){return w.apply(this,arguments)})},{key:"setRTCTotalRes",value:(b=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeUserSetRTCData(n,r,i,s),o=new Vy(nm[nm.userSetData],a,t),e.next=6,this._channel.send(o);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return b.apply(this,arguments)})},{key:"setRTCCDNUris",value:(I=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeUserSetRTCCDNUris(n,r),s=new Vy(nm[nm.userSetData],i,t),e.next=6,this._channel.send(s);case 6:return a=e.sent,o=a.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return I.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:yu.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new Vy(nm[nm.rtcQryData],i,e);return this._channel.send(s,_p)}},{key:"removeRTCData",value:(R=o(regeneratorRuntime.mark((function e(t,n,r,i,s){var a,o,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeRemoveRTCData(n,r,i,s),o=new xy(nm[nm.rtcDelData],a,t),e.next=6,this._channel.send(o);case 6:return u=e.sent,c=u.code,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return R.apply(this,arguments)})},{key:"setRTCOutData",value:function(e,t,n,r){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCOutData",value:function(e,t){throw new Error("JSEngine's method not implemented.")}},{key:"getRTCToken",value:(E=o(regeneratorRuntime.mark((function e(t,n,r){var i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Vy(nm[nm.rtcToken],i,t),e.abrupt("return",this._channel.send(s,mp));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return E.apply(this,arguments)})},{key:"setRTCState",value:(m=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new Vy(nm[nm.rtcUserState],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,a=s.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"getRTCUserInfo",value:(y=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Method not implemented.");case 1:case"end":return e.stop()}}),e)}))),function(e){return y.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:yu.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Vy(nm[nm.rtcUList],t,e);return this._channel.send(n,hp)}},{key:"joinLivingRoomAsAudience",value:(v=o(regeneratorRuntime.mark((function t(n){var r,i,s,a,o,u,c,l,h,f=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=f.length>1&&void 0!==f[1]?f[1]:e.RTCMode.LIVE,i=f.length>2?f[2]:void 0,this._channel){t.next=4;break}return t.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),a=new Vy(nm[nm.viewerJoinR],s,n),t.next=8,this._channel.send(a,Cv);case 8:if(o=t.sent,u=o.code,c=o.data,u===yu.SUCCESS){t.next=13;break}return t.abrupt("return",{code:u});case 13:return l=c.rtcToken,h=c.entries,t.abrupt("return",{code:u,data:{token:l,kvEntries:h}});case 15:case"end":return t.stop()}}),t,this)}))),function(e){return v.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(p=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Vy(nm[nm.viewerExitR],n,t),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"rtcIdentityChange",value:(g=o(regeneratorRuntime.mark((function e(t,n,r){var i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeIdentityChangeInfo(n,r),s=new Vy(nm[nm.rtcIdentityChange],i,t),e.next=6,this._channel.send(s,hp);case 6:if(a=e.sent,o=a.code,u=a.data,o===yu.SUCCESS){e.next=11;break}return e.abrupt("return",{code:o});case 11:return e.abrupt("return",{code:o,data:u});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return g.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(d=o(regeneratorRuntime.mark((function e(t,n){var r,i,s,a,o,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._channel,i=this.currentUserId,r){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return su.info("audience in room start pull KV"),s=r.codec.encodePullRTCRoomKV(t,0),a=new Vy(nm[nm.rtcPullKv],s,i),e.next=8,r.send(a,Tv);case 8:if(o=e.sent,u=o.code,c=o.data,su.info("audience in room end pull KV, code: ".concat(u,", data: ").concat(JSON.stringify(c||{}))),u!==yu.SUCCESS){e.next=16;break}return l=c.kvEntries,this._watcher.onRTCDataChange(l,t),e.abrupt("return",{code:u,data:c});case 16:return e.abrupt("return",{code:u});case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getRTCJoinedUserInfo",value:(c=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,n){e.next=3;break}return e.abrupt("return",{code:yu.RC_NET_CHANNEL_INVALID});case 3:return i=n.codec.encodeQueryUserJoinedInfo(t),s=new Vy(nm[nm.rtcQueryJoined],i,r),e.next=7,n.send(s,Iv);case 7:if(a=e.sent,o=a.code,u=a.data,o!==yu.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o,data:u});case 12:return e.abrupt("return",{code:o});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"getDeviceId",value:function(){return h_(this.runtime)}},{key:"requestRoomPK",value:(a=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeRequestRoomPK(t),r=new Vy(nm[nm.rtcInvite],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"cancelRoomPK",value:(s=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeCancelRoomPK(t),r=new Vy(nm[nm.rtcCancelInvite],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"responseRoomPK",value:(r=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeResponseRoomPK(t),r=new Vy(nm[nm.rtcInviteAnswer],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"endRoomPK",value:(n=o(regeneratorRuntime.mark((function e(t){var n,r,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._channel){e.next=2;break}return e.abrupt("return",yu.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeEndRoomPK(t),r=new Vy(nm[nm.rtcEndInvite],n,t.roomId),e.next=6,this._channel.send(r);case 6:return i=e.sent,s=i.code,this._rtcKVManager.reset(),e.abrupt("return",s);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"callExtra",value:function(e){return Promise.resolve({code:yu.EXTRA_METHOD_UNDEFINED})}},{key:"getConversationListWithAllChannel",value:function(){throw new Error("Method not implemented.")}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){throw new Error("Method not implemented.")}},{key:"clearConversations",value:function(){throw new Error("Method not implemented.")}},{key:"setUserStatusListener",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"subscribeUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"getUserStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"addToBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"removeFromBlacklist",value:function(e){throw new Error("Method not implemented.")}},{key:"getBlacklist",value:function(){throw new Error("Method not implemented.")}},{key:"getBlacklistStatus",value:function(e){throw new Error("Method not implemented.")}},{key:"insertMessage",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"deleteMessages",value:function(e){throw new Error("Method not implemented.")}},{key:"deleteMessagesByTimestamp",value:function(e,t,n,r,i){throw new Error("Method not implemented.")}},{key:"clearMessages",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"getMessage",value:function(e){throw new Error("Method not implemented.")}},{key:"setMessageContent",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"setMessageSearchField",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"searchConversationByContent",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"searchMessageByContent",value:function(e,t,n,r,i,s){throw new Error("Method not implemented.")}},{key:"getUnreadMentionedMessages",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageSentStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"setMessageReceivedStatus",value:function(e,t){throw new Error("Method not implemented.")}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n,r){throw new Error("Method not implemented.")}},{key:"getConversationNotificationStatus",value:function(e,t,n){var r=this._conversationManager.get(e,t,n);return r?Promise.resolve({code:yu.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:yu.CONVER_GET_ERROR})}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this.getHistoryMessage(e,t,n,r,i,s)}}]),qe}(dm),m_=function(){function e(t){u(this,e),this._context=t}return l(e,[{key:"__getContext",value:function(){return this._context}},{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"getCoreVersion",value:function(){return this._context.coreVersion}},{key:"getAPIVersion",value:function(){return this._context.apiVersion}},{key:"getAppkey",value:function(){return this._context.appkey}},{key:"getCurrentId",value:function(){return this._context.getCurrentUserId()}},{key:"getConnectionStatus",value:function(){return this._context.getConnectionStatus()}},{key:"getDeviceId",value:function(){return this._context.getDeviceId()}},{key:"sendMessage",value:function(e,t,n){return this._context.sendMessage(e,t,n)}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];this._context.registerMessageType(e,t,n,r)}},{key:"getServerTime",value:function(){return this._context.getServerTime()}},{key:"getRTCJoinedUserInfo",value:function(e){return this._context.getRTCJoinedUserInfo(e)}}]),e}(),__=function(e){f(n,e);var t=T(n);function n(){return u(this,n),t.apply(this,arguments)}return l(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._context.joinRTCRoom(e,t,n,r,i,s)}},{key:"quitRTCRoom",value:function(e){return this._context.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._context.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._context.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._context.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._context.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._context.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._context.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._context.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)}},{key:"setRTCCDNUris",value:function(e,t,n){return this._context.setRTCCDNUris(e,t,n)}},{key:"getRTCData",value:function(e,t,n,r){return this._context.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._context.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._context.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._context.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._context.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._context.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._context.rtcIdentityChange(e,t,n)}},{key:"requestRoomPK",value:function(e){return this._context.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._context.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._context.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._context.endRoomPK(e)}}]),n}(m_),E_=function(){function e(){u(this,e)}return l(e,null,[{key:"compress",value: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 s=[],a=[],o=function(){if(a.length>0){var e=a.join("");if(a=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);s.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);s.push(i)}s.push(e)}},u=0;u<e.length;){var c=t.indexOf(n,e,u);if(c.length<2)a.push(e.charAt(u++));else if(c.length<4)a.push(e.substr(u,c.length)),u+=c.length;else{var l=t.numberEncode(u-c.offset),h=t.numberEncode(c.length);if(l.length+h.length>=c.length)a.push(e.substr(u,c.length)),u+=c.length;else{o();var f=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);s.push(f+l+h),u+=c.length}}}o();var d=t.numberEncode(e.length),g=String.fromCharCode(t.dataType.Tail|d.length);return s.push(g+d),s.join("")}},{key:"uncompress",value:function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),s=i&t.dataType.Mark,a=15&i,o=void 0;switch(s){case t.dataType.Compressed:var u=a>>2,c=3&a;if(0===u||0===c)throw new Error("Data parsing error,at "+n);var l=t.numberDecode(e.substr(n,u)),h=t.numberDecode(e.substr(n+=u,c));if((l=r.length-l)+h>r.length)throw new Error("Data parsing error,at "+n);n+=c,r+=r.substr(l,h);break;case t.dataType.Tail:if((o=t.numberDecode(e.substr(n,a)))!==r.length)throw console.log(r.length),console.log(o),new Error("Data parsing error,at "+n);n+=a;break e;case t.dataType.NormalExt:o=t.numberDecode(e.substr(n,a)),r+=e.substr(n+=a,o),n+=o;break;case t.dataType.Normal:r+=e.substr(n,a),n+=a;break;case t.dataType.Mark:if(a>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+a),n+=16+a;break;default:throw new Error("Data parsing error,at "+n+" header:"+s)}}while(n<e.length);return r}},{key:"indexOf",value: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 s=t.length-n,a=0,o=i.length;a<o;a++){var u=i[a],c=n-u;if(!(c>this.max)){var l=Math.min(s,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var h=2,f=h;f<l&&t.charAt(u+f)===t.charAt(n+f);f++)h++;h>=r.length&&(r.length=h,r.offset=u)}}}return r}},{key:"numberEncode",value: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("")}},{key:"numberDecode",value: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}();E_.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},E_.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",E_.scale=E_.chars.length,E_.max=238327;var T_=1,R_=!1,I_="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",C_=function(){function e(t){u(this,e),this.info=t,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=t.logPolicy.url||this.logUrl,this.level=t.logPolicy.level||this.level,this.itv=t.logPolicy.itv||this.itv,this.times=t.logPolicy.times||this.times,this.deviceId=h_(t.runtime),this.logSwitch=t.logSwitch;var n=Hc(t.runtime);this.deviceInfo="".concat(n.type,"|").concat(n.version,"|").concat(iu.sessionId),this.startReport()}var t;return l(e,[{key:"startReport",value:function(){var e=this;if(this.logSwitch&&R_){var t=this.itv*Math.pow(2,T_-1);T_<this.times&&T_++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}}},{key:"reportRealtimeLog",value:function(){var e=this,t=iu.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=E_.compress(t.map((function(e){return e.content})).join("")),r="".concat(I_).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");this.info.runtime.httpReq({method:"POST",url:r,body:n}).then((function(t){su.__clearRealTimeLog(),su.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,T_=1),e.startReport()})).catch((function(t){su.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.startTime,r=t.endTime,i=t.platform,s=t.logId,a=t.uri,o=po.getInstance(),su.debug("received report log msg, ".concat(i.toLowerCase()),o),"web"===i.toLowerCase()&&o){e.next=5;break}return e.abrupt("return");case 5:if(!(n>r)){e.next=8;break}return su.warn("report error: The start time(".concat(n,") cannot be greater than the end time(").concat(n,")")),e.abrupt("return");case 8:return e.next=10,su.__insertLogIntoDatabase();case 10:return e.next=12,o.getRangeData(fo,"time",n,r);case 12:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=E_.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&R_){var t=a||h.logUrl,n="".concat(I_).concat(t,"?version=").concat(h.info.version,"&appkey=").concat(h.info.appkey,"&userId=").concat(h.info.userId,"&logId=").concat(s,"&deviceId=").concat(h.deviceId,"&deviceInfo=").concat(h.deviceInfo,"&platform=Web"),r=5e3*(l-1);l++,setTimeout((function(){R_&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){su.debug("report full log success!")})).catch((function(t){e(),su.warn("report full log error -> "+t)}))}),r)}}();case 19:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"distroy",value:function(){T_=1,R_=!1}}],[{key:"init",value:function(t){return R_=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function S_(e){return Object.assign({},e)}var b_,w_=function(){function e(t,n){var r;(u(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.2.1-alpha.3",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=_u.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,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},n),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)&&(r=this._options.navigators).push.apply(r,S(Dr));var i={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),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this)};this._engine=Kc()?new RCCppEngine(t,i,this._options):new y_(t,i,this._options)}var t,n,r,i,s,a,c,f,d,g,p,v,y,m,_,E,T,R,I,b,w,O,N,k,A,M,U,L,x,P,D,V,B,F,G,j,q,K,H,Y,Q;return l(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return su.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new __(this):new m_(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){su.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}},{key:"_handleRedirect",value:(Q=o(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return su.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:t=e.sent,(n=t.code)!==yu.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(n),setTimeout((function(){r._handleRedirect()}),5e3));case 6:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"_connectionStatusListener",value:(Y=o(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===_u.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(t),this._handleRedirect()):t===_u.BLOCKED||t===_u.KICKED_OFFLINE_BY_OTHER_CLIENT||t===_u.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(t)):t===_u.CONNECTING?this._handleConnecting():t===_u.CONNECTED?this._handleConnected():t===_u.DISCONNECTED?this._handleDisconnect(t):t===_u.NETWORK_UNAVAILABLE&&this._handleSuspend(t),this._connectionStatus=t,(null===(n=this._watcher.rtcInnerWatcher)||void 0===n?void 0:n.status)&&this._watcher.rtcInnerWatcher.status(t),this._pluginContextQueue.forEach((function(e){e.onconnectionstatechange&&e.onconnectionstatechange(t)})),this._watcher.connectionState&&this._watcher.connectionState(t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"_handleConnecting",value:function(){this._watcher.onConnecting&&this._watcher.onConnecting()}},{key:"_handleConnected",value:function(){this._watcher.onConnected&&this._watcher.onConnected()}},{key:"_handleDisconnect",value:function(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)}},{key:"_handleSuspend",value:function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)}},{key:"_messageReceiver",value:function(e,t,n){if((e.conversationType===Go.RTC_ROOM||Object.prototype.hasOwnProperty.call(Fu,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(S_(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==Ru.TYPING_STATUS||(this._addTypingInfo(S_(e)),!this._watcher.typingState))if(e.messageType!==Ru.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==Ru.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(S_(e))}catch(e){return su.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(S_(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var r,i=null===(r=e.content)||void 0===r?void 0:r.receiptMessageDic;i&&Array.isArray(i[this._engine.currentUserId])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,i[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 s,a=e.content,o=a.startTime,u=a.endTime,c=a.platform,l=a.logId,f=a.uri,d=a.packageName,g={startTime:parseInt(o),endTime:parseInt(u),platform:c,logId:l,uri:f,packageName:d};null===(s=C_.getInstance())||void 0===s||s.reportFullLog(g)}}else if("function"==typeof this._watcher.chatroomState){var p={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){p[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:p,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:h({},e.senderUserId,"RC:ChrmQuitNtf"===e.messageType?Mu.QUIT:Mu.JOIN),chatroomId:e.targetId}})}},{key:"_batchMessageReceiver",value:function(e,t,n){var r=this,i=[];e.forEach((function(e){var s=r._messageReceiver(e,t,n);s&&i.push(s)})),i.length&&this._watcher.batchMessage&&this._watcher.batchMessage(i)}},{key:"_chatroomInfoListener",value:function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)}},{key:"_conversationInfoListener",value:function(e){this._watcher.conversationState&&this._watcher.conversationState(e)}},{key:"_expansionInfoListener",value:function(e){this._watcher.expansion&&this._watcher.expansion(e)}},{key:"_tagListener",value:function(){this._watcher.tag&&this._watcher.tag()}},{key:"_conversationTagListener",value:function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()}},{key:"_typingStatusListener",value:function(e){this._watcher.typingState&&this._watcher.typingState(e)}},{key:"_pullFinishedListener",value:function(){this._watcher.pullFinished&&this._watcher.pullFinished()}},{key:"_MessageBlockedListener",value:function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)}},{key:"_ultraGroupEnableListener",value:function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)}},{key:"_operateStatusListener",value:function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)}},{key:"_ultraGroupMessageExpansionUpdatedListener",value:function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)}},{key:"_ultraGroupMessageModifiedListener",value:function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)}},{key:"_ultraGroupMessageRecalledListener",value:function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)}},{key:"_rtcDataChange",value:function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))}},{key:"assignWatcher",value: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]=Zo(r)||zo(r)?r:void 0}}))}},{key:"resetWatcher",value:function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))}},{key:"_addTypingInfo",value:function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,s=e.channelId,a=i.typingContentType,o=s||"",u="".concat(n,"#").concat(r,"#").concat(o);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===a?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:a,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())}},{key:"_startCheckTypingInfo",value: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))}},{key:"getConnectedTime",value:function(){return this._engine.getConnectedTime()}},{key:"getServerTime",value:function(){return this._engine.getServerTime()}},{key:"getDeviceId",value:function(){return this._engine.getDeviceId()}},{key:"getCurrentUserId",value:function(){return this._engine.currentUserId}},{key:"getConnectionStatus",value:function(){return this._connectionStatus}},{key:"token",get:function(){return this._token}},{key:"connect",value:(H=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>1&&void 0!==h[1]&&h[1],r=h.length>2?h[2]:void 0,this._connectionStatus!==_u.CONNECTED){e.next=4;break}return e.abrupt("return",{code:yu.SUCCESS,userId:this._engine.currentUserId});case 4:if(this._connectionStatus!==_u.CONNECTING){e.next=6;break}return e.abrupt("return",{code:yu.BIZ_ERROR_CONNECTING});case 6:if("string"==typeof t&&0!==t.length){e.next=8;break}return e.abrupt("return",{code:yu.RC_CONN_USER_OR_PASSWD_ERROR});case 8:return this._token=t,i=t.split("@"),s=C(i,2),a=s[1],o=a?a.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=13,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,n,this._options.checkCA);case 13:if(u=e.sent){e.next=16;break}return e.abrupt("return",{code:yu.RC_NAVI_RESOURCE_ERROR});case 16:if(1!==(null==u?void 0:u.type)){e.next=18;break}return e.abrupt("return",{code:yu.PACKAGE_ENVIRONMENT_ERROR});case 18:return c=Xu.getInfo(),e.next=21,this._engine.connect(this._getTokenWithoutNavi(),u,r);case 21:if(l=e.sent,su.__insertLogIntoDatabase(),l!==Eu.REDIRECT){e.next=28;break}return this._connectionStatus=_u.REDIRECT,e.next=27,this.connect(t,!0);case 27:return e.abrupt("return",e.sent);case 28:return l===yu.SUCCESS&&(su.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==u?void 0:u.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(c),C_.init({runtime:this._runtime,logSwitch:(null==u?void 0:u.logSwitch)||0,logPolicy:JSON.parse((null==u?void 0:u.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),iu.init(this._engine.currentUserId),this._isInternalConnected=!0),l!==yu.SUCCESS||Kc()||1===u.openUS&&this._pullUserSettings(),l!==yu.SUCCESS&&(this._connectionStatus=_u.CONNECTION_CLOSED),e.abrupt("return",{code:l,userId:this._engine.currentUserId});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_pullUserSettings",value:(K=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case 1:case"end":return e.stop()}}),e)}))),function(){return K.apply(this,arguments)})},{key:"disconnect",value:function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=C_.getInstance())||void 0===e||e.distroy(),su.__insertLogIntoDatabase(),iu.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){su.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(e){return this._isInternalConnected?Promise.resolve({code:yu.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)}},{key:"_getTokenWithoutNavi",value:function(){return this._token.replace(/@.+$/,"@")}},{key:"getInfoFromCache",value:function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())}},{key:"registerMessageType",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._engine.registerMessageType(e,t,n,r,i)}},{key:"sendMessage",value:function(e,t,n,r){if(e!==Go.ULTRA_GROUP){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===Ru.READ_RECEIPT_RESPONSE)return Promise.resolve({code:yu.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,o=n.expansion;if(a&&tu(o))return Promise.resolve({code:yu.BIZ_ERROR_INVALID_PARAMETER});var u=JSON.stringify(n.content);return Pi(u)>Gr?Promise.resolve({code:yu.RC_MSG_CONTENT_EXCEED_LIMIT}):e===Go.ULTRA_GROUP?this._engine.sendUltraMessage(t,n):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(q=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d,g,p,v,y;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channelId,r=t.conversationType,i=t.targetId,s=t.messageUId,a=t.keys,o=t.expansion,u=t.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:yu.MESSAGE_KV_NOT_SUPPORT});case 3:if(c=!1,l=tu(o),h=!1,!zo(o)){e.next=18;break}f=Object.keys(o).length,c=f>20,e.t0=regeneratorRuntime.keys(o);case 10:if((e.t1=e.t0()).done){e.next=18;break}if(d=e.t1.value,g=o[d],!(h=d.length>32||g.length>4096)&&!l){e.next=16;break}return e.abrupt("break",18);case 16:e.next=10;break;case 18:if(!c&&!h){e.next=20;break}return e.abrupt("return",{code:yu.EXPANSION_LIMIT_EXCEET});case 20:if(!l){e.next=22;break}return e.abrupt("return",{code:yu.BIZ_ERROR_INVALID_PARAMETER});case 22:return p={mid:s},o&&(p.put=o),a&&(p.del=a),u&&(p.removeAll=1),e.next=28,this._engine.sendMessage(r,i,{content:p,messageType:Ru.EXPANSION_NOTIFY,channelId:n});case 28:return v=e.sent,y=v.code,e.abrupt("return",{code:y});case 31:case"end":return e.stop()}}),e,this)}))),function(e){return q.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(j=o(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:yu.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"});case 4:return e.abrupt("return",this._engine.sendReadReceiptMessage(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return j.apply(this,arguments)})},{key:"getMessageReader",value:(G=o(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==((null==(i=this.getInfoFromCache())?void 0:i.grpRRVer)||0)){e.next=4;break}return e.abrupt("return",{code:yu.READ_RECEIPT_ERROR});case 4:return e.abrupt("return",this._engine.getMessageReader(t,n,r));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return G.apply(this,arguments)})},{key:"_destroy",value: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){su.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=C_.getInstance())||void 0===e||e.distroy(),iu.reset()}},{key:"getHistoryMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:20,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";if(e===Go.ULTRA_GROUP){var o={timestamp:n,count:r,order:i,channelId:s};return this._engine.getUltraHistoryMsg(t,o)}return this._engine.getHistoryMessage(e,t,n,r,i,s,a||"")}},{key:"getConversationList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(t===Go.ULTRA_GROUP){var s=yu.METHOD_NOT_SUPPORT;return Promise.resolve({code:s,msg:yu[s]})}return this._engine.getConversationList(e,t,n,r,i)}},{key:"getConversation",value:function(e,t,n){return this._engine.getConversation(e,t,n)}},{key:"removeConversation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e===Go.ULTRA_GROUP?Promise.resolve(yu.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)}},{key:"getUltraGroupList",value:function(){return this._engine.getUltraGroupList()}},{key:"getBlockUltraGroupList",value:function(){return this._engine.getBlockUltraGroupList()}},{key:"getTopUltraGroupList",value:function(){return this._engine.getTopUltraGroupList()}},{key:"clearUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e===Go.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)}},{key:"clearAllUnreadCount",value:function(){return this._engine.clearAllUnreadCount()}},{key:"getUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationUnreadCount(e,t,n)}},{key:"getTotalUnreadCount",value:function(e,t,n){if(t&&t.includes(Go.ULTRA_GROUP)){var r=yu.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:yu[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[Go.PRIVATE,Go.GROUP,Go.SYSTEM,Go.PUBLIC_SERVICE],!!n)}},{key:"getFirstUnreadMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getFirstUnreadMessage(e,t,n)}},{key:"setConversationStatus",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(e===Go.ULTRA_GROUP&&void 0!==n)return Promise.resolve(yu.METHOD_NOT_SUPPORT);var s=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(s)}},{key:"saveConversationMessageDraft",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.saveConversationMessageDraft(e,t,n,r)}},{key:"getConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationMessageDraft(e,t,n)}},{key:"clearConversationMessageDraft",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.clearConversationMessageDraft(e,t,n)}},{key:"recallMessage",value:function(e,t,n,r,i){return this._engine.recallMsg(e,t,n,r,i)}},{key:"deleteRemoteMessage",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return e===Go.ULTRA_GROUP?Promise.resolve(yu.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,r)}},{key:"deleteRemoteMessageByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)}},{key:"joinChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinChatroom(e,t)}},{key:"joinExistChatroom",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this._engine.joinExistChatroom(e,t)}},{key:"quitChatroom",value:function(e){return this._engine.quitChatroom(e)}},{key:"getChatroomInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this._engine.getChatroomInfo(e,t,n)}},{key:"setChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return Dc(n)&&Vc(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"setChatroomEntries",value:function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,s=r.value;if(!Dc(i)||!Vc(s))return Promise.resolve({code:yu.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return Dc(n)&&Vc(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return Dc(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntries",value:function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!Dc(r))return Promise.resolve({code:yu.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return Dc(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(yu.BIZ_ERROR_INVALID_PARAMETER)}},{key:"getChatroomEntry",value:function(e,t){return this._engine.getChatroomEntry(e,t)}},{key:"getAllChatroomEntries",value:function(e){return this._engine.getAllChatroomEntry(e)}},{key:"getChatroomHistoryMessages",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this._engine.getChatroomHistoryMessages(e,r,t,n)}},{key:"getFileToken",value:(F=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this.getInfoFromCache(),a=(null==s?void 0:s.bosAddr)||"",o=(null==s?void 0:s.uploadServer)||"",u=(null==s?void 0:s.ossConfig)||"",e.next=6,this._engine.getFileToken(t,n,r,i);case 6:if(c=e.sent,l=c.code,h=c.data,l!==yu.SUCCESS){e.next=11;break}return e.abrupt("return",Promise.resolve(Object.assign(h,{bos:a,qiniu:o,ossConfig:u})));case 11:return e.abrupt("return",Promise.reject(l));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return F.apply(this,arguments)})},{key:"getFileUrl",value:(B=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a,o,u,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=c.length>4&&void 0!==c[4]?c[4]:Ou.QINIU,null==i||!i.isBosRes){e.next=3;break}return e.abrupt("return",Promise.resolve(i));case 3:return e.next=5,this._engine.getFileUrl(t,s,n,r);case 5:if(a=e.sent,o=a.code,u=a.data,o!==yu.SUCCESS){e.next=10;break}return e.abrupt("return",Promise.resolve(u));case 10:return e.abrupt("return",Promise.reject(o));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return B.apply(this,arguments)})},{key:"createTag",value:(V=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.createTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"removeTag",value:(D=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"updateTag",value:(P=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.updateTag(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"getTagList",value:(x=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagList());case 1:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"addTagForConversations",value:(L=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n.length>1e3)){e.next=2;break}return e.abrupt("return",Promise.reject(yu.CONVER_OUT_LIMIT_ERROR));case 2:return e.abrupt("return",this._engine.addTagForConversations(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return L.apply(this,arguments)})},{key:"removeTagForConversations",value:(U=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagForConversations(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"removeTagsForConversation",value:(M=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeTagsForConversation(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return M.apply(this,arguments)})},{key:"getConversationListByTag",value:(A=o(regeneratorRuntime.mark((function e(t,n,r,i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getConversationListByTag(t,n,r,i));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return A.apply(this,arguments)})},{key:"getUnreadCountByTag",value:(k=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUnreadCountByTag(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(N=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setConversationStatusInTag(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return N.apply(this,arguments)})},{key:"getTagsForConversation",value:(O=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getTagsForConversation(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){return this._engine.getBlockConversationList()}},{key:"getTopConversationList",value:function(){return this._engine.getTopConversationList()}},{key:"getUnreadMentionedCount",value:function(e){return this._engine.getUnreadMentionedCount(e)}},{key:"getAllUnreadMentionedCount",value:function(){return this._engine.getAllUnreadMentionedCount()}},{key:"sendUltraGroupTypingStatus",value:function(e){if(e.conversationType!==Go.ULTRA_GROUP){var t=yu.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:yu[t]})}return this._engine.sendUltraGroupTypingStatus(e)}},{key:"getUltraGroupMessageListByMessageUId",value:function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)}},{key:"expandUltraMessage",value:(w=o(regeneratorRuntime.mark((function e(t){var n,r,i,s,a,o,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.conversationType,r=t.expansion,i=t.canIncludeExpansion,n===Go.ULTRA_GROUP){e.next=4;break}return s=yu.METHOD_ONLY_SUPPORT_ULTRA_GROUP,e.abrupt("return",{code:s,msg:yu[s]});case 4:if(i){e.next=6;break}return e.abrupt("return",{code:yu.MESSAGE_KV_NOT_SUPPORT});case 6:if(a=!1,o=tu(r),u=!1,!zo(r)){e.next=21;break}c=Object.keys(r).length,a=c>20,e.t0=regeneratorRuntime.keys(r);case 13:if((e.t1=e.t0()).done){e.next=21;break}if(l=e.t1.value,h=r[l],!(u=l.length>32||h.length>64)){e.next=19;break}return e.abrupt("break",21);case 19:e.next=13;break;case 21:if(!a&&!u){e.next=23;break}return e.abrupt("return",{code:yu.EXPANSION_LIMIT_EXCEET});case 23:if(!o){e.next=25;break}return e.abrupt("return",{code:yu.BIZ_ERROR_INVALID_PARAMETER});case 25:return e.next=27,this._engine.expandUltraMessage(t);case 27:return f=e.sent,d=f.code,e.abrupt("return",{code:d});case 30:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"modifyMessage",value:(b=o(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.conversationType===Go.ULTRA_GROUP){e.next=3;break}return n=yu.METHOD_ONLY_SUPPORT_ULTRA_GROUP,e.abrupt("return",{code:n,msg:yu[n]});case 3:return e.next=5,this._engine.modifyMessage(t);case 5:return r=e.sent,i=r.code,e.abrupt("return",{code:i});case 8:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"getUltraGroupUnreadMentionedCountByTargetId",value:function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)}},{key:"getAllConversationState",value:function(){return this._engine.getAllConversationState()}},{key:"callExtra",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,[e].concat(r))}},{key:"clearConversations",value:(I=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._engine.clearConversations(t,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"setUserStatusListener",value:function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){su.error(e)}}))}},{key:"addToBlacklist",value:(R=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.addToBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"removeFromBlacklist",value:(T=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.removeFromBlacklist(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"getBlacklist",value:(E=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklist());case 1:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"getBlacklistStatus",value:(_=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getBlacklistStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"insertMessage",value:(m=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.insertMessage(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return m.apply(this,arguments)})},{key:"deleteMessages",value:(y=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.deleteMessages(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"deleteMessagesByTimestamp",value:(v=o(regeneratorRuntime.mark((function e(t,n,r,i){var s,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=a.length>4&&void 0!==a[4]?a[4]:"",e.abrupt("return",this._engine.deleteMessagesByTimestamp(t,n,r,i,s));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return v.apply(this,arguments)})},{key:"clearMessages",value:(p=o(regeneratorRuntime.mark((function e(t,n){var r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>2&&void 0!==i[2]?i[2]:"",e.abrupt("return",this._engine.clearMessages(t,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"getMessage",value:(g=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getMessage(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"setMessageContent",value:(d=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageContent(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"setMessageSearchField",value:(f=o(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSearchField(t,n,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return f.apply(this,arguments)})},{key:"setMessageSentStatus",value:(c=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageSentStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"setMessageReceivedStatus",value:(a=o(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setMessageReceivedStatus(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"setUserStatus",value:(s=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.setUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"subscribeUserStatus",value:(i=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.subscribeUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getUserStatus",value:(r=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._engine.getUserStatus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"searchConversationByContent",value:(n=o(regeneratorRuntime.mark((function e(t){var n,r,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:[],r=s.length>2&&void 0!==s[2]?s[2]:"",i=s.length>3?s[3]:void 0,e.abrupt("return",this._engine.searchConversationByContent(t,n,r,i));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"searchMessageByContent",value:(t=o(regeneratorRuntime.mark((function e(t,n,r,i,s,a){var o,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=u.length>6&&void 0!==u[6]?u[6]:"",e.abrupt("return",this._engine.searchMessageByContent(t,n,r,i,s,a,o));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i,s,a){return t.apply(this,arguments)})},{key:"getUnreadMentionedMessages",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getUnreadMentionedMessages(e,t,n)}},{key:"clearUnreadCountByTimestamp",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return this._engine.clearUnreadCountByTimestamp(e,t,n,r)}},{key:"getConversationNotificationStatus",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._engine.getConversationNotificationStatus(e,t,n)}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,s)}},{key:"getConversationListWithAllChannel",value:function(){return this._engine.getConversationListWithAllChannel()}},{key:"getConversationListWithAllChannelByPage",value:function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)}},{key:"joinRTCRoom",value:function(e,t,n,r,i,s){return this._engine.joinRTCRoom(e,t,n,r,i,s)}},{key:"quitRTCRoom",value:function(e){return this._engine.quitRTCRoom(e)}},{key:"rtcPing",value:function(e,t,n){return this._engine.rtcPing(e,t,n)}},{key:"getRTCRoomInfo",value:function(e){return this._engine.getRTCRoomInfo(e)}},{key:"getRTCUserInfoList",value:function(e){return this._engine.getRTCUserInfoList(e)}},{key:"getRTCUserInfo",value:function(e){return this._engine.getRTCUserInfo(e)}},{key:"setRTCUserInfo",value:function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)}},{key:"removeRTCUserInfo",value:function(e,t){return this._engine.removeRTCUserInfo(e,t)}},{key:"setRTCData",value:function(e,t,n,r,i,s){return this._engine.setRTCData(e,t,n,r,i,s)}},{key:"setRTCTotalRes",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return this._engine.setRTCTotalRes(e,t,n,r,i)}},{key:"setRTCCDNUris",value:function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)}},{key:"getRTCData",value:function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)}},{key:"removeRTCData",value:function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)}},{key:"setRTCOutData",value:function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)}},{key:"getRTCOutData",value:function(e,t){return this._engine.getRTCOutData(e,t)}},{key:"getRTCToken",value:function(e,t,n){return this._engine.getRTCToken(e,t,n)}},{key:"setRTCState",value:function(e,t){return this._engine.setRTCState(e,t)}},{key:"getRTCUserList",value:function(e){return this._engine.getRTCUserList(e)}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)}},{key:"quitLivingRoomAsAudience",value:function(e){return this._engine.quitLivingRoomAsAudience(e)}},{key:"rtcIdentityChange",value:function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)}},{key:"getRTCJoinedUserInfo",value:function(e){return this._engine.getRTCJoinedUserInfo(e)}},{key:"requestRoomPK",value:function(e){return this._engine.requestRoomPK(e)}},{key:"cancelRoomPK",value:function(e){return this._engine.cancelRoomPK(e)}},{key:"responseRoomPK",value:function(e){return this._engine.responseRoomPK(e)}},{key:"endRoomPK",value:function(e){return this._engine.endRoomPK(e)}}],[{key:"init",value:function(t,n){return su.setLogLevel(n.logLevel),su.setLogStdout(n.logStdout),(n.indexDBSwitch||Xo(n.indexDBSwitch))&&po.init(),su.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(su.error("Repeat initialize!"),this._context):(su.warn("RCEngine Commit:","39f5d0951d0770155a526688840b2a91e1f0786f"),this._context=new e(t,n),su.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(b_=e.TagChangeType||(e.TagChangeType={}))[b_.add=1]="add",b_[b_.update=2]="update",b_[b_.delete=3]="delete";e.AEngine=dm,e.ANavi=_m,e.APIContext=w_,e.AppStorage=Qr,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=Fu,e.ChatroomEntryType=ku,e.ChatroomMemberChangeType=Mu,e.CometChannel=fm,e.ConnectResultCode=Eu,e.ConnectionStatus=_u,e.ConversationType=Go,e.DelayTimer=zc,e.ErrorCode=yu,e.EventEmitter=du,e.FileType=qo,e.IM_COMET_PULLMSG_TIMEOUT=45e3,e.IM_PING_INTERVAL_TIME=15e3,e.IM_PING_MIN_TIMEOUT=2e3,e.IM_PING_TIMEOUT=15e3,e.IM_SIGNAL_TIMEOUT=Fr,e.Logger=iu,e.MAX_MESSAGE_CONTENT_BYTES=Gr,e.MINI_COMET_CONNECT_URIS=Br,e.MINI_SOCKET_CONNECT_URIS=Vr,e.MentionedType=bu,e.MessageBlockType=Pu,e.MessageDirection=pu,e.MessageType=Ru,e.NAVI_CACHE_DURATION=Lr,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=Cu,e.PING_REQ_TIMEOUT=xr,e.PUBLIC_CLOUD_NAVI_URIS=Dr,e.PluginContext=m_,e.RCAssertError=ec,e.RTCPluginContext=__,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=qr,e.STATUS_MESSAGE=Kr,e.STORAGE_ROOT_KEY=jr,e.UploadMethod=Ou,e.VersionManage=Xu,e.WEB_SOCKET_TIMEOUT=Pr,e.WebSocketChannel=lm,e.appendUrl=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},e.assert=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!tc(e,t,n,r))throw new ec("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.clone=Wc,e.cloneByJSON=qc,e.forEach=Bc,e.formatConnectResponseCode=Yc,e.getBrowser=Hc,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case qo.IMAGE:t="image/jpeg";break;case qo.AUDIO:t="audio/amr";break;case qo.VIDEO:t="video/3gpp";break;case qo.SIGHT:t="video/mpeg4";break;case qo.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=Lc,e.indexOf=Gc,e.isArray=Qo,e.isArrayBuffer=Wo,e.isBoolean=Ho,e.isFunction=Zo,e.isHttpUrl=function(e){return Ko(e)&&/https?:\/\//.test(e)},e.isInObject=jc,e.isInclude=function(e,t){return-1!==Gc(e,t)},e.isNull=$o,e.isNumber=Yo,e.isObject=zo,e.isString=Ko,e.isUndefined=Xo,e.isValidChrmEntryKey=Dc,e.isValidChrmEntryValue=Vc,e.isValidConversationType=function(e){return Yo(e)&&Object.prototype.hasOwnProperty.call(Go,e)},e.isValidExpansion=tu,e.isValidFileType=function(e){return Yo(e)&&Object.prototype.hasOwnProperty.call(qo,e)},e.map=Fc,e.notEmptyArray=function(e){return Qo(e)&&e.length>0},e.notEmptyObject=eu,e.notEmptyString=Jo,e.pushConfigsToJSON=xc,e.pushJSONToConfigs=Pc,e.todo=function(e){return new Wr(e)},e.usingCppEngine=Kc,e.validate=tc,e.version="5.2.1-alpha.3",Object.defineProperty(e,"__esModule",{value:!0})}));