@rongcloud/engine 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -7
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
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,r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){var t={exports:{}};return e(t,t.exports),t.exports}var s=function(e){return e&&e.Math==Math&&e},o=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s("object"==typeof r&&r)||function(){return this}()||Function("return this")(),a=function(e){try{return!!e()}catch(e){return!0}},u=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,h={f:l&&!c.call({1:2},1)?function(e){var t=l(this,e);return!!t&&t.enumerable}:c},f=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},d={}.toString,p=function(e){return d.call(e).slice(8,-1)},v="".split,y=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==p(e)?v.call(e,""):Object(e)}:Object,m=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},_=function(e){return y(m(e))},E=function(e){return"object"==typeof e?null!==e:"function"==typeof e},R=function(e,t){if(!E(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!E(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},T=function(e){return Object(m(e))},I={}.hasOwnProperty,C=function(e,t){return I.call(T(e),t)},S=o.document,b=E(S)&&E(S.createElement),w=function(e){return b?S.createElement(e):{}},N=!u&&!a((function(){return 7!=Object.defineProperty(w("div"),"a",{get:function(){return 7}}).a})),O=Object.getOwnPropertyDescriptor,k={f:u?O:function(e,t){if(e=_(e),t=R(t,!0),N)try{return O(e,t)}catch(e){}if(C(e,t))return f(!h.f.call(e,t),e[t])}},A=function(e){if(!E(e))throw TypeError(String(e)+" is not an object");return e},M=Object.defineProperty,L={f:u?M:function(e,t,n){if(A(e),t=R(t,!0),A(n),N)try{return M(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},U=u?function(e,t,n){return L.f(e,t,f(1,n))}:function(e,t,n){return e[t]=n,e},x=function(e,t){try{U(o,e,t)}catch(n){o[e]=t}return t},P="__core-js_shared__",D=o[P]||x(P,{}),V=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(e){return V.call(e)});var B,F,j,K=D.inspectSource,q=o.WeakMap,Y="function"==typeof q&&/native code/.test(K(q)),H=i((function(e){(e.exports=function(e,t){return D[e]||(D[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.11.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),G=0,W=Math.random(),Q=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++G+W).toString(36)},J=H("keys"),z=function(e){return J[e]||(J[e]=Q(e))},Z={},X="Object already initialized",$=o.WeakMap;if(Y){var ee=D.state||(D.state=new $),te=ee.get,ne=ee.has,re=ee.set;B=function(e,t){if(ne.call(ee,e))throw new TypeError(X);return t.facade=e,re.call(ee,e,t),t},F=function(e){return te.call(ee,e)||{}},j=function(e){return ne.call(ee,e)}}else{var ie=z("state");Z[ie]=!0,B=function(e,t){if(C(e,ie))throw new TypeError(X);return t.facade=e,U(e,ie,t),t},F=function(e){return C(e,ie)?e[ie]:{}},j=function(e){return C(e,ie)}}var se={set:B,get:F,has:j,enforce:function(e){return j(e)?F(e):B(e,{})},getterFor:function(e){return function(t){var n;if(!E(t)||(n=F(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},oe=i((function(e){var t=se.get,n=se.enforce,r=String(String).split("String");(e.exports=function(e,t,i,s){var a,u=!!s&&!!s.unsafe,c=!!s&&!!s.enumerable,l=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof t||C(i,"name")||U(i,"name",t),(a=n(i)).source||(a.source=r.join("string"==typeof t?t:""))),e!==o?(u?!l&&e[t]&&(c=!0):delete e[t],c?e[t]=i:U(e,t,i)):c?e[t]=i:x(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||K(this)}))})),ae=o,ue=function(e){return"function"==typeof e?e:void 0},ce=function(e,t){return arguments.length<2?ue(ae[e])||ue(o[e]):ae[e]&&ae[e][t]||o[e]&&o[e][t]},le=Math.ceil,he=Math.floor,fe=function(e){return isNaN(e=+e)?0:(e>0?he:le)(e)},de=Math.min,ge=function(e){return e>0?de(fe(e),9007199254740991):0},pe=Math.max,ve=Math.min,ye=function(e,t){var n=fe(e);return n<0?pe(n+t,0):ve(n,t)},me=function(e){return function(t,n,r){var i,s=_(t),o=ge(s.length),a=ye(r,o);if(e&&n!=n){for(;o>a;)if((i=s[a++])!=i)return!0}else for(;o>a;a++)if((e||a in s)&&s[a]===n)return e||a||0;return!e&&-1}},_e={includes:me(!0),indexOf:me(!1)},Ee=_e.indexOf,Re=function(e,t){var n,r=_(e),i=0,s=[];for(n in r)!C(Z,n)&&C(r,n)&&s.push(n);for(;t.length>i;)C(r,n=t[i++])&&(~Ee(s,n)||s.push(n));return s},Te=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ie=Te.concat("length","prototype"),Ce={f:Object.getOwnPropertyNames||function(e){return Re(e,Ie)}},Se={f:Object.getOwnPropertySymbols},be=ce("Reflect","ownKeys")||function(e){var t=Ce.f(A(e)),n=Se.f;return n?t.concat(n(e)):t},we=function(e,t){for(var n=be(t),r=L.f,i=k.f,s=0;s<n.length;s++){var o=n[s];C(e,o)||r(e,o,i(t,o))}},Ne=/#|\.prototype\./,Oe=function(e,t){var n=Ae[ke(e)];return n==Le||n!=Me&&("function"==typeof t?a(t):!!t)},ke=Oe.normalize=function(e){return String(e).replace(Ne,".").toLowerCase()},Ae=Oe.data={},Me=Oe.NATIVE="N",Le=Oe.POLYFILL="P",Ue=Oe,xe=k.f,Pe=function(e,t){var n,r,i,s,a,u=e.target,c=e.global,l=e.stat;if(n=c?o:l?o[u]||x(u,{}):(o[u]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=xe(n,r))&&a.value:n[r],!Ue(c?r:u+(l?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;we(s,i)}(e.sham||i&&i.sham)&&U(s,"sham",!0),oe(n,r,s,e)}},De=function(){var e=A(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};function Ve(e,t){return RegExp(e,t)}var Be={UNSUPPORTED_Y:a((function(){var e=Ve("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:a((function(){var e=Ve("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},Fe=RegExp.prototype.exec,je=H("native-string-replace",String.prototype.replace),Ke=Fe,qe=function(){var e=/a/,t=/b*/g;return Fe.call(e,"a"),Fe.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ye=Be.UNSUPPORTED_Y||Be.BROKEN_CARET,He=void 0!==/()??/.exec("")[1];(qe||He||Ye)&&(Ke=function(e){var t,n,r,i,s=this,o=Ye&&s.sticky,a=De.call(s),u=s.source,c=0,l=e;return o&&(-1===(a=a.replace("y","")).indexOf("g")&&(a+="g"),l=String(e).slice(s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==e[s.lastIndex-1])&&(u="(?: "+u+")",l=" "+l,c++),n=new RegExp("^(?:"+u+")",a)),He&&(n=new RegExp("^"+u+"$(?!\\s)",a)),qe&&(t=s.lastIndex),r=Fe.call(o?n:s,l),o?r?(r.input=r.input.slice(c),r[0]=r[0].slice(c),r.index=s.lastIndex,s.lastIndex+=r[0].length):s.lastIndex=0:qe&&r&&(s.lastIndex=s.global?r.index+r[0].length:t),He&&r&&r.length>1&&je.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var Ge=Ke;Pe({target:"RegExp",proto:!0,forced:/./.exec!==Ge},{exec:Ge});var We,Qe,Je="process"==p(o.process),ze=ce("navigator","userAgent")||"",Ze=o.process,Xe=Ze&&Ze.versions,$e=Xe&&Xe.v8;$e?Qe=(We=$e.split("."))[0]+We[1]:ze&&(!(We=ze.match(/Edge\/(\d+)/))||We[1]>=74)&&(We=ze.match(/Chrome\/(\d+)/))&&(Qe=We[1]);var et=Qe&&+Qe,tt=!!Object.getOwnPropertySymbols&&!a((function(){return!Symbol.sham&&(Je?38===et:et>37&&et<41)})),nt=tt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rt=H("wks"),it=o.Symbol,st=nt?it:it&&it.withoutSetter||Q,ot=function(e){return C(rt,e)&&(tt||"string"==typeof rt[e])||(tt&&C(it,e)?rt[e]=it[e]:rt[e]=st("Symbol."+e)),rt[e]},at=ot("species"),ut=!a((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),ct="$0"==="a".replace(/./,"$0"),lt=ot("replace"),ht=!!/./[lt]&&""===/./[lt]("a","$0"),ft=!a((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]})),dt=function(e,t,n,r){var i=ot(e),s=!a((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=s&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[at]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!s||!o||"replace"===e&&(!ut||!ct||ht)||"split"===e&&!ft){var u=/./[i],c=n(i,""[e],(function(e,t,n,r,i){return t.exec===RegExp.prototype.exec?s&&!i?{done:!0,value:u.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:ct,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:ht}),l=c[0],h=c[1];oe(String.prototype,e,l),oe(RegExp.prototype,i,2==t?function(e,t){return h.call(e,this,t)}:function(e){return h.call(e,this)})}r&&U(RegExp.prototype[i],"sham",!0)},gt=function(e){return function(t,n){var r,i,s=String(m(t)),o=fe(n),a=s.length;return o<0||o>=a?e?"":void 0:(r=s.charCodeAt(o))<55296||r>56319||o+1===a||(i=s.charCodeAt(o+1))<56320||i>57343?e?s.charAt(o):r:e?s.slice(o,o+2):i-56320+(r-55296<<10)+65536}},pt={codeAt:gt(!1),charAt:gt(!0)},vt=pt.charAt,yt=function(e,t,n){return t+(n?vt(e,t).length:1)},mt=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==p(e))throw TypeError("RegExp#exec called on incompatible receiver");return Ge.call(e,t)};function _t(e){return(_t="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})(e)}function Et(e,t,n,r,i,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,i)}function Rt(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){Et(s,r,i,o,a,"next",e)}function a(e){Et(s,r,i,o,a,"throw",e)}o(void 0)}))}}function Tt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(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 Ct(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bt(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 wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bt(Object(n),!0).forEach((function(t){St(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nt(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}}),t&&kt(e,t)}function Ot(e){return(Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function kt(e,t){return(kt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function At(){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 Mt(e,t,n){return(Mt=At()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&kt(i,n.prototype),i}).apply(null,arguments)}function Lt(e){var t="function"==typeof Map?new Map:void 0;return(Lt=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 Mt(e,arguments,Ot(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),kt(r,e)})(e)}function Ut(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Ut(e):t}function Pt(e){var t=At();return function(){var n,r=Ot(e);if(t){var i=Ot(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xt(this,n)}}function Dt(e,t,n){return(Dt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ot(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,s=[],o=!0,a=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);o=!0);}catch(e){a=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(a)throw i}}return s}(e,t)||Ft(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 Bt(e){return function(e){if(Array.isArray(e))return jt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ft(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 Ft(e,t){if(e){if("string"==typeof e)return jt(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)?jt(e,t):void 0}}function jt(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}dt("match",1,(function(e,t,n){return[function(t){var n=m(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=A(e),s=String(this);if(!i.global)return mt(i,s);var o=i.unicode;i.lastIndex=0;for(var a,u=[],c=0;null!==(a=mt(i,s));){var l=String(a[0]);u[c]=l,""===l&&(i.lastIndex=yt(s,ge(i.lastIndex),o)),c++}return 0===c?null:u}]}));var Kt=Array.isArray||function(e){return"Array"==p(e)},qt=function(e,t,n){var r=R(t);r in e?L.f(e,r,f(0,n)):e[r]=n},Yt=ot("species"),Ht=function(e,t){var n;return Kt(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Kt(n.prototype)?E(n)&&null===(n=n[Yt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Gt=ot("species"),Wt=function(e){return et>=51||!a((function(){var t=[];return(t.constructor={})[Gt]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Qt=ot("isConcatSpreadable"),Jt=9007199254740991,zt="Maximum allowed index exceeded",Zt=et>=51||!a((function(){var e=[];return e[Qt]=!1,e.concat()[0]!==e})),Xt=Wt("concat"),$t=function(e){if(!E(e))return!1;var t=e[Qt];return void 0!==t?!!t:Kt(e)};Pe({target:"Array",proto:!0,forced:!Zt||!Xt},{concat:function(e){var t,n,r,i,s,o=T(this),a=Ht(o,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if($t(s=-1===t?o:arguments[t])){if(u+(i=ge(s.length))>Jt)throw TypeError(zt);for(n=0;n<i;n++,u++)n in s&&qt(a,u,s[n])}else{if(u>=Jt)throw TypeError(zt);qt(a,u++,s)}return a.length=u,a}});var en,tn,nn=72e5,rn=5e3,sn=5e3,on=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],an=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],un=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],cn=3e4,ln=131072,hn="RCV4-",fn={"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}},dn=["RC:TypSts","RC:InterceptMsg"];e.CONNECTION_TYPE=void 0,(en=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",en.COMET="comet";var gn=function(e){return tn||(tn={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}}),tn},pn=function(){function e(t){Tt(this,e),this._caches={},t&&(this._caches=t)}return Ct(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}(),vn=function(){function e(t,n){Tt(this,e);var r=n?"".concat(hn).concat(n):hn;this._rootStorage=gn(t);var i=this._rootStorage.get(r)||{};this._cache=new pn(St({},r,i)),this._storageKey=r}return Ct(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}(),yn=function(e){Nt(n,e);var t=Pt(n);function n(e){return Tt(this,n),t.call(this,"TODO => ".concat(e))}return n}(Lt(Error)),mn=Wt("slice"),_n=ot("species"),En=[].slice,Rn=Math.max;Pe({target:"Array",proto:!0,forced:!mn},{slice:function(e,t){var n,r,i,s=_(this),o=ge(s.length),a=ye(e,o),u=ye(void 0===t?o:t,o);if(Kt(s)&&("function"!=typeof(n=s.constructor)||n!==Array&&!Kt(n.prototype)?E(n)&&null===(n=n[_n])&&(n=void 0):n=void 0,n===Array||void 0===n))return En.call(s,a,u);for(r=new(void 0===n?Array:n)(Rn(u-a,0)),i=0;a<u;a++,i++)a in s&&qt(r,i,s[a]);return r.length=i,r}});var Tn=Math.floor,In="".replace,Cn=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Sn=/\$([$&'`]|\d{1,2})/g,bn=function(e,t,n,r,i,s){var o=n+e.length,a=r.length,u=Sn;return void 0!==i&&(i=T(i),u=Cn),In.call(s,u,(function(s,u){var c;switch(u.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(o);case"<":c=i[u.slice(1,-1)];break;default:var l=+u;if(0===l)return s;if(l>a){var h=Tn(l/10);return 0===h?s:h<=a?void 0===r[h-1]?u.charAt(1):r[h-1]+u.charAt(1):s}c=r[l-1]}return void 0===c?"":c}))},wn=Math.max,Nn=Math.min;dt("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,s=r.REPLACE_KEEPS_$0,o=i?"$":"$0";return[function(n,r){var i=m(this),s=null==n?void 0:n[e];return void 0!==s?s.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!i&&s||"string"==typeof r&&-1===r.indexOf(o)){var a=n(t,e,this,r);if(a.done)return a.value}var u=A(e),c=String(this),l="function"==typeof r;l||(r=String(r));var h=u.global;if(h){var f=u.unicode;u.lastIndex=0}for(var d=[];;){var g=mt(u,c);if(null===g)break;if(d.push(g),!h)break;""===String(g[0])&&(u.lastIndex=yt(c,ge(u.lastIndex),f))}for(var p,v="",y=0,m=0;m<d.length;m++){g=d[m];for(var _=String(g[0]),E=wn(Nn(fe(g.index),c.length),0),R=[],T=1;T<g.length;T++)R.push(void 0===(p=g[T])?p:String(p));var I=g.groups;if(l){var C=[_].concat(R,E,c);void 0!==I&&C.push(I);var S=String(r.apply(void 0,C))}else S=bn(_,c,E,R,I,r);E>=y&&(v+=c.slice(y,E)+S,y=E+_.length)}return v+c.slice(y)}]}));var On=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},kn=function(e,t,n){if(On(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},An=[].push,Mn=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,o=7==e,a=5==e||s;return function(u,c,l,h){for(var f,d,g=T(u),p=y(g),v=kn(c,l,3),m=ge(p.length),_=0,E=h||Ht,R=t?E(u,m):n||o?E(u,0):void 0;m>_;_++)if((a||_ in p)&&(d=v(f=p[_],_,g),e))if(t)R[_]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return _;case 2:An.call(R,f)}else switch(e){case 4:return!1;case 7:An.call(R,f)}return s?-1:r||i?i:R}},Ln={forEach:Mn(0),map:Mn(1),filter:Mn(2),some:Mn(3),every:Mn(4),find:Mn(5),findIndex:Mn(6),filterOut:Mn(7)},Un=Ln.filter,xn=Wt("filter");Pe({target:"Array",proto:!0,forced:!xn},{filter:function(e){return Un(this,e,arguments.length>1?arguments[1]:void 0)}});var Pn=Ln.map,Dn=Wt("map");Pe({target:"Array",proto:!0,forced:!Dn},{map:function(e){return Pn(this,e,arguments.length>1?arguments[1]:void 0)}});var Vn=Object.keys||function(e){return Re(e,Te)},Bn=a((function(){Vn(1)}));Pe({target:"Object",stat:!0,forced:Bn},{keys:function(e){return Vn(T(e))}});var Fn=function(e,t){var n=[][e];return!!n&&a((function(){n.call(null,t||function(){throw 1},1)}))},jn=[].join,Kn=y!=Object,qn=Fn("join",",");Pe({target:"Array",proto:!0,forced:Kn||!qn},{join:function(e){return jn.call(_(this),void 0===e?",":e)}});var Yn=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()}))},Hn=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 o=0,a=e.length;o<a;o++)r+=(t=e.charCodeAt(o))<127?1:t<=2047?2:t<=65535?3:4;return r},Gn=function(e){return e.match(/\d+(\.\d+){2}/)[0]};i((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=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),o=new N(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 o=n.delegate;if(o){var a=S(o,n);if(a){if(a===p)continue;return a}}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,o),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 _={};_[s]=function(){return this};var E=Object.getPrototypeOf,R=E&&E(E(O([])));R&&R!==n&&r.call(R,s)&&(_=R);var T=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,o,a){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,o,a)}),(function(e){n("throw",e,o,a)})):t.resolve(h).then((function(e){c.value=e,o(c)}),(function(e){return n("throw",e,o,a)}))}a(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 N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function O(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,o=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 o.next=o}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=T.constructor=m,m.constructor=y,y.displayName=u(m,a,"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,a,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},I(C.prototype),C.prototype[o]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,r,i,s){void 0===s&&(s=Promise);var o=new C(c(t,n,r,i),s);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},I(T),u(T,a,"Generator"),T[s]=function(){return this},T.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=O,N.prototype={constructor:N,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 a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.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 o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(o)},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:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));var Wn=L.f,Qn=Function.prototype,Jn=Qn.toString,zn=/^\s*function ([^ (]*)/,Zn="name";u&&!(Zn in Qn)&&Wn(Qn,Zn,{configurable:!0,get:function(){try{return Jn.call(this).match(zn)[1]}catch(e){return""}}});var Xn,$n=u?Object.defineProperties:function(e,t){A(e);for(var n,r=Vn(t),i=r.length,s=0;i>s;)L.f(e,n=r[s++],t[n]);return e},er=ce("document","documentElement"),tr=z("IE_PROTO"),nr=function(){},rr=function(e){return"<script>"+e+"</"+"script>"},ir=function(){try{Xn=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;ir=Xn?function(e){e.write(rr("")),e.close();var t=e.parentWindow.Object;return e=null,t}(Xn):((t=w("iframe")).style.display="none",er.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(rr("document.F=Object")),e.close(),e.F);for(var n=Te.length;n--;)delete ir.prototype[Te[n]];return ir()};Z[tr]=!0;var sr=Object.create||function(e,t){var n;return null!==e?(nr.prototype=A(e),n=new nr,nr.prototype=null,n[tr]=e):n=ir(),void 0===t?n:$n(n,t)},or=ot("unscopables"),ar=Array.prototype;null==ar[or]&&L.f(ar,or,{configurable:!0,value:sr(null)});var ur,cr,lr=function(e){ar[or][e]=!0},hr=_e.includes;Pe({target:"Array",proto:!0},{includes:function(e){return hr(this,e,arguments.length>1?arguments[1]:void 0)}}),lr("includes"),e.LogLevel=void 0,(ur=e.LogLevel||(e.LogLevel={}))[ur.LOG=0]="LOG",ur[ur.DEBUG=0]="DEBUG",ur[ur.INFO=1]="INFO",ur[ur.WARN=2]="WARN",ur[ur.ERROR=3]="ERROR",ur[ur.FATAL=4]="FATAL",ur[ur.NONE=1e3]="NONE",e.LogType=void 0,(cr=e.LogType||(e.LogType={})).IM="IM",cr.RTC="RTC";var fr={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},dr=Ln.forEach,gr=Fn("forEach")?[].forEach:function(e){return dr(this,e,arguments.length>1?arguments[1]:void 0)};for(var pr in fr){var vr=o[pr],yr=vr&&vr.prototype;if(yr&&yr.forEach!==gr)try{U(yr,"forEach",gr)}catch(e){yr.forEach=gr}}var mr={};mr[ot("toStringTag")]="z";var _r="[object z]"===String(mr),Er=ot("toStringTag"),Rr="Arguments"==p(function(){return arguments}()),Tr=_r?p: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=Object(e),Er))?n:Rr?p(t):"Object"==(r=p(t))&&"function"==typeof t.callee?"Arguments":r},Ir=_r?{}.toString:function(){return"[object "+Tr(this)+"]"};_r||oe(Object.prototype,"toString",Ir,{unsafe:!0});var Cr=o.Promise,Sr=function(e,t,n){for(var r in t)oe(e,r,t[r],n);return e},br=L.f,wr=ot("toStringTag"),Nr=function(e,t,n){e&&!C(e=n?e:e.prototype,wr)&&br(e,wr,{configurable:!0,value:t})},Or=ot("species"),kr=function(e){var t=ce(e),n=L.f;u&&t&&!t[Or]&&n(t,Or,{configurable:!0,get:function(){return this}})},Ar=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Mr={},Lr=ot("iterator"),Ur=Array.prototype,xr=function(e){return void 0!==e&&(Mr.Array===e||Ur[Lr]===e)},Pr=ot("iterator"),Dr=function(e){if(null!=e)return e[Pr]||e["@@iterator"]||Mr[Tr(e)]},Vr=function(e){var t=e.return;if(void 0!==t)return A(t.call(e)).value},Br=function(e,t){this.stopped=e,this.result=t},Fr=function(e,t,n){var r,i,s,o,a,u,c,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=kn(t,l,1+h+d),p=function(e){return r&&Vr(r),new Br(!0,e)},v=function(e){return h?(A(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("function"!=typeof(i=Dr(e)))throw TypeError("Target is not iterable");if(xr(i)){for(s=0,o=ge(e.length);o>s;s++)if((a=v(e[s]))&&a instanceof Br)return a;return new Br(!1)}r=i.call(e)}for(u=r.next;!(c=u.call(r)).done;){try{a=v(c.value)}catch(e){throw Vr(r),e}if("object"==typeof a&&a&&a instanceof Br)return a}return new Br(!1)},jr=ot("iterator"),Kr=!1;try{var qr=0,Yr={next:function(){return{done:!!qr++}},return:function(){Kr=!0}};Yr[jr]=function(){return this},Array.from(Yr,(function(){throw 2}))}catch(e){}var Hr,Gr,Wr,Qr=function(e,t){if(!t&&!Kr)return!1;var n=!1;try{var r={};r[jr]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Jr=ot("species"),zr=function(e,t){var n,r=A(e).constructor;return void 0===r||null==(n=A(r)[Jr])?t:On(n)},Zr=/(?:iphone|ipod|ipad).*applewebkit/i.test(ze),Xr=o.location,$r=o.setImmediate,ei=o.clearImmediate,ti=o.process,ni=o.MessageChannel,ri=o.Dispatch,ii=0,si={},oi="onreadystatechange",ai=function(e){if(si.hasOwnProperty(e)){var t=si[e];delete si[e],t()}},ui=function(e){return function(){ai(e)}},ci=function(e){ai(e.data)},li=function(e){o.postMessage(e+"",Xr.protocol+"//"+Xr.host)};$r&&ei||($r=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return si[++ii]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Hr(ii),ii},ei=function(e){delete si[e]},Je?Hr=function(e){ti.nextTick(ui(e))}:ri&&ri.now?Hr=function(e){ri.now(ui(e))}:ni&&!Zr?(Wr=(Gr=new ni).port2,Gr.port1.onmessage=ci,Hr=kn(Wr.postMessage,Wr,1)):o.addEventListener&&"function"==typeof postMessage&&!o.importScripts&&Xr&&"file:"!==Xr.protocol&&!a(li)?(Hr=li,o.addEventListener("message",ci,!1)):Hr=oi in w("script")?function(e){er.appendChild(w("script")).onreadystatechange=function(){er.removeChild(this),ai(e)}}:function(e){setTimeout(ui(e),0)});var hi,fi,di,gi,pi,vi,yi,mi,_i={set:$r,clear:ei},Ei=/web0s(?!.*chrome)/i.test(ze),Ri=k.f,Ti=_i.set,Ii=o.MutationObserver||o.WebKitMutationObserver,Ci=o.document,Si=o.process,bi=o.Promise,wi=Ri(o,"queueMicrotask"),Ni=wi&&wi.value;Ni||(hi=function(){var e,t;for(Je&&(e=Si.domain)&&e.exit();fi;){t=fi.fn,fi=fi.next;try{t()}catch(e){throw fi?gi():di=void 0,e}}di=void 0,e&&e.enter()},Zr||Je||Ei||!Ii||!Ci?bi&&bi.resolve?(yi=bi.resolve(void 0),mi=yi.then,gi=function(){mi.call(yi,hi)}):gi=Je?function(){Si.nextTick(hi)}:function(){Ti.call(o,hi)}:(pi=!0,vi=Ci.createTextNode(""),new Ii(hi).observe(vi,{characterData:!0}),gi=function(){vi.data=pi=!pi}));var Oi,ki,Ai,Mi,Li=Ni||function(e){var t={fn:e,next:void 0};di&&(di.next=t),fi||(fi=t,gi()),di=t},Ui=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=On(t),this.reject=On(n)},xi={f:function(e){return new Ui(e)}},Pi=function(e,t){if(A(e),E(t)&&t.constructor===e)return t;var n=xi.f(e);return(0,n.resolve)(t),n.promise},Di=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Vi=_i.set,Bi=ot("species"),Fi="Promise",ji=se.get,Ki=se.set,qi=se.getterFor(Fi),Yi=Cr,Hi=o.TypeError,Gi=o.document,Wi=o.process,Qi=ce("fetch"),Ji=xi.f,zi=Ji,Zi=!!(Gi&&Gi.createEvent&&o.dispatchEvent),Xi="function"==typeof PromiseRejectionEvent,$i="unhandledrejection",es=Ue(Fi,(function(){if(!(K(Yi)!==String(Yi))){if(66===et)return!0;if(!Je&&!Xi)return!0}if(et>=51&&/native code/.test(Yi))return!1;var e=Yi.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[Bi]=t,!(e.then((function(){}))instanceof t)})),ts=es||!Qr((function(e){Yi.all(e).catch((function(){}))})),ns=function(e){var t;return!(!E(e)||"function"!=typeof(t=e.then))&&t},rs=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;Li((function(){for(var r=e.value,i=1==e.state,s=0;n.length>s;){var o,a,u,c=n[s++],l=i?c.ok:c.fail,h=c.resolve,f=c.reject,d=c.domain;try{l?(i||(2===e.rejection&&as(e),e.rejection=1),!0===l?o=r:(d&&d.enter(),o=l(r),d&&(d.exit(),u=!0)),o===c.promise?f(Hi("Promise-chain cycle")):(a=ns(o))?a.call(o,h,f):h(o)):f(r)}catch(e){d&&!u&&d.exit(),f(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&ss(e)}))}},is=function(e,t,n){var r,i;Zi?((r=Gi.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),o.dispatchEvent(r)):r={promise:t,reason:n},!Xi&&(i=o["on"+e])?i(r):e===$i&&function(e,t){var n=o.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},ss=function(e){Vi.call(o,(function(){var t,n=e.facade,r=e.value;if(os(e)&&(t=Di((function(){Je?Wi.emit("unhandledRejection",r,n):is($i,n,r)})),e.rejection=Je||os(e)?2:1,t.error))throw t.value}))},os=function(e){return 1!==e.rejection&&!e.parent},as=function(e){Vi.call(o,(function(){var t=e.facade;Je?Wi.emit("rejectionHandled",t):is("rejectionhandled",t,e.value)}))},us=function(e,t,n){return function(r){e(t,r,n)}},cs=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,rs(e,!0))},ls=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Hi("Promise can't be resolved itself");var r=ns(t);r?Li((function(){var n={done:!1};try{r.call(t,us(ls,n,e),us(cs,n,e))}catch(t){cs(n,t,e)}})):(e.value=t,e.state=1,rs(e,!1))}catch(t){cs({done:!1},t,e)}}};es&&(Yi=function(e){Ar(this,Yi,Fi),On(e),Oi.call(this);var t=ji(this);try{e(us(ls,t),us(cs,t))}catch(e){cs(t,e)}},(Oi=function(e){Ki(this,{type:Fi,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Sr(Yi.prototype,{then:function(e,t){var n=qi(this),r=Ji(zr(this,Yi));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Je?Wi.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&rs(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),ki=function(){var e=new Oi,t=ji(e);this.promise=e,this.resolve=us(ls,t),this.reject=us(cs,t)},xi.f=Ji=function(e){return e===Yi||e===Ai?new ki(e):zi(e)},"function"==typeof Cr&&(Mi=Cr.prototype.then,oe(Cr.prototype,"then",(function(e,t){var n=this;return new Yi((function(e,t){Mi.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof Qi&&Pe({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Pi(Yi,Qi.apply(o,arguments))}}))),Pe({global:!0,wrap:!0,forced:es},{Promise:Yi}),Nr(Yi,Fi,!1),kr(Fi),Ai=ce(Fi),Pe({target:Fi,stat:!0,forced:es},{reject:function(e){var t=Ji(this);return t.reject.call(void 0,e),t.promise}}),Pe({target:Fi,stat:!0,forced:es},{resolve:function(e){return Pi(this,e)}}),Pe({target:Fi,stat:!0,forced:ts},{all:function(e){var t=this,n=Ji(t),r=n.resolve,i=n.reject,s=Di((function(){var n=On(t.resolve),s=[],o=0,a=1;Fr(e,(function(e){var u=o++,c=!1;s.push(void 0),a++,n.call(t,e).then((function(e){c||(c=!0,s[u]=e,--a||r(s))}),i)})),--a||r(s)}));return s.error&&i(s.value),n.promise},race:function(e){var t=this,n=Ji(t),r=n.reject,i=Di((function(){var i=On(t.resolve);Fr(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var hs="RC_Logs";function fs(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(hs),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=wt({},n.objectStoreParams);r=e.createObjectStore(t,i),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,hs,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var ds=function(){function e(){Tt(this,e)}return Ct(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 o=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),u=o.index(n),c=[],l=u.openCursor(a);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,fs(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();ds._db=null;var gs=ot("match"),ps=function(e){var t;return E(e)&&(void 0!==(t=e[gs])?!!t:"RegExp"==p(e))},vs=Be.UNSUPPORTED_Y,ys=[].push,ms=Math.min,_s=4294967295;dt("split",2,(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=String(m(this)),i=void 0===n?_s:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!ps(e))return t.call(r,e,i);for(var s,o,a,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(s=Ge.call(h,r))&&!((o=h.lastIndex)>l&&(u.push(r.slice(l,s.index)),s.length>1&&s.index<r.length&&ys.apply(u,s.slice(1)),a=s[0].length,l=o,u.length>=i));)h.lastIndex===s.index&&h.lastIndex++;return l===r.length?!a&&h.test("")||u.push(""):u.push(r.slice(l)),u.length>i?u.slice(0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=m(this),s=null==t?void 0:t[e];return void 0!==s?s.call(t,i,n):r.call(String(i),t,n)},function(e,i){var s=n(r,e,this,i,r!==t);if(s.done)return s.value;var o=A(e),a=String(this),u=zr(o,RegExp),c=o.unicode,l=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(vs?"g":"y"),h=new u(vs?"^(?:"+o.source+")":o,l),f=void 0===i?_s:i>>>0;if(0===f)return[];if(0===a.length)return null===mt(h,a)?[a]:[];for(var d=0,g=0,p=[];g<a.length;){h.lastIndex=vs?0:g;var v,y=mt(h,vs?a.slice(g):a);if(null===y||(v=ms(ge(h.lastIndex+(vs?g:0)),a.length))===d)g=yt(a,g,c);else{if(p.push(a.slice(d,g)),p.length===f)return p;for(var m=1;m<=y.length-1;m++)if(p.push(y[m]),p.length===f)return p;g=d=v}}return p.push(a.slice(d)),p}]}),vs);var Es="toString",Rs=RegExp.prototype,Ts=Rs.toString,Is=a((function(){return"/a/b"!=Ts.call({source:"a",flags:"b"})})),Cs=Ts.name!=Es;(Is||Cs)&&oe(RegExp.prototype,Es,(function(){var e=A(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in Rs)?De.call(e):n)}),{unsafe:!0});var Ss,bs=function(e,t){return e+Math.floor(Math.random()*(t-e))},ws=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)}))},Ns=function(){var e=ws();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.RTC_ROOM=12]="RTC_ROOM"}(Ss||(Ss={}));var Os,ks=Ss;!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"}(Os||(Os={}));var As,Ms=Os,Ls=function(e){return"string"==typeof e},Us=function(e){return"boolean"==typeof e},xs=function(e){return"number"==typeof e&&!isNaN(e)},Ps=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Ds=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Vs=function(e){return Ls(e)&&e.length>0},Bs=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Fs=function(e){return"[object Function]"===Object.prototype.toString.call(e)},js=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Ks=function(e){return"[object Null]"===Object.prototype.toString.call(e)},qs=function(e){for(var t in e)return!0;return!1},Ys=(St(As={},e.LogLevel.DEBUG,console.debug.bind(console)),St(As,e.LogLevel.INFO,console.info.bind(console)),St(As,e.LogLevel.WARN,console.warn.bind(console)),St(As,e.LogLevel.ERROR,console.error.bind(console)),St(As,e.LogLevel.FATAL,console.log.bind(console)),As),Hs=function(e){return Ls(e)||xs(e)||js(e)||Us(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},Gs=function(){function t(n,r,i){Tt(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 Ct(t,[{key:"_defaultStdout",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];Ys[e].apply(Ys,["".concat(t,":")].concat(r))}},{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 o=Date.now();Hn(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,o="";for(s=0;s<e.length;s++){if(e.charCodeAt(s)>255?i+=r:i++,i>t)return o;o+=e.charAt(s)}return e}(r,1e3));var a=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:o,level:4-n,content:"".concat(t.sessionId,",").concat(Date.now(),",").concat(s,",").concat(4-n,",").concat(u,',"').concat(a,'"\n'),userId:t.userId};t.databaseLogList.push(c),(t.databaseLogList.length>=100||n===e.LogLevel.FATAL)&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=Rt(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Bt(t.databaseLogList),t.databaseLogList=[],!(r=ds.getInstance())){e.next=14;break}return e.next=6,r.addList(hs,n);case 6:return i=e.sent,e.next=9,r.getCount(hs,"time");case 9:return e.sent>1e5&&r.removeFirstData(hs,"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(Hs).join(" "),this.tag),!(t<this._outLevel)){var s="".concat((new Date).toISOString(),"[").concat(this.tag,"][").concat(e.LogLevel[t],"]"),o="".concat(s," - ").concat(r.map(Hs).join(" "));this._logStdout?this._logStdout(t,o):this._stdout?this._stdout(t,o):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}();Gs.databaseLogList=[],Gs.realTimeLogList=[],Gs.sessionId=Ns(),Gs.userId="";var Ws=new Gs("RCLog"),Qs=Wt("splice"),Js=Math.max,zs=Math.min,Zs=9007199254740991,Xs="Maximum allowed length exceeded";Pe({target:"Array",proto:!0,forced:!Qs},{splice:function(e,t){var n,r,i,s,o,a,u=T(this),c=ge(u.length),l=ye(e,c),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=zs(Js(fe(t),0),c-l)),c+n-r>Zs)throw TypeError(Xs);for(i=Ht(u,r),s=0;s<r;s++)(o=l+s)in u&&qt(i,s,u[o]);if(i.length=r,n<r){for(s=l;s<c-r;s++)a=s+n,(o=s+r)in u?u[a]=u[o]:delete u[a];for(s=c;s>c-r+n;s--)delete u[s-1]}else if(n>r)for(s=c-r;s>l;s--)a=s+n-1,(o=s+r-1)in u?u[a]=u[o]:delete u[a];for(s=0;s<n;s++)u[s+l]=arguments[s+2];return u.length=c-r+n,i}});var $s,eo=function(){function e(){Tt(this,e),this._map={}}return Ct(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 o=t[s],a=o.target,u=o.once,c=o.listener;u&&t.splice(s,1);try{c.call.apply(c,[a].concat(r))}catch(e){Ws.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"}($s||($s={}));var to,no=$s;!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.SUCCESS=0]="SUCCESS",e[e.RC_MSG_UNAUTHORIZED=20406]="RC_MSG_UNAUTHORIZED",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",e[e.ALREADY_IN_USE=51002]="ALREADY_IN_USE",e[e.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",e[e.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",e[e.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"}(to||(to={}));var ro,io=to;!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"}(ro||(ro={}));var so,oo=ro,ao={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"}(so||(so={}));var uo,co=so;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(uo||(uo={}));var lo,ho=uo;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(lo||(lo={}));var fo,go=lo;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(fo||(fo={}));var po,vo=fo;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(po||(po={}));var yo,mo=po;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(yo||(yo={}));var _o,Eo=yo;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(_o||(_o={}));var Ro,To,Io,Co=_o;e.RTCMode=void 0,(Ro=e.RTCMode||(e.RTCMode={}))[Ro.RTC=0]="RTC",Ro[Ro.LIVE=2]="LIVE",e.LiveType=void 0,(To=e.LiveType||(e.LiveType={}))[To.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",To[To.AUDIO=1]="AUDIO",e.LiveRole=void 0,(Io=e.LiveRole||(e.LiveRole={}))[Io.ANCHOR=1]="ANCHOR",Io[Io.AUDIENCE=2]="AUDIENCE";var So,bo,wo,No={"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,(So=e.RTCApiType||(e.RTCApiType={}))[So.ROOM=1]="ROOM",So[So.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(bo=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[bo.AnchorToViewer=1]="AnchorToViewer",bo[bo.ViewerToAnchor=2]="ViewerToAnchor",e.RTCJoinType=void 0,(wo=e.RTCJoinType||(e.RTCJoinType={}))[wo.KICK=0]="KICK",wo[wo.REFUSE=1]="REFUSE",wo[wo.COEXIST=2]="COEXIST";var Oo=function(e){var t=String(m(this)),n="",r=fe(e);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},ko=Math.ceil,Ao=function(e){return function(t,n,r){var i,s,o=String(m(t)),a=o.length,u=void 0===r?" ":String(r),c=ge(n);return c<=a||""==u?o:((s=Oo.call(u,ko((i=c-a)/u.length))).length>i&&(s=s.slice(0,i)),e?o+s:s+o)}},Mo={start:Ao(!1),end:Ao(!0)},Lo=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(ze),Uo=Mo.start;Pe({target:"String",proto:!0,forced:Lo},{padStart:function(e){return Uo(this,e,arguments.length>1?arguments[1]:void 0)}});var xo,Po,Do={engine:"5.1.0"},Vo=function(){function e(){Tt(this,e)}return Ct(e,null,[{key:"add",value:function(e,t){Do[e]=t}},{key:"validEngine",value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return Ws.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 Do.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n}},{key:"getInfo",value:function(){return Do}}]),e}();e.AssertRules=void 0,(Po=e.AssertRules||(e.AssertRules={}))[Po.STRING=0]="STRING",Po[Po.ONLY_STRING=1]="ONLY_STRING",Po[Po.NUMBER=2]="NUMBER",Po[Po.BOOLEAN=3]="BOOLEAN",Po[Po.OBJECT=4]="OBJECT",Po[Po.ARRAY=5]="ARRAY",Po[Po.CALLBACK=6]="CALLBACK",Po[Po.CHANNEL_ID=7]="CHANNEL_ID";var Bo=(St(xo={},e.AssertRules.STRING,Vs),St(xo,e.AssertRules.ONLY_STRING,Ls),St(xo,e.AssertRules.NUMBER,xs),St(xo,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),St(xo,e.AssertRules.OBJECT,Bs),St(xo,e.AssertRules.ARRAY,Ps),St(xo,e.AssertRules.CALLBACK,(function(e){var t=!0;return Bs(e)||(t=!1),(e=e||{}).onSuccess&&!Fs(e.onSuccess)&&(t=!1),e.onError&&!Fs(e.onError)&&(t=!1),t})),St(xo,e.AssertRules.CHANNEL_ID,(function(e){var t=!1;return Ls(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t})),xo),Fo=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,e)).name="RCAssertError",r}return n}(Lt(Error)),jo=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=Bo[n]||n;var i=r&&!n(t)||!r&&!(js(t)||null===t||n(t));return i&&Ws.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},Ko=[].slice,qo=/MSIE .\./.test(ze),Yo=function(e){return function(t,n){var r=arguments.length>2,i=r?Ko.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};Pe({global:!0,bind:!0,forced:qo},{setTimeout:Yo(o.setTimeout),setInterval:Yo(o.setInterval)});var Ho=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return A(n),function(e){if(!E(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),Go=function(e,t,n){var r,i;return Ho&&"function"==typeof(r=t.constructor)&&r!==n&&E(i=r.prototype)&&i!==n.prototype&&Ho(e,i),e},Wo=L.f,Qo=Ce.f,Jo=se.enforce,zo=ot("match"),Zo=o.RegExp,Xo=Zo.prototype,$o=/a/g,ea=/a/g,ta=new Zo($o)!==$o,na=Be.UNSUPPORTED_Y;if(u&&Ue("RegExp",!ta||na||a((function(){return ea[zo]=!1,Zo($o)!=$o||Zo(ea)==ea||"/a/i"!=Zo($o,"i")})))){for(var ra=function(e,t){var n,r=this instanceof ra,i=ps(e),s=void 0===t;if(!r&&i&&e.constructor===ra&&s)return e;ta?i&&!s&&(e=e.source):e instanceof ra&&(s&&(t=De.call(e)),e=e.source),na&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=Go(ta?new Zo(e,t):Zo(e,t),r?this:Xo,ra);na&&n&&(Jo(o).sticky=!0);return o},ia=function(e){e in ra||Wo(ra,e,{configurable:!0,get:function(){return Zo[e]},set:function(t){Zo[e]=t}})},sa=Qo(Zo),oa=0;sa.length>oa;)ia(sa[oa++]);Xo.constructor=ra,ra.prototype=Xo,oe(o,"RegExp",ra)}kr("RegExp");var aa,ua,ca,la=function(e){if(!Bs(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)},ha=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=ws(),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(),o="";if(t){var a=t.split(".");o="."+a[a.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(s).concat(r).concat(o)},fa=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,o=t.channelIdMi,a=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:a||""}},{MI:{channelId:o||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:h},{FCM:f}];return JSON.stringify(g)},da=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,o,a=Object.keys(e);if(0!==a.length){var u=a[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===(o=e[u])||void 0===o?void 0:o.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){Ws.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},ga=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},pa=function(e){var t=e.length;return t<=4096&&t>=1},va=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Bs(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Ps(e)||Ls(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)}()},ya=function(e,t){return va(e,(function(n,r){e[r]=t(n,r)})),e},ma=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return va(e,(function(e,r){t===e&&(n=r)})),n},_a=function(e,t){var n=[];return va(e,(function(e){n.push(e)})),-1!==ma(n,t)},Ea=function(e){return JSON.parse(JSON.stringify(e))},Ra=function(){return"undefined"!=typeof RCCppEngine},Ta=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 o=r.match(i[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Ia=function(e){switch(e){case ao.SERVER_UNAVAILABLE:return io.SERVER_UNAVAILABLE;case ao.TOKEN_INCORRECT:return io.RC_CONN_USER_OR_PASSWD_ERROR;case ao.REDIRECT:return io.RC_CONN_REDIRECTED;case ao.APP_BLOCK_OR_DELETE:return io.RC_CONN_APP_BLOCKED_OR_DELETED;case ao.BLOCK:return io.RC_CONN_USER_BLOCKED;case ao.TOKEN_EXPIRE:return io.RC_CONN_USER_OR_PASSWD_ERROR;case ao.HOSTNAME_ERROR:return io.HOSTNAME_ERROR;case ao.HASOHTERSAMECLIENTONLINE:return io.HAS_OHTER_SAME_CLIENT_ON_LINE;case ao.APP_AUTH_NOT_PASS:return io.RC_APP_AUTH_NOT_PASS;case ao.OTP_USED:return io.RC_OTP_USED;case ao.PLATFORM_ERROR:return io.RC_PLATFORM_ERROR;default:return io.RC_NET_UNAVAILABLE}},Ca=function(e){var t={},n=JSON.parse(e);return va(n,(function(e,n){t[n]=e.v})),t},Sa={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Sa._delayTime=t-e},getTime:function(){var e=Sa._delayTime;return(new Date).getTime()-e}},ba=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},wa=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Na=z("IE_PROTO"),Oa=Object.prototype,ka=wa?Object.getPrototypeOf:function(e){return e=T(e),C(e,Na)?e[Na]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Oa:null},Aa=ot("iterator"),Ma=!1;[].keys&&("next"in(ca=[].keys())?(ua=ka(ka(ca)))!==Object.prototype&&(aa=ua):Ma=!0),(null==aa||a((function(){var e={};return aa[Aa].call(e)!==e})))&&(aa={}),C(aa,Aa)||U(aa,Aa,(function(){return this}));var La={IteratorPrototype:aa,BUGGY_SAFARI_ITERATORS:Ma},Ua=La.IteratorPrototype,xa=function(){return this},Pa=La.IteratorPrototype,Da=La.BUGGY_SAFARI_ITERATORS,Va=ot("iterator"),Ba="keys",Fa="values",ja="entries",Ka=function(){return this},qa=function(e,t,n,r,i,s,o){!function(e,t,n){var r=t+" Iterator";e.prototype=sr(Ua,{next:f(1,n)}),Nr(e,r,!1),Mr[r]=xa}(n,t,r);var a,u,c,l=function(e){if(e===i&&v)return v;if(!Da&&e in g)return g[e];switch(e){case Ba:case Fa:case ja:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",d=!1,g=e.prototype,p=g[Va]||g["@@iterator"]||i&&g[i],v=!Da&&p||l(i),y="Array"==t&&g.entries||p;if(y&&(a=ka(y.call(new e)),Pa!==Object.prototype&&a.next&&(ka(a)!==Pa&&(Ho?Ho(a,Pa):"function"!=typeof a[Va]&&U(a,Va,Ka)),Nr(a,h,!0))),i==Fa&&p&&p.name!==Fa&&(d=!0,v=function(){return p.call(this)}),g[Va]!==v&&U(g,Va,v),Mr[t]=v,i)if(u={values:l(Fa),keys:s?v:l(Ba),entries:l(ja)},o)for(c in u)(Da||d||!(c in g))&&oe(g,c,u[c]);else Pe({target:t,proto:!0,forced:Da||d},u);return u},Ya="Array Iterator",Ha=se.set,Ga=se.getterFor(Ya),Wa=qa(Array,"Array",(function(e,t){Ha(this,{type:Ya,target:_(e),index:0,kind:t})}),(function(){var e=Ga(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");Mr.Arguments=Mr.Array,lr("keys"),lr("values"),lr("entries");var Qa="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Ja=function(e){if(void 0===e)return 0;var t=fe(e),n=ge(t);if(t!==n)throw RangeError("Wrong length or index");return n},za=Math.abs,Za=Math.pow,Xa=Math.floor,$a=Math.log,eu=Math.LN2,tu=function(e,t,n){var r,i,s,o=new Array(n),a=8*n-t-1,u=(1<<a)-1,c=u>>1,l=23===t?Za(2,-24)-Za(2,-77):0,h=e<0||0===e&&1/e<0?1:0,f=0;for((e=za(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=Xa($a(e)/eu),e*(s=Za(2,-r))<1&&(r--,s*=2),(e+=r+c>=1?l/s:l*Za(2,1-c))*s>=2&&(r++,s/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*s-1)*Za(2,t),r+=c):(i=e*Za(2,c-1)*Za(2,t),r=0));t>=8;o[f++]=255&i,i/=256,t-=8);for(r=r<<t|i,a+=t;a>0;o[f++]=255&r,r/=256,a-=8);return o[--f]|=128*h,o},nu=function(e,t){var n,r=e.length,i=8*r-t-1,s=(1<<i)-1,o=s>>1,a=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;a>0;l=256*l+e[u],u--,a-=8);for(n=l&(1<<-a)-1,l>>=-a,a+=t;a>0;n=256*n+e[u],u--,a-=8);if(0===l)l=1-o;else{if(l===s)return n?NaN:c?-1/0:1/0;n+=Za(2,t),l-=o}return(c?-1:1)*n*Za(2,l-t)},ru=function(e){for(var t=T(this),n=ge(t.length),r=arguments.length,i=ye(r>1?arguments[1]:void 0,n),s=r>2?arguments[2]:void 0,o=void 0===s?n:ye(s,n);o>i;)t[i++]=e;return t},iu=Ce.f,su=L.f,ou=se.get,au=se.set,uu="ArrayBuffer",cu="DataView",lu="Wrong index",hu=o.ArrayBuffer,fu=hu,du=o.DataView,gu=du&&du.prototype,pu=Object.prototype,vu=o.RangeError,yu=tu,mu=nu,_u=function(e){return[255&e]},Eu=function(e){return[255&e,e>>8&255]},Ru=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Tu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Iu=function(e){return yu(e,23,4)},Cu=function(e){return yu(e,52,8)},Su=function(e,t){su(e.prototype,t,{get:function(){return ou(this)[t]}})},bu=function(e,t,n,r){var i=Ja(n),s=ou(e);if(i+t>s.byteLength)throw vu(lu);var o=ou(s.buffer).bytes,a=i+s.byteOffset,u=o.slice(a,a+t);return r?u:u.reverse()},wu=function(e,t,n,r,i,s){var o=Ja(n),a=ou(e);if(o+t>a.byteLength)throw vu(lu);for(var u=ou(a.buffer).bytes,c=o+a.byteOffset,l=r(+i),h=0;h<t;h++)u[c+h]=l[s?h:t-h-1]};if(Qa){if(!a((function(){hu(1)}))||!a((function(){new hu(-1)}))||a((function(){return new hu,new hu(1.5),new hu(NaN),hu.name!=uu}))){for(var Nu,Ou=(fu=function(e){return Ar(this,fu),new hu(Ja(e))}).prototype=hu.prototype,ku=iu(hu),Au=0;ku.length>Au;)(Nu=ku[Au++])in fu||U(fu,Nu,hu[Nu]);Ou.constructor=fu}Ho&&ka(gu)!==pu&&Ho(gu,pu);var Mu=new du(new fu(2)),Lu=gu.setInt8;Mu.setInt8(0,2147483648),Mu.setInt8(1,2147483649),!Mu.getInt8(0)&&Mu.getInt8(1)||Sr(gu,{setInt8:function(e,t){Lu.call(this,e,t<<24>>24)},setUint8:function(e,t){Lu.call(this,e,t<<24>>24)}},{unsafe:!0})}else fu=function(e){Ar(this,fu,uu);var t=Ja(e);au(this,{bytes:ru.call(new Array(t),0),byteLength:t}),u||(this.byteLength=t)},du=function(e,t,n){Ar(this,du,cu),Ar(e,fu,cu);var r=ou(e).byteLength,i=fe(t);if(i<0||i>r)throw vu("Wrong offset");if(i+(n=void 0===n?r-i:ge(n))>r)throw vu("Wrong length");au(this,{buffer:e,byteLength:n,byteOffset:i}),u||(this.buffer=e,this.byteLength=n,this.byteOffset=i)},u&&(Su(fu,"byteLength"),Su(du,"buffer"),Su(du,"byteLength"),Su(du,"byteOffset")),Sr(du.prototype,{getInt8:function(e){return bu(this,1,e)[0]<<24>>24},getUint8:function(e){return bu(this,1,e)[0]},getInt16:function(e){var t=bu(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=bu(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Tu(bu(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Tu(bu(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return mu(bu(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return mu(bu(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){wu(this,1,e,_u,t)},setUint8:function(e,t){wu(this,1,e,_u,t)},setInt16:function(e,t){wu(this,2,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){wu(this,2,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){wu(this,4,e,Ru,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){wu(this,4,e,Ru,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){wu(this,4,e,Iu,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){wu(this,8,e,Cu,t,arguments.length>2?arguments[2]:void 0)}});Nr(fu,uu),Nr(du,cu);var Uu={ArrayBuffer:fu,DataView:du},xu=Uu.ArrayBuffer,Pu=Uu.DataView,Du=xu.prototype.slice,Vu=a((function(){return!new xu(2).slice(1,void 0).byteLength}));Pe({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:Vu},{slice:function(e,t){if(void 0!==Du&&void 0===t)return Du.call(A(this),e);for(var n=A(this).byteLength,r=ye(e,n),i=ye(void 0===t?n:t,n),s=new(zr(this,xu))(ge(i-r)),o=new Pu(this),a=new Pu(s),u=0;r<i;)a.setUint8(u++,o.getUint8(r++));return s}});var Bu,Fu=L.f,ju=o.Int8Array,Ku=ju&&ju.prototype,qu=o.Uint8ClampedArray,Yu=qu&&qu.prototype,Hu=ju&&ka(ju),Gu=Ku&&ka(Ku),Wu=Object.prototype,Qu=Wu.isPrototypeOf,Ju=ot("toStringTag"),zu=Q("TYPED_ARRAY_TAG"),Zu=Qa&&!!Ho&&"Opera"!==Tr(o.opera),Xu=!1,$u={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ec={BigInt64Array:8,BigUint64Array:8},tc=function(e){if(!E(e))return!1;var t=Tr(e);return C($u,t)||C(ec,t)};for(Bu in $u)o[Bu]||(Zu=!1);if((!Zu||"function"!=typeof Hu||Hu===Function.prototype)&&(Hu=function(){throw TypeError("Incorrect invocation")},Zu))for(Bu in $u)o[Bu]&&Ho(o[Bu],Hu);if((!Zu||!Gu||Gu===Wu)&&(Gu=Hu.prototype,Zu))for(Bu in $u)o[Bu]&&Ho(o[Bu].prototype,Gu);if(Zu&&ka(Yu)!==Gu&&Ho(Yu,Gu),u&&!C(Gu,Ju))for(Bu in Xu=!0,Fu(Gu,Ju,{get:function(){return E(this)?this[zu]:void 0}}),$u)o[Bu]&&U(o[Bu],zu,Bu);var nc={NATIVE_ARRAY_BUFFER_VIEWS:Zu,TYPED_ARRAY_TAG:Xu&&zu,aTypedArray:function(e){if(tc(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Ho){if(Qu.call(Hu,e))return e}else for(var t in $u)if(C($u,Bu)){var n=o[t];if(n&&(e===n||Qu.call(n,e)))return e}throw TypeError("Target is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n){if(u){if(n)for(var r in $u){var i=o[r];i&&C(i.prototype,e)&&delete i.prototype[e]}Gu[e]&&!n||oe(Gu,e,n?t:Zu&&Ku[e]||t)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(u){if(Ho){if(n)for(r in $u)(i=o[r])&&C(i,e)&&delete i[e];if(Hu[e]&&!n)return;try{return oe(Hu,e,n?t:Zu&&ju[e]||t)}catch(e){}}for(r in $u)!(i=o[r])||i[e]&&!n||oe(i,e,t)}},isView:function(e){if(!E(e))return!1;var t=Tr(e);return"DataView"===t||C($u,t)||C(ec,t)},isTypedArray:tc,TypedArray:Hu,TypedArrayPrototype:Gu},rc=nc.NATIVE_ARRAY_BUFFER_VIEWS,ic=o.ArrayBuffer,sc=o.Int8Array,oc=!rc||!a((function(){sc(1)}))||!a((function(){new sc(-1)}))||!Qr((function(e){new sc,new sc(null),new sc(1.5),new sc(e)}),!0)||a((function(){return 1!==new sc(new ic(2),1,void 0).length})),ac=function(e,t){var n=function(e){var t=fe(e);if(t<0)throw RangeError("The argument can't be less than 0");return t}(e);if(n%t)throw RangeError("Wrong offset");return n},uc=nc.aTypedArrayConstructor,cc=function(e){var t,n,r,i,s,o,a=T(e),u=arguments.length,c=u>1?arguments[1]:void 0,l=void 0!==c,h=Dr(a);if(null!=h&&!xr(h))for(o=(s=h.call(a)).next,a=[];!(i=o.call(s)).done;)a.push(i.value);for(l&&u>2&&(c=kn(c,arguments[2],2)),n=ge(a.length),r=new(uc(this))(n),t=0;n>t;t++)r[t]=l?c(a[t],t):a[t];return r},lc=i((function(e){var t=Ce.f,n=Ln.forEach,r=se.get,i=se.set,s=L.f,a=k.f,c=Math.round,l=o.RangeError,h=Uu.ArrayBuffer,d=Uu.DataView,g=nc.NATIVE_ARRAY_BUFFER_VIEWS,p=nc.TYPED_ARRAY_TAG,v=nc.TypedArray,y=nc.TypedArrayPrototype,m=nc.aTypedArrayConstructor,_=nc.isTypedArray,T="BYTES_PER_ELEMENT",I="Wrong length",S=function(e,t){for(var n=0,r=t.length,i=new(m(e))(r);r>n;)i[n]=t[n++];return i},b=function(e,t){s(e,t,{get:function(){return r(this)[t]}})},w=function(e){var t;return e instanceof h||"ArrayBuffer"==(t=Tr(e))||"SharedArrayBuffer"==t},N=function(e,t){return _(e)&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},O=function(e,t){return N(e,t=R(t,!0))?f(2,e[t]):a(e,t)},A=function(e,t,n){return!(N(e,t=R(t,!0))&&E(n)&&C(n,"value"))||C(n,"get")||C(n,"set")||n.configurable||C(n,"writable")&&!n.writable||C(n,"enumerable")&&!n.enumerable?s(e,t,n):(e[t]=n.value,e)};u?(g||(k.f=O,L.f=A,b(y,"buffer"),b(y,"byteOffset"),b(y,"byteLength"),b(y,"length")),Pe({target:"Object",stat:!0,forced:!g},{getOwnPropertyDescriptor:O,defineProperty:A}),e.exports=function(e,a,u){var f=e.match(/\d+$/)[0]/8,m=e+(u?"Clamped":"")+"Array",R="get"+e,C="set"+e,b=o[m],N=b,O=N&&N.prototype,k={},A=function(e,t){s(e,t,{get:function(){return function(e,t){var n=r(e);return n.view[R](t*f+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var i=r(e);u&&(n=(n=c(n))<0?0:n>255?255:255&n),i.view[C](t*f+i.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};g?oc&&(N=a((function(e,t,n,r){return Ar(e,N,m),Go(E(t)?w(t)?void 0!==r?new b(t,ac(n,f),r):void 0!==n?new b(t,ac(n,f)):new b(t):_(t)?S(N,t):cc.call(N,t):new b(Ja(t)),e,N)})),Ho&&Ho(N,v),n(t(b),(function(e){e in N||U(N,e,b[e])})),N.prototype=O):(N=a((function(e,t,n,r){Ar(e,N,m);var s,o,a,u=0,c=0;if(E(t)){if(!w(t))return _(t)?S(N,t):cc.call(N,t);s=t,c=ac(n,f);var g=t.byteLength;if(void 0===r){if(g%f)throw l(I);if((o=g-c)<0)throw l(I)}else if((o=ge(r)*f)+c>g)throw l(I);a=o/f}else a=Ja(t),s=new h(o=a*f);for(i(e,{buffer:s,byteOffset:c,byteLength:o,length:a,view:new d(s)});u<a;)A(e,u++)})),Ho&&Ho(N,v),O=N.prototype=sr(y)),O.constructor!==N&&U(O,"constructor",N),p&&U(O,p,m),k[m]=N,Pe({global:!0,forced:N!=b,sham:!g},k),T in N||U(N,T,f),T in O||U(O,T,f),kr(m)}):e.exports=function(){}}));lc("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var hc=Math.min,fc=[].copyWithin||function(e,t){var n=T(this),r=ge(n.length),i=ye(e,r),s=ye(t,r),o=arguments.length>2?arguments[2]:void 0,a=hc((void 0===o?r:ye(o,r))-s,r-i),u=1;for(s<i&&i<s+a&&(u=-1,s+=a-1,i+=a-1);a-- >0;)s in n?n[i]=n[s]:delete n[i],i+=u,s+=u;return n},dc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("copyWithin",(function(e,t){return fc.call(dc(this),e,t,arguments.length>2?arguments[2]:void 0)}));var gc=Ln.every,pc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("every",(function(e){return gc(pc(this),e,arguments.length>1?arguments[1]:void 0)}));var vc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("fill",(function(e){return ru.apply(vc(this),arguments)}));var yc=nc.aTypedArrayConstructor,mc=function(e,t){for(var n=zr(e,e.constructor),r=0,i=t.length,s=new(yc(n))(i);i>r;)s[r]=t[r++];return s},_c=Ln.filter,Ec=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("filter",(function(e){var t=_c(Ec(this),e,arguments.length>1?arguments[1]:void 0);return mc(this,t)}));var Rc=Ln.find,Tc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("find",(function(e){return Rc(Tc(this),e,arguments.length>1?arguments[1]:void 0)}));var Ic=Ln.findIndex,Cc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("findIndex",(function(e){return Ic(Cc(this),e,arguments.length>1?arguments[1]:void 0)}));var Sc=Ln.forEach,bc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("forEach",(function(e){Sc(bc(this),e,arguments.length>1?arguments[1]:void 0)}));var wc=_e.includes,Nc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("includes",(function(e){return wc(Nc(this),e,arguments.length>1?arguments[1]:void 0)}));var Oc=_e.indexOf,kc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("indexOf",(function(e){return Oc(kc(this),e,arguments.length>1?arguments[1]:void 0)}));var Ac=ot("iterator"),Mc=o.Uint8Array,Lc=Wa.values,Uc=Wa.keys,xc=Wa.entries,Pc=nc.aTypedArray,Dc=nc.exportTypedArrayMethod,Vc=Mc&&Mc.prototype[Ac],Bc=!!Vc&&("values"==Vc.name||null==Vc.name),Fc=function(){return Lc.call(Pc(this))};Dc("entries",(function(){return xc.call(Pc(this))})),Dc("keys",(function(){return Uc.call(Pc(this))})),Dc("values",Fc,!Bc),Dc(Ac,Fc,!Bc);var jc=nc.aTypedArray,Kc=[].join;(0,nc.exportTypedArrayMethod)("join",(function(e){return Kc.apply(jc(this),arguments)}));var qc=Math.min,Yc=[].lastIndexOf,Hc=!!Yc&&1/[1].lastIndexOf(1,-0)<0,Gc=Fn("lastIndexOf"),Wc=Hc||!Gc?function(e){if(Hc)return Yc.apply(this,arguments)||0;var t=_(this),n=ge(t.length),r=n-1;for(arguments.length>1&&(r=qc(r,fe(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Yc,Qc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("lastIndexOf",(function(e){return Wc.apply(Qc(this),arguments)}));var Jc=Ln.map,zc=nc.aTypedArray,Zc=nc.aTypedArrayConstructor;(0,nc.exportTypedArrayMethod)("map",(function(e){return Jc(zc(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Zc(zr(e,e.constructor)))(t)}))}));var Xc=function(e){return function(t,n,r,i){On(n);var s=T(t),o=y(s),a=ge(s.length),u=e?a-1:0,c=e?-1:1;if(r<2)for(;;){if(u in o){i=o[u],u+=c;break}if(u+=c,e?u<0:a<=u)throw TypeError("Reduce of empty array with no initial value")}for(;e?u>=0:a>u;u+=c)u in o&&(i=n(i,o[u],u,s));return i}},$c={left:Xc(!1),right:Xc(!0)},el=$c.left,tl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("reduce",(function(e){return el(tl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var nl=$c.right,rl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("reduceRight",(function(e){return nl(rl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var il=nc.aTypedArray,sl=nc.exportTypedArrayMethod,ol=Math.floor;sl("reverse",(function(){for(var e,t=this,n=il(t).length,r=ol(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var al=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("set",(function(e){al(this);var t=ac(arguments.length>1?arguments[1]:void 0,1),n=this.length,r=T(e),i=ge(r.length),s=0;if(i+t>n)throw RangeError("Wrong length");for(;s<i;)this[t+s]=r[s++]}),a((function(){new Int8Array(1).set({})})));var ul=nc.aTypedArray,cl=nc.aTypedArrayConstructor,ll=[].slice;(0,nc.exportTypedArrayMethod)("slice",(function(e,t){for(var n=ll.call(ul(this),e,t),r=zr(this,this.constructor),i=0,s=n.length,o=new(cl(r))(s);s>i;)o[i]=n[i++];return o}),a((function(){new Int8Array(1).slice()})));var hl=Ln.some,fl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("some",(function(e){return hl(fl(this),e,arguments.length>1?arguments[1]:void 0)}));var dl=nc.aTypedArray,gl=[].sort;(0,nc.exportTypedArrayMethod)("sort",(function(e){return gl.call(dl(this),e)}));var pl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("subarray",(function(e,t){var n=pl(this),r=n.length,i=ye(e,r);return new(zr(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,ge((void 0===t?r:ye(t,r))-i))}));var vl=o.Int8Array,yl=nc.aTypedArray,ml=nc.exportTypedArrayMethod,_l=[].toLocaleString,El=[].slice,Rl=!!vl&&a((function(){_l.call(new vl(1))}));ml("toLocaleString",(function(){return _l.apply(Rl?El.call(yl(this)):yl(this),arguments)}),a((function(){return[1,2].toLocaleString()!=new vl([1,2]).toLocaleString()}))||!a((function(){vl.prototype.toLocaleString.call([1,2])})));var Tl=nc.exportTypedArrayMethod,Il=o.Uint8Array,Cl=Il&&Il.prototype||{},Sl=[].toString,bl=[].join;a((function(){Sl.call({})}))&&(Sl=function(){return bl.call(this)});var wl=Cl.toString!=Sl;Tl("toString",Sl,wl);var Nl=ot("iterator"),Ol=ot("toStringTag"),kl=Wa.values;for(var Al in fr){var Ml=o[Al],Ll=Ml&&Ml.prototype;if(Ll){if(Ll[Nl]!==kl)try{U(Ll,Nl,kl)}catch(e){Ll[Nl]=kl}if(Ll[Ol]||U(Ll,Ol,Al),fr[Al])for(var Ul in Wa)if(Ll[Ul]!==Wa[Ul])try{U(Ll,Ul,Wa[Ul])}catch(e){Ll[Ul]=Wa[Ul]}}}var xl=Object.assign,Pl=Object.defineProperty,Dl=!xl||a((function(){if(u&&1!==xl({b:1},xl(Pl({},"a",{enumerable:!0,get:function(){Pl(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!=xl({},e)[n]||Vn(xl({},t)).join("")!=r}))?function(e,t){for(var n=T(e),r=arguments.length,i=1,s=Se.f,o=h.f;r>i;)for(var a,c=y(arguments[i++]),l=s?Vn(c).concat(s(c)):Vn(c),f=l.length,d=0;f>d;)a=l[d++],u&&!o.call(c,a)||(n[a]=c[a]);return n}:xl;Pe({target:"Object",stat:!0,forced:Object.assign!==Dl},{assign:Dl});var Vl,Bl,Fl,jl,Kl,ql="[\t\n\v\f\r \u2028\u2029\ufeff]",Yl=RegExp("^"+ql+ql+"*"),Hl=RegExp(ql+ql+"*$"),Gl=function(e){return function(t){var n=String(m(t));return 1&e&&(n=n.replace(Yl,"")),2&e&&(n=n.replace(Hl,"")),n}},Wl={start:Gl(1),end:Gl(2),trim:Gl(3)},Ql=Ce.f,Jl=k.f,zl=L.f,Zl=Wl.trim,Xl="Number",$l=o.Number,eh=$l.prototype,th=p(sr(eh))==Xl,nh=function(e){var t,n,r,i,s,o,a,u,c=R(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=Zl(c)).charCodeAt(0))||45===t){if(88===(n=c.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(o=(s=c.slice(2)).length,a=0;a<o;a++)if((u=s.charCodeAt(a))<48||u>i)return NaN;return parseInt(s,r)}return+c};if(Ue(Xl,!$l(" 0o1")||!$l("0b1")||$l("+0x1"))){for(var rh,ih=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof ih&&(th?a((function(){eh.valueOf.call(n)})):p(n)!=Xl)?Go(new $l(nh(t)),n,ih):nh(t)},sh=u?Ql($l):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),oh=0;sh.length>oh;oh++)C($l,rh=sh[oh])&&!C(ih,rh)&&zl(ih,rh,Jl($l,rh));ih.prototype=eh,eh.constructor=ih,oe(o,Xl,ih)}!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"}(Vl||(Vl={})),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"}(Bl||(Bl={})),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"}(Fl||(Fl={})),function(e){e.PUB="pub",e.QUERY="qry"}(jl||(jl={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Kl||(Kl={}));var ah,uh=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]:Vl.AT_LEAST_ONCE,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Tt(this,e),this._retain=!1,this.qos=Vl.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 Ct(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}(),ch=function(){function e(){Tt(this,e)}return Ct(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ls(e))for(var i=0,s=e.length;i<s;i++){var o=e.charCodeAt(i);o>=0&&o<=127?(r+=1,n.push(o)):o>=128&&o<=2047?(r+=2,n.push(192|31&o>>6),n.push(128|63&o)):o>=2048&&o<=65535&&(r+=3,n.push(224|15&o>>12),n.push(128|63&o>>6),n.push(128|63&o))}for(var a=0,u=n.length;a<u;a++)n[a]>255&&(n[a]&=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,o="";++i<s.length;){var a=Number(s[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^s[++i])<<6|128^s[++i])<<6|128^s[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^s[++i])<<6|128^s[++i]:192==(192&a)&&(a=(a^=192)<<6|128^s[++i])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===s.length||r.length>16384)&&(o+=String.fromCharCode.apply(null,r),r.length=0)}return o}}]),e}(),lh=function(){function e(t){Tt(this,e),this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return Ct(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 ch.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),hh=function(){function e(){Tt(this,e),this._pool=[],this._position=0,this._writen=0}return Ct(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=ch.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),fh="UpStreamMessage",dh="PushExtra",gh="DownStreamMessage",ph="DownStreamMessages",vh="SessionsAttQryInput",yh="SessionsAttOutput",mh="SyncRequestMsg",_h="ChrmPullMsg",Eh="NotifyMsg",Rh="HistoryMsgInput",Th="HistoryMsgOuput",Ih="RelationQryInput",Ch="RelationsOutput",Sh="DeleteSessionsInput",bh="SessionInfo",wh="DeleteSessionsOutput",Nh="RelationsInput",Oh="DeleteMsgInput",kh="CleanHisMsgInput",Ah="SessionMsgReadInput",Mh="ChrmInput",Lh="ChrmOutput",Uh="QueryChatRoomInfoInput",xh="QueryChatRoomInfoOutput",Ph="RtcInput",Dh="RtcUserListOutput",Vh="SetUserStatusInput",Bh="RtcSetDataInput",Fh="RtcUserSetDataInput",jh="RtcDataInput",Kh="RtcSetOutDataInput",qh="MCFollowInput",Yh="RtcTokenOutput",Hh="RtcQryOutput",Gh="RtcQryUserOutDataInput",Wh="RtcUserOutDataOutput",Qh="RtcQueryListInput",Jh="RtcRoomInfoOutput",zh="RtcValueInfo",Zh="RtcKeyDeleteInput",Xh="GetQNupTokenInput",$h="GetQNupTokenOutput",ef="GetQNdownloadUrlInput",tf="GetDownloadUrlInput",nf="GetQNdownloadUrlOutput",rf="GetDownloadUrlOutput",sf="SetChrmKV",of="SetChrmKVS",af="DeleteChrmKVS",uf="ChrmKVOutput",cf="ChrmKVSOutput",lf="ChrmKVSOutputEntity",hf="QueryChrmKV",ff="SetUserSettingInput",df="SetUserSettingOutput",gf="PullUserSettingInput",pf="PullUserSettingOutput",vf="UserSettingNotification",yf="SessionReq",mf="SessionStates",_f="SessionState",Ef="SessionStateItem",Rf="SessionStateModifyReq",Tf="SessionStateModifyResp",If="GrpReadReceiptMsg",Cf="GrpReadReceiptQryReq",Sf="GrpReadReceiptQryResp",bf="GrpMsgReadUser",wf="SessionTagAddInput",Nf="SessionTagItem",Of="SessionTagDelInput",kf="SessionDisTagReq",Af="ReportSDKInput",Mf="ReportSDKOutput",Lf="RtcNotifyMsg",Uf="RtcPullKV",xf="RtcKVOutput",Pf="RtcQueryUserJoinedInput",Df="RtcQueryUserJoinedOutput",Vf="RtcViewerJoinedOutput",Bf="RtcInviteInput",Ff="RtcCancelInviteInput",jf="RtcInviteAnswerInput",Kf="RtcEndInviteInput",qf=(St(ah={},fh,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"]),St(ah,ph,["list","syncTime","finished"]),St(ah,gh,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"]),St(ah,dh,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),St(ah,vh,["nothing"]),St(ah,yh,["inboxTime","sendboxTime","totalUnreadCount"]),St(ah,mh,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),St(ah,_h,["syncTime","count"]),St(ah,Eh,["type","time","chrmId"]),St(ah,Rh,["targetId","time","count","order","busChannel"]),St(ah,Th,["list","syncTime","hasMsg"]),St(ah,Ih,["type","count","startTime","order"]),St(ah,Ch,["info"]),St(ah,Sh,["sessions"]),St(ah,bh,["type","channelId","busChannel"]),St(ah,wh,["nothing"]),St(ah,Nh,["type","msg","count","busChannel","startTime","endTime"]),St(ah,Oh,["type","conversationId","msgs","busChannel"]),St(ah,kh,["targetId","dataTime","conversationType","busChannel"]),St(ah,Ah,["type","msgTime","channelId"]),St(ah,Mh,["nothing"]),St(ah,Lh,["nothing","sessionId","joinTime"]),St(ah,Uh,["count","order"]),St(ah,xh,["userTotalNums","userInfos"]),St(ah,Xh,["type","key","httpMethod","queryString"]),St(ah,ef,["type","key","fileName"]),St(ah,tf,["type","key","fileName"]),St(ah,$h,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),St(ah,nf,["downloadUrl"]),St(ah,rf,["downloadUrl"]),St(ah,sf,["entry","bNotify","notification","type"]),St(ah,of,["entry","bNotify","notification","type"]),St(ah,af,["entry","bNotify","notification","type"]),St(ah,uf,["entries","bFullUpdate","syncTime"]),St(ah,cf,["timestamp","errorKeys"]),St(ah,lf,["key","errorCode"]),St(ah,hf,["timestamp"]),St(ah,ff,["version","value"]),St(ah,df,["version","reserve"]),St(ah,gf,["version","reserve"]),St(ah,pf,["items","version"]),St(ah,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),St(ah,yf,["time"]),St(ah,mf,["version","state"]),St(ah,_f,["type","channelId","time","stateItem","busChannel"]),St(ah,Ef,["sessionStateType","value","tags"]),St(ah,Rf,["version","state"]),St(ah,Tf,["version"]),St(ah,If,["msgId","busChannel"]),St(ah,Cf,["msgId","busChannel"]),St(ah,Sf,["totalMemberNum","list"]),St(ah,bf,["readTime","userId"]),St(ah,wf,["version","tags"]),St(ah,Nf,["tagId","name","createdTime","isTop"]),St(ah,Of,["version","tags"]),St(ah,kf,["tagId"]),St(ah,vf,["version","reserve"]),St(ah,Af,["sdkInfo"]),St(ah,Mf,["nothing"]),St(ah,Ph,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"]),St(ah,Dh,["users","token","sessionId","roomInfo"]),St(ah,Vh,["status"]),St(ah,Bh,["interior","target","key","value","objectName","content"]),St(ah,Fh,["valueInfo","objectName","content"]),St(ah,jh,["interior","target","key","objectName","content"]),St(ah,Kh,["target","valueInfo","objectName","content"]),St(ah,qh,["state"]),St(ah,Yh,["rtcToken"]),St(ah,Hh,["outInfo"]),St(ah,Gh,["userId"]),St(ah,Wh,["user"]),St(ah,Qh,["order"]),St(ah,Jh,["roomId","roomData","userCount","list"]),St(ah,zh,["key","value"]),St(ah,Zh,["key"]),St(ah,Lf,["type","time","roomId"]),St(ah,Uf,["timestamp","roomId"]),St(ah,xf,["entries","bFullUpdate","syncTime"]),St(ah,Pf,["userId"]),St(ah,Df,["info"]),St(ah,Bf,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),St(ah,Ff,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),St(ah,jf,["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),St(ah,Kf,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),ah),Yf={},Hf=function(e){var t=qf[e];Yf[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(Yn(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Yf[e].decode=function(e){var t={};Ls(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(Yn(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Gf in qf)Hf(Gf);Yf.getModule=function(e){return Yf[e]()},lc("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Wf="\npackage Modules;\nmessage probuf {\n message ".concat(Vh,"\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(Eh," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(mh," {\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(fh," {\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(dh," {\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(ph," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(gh," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(Ms.IMAGE,";\n audio = ").concat(Ms.AUDIO,";\n video = ").concat(Ms.VIDEO,";\n file = ").concat(Ms.FILE,";\n }\n message ").concat(Xh," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(ef," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(tf," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat($h," {\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(nf," {\n required string downloadUrl = 1;\n }\n message ").concat(rf," {\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(Mh," {\n required int32 nothing = 1;\n }\n message ").concat(Lh," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(_h," {\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(Ih,"\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(Nh,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n optional string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(Ch,"\n {\n repeated RelationInfo info = 1;\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(kh,"\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(Uh,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(xh,"\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(qh,"\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(Rh,"\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(Th,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Qh,"{\n optional int32 order=1;\n }\n\n message ").concat(Zh,"{\n repeated string key=1;\n }\n\n message ").concat(zh,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(zh," userData=2; //用户资源信息\n }\n\n message ").concat(Dh,"{\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(zh," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Ph,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(Hh,"{\n repeated ").concat(zh," 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(jh,"{\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(Bh,"{\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(Fh," {\n repeated ").concat(zh," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(zh," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Yh,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(Kh,"{\n required targetType target=1;\n repeated ").concat(zh," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Gh,"{\n repeated string userId = 1;\n }\n message ").concat(Wh,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(vh,"{\n required int32 nothing = 1;\n }\n message ").concat(yh,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Ah,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Sh,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(bh,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(wh,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Oh,"\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(sf," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(of," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(af," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(uf," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(cf," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message ").concat(lf,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(hf," {\n required int64 timestamp = 1;\n }\n message ").concat(ff," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(df," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(gf," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(pf," {\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(yf," {\n required int64 time = 1;\n }\n message ").concat(mf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(_f," {\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(Ef," {\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(Rf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Tf," {\n required int64 version=1;\n }\n message ").concat(If," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Cf," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Sf," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(bf," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(wf," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Nf," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(Of," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(kf," {\n repeated string tagId=1;\n }\n message ").concat(vf," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Af,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Mf,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Lf," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Uf,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(xf,"\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(Pf,"\n {\n required string userId = 1;\n }\n message ").concat(Df,"\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(Vf,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Bf,"\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(Ff,"\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(jf,"\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(Kf,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n}\n"),Qf=/"/g;Pe({target:"String",proto:!0,forced:function(e){return a((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}("sub")},{sub:function(){return e="sub",t="",n="",r=String(m(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+String(n).replace(Qf,""")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var Jf="ArrayBuffer",zf=Uu.ArrayBuffer,Zf=o.ArrayBuffer;Pe({global:!0,forced:Zf!==zf},{ArrayBuffer:zf}),kr(Jf),Pe({target:"Array",proto:!0},{fill:ru}),lr("fill");var Xf,$f,ed,td,nd,rd=(Xf=Wf,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":_t(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,o,a={},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+")"},a.Tokenizer=u,(o=(s=function(e){this.tn=new u(e),this.proto3=!1}).prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},s.parse=function(e){return new s(e).parse()},o._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},o._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)},o._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(";")},o._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)}},o._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)},o._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},o._parseMessage=function(e,r){var i=!!r,s=this.tn.next(),o={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(i?"group":"message")+" name: "+s);for(o.name=s,i&&(this.tn.skip("="),r.id=n(this.tn.next()),o.isGroup=!0),"["===(s=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(o,s);else if("oneof"===s)this._parseMessageOneOf(o);else if("enum"===s)this._parseEnum(o);else if("message"===s)this._parseMessage(o);else if("option"===s)this._parseOption(o);else if("service"===s)this._parseService(o);else if("extensions"===s)o.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(o);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(o,"optional",s)}return this.tn.omit(";"),e.messages.push(o),o},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,r,i){var s,o,a;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("<"),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(s.keytype=o,this.tn.skip(","),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field: "+o);if(s.type=o,this.tn.skip(">"),o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,s),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);s.type=a.name,s.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(s.type=i,o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},o._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},o._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()},o._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)},o._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},o._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},o.toString=function(){return"Parser at line "+this.tn.line},a.Parser=s,a}(i,i.Lang),i.Reflect=function(t){function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),s=7&r,o=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(o,n);break;case t.WIRE_TYPES.ENDGROUP:if(o===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+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 s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R={},T=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},I=T.prototype;return I.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},I.toString=function(e){return(e?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=T,(o=(s=function(e,t,n,r,i){T.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(T.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 c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.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 s&&(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=s,u=(a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)}).prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},u.verifyValue=function(n){var i,s,o,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(_t(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(_t(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(_t(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)&&a(_t(n),"not an integer"),(n>4294967295||n<0)&&a(_t(n),"not in range for uint32"),n;a(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"===_t(n)||a(_t(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(o in s={},n)n.hasOwnProperty(o)&&(s[o]=n[o]);n=s}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},u.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)")},u.encodeValue=function(e,r,i){var s,o;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:o=(new n).LE(),this.resolvedType.encode(r,o),i.writeVarint32(o.offset),i.append(o.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},u.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")},u.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)}},u.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=a,(l=(c=function(e,t,n,r,i,o){s.call(this,e,t,n,r,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(s.prototype)).build=function(r){var i,s,o,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,s,o){var a,u,c,l,h,f,d;if(null===e||"object"!==_t(e))return o&&o instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(o.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return s?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(e,t){u[t]=i(e,r,s,o)})),u;if(u={},e instanceof t.Map){for(l=(c=e.entries()).next();!l.done;l=c.next())u[e.keyElem.valueToString(l.value[0])]=i(l.value[1],r,s,e.valueElem.resolvedType);return u}for(d in h=e.$type,f=void 0,e)e.hasOwnProperty(d)&&(u[d]=h&&(f=h.getChild(d))?i(e[d],r,s,f.resolvedType):i(e[d],r,s));return u}var s,o,a=r.getChildren(t.Reflect.Message.Field),u=r.getChildren(t.Reflect.Message.OneOf),c=function e(i){var s,o,c,l;for(t.Builder.Message.call(this),s=0,o=u.length;o>s;++s)this[u[s].name]=null;for(s=0,o=a.length;o>s;++s)this[(c=a[s]).name]=c.repeated?[]:c.map?new t.Map(c):null,!c.required&&"proto3"!==r.syntax||null===c.defaultValue||(this[c.name]=c.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===i||"object"!==_t(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(s=0,o=arguments.length;o>s;++s)void 0!==(l=arguments[s])&&this.$set(a[s].name,l);else this.$set(i)},l=c.prototype=Object.create(t.Builder.Message.prototype);for(l.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},l.$add=l.add,l.set=function(e,n,i){var s,o,a;if(e&&"object"===_t(e)){for(s in i=n,e)e.hasOwnProperty(s)&&void 0!==(n=e[s])&&this.$set(s,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&&(a=this[o.oneof.name],null!==n?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===e&&(this[o.oneof.name]=null)),this},l.$set=l.set,l.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]},l.$get=l.get,s=0;s<a.length;s++)(o=a[s])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)&&(l["set"+s]=n),null===r.getChild("set_"+t)&&(l["set_"+t]=n),null===r.getChild("get"+s)&&(l["get"+s]=i),null===r.getChild("get_"+t)&&(l["get_"+t]=i)}(o);return l.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}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return r.calculate(this)},l.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},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.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}},c.decodeDelimited=function(e,t){var i,s,o;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 o=r.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,o}catch(t){throw e.offset+=s,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:r.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:r}),Object.defineProperty(l,"$type",{value:r})),c}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,a=this.children.length;a>o;o++)if((s=this.children[o])instanceof p||s instanceof c||s instanceof m){if(i.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");i[s.name]=s.build()}else if(s instanceof c.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(!(s instanceof c.OneOf||s instanceof y))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,s,o,a,u=null;for(s=0,o=this._fields.length;o>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(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.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},l.decode=function(e,n,r){var s,o,a,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(a=(s=e.readVarint32())>>>3,(o=7&s)===t.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(o,e)):u.map?(f=u.decode(o,e),l[u.name].set(f[0],f[1])):(l[u.name]=u.decode(o,e),u.oneof&&(null!==(d=l[u.oneof.name])&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name));else switch(o){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(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}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=c,(f=(h=function(e,n,r,i,s,o,a,u,l,h){T.call(this,e,n,o),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=a,this.options=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=t.Util.toCamelCase(this.name))}).prototype=Object.create(T.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},f.verifyValue=function(e,n){var r,i,s;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(_t(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(_t(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),s=[],i=0;i<e.length;i++)s.push(this.element.verifyValue(e[i]));return s}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(_t(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(_t(e),"no array expected"),this.element.verifyValue(e))},f.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}},f.encode=function(e,r,i){var s,o,a,u,c;if(null===this.type||"object"!==_t(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,s=0;s<e.length;s++)this.element.encodeValue(this.id,e[s],r);a=r.offset-o,(u=n.calculateVarint32(a))>1&&(c=r.slice(o,r.offset),o+=u-1,r.offset=o,r.append(c)),r.writeVarint32(a,o-u)}else for(s=0;s<e.length;s++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[s],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},f.calculate=function(e,r){var i,s,o;if(e=this.verifyValue(e),null===this.type||"object"!==_t(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,s=0;s<e.length;s++)o+=this.element.calculateLength(this.id,e[s]);i+=n.calculateVarint32(o),i+=o}else for(s=0;s<e.length;s++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[s]);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},f.decode=function(e,n,r){var i,s,o,u,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,o=[];n.offset<s;)o.push(this.decode(this.type.wireType,n,!0));return o}if(this.map){if(u=a.defaultFieldValue(this.keyType),i=a.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))u=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[u,i]}return this.element.decode(n,e,this.id)},R.Message.Field=h,(d=function(e,t,n,r,i,s,o){h.call(this,e,t,n,null,r,i,s,o),this.extension}).prototype=Object.create(h.prototype),R.Message.ExtensionField=d,g=function(e,t,n){T.call(this,e,t,n),this.fields=[]},R.Message.OneOf=g,(p=function(e,t,n,r,i){s.call(this,e,t,n,r,i),this.className="Enum",this.object=null}).getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(p.prototype=Object.create(s.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(p.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=p,(v=function(e,t,n,r){T.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(T.prototype),R.Enum.Value=v,(y=function(e,t,n,r){T.call(this,e,t,n),this.field=r}).prototype=Object.create(T.prototype),R.Extension=y,((m=function(e,t,n,r){s.call(this,e,t,n,r),this.className="Service",this.clazz=null}).prototype=Object.create(s.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)}},s=i.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<o.length;r++)!function(e){s[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"!==_t(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(s[e.name],"$options",{value:i[e.name].$options}))}(o[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),i}(t,this)},R.Service=m,((_=function(e,t,n,r){T.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(T.prototype)).buildOpt=o.buildOpt,R.Service.Method=_,(E=function(e,t,n,r,i,s,o,a){_.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=s,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(_.prototype),R.Service.RPCMethod=E,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||{}},s=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"!==_t(e.rpc)||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.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},s.create=function(t){var r,s,o,a,u;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(s=t.shift(),i.isMessage(s)){if(o=new n.Message(this,this.ptr,s.name,s.options,s.isGroup,s.syntax),a={},s.oneofs&&Object.keys(s.oneofs).forEach((function(e){o.addChild(a[e]=new n.Message.OneOf(this,o,e))}),this),s.fields&&s.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"!==_t(e.options))throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[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,s.syntax),t&&t.fields.push(e),o.addChild(e)}),this),u=[],s.enums&&s.enums.forEach((function(e){u.push(e)})),s.messages&&s.messages.forEach((function(e){u.push(e)})),s.services&&s.services.forEach((function(e){u.push(e)})),s.extensions&&(o.extensions="number"==typeof s.extensions[0]?[s.extensions]:s.extensions),this.ptr.addChild(o),u.length>0){r.push(t),t=u,u=null,this.ptr=o,o=null;continue}u=null}else if(i.isEnum(s))o=new n.Enum(this,this.ptr,s.name,s.options,s.syntax),s.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(s))o=new n.Service(this,this.ptr,s.name,s.options),Object.keys(s.rpc).forEach((function(e){var t=s.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(s))throw Error("not a valid definition: "+JSON.stringify(s));if(o=this.ptr.resolve(s.ref,!0))s.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(s.ref))throw Error("extended message "+s.ref+" is not defined")}s=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,n){var i,s,o,a,u,c,l,h,f="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"===_t(n)){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(f="\\"),s=i+f+n.file,!0===this.files[s])return this.reset();this.files[s]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"===_t(n)?(this.importRoot=n.root,a=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(f="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),f="\\"):o=".":o=null,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=o+f+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var r;if(null==this.ptr||"object"===_t(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: "+_t(this.ptr)+": "+this.ptr);return this.reset()},s.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},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.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,o;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]),o=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(s)]={key:s,value:o}},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"===_t(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"===_t(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"===_t(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"===_t(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"===_t(e)?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=Xf,i.loadProto(r,void 0,"").build("Modules").probuf}(function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var s,o,a=8*i-r-1,u=(1<<a)-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+=a;l>0;s=256*s+e[t+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=c}return(d?-1:1)*o*Math.pow(2,s-r)}function i(e,t,n,r,i,s){var o,a,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?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*u-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+d]=255&a,d+=g,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;e[n+d]=255&o,d+=g,o/=256,c-=8);e[n+d-g]|=128*p}var s,o,a,u,c,l=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 l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(s=l.prototype).__isByteBuffer__,Object.defineProperty(s,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,s,o,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,o=0,a=e.length;a>o;++o)l.isByteBuffer(e[o])||(e[o]=l.wrap(e[o],t)),(s=e[o].limit-e[o].offset)>0&&(i+=s);if(0===i)return new l(0,n,r);for(c=new l(i,n,r),o=0;a>o;)(s=(u=e[o++]).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},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.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 l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!==_t(e))throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=s.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(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 l(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 l(e.length,n,r)).limit=e.length,o=0;o<e.length;++o)i.view[o]=e[o]}return i},s.writeBitSet=function(e,t){var n,r,i,s,o,a,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,o=0,t+=this.writeVarint32(i,t);s--;)n=1&!!e[o++]|(1&!!e[o++])<<1|(1&!!e[o++])<<2|(1&!!e[o++])<<3|(1&!!e[o++])<<4|(1&!!e[o++])<<5|(1&!!e[o++])<<6|(1&!!e[o++])<<7,this.writeByte(n,t++);if(i>o){for(a=0,n=0;i>o;)n|=(1&!!e[o++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},s.readBitSet=function(e){var t,n,r,i,s,o,a,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,s=0,o=[],e+=n.length;i--;)t=this.readByte(e++),o[s++]=!!(1&t),o[s++]=!!(2&t),o[s++]=!!(4&t),o[s++]=!!(8&t),o[s++]=!!(16&t),o[s++]=!!(32&t),o[s++]=!!(64&t),o[s++]=!!(128&t);if(r>s)for(a=0,t=this.readByte(e++);r>s;)o[s++]=!!(1&t>>a++);return u&&(this.offset=e),o},s.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},s.writeBytes=s.append,s.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},s.writeByte=s.writeInt8,s.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},s.readByte=s.readInt8,s.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},s.writeUInt8=s.writeUint8,s.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},s.readUInt8=s.readUint8,s.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},s.writeShort=s.writeInt16,s.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},s.readShort=s.readInt16,s.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},s.writeUInt16=s.writeUint16,s.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},s.readUInt16=s.readUint16,s.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},s.writeInt=s.writeInt32,s.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},s.readInt=s.readInt32,s.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},s.writeUInt32=s.writeUint32,s.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},s.readUInt32=s.readUint32,e&&(s.writeInt64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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),o&&(this.offset+=8),this},s.writeLong=s.writeInt64,s.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},s.readLong=s.readInt64,s.writeUint64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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),o&&(this.offset+=8),this},s.writeUInt64=s.writeUint64,s.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},s.readUInt64=s.readUint64),s.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},s.writeFloat=s.writeFloat32,s.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},s.readFloat=s.readFloat32,s.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},s.writeDouble=s.writeFloat64,s.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},s.readDouble=s.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},s.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=l.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},s.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},s.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}},s.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"===_t(t)?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.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},l.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()},l.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()},s.writeVarint64=function(t,n){var r,i,s,o,a,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=l.calculateVarint64(t),i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,o=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&o>>>7;case 9:this.view[n+8]=9!==r?128|o:127&o;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},s.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},s.readVarint64=function(t){var n,r,i,s,o,a,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,o=0,r=127&(o=this.view[t++]),128&o&&(r|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(i=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(s=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<7,128&o||this.noAssert&&void 0===o))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|s<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},s.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),s.writeCString=function(e,n){var r,i,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=i+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,o?(this.offset=n,this):i},s.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,c.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}},s.writeIString=function(e,n){var r,i,s,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(i=n,r=c.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,c.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 o?(this.offset=n,this):n-i},s.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,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",s.writeUTF8String=function(e,n){var r,i,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),o?(this.offset=n,this):n-i},s.writeString=s.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateString=l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},s.readUTF8String=function(e,t,r){var i,s,o,a,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.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(o=0,a=r,t===l.METRICS_CHARS){if(s=n(),c.decodeUTF8(function(){return e>o&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++o,c.UTF8toUTF16(e,s)})),o!==e)throw RangeError("Illegal range: Truncated data, "+o+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-a}}if(t===l.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,c.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-a}}throw TypeError("Unsupported metrics: "+t)},s.readString=s.readUTF8String,s.writeVString=function(e,n){var r,i,s,o,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(s=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+r,n+=this.writeVarint32(r,n),c.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 a?(this.offset=n,this):n-s},s.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,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},s.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 l||(e=l.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},s.appendTo=function(e,t){return e.append(this,t),this},s.assert=function(e){return this.noAssert=!e,this},s.capacity=function(){return this.buffer.byteLength},s.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},s.clone=function(e){var t=new l(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},s.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)},s.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 l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(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},s.copyTo=function(e,t,n,r){var i,s,o;if(!this.noAssert&&!l.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==(o=r-n)?e:(e.ensureCapacity(t+o),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=o),s&&(e.offset+=o),this)},s.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},s.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},s.flip=function(){return this.limit=this.offset,this.offset=0,this},s.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},s.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},s.LE=function(e){return this.littleEndian=void 0===e||!!e,this},s.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},s.prepend=function(e,t,n){var r,i,s,o,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((s=i-n)>0?(o=new ArrayBuffer(this.buffer.byteLength+s),(a=new Uint8Array(o)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=o,this.view=a,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},s.prependTo=function(e,t){return e.prepend(this,t),this},s.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},s.remaining=function(){return this.limit-this.offset},s.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},s.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},s.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},s.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},s.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},s.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},s.toArrayBuffer=s.toBuffer,s.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)}},u=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,o;null!==(r=e());)if(void 0===(s=i[r])&&n(r),null!==(r=e())&&(void 0===(o=i[r])&&n(r),t(s<<2>>>0|(48&o)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;n(r)}if(t((15&o)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(o=i[r])){if(61===r)break;n(r)}t((3&s)<<6>>>0|o)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),s.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},s.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)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new l(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},s.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",o="";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+=" ";o+=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+=" ";o+=i+s+"\n"}return e?o:i},l.fromDebug=function(e,t,n){for(var r,i,s=e.length,o=new l(0|(s+1)/3,t,n),a=0,u=0,c=!1,h=!1,f=!1,d=!1,g=!1;s>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(h||f||d){g=!0;break}h=f=d=!0}o.offset=o.markedOffset=o.limit=u,c=!1;break;case"|":if(!n){if(h||d){g=!0;break}h=d=!0}o.offset=o.limit=u,c=!1;break;case"[":if(!n){if(h||f){g=!0;break}h=f=!0}o.offset=o.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}o.offset=u,c=!1;break;case"]":if(!n){if(d||f){g=!0;break}d=f=!0}o.limit=o.markedOffset=u,c=!1;break;case">":if(!n){if(d){g=!0;break}d=!0}o.limit=u,c=!1;break;case"'":if(!n){if(f){g=!0;break}f=!0}o.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");o.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!d)throw TypeError("Illegal str: Missing offset or limit");if(u<o.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return o},s.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("")},l.fromHex=function(e,t,n){var r,i,s,o,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(i=e.length,s=new l(0|i/2,t),o=0,a=0;i>o;o+=2){if(r=parseInt(e.substring(o,o+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[a++]=r}return s.limit=a,s},c=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,o=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())&&o([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&o([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()))&&o([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}(),s.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{c.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()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return c.encodeUTF16toUTF8(t(e),(function(e){i.view[s++]=e})),i.limit=s,i},l}($f=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=a[e])?r:(n=i(e,e<0?-1:0,!1),s&&(a[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 R;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,o,a,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(o=r(c(n,8)),a=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)),a=a.mul(f).add(r(h))):a=(a=a.mul(o)).add(r(h));return a.unsigned=t,a}function o(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?s(t):i(t.low,t.high,t.unsigned)}var a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=s,e.fromValue=o,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,R=i(0,-2147483648,!1),e.MIN_VALUE=R,(T=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},T.toString=function(e){var t,n,i,s,o,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(R)?(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),o=this,a="";;){if(u=o.div(s),l=(o.sub(u.mul(s)).toInt()>>>0).toString(e),(o=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(R)?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},T.isZero=function(){return 0===this.high&&0===this.low},T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.compare=function(e){if(t(e)||(e=o(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},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(v)},T.neg=T.negate,T.add=function(e){var n,r,s,a,u,c,l,h,f,d,g;return t(e)||(e=o(e)),n=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=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+=a+(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)},T.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){var n,s,a,u,c,l,h,f,p,v,y,m;return this.isZero()?g:(t(e)||(e=o(e)),e.isZero()?g:this.eq(R)?e.isOdd()?R:g:e.eq(R)?this.isOdd()?R: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,a=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+=a*f)>>>16,y&=65535,v+=(y+=u*h)>>>16,p+=(v+=s*f)>>>16,v&=65535,p+=(v+=a*h)>>>16,v&=65535,p+=(v+=u*l)>>>16,p+=n*f+s*h+a*l+u*c,i((y&=65535)<<16|(m&=65535),(p&=65535)<<16|(v&=65535),this.unsigned)))},T.mul=T.multiply,T.divide=function(e){var n,i,s,a,u,l,h;if(t(e)||(e=o(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(R))return e.eq(v)||e.eq(m)?R:e.eq(R)?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(R))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=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-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},T.div=T.divide,T.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.not=function(){return i(~this.low,~this.high,this.unsigned)},T.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return t(e)||(e=o(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},T.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)},T.shl=T.shiftLeft,T.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)},T.shr=T.shiftRight,T.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))},T.shru=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.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]},T.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}()),$f));rd.getModule=function(e){var t=new rd[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Ds(e)?[].slice.call(new Int8Array(e)):e},t};var id="pgMsgP",sd="chatMsg",od="pcMsgP",ad={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},ud="delMsg",cd="joinChrm",ld="joinChrmR",hd="exitChrm",fd="setKV",dd="delKV",gd="setKVS",pd="delKVS",vd="qryRelationR",yd="delRelation",md="setSeAtt",_d={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Ed="qryPMsg",Rd="qryGMsg",Td="qryCHMsg",Id="qryCMsg",Cd="qrySMsg",Sd=(St(ed={},"ppMsgP",ks.PRIVATE),St(ed,id,ks.GROUP),St(ed,sd,ks.CHATROOM),St(ed,od,ks.CUSTOMER_SERVICE),ed),bd=(St(td={},ks.PRIVATE,Ed),St(td,ks.GROUP,Rd),St(td,ks.CHATROOM,Td),St(td,ks.CUSTOMER_SERVICE,Id),St(td,ks.SYSTEM,Cd),td),wd=(St(nd={},ks.PRIVATE,_d.PRIVATE),St(nd,ks.GROUP,_d.GROUP),St(nd,ks.CUSTOMER_SERVICE,_d.CUSTOMER_SERVICE),St(nd,ks.SYSTEM,_d.SYSTEM),nd),Nd="1",Od="0",kd=1,Ad=2,Md=3,Ld=function(){function t(e){Tt(this,t),this._codec="websocket"===e?rd:Yf,this._connectType=e}return Ct(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,o=(St(r={},ph,i._formatSyncMessages),St(r,gh,i._formatReceivedMessage),St(r,fh,i._formatSentMessage),St(r,Th,i._formatHistoryMessages),St(r,Ch,i._formatConversationList),St(r,xh,i._formatChatRoomInfos),St(r,Dh,i._formatRTCUserList),St(r,Hh,i._formatRTCData),St(r,uf,i._formatChatRoomKVList),St(r,pf,i._formatUserSetting),St(r,mf,i._formatConversationStatus),St(r,Sf,i._formatGrpReadReceiptQryResp),St(r,df,i._formatSetUserSettingOutput),St(r,vf,i._formatUserSettingNotification),St(r,xf,i._formatRTCRoomKVList),St(r,Yh,i._formatRTCAuidenceJoinRoomData),St(r,Df,i._formatRTCJoinedUserInfo),r)[t];try{s=e.length>0&&i._codec[t].decode(e),Bs(s)&&(s=function(e){for(var t in e)Bs(e[t])&&(e[t]=la(e[t]));return e}(s)),Fs(o)&&(s=o.call(this,s,n))}catch(n){Ws.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=Ds(n)?new Uint8Array(n):n;return ch.readUTF(i.subarray(t,r))}catch(e){Ws.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Ws.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(js(s)||null===s)&&(e.finished=!0),e.syncTime=la(i),e.list=ya(r,(function(e){return n._formatReceivedMessage(e,t)})),e}},{key:"_formatReceivedMessage",value:function(e,t){var r=t=t||{},i=r.currentUserId,s=r.connectedTime,o=e.content,a=e.fromUserId,u=e.type,c=e.groupId,l=e.status,h=e.dataTime,f=e.classname,d=e.msgId,g=e.extraContent,p=e.pushContent,v=e.pushExt,y=e.configFlag,m=(e.direction||no.RECEIVE)===no.SEND,_=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)}}(l),E=_.isPersited,R=_.isCounted,T=_.isMentioned,I=_.disableNotification,C=_.receivedStatus,S=_.canIncludeExpansion,b=[ks.GROUP,ks.CHATROOM,ks.RTC_ROOM].indexOf(u)>-1?c:a,w=m?i:a,N=la(h),O=N<s,k=u===ks.CHATROOM,A=this._formatBytes(o),M={};if(v&&(M=da(v.pushConfigs,v.pushId)),A.user){var L=A.user,U=L.portrait,x=L.portraitUri,P=U||x;P&&(A.user.portrait=A.user.portraitUri=P)}var D,V=wt(wt({},M),{},{pushTitle:null==v?void 0:v.title,pushContent:p,pushData:p,disablePushTitle:!!y&&Boolean(4&y),forceShowDetailContent:!!y&&Boolean(8&y),templateId:null==v?void 0:v.templateId}),B=m?no.SEND:no.RECEIVE;return k&&a===i&&(B=no.SEND),g&&(D={},D=Ca(g)),{conversationType:u,targetId:b,senderUserId:w,messageType:f,messageUId:d,isPersited:E,isCounted:R,isMentioned:T,sentTime:N,isOffLineMessage:O,messageDirection:B,receivedTime:Sa.getTime(),disableNotification:I,receivedStatus:C,canIncludeExpansion:S,content:A,expansion:D,configFlag:y,pushConfig:V,channelId:e.busChannel||""}}},{key:"_formatSentMessage",value:function(e,t){var n,r=e.content,i=e.classname,s=e.sessionId,o=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=t.signal,f=t.currentUserId,d=h.date,g=h.topic,p=h.targetId,v=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(s),y=v.isPersited,m=v.isCounted,_=v.disableNotification,E=v.canIncludeExpansion,R=Sd[g]||ks.PRIVATE,T=_a(ad,g),I=this._formatBytes(r),C=p;i===co.RECALL&&(R=I.conversationType||R,C=I.targetId||p),a&&(n={},n=Ca(a));var S={};u&&(S=da(u.pushConfigs,u.pushId));var b=wt(wt({},S),{},{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==u?void 0:u.templateId});return{conversationType:R,targetId:C,messageType:i,messageUId:o,isPersited:y,isCounted:m,isStatusMessage:T,senderUserId:f,content:this._formatBytes(r),sentTime:1e3*d,receivedTime:Sa.getTime(),messageDirection:no.SEND,isOffLineMessage:!1,disableNotification:_,canIncludeExpansion:E,expansion:n,pushConfig:b,channelId:e.busChannel||""}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,o=r.targetId,a=la(e.syncTime),u=[];return va(i,(function(e){var r=n._formatReceivedMessage(e,t);r.targetId=o,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!s}}},{key:"_formatConversationList",value:function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){};return(r=ya(r,(function(e){var r=e.msg,s=e.userId,o=e.type,a=e.unreadCount,u=e.busChannel,c=null;r&&((c=n._formatReceivedMessage(r,t)).targetId=s);var l={targetId:s,conversationType:o,unreadMessageCount:a,latestMessage:c,channelId:u||""};return i(l)||l})))||[]}},{key:"_formatSetUserSettingOutput",value:function(e){return e}},{key:"_formatChatRoomInfos",value:function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:ya(n,(function(e){var t=e.id,n=e.time;return{id:t,time:la(n)}}))}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=ya(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,s=e.uid,o=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?mo.DELETE:mo.UPDATE}}(r);return{key:t,value:n,isAutoDelete:o.isAutoDelete,isOverwrite:o.isOverwrite,type:o.type,userId:s,timestamp:la(i)}})),isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return va(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=la(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=la(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return va(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,o=e.busChannel,a=ho.CLOSE,u=!1,c=[];va(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case kd:a=n===Nd?ho.OPEN:ho.CLOSE;break;case Ad:u=n===Nd;break;case Md:c=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,isTop:u,updatedTime:la(i),tags:c,channelId:o||""})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,s=e.entries,o={};return va(t,(function(e){var t=e.userId,n=e.userData,r={};va(n,(function(e){var t=e.key,n=e.value;r[t]=n})),o[t]=r})),{users:o,token:n,sessionId:r,roomInfo:i,kvEntries:s}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return va(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 va(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=la(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:la(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:la(e.joinTime)}}))}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(vh);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=(e.conversationType,t.messageType),i=t.isMentioned,s=t.mentionedType,o=t.mentionedUserIdList,a=t.content,u=t.pushContent,c=t.pushData,l=t.directionalUserIdList,h=t.isFilerWhiteBlacklist,f=t.isVoipPush,d=t.canIncludeExpansion,g=t.expansion,p=t.pushConfig,v=t.channelId;ks.GROUP;var y,m,_,E=this._codec.getModule(fh),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),T=p||{},I=T.pushTitle,C=T.pushContent,S=T.pushData,b=T.iOSConfig,w=T.androidConfig,N=T.templateId,O=T.disablePushTitle,k=T.forceShowDetailContent,A=0;(E.setSessionId(R),i&&a)&&(a.mentionedInfo={userIdList:(null===(y=a.mentionedInfo)||void 0===y?void 0:y.userIdList)||o||[],type:(null===(m=a.mentionedInfo)||void 0===m?void 0:m.type)||s||go.ALL,mentionedContent:(null===(_=a.mentionedInfo)||void 0===_?void 0:_.mentionedContent)||""});var M=C||u||"",L=S||c||"";if(M&&E.setPushText(M),L&&E.setAppData(L),l&&E.setUserId(l),A|=f?1:0,A|=h?2:0,A|=O?4:0,A|=k?8:0,E.setConfigFlag(A),E.setClassname(r),a.user&&a.user.portraitUri&&(a.user.portrait=a.user.portraitUri),E.setContent(JSON.stringify(a)),d&&g){var U={};va(g,(function(e,t){U[t]={v:e}})),E.setExtraContent(JSON.stringify(U))}if(p){var x=this._codec.getModule(dh);if(I&&x.setTitle(I),b&&w){var P=fa(b,w);x.setPushConfigs(P)}(null==w?void 0:w.notificationId)&&x.setPushId(null==w?void 0:w.notificationId),x.setTemplateId(N||""),E.setPushExt(n?x.getArrayData():x)}return js(v)||E.setBusChannel(v),E}},{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(mh);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(_h);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,o=this._codec.getModule(Rh);return o.setTargetId(e),o.setTime(i),o.setCount(n),o.setOrder(r),o.setBusChannel(s||""),o.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(Ih);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 o=this._codec.getModule(Ih);return o.setType(r),o.setCount(n),o.setStartTime(i),o.setOrder(s),o.getArrayData()}},{key:"encodeRemoveOldConversationList",value:function(e){var t=e=e||{},n=t.conversationType,r=t.channelId,i=this._codec.getModule(Nh);return i.setType(n),i.setBusChannel(r),i.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule(Sh),r=[];return va(e,(function(e){var n=e.conversationType,i=e.targetId,s=t._codec.getModule(bh);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(Oh),s=[];return va(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){var r=this._codec.getModule(kh);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.conversationType,r=e.targetId,i=t.timestamp,s=this._codec.getModule(Ah);return i=i||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(i),s.getArrayData()}},{key:"encodeJoinOrQuitChatRoom",value:function(){var e=this._codec.getModule(Mh);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(Uh);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(Xh);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(sf),s=t.key,o=t.value,a=t.notificationExtra,u=t.isSendNotification,c=t.type||mo.UPDATE,l=ba(t,c),h={key:s,value:o||"",uid:n};if(js(l)||(h.status=l),i.setEntry(h),u){var f={conversationType:ks.CHATROOM,targetId:e},d={key:s,value:o,extra:a,type:c},g=this._getUpMsgModule(f,{messageType:co.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(ks.CHATROOM)}return i.getArrayData()}},{key:"encodeModifyChatRoomKVS",value:function(e,t,n){this._connectType;var r=this._codec.getModule(of),i=t.entries,s=t.type||mo.UPDATE,o=ba(t,s),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};js(o)||(t.status=o),a.push(t)})),r.setEntry(a),r.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(hf);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(gf);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(yf);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(Rf),i=Sa.getTime(),s=[];return va(e,(function(e){var r=t._codec.getModule(_f),o=e.conversationType,a=e.targetId,u=e.notificationStatus,c=e.isTop,l=e.channelId,h=[];r.setType(o),r.setChannelId(a),r.setTime(i),r.setBusChannel(l);var f=u===ho.OPEN,d={};js(u)||(d[kd]=f),js(c)||(d[Ad]=c),va(d,(function(e,r){if(!js(e)){var i=t._codec.getModule(Ef);e=e?Nd:Od,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(If);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(wf),s=[];return e.forEach((function(e){var t=n._codec.getModule(Nf);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(If);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(Of),s=[];return e.forEach((function(e){var t=n._codec.getModule(Nf);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(kf);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Rf),s=[];return t.forEach((function(t){var i=n._codec.getModule(_f),o=n._codec.getModule(Ef),a=[];e.forEach((function(e){var t=n._codec.getModule(Nf);t.setTagId(e.tagId),js(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),o.setSessionStateType(Md),o.setValue(JSON.stringify(a)),o.setTags(a),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?o.getArrayData():o]),s.push(r?i.getArrayData():i)})),i.setState(s),i.setVersion(Sa.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(Af);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t,n){var r=this._codec.getModule(Ph);return e=e||0,r.setRoomType(e),js(t)||r.setBroadcastType(t),js(n)||r.setJoinType(n),r.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(Vh).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(Bh);if(s.setInterior(n),s.setTarget(r),s.setKey(e),s.setValue(t),i){i.name&&s.setObjectName(i.name);var o=i.content;o&&(Bs(o)&&(o=JSON.stringify(o)),s.setContent(o))}return s.getArrayData()}},{key:"encodeUserSetRTCData",value:function(e,t,n,r){var i=this,s="comet"===this._connectType,o=this._codec.getModule(Fh);o.setObjectName(n);var a=this._codec.getModule(zh);a.setKey(e.name),a.setValue(e.content),s?o.setContent([a.getArrayData()]):o.setContent(a);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(zh);n.setKey(e);var o="uris"===e?t:r;n.setValue(o),s?u.push(n.getArrayData()):u.push(n)})),o.setValueInfo(u),o.getArrayData()}},{key:"encodeUserSetRTCCDNUris",value:function(e,t){this._connectType;var n=this._codec.getModule(Fh);n.setObjectName(e);var r=this._codec.getModule(zh);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(jh);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(jh);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},o=s.name,a=s.content;return!js(o)&&i.setObjectName(o),js(a)||(Bs(a)&&(a=JSON.stringify(a)),i.setContent(a)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(Kh);r.setTarget(t),Ps(e)||(e=[e]),va(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,o=i.content;return!js(s)&&r.setObjectName(s),js(o)||(Bs(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Gh);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(qh);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(Qh);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(zh);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(Zh);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(Ph);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(Uf);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}},{key:"encodeQueryUserJoinedInfo",value:function(e){var t=this._codec.getModule(Pf);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,o=this._codec.getModule(Bf);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(r),o.setTimeoutTime(i),o.setInviteInfo(s),o.getArrayData()}},{key:"encodeCancelRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,s=this._codec.getModule(Ff);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,o=e.value,a=e.agree?1:0,u=this._codec.getModule(jf);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(s),u.setValue(o),u.setAnswerCode(a),u.getArrayData()}},{key:"encodeEndRoomPK",value:function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,s=this._codec.getModule(Kf);return s.setInviteRoomId(t),s.setInviteSessionId(n),s.setInviteContent(r),s.setInviteRoomKeys(i),s.getArrayData()}}]),t}(),Ud=function e(t,n){Tt(this,e),this._watcher=n,this.codec=new Ld(t)},xd=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Pd=function(){function e(t){Tt(this,e),this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return xd(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}(),Dd=function(){function e(t){Tt(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new uh(t,!1,Vl.AT_MOST_ONCE,!1)}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return xd(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 hh;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),Vd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return Ct(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===Kl.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();Ws.debug("server sessionId -> "+s),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(Pd);Vd.MESSAGE_LENGTH=2;var Bd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.DISCONNECT,e.status=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}}}]),n}(Pd);Bd.MESSAGE_LENGTH=2;var Fd,jd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.call(this,Bl.PING_REQ))._name=Fl.PING_REQ,e}return Ct(n,[{key:"writeMessage",value:function(e){}}]),n}(Dd),Kd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,e))._name=Fl.PING_RESP,r}return n}(Pd),qd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(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}(Pd),Yd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(n,[{key:"writeMessage",value:function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)}}]),n}(Dd),Hd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=jl.PUB,e}return Ct(n,[{key:"readMessage",value:function(e,t){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.data=e.readAll(),{stream:e,length:t}}}]),n}(qd),Gd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Tt(this,n),(s=t.call(this,Bl.PUBLISH))._name=Fl.PUBLISH,s.syncMsg=!1,s.identifier=jl.PUB,s.topic=e,s.data=Ls(r)?ch.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Yd),Wd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=jl.PUB,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(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}(qd),Qd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,Bl.PUB_ACK))._name=Fl.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return Ct(n,[{key:"writeMessage",value:function(e){Dt(Ot(n.prototype),"writeMessage",this).call(this,e)}}]),n}(Yd),Jd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Tt(this,n),(s=t.call(this,Bl.QUERY)).name=Fl.QUERY,s.identifier=jl.QUERY,s.topic=e,s.data=Ls(r)?ch.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Yd),zd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,Bl.QUERY_CONFIRM))._name=Fl.QUERY_CON,r.messageId=e,r}return n}(Yd),Zd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.QUERY_ACK,e.status=0,e.identifier=jl.QUERY,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(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}(qd),Xd=function(e){var t,n=e.type;switch(n){case Bl.CONN_ACK:t=new Vd(e);break;case Bl.PUBLISH:(t=new Hd(e)).syncMsg=e.syncMsg;break;case Bl.PUB_ACK:t=new Wd(e);break;case Bl.QUERY_ACK:t=new Zd(e);break;case Bl.SUB_ACK:case Bl.UNSUB_ACK:case Bl.PING_RESP:t=new Kd(e);break;case Bl.DISCONNECT:t=new Bd(e);break;default:t=new Pd(e),Ws.error("No support for deserializing "+n+" messages")}return t},$d=function(e,t){var n=new Uint8Array(e),r=new lh(n),i=r.readByte(),s=new uh(i),o=Xd(s);return o.read(r,n.length-1,t),o},eg=function(e){var t=e.headerCode,n=new uh(t),r=Xd(n);for(var i in e)r[i]=e[i];return r},tg=pt.charAt,ng="String Iterator",rg=se.set,ig=se.getterFor(ng);qa(String,"String",(function(e){rg(this,{type:ng,string:String(e),index:0})}),(function(){var e,t=ig(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=tg(n,r),t.index+=e.length,{value:e,done:!1})})),function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.addSeTag=73]="addSeTag",e[e.delSeTag=74]="delSeTag",e[e.addTag=75]="addTag",e[e.delTag=76]="delTag",e[e.disTag=77]="disTag",e[e.reportsdk=78]="reportsdk",e[e.rtcInvite=79]="rtcInvite",e[e.rtcCancelInvite=80]="rtcCancelInvite",e[e.rtcInviteAnswer=81]="rtcInviteAnswer",e[e.rtcEndInvite=82]="rtcEndInvite"}(Fd||(Fd={}));var sg=Fd;Rt(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=Rt(regeneratorRuntime.mark((function e(t){var i,s,o;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(bs(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:rn});case 4:return o=e.sent,e.abrupt("return",{status:o.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 og,ag,ug=(og=Rt(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=Rt(regeneratorRuntime.mark((function e(o){var a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a="".concat(n,"://").concat(o,"/ping?r=").concat(bs(1e3,9999)),Ws.debug("start ping",a),e.next=4,r.httpReq({url:a,timeout:rn});case 4:u=e.sent,Ws.debug("end ping",s,a,u.status),s++,i({finished:s===t.length,code:u.status,host:o});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return og.apply(this,arguments)}),cg=function(e,t,n,r,i,s,o,a){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(s,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(a?"&protocolVer="+a:"")},lg=function(e){return[sg.ppMsgS,sg.pgMsgS,sg.chatMsgS].map((function(e){return sg[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"}(ag||(ag={}));var hg,fg=function(e,t){Ws.info("websocket send -> messageId: ".concat(e.messageId));var n=e.getBufferData();t.send(n.buffer)},dg=function(e){Nt(a,e);var t,n,r,i,s,o=Pt(a);function a(e,t){var n;return Tt(this,a),(n=o.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 Ct(a,[{key:"connect",value:(s=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var u=[],c=0,l=!1,h=!1,f=function(){var r=Rt(regeneratorRuntime.mark((function r(){var c;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,a._connect(t,n,u.shift(),i,s,o);case 5:if((c=r.sent)!==io.SUCCESS){r.next=11;break}a._checkAlive(),e(c),r.next=20;break;case 11:if(c!==ao.REDIRECT){r.next=15;break}e(c),r.next=20;break;case 15:if(!h||0!==u.length){r.next=18;break}return e(Ia(c)),r.abrupt("return");case 18:l=!1,f();case 20:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();s=Gn(s),a._watcher.status(oo.CONNECTING),ug(r,i,a._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;h=r,200===n&&(u.push(i),c++,f()),r&&0===c&&(Ws.error("No valid websocket server hosts!"),e(io.RC_SOCKET_NOT_CREATED))}))})));case 1:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,o){return s.apply(this,arguments)})},{key:"_connect",value:(i=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.replace("http","ws"),u=cg(a,r,t,n,this._runtime,s,"",o),Ws.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=$d(t,o);if(n instanceof Kd&&f._pingResolve)return f._pingResolve(io.SUCCESS),void(f._pingResolve=void 0);if(n instanceof Vd)return Ws.debug("recv connect ack -> ".concat(n.status)),n.status!==ao.ACCEPTED?(Ws.warn("connect failed: ".concat(n.status)),void e(n.status)):(Ws.info("connect success -> ".concat(u)),f.connectedTime=n.timestamp,f.userId=n.userId||"",f._idCount=n.messageId,void e(io.SUCCESS));if(n instanceof Bd){var r=n.status;switch(Ws.warn("recv disconnect signal -> status: ".concat(r)),r){case ag.BLOCK:f._watcher.status(oo.BLOCKED);break;case ag.OTHER_DEVICE_LOGIN:f._watcher.status(oo.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case ag.REDIRECT_NEW:case ag.REDIRECT:f._watcher.status(oo.REDIRECT);break;default:f._watcher.status(oo.DISCONNECT_BY_SERVER)}}else f._onReceiveSignal(n)}else Ws.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in Ws.warn("websocket closed! code:",t,"reason:",n),l(oo.CONNECTION_CLOSED),f._messageIds){var i=f._messageIds[r];delete f._messageIds[r],i(io.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in Ws.error("websocket error!",null==t?void 0:t.stack),l(oo.WEBSOCKET_ERROR),f._messageIds){var r=f._messageIds[n];delete f._messageIds[n],r(io.RC_NET_CHANNEL_INVALID)}e(io.NETWORK_ERROR)})),c.onOpen((function(){return Ws.debug("websocket open =>",u)})),setTimeout((function(){e(io.TIMEOUT)}),sn)}));case 8:return(h=e.sent)===io.SUCCESS?this._socket=c:(Ws.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,o){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=Rt(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 Ws.debug("send ping ->"),this.sendOnly(new jd),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(io.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===io.SUCCESS){e.next=12;break}return this._failedCount+=1,Ws.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Ws.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close(),this._watcher.status(oo.NETWORK_UNAVAILABLE)):this._checkAlive(),e.abrupt("return");case 12:Ws.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=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.messageId,t.header&&t.header.qos!==Vl.AT_MOST_ONCE&&(t instanceof Hd&&!t.syncMsg&&(Ws.debug("send pubAck -> ".concat(n)),this.sendOnly(new Qd(n))),t instanceof Zd&&(Ws.debug("send queryCon -> ".concat(n)),this.sendOnly(new zd(n)))),n>0&&(t instanceof Wd||t instanceof Zd)&&(Ws.debug("recv ack -> messageId: ".concat(n)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof Hd)){e.next=16;break}if(s=t.syncMsg,(o=t.topic)!==sg[sg.userSetData]){e.next=8;break}return e.abrupt("return");case 8:if(s&&!lg(o)){e.next=11;break}return this._watcher.signal(t),e.abrupt("return");case 11:return e.next=13,new Promise((function(e){u._syncMessageIds[n]=e}));case 13:a=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,a);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&fg(e,this._socket)}},{key:"send",value:(t=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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]:cn,!this._socket){e.next=18;break}return s=this._generateMessageId(),t.messageId=s,fg(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(o=e.sent){e.next=11;break}return Ws.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:io.TIMEOUT});case 11:if(o instanceof Zd||o instanceof Wd){e.next=13;break}return e.abrupt("return",{code:o});case 13:if(a=n&&o.data?this.codec.decodeByPBName(o.data,n,r):o,0===o.status){e.next=17;break}return Ws.warn("send failed -> message: ".concat(s,", respPBName: ").concat(n,", status: ").concat(o.status)),e.abrupt("return",{code:o.status,data:n&&o.data?a:null});case 17:return e.abrupt("return",{code:io.SUCCESS,data:a});case 18:return e.abrupt("return",{code:io.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(oo.DISCONNECTED))}}]),a}(Ud);e.HttpMethod=void 0,(hg=e.HttpMethod||(e.HttpMethod={})).GET="GET",hg.POST="POST";var gg=function(e){if(Bs(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},pg=function(t){Nt(u,t);var n,r,i,s,o,a=Pt(u);function u(e,t){var n;return Tt(this,u),(n=a.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 Ct(u,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ls(e.data)?JSON.parse(e.data):e.data;return n?!Ps(n)||(va(n,function(){var e=Rt(regeneratorRuntime.mark((function e(n){var r,i,s,o,a,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=eg(n),s=i.messageId,o=i._header,a=i.status,i.identifier,u=o&&o.qos!==Vl.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof Hd&&!i.syncMsg&&(l=new Qd(s),t.sendOnly(l)),i instanceof Zd&&(h=new zd(s),t.sendOnly(h))),!(i instanceof Bd)){e.next=20;break}e.t0=a,e.next=e.t0===ag.OTHER_DEVICE_LOGIN?11:e.t0===ag.BLOCK?13:e.t0===ag.REDIRECT_NEW||e.t0===ag.REDIRECT?15:17;break;case 11:return t._watcher.status(oo.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(oo.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(oo.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(oo.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof Hd)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!lg(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):(Ws.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(o=Rt(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,"×trap=").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(oo.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"connect",value:(s=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Gn(s),this._protocol=i,this._isDisconnected=!1,this._watcher.status(oo.CONNECTING),a=[],u=0,c=!1,l=!1,e.abrupt("return",new Promise((function(e){var o,f=(o=Rt(regeneratorRuntime.mark((function r(){var o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==a.length&&!c){r.next=2;break}return r.abrupt("return");case 2:return c=!0,r.next=5,h._connect(t,n,a.shift(),i,s);case 5:if((o=r.sent)!==io.SUCCESS){r.next=11;break}h._startPullSignal(i),e(o),r.next=20;break;case 11:if(o!==ao.REDIRECT){r.next=15;break}e(o),r.next=20;break;case 15:if(!l||0!==a.length){r.next=18;break}return e(Ia(o)),r.abrupt("return");case 18:c=!1,f();case 20:case"end":return r.stop()}}),r)}))),function(){return o.apply(this,arguments)});h._watcher.status(oo.CONNECTING),ug(r,i,h._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;l=r,200===n&&(a.push(i),u++,f()),r&&0===u&&(Ws.error("No valid websocket server hosts!"),e(io.RC_SOCKET_NOT_CREATED))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,o){return s.apply(this,arguments)})},{key:"_connect",value:(i=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(Ws.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(gg(e.data)?Bs(e.data)?e.data:JSON.parse(e.data):(Ws.error("received data is not a validJson",e.data),!1))},a=cg(i,r,t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),Ws.debug("conenct start -> ".concat(a)),e.next=6,this._runtime.httpReq({url:a,body:{pid:this._pid},timeout:sn});case 6:return u=e.sent,c=o(u),this._domain=r,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):Ws.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(a)),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=Rt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,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,o=n.messageId,a=n.topic,u=n.targetId,n.identifier,c=n.getHeaderFlag(),l=a?"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(a,"&targetid=").concat(u,"&pid=").concat(s):"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&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=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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]:cn,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(o=e.sent){e.next=9;break}return e.abrupt("return",{code:io.TIMEOUT});case 9:if(a=n&&o.data?this.codec.decodeByPBName(o.data,n,r):o,0===o.status){e.next=12;break}return e.abrupt("return",{code:o.status,data:n&&o.data?a:null});case 12:return e.abrupt("return",{code:io.SUCCESS,data:a});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(oo.DISCONNECTED)}}]),u}(Ud),vg=function e(t,n,r){Tt(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()},yg=Ln.find,mg="find",_g=!0;mg in[]&&Array(1).find((function(){_g=!1})),Pe({target:"Array",proto:!0,forced:_g},{find:function(e){return yg(this,e,arguments.length>1?arguments[1]:void 0)}}),lr(mg);var Eg=function(e){return["navi",e].join("_")},Rg=function(e,t,n){var r,i,s=Eg(e);try{var o=n.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn}))),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},Tg=function(){function e(t,n){Tt(this,e),this._runtime=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Gn(this._options.apiVersion)}var t;return Ct(e,[{key:"getInfo",value:(t=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&this._clear(t),!(s=Rg(this._appkey,t,this._runtime.localStorage))){e.next=5;break}return this._naviInfo=s,e.abrupt("return",s);case 5:return o=this._options.navigators.slice(),n.length&&n.forEach((function(e){o.indexOf(e)<0&&o.unshift(e)})),e.next=9,this._reqNavi(o,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=Eg(e);try{var o=r.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn&&t!==e.token}))),i.push({timestamp:a,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=Eg(e);try{var s=n.getItem(i);r=s?JSON.parse(s):[]}catch(e){r=[]}var o=Date.now();r.length>0&&(r=r.filter((function(e){return o-e.timestamp<nn&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)}}]),e}(),Ig=Ln.findIndex,Cg="findIndex",Sg=!0;Cg in[]&&Array(1).findIndex((function(){Sg=!1})),Pe({target:"Array",proto:!0,forced:Sg},{findIndex:function(e){return Ig(this,e,arguments.length>1?arguments[1]:void 0)}}),lr(Cg);var bg=function(e){if(ps(e))throw TypeError("The method doesn't accept regular expressions");return e},wg=ot("match");Pe({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[wg]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~String(m(this)).indexOf(bg(e),arguments.length>1?arguments[1]:void 0)}});var Ng="outbox",Og="inbox",kg=function(e,t,n){return[e,t,n].join("_")},Ag=function(){function e(t,n){Tt(this,e),this._runtime=t,this._appkey=n,this._users={}}return Ct(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=kg(Og,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=kg(Og,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=kg(Ng,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=kg(Ng,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime}}]),e}(),Mg={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Lg=function(){function e(t,n){Tt(this,e),this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return Ct(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,o=this._getSetUserId(n),a=r===mo.DELETE,u=o===s,c=!this._isExisted(n),l=a?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)})),Ws.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),Ug=function(){function e(t){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;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=Mg.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,o=s.code,a=s.data,this._isPulling=!1,o===io.SUCCESS?(Mg.set(n,a.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){Mg.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];qs(r)||(r=new Lg(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}(),xg=function(){function e(t,n,r,i){Tt(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 Ct(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){Ws.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],qs(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}(),Pg="converStatusChanged",Dg=function(){function e(t,n,r){Tt(this,e),this._eventEmitter=new eo,this._pullQueue=[],this._isPulling=!1,this._storage=gn(t.runtime),this._appkey=n,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(n,"-").concat(r)}var t;return Ct(e,[{key:"_set",value:function(e){var t=this;if(!js(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(Pg,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=Rt(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===io.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(Pg,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(Pg,(function(e){}))}}]),e}(),Vg={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}},Bg={};for(var Fg in Vg){var jg=Vg[Fg].keyName;Bg[jg]=Fg}var Kg,qg=function(){function e(t,n,r){Tt(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new vn(t,i),this._localStore=new vn(t,"CONVER-".concat(n,"-").concat(r))}return Ct(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:ks.PRIVATE,targetId:"",channelId:""}}},{key:"updateMentionedData",value:function(e){var t,n=this,r=e.conversationType,i=e.targetId,s=e.messageType,o=e.isMentioned,a=e.content,u=e.senderUserId,c=e.channelId,l=this._getStoreKey(r,i,c),h=this._localStore.get(l)||{},f=Bg.mentionedInfo,d=Bg.hasMentioned,g=h[f]||{},p=g.userIdList||[],v=a.mentionedInfo;if(v){if(o&&r===ks.GROUP)(v.userIdList||[]).forEach((function(e){e===n._currentUserId&&p.indexOf(u)<0&&p.push(u)})),v.type===go.ALL&&p.indexOf(u)<0&&p.push(u);if(s===co.RECALL&&r===ks.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]),qs(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 o in n){var a=Bg[o],u=n[o];if(!js(a)&&!js(u)&&"hasMentioned"!==o&&"MentionedInfo"!==o){if(u===Vg[a].defaultVal||"tags"===o&&!qs(u))delete s[a];else if("tags"===o){var c=u;for(var l in c)c[l].isTop||delete c[l].isTop;s[a]=u}else s[a]=u;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}qs(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 o in Vg){var a=Vg[o],u=a.keyName,c=a.defaultVal;s[u]=i[o]||Ea(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},o=t[r];for(var a in o){var u=Vg[a],c=u.keyName,l=u.defaultVal;s[c]=o[a]||Ea(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,o={},a=e[n];for(var u in a){var c=Vg[u],l=c.keyName,h=c.defaultVal;o[l]=a[u]||Ea(h)}for(var f in o.tags){js(t[f])&&(t[f]=[]);var d=Object.assign({},o,{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){Ws.error("adaptOldStore error: ".concat(e.message))}}}]),e}(),Yg=[ks.PRIVATE,ks.GROUP,ks.SYSTEM,ks.PUBLIC_SERVICE,ks.APP_PUBLIC_SERVICE],Hg="conversationChanged",Gg="conTagStatusChanged",Wg=function(){function e(t,n,r,i,s){var o=this;Tt(this,e),this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new eo,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new qg(t.runtime,n,r),this._statusManager=new Dg(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Hg,(function(e){i(e)})),this._eventEmitter.on(Gg,(function(){s()}))}return Ct(e,[{key:"_calcUnreadCount",value:function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,s=e.isCounted,o=e.messageDirection,a=e.senderUserId,u=o===no.SEND&&a===this._loginUserId,c=r===co.RECALL,l=Bs(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;no.SEND;var s=Bs(n),o=!1,a={};return r&&s&&n.mentionedInfo&&(t.hasMentioned=!0,o=!0,a.hasMentioned={val:!0,time:i},a.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:o,localConversation:t,updateItems:a}}},{key:"_calcMentionedCount",value:function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===no.RECEIVE&&null!=n&&n.mentionedInfo){var s=n.mentionedInfo,o=s.type,a=s.userIdList;if(o===go.ALL||(a||[]).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(Bs(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,o=e.isTop,a=e.tags,u=e.channelId,c={},l={};js(s)||(l.notificationStatus={time:i,val:s}),js(o)||(l.isTop={time:i,val:o}),js(a)||(l.tags={time:i,val:a},null==a||a.forEach((function(e){c[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,c,u),this._store.set(n,r,{notificationStatus:s,isTop:o,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(Hg,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Gg),this._conTagStatusChanged=!1))}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,i=e.isPersited,s=e.targetId,o=e.channelId;if(Yg.indexOf(r)>=0){var a=!1,u=this._store.get(r,s,o),c={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,u),i=r.hasChanged,s=r.localConversation,o=r.updateItems;a=a||i,c=wt(wt({},c),o),u=Ea(s)})),a&&this._store.set(r,s,u,o),this._store.updateMentionedData(e),i){var l=this._store.get(r,s,o);l.updatedItems=wt({latestMessage:{time:e.sentTime,val:e}},c),l.latestMessage=e;var h=Object.assign(l,{conversationType:r,targetId:s,channelId:o});this._setUpdatedConversation(h)}(a||i)&&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,o=e.conversationType;r=r||0,(n||1!==s)&&(t.length>0?t.includes(Number(o))&&(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,o=i.hasMentioned,a={};if(s&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),o&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(a).length){var u=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:a});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===ho.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}}]),e}(),Qg=function(){function e(t,n,r,i){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=gn(t.runtime),this._engine=t,this._tagWatcherFunc=i}var t;return Ct(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=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;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!==io.SUCCESS||js(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,o=i.version,a=s.Tag,js(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,o),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}(),Jg=function(e){Nt(i,e);var t,n,r=Pt(i);function i(e,t){var n;return Tt(this,i),(n=r.call(this,e,t))._miniConnectUrl="",n._connectType=t.connectionType,n}return Ct(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=Rt(regeneratorRuntime.mark((function e(t,n,r){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._runtime.useNavi||(o=this._runtime.isSupportSocket()&&"websocket"===this._connectType?an.join(","):un.join(","),this._miniConnectUrl=null!==(s=this._options.miniCMPProxy)&&void 0!==s&&s.length?this._options.miniCMPProxy.join(","):o||"",n=[]),e.abrupt("return",Dt(Ot(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=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i="getServerEndpoint",s=0,o=t.length;case 2:if(!(s<o)){e.next=28;break}return a=this._formatJSONPUrl(t[s],r,n,i),Ws.debug("req navi => ".concat(a)),e.next=7,this._runtime.httpReq({url:a,timeout:1e4,dataType:"text"});case 7:if(200===(u=e.sent).status){e.next=11;break}return 403===u.status?Ws.error("request navi error: "+io.RC_CONN_USER_OR_PASSWD_ERROR):401===u.status&&Ws.error("request navi error: "+io.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(a)?"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),Ws.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}(Tg),zg=function(){function e(t){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;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,o=s.code,a=s.data,o===io.SUCCESS?(this._isPulling=!1,this._pullTime=a.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}(),Zg=function(e,t){return["send_msg",e,t].join("_")},Xg=function(){function e(t,n){Tt(this,e),this._runtime=t,this._appkey=n,this._sendMessageMap={},this._userId=""}return Ct(e,[{key:"init",value:function(e){this._userId=e;var t=Zg(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=Zg(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=Zg(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}(),$g=function(e){var t="RCDeviceId",n=gn(e),r="",i=n.get(t);return i?r=i:(r=Ns(),n.set(t,r)),r};St(Kg={},ks.PRIVATE,sg.qryPMsg),St(Kg,ks.GROUP,sg.qryGMsg),St(Kg,ks.CHATROOM,sg.qryCHMsg),St(Kg,ks.CUSTOMER_SERVICE,sg.qryCMsg),St(Kg,ks.SYSTEM,sg.qrySMsg);var ep=[sg[sg.recallMsg],sg[sg.ppMsgS],sg[sg.pgMsgS],sg[sg.ppMsgP],sg[sg.pgMsgP],sg[sg.chatMsg],sg[sg.pcMsgP],sg[sg.prMsgS]],tp=function(e){var t;return(t={},St(t,ks.PRIVATE,sg.ppMsgP),St(t,ks.GROUP,sg.pgMsgP),St(t,ks.CHATROOM,sg.chatMsg),St(t,ks.CUSTOMER_SERVICE,sg.pcMsgP),St(t,ks.RTC_ROOM,sg.prMsgS),t)[e]},np=function(e,t,r,i,s,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:no.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}},rp=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},ip=function(t){Nt(Ee,t);var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T,I,C,S,b,w,N,O,k,A,M,L,U,x,P,D,V,B,F,j,K,q,Y,H,G,W,Q,J,z,Z,X,$,ee,te,ne,re,ie,se,oe,ae,ue,ce,le,he,fe,de,ge,pe,ve,ye,me,_e=Pt(Ee);function Ee(e,t,n){var r;return Tt(this,Ee),(r=_e.call(this,e,t,n))._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._connectedTime=0,r._localConnectedTime=0,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._letterbox=new Ag(e,n.appkey),r._sendMessageStore=new Xg(e,n.appkey),r._chrmEntryHandler=new Ug(Ut(r)),r}return Ct(Ee,[{key:"_createNavi",value:function(){return new Jg(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(me=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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):Ws.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 Ws.error("navi invaild.",r),e.abrupt("return",io.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),o=Kl.V3,1===n.openAnti&&(o=Kl.V4),e.next=13,s.connect(this._appkey,t,r,n.protocol,this._apiVer,o);case 13:return(a=e.sent)===io.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(oo.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new Wg(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Qg(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new zg(this),this._joinedChrmManager=new xg(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval()):s.close(),e.abrupt("return",a);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return me.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(Ws.warn("connection status changed:",e),e!==oo.CONNECTING)if(e!==oo.CONNECTED){if(this._channel&&e!==oo.DISCONNECTED)return e===oo.BLOCKED||e===oo.KICKED_OFFLINE_BY_OTHER_CLIENT||e===oo.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==oo.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:(ye=Rt(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=Kl.V3,1===this._naviInfo.openAnti&&(i=Kl.V4),e.next=6,this._channel.connect(this._appkey,t,n,r,this._apiVer,i);case 6:if(e.sent!==io.SUCCESS){e.next=14;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(oo.CONNECTED),this._rejoinChrm(),Ws.__insertLogIntoDatabase(),e.abrupt("return");case 14:this._watcher.status(oo.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(t,n,r)}),5e3);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ye.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=sg[r];if(i)switch(i){case sg.s_ntf:Ws.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case sg.s_msg:this._receiveMsg(e);break;case sg.s_cmd:this._receiveStateNotify(e);break;case sg.s_us:this._receiveSettingNotify(e);break;case sg.rtc_ntf:this._receiveRtcKv(e)}else Ws.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,Eh),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})}}},{key:"_receiveSettingNotify",value:function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,vf)).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,Lf),r=n.time,i=n.type,s=n.roomId;switch(i){case 1: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(ep.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,fh,{currentUserId:this.currentUserId,signal:e});r=this._handleMsgProperties(r),t&&(r.sentTime=t.timestamp,r.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||r.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),r.messageType!==co.EXPANSION_NOTIFY?(r.messageType===co.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(r.conversationType,r.targetId,r.channelId),this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Eh),n=t.type,r=t.chrmId,i=t.time;if(Ws.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:(ve=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,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),Ws.info("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new Jd(sg[sg.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,ph,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(o=e.sent,a=o.code,u=o.data,this._latestSyncTimestamp=Date.now(),a===io.SUCCESS&&u){e.next=21;break}return Ws.warn("pullMsg failed -> code:",a,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,Ws.info("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,d=[],c.forEach((function(e){if(e.messageDirection===no.SEND&&(f=Math.max(e.sentTime,f),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==co.EXPANSION_NOTIFY){if(e.messageType===co.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,Bt(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 ve.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,gh,{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!==co.EXPANSION_NOTIFY?t.messageType===co.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,i=e.isCounted,s=e.isPersited,o=e.isStatusMessage,a=r in fn,u=r in this._customMessageType;if(t=a?fn[r]:u?this._customMessageType[r]:{isCounted:!Ks(i)&&i,isPersited:!Ks(s)&&s},Object.assign(e,{isCounted:t.isCounted,isPersited:t.isPersited,isStatusMessage:dn.includes(r)}),n&&(e.isStatusMessage=o),!n){var c=e.content.user;if(c){var l=c.portrait,h=c.portraitUri,f=l||h;f&&(c.portrait=c.portraitUri=f)}}return e}},{key:"getHistoryMessage",value:(pe=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=p.length>5&&void 0!==p[5]?p[5]:"",a=this.currentUserId,u=this._channel,c=bd[t]||Ed,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:o}),e.next=8,u.send(new Jd(c,h,a),Th,{currentUserId:a,connectedTime:u.connectedTime,conversation:{targetId:n}});case 8:if(f=e.sent,(d=f.code)===io.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:io.RC_NET_CHANNEL_INVALID});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return pe.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){Ws.debug("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Jd(sg[sg.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==io.SUCCESS&&Ws.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(ge=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(o=this._channel)){e.next=11;break}return a=o.codec.encodeDeleteMessages(t,n,r,i),u=new Jd(ud,a,s),e.next=6,o.send(u);case 6:if(c=e.sent,(l=c.code)===io.SUCCESS){e.next=10;break}return e.abrupt("return",l);case 10:return e.abrupt("return",l);case 11:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return ge.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(de=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(o=this._channel)){e.next=12;break}return a=o.codec.encodeClearMessages(n,r,i),u=new Jd(wd[t],a,s),e.next=7,o.send(u);case 7:if(c=e.sent,(l=c.code)===io.SUCCESS){e.next=11;break}return e.abrupt("return",l);case 11:return e.abrupt("return",l);case 12:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return de.apply(this,arguments)})},{key:"getConversationList",value:(fe=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,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,o=this._channel,n=n||ks.PRIVATE,!o){e.next=17;break}return a=o.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new Jd(vd,a,s),e.next=12,o.send(u,Ch,{currentUserId:s,connectedTime:o.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===io.SUCCESS){e.next=16;break}return e.abrupt("return",{code:l});case 16:return e.abrupt("return",{code:l,data:h});case 17:return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return fe.apply(this,arguments)})},{key:"removeConversation",value:(he=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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}),o=new Jd(yd,s,n),e.next=6,i.send(o);case 6:if(a=e.sent,Ws.info("RemoveConversation =>",a),(u=a.code)===io.SUCCESS){e.next=11;break}return e.abrupt("return",u);case 11:return e.abrupt("return",u);case 12:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return he.apply(this,arguments)})},{key:"getConversation",value:(le=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._conversationManager.get(t,n,r)){e.next=3;break}return e.abrupt("return",{code:io.CONVER_GET_ERROR});case 3:return e.next=5,this.getHistoryMessage(t,n,0,1,0);case 5:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:io.CONVER_GET_ERROR});case 10:return u=(null==a?void 0:a.list[0])||null,c={conversationType:t,targetId:n,channelId:r,unreadMessageCount:i.unreadMessageCount||0,latestMessage:u,notificationStatus:i.notificationStatus||ho.CLOSE,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},e.abrupt("return",{code:io.SUCCESS,data:c});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return le.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"clearConversationUnreadCount",value:function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(io.SUCCESS)}},{key:"clearAllUnreadCount",value:function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(io.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(io.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"clearConversationMessageDraft",value:function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(io.SUCCESS)}},{key:"pullConversationStatus",value:(ce=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,!n){e.next=11;break}return i=n.codec.encodeGetConversationStatus(t),s=new Jd(sg[sg.pullSeAtts],i,r),e.next=6,n.send(s,mf);case 6:if(o=e.sent,a=o.code,u=o.data,a===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:a});case 10:return e.abrupt("return",{code:a,data:u});case 11:return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 12:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(ue=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.currentUserId,!(r=this._channel)){e.next=13;break}return i=r.codec.encodeSetConversationStatus(t),s=new Jd(md,i,n),e.next=6,r.send(s,Tf);case 6:if(o=e.sent,a=o.code,u=o.data,a!==io.SUCCESS){e.next=12;break}return c=u,t.forEach((function(e){l._conversationManager.addStatus(wt(wt({},e),{},{updatedTime:c.version}),!0)})),e.abrupt("return",a);case 12:return e.abrupt("return",a);case 13:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"_joinChrm",value:(ae=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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",io.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),o=new Jd(r?ld:cd,s,t),e.next=8,i.send(o,Lh);case 8:return a=e.sent,u=a.code,c=a.data,u===io.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 ae.apply(this,arguments)})},{key:"_rejoinChrm",value:(oe=Rt(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)===io.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 oe.apply(this,arguments)})},{key:"_pullChrmMsg",value:(se=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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,o=i.timestamp,!s){e.next=8;break}return e.abrupt("return");case 8:return i.pulling=!0,a=this._channel.codec.encodeChrmSyncMsg(o,n),u=new Jd(sg[sg.chrmPull],a,t),e.next=13,this._channel.send(u,ph,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===io.SUCCESS&&h){e.next=20;break}return Ws.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<o||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 se.apply(this,arguments)})},{key:"joinChatroom",value:(ie=Rt(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 ie.apply(this,arguments)})},{key:"joinExistChatroom",value:(re=Rt(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 re.apply(this,arguments)})},{key:"quitChatroom",value:(ne=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;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",io.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new Jd(hd,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(o=s.code)===io.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),e.abrupt("return",o);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getChatroomInfo",value:(te=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),o=new Jd(sg[sg.queryChrmI],s,t),e.next=7,i.send(o,xh);case 7:if(a=e.sent,u=a.code,c=a.data,u===io.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 te.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(ee=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),a=new Jd(Td,o,t),e.next=7,s.send(a,Th,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===io.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 ee.apply(this,arguments)})},{key:"_modifyChatroomKV",value:($=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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",io.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),o=n.type===mo.UPDATE?fd:dd,a=new Jd(o,s,t),e.next=8,r.send(a);case 8:if(u=e.sent,(c=u.code)!==io.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 $.apply(this,arguments)})},{key:"_modifyChatroomKVS",value:(X=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodeModifyChatRoomKVS(t,n,i),o=n.type===mo.UPDATE?gd:pd,a=new Jd(o,s,t),e.next=8,r.send(a,cf);case 8:return u=e.sent,c=u.code,-1!==[io.SUCCESS,io.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===io.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(d=u.data,Ws.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)}))),Ws.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 X.apply(this,arguments)})},{key:"setChatroomEntry",value:(Z=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 Z.apply(this,arguments)})},{key:"setChatroomEntries",value:(z=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 z.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(J=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 J.apply(this,arguments)})},{key:"removeChatroomEntry",value:(Q=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 Q.apply(this,arguments)})},{key:"removeChatroomEntries",value:(W=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 W.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(G=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 G.apply(this,arguments)})},{key:"getChatroomEntry",value:(H=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.SUCCESS,data:r}));case 5:if(i=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:io.RC_NET_CHANNEL_INVALID}));case 8:return s=i.codec.encodePullChatRoomKV(0),o=new Jd(sg[sg.pullKV],s,t),e.next=12,i.send(o,uf);case 12:if(a=e.sent,!((u=a.data||{})&&u.kvEntries&&u.kvEntries.length)){e.next=18;break}if(void 0===(c=u.kvEntries.find((function(e){return e.key===n})))){e.next=18;break}return e.abrupt("return",Promise.resolve({code:io.SUCCESS,data:null==c?void 0:c.value}));case 18:return e.abrupt("return",Promise.resolve({code:io.CHATROOM_KEY_NOT_EXIST}));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"getAllChatroomEntry",value:(Y=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.SUCCESS,data:n}));case 5:if(r=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:io.RC_NET_CHANNEL_INVALID}));case 8:return i={},s=r.codec.encodePullChatRoomKV(0),o=new Jd(sg[sg.pullKV],s,t),e.next=13,r.send(o,uf);case 13:return a=e.sent,(u=a.data||{})&&u.kvEntries&&u.kvEntries.length&&u.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),e.abrupt("return",Promise.resolve({code:io.SUCCESS,data:i}));case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"pullChatroomEntry",value:(q=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),o=new Jd(sg[sg.pullKV],s,t),e.next=7,r.send(o,uf);case 7:if(a=e.sent,u=a.code,c=a.data,u!==io.SUCCESS){e.next=17;break}return Ws.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(t,c,i),Ws.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 q.apply(this,arguments)})},{key:"sendMessage",value:(K=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:if(r=rp(r,this.currentUserId),r=this._handleMsgProperties(r,!0),i=!![ks.PRIVATE,ks.GROUP].includes(t)&&r.isStatusMessage,s=i?(g=t,p=void 0,(p={},St(p,ks.PRIVATE,sg.ppMsgS),St(p,ks.GROUP,sg.pgMsgS),p)[g]):tp(t)||sg.ppMsgP,i&&(r.isPersited=!1,r.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},r),(a=new Gd(sg[s],o,n)).setHeaderQos(Vl.AT_LEAST_ONCE),!i){e.next=13;break}return this._channel.sendOnly(a),e.abrupt("return",{code:io.SUCCESS,data:np(t,n,wt({},r),"",0,this.currentUserId)});case 13:return u=Date.now()-this._localConnectedTime+this._connectedTime,c=np(t,n,wt({},r),"",u,this.currentUserId),e.next=17,this._channel.send(a);case 17:if(l=e.sent,h=l.code,f=l.data,h===io.SUCCESS){e.next=22;break}return e.abrupt("return",{code:h,data:c});case 22:return d=f,this._sendMessageStore.setMessage(d.messageUId,d.timestamp),c.sentTime=d.timestamp,c.messageUId=d.messageUId,this._conversationManager.setConversationCacheByMessage(c,!0),e.abrupt("return",{code:io.SUCCESS,data:c});case 28:case"end":return e.stop()}var g,p}),e,this)}))),function(e,t,n){return K.apply(this,arguments)})},{key:"recallMsg",value:(j=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p,v;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:io.RC_NET_CHANNEL_INVALID});case 2:return a=s.user,u={content:{conversationType:t,targetId:n,messageUId:r,sentTime:i,user:a},messageType:"RC:RcCmd",disableNotification:null==s?void 0:s.disableNotification,pushConfig:null==s?void 0:s.pushConfig,pushContent:(null===(o=s.pushConfig)||void 0===o?void 0:o.pushContent)||s.pushContent||"",channelId:s.channelId},c=sg[sg.recallMsg],l=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},u),(h=new Gd(c,l,this.currentUserId)).setHeaderQos(Vl.AT_LEAST_ONCE),e.next=10,this._channel.send(h);case 10:if(f=e.sent,d=f.code,g=f.data,d===io.SUCCESS){e.next=15;break}return e.abrupt("return",{code:d});case 15:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),v=np(t,n,wt(wt({},u),{},{isPersited:!0}),p.messageUId,p.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),e.abrupt("return",{code:io.SUCCESS,data:v});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return j.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(F=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new Jd(sg[sg.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 F.apply(this,arguments)})},{key:"getMessageReader",value:(B=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new Jd(sg[sg.rrList],i,t),e.next=6,this._channel.send(s,Sf);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return B.apply(this,arguments)})},{key:"pullUserSettings",value:(V=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new Jd(sg[sg.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,pf));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"getFileToken",value:(D=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":ha(t,n),o=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),a=new Jd(sg[sg.qnTkn],o,this.currentUserId),e.next=7,this._channel.send(a,$h);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==io.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 D.apply(this,arguments)})},{key:"getFileUrl",value:(P=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return s="",o="",a="",n===vo.QINIU?(o=ef,a=nf):(o=tf,a=rf),s=n===vo.QINIU?sg[sg.qnUrl]:n===vo.AWS?sg[sg.s3Url]:n===vo.STC?sg[sg.stcUrl]:sg[sg.aliUrl],u=this._channel.codec.encodeGetFileUrl(o,t,r,i),c=new Jd(s,u,this.currentUserId),e.next=11,this._channel.send(c,a);case 11:if(l=e.sent,h=l.code,f=l.data,d=f,h!==io.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 P.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()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r){this._customMessageType[e]={isPersited:t,isCounted:n}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"getCurrentUserId",value:function(){return this.currentUserId}},{key:"createTag",value:(x=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Jd(sg[sg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([wt(wt({},t),{},{createdTime:u})],u),e.abrupt("return",{code:io.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"removeTag",value:(U=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new Jd(sg[sg.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.deleteTag([t],u),e.abrupt("return",{code:io.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"updateTag",value:(L=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Jd(sg[sg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([t],u),e.abrupt("return",{code:io.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"getTagList",value:(M=Rt(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:io.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"addTagForConversations",value:(A=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:io.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Jd(sg[sg.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(o=s.code)===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return(a={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.conversationType,e.targetId,a,e.channelId)})),e.abrupt("return",{code:io.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"removeTagForConversations",value:(k=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a=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:io.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Jd(sg[sg.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(o=s.code)===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return n.forEach((function(e){a._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),e.abrupt("return",{code:io.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"removeTagsForConversation",value:(O=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return r=t.conversationType,i=t.targetId,s=t.channelId,o=n.map((function(e){return{tagId:e}})),a=this._channel.codec.encodeUpdateConversationTag(o,[t]),u=new Jd(sg[sg.delTag],a,this.currentUserId),e.next=8,this._channel.send(u);case 8:if(c=e.sent,(l=c.code)===io.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:io.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"getConversationListByTag",value:(N=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeOldConversationList({count:r,type:ks.PRIVATE,startTime:n}),a=new Jd(vd,o,i),e.next=7,s.send(a,Ch,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,l),Ws.info("GetConversationListByTag",h),c===io.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 N.apply(this,arguments)})},{key:"_conversationHasTagFilter",value:function(e,t){var n=this,r=[],i=[];function s(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var s=t.conversationType,o=t.targetId,a=t.channelId,u=n._conversationManager.get(s,o,a),c=u.hasMentioned,l=u.mentionedInfo,h=u.lastUnreadTime,f=u.notificationStatus,d=u.isTop,g=u.tags,p=u.unreadMessageCount,v=g&&g[e];if(v){var y=wt(wt({},t),{},{hasMentioned:c,mentionedInfo:l,lastUnreadTime:h,notificationStatus:f,isTop:d,unreadMessageCount:p});v.isTop?r.push(wt(wt({},y),{},{isTopInTag:!0})):i.push(wt(wt({},y),{},{isTopInTag:!1}))}})),[].concat(Bt(r.sort(s)),Bt(i.sort(s)))}},{key:"getUnreadCountByTag",value:(w=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:io.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(b=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.conversationType,o=n.channelId,a=r.isTop,u=[{tagId:t,isTop:a}],(c=this._conversationManager.get(s,i,o)).tags&&Object.hasOwnProperty.call(c.tags,t)){e.next=8;break}return e.abrupt("return",{code:io.NO_TAG_IN_CONVER});case 8:return l=this._channel.codec.encodeUpdateConversationTag(u,[n]),h=new Jd(sg[sg.addTag],l,this.currentUserId),e.next=12,this._channel.send(h);case 12:if(f=e.sent,(d=f.code)===io.SUCCESS){e.next=16;break}return e.abrupt("return",{code:d});case 16:return(g={})[t]={},a&&(g[t].isTop=!0),this._conversationManager.addTagStatus(s,i,g,o),e.abrupt("return",{code:io.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return b.apply(this,arguments)})},{key:"getTagsForConversation",value:(S=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,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:io.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===(o=r[s])||void 0===o?void 0:o.tagName});return e.abrupt("return",{code:io.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"getTopConversationList",value:function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"getUnreadMentionedCount",value:function(e){var t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:io.SUCCESS,data:t})}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"joinRTCRoom",value:(C=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,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:io.RC_NET_CHANNEL_INVALID});case 2:return s=this._channel.codec.encodeJoinRTCRoom(n,r,i),o=new Jd(sg[sg.rtcRJoin_data],s,t),e.abrupt("return",this._channel.send(o,Dh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return C.apply(this,arguments)})},{key:"quitRTCRoom",value:(I=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Jd(sg[sg.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 I.apply(this,arguments)})},{key:"rtcPing",value:(T=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Jd(sg[sg.rtcPing],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return T.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(R=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Jd(sg[sg.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,Jh));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(E=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Jd(sg[sg.rtcUData],n,t),e.next=6,this._channel.send(r,Dh);case 6:return i=e.sent,s=i.code,o=i.data,e.abrupt("return",{code:s,data:o?{users:o.users}:o});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"setRTCUserInfo",value:(_=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new Jd(sg[sg.rtcUPut],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return _.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(m=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,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",io.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new Gd(sg[sg.rtcUDel],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"setRTCData",value:(y=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,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",io.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeSetRTCData(n,r,i,s,o),u=new Gd(sg[sg.rtcSetData],a,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 y.apply(this,arguments)})},{key:"setRTCTotalRes",value:(v=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,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",io.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeUserSetRTCData(n,r,i,s),a=new Jd(sg[sg.userSetData],o,t),e.next=6,this._channel.send(a);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 v.apply(this,arguments)})},{key:"setRTCCDNUris",value:(p=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeUserSetRTCCDNUris(n,r),s=new Jd(sg[sg.userSetData],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:io.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new Jd(sg[sg.rtcQryData],i,e);return this._channel.send(s,Hh)}},{key:"removeRTCData",value:(g=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,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",io.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeRemoveRTCData(n,r,i,s),a=new Gd(sg[sg.rtcDelData],o,t),e.next=6,this._channel.send(a);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 g.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:(d=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Jd(sg[sg.rtcToken],i,t),e.abrupt("return",this._channel.send(s,Yh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"setRTCState",value:(f=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,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",io.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new Jd(sg[sg.rtcUserState],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"getRTCUserInfo",value:(h=Rt(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 h.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:io.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Jd(sg[sg.rtcUList],t,e);return this._channel.send(n,Dh)}},{key:"joinLivingRoomAsAudience",value:(l=Rt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),o=new Jd(sg[sg.viewerJoinR],s,n),t.next=8,this._channel.send(o,Vf);case 8:if(a=t.sent,u=a.code,c=a.data,u===io.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 l.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(c=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Jd(sg[sg.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 c.apply(this,arguments)})},{key:"rtcIdentityChange",value:(u=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeIdentityChangeInfo(n,r),s=new Jd(sg[sg.rtcIdentityChange],i,t),e.next=6,this._channel.send(s,Dh);case 6:if(o=e.sent,a=o.code,u=o.data,a===io.SUCCESS){e.next=11;break}return e.abrupt("return",{code:a});case 11:return e.abrupt("return",{code:a,data:u});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(a=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return Ws.info("audience in room start pull KV"),s=r.codec.encodePullRTCRoomKV(t,0),o=new Jd(sg[sg.rtcPullKv],s,i),e.next=8,r.send(o,xf);case 8:if(a=e.sent,u=a.code,c=a.data,Ws.info("audience in room end pull KV, code: ".concat(u,", data: ").concat(JSON.stringify(c||{}))),u!==io.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 a.apply(this,arguments)})},{key:"getRTCJoinedUserInfo",value:(o=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return i=n.codec.encodeQueryUserJoinedInfo(t),s=new Jd(sg[sg.rtcQueryJoined],i,r),e.next=7,n.send(s,Df);case 7:if(o=e.sent,a=o.code,u=o.data,a!==io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a,data:u});case 12:return e.abrupt("return",{code:a});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getDeviceId",value:function(){return $g(this.runtime)}},{key:"requestRoomPK",value:(s=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeRequestRoomPK(t),r=new Jd(sg[sg.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 s.apply(this,arguments)})},{key:"cancelRoomPK",value:(i=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeCancelRoomPK(t),r=new Jd(sg[sg.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 i.apply(this,arguments)})},{key:"responseRoomPK",value:(r=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeResponseRoomPK(t),r=new Jd(sg[sg.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=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeEndRoomPK(t),r=new Jd(sg[sg.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:io.EXTRA_METHOD_UNDEFINED})}},{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){throw new Error("Method not implemented.")}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this.getHistoryMessage(e,t,n,r,i,s)}}]),Ee}(vg),sp=function(){function e(t){Tt(this,e),this._context=t}return Ct(e,[{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}(),op=function(e){Nt(n,e);var t=Pt(n);function n(){return Tt(this,n),t.apply(this,arguments)}return Ct(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n,r){return this._context.joinRTCRoom(e,t,n,r)}},{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}(sp),ap=function(){function e(){Tt(this,e)}return Ct(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=[],o=[],a=function(){if(o.length>0){var e=o.join("");if(o=[],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)o.push(e.charAt(u++));else if(c.length<4)o.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)o.push(e.substr(u,c.length)),u+=c.length;else{a();var f=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);s.push(f+l+h),u+=c.length}}}a();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,o=15&i,a=void 0;switch(s){case t.dataType.Compressed:var u=o>>2,c=3&o;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((a=t.numberDecode(e.substr(n,o)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=o;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,o)),r+=e.substr(n+=o,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,o),n+=o;break;case t.dataType.Mark:if(o>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+o),n+=16+o;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,o=0,a=i.length;o<a;o++){var u=i[o],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}();ap.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},ap.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ap.scale=ap.chars.length,ap.max=238327;var up=1,cp=!1,lp="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",hp=function(){function e(t){Tt(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=$g(t.runtime),this.logSwitch=t.logSwitch;var n=Ta(t.runtime);this.deviceInfo="".concat(n.type,"|").concat(n.version,"|").concat(Gs.sessionId),this.startReport()}var t;return Ct(e,[{key:"startReport",value:function(){var e=this;if(this.logSwitch&&cp){var t=this.itv*Math.pow(2,up-1);up<this.times&&up++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}}},{key:"reportRealtimeLog",value:function(){var e=this,t=Gs.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=ap.compress(t.map((function(e){return e.content})).join("")),r="".concat(lp).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){Ws.__clearRealTimeLog(),Ws.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,up=1),e.startReport()})).catch((function(t){Ws.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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,o=t.uri,a=ds.getInstance(),Ws.debug("received report log msg, ".concat(i.toLowerCase()),a),"web"===i.toLowerCase()&&a){e.next=5;break}return e.abrupt("return");case 5:if(!(n>r)){e.next=8;break}return Ws.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,Ws.__insertLogIntoDatabase();case 10:return e.next=12,a.getRangeData(hs,"time",n,r);case 12:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=ap.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&cp){var t=o||h.logUrl,n="".concat(lp).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(){cp&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){Ws.debug("report full log success!")})).catch((function(t){e(),Ws.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(){up=1,cp=!1}}],[{key:"init",value:function(t){return cp=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function fp(e){return Object.assign({},e)}var dp,gp=function(){function e(t,n){var r;(Tt(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.1.0",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=oo.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},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,Bt(on));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)};this._engine=Ra()?new RCCppEngine(t,i,this._options):new ip(t,i,this._options)}var t,n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T,I,C,S,b,w,N,O,k,A,M,L,U,x,P,D,V,B;return Ct(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return Ws.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new op(this):new sp(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Ws.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:(B=Rt(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ws.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:e.sent.code!==io.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout((function(){t._handleRedirect()}),5e3));case 6:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"_connectionStatusListener",value:(V=Rt(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===oo.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):t===oo.BLOCKED||t===oo.KICKED_OFFLINE_BY_OTHER_CLIENT||t===oo.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):t===oo.CONNECTING?this._handleConnecting():t===oo.CONNECTED?this._handleConnected():t===oo.DISCONNECTED?this._handleDisconnect():t===oo.NETWORK_UNAVAILABLE&&this._handleSuspend(),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 V.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(){this._watcher.onDisconnect&&this._watcher.onDisconnect()}},{key:"_handleSuspend",value:function(){this._watcher.onSuspend&&this._watcher.onSuspend()}},{key:"_messageReceiver",value:function(e,t,n){var r=this;if((e.conversationType===ks.RTC_ROOM||Object.prototype.hasOwnProperty.call(No,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(fp(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==co.TYPING_STATUS||(this._addTypingInfo(fp(e)),!this._watcher.typingState))if(e.messageType!==co.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==co.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(fp(e))}catch(e){return Ws.error("plugin error =>",e),!1}})))if("RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return this._watcher.message&&this._watcher.message(fp(e),t,n),e;var i,s=null===(i=e.content)||void 0===i?void 0:i.receiptMessageDic;if(s){var o=Object.keys(s),a={};o.length&&o.forEach((function(t){Array.isArray(s[t])&&s[t].forEach((function(n){a[n]=a[n]||{},a[n][t]=e.sentTime}))})),Object.keys(a).forEach((function(t){"function"==typeof r._watcher.messageReceiptResponse&&r._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},t,a[t])}))}}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId);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 u,c=e.content,l=c.startTime,h=c.endTime,f=c.platform,d=c.logId,g=c.uri,p=c.packageName,v={startTime:parseInt(l),endTime:parseInt(h),platform:f,logId:d,uri:g,packageName:p};null===(u=hp.getInstance())||void 0===u||u.reportFullLog(v)}}else if("function"==typeof this._watcher.chatroomState){var y={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){y[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:y,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:St({},e.senderUserId,"RC:ChrmQuitNtf"===e.messageType?Eo.QUIT:Eo.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:"_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]=Fs(r)||Bs(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,o=i.typingContentType,a=s||"",u="".concat(n,"#").concat(r,"#").concat(a);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===o?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:o,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:(D=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>1&&void 0!==l[1]&&l[1],this._connectionStatus!==oo.CONNECTED){e.next=3;break}return e.abrupt("return",{code:io.SUCCESS,userId:this._engine.currentUserId});case 3:if(this._connectionStatus!==oo.CONNECTING){e.next=5;break}return e.abrupt("return",{code:io.BIZ_ERROR_CONNECTING});case 5:if("string"==typeof t&&0!==t.length){e.next=7;break}return e.abrupt("return",{code:io.RC_CONN_USER_OR_PASSWD_ERROR});case 7:return this._token=t,r=t.split("@"),i=Vt(r,2),s=i[1],o=s?s.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=12,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,n,this._options.checkCA);case 12:if(a=e.sent){e.next=15;break}return e.abrupt("return",{code:io.RC_NAVI_RESOURCE_ERROR});case 15:if(1!==(null==a?void 0:a.type)){e.next=17;break}return e.abrupt("return",{code:io.PACKAGE_ENVIRONMENT_ERROR});case 17:return u=Vo.getInfo(),e.next=20,this._engine.connect(this._getTokenWithoutNavi(),a);case 20:if(c=e.sent,Ws.__insertLogIntoDatabase(),c!==ao.REDIRECT){e.next=27;break}return this._connectionStatus=oo.REDIRECT,e.next=26,this.connect(t,!0);case 26:return e.abrupt("return",e.sent);case 27:return c===io.SUCCESS&&(Ws.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),hp.init({runtime:this._runtime,logSwitch:(null==a?void 0:a.logSwitch)||0,logPolicy:JSON.parse((null==a?void 0:a.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Gs.init(this._engine.currentUserId),this._isInternalConnected=!0),c!==io.SUCCESS||Ra()||1===a.openUS&&this._pullUserSettings(),c!==io.SUCCESS&&(this._connectionStatus=oo.CONNECTION_CLOSED),e.abrupt("return",{code:c,userId:this._engine.currentUserId});case 31:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"_pullUserSettings",value:(P=Rt(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 P.apply(this,arguments)})},{key:"disconnect",value:function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,null===(e=hp.getInstance())||void 0===e||e.distroy(),Ws.__insertLogIntoDatabase(),Gs.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Ws.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(){return this._isInternalConnected?Promise.resolve({code:io.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())}},{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]:[];this._engine.registerMessageType(e,t,n,r)}},{key:"sendMessage",value:function(e,t,n,r){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===co.READ_RECEIPT_RESPONSE)return Promise.resolve({code:io.READ_RECEIPT_ERROR});var s=JSON.stringify(n.content);return Hn(s)>ln?Promise.resolve({code:io.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(x=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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,o=t.keys,a=t.expansion,u=t.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:io.MESSAGE_KV_NOT_SUPPORT});case 3:if(c=!1,l=!1,h=!1,!Bs(a)){e.next=19;break}f=Object.keys(a).length,c=f>20,e.t0=regeneratorRuntime.keys(a);case 10:if((e.t1=e.t0()).done){e.next=19;break}if(d=e.t1.value,g=a[d],l=Ls(d)&&!/^[A-Za-z0-9_=+-]+$/.test(d),!(h=d.length>32||g.length>64)&&!l){e.next=17;break}return e.abrupt("break",19);case 17:e.next=10;break;case 19:if(!c&&!h){e.next=21;break}return e.abrupt("return",{code:io.EXPANSION_LIMIT_EXCEET});case 21:if(!l){e.next=23;break}return e.abrupt("return",{code:io.BIZ_ERROR_INVALID_PARAMETER});case 23:return p={mid:s},a&&(p.put=a),o&&(p.del=o),u&&(p.removeAll=1),e.next=29,this._engine.sendMessage(r,i,{content:p,messageType:co.EXPANSION_NOTIFY,channelId:n});case 29:return v=e.sent,y=v.code,e.abrupt("return",{code:y});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(U=Rt(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:io.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 U.apply(this,arguments)})},{key:"getMessageReader",value:(L=Rt(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:io.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 L.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){Ws.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=hp.getInstance())||void 0===e||e.distroy(),Gs.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]:"",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";return this._engine.getHistoryMessage(e,t,n,r,i,s,o||"")}},{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]:"";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 this._engine.removeConversation(e,t,n)}},{key:"clearUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return 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){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[ks.PRIVATE,ks.GROUP,ks.SYSTEM,ks.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]:"",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 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 ga(n)&&pa(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(io.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(!ga(i)||!pa(s))return Promise.resolve({code:io.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return ga(n)&&pa(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(io.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return ga(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(io.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(!ga(r))return Promise.resolve({code:io.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return ga(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(io.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:(M=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this.getInfoFromCache(),o=(null==s?void 0:s.bosAddr)||"",a=(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!==io.SUCCESS){e.next=11;break}return e.abrupt("return",Promise.resolve(Object.assign(h,{bos:o,qiniu:a,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 M.apply(this,arguments)})},{key:"getFileUrl",value:(A=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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]:vo.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(o=e.sent,a=o.code,u=o.data,a!==io.SUCCESS){e.next=10;break}return e.abrupt("return",Promise.resolve(u));case 10:return e.abrupt("return",Promise.reject(a));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return A.apply(this,arguments)})},{key:"createTag",value:(k=Rt(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 k.apply(this,arguments)})},{key:"removeTag",value:(O=Rt(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 O.apply(this,arguments)})},{key:"updateTag",value:(N=Rt(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 N.apply(this,arguments)})},{key:"getTagList",value:(w=Rt(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 w.apply(this,arguments)})},{key:"addTagForConversations",value:(b=Rt(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(io.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 b.apply(this,arguments)})},{key:"removeTagForConversations",value:(S=Rt(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 S.apply(this,arguments)})},{key:"removeTagsForConversation",value:(C=Rt(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 C.apply(this,arguments)})},{key:"getConversationListByTag",value:(I=Rt(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 I.apply(this,arguments)})},{key:"getUnreadCountByTag",value:(T=Rt(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 T.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(R=Rt(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 R.apply(this,arguments)})},{key:"getTagsForConversation",value:(E=Rt(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 E.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:"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:(_=Rt(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 _.apply(this,arguments)})},{key:"setUserStatusListener",value:function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Ws.error(e)}}))}},{key:"addToBlacklist",value:(m=Rt(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 m.apply(this,arguments)})},{key:"removeFromBlacklist",value:(y=Rt(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 y.apply(this,arguments)})},{key:"getBlacklist",value:(v=Rt(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 v.apply(this,arguments)})},{key:"getBlacklistStatus",value:(p=Rt(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 p.apply(this,arguments)})},{key:"insertMessage",value:(g=Rt(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 g.apply(this,arguments)})},{key:"deleteMessages",value:(d=Rt(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 d.apply(this,arguments)})},{key:"deleteMessagesByTimestamp",value:(f=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=o.length>4&&void 0!==o[4]?o[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 f.apply(this,arguments)})},{key:"clearMessages",value:(h=Rt(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 h.apply(this,arguments)})},{key:"getMessage",value:(l=Rt(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 l.apply(this,arguments)})},{key:"setMessageContent",value:(c=Rt(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 c.apply(this,arguments)})},{key:"setMessageSearchField",value:(u=Rt(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 u.apply(this,arguments)})},{key:"setMessageSentStatus",value:(a=Rt(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 a.apply(this,arguments)})},{key:"setMessageReceivedStatus",value:(o=Rt(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 o.apply(this,arguments)})},{key:"setUserStatus",value:(s=Rt(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=Rt(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=Rt(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=Rt(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=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=u.length>6&&void 0!==u[6]?u[6]:"",e.abrupt("return",this._engine.searchMessageByContent(t,n,r,i,s,o,a));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i,s,o){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:"joinRTCRoom",value:function(e,t,n,r){return this._engine.joinRTCRoom(e,t,n,r)}},{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 Ws.setLogLevel(n.logLevel),Ws.setLogStdout(n.logStdout),(n.indexDBSwitch||js(n.indexDBSwitch))&&ds.init(),Ws.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Ws.error("Repeat initialize!"),this._context):(Ws.warn("RCEngine Commit:","a336c0de6ae1d26b24ec675889d919bcb2195568"),this._context=new e(t,n),Ws.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(dp=e.TagChangeType||(e.TagChangeType={}))[dp.add=1]="add",dp[dp.update=2]="update",dp[dp.delete=3]="delete";e.AEngine=vg,e.ANavi=Tg,e.APIContext=gp,e.AppStorage=vn,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=No,e.ChatroomEntryType=mo,e.ChatroomMemberChangeType=Eo,e.CometChannel=pg,e.ConnectResultCode=ao,e.ConnectionStatus=oo,e.ConversationType=ks,e.DelayTimer=Sa,e.ErrorCode=io,e.EventEmitter=eo,e.FileType=Ms,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=cn,e.Logger=Gs,e.MAX_MESSAGE_CONTENT_BYTES=ln,e.MINI_COMET_CONNECT_URIS=un,e.MINI_SOCKET_CONNECT_URIS=an,e.MentionedType=go,e.MessageBlockType=Co,e.MessageDirection=no,e.MessageType=co,e.NAVI_CACHE_DURATION=nn,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=ho,e.PING_REQ_TIMEOUT=rn,e.PUBLIC_CLOUD_NAVI_URIS=on,e.PluginContext=sp,e.RCAssertError=Fo,e.RTCPluginContext=op,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=fn,e.STATUS_MESSAGE=dn,e.STORAGE_ROOT_KEY=hn,e.UploadMethod=vo,e.VersionManage=Vo,e.WEB_SOCKET_TIMEOUT=sn,e.WebSocketChannel=dg,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(!jo(e,t,n,r))throw new Fo("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.cloneByJSON=Ea,e.forEach=va,e.formatConnectResponseCode=Ia,e.getBrowser=Ta,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case Ms.IMAGE:t="image/jpeg";break;case Ms.AUDIO:t="audio/amr";break;case Ms.VIDEO:t="video/3gpp";break;case Ms.SIGHT:t="video/mpeg4";break;case Ms.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=ha,e.indexOf=ma,e.isArray=Ps,e.isArrayBuffer=Ds,e.isBoolean=Us,e.isFunction=Fs,e.isHttpUrl=function(e){return Ls(e)&&/https?:\/\//.test(e)},e.isInObject=_a,e.isInclude=function(e,t){return-1!==ma(e,t)},e.isNull=Ks,e.isNumber=xs,e.isObject=Bs,e.isString=Ls,e.isUndefined=js,e.isValidChrmEntryKey=ga,e.isValidChrmEntryValue=pa,e.isValidConversationType=function(e){return xs(e)&&Object.prototype.hasOwnProperty.call(ks,e)},e.isValidFileType=function(e){return xs(e)&&Object.prototype.hasOwnProperty.call(Ms,e)},e.map=ya,e.notEmptyArray=function(e){return Ps(e)&&e.length>0},e.notEmptyObject=qs,e.notEmptyString=Vs,e.pushConfigsToJSON=fa,e.pushJSONToConfigs=da,e.todo=function(e){return new yn(e)},e.usingCppEngine=Ra,e.validate=jo,e.version="5.1.0",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,r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){var t={exports:{}};return e(t,t.exports),t.exports}var s=function(e){return e&&e.Math==Math&&e},o=s("object"==typeof globalThis&&globalThis)||s("object"==typeof window&&window)||s("object"==typeof self&&self)||s("object"==typeof r&&r)||function(){return this}()||Function("return this")(),a=function(e){try{return!!e()}catch(e){return!0}},u=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,h={f:l&&!c.call({1:2},1)?function(e){var t=l(this,e);return!!t&&t.enumerable}:c},f=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},d={}.toString,p=function(e){return d.call(e).slice(8,-1)},v="".split,y=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==p(e)?v.call(e,""):Object(e)}:Object,m=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},_=function(e){return y(m(e))},E=function(e){return"object"==typeof e?null!==e:"function"==typeof e},R=function(e,t){if(!E(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!E(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!E(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},T=function(e){return Object(m(e))},I={}.hasOwnProperty,C=function(e,t){return I.call(T(e),t)},S=o.document,b=E(S)&&E(S.createElement),w=function(e){return b?S.createElement(e):{}},N=!u&&!a((function(){return 7!=Object.defineProperty(w("div"),"a",{get:function(){return 7}}).a})),O=Object.getOwnPropertyDescriptor,k={f:u?O:function(e,t){if(e=_(e),t=R(t,!0),N)try{return O(e,t)}catch(e){}if(C(e,t))return f(!h.f.call(e,t),e[t])}},A=function(e){if(!E(e))throw TypeError(String(e)+" is not an object");return e},M=Object.defineProperty,L={f:u?M:function(e,t,n){if(A(e),t=R(t,!0),A(n),N)try{return M(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},U=u?function(e,t,n){return L.f(e,t,f(1,n))}:function(e,t,n){return e[t]=n,e},x=function(e,t){try{U(o,e,t)}catch(n){o[e]=t}return t},P="__core-js_shared__",D=o[P]||x(P,{}),V=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(e){return V.call(e)});var B,F,j,K=D.inspectSource,q=o.WeakMap,Y="function"==typeof q&&/native code/.test(K(q)),H=i((function(e){(e.exports=function(e,t){return D[e]||(D[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.11.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),G=0,W=Math.random(),Q=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++G+W).toString(36)},J=H("keys"),z=function(e){return J[e]||(J[e]=Q(e))},Z={},X="Object already initialized",$=o.WeakMap;if(Y){var ee=D.state||(D.state=new $),te=ee.get,ne=ee.has,re=ee.set;B=function(e,t){if(ne.call(ee,e))throw new TypeError(X);return t.facade=e,re.call(ee,e,t),t},F=function(e){return te.call(ee,e)||{}},j=function(e){return ne.call(ee,e)}}else{var ie=z("state");Z[ie]=!0,B=function(e,t){if(C(e,ie))throw new TypeError(X);return t.facade=e,U(e,ie,t),t},F=function(e){return C(e,ie)?e[ie]:{}},j=function(e){return C(e,ie)}}var se={set:B,get:F,has:j,enforce:function(e){return j(e)?F(e):B(e,{})},getterFor:function(e){return function(t){var n;if(!E(t)||(n=F(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},oe=i((function(e){var t=se.get,n=se.enforce,r=String(String).split("String");(e.exports=function(e,t,i,s){var a,u=!!s&&!!s.unsafe,c=!!s&&!!s.enumerable,l=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof t||C(i,"name")||U(i,"name",t),(a=n(i)).source||(a.source=r.join("string"==typeof t?t:""))),e!==o?(u?!l&&e[t]&&(c=!0):delete e[t],c?e[t]=i:U(e,t,i)):c?e[t]=i:x(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||K(this)}))})),ae=o,ue=function(e){return"function"==typeof e?e:void 0},ce=function(e,t){return arguments.length<2?ue(ae[e])||ue(o[e]):ae[e]&&ae[e][t]||o[e]&&o[e][t]},le=Math.ceil,he=Math.floor,fe=function(e){return isNaN(e=+e)?0:(e>0?he:le)(e)},de=Math.min,ge=function(e){return e>0?de(fe(e),9007199254740991):0},pe=Math.max,ve=Math.min,ye=function(e,t){var n=fe(e);return n<0?pe(n+t,0):ve(n,t)},me=function(e){return function(t,n,r){var i,s=_(t),o=ge(s.length),a=ye(r,o);if(e&&n!=n){for(;o>a;)if((i=s[a++])!=i)return!0}else for(;o>a;a++)if((e||a in s)&&s[a]===n)return e||a||0;return!e&&-1}},_e={includes:me(!0),indexOf:me(!1)},Ee=_e.indexOf,Re=function(e,t){var n,r=_(e),i=0,s=[];for(n in r)!C(Z,n)&&C(r,n)&&s.push(n);for(;t.length>i;)C(r,n=t[i++])&&(~Ee(s,n)||s.push(n));return s},Te=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ie=Te.concat("length","prototype"),Ce={f:Object.getOwnPropertyNames||function(e){return Re(e,Ie)}},Se={f:Object.getOwnPropertySymbols},be=ce("Reflect","ownKeys")||function(e){var t=Ce.f(A(e)),n=Se.f;return n?t.concat(n(e)):t},we=function(e,t){for(var n=be(t),r=L.f,i=k.f,s=0;s<n.length;s++){var o=n[s];C(e,o)||r(e,o,i(t,o))}},Ne=/#|\.prototype\./,Oe=function(e,t){var n=Ae[ke(e)];return n==Le||n!=Me&&("function"==typeof t?a(t):!!t)},ke=Oe.normalize=function(e){return String(e).replace(Ne,".").toLowerCase()},Ae=Oe.data={},Me=Oe.NATIVE="N",Le=Oe.POLYFILL="P",Ue=Oe,xe=k.f,Pe=function(e,t){var n,r,i,s,a,u=e.target,c=e.global,l=e.stat;if(n=c?o:l?o[u]||x(u,{}):(o[u]||{}).prototype)for(r in t){if(s=t[r],i=e.noTargetGet?(a=xe(n,r))&&a.value:n[r],!Ue(c?r:u+(l?".":"#")+r,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;we(s,i)}(e.sham||i&&i.sham)&&U(s,"sham",!0),oe(n,r,s,e)}},De=function(){var e=A(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};function Ve(e,t){return RegExp(e,t)}var Be={UNSUPPORTED_Y:a((function(){var e=Ve("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:a((function(){var e=Ve("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},Fe=RegExp.prototype.exec,je=H("native-string-replace",String.prototype.replace),Ke=Fe,qe=function(){var e=/a/,t=/b*/g;return Fe.call(e,"a"),Fe.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ye=Be.UNSUPPORTED_Y||Be.BROKEN_CARET,He=void 0!==/()??/.exec("")[1];(qe||He||Ye)&&(Ke=function(e){var t,n,r,i,s=this,o=Ye&&s.sticky,a=De.call(s),u=s.source,c=0,l=e;return o&&(-1===(a=a.replace("y","")).indexOf("g")&&(a+="g"),l=String(e).slice(s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==e[s.lastIndex-1])&&(u="(?: "+u+")",l=" "+l,c++),n=new RegExp("^(?:"+u+")",a)),He&&(n=new RegExp("^"+u+"$(?!\\s)",a)),qe&&(t=s.lastIndex),r=Fe.call(o?n:s,l),o?r?(r.input=r.input.slice(c),r[0]=r[0].slice(c),r.index=s.lastIndex,s.lastIndex+=r[0].length):s.lastIndex=0:qe&&r&&(s.lastIndex=s.global?r.index+r[0].length:t),He&&r&&r.length>1&&je.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var Ge=Ke;Pe({target:"RegExp",proto:!0,forced:/./.exec!==Ge},{exec:Ge});var We,Qe,Je="process"==p(o.process),ze=ce("navigator","userAgent")||"",Ze=o.process,Xe=Ze&&Ze.versions,$e=Xe&&Xe.v8;$e?Qe=(We=$e.split("."))[0]+We[1]:ze&&(!(We=ze.match(/Edge\/(\d+)/))||We[1]>=74)&&(We=ze.match(/Chrome\/(\d+)/))&&(Qe=We[1]);var et=Qe&&+Qe,tt=!!Object.getOwnPropertySymbols&&!a((function(){return!Symbol.sham&&(Je?38===et:et>37&&et<41)})),nt=tt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rt=H("wks"),it=o.Symbol,st=nt?it:it&&it.withoutSetter||Q,ot=function(e){return C(rt,e)&&(tt||"string"==typeof rt[e])||(tt&&C(it,e)?rt[e]=it[e]:rt[e]=st("Symbol."+e)),rt[e]},at=ot("species"),ut=!a((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),ct="$0"==="a".replace(/./,"$0"),lt=ot("replace"),ht=!!/./[lt]&&""===/./[lt]("a","$0"),ft=!a((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]})),dt=function(e,t,n,r){var i=ot(e),s=!a((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=s&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[at]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!s||!o||"replace"===e&&(!ut||!ct||ht)||"split"===e&&!ft){var u=/./[i],c=n(i,""[e],(function(e,t,n,r,i){return t.exec===RegExp.prototype.exec?s&&!i?{done:!0,value:u.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:ct,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:ht}),l=c[0],h=c[1];oe(String.prototype,e,l),oe(RegExp.prototype,i,2==t?function(e,t){return h.call(e,this,t)}:function(e){return h.call(e,this)})}r&&U(RegExp.prototype[i],"sham",!0)},gt=function(e){return function(t,n){var r,i,s=String(m(t)),o=fe(n),a=s.length;return o<0||o>=a?e?"":void 0:(r=s.charCodeAt(o))<55296||r>56319||o+1===a||(i=s.charCodeAt(o+1))<56320||i>57343?e?s.charAt(o):r:e?s.slice(o,o+2):i-56320+(r-55296<<10)+65536}},pt={codeAt:gt(!1),charAt:gt(!0)},vt=pt.charAt,yt=function(e,t,n){return t+(n?vt(e,t).length:1)},mt=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==p(e))throw TypeError("RegExp#exec called on incompatible receiver");return Ge.call(e,t)};function _t(e){return(_t="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})(e)}function Et(e,t,n,r,i,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,i)}function Rt(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function o(e){Et(s,r,i,o,a,"next",e)}function a(e){Et(s,r,i,o,a,"throw",e)}o(void 0)}))}}function Tt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(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 Ct(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bt(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 wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bt(Object(n),!0).forEach((function(t){St(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nt(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}}),t&&kt(e,t)}function Ot(e){return(Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function kt(e,t){return(kt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function At(){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 Mt(e,t,n){return(Mt=At()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&kt(i,n.prototype),i}).apply(null,arguments)}function Lt(e){var t="function"==typeof Map?new Map:void 0;return(Lt=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 Mt(e,arguments,Ot(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),kt(r,e)})(e)}function Ut(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Ut(e):t}function Pt(e){var t=At();return function(){var n,r=Ot(e);if(t){var i=Ot(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xt(this,n)}}function Dt(e,t,n){return(Dt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ot(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,s=[],o=!0,a=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(s.push(r.value),!t||s.length!==t);o=!0);}catch(e){a=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(a)throw i}}return s}(e,t)||Ft(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 Bt(e){return function(e){if(Array.isArray(e))return jt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ft(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 Ft(e,t){if(e){if("string"==typeof e)return jt(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)?jt(e,t):void 0}}function jt(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}dt("match",1,(function(e,t,n){return[function(t){var n=m(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=A(e),s=String(this);if(!i.global)return mt(i,s);var o=i.unicode;i.lastIndex=0;for(var a,u=[],c=0;null!==(a=mt(i,s));){var l=String(a[0]);u[c]=l,""===l&&(i.lastIndex=yt(s,ge(i.lastIndex),o)),c++}return 0===c?null:u}]}));var Kt=Array.isArray||function(e){return"Array"==p(e)},qt=function(e,t,n){var r=R(t);r in e?L.f(e,r,f(0,n)):e[r]=n},Yt=ot("species"),Ht=function(e,t){var n;return Kt(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Kt(n.prototype)?E(n)&&null===(n=n[Yt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Gt=ot("species"),Wt=function(e){return et>=51||!a((function(){var t=[];return(t.constructor={})[Gt]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Qt=ot("isConcatSpreadable"),Jt=9007199254740991,zt="Maximum allowed index exceeded",Zt=et>=51||!a((function(){var e=[];return e[Qt]=!1,e.concat()[0]!==e})),Xt=Wt("concat"),$t=function(e){if(!E(e))return!1;var t=e[Qt];return void 0!==t?!!t:Kt(e)};Pe({target:"Array",proto:!0,forced:!Zt||!Xt},{concat:function(e){var t,n,r,i,s,o=T(this),a=Ht(o,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if($t(s=-1===t?o:arguments[t])){if(u+(i=ge(s.length))>Jt)throw TypeError(zt);for(n=0;n<i;n++,u++)n in s&&qt(a,u,s[n])}else{if(u>=Jt)throw TypeError(zt);qt(a,u++,s)}return a.length=u,a}});var en,tn,nn=72e5,rn=5e3,sn=5e3,on=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],an=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],un=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],cn=3e4,ln=131072,hn="RCV4-",fn={"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}},dn=["RC:TypSts","RC:InterceptMsg"];e.CONNECTION_TYPE=void 0,(en=e.CONNECTION_TYPE||(e.CONNECTION_TYPE={})).WEBSOCKET="websocket",en.COMET="comet";var gn=function(e){return tn||(tn={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}}),tn},pn=function(){function e(t){Tt(this,e),this._caches={},t&&(this._caches=t)}return Ct(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}(),vn=function(){function e(t,n){Tt(this,e);var r=n?"".concat(hn).concat(n):hn;this._rootStorage=gn(t);var i=this._rootStorage.get(r)||{};this._cache=new pn(St({},r,i)),this._storageKey=r}return Ct(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}(),yn=function(e){Nt(n,e);var t=Pt(n);function n(e){return Tt(this,n),t.call(this,"TODO => ".concat(e))}return n}(Lt(Error)),mn=Wt("slice"),_n=ot("species"),En=[].slice,Rn=Math.max;Pe({target:"Array",proto:!0,forced:!mn},{slice:function(e,t){var n,r,i,s=_(this),o=ge(s.length),a=ye(e,o),u=ye(void 0===t?o:t,o);if(Kt(s)&&("function"!=typeof(n=s.constructor)||n!==Array&&!Kt(n.prototype)?E(n)&&null===(n=n[_n])&&(n=void 0):n=void 0,n===Array||void 0===n))return En.call(s,a,u);for(r=new(void 0===n?Array:n)(Rn(u-a,0)),i=0;a<u;a++,i++)a in s&&qt(r,i,s[a]);return r.length=i,r}});var Tn=Math.floor,In="".replace,Cn=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Sn=/\$([$&'`]|\d{1,2})/g,bn=function(e,t,n,r,i,s){var o=n+e.length,a=r.length,u=Sn;return void 0!==i&&(i=T(i),u=Cn),In.call(s,u,(function(s,u){var c;switch(u.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(o);case"<":c=i[u.slice(1,-1)];break;default:var l=+u;if(0===l)return s;if(l>a){var h=Tn(l/10);return 0===h?s:h<=a?void 0===r[h-1]?u.charAt(1):r[h-1]+u.charAt(1):s}c=r[l-1]}return void 0===c?"":c}))},wn=Math.max,Nn=Math.min;dt("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,s=r.REPLACE_KEEPS_$0,o=i?"$":"$0";return[function(n,r){var i=m(this),s=null==n?void 0:n[e];return void 0!==s?s.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!i&&s||"string"==typeof r&&-1===r.indexOf(o)){var a=n(t,e,this,r);if(a.done)return a.value}var u=A(e),c=String(this),l="function"==typeof r;l||(r=String(r));var h=u.global;if(h){var f=u.unicode;u.lastIndex=0}for(var d=[];;){var g=mt(u,c);if(null===g)break;if(d.push(g),!h)break;""===String(g[0])&&(u.lastIndex=yt(c,ge(u.lastIndex),f))}for(var p,v="",y=0,m=0;m<d.length;m++){g=d[m];for(var _=String(g[0]),E=wn(Nn(fe(g.index),c.length),0),R=[],T=1;T<g.length;T++)R.push(void 0===(p=g[T])?p:String(p));var I=g.groups;if(l){var C=[_].concat(R,E,c);void 0!==I&&C.push(I);var S=String(r.apply(void 0,C))}else S=bn(_,c,E,R,I,r);E>=y&&(v+=c.slice(y,E)+S,y=E+_.length)}return v+c.slice(y)}]}));var On=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},kn=function(e,t,n){if(On(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},An=[].push,Mn=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,s=6==e,o=7==e,a=5==e||s;return function(u,c,l,h){for(var f,d,g=T(u),p=y(g),v=kn(c,l,3),m=ge(p.length),_=0,E=h||Ht,R=t?E(u,m):n||o?E(u,0):void 0;m>_;_++)if((a||_ in p)&&(d=v(f=p[_],_,g),e))if(t)R[_]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return _;case 2:An.call(R,f)}else switch(e){case 4:return!1;case 7:An.call(R,f)}return s?-1:r||i?i:R}},Ln={forEach:Mn(0),map:Mn(1),filter:Mn(2),some:Mn(3),every:Mn(4),find:Mn(5),findIndex:Mn(6),filterOut:Mn(7)},Un=Ln.filter,xn=Wt("filter");Pe({target:"Array",proto:!0,forced:!xn},{filter:function(e){return Un(this,e,arguments.length>1?arguments[1]:void 0)}});var Pn=Ln.map,Dn=Wt("map");Pe({target:"Array",proto:!0,forced:!Dn},{map:function(e){return Pn(this,e,arguments.length>1?arguments[1]:void 0)}});var Vn=Object.keys||function(e){return Re(e,Te)},Bn=a((function(){Vn(1)}));Pe({target:"Object",stat:!0,forced:Bn},{keys:function(e){return Vn(T(e))}});var Fn=function(e,t){var n=[][e];return!!n&&a((function(){n.call(null,t||function(){throw 1},1)}))},jn=[].join,Kn=y!=Object,qn=Fn("join",",");Pe({target:"Array",proto:!0,forced:Kn||!qn},{join:function(e){return jn.call(_(this),void 0===e?",":e)}});var Yn=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()}))},Hn=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 o=0,a=e.length;o<a;o++)r+=(t=e.charCodeAt(o))<127?1:t<=2047?2:t<=65535?3:4;return r},Gn=function(e){return e.match(/\d+(\.\d+){2}/)[0]};i((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=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),o=new N(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 o=n.delegate;if(o){var a=S(o,n);if(a){if(a===p)continue;return a}}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,o),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 _={};_[s]=function(){return this};var E=Object.getPrototypeOf,R=E&&E(E(O([])));R&&R!==n&&r.call(R,s)&&(_=R);var T=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,o,a){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,o,a)}),(function(e){n("throw",e,o,a)})):t.resolve(h).then((function(e){c.value=e,o(c)}),(function(e){return n("throw",e,o,a)}))}a(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 N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function O(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,o=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 o.next=o}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=T.constructor=m,m.constructor=y,y.displayName=u(m,a,"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,a,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},I(C.prototype),C.prototype[o]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,r,i,s){void 0===s&&(s=Promise);var o=new C(c(t,n,r,i),s);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},I(T),u(T,a,"Generator"),T[s]=function(){return this},T.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=O,N.prototype={constructor:N,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 a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.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 o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(o)},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:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));var Wn=L.f,Qn=Function.prototype,Jn=Qn.toString,zn=/^\s*function ([^ (]*)/,Zn="name";u&&!(Zn in Qn)&&Wn(Qn,Zn,{configurable:!0,get:function(){try{return Jn.call(this).match(zn)[1]}catch(e){return""}}});var Xn,$n=u?Object.defineProperties:function(e,t){A(e);for(var n,r=Vn(t),i=r.length,s=0;i>s;)L.f(e,n=r[s++],t[n]);return e},er=ce("document","documentElement"),tr=z("IE_PROTO"),nr=function(){},rr=function(e){return"<script>"+e+"</"+"script>"},ir=function(){try{Xn=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;ir=Xn?function(e){e.write(rr("")),e.close();var t=e.parentWindow.Object;return e=null,t}(Xn):((t=w("iframe")).style.display="none",er.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(rr("document.F=Object")),e.close(),e.F);for(var n=Te.length;n--;)delete ir.prototype[Te[n]];return ir()};Z[tr]=!0;var sr=Object.create||function(e,t){var n;return null!==e?(nr.prototype=A(e),n=new nr,nr.prototype=null,n[tr]=e):n=ir(),void 0===t?n:$n(n,t)},or=ot("unscopables"),ar=Array.prototype;null==ar[or]&&L.f(ar,or,{configurable:!0,value:sr(null)});var ur,cr,lr=function(e){ar[or][e]=!0},hr=_e.includes;Pe({target:"Array",proto:!0},{includes:function(e){return hr(this,e,arguments.length>1?arguments[1]:void 0)}}),lr("includes"),e.LogLevel=void 0,(ur=e.LogLevel||(e.LogLevel={}))[ur.LOG=0]="LOG",ur[ur.DEBUG=0]="DEBUG",ur[ur.INFO=1]="INFO",ur[ur.WARN=2]="WARN",ur[ur.ERROR=3]="ERROR",ur[ur.FATAL=4]="FATAL",ur[ur.NONE=1e3]="NONE",e.LogType=void 0,(cr=e.LogType||(e.LogType={})).IM="IM",cr.RTC="RTC";var fr={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},dr=Ln.forEach,gr=Fn("forEach")?[].forEach:function(e){return dr(this,e,arguments.length>1?arguments[1]:void 0)};for(var pr in fr){var vr=o[pr],yr=vr&&vr.prototype;if(yr&&yr.forEach!==gr)try{U(yr,"forEach",gr)}catch(e){yr.forEach=gr}}var mr={};mr[ot("toStringTag")]="z";var _r="[object z]"===String(mr),Er=ot("toStringTag"),Rr="Arguments"==p(function(){return arguments}()),Tr=_r?p: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=Object(e),Er))?n:Rr?p(t):"Object"==(r=p(t))&&"function"==typeof t.callee?"Arguments":r},Ir=_r?{}.toString:function(){return"[object "+Tr(this)+"]"};_r||oe(Object.prototype,"toString",Ir,{unsafe:!0});var Cr=o.Promise,Sr=function(e,t,n){for(var r in t)oe(e,r,t[r],n);return e},br=L.f,wr=ot("toStringTag"),Nr=function(e,t,n){e&&!C(e=n?e:e.prototype,wr)&&br(e,wr,{configurable:!0,value:t})},Or=ot("species"),kr=function(e){var t=ce(e),n=L.f;u&&t&&!t[Or]&&n(t,Or,{configurable:!0,get:function(){return this}})},Ar=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Mr={},Lr=ot("iterator"),Ur=Array.prototype,xr=function(e){return void 0!==e&&(Mr.Array===e||Ur[Lr]===e)},Pr=ot("iterator"),Dr=function(e){if(null!=e)return e[Pr]||e["@@iterator"]||Mr[Tr(e)]},Vr=function(e){var t=e.return;if(void 0!==t)return A(t.call(e)).value},Br=function(e,t){this.stopped=e,this.result=t},Fr=function(e,t,n){var r,i,s,o,a,u,c,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=kn(t,l,1+h+d),p=function(e){return r&&Vr(r),new Br(!0,e)},v=function(e){return h?(A(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("function"!=typeof(i=Dr(e)))throw TypeError("Target is not iterable");if(xr(i)){for(s=0,o=ge(e.length);o>s;s++)if((a=v(e[s]))&&a instanceof Br)return a;return new Br(!1)}r=i.call(e)}for(u=r.next;!(c=u.call(r)).done;){try{a=v(c.value)}catch(e){throw Vr(r),e}if("object"==typeof a&&a&&a instanceof Br)return a}return new Br(!1)},jr=ot("iterator"),Kr=!1;try{var qr=0,Yr={next:function(){return{done:!!qr++}},return:function(){Kr=!0}};Yr[jr]=function(){return this},Array.from(Yr,(function(){throw 2}))}catch(e){}var Hr,Gr,Wr,Qr=function(e,t){if(!t&&!Kr)return!1;var n=!1;try{var r={};r[jr]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Jr=ot("species"),zr=function(e,t){var n,r=A(e).constructor;return void 0===r||null==(n=A(r)[Jr])?t:On(n)},Zr=/(?:iphone|ipod|ipad).*applewebkit/i.test(ze),Xr=o.location,$r=o.setImmediate,ei=o.clearImmediate,ti=o.process,ni=o.MessageChannel,ri=o.Dispatch,ii=0,si={},oi="onreadystatechange",ai=function(e){if(si.hasOwnProperty(e)){var t=si[e];delete si[e],t()}},ui=function(e){return function(){ai(e)}},ci=function(e){ai(e.data)},li=function(e){o.postMessage(e+"",Xr.protocol+"//"+Xr.host)};$r&&ei||($r=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return si[++ii]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Hr(ii),ii},ei=function(e){delete si[e]},Je?Hr=function(e){ti.nextTick(ui(e))}:ri&&ri.now?Hr=function(e){ri.now(ui(e))}:ni&&!Zr?(Wr=(Gr=new ni).port2,Gr.port1.onmessage=ci,Hr=kn(Wr.postMessage,Wr,1)):o.addEventListener&&"function"==typeof postMessage&&!o.importScripts&&Xr&&"file:"!==Xr.protocol&&!a(li)?(Hr=li,o.addEventListener("message",ci,!1)):Hr=oi in w("script")?function(e){er.appendChild(w("script")).onreadystatechange=function(){er.removeChild(this),ai(e)}}:function(e){setTimeout(ui(e),0)});var hi,fi,di,gi,pi,vi,yi,mi,_i={set:$r,clear:ei},Ei=/web0s(?!.*chrome)/i.test(ze),Ri=k.f,Ti=_i.set,Ii=o.MutationObserver||o.WebKitMutationObserver,Ci=o.document,Si=o.process,bi=o.Promise,wi=Ri(o,"queueMicrotask"),Ni=wi&&wi.value;Ni||(hi=function(){var e,t;for(Je&&(e=Si.domain)&&e.exit();fi;){t=fi.fn,fi=fi.next;try{t()}catch(e){throw fi?gi():di=void 0,e}}di=void 0,e&&e.enter()},Zr||Je||Ei||!Ii||!Ci?bi&&bi.resolve?(yi=bi.resolve(void 0),mi=yi.then,gi=function(){mi.call(yi,hi)}):gi=Je?function(){Si.nextTick(hi)}:function(){Ti.call(o,hi)}:(pi=!0,vi=Ci.createTextNode(""),new Ii(hi).observe(vi,{characterData:!0}),gi=function(){vi.data=pi=!pi}));var Oi,ki,Ai,Mi,Li=Ni||function(e){var t={fn:e,next:void 0};di&&(di.next=t),fi||(fi=t,gi()),di=t},Ui=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=On(t),this.reject=On(n)},xi={f:function(e){return new Ui(e)}},Pi=function(e,t){if(A(e),E(t)&&t.constructor===e)return t;var n=xi.f(e);return(0,n.resolve)(t),n.promise},Di=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Vi=_i.set,Bi=ot("species"),Fi="Promise",ji=se.get,Ki=se.set,qi=se.getterFor(Fi),Yi=Cr,Hi=o.TypeError,Gi=o.document,Wi=o.process,Qi=ce("fetch"),Ji=xi.f,zi=Ji,Zi=!!(Gi&&Gi.createEvent&&o.dispatchEvent),Xi="function"==typeof PromiseRejectionEvent,$i="unhandledrejection",es=Ue(Fi,(function(){if(!(K(Yi)!==String(Yi))){if(66===et)return!0;if(!Je&&!Xi)return!0}if(et>=51&&/native code/.test(Yi))return!1;var e=Yi.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[Bi]=t,!(e.then((function(){}))instanceof t)})),ts=es||!Qr((function(e){Yi.all(e).catch((function(){}))})),ns=function(e){var t;return!(!E(e)||"function"!=typeof(t=e.then))&&t},rs=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;Li((function(){for(var r=e.value,i=1==e.state,s=0;n.length>s;){var o,a,u,c=n[s++],l=i?c.ok:c.fail,h=c.resolve,f=c.reject,d=c.domain;try{l?(i||(2===e.rejection&&as(e),e.rejection=1),!0===l?o=r:(d&&d.enter(),o=l(r),d&&(d.exit(),u=!0)),o===c.promise?f(Hi("Promise-chain cycle")):(a=ns(o))?a.call(o,h,f):h(o)):f(r)}catch(e){d&&!u&&d.exit(),f(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&ss(e)}))}},is=function(e,t,n){var r,i;Zi?((r=Gi.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),o.dispatchEvent(r)):r={promise:t,reason:n},!Xi&&(i=o["on"+e])?i(r):e===$i&&function(e,t){var n=o.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},ss=function(e){Vi.call(o,(function(){var t,n=e.facade,r=e.value;if(os(e)&&(t=Di((function(){Je?Wi.emit("unhandledRejection",r,n):is($i,n,r)})),e.rejection=Je||os(e)?2:1,t.error))throw t.value}))},os=function(e){return 1!==e.rejection&&!e.parent},as=function(e){Vi.call(o,(function(){var t=e.facade;Je?Wi.emit("rejectionHandled",t):is("rejectionhandled",t,e.value)}))},us=function(e,t,n){return function(r){e(t,r,n)}},cs=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,rs(e,!0))},ls=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Hi("Promise can't be resolved itself");var r=ns(t);r?Li((function(){var n={done:!1};try{r.call(t,us(ls,n,e),us(cs,n,e))}catch(t){cs(n,t,e)}})):(e.value=t,e.state=1,rs(e,!1))}catch(t){cs({done:!1},t,e)}}};es&&(Yi=function(e){Ar(this,Yi,Fi),On(e),Oi.call(this);var t=ji(this);try{e(us(ls,t),us(cs,t))}catch(e){cs(t,e)}},(Oi=function(e){Ki(this,{type:Fi,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Sr(Yi.prototype,{then:function(e,t){var n=qi(this),r=Ji(zr(this,Yi));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Je?Wi.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&rs(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),ki=function(){var e=new Oi,t=ji(e);this.promise=e,this.resolve=us(ls,t),this.reject=us(cs,t)},xi.f=Ji=function(e){return e===Yi||e===Ai?new ki(e):zi(e)},"function"==typeof Cr&&(Mi=Cr.prototype.then,oe(Cr.prototype,"then",(function(e,t){var n=this;return new Yi((function(e,t){Mi.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof Qi&&Pe({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Pi(Yi,Qi.apply(o,arguments))}}))),Pe({global:!0,wrap:!0,forced:es},{Promise:Yi}),Nr(Yi,Fi,!1),kr(Fi),Ai=ce(Fi),Pe({target:Fi,stat:!0,forced:es},{reject:function(e){var t=Ji(this);return t.reject.call(void 0,e),t.promise}}),Pe({target:Fi,stat:!0,forced:es},{resolve:function(e){return Pi(this,e)}}),Pe({target:Fi,stat:!0,forced:ts},{all:function(e){var t=this,n=Ji(t),r=n.resolve,i=n.reject,s=Di((function(){var n=On(t.resolve),s=[],o=0,a=1;Fr(e,(function(e){var u=o++,c=!1;s.push(void 0),a++,n.call(t,e).then((function(e){c||(c=!0,s[u]=e,--a||r(s))}),i)})),--a||r(s)}));return s.error&&i(s.value),n.promise},race:function(e){var t=this,n=Ji(t),r=n.reject,i=Di((function(){var i=On(t.resolve);Fr(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var hs="RC_Logs";function fs(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(hs),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=wt({},n.objectStoreParams);r=e.createObjectStore(t,i),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,hs,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var ds=function(){function e(){Tt(this,e)}return Ct(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 o=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),u=o.index(n),c=[],l=u.openCursor(a);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,fs(t)}}else console.debug("IndexDB is not currently supported in the environment!")}},{key:"getInstance",value:function(){return e._instance}}]),e}();ds._db=null;var gs=ot("match"),ps=function(e){var t;return E(e)&&(void 0!==(t=e[gs])?!!t:"RegExp"==p(e))},vs=Be.UNSUPPORTED_Y,ys=[].push,ms=Math.min,_s=4294967295;dt("split",2,(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=String(m(this)),i=void 0===n?_s:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!ps(e))return t.call(r,e,i);for(var s,o,a,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(s=Ge.call(h,r))&&!((o=h.lastIndex)>l&&(u.push(r.slice(l,s.index)),s.length>1&&s.index<r.length&&ys.apply(u,s.slice(1)),a=s[0].length,l=o,u.length>=i));)h.lastIndex===s.index&&h.lastIndex++;return l===r.length?!a&&h.test("")||u.push(""):u.push(r.slice(l)),u.length>i?u.slice(0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=m(this),s=null==t?void 0:t[e];return void 0!==s?s.call(t,i,n):r.call(String(i),t,n)},function(e,i){var s=n(r,e,this,i,r!==t);if(s.done)return s.value;var o=A(e),a=String(this),u=zr(o,RegExp),c=o.unicode,l=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(vs?"g":"y"),h=new u(vs?"^(?:"+o.source+")":o,l),f=void 0===i?_s:i>>>0;if(0===f)return[];if(0===a.length)return null===mt(h,a)?[a]:[];for(var d=0,g=0,p=[];g<a.length;){h.lastIndex=vs?0:g;var v,y=mt(h,vs?a.slice(g):a);if(null===y||(v=ms(ge(h.lastIndex+(vs?g:0)),a.length))===d)g=yt(a,g,c);else{if(p.push(a.slice(d,g)),p.length===f)return p;for(var m=1;m<=y.length-1;m++)if(p.push(y[m]),p.length===f)return p;g=d=v}}return p.push(a.slice(d)),p}]}),vs);var Es="toString",Rs=RegExp.prototype,Ts=Rs.toString,Is=a((function(){return"/a/b"!=Ts.call({source:"a",flags:"b"})})),Cs=Ts.name!=Es;(Is||Cs)&&oe(RegExp.prototype,Es,(function(){var e=A(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in Rs)?De.call(e):n)}),{unsafe:!0});var Ss,bs=function(e,t){return e+Math.floor(Math.random()*(t-e))},ws=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)}))},Ns=function(){var e=ws();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.RTC_ROOM=12]="RTC_ROOM"}(Ss||(Ss={}));var Os,ks=Ss;!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"}(Os||(Os={}));var As,Ms=Os,Ls=function(e){return"string"==typeof e},Us=function(e){return"boolean"==typeof e},xs=function(e){return"number"==typeof e&&!isNaN(e)},Ps=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Ds=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Vs=function(e){return Ls(e)&&e.length>0},Bs=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Fs=function(e){return"[object Function]"===Object.prototype.toString.call(e)},js=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Ks=function(e){return"[object Null]"===Object.prototype.toString.call(e)},qs=function(e){for(var t in e)return!0;return!1},Ys=(St(As={},e.LogLevel.DEBUG,console.debug.bind(console)),St(As,e.LogLevel.INFO,console.info.bind(console)),St(As,e.LogLevel.WARN,console.warn.bind(console)),St(As,e.LogLevel.ERROR,console.error.bind(console)),St(As,e.LogLevel.FATAL,console.log.bind(console)),As),Hs=function(e){return Ls(e)||xs(e)||js(e)||Us(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},Gs=function(){function t(n,r,i){Tt(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 Ct(t,[{key:"_defaultStdout",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];Ys[e].apply(Ys,["".concat(t,":")].concat(r))}},{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 o=Date.now();Hn(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,o="";for(s=0;s<e.length;s++){if(e.charCodeAt(s)>255?i+=r:i++,i>t)return o;o+=e.charAt(s)}return e}(r,1e3));var a=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:o,level:4-n,content:"".concat(t.sessionId,",").concat(Date.now(),",").concat(s,",").concat(4-n,",").concat(u,',"').concat(a,'"\n'),userId:t.userId};t.databaseLogList.push(c),(t.databaseLogList.length>=100||n===e.LogLevel.FATAL)&&this.__insertLogIntoDatabase()}},{key:"__insertLogIntoDatabase",value:(n=Rt(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Bt(t.databaseLogList),t.databaseLogList=[],!(r=ds.getInstance())){e.next=14;break}return e.next=6,r.addList(hs,n);case 6:return i=e.sent,e.next=9,r.getCount(hs,"time");case 9:return e.sent>1e5&&r.removeFirstData(hs,"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(Hs).join(" "),this.tag),!(t<this._outLevel)){var s="".concat((new Date).toISOString(),"[").concat(this.tag,"][").concat(e.LogLevel[t],"]"),o="".concat(s," - ").concat(r.map(Hs).join(" "));this._logStdout?this._logStdout(t,o):this._stdout?this._stdout(t,o):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}();Gs.databaseLogList=[],Gs.realTimeLogList=[],Gs.sessionId=Ns(),Gs.userId="";var Ws=new Gs("RCLog"),Qs=Wt("splice"),Js=Math.max,zs=Math.min,Zs=9007199254740991,Xs="Maximum allowed length exceeded";Pe({target:"Array",proto:!0,forced:!Qs},{splice:function(e,t){var n,r,i,s,o,a,u=T(this),c=ge(u.length),l=ye(e,c),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=zs(Js(fe(t),0),c-l)),c+n-r>Zs)throw TypeError(Xs);for(i=Ht(u,r),s=0;s<r;s++)(o=l+s)in u&&qt(i,s,u[o]);if(i.length=r,n<r){for(s=l;s<c-r;s++)a=s+n,(o=s+r)in u?u[a]=u[o]:delete u[a];for(s=c;s>c-r+n;s--)delete u[s-1]}else if(n>r)for(s=c-r;s>l;s--)a=s+n-1,(o=s+r-1)in u?u[a]=u[o]:delete u[a];for(s=0;s<n;s++)u[s+l]=arguments[s+2];return u.length=c-r+n,i}});var $s,eo=function(){function e(){Tt(this,e),this._map={}}return Ct(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 o=t[s],a=o.target,u=o.once,c=o.listener;u&&t.splice(s,1);try{c.call.apply(c,[a].concat(r))}catch(e){Ws.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"}($s||($s={}));var to,no=$s;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",e[e.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",e[e.SUCCESS=0]="SUCCESS",e[e.RC_MSG_UNAUTHORIZED=20406]="RC_MSG_UNAUTHORIZED",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",e[e.ALREADY_IN_USE=51002]="ALREADY_IN_USE",e[e.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",e[e.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",e[e.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"}(to||(to={}));var ro,io=to;!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"}(ro||(ro={}));var so,oo=ro,ao={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"}(so||(so={}));var uo,co=so;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(uo||(uo={}));var lo,ho=uo;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(lo||(lo={}));var fo,go=lo;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(fo||(fo={}));var po,vo=fo;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(po||(po={}));var yo,mo=po;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(yo||(yo={}));var _o,Eo=yo;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(_o||(_o={}));var Ro,To,Io,Co=_o;e.RTCMode=void 0,(Ro=e.RTCMode||(e.RTCMode={}))[Ro.RTC=0]="RTC",Ro[Ro.LIVE=2]="LIVE",e.LiveType=void 0,(To=e.LiveType||(e.LiveType={}))[To.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",To[To.AUDIO=1]="AUDIO",e.LiveRole=void 0,(Io=e.LiveRole||(e.LiveRole={}))[Io.ANCHOR=1]="ANCHOR",Io[Io.AUDIENCE=2]="AUDIENCE";var So,bo,wo,No={"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,(So=e.RTCApiType||(e.RTCApiType={}))[So.ROOM=1]="ROOM",So[So.PERSON=2]="PERSON",e.RTCIdentityChangeType=void 0,(bo=e.RTCIdentityChangeType||(e.RTCIdentityChangeType={}))[bo.AnchorToViewer=1]="AnchorToViewer",bo[bo.ViewerToAnchor=2]="ViewerToAnchor",e.RTCJoinType=void 0,(wo=e.RTCJoinType||(e.RTCJoinType={}))[wo.KICK=0]="KICK",wo[wo.REFUSE=1]="REFUSE",wo[wo.COEXIST=2]="COEXIST";var Oo=function(e){var t=String(m(this)),n="",r=fe(e);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},ko=Math.ceil,Ao=function(e){return function(t,n,r){var i,s,o=String(m(t)),a=o.length,u=void 0===r?" ":String(r),c=ge(n);return c<=a||""==u?o:((s=Oo.call(u,ko((i=c-a)/u.length))).length>i&&(s=s.slice(0,i)),e?o+s:s+o)}},Mo={start:Ao(!1),end:Ao(!0)},Lo=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(ze),Uo=Mo.start;Pe({target:"String",proto:!0,forced:Lo},{padStart:function(e){return Uo(this,e,arguments.length>1?arguments[1]:void 0)}});var xo,Po,Do={engine:"5.1.1"},Vo=function(){function e(){Tt(this,e)}return Ct(e,null,[{key:"add",value:function(e,t){Do[e]=t}},{key:"validEngine",value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return Ws.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 Do.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n}},{key:"getInfo",value:function(){return Do}}]),e}();e.AssertRules=void 0,(Po=e.AssertRules||(e.AssertRules={}))[Po.STRING=0]="STRING",Po[Po.ONLY_STRING=1]="ONLY_STRING",Po[Po.NUMBER=2]="NUMBER",Po[Po.BOOLEAN=3]="BOOLEAN",Po[Po.OBJECT=4]="OBJECT",Po[Po.ARRAY=5]="ARRAY",Po[Po.CALLBACK=6]="CALLBACK",Po[Po.CHANNEL_ID=7]="CHANNEL_ID";var Bo=(St(xo={},e.AssertRules.STRING,Vs),St(xo,e.AssertRules.ONLY_STRING,Ls),St(xo,e.AssertRules.NUMBER,xs),St(xo,e.AssertRules.BOOLEAN,(function(e){return"boolean"==typeof e})),St(xo,e.AssertRules.OBJECT,Bs),St(xo,e.AssertRules.ARRAY,Ps),St(xo,e.AssertRules.CALLBACK,(function(e){var t=!0;return Bs(e)||(t=!1),(e=e||{}).onSuccess&&!Fs(e.onSuccess)&&(t=!1),e.onError&&!Fs(e.onError)&&(t=!1),t})),St(xo,e.AssertRules.CHANNEL_ID,(function(e){var t=!1;return Ls(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t})),xo),Fo=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,e)).name="RCAssertError",r}return n}(Lt(Error)),jo=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=Bo[n]||n;var i=r&&!n(t)||!r&&!(js(t)||null===t||n(t));return i&&Ws.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},Ko=[].slice,qo=/MSIE .\./.test(ze),Yo=function(e){return function(t,n){var r=arguments.length>2,i=r?Ko.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};Pe({global:!0,bind:!0,forced:qo},{setTimeout:Yo(o.setTimeout),setInterval:Yo(o.setInterval)});var Ho=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return A(n),function(e){if(!E(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),Go=function(e,t,n){var r,i;return Ho&&"function"==typeof(r=t.constructor)&&r!==n&&E(i=r.prototype)&&i!==n.prototype&&Ho(e,i),e},Wo=L.f,Qo=Ce.f,Jo=se.enforce,zo=ot("match"),Zo=o.RegExp,Xo=Zo.prototype,$o=/a/g,ea=/a/g,ta=new Zo($o)!==$o,na=Be.UNSUPPORTED_Y;if(u&&Ue("RegExp",!ta||na||a((function(){return ea[zo]=!1,Zo($o)!=$o||Zo(ea)==ea||"/a/i"!=Zo($o,"i")})))){for(var ra=function(e,t){var n,r=this instanceof ra,i=ps(e),s=void 0===t;if(!r&&i&&e.constructor===ra&&s)return e;ta?i&&!s&&(e=e.source):e instanceof ra&&(s&&(t=De.call(e)),e=e.source),na&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=Go(ta?new Zo(e,t):Zo(e,t),r?this:Xo,ra);na&&n&&(Jo(o).sticky=!0);return o},ia=function(e){e in ra||Wo(ra,e,{configurable:!0,get:function(){return Zo[e]},set:function(t){Zo[e]=t}})},sa=Qo(Zo),oa=0;sa.length>oa;)ia(sa[oa++]);Xo.constructor=ra,ra.prototype=Xo,oe(o,"RegExp",ra)}kr("RegExp");var aa,ua,ca,la=function(e){if(!Bs(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)},ha=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=ws(),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(),o="";if(t){var a=t.split(".");o="."+a[a.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(s).concat(r).concat(o)},fa=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,o=t.channelIdMi,a=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:a||""}},{MI:{channelId:o||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:h},{FCM:f}];return JSON.stringify(g)},da=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,o,a=Object.keys(e);if(0!==a.length){var u=a[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===(o=e[u])||void 0===o?void 0:o.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){Ws.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},ga=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},pa=function(e){var t=e.length;return t<=4096&&t>=1},va=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Bs(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Ps(e)||Ls(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)}()},ya=function(e,t){return va(e,(function(n,r){e[r]=t(n,r)})),e},ma=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return va(e,(function(e,r){t===e&&(n=r)})),n},_a=function(e,t){var n=[];return va(e,(function(e){n.push(e)})),-1!==ma(n,t)},Ea=function(e){return JSON.parse(JSON.stringify(e))},Ra=function(){return"undefined"!=typeof RCCppEngine},Ta=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 o=r.match(i[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Ia=function(e){switch(e){case ao.SERVER_UNAVAILABLE:return io.SERVER_UNAVAILABLE;case ao.TOKEN_INCORRECT:return io.RC_CONN_USER_OR_PASSWD_ERROR;case ao.REDIRECT:return io.RC_CONN_REDIRECTED;case ao.APP_BLOCK_OR_DELETE:return io.RC_CONN_APP_BLOCKED_OR_DELETED;case ao.BLOCK:return io.RC_CONN_USER_BLOCKED;case ao.TOKEN_EXPIRE:return io.RC_CONN_USER_OR_PASSWD_ERROR;case ao.HOSTNAME_ERROR:return io.HOSTNAME_ERROR;case ao.HASOHTERSAMECLIENTONLINE:return io.HAS_OHTER_SAME_CLIENT_ON_LINE;case ao.APP_AUTH_NOT_PASS:return io.RC_APP_AUTH_NOT_PASS;case ao.OTP_USED:return io.RC_OTP_USED;case ao.PLATFORM_ERROR:return io.RC_PLATFORM_ERROR;default:return io.RC_NET_UNAVAILABLE}},Ca=function(e){var t={},n=JSON.parse(e);return va(n,(function(e,n){t[n]=e.v})),t},Sa={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Sa._delayTime=t-e},getTime:function(){var e=Sa._delayTime;return(new Date).getTime()-e}},ba=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},wa=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Na=z("IE_PROTO"),Oa=Object.prototype,ka=wa?Object.getPrototypeOf:function(e){return e=T(e),C(e,Na)?e[Na]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Oa:null},Aa=ot("iterator"),Ma=!1;[].keys&&("next"in(ca=[].keys())?(ua=ka(ka(ca)))!==Object.prototype&&(aa=ua):Ma=!0),(null==aa||a((function(){var e={};return aa[Aa].call(e)!==e})))&&(aa={}),C(aa,Aa)||U(aa,Aa,(function(){return this}));var La={IteratorPrototype:aa,BUGGY_SAFARI_ITERATORS:Ma},Ua=La.IteratorPrototype,xa=function(){return this},Pa=La.IteratorPrototype,Da=La.BUGGY_SAFARI_ITERATORS,Va=ot("iterator"),Ba="keys",Fa="values",ja="entries",Ka=function(){return this},qa=function(e,t,n,r,i,s,o){!function(e,t,n){var r=t+" Iterator";e.prototype=sr(Ua,{next:f(1,n)}),Nr(e,r,!1),Mr[r]=xa}(n,t,r);var a,u,c,l=function(e){if(e===i&&v)return v;if(!Da&&e in g)return g[e];switch(e){case Ba:case Fa:case ja:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",d=!1,g=e.prototype,p=g[Va]||g["@@iterator"]||i&&g[i],v=!Da&&p||l(i),y="Array"==t&&g.entries||p;if(y&&(a=ka(y.call(new e)),Pa!==Object.prototype&&a.next&&(ka(a)!==Pa&&(Ho?Ho(a,Pa):"function"!=typeof a[Va]&&U(a,Va,Ka)),Nr(a,h,!0))),i==Fa&&p&&p.name!==Fa&&(d=!0,v=function(){return p.call(this)}),g[Va]!==v&&U(g,Va,v),Mr[t]=v,i)if(u={values:l(Fa),keys:s?v:l(Ba),entries:l(ja)},o)for(c in u)(Da||d||!(c in g))&&oe(g,c,u[c]);else Pe({target:t,proto:!0,forced:Da||d},u);return u},Ya="Array Iterator",Ha=se.set,Ga=se.getterFor(Ya),Wa=qa(Array,"Array",(function(e,t){Ha(this,{type:Ya,target:_(e),index:0,kind:t})}),(function(){var e=Ga(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");Mr.Arguments=Mr.Array,lr("keys"),lr("values"),lr("entries");var Qa="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Ja=function(e){if(void 0===e)return 0;var t=fe(e),n=ge(t);if(t!==n)throw RangeError("Wrong length or index");return n},za=Math.abs,Za=Math.pow,Xa=Math.floor,$a=Math.log,eu=Math.LN2,tu=function(e,t,n){var r,i,s,o=new Array(n),a=8*n-t-1,u=(1<<a)-1,c=u>>1,l=23===t?Za(2,-24)-Za(2,-77):0,h=e<0||0===e&&1/e<0?1:0,f=0;for((e=za(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=Xa($a(e)/eu),e*(s=Za(2,-r))<1&&(r--,s*=2),(e+=r+c>=1?l/s:l*Za(2,1-c))*s>=2&&(r++,s/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*s-1)*Za(2,t),r+=c):(i=e*Za(2,c-1)*Za(2,t),r=0));t>=8;o[f++]=255&i,i/=256,t-=8);for(r=r<<t|i,a+=t;a>0;o[f++]=255&r,r/=256,a-=8);return o[--f]|=128*h,o},nu=function(e,t){var n,r=e.length,i=8*r-t-1,s=(1<<i)-1,o=s>>1,a=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;a>0;l=256*l+e[u],u--,a-=8);for(n=l&(1<<-a)-1,l>>=-a,a+=t;a>0;n=256*n+e[u],u--,a-=8);if(0===l)l=1-o;else{if(l===s)return n?NaN:c?-1/0:1/0;n+=Za(2,t),l-=o}return(c?-1:1)*n*Za(2,l-t)},ru=function(e){for(var t=T(this),n=ge(t.length),r=arguments.length,i=ye(r>1?arguments[1]:void 0,n),s=r>2?arguments[2]:void 0,o=void 0===s?n:ye(s,n);o>i;)t[i++]=e;return t},iu=Ce.f,su=L.f,ou=se.get,au=se.set,uu="ArrayBuffer",cu="DataView",lu="Wrong index",hu=o.ArrayBuffer,fu=hu,du=o.DataView,gu=du&&du.prototype,pu=Object.prototype,vu=o.RangeError,yu=tu,mu=nu,_u=function(e){return[255&e]},Eu=function(e){return[255&e,e>>8&255]},Ru=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Tu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Iu=function(e){return yu(e,23,4)},Cu=function(e){return yu(e,52,8)},Su=function(e,t){su(e.prototype,t,{get:function(){return ou(this)[t]}})},bu=function(e,t,n,r){var i=Ja(n),s=ou(e);if(i+t>s.byteLength)throw vu(lu);var o=ou(s.buffer).bytes,a=i+s.byteOffset,u=o.slice(a,a+t);return r?u:u.reverse()},wu=function(e,t,n,r,i,s){var o=Ja(n),a=ou(e);if(o+t>a.byteLength)throw vu(lu);for(var u=ou(a.buffer).bytes,c=o+a.byteOffset,l=r(+i),h=0;h<t;h++)u[c+h]=l[s?h:t-h-1]};if(Qa){if(!a((function(){hu(1)}))||!a((function(){new hu(-1)}))||a((function(){return new hu,new hu(1.5),new hu(NaN),hu.name!=uu}))){for(var Nu,Ou=(fu=function(e){return Ar(this,fu),new hu(Ja(e))}).prototype=hu.prototype,ku=iu(hu),Au=0;ku.length>Au;)(Nu=ku[Au++])in fu||U(fu,Nu,hu[Nu]);Ou.constructor=fu}Ho&&ka(gu)!==pu&&Ho(gu,pu);var Mu=new du(new fu(2)),Lu=gu.setInt8;Mu.setInt8(0,2147483648),Mu.setInt8(1,2147483649),!Mu.getInt8(0)&&Mu.getInt8(1)||Sr(gu,{setInt8:function(e,t){Lu.call(this,e,t<<24>>24)},setUint8:function(e,t){Lu.call(this,e,t<<24>>24)}},{unsafe:!0})}else fu=function(e){Ar(this,fu,uu);var t=Ja(e);au(this,{bytes:ru.call(new Array(t),0),byteLength:t}),u||(this.byteLength=t)},du=function(e,t,n){Ar(this,du,cu),Ar(e,fu,cu);var r=ou(e).byteLength,i=fe(t);if(i<0||i>r)throw vu("Wrong offset");if(i+(n=void 0===n?r-i:ge(n))>r)throw vu("Wrong length");au(this,{buffer:e,byteLength:n,byteOffset:i}),u||(this.buffer=e,this.byteLength=n,this.byteOffset=i)},u&&(Su(fu,"byteLength"),Su(du,"buffer"),Su(du,"byteLength"),Su(du,"byteOffset")),Sr(du.prototype,{getInt8:function(e){return bu(this,1,e)[0]<<24>>24},getUint8:function(e){return bu(this,1,e)[0]},getInt16:function(e){var t=bu(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=bu(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Tu(bu(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Tu(bu(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return mu(bu(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return mu(bu(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){wu(this,1,e,_u,t)},setUint8:function(e,t){wu(this,1,e,_u,t)},setInt16:function(e,t){wu(this,2,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){wu(this,2,e,Eu,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){wu(this,4,e,Ru,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){wu(this,4,e,Ru,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){wu(this,4,e,Iu,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){wu(this,8,e,Cu,t,arguments.length>2?arguments[2]:void 0)}});Nr(fu,uu),Nr(du,cu);var Uu={ArrayBuffer:fu,DataView:du},xu=Uu.ArrayBuffer,Pu=Uu.DataView,Du=xu.prototype.slice,Vu=a((function(){return!new xu(2).slice(1,void 0).byteLength}));Pe({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:Vu},{slice:function(e,t){if(void 0!==Du&&void 0===t)return Du.call(A(this),e);for(var n=A(this).byteLength,r=ye(e,n),i=ye(void 0===t?n:t,n),s=new(zr(this,xu))(ge(i-r)),o=new Pu(this),a=new Pu(s),u=0;r<i;)a.setUint8(u++,o.getUint8(r++));return s}});var Bu,Fu=L.f,ju=o.Int8Array,Ku=ju&&ju.prototype,qu=o.Uint8ClampedArray,Yu=qu&&qu.prototype,Hu=ju&&ka(ju),Gu=Ku&&ka(Ku),Wu=Object.prototype,Qu=Wu.isPrototypeOf,Ju=ot("toStringTag"),zu=Q("TYPED_ARRAY_TAG"),Zu=Qa&&!!Ho&&"Opera"!==Tr(o.opera),Xu=!1,$u={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ec={BigInt64Array:8,BigUint64Array:8},tc=function(e){if(!E(e))return!1;var t=Tr(e);return C($u,t)||C(ec,t)};for(Bu in $u)o[Bu]||(Zu=!1);if((!Zu||"function"!=typeof Hu||Hu===Function.prototype)&&(Hu=function(){throw TypeError("Incorrect invocation")},Zu))for(Bu in $u)o[Bu]&&Ho(o[Bu],Hu);if((!Zu||!Gu||Gu===Wu)&&(Gu=Hu.prototype,Zu))for(Bu in $u)o[Bu]&&Ho(o[Bu].prototype,Gu);if(Zu&&ka(Yu)!==Gu&&Ho(Yu,Gu),u&&!C(Gu,Ju))for(Bu in Xu=!0,Fu(Gu,Ju,{get:function(){return E(this)?this[zu]:void 0}}),$u)o[Bu]&&U(o[Bu],zu,Bu);var nc={NATIVE_ARRAY_BUFFER_VIEWS:Zu,TYPED_ARRAY_TAG:Xu&&zu,aTypedArray:function(e){if(tc(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Ho){if(Qu.call(Hu,e))return e}else for(var t in $u)if(C($u,Bu)){var n=o[t];if(n&&(e===n||Qu.call(n,e)))return e}throw TypeError("Target is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n){if(u){if(n)for(var r in $u){var i=o[r];i&&C(i.prototype,e)&&delete i.prototype[e]}Gu[e]&&!n||oe(Gu,e,n?t:Zu&&Ku[e]||t)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(u){if(Ho){if(n)for(r in $u)(i=o[r])&&C(i,e)&&delete i[e];if(Hu[e]&&!n)return;try{return oe(Hu,e,n?t:Zu&&ju[e]||t)}catch(e){}}for(r in $u)!(i=o[r])||i[e]&&!n||oe(i,e,t)}},isView:function(e){if(!E(e))return!1;var t=Tr(e);return"DataView"===t||C($u,t)||C(ec,t)},isTypedArray:tc,TypedArray:Hu,TypedArrayPrototype:Gu},rc=nc.NATIVE_ARRAY_BUFFER_VIEWS,ic=o.ArrayBuffer,sc=o.Int8Array,oc=!rc||!a((function(){sc(1)}))||!a((function(){new sc(-1)}))||!Qr((function(e){new sc,new sc(null),new sc(1.5),new sc(e)}),!0)||a((function(){return 1!==new sc(new ic(2),1,void 0).length})),ac=function(e,t){var n=function(e){var t=fe(e);if(t<0)throw RangeError("The argument can't be less than 0");return t}(e);if(n%t)throw RangeError("Wrong offset");return n},uc=nc.aTypedArrayConstructor,cc=function(e){var t,n,r,i,s,o,a=T(e),u=arguments.length,c=u>1?arguments[1]:void 0,l=void 0!==c,h=Dr(a);if(null!=h&&!xr(h))for(o=(s=h.call(a)).next,a=[];!(i=o.call(s)).done;)a.push(i.value);for(l&&u>2&&(c=kn(c,arguments[2],2)),n=ge(a.length),r=new(uc(this))(n),t=0;n>t;t++)r[t]=l?c(a[t],t):a[t];return r},lc=i((function(e){var t=Ce.f,n=Ln.forEach,r=se.get,i=se.set,s=L.f,a=k.f,c=Math.round,l=o.RangeError,h=Uu.ArrayBuffer,d=Uu.DataView,g=nc.NATIVE_ARRAY_BUFFER_VIEWS,p=nc.TYPED_ARRAY_TAG,v=nc.TypedArray,y=nc.TypedArrayPrototype,m=nc.aTypedArrayConstructor,_=nc.isTypedArray,T="BYTES_PER_ELEMENT",I="Wrong length",S=function(e,t){for(var n=0,r=t.length,i=new(m(e))(r);r>n;)i[n]=t[n++];return i},b=function(e,t){s(e,t,{get:function(){return r(this)[t]}})},w=function(e){var t;return e instanceof h||"ArrayBuffer"==(t=Tr(e))||"SharedArrayBuffer"==t},N=function(e,t){return _(e)&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},O=function(e,t){return N(e,t=R(t,!0))?f(2,e[t]):a(e,t)},A=function(e,t,n){return!(N(e,t=R(t,!0))&&E(n)&&C(n,"value"))||C(n,"get")||C(n,"set")||n.configurable||C(n,"writable")&&!n.writable||C(n,"enumerable")&&!n.enumerable?s(e,t,n):(e[t]=n.value,e)};u?(g||(k.f=O,L.f=A,b(y,"buffer"),b(y,"byteOffset"),b(y,"byteLength"),b(y,"length")),Pe({target:"Object",stat:!0,forced:!g},{getOwnPropertyDescriptor:O,defineProperty:A}),e.exports=function(e,a,u){var f=e.match(/\d+$/)[0]/8,m=e+(u?"Clamped":"")+"Array",R="get"+e,C="set"+e,b=o[m],N=b,O=N&&N.prototype,k={},A=function(e,t){s(e,t,{get:function(){return function(e,t){var n=r(e);return n.view[R](t*f+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var i=r(e);u&&(n=(n=c(n))<0?0:n>255?255:255&n),i.view[C](t*f+i.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};g?oc&&(N=a((function(e,t,n,r){return Ar(e,N,m),Go(E(t)?w(t)?void 0!==r?new b(t,ac(n,f),r):void 0!==n?new b(t,ac(n,f)):new b(t):_(t)?S(N,t):cc.call(N,t):new b(Ja(t)),e,N)})),Ho&&Ho(N,v),n(t(b),(function(e){e in N||U(N,e,b[e])})),N.prototype=O):(N=a((function(e,t,n,r){Ar(e,N,m);var s,o,a,u=0,c=0;if(E(t)){if(!w(t))return _(t)?S(N,t):cc.call(N,t);s=t,c=ac(n,f);var g=t.byteLength;if(void 0===r){if(g%f)throw l(I);if((o=g-c)<0)throw l(I)}else if((o=ge(r)*f)+c>g)throw l(I);a=o/f}else a=Ja(t),s=new h(o=a*f);for(i(e,{buffer:s,byteOffset:c,byteLength:o,length:a,view:new d(s)});u<a;)A(e,u++)})),Ho&&Ho(N,v),O=N.prototype=sr(y)),O.constructor!==N&&U(O,"constructor",N),p&&U(O,p,m),k[m]=N,Pe({global:!0,forced:N!=b,sham:!g},k),T in N||U(N,T,f),T in O||U(O,T,f),kr(m)}):e.exports=function(){}}));lc("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var hc=Math.min,fc=[].copyWithin||function(e,t){var n=T(this),r=ge(n.length),i=ye(e,r),s=ye(t,r),o=arguments.length>2?arguments[2]:void 0,a=hc((void 0===o?r:ye(o,r))-s,r-i),u=1;for(s<i&&i<s+a&&(u=-1,s+=a-1,i+=a-1);a-- >0;)s in n?n[i]=n[s]:delete n[i],i+=u,s+=u;return n},dc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("copyWithin",(function(e,t){return fc.call(dc(this),e,t,arguments.length>2?arguments[2]:void 0)}));var gc=Ln.every,pc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("every",(function(e){return gc(pc(this),e,arguments.length>1?arguments[1]:void 0)}));var vc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("fill",(function(e){return ru.apply(vc(this),arguments)}));var yc=nc.aTypedArrayConstructor,mc=function(e,t){for(var n=zr(e,e.constructor),r=0,i=t.length,s=new(yc(n))(i);i>r;)s[r]=t[r++];return s},_c=Ln.filter,Ec=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("filter",(function(e){var t=_c(Ec(this),e,arguments.length>1?arguments[1]:void 0);return mc(this,t)}));var Rc=Ln.find,Tc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("find",(function(e){return Rc(Tc(this),e,arguments.length>1?arguments[1]:void 0)}));var Ic=Ln.findIndex,Cc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("findIndex",(function(e){return Ic(Cc(this),e,arguments.length>1?arguments[1]:void 0)}));var Sc=Ln.forEach,bc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("forEach",(function(e){Sc(bc(this),e,arguments.length>1?arguments[1]:void 0)}));var wc=_e.includes,Nc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("includes",(function(e){return wc(Nc(this),e,arguments.length>1?arguments[1]:void 0)}));var Oc=_e.indexOf,kc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("indexOf",(function(e){return Oc(kc(this),e,arguments.length>1?arguments[1]:void 0)}));var Ac=ot("iterator"),Mc=o.Uint8Array,Lc=Wa.values,Uc=Wa.keys,xc=Wa.entries,Pc=nc.aTypedArray,Dc=nc.exportTypedArrayMethod,Vc=Mc&&Mc.prototype[Ac],Bc=!!Vc&&("values"==Vc.name||null==Vc.name),Fc=function(){return Lc.call(Pc(this))};Dc("entries",(function(){return xc.call(Pc(this))})),Dc("keys",(function(){return Uc.call(Pc(this))})),Dc("values",Fc,!Bc),Dc(Ac,Fc,!Bc);var jc=nc.aTypedArray,Kc=[].join;(0,nc.exportTypedArrayMethod)("join",(function(e){return Kc.apply(jc(this),arguments)}));var qc=Math.min,Yc=[].lastIndexOf,Hc=!!Yc&&1/[1].lastIndexOf(1,-0)<0,Gc=Fn("lastIndexOf"),Wc=Hc||!Gc?function(e){if(Hc)return Yc.apply(this,arguments)||0;var t=_(this),n=ge(t.length),r=n-1;for(arguments.length>1&&(r=qc(r,fe(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Yc,Qc=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("lastIndexOf",(function(e){return Wc.apply(Qc(this),arguments)}));var Jc=Ln.map,zc=nc.aTypedArray,Zc=nc.aTypedArrayConstructor;(0,nc.exportTypedArrayMethod)("map",(function(e){return Jc(zc(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Zc(zr(e,e.constructor)))(t)}))}));var Xc=function(e){return function(t,n,r,i){On(n);var s=T(t),o=y(s),a=ge(s.length),u=e?a-1:0,c=e?-1:1;if(r<2)for(;;){if(u in o){i=o[u],u+=c;break}if(u+=c,e?u<0:a<=u)throw TypeError("Reduce of empty array with no initial value")}for(;e?u>=0:a>u;u+=c)u in o&&(i=n(i,o[u],u,s));return i}},$c={left:Xc(!1),right:Xc(!0)},el=$c.left,tl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("reduce",(function(e){return el(tl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var nl=$c.right,rl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("reduceRight",(function(e){return nl(rl(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var il=nc.aTypedArray,sl=nc.exportTypedArrayMethod,ol=Math.floor;sl("reverse",(function(){for(var e,t=this,n=il(t).length,r=ol(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var al=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("set",(function(e){al(this);var t=ac(arguments.length>1?arguments[1]:void 0,1),n=this.length,r=T(e),i=ge(r.length),s=0;if(i+t>n)throw RangeError("Wrong length");for(;s<i;)this[t+s]=r[s++]}),a((function(){new Int8Array(1).set({})})));var ul=nc.aTypedArray,cl=nc.aTypedArrayConstructor,ll=[].slice;(0,nc.exportTypedArrayMethod)("slice",(function(e,t){for(var n=ll.call(ul(this),e,t),r=zr(this,this.constructor),i=0,s=n.length,o=new(cl(r))(s);s>i;)o[i]=n[i++];return o}),a((function(){new Int8Array(1).slice()})));var hl=Ln.some,fl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("some",(function(e){return hl(fl(this),e,arguments.length>1?arguments[1]:void 0)}));var dl=nc.aTypedArray,gl=[].sort;(0,nc.exportTypedArrayMethod)("sort",(function(e){return gl.call(dl(this),e)}));var pl=nc.aTypedArray;(0,nc.exportTypedArrayMethod)("subarray",(function(e,t){var n=pl(this),r=n.length,i=ye(e,r);return new(zr(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,ge((void 0===t?r:ye(t,r))-i))}));var vl=o.Int8Array,yl=nc.aTypedArray,ml=nc.exportTypedArrayMethod,_l=[].toLocaleString,El=[].slice,Rl=!!vl&&a((function(){_l.call(new vl(1))}));ml("toLocaleString",(function(){return _l.apply(Rl?El.call(yl(this)):yl(this),arguments)}),a((function(){return[1,2].toLocaleString()!=new vl([1,2]).toLocaleString()}))||!a((function(){vl.prototype.toLocaleString.call([1,2])})));var Tl=nc.exportTypedArrayMethod,Il=o.Uint8Array,Cl=Il&&Il.prototype||{},Sl=[].toString,bl=[].join;a((function(){Sl.call({})}))&&(Sl=function(){return bl.call(this)});var wl=Cl.toString!=Sl;Tl("toString",Sl,wl);var Nl=ot("iterator"),Ol=ot("toStringTag"),kl=Wa.values;for(var Al in fr){var Ml=o[Al],Ll=Ml&&Ml.prototype;if(Ll){if(Ll[Nl]!==kl)try{U(Ll,Nl,kl)}catch(e){Ll[Nl]=kl}if(Ll[Ol]||U(Ll,Ol,Al),fr[Al])for(var Ul in Wa)if(Ll[Ul]!==Wa[Ul])try{U(Ll,Ul,Wa[Ul])}catch(e){Ll[Ul]=Wa[Ul]}}}var xl=Object.assign,Pl=Object.defineProperty,Dl=!xl||a((function(){if(u&&1!==xl({b:1},xl(Pl({},"a",{enumerable:!0,get:function(){Pl(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!=xl({},e)[n]||Vn(xl({},t)).join("")!=r}))?function(e,t){for(var n=T(e),r=arguments.length,i=1,s=Se.f,o=h.f;r>i;)for(var a,c=y(arguments[i++]),l=s?Vn(c).concat(s(c)):Vn(c),f=l.length,d=0;f>d;)a=l[d++],u&&!o.call(c,a)||(n[a]=c[a]);return n}:xl;Pe({target:"Object",stat:!0,forced:Object.assign!==Dl},{assign:Dl});var Vl,Bl,Fl,jl,Kl,ql="[\t\n\v\f\r \u2028\u2029\ufeff]",Yl=RegExp("^"+ql+ql+"*"),Hl=RegExp(ql+ql+"*$"),Gl=function(e){return function(t){var n=String(m(t));return 1&e&&(n=n.replace(Yl,"")),2&e&&(n=n.replace(Hl,"")),n}},Wl={start:Gl(1),end:Gl(2),trim:Gl(3)},Ql=Ce.f,Jl=k.f,zl=L.f,Zl=Wl.trim,Xl="Number",$l=o.Number,eh=$l.prototype,th=p(sr(eh))==Xl,nh=function(e){var t,n,r,i,s,o,a,u,c=R(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=Zl(c)).charCodeAt(0))||45===t){if(88===(n=c.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(o=(s=c.slice(2)).length,a=0;a<o;a++)if((u=s.charCodeAt(a))<48||u>i)return NaN;return parseInt(s,r)}return+c};if(Ue(Xl,!$l(" 0o1")||!$l("0b1")||$l("+0x1"))){for(var rh,ih=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof ih&&(th?a((function(){eh.valueOf.call(n)})):p(n)!=Xl)?Go(new $l(nh(t)),n,ih):nh(t)},sh=u?Ql($l):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),oh=0;sh.length>oh;oh++)C($l,rh=sh[oh])&&!C(ih,rh)&&zl(ih,rh,Jl($l,rh));ih.prototype=eh,eh.constructor=ih,oe(o,Xl,ih)}!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"}(Vl||(Vl={})),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"}(Bl||(Bl={})),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"}(Fl||(Fl={})),function(e){e.PUB="pub",e.QUERY="qry"}(jl||(jl={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Kl||(Kl={}));var ah,uh=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]:Vl.AT_LEAST_ONCE,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Tt(this,e),this._retain=!1,this.qos=Vl.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 Ct(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}(),ch=function(){function e(){Tt(this,e)}return Ct(e,null,[{key:"writeUTF",value:function(e,t){var n=[],r=0;if(Ls(e))for(var i=0,s=e.length;i<s;i++){var o=e.charCodeAt(i);o>=0&&o<=127?(r+=1,n.push(o)):o>=128&&o<=2047?(r+=2,n.push(192|31&o>>6),n.push(128|63&o)):o>=2048&&o<=65535&&(r+=3,n.push(224|15&o>>12),n.push(128|63&o>>6),n.push(128|63&o))}for(var a=0,u=n.length;a<u;a++)n[a]>255&&(n[a]&=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,o="";++i<s.length;){var a=Number(s[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^s[++i])<<6|128^s[++i])<<6|128^s[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^s[++i])<<6|128^s[++i]:192==(192&a)&&(a=(a^=192)<<6|128^s[++i])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===s.length||r.length>16384)&&(o+=String.fromCharCode.apply(null,r),r.length=0)}return o}}]),e}(),lh=function(){function e(t){Tt(this,e),this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return Ct(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 ch.readUTF(t)}},{key:"readAll",value:function(){return this._pool.subarray(this._position,this._poolLen)}}]),e}(),hh=function(){function e(){Tt(this,e),this._pool=[],this._position=0,this._writen=0}return Ct(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=ch.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length}},{key:"getBytesArray",value:function(){return this._pool}}]),e}(),fh="UpStreamMessage",dh="PushExtra",gh="DownStreamMessage",ph="DownStreamMessages",vh="SessionsAttQryInput",yh="SessionsAttOutput",mh="SyncRequestMsg",_h="ChrmPullMsg",Eh="NotifyMsg",Rh="HistoryMsgInput",Th="HistoryMsgOuput",Ih="RelationQryInput",Ch="RelationsOutput",Sh="DeleteSessionsInput",bh="SessionInfo",wh="DeleteSessionsOutput",Nh="RelationsInput",Oh="DeleteMsgInput",kh="CleanHisMsgInput",Ah="SessionMsgReadInput",Mh="ChrmInput",Lh="ChrmOutput",Uh="QueryChatRoomInfoInput",xh="QueryChatRoomInfoOutput",Ph="RtcInput",Dh="RtcUserListOutput",Vh="SetUserStatusInput",Bh="RtcSetDataInput",Fh="RtcUserSetDataInput",jh="RtcDataInput",Kh="RtcSetOutDataInput",qh="MCFollowInput",Yh="RtcTokenOutput",Hh="RtcQryOutput",Gh="RtcQryUserOutDataInput",Wh="RtcUserOutDataOutput",Qh="RtcQueryListInput",Jh="RtcRoomInfoOutput",zh="RtcValueInfo",Zh="RtcKeyDeleteInput",Xh="GetQNupTokenInput",$h="GetQNupTokenOutput",ef="GetQNdownloadUrlInput",tf="GetDownloadUrlInput",nf="GetQNdownloadUrlOutput",rf="GetDownloadUrlOutput",sf="SetChrmKV",of="SetChrmKVS",af="DeleteChrmKVS",uf="ChrmKVOutput",cf="ChrmKVSOutput",lf="ChrmKVSOutputEntity",hf="QueryChrmKV",ff="SetUserSettingInput",df="SetUserSettingOutput",gf="PullUserSettingInput",pf="PullUserSettingOutput",vf="UserSettingNotification",yf="SessionReq",mf="SessionStates",_f="SessionState",Ef="SessionStateItem",Rf="SessionStateModifyReq",Tf="SessionStateModifyResp",If="GrpReadReceiptMsg",Cf="GrpReadReceiptQryReq",Sf="GrpReadReceiptQryResp",bf="GrpMsgReadUser",wf="SessionTagAddInput",Nf="SessionTagItem",Of="SessionTagDelInput",kf="SessionDisTagReq",Af="ReportSDKInput",Mf="ReportSDKOutput",Lf="RtcNotifyMsg",Uf="RtcPullKV",xf="RtcKVOutput",Pf="RtcQueryUserJoinedInput",Df="RtcQueryUserJoinedOutput",Vf="RtcViewerJoinedOutput",Bf="RtcInviteInput",Ff="RtcCancelInviteInput",jf="RtcInviteAnswerInput",Kf="RtcEndInviteInput",qf=(St(ah={},fh,["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"]),St(ah,ph,["list","syncTime","finished"]),St(ah,gh,["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"]),St(ah,dh,["title","templateIdNoUse","pushId","pushConfigs","templateId"]),St(ah,vh,["nothing"]),St(ah,yh,["inboxTime","sendboxTime","totalUnreadCount"]),St(ah,mh,["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"]),St(ah,_h,["syncTime","count"]),St(ah,Eh,["type","time","chrmId"]),St(ah,Rh,["targetId","time","count","order","busChannel"]),St(ah,Th,["list","syncTime","hasMsg"]),St(ah,Ih,["type","count","startTime","order"]),St(ah,Ch,["info"]),St(ah,Sh,["sessions"]),St(ah,bh,["type","channelId","busChannel"]),St(ah,wh,["nothing"]),St(ah,Nh,["type","msg","count","busChannel","startTime","endTime"]),St(ah,Oh,["type","conversationId","msgs","busChannel"]),St(ah,kh,["targetId","dataTime","conversationType","busChannel"]),St(ah,Ah,["type","msgTime","channelId"]),St(ah,Mh,["nothing"]),St(ah,Lh,["nothing","sessionId","joinTime"]),St(ah,Uh,["count","order"]),St(ah,xh,["userTotalNums","userInfos"]),St(ah,Xh,["type","key","httpMethod","queryString"]),St(ah,ef,["type","key","fileName"]),St(ah,tf,["type","key","fileName"]),St(ah,$h,["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"]),St(ah,nf,["downloadUrl"]),St(ah,rf,["downloadUrl"]),St(ah,sf,["entry","bNotify","notification","type"]),St(ah,of,["entry","bNotify","notification","type"]),St(ah,af,["entry","bNotify","notification","type"]),St(ah,uf,["entries","bFullUpdate","syncTime"]),St(ah,cf,["timestamp","errorKeys"]),St(ah,lf,["key","errorCode"]),St(ah,hf,["timestamp"]),St(ah,ff,["version","value"]),St(ah,df,["version","reserve"]),St(ah,gf,["version","reserve"]),St(ah,pf,["items","version"]),St(ah,"UserSettingItem",["targetId","type","key","value","version","status","tags"]),St(ah,yf,["time"]),St(ah,mf,["version","state"]),St(ah,_f,["type","channelId","time","stateItem","busChannel"]),St(ah,Ef,["sessionStateType","value","tags"]),St(ah,Rf,["version","state"]),St(ah,Tf,["version"]),St(ah,If,["msgId","busChannel"]),St(ah,Cf,["msgId","busChannel"]),St(ah,Sf,["totalMemberNum","list"]),St(ah,bf,["readTime","userId"]),St(ah,wf,["version","tags"]),St(ah,Nf,["tagId","name","createdTime","isTop"]),St(ah,Of,["version","tags"]),St(ah,kf,["tagId"]),St(ah,vf,["version","reserve"]),St(ah,Af,["sdkInfo"]),St(ah,Mf,["nothing"]),St(ah,Ph,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"]),St(ah,Dh,["users","token","sessionId","roomInfo"]),St(ah,Vh,["status"]),St(ah,Bh,["interior","target","key","value","objectName","content"]),St(ah,Fh,["valueInfo","objectName","content"]),St(ah,jh,["interior","target","key","objectName","content"]),St(ah,Kh,["target","valueInfo","objectName","content"]),St(ah,qh,["state"]),St(ah,Yh,["rtcToken"]),St(ah,Hh,["outInfo"]),St(ah,Gh,["userId"]),St(ah,Wh,["user"]),St(ah,Qh,["order"]),St(ah,Jh,["roomId","roomData","userCount","list"]),St(ah,zh,["key","value"]),St(ah,Zh,["key"]),St(ah,Lf,["type","time","roomId"]),St(ah,Uf,["timestamp","roomId"]),St(ah,xf,["entries","bFullUpdate","syncTime"]),St(ah,Pf,["userId"]),St(ah,Df,["info"]),St(ah,Bf,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),St(ah,Ff,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),St(ah,jf,["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),St(ah,Kf,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),ah),Yf={},Hf=function(e){var t=qf[e];Yf[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],s="set".concat(Yn(i,0,1));n[s]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Yf[e].decode=function(e){var t={};Ls(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(Yn(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Gf in qf)Hf(Gf);Yf.getModule=function(e){return Yf[e]()},lc("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Wf="\npackage Modules;\nmessage probuf {\n message ".concat(Vh,"\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(Eh," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(mh," {\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(fh," {\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(dh," {\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(ph," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message ").concat(gh," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(Ms.IMAGE,";\n audio = ").concat(Ms.AUDIO,";\n video = ").concat(Ms.VIDEO,";\n file = ").concat(Ms.FILE,";\n }\n message ").concat(Xh," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(ef," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(tf," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat($h," {\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(nf," {\n required string downloadUrl = 1;\n }\n message ").concat(rf," {\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(Mh," {\n required int32 nothing = 1;\n }\n message ").concat(Lh," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(_h," {\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(Ih,"\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(Nh,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n optional string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(Ch,"\n {\n repeated RelationInfo info = 1;\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(kh,"\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(Uh,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(xh,"\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(qh,"\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(Rh,"\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(Th,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Qh,"{\n optional int32 order=1;\n }\n\n message ").concat(Zh,"{\n repeated string key=1;\n }\n\n message ").concat(zh,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(zh," userData=2; //用户资源信息\n }\n\n message ").concat(Dh,"{\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(zh," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Ph,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(Hh,"{\n repeated ").concat(zh," 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(jh,"{\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(Bh,"{\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(Fh," {\n repeated ").concat(zh," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(zh," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Yh,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(Kh,"{\n required targetType target=1;\n repeated ").concat(zh," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Gh,"{\n repeated string userId = 1;\n }\n message ").concat(Wh,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(vh,"{\n required int32 nothing = 1;\n }\n message ").concat(yh,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Ah,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Sh,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(bh,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(wh,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Oh,"\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(sf," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(of," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(af," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(uf," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ").concat(cf," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message ").concat(lf,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(hf," {\n required int64 timestamp = 1;\n }\n message ").concat(ff," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(df," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(gf," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(pf," {\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(yf," {\n required int64 time = 1;\n }\n message ").concat(mf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(_f," {\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(Ef," {\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(Rf," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Tf," {\n required int64 version=1;\n }\n message ").concat(If," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Cf," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Sf," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(bf," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(wf," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Nf," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(Of," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(kf," {\n repeated string tagId=1;\n }\n message ").concat(vf," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Af,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Mf,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Lf," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Uf,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(xf,"\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(Pf,"\n {\n required string userId = 1;\n }\n message ").concat(Df,"\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(Vf,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Bf,"\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(Ff,"\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(jf,"\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(Kf,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n}\n"),Qf=/"/g;Pe({target:"String",proto:!0,forced:function(e){return a((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}("sub")},{sub:function(){return e="sub",t="",n="",r=String(m(this)),i="<"+e,""!==t&&(i+=" "+t+'="'+String(n).replace(Qf,""")+'"'),i+">"+r+"</"+e+">";var e,t,n,r,i}});var Jf="ArrayBuffer",zf=Uu.ArrayBuffer,Zf=o.ArrayBuffer;Pe({global:!0,forced:Zf!==zf},{ArrayBuffer:zf}),kr(Jf),Pe({target:"Array",proto:!0},{fill:ru}),lr("fill");var Xf,$f,ed,td,nd,rd=(Xf=Wf,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":_t(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,o,a={},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+")"},a.Tokenizer=u,(o=(s=function(e){this.tn=new u(e),this.proto3=!1}).prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},s.parse=function(e){return new s(e).parse()},o._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},o._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)},o._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(";")},o._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)}},o._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)},o._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},o._parseMessage=function(e,r){var i=!!r,s=this.tn.next(),o={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(i?"group":"message")+" name: "+s);for(o.name=s,i&&(this.tn.skip("="),r.id=n(this.tn.next()),o.isGroup=!0),"["===(s=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(o,s);else if("oneof"===s)this._parseMessageOneOf(o);else if("enum"===s)this._parseEnum(o);else if("message"===s)this._parseMessage(o);else if("option"===s)this._parseOption(o);else if("service"===s)this._parseService(o);else if("extensions"===s)o.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(o);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(o,"optional",s)}return this.tn.omit(";"),e.messages.push(o),o},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,r,i){var s,o,a;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("<"),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(s.keytype=o,this.tn.skip(","),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field: "+o);if(s.type=o,this.tn.skip(">"),o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,s),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);s.type=a.name,s.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(s.type=i,o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},o._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},o._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()},o._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)},o._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},o._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},o.toString=function(){return"Parser at line "+this.tn.line},a.Parser=s,a}(i,i.Lang),i.Reflect=function(t){function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),s=7&r,o=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(o,n);break;case t.WIRE_TYPES.ENDGROUP:if(o===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+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 s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R={},T=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},I=T.prototype;return I.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},I.toString=function(e){return(e?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=T,(o=(s=function(e,t,n,r,i){T.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(T.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 c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.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 s&&(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=s,u=(a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)}).prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},u.verifyValue=function(n){var i,s,o,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(_t(n),"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(_t(n),e.message)}else a(_t(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(_t(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(_t(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(_t(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)&&a(_t(n),"not an integer"),(n>4294967295||n<0)&&a(_t(n),"not in range for uint32"),n;a(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"===_t(n)||a(_t(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(o in s={},n)n.hasOwnProperty(o)&&(s[o]=n[o]);n=s}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},u.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)")},u.encodeValue=function(e,r,i){var s,o;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:o=(new n).LE(),this.resolvedType.encode(r,o),i.writeVarint32(o.offset),i.append(o.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},u.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")},u.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)}},u.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=a,(l=(c=function(e,t,n,r,i,o){s.call(this,e,t,n,r,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(s.prototype)).build=function(r){var i,s,o,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,s,o){var a,u,c,l,h,f,d;if(null===e||"object"!==_t(e))return o&&o instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(o.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return s?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(e,t){u[t]=i(e,r,s,o)})),u;if(u={},e instanceof t.Map){for(l=(c=e.entries()).next();!l.done;l=c.next())u[e.keyElem.valueToString(l.value[0])]=i(l.value[1],r,s,e.valueElem.resolvedType);return u}for(d in h=e.$type,f=void 0,e)e.hasOwnProperty(d)&&(u[d]=h&&(f=h.getChild(d))?i(e[d],r,s,f.resolvedType):i(e[d],r,s));return u}var s,o,a=r.getChildren(t.Reflect.Message.Field),u=r.getChildren(t.Reflect.Message.OneOf),c=function e(i){var s,o,c,l;for(t.Builder.Message.call(this),s=0,o=u.length;o>s;++s)this[u[s].name]=null;for(s=0,o=a.length;o>s;++s)this[(c=a[s]).name]=c.repeated?[]:c.map?new t.Map(c):null,!c.required&&"proto3"!==r.syntax||null===c.defaultValue||(this[c.name]=c.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===i||"object"!==_t(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(s=0,o=arguments.length;o>s;++s)void 0!==(l=arguments[s])&&this.$set(a[s].name,l);else this.$set(i)},l=c.prototype=Object.create(t.Builder.Message.prototype);for(l.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},l.$add=l.add,l.set=function(e,n,i){var s,o,a;if(e&&"object"===_t(e)){for(s in i=n,e)e.hasOwnProperty(s)&&void 0!==(n=e[s])&&this.$set(s,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&&(a=this[o.oneof.name],null!==n?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===e&&(this[o.oneof.name]=null)),this},l.$set=l.set,l.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]},l.$get=l.get,s=0;s<a.length;s++)(o=a[s])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)&&(l["set"+s]=n),null===r.getChild("set_"+t)&&(l["set_"+t]=n),null===r.getChild("get"+s)&&(l["get"+s]=i),null===r.getChild("get_"+t)&&(l["get_"+t]=i)}(o);return l.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}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return r.calculate(this)},l.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},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.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}},c.decodeDelimited=function(e,t){var i,s,o;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 o=r.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,o}catch(t){throw e.offset+=s,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:r.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:r}),Object.defineProperty(l,"$type",{value:r})),c}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,a=this.children.length;a>o;o++)if((s=this.children[o])instanceof p||s instanceof c||s instanceof m){if(i.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");i[s.name]=s.build()}else if(s instanceof c.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(!(s instanceof c.OneOf||s instanceof y))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,s,o,a,u=null;for(s=0,o=this._fields.length;o>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(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.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},l.decode=function(e,n,r){var s,o,a,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(a=(s=e.readVarint32())>>>3,(o=7&s)===t.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(o,e)):u.map?(f=u.decode(o,e),l[u.name].set(f[0],f[1])):(l[u.name]=u.decode(o,e),u.oneof&&(null!==(d=l[u.oneof.name])&&d!==u.name&&(l[d]=null),l[u.oneof.name]=u.name));else switch(o){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(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}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=c,(f=(h=function(e,n,r,i,s,o,a,u,l,h){T.call(this,e,n,o),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=a,this.options=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=t.Util.toCamelCase(this.name))}).prototype=Object.create(T.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},f.verifyValue=function(e,n){var r,i,s;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(_t(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(_t(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),s=[],i=0;i<e.length;i++)s.push(this.element.verifyValue(e[i]));return s}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(_t(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(_t(e),"no array expected"),this.element.verifyValue(e))},f.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}},f.encode=function(e,r,i){var s,o,a,u,c;if(null===this.type||"object"!==_t(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,s=0;s<e.length;s++)this.element.encodeValue(this.id,e[s],r);a=r.offset-o,(u=n.calculateVarint32(a))>1&&(c=r.slice(o,r.offset),o+=u-1,r.offset=o,r.append(c)),r.writeVarint32(a,o-u)}else for(s=0;s<e.length;s++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[s],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},f.calculate=function(e,r){var i,s,o;if(e=this.verifyValue(e),null===this.type||"object"!==_t(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,s=0;s<e.length;s++)o+=this.element.calculateLength(this.id,e[s]);i+=n.calculateVarint32(o),i+=o}else for(s=0;s<e.length;s++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[s]);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},f.decode=function(e,n,r){var i,s,o,u,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,o=[];n.offset<s;)o.push(this.decode(this.type.wireType,n,!0));return o}if(this.map){if(u=a.defaultFieldValue(this.keyType),i=a.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))u=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[u,i]}return this.element.decode(n,e,this.id)},R.Message.Field=h,(d=function(e,t,n,r,i,s,o){h.call(this,e,t,n,null,r,i,s,o),this.extension}).prototype=Object.create(h.prototype),R.Message.ExtensionField=d,g=function(e,t,n){T.call(this,e,t,n),this.fields=[]},R.Message.OneOf=g,(p=function(e,t,n,r,i){s.call(this,e,t,n,r,i),this.className="Enum",this.object=null}).getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(p.prototype=Object.create(s.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(p.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=p,(v=function(e,t,n,r){T.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(T.prototype),R.Enum.Value=v,(y=function(e,t,n,r){T.call(this,e,t,n),this.field=r}).prototype=Object.create(T.prototype),R.Extension=y,((m=function(e,t,n,r){s.call(this,e,t,n,r),this.className="Service",this.clazz=null}).prototype=Object.create(s.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)}},s=i.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<o.length;r++)!function(e){s[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"!==_t(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(s[e.name],"$options",{value:i[e.name].$options}))}(o[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),i}(t,this)},R.Service=m,((_=function(e,t,n,r){T.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(T.prototype)).buildOpt=o.buildOpt,R.Service.Method=_,(E=function(e,t,n,r,i,s,o,a){_.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=s,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(_.prototype),R.Service.RPCMethod=E,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||{}},s=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"!==_t(e.rpc)||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.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},s.create=function(t){var r,s,o,a,u;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(s=t.shift(),i.isMessage(s)){if(o=new n.Message(this,this.ptr,s.name,s.options,s.isGroup,s.syntax),a={},s.oneofs&&Object.keys(s.oneofs).forEach((function(e){o.addChild(a[e]=new n.Message.OneOf(this,o,e))}),this),s.fields&&s.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"!==_t(e.options))throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[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,s.syntax),t&&t.fields.push(e),o.addChild(e)}),this),u=[],s.enums&&s.enums.forEach((function(e){u.push(e)})),s.messages&&s.messages.forEach((function(e){u.push(e)})),s.services&&s.services.forEach((function(e){u.push(e)})),s.extensions&&(o.extensions="number"==typeof s.extensions[0]?[s.extensions]:s.extensions),this.ptr.addChild(o),u.length>0){r.push(t),t=u,u=null,this.ptr=o,o=null;continue}u=null}else if(i.isEnum(s))o=new n.Enum(this,this.ptr,s.name,s.options,s.syntax),s.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(s))o=new n.Service(this,this.ptr,s.name,s.options),Object.keys(s.rpc).forEach((function(e){var t=s.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(s))throw Error("not a valid definition: "+JSON.stringify(s));if(o=this.ptr.resolve(s.ref,!0))s.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(s.ref))throw Error("extended message "+s.ref+" is not defined")}s=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,n){var i,s,o,a,u,c,l,h,f="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"===_t(n)){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(f="\\"),s=i+f+n.file,!0===this.files[s])return this.reset();this.files[s]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"===_t(n)?(this.importRoot=n.root,a=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(f="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),f="\\"):o=".":o=null,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=o+f+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var r;if(null==this.ptr||"object"===_t(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: "+_t(this.ptr)+": "+this.ptr);return this.reset()},s.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},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.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,o;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]),o=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(s)]={key:s,value:o}},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"===_t(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"===_t(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"===_t(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"===_t(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"===_t(e)?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=Xf,i.loadProto(r,void 0,"").build("Modules").probuf}(function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var s,o,a=8*i-r-1,u=(1<<a)-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+=a;l>0;s=256*s+e[t+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=c}return(d?-1:1)*o*Math.pow(2,s-r)}function i(e,t,n,r,i,s){var o,a,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?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*u-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+d]=255&a,d+=g,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;e[n+d]=255&o,d+=g,o/=256,c-=8);e[n+d-g]|=128*p}var s,o,a,u,c,l=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 l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(s=l.prototype).__isByteBuffer__,Object.defineProperty(s,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,s,o,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,o=0,a=e.length;a>o;++o)l.isByteBuffer(e[o])||(e[o]=l.wrap(e[o],t)),(s=e[o].limit-e[o].offset)>0&&(i+=s);if(0===i)return new l(0,n,r);for(c=new l(i,n,r),o=0;a>o;)(s=(u=e[o++]).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},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.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 l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!==_t(e))throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=s.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(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 l(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 l(e.length,n,r)).limit=e.length,o=0;o<e.length;++o)i.view[o]=e[o]}return i},s.writeBitSet=function(e,t){var n,r,i,s,o,a,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,o=0,t+=this.writeVarint32(i,t);s--;)n=1&!!e[o++]|(1&!!e[o++])<<1|(1&!!e[o++])<<2|(1&!!e[o++])<<3|(1&!!e[o++])<<4|(1&!!e[o++])<<5|(1&!!e[o++])<<6|(1&!!e[o++])<<7,this.writeByte(n,t++);if(i>o){for(a=0,n=0;i>o;)n|=(1&!!e[o++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},s.readBitSet=function(e){var t,n,r,i,s,o,a,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,s=0,o=[],e+=n.length;i--;)t=this.readByte(e++),o[s++]=!!(1&t),o[s++]=!!(2&t),o[s++]=!!(4&t),o[s++]=!!(8&t),o[s++]=!!(16&t),o[s++]=!!(32&t),o[s++]=!!(64&t),o[s++]=!!(128&t);if(r>s)for(a=0,t=this.readByte(e++);r>s;)o[s++]=!!(1&t>>a++);return u&&(this.offset=e),o},s.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},s.writeBytes=s.append,s.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},s.writeByte=s.writeInt8,s.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},s.readByte=s.readInt8,s.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},s.writeUInt8=s.writeUint8,s.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},s.readUInt8=s.readUint8,s.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},s.writeShort=s.writeInt16,s.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},s.readShort=s.readInt16,s.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},s.writeUInt16=s.writeUint16,s.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},s.readUInt16=s.readUint16,s.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},s.writeInt=s.writeInt32,s.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},s.readInt=s.readInt32,s.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},s.writeUInt32=s.writeUint32,s.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},s.readUInt32=s.readUint32,e&&(s.writeInt64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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),o&&(this.offset+=8),this},s.writeLong=s.writeInt64,s.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},s.readLong=s.readInt64,s.writeUint64=function(t,n){var r,i,s,o=void 0===n;if(o&&(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),o&&(this.offset+=8),this},s.writeUInt64=s.writeUint64,s.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},s.readUInt64=s.readUint64),s.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},s.writeFloat=s.writeFloat32,s.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},s.readFloat=s.readFloat32,s.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},s.writeDouble=s.writeFloat64,s.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},s.readDouble=s.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},s.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=l.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},s.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},s.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}},s.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"===_t(t)?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.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},l.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()},l.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()},s.writeVarint64=function(t,n){var r,i,s,o,a,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=l.calculateVarint64(t),i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,o=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&o>>>7;case 9:this.view[n+8]=9!==r?128|o:127&o;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},s.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},s.readVarint64=function(t){var n,r,i,s,o,a,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,o=0,r=127&(o=this.view[t++]),128&o&&(r|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(i=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(s=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<7,128&o||this.noAssert&&void 0===o))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|s<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},s.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),s.writeCString=function(e,n){var r,i,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=i+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,o?(this.offset=n,this):i},s.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,c.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}},s.writeIString=function(e,n){var r,i,s,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(i=n,r=c.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,c.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 o?(this.offset=n,this):n-i},s.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,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",s.writeUTF8String=function(e,n){var r,i,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),o?(this.offset=n,this):n-i},s.writeString=s.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateString=l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},s.readUTF8String=function(e,t,r){var i,s,o,a,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.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(o=0,a=r,t===l.METRICS_CHARS){if(s=n(),c.decodeUTF8(function(){return e>o&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++o,c.UTF8toUTF16(e,s)})),o!==e)throw RangeError("Illegal range: Truncated data, "+o+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-a}}if(t===l.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,c.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-a}}throw TypeError("Unsupported metrics: "+t)},s.readString=s.readUTF8String,s.writeVString=function(e,n){var r,i,s,o,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(s=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+r,n+=this.writeVarint32(r,n),c.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 a?(this.offset=n,this):n-s},s.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,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},s.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 l||(e=l.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},s.appendTo=function(e,t){return e.append(this,t),this},s.assert=function(e){return this.noAssert=!e,this},s.capacity=function(){return this.buffer.byteLength},s.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},s.clone=function(e){var t=new l(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},s.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)},s.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 l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(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},s.copyTo=function(e,t,n,r){var i,s,o;if(!this.noAssert&&!l.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==(o=r-n)?e:(e.ensureCapacity(t+o),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=o),s&&(e.offset+=o),this)},s.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},s.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},s.flip=function(){return this.limit=this.offset,this.offset=0,this},s.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},s.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},s.LE=function(e){return this.littleEndian=void 0===e||!!e,this},s.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},s.prepend=function(e,t,n){var r,i,s,o,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((s=i-n)>0?(o=new ArrayBuffer(this.buffer.byteLength+s),(a=new Uint8Array(o)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=o,this.view=a,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},s.prependTo=function(e,t){return e.prepend(this,t),this},s.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},s.remaining=function(){return this.limit-this.offset},s.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},s.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},s.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},s.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},s.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},s.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},s.toArrayBuffer=s.toBuffer,s.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)}},u=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,o;null!==(r=e());)if(void 0===(s=i[r])&&n(r),null!==(r=e())&&(void 0===(o=i[r])&&n(r),t(s<<2>>>0|(48&o)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;n(r)}if(t((15&o)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(o=i[r])){if(61===r)break;n(r)}t((3&s)<<6>>>0|o)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),s.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},s.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)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new l(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},s.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",s="",o="";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+=" ";o+=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+=" ";o+=i+s+"\n"}return e?o:i},l.fromDebug=function(e,t,n){for(var r,i,s=e.length,o=new l(0|(s+1)/3,t,n),a=0,u=0,c=!1,h=!1,f=!1,d=!1,g=!1;s>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(h||f||d){g=!0;break}h=f=d=!0}o.offset=o.markedOffset=o.limit=u,c=!1;break;case"|":if(!n){if(h||d){g=!0;break}h=d=!0}o.offset=o.limit=u,c=!1;break;case"[":if(!n){if(h||f){g=!0;break}h=f=!0}o.offset=o.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}o.offset=u,c=!1;break;case"]":if(!n){if(d||f){g=!0;break}d=f=!0}o.limit=o.markedOffset=u,c=!1;break;case">":if(!n){if(d){g=!0;break}d=!0}o.limit=u,c=!1;break;case"'":if(!n){if(f){g=!0;break}f=!0}o.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");o.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!d)throw TypeError("Illegal str: Missing offset or limit");if(u<o.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return o},s.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("")},l.fromHex=function(e,t,n){var r,i,s,o,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(i=e.length,s=new l(0|i/2,t),o=0,a=0;i>o;o+=2){if(r=parseInt(e.substring(o,o+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[a++]=r}return s.limit=a,s},c=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,o=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())&&o([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&o([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()))&&o([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}(),s.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{c.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()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return c.encodeUTF16toUTF8(t(e),(function(e){i.view[s++]=e})),i.limit=s,i},l}($f=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=a[e])?r:(n=i(e,e<0?-1:0,!1),s&&(a[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 R;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,o,a,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(o=r(c(n,8)),a=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)),a=a.mul(f).add(r(h))):a=(a=a.mul(o)).add(r(h));return a.unsigned=t,a}function o(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?s(t):i(t.low,t.high,t.unsigned)}var a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=s,e.fromValue=o,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,R=i(0,-2147483648,!1),e.MIN_VALUE=R,(T=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},T.toString=function(e){var t,n,i,s,o,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(R)?(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),o=this,a="";;){if(u=o.div(s),l=(o.sub(u.mul(s)).toInt()>>>0).toString(e),(o=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(R)?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},T.isZero=function(){return 0===this.high&&0===this.low},T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.compare=function(e){if(t(e)||(e=o(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},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(v)},T.neg=T.negate,T.add=function(e){var n,r,s,a,u,c,l,h,f,d,g;return t(e)||(e=o(e)),n=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=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+=a+(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)},T.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){var n,s,a,u,c,l,h,f,p,v,y,m;return this.isZero()?g:(t(e)||(e=o(e)),e.isZero()?g:this.eq(R)?e.isOdd()?R:g:e.eq(R)?this.isOdd()?R: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,a=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+=a*f)>>>16,y&=65535,v+=(y+=u*h)>>>16,p+=(v+=s*f)>>>16,v&=65535,p+=(v+=a*h)>>>16,v&=65535,p+=(v+=u*l)>>>16,p+=n*f+s*h+a*l+u*c,i((y&=65535)<<16|(m&=65535),(p&=65535)<<16|(v&=65535),this.unsigned)))},T.mul=T.multiply,T.divide=function(e){var n,i,s,a,u,l,h;if(t(e)||(e=o(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(R))return e.eq(v)||e.eq(m)?R:e.eq(R)?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(R))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=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-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},T.div=T.divide,T.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.not=function(){return i(~this.low,~this.high,this.unsigned)},T.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return t(e)||(e=o(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},T.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)},T.shl=T.shiftLeft,T.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)},T.shr=T.shiftRight,T.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))},T.shru=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.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]},T.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}()),$f));rd.getModule=function(e){var t=new rd[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=Ds(e)?[].slice.call(new Int8Array(e)):e},t};var id="pgMsgP",sd="chatMsg",od="pcMsgP",ad={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},ud="delMsg",cd="joinChrm",ld="joinChrmR",hd="exitChrm",fd="setKV",dd="delKV",gd="setKVS",pd="delKVS",vd="qryRelationR",yd="delRelation",md="setSeAtt",_d={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Ed="qryPMsg",Rd="qryGMsg",Td="qryCHMsg",Id="qryCMsg",Cd="qrySMsg",Sd=(St(ed={},"ppMsgP",ks.PRIVATE),St(ed,id,ks.GROUP),St(ed,sd,ks.CHATROOM),St(ed,od,ks.CUSTOMER_SERVICE),ed),bd=(St(td={},ks.PRIVATE,Ed),St(td,ks.GROUP,Rd),St(td,ks.CHATROOM,Td),St(td,ks.CUSTOMER_SERVICE,Id),St(td,ks.SYSTEM,Cd),td),wd=(St(nd={},ks.PRIVATE,_d.PRIVATE),St(nd,ks.GROUP,_d.GROUP),St(nd,ks.CUSTOMER_SERVICE,_d.CUSTOMER_SERVICE),St(nd,ks.SYSTEM,_d.SYSTEM),nd),Nd="1",Od="0",kd=1,Ad=2,Md=3,Ld=function(){function t(e){Tt(this,t),this._codec="websocket"===e?rd:Yf,this._connectType=e}return Ct(t,[{key:"decodeByPBName",value:function(e,t,n){var r,i=this,s=e,o=(St(r={},ph,i._formatSyncMessages),St(r,gh,i._formatReceivedMessage),St(r,fh,i._formatSentMessage),St(r,Th,i._formatHistoryMessages),St(r,Ch,i._formatConversationList),St(r,xh,i._formatChatRoomInfos),St(r,Dh,i._formatRTCUserList),St(r,Hh,i._formatRTCData),St(r,uf,i._formatChatRoomKVList),St(r,pf,i._formatUserSetting),St(r,mf,i._formatConversationStatus),St(r,Sf,i._formatGrpReadReceiptQryResp),St(r,df,i._formatSetUserSettingOutput),St(r,vf,i._formatUserSettingNotification),St(r,xf,i._formatRTCRoomKVList),St(r,Yh,i._formatRTCAuidenceJoinRoomData),St(r,Df,i._formatRTCJoinedUserInfo),r)[t];try{s=e.length>0&&i._codec[t].decode(e),Bs(s)&&(s=function(e){for(var t in e)Bs(e[t])&&(e[t]=la(e[t]));return e}(s)),Fs(o)&&(s=o.call(this,s,n))}catch(n){Ws.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=Ds(n)?new Uint8Array(n):n;return ch.readUTF(i.subarray(t,r))}catch(e){Ws.info("readBytes error\n",e)}return e}},{key:"_formatBytes",value:function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Ws.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(js(s)||null===s)&&(e.finished=!0),e.syncTime=la(i),e.list=ya(r,(function(e){return n._formatReceivedMessage(e,t)})),e}},{key:"_formatReceivedMessage",value:function(e,t){var r=t=t||{},i=r.currentUserId,s=r.connectedTime,o=e.content,a=e.fromUserId,u=e.type,c=e.groupId,l=e.status,h=e.dataTime,f=e.classname,d=e.msgId,g=e.extraContent,p=e.pushContent,v=e.pushExt,y=e.configFlag,m=(e.direction||no.RECEIVE)===no.SEND,_=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)}}(l),E=_.isPersited,R=_.isCounted,T=_.isMentioned,I=_.disableNotification,C=_.receivedStatus,S=_.canIncludeExpansion,b=[ks.GROUP,ks.CHATROOM,ks.RTC_ROOM].indexOf(u)>-1?c:a,w=m?i:a,N=la(h),O=N<s,k=u===ks.CHATROOM,A=this._formatBytes(o),M={};if(v&&(M=da(v.pushConfigs,v.pushId)),A.user){var L=A.user,U=L.portrait,x=L.portraitUri,P=U||x;P&&(A.user.portrait=A.user.portraitUri=P)}var D,V=wt(wt({},M),{},{pushTitle:null==v?void 0:v.title,pushContent:p,pushData:p,disablePushTitle:!!y&&Boolean(4&y),forceShowDetailContent:!!y&&Boolean(8&y),templateId:null==v?void 0:v.templateId}),B=m?no.SEND:no.RECEIVE;return k&&a===i&&(B=no.SEND),g&&(D={},D=Ca(g)),{conversationType:u,targetId:b,senderUserId:w,messageType:f,messageUId:d,isPersited:E,isCounted:R,isMentioned:T,sentTime:N,isOffLineMessage:O,messageDirection:B,receivedTime:Sa.getTime(),disableNotification:I,receivedStatus:C,canIncludeExpansion:S,content:A,expansion:D,configFlag:y,pushConfig:V,channelId:e.busChannel||""}}},{key:"_formatSentMessage",value:function(e,t){var n,r=e.content,i=e.classname,s=e.sessionId,o=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=t.signal,f=t.currentUserId,d=h.date,g=h.topic,p=h.targetId,v=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(s),y=v.isPersited,m=v.isCounted,_=v.disableNotification,E=v.canIncludeExpansion,R=Sd[g]||ks.PRIVATE,T=_a(ad,g),I=this._formatBytes(r),C=p;i===co.RECALL&&(R=I.conversationType||R,C=I.targetId||p),a&&(n={},n=Ca(a));var S={};u&&(S=da(u.pushConfigs,u.pushId));var b=wt(wt({},S),{},{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==u?void 0:u.templateId});return{conversationType:R,targetId:C,messageType:i,messageUId:o,isPersited:y,isCounted:m,isStatusMessage:T,senderUserId:f,content:this._formatBytes(r),sentTime:1e3*d,receivedTime:Sa.getTime(),messageDirection:no.SEND,isOffLineMessage:!1,disableNotification:_,canIncludeExpansion:E,expansion:n,pushConfig:b,channelId:e.busChannel||""}}},{key:"_formatHistoryMessages",value:function(e,t){var n=this,r=t.conversation||{},i=e.list,s=e.hasMsg,o=r.targetId,a=la(e.syncTime),u=[];return va(i,(function(e){var r=n._formatReceivedMessage(e,t);r.targetId=o,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!s}}},{key:"_formatConversationList",value:function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){};return(r=ya(r,(function(e){var r=e.msg,s=e.userId,o=e.type,a=e.unreadCount,u=e.busChannel,c=null;r&&((c=n._formatReceivedMessage(r,t)).targetId=s);var l={targetId:s,conversationType:o,unreadMessageCount:a,latestMessage:c,channelId:u||""};return i(l)||l})))||[]}},{key:"_formatSetUserSettingOutput",value:function(e){return e}},{key:"_formatChatRoomInfos",value:function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:ya(n,(function(e){var t=e.id,n=e.time;return{id:t,time:la(n)}}))}}},{key:"_formatChatRoomKVList",value:function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=ya(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,s=e.uid,o=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?mo.DELETE:mo.UPDATE}}(r);return{key:t,value:n,isAutoDelete:o.isAutoDelete,isOverwrite:o.isOverwrite,type:o.type,userId:s,timestamp:la(i)}})),isFullUpdate:n,syncTime:r}}},{key:"_formatUserSetting",value:function(e){var t=this,n=e.items,r=e.version,i={};return va(n||[],(function(e){var n=e.key,r=e.version,s=e.value;e.version=la(r),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=la(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}}},{key:"_formatConversationStatus",value:function(e){var t=e.state,n=[];return va(t,(function(e){var t=e.type,r=e.channelId,i=e.time,s=e.stateItem,o=e.busChannel,a=ho.CLOSE,u=!1,c=[];va(s,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case kd:a=n===Nd?ho.OPEN:ho.CLOSE;break;case Ad:u=n===Nd;break;case Md:c=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,isTop:u,updatedTime:la(i),tags:c,channelId:o||""})})),n}},{key:"_formatRTCUserList",value:function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,s=e.entries,o={};return va(t,(function(e){var t=e.userId,n=e.userData,r={};va(n,(function(e){var t=e.key,n=e.value;r[t]=n})),o[t]=r})),{users:o,token:n,sessionId:r,roomInfo:i,kvEntries:s}}},{key:"_formatRTCData",value:function(e){var t=e.outInfo,n={};return va(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 va(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=la(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:la(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:la(e.joinTime)}}))}},{key:"encodeServerConfParams",value:function(){var e=this._codec.getModule(vh);return e.setNothing(1),e.getArrayData()}},{key:"_getUpMsgModule",value:function(e,t){var n="comet"===this._connectType,r=(e.conversationType,t.messageType),i=t.isMentioned,s=t.mentionedType,o=t.mentionedUserIdList,a=t.content,u=t.pushContent,c=t.pushData,l=t.directionalUserIdList,h=t.isFilerWhiteBlacklist,f=t.isVoipPush,d=t.canIncludeExpansion,g=t.expansion,p=t.pushConfig,v=t.channelId;ks.GROUP;var y,m,_,E=this._codec.getModule(fh),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),T=p||{},I=T.pushTitle,C=T.pushContent,S=T.pushData,b=T.iOSConfig,w=T.androidConfig,N=T.templateId,O=T.disablePushTitle,k=T.forceShowDetailContent,A=0;(E.setSessionId(R),i&&a)&&(a.mentionedInfo={userIdList:(null===(y=a.mentionedInfo)||void 0===y?void 0:y.userIdList)||o||[],type:(null===(m=a.mentionedInfo)||void 0===m?void 0:m.type)||s||go.ALL,mentionedContent:(null===(_=a.mentionedInfo)||void 0===_?void 0:_.mentionedContent)||""});var M=C||u||"",L=S||c||"";if(M&&E.setPushText(M),L&&E.setAppData(L),l&&E.setUserId(l),A|=f?1:0,A|=h?2:0,A|=O?4:0,A|=k?8:0,E.setConfigFlag(A),E.setClassname(r),a.user&&a.user.portraitUri&&(a.user.portrait=a.user.portraitUri),E.setContent(JSON.stringify(a)),d&&g){var U={};va(g,(function(e,t){U[t]={v:e}})),E.setExtraContent(JSON.stringify(U))}if(p){var x=this._codec.getModule(dh);if(I&&x.setTitle(I),b&&w){var P=fa(b,w);x.setPushConfigs(P)}(null==w?void 0:w.notificationId)&&x.setPushId(null==w?void 0:w.notificationId),x.setTemplateId(N||""),E.setPushExt(n?x.getArrayData():x)}return js(v)||E.setBusChannel(v),E}},{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(mh);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(_h);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,o=this._codec.getModule(Rh);return o.setTargetId(e),o.setTime(i),o.setCount(n),o.setOrder(r),o.setBusChannel(s||""),o.getArrayData()}},{key:"encodeGetConversationList",value:function(e){var t=e=e||{},n=t.count,r=t.startTime,i=this._codec.getModule(Ih);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 o=this._codec.getModule(Ih);return o.setType(r),o.setCount(n),o.setStartTime(i),o.setOrder(s),o.getArrayData()}},{key:"encodeRemoveOldConversationList",value:function(e){var t=e=e||{},n=t.conversationType,r=t.channelId,i=this._codec.getModule(Nh);return i.setType(n),i.setBusChannel(r),i.getArrayData()}},{key:"encodeRemoveConversationList",value:function(e){var t=this,n=this._codec.getModule(Sh),r=[];return va(e,(function(e){var n=e.conversationType,i=e.targetId,s=t._codec.getModule(bh);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(Oh),s=[];return va(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){var r=this._codec.getModule(kh);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.getArrayData()}},{key:"encodeClearUnreadCount",value:function(e,t){var n=e.conversationType,r=e.targetId,i=t.timestamp,s=this._codec.getModule(Ah);return i=i||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(i),s.getArrayData()}},{key:"encodeJoinOrQuitChatRoom",value:function(){var e=this._codec.getModule(Mh);return e.setNothing(1),e.getArrayData()}},{key:"encodeGetChatRoomInfo",value:function(e,t){var n=this._codec.getModule(Uh);return n.setCount(e),n.setOrder(t),n.getArrayData()}},{key:"encodeGetFileToken",value:function(e,t,n,r){var i=this._codec.getModule(Xh);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(sf),s=t.key,o=t.value,a=t.notificationExtra,u=t.isSendNotification,c=t.type||mo.UPDATE,l=ba(t,c),h={key:s,value:o||"",uid:n};if(js(l)||(h.status=l),i.setEntry(h),u){var f={conversationType:ks.CHATROOM,targetId:e},d={key:s,value:o,extra:a,type:c},g=this._getUpMsgModule(f,{messageType:co.CHRM_KV_NOTIFY,content:d,isPersited:!1,isCounted:!1});r?i.setNotification(g.getArrayData()):i.setNotification(g),i.setBNotify(!0),i.setType(ks.CHATROOM)}return i.getArrayData()}},{key:"encodeModifyChatRoomKVS",value:function(e,t,n){this._connectType;var r=this._codec.getModule(of),i=t.entries,s=t.type||mo.UPDATE,o=ba(t,s),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};js(o)||(t.status=o),a.push(t)})),r.setEntry(a),r.getArrayData()}},{key:"encodePullChatRoomKV",value:function(e){var t=this._codec.getModule(hf);return t.setTimestamp(e),t.getArrayData()}},{key:"encodePullUserSetting",value:function(e){var t=this._codec.getModule(gf);return t.setVersion(e),t.getArrayData()}},{key:"encodeGetConversationStatus",value:function(e){var t=this._codec.getModule(yf);return t.setTime(e),t.getArrayData()}},{key:"encodeSetConversationStatus",value:function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(Rf),i=Sa.getTime(),s=[];return va(e,(function(e){var r=t._codec.getModule(_f),o=e.conversationType,a=e.targetId,u=e.notificationStatus,c=e.isTop,l=e.channelId,h=[];r.setType(o),r.setChannelId(a),r.setTime(i),r.setBusChannel(l);var f=u===ho.OPEN,d={};js(u)||(d[kd]=f),js(c)||(d[Ad]=c),va(d,(function(e,r){if(!js(e)){var i=t._codec.getModule(Ef);e=e?Nd:Od,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(If);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(wf),s=[];return e.forEach((function(e){var t=n._codec.getModule(Nf);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(If);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(Of),s=[];return e.forEach((function(e){var t=n._codec.getModule(Nf);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(kf);return t.setTagId(e),t.getArrayData()}},{key:"encodeUpdateConversationTag",value:function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Rf),s=[];return t.forEach((function(t){var i=n._codec.getModule(_f),o=n._codec.getModule(Ef),a=[];e.forEach((function(e){var t=n._codec.getModule(Nf);t.setTagId(e.tagId),js(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),o.setSessionStateType(Md),o.setValue(JSON.stringify(a)),o.setTags(a),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?o.getArrayData():o]),s.push(r?i.getArrayData():i)})),i.setState(s),i.setVersion(Sa.getTime()),i.getArrayData()}},{key:"encodeReportSDKInfo",value:function(e){var t=this._codec.getModule(Af);return t.setSdkInfo(e),t.getArrayData()}},{key:"encodeJoinRTCRoom",value:function(e,t,n){var r=this._codec.getModule(Ph);return e=e||0,r.setRoomType(e),js(t)||r.setBroadcastType(t),js(n)||r.setJoinType(n),r.getArrayData()}},{key:"encodeQuitRTCRoom",value:function(){return this._codec.getModule(Vh).getArrayData()}},{key:"encodeSetRTCData",value:function(e,t,n,r,i){var s=this._codec.getModule(Bh);if(s.setInterior(n),s.setTarget(r),s.setKey(e),s.setValue(t),i){i.name&&s.setObjectName(i.name);var o=i.content;o&&(Bs(o)&&(o=JSON.stringify(o)),s.setContent(o))}return s.getArrayData()}},{key:"encodeUserSetRTCData",value:function(e,t,n,r){var i=this,s="comet"===this._connectType,o=this._codec.getModule(Fh);o.setObjectName(n);var a=this._codec.getModule(zh);a.setKey(e.name),a.setValue(e.content),s?o.setContent([a.getArrayData()]):o.setContent(a);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(zh);n.setKey(e);var o="uris"===e?t:r;n.setValue(o),s?u.push(n.getArrayData()):u.push(n)})),o.setValueInfo(u),o.getArrayData()}},{key:"encodeUserSetRTCCDNUris",value:function(e,t){this._connectType;var n=this._codec.getModule(Fh);n.setObjectName(e);var r=this._codec.getModule(zh);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(jh);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(jh);i.setInterior(t),i.setTarget(n),i.setKey(e);var s=r=r||{},o=s.name,a=s.content;return!js(o)&&i.setObjectName(o),js(a)||(Bs(a)&&(a=JSON.stringify(a)),i.setContent(a)),i.getArrayData()}},{key:"encodeSetRTCOutData",value:function(e,t,n){var r=this._codec.getModule(Kh);r.setTarget(t),Ps(e)||(e=[e]),va(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,o=i.content;return!js(s)&&r.setObjectName(s),js(o)||(Bs(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()}},{key:"ecnodeGetRTCOutData",value:function(e){var t=this._codec.getModule(Gh);return t.setUserId(e),t.getArrayData()}},{key:"encodeSetRTCState",value:function(e){var t=this._codec.getModule(qh);return t.setState(e),t.getArrayData()}},{key:"encodeGetRTCRoomInfo",value:function(){var e=this._codec.getModule(Qh);return e.setOrder(2),e.getArrayData()}},{key:"encodeSetRTCUserInfo",value:function(e,t){var n=this._codec.getModule(zh);return n.setKey(e),n.setValue(t),n.getArrayData()}},{key:"encodeRemoveRTCUserInfo",value:function(e){var t=this._codec.getModule(Zh);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(Ph);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(Uf);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()}},{key:"encodeQueryUserJoinedInfo",value:function(e){var t=this._codec.getModule(Pf);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,o=this._codec.getModule(Bf);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(r),o.setTimeoutTime(i),o.setInviteInfo(s),o.getArrayData()}},{key:"encodeCancelRoomPK",value:function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,s=this._codec.getModule(Ff);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,o=e.value,a=e.agree?1:0,u=this._codec.getModule(jf);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(s),u.setValue(o),u.setAnswerCode(a),u.getArrayData()}},{key:"encodeEndRoomPK",value:function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,s=this._codec.getModule(Kf);return s.setInviteRoomId(t),s.setInviteSessionId(n),s.setInviteContent(r),s.setInviteRoomKeys(i),s.getArrayData()}}]),t}(),Ud=function e(t,n){Tt(this,e),this._watcher=n,this.codec=new Ld(t)},xd=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Pd=function(){function e(t){Tt(this,e),this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return xd(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}(),Dd=function(){function e(t){Tt(this,e),this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new uh(t,!1,Vl.AT_MOST_ONCE,!1)}return Ct(e,[{key:"getIdentifier",value:function(){var e=this.messageId,t=this.identifier;return xd(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 hh;this.write(e);var t=e.getBytesArray();return new Int8Array(t)}},{key:"getCometData",value:function(){var e=this.data||{};return JSON.stringify(e)}}]),e}(),Vd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return Ct(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===Kl.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();Ws.debug("server sessionId -> "+s),this.timestamp=e.readLong()}return{stream:e,length:t}}}]),n}(Pd);Vd.MESSAGE_LENGTH=2;var Bd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.DISCONNECT,e.status=0,e}return Ct(n,[{key:"readMessage",value:function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}}}]),n}(Pd);Bd.MESSAGE_LENGTH=2;var Fd,jd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.call(this,Bl.PING_REQ))._name=Fl.PING_REQ,e}return Ct(n,[{key:"writeMessage",value:function(e){}}]),n}(Dd),Kd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,e))._name=Fl.PING_RESP,r}return n}(Pd),qd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(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}(Pd),Yd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments)).messageId=0,e}return Ct(n,[{key:"writeMessage",value:function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)}}]),n}(Dd),Hd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=jl.PUB,e}return Ct(n,[{key:"readMessage",value:function(e,t){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),Dt(Ot(n.prototype),"readMessage",this).call(this,e,t),this.data=e.readAll(),{stream:e,length:t}}}]),n}(qd),Gd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Tt(this,n),(s=t.call(this,Bl.PUBLISH))._name=Fl.PUBLISH,s.syncMsg=!1,s.identifier=jl.PUB,s.topic=e,s.data=Ls(r)?ch.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Yd),Wd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=jl.PUB,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(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}(qd),Qd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,Bl.PUB_ACK))._name=Fl.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return Ct(n,[{key:"writeMessage",value:function(e){Dt(Ot(n.prototype),"writeMessage",this).call(this,e)}}]),n}(Yd),Jd=function(e){Nt(n,e);var t=Pt(n);function n(e,r,i){var s;return Tt(this,n),(s=t.call(this,Bl.QUERY)).name=Fl.QUERY,s.identifier=jl.QUERY,s.topic=e,s.data=Ls(r)?ch.writeUTF(r):r,s.targetId=i,s}return Ct(n,[{key:"writeMessage",value:function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),Dt(Ot(n.prototype),"writeMessage",this).call(this,e),e.write(this.data)}}]),n}(Yd),zd=function(e){Nt(n,e);var t=Pt(n);function n(e){var r;return Tt(this,n),(r=t.call(this,Bl.QUERY_CONFIRM))._name=Fl.QUERY_CON,r.messageId=e,r}return n}(Yd),Zd=function(e){Nt(n,e);var t=Pt(n);function n(){var e;return Tt(this,n),(e=t.apply(this,arguments))._name=Fl.QUERY_ACK,e.status=0,e.identifier=jl.QUERY,e.topic="",e.targetId="",e}return Ct(n,[{key:"readMessage",value:function(e,t){return Dt(Ot(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}(qd),Xd=function(e){var t,n=e.type;switch(n){case Bl.CONN_ACK:t=new Vd(e);break;case Bl.PUBLISH:(t=new Hd(e)).syncMsg=e.syncMsg;break;case Bl.PUB_ACK:t=new Wd(e);break;case Bl.QUERY_ACK:t=new Zd(e);break;case Bl.SUB_ACK:case Bl.UNSUB_ACK:case Bl.PING_RESP:t=new Kd(e);break;case Bl.DISCONNECT:t=new Bd(e);break;default:t=new Pd(e),Ws.error("No support for deserializing "+n+" messages")}return t},$d=function(e,t){var n=new Uint8Array(e),r=new lh(n),i=r.readByte(),s=new uh(i),o=Xd(s);return o.read(r,n.length-1,t),o},eg=function(e){var t=e.headerCode,n=new uh(t),r=Xd(n);for(var i in e)r[i]=e[i];return r},tg=pt.charAt,ng="String Iterator",rg=se.set,ig=se.getterFor(ng);qa(String,"String",(function(e){rg(this,{type:ng,string:String(e),index:0})}),(function(){var e,t=ig(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=tg(n,r),t.index+=e.length,{value:e,done:!1})})),function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.addSeTag=73]="addSeTag",e[e.delSeTag=74]="delSeTag",e[e.addTag=75]="addTag",e[e.delTag=76]="delTag",e[e.disTag=77]="disTag",e[e.reportsdk=78]="reportsdk",e[e.rtcInvite=79]="rtcInvite",e[e.rtcCancelInvite=80]="rtcCancelInvite",e[e.rtcInviteAnswer=81]="rtcInviteAnswer",e[e.rtcEndInvite=82]="rtcEndInvite"}(Fd||(Fd={}));var sg=Fd;Rt(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=Rt(regeneratorRuntime.mark((function e(t){var i,s,o;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(bs(1e3,9999)),e.next=4,r.httpReq({url:s,timeout:rn});case 4:return o=e.sent,e.abrupt("return",{status:o.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 og,ag,ug=(og=Rt(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=Rt(regeneratorRuntime.mark((function e(o){var a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a="".concat(n,"://").concat(o,"/ping?r=").concat(bs(1e3,9999)),Ws.debug("start ping",a),e.next=4,r.httpReq({url:a,timeout:rn});case 4:u=e.sent,Ws.debug("end ping",s,a,u.status),s++,i({finished:s===t.length,code:u.status,host:o});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return og.apply(this,arguments)}),cg=function(e,t,n,r,i,s,o,a){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(s,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(a?"&protocolVer="+a:"")},lg=function(e){return[sg.ppMsgS,sg.pgMsgS,sg.chatMsgS].map((function(e){return sg[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"}(ag||(ag={}));var hg,fg=function(e,t){Ws.info("websocket send -> messageId: ".concat(e.messageId));var n=e.getBufferData();t.send(n.buffer)},dg=function(e){Nt(a,e);var t,n,r,i,s,o=Pt(a);function a(e,t){var n;return Tt(this,a),(n=o.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 Ct(a,[{key:"connect",value:(s=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var u=[],c=0,l=!1,h=!1,f=function(){var r=Rt(regeneratorRuntime.mark((function r(){var c;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,a._connect(t,n,u.shift(),i,s,o);case 5:if((c=r.sent)!==io.SUCCESS){r.next=11;break}a._checkAlive(),e(c),r.next=20;break;case 11:if(c!==ao.REDIRECT){r.next=15;break}e(c),r.next=20;break;case 15:if(!h||0!==u.length){r.next=18;break}return e(Ia(c)),r.abrupt("return");case 18:l=!1,f();case 20:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();s=Gn(s),a._watcher.status(oo.CONNECTING),ug(r,i,a._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;h=r,200===n&&(u.push(i),c++,f()),r&&0===c&&(Ws.error("No valid websocket server hosts!"),e(io.RC_SOCKET_NOT_CREATED))}))})));case 1:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,o){return s.apply(this,arguments)})},{key:"_connect",value:(i=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l,h,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.replace("http","ws"),u=cg(a,r,t,n,this._runtime,s,"",o),Ws.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=$d(t,o);if(n instanceof Kd&&f._pingResolve)return f._pingResolve(io.SUCCESS),void(f._pingResolve=void 0);if(n instanceof Vd)return Ws.debug("recv connect ack -> ".concat(n.status)),n.status!==ao.ACCEPTED?(Ws.warn("connect failed: ".concat(n.status)),void e(n.status)):(Ws.info("connect success -> ".concat(u)),f.connectedTime=n.timestamp,f.userId=n.userId||"",f._idCount=n.messageId,void e(io.SUCCESS));if(n instanceof Bd){var r=n.status;switch(Ws.warn("recv disconnect signal -> status: ".concat(r)),r){case ag.BLOCK:f._watcher.status(oo.BLOCKED);break;case ag.OTHER_DEVICE_LOGIN:f._watcher.status(oo.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case ag.REDIRECT_NEW:case ag.REDIRECT:f._watcher.status(oo.REDIRECT);break;default:f._watcher.status(oo.DISCONNECT_BY_SERVER)}}else f._onReceiveSignal(n)}else Ws.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in Ws.warn("websocket closed! code:",t,"reason:",n),l(oo.CONNECTION_CLOSED),f._messageIds){var i=f._messageIds[r];delete f._messageIds[r],i(io.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in Ws.error("websocket error!",null==t?void 0:t.stack),l(oo.WEBSOCKET_ERROR),f._messageIds){var r=f._messageIds[n];delete f._messageIds[n],r(io.RC_NET_CHANNEL_INVALID)}e(io.NETWORK_ERROR)})),c.onOpen((function(){return Ws.debug("websocket open =>",u)})),setTimeout((function(){e(io.TIMEOUT)}),sn)}));case 8:return(h=e.sent)===io.SUCCESS?this._socket=c:(Ws.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,o){return i.apply(this,arguments)})},{key:"_checkAlive",value:(r=Rt(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 Ws.debug("send ping ->"),this.sendOnly(new jd),e.next=6,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(io.TIMEOUT)}),15e3)}));case 6:if((t=e.sent)===io.SUCCESS){e.next=12;break}return this._failedCount+=1,Ws.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(t)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Ws.warn("ping timeout, close current websocket to reconnect!"),null===(n=this._socket)||void 0===n||n.close(),this._watcher.status(oo.NETWORK_UNAVAILABLE)):this._checkAlive(),e.abrupt("return");case 12:Ws.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=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.messageId,t.header&&t.header.qos!==Vl.AT_MOST_ONCE&&(t instanceof Hd&&!t.syncMsg&&(Ws.debug("send pubAck -> ".concat(n)),this.sendOnly(new Qd(n))),t instanceof Zd&&(Ws.debug("send queryCon -> ".concat(n)),this.sendOnly(new zd(n)))),n>0&&(t instanceof Wd||t instanceof Zd)&&(Ws.debug("recv ack -> messageId: ".concat(n)),(r=this._messageIds[n])&&(r(t),delete this._messageIds[n]),(i=this._syncMessageIds[n])&&(delete this._syncMessageIds[n],i(t))),!(t instanceof Hd)){e.next=16;break}if(s=t.syncMsg,(o=t.topic)!==sg[sg.userSetData]){e.next=8;break}return e.abrupt("return");case 8:if(s&&!lg(o)){e.next=11;break}return this._watcher.signal(t),e.abrupt("return");case 11:return e.next=13,new Promise((function(e){u._syncMessageIds[n]=e}));case 13:a=e.sent,delete this._syncMessageIds[n],this._watcher.signal(t,a);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendOnly",value:function(e){this._socket&&fg(e,this._socket)}},{key:"send",value:(t=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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]:cn,!this._socket){e.next=18;break}return s=this._generateMessageId(),t.messageId=s,fg(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(o=e.sent){e.next=11;break}return Ws.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(n,", timeout: ").concat(i)),e.abrupt("return",{code:io.TIMEOUT});case 11:if(o instanceof Zd||o instanceof Wd){e.next=13;break}return e.abrupt("return",{code:o});case 13:if(a=n&&o.data?this.codec.decodeByPBName(o.data,n,r):o,0===o.status){e.next=17;break}return Ws.warn("send failed -> message: ".concat(s,", respPBName: ").concat(n,", status: ").concat(o.status)),e.abrupt("return",{code:o.status,data:n&&o.data?a:null});case 17:return e.abrupt("return",{code:io.SUCCESS,data:a});case 18:return e.abrupt("return",{code:io.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(oo.DISCONNECTED))}}]),a}(Ud);e.HttpMethod=void 0,(hg=e.HttpMethod||(e.HttpMethod={})).GET="GET",hg.POST="POST";var gg=function(e){if(Bs(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t},pg=function(t){Nt(u,t);var n,r,i,s,o,a=Pt(u);function u(e,t){var n;return Tt(this,u),(n=a.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 Ct(u,[{key:"handleCometRes",value:function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=Ls(e.data)?JSON.parse(e.data):e.data;return n?!Ps(n)||(va(n,function(){var e=Rt(regeneratorRuntime.mark((function e(n){var r,i,s,o,a,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=eg(n),s=i.messageId,o=i._header,a=i.status,i.identifier,u=o&&o.qos!==Vl.AT_MOST_ONCE,s&&i.getIdentifier&&((c=t._messageIds[s])&&c(i),t._syncMessageIds[s]&&t._syncMessageIds[s](i)),u&&(i instanceof Hd&&!i.syncMsg&&(l=new Qd(s),t.sendOnly(l)),i instanceof Zd&&(h=new zd(s),t.sendOnly(h))),!(i instanceof Bd)){e.next=20;break}e.t0=a,e.next=e.t0===ag.OTHER_DEVICE_LOGIN?11:e.t0===ag.BLOCK?13:e.t0===ag.REDIRECT_NEW||e.t0===ag.REDIRECT?15:17;break;case 11:return t._watcher.status(oo.KICKED_OFFLINE_BY_OTHER_CLIENT),e.abrupt("break",19);case 13:return t._watcher.status(oo.BLOCKED),e.abrupt("break",19);case 15:return t._watcher.status(oo.REDIRECT),e.abrupt("break",19);case 17:return t._watcher.status(oo.DISCONNECT_BY_SERVER),e.abrupt("break",19);case 19:return e.abrupt("return");case 20:if(!(i instanceof Hd)){e.next=30;break}if(f=i.syncMsg,d=i.topic,f&&!lg(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):(Ws.error("received data is not a validJson",n),!1)}},{key:"_startPullSignal",value:(o=Rt(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,"×trap=").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(oo.NETWORK_UNAVAILABLE)));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"connect",value:(s=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u,c,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=Gn(s),this._protocol=i,this._isDisconnected=!1,this._watcher.status(oo.CONNECTING),a=[],u=0,c=!1,l=!1,e.abrupt("return",new Promise((function(e){var o,f=(o=Rt(regeneratorRuntime.mark((function r(){var o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==a.length&&!c){r.next=2;break}return r.abrupt("return");case 2:return c=!0,r.next=5,h._connect(t,n,a.shift(),i,s);case 5:if((o=r.sent)!==io.SUCCESS){r.next=11;break}h._startPullSignal(i),e(o),r.next=20;break;case 11:if(o!==ao.REDIRECT){r.next=15;break}e(o),r.next=20;break;case 15:if(!l||0!==a.length){r.next=18;break}return e(Ia(o)),r.abrupt("return");case 18:c=!1,f();case 20:case"end":return r.stop()}}),r)}))),function(){return o.apply(this,arguments)});h._watcher.status(oo.CONNECTING),ug(r,i,h._runtime,(function(t){var n=t.code,r=t.finished,i=t.host;l=r,200===n&&(a.push(i),u++,f()),r&&0===u&&(Ws.error("No valid websocket server hosts!"),e(io.RC_SOCKET_NOT_CREATED))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,o){return s.apply(this,arguments)})},{key:"_connect",value:(i=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(Ws.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(gg(e.data)?Bs(e.data)?e.data:JSON.parse(e.data):(Ws.error("received data is not a validJson",e.data),!1))},a=cg(i,r,t,n,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),Ws.debug("conenct start -> ".concat(a)),e.next=6,this._runtime.httpReq({url:a,body:{pid:this._pid},timeout:sn});case 6:return u=e.sent,c=o(u),this._domain=r,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):Ws.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(a)),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=Rt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,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,o=n.messageId,a=n.topic,u=n.targetId,n.identifier,c=n.getHeaderFlag(),l=a?"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(a,"&targetid=").concat(u,"&pid=").concat(s):"".concat(this._protocol,"://").concat(r,"/websocket?messageid=").concat(o,"&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=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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]:cn,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(o=e.sent){e.next=9;break}return e.abrupt("return",{code:io.TIMEOUT});case 9:if(a=n&&o.data?this.codec.decodeByPBName(o.data,n,r):o,0===o.status){e.next=12;break}return e.abrupt("return",{code:o.status,data:n&&o.data?a:null});case 12:return e.abrupt("return",{code:io.SUCCESS,data:a});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(oo.DISCONNECTED)}}]),u}(Ud),vg=function e(t,n,r){Tt(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()},yg=Ln.find,mg="find",_g=!0;mg in[]&&Array(1).find((function(){_g=!1})),Pe({target:"Array",proto:!0,forced:_g},{find:function(e){return yg(this,e,arguments.length>1?arguments[1]:void 0)}}),lr(mg);var Eg=function(e){return["navi",e].join("_")},Rg=function(e,t,n){var r,i,s=Eg(e);try{var o=n.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn}))),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},Tg=function(){function e(t,n){Tt(this,e),this._runtime=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Gn(this._options.apiVersion)}var t;return Ct(e,[{key:"getInfo",value:(t=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&this._clear(t),!(s=Rg(this._appkey,t,this._runtime.localStorage))){e.next=5;break}return this._naviInfo=s,e.abrupt("return",s);case 5:return o=this._options.navigators.slice(),n.length&&n.forEach((function(e){o.indexOf(e)<0&&o.unshift(e)})),e.next=9,this._reqNavi(o,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=Eg(e);try{var o=r.getItem(s);i=o?JSON.parse(o):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<nn&&t!==e.token}))),i.push({timestamp:a,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=Eg(e);try{var s=n.getItem(i);r=s?JSON.parse(s):[]}catch(e){r=[]}var o=Date.now();r.length>0&&(r=r.filter((function(e){return o-e.timestamp<nn&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)}}]),e}(),Ig=Ln.findIndex,Cg="findIndex",Sg=!0;Cg in[]&&Array(1).findIndex((function(){Sg=!1})),Pe({target:"Array",proto:!0,forced:Sg},{findIndex:function(e){return Ig(this,e,arguments.length>1?arguments[1]:void 0)}}),lr(Cg);var bg=function(e){if(ps(e))throw TypeError("The method doesn't accept regular expressions");return e},wg=ot("match");Pe({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[wg]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~String(m(this)).indexOf(bg(e),arguments.length>1?arguments[1]:void 0)}});var Ng="outbox",Og="inbox",kg=function(e,t,n){return[e,t,n].join("_")},Ag=function(){function e(t,n){Tt(this,e),this._runtime=t,this._appkey=n,this._users={}}return Ct(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=kg(Og,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=kg(Og,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=kg(Ng,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=kg(Ng,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime}}]),e}(),Mg={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Lg=function(){function e(t,n){Tt(this,e),this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return Ct(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,o=this._getSetUserId(n),a=r===mo.DELETE,u=o===s,c=!this._isExisted(n),l=a?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)})),Ws.debug("end setEntries")}},{key:"clear",value:function(){this._kvCaches={}}}]),e}(),Ug=function(){function e(t){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;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=Mg.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,o=s.code,a=s.data,this._isPulling=!1,o===io.SUCCESS?(Mg.set(n,a.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){Mg.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];qs(r)||(r=new Lg(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}(),xg=function(){function e(t,n,r,i){Tt(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 Ct(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){Ws.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e}},{key:"remove",value:function(e){delete this._joinedChrmsInfo[e],qs(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}(),Pg="converStatusChanged",Dg=function(){function e(t,n,r){Tt(this,e),this._eventEmitter=new eo,this._pullQueue=[],this._isPulling=!1,this._storage=gn(t.runtime),this._appkey=n,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(n,"-").concat(r)}var t;return Ct(e,[{key:"_set",value:function(e){var t=this;if(!js(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(Pg,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}}},{key:"_startPull",value:(t=Rt(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===io.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(Pg,(function(t){e(t)}))}},{key:"unwatch",value:function(){this._eventEmitter.off(Pg,(function(e){}))}}]),e}(),Vg={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}},Bg={};for(var Fg in Vg){var jg=Vg[Fg].keyName;Bg[jg]=Fg}var Kg,qg=function(){function e(t,n,r){Tt(this,e),this._appkey=n,this._currentUserId=r;var i="con-".concat(n,"-").concat(r);this.storage=new vn(t,i),this._localStore=new vn(t,"CONVER-".concat(n,"-").concat(r))}return Ct(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:ks.PRIVATE,targetId:"",channelId:""}}},{key:"updateMentionedData",value:function(e){var t,n=this,r=e.conversationType,i=e.targetId,s=e.messageType,o=e.isMentioned,a=e.content,u=e.senderUserId,c=e.channelId,l=this._getStoreKey(r,i,c),h=this._localStore.get(l)||{},f=Bg.mentionedInfo,d=Bg.hasMentioned,g=h[f]||{},p=g.userIdList||[],v=a.mentionedInfo;if(v){if(o&&r===ks.GROUP)(v.userIdList||[]).forEach((function(e){e===n._currentUserId&&p.indexOf(u)<0&&p.push(u)})),v.type===go.ALL&&p.indexOf(u)<0&&p.push(u);if(s===co.RECALL&&r===ks.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]),qs(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 o in n){var a=Bg[o],u=n[o];if(!js(a)&&!js(u)&&"hasMentioned"!==o&&"MentionedInfo"!==o){if(u===Vg[a].defaultVal||"tags"===o&&!qs(u))delete s[a];else if("tags"===o){var c=u;for(var l in c)c[l].isTop||delete c[l].isTop;s[a]=u}else s[a]=u;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}qs(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 o in Vg){var a=Vg[o],u=a.keyName,c=a.defaultVal;s[u]=i[o]||Ea(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},o=t[r];for(var a in o){var u=Vg[a],c=u.keyName,l=u.defaultVal;s[c]=o[a]||Ea(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,o={},a=e[n];for(var u in a){var c=Vg[u],l=c.keyName,h=c.defaultVal;o[l]=a[u]||Ea(h)}for(var f in o.tags){js(t[f])&&(t[f]=[]);var d=Object.assign({},o,{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){Ws.error("adaptOldStore error: ".concat(e.message))}}}]),e}(),Yg=[ks.PRIVATE,ks.GROUP,ks.SYSTEM,ks.PUBLIC_SERVICE,ks.APP_PUBLIC_SERVICE],Hg="conversationChanged",Gg="conTagStatusChanged",Wg=function(){function e(t,n,r,i,s){var o=this;Tt(this,e),this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new eo,this._draftMap={},this._appkey=n,this._loginUserId=r,this._store=new qg(t.runtime,n,r),this._statusManager=new Dg(t,n,r),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Hg,(function(e){i(e)})),this._eventEmitter.on(Gg,(function(){s()}))}return Ct(e,[{key:"_calcUnreadCount",value:function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,s=e.isCounted,o=e.messageDirection,a=e.senderUserId,u=o===no.SEND&&a===this._loginUserId,c=r===co.RECALL,l=Bs(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;no.SEND;var s=Bs(n),o=!1,a={};return r&&s&&n.mentionedInfo&&(t.hasMentioned=!0,o=!0,a.hasMentioned={val:!0,time:i},a.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:o,localConversation:t,updateItems:a}}},{key:"_calcMentionedCount",value:function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===no.RECEIVE&&null!=n&&n.mentionedInfo){var s=n.mentionedInfo,o=s.type,a=s.userIdList;if(o===go.ALL||(a||[]).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(Bs(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,o=e.isTop,a=e.tags,u=e.channelId,c={},l={};js(s)||(l.notificationStatus={time:i,val:s}),js(o)||(l.isTop={time:i,val:o}),js(a)||(l.tags={time:i,val:a},null==a||a.forEach((function(e){c[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,c,u),this._store.set(n,r,{notificationStatus:s,isTop:o,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(Hg,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Gg),this._conTagStatusChanged=!1))}},{key:"setConversationCacheByMessage",value:function(e,t){var n=this,r=e.conversationType,i=e.isPersited,s=e.targetId,o=e.channelId;if(Yg.indexOf(r)>=0){var a=!1,u=this._store.get(r,s,o),c={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,u),i=r.hasChanged,s=r.localConversation,o=r.updateItems;a=a||i,c=wt(wt({},c),o),u=Ea(s)})),a&&this._store.set(r,s,u,o),this._store.updateMentionedData(e),i){var l=this._store.get(r,s,o);l.updatedItems=wt({latestMessage:{time:e.sentTime,val:e}},c),l.latestMessage=e;var h=Object.assign(l,{conversationType:r,targetId:s,channelId:o});this._setUpdatedConversation(h)}(a||i)&&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,o=e.conversationType;r=r||0,(n||1!==s)&&(t.length>0?t.includes(Number(o))&&(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,o=i.hasMentioned,a={};if(s&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),o&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(a).length){var u=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:a});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===ho.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}}]),e}(),Qg=function(){function e(t,n,r,i){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(n,"-").concat(r),this._storagePullTimeKey="us-s-".concat(n,"-").concat(r),this._storage=gn(t.runtime),this._engine=t,this._tagWatcherFunc=i}var t;return Ct(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=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;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!==io.SUCCESS||js(i)?(this._isPulling=!1,this._startPull()):(s=i.settings,o=i.version,a=s.Tag,js(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,o),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}(),Jg=function(e){Nt(i,e);var t,n,r=Pt(i);function i(e,t){var n;return Tt(this,i),(n=r.call(this,e,t))._miniConnectUrl="",n._connectType=t.connectionType,n}return Ct(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=Rt(regeneratorRuntime.mark((function e(t,n,r){var s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._runtime.useNavi||(o=this._runtime.isSupportSocket()&&"websocket"===this._connectType?an.join(","):un.join(","),this._miniConnectUrl=null!==(s=this._options.miniCMPProxy)&&void 0!==s&&s.length?this._options.miniCMPProxy.join(","):o||"",n=[]),e.abrupt("return",Dt(Ot(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=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c,l,h,f,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i="getServerEndpoint",s=0,o=t.length;case 2:if(!(s<o)){e.next=28;break}return a=this._formatJSONPUrl(t[s],r,n,i),Ws.debug("req navi => ".concat(a)),e.next=7,this._runtime.httpReq({url:a,timeout:1e4,dataType:"text"});case 7:if(200===(u=e.sent).status){e.next=11;break}return 403===u.status?Ws.error("request navi error: "+io.RC_CONN_USER_OR_PASSWD_ERROR):401===u.status&&Ws.error("request navi error: "+io.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(a)?"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),Ws.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}(Tg),zg=function(){function e(t){Tt(this,e),this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}var t;return Ct(e,[{key:"_startPull",value:(t=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a;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,o=s.code,a=s.data,o===io.SUCCESS?(this._isPulling=!1,this._pullTime=a.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}(),Zg=function(e,t){return["send_msg",e,t].join("_")},Xg=function(){function e(t,n){Tt(this,e),this._runtime=t,this._appkey=n,this._sendMessageMap={},this._userId=""}return Ct(e,[{key:"init",value:function(e){this._userId=e;var t=Zg(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=Zg(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=Zg(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}(),$g=function(e){var t="RCDeviceId",n=gn(e),r="",i=n.get(t);return i?r=i:(r=Ns(),n.set(t,r)),r};St(Kg={},ks.PRIVATE,sg.qryPMsg),St(Kg,ks.GROUP,sg.qryGMsg),St(Kg,ks.CHATROOM,sg.qryCHMsg),St(Kg,ks.CUSTOMER_SERVICE,sg.qryCMsg),St(Kg,ks.SYSTEM,sg.qrySMsg);var ep=[sg[sg.recallMsg],sg[sg.ppMsgS],sg[sg.pgMsgS],sg[sg.ppMsgP],sg[sg.pgMsgP],sg[sg.chatMsg],sg[sg.pcMsgP],sg[sg.prMsgS]],tp=function(e){var t;return(t={},St(t,ks.PRIVATE,sg.ppMsgP),St(t,ks.GROUP,sg.pgMsgP),St(t,ks.CHATROOM,sg.chatMsg),St(t,ks.CUSTOMER_SERVICE,sg.pcMsgP),St(t,ks.RTC_ROOM,sg.prMsgS),t)[e]},np=function(e,t,r,i,s,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:no.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}},rp=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e},ip=function(t){Nt(Ee,t);var n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T,I,C,S,b,w,N,O,k,A,M,L,U,x,P,D,V,B,F,j,K,q,Y,H,G,W,Q,J,z,Z,X,$,ee,te,ne,re,ie,se,oe,ae,ue,ce,le,he,fe,de,ge,pe,ve,ye,me,_e=Pt(Ee);function Ee(e,t,n){var r;return Tt(this,Ee),(r=_e.call(this,e,t,n))._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._connectedTime=0,r._localConnectedTime=0,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._letterbox=new Ag(e,n.appkey),r._sendMessageStore=new Xg(e,n.appkey),r._chrmEntryHandler=new Ug(Ut(r)),r}return Ct(Ee,[{key:"_createNavi",value:function(){return new Jg(this.runtime,this._options)}},{key:"getConnectedTime",value:function(){return this._connectedTime}},{key:"connect",value:(me=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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):Ws.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 Ws.error("navi invaild.",r),e.abrupt("return",io.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),o=Kl.V3,1===n.openAnti&&(o=Kl.V4),e.next=13,s.connect(this._appkey,t,r,n.protocol,this._apiVer,o);case 13:return(a=e.sent)===io.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(oo.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new Wg(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Qg(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new zg(this),this._joinedChrmManager=new xg(this.runtime,this._appkey,this.currentUserId,n.joinMChrm),this._startSyncInterval()):s.close(),e.abrupt("return",a);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return me.apply(this,arguments)})},{key:"_connectionStatusHandler",value:function(e,t,n,r){if(Ws.warn("connection status changed:",e),e!==oo.CONNECTING)if(e!==oo.CONNECTED){if(this._channel&&e!==oo.DISCONNECTED)return e===oo.BLOCKED||e===oo.KICKED_OFFLINE_BY_OTHER_CLIENT||e===oo.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==oo.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:(ye=Rt(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=Kl.V3,1===this._naviInfo.openAnti&&(i=Kl.V4),e.next=6,this._channel.connect(this._appkey,t,n,r,this._apiVer,i);case 6:if(e.sent!==io.SUCCESS){e.next=14;break}return this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(oo.CONNECTED),this._rejoinChrm(),Ws.__insertLogIntoDatabase(),e.abrupt("return");case 14:this._watcher.status(oo.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(t,n,r)}),5e3);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ye.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=sg[r];if(i)switch(i){case sg.s_ntf:Ws.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case sg.s_msg:this._receiveMsg(e);break;case sg.s_cmd:this._receiveStateNotify(e);break;case sg.s_us:this._receiveSettingNotify(e);break;case sg.rtc_ntf:this._receiveRtcKv(e)}else Ws.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,Eh),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})}}},{key:"_receiveSettingNotify",value:function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,vf)).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,Lf),r=n.time,i=n.type,s=n.roomId;switch(i){case 1: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(ep.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,fh,{currentUserId:this.currentUserId,signal:e});r=this._handleMsgProperties(r),t&&(r.sentTime=t.timestamp,r.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||r.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),r.messageType!==co.EXPANSION_NOTIFY?(r.messageType===co.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(r.conversationType,r.targetId,r.channelId),this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r))}}},{key:"_pullMsg",value:function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Eh),n=t.type,r=t.chrmId,i=t.time;if(Ws.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:(ve=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,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),Ws.info("pullMsg -> sendboxTime: ".concat(n,", inboxTime: ").concat(r)),i=this._channel.codec.encodeSyncMsg({sendboxTime:n,inboxTime:r}),s=new Jd(sg[sg.pullMsg],i,this.currentUserId),e.next=13,this._channel.send(s,ph,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(o=e.sent,a=o.code,u=o.data,this._latestSyncTimestamp=Date.now(),a===io.SUCCESS&&u){e.next=21;break}return Ws.warn("pullMsg failed -> code:",a,", data: ",u),this._pullingMsg=!1,e.abrupt("return");case 21:c=u.list,l=u.finished,h=u.syncTime,Ws.info("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),f=0,d=[],c.forEach((function(e){if(e.messageDirection===no.SEND&&(f=Math.max(e.sentTime,f),p._sendMessageStore.getSendMessageMap()[e.messageUId]))p._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==co.EXPANSION_NOTIFY){if(e.messageType===co.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,Bt(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 ve.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,gh,{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!==co.EXPANSION_NOTIFY?t.messageType===co.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,i=e.isCounted,s=e.isPersited,o=e.isStatusMessage,a=r in fn,u=r in this._customMessageType;if(t=a?fn[r]:u?this._customMessageType[r]:{isCounted:!Ks(i)&&i,isPersited:!Ks(s)&&s},Object.assign(e,{isCounted:t.isCounted,isPersited:t.isPersited,isStatusMessage:dn.includes(r)}),n&&(e.isStatusMessage=o),!n){var c=e.content.user;if(c){var l=c.portrait,h=c.portraitUri,f=l||h;f&&(c.portrait=c.portraitUri=f)}}return e}},{key:"getHistoryMessage",value:(pe=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=p.length>5&&void 0!==p[5]?p[5]:"",a=this.currentUserId,u=this._channel,c=bd[t]||Ed,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:o}),e.next=8,u.send(new Jd(c,h,a),Th,{currentUserId:a,connectedTime:u.connectedTime,conversation:{targetId:n}});case 8:if(f=e.sent,(d=f.code)===io.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:io.RC_NET_CHANNEL_INVALID});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return pe.apply(this,arguments)})},{key:"reportSDKInfo",value:function(e){var t=this.currentUserId,n=this._channel;if(n){Ws.debug("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new Jd(sg[sg.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==io.SUCCESS&&Ws.warn("reportSDKInfo failed -> code: ".concat(t))}))}}},{key:"deleteRemoteMessage",value:(ge=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(o=this._channel)){e.next=11;break}return a=o.codec.encodeDeleteMessages(t,n,r,i),u=new Jd(ud,a,s),e.next=6,o.send(u);case 6:if(c=e.sent,(l=c.code)===io.SUCCESS){e.next=10;break}return e.abrupt("return",l);case 10:return e.abrupt("return",l);case 11:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return ge.apply(this,arguments)})},{key:"deleteRemoteMessageByTimestamp",value:(de=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.currentUserId,!(o=this._channel)){e.next=12;break}return a=o.codec.encodeClearMessages(n,r,i),u=new Jd(wd[t],a,s),e.next=7,o.send(u);case 7:if(c=e.sent,(l=c.code)===io.SUCCESS){e.next=11;break}return e.abrupt("return",l);case 11:return e.abrupt("return",l);case 12:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return de.apply(this,arguments)})},{key:"getConversationList",value:(fe=Rt(regeneratorRuntime.mark((function e(){var t,n,r,i,s,o,a,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,o=this._channel,n=n||ks.PRIVATE,!o){e.next=17;break}return a=o.codec.encodeOldConversationList({count:t,type:n,startTime:r,order:i}),u=new Jd(vd,a,s),e.next=12,o.send(u,Ch,{currentUserId:s,connectedTime:o.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===io.SUCCESS){e.next=16;break}return e.abrupt("return",{code:l});case 16:return e.abrupt("return",{code:l,data:h});case 17:return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 18:case"end":return e.stop()}}),e,this)}))),function(){return fe.apply(this,arguments)})},{key:"removeConversation",value:(he=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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}),o=new Jd(yd,s,n),e.next=6,i.send(o);case 6:if(a=e.sent,Ws.info("RemoveConversation =>",a),(u=a.code)===io.SUCCESS){e.next=11;break}return e.abrupt("return",u);case 11:return e.abrupt("return",u);case 12:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return he.apply(this,arguments)})},{key:"getConversation",value:(le=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._conversationManager.get(t,n,r)){e.next=3;break}return e.abrupt("return",{code:io.CONVER_GET_ERROR});case 3:return e.next=5,this.getHistoryMessage(t,n,0,1,0);case 5:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:io.CONVER_GET_ERROR});case 10:return u=(null==a?void 0:a.list[0])||null,c={conversationType:t,targetId:n,channelId:r,unreadMessageCount:i.unreadMessageCount||0,latestMessage:u,notificationStatus:i.notificationStatus||ho.CLOSE,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},e.abrupt("return",{code:io.SUCCESS,data:c});case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return le.apply(this,arguments)})},{key:"getAllConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"getConversationUnreadCount",value:function(e,t,n){var r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"clearConversationUnreadCount",value:function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(io.SUCCESS)}},{key:"clearAllUnreadCount",value:function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(io.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(io.SUCCESS)}},{key:"getConversationMessageDraft",value:function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:io.SUCCESS,data:r})}},{key:"clearConversationMessageDraft",value:function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(io.SUCCESS)}},{key:"pullConversationStatus",value:(ce=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._channel,r=this.currentUserId,!n){e.next=11;break}return i=n.codec.encodeGetConversationStatus(t),s=new Jd(sg[sg.pullSeAtts],i,r),e.next=6,n.send(s,mf);case 6:if(o=e.sent,a=o.code,u=o.data,a===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:a});case 10:return e.abrupt("return",{code:a,data:u});case 11:return e.abrupt("return",{code:io.RC_NET_CHANNEL_INVALID});case 12:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"batchSetConversationStatus",value:(ue=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.currentUserId,!(r=this._channel)){e.next=13;break}return i=r.codec.encodeSetConversationStatus(t),s=new Jd(md,i,n),e.next=6,r.send(s,Tf);case 6:if(o=e.sent,a=o.code,u=o.data,a!==io.SUCCESS){e.next=12;break}return c=u,t.forEach((function(e){l._conversationManager.addStatus(wt(wt({},e),{},{updatedTime:c.version}),!0)})),e.abrupt("return",a);case 12:return e.abrupt("return",a);case 13:return e.abrupt("return",io.RC_NET_CHANNEL_INVALID);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"_joinChrm",value:(ae=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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",io.RC_NET_CHANNEL_INVALID);case 3:return s=i.codec.encodeJoinOrQuitChatRoom(),o=new Jd(r?ld:cd,s,t),e.next=8,i.send(o,Lh);case 8:return a=e.sent,u=a.code,c=a.data,u===io.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 ae.apply(this,arguments)})},{key:"_rejoinChrm",value:(oe=Rt(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)===io.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 oe.apply(this,arguments)})},{key:"_pullChrmMsg",value:(se=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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,o=i.timestamp,!s){e.next=8;break}return e.abrupt("return");case 8:return i.pulling=!0,a=this._channel.codec.encodeChrmSyncMsg(o,n),u=new Jd(sg[sg.chrmPull],a,t),e.next=13,this._channel.send(u,ph,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId});case 13:if(c=e.sent,l=c.code,h=c.data,i.pulling=!1,l===io.SUCCESS&&h){e.next=20;break}return Ws.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<o||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 se.apply(this,arguments)})},{key:"joinChatroom",value:(ie=Rt(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 ie.apply(this,arguments)})},{key:"joinExistChatroom",value:(re=Rt(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 re.apply(this,arguments)})},{key:"quitChatroom",value:(ne=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o;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",io.RC_NET_CHANNEL_INVALID);case 3:return r=n.codec.encodeJoinOrQuitChatRoom(),i=new Jd(hd,r,t),e.next=7,n.send(i);case 7:return s=e.sent,(o=s.code)===io.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),e.abrupt("return",o);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getChatroomInfo",value:(te=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return s=i.codec.encodeGetChatRoomInfo(n,r),o=new Jd(sg[sg.queryChrmI],s,t),e.next=7,i.send(o,xh);case 7:if(a=e.sent,u=a.code,c=a.data,u===io.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 te.apply(this,arguments)})},{key:"getChatroomHistoryMessages",value:(ee=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeGetHistoryMsg(t,{timestamp:n,count:r,order:i}),a=new Jd(Td,o,t),e.next=7,s.send(a,Th,{conversation:{targetId:t}});case 7:if(u=e.sent,c=u.code,l=u.data,c===io.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 ee.apply(this,arguments)})},{key:"_modifyChatroomKV",value:($=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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",io.RC_NET_CHANNEL_INVALID);case 3:return s=r.codec.encodeModifyChatRoomKV(t,n,i),o=n.type===mo.UPDATE?fd:dd,a=new Jd(o,s,t),e.next=8,r.send(a);case 8:if(u=e.sent,(c=u.code)!==io.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 $.apply(this,arguments)})},{key:"_modifyChatroomKVS",value:(X=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodeModifyChatRoomKVS(t,n,i),o=n.type===mo.UPDATE?gd:pd,a=new Jd(o,s,t),e.next=8,r.send(a,cf);case 8:return u=e.sent,c=u.code,-1!==[io.SUCCESS,io.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===io.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(d=u.data,Ws.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)}))),Ws.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 X.apply(this,arguments)})},{key:"setChatroomEntry",value:(Z=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 Z.apply(this,arguments)})},{key:"setChatroomEntries",value:(z=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 z.apply(this,arguments)})},{key:"forceSetChatroomEntry",value:(J=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 J.apply(this,arguments)})},{key:"removeChatroomEntry",value:(Q=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 Q.apply(this,arguments)})},{key:"removeChatroomEntries",value:(W=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 W.apply(this,arguments)})},{key:"forceRemoveChatroomEntry",value:(G=Rt(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.type=mo.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 G.apply(this,arguments)})},{key:"getChatroomEntry",value:(H=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.SUCCESS,data:r}));case 5:if(i=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:io.RC_NET_CHANNEL_INVALID}));case 8:return s=i.codec.encodePullChatRoomKV(0),o=new Jd(sg[sg.pullKV],s,t),e.next=12,i.send(o,uf);case 12:if(a=e.sent,!((u=a.data||{})&&u.kvEntries&&u.kvEntries.length)){e.next=18;break}if(void 0===(c=u.kvEntries.find((function(e){return e.key===n})))){e.next=18;break}return e.abrupt("return",Promise.resolve({code:io.SUCCESS,data:null==c?void 0:c.value}));case 18:return e.abrupt("return",Promise.resolve({code:io.CHATROOM_KEY_NOT_EXIST}));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"getAllChatroomEntry",value:(Y=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.SUCCESS,data:n}));case 5:if(r=this._channel){e.next=8;break}return e.abrupt("return",Promise.reject({code:io.RC_NET_CHANNEL_INVALID}));case 8:return i={},s=r.codec.encodePullChatRoomKV(0),o=new Jd(sg[sg.pullKV],s,t),e.next=13,r.send(o,uf);case 13:return a=e.sent,(u=a.data||{})&&u.kvEntries&&u.kvEntries.length&&u.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),e.abrupt("return",Promise.resolve({code:io.SUCCESS,data:i}));case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"pullChatroomEntry",value:(q=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return s=r.codec.encodePullChatRoomKV(n),o=new Jd(sg[sg.pullKV],s,t),e.next=7,r.send(o,uf);case 7:if(a=e.sent,u=a.code,c=a.data,u!==io.SUCCESS){e.next=17;break}return Ws.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(t,c,i),Ws.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 q.apply(this,arguments)})},{key:"sendMessage",value:(K=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:if(r=rp(r,this.currentUserId),r=this._handleMsgProperties(r,!0),i=!![ks.PRIVATE,ks.GROUP].includes(t)&&r.isStatusMessage,s=i?(g=t,p=void 0,(p={},St(p,ks.PRIVATE,sg.ppMsgS),St(p,ks.GROUP,sg.pgMsgS),p)[g]):tp(t)||sg.ppMsgP,i&&(r.isPersited=!1,r.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},r),(a=new Gd(sg[s],o,n)).setHeaderQos(Vl.AT_LEAST_ONCE),!i){e.next=13;break}return this._channel.sendOnly(a),e.abrupt("return",{code:io.SUCCESS,data:np(t,n,wt({},r),"",0,this.currentUserId)});case 13:return u=Date.now()-this._localConnectedTime+this._connectedTime,c=np(t,n,wt({},r),"",u,this.currentUserId),e.next=17,this._channel.send(a);case 17:if(l=e.sent,h=l.code,f=l.data,h===io.SUCCESS){e.next=22;break}return e.abrupt("return",{code:h,data:c});case 22:return d=f,this._sendMessageStore.setMessage(d.messageUId,d.timestamp),c.sentTime=d.timestamp,c.messageUId=d.messageUId,this._conversationManager.setConversationCacheByMessage(c,!0),e.abrupt("return",{code:io.SUCCESS,data:c});case 28:case"end":return e.stop()}var g,p}),e,this)}))),function(e,t,n){return K.apply(this,arguments)})},{key:"recallMsg",value:(j=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,u,c,l,h,f,d,g,p,v;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:io.RC_NET_CHANNEL_INVALID});case 2:return a=s.user,u={content:{conversationType:t,targetId:n,messageUId:r,sentTime:i,user:a},messageType:"RC:RcCmd",disableNotification:null==s?void 0:s.disableNotification,pushConfig:null==s?void 0:s.pushConfig,pushContent:(null===(o=s.pushConfig)||void 0===o?void 0:o.pushContent)||s.pushContent||"",channelId:s.channelId},c=sg[sg.recallMsg],l=this._channel.codec.encodeUpMsg({conversationType:t,targetId:n},u),(h=new Gd(c,l,this.currentUserId)).setHeaderQos(Vl.AT_LEAST_ONCE),e.next=10,this._channel.send(h);case 10:if(f=e.sent,d=f.code,g=f.data,d===io.SUCCESS){e.next=15;break}return e.abrupt("return",{code:d});case 15:return p=g,this._sendMessageStore.setMessage(p.messageUId,p.timestamp),v=np(t,n,wt(wt({},u),{},{isPersited:!0}),p.messageUId,p.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),e.abrupt("return",{code:io.SUCCESS,data:v});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i){return j.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(F=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeReadReceipt(n,r),s=new Jd(sg[sg.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 F.apply(this,arguments)})},{key:"getMessageReader",value:(B=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeMessageReader(n,r),s=new Jd(sg[sg.rrList],i,t),e.next=6,this._channel.send(s,Sf);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return B.apply(this,arguments)})},{key:"pullUserSettings",value:(V=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodePullUserSetting(t),r=new Jd(sg[sg.pullUS],n,this.currentUserId),e.abrupt("return",this._channel.send(r,pf));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"getFileToken",value:(D=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return s=i&&"uploads"!==i?n||"":ha(t,n),o=this._channel.codec.encodeGetFileToken(t,s,r||"",i||""),a=new Jd(sg[sg.qnTkn],o,this.currentUserId),e.next=7,this._channel.send(a,$h);case 7:if(u=e.sent,c=u.code,l=u.data,l=Object.assign(l,{fileName:s}),c!==io.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 D.apply(this,arguments)})},{key:"getFileUrl",value:(P=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return s="",o="",a="",n===vo.QINIU?(o=ef,a=nf):(o=tf,a=rf),s=n===vo.QINIU?sg[sg.qnUrl]:n===vo.AWS?sg[sg.s3Url]:n===vo.STC?sg[sg.stcUrl]:sg[sg.aliUrl],u=this._channel.codec.encodeGetFileUrl(o,t,r,i),c=new Jd(s,u,this.currentUserId),e.next=11,this._channel.send(c,a);case 11:if(l=e.sent,h=l.code,f=l.data,d=f,h!==io.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 P.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()}},{key:"destroy",value:function(){throw new Error("JSEngine's method not implemented.")}},{key:"registerMessageType",value:function(e,t,n,r){this._customMessageType[e]={isPersited:t,isCounted:n}}},{key:"getServerTime",value:function(){return Date.now()-this._localConnectedTime+this._connectedTime}},{key:"getCurrentUserId",value:function(){return this.currentUserId}},{key:"createTag",value:(x=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Jd(sg[sg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([wt(wt({},t),{},{createdTime:u})],u),e.abrupt("return",{code:io.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"removeTag",value:(U=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeRemoveTag([t],n),i=new Jd(sg[sg.delSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.deleteTag([t],u),e.abrupt("return",{code:io.SUCCESS});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"updateTag",value:(L=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._userSettingManager.getVersion(),r=this._channel.codec.encodeCreateTag([t],n),i=new Jd(sg[sg.addSeTag],r,this.currentUserId),e.next=7,this._channel.send(i,df);case 7:if(s=e.sent,o=s.code,a=s.data,o===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return u=a.version,this._userSettingManager.addTag([t],u),e.abrupt("return",{code:io.SUCCESS,data:a});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"getTagList",value:(M=Rt(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:io.SUCCESS,data:t});case 4:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"addTagForConversations",value:(A=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:if(this._userSettingManager.getTagById(t)){e.next=4;break}return e.abrupt("return",{code:io.TAG_NOT_EXIST});case 4:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Jd(sg[sg.addTag],r,this.currentUserId),e.next=8,this._channel.send(i);case 8:if(s=e.sent,(o=s.code)===io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:o});case 12:return(a={})[t]={},n.forEach((function(e){u._conversationManager.addTagStatus(e.conversationType,e.targetId,a,e.channelId)})),e.abrupt("return",{code:io.SUCCESS});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"removeTagForConversations",value:(k=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a=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:io.RC_NET_CHANNEL_INVALID});case 2:return r=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],n),i=new Jd(sg[sg.delTag],r,this.currentUserId),e.next=6,this._channel.send(i);case 6:if(s=e.sent,(o=s.code)===io.SUCCESS){e.next=10;break}return e.abrupt("return",{code:o});case 10:return n.forEach((function(e){a._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),e.abrupt("return",{code:io.SUCCESS});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"removeTagsForConversation",value:(O=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return r=t.conversationType,i=t.targetId,s=t.channelId,o=n.map((function(e){return{tagId:e}})),a=this._channel.codec.encodeUpdateConversationTag(o,[t]),u=new Jd(sg[sg.delTag],a,this.currentUserId),e.next=8,this._channel.send(u);case 8:if(c=e.sent,(l=c.code)===io.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:io.SUCCESS});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"getConversationListByTag",value:(N=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return o=s.codec.encodeOldConversationList({count:r,type:ks.PRIVATE,startTime:n}),a=new Jd(vd,o,i),e.next=7,s.send(a,Ch,{currentUserId:i,connectedTime:s.connectedTime});case 7:if(u=e.sent,c=u.code,l=u.data,h=this._conversationHasTagFilter(t,l),Ws.info("GetConversationListByTag",h),c===io.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 N.apply(this,arguments)})},{key:"_conversationHasTagFilter",value:function(e,t){var n=this,r=[],i=[];function s(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var s=t.conversationType,o=t.targetId,a=t.channelId,u=n._conversationManager.get(s,o,a),c=u.hasMentioned,l=u.mentionedInfo,h=u.lastUnreadTime,f=u.notificationStatus,d=u.isTop,g=u.tags,p=u.unreadMessageCount,v=g&&g[e];if(v){var y=wt(wt({},t),{},{hasMentioned:c,mentionedInfo:l,lastUnreadTime:h,notificationStatus:f,isTop:d,unreadMessageCount:p});v.isTop?r.push(wt(wt({},y),{},{isTopInTag:!0})):i.push(wt(wt({},y),{},{isTopInTag:!1}))}})),[].concat(Bt(r.sort(s)),Bt(i.sort(s)))}},{key:"getUnreadCountByTag",value:(w=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return r=this._conversationManager.getUnreadCountByTag(t,n),e.abrupt("return",{code:io.SUCCESS,data:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(b=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:if(i=n.targetId,s=n.conversationType,o=n.channelId,a=r.isTop,u=[{tagId:t,isTop:a}],(c=this._conversationManager.get(s,i,o)).tags&&Object.hasOwnProperty.call(c.tags,t)){e.next=8;break}return e.abrupt("return",{code:io.NO_TAG_IN_CONVER});case 8:return l=this._channel.codec.encodeUpdateConversationTag(u,[n]),h=new Jd(sg[sg.addTag],l,this.currentUserId),e.next=12,this._channel.send(h);case 12:if(f=e.sent,(d=f.code)===io.SUCCESS){e.next=16;break}return e.abrupt("return",{code:d});case 16:return(g={})[t]={},a&&(g[t].isTop=!0),this._conversationManager.addTagStatus(s,i,g,o),e.abrupt("return",{code:io.SUCCESS});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return b.apply(this,arguments)})},{key:"getTagsForConversation",value:(S=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,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:io.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===(o=r[s])||void 0===o?void 0:o.tagName});return e.abrupt("return",{code:io.SUCCESS,data:i});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"getBlockConversationList",value:function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"getTopConversationList",value:function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"getUnreadMentionedCount",value:function(e){var t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:io.SUCCESS,data:t})}},{key:"getAllUnreadMentionedCount",value:function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:io.SUCCESS,data:e})}},{key:"joinRTCRoom",value:(C=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,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:io.RC_NET_CHANNEL_INVALID});case 2:return s=this._channel.codec.encodeJoinRTCRoom(n,r,i),o=new Jd(sg[sg.rtcRJoin_data],s,t),e.abrupt("return",this._channel.send(o,Dh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return C.apply(this,arguments)})},{key:"quitRTCRoom",value:(I=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Jd(sg[sg.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 I.apply(this,arguments)})},{key:"rtcPing",value:(T=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Jd(sg[sg.rtcPing],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return T.apply(this,arguments)})},{key:"getRTCRoomInfo",value:(R=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Jd(sg[sg.rtcRInfo],n,t),e.abrupt("return",this._channel.send(r,Jh));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"getRTCUserInfoList",value:(E=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,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:io.RC_NET_CHANNEL_INVALID});case 2:return n=this._channel.codec.encodeGetRTCRoomInfo(),r=new Jd(sg[sg.rtcUData],n,t),e.next=6,this._channel.send(r,Dh);case 6:return i=e.sent,s=i.code,o=i.data,e.abrupt("return",{code:s,data:o?{users:o.users}:o});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"setRTCUserInfo",value:(_=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeSetRTCUserInfo(n,r),s=new Jd(sg[sg.rtcUPut],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return _.apply(this,arguments)})},{key:"removeRTCUserInfo",value:(m=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,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",io.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeRemoveRTCUserInfo(n),i=new Gd(sg[sg.rtcUDel],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"setRTCData",value:(y=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,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",io.RC_NET_CHANNEL_INVALID);case 2:return a=this._channel.codec.encodeSetRTCData(n,r,i,s,o),u=new Gd(sg[sg.rtcSetData],a,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 y.apply(this,arguments)})},{key:"setRTCTotalRes",value:(v=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,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",io.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeUserSetRTCData(n,r,i,s),a=new Jd(sg[sg.userSetData],o,t),e.next=6,this._channel.send(a);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 v.apply(this,arguments)})},{key:"setRTCCDNUris",value:(p=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,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",io.RC_NET_CHANNEL_INVALID);case 2:return i=this._channel.codec.encodeUserSetRTCCDNUris(n,r),s=new Jd(sg[sg.userSetData],i,t),e.next=6,this._channel.send(s);case 6:return o=e.sent,a=o.code,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"getRTCData",value:function(e,t,n,r){if(!this._channel)return Promise.resolve({code:io.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),s=new Jd(sg[sg.rtcQryData],i,e);return this._channel.send(s,Hh)}},{key:"removeRTCData",value:(g=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s){var o,a,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",io.RC_NET_CHANNEL_INVALID);case 2:return o=this._channel.codec.encodeRemoveRTCData(n,r,i,s),a=new Gd(sg[sg.rtcDelData],o,t),e.next=6,this._channel.send(a);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 g.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:(d=Rt(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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeJoinRTCRoom(n,r),s=new Jd(sg[sg.rtcToken],i,t),e.abrupt("return",this._channel.send(s,Yh));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"setRTCState",value:(f=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,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",io.RC_NET_CHANNEL_INVALID);case 2:return r=this._channel.codec.encodeSetRTCState(n),i=new Jd(sg[sg.rtcUserState],r,t),e.next=6,this._channel.send(i);case 6:return s=e.sent,o=s.code,e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"getRTCUserInfo",value:(h=Rt(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 h.apply(this,arguments)})},{key:"getRTCUserList",value:function(e){if(!this._channel)return Promise.resolve({code:io.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Jd(sg[sg.rtcUList],t,e);return this._channel.send(n,Dh)}},{key:"joinLivingRoomAsAudience",value:(l=Rt(regeneratorRuntime.mark((function t(n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 4:return s=this._channel.codec.encodeJoinRTCRoom(r,i),o=new Jd(sg[sg.viewerJoinR],s,n),t.next=8,this._channel.send(o,Vf);case 8:if(a=t.sent,u=a.code,c=a.data,u===io.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 l.apply(this,arguments)})},{key:"quitLivingRoomAsAudience",value:(c=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeQuitRTCRoom(),r=new Jd(sg[sg.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 c.apply(this,arguments)})},{key:"rtcIdentityChange",value:(u=Rt(regeneratorRuntime.mark((function e(t,n,r){var i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 2:return i=this._channel.codec.encodeIdentityChangeInfo(n,r),s=new Jd(sg[sg.rtcIdentityChange],i,t),e.next=6,this._channel.send(s,Dh);case 6:if(o=e.sent,a=o.code,u=o.data,a===io.SUCCESS){e.next=11;break}return e.abrupt("return",{code:a});case 11:return e.abrupt("return",{code:a,data:u});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"pullRTCRoomEntry",value:(a=Rt(regeneratorRuntime.mark((function e(t,n){var r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return Ws.info("audience in room start pull KV"),s=r.codec.encodePullRTCRoomKV(t,0),o=new Jd(sg[sg.rtcPullKv],s,i),e.next=8,r.send(o,xf);case 8:if(a=e.sent,u=a.code,c=a.data,Ws.info("audience in room end pull KV, code: ".concat(u,", data: ").concat(JSON.stringify(c||{}))),u!==io.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 a.apply(this,arguments)})},{key:"getRTCJoinedUserInfo",value:(o=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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:io.RC_NET_CHANNEL_INVALID});case 3:return i=n.codec.encodeQueryUserJoinedInfo(t),s=new Jd(sg[sg.rtcQueryJoined],i,r),e.next=7,n.send(s,Df);case 7:if(o=e.sent,a=o.code,u=o.data,a!==io.SUCCESS){e.next=12;break}return e.abrupt("return",{code:a,data:u});case 12:return e.abrupt("return",{code:a});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getDeviceId",value:function(){return $g(this.runtime)}},{key:"requestRoomPK",value:(s=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeRequestRoomPK(t),r=new Jd(sg[sg.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 s.apply(this,arguments)})},{key:"cancelRoomPK",value:(i=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeCancelRoomPK(t),r=new Jd(sg[sg.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 i.apply(this,arguments)})},{key:"responseRoomPK",value:(r=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeResponseRoomPK(t),r=new Jd(sg[sg.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=Rt(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",io.RC_NET_CHANNEL_INVALID);case 2:return n=this._channel.codec.encodeEndRoomPK(t),r=new Jd(sg[sg.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:io.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:io.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:io.CONVER_GET_ERROR})}},{key:"getRemoteHistoryMessages",value:function(e,t,n,r,i,s){return this.getHistoryMessage(e,t,n,r,i,s)}}]),Ee}(vg),sp=function(){function e(t){Tt(this,e),this._context=t}return Ct(e,[{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}(),op=function(e){Nt(n,e);var t=Pt(n);function n(){return Tt(this,n),t.apply(this,arguments)}return Ct(n,[{key:"getNaviInfo",value:function(){return this._context.getInfoFromCache()}},{key:"joinRTCRoom",value:function(e,t,n,r){return this._context.joinRTCRoom(e,t,n,r)}},{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}(sp),ap=function(){function e(){Tt(this,e)}return Ct(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=[],o=[],a=function(){if(o.length>0){var e=o.join("");if(o=[],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)o.push(e.charAt(u++));else if(c.length<4)o.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)o.push(e.substr(u,c.length)),u+=c.length;else{a();var f=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);s.push(f+l+h),u+=c.length}}}a();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,o=15&i,a=void 0;switch(s){case t.dataType.Compressed:var u=o>>2,c=3&o;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((a=t.numberDecode(e.substr(n,o)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=o;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,o)),r+=e.substr(n+=o,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,o),n+=o;break;case t.dataType.Mark:if(o>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+o),n+=16+o;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,o=0,a=i.length;o<a;o++){var u=i[o],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}();ap.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},ap.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ap.scale=ap.chars.length,ap.max=238327;var up=1,cp=!1,lp="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",hp=function(){function e(t){Tt(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=$g(t.runtime),this.logSwitch=t.logSwitch;var n=Ta(t.runtime);this.deviceInfo="".concat(n.type,"|").concat(n.version,"|").concat(Gs.sessionId),this.startReport()}var t;return Ct(e,[{key:"startReport",value:function(){var e=this;if(this.logSwitch&&cp){var t=this.itv*Math.pow(2,up-1);up<this.times&&up++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}}},{key:"reportRealtimeLog",value:function(){var e=this,t=Gs.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=ap.compress(t.map((function(e){return e.content})).join("")),r="".concat(lp).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){Ws.__clearRealTimeLog(),Ws.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,up=1),e.startReport()})).catch((function(t){Ws.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()}},{key:"reportFullLog",value:(t=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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,o=t.uri,a=ds.getInstance(),Ws.debug("received report log msg, ".concat(i.toLowerCase()),a),"web"===i.toLowerCase()&&a){e.next=5;break}return e.abrupt("return");case 5:if(!(n>r)){e.next=8;break}return Ws.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,Ws.__insertLogIntoDatabase();case 10:return e.next=12,a.getRangeData(hs,"time",n,r);case 12:u=(u=e.sent).filter((function(e){return!e.userId||e.userId===h.info.userId})),c=ap.compress(u.map((function(e){return e.content})).join("")||"no data"),l=1,function e(){if(!(l>3)&&cp){var t=o||h.logUrl,n="".concat(lp).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(){cp&&h.info.runtime.httpReq({url:n,method:"POST",body:c}).then((function(){Ws.debug("report full log success!")})).catch((function(t){e(),Ws.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(){up=1,cp=!1}}],[{key:"init",value:function(t){return cp=!0,e._instance||(e._instance=new e(t)),e._instance}},{key:"getInstance",value:function(){return e._instance}}]),e}();function fp(e){return Object.assign({},e)}var dp,gp=function(){function e(t,n){var r;(Tt(this,e),this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.1.1",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=oo.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},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,Bt(on));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)};this._engine=Ra()?new RCCppEngine(t,i,this._options):new ip(t,i,this._options)}var t,n,r,i,s,o,a,u,c,l,h,f,d,g,p,v,y,m,_,E,R,T,I,C,S,b,w,N,O,k,A,M,L,U,x,P,D,V,B;return Ct(e,[{key:"install",value:function(e,t){if(this._pluginInstanseMap[e.tag])return Ws.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new op(this):new sp(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Ws.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:(B=Rt(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ws.debug("_handleRedirct",this._token),e.next=3,this.connect(this._token,!0);case 3:e.sent.code!==io.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout((function(){t._handleRedirect()}),5e3));case 6:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"_connectionStatusListener",value:(V=Rt(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t===oo.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):t===oo.BLOCKED||t===oo.KICKED_OFFLINE_BY_OTHER_CLIENT||t===oo.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):t===oo.CONNECTING?this._handleConnecting():t===oo.CONNECTED?this._handleConnected():t===oo.DISCONNECTED?this._handleDisconnect():t===oo.NETWORK_UNAVAILABLE&&this._handleSuspend(),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 V.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(){this._watcher.onDisconnect&&this._watcher.onDisconnect()}},{key:"_handleSuspend",value:function(){this._watcher.onSuspend&&this._watcher.onSuspend()}},{key:"_messageReceiver",value:function(e,t,n){if((e.conversationType===ks.RTC_ROOM||Object.prototype.hasOwnProperty.call(No,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(fp(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==co.TYPING_STATUS||(this._addTypingInfo(fp(e)),!this._watcher.typingState))if(e.messageType!==co.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==co.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(fp(e))}catch(e){return Ws.error("plugin error =>",e),!1}})))if("RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return this._watcher.message&&this._watcher.message(fp(e),t,n),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,o=e.content,a=o.startTime,u=o.endTime,c=o.platform,l=o.logId,h=o.uri,f=o.packageName,d={startTime:parseInt(a),endTime:parseInt(u),platform:c,logId:l,uri:h,packageName:f};null===(s=hp.getInstance())||void 0===s||s.reportFullLog(d)}}else if("function"==typeof this._watcher.chatroomState){var g={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){g[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:g,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:St({},e.senderUserId,"RC:ChrmQuitNtf"===e.messageType?Eo.QUIT:Eo.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:"_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]=Fs(r)||Bs(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,o=i.typingContentType,a=s||"",u="".concat(n,"#").concat(r,"#").concat(a);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===o?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:o,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:(D=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,u,c,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>1&&void 0!==l[1]&&l[1],this._connectionStatus!==oo.CONNECTED){e.next=3;break}return e.abrupt("return",{code:io.SUCCESS,userId:this._engine.currentUserId});case 3:if(this._connectionStatus!==oo.CONNECTING){e.next=5;break}return e.abrupt("return",{code:io.BIZ_ERROR_CONNECTING});case 5:if("string"==typeof t&&0!==t.length){e.next=7;break}return e.abrupt("return",{code:io.RC_CONN_USER_OR_PASSWD_ERROR});case 7:return this._token=t,r=t.split("@"),i=Vt(r,2),s=i[1],o=s?s.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],e.next=12,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,n,this._options.checkCA);case 12:if(a=e.sent){e.next=15;break}return e.abrupt("return",{code:io.RC_NAVI_RESOURCE_ERROR});case 15:if(1!==(null==a?void 0:a.type)){e.next=17;break}return e.abrupt("return",{code:io.PACKAGE_ENVIRONMENT_ERROR});case 17:return u=Vo.getInfo(),e.next=20,this._engine.connect(this._getTokenWithoutNavi(),a);case 20:if(c=e.sent,Ws.__insertLogIntoDatabase(),c!==ao.REDIRECT){e.next=27;break}return this._connectionStatus=oo.REDIRECT,e.next=26,this.connect(t,!0);case 26:return e.abrupt("return",e.sent);case 27:return c===io.SUCCESS&&(Ws.info("connect success, userId: ".concat(this._engine.currentUserId)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),hp.init({runtime:this._runtime,logSwitch:(null==a?void 0:a.logSwitch)||0,logPolicy:JSON.parse((null==a?void 0:a.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Gs.init(this._engine.currentUserId),this._isInternalConnected=!0),c!==io.SUCCESS||Ra()||1===a.openUS&&this._pullUserSettings(),c!==io.SUCCESS&&(this._connectionStatus=oo.CONNECTION_CLOSED),e.abrupt("return",{code:c,userId:this._engine.currentUserId});case 31:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"_pullUserSettings",value:(P=Rt(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 P.apply(this,arguments)})},{key:"disconnect",value:function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,null===(e=hp.getInstance())||void 0===e||e.distroy(),Ws.__insertLogIntoDatabase(),Gs.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Ws.error("plugin error =>",e)}})),Promise.resolve()}},{key:"reconnect",value:function(){return this._isInternalConnected?Promise.resolve({code:io.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())}},{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]:[];this._engine.registerMessageType(e,t,n,r)}},{key:"sendMessage",value:function(e,t,n,r){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===co.READ_RECEIPT_RESPONSE)return Promise.resolve({code:io.READ_RECEIPT_ERROR});var s=JSON.stringify(n.content);return Hn(s)>ln?Promise.resolve({code:io.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)}},{key:"sendExpansionMessage",value:(x=Rt(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,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,o=t.keys,a=t.expansion,u=t.removeAll,t.canIncludeExpansion){e.next=3;break}return e.abrupt("return",{code:io.MESSAGE_KV_NOT_SUPPORT});case 3:if(c=!1,l=!1,h=!1,!Bs(a)){e.next=19;break}f=Object.keys(a).length,c=f>20,e.t0=regeneratorRuntime.keys(a);case 10:if((e.t1=e.t0()).done){e.next=19;break}if(d=e.t1.value,g=a[d],l=Ls(d)&&!/^[A-Za-z0-9_=+-]+$/.test(d),!(h=d.length>32||g.length>64)&&!l){e.next=17;break}return e.abrupt("break",19);case 17:e.next=10;break;case 19:if(!c&&!h){e.next=21;break}return e.abrupt("return",{code:io.EXPANSION_LIMIT_EXCEET});case 21:if(!l){e.next=23;break}return e.abrupt("return",{code:io.BIZ_ERROR_INVALID_PARAMETER});case 23:return p={mid:s},a&&(p.put=a),o&&(p.del=o),u&&(p.removeAll=1),e.next=29,this._engine.sendMessage(r,i,{content:p,messageType:co.EXPANSION_NOTIFY,channelId:n});case 29:return v=e.sent,y=v.code,e.abrupt("return",{code:y});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"sendReadReceiptMessage",value:(U=Rt(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:io.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 U.apply(this,arguments)})},{key:"getMessageReader",value:(L=Rt(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:io.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 L.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){Ws.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=hp.getInstance())||void 0===e||e.distroy(),Gs.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]:"",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";return this._engine.getHistoryMessage(e,t,n,r,i,s,o||"")}},{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]:"";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 this._engine.removeConversation(e,t,n)}},{key:"clearUnreadCount",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return 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){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[ks.PRIVATE,ks.GROUP,ks.SYSTEM,ks.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]:"",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 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 ga(n)&&pa(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(io.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(!ga(i)||!pa(s))return Promise.resolve({code:io.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)}},{key:"forceSetChatroomEntry",value:function(e,t){var n=t.key,r=t.value;return ga(n)&&pa(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(io.BIZ_ERROR_INVALID_PARAMETER)}},{key:"removeChatroomEntry",value:function(e,t){var n=t.key;return ga(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(io.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(!ga(r))return Promise.resolve({code:io.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)}},{key:"forceRemoveChatroomEntry",value:function(e,t){var n=t.key;return ga(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(io.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:(M=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,u,c,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this.getInfoFromCache(),o=(null==s?void 0:s.bosAddr)||"",a=(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!==io.SUCCESS){e.next=11;break}return e.abrupt("return",Promise.resolve(Object.assign(h,{bos:o,qiniu:a,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 M.apply(this,arguments)})},{key:"getFileUrl",value:(A=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o,a,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]:vo.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(o=e.sent,a=o.code,u=o.data,a!==io.SUCCESS){e.next=10;break}return e.abrupt("return",Promise.resolve(u));case 10:return e.abrupt("return",Promise.reject(a));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return A.apply(this,arguments)})},{key:"createTag",value:(k=Rt(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 k.apply(this,arguments)})},{key:"removeTag",value:(O=Rt(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 O.apply(this,arguments)})},{key:"updateTag",value:(N=Rt(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 N.apply(this,arguments)})},{key:"getTagList",value:(w=Rt(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 w.apply(this,arguments)})},{key:"addTagForConversations",value:(b=Rt(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(io.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 b.apply(this,arguments)})},{key:"removeTagForConversations",value:(S=Rt(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 S.apply(this,arguments)})},{key:"removeTagsForConversation",value:(C=Rt(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 C.apply(this,arguments)})},{key:"getConversationListByTag",value:(I=Rt(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 I.apply(this,arguments)})},{key:"getUnreadCountByTag",value:(T=Rt(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 T.apply(this,arguments)})},{key:"setConversationStatusInTag",value:(R=Rt(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 R.apply(this,arguments)})},{key:"getTagsForConversation",value:(E=Rt(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 E.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:"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:(_=Rt(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 _.apply(this,arguments)})},{key:"setUserStatusListener",value:function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Ws.error(e)}}))}},{key:"addToBlacklist",value:(m=Rt(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 m.apply(this,arguments)})},{key:"removeFromBlacklist",value:(y=Rt(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 y.apply(this,arguments)})},{key:"getBlacklist",value:(v=Rt(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 v.apply(this,arguments)})},{key:"getBlacklistStatus",value:(p=Rt(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 p.apply(this,arguments)})},{key:"insertMessage",value:(g=Rt(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 g.apply(this,arguments)})},{key:"deleteMessages",value:(d=Rt(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 d.apply(this,arguments)})},{key:"deleteMessagesByTimestamp",value:(f=Rt(regeneratorRuntime.mark((function e(t,n,r,i){var s,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=o.length>4&&void 0!==o[4]?o[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 f.apply(this,arguments)})},{key:"clearMessages",value:(h=Rt(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 h.apply(this,arguments)})},{key:"getMessage",value:(l=Rt(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 l.apply(this,arguments)})},{key:"setMessageContent",value:(c=Rt(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 c.apply(this,arguments)})},{key:"setMessageSearchField",value:(u=Rt(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 u.apply(this,arguments)})},{key:"setMessageSentStatus",value:(a=Rt(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 a.apply(this,arguments)})},{key:"setMessageReceivedStatus",value:(o=Rt(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 o.apply(this,arguments)})},{key:"setUserStatus",value:(s=Rt(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=Rt(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=Rt(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=Rt(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=Rt(regeneratorRuntime.mark((function e(t,n,r,i,s,o){var a,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=u.length>6&&void 0!==u[6]?u[6]:"",e.abrupt("return",this._engine.searchMessageByContent(t,n,r,i,s,o,a));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n,r,i,s,o){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){return this._engine.joinRTCRoom(e,t,n,r)}},{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 Ws.setLogLevel(n.logLevel),Ws.setLogStdout(n.logStdout),(n.indexDBSwitch||js(n.indexDBSwitch))&&ds.init(),Ws.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Ws.error("Repeat initialize!"),this._context):(Ws.warn("RCEngine Commit:","41dbe38d1b376ca0a791b23ed94be291e3f92e81"),this._context=new e(t,n),Ws.__insertLogIntoDatabase(),this._context)}},{key:"destroy",value:function(){this._context&&(this._context._destroy(),this._context=void 0)}}]),e}();e.TagChangeType=void 0,(dp=e.TagChangeType||(e.TagChangeType={}))[dp.add=1]="add",dp[dp.update=2]="update",dp[dp.delete=3]="delete";e.AEngine=vg,e.ANavi=Tg,e.APIContext=gp,e.AppStorage=vn,e.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},e.CallLibMsgType=No,e.ChatroomEntryType=mo,e.ChatroomMemberChangeType=Eo,e.CometChannel=pg,e.ConnectResultCode=ao,e.ConnectionStatus=oo,e.ConversationType=ks,e.DelayTimer=Sa,e.ErrorCode=io,e.EventEmitter=eo,e.FileType=Ms,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=cn,e.Logger=Gs,e.MAX_MESSAGE_CONTENT_BYTES=ln,e.MINI_COMET_CONNECT_URIS=un,e.MINI_SOCKET_CONNECT_URIS=an,e.MentionedType=go,e.MessageBlockType=Co,e.MessageDirection=no,e.MessageType=co,e.NAVI_CACHE_DURATION=nn,e.NAVI_REQ_TIMEOUT=1e4,e.NotificationStatus=ho,e.PING_REQ_TIMEOUT=rn,e.PUBLIC_CLOUD_NAVI_URIS=on,e.PluginContext=sp,e.RCAssertError=Fo,e.RTCPluginContext=op,e.ReceivedStatus=n,e.SEND_MESSAGE_TYPE_OPTION=fn,e.STATUS_MESSAGE=dn,e.STORAGE_ROOT_KEY=hn,e.UploadMethod=vo,e.VersionManage=Vo,e.WEB_SOCKET_TIMEOUT=sn,e.WebSocketChannel=dg,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(!jo(e,t,n,r))throw new Fo("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},e.cloneByJSON=Ea,e.forEach=va,e.formatConnectResponseCode=Ia,e.getBrowser=Ta,e.getMimeKey=function(e){var t="application/octet-stream";switch(e){case Ms.IMAGE:t="image/jpeg";break;case Ms.AUDIO:t="audio/amr";break;case Ms.VIDEO:t="video/3gpp";break;case Ms.SIGHT:t="video/mpeg4";break;case Ms.COMBINE_HTML:t="text/html"}return t},e.getUploadFileName=ha,e.indexOf=ma,e.isArray=Ps,e.isArrayBuffer=Ds,e.isBoolean=Us,e.isFunction=Fs,e.isHttpUrl=function(e){return Ls(e)&&/https?:\/\//.test(e)},e.isInObject=_a,e.isInclude=function(e,t){return-1!==ma(e,t)},e.isNull=Ks,e.isNumber=xs,e.isObject=Bs,e.isString=Ls,e.isUndefined=js,e.isValidChrmEntryKey=ga,e.isValidChrmEntryValue=pa,e.isValidConversationType=function(e){return xs(e)&&Object.prototype.hasOwnProperty.call(ks,e)},e.isValidFileType=function(e){return xs(e)&&Object.prototype.hasOwnProperty.call(Ms,e)},e.map=ya,e.notEmptyArray=function(e){return Ps(e)&&e.length>0},e.notEmptyObject=qs,e.notEmptyString=Vs,e.pushConfigsToJSON=fa,e.pushJSONToConfigs=da,e.todo=function(e){return new yn(e)},e.usingCppEngine=Ra,e.validate=jo,e.version="5.1.1",Object.defineProperty(e,"__esModule",{value:!0})}));
|