@rongcloud/engine 5.3.4 → 5.4.2-beem.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/index.d.ts +2127 -1864
- package/index.esm.js +1 -18
- package/index.js +1 -18
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
var e;!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"}(e||(e={}));var t,n=e,i=72e5,r=1e4,o=5e3,s=5e3,a=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],c=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],u=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],h=3e4,l=15e3,d=15e3,f=2e3,p=131072,_=45e3,m=18e4,v="RCV4-",E=32,y=4096,T={"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}},I={"RC:DizNtf":{isCounted:!1,isPersited:!1}},C=["RC:TypSts","RC:InterceptMsg"];!function(e){e.WEBSOCKET="websocket",e.COMET="comet"}(t||(t={}));var R,S=500,N=1e5,O=3e3,M=1e3,A=function(e){return R||(R={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}}),R},U=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),w=function(){function e(e,t){var n,i=t?"".concat("RCV4-").concat(t):"RCV4-";this._rootStorage=A(e);var r=this._rootStorage.get(i)||{};this._cache=new U(((n={})[i]=r,n)),this._storageKey=i}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e}(),L=function(e,t){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},L(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}L(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var P=function(){return P=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},P.apply(this,arguments)};function D(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}function V(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function k(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var x,G=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return b(t,e),t}(Error),B=function(e){return new G(e)},F=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var i=e.slice(t,n);return e=e.replace(i,(function(e){return e.toUpperCase()}))},K=function(e,t){void 0===t&&(t="utf-8");var n,i=0;if("utf-16"===t)for(var r=0,o=e.length;r<o;r++)i+=(n=e.charCodeAt(r))<=65535?2:4;else for(r=0,o=e.length;r<o;r++)i+=(n=e.charCodeAt(r))<127?1:n<=2047?2:n<=65535?3:4;return i},H=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},q=function(e){return e.match(/\d+(\.\d+){2}/)[0]};!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(x||(x={}));var Y,j=x;!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"}(Y||(Y={}));var Q,W=Y,J=function(e){return"string"==typeof e},z=function(e){return"boolean"==typeof e},Z=function(e){return"number"==typeof e&&!isNaN(e)},X=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},$=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},ee=function(e){return J(e)&&e.length>0},te=function(e){return X(e)&&e.length>0},ne=function(e){return"[object Object]"===Object.prototype.toString.call(e)},ie=function(e){return"[object Function]"===Object.prototype.toString.call(e)},re=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},oe=function(e){return"[object Null]"===Object.prototype.toString.call(e)},se=function(e){return J(e)&&/https?:\/\//.test(e)},ae=function(e){for(var t in e)return!0;return!1},ce=function(e){return Z(e)&&Object.prototype.hasOwnProperty.call(j,e)},ue=function(e){return Z(e)&&Object.prototype.hasOwnProperty.call(W,e)},he=function(e){var t=!1,n=!1,i=!1;if(ne(e)){var r=Object.keys(e).length;for(var o in t=r>20,e)if(n||(n=J(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!i){var s=e[o];i=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}};!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(Q||(Q={}));var le,de=Q;!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",
|
|
2
|
-
/*!
|
|
3
|
-
聊天室设置 KV 失败,出现在两人或者多端同时操作一个 kv。
|
|
4
|
-
如果出现该错误,为避免和其他端同时操作,请延时一定时间再试
|
|
5
|
-
*/
|
|
6
|
-
e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",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_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",e[e.ALREADY_IN_USE=51002]="ALREADY_IN_USE",e[e.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",e[e.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",e[e.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"}(le||(le={}));var fe,pe=le;!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.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",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"}(fe||(fe={}));var ge,_e=fe,me={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"}(ge||(ge={}));var ve,Ee=ge;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(ve||(ve={}));var ye,Te=ve;!function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(ye||(ye={}));var Ie,Ce=ye;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Ie||(Ie={}));var Re,Se=Ie;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(Re||(Re={}));var Ne,Oe=Re;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(Ne||(Ne={}));var Me,Ae,Ue,we,Le=Ne;!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.STATISTICS=6]="STATISTICS",e[e.NONE=1e3]="NONE"}(Me||(Me={})),function(e){e.IM="IM",e.RTC="RTC"}(Ae||(Ae={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_O="A-init-O",e.L_INIT_O="L-init-O",e.P_INIT_O="P-init-O",e.A_CONNECT_T="A-connect-T",e.A_CONNECT_R="A-connect-R",e.A_CONNECT_S="A-connect-S",e.A_DISCONNECT_O="A-disconnect-O",e.A_RECONNECT_T="A-reconnect-T",e.A_RECONNECT_R="A_RECONNECT_R",e.L_CONNECT_T="L-connect-T",e.L_CONNECT_R="L-connect-R",e.L_CONNECT_S="L-connect-S",e.P_CONNECT_O="P-connect-O",e.P_CONNECT_S="P-connect-S",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-send_msg-R",e.P_SEND_MSG_T="P-send_msg-T",e.P_SEND_MSG_R="P-send_msg-R",e.L_SEND_MSG_T="L-send_msg-T",e.L_SEND_MSG_R="L-send_msg-R",e.L_PULL_MSG_T="L-pull_msg-T",e.L_PULL_MSG_R="L-pull_msg-R",e.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",e.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",e.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",e.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",e.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",e.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",e.A_DELETE_MESSAGES_S="A-delete_messages-S",e.P_DELETE_MSG_S="P-delete_msg-S",e.L_PULL_CONVERSATION_S="L-pull_conversation-S",e.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",e.A_REGTYP_O="A-regtyp-O",e.P_REGTYP_O="P-regtype-O",e.P_REGTYP_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_ENV_S="L-Env-S",e.L_GET_INDEX_NAVI_S="L-get_index_navi-S",e.A_JOIN_CHATROOM_T="A-join_chatroom-T",e.A_JOIN_CHATROOM_R="A-join_chatroom-R",e.L_JOIN_CHATROOM_T="L-join_chatroom-T",e.L_JOIN_CHATROOM_R="L-join_chatroom-R",e.A_QUIT_CHATROOM_T="A-quit_chatroom-T",e.A_QUIT_CHATROOM_R="A-quit_chatroom-R",e.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",e.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",e.L_MEDIA_S="L-media-S",e.L_MEDIA_UPLOAD_T="L-media_upload-T",e.L_MEDIA_UPLOAD_R="L-media_upload-R",e.G_UPLOAD_LOG_S="G-upload_log-S",e.G_UPLOAD_LOG_E="G-upload_log-E",e.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",e.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",e.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",e.A_GET_HISTORY_MSG_T="A-get_history_msg-T",e.A_GET_HISTORY_MSG_R="A-get_history_msg-R",e.L_GET_HISTORY_MSG_T="L-get_history_msg-T",e.L_GET_HISTORY_MSG_R="L-get_history_msg-R",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E"}(Ue||(Ue={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(we||(we={}));var be,Pe=we;!function(e){
|
|
7
|
-
/*!
|
|
8
|
-
全局敏感词:命中了融云内置的全局敏感词
|
|
9
|
-
*/
|
|
10
|
-
e[e.GLOBAL=1]="GLOBAL",
|
|
11
|
-
/*!
|
|
12
|
-
自定义敏感词拦截:命中了客户在融云自定义的敏感词
|
|
13
|
-
*/
|
|
14
|
-
e[e.CUSTOM=2]="CUSTOM",
|
|
15
|
-
/*!
|
|
16
|
-
第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态
|
|
17
|
-
*/
|
|
18
|
-
e[e.THIRD_PARTY=3]="THIRD_PARTY"}(be||(be={}));var De,Ve=be;!function(e){e[e.typing=0]="typing"}(De||(De={}));var ke,xe,Ge,Be=De;!function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE"}(ke||(ke={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(xe||(xe={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Ge||(Ge={}));var Fe,Ke,He,qe={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Fe||(Fe={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Ke||(Ke={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(He||(He={}));var Ye="RC_Logs";function je(e){var t=e.target.result;if(1===e.oldVersion)try{t.deleteObjectStore(Ye)}catch(e){console.warn("version 1 indexDB delete error, name: ".concat(e.name,", message: ").concat(e.message,", stack: ").concat(e.stack))}!function(e,t,n){var i;if(!e.objectStoreNames.contains(t)){var r=P({},n.objectStoreParams);i=e.createObjectStore(t,r),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){i.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,Ye,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var Qe,We=function(){function e(){}return e.init=function(){if("undefined"!=typeof window&&window&&window.indexedDB){if(e.indexDBSwitch&&!e.opening){e.opening=!0;var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(t){e.opening=!1,console.warn("open indexDB request failed "+t.target.error)},t.onsuccess=function(t){e.opening=!1,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.opening=!1,e._db=t.target.result,je(t)}}}else console.debug("IndexDB is not currently supported in the environment!")},e.getInstance=function(){return e._instance},e.prototype.addList=function(t,n){return new Promise((function(i){if(e._db){var r=e._db.transaction([t],"readwrite"),o=r.objectStore(t);n.forEach((function(e){null==o||o.add(e)})),r.oncomplete=function(e){i(!0)},r.onerror=function(e){i(!1)}}else i(!1)}))},e.prototype.getRangeData=function(t,n,i,r){return new Promise((function(o){if(e._db){var s=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(i,r),c=s.index(n),u=[],h=c.openCursor(a);h.onsuccess=function(e){var t=e.target.result;t?(u.push(t.value),t.continue()):o(u)},h.onerror=function(e){console.error(e),o([])}}else o([])}))},e.prototype.getCount=function(t,n){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readonly").objectStore(t).count();i.onsuccess=function(){n(i.result)},i.onerror=function(e){console.error(e),n(0)}}else n(0)}))},e.prototype.removeFirstData=function(t,n,i){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readwrite").objectStore(t),o=r.getAllKeys(IDBKeyRange.lowerBound(0),i);o.onsuccess=function(){var e=o.result;e.length>0&&(r.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))},e._db=null,e.indexDBSwitch=!0,e.opening=!1,e}(),Je=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)}))},ze=function(){var e=Je();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,i=+e,r=[];do{var o=i%n;i=(i-o)/n,r.unshift(t[o])}while(i);return r.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},Ze=ze(),Xe={};function $e(e){return 4-e}console&&((Qe={})[Me.DEBUG]=console.debug.bind(console),Qe[Me.INFO]=console.info.bind(console),Qe[Me.WARN]=console.warn.bind(console),Qe[Me.ERROR]=console.error.bind(console),Qe[Me.FATAL]=console.log.bind(console),Xe=Qe);var et=[],tt=function(e){return J(e)||Z(e)||re(e)||z(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)};function nt(e,t,n,i){t=/^[\w]+-[\w]+-[\w]+?/.test(t)?t:"L-".concat(t,"-O"),i||(i=["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(t)?Ae.RTC:Ae.IM);var r=Date.now(),o="";try{o=(o=JSON.stringify({message:n,userId:rt.userId})).replace(/"/g,'""'),o='"'.concat(o,'"')}catch(e){gt(Ue.G_UPLOAD_LOG_E,{name:e.name,message:e.message,stack:e.stack})}K(o)>=1e3&&(o=function(e,t,n){if(void 0===n&&(n="utf-8"),!e||!t)return"";var i="utf-8"===n?3:2,r=0,o=0,s="";for(o=0;o<e.length;o++){if(e.charCodeAt(o)>255?r+=i:r++,r>t)return s;s+=e.charAt(o)}return e}(o,1e3));var s=$e(e),a={sessionId:Ze,time:r,level:s,content:"".concat(Ze,",").concat(Date.now(),",").concat(i,",").concat(s,",").concat(t,",").concat(o,"\n"),userId:rt.userId};return et.push(a),a}function it(e,t,n){console&&Xe[e]&&Xe[e]("".concat(t,":"),n)}var rt={localLogLevel:Me.WARN,userId:""},ot=-1;ot>=0&&(clearInterval(ot),ot=-1),"undefined"!=typeof window&&window&&window.indexedDB&&(ot=setInterval((function(){et.length&&function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:if(!(t=We.getInstance()))return[3,6];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,t.addList(Ye,e)];case 2:return n=r.sent(),[4,t.getCount(Ye,"time")];case 3:return r.sent()>1e5&&t.removeFirstData(Ye,"time",2e3),[2,n];case 4:return i=r.sent(),gt(Ue.G_UPLOAD_LOG_E,{name:i.name,message:i.message,stack:i.stack}),[2,!1];case 5:return[3,7];case 6:return We.init(),[2,!1];case 7:return[2]}}))}))}(et.slice()).then((function(e){e&&(et=[])}))}),3e3));var st=Date.now(),at=0;function ct(){var e=Date.now();return st!==e&&(st=e,at=0),"".concat(st,"-").concat(at++)}function ut(e){!e.customLogPrint&&delete e.customLogPrint,rt=Object.assign(rt,e)}function ht(e,t,n,i){if(void 0===n&&(n={}),void 0===i&&(i={}),e>Me.DEBUG&&(i&&(n=Object.assign(n,i)),nt(e,t,n,null==i?void 0:i.logSource)),e>=rt.localLogLevel){var r="".concat((new Date).toISOString(),"[").concat(t,"][").concat(Me[e],"]"),o="".concat(r," - ").concat(tt(n));rt.customLogPrint?rt.customLogPrint(e,o):it(e,r,tt(n))}}var lt,dt=ht.bind(null,Me.DEBUG),ft=ht.bind(null,Me.INFO),pt=ht.bind(null,Me.WARN),gt=ht.bind(null,Me.ERROR),_t=ht.bind(null,Me.FATAL),mt=Object.freeze({__proto__:null,sessionId:Ze,logLevelTransformer:$e,formatLogObj:tt,insertIntoLogCache:nt,_defaultStdout:it,ID:ct,init:ut,log:ht,debug:dt,info:ft,warn:pt,error:gt,fatal:_t}),vt=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Et=function(e){var t="RCDeviceId",n=A(e),i="",r=n.get(t);return r?i=r:(i=ze(),n.set(t,i)),i},yt=function(){function e(){}return e.compress=function(e){for(var t=this,n={},i=0;i<e.length-1;i++){var r=e.charAt(i)+e.charAt(i+1);n.hasOwnProperty(r)?n[r].push(i):n[r]=[i]}for(var o=[],s=[],a=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var n=t.numberEncode(e.length),i=String.fromCharCode(t.dataType.NormalExt|n.length);o.push(i+n)}else{var r=String.fromCharCode(t.dataType.Normal|e.length);o.push(r)}o.push(e)}},c=0;c<e.length;){var u=t.indexOf(n,e,c);if(u.length<2)s.push(e.charAt(c++));else if(u.length<4)s.push(e.substr(c,u.length)),c+=u.length;else{var h=t.numberEncode(c-u.offset),l=t.numberEncode(u.length);if(h.length+l.length>=u.length)s.push(e.substr(c,u.length)),c+=u.length;else{a();var d=String.fromCharCode(t.dataType.Compressed|h.length<<2|l.length);o.push(d+h+l),c+=u.length}}}a();var f=t.numberEncode(e.length),p=String.fromCharCode(t.dataType.Tail|f.length);return o.push(p+f),o.join("")},e.uncompress=function(e){var t=this,n=0,i="";e:do{var r=e.charCodeAt(n++),o=r&t.dataType.Mark,s=15&r,a=void 0;switch(o){case t.dataType.Compressed:var c=s>>2,u=3&s;if(0===c||0===u)throw new Error("Data parsing error,at "+n);var h=t.numberDecode(e.substr(n,c)),l=t.numberDecode(e.substr(n+=c,u));if((h=i.length-h)+l>i.length)throw new Error("Data parsing error,at "+n);n+=u,i+=i.substr(h,l);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,s)))!==i.length)throw console.log(i.length),console.log(a),new Error("Data parsing error,at "+n);n+=s;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,s)),i+=e.substr(n+=s,a),n+=a;break;case t.dataType.Normal:i+=e.substr(n,s),n+=s;break;case t.dataType.Mark:if(s>10)throw new Error("Data parsing error,at "+n);i+=e.substr(n,16+s),n+=16+s;break;default:throw new Error("Data parsing error,at "+n+" header:"+o)}}while(n<e.length);return i},e.indexOf=function(e,t,n){var i={length:0,offset:-1};if(t.length,n>=t.length-1)return i;var r=e[t.charAt(n)+t.charAt(n+1)];if(r[0]===n)return i;for(var o=t.length-n,s=0,a=r.length;s<a;s++){var c=r[s],u=n-c;if(!(u>this.max)){var h=Math.min(o,u);if(h<=i.length)break;if(!(i.length>2&&t.charAt(c+i.length-1)!==t.charAt(n+i.length-1))){for(var l=2,d=l;d<h&&t.charAt(c+d)===t.charAt(n+d);d++)l++;l>=i.length&&(i.length=l,i.offset=c)}}}return i},e.numberEncode=function(e){var t=this,n=[],i=0;do{i=e%t.scale,n.push(t.chars.charAt(i)),e=(e-i)/t.scale}while(e>0);return n.join("")},e.numberDecode=function(e){for(var t=0,n=0,i=e.length-1;i>=0;i--){if(-1===(n=this.chars.indexOf(e.charAt(i))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t},e.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},e.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.scale=e.chars.length,e.max=238327,e}(),Tt=function(e){return J(e)&&/https?:\/\//.test(e)},It=function(){function e(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=Et(e.runtime),this.logSwitch=e.logSwitch;var t=vt(e.runtime);this.deviceInfo="".concat(t.type,"|").concat(t.version,"|").concat(null==e?void 0:e.sessionId)}return e.prototype.updateUploadLogAttr=function(e){var t=e.logPolicy,n=e.logSwitch,i=e.runtime,r=e.sessionId,o=void 0===r?"":r,s=e.userId;if(t){var a=t.url,c=t.level,u=t.itv,h=t.times;this.logUrl=a||this.logUrl,this.level=c||this.level,this.itv=u||this.itv,this.times=h||this.times}if(n&&(this.logSwitch=n),i){this.deviceId=Et(i);var l=vt(i);this.deviceInfo="".concat(l.type,"|").concat(l.version,"|").concat(o)}s&&(this.info.userId=s)},e.init=function(t){return e.reportSwitch=!0,e._instance||(e._instance=new e(t)),e._instance},e.getInstance=function(){return e._instance},e.prototype.reportRealtimeLog=function(t){var n=this;if(0===t.length||!this.logUrl)return Promise.resolve();var i=yt.compress(t.map((function(e){return e.content})).join("")),r=Tt(this.logUrl)?"":"https://",o="".concat(r).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");return this.info.runtime.httpReq({method:"POST",url:o,body:i}).then((function(t){var i=t.data;i&&(i=JSON.parse(i),n.itv=i.nextTime,n.level=i.level,n.logSwitch=i.logSwitch,e.currentRTTimes=1)}))},e.prototype.reportFullLog=function(t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:return n=t.startTime,i=t.endTime,r=t.platform,o=t.logId,s=t.uri,a=We.getInstance(),"web"===r.toLowerCase()&&a?n>i?[2]:[4,a.getRangeData(Ye,"time",n,i)]:[2];case 1:return c=(c=f.sent()).filter((function(e){return!e.userId||e.userId===d.info.userId})),u=yt.compress(c.map((function(e){return e.content})).join("")||"no data"),5e3,h=1,l=function(){if(h>3||!e.reportSwitch)return Promise.resolve();var t=s||d.logUrl,n=Tt(t)?"":"https://",i="".concat(n).concat(t,"?version=").concat(d.info.version,"&appkey=").concat(d.info.appkey,"&userId=").concat(d.info.userId,"&logId=").concat(o,"&deviceId=").concat(d.deviceId,"&deviceInfo=").concat(d.deviceInfo,"&platform=Web"),r=5e3*(h-1);return h++,new Promise((function(t,n){setTimeout((function(){e.reportSwitch&&d.info.runtime.httpReq({url:i,method:"POST",body:u}).then((function(){t()})).catch((function(e){n(e),l()}))}),r)}))},[2,l()]}}))}))},e.prototype.distroy=function(){e.currentRTTimes=1,e.reportSwitch=!1},e.currentRTTimes=1,e.reportSwitch=!1,e}(),Ct=[],Rt=-1;function St(e){lt&<.updateUploadLogAttr(e)}function Nt(e,t,n,i){nt(4-e,t,n);var r=JSON.stringify({message:n});r=r.replace(/"/g,'""'),r='"'.concat(r,'"');var o={level:e,content:[Ze,Date.now(),i||Ae.IM,e,t,r].join()+"\n"};Ct.push(o),Ct.length>=600&&(Ct=Ct.slice(-500))}function Ot(){if(Rt>=0&&(clearTimeout(Rt),Rt=-1),lt&<.logSwitch&&It.reportSwitch){var e=lt.itv*Math.pow(2,It.currentRTTimes-1);It.currentRTTimes<lt.times&&It.currentRTTimes++,Rt=setTimeout((function(){var e=Ct.filter((function(e){return e.level<=lt.level}));0===e.length?Ot():lt.reportRealtimeLog(e).then((function(){Ct=[],ft(Ue.G_UPLOAD_LOG_S,"report real-time log success"),Ot()})).catch((function(e){ft(Ue.G_UPLOAD_LOG_E,"report real-time log error -> "+e),Ot()}))}),1e3*e)}}var Mt=function(){function e(e,t,n){this.tagId=e,this.logSource=t,this.initiator=n,this._localLogLevel=Me.WARN,this.debug=this.log.bind(this,Me.DEBUG),this.info=this.log.bind(this,Me.INFO),this.warn=this.log.bind(this,Me.WARN),this.error=this.log.bind(this,Me.ERROR),this.fatal=this.log.bind(this,Me.FATAL),this.reportLog=Nt}return e.prototype.setLogLevel=function(e){this._localLogLevel="number"!=typeof e?Me.WARN:e},e.prototype.setLogStdout=function(e){this._customLogPrint=e},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e>Me.DEBUG&&nt(e,this.tagId,t.map(tt).join(" ")),!(e<this._localLogLevel)){var i="".concat((new Date).toISOString(),"[").concat(this.tagId,"][").concat(Me[e],"]"),r="".concat(i," - ").concat(t.map(tt).join(" "));this._customLogPrint?this._customLogPrint(e,r):this._stdout?this._stdout(e,r):it.apply(void 0,k([e,i],t,!1))}},e.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},e.prototype.setStdout=function(e){this._stdout=e},e}(),At=new Mt("RCEngine"),Ut=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var i=this._map[e];i&&((i=i.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=i:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=this._map[e];if(i)for(var r=i.length-1;r>=0;r-=1){var o=i[r],s=o.target,a=o.once,c=o.listener;a&&i.splice(r,1);try{c.call.apply(c,k([s],t,!1))}catch(e){At.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),wt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};wt.engine="5.3.4";var Lt,bt,Pt=function(){function e(){}return e.add=function(e,t){wt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return At.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 wt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return wt},e}();!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK",e[e.CHANNEL_ID=7]="CHANNEL_ID"}(bt||(bt={}));var Dt,Vt,kt,xt,Gt,Bt=((Lt={})[bt.STRING]=ee,Lt[bt.ONLY_STRING]=J,Lt[bt.NUMBER]=Z,Lt[bt.BOOLEAN]=function(e){return"boolean"==typeof e},Lt[bt.OBJECT]=ne,Lt[bt.ARRAY]=X,Lt[bt.CALLBACK]=function(e){var t=!0;return ne(e)||(t=!1),(e=e||{}).onSuccess&&!ie(e.onSuccess)&&(t=!1),e.onError&&!ie(e.onError)&&(t=!1),t},Lt[bt.CHANNEL_ID]=function(e){var t=!1;return J(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Lt),Ft=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return b(t,e),t}(Error),Kt=function(e,t,n,i){if(void 0===i&&(i=!1),!Ht(e,t,n,i))throw new Ft("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},Ht=function(e,t,n,i){void 0===i&&(i=!1),n=Bt[n]||n;var r=i&&!n(t)||!i&&!(re(t)||null===t||n(t));return r&&At.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!r},qt=function(e){if(!ne(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)},Yt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),i=Je(),r=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),i=t.getMonth()+1,r=t.getDate();return"".concat(n).concat(e).concat(i).concat(e).concat(r)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s="."+a[a.length-1]}return"".concat(e,"__RC-").concat(r,"_").concat(n,"_").concat(o).concat(i).concat(s)},jt=function(e){var t="application/octet-stream";switch(e){case W.IMAGE:t="image/jpeg";break;case W.AUDIO:t="audio/amr";break;case W.VIDEO:t="video/3gpp";break;case W.SIGHT:t="video/mpeg4";break;case W.COMBINE_HTML:t="text/html"}return t},Qt=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,c=t.channelIdOPPO,u=t.typeVivo,h=t.googleConfig,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=i||"",l.category=r||"",l.richMediaUri=o||"";var d={};d.collapse_key=null==h?void 0:h.collapseKey,d.imageUrl=null==h?void 0:h.imageUrl;var f=null==h?void 0:h.priority;f&&!["high","normal"].includes(f)&&(f="normal"),d.priority=f;var p=[{HW:{channelId:a||""}},{MI:{channelId:s||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||""}},{APNS:l},{FCM:d}];return JSON.stringify(p)},Wt=function(e,t){var n={},i={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:i};try{var r=JSON.parse(e);null==r||r.forEach((function(e){var t,r,o,s,a=Object.keys(e);if(0!==a.length){var c=a[0];switch(c){case"HW":return void(i.channelIdHW=null===(t=e[c])||void 0===t?void 0:t.channelId);case"MI":return void(i.channelIdMi=null===(r=e[c])||void 0===r?void 0:r.channelId);case"OPPO":return void(i.channelIdOPPO=null===(o=e[c])||void 0===o?void 0:o.channelId);case"VIVO":return void(i.typeVivo=null===(s=e[c])||void 0===s?void 0:s.classification);case"APNS":return n.threadId=e[c]["thread-id"],n.apnsCollapseId=e[c]["apns-collapse-id"],n.category=e[c].category,void(n.richMediaUri=e[c].richMediaUri);case"FCM":i.googleConfig={collapseKey:e[c].collapse_key||"",imageUrl:e[c].imageUrl||"",priority:e[c].priority||""}}}}))}catch(t){At.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:i}},Jt=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},zt=function(e){var t=e.length;return t<=4096&&t>=1},Zt=function(e,t,n){t=t||function(){};var i=(n=n||{}).isReverse;ne(e)&&function(){for(var n in e)t(e[n],n,e)}(),(X(e)||J(e))&&function(){if(i)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var r=0,o=e.length;r<o;r++)t(e[r],r)}()},Xt=function(e,t){return Zt(e,(function(n,i){e[i]=t(n,i)})),e},$t=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return Zt(e,(function(e,i){t===e&&(n=i)})),n},en=function(e,t){return-1!==$t(e,t)},tn=function(e,t){var n=[];return Zt(e,(function(e){n.push(e)})),-1!==$t(n,t)},nn=function(e){return JSON.parse(JSON.stringify(e))},rn=function(){return"undefined"!=typeof RCCppEngine},on=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},sn=function(e){switch(e){case me.SERVER_UNAVAILABLE:return pe.SERVER_UNAVAILABLE;case me.TOKEN_INCORRECT:return pe.RC_CONN_USER_OR_PASSWD_ERROR;case me.REDIRECT:return pe.RC_CONN_REDIRECTED;case me.APP_BLOCK_OR_DELETE:return pe.RC_CONN_APP_BLOCKED_OR_DELETED;case me.BLOCK:return pe.RC_CONN_USER_BLOCKED;case me.TOKEN_EXPIRE:return pe.RC_CONN_USER_OR_PASSWD_ERROR;case me.HOSTNAME_ERROR:return pe.HOSTNAME_ERROR;case me.HASOHTERSAMECLIENTONLINE:return pe.HAS_OHTER_SAME_CLIENT_ON_LINE;case me.APP_AUTH_NOT_PASS:return pe.RC_APP_AUTH_NOT_PASS;case me.OTP_USED:return pe.RC_OTP_USED;case me.PLATFORM_ERROR:return pe.RC_PLATFORM_ERROR;default:return pe.RC_NET_UNAVAILABLE}},an=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(an(e[n]));else for(var n in t={},e)t[n]=an(e[n]);else t=e;return t},cn=function(e){var t;try{t=an(e)}catch(n){At.error("clone err:",n),t=JSON.parse(JSON.stringify(e))}return t},un=function(e){var t={},n=JSON.parse(e);return Zt(n,(function(e,n){t[n]=e.v})),t},hn={_delayTime:0,setTime:function(e){var t=(new Date).getTime();hn._delayTime=t-e},getTime:function(){var e=hn._delayTime;return(new Date).getTime()-e}},ln=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(Dt||(Dt={})),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"}(Vt||(Vt={})),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"}(kt||(kt={})),function(e){e.PUB="pub",e.QUERY="qry"}(xt||(xt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Gt||(Gt={}));var dn,fn=function(){function e(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=Dt.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Dt.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var r=e>0;e&&r&&1===arguments.length?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=8==(8&e)):(this.type=e,this._retain=t,this.qos=n,this._dup=i)}return e.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0},e}(),pn=function(){function e(){}return e.writeUTF=function(e,t){var n=[],i=0;if(J(e))for(var r=0,o=e.length;r<o;r++){var s=e.charCodeAt(r);s>=0&&s<=127?(i+=1,n.push(s)):s>=128&&s<=2047?(i+=2,n.push(192|31&s>>6),n.push(128|63&s)):s>=2048&&s<=65535&&(i+=3,n.push(224|15&s>>12),n.push(128|63&s>>6),n.push(128|63&s))}for(r=0,o=n.length;r<o;r++)n[r]>255&&(n[r]&=255);return t?n:i<=255?[0,i].concat(n):[i>>8,255&i].concat(n)},e.readUTF=function(e){for(var t,n,i=[],r=-1,o=e,s="";++r<o.length;){var a=Number(o[r]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++r])<<6|128^o[++r])<<6|128^o[++r]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++r])<<6|128^o[++r]:192==(192&a)&&(a=(a^=192)<<6|128^o[++r])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?i.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,i.push(t,n)),(r+1===o.length||i.length>16384)&&(s+=String.fromCharCode.apply(null,i),i.length=0)}return s},e}(),gn=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return pn.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),_n=function(){function e(){this._pool=[],this._position=0,this._writen=0}return e.prototype.write=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},e.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},e.prototype.writeUTF=function(e){var t=pn.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),mn="UpStreamMessage",vn="PushExtra",En="DownStreamMessage",yn="DownStreamMessages",Tn="SessionsAttQryInput",In="SessionsAttOutput",Cn="SyncRequestMsg",Rn="ChrmPullMsg",Sn="NotifyMsg",Nn="HistoryMsgInput",On="HistoryMsgOuput",Mn="RelationQryInput",An="RelationsOutput",Un="DeleteSessionsInput",wn="SessionInfo",Ln="DeleteSessionsOutput",bn="RelationsInput",Pn="DeleteMsgInput",Dn="CleanHisMsgInput",Vn="SessionMsgReadInput",kn="ChrmInput",xn="ChrmOutput",Gn="QueryChatRoomInfoInput",Bn="QueryChatRoomInfoOutput",Fn="RtcInput",Kn="RtcUserListOutput",Hn="SetUserStatusInput",qn="RtcSetDataInput",Yn="RtcUserSetDataInput",jn="RtcDataInput",Qn="RtcSetOutDataInput",Wn="MCFollowInput",Jn="RtcTokenOutput",zn="RtcQryOutput",Zn="RtcQryUserOutDataInput",Xn="RtcUserOutDataOutput",$n="RtcQueryListInput",ei="RtcRoomInfoOutput",ti="RtcValueInfo",ni="RtcKeyDeleteInput",ii="GetQNupTokenInput",ri="GetQNupTokenOutput",oi="GetQNdownloadUrlInput",si="GetDownloadUrlInput",ai="GetQNdownloadUrlOutput",ci="GetDownloadUrlOutput",ui="ChrmKVEntity",hi="SetChrmKV",li="SetChrmKVS",di="DeleteChrmKVS",fi="ChrmKVOutput",pi="ChrmKVSOutput",gi="ChrmKVSVersionEntity",_i="ChrmKVSOutputEntity",mi="QueryChrmKV",vi="SetUserSettingInput",Ei="SetUserSettingOutput",yi="PullUserSettingInput",Ti="PullUserSettingOutput",Ii="UserSettingNotification",Ci="SessionReq",Ri="SessionStates",Si="SessionState",Ni="SessionStateItem",Oi="SessionStateModifyReq",Mi="SessionStateModifyResp",Ai="GroupUnpushQuery",Ui="GroupUnpushSet",wi="GroupUnpushResult",Li="GrpReadReceiptMsg",bi="GrpReadReceiptQryReq",Pi="GrpReadReceiptQryResp",Di="GrpMsgReadUser",Vi="SessionTagAddInput",ki="SessionTagItem",xi="SessionTagDelInput",Gi="SessionDisTagReq",Bi="ReportSDKInput",Fi="ReportSDKOutput",Ki="UltraGrpPullSes",Hi="UltraGrpPullMsg",qi="MsgChangeReq",Yi="QueryMsgChange",ji="MsgChange",Qi="MsgChangeList",Wi="MsgQuery",Ji="MessageQueryInfo",zi="MsgQueryAck",Zi="OperateStatus",Xi="OperateStatusNotify",$i="OperateInfo",er="OperateSummary",tr="RtcNotifyMsg",nr="RtcPullKV",ir="RtcKVOutput",rr="RtcQueryUserJoinedInput",or="RtcQueryUserJoinedOutput",sr="RtcViewerJoinedOutput",ar="RtcInviteInput",cr="RtcCancelInviteInput",ur="RtcInviteAnswerInput",hr="RtcEndInviteInput",lr="SetRtcRoomIdInput",dr="SetRtcRoomIdOutput",fr=((dn={})[mn]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],dn[yn]=["list","syncTime","finished","broadcastSyncTime"],dn[En]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],dn[vn]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],dn[Tn]=["nothing"],dn[In]=["inboxTime","sendboxTime","totalUnreadCount"],dn[Cn]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],dn[Rn]=["syncTime","count"],dn[Sn]=["type","time","chrmId"],dn[Nn]=["targetId","time","count","order","busChannel"],dn[On]=["list","syncTime","hasMsg"],dn[Mn]=["type","count","startTime","order"],dn[An]=["info","isFinished"],dn[Un]=["sessions"],dn[wn]=["type","channelId","busChannel"],dn[Ln]=["nothing"],dn[bn]=["type","msg","count","busChannel","startTime","endTime"],dn[Pn]=["type","conversationId","msgs","busChannel"],dn[Dn]=["targetId","dataTime","conversationType","busChannel"],dn[Vn]=["type","msgTime","channelId","busChannel"],dn[kn]=["nothing"],dn[xn]=["nothing","sessionId","joinTime"],dn[Gn]=["count","order"],dn[Bn]=["userTotalNums","userInfos"],dn[ii]=["type","key","httpMethod","queryString"],dn[oi]=["type","key","fileName"],dn[si]=["type","key","fileName"],dn[ri]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],dn[ai]=["downloadUrl"],dn[ci]=["downloadUrl"],dn[ui]=["key","value","status","timestamp","uid","version"],dn[hi]=["entry","bNotify","notification","type"],dn[li]=["entry","bNotify","notification","type"],dn[di]=["entry","bNotify","notification","type"],dn[fi]=["entries","bFullUpdate","syncTime"],dn[pi]=["timestamp","errorKeys","keysVersion"],dn[gi]=["version","key"],dn[_i]=["key","errorCode"],dn[mi]=["timestamp"],dn[vi]=["version","value"],dn[Ei]=["version","reserve"],dn[yi]=["version","reserve"],dn[Ti]=["items","version"],dn.UserSettingItem=["targetId","type","key","value","version","status","tags"],dn[Ci]=["time"],dn[Ri]=["version","state"],dn[Si]=["type","channelId","time","stateItem","busChannel"],dn[Ni]=["sessionStateType","value","tags"],dn[Oi]=["version","state"],dn[Mi]=["version"],dn[Ui]=["busChannel","unpushLevel"],dn[Ai]=["busChannel"],dn[wi]=["groupId","busChannel","unpushLevel"],dn[Li]=["msgId","busChannel"],dn[bi]=["msgId","busChannel"],dn[Pi]=["totalMemberNum","list"],dn[Di]=["readTime","userId"],dn[Vi]=["version","tags"],dn[ki]=["tagId","name","createdTime","isTop"],dn[xi]=["version","tags"],dn[Gi]=["tagId"],dn[Ii]=["version","reserve"],dn[Bi]=["sdkInfo"],dn[Fi]=["nothing"],dn[Ki]=["syncTime","isEraseMsgContent"],dn[Hi]=["syncTime"],dn[qi]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],dn[Yi]=["syncTime"],dn[Qi]=["list","syncTime","hasNext"],dn[ji]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId"],dn[Wi]=["targetId","type","query"],dn[Ji]=["msgTime","msgUID","busChannel"],dn[zi]=["list"],dn[Zi]=["targetId","type","opType","busChannel"],dn[Xi]=["type","notifyType","info","summary"],dn[$i]=["targetId","busChannel","userId","opType","optime"],dn[er]=["targetId","busChannel","count","opType"],dn[Fn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],dn[Kn]=["users","token","sessionId","roomInfo"],dn[Hn]=["status"],dn[qn]=["interior","target","key","value","objectName","content"],dn[Yn]=["valueInfo","objectName","content"],dn[jn]=["interior","target","key","objectName","content"],dn[Qn]=["target","valueInfo","objectName","content"],dn[Wn]=["state"],dn[Jn]=["rtcToken"],dn[zn]=["outInfo"],dn[Zn]=["userId"],dn[Xn]=["user"],dn[$n]=["order"],dn[ei]=["roomId","roomData","userCount","list"],dn[ti]=["key","value"],dn[ni]=["key"],dn[tr]=["type","time","roomId"],dn[nr]=["timestamp","roomId"],dn[ir]=["entries","bFullUpdate","syncTime"],dn[rr]=["userId"],dn[or]=["info"],dn[ar]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],dn[cr]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],dn[ur]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],dn[hr]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],dn[lr]=["rtcRoomId"],dn[dr]=["nothing"],dn),pr={},gr=function(e){var t=fr[e];pr[e]=function(){for(var e={},n={getArrayData:function(){return e}},i=function(i){var r=t[i],o="set".concat(F(r,0,1));n[o]=function(t){e[r]=t}},r=0;r<t.length;r++)i(r);return n},pr[e].decode=function(e){var t={};J(e)&&(e=JSON.parse(e));var n=function(n){var i="get".concat(F(n,0,1));t[n]=e[n],t[i]=function(){return e[n]}};for(var i in e)n(i);return t}};for(var _r in fr)gr(_r);pr.getModule=function(e){return pr[e]()};var mr="\npackage Modules;\nmessage probuf {\n message ".concat(Hn,"\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(Sn," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Cn," {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message ").concat(mn," {\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(vn," {\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(yn," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(En," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n optional int64 extStatus = 20; // 消息的扩展标记 第0位,表示送达状态: 0x01 表示已送达;断档: 0x02 表示是否需要执行断档策略; 消息修改: 0x04 拉取历史消息时表示该消息是否修改过\n repeated string toUserId = 21; //指定接收者(限定群和讨论组)//增加聊天室定向成员\n optional int32 groupUnpush = 22; //群聊默认免打扰级别\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(W.IMAGE,";\n audio = ").concat(W.AUDIO,";\n video = ").concat(W.VIDEO,";\n file = ").concat(W.FILE,";\n }\n message ").concat(ii," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(oi," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(si," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(ri," {\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(ai," {\n required string downloadUrl = 1;\n }\n message ").concat(ci," {\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(kn," {\n required int32 nothing = 1;\n }\n message ").concat(xn," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(Rn," {\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(Mn,"\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(bn,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(An,"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(Dn,"\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(Gn,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Bn,"\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(Wn,"\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(Nn,"\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(On,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat($n,"{\n optional int32 order=1;\n }\n\n message ").concat(ni,"{\n repeated string key=1;\n }\n\n message ").concat(ti,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(ti," userData=2; //用户资源信息\n }\n\n message ").concat(Kn,"{\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(ti," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Fn,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(ti," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(ti," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(zn,"{\n repeated ").concat(ti," 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(jn,"{\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(qn,"{\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(Yn," {\n repeated ").concat(ti," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(ti," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Jn,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(Qn,"{\n required targetType target=1;\n repeated ").concat(ti," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Zn,"{\n repeated string userId = 1;\n }\n message ").concat(Xn,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Tn,"{\n required int32 nothing = 1;\n }\n message ").concat(In,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Vn,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Un,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(wn,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(Ln,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Pn,"\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 optional int64 version = 6;\n }\n message ").concat(hi," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(li," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(di," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(fi," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ").concat(pi," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(_i,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(mi," {\n required int64 timestamp = 1;\n }\n message ").concat(vi," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Ei," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(yi," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Ti," {\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(Ci," {\n required int64 time = 1;\n }\n message ").concat(Ri," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Si," {\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(Ni," {\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(Oi," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Ai," {\n optional string busChannel = 1;\n }\n message ").concat(Ui,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(wi," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(Mi," {\n required int64 version=1;\n }\n message ").concat(Li," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(bi," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Pi," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Di," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Vi," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(ki," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(xi," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Gi," {\n repeated string tagId=1;\n }\n message ").concat(Ii," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Bi,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Fi,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(tr," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(nr,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(ir,"\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(rr,"\n {\n required string userId = 1;\n }\n message ").concat(or,"\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(sr,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(ar,"\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(cr,"\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(ur,"\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(hr,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(Ki,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Hi,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(qi,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(Yi," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Qi," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message MsgChange //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0,设为 1 时,IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 新加 - 消息变更的操作人Id\n }\n message ").concat(Wi," //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message ").concat(zi," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(Zi," //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message ").concat(Xi," //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message ").concat($i," {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message ").concat(er," {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n message ").concat(lr,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(dr,"\n {\n required int32 nothing = 1; //用于占位\n }\n}\n");var vr,Er,yr,Tr,Ir,Cr,Rr,Sr=(vr=mr,Er=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,i,o;return t?(o=(e>>>=0)>=0&&e<256)&&(i=c[e])?i:(n=r(e,(0|e)<0?-1:0,!0),o&&(c[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(i=a[e])?i:(n=r(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function i(e,t){if(isNaN(e)||!isFinite(e))return t?g:p;if(t){if(e<0)return g;if(e>=l)return y}else{if(-d>=e)return T;if(e+1>=d)return E}return e<0?i(-e,t).neg():r(0|e%h,0|e/h,t)}function r(t,n,i){return new e(t,n,i)}function o(e,t,n){var r,s,a,c,h,l,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(e.substring(1),t,n).neg();for(s=i(u(n,8)),a=p,c=0;c<e.length;c+=8)h=Math.min(8,e.length-c),l=parseInt(e.substring(c,c+h),n),h<8?(d=i(u(n,h)),a=a.mul(d).add(i(l))):a=(a=a.mul(s)).add(i(l));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?i(t):"string"==typeof t?o(t):r(t.low,t.high,t.unsigned)}var a,c,u,h,l,d,f,p,g,_,m,v,E,y,T,I;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},c={},e.fromInt=n,e.fromNumber=i,e.fromBits=r,u=Math.pow,e.fromString=o,e.fromValue=s,d=(l=(h=4294967296)*h)/2,f=n(16777216),p=n(0),e.ZERO=p,g=n(0,!0),e.UZERO=g,_=n(1),e.ONE=_,m=n(1,!0),e.UONE=m,v=n(-1),e.NEG_ONE=v,E=r(-1,2147483647,!1),e.MAX_VALUE=E,y=r(-1,-1,!0),e.MAX_UNSIGNED_VALUE=y,T=r(0,-2147483648,!1),e.MIN_VALUE=T,(I=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},I.toString=function(e){var t,n,r,o,s,a,c,h;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(T)?(t=i(e),r=(n=this.div(t)).mul(t).sub(this),n.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(o=i(u(e,6),this.unsigned),s=this,a="";;){if(c=s.div(o),h=(s.sub(c.mul(o)).toInt()>>>0).toString(e),(s=c).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},I.isZero=function(){return 0===this.high&&0===this.low},I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return 1==(1&this.low)},I.isEven=function(){return 0==(1&this.low)},I.equals=function(e){return t(e)||(e=s(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),i=e.isNegative();return n&&!i?-1:!n&&i?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},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(_)},I.neg=I.negate,I.add=function(e){var n,i,o,a,c,u,h,l,d,f,p;return t(e)||(e=s(e)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,c=e.high>>>16,u=65535&e.high,h=e.low>>>16,l=0,d=0,f=0,p=0,f+=(p+=a+(65535&e.low))>>>16,d+=(f+=o+h)>>>16,l+=(d+=i+u)>>>16,l+=n+c,r((f&=65535)<<16|(p&=65535),(l&=65535)<<16|(d&=65535),this.unsigned)},I.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){var n,o,a,c,u,h,l,d,g,_,m,v;return this.isZero()?p:(t(e)||(e=s(e)),e.isZero()?p:this.eq(T)?e.isOdd()?T:p:e.eq(T)?this.isOdd()?T:p:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(f)&&e.lt(f)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=e.high>>>16,h=65535&e.high,l=e.low>>>16,g=0,_=0,m=0,v=0,m+=(v+=c*(d=65535&e.low))>>>16,_+=(m+=a*d)>>>16,m&=65535,_+=(m+=c*l)>>>16,g+=(_+=o*d)>>>16,_&=65535,g+=(_+=a*l)>>>16,_&=65535,g+=(_+=c*h)>>>16,g+=n*d+o*l+a*h+c*u,r((m&=65535)<<16|(v&=65535),(g&=65535)<<16|(_&=65535),this.unsigned)))},I.mul=I.multiply,I.divide=function(e){var n,r,o,a,c,h,l;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:p;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return m;o=g}else{if(this.eq(T))return e.eq(_)||e.eq(v)?T:e.eq(T)?_:(n=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?_:v:(r=this.sub(e.mul(n)),o=n.add(r.div(e)));if(e.eq(T))return this.unsigned?g:p;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=p}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),l=(h=i(n)).mul(e);l.isNegative()||l.gt(r);)l=(h=i(n-=c,this.unsigned)).mul(e);h.isZero()&&(h=_),o=o.add(h),r=r.sub(l)}return o},I.div=I.divide,I.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.not=function(){return r(~this.low,~this.high,this.unsigned)},I.and=function(e){return t(e)||(e=s(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return t(e)||(e=s(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return t(e)||(e=s(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):r(0,this.low<<e-32,this.unsigned)},I.shl=I.shiftLeft,I.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):r(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0==(e&=63)?this:(n=this.high,e<32?r(this.low>>>e|n<<32-e,n>>>e,this.unsigned):r(32===e?n:n>>>e-32,0,this.unsigned))},I.shru=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.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]},I.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}(),yr=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 i(e,t,n,i,r){var o,s,a=8*r-i-1,c=(1<<a)-1,u=c>>1,h=-7,l=n?r-1:0,d=n?-1:1,f=e[t+l];for(l+=d,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+e[t+l],l+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+e[t+l],l+=d,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,i),o-=u}return(f?-1:1)*s*Math.pow(2,o-i)}function r(e,t,n,i,r,o){var s,a,c,u=8*o-r-1,h=(1<<u)-1,l=h>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?d/c:d*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(t*c-1)*Math.pow(2,r),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,r),s=0));r>=8;e[n+f]=255&a,f+=p,a/=256,r-=8);for(s=s<<r|a,u+=r;u>0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*g}var o,s,a,c,u,h=function(e,t,n){if(void 0===e&&(e=h.DEFAULT_CAPACITY),void 0===t&&(t=h.DEFAULT_ENDIAN),void 0===n&&(n=h.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=e||null,(o=h.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(e,t,n){return new h(e,t,n)},h.concat=function(e,t,n,i){var r,o,s,a,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(i=n,n=t,t=void 0),r=0,s=0,a=e.length;a>s;++s)h.isByteBuffer(e[s])||(e[s]=h.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(r+=o);if(0===r)return new h(0,n,i);for(u=new h(r,n,i),s=0;a>s;)(o=(c=e[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},h.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},h.type=function(){return ArrayBuffer},h.wrap=function(e,t,n,i){var r,s;if("string"!=typeof t&&(i=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return h.fromBase64(e,n);case"hex":return h.fromHex(e,n);case"binary":return h.fromBinary(e,n);case"utf8":return h.fromUTF8(e,n);case"debug":return h.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(h.isByteBuffer(e))return(r=o.clone.call(e)).markedOffset=-1,r;if(e instanceof Uint8Array)r=new h(0,n,i),e.length>0&&(r.buffer=e.buffer,r.offset=e.byteOffset,r.limit=e.byteOffset+e.byteLength,r.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)r=new h(0,n,i),e.byteLength>0&&(r.buffer=e,r.offset=0,r.limit=e.byteLength,r.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((r=new h(e.length,n,i)).limit=e.length,s=0;s<e.length;++s)r.view[s]=e[s]}return r},o.writeBitSet=function(e,t){var n,i,r,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(i=t,o=(r=e.length)>>3,s=0,t+=this.writeVarint32(r,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(r>s){for(a=0,n=0;r>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return c?(this.offset=t,this):t-i},o.readBitSet=function(e){var t,n,i,r,o,s,a,c=void 0===e;for(c&&(e=this.offset),r=(i=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;r--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(i>o)for(a=0,t=this.readByte(e++);i>o;)s[o++]=!!(1&t>>a++);return c&&(this.offset=e),s},o.readBytes=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,i=void 0===t;if(i&&(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,i&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,i=void 0===t;if(i&&(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,i&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,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,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!1),o&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,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,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!0),o&&(this.offset+=8),r},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,i=void 0===t;if(i&&(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,r(this.view,e,t,this.littleEndian,23,4),i&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=i(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,i=void 0===t;if(i&&(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,r(this.view,e,t,this.littleEndian,52,8),i&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=i(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},h.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},h.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=i=h.calculateVarint32(e))>(r=this.buffer.byteLength)&&this.resize((r*=2)>t?r:t),t-=i,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):i},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(h.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,i=0;do{if(!this.noAssert&&e>this.limit)throw(r=Error("Truncated")).truncated=!0,r;t=this.view[e++],n<5&&(i|=(127&t)<<7*n),++n}while(0!=(128&t));return i|=0,o?(this.offset=e,i):{value:i,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=h.zigZagDecode32(t.value):t=h.zigZagDecode32(t),t},e&&(h.MAX_VARINT64_BYTES=10,h.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,i=t.shiftRightUnsigned(28).toInt()>>>0,r=t.shiftRightUnsigned(56).toInt()>>>0;return 0==r?0==i?n<16384?n<128?1:2:1<<21>n?3:4:i<16384?i<128?5:6:1<<21>i?7:8:r<128?9:10},h.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},h.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var i,r,o,s,a,c=void 0===n;if(c&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),i=h.calculateVarint64(t),r=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=i)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=i,i){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==i?128|s:127&s;case 8:this.view[n+7]=8!==i?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==i?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==i?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==i?128|o:127&o;case 4:this.view[n+3]=4!==i?128|r>>>21:127&r>>>21;case 3:this.view[n+2]=3!==i?128|r>>>14:127&r>>>14;case 2:this.view[n+1]=2!==i?128|r>>>7:127&r>>>7;case 1:this.view[n]=1!==i?128|r:127&r}return c?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(h.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,i,r,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,i=0,r=0,o=0,s=0,i=127&(s=this.view[t++]),128&s&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(r=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(i|r<<28,r>>>4|o<<24,!1),c?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=h.zigZagDecode64(n.value):n=h.zigZagDecode64(n),n}),o.writeCString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),r=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;r>i;++i)if(0===e.charCodeAt(i))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 r=u.calculateUTF16asUTF8(t(e))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):r},o.readCString=function(e){var t,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,r=-1,u.decodeUTF8toUTF16(function(){if(0===r)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(r=this.view[e++])?null:r}.bind(this),i=n(),!0),o?(this.offset=e,i()):{string:i(),length:e-t}},o.writeIString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(r=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+i,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):(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),n+=4,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==r+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return s?(this.offset=n,this):n-r},o.readIString=function(e){var t,n,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),i=this.readUTF8String(n,h.METRICS_BYTES,e+=4),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=n,i=u.calculateUTF16asUTF8(t(e))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-r},o.writeString=o.writeUTF8String,h.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},h.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},h.calculateString=h.calculateUTF8Bytes,o.readUTF8String=function(e,t,i){var r,o,s,a,c;if("number"==typeof t&&(i=t,t=void 0),(r=void 0===i)&&(i=this.offset),void 0===t&&(t=h.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=i,t===h.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++s,u.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return r?(this.offset=i,o()):{string:o(),length:i-a}}if(t===h.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}if(c=i+e,u.decodeUTF8toUTF16(function(){return c>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==c)throw RangeError("Illegal range: Truncated data, "+i+" == "+c);return r?(this.offset=i,o()):{string:o(),length:i-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var i,r,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],r=h.calculateVarint32(i),n+=r+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+i,n+=this.writeVarint32(i,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),i=this.readUTF8String(n.value,h.METRICS_BYTES,e+=n.length),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},o.append=function(e,t,n){var i,r,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof h||(e=h.wrap(e,t)),(r=e.limit-e.offset)<=0||((n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=r,i&&(this.offset+=r)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new h(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,i,r;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0==(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(i=new ArrayBuffer(n),(r=new Uint8Array(i)).set(this.view.subarray(e,t)),this.buffer=i,this.view=r,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new h(0,this.littleEndian,this.noAssert);var n=t-e,i=new h(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=e),this.copyTo(i,0,e,t),i},o.copyTo=function(e,t,n,i){var r,o,s;if(!this.noAssert&&!h.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(r=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0==(s=i-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,i),t),r&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var i=void 0===t;if(i&&(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 i&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var i,r,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof h||(e=h.wrap(e,t)),(r=e.limit-e.offset)<=0||((o=r-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-r),e.offset=e.limit,i&&(this.offset-=r)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,i=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal limit: Not an integer");if(i>>>=0,n<0||n>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+i+" <= "+this.buffer.byteLength)}return e||0!==n||i!==this.buffer.byteLength?n===i?s:(t=new ArrayBuffer(i-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,i),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},c=function(){var e,t,n={},i=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[];for(e=0,t=i.length;t>e;++e)r[i[e]]=e;return n.encode=function(e,t){for(var n,r;null!==(n=e());)t(i[63&n>>2]),r=(3&n)<<4,null!==(n=e())?(t(i[63&((r|=15&n>>4)|15&n>>4)]),r=(15&n)<<2,null!==(n=e())?(t(i[63&(r|3&n>>6)]),t(i[63&n])):(t(i[63&r]),t(61))):(t(i[63&r]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var i,o,s;null!==(i=e());)if(void 0===(o=r[i])&&n(i),null!==(i=e())&&(void 0===(s=r[i])&&n(i),t(o<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(o=r[i])){if(61===i)break;n(i)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(i=e())){if(void 0===(s=r[i])){if(61===i)break;n(i)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var i;return c.encode(function(){return t>e?this.view[e++]:null}.bind(this),i=n()),i()},h.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var i=new h(e.length/4*3,n),r=0;return c.decode(t(e),(function(e){i.view[r++]=e})),i.limit=r,i},h.btoa=function(e){return h.fromBinary(e).toBase64()},h.atob=function(e){return h.fromBase64(e).toBinary()},o.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],i=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(i.push(String.fromCharCode.apply(String,n)),n=[]);return i.join("")+String.fromCharCode.apply(String,n)},h.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,i=0,r=e.length,o=new h(r,t);r>i;){if((n=e.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);o.view[i++]=n}return o.limit=r,o},o.toDebug=function(e){for(var t,n=-1,i=this.buffer.byteLength,r="",o="",s="";i>n;){if(-1!==n&&(r+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";s+=r+o+"\n",r=o=""}r+=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!==i?" ":""}if(e&&" "!==r){for(;r.length<51;)r+=" ";s+=r+o+"\n"}return e?s:r},h.fromDebug=function(e,t,n){for(var i,r,o=e.length,s=new h(0|(o+1)/3,t,n),a=0,c=0,u=!1,l=!1,d=!1,f=!1,p=!1;o>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(l||d||f){p=!0;break}l=d=f=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(l||f){p=!0;break}l=f=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(l||d){p=!0;break}l=d=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(l){p=!0;break}l=!0}s.offset=c,u=!1;break;case"]":if(!n){if(f||d){p=!0;break}f=d=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(f){p=!0;break}f=!0}s.limit=c,u=!1;break;case"'":if(!n){if(d){p=!0;break}d=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){p=!0;break}if(r=parseInt(i+e.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=r,u=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!l||!f)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,i=new Array(t-e);t>e;)(n=this.view[e++])<16?i.push("0",n.toString(16)):i.push(n.toString(16));return i.join("")},h.fromHex=function(e,t,n){var i,r,o,s,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(r=e.length,o=new h(0|r/2,t),s=0,a=0;r>s;s+=2){if(i=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=i}return o.limit=a,o},u=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,i,r,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(i=e())&&s([n,i]),t((31&n)<<6|63&i);else if(224==(240&n))(null===(i=e())||null===(r=e()))&&s([n,i,r]),t((15&n)<<12|(63&i)<<6|63&r);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(i=e())||null===(r=e())||null===(o=e()))&&s([n,i,r,o]),t((7&n)<<18|(63&i)<<12|(63&r)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,i=null;null!==(n=null!==i?i:e());)n>=55296&&n<=57343&&null!==(i=e())&&i>=56320&&i<=57343?(t(1024*(n-55296)+i-56320+65536),i=null):t(n);null!==i&&t(i)},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,i=0;return e.UTF16toUTF8(t,(function(e){++n,i+=e<128?1:e<2048?2:e<65536?3:4})),[n,i]}};return e}(),o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var i;try{u.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),i=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return i()},h.fromUTF8=function(e,n,i){if(!i&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var r=new h(u.calculateUTF16asUTF8(t(e),!0)[1],n,i),o=0;return u.encodeUTF16toUTF8(t(e),(function(e){r.view[o++]=e})),r.limit=o,r},h}(Er),Tr=function(e,t){var n,i,r={};return r.ByteBuffer=e,r.c=e,n=e,r.Long=t||null,r.VERSION="5.0.1",r.WIRE_TYPES={},r.WIRE_TYPES.VARINT=0,r.WIRE_TYPES.BITS64=1,r.WIRE_TYPES.LDELIM=2,r.WIRE_TYPES.STARTGROUP=3,r.WIRE_TYPES.ENDGROUP=4,r.WIRE_TYPES.BITS32=5,r.PACKABLE_WIRE_TYPES=[r.WIRE_TYPES.VARINT,r.WIRE_TYPES.BITS64,r.WIRE_TYPES.BITS32],r.TYPES={int32:{name:"int32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},uint64:{name:"uint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.UZERO:void 0},sint64:{name:"sint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},bool:{name:"bool",wireType:r.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:r.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:r.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.ZERO:void 0},float:{name:"float",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:r.WIRE_TYPES.STARTGROUP,defaultValue:null}},r.MAP_KEY_TYPES=[r.TYPES.int32,r.TYPES.sint32,r.TYPES.sfixed32,r.TYPES.uint32,r.TYPES.fixed32,r.TYPES.int64,r.TYPES.sint64,r.TYPES.sfixed64,r.TYPES.uint64,r.TYPES.fixed64,r.TYPES.bool,r.TYPES.string,r.TYPES.bytes],r.ID_MIN=1,r.ID_MAX=536870911,r.convertFieldsToCamelCase=!1,r.populateAccessors=!0,r.populateDefaults=!0,r.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof 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 i=e.XHR();if(i.open("GET",t,!!n),i.setRequestHeader("Accept","text/plain"),"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/plain"),!n)return i.send(null),200==i.status||0==i.status&&"string"==typeof i.responseText?i.responseText:null;if(i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0==i.status&&"string"==typeof i.responseText?n(i.responseText):n(null))},4==i.readyState)return;i.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),r.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},r.DotProto=function(e,t){function n(e,n){var i=-1,r=1;if("-"==e.charAt(0)&&(r=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))i=parseInt(e);else if(t.NUMBER_HEX.test(e))i=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(r<0?"-":"")+e);i=parseInt(e.substring(1),8)}if(i=0|r*i,!n&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+e);return i}function i(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 r(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},c=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},u.next=function(){var e,n,i,r,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(i=this.source.charAt(this.index));)if("\n"===i&&++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("*"!==(i=this.source.charAt(this.index)))return"/";do{if("\n"===i&&++this.line,++this.index===this.source.length)return null;n=i,i=this.source.charAt(this.index)}while("*"!==n||"/"!==i);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(r=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(r++)))for(;r<this.source.length&&!t.DELIM.test(this.source.charAt(r));)++r;return('"'===(o=this.source.substring(this.index,this.index=r))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},u.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},u.omit=function(e){return this.peek()===e&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,o=function(e){this.tn=new c(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),i=!1;break;case"enum":this._parseEnum(n),i=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return i(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var i,r=this.tn.next(),o=!1;if("("===r&&(o=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,o&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,i),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var i=this.tn.peek();if("{"!==i)r(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!t.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(e.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(e,n+"."+i)}},s._parseService=function(e){var n,i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);for(n={name:i,rpc:{},options:{}},this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(n);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,i,r="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(i.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.response_stream=!0,o=this.tn.next()),i.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[r]&&(e[r]={}),e[r][n]=i},s._parseMessage=function(e,i){var r=!!i,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(r?"group":"message")+" name: "+o);for(s.name=o,r&&(this.tn.skip("="),i.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,i,r){var o,s,a;if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);if(o={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(r)&&!t.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(o.type=r,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,i,r,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(i=o,r=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=i,r.push(n.id);this.tn.omit(";"),e.oneofs[i]=r},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var i,r={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(r.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(r);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),i={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),e.enums.push(r)},s._parseExtensionRanges=function(){var t,n,r,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":r=e.ID_MIN;break;case"max":r=e.ID_MAX;break;default:r=i(t)}if(n.push(r),2===n.length)break;if("to"!==this.tn.peek()){n.push(r);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);for(n={ref:i,fields:[]},this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(n,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(n,"optional",i)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(r,r.Lang),r.Reflect=function(t){function i(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 r(e,n){var i=n.readVarint32(),o=7&i,s=i>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(128==(128&i));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:i=n.readVarint32(),n.offset+=i;break;case t.WIRE_TYPES.STARTGROUP:r(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,c,u,h,l,d,f,p,g,_,m,v,E,y,T={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},T.T=I,o=function(e,t,n,i,r){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(I.prototype)).getChildren=function(e){var t,n,i;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,i=this.children.length;i>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,i="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][i]===e)return this.children[t];return null},s.resolve=function(e,t){var n,i="string"==typeof e?e.split("."):e,r=this,o=0;if(""===i[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof T.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof T.T&&(!t||n instanceof T.Namespace))){r=null;break}r=n,o++}while(o<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},s.qn=function(e){var t,n,i=[],r=e;do{i.unshift(r.name),r=r.parent}while(null!==r);for(t=1;t<=i.length;t++)if(n=i.slice(i.length-t),e===this.resolve(n,e instanceof T.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,i={},r=this.children;for(t=0,n=r.length;n>t;++t)(e=r[t])instanceof o&&(i[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},s.buildOpt=function(){var e,t,n,i,r={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],i=this.options[o[e]],r[n]=i;return r},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},T.Namespace=o,a=function(e,n,i,r){if(this.type=e,this.resolvedType=n,this.isMapKey=i,this.syntax=r,i&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},c=a.prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},c.verifyValue=function(n){var r,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof 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(typeof 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 i(n,!1)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return i(n,!0)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(typeof n,"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(typeof n,"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(typeof n,"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(r=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<r.length;s++){if(r[s].name==n)return r[s].id;if(r[s].id==n)return r[s].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),(n>4294967295||n<0)&&a(typeof 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"==typeof n||a(typeof n,"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(s in o={},n)n.hasOwnProperty(s)&&(o[s]=n[s]);n=o}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},c.calculateLength=function(e,i){if(null===i)return 0;var r;switch(this.type){case t.TYPES.int32:return i<0?n.calculateVarint64(i):n.calculateVarint32(i);case t.TYPES.uint32:return n.calculateVarint32(i);case t.TYPES.sint32:return n.calculateVarint32(n.zigZagEncode32(i));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(i);case t.TYPES.sint64:return n.calculateVarint64(n.zigZagEncode64(i));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return n.calculateVarint32(i);case t.TYPES.double:return 8;case t.TYPES.string:return r=n.calculateUTF8Bytes(i),n.calculateVarint32(r)+r;case t.TYPES.bytes:if(i.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+i.remaining()+" bytes remaining");return n.calculateVarint32(i.remaining())+i.remaining();case t.TYPES.message:return r=this.resolvedType.calculate(i),n.calculateVarint32(r)+r;case t.TYPES.group:return(r=this.resolvedType.calculate(i))+n.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+i+" (unknown type)")},c.encodeValue=function(e,i,r){var o,s;if(null===i)return r;switch(this.type){case t.TYPES.int32:i<0?r.writeVarint64(i):r.writeVarint32(i);break;case t.TYPES.uint32:r.writeVarint32(i);break;case t.TYPES.sint32:r.writeVarint32ZigZag(i);break;case t.TYPES.fixed32:r.writeUint32(i);break;case t.TYPES.sfixed32:r.writeInt32(i);break;case t.TYPES.int64:case t.TYPES.uint64:r.writeVarint64(i);break;case t.TYPES.sint64:r.writeVarint64ZigZag(i);break;case t.TYPES.fixed64:r.writeUint64(i);break;case t.TYPES.sfixed64:r.writeInt64(i);break;case t.TYPES.bool:"string"==typeof i?r.writeVarint32("false"===i.toLowerCase()?0:!!i):r.writeVarint32(i?1:0);break;case t.TYPES.enum:r.writeVarint32(i);break;case t.TYPES.float:r.writeFloat32(i);break;case t.TYPES.double:r.writeFloat64(i);break;case t.TYPES.string:r.writeVString(i);break;case t.TYPES.bytes:if(i.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+i.remaining()+" bytes remaining");o=i.offset,r.writeVarint32(i.remaining()),r.append(i),i.offset=o;break;case t.TYPES.message:s=(new n).LE(),this.resolvedType.encode(i,s),r.writeVarint32(s.offset),r.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(i,r),r.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+i+" (unknown type)")}return r},c.decode=function(e,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(r=e.clone()).limit=r.offset+o,e.offset+=o,r;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,i)}throw Error("[INTERNAL] Illegal decode type")},c.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return n.fromBinary(e)}},c.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},T.Element=a,u=function(e,t,n,i,r,s){o.call(this,e,t,n,i,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!r,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(h=u.prototype=Object.create(o.prototype)).build=function(i){var r,o,s,a;if(this.clazz&&!i)return this.clazz;for(r=function(t,i){function r(e,i,o,s){var a,c,u,h,l,d,f;if(null===e||"object"!=typeof e)return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(n.isByteBuffer(e))return i?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(e,t){c[t]=r(e,i,o,s)})),c;if(c={},e instanceof t.Map){for(h=(u=e.entries()).next();!h.done;h=u.next())c[e.keyElem.valueToString(h.value[0])]=r(h.value[1],i,o,e.valueElem.resolvedType);return c}for(f in l=e.$type,d=void 0,e)e.hasOwnProperty(f)&&(c[f]=l&&(d=l.getChild(f))?r(e[f],i,o,d.resolvedType):r(e[f],i,o));return c}var o,s,a=i.getChildren(t.Reflect.Message.Field),c=i.getChildren(t.Reflect.Message.OneOf),u=function(e){var r,o,s,h;for(t.Builder.Message.call(this),r=0,o=c.length;o>r;++r)this[c[r].name]=null;for(r=0,o=a.length;o>r;++r)this[(s=a[r]).name]=s.repeated?[]:s.map?new t.Map(s):null,!s.required&&"proto3"!==i.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof u)||Array.isArray(e)||e instanceof t.Map||n.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(r=0,o=arguments.length;o>r;++r)void 0!==(h=arguments[r])&&this.$set(a[r].name,h);else this.$set(e)},h=u.prototype=Object.create(t.Builder.Message.prototype);for(h.add=function(e,n,r){var o=i._fieldsByName[e];if(!r){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");n=o.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},h.$add=h.add,h.set=function(e,n,r){var o,s,a;if(e&&"object"==typeof e){for(o in r=n,e)e.hasOwnProperty(o)&&void 0!==(n=e[o])&&this.$set(o,n,r);return this}if(s=i._fieldsByName[e],r)this[e]=n;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=n=s.verifyValue(n)}return s&&s.oneof&&(a=this[s.oneof.name],null!==n?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},h.$set=h.set,h.get=function(e,n){if(n)return this[e];var r=i._fieldsByName[e];if(!(r&&r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));return this[r.name]},h.$get=h.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||i.builder.options.populateAccessors&&function(e){var t,n,r,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),n=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},r=function(){return this[e.name]},null===i.getChild("set"+o)&&(h["set"+o]=n),null===i.getChild("set_"+t)&&(h["set_"+t]=n),null===i.getChild("get"+o)&&(h["get"+o]=r),null===i.getChild("get_"+t)&&(h["get_"+t]=r)}(s);return h.encode=function(t,n){var r,o;"boolean"==typeof t&&(n=t,t=void 0),r=!1,t||(t=new e,r=!0),o=t.littleEndian;try{return i.encode(this,t.LE(),n),(r?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},u.encode=function(e,t,n){return new u(e).encode(t,n)},h.calculate=function(){return i.calculate(this)},h.encodeDelimited=function(e){var t,r=!1;return e||(e=new n,r=!0),t=(new n).LE(),i.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),r?e.flip():e},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return r(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},u.decode=function(e,t){var r,o;"string"==typeof e&&(e=n.wrap(e,t||"base64")),r=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return o=i.decode(e.LE()),e.LE(r),o}catch(t){throw e.LE(r),t}},u.decodeDelimited=function(e,t){var r,o,s;if("string"==typeof e&&(e=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(r=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=r,null;try{return s=i.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,t}},u.decode64=function(e){return u.decode(e,"base64")},u.decodeHex=function(e){return u.decode(e,"hex")},u.decodeJSON=function(e){return new u(JSON.parse(e))},h.toString=function(){return i.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:i.buildOpt()}),Object.defineProperty(h,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:i}),Object.defineProperty(h,"$type",{value:i})),u}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof g||o instanceof u||o instanceof v){if(r.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");r[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},h.encode=function(e,t,n){var i,r,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)r=e[(i=this._fields[o]).name],i.required&&null===r?null===c&&(c=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,a;return t},h.calculate=function(e){for(var t,n,i=0,r=0,o=this._fields.length;o>r;++r){if(n=e[(t=this._fields[r]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);i+=t.calculate(n,e)}return i},h.decode=function(e,n,i){var o,s,a,c,u,h,l,d,f,p,g,_;for(n="number"==typeof n?n:-1,u=e.offset,h=new this.clazz;e.offset<u+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.WIRE_TYPES.ENDGROUP){if(a!==i)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(i?i+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?h[c.name].push(c.decode(s,e)):c.map?(d=c.decode(s,e),h[c.name].set(d[0],d[1])):(h[c.name]=c.decode(s,e),c.oneof&&(null!==(f=h[c.oneof.name])&&f!==c.name&&(h[f]=null),h[c.oneof.name]=c.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:l=e.readVarint32(),e.offset+=l;break;case t.WIRE_TYPES.STARTGROUP:for(;r(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(p=0,g=this._fields.length;g>p;++p)if(null===h[(c=this._fields[p]).name])if("proto3"===this.syntax)h[c.name]=c.defaultValue;else{if(c.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=h,_;t.populateDefaults&&null!==c.defaultValue&&(h[c.name]=c.defaultValue)}return h},T.Message=u,l=function(e,n,i,r,o,s,a,c,h,l){I.call(this,e,n,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=h||null,this.syntax=l||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=l.prototype=Object.create(I.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)},d.verifyValue=function(e,n){var i,r,o;if(n=n||!1,i=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&&i(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&i(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],r=0;r<e.length;r++)o.push(this.element.verifyValue(e[r]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||i(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&i(typeof e,"no array expected"),this.element.verifyValue(e))},d.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},d.encode=function(e,i,r){var o,s,a,c,u;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return i;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i.ensureCapacity(i.offset+=1),s=i.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],i);a=i.offset-s,(c=n.calculateVarint32(a))>1&&(u=i.slice(s,i.offset),s+=c-1,i.offset=s,i.append(u)),i.writeVarint32(a,s-c)}else for(o=0;o<e.length;o++)i.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],i);else this.map?e.forEach((function(e,r){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i.writeVarint32(o),i.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,i),i.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,i)}),this):this.hasWirePresence(e,r)&&(i.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,i))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},d.calculate=function(e,i){var r,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;r=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);r+=n.calculateVarint32(s),r+=s}else for(o=0;o<e.length;o++)r+=n.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,i){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r+=n.calculateVarint32(o),r+=o}),this):this.hasWirePresence(e,i)&&(r+=n.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},d.decode=function(e,n,i){var r,o,s,c,u,h,l;if(!(!this.map&&e==this.type.wireType||!i&&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&&!i){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(c=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(e=7&(h=u.readVarint32()),1==(l=h>>>3))c=this.keyElement.decode(u,e,l);else{if(2!==l)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(u,e,l)}return[c,r]}return this.element.decode(n,e,this.id)},T.Message.Field=l,f=function(e,t,n,i,r,o,s){l.call(this,e,t,n,null,i,r,o,s),this.extension},f.prototype=Object.create(l.prototype),T.Message.ExtensionField=f,p=function(e,t,n){I.call(this,e,t,n),this.fields=[]},T.Message.OneOf=p,g=function(e,t,n,i,r){o.call(this,e,t,n,i,r),this.className="Enum",this.object=null},g.getName=function(e,t){var n,i,r=Object.keys(e);for(i=0;i<r.length;++i)if(e[n=r[i]]===t)return n;return null},(g.prototype=Object.create(o.prototype)).build=function(e){var n,i,r,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,r=0,o=(i=this.getChildren(g.Value)).length;o>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},T.Enum=g,_=function(e,t,n,i){I.call(this,e,t,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(I.prototype),T.Enum.Value=_,m=function(e,t,n,i){I.call(this,e,t,n),this.field=i},m.prototype=Object.create(I.prototype),T.Extension=m,v=function(e,t,n,i){o.call(this,e,t,n,i),this.className="Service",this.clazz=null},(v.prototype=Object.create(o.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var i,r=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=r.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(i=0;i<s.length;i++)!function(e){o[e.name]=function(i,r){try{try{i=e.resolvedRequestType.clazz.decode(n.wrap(i))}catch(e){if(!(e instanceof TypeError))throw e}if(null===i||"object"!=typeof i)throw Error("Illegal arguments");i instanceof e.resolvedRequestType.clazz||(i=new e.resolvedRequestType.clazz(i)),this.rpcImpl(e.fqn(),i,(function(n,i){if(!n){try{i=e.resolvedResponseType.clazz.decode(i)}catch(e){}return i&&i instanceof e.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+t.name+"#"+e.name))}r(n)}))}catch(e){setTimeout(r.bind(this,e),0)}},r[e.name]=function(t,n,i){new r(t)[e.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:r[e.name].$options}))}(s[i]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),r}(t,this)},T.Service=v,E=function(e,t,n,i){I.call(this,e,t,n),this.className="Service.Method",this.options=i||{}},(E.prototype=Object.create(I.prototype)).buildOpt=s.buildOpt,T.Service.Method=E,y=function(e,t,n,i,r,o,s,a){E.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},y.prototype=Object.create(E.prototype),T.Service.RPCMethod=y,T}(r),r.Builder=function(e,t,n){function i(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,i(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var r=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=r.prototype;return r.isMessage=function(e){return"string"==typeof e.name&&void 0===e.values&&void 0===e.rpc},r.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},r.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},r.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},r.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var i,o,s,a,c;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(i=[t];i.length>0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),r.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),c=[],o.enums&&o.enums.forEach((function(e){c.push(e)})),o.messages&&o.messages.forEach((function(e){c.push(e)})),o.services&&o.services.forEach((function(e){c.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){i.push(t),t=c,c=null,this.ptr=s,s=null;continue}c=null}else if(r.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(r.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!r.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var i,r,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(i=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");r=t.name,this.options.convertFieldsToCamelCase&&(r=e.Util.toCamelCase(r)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+r,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var r,o,s,a,c,u,h,l,d="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(r=n.root,e.Util.IS_NODE,(r.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=r+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[c]))continue;if(u=s+d+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(h=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(h+""),u):this.import(e.DotProto.Parser.parse(h),u)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+c+"."+n}))):this.import(t.imports[c],n+"_import"+c):this.import(t.imports[c]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&i(t),l=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){l.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=l),t.enums&&(this.create(t.enums),this.ptr=l),t.services&&(this.create(t.services),this.ptr=l),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var i;if(null==this.ptr||"object"==typeof 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(!(i=(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=i,i instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==i.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(i instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=i.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(!((i=this.ptr.parent.resolve(this.ptr.requestName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=i,!((i=this.ptr.parent.resolve(this.ptr.responseName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}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: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,i;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,i=0;i<t.length;i++){if(!n[t[i]]){n=null;break}n=n[t[i]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(r,r.Lang,r.Reflect),r.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 i=function(e,n){var i,r,o,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(i=Object.keys(n),r=0;r<i.length;r++)o=this.keyElem.valueFromString(i[r]),s=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},r.entries=function(){var e,t,i=[],r=Object.keys(this.map);for(t=0;t<r.length;t++)i.push([(e=this.map[r[t]]).key,e.value]);return n(i)},r.keys=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].key);return n(t)},r.values=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].value);return n(t)},r.forEach=function(e,t){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)e.call(t,(n=this.map[r[i]]).value,n.key,this)},r.set=function(e,t){var n=this.keyElem.verifyValue(e),i=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},r.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,r.Reflect),r.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),r.loadJson(r.DotProto.Parser.parse(e),t,n)},r.protoFromString=r.loadProto,r.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return r.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,r.loadProto(i,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=r.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:r.loadProto(i,n,e)},r.protoFromFile=r.loadProtoFile,r.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=r.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=r.populateAccessors),new r.Builder(e)},r.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=r.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},r.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return r.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,r.loadJson(JSON.parse(i),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=r.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:r.loadJson(JSON.parse(i),n,e)},i=vr,r.loadProto(i,void 0,"").build("Modules").probuf}(yr,Er),Tr);Sr.getModule=function(e){var t=new Sr[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=$(e)?[].slice.call(new Int8Array(e)):e},t};var Nr,Or,Mr="pgMsgP",Ar="chatMsg",Ur="pcMsgP",wr={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Lr="delMsg",br="joinChrm",Pr="joinChrmR",Dr="exitChrm",Vr="setKV",kr="delKV",xr="setKVS",Gr="delKVS",Br="qryRelationR",Fr="delRelation",Kr="setSeAtt",Hr={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},qr="qryPMsg",Yr="qryGMsg",jr="qryCHMsg",Qr="qryCMsg",Wr="qrySMsg",Jr=((Ir={})["ppMsgP"]=j.PRIVATE,Ir[Mr]=j.GROUP,Ir[Ar]=j.CHATROOM,Ir[Ur]=j.CUSTOMER_SERVICE,Ir),zr=((Cr={})[j.PRIVATE]=qr,Cr[j.GROUP]=Yr,Cr[j.CHATROOM]=jr,Cr[j.CUSTOMER_SERVICE]=Qr,Cr[j.SYSTEM]=Wr,Cr),Zr=((Rr={})[j.PRIVATE]=Hr.PRIVATE,Rr[j.GROUP]=Hr.GROUP,Rr[j.ULTRA_GROUP]=Hr.ULTRA_GROUP,Rr[j.CUSTOMER_SERVICE]=Hr.CUSTOMER_SERVICE,Rr[j.SYSTEM]=Hr.SYSTEM,Rr),Xr="1",$r="0",eo=1,to=2,no=3,io=function(){function e(e){this._codec="websocket"===e?Sr:pr,this._connectType=e}return e.prototype.decodeByPBName=function(e,t,n){var i,r=this,o=e,s=((i={})[yn]=r._formatSyncMessages,i[En]=r._formatReceivedMessage,i[mn]=r._formatSentMessage,i[On]=r._formatHistoryMessages,i[An]=r._formatConversationList,i[Bn]=r._formatChatRoomInfos,i[Kn]=r._formatRTCUserList,i[zn]=r._formatRTCData,i[fi]=r._formatChatRoomKVList,i[Ti]=r._formatUserSetting,i[Ri]=r._formatConversationStatus,i[Pi]=r._formatGrpReadReceiptQryResp,i[Ei]=r._formatSetUserSettingOutput,i[Ii]=r._formatUserSettingNotification,i[Qi]=r._formatUltraMsgChangeList,i[Xi]=r._formatUltraOperateStatusNotifyList,i[zi]=r._formatUltraMsgList,i[xn]=r._formatChrmKVVersion,i[ir]=r._formatRTCRoomKVList,i[Jn]=r._formatRTCAuidenceJoinRoomData,i[or]=r._formatRTCJoinedUserInfo,i)[t];try{o=e.length>0&&r._codec[t].decode(e),ne(o)&&(o=function(e){for(var t in e)ne(e[t])&&(e[t]=qt(e[t]));return e}(o)),ie(s)&&(o=s.call(this,o,n))}catch(n){At.error("PB parse error\n",n,e,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,i=e.limit;if(t)try{var r=$(n)?new Uint8Array(n):n;return pn.readUTF(r.subarray(t,i))}catch(e){At.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){At.info("formatBytes error\n",e)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,i=e.list,r=e.syncTime,o=e.finished;return(re(o)||null===o)&&(e.finished=!0),e.syncTime=qt(r),e.list=Xt(i,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var i=(t=t||{}).currentUserId,r=t.connectedTime,o=e.content,s=e.fromUserId,a=e.type,c=e.groupId,u=e.status,h=e.dataTime,l=e.classname,d=e.msgId,f=e.extraContent,p=e.pushContent,g=e.pushExt,_=e.configFlag,m=e.extStatus;e.toUserId,e.groupUnpush;var v=(e.direction||de.RECEIVE)===de.SEND,E=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)}}(u),y=E.isPersited,T=E.isCounted,I=E.isMentioned,C=E.disableNotification,R=E.receivedStatus,S=E.canIncludeExpansion,N=!!(2&(m||0)),O=!!(4&(m||0)),M=[j.GROUP,j.CHATROOM,j.RTC_ROOM,j.ULTRA_GROUP].indexOf(a)>-1?c:s,A=v?i:s,U=qt(h),w=U<r,L=a===j.CHATROOM,b=this._formatBytes(o),D={};if(g&&(D=Wt(g.pushConfigs,g.pushId)),b.user){var V=b.user,k=V.portrait,x=V.portraitUri,G=k||x;G&&(b.user.portrait=b.user.portraitUri=G)}var B,F=P(P({},D),{pushTitle:null==g?void 0:g.title,pushContent:p,pushData:p,disablePushTitle:!!_&&Boolean(4&_),forceShowDetailContent:!!_&&Boolean(8&_),templateId:null==g?void 0:g.templateId}),K=v?de.SEND:de.RECEIVE;L&&s===i&&(K=de.SEND),f&&(B={},B=un(f));var H={conversationType:a,targetId:M,senderUserId:A,messageType:l,messageUId:d,isPersited:y,isCounted:T,isMentioned:I,sentTime:U,messageDirection:K,receivedTime:hn.getTime(),disableNotification:C,receivedStatus:R,canIncludeExpansion:S,content:b,expansion:B,configFlag:_,pushConfig:F,channelId:e.busChannel||"",isInterrupt:N,isModifyMessage:O};return a!==j.ULTRA_GROUP&&(H.isOffLineMessage=w),H},e.prototype._formatSentMessage=function(e,t){var n,i=e.content,r=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,c=e.pushExt,u=e.pushContent,h=e.configFlag,l=e.extStatus,d=t.signal,f=t.currentUserId,p=d.date,g=d.topic,_=d.targetId,m=!!(2&(l||0)),v=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),E=v.isPersited,y=v.isCounted,T=v.disableNotification,I=v.canIncludeExpansion,C=Jr[g]||j.PRIVATE,R=tn(wr,g),S=this._formatBytes(i),N=_;r===Ee.RECALL&&(C=S.conversationType||C,N=S.targetId||_),a&&(n={},n=un(a));var O={};c&&(O=Wt(c.pushConfigs,c.pushId));var M=P(P({},O),{pushTitle:null==c?void 0:c.title,pushContent:u,pushData:u,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==c?void 0:c.templateId});return{conversationType:C,targetId:N,messageType:r,messageUId:s,isPersited:E,isCounted:y,isStatusMessage:R,senderUserId:f,content:this._formatBytes(i),sentTime:1e3*p,receivedTime:hn.getTime(),messageDirection:de.SEND,isOffLineMessage:!1,disableNotification:T,canIncludeExpansion:I,expansion:n,pushConfig:M,channelId:e.busChannel||"",isInterrupt:m}},e.prototype._formatHistoryMessages=function(e,t){var n=this,i=t.conversation||{},r=e.list,o=e.hasMsg,s=i.targetId,a=qt(e.syncTime),c=[];return Zt(r,(function(e){var r=n._formatReceivedMessage(e,t);i.conversationType===j.ULTRA_GROUP?r.targetId=e.groupId||i.targetId:r.targetId=s,c.push(r)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,i=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,i=e.time,r=e.changeType,o=e.msgUID,s=e.msgTime,a=e.busChannel,c=e.isAdmin,u=e.isDel,h=e.operatorId;return{targetId:t,conversationType:n,changeType:r,messageUId:o,changeTime:qt(i),sendTime:qt(s),channelId:a,isAdmin:c,isDel:u,operatorId:h}})),hasNext:i}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,i=e.info,r=e.summary,o=[],s=[],a=2==(2&n),c=1==(1&n);return c&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.userId,r=e.opType,s=e.optime,a=qt(s);o.push({targetId:t,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.count,r=e.opType;s.push({targetId:t,channelId:n,count:i,operationType:r})})),{conversationType:t,info:o,summary:s,hasInfo:c,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,i=e.list;return{list:i&&i.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatConversationList=function(e,t){var n=this,i=e.info,r=t.afterDecode||function(){},o={list:(i=Xt(i,(function(e){var i=e.msg,o=e.userId,s=e.type,a=e.unreadCount,c=e.busChannel,u=e.versionTime,h=e.remindCount,l=null;i&&((l=n._formatReceivedMessage(i,t)).targetId=o);var d={targetId:o,conversationType:s,unreadMessageCount:qt(a)||0,latestMessage:l||{},channelId:c||""};return s===j.ULTRA_GROUP&&(d.versionTime=qt(u)||0,d.unreadMentionedCount=qt(h)||0),r(d)||d})))||[]};return((null==t?void 0:t.conversationType)||j.NONE)===j.ULTRA_GROUP&&(o.isFinished=e.isFinished),o},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:Xt(n,(function(e){var t=e.id,n=e.time;return{id:t,time:qt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return t=Xt(t=t||[],(function(e){var t=e.key,n=e.value,i=e.status,r=e.timestamp,o=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?Le.DELETE:Le.UPDATE}}(i);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:qt(r),version:qt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:i}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,i=e.version,r={};return Zt(n||[],(function(e){var n=e.key,i=e.version,o=e.value;e.version=qt(i),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=qt(e.createdTime),e.tagName=e.name})),r[n]=e})),{settings:r,version:i}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return Zt(t,(function(e){var t=e.type,i=e.channelId,r=e.time,o=e.stateItem,s=e.busChannel,a=Te.CLOSE,c=Ce.NOT_SET,u=!1,h=[];Zt(o,(function(e){var t=e.sessionStateType,n=e.value,i=e.tags;switch(t){case eo:a=n===Xr?Te.OPEN:Te.CLOSE,c=Number(n)||Ce.NOT_SET;break;case to:u=n===Xr;break;case no:h=i}})),n.push({conversationType:t,type:t,targetId:i,notificationStatus:a,notificationLevel:c,isTop:u,updatedTime:qt(r),tags:h,channelId:s||""})})),n},e.prototype._formatRTCUserList=function(e){var t=e.users,n=e.token,i=e.sessionId,r=e.roomInfo,o=e.entries,s=e.offlineKickTime,a={};return Zt(t,(function(e){var t=e.userId,n=e.userData,i={};Zt(n,(function(e){var t=e.key,n=e.value;i[t]=n})),a[t]=i})),{users:a,token:n,sessionId:i,roomInfo:r,kvEntries:o,offlineKickTime:s}},e.prototype._formatRTCData=function(e){var t=e.outInfo,n={};return Zt(t,(function(e){n[e.key]=e.value})),n},e.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,n=e.userCount,i=e.roomData,r={id:t,total:n};return Zt(i,(function(e){r[e.key]=e.value})),r},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=qt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatRTCRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return{kvEntries:t=(t=t||[]).map((function(e){var t=e.timestamp;return Object.assign(e,{timestamp:qt(t)})})),isFullUpdate:n,syncTime:i}},e.prototype._formatChrmKVVersion=function(e){return e},e.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:qt(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Tn);return e.setNothing(1),e.getArrayData()},e.prototype._getUpMsgModule=function(e,t){var n,i,r,o="comet"===this._connectType,s=e.conversationType,a=t.messageType,c=t.isMentioned,u=t.mentionedType,h=t.mentionedUserIdList,l=t.content,d=t.pushContent,f=t.pushData,p=t.directionalUserIdList,g=t.isFilerWhiteBlacklist,_=t.isVoipPush,m=t.canIncludeExpansion,v=t.expansion,E=t.pushConfig,y=t.channelId;[j.GROUP,j.ULTRA_GROUP].includes(s);var T=this._codec.getModule(mn),I=function(e){var t=e.isStatusMessage,n=e.isPersited,i=e.isCounted;t&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),e.isMentioned&&(r|=4),e.disableNotification&&(r|=32),e.canIncludeExpansion&&(r|=64),r}(t),C=E||{},R=C.pushTitle,S=C.pushContent,N=C.pushData,O=C.iOSConfig,M=C.androidConfig,A=C.templateId,U=C.disablePushTitle,w=C.forceShowDetailContent,L=0;T.setSessionId(I),c&&l&&(l.mentionedInfo={userIdList:(null===(n=l.mentionedInfo)||void 0===n?void 0:n.userIdList)||h||[],type:(null===(i=l.mentionedInfo)||void 0===i?void 0:i.type)||u||Se.ALL,mentionedContent:(null===(r=l.mentionedInfo)||void 0===r?void 0:r.mentionedContent)||""});var b=S||d||"",P=N||f||"";if(b&&T.setPushText(b),P&&T.setAppData(P),p&&T.setUserId(p),L|=_?1:0,L|=g?2:0,L|=U?4:0,L|=w?8:0,T.setConfigFlag(L),T.setClassname(a),l.user&&l.user.portraitUri&&(l.user.portrait=l.user.portraitUri),T.setContent(JSON.stringify(l)),m&&v){var D={};Zt(v,(function(e,t){D[t]={v:e}})),T.setExtraContent(JSON.stringify(D))}if(E){var V=this._codec.getModule(vn);if(R&&V.setTitle(R),O&&M){var k=Qt(O,M);V.setPushConfigs(k)}(null==M?void 0:M.notificationId)&&V.setPushId(null==M?void 0:M.notificationId),V.setTemplateId(A||""),T.setPushExt(o?V.getArrayData():V)}return re(y)||T.setBusChannel(y),T},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,i=e.broadcastSyncTime,r=this._codec.getModule(Cn);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Rn);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,i=t.order,r=t.timestamp,o=t.channelId,s=this._codec.getModule(Nn);return s.setTargetId(e),s.setTime(r),s.setCount(n),s.setOrder(i),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(Hi);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,i=this._codec.getModule(Mn);return i.setType(1),i.setCount(t),i.setStartTime(n),i.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,i=e.startTime,r=e.order;t=t||0,i=i||0,r=r||0;var o=this._codec.getModule(Mn);return o.setType(n),o.setCount(t),o.setStartTime(i),o.setOrder(r),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,i=this._codec.getModule(bn);return i.setType(t),n&&i.setBusChannel([n]),i.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(Un),i=[];return Zt(e,(function(e){var n=e.conversationType,r=e.targetId,o=t._codec.getModule(wn);o.setType(n),o.setChannelId(r),i.push(o)})),n.setSessions(i),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,i){var r=this._codec.getModule(Pn),o=[];return Zt(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(o),r.setBusChannel(i),r.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,i){var r=this._codec.getModule(Dn);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,i=e.targetId,r=e.channelId,o=t.timestamp,s=this._codec.getModule(Vn);return o=o||+new Date,s.setType(n),s.setChannelId(i),s.setMsgTime(o),s.setBusChannel(r),s.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.keys,c={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},u=this._codec.getModule(qi);return u.setFromUserId(t),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(c)),u.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.content,c=this._codec.getModule(qi);return c.setFromUserId(t),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(a)),c.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(Yi);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,i=e.messages,r=this._codec.getModule(Wi),o=i.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return r.setTargetId(t),r.setType(n),r.setQuery(o),r.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,i){var r=this._codec.getModule(Zi);return r.setTargetId(e),r.setType(t),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(kn);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Gn);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(Ui);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(Ai);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,i){var r=this._codec.getModule(ii);return r.setType(e),r.setKey(t),r.setHttpMethod(n),r.setQueryString(i),r.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,i){var r=this._codec.getModule(e);return r.setType(t),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var i="comet"===this._connectType,r=this._codec.getModule(hi),o=t.key,s=t.value,a=t.notificationExtra,c=t.isSendNotification,u=t.type,h=t.timestamp,l=u||Le.UPDATE,d=ln(t,l),f={key:o,value:s||"",uid:n,version:h};if(re(d)||(f.status=d),r.setEntry(f),c){var p={conversationType:j.CHATROOM,targetId:e},g={key:o,value:s,extra:a,type:l},_=this._getUpMsgModule(p,{messageType:Ee.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});i?r.setNotification(_.getArrayData()):r.setNotification(_),r.setBNotify(!0),r.setType(j.CHATROOM)}return r.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){this._connectType;var i=this._codec.getModule(li),r=t.entries,o=t.type||Le.UPDATE,s=ln(t,o),a=[];return r.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};re(s)||(t.status=s),a.push(t)})),i.setEntry(a),i.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(mi);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(yi);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Ci);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(Oi),o=hn.getTime(),s=[];return Zt(e,(function(e){var t=n._codec.getModule(Si),r=e.conversationType,a=e.targetId,c=e.notificationStatus,u=e.isTop,h=e.channelId,l=e.notificationLevel,d=[];t.setType(r),t.setChannelId(a),t.setTime(o),t.setBusChannel(h);var f=c===Te.OPEN,p={};re(c)||(p[eo]=f),re(l)||(p[eo]=l),re(u)||(p[to]=u),Zt(p,(function(e,t){if(!re(e)){var r=n._codec.getModule(Ni);e=e?Xr:$r,re(l)||Number(t)!==eo||(e=String(l)),r.setSessionStateType(Number(t)),r.setValue(e);var o=i?r.getArrayData():r;d.push(o)}})),t.setStateItem(d);var g=i?t.getArrayData():t;s.push(g)})),r.setVersion(t||o),r.setState(s),r.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(Li);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(Vi),o=[];return e.forEach((function(e){var t=n._codec.getModule(ki);t.setTagId(e.tagId),t.setName(e.tagName),o.push(i?t.getArrayData():t)})),r.setTags(o),r.setVersion(t),r.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(Li);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(xi),o=[];return e.forEach((function(e){var t=n._codec.getModule(ki);t.setTagId(e),o.push(i?t.getArrayData():t)})),r.setTags(o),r.setVersion(t),r.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(Gi);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(Oi),o=[];return t.forEach((function(t){var r=n._codec.getModule(Si),s=n._codec.getModule(Ni),a=[];e.forEach((function(e){var t=n._codec.getModule(ki);t.setTagId(e.tagId),re(e.isTop)||t.setIsTop(e.isTop),a.push(i?t.getArrayData():t)})),s.setSessionStateType(no),s.setValue(JSON.stringify(a)),s.setTags(a),r.setType(t.conversationType),r.setChannelId(t.targetId),r.setTime(Date.now()),r.setStateItem([i?s.getArrayData():s]),o.push(i?r.getArrayData():r)})),r.setState(o),r.setVersion(hn.getTime()),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Bi);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(Ki);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodeJoinRTCRoom=function(e,t,n,i,r){var o=this,s="comet"===this._connectType,a=this._codec.getModule(Fn);if(e=e||0,a.setRoomType(e),re(t)||a.setBroadcastType(t),re(n)||a.setJoinType(n),i){var c=[],u=this._codec.getModule(ti);for(var h in i)u.setKey(h),u.setValue(i[h]),s?c.push(u.getArrayData()):c.push(u);a.setInnerDatas(c)}if(r){var l=[];Object.keys(r).forEach((function(e){var t=o._codec.getModule(ti);t.setKey(e),t.setValue(r[e]),s?l.push(t.getArrayData()):l.push(t)})),a.setOuterDatas(l)}return a.getArrayData()},e.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(Hn).getArrayData()},e.prototype.encodeSetRTCData=function(e,t,n,i,r){var o=this._codec.getModule(qn);if(o.setInterior(n),o.setTarget(i),o.setKey(e),o.setValue(t),r){r.name&&o.setObjectName(r.name);var s=r.content;s&&(ne(s)&&(s=JSON.stringify(s)),o.setContent(s))}return o.getArrayData()},e.prototype.encodeUserSetRTCData=function(e,t,n,i){var r=this,o="comet"===this._connectType,s=this._codec.getModule(Yn);s.setObjectName(n);var a=this._codec.getModule(ti);a.setKey(e.name),a.setValue(e.content),o?s.setContent(a.getArrayData()):s.setContent(a);var c=[];return["uris","mcu_uris"].forEach((function(e){var n=r._codec.getModule(ti);n.setKey(e);var s="uris"===e?t:i;n.setValue(s),o?c.push(n.getArrayData()):c.push(n)})),s.setValueInfo(c),s.getArrayData()},e.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var n=this._codec.getModule(Yn);n.setObjectName(e);var i=this._codec.getModule(ti);return i.setKey("cdn_uris"),i.setValue(t),n.setValueInfo(i),n.getArrayData()},e.prototype.encodeGetRTCData=function(e,t,n){var i=this._codec.getModule(jn);return i.setInterior(t),i.setTarget(n),i.setKey(e),i.getArrayData()},e.prototype.encodeRemoveRTCData=function(e,t,n,i){var r=this._codec.getModule(jn);r.setInterior(t),r.setTarget(n),r.setKey(e);var o=(i=i||{}).name,s=i.content;return!re(o)&&r.setObjectName(o),re(s)||(ne(s)&&(s=JSON.stringify(s)),r.setContent(s)),r.getArrayData()},e.prototype.encodeSetRTCOutData=function(e,t,n){var i=this._codec.getModule(Qn);i.setTarget(t),X(e)||(e=[e]),Zt(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})),i.setValueInfo(e);var r=(n=n||{}).name,o=n.content;return!re(r)&&i.setObjectName(r),re(o)||(ne(o)&&(o=JSON.stringify(o)),i.setContent(o)),i.getArrayData()},e.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(Zn);return t.setUserId(e),t.getArrayData()},e.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(Wn);return t.setState(e),t.getArrayData()},e.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule($n);return e.setOrder(2),e.getArrayData()},e.prototype.encodeSetRTCUserInfo=function(e,t){var n=this._codec.getModule(ti);return n.setKey(e),n.setValue(t),n.getArrayData()},e.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(ni);return t.setKey(e),t.getArrayData()},e.prototype.encodeIdentityChangeInfo=function(e,t,n){void 0===n&&(n=!1);var i=this._codec.getModule(Fn);return i.setRoomType(ke.LIVE),t&&i.setBroadcastType(t),i.setIdentityChangeType(e),i.setNeedSysChatroom(n),i.getArrayData()},e.prototype.encodePullRTCRoomKV=function(e,t){var n=this._codec.getModule(nr);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()},e.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(rr);return t.setUserId(e),t.getArrayData()},e.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteTimeout,o=e.inviteInfo,s=this._codec.getModule(ar);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(i),s.setTimeoutTime(r),s.setInviteInfo(o),s.getArrayData()},e.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteInfo,o=this._codec.getModule(cr);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(i),o.setInviteInfo(r),o.getArrayData()},e.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,n=e.inviteRoomId,i=e.inviteSessionId,r=e.content,o=e.key,s=e.value,a=e.agree?1:0,c=this._codec.getModule(ur);return c.setInviteUserId(t),c.setInviteRoomId(n),c.setInviteSessionId(i),c.setContent(r),c.setKey(o),c.setValue(s),c.setAnswerCode(a),c.getArrayData()},e.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,n=e.sessionId,i=e.content,r=e.keys,o=this._codec.getModule(hr);return o.setInviteRoomId(t),o.setInviteSessionId(n),o.setInviteContent(i),o.setInviteRoomKeys(r),o.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(lr);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e}(),ro=function(e,t){this._watcher=t,this.codec=new io(e)};function oo(e,t,n){if(e&<){var i=nt($e(Me.STATISTICS),e,t,n);return lt.reportRealtimeLog([i]).then((function(){ft(Ue.G_UPLOAD_LOG_S,"big data realtime report success")})).catch((function(e){ft(Ue.G_UPLOAD_LOG_E,"big data realtime report error -> "+e)}))}}!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Nr||(Nr={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Or||(Or={}));var so,ao,co={},uo={sdkPrivate:Nr.OPEN,serverPrivate:Nr.OPEN,bundleId:"lib-next"};function ho(e){uo.sdkPrivate=e.sdkPrivate===Nr.PRIVATE?Nr.PRIVATE:Nr.OPEN,uo.serverPrivate=e.serverPrivate===Nr.PRIVATE?Nr.PRIVATE:Nr.OPEN,e.bundleId&&(uo.bundleId=e.bundleId)}function lo(){return uo}function fo(e,t,n){void 0===t&&(t={}),void 0===n&&(n=!1),ne(t)&&e&&(co[e]&&!n||(co[e]={}),co[e]=P(P({},co[e]),t))}function po(e){return co[e]||{}}!function(e){e.GET="GET",e.POST="POST"}(so||(so={})),function(e){e.WIFI="wifi",e.FOUR_G="4g",e.THREE_G="3g",e.TWO_G="2g",e.FIVE_G="2g",e.THREE_GENT="3gnet",e.UNKONWN="unknown"}(ao||(ao={}));var go,_o=function(e,t){return e&&t?t+"_"+e:e||Date.now()},mo=function(){function e(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return _o(e,t)},e.prototype.read=function(e,t,n){this.readMessage(e,t,n)},e.prototype.readMessage=function(e,t,n){return{stream:e,length:t}},e}(),vo=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new fn(e,!1,Dt.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return _o(e,t)},e.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getLengthSize=function(){return this.lengthSize},e.prototype.getBufferData=function(){var e=new _n;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),Eo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=kt.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return b(t,e),t.prototype.readMessage=function(e,n,i){if(e.readByte(),this.status=+e.readByte(),n<=t.MESSAGE_LENGTH)return{stream:e,length:n};if(i===Gt.V4){var r=e.readByte();1&r&&(this.userId=e.readUTF()),2&r&&e.readUTF(),4&r&&(this.timestamp=e.readLong()),8&r&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var o=e.readUTF();At.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(mo),yo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=kt.DISCONNECT,t.status=0,t}return b(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(mo),To=function(e){function t(){var t=e.call(this,Vt.PING_REQ)||this;return t._name=kt.PING_REQ,t}return b(t,e),t.prototype.writeMessage=function(e){},t}(vo),Io=function(e){function t(t){var n=e.call(this,t)||this;return n._name=kt.PING_RESP,n}return b(t,e),t}(mo),Co=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return b(t,e),t.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},t}(mo),Ro=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return b(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,i=(65280&t)>>8;e.write(i),e.write(n)},t}(vo),So=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=kt.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=xt.PUB,t}return b(t,e),t.prototype.readMessage=function(t,n){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.data=t.readAll(),{stream:t,length:n}},t}(Co),No=function(e){function t(t,n,i){var r=e.call(this,Vt.PUBLISH)||this;return r._name=kt.PUBLISH,r.syncMsg=!1,r.identifier=xt.PUB,r.topic=t,r.data=J(n)?pn.writeUTF(n):n,r.targetId=i,r}return b(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Ro),Oo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=kt.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=xt.PUB,t.topic="",t.targetId="",t}return b(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:n}},t}(Co),Mo=function(e){function t(t){var n=e.call(this,Vt.PUB_ACK)||this;return n._name=kt.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return b(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Ro),Ao=function(e){function t(t,n,i){var r=e.call(this,Vt.QUERY)||this;return r.name=kt.QUERY,r.identifier=xt.QUERY,r.topic=t,r.data=J(n)?pn.writeUTF(n):n,r.targetId=i,r}return b(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Ro),Uo=function(e){function t(t){var n=e.call(this,Vt.QUERY_CONFIRM)||this;return n._name=kt.QUERY_CON,n.messageId=t,n}return b(t,e),t}(Ro),wo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=kt.QUERY_ACK,t.status=0,t.identifier=xt.QUERY,t.topic="",t.targetId="",t}return b(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:n}},t}(Co),Lo=function(e){var t,n=e.type;switch(n){case Vt.CONN_ACK:t=new Eo(e);break;case Vt.PUBLISH:(t=new So(e)).syncMsg=e.syncMsg;break;case Vt.PUB_ACK:t=new Oo(e);break;case Vt.QUERY_ACK:t=new wo(e);break;case Vt.SUB_ACK:case Vt.UNSUB_ACK:case Vt.PING_RESP:t=new Io(e);break;case Vt.DISCONNECT:t=new yo(e);break;default:t=new mo(e),At.error("No support for deserializing "+n+" messages")}return t};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf",e[e.ugUnpushQuery=94]="ugUnpushQuery",e[e.ugUnpushSet=95]="ugUnpushSet",e[e.setRtcRoomId=96]="setRtcRoomId"}(go||(go={}));var bo,Po,Do=go,Vo=function(e,t,n,i,r,o,s,a){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(o,"&pid=").concat(s,"&apiVer=").concat(r.isFromUniapp?"uniapp":"normal").concat(r.connectPlatform?"&platform="+r.connectPlatform:"").concat(a?"&protocolVer="+a:"")},ko=function(e){return[Do.ppMsgS,Do.pgMsgS,Do.chatMsgS].map((function(e){return Do[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"}(bo||(bo={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_COMET="IM-stats_comet-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S"}(Po||(Po={}));var xo=function(e,t){At.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)};var Go=function(e){function t(t,n){var i=e.call(this,"websocket",n)||this;return i._runtime=t,i._socket=null,i._messageIds={},i._syncMessageIds={},i._failedCount=0,i.ALLOW_FAILED_TIMES=2,i._timer=null,i._idCount=0,i._generateMessageId=function(){return i._idCount>=65535&&(i._idCount=0),++i._idCount},i}return b(t,e),t.prototype.connect=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s=this;return V(this,(function(a){return[2,new Promise((function(a){var c=n.slice(),u=!1,h=function(){return D(s,void 0,void 0,(function(){var n,s,l;return V(this,(function(d){switch(d.label){case 0:return 0===c.length||u?[2]:(u=!0,n=c.shift(),fo(Po.IM_WEBSOCKET,{startTime:(new Date).getTime(),host:n,protocol:Or.WS}),[4,this._connect(e,t,n,i,r,o)]);case 1:if(s=d.sent(),l=s===pe.SUCCESS||s===me.REDIRECT?s:sn(s),fo(Po.IM_WEBSOCKET,{endTime:(new Date).getTime(),code:l}),function(e){D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:t=Po.IM_WEBSOCKET,n=lo(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=po(t),a=s.protocol,c=s.startTime,u=s.endTime,h=s.code,l=s.host,d=ao.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),At.info(f.message),[3,4];case 4:return p=0,Z(c)&&Z(u)&&u>c&&c&&(p=u-c),oo(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),s===pe.SUCCESS)this._checkAlive(),a(s);else if(s===me.REDIRECT)a(s);else{if(0===c.length)return a(sn(s)),[2];u=!1,h()}return[2]}}))}))};r=q(r),s._watcher.status(_e.CONNECTING),h()}))]}))}))},t.prototype._connect=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s,a,c,u,h,l=this;return V(this,(function(d){switch(d.label){case 0:return s=i.replace("http","ws"),a=Vo(s,n,e,t,this._runtime,r,"",o),At.info("conenct start -> ".concat(a)),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(a),u=function(e){l._timer&&(clearTimeout(l._timer),l._timer=null),l._socket===c&&(l._socket=null,l._watcher.status(e))},[4,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=function(e,t){var n=new Uint8Array(e),i=new gn(n),r=i.readByte(),o=new fn(r),s=Lo(o);return s.read(i,n.length-1,t),s}(t,o);if(n instanceof Io&&l._pingResolve)return l._pingResolve(pe.SUCCESS),void(l._pingResolve=void 0);if(n instanceof Eo)return At.info("recv connect ack -> ".concat(n.status)),n.status!==me.ACCEPTED?(At.warn("connect failed: ".concat(n.status)),void e(n.status)):(At.info("connect success -> ".concat(a)),l.connectedTime=n.timestamp,l.userId=n.userId||"",l._idCount=n.messageId,void e(pe.SUCCESS));if(n instanceof yo){var i=n.status;switch(At.warn("recv disconnect signal -> status: ".concat(i)),i){case bo.BLOCK_NEW:case bo.BLOCK:l._watcher.status(_e.BLOCKED);break;case bo.OTHER_DEVICE_LOGIN:l._watcher.status(_e.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case bo.REDIRECT_NEW:case bo.REDIRECT:l._watcher.status(_e.REDIRECT);break;default:l._watcher.status(_e.DISCONNECT_BY_SERVER)}}else l._onReceiveSignal(n)}else At.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var i in At.warn("websocket closed! code:",t,"reason:",n),u(_e.CONNECTION_CLOSED),l._messageIds){var r=l._messageIds[i];delete l._messageIds[i],r(pe.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in At.error("websocket error!",null==t?void 0:t.stack),u(_e.WEBSOCKET_ERROR),l._messageIds){var i=l._messageIds[n];delete l._messageIds[n],i(pe.RC_NET_CHANNEL_INVALID)}e(pe.NETWORK_ERROR)})),c.onOpen((function(){return At.info("websocket open =>",a)})),setTimeout((function(){e(pe.TIMEOUT)}),5e3)}))];case 1:return(h=d.sent())===pe.SUCCESS?this._socket=c:(At.warn("connect result -> code: ".concat(h,", url: ").concat(a)),c.close()),[2,h]}}))}))},t.prototype._checkAlive=function(){var e;return D(this,void 0,void 0,(function(){var t,n,i=this;return V(this,(function(r){switch(r.label){case 0:return this._socket?(At.info("send ping ->"),this.sendOnly(new To),t=ct(),ft(Ue.L_CHECK_ALIVE_IM_T,{},{traceId:t}),[4,new Promise((function(e){i._pingResolve=e,i._timer&&clearTimeout(i._timer),i._timer=setTimeout((function(){i._pingResolve=void 0,e(pe.TIMEOUT)}),15e3)}))]):[2];case 1:return n=r.sent(),(n===pe.SUCCESS?ft:pt)(Ue.L_CHECK_ALIVE_IM_R,{isSuccess:n===pe.SUCCESS},{traceId:t}),n!==pe.SUCCESS?(this._failedCount+=1,At.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(n)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,At.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._socket=null,this._watcher.status(_e.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(At.info("recv ping <-"),this._failedCount=0,setTimeout((function(){return i._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a=this;return V(this,(function(c){switch(c.label){case 0:return t=e.messageId,e.header&&e.header.qos!==Dt.AT_MOST_ONCE&&(e instanceof So&&!e.syncMsg&&(At.info("send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Mo(t))),e instanceof wo&&(At.info("send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Uo(t)))),t>0&&(e instanceof Oo||e instanceof wo)&&(At.info("recv ack -> messageId: ".concat(t," ").concat(e.topic)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(i=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],i(e))),e instanceof So?(r=e.syncMsg,o=e.topic,At.info("recv PublishReader -> messageId: ".concat(t," ").concat(o)),o===Do[Do.userSetData]?[2]:!r||ko(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){a._syncMessageIds[t]=e}))]):[3,2];case 1:s=c.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,s),c.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof No||e instanceof Ao)&&(e.messageId=this._generateMessageId()),xo(e,this._socket))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),D(this,void 0,void 0,(function(){var r,o,s,a,c=this;return V(this,(function(u){switch(u.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,xo(e,this._socket),[4,new Promise((function(e){c._messageIds[r]=e,setTimeout((function(){c._messageIds[r]&&delete c._messageIds[r],e()}),i)}))]):[3,2];case 1:return(o=u.sent())?o instanceof wo||o instanceof Oo?(s=t&&o.data&&[pe.SUCCESS,pe.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(At.warn("send failed -> message: ".concat(r,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:pe.SUCCESS,data:a}]):[2,{code:o}]:(At.warn("send timeout -> message: ".concat(r,", respPBName: ").concat(t,", timeout: ").concat(i)),[2,{code:pe.TIMEOUT}]);case 2:return[2,{code:pe.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(_e.DISCONNECTED))},t}(ro);var Bo=function(e){function t(t,n){var i=e.call(this,"comet",n)||this;return i._runtime=t,i._messageIds={},i._syncMessageIds={},i._idCount=0,i._generateMessageId=function(){return++i._idCount},i._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),i}return b(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=J(e.data)?JSON.parse(e.data):e.data;return n?!X(n)||(Zt(n,(function(e){return D(t,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new fn(t),i=Lo(n);for(var r in e)i[r]=e[r];return i}(e),i=n.messageId,r=n._header,o=n.status,s=r&&r.qos!==Dt.AT_MOST_ONCE,i&&n.getIdentifier&&((a=this._messageIds[i])&&a(n),this._syncMessageIds[i]&&this._syncMessageIds[i](n)),s&&(n instanceof So&&!n.syncMsg&&(c=new Mo(i),this.sendOnly(c)),n instanceof wo&&(c=new Uo(i),this.sendOnly(c))),n instanceof yo){switch(o){case bo.OTHER_DEVICE_LOGIN:this._watcher.status(_e.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case bo.BLOCK:case bo.BLOCK_NEW:this._watcher.status(_e.BLOCKED);break;case bo.REDIRECT_NEW:case bo.REDIRECT:this._watcher.status(_e.REDIRECT);break;default:this._watcher.status(_e.DISCONNECT_BY_SERVER)}return[2]}return n instanceof So?(u=n.syncMsg,h=n.topic,!u||ko(h)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){d._syncMessageIds[i]=e}))]):[3,2];case 1:l=f.sent(),delete this._syncMessageIds[i],this._watcher.signal(n,l),f.label=2;case 2:return[2]}}))}))})),!0):(At.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o;return V(this,(function(s){switch(s.label){case 0:return t=(new Date).getTime(),n="".concat(e,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"×trap=").concat(t,"&pid=").concat(this._pid),i=ct(),ft(Ue.L_CHECK_ALIVE_IM_T,{},{traceId:i}),[4,this._runtime.httpReq({url:n,body:{pid:this._pid},timeout:45e3})];case 1:return r=s.sent(),o=this.handleCometRes(r),(o?ft:pt)(Ue.L_CHECK_ALIVE_IM_R,{isSuccess:o},{traceId:i}),this._isDisconnected||(o?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(_e.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var o,s,a=this;return V(this,(function(c){return r=q(r),this._protocol=i,this._isDisconnected=!1,this._watcher.status(_e.CONNECTING),o=n.slice(),s=!1,[2,new Promise((function(n){var c=function(){return D(a,void 0,void 0,(function(){var a,u,h;return V(this,(function(l){switch(l.label){case 0:return 0===o.length||s?[2]:(s=!0,a=o.shift(),fo(Po.IM_COMET,{startTime:(new Date).getTime(),host:a,protocol:Or.NAVI}),[4,this._connect(e,t,a,i,r)]);case 1:if(u=l.sent(),h=u===pe.SUCCESS||u===me.REDIRECT?u:sn(u),fo(Po.IM_COMET,{endTime:(new Date).getTime(),code:h}),function(e){D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:t=Po.IM_COMET,n=lo(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=po(t),a=s.protocol,c=s.startTime,u=s.endTime,h=s.code,l=s.host,d=ao.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),At.info(f.message),[3,4];case 4:return p=0,Z(c)&&Z(u)&&u>c&&c&&(p=u-c),oo(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),u===pe.SUCCESS)this._startPullSignal(i),n(u);else if(u===me.REDIRECT)n(u);else{if(0===o.length)return n(sn(u)),[2];s=!1,c()}return[2]}}))}))};a._watcher.status(_e.CONNECTING),c()}))]}))}))},t.prototype._connect=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(At.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(function(e){if(ne(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t}(e.data)?ne(e.data)?e.data:JSON.parse(e.data):(At.error("received data is not a validJson",e.data),!1))},s=Vo(i,n,e,t,this._runtime,r,this._pid),this.sendConnectTime=Date.now(),At.info("conenct start -> ".concat(s)),[4,this._runtime.httpReq({url:s,body:{pid:this._pid},timeout:5e3})];case 1:return a=u.sent(),c=o(a),this._domain=n,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp,ft("connect success -> userId: ".concat(c.userId,", url: ").concat(s))):At.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(s)),[2,null==c?void 0:c.status]}}))}))},t.prototype.sendCometData=function(e,t){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return n=(t=this)._domain,i=t._sessionid,r=t._pid,o=e.messageId,s=e.topic,a=e.targetId,c=e.getHeaderFlag(),u=s?"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(s,"&targetid=").concat(a,"&pid=").concat(r):"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&pid=").concat(r),[4,this._runtime.httpReq({url:u,method:so.POST,body:e.getCometData()})];case 1:return h=l.sent(),this.handleCometRes(h),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),D(this,void 0,void 0,(function(){var r,o,s,a,c=this;return V(this,(function(u){switch(u.label){case 0:return r=this._generateMessageId(),e.messageId=r,this.sendCometData(e),[4,new Promise((function(e){c._messageIds[r]=e,setTimeout((function(){delete c._messageIds[r],e()}),i)}))];case 1:return(o=u.sent())?(s=t&&o.data&&[pe.SUCCESS,pe.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?a:null}]:[2,{code:pe.SUCCESS,data:a}]):[2,{code:pe.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(_e.DISCONNECTED)},t}(ro),Fo=function(e){return["navi",e].join("_")};function Ko(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:t=Po.IM_NAVI,n=lo(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=po(t),a=s.protocol,c=s.startTime,u=s.endTime,h=s.code,l=s.host,d=ao.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),At.debug(f.message),[3,4];case 4:return p=0,Z(c)&&Z(u)&&u>c&&c&&(p=u-c),oo(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:h,hos:l,net:d}),[2]}}))}))}var Ho=function(){function e(e,t,n){this.runtime=e,this._watcher=t,this._options=n,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this._apiVersion=q(this._options.apiVersion)}return e.prototype.getNaviInfo=function(e,t,n,i){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return n&&this._clear(e),i=function(e,t,n){var i,r,o=Fo(e);try{var s=n.getItem(o);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();return r.length>0&&(r=r.filter((function(e){return a-e.timestamp<72e5}))),0===r.length?n.removeItem(o):n.setItem(o,JSON.stringify(r)),(null===(i=r.find((function(e){return e.token===t})))||void 0===i?void 0:i.naviInfo)||null}(this._appkey,e,this.runtime.localStorage),i?(this._naviInfo=i,[2,i]):(r=this._options.navigators.slice(),t.length&&t.forEach((function(e){r.indexOf(e)<0&&r.unshift(e)})),[4,this.requestNaviInfo(r,this._appkey,e)]);case 1:return(i=o.sent())?(this._naviInfo=i,this.setNaviInfo2Cache(e,i),[2,i]):[2,i]}}))}))},e.prototype.setNaviInfo2Cache=function(e,t){this._naviInfo=t,function(e,t,n,i){var r,o=Fo(e);try{var s=i.getItem(o);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();r.length>0&&(r=r.filter((function(e){return a-e.timestamp<72e5&&t!==e.token}))),r.push({timestamp:a,naviInfo:n,token:t}),i.setItem(o,JSON.stringify(r))}(this._appkey,e,t,this.runtime.localStorage)},e.prototype.getInfoFromCache=function(e){return P({},this._naviInfo)},e.prototype._clear=function(e){!function(e,t,n){var i,r=Fo(e);try{var o=n.getItem(r);i=o?JSON.parse(o):[]}catch(e){i=[]}var s=Date.now();i.length>0&&(i=i.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),0===i.length?n.removeItem(r):n.setItem(r,JSON.stringify(i))}(this._appkey,e,this.runtime.localStorage)},e}(),qo=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},e.prototype.getCoreVersion=function(){return this._context.coreVersion},e.prototype.getAPIVersion=function(){return this._context.apiVersion},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,i){void 0===i&&(i=[]),this._context.registerMessageType(e,t,n,i)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},e}(),Yo=function(e,t,n){return[e,t,n].join("_")},jo=function(){function e(e,t){this._runtime=e,this._appkey=t,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0,broadcastSyncTime:0})},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var i=Yo("inbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=Yo("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||re(e))){n.broadcastSyncTime=e;var i=Yo("broadcastbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=Yo("broadcastbox",this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n))||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var i=Yo("outbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=Yo("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),Qo={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Wo=function(){function e(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,i=e.type,r=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=i===Le.DELETE,c=s===o,u=!this._isExisted(n),h=a?this._remove:this._add;(t||r||c||u)&&h.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,i=t.isDeleted;return n&&!i},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,i=e.isFullUpdate;n=n||[],(i=i||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,i)})),At.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),Jo=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(i=Qo.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,this._isPulling=!1,o===pe.SUCCESS?(Qo.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Qo.clear(e);var t=this._storeCaches[e];t&&t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var i=this._storeCaches[e];ae(i)||(i=new Wo(e,n)),i.setEntries(t),this._storeCaches[e]=i},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getVersion=function(e,t){var n=this._storeCaches[e];return n?n.getVersion(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),zo=function(){function e(e,t,n,i){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){At.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],ae(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},e.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},e}(),Zo="converStatusChanged",Xo=function(){function e(e,t,n){this._eventEmitter=new Ut,this._pullQueue=[],this._isPulling=!1,this._storage=A(e.runtime),this._appkey=t,this._currentUserId=n,this._engine=e,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n)}return e.prototype._set=function(e){var t=this;if(!re(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach((function(e,r){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(Zo,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=r.sent(),n=t.code,i=t.data,n===pe.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(Zo,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(Zo,(function(e){}))},e}(),$o={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},es={};for(var ts in $o){var ns=$o[ts].keyName;es[ns]=ts}var is,rs=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var i="con-".concat(t,"-").concat(n);this.storage=new w(e,i),this._localStore=new w(e,"CONVER-".concat(t,"-").concat(n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),i=t.shift(),r=t.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:j.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,i=e.targetId,r=e.messageType,o=e.isMentioned,s=e.content,a=e.senderUserId,c=e.channelId,u=this._getStoreKey(n,i,c),h=this._localStore.get(u)||{},l=es.mentionedInfo,d=es.hasMentioned,f=h[l]||{},p=f.userIdList||[],g=s.mentionedInfo;if(g){if(o&&n===j.GROUP)(g.userIdList||[]).forEach((function(e){e===t._currentUserId&&p.indexOf(a)<0&&p.push(a)})),g.type===Se.ALL&&p.indexOf(a)<0&&p.push(a);if(r===Ee.RECALL&&n===j.GROUP){var _=p.indexOf(a);_>=0&&p.splice(_,1)}g={userIdList:p,type:(null==g?void 0:g.type)||f.type},0!==p.length?(h[l]=g,h[d]=!0):(delete h[l],delete h[d]),ae(h)?this._localStore.set(u,h):this._localStore.remove(u)}},e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=es[s],c=n[s];if(!re(a)&&!re(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(c===$o[a].defaultVal||"tags"===s&&!ae(c))delete o[a];else if("tags"===s){var u=c;for(var h in u)u[h].isTop||delete u[h].isTop;o[a]=c}else o[a]=c;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}ae(o)?this._localStore.set(r,o):this._localStore.remove(r)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var i=this._getStoreKey(e,t,n),r=this._localStore.get(i)||{},o={};for(var s in $o){var a=$o[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||nn(u)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var i in t){var r=this._getConOptionByKey(i),o={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},s=t[i];for(var a in s)if($o[a]){var c=$o[a],u=c.keyName,h=c.defaultVal;o[u]=s[a]||nn(h)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var i=this._getConOptionByKey(n),r=i.conversationType,o=i.targetId,s={},a=e[n];for(var c in a){var u=$o[c],h=u.keyName,l=u.defaultVal;s[h]=a[c]||nn(l)}for(var d in s.tags){re(t[d])&&(t[d]=[]);var f=Object.assign({},s,{conversationType:r,targetId:o});delete f.tags,t[d].push(f)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}this.storage.clear()}catch(e){At.error("adaptOldStore error: ".concat(e.message))}},e}(),os=[j.PRIVATE,j.GROUP,j.SYSTEM,j.PUBLIC_SERVICE,j.APP_PUBLIC_SERVICE],ss="conversationChanged",as="conTagStatusChanged",cs=function(){function e(e,t,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Ut,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new rs(e.runtime,t,n),this._statusManager=new Xo(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(ss,(function(e){i(e)})),this._eventEmitter.on(as,(function(){r()}))}return e.prototype._calcUnreadCount=function(e,t){var n=e.content,i=e.messageType,r=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,c=s===de.SEND&&a===this._loginUserId,u=i===Ee.RECALL,h=ne(n),l=!1,d={},f=t.lastUnreadTime||0,p=t.lastReadTime||0,g=t.unreadMessageCount||0;if(f>r||c)return{hasChanged:l,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=g+1,t.lastUnreadTime=r,l=!0),u&&h){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),m=!this._recallMsgTimeMap[_]||this._recallMsgTimeMap[_]&&!this._recallMsgTimeMap[_].find((function(e){return e===n.sentTime})),v=f>=n.sentTime;p&&(v=p<n.sentTime),v&&g&&m&&(!this._recallMsgTimeMap[_]&&(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=g-1,l=!0)}return l&&(d.unreadMessageCount={val:t.unreadMessageCount,time:r}),{hasChanged:l,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,i=(e.messageDirection,e.isMentioned),r=e.sentTime;de.SEND;var o=ne(n),s=!1,a={};return i&&o&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0,a.hasMentioned={val:!0,time:r},a.mentionedInfo={val:n.mentionedInfo,time:r}),{hasChanged:s,localConversation:t,updateItems:a}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,i=e.messageDirection,r=!1;if(e.isMentioned&&i===de.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===Se.ALL||(a||[]).includes(this._loginUserId)){r=!0;var c=t.unreadMentionedCount||0;t.unreadMentionedCount=c+1}}return{hasChanged:r,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(ne(e)){var t=e.conversationType,n=e.targetId,i=e.channelId,r="".concat(t,"_").concat(n),o=this._store.get(t,n,i)||{};this._updatedConversations[r]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,i){var r=(this._store.get(e,t,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var o in r)if(!n[o]||!!r[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,i=e.targetId,r=e.updatedTime,o=e.notificationStatus,s=e.notificationLevel,a=e.isTop,c=e.tags,u=e.channelId,h={},l={};n!==j.ULTRA_GROUP&&(re(o)||(l.notificationStatus={time:r,val:o}),re(s)||(l.notificationLevel={time:r,val:s}),re(a)||(l.isTop={time:r,val:a}),re(c)||(l.tags={time:r,val:c},null==c||c.forEach((function(e){h[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,i,h,u),this._store.set(n,i,{notificationStatus:o,notificationLevel:s,isTop:a,tags:h},u),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:l,channelId:u}),t&&this._notifyConversationChanged())},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(ss,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(as),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,i=e.conversationType,r=e.isPersited,o=e.targetId,s=e.channelId;if(os.indexOf(i)>=0){var a=!1,c=this._store.get(i,o,s),u={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,c),r=i.hasChanged,o=i.localConversation,s=i.updateItems;a=a||r,u=P(P({},u),s),c=nn(o)})),a&&this._store.set(i,o,c,s),this._store.updateMentionedData(e),r){var h=this._store.get(i,o,s);h.updatedItems=P({latestMessage:{time:e.sentTime,val:e}},u),h.latestMessage=e;var l=Object.assign(h,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(l)}(a||r)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var i=this._store.getValue(),r=0;return i.forEach((function(e){var i=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;i=i||0,(n||1!==o||s===Ce.NOT_SET||s===Ce.ALL_MESSAGE)&&(t.length>0?t.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],i=0;return n.forEach((function(e){var n=e.unreadMessageCount,r=e.notificationStatus,o=e.notificationLevel;(t||1!==r||-1===o||0===o)&&(n=n||0,i+=Number(n))})),i},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,i){void 0===i&&(i=!0);var r=this._store.get(e,t,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=r.unreadMessageCount,s=r.hasMentioned,a={};if(o&&(r.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,r,n),i&&0!==Object.keys(a).length){var c=Object.assign(r,{conversationType:e,targetId:t,channelId:n,updatedItems:a});this._setUpdatedConversation(c),this._notifyConversationChanged()}},e.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,t.lastReadTime=t.lastUnreadTime,e._recallMsgTimeMap={},e._store.set(t.conversationType,t.targetId,t,t.channelId))}))},e.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},e.prototype.setDraft=function(e,t,n,i){var r="".concat(e,"_").concat(t,"_").concat(i);this._draftMap[r]=n},e.prototype.getDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[i]},e.prototype.clearDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[i]},e.prototype.addTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i).tags;r=Object.assign(r,n),this._store.set(e,t,{tags:r},i)},e.prototype.deleteTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i).tags;n.forEach((function(e){delete r[e]})),this._store.set(e,t,{tags:r},i)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===Te.OPEN||-1!==e.notificationLevel&&0!==e.notificationLevel})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===e&&(e=""),this.get(t,n,e).unreadMentionedCount||0},e.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t},e.prototype.getAllConversationState=function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e}(),us=function(){function e(e,t,n,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(t,"-").concat(n),this._storagePullTimeKey="us-s-".concat(t,"-").concat(n),this._storage=A(e.runtime),this._engine=e,this._tagWatcherFunc=i}return e.prototype._updateTag=function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,i=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:i}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.deleteTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))},e.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=c.sent(),n=t.code,i=t.data,n!==pe.SUCCESS||re(i)?(this._isPulling=!1,this._startPull()):(o=(r=i).settings,s=r.version,a=o.Tag,re(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),hs=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(i=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,o===pe.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},e.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},e}(),ls=function(e,t){return["send_msg",e,t].join("_")},ds=function(){function e(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=ls(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=ls(this._appkey,this._userId),i=this._getLocalInfo(n);i[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(i))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=ls(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}();(is={})[j.PRIVATE]=Do.qryPMsg,is[j.GROUP]=Do.qryGMsg,is[j.CHATROOM]=Do.qryCHMsg,is[j.CUSTOMER_SERVICE]=Do.qryCMsg,is[j.SYSTEM]=Do.qrySMsg;var fs=[Do[Do.recallMsg],Do[Do.ppMsgS],Do[Do.pgMsgS],Do[Do.ppMsgP],Do[Do.pgMsgP],Do[Do.chatMsg],Do[Do.pcMsgP],Do[Do.prMsgS],Do[Do.updUgRTime]],ps=function(){function e(e,t,n){this.ULTRA_GROUP_CONVERSATION="ultragroupconversation";var i="".concat(this.ULTRA_GROUP_CONVERSATION,"-").concat(t,"-").concat(n);this._localStore=new w(e,i)}return e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=_s[s],c=n[s];if(!re(a)&&!re(c))c===gs[a].defaultVal?delete o[a]:o[a]=c}ae(o)?this._localStore.set(r,o):this._localStore.remove(r)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var i=this._getStoreKey(e,t,n),r=this._localStore.get(i)||{},o={};for(var s in gs){var a=gs[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||nn(u)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),gs={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},_s={};for(var ms in gs){var vs=gs[ms].keyName;_s[vs]=ms}var Es=function(){function e(e,t,n){this._store=new ps(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,o=e.channelId;t===j.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:i,notificationLevel:r},o)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),ys=function(e,t,i,r,o,s){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:de.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt}},Ts=function(e){return e.sort((function(e,t){var n,i,r=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=t.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r}))},Is=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._conversationUpdatedTime=0,r._miniConnectUrl="",r.currentUserId="",r._connectedTime=0,r._localConnectedTime=0,r._status=_e.DISCONNECTED,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._pullChatroomEntryTimestamp=0,r._intervalTimerForChrmPull=-1,r._lastSyncUltraMsgTimeStamp=0,r._lastSyncUltraMsgLocalTimeStamp=0,r._ultraGroupTimer=-1,r._isUltraPulling=!1,r._ultraGroupTimeQue=[],r._isUltraGroupListExist=!1,r._ultraGroupMap={},r._firstPullUltraGroupTime=0,r._ultraMsgMap={},r._pullUltraChangeMessageQue=[],r._isPullingUltraChangeMessage=!1,r._lastPullingUltraChangeMessageTime=0,r._ultraMsgChangeMap={},r._letterbox=new jo(t,i.appkey),r._sendMessageStore=new ds(t,i.appkey),r._chrmEntryHandler=new Jo(r),r._connectType=i.connectionType,r}return b(t,e),t.prototype._formatJSONPUrl=function(e,t,n,i){var r=this.runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(r,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(i,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())},t.prototype.getNaviInfo=function(t,n,i){var r;return D(this,void 0,void 0,(function(){var o;return V(this,(function(s){return this.runtime.useNavi||(o=void 0,o=this.runtime.isSupportSocket()&&"websocket"===this._connectType?c.join(","):u.join(","),this._miniConnectUrl=(null===(r=this._options.miniCMPProxy)||void 0===r?void 0:r.length)?this._options.miniCMPProxy.join(","):o||"",n=[]),[2,e.prototype.getNaviInfo.call(this,t,n,i)]}))}))},t.prototype.requestNaviInfo=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l,d,f;return V(this,(function(p){switch(p.label){case 0:i="getServerEndpoint",r=0,o=e.length,p.label=1;case 1:return r<o?(s=this._formatJSONPUrl(e[r],n,t,i),dt("req navi => ".concat(s)),[4,this.runtime.httpReq({url:s,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(a=p.sent(),c=(new Date).getTime(),fo(Po.IM_NAVI,{endTime:c}),200!==a.status)return u=void 0,403===a.status?(u=pe.RC_CONN_USER_OR_PASSWD_ERROR,gt("request navi error: "+u)):401===a.status&&(u=pe.RC_CONN_APP_BLOCKED_OR_DELETED,gt("request navi error: "+u)),fo(Po.IM_NAVI,{code:u}),Ko(this.runtime),[3,3];try{return h=a.data.match(/{[\d\D]+}/),0===(l=h&&h[0]?h[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),f=JSON.parse(l),d=/^https/.test(s)?"https":"http",f.protocol=d,this.runtime.useNavi||(f.server="",f.backupServer=this._miniConnectUrl,f.logSwitch=0),ho({serverPrivate:f.type===Nr.PRIVATE?Nr.PRIVATE:Nr.OPEN}),fo(Po.IM_NAVI,{code:pe.SUCCESS}),f.userId&&(St({userId:f.userId}),ut({userId:f.userId})),Ko(this.runtime),[2,f]}catch(e){gt("parse navi err =>",e)}p.label=3;case 3:return r+=1,[3,1];case 4:return this.runtime.useNavi?[2,null]:(f={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},fo(Po.IM_NAVI,{code:f.code,startTime:0,endTime:0,host:""}),Ko(this.runtime),[2,f])}}))}))},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a=this;return V(this,(function(c){switch(c.label){case 0:return n=[],this.naviInfo=t,t.server?n.push(t.server):At.warn("navi.server is invalid"),(i=t.backupServer)&&i.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(At.error("navi invaild.",n),[2,pe.UNKNOWN]):(r=this.runtime.createDataChannel({status:function(i){a._connectionStatusHandler(i,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=Gt.V3,1===t.openAnti&&(o=Gt.V4),[4,r.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(s=c.sent())===pe.SUCCESS?(this._channel=r,this.currentUserId=r.userId,this._connectedTime=r.connectedTime,this._localConnectedTime=Math.floor((Date.now()+r.sendConnectTime)/2),this._watcher.status(_e.CONNECTED),this._status=_e.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new cs(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._ultraGroupManager=new Es(this,this._appkey,this.currentUserId),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new us(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new hs(this),this._joinedChrmManager=new zo(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval(),1===t.ugMsg&&this._startUltraSyncInterval()):r.close(),[2,s]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,i){if(At.warn("connection status changed:",e),this._status=e,e!==_e.CONNECTING)if(e!==_e.CONNECTED){if(this._channel&&e!==_e.DISCONNECTED)return e===_e.BLOCKED||e===_e.KICKED_OFFLINE_BY_OTHER_CLIENT||e===_e.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==_e.REDIRECT?(this._watcher.status(e),this._try2Reconnect(t,n,i)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)},t.prototype._try2Reconnect=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r=this;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=Gt.V3,1===this.naviInfo.openAnti&&(i=Gt.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,i)]):[2];case 1:return o.sent()===pe.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(_e.CONNECTED),this._status=_e.CONNECTED,1===this.naviInfo.ugMsg&&this._startUltraSyncInterval(),this._rejoinChrm(),[2]):(this._watcher.status(_e.WEBSOCKET_UNAVAILABLE),this._status=_e.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){r._reconnectTimer=-1,r._try2Reconnect(e,t,n)}),5e3),[2])}}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,i=e.topic;if(n)this._receiveSyncMsg(e,t);else{var r=Do[i];if(r)switch(r){case Do.s_ntf:At.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case Do.s_msg:this._receiveMsg(e);break;case Do.s_cmd:this._receiveStateNotify(e);break;case Do.s_us:this._receiveSettingNotify(e);break;case Do.rtc_ntf:this._receiveRtcKv(e);break;case Do.s_opNtf:this._pullOperateStatusNotify(e)}else At.error("unknown topic:",i)}},t.prototype._receiveStateNotify=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Sn),i=n.time,r=n.type,o=n.chrmId;switch(r){case 2:this._chrmEntryHandler.pullEntry(o,i);break;case 3:this._conversationManager.startPullConversationStatus(i);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(i),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(i),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Ii)).version;this._userSettingManager.pullUserSettings(n)},t.prototype._receiveRtcKv=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,tr),i=n.time,r=n.type,o=n.roomId;if(1===r)this._rtcKVManager.pullEntry(o,i)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,i=t.del,r=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:r,expansion:n}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:r,deletedKeys:i}})},t.prototype._receiveSyncMsg=function(e,t){var n,i;if(fs.includes(e.topic)){if(e.topic===Do[Do.updUgRTime]){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,Vn),o=r.channelId,s=r.busChannel,a=this._ultraGroupMap[s+"_"+o];return a&&(a.unreadMessageCount=0,a.unreadMentionedCount=0,a.lastReadTime=t.timestamp,this._watcher.conversation(cn([a]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var c=null===(i=this._channel)||void 0===i?void 0:i.codec.decodeByPBName(e.data,mn,{currentUserId:this.currentUserId,signal:e});c=this._handleMsgProperties(c),t&&(c.sentTime=t.timestamp,c.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||c.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),c.messageType!==Ee.EXPANSION_NOTIFY?(c.messageType===Ee.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(c.conversationType,c.targetId,c.channelId),this._conversationManager.setConversationCacheByMessage(c,!0),this._watcher.batchMessage([c])):this._receiveMessageExpansion(c))}},t.prototype._pullMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Sn),n=t.type,i=t.chrmId,r=t.time;if(At.info("s_ntf -> type: ".concat(n,", chrmId: ").concat(i,", time: ").concat(r)),2===n){var o=this._chrmsQueue[i];if(!o)return;o.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()}},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncMsg=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,c,u,h,l,d,f,p,g,_,m,v,E=this;return V(this,(function(y){switch(y.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),At.info("pullMsg -> sendboxTime: ".concat(e,", inboxTime: ").concat(t,", broadcastSyncTime: ").concat(n)),i=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),r=new Ao(Do[Do.pullMsg],i,this.currentUserId),o=ct(),ft(Ue.L_PULL_MSG_T,{outboxTime:e,inboxTime:t,broadcastSyncTime:n},{traceId:o}),[4,this._channel.send(r,yn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=y.sent(),a=s.code,c=s.data,this._latestSyncTimestamp=Date.now(),a!==pe.SUCCESS||!c||re(c.finished)||re(c.list)||re(c.syncTime)?(At.warn("pullMsg failed -> code:",a,", data: ",c),pt(Ue.L_PULL_MSG_R,{code:a,timestamp:this._latestSyncTimestamp},{traceId:o}),this._pullingMsg=!1,[2]):(u=c.list,h=c.finished,l=c.syncTime,d=c.broadcastSyncTime,f=void 0===d?1:d,At.info("pullMsg success -> syncTime: ".concat(l,", finished: ").concat(h)),p=0,g=[],_=[],u.forEach((function(e){if((g.push(e.messageUId),e.messageDirection===de.SEND)&&(p=Math.max(e.sentTime,p),E._sendMessageStore.getSendMessageMap()[e.messageUId]))return void E._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==Ee.EXPANSION_NOTIFY){if(e.messageType===Ee.SYNC_READ_STATUS){if(e.senderUserId!==E.currentUserId)return;E._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=E._handleMsgProperties(e);E._conversationManager.setConversationCacheByMessage(t,!0),_.push(t)}else E._receiveMessageExpansion(e)})),this._watcher.batchMessage(_),this._letterbox.setInboxTime(l,this.currentUserId),this._letterbox.setOutboxTime(p,this.currentUserId),this._letterbox.setBroadcastSyncTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(p),this._pullingMsg=!1,m=this._pullQueue.filter((function(e){return e>l})),this._pullQueue.length=0,(v=this._pullQueue).push.apply(v,m),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),ft(Ue.L_PULL_MSG_R,{code:a,messageUIds:g.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h},{traceId:o}),(!h||m.length>0)&&this._syncMsg(),[2])}}))}))},t.prototype._receiveMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,En,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});if((t=this._handleMsgProperties(t)).conversationType!==j.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}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!==Ee.EXPANSION_NOTIFY?t.messageType===Ee.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,i=e.messageType,r=e.isCounted,o=e.isPersited,s=e.isStatusMessage,a=i in T,c=i in this._customMessageType;if(n=a?P(P({},T[i]),{isStatusMessage:C.includes(i)}):c?this._customMessageType[i]:{isCounted:!oe(r)&&r,isPersited:!oe(o)&&o,isStatusMessage:!1},Object.assign(e,n),t&&!re(s)&&(e.isStatusMessage=s),!t){var u=e.content.user;if(u){var h=u.portrait,l=u.portraitUri,d=h||l;d&&(u.portrait=u.portraitUri=d)}}return e},t.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){return void 0===o&&(o=""),D(this,void 0,void 0,(function(){var s,c,u,h,l,d,f,p,g,_;return V(this,(function(m){switch(m.label){case 0:return c=(s=this).currentUserId,u=s._channel,h=zr[e]||qr,l=1===i&&0===n,u?(d=u.codec.encodeGetHistoryMsg(t,{timestamp:n,count:l?2:i,order:r,channelId:o}),ft(Ue.L_GET_HISTORY_MSG_T,{targetId:t,conversationType:j.ULTRA_GROUP,channelId:o,timestamp:n,count:i},{traceId:a}),[4,u.send(new Ao(h,d,c),On,{currentUserId:c,connectedTime:u.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return f=m.sent(),(p=f.code)===pe.SUCCESS&&d?(g=f.data,l&&2===g.list.length&&(g.hasMore=!0,0===r?g.list.shift():g.list.pop()),_=[],g.list&&g.list.forEach((function(e){e&&_.push(e.messageUId)})),ft(Ue.L_GET_HISTORY_MSG_R,{code:p,messageUIds:_.join(",")},{traceId:a}),[2,{code:p,data:{list:g.list,hasMore:g.hasMore}}]):(pt(Ue.L_GET_HISTORY_MSG_R,{code:p,messageUIds:""},{traceId:a}),[2,{code:p}]);case 2:return[2,{code:pe.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){At.info("reportSDKInfo ->",e);var i=n.codec.encodeReportSDKInfo(JSON.stringify(e)),r=new Ao(Do[Do.reportsdk],i,t);n.send(r).then((function(e){var t=e.code;t!==pe.SUCCESS&&At.warn("reportSDKInfo failed -> code: ".concat(t))}))}},t.prototype.deleteRemoteMessage=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return o=(r=this).currentUserId,(s=r._channel)?(a=s.codec.encodeDeleteMessages(e,t,n,i),c=new Ao(Lr,a,o),[4,s.send(c)]):[3,2];case 1:return u=l.sent(),h=u.code,pe.SUCCESS,[2,h];case 2:return[2,pe.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return o=(r=this).currentUserId,(s=r._channel)?(a=s.codec.encodeClearMessages(t,n,i,e),c=Zr[e],u=new Ao(c,a,o),[4,s.send(u)]):[3,2];case 1:return h=d.sent(),l=h.code,pe.SUCCESS,[2,l];case 2:return[2,pe.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:return o=(r=this).currentUserId,s=r._channel,t=t||j.PRIVATE,s?(a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),c=new Ao(Br,a,o),[4,s.send(c,An,{currentUserId:o,connectedTime:s.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=d._conversationManager.get(t,n,i);return Object.assign(e,r),e}})]):[3,2];case 1:return u=f.sent(),h=u.code,l=u.data,h!==pe.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==l?void 0:l.list}];case 2:return[2,{code:pe.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return(i=this._channel)?(r=i.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new Ao(Fr,r,t),[4,i.send(o)]):[3,2];case 1:return s=c.sent(),At.info("RemoveConversation =>",s),a=s.code,pe.SUCCESS,[2,a];case 2:return[2,pe.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return e!==j.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap[n+"_"+t])?[3,3]:[2,{code:pe.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:pe.CONVER_GET_ERROR}];case 2:if(o=u.sent(),s=o.code,a=o.data,s!==pe.SUCCESS)return[2,{code:pe.CONVER_GET_ERROR}];c=(null==a?void 0:a.list[0])||null,i={conversationType:e,targetId:t,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:c,notificationStatus:r.notificationStatus||Te.CLOSE,notificationLevel:r.notificationLevel||Ce.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},u.label=3;case 3:return[2,{code:pe.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:pe.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return r=e===j.ULTRA_GROUP?(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0:this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:pe.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(pe.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(pe.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve(pe.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:pe.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(pe.SUCCESS)},t.prototype.pullConversationStatus=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h=this;return V(this,(function(l){switch(l.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(r=n.codec.encodeGetConversationStatus(e),o=new Ao(Do[Do.pullSeAtts],r,i),[4,n.send(o,Ri)]):[3,2];case 1:return s=l.sent(),a=s.code,c=s.data,ft(Ue.L_PULL_CONVERSATION_S,{timestamp:e,userId:i}),a!==pe.SUCCESS?[2,{code:a}]:(u=[],Array.isArray(c)&&c.forEach((function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.channelId,o=e.isTop,s=e.notificationLevel,a=h._ultraGroupMap[r+"_"+n];t===j.ULTRA_GROUP?a&&(void 0!==i&&(a.notificationStatus=i),void 0!==s&&(a.notificationLevel=s),void 0===s&&void 0===i||h._ultraGroupManager.addUltraGroupStatus(e),"boolean"==typeof o&&(a.isTop=o)):u.push(e)})),[2,{code:a,data:u}]);case 2:return[2,{code:pe.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:return n=(t=this).currentUserId,(i=t._channel)?(r=i.codec.encodeSetConversationStatus(e,this._conversationUpdatedTime),o=new Ao(Kr,r,n),[4,i.send(o,Mi)]):[3,2];case 1:return s=f.sent(),a=s.code,c=s.data,a===pe.SUCCESS?(u=c,this._conversationUpdatedTime=u.version,h=[],e.forEach((function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,o=e.channelId,s=e.isTop;if(t===j.ULTRA_GROUP){var a=d._ultraGroupMap[o+"_"+n];a&&(void 0!==i&&(a.notificationStatus=i),void 0!==r&&(a.notificationLevel=r),void 0===r&&void 0===i||d._ultraGroupManager.addUltraGroupStatus(a),void 0!==s&&(a.isTop=s),h.push(a))}else d._conversationManager.addStatus(P(P({},e),{updatedTime:u.version}),!0)})),h.length>0&&(l=cn(h),l=Ts(l),this._watcher.conversation(l)),[2,a]):[2,a];case 2:return[2,pe.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return(r=this._channel)?(o=r.codec.encodeJoinOrQuitChatRoom(),a=new Ao(s=n?Pr:br,o,e),ft(Ue.L_JOIN_CHATROOM_T,{chatroomId:e,count:t,topic:s},{traceId:i}),[4,r.send(a,xn)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return c=d.sent(),u=c.code,h=c.data,(u===pe.SUCCESS?ft:pt)(Ue.L_JOIN_CHATROOM_R,{code:u,timestamp:(new Date).getTime()},{traceId:i}),u===pe.SUCCESS&&(l=h.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,l),this.naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull()),[2,u]}}))}))},t.prototype._rejoinChrm=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,a.label=1;case 1:return i<t.length?(r=t[i],ft(Ue.L_REJOIN_CHATROOM_T,{chatroomId:r,count:e[r]||10,topic:Pr}),o=ct(),[4,this._joinChrm(r,e[r]||10,!0,o)]):[3,4];case 2:s=a.sent(),(s===pe.SUCCESS?ft:pt)(Ue.L_REJOIN_CHATROOM_R,{code:s,timestamp:(new Date).getTime()},{traceId:o}),s===pe.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:r,count:e[r]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:s}}),a.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l,d,f,p,g;return V(this,(function(_){switch(_.label){case 0:return this._channel?(i=this._chrmsQueue[e],r=i.pulling,o=i.timestamp,r?[2]:(i.pulling=!0,s=this._channel.codec.encodeChrmSyncMsg(o,t),a=new Ao(Do[Do.chrmPull],s,e),ft(Ue.L_PULL_CHATROOM_MSG_T,{chatroomId:e,timestamp:o}),[4,this._channel.send(a,yn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return c=_.sent(),u=c.code,h=c.data,i.pulling=!1,u===pe.SUCCESS&&h?(l=h.list,d=h.syncTime,f=h.finished,i.timestamp=n?Math.max(d,n):d,i.queue=i.queue.filter((function(e){return e>d})),p=[],g=[],l.forEach((function(e){e.sentTime<o||(p.push(e.messageUId),g.push(e))})),this._watcher.batchMessage(g),ft(Ue.L_PULL_CHATROOM_MSG_R,{code:u,timestamp:o,messageUIds:p.join(",")}),(!f||i.queue.length>0)&&this._pullChrmMsg(e),[2]):(pt(Ue.L_PULL_CHATROOM_MSG_R,{code:u,timestamp:o,messageUIds:""}),At.warn("pull chatroom msg failed, code:",u,", data:",h),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o;return V(this,(function(s){switch(s.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),i=new Ao(Dr,n,e),[4,t.send(i)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return r=s.sent(),(o=r.code)===pe.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return(i=this._channel)?(r=i.codec.encodeGetChatRoomInfo(t,n),o=new Ao(Do[Do.queryChrmI],r,e),[4,i.send(o,Bn)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==pe.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:return(r=this._channel)?(o=r.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:i}),s=new Ao(jr,o,e),[4,r.send(s,On,{conversation:{targetId:e}})]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),c=a.code,u=a.data,c!==pe.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=i.codec.encodeModifyChatRoomKV(e,t,r),a=t.type===Le.UPDATE?Vr:kr,c=new Ao(a,s,e),[4,i.send(c,xn)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return u=l.sent(),(h=u.code)===pe.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},r),[2,h]):[2,h]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d,f,p=this;return V(this,(function(g){switch(g.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(t.entries.forEach((function(t){var n=p._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?p.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(e,t,r),s=t.type===Le.UPDATE?xr:Gr,a=new Ao(s,o,e),[4,i.send(a,pi)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return c=g.sent(),u=c.code,-1!==[pe.SUCCESS,pe.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(u)&&(l=[],delete(d=Object.assign({},t)).entries,t.entries.forEach((function(e){l.push(Object.assign({},e,d))})),u===pe.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=c.data,At.warn("设置失败的属性:",f.errorKeys),h=f.errorKeys,f&&Array.isArray(f.errorKeys)&&f.errorKeys.forEach((function(e){var t=l.findIndex((function(t){return e.key===t.key}));-1!==t&&l.splice(t,1)}))),At.warn("设置成功的属性:",l),this._chrmEntryHandler.setLocal(e,{kvEntries:l,syncTime:(new Date).getTime()},r)),[2,{code:u,data:h}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=Le.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=Le.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=Le.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=Le.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=Le.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=Le.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:pe.SUCCESS,data:n})]:[3,1];case 1:return(i=this._channel)?(r=i.codec.encodePullChatRoomKV(0),o=new Ao(Do[Do.pullKV],r,e),[4,i.send(o,fi)]):[2,Promise.reject({code:pe.RC_NET_CHANNEL_INVALID})];case 2:return s=u.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&(c=a.kvEntries.find((function(e){return e.key===t})),void 0!==c)?[2,Promise.resolve({code:pe.SUCCESS,data:null==c?void 0:c.value})]:[2,Promise.resolve({code:pe.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:pe.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(i={},r=n.codec.encodePullChatRoomKV(0),o=new Ao(Do[Do.pullKV],r,e),[4,n.send(o,fi)]):[2,Promise.reject({code:pe.RC_NET_CHANNEL_INVALID})];case 2:return s=c.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&a.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),[2,Promise.resolve({code:pe.SUCCESS,data:i})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d,f;return V(this,(function(p){switch(p.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(t||(t=this._pullChatroomEntryTimestamp),o=i.codec.encodePullChatRoomKV(t),s=new Ao(Do[Do.pullKV],o,e),ft(Ue.L_PULL_CHATROOM_KV_T,{chatroomId:e,timestamp:t}),[4,i.send(s,fi)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return a=p.sent(),c=a.code,u=a.data,(c===pe.SUCCESS?ft:pt)(Ue.L_PULL_CHATROOM_KV_R,{code:c,timestamp:t}),c===pe.SUCCESS?(At.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(e,u,r),At.info("Save into cache success!"),l=(h=u).kvEntries,d=h.syncTime,this._pullChatroomEntryTimestamp=d||0,f=[],l.length>0&&(l.forEach((function(t){var n=t.key,i=t.value,r=t.type,o=t.timestamp;f.push({key:n,value:i,type:r,timestamp:o,chatroomId:e})})),this._watcher.chatroom({updatedEntries:f})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._channel?t.forEach((function(t){e._pullChrmMsg(t),e.naviInfo.kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),18e4)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,l,d,f,p,g;return V(this,(function(_){switch(_.label){case 0:return this._channel?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),i=!![j.PRIVATE,j.GROUP].includes(e)&&n.isStatusMessage,o=i?function(e){var t;return(t={},t[j.PRIVATE]=Do.ppMsgS,t[j.GROUP]=Do.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[j.PRIVATE]=Do.ppMsgP,t[j.GROUP]=Do.pgMsgP,t[j.CHATROOM]=Do.chatMsg,t[j.CUSTOMER_SERVICE]=Do.pcMsgP,t[j.RTC_ROOM]=Do.prMsgS,t)[e]}(e)||Do.ppMsgP,i&&(n.isPersited=!1,n.isCounted=!1),s=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(a=new No(Do[o],s,t)).setHeaderQos(Dt.AT_LEAST_ONCE),i?(this._channel.sendOnly(a),[2,{code:pe.SUCCESS,data:ys(e,t,P({},n),"",0,this.currentUserId)}]):(c=Date.now()-this._localConnectedTime+this._connectedTime,u=ys(e,t,P({},n),"",c,this.currentUserId),ft(Ue.L_SEND_MSG_T,{messageType:n.messageType,conversationType:j.ULTRA_GROUP,targetId:t,channelId:n.channelId},{traceId:r}),[4,this._channel.send(a)])):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return h=_.sent(),l=h.code,d=h.data,f=l===pe.SUCCESS?ft:pt,p=l===pe.SUCCESS?d.messageId:u.messageUId,f(Ue.L_SEND_MSG_R,{code:l,messageUId:p||""},{traceId:r}),l!==pe.SUCCESS?[2,{code:l,data:u}]:(g=d,this._sendMessageStore.setMessage(g.messageUId,g.timestamp),u.sentTime=g.timestamp,u.messageUId=g.messageUId,this._conversationManager.setConversationCacheByMessage(u,!0),[2,{code:pe.SUCCESS,data:u}])}}))}))},t.prototype.recallMsg=function(e,t,n,i,r){var o;return D(this,void 0,void 0,(function(){var s,a,c,u,h,l,d,f,p,g,_,m,v;return V(this,(function(E){switch(E.label){case 0:return this._channel?(s=r.user,a=r.extra,c=r.isDelete,u={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:c||!1},s&&(u.user=s),a&&(u.extra=a),h={content:u,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(o=r.pushConfig)||void 0===o?void 0:o.pushContent)||r.pushContent||"",channelId:r.channelId},l=Do[Do.recallMsg],d=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},h),(f=new No(l,d,this.currentUserId)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(f)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return p=E.sent(),g=p.code,_=p.data,e===j.ULTRA_GROUP&&dt(Ue.L_RECALL_ULTRA_MSG_S,{code:g,conversationType:e,targetId:t,channelId:r.channelId}),g!==pe.SUCCESS?[2,{code:g}]:(m=_,e===j.ULTRA_GROUP?(this._ultraMsgMap[m.messageUId]=m.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:pe.SUCCESS}]):(this._sendMessageStore.setMessage(m.messageUId,m.timestamp),v=ys(e,t,P(P({},h),{isPersited:!0}),m.messageUId,m.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:pe.SUCCESS,data:v}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeReadReceipt(t,n),r=new Ao(Do[Do.rrMsg],i,e),[4,this._channel.send(r)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeMessageReader(t,n),r=new Ao(Do[Do.rrList],i,e),[4,this._channel.send(r,Pi)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return D(this,void 0,void 0,(function(){var t,n;return V(this,(function(i){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new Ao(Do[Do.pullUS],t,this.currentUserId),[2,this._channel.send(n,Ti)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:return this._channel?(r=i&&"uploads"!==i?t||"":Yt(e,t),o=this._channel.codec.encodeGetFileToken(e,r,n||"",i||""),s=new Ao(Do[Do.qnTkn],o,this.currentUserId),[4,this._channel.send(s,ri)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),c=a.code,u=a.data,u=Object.assign(u,{fileName:r}),c===pe.SUCCESS?[2,{code:c,data:u}]:[2,{code:c}]}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l,d;return V(this,(function(f){switch(f.label){case 0:return this._channel?(r="",o="",s="",t===Oe.QINIU?(o=oi,s=ai):(o=si,s=ci),r=t===Oe.QINIU?Do[Do.qnUrl]:t===Oe.AWS?Do[Do.s3Url]:t===Oe.STC?Do[Do.stcUrl]:Do[Do.aliUrl],a=this._channel.codec.encodeGetFileUrl(o,e,n,i),c=new Ao(r,a,this.currentUserId),[4,this._channel.send(c,s)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return u=f.sent(),h=u.code,l=u.data,d=l,h===pe.SUCCESS?[2,{code:h,data:d}]:[2,{code:h}]}}))}))},t.prototype.disconnect=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData()},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,t,n,i,r){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:r}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),i=new Ao(Do[Do.addSeTag],n,this.currentUserId),[4,this._channel.send(i,Ei)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==pe.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([P(P({},e),{createdTime:a})],a),[2,{code:pe.SUCCESS,data:s}])}}))}))},t.prototype.removeTag=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),i=new Ao(Do[Do.delSeTag],n,this.currentUserId),[4,this._channel.send(i,Ei)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==pe.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:pe.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),i=new Ao(Do[Do.addSeTag],n,this.currentUserId),[4,this._channel.send(i,Ei)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==pe.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:pe.SUCCESS,data:s}])}}))}))},t.prototype.getTagList=function(){return D(this,void 0,void 0,(function(){var e,t;return V(this,(function(n){return e=this._userSettingManager.getTags(),t=this._conversationManager.getConversationListForTag(),e.forEach((function(e){e.conversationCount=t[e.tagId]?t[e.tagId].length:0})),[2,{code:pe.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s=this;return V(this,(function(a){switch(a.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Ao(Do[Do.addTag],n,this.currentUserId),[4,this._channel.send(i)]):[2,{code:pe.TAG_NOT_EXIST}]:[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return(r=a.sent().code)!==pe.SUCCESS?[2,{code:r}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:pe.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o=this;return V(this,(function(s){switch(s.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Ao(Do[Do.delTag],n,this.currentUserId),[4,this._channel.send(i)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return(r=s.sent().code)!==pe.SUCCESS?[2,{code:r}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:pe.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return this._channel?(n=e.conversationType,i=e.targetId,r=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._channel.codec.encodeUpdateConversationTag(o,[e]),a=new Ao(Do[Do.delTag],s,this.currentUserId),[4,this._channel.send(a)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return(c=u.sent().code)!==pe.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,i,t,r),[2,{code:pe.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return r=(i=this).currentUserId,(o=i._channel)?(s=o.codec.encodeOldConversationList({count:n,type:j.PRIVATE,startTime:t}),a=new Ao(Br,s,r),[4,o.send(a,An,{currentUserId:r,connectedTime:o.connectedTime})]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return c=d.sent(),u=c.code,h=c.data,l=this._conversationHasTagFilter(e,null==h?void 0:h.list),At.info("GetConversationListByTag",l),u!==pe.SUCCESS?[2,{code:u}]:[2,{code:u,data:l}]}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,i=[],r=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,c=n._conversationManager.get(o,s,a),u=c.hasMentioned,h=c.mentionedInfo,l=c.lastUnreadTime,d=c.notificationStatus,f=c.isTop,p=c.tags,g=c.unreadMessageCount,_=p&&p[e];if(_){var m=P(P({},t),{hasMentioned:u,mentionedInfo:h,lastUnreadTime:l,notificationStatus:d,isTop:f,unreadMessageCount:g});_.isTop?i.push(P(P({},m),{isTopInTag:!0})):r.push(P(P({},m),{isTopInTag:!1}))}})),k(k([],i.sort(o),!0),r.sort(o),!0)},t.prototype.getUnreadCountByTag=function(e,t){return D(this,void 0,void 0,(function(){var n;return V(this,(function(i){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:pe.SUCCESS,data:n}]):[2,{code:pe.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l,d;return V(this,(function(f){switch(f.label){case 0:return this._channel?(i=t.targetId,r=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(c=this._conversationManager.get(r,i,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(u=this._channel.codec.encodeUpdateConversationTag(a,[t]),h=new Ao(Do[Do.addTag],u,this.currentUserId),[4,this._channel.send(h)]):[2,{code:pe.NO_TAG_IN_CONVER}]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return(l=f.sent().code)!==pe.SUCCESS?[2,{code:l}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(r,i,d,o),[2,{code:pe.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return D(this,void 0,void 0,(function(){var n,i,r,o;return V(this,(function(s){if(!this._channel)return[2,{code:pe.RC_NET_CHANNEL_INVALID}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(o in n.tags)r.push({tagId:o,tagName:null===(t=i[o])||void 0===t?void 0:t.tagName});return[2,{code:pe.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:pe.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:pe.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===j.ULTRA_GROUP?(null===(t=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId),Promise.resolve({code:pe.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:pe.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===j.ULTRA_GROUP)return Promise.resolve({code:pe.METHOD_NOT_AVAILABLE});var i;if(!(i=e===j.ULTRA_GROUP?this._ultraGroupManager.get(j.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:pe.SUCCESS,data:Ce.NOT_SET});var r=i.notificationLevel;return re(i.notificationLevel)&&!re(i.notificationStatus)&&(r=Te.OPEN===i.notificationStatus?1:0),Promise.resolve({code:pe.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===j.ULTRA_GROUP?this._ultraGroupManager.get(j.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:pe.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:pe.SUCCESS,data:Te.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,o){return this.getHistoryMessage(e,t,n,i,r,o)},t.prototype.getUltraGroupList=function(){return D(this,void 0,void 0,(function(){var e,t;return V(this,(function(n){return this._isUltraGroupListExist?(e=Object.values(this._ultraGroupMap),e=Ts(e),t=cn(e),[2,{code:pe.SUCCESS,data:t}]):[2,{code:pe.METHOD_NOT_AVAILABLE}]}))}))},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:pe.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===Te.OPEN&&t.push({conversationType:j.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:pe.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:pe.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:j.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:pe.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:pe.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap){n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount)}return Promise.resolve({code:pe.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e){var t=0;for(var n in this._ultraGroupMap){var i=this._ultraGroupMap[n];i.targetId===e&&(t+=i.unreadMessageCount||0)}return Promise.resolve({code:pe.SUCCESS,data:t})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:pe.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap)t+=e?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return Promise.resolve({code:pe.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),D(this,void 0,void 0,(function(){var n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._channel?this._status!==_e.CONNECTED?[2,pe.RC_NET_UNAVAILABLE]:(n=Date.now(),i=this._channel.codec.encodeClearUnreadCount({conversationType:j.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new No(Do[Do.updUgRTime],i,this.currentUserId)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(r)]):[2,pe.RC_NET_CHANNEL_INVALID]:[2,Promise.resolve(pe.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===pe.SUCCESS&&(s=this._ultraGroupMap[t+"_"+e])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.lastReadTime=n),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p=this;return V(this,(function(g){switch(g.label){case 0:return this._channel&&this._status===_e.CONNECTED?(!1,t=this._channel.codec.encodeUltraGroup(e,false),n=new Ao(Do[Do.pullUgSes],t,this.currentUserId),[4,this._channel.send(n,An,{currentUserId:this.currentUserId,conversationType:j.ULTRA_GROUP})]):[2];case 1:return i=g.sent(),r=i.code,o=i.data,r===pe.SUCCESS&&o?(a=(null==o?void 0:o.list)||[],c=null==o?void 0:o.isFinished,a.forEach((function(e){e.notificationStatus=Te.CLOSE,e.notificationLevel=Ce.NOT_SET,e.isTop=!1,p._ultraGroupMap[e.channelId+"_"+e.targetId]=e,p._ultraGroupManager.addUltraGroupStatus(e)})),!1!==c?[3,2]:(u=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(u),[3,4])):(At.warn("pull super conversation failed, code:",r,", data:",o,"retrying..."),s=setTimeout((function(){p._firstPullUltraGroupTime=e,p._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return[4,this.pullConversationStatus(this._firstPullUltraGroupTime)];case 3:h=g.sent(),l=h.code,d=h.data,l!==pe.SUCCESS&&At.warn("pullConversationStatus fail code: ".concat(l,", data: ").concat(d)),f=Object.values(this._ultraGroupMap),f=Ts(f),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(cn(f)),0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),g.label=4;case 4:return[2]}}))}))},t.prototype._startUltraSyncInterval=function(){var e=this,t=function(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._syncUltraMsg(0),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._syncUltraMsg=function(e){var t;return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d,f,p,g,_=this;return V(this,(function(m){switch(m.label){case 0:return this._channel&&this._status===_e.CONNECTED?this._isUltraPulling?[2]:(At.info("start pull ultra msg, time: ".concat(e)),this._isUltraPulling=!0,n=this._channel.codec.encodeSuperSyncMsg(e),i=new Ao(Do[Do.pullUgMsg],n,this.currentUserId),r=ct(),ft(Ue.L_PULL_ULTRA_MSG_T,{timestamp:e},{traceId:r}),[4,this._channel.send(i,yn,{currentUserId:this.currentUserId,conversation:{conversationType:j.ULTRA_GROUP}})]):[2];case 1:if(o=m.sent(),s=o.code,a=o.data,At.info("end pull ultra msg, code: ".concat(s,", syncTime: ").concat(null==a?void 0:a.syncTime,", count: ").concat(null===(t=null==a?void 0:a.list)||void 0===t?void 0:t.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),s!==pe.SUCCESS||!a)return pt(Ue.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:"",timestamp:e},{traceId:r}),At.warn("sync super message failed, code:",s,", data:",a),this._isUltraPulling=!1,[2];if(this._isUltraPulling=!1,c=a.list,u=a.syncTime,h=a.finished,!this._isUltraGroupListExist)return At.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=u,[2];for(g in l=[],d={},f=[],c.forEach((function(e){var t,n,i,r=e.targetId,o=e.content,s=e.messageType,a=e.messageUId,c=e.channelId,h=e.isCounted;if(l.push(a),_._ultraMsgMap[a])delete _._ultraMsgMap[a];else{var p=0;((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===Se.ALL||(null===(i=null===(n=null==o?void 0:o.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===i?void 0:i.includes(_.currentUserId)))&&(p=1);var g=_._ultraGroupMap[c+"_"+r];if(g)h&&(s===Ee.RECALL?g.unreadMessageCount>0&&(g.unreadMessageCount-=1):(g.unreadMessageCount+=1,g.unreadMentionedCount+=p)),g.versionTime=u,g.latestMessage=e,d[c+"_"+r]=g,_._ultraGroupManager.addUltraGroupStatus(g);else{var m={conversationType:j.ULTRA_GROUP,targetId:r,channelId:c,unreadMessageCount:h?1:0,unreadMentionedCount:h?p:0,versionTime:u,latestMessage:e,notificationStatus:Te.CLOSE,notificationLevel:Ce.NOT_SET,isTop:!1};_._ultraGroupMap[c+"_"+r]=m,d[c+"_"+r]=m,_._ultraGroupManager.addUltraGroupStatus(m)}f.push(e)}})),Object.keys(d).length>0&&(At.info("notice ultragroups"),p=Object.values(d),p=Ts(p),this._watcher.conversation(cn(p))),ft(Ue.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:l.join(","),timestamp:u},{traceId:r}),At.info("notice ultragroup message"),this._watcher.batchMessage(f),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>u})),this._ultraMsgMap)this._ultraMsgMap[g]<u&&delete this._ultraMsgMap[g];return!1===h?this._syncUltraMsg(u):c&&c.length>0&&(this._lastSyncUltraMsgTimeStamp=u),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:("RC:SRSMsg"===t.messageType&&At.warn("ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),i=this._channel.codec.encodeUpMsg({conversationType:j.ULTRA_GROUP,targetId:e},t),(r=new No(Do[Do.ugMsg],i,e)).setHeaderQos(Dt.AT_LEAST_ONCE),o=Date.now()-this._localConnectedTime+this._connectedTime,s=ys(j.ULTRA_GROUP,e,P({},t),"",o,this.currentUserId),ft(Ue.L_SEND_MSG_T,{messageType:t.messageType,conversationType:j.ULTRA_GROUP,targetId:e,channelId:t.channelId},{traceId:n}),[4,this._channel.send(r)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return a=g.sent(),c=a.code,u=a.data,h=c===pe.SUCCESS?ft:pt,l=c===pe.SUCCESS?u.messageUId:s.messageUId,h(Ue.L_SEND_MSG_R,{code:c,messageUId:l||""},{traceId:n}),c!==pe.SUCCESS?[2,{code:c,data:s}]:(d=u,s.sentTime=d.timestamp,s.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,f=t.channelId||"",(p=this._ultraGroupMap[f+"_"+e])?p.latestMessage=s:(p={conversationType:j.ULTRA_GROUP,targetId:e,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:s.sentTime,latestMessage:s,notificationStatus:Te.CLOSE,notificationLevel:Ce.NOT_SET,isTop:!1},this._ultraGroupMap[f+"_"+e]=p,this._ultraGroupManager.addUltraGroupStatus(p)),this._watcher.conversation(cn([p])),[2,{code:c,data:s}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:(n=e.conversationType,i=e.channelId,r=e.targetId,o=this._channel.codec.encodeOperateStatus(r,n,i||"",t||0),(s=new No(Do[Do.operate],o,r)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(s)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return(a=c.sent().code)!==pe.SUCCESS?[2,{code:a,msg:pe[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:pe.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._channel.codec.encodeMsgQuery(e),(i=new Ao(Do[Do.qryMsg],n,this.currentUserId)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(i,zi)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==pe.SUCCESS?[2,{code:o,msg:pe[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(e){var n=e.messageUId;t[n]=e})),[2,{code:0,data:t}])}}))}))},t.prototype._pullOperateStatusNotify=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Xi),n=t.conversationType,i=t.info,r=t.summary;At.info("s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new No(Do[Do.upMsgEx],t,e.targetId)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==pe.SUCCESS?[2,{code:r,msg:pe[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype.modifyMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodemodifyMessage(e,this.currentUserId),(n=new No(Do[Do.modifyMsg],t,e.targetId)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==pe.SUCCESS?[2,{code:r,msg:pe[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p,g,_,m,v=this;return V(this,(function(E){switch(E.label){case 0:return this._channel?this._status!==_e.CONNECTED||this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._channel.codec.encodeQueryMsgChange(e),(n=new No(Do[Do.qryMsgChange],t,this.currentUserId)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(n,Qi)]):[2];case 1:if(i=E.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r!==pe.SUCCESS)return[2];for(p in a=(s=o||{}).hasNext,c=s.list,u=(null==o?void 0:o.syncTime)||0,h=[],l={},Array.isArray(c)&&c.forEach((function(e){var t=e,n=t.targetId,i=t.conversationType,r=t.sendTime,o=t.messageUId,s=t.changeType,a=t.operatorId,c=e.channelId||"",u=i+"_"+n,d=o+"_"+c+"_"+r,f=l[u];if(f)f.add(d);else{var p=new Set([d]);l[u]=p}3!==s?v._ultraMsgChangeMap[o]=s:(v._updateUltraGroupWhenRecallMsg(n,c,o),h.push({targetId:n,conversationType:i,sendTime:r,messageUId:o,senderUserId:a,channelId:c}))})),Array.isArray(h)&&h.length>0&&this._watcher.ultraGroupMessageRecalled(h),d=function(e){var t=e.split("_"),n=t.shift(),i=t.join("_"),r=l[e],o=[];r.forEach((function(e){var t=e.split("_"),n=t[0],i=t[1],r=t[2];o.push({sendTime:Number(r),messageUId:n,channelId:i})}));var s={targetId:i,conversationType:Number(n),messages:o};f._pullUltraMessageList(s)},f=this,l)d(p);for(_ in g=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(m=this._pullUltraChangeMessageQue).push.apply(m,g),this._ultraMsgMap)this._ultraMsgMap[_]<u&&delete this._ultraMsgMap[_];return a?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]}}))}))},t.prototype._pullUltraMessageList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u=this;return V(this,(function(h){switch(h.label){case 0:return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeMsgQuery(e),(n=new Ao(Do[Do.qryMsg],t,this.currentUserId)).setHeaderQos(Dt.AT_LEAST_ONCE),[4,this._channel.send(n,zi)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return i=h.sent(),r=i.code,o=i.data,r!==pe.SUCCESS?[2,{code:r,msg:pe[r]}]:(s=(o||{}).list,a=[],c=[],Array.isArray(s)&&s.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=u._ultraGroupMap[n+"_"+t];r&&r.latestMessage.messageUId===e.messageUId&&(r.latestMessage=e);var o=u._ultraMsgChangeMap[i+""];1===o?a.push(e):2===o&&c.push(e)})),a.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(a||[]),c.length>0&&this._watcher.ultraGroupMessageModified(c||[]),[2])}}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:(i=this._channel.codec.encodeGetHistoryMsg(e,t),r=new Ao(Do[Do.qryUgMsg],i,this.currentUserId),ft(Ue.L_GET_HISTORY_MSG_T,{targetId:e,conversationType:j.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count},{traceId:n}),[4,this._channel.send(r,On,{currentUserId:this.currentUserId,conversation:{conversationType:j.ULTRA_GROUP,targetId:e}})]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return o=u.sent(),s=o.code,a=o.data,s===pe.SUCCESS&&a?(c=[],a.list&&a.list.forEach((function(e){e&&c.push(e.messageUId)})),ft(Ue.L_GET_HISTORY_MSG_R,{code:s,messageUIds:c.join(",")},{traceId:n}),[2,{code:s,data:a}]):(pt(Ue.L_GET_HISTORY_MSG_R,{code:s,messageUIds:""},{traceId:n}),At.warn("get super history message failed, code:",s,", data:",a),[2,{code:s}])}}))}))},t.prototype.searchUltraGroupMessages=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(e){return this._channel?this._status!==_e.CONNECTED?[2,{code:pe.RC_NET_UNAVAILABLE}]:[2,{code:pe.SUCCESS}]:[2,{code:pe.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?(i=this._channel)?(r=i.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),o=new Ao(Do[Do.ugUnpushSet],r,e),[4,i.send(o)]):[3,2]:[2,Promise.resolve({code:pe.METHOD_NOT_AVAILABLE})];case 1:return s=c.sent(),a=s.code,pe.SUCCESS,[2,{code:a}];case 2:return[2,{code:pe.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?(n=this._channel)?(i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new Ao(Do[Do.ugUnpushQuery],i,e),[4,n.send(r,wi)]):[3,2]:[2,Promise.resolve({code:pe.METHOD_NOT_AVAILABLE})];case 1:return o=u.sent(),s=o.code,a=o.data,s===pe.SUCCESS&&a?(c=a.unpushLevel,[2,{code:s,data:c}]):[2,{code:s}];case 2:return[2,{code:pe.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n){var i="".concat(t,"_").concat(e);if(this._ultraGroupMap[i]){var r=this._ultraGroupMap[i],o=r.latestMessage;o&&o.messageUId===n&&(r.latestMessage=null)}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:pe.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s,a;return V(this,(function(c){return this._channel?(s=this._channel.codec.encodeJoinRTCRoom(t,n,i,r,o),a=new Ao(Do[Do.rtcRJoin_data],s,e),[2,this._channel.send(a,Kn)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return D(this,void 0,void 0,(function(){var t,n;return V(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Ao(Do[Do.rtcRExit],t,e),[4,this._channel.send(n)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new Ao(Do[Do.rtcPing],i,e),[4,this._channel.send(r)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return D(this,void 0,void 0,(function(){var t,n;return V(this,(function(i){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Ao(Do[Do.rtcRInfo],t,e),[2,this._channel.send(n,ei)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o;return V(this,(function(s){switch(s.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Ao(Do[Do.rtcUData],t,e),[4,this._channel.send(n,Kn)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return i=s.sent(),r=i.code,o=i.data,[2,{code:r,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeSetRTCUserInfo(t,n),r=new Ao(Do[Do.rtcUPut],i,e),[4,this._channel.send(r)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return D(this,void 0,void 0,(function(){var n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),i=new No(Do[Do.rtcUDel],n,e),[4,this._channel.send(i)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(s=this._channel.codec.encodeSetRTCData(t,n,i,r,o),a=new No(Do[Do.rtcSetData],s,e),[4,this._channel.send(a)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,i,r),s=new Ao(Do[Do.userSetData],o,e),[4,this._channel.send(s)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeUserSetRTCCDNUris(t,n),r=new Ao(Do[Do.userSetData],i,e),[4,this._channel.send(r)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){if(!this._channel)return Promise.resolve({code:pe.RC_NET_CHANNEL_INVALID});var r=this._channel.codec.encodeGetRTCData(t,n,i),o=new Ao(Do[Do.rtcQryData],r,e);return this._channel.send(o,zn)},t.prototype.removeRTCData=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,i,r),s=new No(Do[Do.rtcDelData],o,e),[4,this._channel.send(s)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,t){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new Ao(Do[Do.rtcToken],i,e),[2,this._channel.send(r,Jn)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return D(this,void 0,void 0,(function(){var n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),i=new Ao(Do[Do.rtcUserState],n,e),[4,this._channel.send(i)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:pe.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Ao(Do[Do.rtcUList],t,e);return this._channel.send(n,Kn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=ke.LIVE),D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new Ao(Do[Do.viewerJoinR],i,e),[4,this._channel.send(r,sr)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,a=o.data,s!==pe.SUCCESS?[2,{code:s}]:(u=(c=a).rtcToken,h=c.entries,[2,{code:s,data:{token:u,kvEntries:h}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Ao(Do[Do.viewerExitR],t,e),[4,this._channel.send(n)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(i=this._channel.codec.encodeIdentityChangeInfo(t,n),r=new Ao(Do[Do.rtcIdentityChange],i,e),[4,this._channel.send(r,Kn)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),s=o.code,a=o.data,s!==pe.SUCCESS?[2,{code:s}]:[2,{code:s,data:a}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(At.info("audience in room start pull KV"),r=n.codec.encodePullRTCRoomKV(e,0),o=new Ao(Do[Do.rtcPullKv],r,i),[4,n.send(o,ir)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),a=s.code,c=s.data,At.info("audience in room end pull KV, code: ".concat(a,", data: ").concat(JSON.stringify(c||{}))),a===pe.SUCCESS?(u=c.kvEntries,this._watcher.onRTCDataChange(u,e),[2,{code:a,data:c}]):[2,{code:a}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(r=n.codec.encodeQueryUserJoinedInfo(e),o=new Ao(Do[Do.rtcQueryJoined],r,i),[4,n.send(o,or)]):[2,{code:pe.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a===pe.SUCCESS?[2,{code:a,data:c}]:[2,{code:a}]}}))}))},t.prototype.getDeviceId=function(){return Et(this.runtime)},t.prototype.requestRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new Ao(Do[Do.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.cancelRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new Ao(Do[Do.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.responseRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new Ao(Do[Do.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.endRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new Ao(Do[Do.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(t=e.chatRoomId,n=this._channel.codec.encodebindRTCRoomForChatroom(e),i=new Ao(Do[Do.setRtcRoomId],n,t),[4,this._channel.send(i)]):[2,pe.RC_NET_CHANNEL_INVALID];case 1:return r=o.sent(),[2,r.code]}}))}))},t.prototype.callExtra=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Promise.resolve({code:pe.EXTRA_METHOD_UNDEFINED})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.removeFromBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},t.prototype.getBlacklistStatus=function(e){throw new Error("Method not implemented.")},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,i,r,o){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){throw new Error("Method not implemented.")},t}(Ho),Cs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return b(t,e),t.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return this._context.joinRTCRoom(e,t,n,i,r,o)},t.prototype.quitRTCRoom=function(e){return this._context.quitRTCRoom(e)},t.prototype.rtcPing=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return this._context.getRTCRoomInfo(e)},t.prototype.getRTCUserInfoList=function(e){return this._context.getRTCUserInfoList(e)},t.prototype.getRTCUserInfo=function(e){return this._context.getRTCUserInfo(e)},t.prototype.setRTCUserInfo=function(e,t,n){return this._context.setRTCUserInfo(e,t,n)},t.prototype.removeRTCUserInfo=function(e,t){return this._context.removeRTCUserInfo(e,t)},t.prototype.setRTCData=function(e,t,n,i,r,o){return this._context.setRTCData(e,t,n,i,r,o)},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return this._context.setRTCTotalRes(e,t,n,i,r)},t.prototype.setRTCCDNUris=function(e,t,n){return this._context.setRTCCDNUris(e,t,n)},t.prototype.getRTCData=function(e,t,n,i){return this._context.getRTCData(e,t,n,i)},t.prototype.removeRTCData=function(e,t,n,i,r){return this._context.removeRTCData(e,t,n,i,r)},t.prototype.setRTCOutData=function(e,t,n,i){return this._context.setRTCOutData(e,t,n,i)},t.prototype.getRTCOutData=function(e,t){return this._context.getRTCOutData(e,t)},t.prototype.getRTCToken=function(e,t,n){return this._context.getRTCToken(e,t,n)},t.prototype.setRTCState=function(e,t){return this._context.setRTCState(e,t)},t.prototype.getRTCUserList=function(e){return this._context.getRTCUserList(e)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)},t.prototype.quitLivingRoomAsAudience=function(e){return this._context.quitLivingRoomAsAudience(e)},t.prototype.rtcIdentityChange=function(e,t,n){return this._context.rtcIdentityChange(e,t,n)},t.prototype.requestRoomPK=function(e){return this._context.requestRoomPK(e)},t.prototype.cancelRoomPK=function(e){return this._context.cancelRoomPK(e)},t.prototype.responseRoomPK=function(e){return this._context.responseRoomPK(e)},t.prototype.endRoomPK=function(e){return this._context.endRoomPK(e)},t}(qo);function Rs(e){return Object.assign({},e)}var Ss,Ns=function(){function e(e,t){var n;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.3.4",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=_e.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},t),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this.apiPKGName=this._options.apiPKGName||"",this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter((function(e){return/^https?:\/\//.test(e)})),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")})),0===this._options.navigators.length&&(n=this._options.navigators).push.apply(n,a),ho({bundleId:this.apiPKGName}),function(e){lt=It.init(P(P({},e),{sessionId:Ze})),Ot()}({runtime:this._runtime,logSwitch:1,logPolicy:JSON.parse("{}"),appkey:this.appkey,version:this.apiVersion});var i={status:this._connectionStatusListener.bind(this),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this)};this._engine=rn()?new RCCppEngine(e,i,this._options):new Is(e,i,this._options)}return e.init=function(t,n){return ut({customLogPrint:n.logStdout,localLogLevel:n.logLevel}),At.setLogLevel(n.logLevel),At.setLogStdout(n.logStdout),ft(Ue.L_INIT_O,{appkey:n.appkey,navigators:n.navigators,connectionType:n.connectionType,logLevel:n.logLevel,typingExpireTime:n.typingExpireTime}),!1===n.indexDBSwitch&&(We.indexDBSwitch=!1),ft(Ue.L_IMSDK_VER_O,{commitId:"4a1b7760381616fa6a6cb2e0200d6a0dc56f90a1",version:"5.3.4"}),At.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(At.error("Repeat initialize!"),this._context):(At.warn("RCEngine Commit:","4a1b7760381616fa6a6cb2e0200d6a0dc56f90a1"),this._context=new e(t,n),this._context)},e.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},e.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return At.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new Cs(this):new qo(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(n,this._runtime,t)}catch(e){At.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&this._pluginContextQueue.push(n),i&&(this._pluginInstanseMap[e.tag]=i),i},e.prototype._handleRedirect=function(){return D(this,void 0,void 0,(function(){var e,t=this;return V(this,(function(n){switch(n.label){case 0:return At.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return(e=n.sent().code)!==pe.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(e),setTimeout((function(){t._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return D(this,void 0,void 0,(function(){return V(this,(function(n){return ft(Ue.L_CONNECT_S,{status:e}),[_e.REDIRECT,_e.BLOCKED,_e.KICKED_OFFLINE_BY_OTHER_CLIENT,_e.DISCONNECT_BY_SERVER,_e.DISCONNECTED,_e.NETWORK_UNAVAILABLE].includes(e)&&(fo(Po.IM_CONNECTION_DURATION,{endTime:(new Date).getTime(),code:e}),function(e){D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:t=Po.IM_CONNECTION_DURATION,n=lo().bundleId,i=po(t),r=i.startTime,o=i.endTime,s=i.code,a=ao.UNKONWN,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return a=h.sent(),[3,4];case 3:return c=h.sent(),At.debug(c.message),[3,4];case 4:return u=0,Z(r)&&Z(o)&&o>r&&r&&(u=o-r),oo(t,{bid:n,cod:s,dur:u,net:a}),[2]}}))}))}(this._runtime)),this._connectionStatus=e,e===_e.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(e),this._handleRedirect()):e===_e.BLOCKED||e===_e.KICKED_OFFLINE_BY_OTHER_CLIENT||e===_e.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(e)):e===_e.CONNECTING?this._handleConnecting():e===_e.CONNECTED?this._handleConnected():e===_e.DISCONNECTED?this._handleDisconnect(e):e===_e.NETWORK_UNAVAILABLE&&this._handleSuspend(e),(null===(t=this._watcher.rtcInnerWatcher)||void 0===t?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach((function(t){t.onconnectionstatechange&&t.onconnectionstatechange(e)})),this._watcher.connectionState&&this._watcher.connectionState(e),[2]}))}))},e.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},e.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},e.prototype._handleDisconnect=function(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)},e.prototype._handleSuspend=function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)},e.prototype._messageReceiver=function(e,t,n){var i,r,o;if((e.conversationType===j.RTC_ROOM||Object.prototype.hasOwnProperty.call(qe,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Rs(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==Ee.TYPING_STATUS||(this._addTypingInfo(Rs(e)),!this._watcher.typingState))if(e.messageType!==Ee.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==Ee.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Rs(e))}catch(e){return At.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(Rs(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var s=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic,a=this._engine.getCurrentUserId();s&&Array.isArray(s[a])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,s[a])}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,extra:e.content.extra});else{var c=e.content,u=c.startTime,h=c.endTime,l=c.platform,d=c.logId,f=c.uri,p=c.packageName,g={startTime:parseInt(u),endTime:parseInt(h),platform:l,logId:d,uri:f,packageName:p};null===(r=It.getInstance())||void 0===r||r.reportFullLog(g)}}else if("function"==typeof this._watcher.chatroomState){var _={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){_[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:_,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(i={},i[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?Pe.QUIT:Pe.JOIN,i),chatroomId:e.targetId}})},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[];e.forEach((function(e){var o=i._messageReceiver(e,t,n);o&&r.push(o)})),r.length&&this._watcher.batchMessage&&this._watcher.batchMessage(r)},e.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},e.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},e.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},e.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},e.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},e.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},e.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},e.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},e.prototype._ultraGroupEnableListener=function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)},e.prototype._operateStatusListener=function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)},e.prototype._ultraGroupMessageModifiedListener=function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)},e.prototype._ultraGroupMessageRecalledListener=function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];t._watcher[n]=ie(i)||ne(i)?i:void 0}}))},e.prototype.resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,i=e.targetId,r=e.content,o=e.channelId,s=r.typingContentType,a=o||"",c="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[c]||(this._typingInfo[c]=[]);var u=this._typingInfo[c].findIndex((function(e){return e.userId===t}));u>=0&&this._typingInfo[c][u].messageType===s?this._typingInfo[c][u].timestamp=Date.now():(u>=0&&this._typingInfo[c].splice(u,1),this._typingInfo[c].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(c)||this._typingChangedList.push(c),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}if(e._typingChangedList.length>0){var i=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(i),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._connectionStatus},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.connect=function(e,t,n,i){return void 0===t&&(t=!1),D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return this._connectionStatus===_e.CONNECTED?[2,{code:pe.SUCCESS,userId:this._engine.getCurrentUserId()}]:this._connectionStatus===_e.CONNECTING?[2,{code:pe.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:pe.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,r=e.split("@"),o=r[1],s=o?o.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],ft(Ue.L_GET_NAVI_T,{token:e,uris:s},{traceId:i}),[4,this._engine.getNaviInfo(this._getTokenWithoutNavi(),s,t,this._options.checkCA)]);case 1:return(a=l.sent())?(ft(Ue.L_GET_NAVI_R,{code:pe.SUCCESS,naviInfo:a},{traceId:i}),ft(Ue.L_ENV_S,{isEnterprise:1===(null==a?void 0:a.type)},{traceId:i}),1===(null==a?void 0:a.type)?[2,{code:pe.PACKAGE_ENVIRONMENT_ERROR}]:(c=Pt.getInfo(),ft(Ue.L_CONNECT_T,{token:e,refreshNavi:t,reconnectKickEnable:n},{traceId:i}),[4,this._engine.connect(this._getTokenWithoutNavi(),a,n,i)])):(pt(Ue.L_GET_NAVI_R,{code:pe.RC_NAVI_RESOURCE_ERROR},{traceId:i}),[2,{code:pe.RC_NAVI_RESOURCE_ERROR}]);case 2:return u=l.sent(),(u===pe.SUCCESS?ft:pt)(Ue.L_CONNECT_R,{code:u,userId:this._engine.getCurrentUserId()},{traceId:i}),u!==me.REDIRECT?[3,4]:(this._connectionStatus=_e.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,l.sent()];case 4:return h=this._engine.getCurrentUserId(),u===pe.SUCCESS&&(fo(Po.IM_CONNECTION_DURATION,{startTime:(new Date).getTime()},!0),At.info("connect success, userId: ".concat(h)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(c),St({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:h}),ut({userId:h}),this._isInternalConnected=!0),u!==pe.SUCCESS||rn()||1===a.openUS&&this._pullUserSettings(),u!==pe.SUCCESS&&(this._connectionStatus=_e.CONNECTION_CLOSED),[2,{code:u,userId:h}]}}))}))},e.prototype._pullUserSettings=function(){return D(this,void 0,void 0,(function(){return V(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=It.getInstance())||void 0===e||e.distroy(),ut({userId:""}),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){At.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(e){return this._isInternalConnected?Promise.resolve({code:pe.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getInfoFromCache=function(){return this._engine.getInfoFromCache(this._getTokenWithoutNavi())},e.prototype.registerMessageType=function(e,t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),this._engine.registerMessageType(e,t,n,i,r)},e.prototype.sendMessage=function(e,t,n,i,r){if(e!==j.ULTRA_GROUP){var o=this.getInfoFromCache();if(1===((null==o?void 0:o.grpRRVer)||0)&&n.messageType===Ee.READ_RECEIPT_RESPONSE)return Promise.resolve({code:pe.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,c=n.expansion;if(a){var u=he(c),h=u.isIllgalEx,l=u.isExKeyOrValLengthExceedLimit;if(u.isExceedLimit||l)return Promise.resolve({code:pe.EXPANSION_LIMIT_EXCEET});if(h)return Promise.resolve({code:pe.BIZ_ERROR_INVALID_PARAMETER})}var d=JSON.stringify(n.content);return K(d)>131072?Promise.resolve({code:pe.RC_MSG_CONTENT_EXCEED_LIMIT}):e===j.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,r):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(c=he(s),u=c.isIllgalEx,h=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||h?[2,Promise.resolve({code:pe.EXPANSION_LIMIT_EXCEET})]:u?[2,Promise.resolve({code:pe.BIZ_ERROR_INVALID_PARAMETER})]:(l={mid:r},s&&(l.put=s),o&&(l.del=o),a&&(l.removeAll=1),[4,this._engine.sendMessage(n,i,{content:l,messageType:Ee.EXPANSION_NOTIFY,channelId:t})])):[2,{code:pe.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return D(this,void 0,void 0,(function(){var i;return V(this,(function(r){return i=this.getInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:pe.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,n)]}))}))},e.prototype.getMessageReader=function(e,t,n){return D(this,void 0,void 0,(function(){var i;return V(this,(function(r){return i=this.getInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:pe.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){At.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=It.getInstance())||void 0===e||e.distroy(),ut({userId:""})},e.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),void 0===s&&(s=""),e===j.ULTRA_GROUP){var c={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(t,c,a)}return this._engine.getHistoryMessage(e,t,n,i,r,o,s||"",a)},e.prototype.getConversationList=function(e,t,n,i,r){if(void 0===e&&(e=300),void 0===r&&(r=""),t===j.ULTRA_GROUP){var o=pe.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:pe[o]})}return this._engine.getConversationList(e,t,n,i,r)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===j.ULTRA_GROUP?Promise.resolve(pe.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)},e.prototype.getUltraGroupList=function(){return this._engine.getUltraGroupList()},e.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},e.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),e===j.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(e,t,n)},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(j.ULTRA_GROUP)){var i=pe.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:pe[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[j.PRIVATE,j.GROUP,j.SYSTEM,j.PUBLIC_SERVICE],!!n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(e,t,n)},e.prototype.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),D(this,void 0,void 0,(function(){var r;return V(this,(function(o){return r=[{conversationType:e,targetId:t,notificationLevel:n,channelId:i}],[2,this._engine.batchSetConversationStatus(r)]}))}))},e.prototype.setConversationStatus=function(e,t,n,i,r){if(void 0===r&&(r=""),e===j.ULTRA_GROUP&&void 0!==n)return Promise.resolve(pe.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(e,t,n,i)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,i,r){return this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){return void 0===i&&(i=""),e===j.ULTRA_GROUP?Promise.resolve(pe.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,i)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,i)},e.prototype.joinChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,n)},e.prototype.joinExistChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return Jt(n)&&zt(i)?this._engine.setChatroomEntry(e,t):Promise.resolve(pe.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n],r=i.key,o=i.value;if(!Jt(r)||!zt(o))return Promise.resolve({code:pe.BIZ_ERROR_INVALID_PARAMETER})}var s=P(P({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,i=t.value;return Jt(n)&&zt(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(pe.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return Jt(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(pe.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n].key;if(!Jt(i))return Promise.resolve({code:pe.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return Jt(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(pe.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,i){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===i&&(i=0),this._engine.getChatroomHistoryMessages(e,i,t,n)},e.prototype.getFileToken=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return r=this.getInfoFromCache(),o=(null==r?void 0:r.bosAddr)||"",s=(null==r?void 0:r.uploadServer)||"",a=(null==r?void 0:r.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,i)];case 1:return c=l.sent(),u=c.code,h=c.data,u===pe.SUCCESS&&h?[2,Promise.resolve(Object.assign(h,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(u)]}}))}))},e.prototype.getFileUrl=function(e,t,n,i,r){return void 0===r&&(r=Oe.QINIU),D(this,void 0,void 0,(function(){var o,s,a;return V(this,(function(c){switch(c.label){case 0:return(null==i?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(e,r,t,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===pe.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return D(this,void 0,void 0,(function(){return V(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.length>1e3?[2,Promise.reject(pe.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return D(this,void 0,void 0,(function(){return V(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},e.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==j.ULTRA_GROUP){var t=pe.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:pe[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==j.ULTRA_GROUP?[2,{code:r=pe.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:pe[r]}]:i?(o=he(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:pe.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:pe.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:pe.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:c.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return D(this,void 0,void 0,(function(){var t;return V(this,(function(n){switch(n.label){case 0:return e.conversationType!==j.ULTRA_GROUP?[2,{code:t=pe.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:pe[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e){return this._engine.getUltraGroupUnreadCountByTargetId(e)},e.prototype.getAllUltraGroupUnreadCount=function(e){return void 0===e&&(e=!1),this._engine.getAllUltraGroupUnreadCount(e)},e.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},e.prototype.callExtra=function(e){for(var t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,k([e],n,!1))},e.prototype.clearConversations=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){switch(n.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){At.error(e)}}))},e.prototype.addToBlacklist=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return D(this,void 0,void 0,(function(){return V(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){return void 0===r&&(r=""),D(this,void 0,void 0,(function(){return V(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,i,r)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setUserStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,i){return void 0===t&&(t=[]),void 0===n&&(n=""),D(this,void 0,void 0,(function(){return V(this,(function(r){return[2,this._engine.searchConversationByContent(e,t,n,i)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,i,r,o,s){return void 0===s&&(s=""),D(this,void 0,void 0,(function(){return V(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,i,r,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(e,t,n,i)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return void 0===t&&(t=""),this._engine.getUltraGroupDefaultNotificationLevel(e,t)},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.setUltraGroupDefaultNotificationLevel(e,t,n)},e.prototype.getConversationNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationLevel(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(e,t,n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,o){return this._engine.getRemoteHistoryMessages(e,t,n,i,r,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.joinRTCRoom=function(e,t,n,i,r,o){return this._engine.joinRTCRoom(e,t,n,i,r,o)},e.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},e.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},e.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},e.prototype.setRTCUserInfo=function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)},e.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},e.prototype.setRTCData=function(e,t,n,i,r,o){return this._engine.setRTCData(e,t,n,i,r,o)},e.prototype.setRTCTotalRes=function(e,t,n,i,r){return void 0===r&&(r=""),this._engine.setRTCTotalRes(e,t,n,i,r)},e.prototype.setRTCCDNUris=function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)},e.prototype.getRTCData=function(e,t,n,i){return this._engine.getRTCData(e,t,n,i)},e.prototype.removeRTCData=function(e,t,n,i,r){return this._engine.removeRTCData(e,t,n,i,r)},e.prototype.setRTCOutData=function(e,t,n,i){return this._engine.setRTCOutData(e,t,n,i)},e.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},e.prototype.getRTCToken=function(e,t,n){return this._engine.getRTCToken(e,t,n)},e.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},e.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},e.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)},e.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},e.prototype.rtcIdentityChange=function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)},e.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},e.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},e.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},e.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},e.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e}();!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Ss||(Ss={}));var Os="5.3.4";export{Ho as AEngine,Ns as APIContext,w as AppStorage,bt as AssertRules,t as CONNECTION_TYPE,I as CPP_PROTOCAL_MSGTYPE_OPTION,qe as CallLibMsgType,Le as ChatroomEntryType,Pe as ChatroomMemberChangeType,Bo as CometChannel,me as ConnectResultCode,_e as ConnectionStatus,j as ConversationType,O as DB_LOG_FLUSH_FREQUENCY,N as DB_LOG_MAX_SIZE,hn as DelayTimer,pe as ErrorCode,Ut as EventEmitter,W as FileType,so as HttpMethod,m as IM_CHATROOM_PULL_INTERVAL_TIME,_ as IM_COMET_PULLMSG_TIMEOUT,l as IM_PING_INTERVAL_TIME,f as IM_PING_MIN_TIMEOUT,d as IM_PING_TIMEOUT,h as IM_SIGNAL_TIMEOUT,Ge as LiveRole,xe as LiveType,Me as LogLevel,Ae as LogSource,Ue as LogTagId,Mt as Logger,p as MAX_MESSAGE_CONTENT_BYTES,E as MAX_MESSAGE_EXPANSION_KEY_LENGTH,y as MAX_MESSAGE_EXPANSION_VAL_LENGTH,u as MINI_COMET_CONNECT_URIS,c as MINI_SOCKET_CONNECT_URIS,Se as MentionedType,Ve as MessageBlockType,de as MessageDirection,Ee as MessageType,i as NAVI_CACHE_DURATION,r as NAVI_REQ_TIMEOUT,ao as NetworkType,Ce as NotificationLevel,Te as NotificationStatus,M as ONE_LOG_SIZE_MAX,Be as OperateStatus,o as PING_REQ_TIMEOUT,a as PUBLIC_CLOUD_NAVI_URIS,qo as PluginContext,Ft as RCAssertError,S as REAT_TIME_LOG_SIZE,Fe as RTCApiType,Ke as RTCIdentityChangeType,He as RTCJoinType,ke as RTCMode,Cs as RTCPluginContext,n as ReceivedStatus,T as SEND_MESSAGE_TYPE_OPTION,C as STATUS_MESSAGE,v as STORAGE_ROOT_KEY,Ss as TagChangeType,Oe as UploadMethod,Pt as VersionManage,s as WEB_SOCKET_TIMEOUT,Go as WebSocketChannel,H as appendUrl,Kt as assert,cn as clone,nn as cloneByJSON,At as engineLogger,Zt as forEach,sn as formatConnectResponseCode,on as getBrowser,jt as getMimeKey,Yt as getUploadFileName,$t as indexOf,X as isArray,$ as isArrayBuffer,z as isBoolean,ie as isFunction,se as isHttpUrl,tn as isInObject,en as isInclude,oe as isNull,Z as isNumber,ne as isObject,J as isString,re as isUndefined,Jt as isValidChrmEntryKey,zt as isValidChrmEntryValue,ce as isValidConversationType,he as isValidExpansion,ue as isValidFileType,mt as logger,Xt as map,te as notEmptyArray,ae as notEmptyObject,ee as notEmptyString,Qt as pushConfigsToJSON,Wt as pushJSONToConfigs,B as todo,rn as usingCppEngine,Ht as validate,Os as version};
|
|
1
|
+
var e;!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"}(e||(e={}));var t,n=e,i=72e5,r=1e4,o=5e3,s=5e3,a=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],c=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],u=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],h=3e4,l=15e3,d=15e3,f=2e3,p=131072,_=45e3,m=18e4,v="RCV4-",y=32,E=4096,T={"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:Delivered":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},I={"RC:DizNtf":{isCounted:!1,isPersited:!1}},C=["RC:TypSts","RC:InterceptMsg"];!function(e){e.WEBSOCKET="websocket",e.COMET="comet"}(t||(t={}));var R,S=500,N=1e5,O=3e3,M=1e3,A=function(e){return R||(R={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}}),R},U=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),w=function(){function e(e,t){var n,i=t?"".concat("RCV4-").concat(t):"RCV4-";this._rootStorage=A(e);var r=this._rootStorage.get(i)||{};this._cache=new U(((n={})[i]=r,n)),this._storageKey=i}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e}(),L=function(e,t){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},L(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}L(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var P=function(){return P=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},P.apply(this,arguments)};function D(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}function V(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function k(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var G,B=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return b(t,e),t}(Error),x=function(e){return new B(e)},F=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var i=e.slice(t,n);return e=e.replace(i,(function(e){return e.toUpperCase()}))},K=function(e,t){void 0===t&&(t="utf-8");var n,i=0;if("utf-16"===t)for(var r=0,o=e.length;r<o;r++)i+=(n=e.charCodeAt(r))<=65535?2:4;else for(r=0,o=e.length;r<o;r++)i+=(n=e.charCodeAt(r))<127?1:n<=2047?2:n<=65535?3:4;return i},H=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},q=function(e){return e.match(/\d+(\.\d+){2}/)[0]};!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(G||(G={}));var Y,j=G;!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"}(Y||(Y={}));var Q,W=Y,J=function(e){return"string"==typeof e},z=function(e){return"boolean"==typeof e},Z=function(e){return"number"==typeof e&&!isNaN(e)},X=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},$=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},ee=function(e){return J(e)&&e.length>0},te=function(e){return X(e)&&e.length>0},ne=function(e){return"[object Object]"===Object.prototype.toString.call(e)},ie=function(e){return"[object Function]"===Object.prototype.toString.call(e)},re=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},oe=function(e){return"[object Null]"===Object.prototype.toString.call(e)},se=function(e){return J(e)&&/https?:\/\//.test(e)},ae=function(e){for(var t in e)return!0;return!1},ce=function(e){return Z(e)&&Object.prototype.hasOwnProperty.call(j,e)},ue=function(e){var t=!1;return J(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},he=function(e){return Z(e)&&Object.prototype.hasOwnProperty.call(W,e)},le=function(e){var t=!1,n=!1,i=!1;if(ne(e)){var r=Object.keys(e).length;for(var o in t=r>20,e)if(n||(n=J(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!i){var s=e[o];i=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}};!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(Q||(Q={}));var de,fe=Q;!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_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.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",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_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",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.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.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.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",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"}(de||(de={}));var pe,ge=de;!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.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",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"}(pe||(pe={}));var _e,me=pe,ve={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.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",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"}(_e||(_e={}));var ye,Ee=_e;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(ye||(ye={}));var Te,Ie=ye;!function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(Te||(Te={}));var Ce,Re=Te;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Ce||(Ce={}));var Se,Ne=Ce;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(Se||(Se={}));var Oe,Me=Se;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(Oe||(Oe={}));var Ae,Ue,we,Le,be=Oe;!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.STATISTICS=6]="STATISTICS",e[e.NONE=1e3]="NONE"}(Ae||(Ae={})),function(e){e.IM="IM",e.RTC="RTC"}(Ue||(Ue={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_O="A-init-O",e.L_INIT_O="L-init-O",e.P_INIT_O="P-init-O",e.A_CONNECT_T="A-connect-T",e.A_CONNECT_R="A-connect-R",e.A_CONNECT_S="A-connect-S",e.A_DISCONNECT_O="A-disconnect-O",e.A_RECONNECT_T="A-reconnect-T",e.A_RECONNECT_R="A_RECONNECT_R",e.L_CONNECT_T="L-connect-T",e.L_CONNECT_R="L-connect-R",e.L_CONNECT_S="L-connect-S",e.P_CONNECT_O="P-connect-O",e.P_CONNECT_S="P-connect-S",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-send_msg-R",e.P_SEND_MSG_T="P-send_msg-T",e.P_SEND_MSG_R="P-send_msg-R",e.L_SEND_MSG_T="L-send_msg-T",e.L_SEND_MSG_R="L-send_msg-R",e.L_PULL_MSG_T="L-pull_msg-T",e.L_PULL_MSG_R="L-pull_msg-R",e.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",e.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",e.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",e.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",e.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",e.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",e.A_DELETE_MESSAGES_S="A-delete_messages-S",e.P_DELETE_MSG_S="P-delete_msg-S",e.L_PULL_CONVERSATION_S="L-pull_conversation-S",e.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",e.A_REGTYP_O="A-regtyp-O",e.P_REGTYP_O="P-regtype-O",e.P_REGTYP_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_ENV_S="L-Env-S",e.L_GET_INDEX_NAVI_S="L-get_index_navi-S",e.A_JOIN_CHATROOM_T="A-join_chatroom-T",e.A_JOIN_CHATROOM_R="A-join_chatroom-R",e.L_JOIN_CHATROOM_T="L-join_chatroom-T",e.L_JOIN_CHATROOM_R="L-join_chatroom-R",e.A_QUIT_CHATROOM_T="A-quit_chatroom-T",e.A_QUIT_CHATROOM_R="A-quit_chatroom-R",e.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",e.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",e.L_MEDIA_S="L-media-S",e.L_MEDIA_UPLOAD_T="L-media_upload-T",e.L_MEDIA_UPLOAD_R="L-media_upload-R",e.G_UPLOAD_LOG_S="G-upload_log-S",e.G_UPLOAD_LOG_E="G-upload_log-E",e.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",e.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",e.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",e.A_GET_HISTORY_MSG_T="A-get_history_msg-T",e.A_GET_HISTORY_MSG_R="A-get_history_msg-R",e.L_GET_HISTORY_MSG_T="L-get_history_msg-T",e.L_GET_HISTORY_MSG_R="L-get_history_msg-R",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E"}(we||(we={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Le||(Le={}));var Pe,De=Le;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Pe||(Pe={}));var Ve,ke=Pe;!function(e){e[e.typing=0]="typing"}(Ve||(Ve={}));var Ge,Be,xe,Fe,Ke,He,qe,Ye=Ve;!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(Ge||(Ge={})),function(e){e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Be||(Be={})),function(e){e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY",e[e.MSG_RECALL=3]="MSG_RECALL",e[e.CHANNEL_CHANGE=4]="CHANNEL_CHANGE"}(xe||(xe={})),function(e){e[e.CHANNEL_DELETE=1]="CHANNEL_DELETE",e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",e[e.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Fe||(Fe={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING"}(Ke||(Ke={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(He||(He={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(qe||(qe={}));var je,Qe,We,Je={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(je||(je={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Qe||(Qe={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(We||(We={}));var ze="RC_Logs";function Ze(e){var t=e.target.result;if(1===e.oldVersion)try{t.deleteObjectStore(ze)}catch(e){console.warn("version 1 indexDB delete error, name: ".concat(e.name,", message: ").concat(e.message,", stack: ").concat(e.stack))}!function(e,t,n){var i;if(!e.objectStoreNames.contains(t)){var r=P({},n.objectStoreParams);i=e.createObjectStore(t,r),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){i.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,ze,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var Xe,$e=function(){function e(){}return e.init=function(){if("undefined"!=typeof window&&window&&window.indexedDB){if(e.indexDBSwitch&&!e.opening){e.opening=!0;var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(t){e.opening=!1,console.warn("open indexDB request failed "+t.target.error)},t.onsuccess=function(t){e.opening=!1,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.opening=!1,e._db=t.target.result,Ze(t)}}}else console.debug("IndexDB is not currently supported in the environment!")},e.getInstance=function(){return e._instance},e.prototype.addList=function(t,n){return new Promise((function(i){if(e._db){var r=e._db.transaction([t],"readwrite"),o=r.objectStore(t);n.forEach((function(e){null==o||o.add(e)})),r.oncomplete=function(e){i(!0)},r.onerror=function(e){i(!1)}}else i(!1)}))},e.prototype.getRangeData=function(t,n,i,r){return new Promise((function(o){if(e._db){var s=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(i,r),c=s.index(n),u=[],h=c.openCursor(a);h.onsuccess=function(e){var t=e.target.result;t?(u.push(t.value),t.continue()):o(u)},h.onerror=function(e){console.error(e),o([])}}else o([])}))},e.prototype.getCount=function(t,n){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readonly").objectStore(t).count();i.onsuccess=function(){n(i.result)},i.onerror=function(e){console.error(e),n(0)}}else n(0)}))},e.prototype.removeFirstData=function(t,n,i){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readwrite").objectStore(t),o=r.getAllKeys(IDBKeyRange.lowerBound(0),i);o.onsuccess=function(){var e=o.result;e.length>0&&(r.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))},e._db=null,e.indexDBSwitch=!0,e.opening=!1,e}(),et=function(e,t){return e+Math.floor(Math.random()*(t-e))},tt=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)}))},nt=function(){var e=tt();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,i=+e,r=[];do{var o=i%n;i=(i-o)/n,r.unshift(t[o])}while(i);return r.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},it=nt(),rt={};function ot(e){return 4-e}console&&((Xe={})[Ae.DEBUG]=console.debug.bind(console),Xe[Ae.INFO]=console.info.bind(console),Xe[Ae.WARN]=console.warn.bind(console),Xe[Ae.ERROR]=console.error.bind(console),Xe[Ae.FATAL]=console.log.bind(console),rt=Xe);var st=[],at=function(e){return J(e)||Z(e)||re(e)||z(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)};function ct(e,t,n,i){t=/^[\w]+-[\w]+-[\w]+?/.test(t)?t:"L-".concat(t,"-O"),i||(i=["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(t)?Ue.RTC:Ue.IM);var r=Date.now(),o="";try{o=(o=JSON.stringify({message:n,userId:ht.userId})).replace(/"/g,'""'),o='"'.concat(o,'"')}catch(e){Tt(we.G_UPLOAD_LOG_E,{name:e.name,message:e.message,stack:e.stack})}K(o)>=1e3&&(o=function(e,t,n){if(void 0===n&&(n="utf-8"),!e||!t)return"";var i="utf-8"===n?3:2,r=0,o=0,s="";for(o=0;o<e.length;o++){if(e.charCodeAt(o)>255?r+=i:r++,r>t)return s;s+=e.charAt(o)}return e}(o,1e3));var s=ot(e),a={sessionId:it,time:r,level:s,content:"".concat(it,",").concat(Date.now(),",").concat(i,",").concat(s,",").concat(t,",").concat(o,"\n"),userId:ht.userId};return st.push(a),a}function ut(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];console&&rt[e]&&rt[e].apply(rt,k(["".concat(t,":")],n,!1))}var ht={localLogLevel:Ae.WARN,userId:""},lt=-1;lt>=0&&(clearInterval(lt),lt=-1),"undefined"!=typeof window&&window&&window.indexedDB&&(lt=setInterval((function(){st.length&&function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:if(!(t=$e.getInstance()))return[3,6];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,t.addList(ze,e)];case 2:return n=r.sent(),[4,t.getCount(ze,"time")];case 3:return r.sent()>1e5&&t.removeFirstData(ze,"time",2e3),[2,n];case 4:return i=r.sent(),Tt(we.G_UPLOAD_LOG_E,{name:i.name,message:i.message,stack:i.stack}),[2,!1];case 5:return[3,7];case 6:return $e.init(),[2,!1];case 7:return[2]}}))}))}(st.slice()).then((function(e){e&&(st=[])}))}),3e3));var dt=Date.now(),ft=0;function pt(){var e=Date.now();return dt!==e&&(dt=e,ft=0),"".concat(dt,"-").concat(ft++)}function gt(e){!e.customLogPrint&&delete e.customLogPrint,ht=Object.assign(ht,e)}function _t(e,t,n,i){if(void 0===n&&(n={}),void 0===i&&(i={}),e>Ae.DEBUG&&(i&&(n=Object.assign(n,i)),ct(e,t,n,null==i?void 0:i.logSource)),e>=ht.localLogLevel){var r="".concat((new Date).toISOString(),"[").concat(t,"][").concat(Ae[e],"]"),o="".concat(r," - ").concat(at(n));ht.customLogPrint?ht.customLogPrint(e,o):ut(e,r,at(n))}}var mt,vt=_t.bind(null,Ae.DEBUG),yt=_t.bind(null,Ae.INFO),Et=_t.bind(null,Ae.WARN),Tt=_t.bind(null,Ae.ERROR),It=_t.bind(null,Ae.FATAL),Ct=Object.freeze({__proto__:null,sessionId:it,logLevelTransformer:ot,formatLogObj:at,insertIntoLogCache:ct,_defaultStdout:ut,ID:pt,init:gt,log:_t,debug:vt,info:yt,warn:Et,error:Tt,fatal:It}),Rt=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},St=function(e){var t="RCDeviceId",n=A(e),i="",r=n.get(t);return r?i=r:(i=nt(),n.set(t,i)),i},Nt=function(){function e(){}return e.compress=function(e){for(var t=this,n={},i=0;i<e.length-1;i++){var r=e.charAt(i)+e.charAt(i+1);n.hasOwnProperty(r)?n[r].push(i):n[r]=[i]}for(var o=[],s=[],a=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var n=t.numberEncode(e.length),i=String.fromCharCode(t.dataType.NormalExt|n.length);o.push(i+n)}else{var r=String.fromCharCode(t.dataType.Normal|e.length);o.push(r)}o.push(e)}},c=0;c<e.length;){var u=t.indexOf(n,e,c);if(u.length<2)s.push(e.charAt(c++));else if(u.length<4)s.push(e.substr(c,u.length)),c+=u.length;else{var h=t.numberEncode(c-u.offset),l=t.numberEncode(u.length);if(h.length+l.length>=u.length)s.push(e.substr(c,u.length)),c+=u.length;else{a();var d=String.fromCharCode(t.dataType.Compressed|h.length<<2|l.length);o.push(d+h+l),c+=u.length}}}a();var f=t.numberEncode(e.length),p=String.fromCharCode(t.dataType.Tail|f.length);return o.push(p+f),o.join("")},e.uncompress=function(e){var t=this,n=0,i="";e:do{var r=e.charCodeAt(n++),o=r&t.dataType.Mark,s=15&r,a=void 0;switch(o){case t.dataType.Compressed:var c=s>>2,u=3&s;if(0===c||0===u)throw new Error("Data parsing error,at "+n);var h=t.numberDecode(e.substr(n,c)),l=t.numberDecode(e.substr(n+=c,u));if((h=i.length-h)+l>i.length)throw new Error("Data parsing error,at "+n);n+=u,i+=i.substr(h,l);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,s)))!==i.length)throw console.log(i.length),console.log(a),new Error("Data parsing error,at "+n);n+=s;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,s)),i+=e.substr(n+=s,a),n+=a;break;case t.dataType.Normal:i+=e.substr(n,s),n+=s;break;case t.dataType.Mark:if(s>10)throw new Error("Data parsing error,at "+n);i+=e.substr(n,16+s),n+=16+s;break;default:throw new Error("Data parsing error,at "+n+" header:"+o)}}while(n<e.length);return i},e.indexOf=function(e,t,n){var i={length:0,offset:-1};if(t.length,n>=t.length-1)return i;var r=e[t.charAt(n)+t.charAt(n+1)];if(r[0]===n)return i;for(var o=t.length-n,s=0,a=r.length;s<a;s++){var c=r[s],u=n-c;if(!(u>this.max)){var h=Math.min(o,u);if(h<=i.length)break;if(!(i.length>2&&t.charAt(c+i.length-1)!==t.charAt(n+i.length-1))){for(var l=2,d=l;d<h&&t.charAt(c+d)===t.charAt(n+d);d++)l++;l>=i.length&&(i.length=l,i.offset=c)}}}return i},e.numberEncode=function(e){var t=this,n=[],i=0;do{i=e%t.scale,n.push(t.chars.charAt(i)),e=(e-i)/t.scale}while(e>0);return n.join("")},e.numberDecode=function(e){for(var t=0,n=0,i=e.length-1;i>=0;i--){if(-1===(n=this.chars.indexOf(e.charAt(i))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t},e.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},e.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.scale=e.chars.length,e.max=238327,e}(),Ot=function(e){return J(e)&&/https?:\/\//.test(e)},Mt=function(){function e(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=St(e.runtime),this.logSwitch=e.logSwitch;var t=Rt(e.runtime);this.deviceInfo="".concat(t.type,"|").concat(t.version,"|").concat(null==e?void 0:e.sessionId)}return e.prototype.updateUploadLogAttr=function(e){var t=e.logPolicy,n=e.logSwitch,i=e.runtime,r=e.sessionId,o=void 0===r?"":r,s=e.userId;if(t){var a=t.url,c=t.level,u=t.itv,h=t.times;this.logUrl=a||this.logUrl,this.level=c||this.level,this.itv=u||this.itv,this.times=h||this.times}if(n&&(this.logSwitch=n),i){this.deviceId=St(i);var l=Rt(i);this.deviceInfo="".concat(l.type,"|").concat(l.version,"|").concat(o)}s&&(this.info.userId=s)},e.init=function(t){return e.reportSwitch=!0,e._instance||(e._instance=new e(t)),e._instance},e.getInstance=function(){return e._instance},e.prototype.reportRealtimeLog=function(t){var n=this;if(0===t.length||!this.logUrl)return Promise.resolve();var i=Nt.compress(t.map((function(e){return e.content})).join("")),r=Ot(this.logUrl)?"":"https://",o="".concat(r).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");return this.info.runtime.httpReq({method:"POST",url:o,body:i}).then((function(t){var i=t.data;i&&(i=JSON.parse(i),n.itv=i.nextTime,n.level=i.level,n.logSwitch=i.logSwitch,e.currentRTTimes=1)}))},e.prototype.reportFullLog=function(t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:return n=t.startTime,i=t.endTime,r=t.platform,o=t.logId,s=t.uri,a=$e.getInstance(),"web"===r.toLowerCase()&&a?n>i?[2]:[4,a.getRangeData(ze,"time",n,i)]:[2];case 1:return c=(c=f.sent()).filter((function(e){return!e.userId||e.userId===d.info.userId})),u=Nt.compress(c.map((function(e){return e.content})).join("")||"no data"),5e3,h=1,l=function(){if(h>3||!e.reportSwitch)return Promise.resolve();var t=s||d.logUrl,n=Ot(t)?"":"https://",i="".concat(n).concat(t,"?version=").concat(d.info.version,"&appkey=").concat(d.info.appkey,"&userId=").concat(d.info.userId,"&logId=").concat(o,"&deviceId=").concat(d.deviceId,"&deviceInfo=").concat(d.deviceInfo,"&platform=Web"),r=5e3*(h-1);return h++,new Promise((function(t,n){setTimeout((function(){e.reportSwitch&&d.info.runtime.httpReq({url:i,method:"POST",body:u}).then((function(){t()})).catch((function(e){n(e),l()}))}),r)}))},[2,l()]}}))}))},e.prototype.distroy=function(){e.currentRTTimes=1,e.reportSwitch=!1},e.currentRTTimes=1,e.reportSwitch=!1,e}(),At=[],Ut=-1;function wt(e){mt&&mt.updateUploadLogAttr(e)}function Lt(e,t,n,i){ct(4-e,t,n);var r=JSON.stringify({message:n});r=r.replace(/"/g,'""'),r='"'.concat(r,'"');var o={level:e,content:[it,Date.now(),i||Ue.IM,e,t,r].join()+"\n"};At.push(o),At.length>=600&&(At=At.slice(-500))}function bt(){if(Ut>=0&&(clearTimeout(Ut),Ut=-1),mt&&mt.logSwitch&&Mt.reportSwitch){var e=mt.itv*Math.pow(2,Mt.currentRTTimes-1);Mt.currentRTTimes<mt.times&&Mt.currentRTTimes++,Ut=setTimeout((function(){var e=At.filter((function(e){return e.level<=mt.level}));0===e.length?bt():mt.reportRealtimeLog(e).then((function(){At=[],yt(we.G_UPLOAD_LOG_S,"report real-time log success"),bt()})).catch((function(e){yt(we.G_UPLOAD_LOG_E,"report real-time log error -> "+e),bt()}))}),1e3*e)}}var Pt=function(){function e(e,t,n){this.tagId=e,this.logSource=t,this.initiator=n,this._localLogLevel=Ae.WARN,this.debug=this.log.bind(this,Ae.DEBUG),this.info=this.log.bind(this,Ae.INFO),this.warn=this.log.bind(this,Ae.WARN),this.error=this.log.bind(this,Ae.ERROR),this.fatal=this.log.bind(this,Ae.FATAL),this.reportLog=Lt}return e.prototype.setLogLevel=function(e){this._localLogLevel="number"!=typeof e?Ae.WARN:e},e.prototype.setLogStdout=function(e){this._customLogPrint=e},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e>Ae.DEBUG&&ct(e,this.tagId,t.map(at).join(" ")),!(e<this._localLogLevel)){var i="".concat((new Date).toISOString(),"[").concat(this.tagId,"][").concat(Ae[e],"]"),r="".concat(i," - ").concat(t.map(at).join(" "));this._customLogPrint?this._customLogPrint(e,r):this._stdout?this._stdout(e,r):ut.apply(void 0,k([e,i],t,!1))}},e.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},e.prototype.setStdout=function(e){this._stdout=e},e}(),Dt=new Pt("RCEngine"),Vt=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var i=this._map[e];i&&((i=i.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=i:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=this._map[e];if(i)for(var r=i.length-1;r>=0;r-=1){var o=i[r],s=o.target,a=o.once,c=o.listener;a&&i.splice(r,1);try{c.call.apply(c,k([s],t,!1))}catch(e){Dt.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),kt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};kt.engine="5.4.2-beem.1";var Gt,Bt,xt=function(){function e(){}return e.add=function(e,t){kt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return Dt.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 kt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return kt},e}();!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK",e[e.CHANNEL_ID=7]="CHANNEL_ID",e[e.CONVERSATION=8]="CONVERSATION"}(Bt||(Bt={}));var Ft,Kt,Ht,qt,Yt,jt=((Gt={})[Bt.STRING]=ee,Gt[Bt.ONLY_STRING]=J,Gt[Bt.NUMBER]=Z,Gt[Bt.BOOLEAN]=function(e){return"boolean"==typeof e},Gt[Bt.OBJECT]=ne,Gt[Bt.ARRAY]=X,Gt[Bt.CALLBACK]=function(e){var t=!0;return ne(e)||(t=!1),(e=e||{}).onSuccess&&!ie(e.onSuccess)&&(t=!1),e.onError&&!ie(e.onError)&&(t=!1),t},Gt[Bt.CHANNEL_ID]=ue,Gt[Bt.CONVERSATION]=function(e){var t=!0;return ne(e)||(t=!1),J(e.targetId)||(t=!1),ce(e.conversationType)||(t=!1),re(e.channelId)||ue(e.channelId)||(t=!1),t},Gt),Qt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return b(t,e),t}(Error),Wt=function(e,t,n,i){if(void 0===i&&(i=!1),!Jt(e,t,n,i))throw new Qt("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},Jt=function(e,t,n,i){void 0===i&&(i=!1),n=jt[n]||n;var r=i&&!n(t)||!i&&!(re(t)||null===t||n(t));return r&&Dt.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!r},zt=function(e){if(!ne(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)},Zt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),i=tt(),r=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),i=t.getMonth()+1,r=t.getDate();return"".concat(n).concat(e).concat(i).concat(e).concat(r)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s="."+a[a.length-1]}return"".concat(e,"__RC-").concat(r,"_").concat(n,"_").concat(o).concat(i).concat(s)},Xt=function(e){var t="application/octet-stream";switch(e){case W.IMAGE:t="image/jpeg";break;case W.AUDIO:t="audio/amr";break;case W.VIDEO:t="video/3gpp";break;case W.SIGHT:t="video/mpeg4";break;case W.COMBINE_HTML:t="text/html"}return t},$t=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,c=t.channelIdOPPO,u=t.typeVivo,h=t.googleConfig,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=i||"",l.category=r||"",l.richMediaUri=o||"";var d={};d.collapse_key=null==h?void 0:h.collapseKey,d.imageUrl=null==h?void 0:h.imageUrl;var f=null==h?void 0:h.priority;f&&!["high","normal"].includes(f)&&(f="normal"),d.priority=f;var p=[{HW:{channelId:a||""}},{MI:{channelId:s||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||""}},{APNS:l},{FCM:d}];return JSON.stringify(p)},en=function(e,t){var n={},i={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:i};try{var r=JSON.parse(e);null==r||r.forEach((function(e){var t,r,o,s,a=Object.keys(e);if(0!==a.length){var c=a[0];switch(c){case"HW":return void(i.channelIdHW=null===(t=e[c])||void 0===t?void 0:t.channelId);case"MI":return void(i.channelIdMi=null===(r=e[c])||void 0===r?void 0:r.channelId);case"OPPO":return void(i.channelIdOPPO=null===(o=e[c])||void 0===o?void 0:o.channelId);case"VIVO":return void(i.typeVivo=null===(s=e[c])||void 0===s?void 0:s.classification);case"APNS":return n.threadId=e[c]["thread-id"],n.apnsCollapseId=e[c]["apns-collapse-id"],n.category=e[c].category,void(n.richMediaUri=e[c].richMediaUri);case"FCM":i.googleConfig={collapseKey:e[c].collapse_key||"",imageUrl:e[c].imageUrl||"",priority:e[c].priority||""}}}}))}catch(t){Dt.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:i}},tn=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},nn=function(e){var t=e.length;return t<=4096&&t>=1},rn=function(e,t,n){t=t||function(){};var i=(n=n||{}).isReverse;ne(e)&&function(){for(var n in e)t(e[n],n,e)}(),(X(e)||J(e))&&function(){if(i)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var r=0,o=e.length;r<o;r++)t(e[r],r)}()},on=function(e,t){return rn(e,(function(n,i){e[i]=t(n,i)})),e},sn=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return rn(e,(function(e,i){t===e&&(n=i)})),n},an=function(e,t){return-1!==sn(e,t)},cn=function(e,t){var n=[];return rn(e,(function(e){n.push(e)})),-1!==sn(n,t)},un=function(e){return JSON.parse(JSON.stringify(e))},hn=function(){return"undefined"!=typeof RCCppEngine},ln=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},dn=function(e){switch(e){case ve.SERVER_UNAVAILABLE:return ge.SERVER_UNAVAILABLE;case ve.TOKEN_INCORRECT:return ge.RC_CONN_USER_OR_PASSWD_ERROR;case ve.REDIRECT:return ge.RC_CONN_REDIRECTED;case ve.APP_BLOCK_OR_DELETE:return ge.RC_CONN_APP_BLOCKED_OR_DELETED;case ve.BLOCK:return ge.RC_CONN_USER_BLOCKED;case ve.TOKEN_EXPIRE:return ge.RC_CONN_USER_OR_PASSWD_ERROR;case ve.HOSTNAME_ERROR:return ge.HOSTNAME_ERROR;case ve.HASOHTERSAMECLIENTONLINE:return ge.HAS_OHTER_SAME_CLIENT_ON_LINE;case ve.APP_AUTH_NOT_PASS:return ge.RC_APP_AUTH_NOT_PASS;case ve.OTP_USED:return ge.RC_OTP_USED;case ve.PLATFORM_ERROR:return ge.RC_PLATFORM_ERROR;default:return ge.RC_NET_UNAVAILABLE}},fn=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(fn(e[n]));else for(var n in t={},e)t[n]=fn(e[n]);else t=e;return t},pn=function(e){var t;try{t=fn(e)}catch(n){Dt.error("clone err:",n),t=JSON.parse(JSON.stringify(e))}return t},gn=function(e){var t={},n=JSON.parse(e);return rn(n,(function(e,n){t[n]=e.v})),t},_n={_delayTime:0,setTime:function(e){var t=(new Date).getTime();_n._delayTime=t-e},getTime:function(){var e=_n._delayTime;return(new Date).getTime()-e}},mn=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(Ft||(Ft={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(Kt||(Kt={})),function(e){e.CONN_ACK="ConnAckMessage",e.DISCONNECT="DisconnectMessage",e.PING_REQ="PingReqMessage",e.PING_RESP="PingRespMessage",e.PUBLISH="PublishMessage",e.PUB_ACK="PubAckMessage",e.QUERY="QueryMessage",e.QUERY_CON="QueryConMessage",e.QUERY_ACK="QueryAckMessage"}(Ht||(Ht={})),function(e){e.PUB="pub",e.QUERY="qry"}(qt||(qt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Yt||(Yt={}));var vn,yn=function(){function e(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=Ft.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Ft.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var r=e>0;e&&r&&1===arguments.length?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=8==(8&e)):(this.type=e,this._retain=t,this.qos=n,this._dup=i)}return e.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0},e}(),En=function(){function e(){}return e.writeUTF=function(e,t){var n=[],i=0;if(J(e))for(var r=0,o=e.length;r<o;r++){var s=e.charCodeAt(r);s>=0&&s<=127?(i+=1,n.push(s)):s>=128&&s<=2047?(i+=2,n.push(192|31&s>>6),n.push(128|63&s)):s>=2048&&s<=65535&&(i+=3,n.push(224|15&s>>12),n.push(128|63&s>>6),n.push(128|63&s))}for(r=0,o=n.length;r<o;r++)n[r]>255&&(n[r]&=255);return t?n:i<=255?[0,i].concat(n):[i>>8,255&i].concat(n)},e.readUTF=function(e){for(var t,n,i=[],r=-1,o=e,s="";++r<o.length;){var a=Number(o[r]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++r])<<6|128^o[++r])<<6|128^o[++r]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++r])<<6|128^o[++r]:192==(192&a)&&(a=(a^=192)<<6|128^o[++r])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?i.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,i.push(t,n)),(r+1===o.length||i.length>16384)&&(s+=String.fromCharCode.apply(null,i),i.length=0)}return s},e}(),Tn=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return En.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),In=function(){function e(){this._pool=[],this._position=0,this._writen=0}return e.prototype.write=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},e.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},e.prototype.writeUTF=function(e){var t=En.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),Cn="UpStreamMessage",Rn="PushExtra",Sn="DownStreamMessage",Nn="DownStreamMessages",On="SessionsAttQryInput",Mn="SessionsAttOutput",An="SyncRequestMsg",Un="ChrmPullMsg",wn="NotifyMsg",Ln="HistoryMsgInput",bn="HistoryMsgOuput",Pn="RelationQryInput",Dn="RelationsOutput",Vn="DeleteSessionsInput",kn="SessionInfo",Gn="DeleteSessionsOutput",Bn="RelationsInput",xn="DeleteMsgInput",Fn="CleanHisMsgInput",Kn="SessionMsgReadInput",Hn="ChrmInput",qn="ChrmOutput",Yn="QueryChatRoomInfoInput",jn="QueryChatRoomInfoOutput",Qn="RtcInput",Wn="RtcUserListOutput",Jn="SetUserStatusInput",zn="RtcSetDataInput",Zn="RtcUserSetDataInput",Xn="RtcDataInput",$n="RtcSetOutDataInput",ei="MCFollowInput",ti="RtcTokenOutput",ni="RtcQryOutput",ii="RtcQryUserOutDataInput",ri="RtcUserOutDataOutput",oi="RtcQueryListInput",si="RtcRoomInfoOutput",ai="RtcValueInfo",ci="RtcKeyDeleteInput",ui="GetQNupTokenInput",hi="GetQNupTokenOutput",li="GetQNdownloadUrlInput",di="GetDownloadUrlInput",fi="GetQNdownloadUrlOutput",pi="GetDownloadUrlOutput",gi="ChrmKVEntity",_i="SetChrmKV",mi="SetChrmKVS",vi="DeleteChrmKVS",yi="ChrmKVOutput",Ei="ChrmKVSOutput",Ti="ChrmKVSVersionEntity",Ii="ChrmKVSOutputEntity",Ci="QueryChrmKV",Ri="SetUserSettingInput",Si="SetUserSettingOutput",Ni="PullUserSettingInput",Oi="PullUserSettingOutput",Mi="UserSettingNotification",Ai="SessionReq",Ui="SessionStates",wi="SessionState",Li="SessionStateItem",bi="SessionStateModifyReq",Pi="SessionStateModifyResp",Di="GroupUnpushQuery",Vi="GroupUnpushSet",ki="GroupUnpushResult",Gi="GrpReadReceiptMsg",Bi="GrpReadReceiptQryReq",xi="GrpReadReceiptQryResp",Fi="GrpMsgReadUser",Ki="SessionTagAddInput",Hi="SessionTagItem",qi="SessionTagDelInput",Yi="SessionDisTagReq",ji="ReportSDKInput",Qi="ReportSDKOutput",Wi="UltraGrpPullSes",Ji="UltraGrpPullMsg",zi="MsgChangeReq",Zi="QueryMsgChange",Xi="MsgChange",$i="MsgChangeList",er="MsgQuery",tr="MessageQueryInfo",nr="MsgQueryAck",ir="OperateStatus",rr="OperateStatusNotify",or="OperateInfo",sr="OperateSummary",ar="RtcNotifyMsg",cr="RtcPullKV",ur="RtcKVOutput",hr="RtcQueryUserJoinedInput",lr="RtcQueryUserJoinedOutput",dr="RtcViewerJoinedOutput",fr="RtcInviteInput",pr="RtcCancelInviteInput",gr="RtcInviteAnswerInput",_r="RtcEndInviteInput",mr="SetRtcRoomIdInput",vr="SetRtcRoomIdOutput",yr=((vn={})[Cn]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],vn[Nn]=["list","syncTime","finished","broadcastSyncTime"],vn[Sn]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],vn[Rn]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],vn[On]=["nothing"],vn[Mn]=["inboxTime","sendboxTime","totalUnreadCount"],vn[An]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],vn[Un]=["syncTime","count"],vn[wn]=["type","time","chrmId"],vn[Ln]=["targetId","time","count","order","busChannel"],vn[bn]=["list","syncTime","hasMsg"],vn[Pn]=["type","count","startTime","order"],vn[Dn]=["info","isFinished"],vn[Vn]=["sessions"],vn[kn]=["type","channelId","busChannel"],vn[Gn]=["nothing"],vn[Bn]=["type","msg","count","busChannel","startTime","endTime"],vn[xn]=["type","conversationId","msgs","busChannel"],vn[Fn]=["targetId","dataTime","conversationType","busChannel"],vn[Kn]=["type","msgTime","channelId","busChannel"],vn[Hn]=["nothing"],vn[qn]=["nothing","sessionId","joinTime"],vn[Yn]=["count","order"],vn[jn]=["userTotalNums","userInfos"],vn[ui]=["type","key","httpMethod","queryString"],vn[li]=["type","key","fileName"],vn[di]=["type","key","fileName"],vn[hi]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],vn[fi]=["downloadUrl"],vn[pi]=["downloadUrl"],vn[gi]=["key","value","status","timestamp","uid","version"],vn[_i]=["entry","bNotify","notification","type"],vn[mi]=["entry","bNotify","notification","type"],vn[vi]=["entry","bNotify","notification","type"],vn[yi]=["entries","bFullUpdate","syncTime"],vn[Ei]=["timestamp","errorKeys","keysVersion"],vn[Ti]=["version","key"],vn[Ii]=["key","errorCode"],vn[Ci]=["timestamp"],vn[Ri]=["version","value"],vn[Si]=["version","reserve"],vn[Ni]=["version","reserve"],vn[Oi]=["items","version"],vn.UserSettingItem=["targetId","type","key","value","version","status","tags"],vn[Ai]=["time"],vn[Ui]=["version","state"],vn[wi]=["type","channelId","time","stateItem","busChannel"],vn[Li]=["sessionStateType","value","tags"],vn[bi]=["version","state"],vn[Pi]=["version"],vn[Vi]=["busChannel","unpushLevel"],vn[Di]=["busChannel"],vn[ki]=["groupId","busChannel","unpushLevel"],vn[Gi]=["msgId","busChannel"],vn[Bi]=["msgId","busChannel"],vn[xi]=["totalMemberNum","list"],vn[Fi]=["readTime","userId"],vn[Ki]=["version","tags"],vn[Hi]=["tagId","name","createdTime","isTop"],vn[qi]=["version","tags"],vn[Yi]=["tagId"],vn[Mi]=["version","reserve"],vn[ji]=["sdkInfo"],vn[Qi]=["nothing"],vn[Wi]=["syncTime","isEraseMsgContent"],vn[Ji]=["syncTime"],vn[zi]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],vn[Zi]=["syncTime"],vn[$i]=["list","syncTime","hasNext"],vn[Xi]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType"],vn[er]=["targetId","type","query"],vn[tr]=["msgTime","msgUID","busChannel"],vn[nr]=["list"],vn[ir]=["targetId","type","opType","busChannel"],vn[rr]=["type","notifyType","info","summary"],vn[or]=["targetId","busChannel","userId","opType","optime"],vn[sr]=["targetId","busChannel","count","opType"],vn[Qn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],vn[Wn]=["users","token","sessionId","roomInfo"],vn[Jn]=["status"],vn[zn]=["interior","target","key","value","objectName","content"],vn[Zn]=["valueInfo","objectName","content"],vn[Xn]=["interior","target","key","objectName","content"],vn[$n]=["target","valueInfo","objectName","content"],vn[ei]=["state"],vn[ti]=["rtcToken"],vn[ni]=["outInfo"],vn[ii]=["userId"],vn[ri]=["user"],vn[oi]=["order"],vn[si]=["roomId","roomData","userCount","list"],vn[ai]=["key","value"],vn[ci]=["key"],vn[ar]=["type","time","roomId"],vn[cr]=["timestamp","roomId"],vn[ur]=["entries","bFullUpdate","syncTime"],vn[hr]=["userId"],vn[lr]=["info"],vn[fr]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],vn[pr]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],vn[gr]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],vn[_r]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],vn[mr]=["rtcRoomId"],vn[vr]=["nothing"],vn),Er={},Tr=function(e){var t=yr[e];Er[e]=function(){for(var e={},n={getArrayData:function(){return e}},i=function(i){var r=t[i],o="set".concat(F(r,0,1));n[o]=function(t){e[r]=t}},r=0;r<t.length;r++)i(r);return n},Er[e].decode=function(e){var t={};J(e)&&(e=JSON.parse(e));var n=function(n){var i="get".concat(F(n,0,1));t[n]=e[n],t[i]=function(){return e[n]}};for(var i in e)n(i);return t}};for(var Ir in yr)Tr(Ir);Er.getModule=function(e){return Er[e]()};var Cr="\npackage Modules;\nmessage probuf {\n message ".concat(Jn,"\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(wn," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(An," {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message ").concat(Cn," {\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(Rn," {\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(Nn," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(Sn," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n optional int64 extStatus = 20; // 消息的扩展标记 第0位,表示送达状态: 0x01 表示已送达;断档: 0x02 表示是否需要执行断档策略; 消息修改: 0x04 拉取历史消息时表示该消息是否修改过 0x08 每条消息携带的频道类型\n repeated string toUserId = 21; //指定接收者(限定群和讨论组)//增加聊天室定向成员\n optional int32 groupUnpush = 22; //群聊默认免打扰级别\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(W.IMAGE,";\n audio = ").concat(W.AUDIO,";\n video = ").concat(W.VIDEO,";\n file = ").concat(W.FILE,";\n }\n message ").concat(ui," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(li," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(di," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(hi," {\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(fi," {\n required string downloadUrl = 1;\n }\n message ").concat(pi," {\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(Hn," {\n required int32 nothing = 1;\n }\n message ").concat(qn," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(Un," {\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(Pn,"\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(Bn,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(Dn,"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n optional int32 busChannelType = 9; // 0: 公有频道; 1: 私有频道;\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(Fn,"\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(Yn,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(jn,"\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(ei,"\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(Ln,"\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(bn,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(oi,"{\n optional int32 order=1;\n }\n\n message ").concat(ci,"{\n repeated string key=1;\n }\n\n message ").concat(ai,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(ai," userData=2; //用户资源信息\n }\n\n message ").concat(Wn,"{\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(ai," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Qn,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(ai," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(ai," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(ni,"{\n repeated ").concat(ai," 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(Xn,"{\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(zn,"{\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(Zn," {\n repeated ").concat(ai," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(ai," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(ti,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat($n,"{\n required targetType target=1;\n repeated ").concat(ai," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(ii,"{\n repeated string userId = 1;\n }\n message ").concat(ri,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(On,"{\n required int32 nothing = 1;\n }\n message ").concat(Mn,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Kn,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Vn,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(kn,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(Gn,"\n {\n optional int32 nothing=1;\n }\n message ").concat(xn,"\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 optional int64 version = 6;\n }\n message ").concat(_i," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(mi," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(vi," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(yi," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ").concat(Ei," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Ii,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Ci," {\n required int64 timestamp = 1;\n }\n message ").concat(Ri," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Si," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Ni," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Oi," {\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(Ai," {\n required int64 time = 1;\n }\n message ").concat(Ui," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(wi," {\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(Li," {\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(bi," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Di," {\n optional string busChannel = 1;\n }\n message ").concat(Vi,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(ki," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(Pi," {\n required int64 version=1;\n }\n message ").concat(Gi," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Bi," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(xi," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Fi," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Ki," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Hi," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(qi," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Yi," {\n repeated string tagId=1;\n }\n message ").concat(Mi," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(ji,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Qi,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(ar," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(cr,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(ur,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(hr,"\n {\n required string userId = 1;\n }\n message ").concat(lr,"\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(dr,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(fr,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(pr,"\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(gr,"\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(_r,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(Wi,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Ji,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(zi,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(Zi," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat($i," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(Xi," //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回,4:频道变更)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0, 设为 1 时, IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 消息变更的操作人 Id; subChangeType 为 5 时,operatorId 表示被踢出超级群私有频道白名单的用户\n optional int32 subChangeType = 11; // 当 changeType 为 4 时,该参数有意义; 1: 删除频道; 2: 公有频道变为私有频道; 3: 私有频道变为公有频道; 4: 私有频道成员变更-加入, SDK 不通知业务层; 5: 私有频道成员变更-退出; 6: 公有频道变为私有频道,当前用户不在白名单中;\n }\n message ").concat(er," //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message ").concat(nr," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(ir," //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message ").concat(rr," //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message ").concat(or," {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message ").concat(sr," {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n message ").concat(mr,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(vr,"\n {\n required int32 nothing = 1; //用于占位\n }\n}\n");var Rr,Sr,Nr,Or,Mr,Ar,Ur,wr=(Rr=Cr,Sr=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,i,o;return t?(o=(e>>>=0)>=0&&e<256)&&(i=c[e])?i:(n=r(e,(0|e)<0?-1:0,!0),o&&(c[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(i=a[e])?i:(n=r(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function i(e,t){if(isNaN(e)||!isFinite(e))return t?g:p;if(t){if(e<0)return g;if(e>=l)return E}else{if(-d>=e)return T;if(e+1>=d)return y}return e<0?i(-e,t).neg():r(0|e%h,0|e/h,t)}function r(t,n,i){return new e(t,n,i)}function o(e,t,n){var r,s,a,c,h,l,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(e.substring(1),t,n).neg();for(s=i(u(n,8)),a=p,c=0;c<e.length;c+=8)h=Math.min(8,e.length-c),l=parseInt(e.substring(c,c+h),n),h<8?(d=i(u(n,h)),a=a.mul(d).add(i(l))):a=(a=a.mul(s)).add(i(l));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?i(t):"string"==typeof t?o(t):r(t.low,t.high,t.unsigned)}var a,c,u,h,l,d,f,p,g,_,m,v,y,E,T,I;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},c={},e.fromInt=n,e.fromNumber=i,e.fromBits=r,u=Math.pow,e.fromString=o,e.fromValue=s,d=(l=(h=4294967296)*h)/2,f=n(16777216),p=n(0),e.ZERO=p,g=n(0,!0),e.UZERO=g,_=n(1),e.ONE=_,m=n(1,!0),e.UONE=m,v=n(-1),e.NEG_ONE=v,y=r(-1,2147483647,!1),e.MAX_VALUE=y,E=r(-1,-1,!0),e.MAX_UNSIGNED_VALUE=E,T=r(0,-2147483648,!1),e.MIN_VALUE=T,(I=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},I.toString=function(e){var t,n,r,o,s,a,c,h;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(T)?(t=i(e),r=(n=this.div(t)).mul(t).sub(this),n.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(o=i(u(e,6),this.unsigned),s=this,a="";;){if(c=s.div(o),h=(s.sub(c.mul(o)).toInt()>>>0).toString(e),(s=c).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},I.isZero=function(){return 0===this.high&&0===this.low},I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return 1==(1&this.low)},I.isEven=function(){return 0==(1&this.low)},I.equals=function(e){return t(e)||(e=s(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),i=e.isNegative();return n&&!i?-1:!n&&i?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},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(_)},I.neg=I.negate,I.add=function(e){var n,i,o,a,c,u,h,l,d,f,p;return t(e)||(e=s(e)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,c=e.high>>>16,u=65535&e.high,h=e.low>>>16,l=0,d=0,f=0,p=0,f+=(p+=a+(65535&e.low))>>>16,d+=(f+=o+h)>>>16,l+=(d+=i+u)>>>16,l+=n+c,r((f&=65535)<<16|(p&=65535),(l&=65535)<<16|(d&=65535),this.unsigned)},I.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){var n,o,a,c,u,h,l,d,g,_,m,v;return this.isZero()?p:(t(e)||(e=s(e)),e.isZero()?p:this.eq(T)?e.isOdd()?T:p:e.eq(T)?this.isOdd()?T:p:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(f)&&e.lt(f)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=e.high>>>16,h=65535&e.high,l=e.low>>>16,g=0,_=0,m=0,v=0,m+=(v+=c*(d=65535&e.low))>>>16,_+=(m+=a*d)>>>16,m&=65535,_+=(m+=c*l)>>>16,g+=(_+=o*d)>>>16,_&=65535,g+=(_+=a*l)>>>16,_&=65535,g+=(_+=c*h)>>>16,g+=n*d+o*l+a*h+c*u,r((m&=65535)<<16|(v&=65535),(g&=65535)<<16|(_&=65535),this.unsigned)))},I.mul=I.multiply,I.divide=function(e){var n,r,o,a,c,h,l;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:p;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return m;o=g}else{if(this.eq(T))return e.eq(_)||e.eq(v)?T:e.eq(T)?_:(n=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?_:v:(r=this.sub(e.mul(n)),o=n.add(r.div(e)));if(e.eq(T))return this.unsigned?g:p;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=p}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),l=(h=i(n)).mul(e);l.isNegative()||l.gt(r);)l=(h=i(n-=c,this.unsigned)).mul(e);h.isZero()&&(h=_),o=o.add(h),r=r.sub(l)}return o},I.div=I.divide,I.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.not=function(){return r(~this.low,~this.high,this.unsigned)},I.and=function(e){return t(e)||(e=s(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return t(e)||(e=s(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return t(e)||(e=s(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):r(0,this.low<<e-32,this.unsigned)},I.shl=I.shiftLeft,I.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):r(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0==(e&=63)?this:(n=this.high,e<32?r(this.low>>>e|n<<32-e,n>>>e,this.unsigned):r(32===e?n:n>>>e-32,0,this.unsigned))},I.shru=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.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]},I.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}(),Nr=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 i(e,t,n,i,r){var o,s,a=8*r-i-1,c=(1<<a)-1,u=c>>1,h=-7,l=n?r-1:0,d=n?-1:1,f=e[t+l];for(l+=d,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+e[t+l],l+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+e[t+l],l+=d,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,i),o-=u}return(f?-1:1)*s*Math.pow(2,o-i)}function r(e,t,n,i,r,o){var s,a,c,u=8*o-r-1,h=(1<<u)-1,l=h>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?d/c:d*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(t*c-1)*Math.pow(2,r),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,r),s=0));r>=8;e[n+f]=255&a,f+=p,a/=256,r-=8);for(s=s<<r|a,u+=r;u>0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*g}var o,s,a,c,u,h=function(e,t,n){if(void 0===e&&(e=h.DEFAULT_CAPACITY),void 0===t&&(t=h.DEFAULT_ENDIAN),void 0===n&&(n=h.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=e||null,(o=h.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(e,t,n){return new h(e,t,n)},h.concat=function(e,t,n,i){var r,o,s,a,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(i=n,n=t,t=void 0),r=0,s=0,a=e.length;a>s;++s)h.isByteBuffer(e[s])||(e[s]=h.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(r+=o);if(0===r)return new h(0,n,i);for(u=new h(r,n,i),s=0;a>s;)(o=(c=e[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},h.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},h.type=function(){return ArrayBuffer},h.wrap=function(e,t,n,i){var r,s;if("string"!=typeof t&&(i=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return h.fromBase64(e,n);case"hex":return h.fromHex(e,n);case"binary":return h.fromBinary(e,n);case"utf8":return h.fromUTF8(e,n);case"debug":return h.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(h.isByteBuffer(e))return(r=o.clone.call(e)).markedOffset=-1,r;if(e instanceof Uint8Array)r=new h(0,n,i),e.length>0&&(r.buffer=e.buffer,r.offset=e.byteOffset,r.limit=e.byteOffset+e.byteLength,r.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)r=new h(0,n,i),e.byteLength>0&&(r.buffer=e,r.offset=0,r.limit=e.byteLength,r.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((r=new h(e.length,n,i)).limit=e.length,s=0;s<e.length;++s)r.view[s]=e[s]}return r},o.writeBitSet=function(e,t){var n,i,r,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(i=t,o=(r=e.length)>>3,s=0,t+=this.writeVarint32(r,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(r>s){for(a=0,n=0;r>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return c?(this.offset=t,this):t-i},o.readBitSet=function(e){var t,n,i,r,o,s,a,c=void 0===e;for(c&&(e=this.offset),r=(i=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;r--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(i>o)for(a=0,t=this.readByte(e++);i>o;)s[o++]=!!(1&t>>a++);return c&&(this.offset=e),s},o.readBytes=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,i=void 0===t;if(i&&(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,i&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,i=void 0===t;if(i&&(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,i&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,i=void 0===t;if(i&&(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),i&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,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,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!1),o&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,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,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!0),o&&(this.offset+=8),r},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,i=void 0===t;if(i&&(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,r(this.view,e,t,this.littleEndian,23,4),i&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=i(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,i=void 0===t;if(i&&(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,r(this.view,e,t,this.littleEndian,52,8),i&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=i(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},h.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},h.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=i=h.calculateVarint32(e))>(r=this.buffer.byteLength)&&this.resize((r*=2)>t?r:t),t-=i,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):i},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(h.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,i=0;do{if(!this.noAssert&&e>this.limit)throw(r=Error("Truncated")).truncated=!0,r;t=this.view[e++],n<5&&(i|=(127&t)<<7*n),++n}while(0!=(128&t));return i|=0,o?(this.offset=e,i):{value:i,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=h.zigZagDecode32(t.value):t=h.zigZagDecode32(t),t},e&&(h.MAX_VARINT64_BYTES=10,h.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,i=t.shiftRightUnsigned(28).toInt()>>>0,r=t.shiftRightUnsigned(56).toInt()>>>0;return 0==r?0==i?n<16384?n<128?1:2:1<<21>n?3:4:i<16384?i<128?5:6:1<<21>i?7:8:r<128?9:10},h.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},h.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var i,r,o,s,a,c=void 0===n;if(c&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),i=h.calculateVarint64(t),r=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=i)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=i,i){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==i?128|s:127&s;case 8:this.view[n+7]=8!==i?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==i?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==i?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==i?128|o:127&o;case 4:this.view[n+3]=4!==i?128|r>>>21:127&r>>>21;case 3:this.view[n+2]=3!==i?128|r>>>14:127&r>>>14;case 2:this.view[n+1]=2!==i?128|r>>>7:127&r>>>7;case 1:this.view[n]=1!==i?128|r:127&r}return c?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(h.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,i,r,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,i=0,r=0,o=0,s=0,i=127&(s=this.view[t++]),128&s&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(r=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(i|r<<28,r>>>4|o<<24,!1),c?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=h.zigZagDecode64(n.value):n=h.zigZagDecode64(n),n}),o.writeCString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),r=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;r>i;++i)if(0===e.charCodeAt(i))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 r=u.calculateUTF16asUTF8(t(e))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):r},o.readCString=function(e){var t,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,r=-1,u.decodeUTF8toUTF16(function(){if(0===r)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(r=this.view[e++])?null:r}.bind(this),i=n(),!0),o?(this.offset=e,i()):{string:i(),length:e-t}},o.writeIString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(r=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+i,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):(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),n+=4,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==r+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return s?(this.offset=n,this):n-r},o.readIString=function(e){var t,n,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),i=this.readUTF8String(n,h.METRICS_BYTES,e+=4),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=n,i=u.calculateUTF16asUTF8(t(e))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-r},o.writeString=o.writeUTF8String,h.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},h.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},h.calculateString=h.calculateUTF8Bytes,o.readUTF8String=function(e,t,i){var r,o,s,a,c;if("number"==typeof t&&(i=t,t=void 0),(r=void 0===i)&&(i=this.offset),void 0===t&&(t=h.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=i,t===h.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++s,u.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return r?(this.offset=i,o()):{string:o(),length:i-a}}if(t===h.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}if(c=i+e,u.decodeUTF8toUTF16(function(){return c>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==c)throw RangeError("Illegal range: Truncated data, "+i+" == "+c);return r?(this.offset=i,o()):{string:o(),length:i-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var i,r,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],r=h.calculateVarint32(i),n+=r+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+i,n+=this.writeVarint32(i,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),i=this.readUTF8String(n.value,h.METRICS_BYTES,e+=n.length),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},o.append=function(e,t,n){var i,r,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof h||(e=h.wrap(e,t)),(r=e.limit-e.offset)<=0||((n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=r,i&&(this.offset+=r)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new h(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,i,r;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0==(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(i=new ArrayBuffer(n),(r=new Uint8Array(i)).set(this.view.subarray(e,t)),this.buffer=i,this.view=r,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new h(0,this.littleEndian,this.noAssert);var n=t-e,i=new h(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=e),this.copyTo(i,0,e,t),i},o.copyTo=function(e,t,n,i){var r,o,s;if(!this.noAssert&&!h.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(r=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0==(s=i-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,i),t),r&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var i=void 0===t;if(i&&(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 i&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var i,r,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof h||(e=h.wrap(e,t)),(r=e.limit-e.offset)<=0||((o=r-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-r),e.offset=e.limit,i&&(this.offset-=r)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,i=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal limit: Not an integer");if(i>>>=0,n<0||n>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+i+" <= "+this.buffer.byteLength)}return e||0!==n||i!==this.buffer.byteLength?n===i?s:(t=new ArrayBuffer(i-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,i),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},c=function(){var e,t,n={},i=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[];for(e=0,t=i.length;t>e;++e)r[i[e]]=e;return n.encode=function(e,t){for(var n,r;null!==(n=e());)t(i[63&n>>2]),r=(3&n)<<4,null!==(n=e())?(t(i[63&((r|=15&n>>4)|15&n>>4)]),r=(15&n)<<2,null!==(n=e())?(t(i[63&(r|3&n>>6)]),t(i[63&n])):(t(i[63&r]),t(61))):(t(i[63&r]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var i,o,s;null!==(i=e());)if(void 0===(o=r[i])&&n(i),null!==(i=e())&&(void 0===(s=r[i])&&n(i),t(o<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(o=r[i])){if(61===i)break;n(i)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(i=e())){if(void 0===(s=r[i])){if(61===i)break;n(i)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var i;return c.encode(function(){return t>e?this.view[e++]:null}.bind(this),i=n()),i()},h.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var i=new h(e.length/4*3,n),r=0;return c.decode(t(e),(function(e){i.view[r++]=e})),i.limit=r,i},h.btoa=function(e){return h.fromBinary(e).toBase64()},h.atob=function(e){return h.fromBase64(e).toBinary()},o.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],i=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(i.push(String.fromCharCode.apply(String,n)),n=[]);return i.join("")+String.fromCharCode.apply(String,n)},h.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,i=0,r=e.length,o=new h(r,t);r>i;){if((n=e.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);o.view[i++]=n}return o.limit=r,o},o.toDebug=function(e){for(var t,n=-1,i=this.buffer.byteLength,r="",o="",s="";i>n;){if(-1!==n&&(r+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";s+=r+o+"\n",r=o=""}r+=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!==i?" ":""}if(e&&" "!==r){for(;r.length<51;)r+=" ";s+=r+o+"\n"}return e?s:r},h.fromDebug=function(e,t,n){for(var i,r,o=e.length,s=new h(0|(o+1)/3,t,n),a=0,c=0,u=!1,l=!1,d=!1,f=!1,p=!1;o>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(l||d||f){p=!0;break}l=d=f=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(l||f){p=!0;break}l=f=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(l||d){p=!0;break}l=d=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(l){p=!0;break}l=!0}s.offset=c,u=!1;break;case"]":if(!n){if(f||d){p=!0;break}f=d=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(f){p=!0;break}f=!0}s.limit=c,u=!1;break;case"'":if(!n){if(d){p=!0;break}d=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){p=!0;break}if(r=parseInt(i+e.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=r,u=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!l||!f)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,i=new Array(t-e);t>e;)(n=this.view[e++])<16?i.push("0",n.toString(16)):i.push(n.toString(16));return i.join("")},h.fromHex=function(e,t,n){var i,r,o,s,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(r=e.length,o=new h(0|r/2,t),s=0,a=0;r>s;s+=2){if(i=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=i}return o.limit=a,o},u=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,i,r,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(i=e())&&s([n,i]),t((31&n)<<6|63&i);else if(224==(240&n))(null===(i=e())||null===(r=e()))&&s([n,i,r]),t((15&n)<<12|(63&i)<<6|63&r);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(i=e())||null===(r=e())||null===(o=e()))&&s([n,i,r,o]),t((7&n)<<18|(63&i)<<12|(63&r)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,i=null;null!==(n=null!==i?i:e());)n>=55296&&n<=57343&&null!==(i=e())&&i>=56320&&i<=57343?(t(1024*(n-55296)+i-56320+65536),i=null):t(n);null!==i&&t(i)},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,i=0;return e.UTF16toUTF8(t,(function(e){++n,i+=e<128?1:e<2048?2:e<65536?3:4})),[n,i]}};return e}(),o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var i;try{u.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),i=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return i()},h.fromUTF8=function(e,n,i){if(!i&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var r=new h(u.calculateUTF16asUTF8(t(e),!0)[1],n,i),o=0;return u.encodeUTF16toUTF8(t(e),(function(e){r.view[o++]=e})),r.limit=o,r},h}(Sr),Or=function(e,t){var n,i,r={};return r.ByteBuffer=e,r.c=e,n=e,r.Long=t||null,r.VERSION="5.0.1",r.WIRE_TYPES={},r.WIRE_TYPES.VARINT=0,r.WIRE_TYPES.BITS64=1,r.WIRE_TYPES.LDELIM=2,r.WIRE_TYPES.STARTGROUP=3,r.WIRE_TYPES.ENDGROUP=4,r.WIRE_TYPES.BITS32=5,r.PACKABLE_WIRE_TYPES=[r.WIRE_TYPES.VARINT,r.WIRE_TYPES.BITS64,r.WIRE_TYPES.BITS32],r.TYPES={int32:{name:"int32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},uint64:{name:"uint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.UZERO:void 0},sint64:{name:"sint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},bool:{name:"bool",wireType:r.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:r.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:r.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.ZERO:void 0},float:{name:"float",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:r.WIRE_TYPES.STARTGROUP,defaultValue:null}},r.MAP_KEY_TYPES=[r.TYPES.int32,r.TYPES.sint32,r.TYPES.sfixed32,r.TYPES.uint32,r.TYPES.fixed32,r.TYPES.int64,r.TYPES.sint64,r.TYPES.sfixed64,r.TYPES.uint64,r.TYPES.fixed64,r.TYPES.bool,r.TYPES.string,r.TYPES.bytes],r.ID_MIN=1,r.ID_MAX=536870911,r.convertFieldsToCamelCase=!1,r.populateAccessors=!0,r.populateDefaults=!0,r.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof 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 i=e.XHR();if(i.open("GET",t,!!n),i.setRequestHeader("Accept","text/plain"),"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/plain"),!n)return i.send(null),200==i.status||0==i.status&&"string"==typeof i.responseText?i.responseText:null;if(i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0==i.status&&"string"==typeof i.responseText?n(i.responseText):n(null))},4==i.readyState)return;i.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),r.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},r.DotProto=function(e,t){function n(e,n){var i=-1,r=1;if("-"==e.charAt(0)&&(r=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))i=parseInt(e);else if(t.NUMBER_HEX.test(e))i=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(r<0?"-":"")+e);i=parseInt(e.substring(1),8)}if(i=0|r*i,!n&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+e);return i}function i(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 r(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},c=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},u.next=function(){var e,n,i,r,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(i=this.source.charAt(this.index));)if("\n"===i&&++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("*"!==(i=this.source.charAt(this.index)))return"/";do{if("\n"===i&&++this.line,++this.index===this.source.length)return null;n=i,i=this.source.charAt(this.index)}while("*"!==n||"/"!==i);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(r=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(r++)))for(;r<this.source.length&&!t.DELIM.test(this.source.charAt(r));)++r;return('"'===(o=this.source.substring(this.index,this.index=r))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},u.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},u.omit=function(e){return this.peek()===e&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,o=function(e){this.tn=new c(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),i=!1;break;case"enum":this._parseEnum(n),i=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return i(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var i,r=this.tn.next(),o=!1;if("("===r&&(o=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,o&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,i),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var i=this.tn.peek();if("{"!==i)r(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!t.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(e.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(e,n+"."+i)}},s._parseService=function(e){var n,i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);for(n={name:i,rpc:{},options:{}},this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(n);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,i,r="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(i.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.response_stream=!0,o=this.tn.next()),i.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[r]&&(e[r]={}),e[r][n]=i},s._parseMessage=function(e,i){var r=!!i,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(r?"group":"message")+" name: "+o);for(s.name=o,r&&(this.tn.skip("="),i.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,i,r){var o,s,a;if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);if(o={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(r)&&!t.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(o.type=r,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,i,r,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(i=o,r=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=i,r.push(n.id);this.tn.omit(";"),e.oneofs[i]=r},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var i,r={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(r.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(r);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),i={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),e.enums.push(r)},s._parseExtensionRanges=function(){var t,n,r,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":r=e.ID_MIN;break;case"max":r=e.ID_MAX;break;default:r=i(t)}if(n.push(r),2===n.length)break;if("to"!==this.tn.peek()){n.push(r);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);for(n={ref:i,fields:[]},this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(n,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(n,"optional",i)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(r,r.Lang),r.Reflect=function(t){function i(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 r(e,n){var i=n.readVarint32(),o=7&i,s=i>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(128==(128&i));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:i=n.readVarint32(),n.offset+=i;break;case t.WIRE_TYPES.STARTGROUP:r(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,c,u,h,l,d,f,p,g,_,m,v,y,E,T={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},T.T=I,o=function(e,t,n,i,r){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(I.prototype)).getChildren=function(e){var t,n,i;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,i=this.children.length;i>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,i="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][i]===e)return this.children[t];return null},s.resolve=function(e,t){var n,i="string"==typeof e?e.split("."):e,r=this,o=0;if(""===i[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof T.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof T.T&&(!t||n instanceof T.Namespace))){r=null;break}r=n,o++}while(o<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},s.qn=function(e){var t,n,i=[],r=e;do{i.unshift(r.name),r=r.parent}while(null!==r);for(t=1;t<=i.length;t++)if(n=i.slice(i.length-t),e===this.resolve(n,e instanceof T.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,i={},r=this.children;for(t=0,n=r.length;n>t;++t)(e=r[t])instanceof o&&(i[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},s.buildOpt=function(){var e,t,n,i,r={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],i=this.options[o[e]],r[n]=i;return r},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},T.Namespace=o,a=function(e,n,i,r){if(this.type=e,this.resolvedType=n,this.isMapKey=i,this.syntax=r,i&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},c=a.prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},c.verifyValue=function(n){var r,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof 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(typeof 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 i(n,!1)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return i(n,!0)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(typeof n,"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(typeof n,"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(typeof n,"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(r=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<r.length;s++){if(r[s].name==n)return r[s].id;if(r[s].id==n)return r[s].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),(n>4294967295||n<0)&&a(typeof 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"==typeof n||a(typeof n,"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(s in o={},n)n.hasOwnProperty(s)&&(o[s]=n[s]);n=o}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},c.calculateLength=function(e,i){if(null===i)return 0;var r;switch(this.type){case t.TYPES.int32:return i<0?n.calculateVarint64(i):n.calculateVarint32(i);case t.TYPES.uint32:return n.calculateVarint32(i);case t.TYPES.sint32:return n.calculateVarint32(n.zigZagEncode32(i));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(i);case t.TYPES.sint64:return n.calculateVarint64(n.zigZagEncode64(i));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return n.calculateVarint32(i);case t.TYPES.double:return 8;case t.TYPES.string:return r=n.calculateUTF8Bytes(i),n.calculateVarint32(r)+r;case t.TYPES.bytes:if(i.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+i.remaining()+" bytes remaining");return n.calculateVarint32(i.remaining())+i.remaining();case t.TYPES.message:return r=this.resolvedType.calculate(i),n.calculateVarint32(r)+r;case t.TYPES.group:return(r=this.resolvedType.calculate(i))+n.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+i+" (unknown type)")},c.encodeValue=function(e,i,r){var o,s;if(null===i)return r;switch(this.type){case t.TYPES.int32:i<0?r.writeVarint64(i):r.writeVarint32(i);break;case t.TYPES.uint32:r.writeVarint32(i);break;case t.TYPES.sint32:r.writeVarint32ZigZag(i);break;case t.TYPES.fixed32:r.writeUint32(i);break;case t.TYPES.sfixed32:r.writeInt32(i);break;case t.TYPES.int64:case t.TYPES.uint64:r.writeVarint64(i);break;case t.TYPES.sint64:r.writeVarint64ZigZag(i);break;case t.TYPES.fixed64:r.writeUint64(i);break;case t.TYPES.sfixed64:r.writeInt64(i);break;case t.TYPES.bool:"string"==typeof i?r.writeVarint32("false"===i.toLowerCase()?0:!!i):r.writeVarint32(i?1:0);break;case t.TYPES.enum:r.writeVarint32(i);break;case t.TYPES.float:r.writeFloat32(i);break;case t.TYPES.double:r.writeFloat64(i);break;case t.TYPES.string:r.writeVString(i);break;case t.TYPES.bytes:if(i.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+i.remaining()+" bytes remaining");o=i.offset,r.writeVarint32(i.remaining()),r.append(i),i.offset=o;break;case t.TYPES.message:s=(new n).LE(),this.resolvedType.encode(i,s),r.writeVarint32(s.offset),r.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(i,r),r.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+i+" (unknown type)")}return r},c.decode=function(e,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(r=e.clone()).limit=r.offset+o,e.offset+=o,r;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,i)}throw Error("[INTERNAL] Illegal decode type")},c.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return n.fromBinary(e)}},c.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},T.Element=a,u=function(e,t,n,i,r,s){o.call(this,e,t,n,i,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!r,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(h=u.prototype=Object.create(o.prototype)).build=function(i){var r,o,s,a;if(this.clazz&&!i)return this.clazz;for(r=function(t,i){function r(e,i,o,s){var a,c,u,h,l,d,f;if(null===e||"object"!=typeof e)return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(n.isByteBuffer(e))return i?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(e,t){c[t]=r(e,i,o,s)})),c;if(c={},e instanceof t.Map){for(h=(u=e.entries()).next();!h.done;h=u.next())c[e.keyElem.valueToString(h.value[0])]=r(h.value[1],i,o,e.valueElem.resolvedType);return c}for(f in l=e.$type,d=void 0,e)e.hasOwnProperty(f)&&(c[f]=l&&(d=l.getChild(f))?r(e[f],i,o,d.resolvedType):r(e[f],i,o));return c}var o,s,a=i.getChildren(t.Reflect.Message.Field),c=i.getChildren(t.Reflect.Message.OneOf),u=function(e){var r,o,s,h;for(t.Builder.Message.call(this),r=0,o=c.length;o>r;++r)this[c[r].name]=null;for(r=0,o=a.length;o>r;++r)this[(s=a[r]).name]=s.repeated?[]:s.map?new t.Map(s):null,!s.required&&"proto3"!==i.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof u)||Array.isArray(e)||e instanceof t.Map||n.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(r=0,o=arguments.length;o>r;++r)void 0!==(h=arguments[r])&&this.$set(a[r].name,h);else this.$set(e)},h=u.prototype=Object.create(t.Builder.Message.prototype);for(h.add=function(e,n,r){var o=i._fieldsByName[e];if(!r){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");n=o.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},h.$add=h.add,h.set=function(e,n,r){var o,s,a;if(e&&"object"==typeof e){for(o in r=n,e)e.hasOwnProperty(o)&&void 0!==(n=e[o])&&this.$set(o,n,r);return this}if(s=i._fieldsByName[e],r)this[e]=n;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=n=s.verifyValue(n)}return s&&s.oneof&&(a=this[s.oneof.name],null!==n?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},h.$set=h.set,h.get=function(e,n){if(n)return this[e];var r=i._fieldsByName[e];if(!(r&&r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));return this[r.name]},h.$get=h.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||i.builder.options.populateAccessors&&function(e){var t,n,r,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),n=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},r=function(){return this[e.name]},null===i.getChild("set"+o)&&(h["set"+o]=n),null===i.getChild("set_"+t)&&(h["set_"+t]=n),null===i.getChild("get"+o)&&(h["get"+o]=r),null===i.getChild("get_"+t)&&(h["get_"+t]=r)}(s);return h.encode=function(t,n){var r,o;"boolean"==typeof t&&(n=t,t=void 0),r=!1,t||(t=new e,r=!0),o=t.littleEndian;try{return i.encode(this,t.LE(),n),(r?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},u.encode=function(e,t,n){return new u(e).encode(t,n)},h.calculate=function(){return i.calculate(this)},h.encodeDelimited=function(e){var t,r=!1;return e||(e=new n,r=!0),t=(new n).LE(),i.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),r?e.flip():e},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return r(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},u.decode=function(e,t){var r,o;"string"==typeof e&&(e=n.wrap(e,t||"base64")),r=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return o=i.decode(e.LE()),e.LE(r),o}catch(t){throw e.LE(r),t}},u.decodeDelimited=function(e,t){var r,o,s;if("string"==typeof e&&(e=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(r=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=r,null;try{return s=i.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,t}},u.decode64=function(e){return u.decode(e,"base64")},u.decodeHex=function(e){return u.decode(e,"hex")},u.decodeJSON=function(e){return new u(JSON.parse(e))},h.toString=function(){return i.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:i.buildOpt()}),Object.defineProperty(h,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:i}),Object.defineProperty(h,"$type",{value:i})),u}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof g||o instanceof u||o instanceof v){if(r.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");r[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},h.encode=function(e,t,n){var i,r,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)r=e[(i=this._fields[o]).name],i.required&&null===r?null===c&&(c=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,a;return t},h.calculate=function(e){for(var t,n,i=0,r=0,o=this._fields.length;o>r;++r){if(n=e[(t=this._fields[r]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);i+=t.calculate(n,e)}return i},h.decode=function(e,n,i){var o,s,a,c,u,h,l,d,f,p,g,_;for(n="number"==typeof n?n:-1,u=e.offset,h=new this.clazz;e.offset<u+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.WIRE_TYPES.ENDGROUP){if(a!==i)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(i?i+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?h[c.name].push(c.decode(s,e)):c.map?(d=c.decode(s,e),h[c.name].set(d[0],d[1])):(h[c.name]=c.decode(s,e),c.oneof&&(null!==(f=h[c.oneof.name])&&f!==c.name&&(h[f]=null),h[c.oneof.name]=c.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:l=e.readVarint32(),e.offset+=l;break;case t.WIRE_TYPES.STARTGROUP:for(;r(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(p=0,g=this._fields.length;g>p;++p)if(null===h[(c=this._fields[p]).name])if("proto3"===this.syntax)h[c.name]=c.defaultValue;else{if(c.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=h,_;t.populateDefaults&&null!==c.defaultValue&&(h[c.name]=c.defaultValue)}return h},T.Message=u,l=function(e,n,i,r,o,s,a,c,h,l){I.call(this,e,n,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=h||null,this.syntax=l||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=l.prototype=Object.create(I.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)},d.verifyValue=function(e,n){var i,r,o;if(n=n||!1,i=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&&i(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&i(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],r=0;r<e.length;r++)o.push(this.element.verifyValue(e[r]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||i(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&i(typeof e,"no array expected"),this.element.verifyValue(e))},d.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},d.encode=function(e,i,r){var o,s,a,c,u;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return i;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i.ensureCapacity(i.offset+=1),s=i.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],i);a=i.offset-s,(c=n.calculateVarint32(a))>1&&(u=i.slice(s,i.offset),s+=c-1,i.offset=s,i.append(u)),i.writeVarint32(a,s-c)}else for(o=0;o<e.length;o++)i.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],i);else this.map?e.forEach((function(e,r){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i.writeVarint32(o),i.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,i),i.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,i)}),this):this.hasWirePresence(e,r)&&(i.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,i))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},d.calculate=function(e,i){var r,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;r=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);r+=n.calculateVarint32(s),r+=s}else for(o=0;o<e.length;o++)r+=n.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,i){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r+=n.calculateVarint32(o),r+=o}),this):this.hasWirePresence(e,i)&&(r+=n.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},d.decode=function(e,n,i){var r,o,s,c,u,h,l;if(!(!this.map&&e==this.type.wireType||!i&&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&&!i){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(c=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(e=7&(h=u.readVarint32()),1==(l=h>>>3))c=this.keyElement.decode(u,e,l);else{if(2!==l)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(u,e,l)}return[c,r]}return this.element.decode(n,e,this.id)},T.Message.Field=l,f=function(e,t,n,i,r,o,s){l.call(this,e,t,n,null,i,r,o,s),this.extension},f.prototype=Object.create(l.prototype),T.Message.ExtensionField=f,p=function(e,t,n){I.call(this,e,t,n),this.fields=[]},T.Message.OneOf=p,g=function(e,t,n,i,r){o.call(this,e,t,n,i,r),this.className="Enum",this.object=null},g.getName=function(e,t){var n,i,r=Object.keys(e);for(i=0;i<r.length;++i)if(e[n=r[i]]===t)return n;return null},(g.prototype=Object.create(o.prototype)).build=function(e){var n,i,r,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,r=0,o=(i=this.getChildren(g.Value)).length;o>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},T.Enum=g,_=function(e,t,n,i){I.call(this,e,t,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(I.prototype),T.Enum.Value=_,m=function(e,t,n,i){I.call(this,e,t,n),this.field=i},m.prototype=Object.create(I.prototype),T.Extension=m,v=function(e,t,n,i){o.call(this,e,t,n,i),this.className="Service",this.clazz=null},(v.prototype=Object.create(o.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var i,r=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=r.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(i=0;i<s.length;i++)!function(e){o[e.name]=function(i,r){try{try{i=e.resolvedRequestType.clazz.decode(n.wrap(i))}catch(e){if(!(e instanceof TypeError))throw e}if(null===i||"object"!=typeof i)throw Error("Illegal arguments");i instanceof e.resolvedRequestType.clazz||(i=new e.resolvedRequestType.clazz(i)),this.rpcImpl(e.fqn(),i,(function(n,i){if(!n){try{i=e.resolvedResponseType.clazz.decode(i)}catch(e){}return i&&i instanceof e.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+t.name+"#"+e.name))}r(n)}))}catch(e){setTimeout(r.bind(this,e),0)}},r[e.name]=function(t,n,i){new r(t)[e.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:r[e.name].$options}))}(s[i]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),r}(t,this)},T.Service=v,y=function(e,t,n,i){I.call(this,e,t,n),this.className="Service.Method",this.options=i||{}},(y.prototype=Object.create(I.prototype)).buildOpt=s.buildOpt,T.Service.Method=y,E=function(e,t,n,i,r,o,s,a){y.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},E.prototype=Object.create(y.prototype),T.Service.RPCMethod=E,T}(r),r.Builder=function(e,t,n){function i(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,i(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var r=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=r.prototype;return r.isMessage=function(e){return"string"==typeof e.name&&void 0===e.values&&void 0===e.rpc},r.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},r.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},r.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},r.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var i,o,s,a,c;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(i=[t];i.length>0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),r.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),c=[],o.enums&&o.enums.forEach((function(e){c.push(e)})),o.messages&&o.messages.forEach((function(e){c.push(e)})),o.services&&o.services.forEach((function(e){c.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){i.push(t),t=c,c=null,this.ptr=s,s=null;continue}c=null}else if(r.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(r.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!r.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var i,r,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(i=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");r=t.name,this.options.convertFieldsToCamelCase&&(r=e.Util.toCamelCase(r)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+r,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var r,o,s,a,c,u,h,l,d="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(r=n.root,e.Util.IS_NODE,(r.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=r+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[c]))continue;if(u=s+d+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(h=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(h+""),u):this.import(e.DotProto.Parser.parse(h),u)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+c+"."+n}))):this.import(t.imports[c],n+"_import"+c):this.import(t.imports[c]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&i(t),l=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){l.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=l),t.enums&&(this.create(t.enums),this.ptr=l),t.services&&(this.create(t.services),this.ptr=l),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var i;if(null==this.ptr||"object"==typeof 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(!(i=(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=i,i instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==i.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(i instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=i.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(!((i=this.ptr.parent.resolve(this.ptr.requestName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=i,!((i=this.ptr.parent.resolve(this.ptr.responseName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}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: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,i;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,i=0;i<t.length;i++){if(!n[t[i]]){n=null;break}n=n[t[i]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(r,r.Lang,r.Reflect),r.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 i=function(e,n){var i,r,o,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(i=Object.keys(n),r=0;r<i.length;r++)o=this.keyElem.valueFromString(i[r]),s=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},r.entries=function(){var e,t,i=[],r=Object.keys(this.map);for(t=0;t<r.length;t++)i.push([(e=this.map[r[t]]).key,e.value]);return n(i)},r.keys=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].key);return n(t)},r.values=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].value);return n(t)},r.forEach=function(e,t){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)e.call(t,(n=this.map[r[i]]).value,n.key,this)},r.set=function(e,t){var n=this.keyElem.verifyValue(e),i=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},r.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,r.Reflect),r.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),r.loadJson(r.DotProto.Parser.parse(e),t,n)},r.protoFromString=r.loadProto,r.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return r.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,r.loadProto(i,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=r.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:r.loadProto(i,n,e)},r.protoFromFile=r.loadProtoFile,r.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=r.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=r.populateAccessors),new r.Builder(e)},r.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=r.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},r.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return r.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,r.loadJson(JSON.parse(i),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=r.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:r.loadJson(JSON.parse(i),n,e)},i=Rr,r.loadProto(i,void 0,"").build("Modules").probuf}(Nr,Sr),Or);wr.getModule=function(e){var t=new wr[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=$(e)?[].slice.call(new Int8Array(e)):e},t};var Lr,br,Pr="pgMsgP",Dr="chatMsg",Vr="pcMsgP",kr={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Gr="delMsg",Br="joinChrm",xr="joinChrmR",Fr="exitChrm",Kr="setKV",Hr="delKV",qr="setKVS",Yr="delKVS",jr="qryRelationR",Qr="delRelation",Wr="setSeAtt",Jr={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},zr="qryPMsg",Zr="qryGMsg",Xr="qryCHMsg",$r="qryCMsg",eo="qrySMsg",to=((Mr={})["ppMsgP"]=j.PRIVATE,Mr[Pr]=j.GROUP,Mr[Dr]=j.CHATROOM,Mr[Vr]=j.CUSTOMER_SERVICE,Mr),no=((Ar={})[j.PRIVATE]=zr,Ar[j.GROUP]=Zr,Ar[j.CHATROOM]=Xr,Ar[j.CUSTOMER_SERVICE]=$r,Ar[j.SYSTEM]=eo,Ar),io=((Ur={})[j.PRIVATE]=Jr.PRIVATE,Ur[j.GROUP]=Jr.GROUP,Ur[j.ULTRA_GROUP]=Jr.ULTRA_GROUP,Ur[j.CUSTOMER_SERVICE]=Jr.CUSTOMER_SERVICE,Ur[j.SYSTEM]=Jr.SYSTEM,Ur),ro="1",oo="0",so=1,ao=2,co=3,uo=function(){function e(e){this._codec="websocket"===e?wr:Er,this._connectType=e}return e.prototype.decodeByPBName=function(e,t,n){var i,r=this,o=e,s=((i={})[Nn]=r._formatSyncMessages,i[Sn]=r._formatReceivedMessage,i[Cn]=r._formatSentMessage,i[bn]=r._formatHistoryMessages,i[Dn]=r._formatConversationList,i[jn]=r._formatChatRoomInfos,i[Wn]=r._formatRTCUserList,i[ni]=r._formatRTCData,i[yi]=r._formatChatRoomKVList,i[Oi]=r._formatUserSetting,i[Ui]=r._formatConversationStatus,i[xi]=r._formatGrpReadReceiptQryResp,i[Si]=r._formatSetUserSettingOutput,i[Mi]=r._formatUserSettingNotification,i[$i]=r._formatUltraMsgChangeList,i[rr]=r._formatUltraOperateStatusNotifyList,i[nr]=r._formatUltraMsgList,i[qn]=r._formatChrmKVVersion,i[ur]=r._formatRTCRoomKVList,i[ti]=r._formatRTCAuidenceJoinRoomData,i[lr]=r._formatRTCJoinedUserInfo,i)[t];try{o=e.length>0&&r._codec[t].decode(e),ne(o)&&(o=function(e){for(var t in e)ne(e[t])&&(e[t]=zt(e[t]));return e}(o)),ie(s)&&(o=s.call(this,o,n))}catch(n){Dt.error("PB parse error\n",n,e,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,i=e.limit;if(t)try{var r=$(n)?new Uint8Array(n):n;return En.readUTF(r.subarray(t,i))}catch(e){Dt.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Dt.info("formatBytes error\n",e)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,i=e.list,r=e.syncTime,o=e.finished;return(re(o)||null===o)&&(e.finished=!0),e.syncTime=zt(r),e.list=on(i,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var i=(t=t||{}).currentUserId,r=t.connectedTime,o=e.content,s=e.fromUserId,a=e.type,c=e.groupId,u=e.status,h=e.dataTime,l=e.classname,d=e.msgId,f=e.extraContent,p=e.pushContent,g=e.pushExt,_=e.configFlag,m=e.extStatus;e.toUserId,e.groupUnpush;var v=(e.direction||fe.RECEIVE)===fe.SEND,y=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)}}(u),E=y.isPersited,T=y.isCounted,I=y.isMentioned,C=y.disableNotification,R=y.receivedStatus,S=y.canIncludeExpansion,N=!!(2&(m||0)),O=!!(4&(m||0)),M=!!(8&(m||0))?Ge.PRIVATE:Ge.PUBLIC,A=[j.GROUP,j.CHATROOM,j.RTC_ROOM,j.ULTRA_GROUP].indexOf(a)>-1?c:s,U=v?i:s,w=zt(h),L=w<r,b=a===j.CHATROOM,D=this._formatBytes(o),V={};if(g&&(V=en(g.pushConfigs,g.pushId)),D.user){var k=D.user,G=k.portrait,B=k.portraitUri,x=G||B;x&&(D.user.portrait=D.user.portraitUri=x)}var F,K=P(P({},V),{pushTitle:null==g?void 0:g.title,pushContent:p,pushData:p,disablePushTitle:!!_&&Boolean(4&_),forceShowDetailContent:!!_&&Boolean(8&_),templateId:null==g?void 0:g.templateId}),H=v?fe.SEND:fe.RECEIVE;b&&s===i&&(H=fe.SEND),f&&(F={},F=gn(f));var q={conversationType:a,targetId:A,senderUserId:U,messageType:l,messageUId:d,isPersited:E,isCounted:T,isMentioned:I,sentTime:w,messageDirection:H,receivedTime:_n.getTime(),disableNotification:C,receivedStatus:R,canIncludeExpansion:S,content:D,expansion:F,configFlag:_,pushConfig:K,channelId:e.busChannel||"",isInterrupt:N,isModifyMessage:O};return a!==j.ULTRA_GROUP&&(q.isOffLineMessage=L),a===j.ULTRA_GROUP&&(q.channelType=M),q},e.prototype._formatSentMessage=function(e,t){var n,i=e.content,r=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,c=e.pushExt,u=e.pushContent,h=e.configFlag,l=e.extStatus,d=t.signal,f=t.currentUserId,p=d.date,g=d.topic,_=d.targetId,m=!!(2&(l||0)),v=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),y=v.isPersited,E=v.isCounted,T=v.disableNotification,I=v.canIncludeExpansion,C=to[g]||j.PRIVATE,R=cn(kr,g),S=this._formatBytes(i),N=_;r===Ee.RECALL&&(C=S.conversationType||C,N=S.targetId||_),a&&(n={},n=gn(a));var O={};c&&(O=en(c.pushConfigs,c.pushId));var M=P(P({},O),{pushTitle:null==c?void 0:c.title,pushContent:u,pushData:u,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==c?void 0:c.templateId});return{conversationType:C,targetId:N,messageType:r,messageUId:s,isPersited:y,isCounted:E,isStatusMessage:R,senderUserId:f,content:this._formatBytes(i),sentTime:1e3*p,receivedTime:_n.getTime(),messageDirection:fe.SEND,isOffLineMessage:!1,disableNotification:T,canIncludeExpansion:I,expansion:n,pushConfig:M,channelId:e.busChannel||"",isInterrupt:m}},e.prototype._formatHistoryMessages=function(e,t){var n=this,i=t.conversation||{},r=e.list,o=e.hasMsg,s=i.targetId,a=zt(e.syncTime),c=[];return rn(r,(function(e){var r=n._formatReceivedMessage(e,t);i.conversationType===j.ULTRA_GROUP?r.targetId=e.groupId||i.targetId:r.targetId=s,c.push(r)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,i=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,i=e.time,r=e.changeType,o=e.msgUID,s=e.msgTime,a=e.busChannel,c=e.isAdmin,u=e.isDel,h=e.operatorId,l=e.subChangeType;return{targetId:t,conversationType:n,changeType:r,messageUId:o,changeTime:zt(i),sendTime:zt(s),channelId:a,isAdmin:c,isDel:u,operatorId:h,subChangeType:l}})),hasNext:i}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,i=e.info,r=e.summary,o=[],s=[],a=2==(2&n),c=1==(1&n);return c&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.userId,r=e.opType,s=e.optime,a=zt(s);o.push({targetId:t,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.count,r=e.opType;s.push({targetId:t,channelId:n,count:i,operationType:r})})),{conversationType:t,info:o,summary:s,hasInfo:c,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,i=e.list;return{list:i&&i.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatConversationList=function(e,t){var n=this,i=e.info,r=t.afterDecode||function(){},o={list:(i=on(i,(function(e){var i=e.msg,o=e.userId,s=e.type,a=e.unreadCount,c=e.busChannel,u=e.versionTime,h=e.remindCount,l=e.busChannelType,d=null;i&&((d=n._formatReceivedMessage(i,t)).targetId=o);var f={targetId:o,conversationType:s,unreadMessageCount:zt(a)||0,latestMessage:d||{},channelId:c||""};return s===j.ULTRA_GROUP&&(f.versionTime=zt(u)||0,f.unreadMentionedCount=zt(h)||0,f.channelType=l||Ge.PUBLIC),r(f)||f})))||[]};return((null==t?void 0:t.conversationType)||j.NONE)===j.ULTRA_GROUP&&(o.isFinished=e.isFinished),o},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:on(n,(function(e){var t=e.id,n=e.time;return{id:t,time:zt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return t=on(t=t||[],(function(e){var t=e.key,n=e.value,i=e.status,r=e.timestamp,o=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?be.DELETE:be.UPDATE}}(i);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:zt(r),version:zt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:i}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,i=e.version,r={};return rn(n||[],(function(e){var n=e.key,i=e.version,o=e.value;e.version=zt(i),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=zt(e.createdTime),e.tagName=e.name})),r[n]=e})),{settings:r,version:i}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return rn(t,(function(e){var t=e.type,i=e.channelId,r=e.time,o=e.stateItem,s=e.busChannel,a=Ie.CLOSE,c=Re.NOT_SET,u=!1,h=[];rn(o,(function(e){var t=e.sessionStateType,n=e.value,i=e.tags;switch(t){case so:a=n===ro?Ie.OPEN:Ie.CLOSE,c=Number(n)||Re.NOT_SET;break;case ao:u=n===ro;break;case co:h=i}})),n.push({conversationType:t,type:t,targetId:i,notificationStatus:a,notificationLevel:c,isTop:u,updatedTime:zt(r),tags:h,channelId:s||""})})),n},e.prototype._formatRTCUserList=function(e){var t=e.users,n=e.token,i=e.sessionId,r=e.roomInfo,o=e.entries,s=e.offlineKickTime,a={};return rn(t,(function(e){var t=e.userId,n=e.userData,i={};rn(n,(function(e){var t=e.key,n=e.value;i[t]=n})),a[t]=i})),{users:a,token:n,sessionId:i,roomInfo:r,kvEntries:o,offlineKickTime:s}},e.prototype._formatRTCData=function(e){var t=e.outInfo,n={};return rn(t,(function(e){n[e.key]=e.value})),n},e.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,n=e.userCount,i=e.roomData,r={id:t,total:n};return rn(i,(function(e){r[e.key]=e.value})),r},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=zt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatRTCRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return{kvEntries:t=(t=t||[]).map((function(e){var t=e.timestamp;return Object.assign(e,{timestamp:zt(t)})})),isFullUpdate:n,syncTime:i}},e.prototype._formatChrmKVVersion=function(e){return e},e.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:zt(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(On);return e.setNothing(1),e.getArrayData()},e.prototype._getUpMsgModule=function(e,t){var n,i,r,o="comet"===this._connectType,s=e.conversationType,a=t.messageType,c=t.isMentioned,u=t.mentionedType,h=t.mentionedUserIdList,l=t.content,d=t.pushContent,f=t.pushData,p=t.directionalUserIdList,g=t.isFilerWhiteBlacklist,_=t.isVoipPush,m=t.canIncludeExpansion,v=t.expansion,y=t.pushConfig,E=t.channelId;[j.GROUP,j.ULTRA_GROUP].includes(s);var T=this._codec.getModule(Cn),I=function(e){var t=e.isStatusMessage,n=e.isPersited,i=e.isCounted;t&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),e.isMentioned&&(r|=4),e.disableNotification&&(r|=32),e.canIncludeExpansion&&(r|=64),r}(t),C=y||{},R=C.pushTitle,S=C.pushContent,N=C.pushData,O=C.iOSConfig,M=C.androidConfig,A=C.templateId,U=C.disablePushTitle,w=C.forceShowDetailContent,L=0;T.setSessionId(I),c&&l&&(l.mentionedInfo={userIdList:(null===(n=l.mentionedInfo)||void 0===n?void 0:n.userIdList)||h||[],type:(null===(i=l.mentionedInfo)||void 0===i?void 0:i.type)||u||Ne.ALL,mentionedContent:(null===(r=l.mentionedInfo)||void 0===r?void 0:r.mentionedContent)||""});var b=S||d||"",P=N||f||"";if(b&&T.setPushText(b),P&&T.setAppData(P),p&&T.setUserId(p),L|=_?1:0,L|=g?2:0,L|=U?4:0,L|=w?8:0,T.setConfigFlag(L),T.setClassname(a),l.user&&l.user.portraitUri&&(l.user.portrait=l.user.portraitUri),T.setContent(JSON.stringify(l)),m&&v){var D={};rn(v,(function(e,t){D[t]={v:e}})),T.setExtraContent(JSON.stringify(D))}if(y){var V=this._codec.getModule(Rn);if(R&&V.setTitle(R),O&&M){var k=$t(O,M);V.setPushConfigs(k)}(null==M?void 0:M.notificationId)&&V.setPushId(null==M?void 0:M.notificationId),V.setTemplateId(A||""),T.setPushExt(o?V.getArrayData():V)}return re(E)||T.setBusChannel(E),T},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,i=e.broadcastSyncTime,r=this._codec.getModule(An);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Un);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,i=t.order,r=t.timestamp,o=t.channelId,s=this._codec.getModule(Ln);return s.setTargetId(e),s.setTime(r),s.setCount(n),s.setOrder(i),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(Ji);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,i=this._codec.getModule(Pn);return i.setType(1),i.setCount(t),i.setStartTime(n),i.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,i=e.startTime,r=e.order;t=t||0,i=i||0,r=r||0;var o=this._codec.getModule(Pn);return o.setType(n),o.setCount(t),o.setStartTime(i),o.setOrder(r),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,i=this._codec.getModule(Bn);return i.setType(t),n&&i.setBusChannel([n]),i.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(Vn),i=[];return rn(e,(function(e){var n=e.conversationType,r=e.targetId,o=t._codec.getModule(kn);o.setType(n),o.setChannelId(r),i.push(o)})),n.setSessions(i),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,i){var r=this._codec.getModule(xn),o=[];return rn(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(o),r.setBusChannel(i),r.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,i){var r=this._codec.getModule(Fn);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,i=e.targetId,r=e.channelId,o=t.timestamp,s=this._codec.getModule(Kn);return o=o||+new Date,s.setType(n),s.setChannelId(i),s.setMsgTime(o),s.setBusChannel(r),s.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.keys,c={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},u=this._codec.getModule(zi);return u.setFromUserId(t),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(c)),u.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.content,c=this._codec.getModule(zi);return c.setFromUserId(t),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(a)),c.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(Zi);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,i=e.messages,r=this._codec.getModule(er),o=i.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return r.setTargetId(t),r.setType(n),r.setQuery(o),r.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,i){var r=this._codec.getModule(ir);return r.setTargetId(e),r.setType(t),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(Hn);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Yn);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(Vi);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(Di);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,i){var r=this._codec.getModule(ui);return r.setType(e),r.setKey(t),r.setHttpMethod(n),r.setQueryString(i),r.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,i){var r=this._codec.getModule(e);return r.setType(t),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var i="comet"===this._connectType,r=this._codec.getModule(_i),o=t.key,s=t.value,a=t.notificationExtra,c=t.isSendNotification,u=t.type,h=t.timestamp,l=u||be.UPDATE,d=mn(t,l),f={key:o,value:s||"",uid:n,version:h};if(re(d)||(f.status=d),r.setEntry(f),c){var p={conversationType:j.CHATROOM,targetId:e},g={key:o,value:s,extra:a,type:l},_=this._getUpMsgModule(p,{messageType:Ee.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});i?r.setNotification(_.getArrayData()):r.setNotification(_),r.setBNotify(!0),r.setType(j.CHATROOM)}return r.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){this._connectType;var i=this._codec.getModule(mi),r=t.entries,o=t.type||be.UPDATE,s=mn(t,o),a=[];return r.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};re(s)||(t.status=s),a.push(t)})),i.setEntry(a),i.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Ci);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(Ni);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Ai);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(bi),o=_n.getTime(),s=[];return rn(e,(function(e){var t=n._codec.getModule(wi),r=e.conversationType,a=e.targetId,c=e.notificationStatus,u=e.isTop,h=e.channelId,l=e.notificationLevel,d=[];t.setType(r),t.setChannelId(a),t.setTime(o),t.setBusChannel(h);var f=c===Ie.OPEN,p={};re(c)||(p[so]=f),re(l)||(p[so]=l),re(u)||(p[ao]=u),rn(p,(function(e,t){if(!re(e)){var r=n._codec.getModule(Li);e=e?ro:oo,re(l)||Number(t)!==so||(e=String(l)),r.setSessionStateType(Number(t)),r.setValue(e);var o=i?r.getArrayData():r;d.push(o)}})),t.setStateItem(d);var g=i?t.getArrayData():t;s.push(g)})),r.setVersion(t||o),r.setState(s),r.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(Gi);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(Ki),o=[];return e.forEach((function(e){var t=n._codec.getModule(Hi);t.setTagId(e.tagId),t.setName(e.tagName),o.push(i?t.getArrayData():t)})),r.setTags(o),r.setVersion(t),r.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(Gi);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(qi),o=[];return e.forEach((function(e){var t=n._codec.getModule(Hi);t.setTagId(e),o.push(i?t.getArrayData():t)})),r.setTags(o),r.setVersion(t),r.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(Yi);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,i="comet"===this._connectType,r=this._codec.getModule(bi),o=[];return t.forEach((function(t){var r=n._codec.getModule(wi),s=n._codec.getModule(Li),a=[];e.forEach((function(e){var t=n._codec.getModule(Hi);t.setTagId(e.tagId),re(e.isTop)||t.setIsTop(e.isTop),a.push(i?t.getArrayData():t)})),s.setSessionStateType(co),s.setValue(JSON.stringify(a)),s.setTags(a),r.setType(t.conversationType),r.setChannelId(t.targetId),r.setTime(Date.now()),r.setStateItem([i?s.getArrayData():s]),o.push(i?r.getArrayData():r)})),r.setState(o),r.setVersion(_n.getTime()),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(ji);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(Wi);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodeJoinRTCRoom=function(e,t,n,i,r){var o=this,s="comet"===this._connectType,a=this._codec.getModule(Qn);if(e=e||0,a.setRoomType(e),re(t)||a.setBroadcastType(t),re(n)||a.setJoinType(n),i){var c=[],u=this._codec.getModule(ai);for(var h in i)u.setKey(h),u.setValue(i[h]),s?c.push(u.getArrayData()):c.push(u);a.setInnerDatas(c)}if(r){var l=[];Object.keys(r).forEach((function(e){var t=o._codec.getModule(ai);t.setKey(e),t.setValue(r[e]),s?l.push(t.getArrayData()):l.push(t)})),a.setOuterDatas(l)}return a.getArrayData()},e.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(Jn).getArrayData()},e.prototype.encodeSetRTCData=function(e,t,n,i,r){var o=this._codec.getModule(zn);if(o.setInterior(n),o.setTarget(i),o.setKey(e),o.setValue(t),r){r.name&&o.setObjectName(r.name);var s=r.content;s&&(ne(s)&&(s=JSON.stringify(s)),o.setContent(s))}return o.getArrayData()},e.prototype.encodeUserSetRTCData=function(e,t,n,i){var r=this,o="comet"===this._connectType,s=this._codec.getModule(Zn);s.setObjectName(n);var a=this._codec.getModule(ai);a.setKey(e.name),a.setValue(e.content),o?s.setContent(a.getArrayData()):s.setContent(a);var c=[];return["uris","mcu_uris"].forEach((function(e){var n=r._codec.getModule(ai);n.setKey(e);var s="uris"===e?t:i;n.setValue(s),o?c.push(n.getArrayData()):c.push(n)})),s.setValueInfo(c),s.getArrayData()},e.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var n=this._codec.getModule(Zn);n.setObjectName(e);var i=this._codec.getModule(ai);return i.setKey("cdn_uris"),i.setValue(t),n.setValueInfo(i),n.getArrayData()},e.prototype.encodeGetRTCData=function(e,t,n){var i=this._codec.getModule(Xn);return i.setInterior(t),i.setTarget(n),i.setKey(e),i.getArrayData()},e.prototype.encodeRemoveRTCData=function(e,t,n,i){var r=this._codec.getModule(Xn);r.setInterior(t),r.setTarget(n),r.setKey(e);var o=(i=i||{}).name,s=i.content;return!re(o)&&r.setObjectName(o),re(s)||(ne(s)&&(s=JSON.stringify(s)),r.setContent(s)),r.getArrayData()},e.prototype.encodeSetRTCOutData=function(e,t,n){var i=this._codec.getModule($n);i.setTarget(t),X(e)||(e=[e]),rn(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})),i.setValueInfo(e);var r=(n=n||{}).name,o=n.content;return!re(r)&&i.setObjectName(r),re(o)||(ne(o)&&(o=JSON.stringify(o)),i.setContent(o)),i.getArrayData()},e.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(ii);return t.setUserId(e),t.getArrayData()},e.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(ei);return t.setState(e),t.getArrayData()},e.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(oi);return e.setOrder(2),e.getArrayData()},e.prototype.encodeSetRTCUserInfo=function(e,t){var n=this._codec.getModule(ai);return n.setKey(e),n.setValue(t),n.getArrayData()},e.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(ci);return t.setKey(e),t.getArrayData()},e.prototype.encodeIdentityChangeInfo=function(e,t,n){void 0===n&&(n=!1);var i=this._codec.getModule(Qn);return i.setRoomType(Ke.LIVE),t&&i.setBroadcastType(t),i.setIdentityChangeType(e),i.setNeedSysChatroom(n),i.getArrayData()},e.prototype.encodePullRTCRoomKV=function(e,t){var n=this._codec.getModule(cr);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()},e.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(hr);return t.setUserId(e),t.getArrayData()},e.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteTimeout,o=e.inviteInfo,s=this._codec.getModule(fr);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(i),s.setTimeoutTime(r),s.setInviteInfo(o),s.getArrayData()},e.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteInfo,o=this._codec.getModule(pr);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(i),o.setInviteInfo(r),o.getArrayData()},e.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,n=e.inviteRoomId,i=e.inviteSessionId,r=e.content,o=e.key,s=e.value,a=e.agree?1:0,c=this._codec.getModule(gr);return c.setInviteUserId(t),c.setInviteRoomId(n),c.setInviteSessionId(i),c.setContent(r),c.setKey(o),c.setValue(s),c.setAnswerCode(a),c.getArrayData()},e.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,n=e.sessionId,i=e.content,r=e.keys,o=this._codec.getModule(_r);return o.setInviteRoomId(t),o.setInviteSessionId(n),o.setInviteContent(i),o.setInviteRoomKeys(r),o.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(mr);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e}(),ho=function(e,t){this._watcher=t,this.codec=new uo(e)};function lo(e,t,n){if(e&&mt){var i=ct(ot(Ae.STATISTICS),e,t,n);return mt.reportRealtimeLog([i]).then((function(){yt(we.G_UPLOAD_LOG_S,"big data realtime report success")})).catch((function(e){yt(we.G_UPLOAD_LOG_E,"big data realtime report error -> "+e)}))}}!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Lr||(Lr={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(br||(br={}));var fo,po,go={},_o={sdkPrivate:Lr.OPEN,serverPrivate:Lr.OPEN,bundleId:"lib-next"};function mo(e){_o.sdkPrivate=e.sdkPrivate===Lr.PRIVATE?Lr.PRIVATE:Lr.OPEN,_o.serverPrivate=e.serverPrivate===Lr.PRIVATE?Lr.PRIVATE:Lr.OPEN,e.bundleId&&(_o.bundleId=e.bundleId)}function vo(){return _o}function yo(e,t,n){void 0===t&&(t={}),void 0===n&&(n=!1),ne(t)&&e&&(go[e]&&!n||(go[e]={}),go[e]=P(P({},go[e]),t))}function Eo(e){return go[e]||{}}!function(e){e.GET="GET",e.POST="POST"}(fo||(fo={})),function(e){e.WIFI="wifi",e.FOUR_G="4g",e.THREE_G="3g",e.TWO_G="2g",e.FIVE_G="2g",e.THREE_GENT="3gnet",e.UNKONWN="unknown"}(po||(po={}));var To,Io=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Co=function(){function e(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Io(e,t)},e.prototype.read=function(e,t,n){this.readMessage(e,t,n)},e.prototype.readMessage=function(e,t,n){return{stream:e,length:t}},e}(),Ro=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new yn(e,!1,Ft.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Io(e,t)},e.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getLengthSize=function(){return this.lengthSize},e.prototype.getBufferData=function(){var e=new In;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),So=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return b(t,e),t.prototype.readMessage=function(e,n,i){if(e.readByte(),this.status=+e.readByte(),n<=t.MESSAGE_LENGTH)return{stream:e,length:n};if(i===Yt.V4){var r=e.readByte();1&r&&(this.userId=e.readUTF()),2&r&&e.readUTF(),4&r&&(this.timestamp=e.readLong()),8&r&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var o=e.readUTF();Dt.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(Co),No=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.DISCONNECT,t.status=0,t}return b(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(Co),Oo=function(e){function t(){var t=e.call(this,Kt.PING_REQ)||this;return t._name=Ht.PING_REQ,t}return b(t,e),t.prototype.writeMessage=function(e){},t}(Ro),Mo=function(e){function t(t){var n=e.call(this,t)||this;return n._name=Ht.PING_RESP,n}return b(t,e),t}(Co),Ao=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return b(t,e),t.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},t}(Co),Uo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return b(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,i=(65280&t)>>8;e.write(i),e.write(n)},t}(Ro),wo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=qt.PUB,t}return b(t,e),t.prototype.readMessage=function(t,n){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.data=t.readAll(),{stream:t,length:n}},t}(Ao),Lo=function(e){function t(t,n,i){var r=e.call(this,Kt.PUBLISH)||this;return r._name=Ht.PUBLISH,r.syncMsg=!1,r.identifier=qt.PUB,r.topic=t,r.data=J(n)?En.writeUTF(n):n,r.targetId=i,r}return b(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Uo),bo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=qt.PUB,t.topic="",t.targetId="",t}return b(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:n}},t}(Ao),Po=function(e){function t(t){var n=e.call(this,Kt.PUB_ACK)||this;return n._name=Ht.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return b(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Uo),Do=function(e){function t(t,n,i){var r=e.call(this,Kt.QUERY)||this;return r.name=Ht.QUERY,r.identifier=qt.QUERY,r.topic=t,r.data=J(n)?En.writeUTF(n):n,r.targetId=i,r}return b(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Uo),Vo=function(e){function t(t){var n=e.call(this,Kt.QUERY_CONFIRM)||this;return n._name=Ht.QUERY_CON,n.messageId=t,n}return b(t,e),t}(Uo),ko=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.QUERY_ACK,t.status=0,t.identifier=qt.QUERY,t.topic="",t.targetId="",t}return b(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:n}},t}(Ao),Go=function(e){var t,n=e.type;switch(n){case Kt.CONN_ACK:t=new So(e);break;case Kt.PUBLISH:(t=new wo(e)).syncMsg=e.syncMsg;break;case Kt.PUB_ACK:t=new bo(e);break;case Kt.QUERY_ACK:t=new ko(e);break;case Kt.SUB_ACK:case Kt.UNSUB_ACK:case Kt.PING_RESP:t=new Mo(e);break;case Kt.DISCONNECT:t=new No(e);break;default:t=new Co(e),Dt.error("No support for deserializing "+n+" messages")}return t};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf",e[e.ugUnpushQuery=94]="ugUnpushQuery",e[e.ugUnpushSet=95]="ugUnpushSet",e[e.setRtcRoomId=96]="setRtcRoomId"}(To||(To={}));var Bo,xo,Fo=To,Ko=function(e,t,n,i,r,o,s,a){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(o,"&pid=").concat(s,"&apiVer=").concat(r.isFromUniapp?"uniapp":"normal").concat(r.connectPlatform?"&platform="+r.connectPlatform:"").concat(a?"&protocolVer="+a:"")},Ho=function(e){return[Fo.ppMsgS,Fo.pgMsgS,Fo.chatMsgS].map((function(e){return Fo[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"}(Bo||(Bo={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_COMET="IM-stats_comet-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S"}(xo||(xo={}));var qo=function(e,t){Dt.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)};var Yo=function(e){function t(t,n){var i=e.call(this,"websocket",n)||this;return i._runtime=t,i._socket=null,i._messageIds={},i._syncMessageIds={},i._failedCount=0,i.ALLOW_FAILED_TIMES=2,i._timer=null,i._idCount=0,i._generateMessageId=function(){return i._idCount>=65535&&(i._idCount=0),++i._idCount},i}return b(t,e),t.prototype.connect=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s=this;return V(this,(function(a){return[2,new Promise((function(a){var c=n.slice(),u=!1,h=function(){return D(s,void 0,void 0,(function(){var n,s,l;return V(this,(function(d){switch(d.label){case 0:return 0===c.length||u?[2]:(u=!0,n=c.shift(),yo(xo.IM_WEBSOCKET,{startTime:(new Date).getTime(),host:n,protocol:br.WS}),[4,this._connect(e,t,n,i,r,o)]);case 1:if(s=d.sent(),l=s===ge.SUCCESS||s===ve.REDIRECT?s:dn(s),yo(xo.IM_WEBSOCKET,{endTime:(new Date).getTime(),code:l}),function(e){D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:t=xo.IM_WEBSOCKET,n=vo(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=Eo(t),a=s.protocol,c=s.startTime,u=s.endTime,h=s.code,l=s.host,d=po.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),Dt.info(f.message),[3,4];case 4:return p=0,Z(c)&&Z(u)&&u>c&&c&&(p=u-c),lo(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),s===ge.SUCCESS)this._checkAlive(),a(s);else if(s===ve.REDIRECT)a(s);else{if(0===c.length)return a(dn(s)),[2];u=!1,h()}return[2]}}))}))};r=q(r),s._watcher.status(me.CONNECTING),h()}))]}))}))},t.prototype._connect=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s,a,c,u,h,l=this;return V(this,(function(d){switch(d.label){case 0:return s=i.replace("http","ws"),a=Ko(s,n,e,t,this._runtime,r,"",o),Dt.info("conenct start -> ".concat(a)),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(a),u=function(e){l._timer&&(clearTimeout(l._timer),l._timer=null),l._socket===c&&(l._socket=null,l._watcher.status(e))},[4,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=function(e,t){var n=new Uint8Array(e),i=new Tn(n),r=i.readByte(),o=new yn(r),s=Go(o);return s.read(i,n.length-1,t),s}(t,o);if(n instanceof Mo&&l._pingResolve)return l._pingResolve(ge.SUCCESS),void(l._pingResolve=void 0);if(n instanceof So)return Dt.info("recv connect ack -> ".concat(n.status)),n.status!==ve.ACCEPTED?(Dt.warn("connect failed: ".concat(n.status)),void e(n.status)):(Dt.info("connect success -> ".concat(a)),l.connectedTime=n.timestamp,l.userId=n.userId||"",l._idCount=n.messageId,void e(ge.SUCCESS));if(n instanceof No){var i=n.status;switch(Dt.warn("recv disconnect signal -> status: ".concat(i)),i){case Bo.BLOCK_NEW:case Bo.BLOCK:l._watcher.status(me.BLOCKED);break;case Bo.OTHER_DEVICE_LOGIN:l._watcher.status(me.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Bo.REDIRECT_NEW:case Bo.REDIRECT:l._watcher.status(me.REDIRECT);break;default:l._watcher.status(me.DISCONNECT_BY_SERVER)}}else l._onReceiveSignal(n)}else Dt.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var i in Dt.warn("websocket closed! code:",t,"reason:",n),u(me.CONNECTION_CLOSED),l._messageIds){var r=l._messageIds[i];delete l._messageIds[i],r(ge.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in Dt.error("websocket error!",null==t?void 0:t.stack),u(me.WEBSOCKET_ERROR),l._messageIds){var i=l._messageIds[n];delete l._messageIds[n],i(ge.RC_NET_CHANNEL_INVALID)}e(ge.NETWORK_ERROR)})),c.onOpen((function(){return Dt.info("websocket open =>",a)})),setTimeout((function(){e(ge.TIMEOUT)}),5e3)}))];case 1:return(h=d.sent())===ge.SUCCESS?this._socket=c:(Dt.warn("connect result -> code: ".concat(h,", url: ").concat(a)),c.close()),[2,h]}}))}))},t.prototype._checkAlive=function(){var e;return D(this,void 0,void 0,(function(){var t,n,i=this;return V(this,(function(r){switch(r.label){case 0:return this._socket?(Dt.info("send ping ->"),this.sendOnly(new Oo),t=pt(),yt(we.L_CHECK_ALIVE_IM_T,{},{traceId:t}),[4,new Promise((function(e){i._pingResolve=e,i._timer&&clearTimeout(i._timer),i._timer=setTimeout((function(){i._pingResolve=void 0,e(ge.TIMEOUT)}),15e3)}))]):[2];case 1:return n=r.sent(),(n===ge.SUCCESS?yt:Et)(we.L_CHECK_ALIVE_IM_R,{isSuccess:n===ge.SUCCESS},{traceId:t}),n!==ge.SUCCESS?(this._failedCount+=1,Dt.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(n)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Dt.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._socket=null,this._watcher.status(me.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(Dt.info("recv ping <-"),this._failedCount=0,setTimeout((function(){return i._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a=this;return V(this,(function(c){switch(c.label){case 0:return t=e.messageId,e.header&&e.header.qos!==Ft.AT_MOST_ONCE&&(e instanceof wo&&!e.syncMsg&&(Dt.info("send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Po(t))),e instanceof ko&&(Dt.info("send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Vo(t)))),t>0&&(e instanceof bo||e instanceof ko)&&(Dt.info("recv ack -> messageId: ".concat(t," ").concat(e.topic)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(i=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],i(e))),e instanceof wo?(r=e.syncMsg,o=e.topic,Dt.info("recv PublishReader -> messageId: ".concat(t," ").concat(o)),o===Fo[Fo.userSetData]?[2]:!r||Ho(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){a._syncMessageIds[t]=e}))]):[3,2];case 1:s=c.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,s),c.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof Lo||e instanceof Do)&&(e.messageId=this._generateMessageId()),qo(e,this._socket))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),D(this,void 0,void 0,(function(){var r,o,s,a,c=this;return V(this,(function(u){switch(u.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,qo(e,this._socket),[4,new Promise((function(e){c._messageIds[r]=e,setTimeout((function(){c._messageIds[r]&&delete c._messageIds[r],e()}),i)}))]):[3,2];case 1:return(o=u.sent())?o instanceof ko||o instanceof bo?(s=t&&o.data&&[ge.SUCCESS,ge.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(Dt.warn("send failed -> message: ".concat(r,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:ge.SUCCESS,data:a}]):[2,{code:o}]:(Dt.warn("send timeout -> message: ".concat(r,", respPBName: ").concat(t,", timeout: ").concat(i)),[2,{code:ge.TIMEOUT}]);case 2:return[2,{code:ge.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(me.DISCONNECTED))},t}(ho);var jo=function(e){function t(t,n){var i=e.call(this,"comet",n)||this;return i._runtime=t,i._messageIds={},i._syncMessageIds={},i._idCount=0,i._generateMessageId=function(){return++i._idCount},i._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),i}return b(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=J(e.data)?JSON.parse(e.data):e.data;return n?!X(n)||(rn(n,(function(e){return D(t,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new yn(t),i=Go(n);for(var r in e)i[r]=e[r];return i}(e),i=n.messageId,r=n._header,o=n.status,s=r&&r.qos!==Ft.AT_MOST_ONCE,i&&n.getIdentifier&&((a=this._messageIds[i])&&a(n),this._syncMessageIds[i]&&this._syncMessageIds[i](n)),s&&(n instanceof wo&&!n.syncMsg&&(c=new Po(i),this.sendOnly(c)),n instanceof ko&&(c=new Vo(i),this.sendOnly(c))),n instanceof No){switch(o){case Bo.OTHER_DEVICE_LOGIN:this._watcher.status(me.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Bo.BLOCK:case Bo.BLOCK_NEW:this._watcher.status(me.BLOCKED);break;case Bo.REDIRECT_NEW:case Bo.REDIRECT:this._watcher.status(me.REDIRECT);break;default:this._watcher.status(me.DISCONNECT_BY_SERVER)}return[2]}return n instanceof wo?(u=n.syncMsg,h=n.topic,!u||Ho(h)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){d._syncMessageIds[i]=e}))]):[3,2];case 1:l=f.sent(),delete this._syncMessageIds[i],this._watcher.signal(n,l),f.label=2;case 2:return[2]}}))}))})),!0):(Dt.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o;return V(this,(function(s){switch(s.label){case 0:return t=(new Date).getTime(),n="".concat(e,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"×trap=").concat(t,"&pid=").concat(this._pid),i=pt(),yt(we.L_CHECK_ALIVE_IM_T,{},{traceId:i}),[4,this._runtime.httpReq({url:n,body:{pid:this._pid},timeout:45e3})];case 1:return r=s.sent(),o=this.handleCometRes(r),(o?yt:Et)(we.L_CHECK_ALIVE_IM_R,{isSuccess:o},{traceId:i}),this._isDisconnected||(o?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(me.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var o,s,a=this;return V(this,(function(c){return r=q(r),this._protocol=i,this._isDisconnected=!1,this._watcher.status(me.CONNECTING),o=n.slice(),s=!1,[2,new Promise((function(n){var c=function(){return D(a,void 0,void 0,(function(){var a,u,h;return V(this,(function(l){switch(l.label){case 0:return 0===o.length||s?[2]:(s=!0,a=o.shift(),yo(xo.IM_COMET,{startTime:(new Date).getTime(),host:a,protocol:br.NAVI}),[4,this._connect(e,t,a,i,r)]);case 1:if(u=l.sent(),h=u===ge.SUCCESS||u===ve.REDIRECT?u:dn(u),yo(xo.IM_COMET,{endTime:(new Date).getTime(),code:h}),function(e){D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:t=xo.IM_COMET,n=vo(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=Eo(t),a=s.protocol,c=s.startTime,u=s.endTime,h=s.code,l=s.host,d=po.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),Dt.info(f.message),[3,4];case 4:return p=0,Z(c)&&Z(u)&&u>c&&c&&(p=u-c),lo(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),u===ge.SUCCESS)this._startPullSignal(i),n(u);else if(u===ve.REDIRECT)n(u);else{if(0===o.length)return n(dn(u)),[2];s=!1,c()}return[2]}}))}))};a._watcher.status(me.CONNECTING),c()}))]}))}))},t.prototype._connect=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(Dt.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(function(e){if(ne(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t}(e.data)?ne(e.data)?e.data:JSON.parse(e.data):(Dt.error("received data is not a validJson",e.data),!1))},s=Ko(i,n,e,t,this._runtime,r,this._pid),this.sendConnectTime=Date.now(),Dt.info("conenct start -> ".concat(s)),[4,this._runtime.httpReq({url:s,body:{pid:this._pid},timeout:5e3})];case 1:return a=u.sent(),c=o(a),this._domain=n,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp,yt("connect success -> userId: ".concat(c.userId,", url: ").concat(s))):Dt.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(s)),[2,null==c?void 0:c.status]}}))}))},t.prototype.sendCometData=function(e,t){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return n=(t=this)._domain,i=t._sessionid,r=t._pid,o=e.messageId,s=e.topic,a=e.targetId,c=e.getHeaderFlag(),u=s?"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(s,"&targetid=").concat(a,"&pid=").concat(r):"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&pid=").concat(r),[4,this._runtime.httpReq({url:u,method:fo.POST,body:e.getCometData()})];case 1:return h=l.sent(),this.handleCometRes(h),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),D(this,void 0,void 0,(function(){var r,o,s,a,c=this;return V(this,(function(u){switch(u.label){case 0:return r=this._generateMessageId(),e.messageId=r,this.sendCometData(e),[4,new Promise((function(e){c._messageIds[r]=e,setTimeout((function(){delete c._messageIds[r],e()}),i)}))];case 1:return(o=u.sent())?(s=t&&o.data&&[ge.SUCCESS,ge.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?a:null}]:[2,{code:ge.SUCCESS,data:a}]):[2,{code:ge.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(me.DISCONNECTED)},t}(ho),Qo=function(e){return["navi",e].join("_")};function Wo(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:t=xo.IM_NAVI,n=vo(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=Eo(t),a=s.protocol,c=s.startTime,u=s.endTime,h=s.code,l=s.host,d=po.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),Dt.debug(f.message),[3,4];case 4:return p=0,Z(c)&&Z(u)&&u>c&&c&&(p=u-c),lo(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:h,hos:l,net:d}),[2]}}))}))}var Jo=function(){function e(e,t,n){this.runtime=e,this._watcher=t,this._options=n,this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this._apiVersion=q(this._options.apiVersion)}return e.prototype.getNaviInfo=function(e,t,n,i){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return n&&this._clear(e),i=function(e,t,n){var i,r,o=Qo(e);try{var s=n.getItem(o);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();return r.length>0&&(r=r.filter((function(e){return a-e.timestamp<72e5}))),0===r.length?n.removeItem(o):n.setItem(o,JSON.stringify(r)),(null===(i=r.find((function(e){return e.token===t})))||void 0===i?void 0:i.naviInfo)||null}(this._appkey,e,this.runtime.localStorage),i?[2,i]:(r=this._options.navigators.slice(),t.length&&t.forEach((function(e){r.indexOf(e)<0&&r.unshift(e)})),[4,this.requestNaviInfo(r,this._appkey,e)]);case 1:return(i=o.sent())?(this.setNaviInfo2Cache(e,i),[2,i]):[2,i]}}))}))},e.prototype.setNaviInfo2Cache=function(e,t){!function(e,t,n,i){var r,o=Qo(e);try{var s=i.getItem(o);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();r.length>0&&(r=r.filter((function(e){return a-e.timestamp<72e5&&t!==e.token}))),r.push({timestamp:a,naviInfo:n,token:t}),i.setItem(o,JSON.stringify(r))}(this._appkey,e,t,this.runtime.localStorage)},e.prototype._clear=function(e){!function(e,t,n){var i,r=Qo(e);try{var o=n.getItem(r);i=o?JSON.parse(o):[]}catch(e){i=[]}var s=Date.now();i.length>0&&(i=i.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),0===i.length?n.removeItem(r):n.setItem(r,JSON.stringify(i))}(this._appkey,e,this.runtime.localStorage)},e}(),zo=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},e.prototype.getCoreVersion=function(){return this._context.coreVersion},e.prototype.getAPIVersion=function(){return this._context.apiVersion},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,i){void 0===i&&(i=[]),this._context.registerMessageType(e,t,n,i)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},e.prototype.setCallInfo=function(e,t,n){return this._context.setCallInfo(e,t,n)},e}(),Zo=function(e,t,n){return[e,t,n].join("_")},Xo=function(){function e(e,t){this._runtime=e,this._appkey=t,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0,broadcastSyncTime:0})},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var i=Zo("inbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=Zo("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||re(e))){n.broadcastSyncTime=e;var i=Zo("broadcastbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=Zo("broadcastbox",this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n))||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var i=Zo("outbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=Zo("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),$o={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},es=function(){function e(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,i=e.type,r=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=i===be.DELETE,c=s===o,u=!this._isExisted(n),h=a?this._remove:this._add;(t||r||c||u)&&h.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,i=t.isDeleted;return n&&!i},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,i=e.isFullUpdate;n=n||[],(i=i||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,i)})),Dt.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),ts=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(i=$o.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,this._isPulling=!1,o===ge.SUCCESS?($o.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){$o.clear(e);var t=this._storeCaches[e];t&&t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var i=this._storeCaches[e];ae(i)||(i=new es(e,n)),i.setEntries(t),this._storeCaches[e]=i},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getVersion=function(e,t){var n=this._storeCaches[e];return n?n.getVersion(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),ns=function(){function e(e,t,n,i){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){Dt.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],ae(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},e.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},e}(),is="converStatusChanged",rs=function(){function e(e,t,n){this._eventEmitter=new Vt,this._pullQueue=[],this._isPulling=!1,this._storage=A(e.runtime),this._appkey=t,this._currentUserId=n,this._engine=e,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n)}return e.prototype._set=function(e){var t=this;if(!re(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach((function(e,r){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(is,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=r.sent(),n=t.code,i=t.data,n===ge.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(is,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(is,(function(e){}))},e}(),os={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},ss={};for(var as in os){var cs=os[as].keyName;ss[cs]=as}var us,hs=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var i="con-".concat(t,"-").concat(n);this.storage=new w(e,i),this._localStore=new w(e,"CONVER-".concat(t,"-").concat(n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),i=t.shift(),r=t.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:j.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,i=e.targetId,r=e.messageType,o=e.isMentioned,s=e.content,a=e.senderUserId,c=e.channelId,u=this._getStoreKey(n,i,c),h=this._localStore.get(u)||{},l=ss.mentionedInfo,d=ss.hasMentioned,f=h[l]||{},p=f.userIdList||[],g=s.mentionedInfo;if(g){if(o&&n===j.GROUP)(g.userIdList||[]).forEach((function(e){e===t._currentUserId&&p.indexOf(a)<0&&p.push(a)})),g.type===Ne.ALL&&p.indexOf(a)<0&&p.push(a);if(r===Ee.RECALL&&n===j.GROUP){var _=p.indexOf(a);_>=0&&p.splice(_,1)}g={userIdList:p,type:(null==g?void 0:g.type)||f.type},0!==p.length?(h[l]=g,h[d]=!0):(delete h[l],delete h[d]),ae(h)?this._localStore.set(u,h):this._localStore.remove(u)}},e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=ss[s],c=n[s];if(!re(a)&&!re(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(c===os[a].defaultVal||"tags"===s&&!ae(c))delete o[a];else if("tags"===s){var u=c;for(var h in u)u[h].isTop||delete u[h].isTop;o[a]=c}else o[a]=c;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}ae(o)?this._localStore.set(r,o):this._localStore.remove(r)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var i=this._getStoreKey(e,t,n),r=this._localStore.get(i)||{},o={};for(var s in os){var a=os[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||un(u)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var i in t){var r=this._getConOptionByKey(i),o={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},s=t[i];for(var a in s)if(os[a]){var c=os[a],u=c.keyName,h=c.defaultVal;o[u]=s[a]||un(h)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var i=this._getConOptionByKey(n),r=i.conversationType,o=i.targetId,s={},a=e[n];for(var c in a){var u=os[c],h=u.keyName,l=u.defaultVal;s[h]=a[c]||un(l)}for(var d in s.tags){re(t[d])&&(t[d]=[]);var f=Object.assign({},s,{conversationType:r,targetId:o});delete f.tags,t[d].push(f)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}this.storage.clear()}catch(e){Dt.error("adaptOldStore error: ".concat(e.message))}},e}(),ls=[j.PRIVATE,j.GROUP,j.SYSTEM,j.PUBLIC_SERVICE,j.APP_PUBLIC_SERVICE],ds="conversationChanged",fs="conTagStatusChanged",ps=function(){function e(e,t,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Vt,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new hs(e.runtime,t,n),this._statusManager=new rs(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(ds,(function(e){i(e)})),this._eventEmitter.on(fs,(function(){r()}))}return e.prototype._calcUnreadCount=function(e,t){var n=e.content,i=e.messageType,r=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,c=s===fe.SEND&&a===this._loginUserId,u=i===Ee.RECALL,h=ne(n),l=!1,d={},f=t.lastUnreadTime||0,p=t.lastReadTime||0,g=t.unreadMessageCount||0;if(f>r||c)return{hasChanged:l,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=g+1,t.lastUnreadTime=r,l=!0),u&&h){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),m=!this._recallMsgTimeMap[_]||this._recallMsgTimeMap[_]&&!this._recallMsgTimeMap[_].find((function(e){return e===n.sentTime})),v=f>=n.sentTime;p&&(v=p<n.sentTime),v&&g&&m&&(!this._recallMsgTimeMap[_]&&(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=g-1,l=!0)}return l&&(d.unreadMessageCount={val:t.unreadMessageCount,time:r}),{hasChanged:l,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,i=(e.messageDirection,e.isMentioned),r=e.sentTime;fe.SEND;var o=ne(n),s=!1,a={};return i&&o&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0,a.hasMentioned={val:!0,time:r},a.mentionedInfo={val:n.mentionedInfo,time:r}),{hasChanged:s,localConversation:t,updateItems:a}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,i=e.messageDirection,r=!1;if(e.isMentioned&&i===fe.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===Ne.ALL||(a||[]).includes(this._loginUserId)){r=!0;var c=t.unreadMentionedCount||0;t.unreadMentionedCount=c+1}}return{hasChanged:r,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(ne(e)){var t=e.conversationType,n=e.targetId,i=e.channelId,r="".concat(t,"_").concat(n),o=this._store.get(t,n,i)||{};this._updatedConversations[r]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,i){var r=(this._store.get(e,t,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var o in r)if(!n[o]||!!r[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,i=e.targetId,r=e.updatedTime,o=e.notificationStatus,s=e.notificationLevel,a=e.isTop,c=e.tags,u=e.channelId,h={},l={};n!==j.ULTRA_GROUP&&(re(o)||(l.notificationStatus={time:r,val:o}),re(s)||(l.notificationLevel={time:r,val:s}),re(a)||(l.isTop={time:r,val:a}),re(c)||(l.tags={time:r,val:c},null==c||c.forEach((function(e){h[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,i,h,u),this._store.set(n,i,{notificationStatus:o,notificationLevel:s,isTop:a,tags:h},u),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:l,channelId:u}),t&&this._notifyConversationChanged())},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(ds,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(fs),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,i=e.conversationType,r=e.isPersited,o=e.targetId,s=e.channelId;if(ls.indexOf(i)>=0){var a=!1,c=this._store.get(i,o,s),u={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,c),r=i.hasChanged,o=i.localConversation,s=i.updateItems;a=a||r,u=P(P({},u),s),c=un(o)})),a&&this._store.set(i,o,c,s),this._store.updateMentionedData(e),r){var h=this._store.get(i,o,s);h.updatedItems=P({latestMessage:{time:e.sentTime,val:e}},u),h.latestMessage=e;var l=Object.assign(h,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(l)}(a||r)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var i=this._store.getValue(),r=0;return i.forEach((function(e){var i=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;i=i||0,(n||1!==o||s===Re.NOT_SET||s===Re.ALL_MESSAGE)&&(t.length>0?t.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],i=0;return n.forEach((function(e){var n=e.unreadMessageCount,r=e.notificationStatus,o=e.notificationLevel;(t||1!==r||-1===o||0===o)&&(n=n||0,i+=Number(n))})),i},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,i){void 0===i&&(i=!0);var r=this._store.get(e,t,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=r.unreadMessageCount,s=r.hasMentioned,a={};if(o&&(r.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,r,n),i&&0!==Object.keys(a).length){var c=Object.assign(r,{conversationType:e,targetId:t,channelId:n,updatedItems:a});this._setUpdatedConversation(c),this._notifyConversationChanged()}},e.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,t.lastReadTime=t.lastUnreadTime,e._recallMsgTimeMap={},e._store.set(t.conversationType,t.targetId,t,t.channelId))}))},e.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},e.prototype.setDraft=function(e,t,n,i){var r="".concat(e,"_").concat(t,"_").concat(i);this._draftMap[r]=n},e.prototype.getDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[i]},e.prototype.clearDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[i]},e.prototype.addTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i).tags;r=Object.assign(r,n),this._store.set(e,t,{tags:r},i)},e.prototype.deleteTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i).tags;n.forEach((function(e){delete r[e]})),this._store.set(e,t,{tags:r},i)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===Ie.OPEN||-1!==e.notificationLevel&&0!==e.notificationLevel})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===e&&(e=""),this.get(t,n,e).unreadMentionedCount||0},e.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t},e.prototype.getAllConversationState=function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e}(),gs=function(){function e(e,t,n,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(t,"-").concat(n),this._storagePullTimeKey="us-s-".concat(t,"-").concat(n),this._storage=A(e.runtime),this._engine=e,this._tagWatcherFunc=i}return e.prototype._updateTag=function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,i=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:i}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.deleteTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))},e.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=c.sent(),n=t.code,i=t.data,n!==ge.SUCCESS||re(i)?(this._isPulling=!1,this._startPull()):(o=(r=i).settings,s=r.version,a=o.Tag,re(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),_s=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(i=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,o===ge.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},e.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},e}(),ms=function(e,t){return["send_msg",e,t].join("_")},vs=function(){function e(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=ms(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=ms(this._appkey,this._userId),i=this._getLocalInfo(n);i[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(i))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=ms(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}();(us={})[j.PRIVATE]=Fo.qryPMsg,us[j.GROUP]=Fo.qryGMsg,us[j.CHATROOM]=Fo.qryCHMsg,us[j.CUSTOMER_SERVICE]=Fo.qryCMsg,us[j.SYSTEM]=Fo.qrySMsg;var ys=[Fo[Fo.recallMsg],Fo[Fo.ppMsgS],Fo[Fo.pgMsgS],Fo[Fo.ppMsgP],Fo[Fo.pgMsgP],Fo[Fo.chatMsg],Fo[Fo.pcMsgP],Fo[Fo.prMsgS],Fo[Fo.updUgRTime]],Es=function(){function e(e,t,n){this.ULTRA_GROUP_CONVERSATION="ultragroupconversation";var i="".concat(this.ULTRA_GROUP_CONVERSATION,"-").concat(t,"-").concat(n);this._localStore=new w(e,i)}return e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=Is[s],c=n[s];if(!re(a)&&!re(c))c===Ts[a].defaultVal?delete o[a]:o[a]=c}ae(o)?this._localStore.set(r,o):this._localStore.remove(r)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var i=this._getStoreKey(e,t,n),r=this._localStore.get(i)||{},o={};for(var s in Ts){var a=Ts[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||un(u)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Ts={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Is={};for(var Cs in Ts){var Rs=Ts[Cs].keyName;Is[Rs]=Cs}var Ss=function(){function e(e,t,n){this._store=new Es(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,o=e.channelId;t===j.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:i,notificationLevel:r},o)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),Ns=function(e,t,i,r,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:fe.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0}},Os=function(e){return e.sort((function(e,t){var n,i,r=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=t.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r}))},Ms=0,As=function(){return++Ms},Us=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.naviInfo=null,r._customMessageType={},r._reconnectTimer=-1,r._pullOfflineFinished=!1,r._conversationUpdatedTime=0,r._miniConnectUrl="",r.currentUserId="",r._connectedTime=0,r._localConnectedTime=0,r._status=me.DISCONNECTED,r._pullingMsg=!1,r._pullQueue=[],r._chrmsQueue={},r._latestSyncTimestamp=0,r._intervalTimer=-1,r._pullChatroomEntryTimestamp=0,r._intervalTimerForChrmPull=-1,r._lastSyncUltraMsgTimeStamp=0,r._lastSyncUltraMsgLocalTimeStamp=0,r._ultraGroupTimer=-1,r._isUltraPulling=!1,r._ultraGroupTimeQue=[],r._isUltraGroupListExist=!1,r._ultraGroupMap={},r._firstPullUltraGroupTime=0,r._ultraMsgMap={},r._pullUltraChangeMessageQue=[],r._isPullingUltraChangeMessage=!1,r._lastPullingUltraChangeMessageTime=0,r._ultraMsgChangeMap={},r._letterbox=new Xo(t,i.appkey),r._sendMessageStore=new vs(t,i.appkey),r._chrmEntryHandler=new ts(r),r._connectType=i.connectionType,r}return b(t,e),t.prototype._formatJSONPUrl=function(e,t,n,i){var r=this.runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(r,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(i,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())},t.prototype.getNaviInfo=function(t,n,i){var r;return D(this,void 0,void 0,(function(){var o;return V(this,(function(s){return this.runtime.useNavi||(o=void 0,o=this.runtime.isSupportSocket()&&"websocket"===this._connectType?c.join(","):u.join(","),this._miniConnectUrl=(null===(r=this._options.miniCMPProxy)||void 0===r?void 0:r.length)?this._options.miniCMPProxy.join(","):o||"",n=[]),[2,e.prototype.getNaviInfo.call(this,t,n,i)]}))}))},t.prototype.requestNaviInfo=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l,d,f;return V(this,(function(p){switch(p.label){case 0:i="getServerEndpoint",r=0,o=e.length,p.label=1;case 1:return r<o?(s=this._formatJSONPUrl(e[r],n,t,i),vt("req navi => ".concat(s)),[4,this.runtime.httpReq({url:s,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(a=p.sent(),c=(new Date).getTime(),yo(xo.IM_NAVI,{endTime:c}),200!==a.status)return u=void 0,403===a.status?(u=ge.RC_CONN_USER_OR_PASSWD_ERROR,Tt("request navi error: "+u)):401===a.status&&(u=ge.RC_CONN_APP_BLOCKED_OR_DELETED,Tt("request navi error: "+u)),yo(xo.IM_NAVI,{code:u}),Wo(this.runtime),[3,3];try{return h=a.data.match(/{[\d\D]+}/),0===(l=h&&h[0]?h[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),f=JSON.parse(l),d=/^https/.test(s)?"https":"http",f.protocol=d,this.runtime.useNavi||(f.server="",f.backupServer=this._miniConnectUrl,f.logSwitch=0),mo({serverPrivate:f.type===Lr.PRIVATE?Lr.PRIVATE:Lr.OPEN}),yo(xo.IM_NAVI,{code:ge.SUCCESS}),f.userId&&(wt({userId:f.userId}),gt({userId:f.userId})),Wo(this.runtime),[2,f]}catch(e){Tt("parse navi err =>",e)}p.label=3;case 3:return r+=1,[3,1];case 4:return this.runtime.useNavi?[2,null]:(f={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},yo(xo.IM_NAVI,{code:f.code,startTime:0,endTime:0,host:""}),Wo(this.runtime),[2,f])}}))}))},t.prototype.getNaviInfoFromCache=function(){return this.naviInfo?P({},this.naviInfo):null},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a=this;return V(this,(function(c){switch(c.label){case 0:return n=[],this.naviInfo=t,t.server?n.push(t.server):Dt.warn("navi.server is invalid"),(i=t.backupServer)&&i.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(Dt.error("navi invaild.",n),[2,ge.UNKNOWN]):(r=this.runtime.createDataChannel({status:function(i){a._connectionStatusHandler(i,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=Yt.V3,1===t.openAnti&&(o=Yt.V4),[4,r.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(s=c.sent())===ge.SUCCESS?(this._channel=r,this.currentUserId=r.userId,this._connectedTime=r.connectedTime,this._localConnectedTime=Math.floor((Date.now()+r.sendConnectTime)/2),this._watcher.status(me.CONNECTED),this._status=me.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new ps(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._ultraGroupManager=new Ss(this,this._appkey,this.currentUserId),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new gs(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new _s(this),this._joinedChrmManager=new ns(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval(),1===t.ugMsg&&this._startUltraSyncInterval()):r.close(),[2,s]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,i){if(Dt.warn("connection status changed:",e),this._status=e,e!==me.CONNECTING)if(e!==me.CONNECTED){if(this._channel&&e!==me.DISCONNECTED)return e===me.BLOCKED||e===me.KICKED_OFFLINE_BY_OTHER_CLIENT||e===me.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==me.REDIRECT?(this._watcher.status(e),this._try2Reconnect(t,n,i)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)},t.prototype._try2Reconnect=function(e,t,n){var i,r;return D(this,void 0,void 0,(function(){var o,s=this;return V(this,(function(a){switch(a.label){case 0:return this._channel?(o=Yt.V3,1===(null===(i=this.naviInfo)||void 0===i?void 0:i.openAnti)&&(o=Yt.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,o)]):[2];case 1:return a.sent()===ge.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(me.CONNECTED),this._status=me.CONNECTED,1===(null===(r=this.naviInfo)||void 0===r?void 0:r.ugMsg)&&this._startUltraSyncInterval(),this._rejoinChrm(),[2]):(this._watcher.status(me.WEBSOCKET_UNAVAILABLE),this._status=me.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(e,t,n)}),5e3),[2])}}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,i=e.topic;if(n)this._receiveSyncMsg(e,t);else{var r=Fo[i];if(r)switch(r){case Fo.s_ntf:Dt.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case Fo.s_msg:this._receiveMsg(e);break;case Fo.s_cmd:this._receiveStateNotify(e);break;case Fo.s_us:this._receiveSettingNotify(e);break;case Fo.rtc_ntf:this._receiveRtcKv(e);break;case Fo.s_opNtf:this._pullOperateStatusNotify(e)}else Dt.error("unknown topic:",i)}},t.prototype._receiveStateNotify=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,wn),i=n.time,r=n.type,o=n.chrmId;switch(r){case 2:this._chrmEntryHandler.pullEntry(o,i);break;case 3:this._conversationManager.startPullConversationStatus(i);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(i),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(i),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Mi)).version;this._userSettingManager.pullUserSettings(n)},t.prototype._receiveRtcKv=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,ar),i=n.time,r=n.type,o=n.roomId;if(1===r)this._rtcKVManager.pullEntry(o,i)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,i=t.del,r=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:r,expansion:n}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:r,deletedKeys:i}})},t.prototype._receiveSyncMsg=function(e,t){var n,i;if(ys.includes(e.topic)){if(e.topic===Fo[Fo.updUgRTime]){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,Kn),o=r.channelId,s=r.busChannel,a=this._ultraGroupMap[s+"_"+o];return a&&(a.unreadMessageCount=0,a.unreadMentionedCount=0,a.lastReadTime=t.timestamp,this._watcher.conversation(pn([a]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var c=null===(i=this._channel)||void 0===i?void 0:i.codec.decodeByPBName(e.data,Cn,{currentUserId:this.currentUserId,signal:e});c=this._handleMsgProperties(c),t&&(c.sentTime=t.timestamp,c.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||c.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),c.messageType!==Ee.EXPANSION_NOTIFY?(c.messageType===Ee.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(c.conversationType,c.targetId,c.channelId),this._conversationManager.setConversationCacheByMessage(c,!0),this._watcher.batchMessage([c])):this._receiveMessageExpansion(c))}},t.prototype._pullMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,wn),n=t.type,i=t.chrmId,r=t.time;if(Dt.info("s_ntf -> type: ".concat(n,", chrmId: ").concat(i,", time: ").concat(r)),2===n){var o=this._chrmsQueue[i];if(!o)return;o.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()}},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncMsg=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,c,u,h,l,d,f,p,g,_,m,v,y=this;return V(this,(function(E){switch(E.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),Dt.info("pullMsg -> sendboxTime: ".concat(e,", inboxTime: ").concat(t,", broadcastSyncTime: ").concat(n)),i=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),r=new Do(Fo[Fo.pullMsg],i,this.currentUserId),o=pt(),yt(we.L_PULL_MSG_T,{outboxTime:e,inboxTime:t,broadcastSyncTime:n},{traceId:o}),[4,this._channel.send(r,Nn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=E.sent(),a=s.code,c=s.data,this._latestSyncTimestamp=Date.now(),a!==ge.SUCCESS||!c||re(c.finished)||re(c.list)||re(c.syncTime)?(Dt.warn("pullMsg failed -> code:",a,", data: ",c),Et(we.L_PULL_MSG_R,{code:a,timestamp:this._latestSyncTimestamp},{traceId:o}),this._pullingMsg=!1,[2]):(u=c.list,h=c.finished,l=c.syncTime,d=c.broadcastSyncTime,f=void 0===d?1:d,Dt.info("pullMsg success -> syncTime: ".concat(l,", finished: ").concat(h)),p=0,g=[],_=[],u.forEach((function(e){if(e.messageType!==Ee.DELIVERED&&e.messageType!==Ee.DELIVERED_MSG){if(g.push(e.messageUId),e.messageDirection===fe.SEND)if(p=Math.max(e.sentTime,p),y._sendMessageStore.getSendMessageMap()[e.messageUId])return void y._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==Ee.EXPANSION_NOTIFY){if(e.messageType===Ee.SYNC_READ_STATUS){if(e.senderUserId!==y.currentUserId)return;y._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=y._handleMsgProperties(e);y._conversationManager.setConversationCacheByMessage(t,!0),_.push(t)}else y._receiveMessageExpansion(e)}})),this._watcher.batchMessage(_),this._letterbox.setInboxTime(l,this.currentUserId),this._letterbox.setOutboxTime(p,this.currentUserId),this._letterbox.setBroadcastSyncTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(p),this._pullingMsg=!1,m=this._pullQueue.filter((function(e){return e>l})),this._pullQueue.length=0,(v=this._pullQueue).push.apply(v,m),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),yt(we.L_PULL_MSG_R,{code:a,messageUIds:g.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h},{traceId:o}),(!h||m.length>0)&&this._syncMsg(),[2])}}))}))},t.prototype._receiveMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Sn,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});if((t=this._handleMsgProperties(t)).messageType!==Ee.DELIVERED&&t.messageType!==Ee.DELIVERED_MSG){if(t.conversationType!==j.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}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!==Ee.EXPANSION_NOTIFY?t.messageType===Ee.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,i=e.messageType,r=e.isCounted,o=e.isPersited,s=e.isStatusMessage,a=i in T,c=i in this._customMessageType;if(n=a?P(P({},T[i]),{isStatusMessage:C.includes(i)}):c?this._customMessageType[i]:{isCounted:!oe(r)&&r,isPersited:!oe(o)&&o,isStatusMessage:!1},Object.assign(e,n),t&&!re(s)&&(e.isStatusMessage=s),!t){var u=e.content.user;if(u){var h=u.portrait,l=u.portraitUri,d=h||l;d&&(u.portrait=u.portraitUri=d)}}return e},t.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){return void 0===o&&(o=""),D(this,void 0,void 0,(function(){var s,c,u,h,l,d,f,p,g,_;return V(this,(function(m){switch(m.label){case 0:return c=(s=this).currentUserId,u=s._channel,h=no[e]||zr,l=1===i&&0===n,u?(d=u.codec.encodeGetHistoryMsg(t,{timestamp:n,count:l?2:i,order:r,channelId:o}),yt(we.L_GET_HISTORY_MSG_T,{targetId:t,conversationType:e,channelId:o,timestamp:n,count:i,order:r},{traceId:a}),[4,u.send(new Do(h,d,c),bn,{currentUserId:c,connectedTime:u.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return f=m.sent(),(p=f.code)===ge.SUCCESS&&d?(g=f.data,l&&2===g.list.length&&(g.hasMore=!0,0===r?g.list.shift():g.list.pop()),_=[],g.list&&g.list.forEach((function(e){e&&_.push(e.messageUId)})),yt(we.L_GET_HISTORY_MSG_R,{code:p,messageUIds:_.join(",")},{traceId:a}),[2,{code:p,data:{list:g.list,hasMore:g.hasMore}}]):(Et(we.L_GET_HISTORY_MSG_R,{code:p,messageUIds:""},{traceId:a}),[2,{code:p}]);case 2:return[2,{code:ge.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){Dt.info("reportSDKInfo ->",e);var i=n.codec.encodeReportSDKInfo(JSON.stringify(e)),r=new Do(Fo[Fo.reportsdk],i,t);n.send(r).then((function(e){var t=e.code;t!==ge.SUCCESS&&Dt.warn("reportSDKInfo failed -> code: ".concat(t))}))}},t.prototype.deleteRemoteMessage=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return o=(r=this).currentUserId,(s=r._channel)?(a=s.codec.encodeDeleteMessages(e,t,n,i),c=new Do(Gr,a,o),[4,s.send(c)]):[3,2];case 1:return u=l.sent(),h=u.code,ge.SUCCESS,[2,h];case 2:return[2,ge.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return o=(r=this).currentUserId,(s=r._channel)?(a=s.codec.encodeClearMessages(t,n,i,e),c=io[e],u=new Do(c,a,o),[4,s.send(u)]):[3,2];case 1:return h=d.sent(),l=h.code,ge.SUCCESS,[2,l];case 2:return[2,ge.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:return o=(r=this).currentUserId,s=r._channel,t=t||j.PRIVATE,s?(a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),c=new Do(jr,a,o),[4,s.send(c,Dn,{currentUserId:o,connectedTime:s.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=d._conversationManager.get(t,n,i);return Object.assign(e,r),e}})]):[3,2];case 1:return u=f.sent(),h=u.code,l=u.data,h!==ge.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==l?void 0:l.list}];case 2:return[2,{code:ge.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return(i=this._channel)?(r=i.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new Do(Qr,r,t),[4,i.send(o)]):[3,2];case 1:return s=c.sent(),Dt.info("RemoveConversation =>",s),a=s.code,ge.SUCCESS,[2,a];case 2:return[2,ge.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return e!==j.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap[n+"_"+t])?[3,3]:[2,{code:ge.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:ge.CONVER_GET_ERROR}];case 2:if(o=u.sent(),s=o.code,a=o.data,s!==ge.SUCCESS)return[2,{code:ge.CONVER_GET_ERROR}];c=(null==a?void 0:a.list[0])||null,i={conversationType:e,targetId:t,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:c,notificationStatus:r.notificationStatus||Ie.CLOSE,notificationLevel:r.notificationLevel||Re.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},u.label=3;case 3:return[2,{code:ge.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:ge.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return r=e===j.ULTRA_GROUP?(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0:this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:ge.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(ge.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(ge.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve(ge.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:ge.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(ge.SUCCESS)},t.prototype.pullConversationStatus=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h=this;return V(this,(function(l){switch(l.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(r=n.codec.encodeGetConversationStatus(e),o=new Do(Fo[Fo.pullSeAtts],r,i),[4,n.send(o,Ui)]):[3,2];case 1:return s=l.sent(),a=s.code,c=s.data,yt(we.L_PULL_CONVERSATION_S,{timestamp:e,userId:i}),a!==ge.SUCCESS?[2,{code:a}]:(u=[],Array.isArray(c)&&c.forEach((function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.channelId,o=e.isTop,s=e.notificationLevel,a=h._ultraGroupMap[r+"_"+n];t===j.ULTRA_GROUP?a&&(void 0!==i&&(a.notificationStatus=i),void 0!==s&&(a.notificationLevel=s),void 0===s&&void 0===i||h._ultraGroupManager.addUltraGroupStatus(e),"boolean"==typeof o&&(a.isTop=o)):u.push(e)})),[2,{code:a,data:u}]);case 2:return[2,{code:ge.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d=this;return V(this,(function(f){switch(f.label){case 0:return n=(t=this).currentUserId,(i=t._channel)?(r=i.codec.encodeSetConversationStatus(e,this._conversationUpdatedTime),o=new Do(Wr,r,n),[4,i.send(o,Pi)]):[3,2];case 1:return s=f.sent(),a=s.code,c=s.data,a===ge.SUCCESS?(u=c,this._conversationUpdatedTime=u.version,h=[],e.forEach((function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,o=e.channelId,s=e.isTop;if(t===j.ULTRA_GROUP){var a=d._ultraGroupMap[o+"_"+n];a&&(void 0!==i&&(a.notificationStatus=i),void 0!==r&&(a.notificationLevel=r),void 0===r&&void 0===i||d._ultraGroupManager.addUltraGroupStatus(a),void 0!==s&&(a.isTop=s),h.push(a))}else d._conversationManager.addStatus(P(P({},e),{updatedTime:u.version}),!0)})),h.length>0&&(l=pn(h),l=Os(l),this._watcher.conversation(l)),[2,a]):[2,a];case 2:return[2,ge.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return(r=this._channel)?(o=r.codec.encodeJoinOrQuitChatRoom(),a=new Do(s=n?xr:Br,o,e),yt(we.L_JOIN_CHATROOM_T,{chatroomId:e,count:t,topic:s},{traceId:i}),[4,r.send(a,qn)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return c=d.sent(),u=c.code,h=c.data,(u===ge.SUCCESS?yt:Et)(we.L_JOIN_CHATROOM_R,{code:u,timestamp:(new Date).getTime()},{traceId:i}),u===ge.SUCCESS&&(l=h.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,l),this.naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull()),[2,u]}}))}))},t.prototype._rejoinChrm=function(){return D(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,a.label=1;case 1:return i<t.length?(r=t[i],yt(we.L_REJOIN_CHATROOM_T,{chatroomId:r,count:e[r]||10,topic:xr}),o=pt(),[4,this._joinChrm(r,e[r]||10,!0,o)]):[3,4];case 2:s=a.sent(),(s===ge.SUCCESS?yt:Et)(we.L_REJOIN_CHATROOM_R,{code:s,timestamp:(new Date).getTime()},{traceId:o}),s===ge.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:r,count:e[r]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:s}}),a.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l,d,f,p,g;return V(this,(function(_){switch(_.label){case 0:return this._channel?(i=this._chrmsQueue[e],r=i.pulling,o=i.timestamp,r?[2]:(i.pulling=!0,s=this._channel.codec.encodeChrmSyncMsg(o,t),a=new Do(Fo[Fo.chrmPull],s,e),yt(we.L_PULL_CHATROOM_MSG_T,{chatroomId:e,timestamp:o}),[4,this._channel.send(a,Nn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return c=_.sent(),u=c.code,h=c.data,i.pulling=!1,u===ge.SUCCESS&&h?(l=h.list,d=h.syncTime,f=h.finished,i.timestamp=n?Math.max(d,n):d,i.queue=i.queue.filter((function(e){return e>d})),p=[],g=[],l.forEach((function(e){e.sentTime<o||(p.push(e.messageUId),g.push(e))})),this._watcher.batchMessage(g),yt(we.L_PULL_CHATROOM_MSG_R,{code:u,timestamp:o,messageUIds:p.join(",")}),(!f||i.queue.length>0)&&this._pullChrmMsg(e),[2]):(Et(we.L_PULL_CHATROOM_MSG_R,{code:u,timestamp:o,messageUIds:""}),Dt.warn("pull chatroom msg failed, code:",u,", data:",h),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o;return V(this,(function(s){switch(s.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),i=new Do(Fr,n,e),[4,t.send(i)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return r=s.sent(),(o=r.code)===ge.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return(i=this._channel)?(r=i.codec.encodeGetChatRoomInfo(t,n),o=new Do(Fo[Fo.queryChrmI],r,e),[4,i.send(o,jn)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==ge.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:return(r=this._channel)?(o=r.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:i}),s=new Do(Xr,o,e),[4,r.send(s,bn,{conversation:{targetId:e}})]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),c=a.code,u=a.data,c!==ge.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=i.codec.encodeModifyChatRoomKV(e,t,r),a=t.type===be.UPDATE?Kr:Hr,c=new Do(a,s,e),[4,i.send(c,qn)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return u=l.sent(),(h=u.code)===ge.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},r),[2,h]):[2,h]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d,f,p=this;return V(this,(function(g){switch(g.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(t.entries.forEach((function(t){var n=p._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?p.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(e,t,r),s=t.type===be.UPDATE?qr:Yr,a=new Do(s,o,e),[4,i.send(a,Ei)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return c=g.sent(),u=c.code,-1!==[ge.SUCCESS,ge.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(u)&&(l=[],delete(d=Object.assign({},t)).entries,t.entries.forEach((function(e){l.push(Object.assign({},e,d))})),u===ge.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=c.data,Dt.warn("设置失败的属性:",f.errorKeys),h=f.errorKeys,f&&Array.isArray(f.errorKeys)&&f.errorKeys.forEach((function(e){var t=l.findIndex((function(t){return e.key===t.key}));-1!==t&&l.splice(t,1)}))),Dt.warn("设置成功的属性:",l),this._chrmEntryHandler.setLocal(e,{kvEntries:l,syncTime:(new Date).getTime()},r)),[2,{code:u,data:h}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=be.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=be.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=be.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=be.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=be.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.type=be.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:ge.SUCCESS,data:n})]:[3,1];case 1:return(i=this._channel)?(r=i.codec.encodePullChatRoomKV(0),o=new Do(Fo[Fo.pullKV],r,e),[4,i.send(o,yi)]):[2,Promise.reject({code:ge.RC_NET_CHANNEL_INVALID})];case 2:return s=u.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&(c=a.kvEntries.find((function(e){return e.key===t})),void 0!==c)?[2,Promise.resolve({code:ge.SUCCESS,data:null==c?void 0:c.value})]:[2,Promise.resolve({code:ge.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:ge.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(i={},r=n.codec.encodePullChatRoomKV(0),o=new Do(Fo[Fo.pullKV],r,e),[4,n.send(o,yi)]):[2,Promise.reject({code:ge.RC_NET_CHANNEL_INVALID})];case 2:return s=c.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&a.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),[2,Promise.resolve({code:ge.SUCCESS,data:i})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d,f;return V(this,(function(p){switch(p.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(t||(t=this._pullChatroomEntryTimestamp),o=i.codec.encodePullChatRoomKV(t),s=new Do(Fo[Fo.pullKV],o,e),yt(we.L_PULL_CHATROOM_KV_T,{chatroomId:e,timestamp:t}),[4,i.send(s,yi)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return a=p.sent(),c=a.code,u=a.data,(c===ge.SUCCESS?yt:Et)(we.L_PULL_CHATROOM_KV_R,{code:c,timestamp:t}),c===ge.SUCCESS?(Dt.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(e,u,r),Dt.info("Save into cache success!"),l=(h=u).kvEntries,d=h.syncTime,this._pullChatroomEntryTimestamp=d||0,f=[],l.length>0&&(l.forEach((function(t){var n=t.key,i=t.value,r=t.type,o=t.timestamp;f.push({key:n,value:i,type:r,timestamp:o,chatroomId:e})})),this._watcher.chatroom({updatedEntries:f})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._channel?t.forEach((function(t){e._pullChrmMsg(t),e.naviInfo.kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),18e4)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var o,s,a,c,u,h,l,d,f,p,g;return V(this,(function(_){switch(_.label){case 0:return this._channel?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![j.PRIVATE,j.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[j.PRIVATE]=Fo.ppMsgS,t[j.GROUP]=Fo.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[j.PRIVATE]=Fo.ppMsgP,t[j.GROUP]=Fo.pgMsgP,t[j.CHATROOM]=Fo.chatMsg,t[j.CUSTOMER_SERVICE]=Fo.pcMsgP,t[j.RTC_ROOM]=Fo.prMsgS,t)[e]}(e)||Fo.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(c=new Lo(Fo[s],a,t)).setHeaderQos(Ft.AT_LEAST_ONCE),u=n.isPersited?As():0,o?(this._channel.sendOnly(c),[2,{code:ge.SUCCESS,data:Ns(e,t,P({},n),"",0,this.currentUserId,u)}]):(h=Date.now()-this._localConnectedTime+this._connectedTime,l=Ns(e,t,P({},n),"",h,this.currentUserId,u),i&&i(u),yt(we.L_SEND_MSG_T,{messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId},{traceId:r}),[4,this._channel.send(c)])):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return d=_.sent(),f=d.code,p=d.data,f!==ge.SUCCESS?(Et(we.L_SEND_MSG_R,{code:f,messageUId:l.messageUId,messageId:l.messageId},{traceId:r}),[2,{code:f,data:l}]):(yt(we.L_SEND_MSG_R,{code:f,messageUId:null==p?void 0:p.messageUId,messageId:null==p?void 0:p.messageId},{traceId:r}),g=p,this._sendMessageStore.setMessage(g.messageUId,g.timestamp),l.sentTime=g.timestamp,l.messageUId=g.messageUId,this._conversationManager.setConversationCacheByMessage(l,!0),[2,{code:ge.SUCCESS,data:l}])}}))}))},t.prototype.recallMsg=function(e,t,n,i,r){var o;return D(this,void 0,void 0,(function(){var s,a,c,u,h,l,d,f,p,g,_,m,v;return V(this,(function(y){switch(y.label){case 0:return this._channel?(s=r.user,a=r.extra,c=r.isDelete,u={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:c||!1},s&&(u.user=s),a&&(u.extra=a),h={content:u,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(o=r.pushConfig)||void 0===o?void 0:o.pushContent)||r.pushContent||"",channelId:r.channelId},l=Fo[Fo.recallMsg],d=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},h),(f=new Lo(l,d,this.currentUserId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(f)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return p=y.sent(),g=p.code,_=p.data,e===j.ULTRA_GROUP&&vt(we.L_RECALL_ULTRA_MSG_S,{code:g,conversationType:e,targetId:t,channelId:r.channelId}),g!==ge.SUCCESS?[2,{code:g}]:(m=_,e===j.ULTRA_GROUP?(this._ultraMsgMap[m.messageUId]=m.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:ge.SUCCESS}]):(this._sendMessageStore.setMessage(m.messageUId,m.timestamp),v=Ns(e,t,P(P({},h),{isPersited:!0}),m.messageUId,m.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:ge.SUCCESS,data:v}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeReadReceipt(t,n),r=new Do(Fo[Fo.rrMsg],i,e),[4,this._channel.send(r)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeMessageReader(t,n),r=new Do(Fo[Fo.rrList],i,e),[4,this._channel.send(r,xi)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return D(this,void 0,void 0,(function(){var t,n;return V(this,(function(i){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new Do(Fo[Fo.pullUS],t,this.currentUserId),[2,this._channel.send(n,Oi)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:return this._channel?(r=i&&"uploads"!==i?t||"":Zt(e,t),o=this._channel.codec.encodeGetFileToken(e,r,n||"",i||""),s=new Do(Fo[Fo.qnTkn],o,this.currentUserId),[4,this._channel.send(s,hi)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),c=a.code,u=a.data,u=Object.assign(u,{fileName:r}),c===ge.SUCCESS?[2,{code:c,data:u}]:[2,{code:c}]}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l,d;return V(this,(function(f){switch(f.label){case 0:return this._channel?(r="",o="",s="",t===Me.QINIU?(o=li,s=fi):(o=di,s=pi),r=t===Me.QINIU?Fo[Fo.qnUrl]:t===Me.AWS?Fo[Fo.s3Url]:t===Me.STC?Fo[Fo.stcUrl]:Fo[Fo.aliUrl],a=this._channel.codec.encodeGetFileUrl(o,e,n,i),c=new Do(r,a,this.currentUserId),[4,this._channel.send(c,s)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return u=f.sent(),h=u.code,l=u.data,d=l,h===ge.SUCCESS?[2,{code:h,data:d}]:[2,{code:h}]}}))}))},t.prototype.disconnect=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData()},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,t,n,i,r){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:r}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),i=new Do(Fo[Fo.addSeTag],n,this.currentUserId),[4,this._channel.send(i,Si)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==ge.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([P(P({},e),{createdTime:a})],a),[2,{code:ge.SUCCESS,data:s}])}}))}))},t.prototype.removeTag=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),i=new Do(Fo[Fo.delSeTag],n,this.currentUserId),[4,this._channel.send(i,Si)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==ge.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:ge.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),i=new Do(Fo[Fo.addSeTag],n,this.currentUserId),[4,this._channel.send(i,Si)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==ge.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:ge.SUCCESS,data:s}])}}))}))},t.prototype.getTagList=function(){return D(this,void 0,void 0,(function(){var e,t;return V(this,(function(n){return e=this._userSettingManager.getTags(),t=this._conversationManager.getConversationListForTag(),e.forEach((function(e){e.conversationCount=t[e.tagId]?t[e.tagId].length:0})),[2,{code:ge.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s=this;return V(this,(function(a){switch(a.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Do(Fo[Fo.addTag],n,this.currentUserId),[4,this._channel.send(i)]):[2,{code:ge.TAG_NOT_EXIST}]:[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return(r=a.sent().code)!==ge.SUCCESS?[2,{code:r}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:ge.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o=this;return V(this,(function(s){switch(s.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Do(Fo[Fo.delTag],n,this.currentUserId),[4,this._channel.send(i)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return(r=s.sent().code)!==ge.SUCCESS?[2,{code:r}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:ge.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return this._channel?(n=e.conversationType,i=e.targetId,r=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._channel.codec.encodeUpdateConversationTag(o,[e]),a=new Do(Fo[Fo.delTag],s,this.currentUserId),[4,this._channel.send(a)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return(c=u.sent().code)!==ge.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,i,t,r),[2,{code:ge.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return r=(i=this).currentUserId,(o=i._channel)?(s=o.codec.encodeOldConversationList({count:n,type:j.PRIVATE,startTime:t}),a=new Do(jr,s,r),[4,o.send(a,Dn,{currentUserId:r,connectedTime:o.connectedTime})]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return c=d.sent(),u=c.code,h=c.data,l=this._conversationHasTagFilter(e,null==h?void 0:h.list),Dt.info("GetConversationListByTag",l),u!==ge.SUCCESS?[2,{code:u}]:[2,{code:u,data:l}]}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,i=[],r=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,c=n._conversationManager.get(o,s,a),u=c.hasMentioned,h=c.mentionedInfo,l=c.lastUnreadTime,d=c.notificationStatus,f=c.isTop,p=c.tags,g=c.unreadMessageCount,_=p&&p[e];if(_){var m=P(P({},t),{hasMentioned:u,mentionedInfo:h,lastUnreadTime:l,notificationStatus:d,isTop:f,unreadMessageCount:g});_.isTop?i.push(P(P({},m),{isTopInTag:!0})):r.push(P(P({},m),{isTopInTag:!1}))}})),k(k([],i.sort(o),!0),r.sort(o),!0)},t.prototype.getUnreadCountByTag=function(e,t){return D(this,void 0,void 0,(function(){var n;return V(this,(function(i){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:ge.SUCCESS,data:n}]):[2,{code:ge.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,l,d;return V(this,(function(f){switch(f.label){case 0:return this._channel?(i=t.targetId,r=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(c=this._conversationManager.get(r,i,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(u=this._channel.codec.encodeUpdateConversationTag(a,[t]),h=new Do(Fo[Fo.addTag],u,this.currentUserId),[4,this._channel.send(h)]):[2,{code:ge.NO_TAG_IN_CONVER}]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return(l=f.sent().code)!==ge.SUCCESS?[2,{code:l}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(r,i,d,o),[2,{code:ge.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return D(this,void 0,void 0,(function(){var n,i,r,o;return V(this,(function(s){if(!this._channel)return[2,{code:ge.RC_NET_CHANNEL_INVALID}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(o in n.tags)r.push({tagId:o,tagName:null===(t=i[o])||void 0===t?void 0:t.tagName});return[2,{code:ge.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:ge.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:ge.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===j.ULTRA_GROUP?(null===(t=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId),Promise.resolve({code:ge.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:ge.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===j.ULTRA_GROUP)return Promise.resolve({code:ge.METHOD_NOT_AVAILABLE});var i;if(!(i=e===j.ULTRA_GROUP?this._ultraGroupManager.get(j.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:ge.SUCCESS,data:Re.NOT_SET});var r=i.notificationLevel;return re(i.notificationLevel)&&!re(i.notificationStatus)&&(r=Ie.OPEN===i.notificationStatus?1:0),Promise.resolve({code:ge.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===j.ULTRA_GROUP?this._ultraGroupManager.get(j.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:ge.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:ge.SUCCESS,data:Ie.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,o){return this.getHistoryMessage(e,t,n,i,r,o)},t.prototype.getUltraGroupList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r;return V(this,(function(o){return t=e.targetId,n=e.channelType,this._isUltraGroupListExist?(i=(i=Object.values(this._ultraGroupMap)).filter((function(e){return!(e.targetId!==t&&t||e.channelType!==n&&Z(n))})),i=Os(i),r=pn(i),[2,{code:ge.SUCCESS,data:r}]):[2,{code:ge.METHOD_NOT_AVAILABLE}]}))}))},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:ge.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===Ie.OPEN&&t.push({conversationType:j.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:ge.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:ge.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:j.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:ge.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:ge.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap){n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount)}return Promise.resolve({code:ge.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e){var t=0;for(var n in this._ultraGroupMap){var i=this._ultraGroupMap[n];i.targetId===e&&(t+=i.unreadMessageCount||0)}return Promise.resolve({code:ge.SUCCESS,data:t})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:ge.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap)t+=e?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return Promise.resolve({code:ge.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),D(this,void 0,void 0,(function(){var n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._channel?this._status!==me.CONNECTED?[2,ge.RC_NET_UNAVAILABLE]:(n=Date.now(),i=this._channel.codec.encodeClearUnreadCount({conversationType:j.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new Lo(Fo[Fo.updUgRTime],i,this.currentUserId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(r)]):[2,ge.RC_NET_CHANNEL_INVALID]:[2,Promise.resolve(ge.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===ge.SUCCESS&&(s=this._ultraGroupMap[t+"_"+e])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.lastReadTime=n),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l,d,f,p=this;return V(this,(function(g){switch(g.label){case 0:return this._channel&&this._status===me.CONNECTED?(!1,t=this._channel.codec.encodeUltraGroup(e,false),n=new Do(Fo[Fo.pullUgSes],t,this.currentUserId),[4,this._channel.send(n,Dn,{currentUserId:this.currentUserId,conversationType:j.ULTRA_GROUP})]):[2];case 1:return i=g.sent(),r=i.code,o=i.data,r===ge.SUCCESS&&o?(a=(null==o?void 0:o.list)||[],c=null==o?void 0:o.isFinished,a.forEach((function(e){e.notificationStatus=Ie.CLOSE,e.notificationLevel=Re.NOT_SET,e.isTop=!1,p._ultraGroupMap[e.channelId+"_"+e.targetId]=e,p._ultraGroupManager.addUltraGroupStatus(e)})),!1!==c?[3,2]:(u=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(u),[3,4])):(Dt.warn("pull super conversation failed, code:",r,", data:",o,"retrying..."),s=setTimeout((function(){p._firstPullUltraGroupTime=e,p._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return[4,this.pullConversationStatus(this._firstPullUltraGroupTime)];case 3:h=g.sent(),l=h.code,d=h.data,l!==ge.SUCCESS&&Dt.warn("pullConversationStatus fail code: ".concat(l,", data: ").concat(d)),f=Object.values(this._ultraGroupMap),f=Os(f),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(pn(f)),0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),g.label=4;case 4:return[2]}}))}))},t.prototype._startUltraSyncInterval=function(){var e=this,t=function(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._syncUltraMsg(0),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._syncUltraMsg=function(e){var t;return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,l,d,f,p,g,_=this;return V(this,(function(m){switch(m.label){case 0:return this._channel&&this._status===me.CONNECTED?this._isUltraPulling?[2]:(Dt.info("start pull ultra msg, time: ".concat(e)),this._isUltraPulling=!0,n=this._channel.codec.encodeSuperSyncMsg(e),i=new Do(Fo[Fo.pullUgMsg],n,this.currentUserId),r=pt(),yt(we.L_PULL_ULTRA_MSG_T,{timestamp:e},{traceId:r}),[4,this._channel.send(i,Nn,{currentUserId:this.currentUserId,conversation:{conversationType:j.ULTRA_GROUP}})]):[2];case 1:if(o=m.sent(),s=o.code,a=o.data,Dt.info("end pull ultra msg, code: ".concat(s,", syncTime: ").concat(null==a?void 0:a.syncTime,", count: ").concat(null===(t=null==a?void 0:a.list)||void 0===t?void 0:t.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),s!==ge.SUCCESS||!a)return Et(we.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:"",timestamp:e},{traceId:r}),Dt.warn("sync super message failed, code:",s,", data:",a),this._isUltraPulling=!1,[2];if(this._isUltraPulling=!1,c=a.list,u=a.syncTime,h=a.finished,!this._isUltraGroupListExist)return Dt.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=u,[2];for(g in l=[],d={},f=[],c.forEach((function(e){var t,n,i,r=e.targetId,o=e.content,s=e.messageType,a=e.messageUId,c=e.channelId,h=e.isCounted,p=e.channelType;if(l.push(a),_._ultraMsgMap[a])delete _._ultraMsgMap[a];else{var g=0;((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===Ne.ALL||(null===(i=null===(n=null==o?void 0:o.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===i?void 0:i.includes(_.currentUserId)))&&(g=1);var m=_._ultraGroupMap[c+"_"+r];if(m)h&&(s===Ee.RECALL?m.unreadMessageCount>0&&(m.unreadMessageCount-=1):(m.unreadMessageCount+=1,m.unreadMentionedCount+=g)),m.versionTime=u,m.latestMessage=e,m.channelType=p,d[c+"_"+r]=m,_._ultraGroupManager.addUltraGroupStatus(m);else{var v={conversationType:j.ULTRA_GROUP,targetId:r,channelId:c,unreadMessageCount:h?1:0,unreadMentionedCount:h?g:0,versionTime:u,latestMessage:e,notificationStatus:Ie.CLOSE,notificationLevel:Re.NOT_SET,isTop:!1,channelType:p};_._ultraGroupMap[c+"_"+r]=v,d[c+"_"+r]=v,_._ultraGroupManager.addUltraGroupStatus(v)}f.push(e)}})),Object.keys(d).length>0&&(Dt.info("notice ultragroups"),p=Object.values(d),p=Os(p),this._watcher.conversation(pn(p))),yt(we.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:l.join(","),timestamp:u},{traceId:r}),Dt.info("notice ultragroup message"),this._watcher.batchMessage(f),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>u})),this._ultraMsgMap)this._ultraMsgMap[g]<u&&delete this._ultraMsgMap[g];return!1===h?this._syncUltraMsg(u):c&&c.length>0&&(this._lastSyncUltraMsgTimeStamp=u),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,l,d,f,p;return V(this,(function(g){switch(g.label){case 0:return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:("RC:SRSMsg"===t.messageType&&Dt.warn("ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),r=this._channel.codec.encodeUpMsg({conversationType:j.ULTRA_GROUP,targetId:e},t),(o=new Lo(Fo[Fo.ugMsg],r,e)).setHeaderQos(Ft.AT_LEAST_ONCE),s=Date.now()-this._localConnectedTime+this._connectedTime,a=t.isPersited?As():0,c=Ns(j.ULTRA_GROUP,e,P({},t),"",s,this.currentUserId,a),n&&n(a),yt(we.L_SEND_MSG_T,{messageType:t.messageType,conversationType:j.ULTRA_GROUP,targetId:e,channelId:t.channelId},{traceId:i}),[4,this._channel.send(o)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return u=g.sent(),h=u.code,l=u.data,h!==ge.SUCCESS?(Et(we.L_SEND_MSG_R,{code:h,messageUId:c.messageUId,messageId:c.messageId},{traceId:i}),[2,{code:h,data:c}]):(yt(we.L_SEND_MSG_R,{code:h,messageUId:null==l?void 0:l.messageUId,messageId:null==l?void 0:l.messageId},{traceId:i}),d=l,c.sentTime=d.timestamp,c.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,f=t.channelId||"",(p=this._ultraGroupMap[f+"_"+e])?(p.latestMessage=c,Z(p.channelType)&&(c.channelType=p.channelType)):(p={conversationType:j.ULTRA_GROUP,targetId:e,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:Ie.CLOSE,notificationLevel:Re.NOT_SET,isTop:!1},this._ultraGroupMap[f+"_"+e]=p,this._ultraGroupManager.addUltraGroupStatus(p)),this._watcher.conversation(pn([p])),[2,{code:h,data:c}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:(n=e.conversationType,i=e.channelId,r=e.targetId,o=this._channel.codec.encodeOperateStatus(r,n,i||"",t||0),(s=new Lo(Fo[Fo.operate],o,r)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(s)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return(a=c.sent().code)!==ge.SUCCESS?[2,{code:a,msg:ge[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:ge.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._channel.codec.encodeMsgQuery(e),(i=new Do(Fo[Fo.qryMsg],n,this.currentUserId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(i,nr)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==ge.SUCCESS?[2,{code:o,msg:ge[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(e){var n=e.messageUId;t[n]=e})),[2,{code:0,data:t}])}}))}))},t.prototype._pullOperateStatusNotify=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,rr),n=t.conversationType,i=t.info,r=t.summary;Dt.info("s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Lo(Fo[Fo.upMsgEx],t,e.targetId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==ge.SUCCESS?[2,{code:r,msg:ge[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype.modifyMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodemodifyMessage(e,this.currentUserId),(n=new Lo(Fo[Fo.modifyMsg],t,e.targetId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==ge.SUCCESS?[2,{code:r,msg:ge[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return this._channel?this._status!==me.CONNECTED||this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._channel.codec.encodeQueryMsgChange(e),(n=new Do(Fo[Fo.qryMsgChange],t,this.currentUserId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(n,$i)]):[2];case 1:if(i=d.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r!==ge.SUCCESS||!o)return[2];for(h in s=o.hasNext,a=o.list,c=(null==o?void 0:o.syncTime)||0,this._ultraChannelTypeChangeNotice(a),this._ultraChannelUserKickedNotice(a),this._ultraChannelDeleteNotice(a),this._ultraRecalledNotice(a),this._ultraMsgUpdateNotice(xe.MSG_EXPANSION,a),this._ultraMsgUpdateNotice(xe.MSG_MODIFY,a),u=this._pullUltraChangeMessageQue.filter((function(e){return e>c})),this._pullUltraChangeMessageQue.length=0,(l=this._pullUltraChangeMessageQue).push.apply(l,u),this._ultraMsgMap)this._ultraMsgMap[h]<c&&delete this._ultraMsgMap[h];return s?this._pullUltraChangeMessageList(c):this._lastPullingUltraChangeMessageTime=c,[2]}}))}))},t.prototype._ultraChannelTypeChangeNotice=function(e){var t=this,n=[];e.forEach((function(e){var i=e.targetId,r=e.changeType,o=e.subChangeType,s=e.channelId,a=void 0===s?"":s;if(r===xe.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(a,"_").concat(i)]){var c=Fe.PUBLIC_TO_PRIVATE,u=Fe.PRIVATE_TO_PUBLIC,h=Fe.PUBLIC_TO_PRIVATE_USER_NOT_IN;o===u&&(t._ultraGroupMap["".concat(a,"_").concat(i)].channelType=Ge.PUBLIC),o===c&&(t._ultraGroupMap["".concat(a,"_").concat(i)].channelType=Ge.PRIVATE);var l=t._ultraGroupMap["".concat(a,"_").concat(i)].channelType,d=void 0===l?Ge.PUBLIC:l;[c,u,h].includes(o)&&n.push({targetId:i,channelId:a,changeType:o,channelType:d}),o===h&&delete t._ultraGroupMap["".concat(a,"_").concat(i)]}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n)},t.prototype._ultraChannelDeleteNotice=function(e){var t=this,n=[];Array.isArray(e)&&e.forEach((function(e){var i=e.targetId,r=e.sendTime,o=e.changeType,s=e.subChangeType,a=e.channelId,c=void 0===a?"":a;if(o===xe.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(c,"_").concat(i)]){var u=t._ultraGroupMap["".concat(c,"_").concat(i)].channelType,h=void 0===u?Ge.PUBLIC:u;s===Fe.CHANNEL_DELETE&&(n.push({targetId:i,channelId:c,channelType:h,deleteTime:r}),delete t._ultraGroupMap["".concat(c,"_").concat(i)])}})),n.length>0&&this._watcher.ultraGroupChannelDelete(n)},t.prototype._ultraChannelUserKickedNotice=function(e){var t=this,n=[];e.forEach((function(e){var i=e.targetId,r=e.changeType,o=e.operatorId,s=e.subChangeType,a=e.channelId,c=void 0===a?"":a;r===xe.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(c,"_").concat(i)]&&(s===Fe.CHANNEL_USER_KICKED&&n.push({targetId:i,channelId:c,userId:o,channelType:Ge.PRIVATE}),o===t.currentUserId&&s===Fe.CHANNEL_USER_KICKED&&delete t._ultraGroupMap["".concat(c,"_").concat(i)])})),n.length>0&&this._watcher.ultraGroupChannelUserKicked(n)},t.prototype._ultraRecalledNotice=function(e){var t=this,n=[];e.forEach((function(e){var i=e.targetId,r=e.conversationType,o=e.sendTime,s=e.messageUId,a=e.changeType,c=e.operatorId,u=e.channelId,h=void 0===u?"":u;a===xe.MSG_RECALL&&(t._updateUltraGroupWhenRecallMsg(i,h,s),n.push({targetId:i,conversationType:r,sendTime:o,messageUId:s,senderUserId:c,channelId:h}))})),n.length>0&&this._watcher.ultraGroupMessageRecalled(n)},t.prototype._ultraMsgUpdateNotice=function(e,t){var n=this,i={};t.forEach((function(t){var r=t.targetId,o=t.conversationType,s=t.sendTime,a=t.messageUId,c=t.changeType,u=t.channelId,h=o+"_"+r,l=a+"_"+(void 0===u?"":u)+"_"+s,d=i[h];if(d)d.add(l);else{var f=new Set([l]);i[h]=f}c===e&&(n._ultraMsgChangeMap[a]=c)}));var r=function(e){var t=e.split("_"),n=t.shift(),r=t.join("_"),s=i[e],a=[];s.forEach((function(e){var t=e.split("_"),n=t[0],i=t[1],r=t[2];a.push({sendTime:Number(r),messageUId:n,channelId:i})}));var c={targetId:r,conversationType:Number(n),messages:a};o._pullUltraMessageList(c)},o=this;for(var s in i)r(s)},t.prototype._pullUltraMessageList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u=this;return V(this,(function(h){switch(h.label){case 0:return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeMsgQuery(e),(n=new Do(Fo[Fo.qryMsg],t,this.currentUserId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(n,nr)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return i=h.sent(),r=i.code,o=i.data,r!==ge.SUCCESS?[2,{code:r,msg:ge[r]}]:(s=(o||{}).list,a=[],c=[],Array.isArray(s)&&s.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=u._ultraGroupMap[n+"_"+t];r&&r.latestMessage.messageUId===e.messageUId&&(r.latestMessage=e);var o=u._ultraMsgChangeMap[i+""];o===xe.MSG_EXPANSION?a.push(e):o===xe.MSG_MODIFY&&c.push(e)})),a.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(a||[]),c.length>0&&this._watcher.ultraGroupMessageModified(c||[]),[2])}}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:(i=this._channel.codec.encodeGetHistoryMsg(e,t),r=new Do(Fo[Fo.qryUgMsg],i,this.currentUserId),yt(we.L_GET_HISTORY_MSG_T,{targetId:e,conversationType:j.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count},{traceId:n}),[4,this._channel.send(r,bn,{currentUserId:this.currentUserId,conversation:{conversationType:j.ULTRA_GROUP,targetId:e}})]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return o=u.sent(),s=o.code,a=o.data,s===ge.SUCCESS&&a?(c=[],a.list&&a.list.forEach((function(e){e&&c.push(e.messageUId)})),yt(we.L_GET_HISTORY_MSG_R,{code:s,messageUIds:c.join(",")},{traceId:n}),[2,{code:s,data:a}]):(Et(we.L_GET_HISTORY_MSG_R,{code:s,messageUIds:""},{traceId:n}),Dt.warn("get super history message failed, code:",s,", data:",a),[2,{code:s}])}}))}))},t.prototype.searchUltraGroupMessages=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(e){return this._channel?this._status!==me.CONNECTED?[2,{code:ge.RC_NET_UNAVAILABLE}]:[2,{code:ge.SUCCESS}]:[2,{code:ge.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?(i=this._channel)?(r=i.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),o=new Do(Fo[Fo.ugUnpushSet],r,e),[4,i.send(o)]):[3,2]:[2,Promise.resolve({code:ge.METHOD_NOT_AVAILABLE})];case 1:return s=c.sent(),a=s.code,ge.SUCCESS,[2,{code:a}];case 2:return[2,{code:ge.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?(n=this._channel)?(i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new Do(Fo[Fo.ugUnpushQuery],i,e),[4,n.send(r,ki)]):[3,2]:[2,Promise.resolve({code:ge.METHOD_NOT_AVAILABLE})];case 1:return o=u.sent(),s=o.code,a=o.data,s===ge.SUCCESS&&a?(c=a.unpushLevel,[2,{code:s,data:c}]):[2,{code:s}];case 2:return[2,{code:ge.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n){var i="".concat(t,"_").concat(e);if(this._ultraGroupMap[i]){var r=this._ultraGroupMap[i],o=r.latestMessage;o&&o.messageUId===n&&(r.latestMessage=null)}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:ge.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s,a;return V(this,(function(c){return this._channel?(s=this._channel.codec.encodeJoinRTCRoom(t,n,i,r,o),a=new Do(Fo[Fo.rtcRJoin_data],s,e),[2,this._channel.send(a,Wn)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return D(this,void 0,void 0,(function(){var t,n;return V(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Do(Fo[Fo.rtcRExit],t,e),[4,this._channel.send(n)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new Do(Fo[Fo.rtcPing],i,e),[4,this._channel.send(r)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return D(this,void 0,void 0,(function(){var t,n;return V(this,(function(i){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Do(Fo[Fo.rtcRInfo],t,e),[2,this._channel.send(n,si)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o;return V(this,(function(s){switch(s.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Do(Fo[Fo.rtcUData],t,e),[4,this._channel.send(n,Wn)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return i=s.sent(),r=i.code,o=i.data,[2,{code:r,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeSetRTCUserInfo(t,n),r=new Do(Fo[Fo.rtcUPut],i,e),[4,this._channel.send(r)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return D(this,void 0,void 0,(function(){var n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),i=new Lo(Fo[Fo.rtcUDel],n,e),[4,this._channel.send(i)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,o){return D(this,void 0,void 0,(function(){var s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(s=this._channel.codec.encodeSetRTCData(t,n,i,r,o),a=new Lo(Fo[Fo.rtcSetData],s,e),[4,this._channel.send(a)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,i,r),s=new Do(Fo[Fo.userSetData],o,e),[4,this._channel.send(s)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeUserSetRTCCDNUris(t,n),r=new Do(Fo[Fo.userSetData],i,e),[4,this._channel.send(r)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){if(!this._channel)return Promise.resolve({code:ge.RC_NET_CHANNEL_INVALID});var r=this._channel.codec.encodeGetRTCData(t,n,i),o=new Do(Fo[Fo.rtcQryData],r,e);return this._channel.send(o,ni)},t.prototype.removeRTCData=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){var o,s;return V(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,i,r),s=new Lo(Fo[Fo.rtcDelData],o,e),[4,this._channel.send(s)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,t){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r;return V(this,(function(o){return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new Do(Fo[Fo.rtcToken],i,e),[2,this._channel.send(r,ti)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return D(this,void 0,void 0,(function(){var n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),i=new Do(Fo[Fo.rtcUserState],n,e),[4,this._channel.send(i)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:ge.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new Do(Fo[Fo.rtcUList],t,e);return this._channel.send(n,Wn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=Ke.LIVE),D(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new Do(Fo[Fo.viewerJoinR],i,e),[4,this._channel.send(r,dr)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,a=o.data,s!==ge.SUCCESS?[2,{code:s}]:(u=(c=a).rtcToken,h=c.entries,[2,{code:s,data:{token:u,kvEntries:h}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new Do(Fo[Fo.viewerExitR],t,e),[4,this._channel.send(n)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return this._channel?(i=this._channel.codec.encodeIdentityChangeInfo(t,n),r=new Do(Fo[Fo.rtcIdentityChange],i,e),[4,this._channel.send(r,Wn)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),s=o.code,a=o.data,s!==ge.SUCCESS?[2,{code:s}]:[2,{code:s,data:a}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(Dt.info("audience in room start pull KV"),r=n.codec.encodePullRTCRoomKV(e,0),o=new Do(Fo[Fo.rtcPullKv],r,i),[4,n.send(o,ur)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),a=s.code,c=s.data,Dt.info("audience in room end pull KV, code: ".concat(a,", data: ").concat(JSON.stringify(c||{}))),a===ge.SUCCESS?(u=c.kvEntries,this._watcher.onRTCDataChange(u,e),[2,{code:a,data:c}]):[2,{code:a}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c;return V(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(r=n.codec.encodeQueryUserJoinedInfo(e),o=new Do(Fo[Fo.rtcQueryJoined],r,i),[4,n.send(o,lr)]):[2,{code:ge.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a===ge.SUCCESS?[2,{code:a,data:c}]:[2,{code:a}]}}))}))},t.prototype.getDeviceId=function(){return St(this.runtime)},t.prototype.requestRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new Do(Fo[Fo.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.cancelRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new Do(Fo[Fo.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.responseRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new Do(Fo[Fo.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.endRoomPK=function(e){return D(this,void 0,void 0,(function(){var t,n,i;return V(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new Do(Fo[Fo.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r;return V(this,(function(o){switch(o.label){case 0:return this._channel?(t=e.chatRoomId,n=this._channel.codec.encodebindRTCRoomForChatroom(e),i=new Do(Fo[Fo.setRtcRoomId],n,t),[4,this._channel.send(i)]):[2,ge.RC_NET_CHANNEL_INVALID];case 1:return r=o.sent(),[2,r.code]}}))}))},t.prototype.callExtra=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Promise.resolve({code:ge.EXTRA_METHOD_UNDEFINED})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getConversationsByPage=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.removeFromBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},t.prototype.getBlacklistStatus=function(e){throw new Error("Method not implemented.")},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.searchConversationByContentWithAllChannel=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,i,r,o){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,o,s){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.updateMessageReceiptStatus=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearData=function(){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setCallInfo=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},t}(Jo),ws=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return b(t,e),t.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return this._context.joinRTCRoom(e,t,n,i,r,o)},t.prototype.quitRTCRoom=function(e){return this._context.quitRTCRoom(e)},t.prototype.rtcPing=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return this._context.getRTCRoomInfo(e)},t.prototype.getRTCUserInfoList=function(e){return this._context.getRTCUserInfoList(e)},t.prototype.getRTCUserInfo=function(e){return this._context.getRTCUserInfo(e)},t.prototype.setRTCUserInfo=function(e,t,n){return this._context.setRTCUserInfo(e,t,n)},t.prototype.removeRTCUserInfo=function(e,t){return this._context.removeRTCUserInfo(e,t)},t.prototype.setRTCData=function(e,t,n,i,r,o){return this._context.setRTCData(e,t,n,i,r,o)},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return this._context.setRTCTotalRes(e,t,n,i,r)},t.prototype.setRTCCDNUris=function(e,t,n){return this._context.setRTCCDNUris(e,t,n)},t.prototype.getRTCData=function(e,t,n,i){return this._context.getRTCData(e,t,n,i)},t.prototype.removeRTCData=function(e,t,n,i,r){return this._context.removeRTCData(e,t,n,i,r)},t.prototype.setRTCOutData=function(e,t,n,i){return this._context.setRTCOutData(e,t,n,i)},t.prototype.getRTCOutData=function(e,t){return this._context.getRTCOutData(e,t)},t.prototype.getRTCToken=function(e,t,n){return this._context.getRTCToken(e,t,n)},t.prototype.setRTCState=function(e,t){return this._context.setRTCState(e,t)},t.prototype.getRTCUserList=function(e){return this._context.getRTCUserList(e)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)},t.prototype.quitLivingRoomAsAudience=function(e){return this._context.quitLivingRoomAsAudience(e)},t.prototype.rtcIdentityChange=function(e,t,n){return this._context.rtcIdentityChange(e,t,n)},t.prototype.requestRoomPK=function(e){return this._context.requestRoomPK(e)},t.prototype.cancelRoomPK=function(e){return this._context.cancelRoomPK(e)},t.prototype.responseRoomPK=function(e){return this._context.responseRoomPK(e)},t.prototype.endRoomPK=function(e){return this._context.endRoomPK(e)},t}(zo);function Ls(e){return Object.assign({},e)}var bs,Ps=function(){function e(e,t){var n;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.4.2-beem.1",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=me.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0,messageDelivered:void 0,groupMessageDeliveredStatus:void 0,ultraGroupChannelChangeType:void 0,ultraGroupChannelUserKicked:void 0,ultraGroupChannelDelete:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},t),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this.apiPKGName=this._options.apiPKGName||"",this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter((function(e){return/^https?:\/\//.test(e)})),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")})),0===this._options.navigators.length&&(n=this._options.navigators).push.apply(n,a),mo({bundleId:this.apiPKGName}),function(e){mt=Mt.init(P(P({},e),{sessionId:it})),bt()}({runtime:this._runtime,logSwitch:1,logPolicy:JSON.parse("{}"),appkey:this.appkey,version:this.apiVersion});var i={status:this._connectionStatusListener.bind(this),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this),messageDelivered:this._messageDeliveredListerer.bind(this),groupMessageDeliveredStatus:this._groupMessageDeliveredStatusListerer.bind(this),callInfo:this._callInfoListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this)};this._engine=hn()?new RCCppEngine(e,i,this._options):new Us(e,i,this._options)}return e.init=function(t,n){return gt({customLogPrint:n.logStdout,localLogLevel:n.logLevel}),Dt.setLogLevel(n.logLevel),Dt.setLogStdout(n.logStdout),yt(we.L_INIT_O,{appkey:n.appkey,navigators:n.navigators,connectionType:n.connectionType,logLevel:n.logLevel,typingExpireTime:n.typingExpireTime}),!1===n.indexDBSwitch&&($e.indexDBSwitch=!1),yt(we.L_IMSDK_VER_O,{commitId:"3de15114118706bde1c6586f77e9ad7dd3f3b2f2",version:"5.4.2-beem.1"}),Dt.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Dt.error("Repeat initialize!"),this._context):(Dt.warn("RCEngine Commit:","3de15114118706bde1c6586f77e9ad7dd3f3b2f2"),this._context=new e(t,n),this._context)},e.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},e.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return Dt.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new ws(this):new zo(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(n,this._runtime,t)}catch(e){Dt.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&this._pluginContextQueue.push(n),i&&(this._pluginInstanseMap[e.tag]=i),i},e.prototype._handleRedirect=function(){return D(this,void 0,void 0,(function(){var e,t=this;return V(this,(function(n){switch(n.label){case 0:return Dt.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return(e=n.sent().code)!==ge.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(e),setTimeout((function(){t._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return D(this,void 0,void 0,(function(){return V(this,(function(n){return yt(we.L_CONNECT_S,{status:e}),[me.REDIRECT,me.BLOCKED,me.KICKED_OFFLINE_BY_OTHER_CLIENT,me.DISCONNECT_BY_SERVER,me.DISCONNECTED,me.NETWORK_UNAVAILABLE].includes(e)&&(yo(xo.IM_CONNECTION_DURATION,{endTime:(new Date).getTime(),code:e}),function(e){D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u;return V(this,(function(h){switch(h.label){case 0:t=xo.IM_CONNECTION_DURATION,n=vo().bundleId,i=Eo(t),r=i.startTime,o=i.endTime,s=i.code,a=po.UNKONWN,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return a=h.sent(),[3,4];case 3:return c=h.sent(),Dt.debug(c.message),[3,4];case 4:return u=0,Z(r)&&Z(o)&&o>r&&r&&(u=o-r),lo(t,{bid:n,cod:s,dur:u,net:a}),[2]}}))}))}(this._runtime)),this._connectionStatus=e,e===me.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(e),this._handleRedirect()):e===me.BLOCKED||e===me.KICKED_OFFLINE_BY_OTHER_CLIENT||e===me.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(e)):e===me.CONNECTING?this._handleConnecting():e===me.CONNECTED?this._handleConnected():e===me.DISCONNECTED?this._handleDisconnect(e):e===me.NETWORK_UNAVAILABLE&&this._handleSuspend(e),(null===(t=this._watcher.rtcInnerWatcher)||void 0===t?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach((function(t){t.onconnectionstatechange&&t.onconnectionstatechange(e)})),this._watcher.connectionState&&this._watcher.connectionState(e),[2]}))}))},e.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},e.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},e.prototype._handleDisconnect=function(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)},e.prototype._handleSuspend=function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)},e.prototype._messageReceiver=function(e,t,n){var i,r,o;if((e.conversationType===j.RTC_ROOM||Object.prototype.hasOwnProperty.call(Je,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Ls(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==Ee.TYPING_STATUS||(this._addTypingInfo(Ls(e)),!this._watcher.typingState))if(e.messageType!==Ee.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==Ee.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Ls(e))}catch(e){return Dt.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(Ls(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var s=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic,a=this._engine.getCurrentUserId();s&&Array.isArray(s[a])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,s[a])}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,extra:e.content.extra});else{var c=e.content,u=c.startTime,h=c.endTime,l=c.platform,d=c.logId,f=c.uri,p=c.packageName,g={startTime:parseInt(u),endTime:parseInt(h),platform:l,logId:d,uri:f,packageName:p};null===(r=Mt.getInstance())||void 0===r||r.reportFullLog(g)}}else if("function"==typeof this._watcher.chatroomState){var _={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){_[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:_,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(i={},i[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?De.QUIT:De.JOIN,i),chatroomId:e.targetId}})},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[];e.forEach((function(e){var o=i._messageReceiver(e,t,n);o&&r.push(o)})),r.length&&this._watcher.batchMessage&&this._watcher.batchMessage(r)},e.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},e.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},e.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},e.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},e.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},e.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},e.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},e.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},e.prototype._messageDeliveredListerer=function(e){this._watcher.messageDelivered&&this._watcher.messageDelivered(e)},e.prototype._groupMessageDeliveredStatusListerer=function(e){this._watcher.groupMessageDeliveredStatus&&this._watcher.groupMessageDeliveredStatus(e)},e.prototype._callInfoListener=function(e){this._pluginContextQueue.forEach((function(t){try{t.onCallInfo&&t.onCallInfo(e)}catch(e){Dt.error("plugin error =>",e)}}))},e.prototype._ultraGroupEnableListener=function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)},e.prototype._operateStatusListener=function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)},e.prototype._ultraGroupMessageModifiedListener=function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)},e.prototype._ultraGroupMessageRecalledListener=function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){this._watcher.ultraGroupChannelChangeType&&this._watcher.ultraGroupChannelChangeType(e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){this._watcher.ultraGroupChannelUserKicked&&this._watcher.ultraGroupChannelUserKicked(e)},e.prototype._ultraGroupChannelDeleteListener=function(e){this._watcher.ultraGroupChannelDelete&&this._watcher.ultraGroupChannelDelete(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];t._watcher[n]=ie(i)||ne(i)?i:void 0}}))},e.prototype.resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,i=e.targetId,r=e.content,o=e.channelId,s=r.typingContentType,a=o||"",c="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[c]||(this._typingInfo[c]=[]);var u=this._typingInfo[c].findIndex((function(e){return e.userId===t}));u>=0&&this._typingInfo[c][u].messageType===s?this._typingInfo[c][u].timestamp=Date.now():(u>=0&&this._typingInfo[c].splice(u,1),this._typingInfo[c].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(c)||this._typingChangedList.push(c),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}if(e._typingChangedList.length>0){var i=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(i),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._connectionStatus},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.connect=function(e,t,n,i){return void 0===t&&(t=!1),D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return this._connectionStatus===me.CONNECTED?[2,{code:ge.SUCCESS,userId:this._engine.getCurrentUserId()}]:this._connectionStatus===me.CONNECTING?[2,{code:ge.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:ge.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,r=e.split("@"),o=r[1],s=o?o.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],yt(we.L_GET_NAVI_T,{token:e,uris:s},{traceId:i}),[4,this._engine.getNaviInfo(this._getTokenWithoutNavi(),s,t,this._options.checkCA)]);case 1:return(a=l.sent())?(yt(we.L_GET_NAVI_R,{code:ge.SUCCESS,naviInfo:a},{traceId:i}),yt(we.L_ENV_S,{isEnterprise:1===(null==a?void 0:a.type)},{traceId:i}),1===(null==a?void 0:a.type)?[2,{code:ge.PACKAGE_ENVIRONMENT_ERROR}]:(c=xt.getInfo(),yt(we.L_CONNECT_T,{token:e,refreshNavi:t,reconnectKickEnable:n},{traceId:i}),[4,this._engine.connect(this._getTokenWithoutNavi(),a,n,i)])):(Et(we.L_GET_NAVI_R,{code:ge.RC_NAVI_RESOURCE_ERROR},{traceId:i}),[2,{code:ge.RC_NAVI_RESOURCE_ERROR}]);case 2:return u=l.sent(),(u===ge.SUCCESS?yt:Et)(we.L_CONNECT_R,{code:u,userId:this._engine.getCurrentUserId()},{traceId:i}),u!==ve.REDIRECT?[3,4]:(this._connectionStatus=me.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,l.sent()];case 4:return h=this._engine.getCurrentUserId(),u===ge.SUCCESS&&(yo(xo.IM_CONNECTION_DURATION,{startTime:(new Date).getTime()},!0),Dt.info("connect success, userId: ".concat(h)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(c),wt({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:h}),gt({userId:h}),this._isInternalConnected=!0),u!==ge.SUCCESS||hn()||1===a.openUS&&this._pullUserSettings(),u!==ge.SUCCESS&&(this._connectionStatus=me.CONNECTION_CLOSED),[2,{code:u,userId:h}]}}))}))},e.prototype._pullUserSettings=function(){return D(this,void 0,void 0,(function(){return V(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=Mt.getInstance())||void 0===e||e.distroy(),gt({userId:""}),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Dt.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(e){return this._isInternalConnected?Promise.resolve({code:ge.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),this._engine.registerMessageType(e,t,n,i,r)},e.prototype.sendMessage=function(e,t,n,i,r){if(e!==j.ULTRA_GROUP){var o=this.getInfoFromCache();if(1===((null==o?void 0:o.grpRRVer)||0)&&n.messageType===Ee.READ_RECEIPT_RESPONSE)return Promise.resolve({code:ge.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,c=n.expansion;if(a){var u=le(c),h=u.isIllgalEx,l=u.isExKeyOrValLengthExceedLimit;if(u.isExceedLimit||l)return Promise.resolve({code:ge.EXPANSION_LIMIT_EXCEET});if(h)return Promise.resolve({code:ge.BIZ_ERROR_INVALID_PARAMETER})}var d=JSON.stringify(n.content);return K(d)>131072?Promise.resolve({code:ge.RC_MSG_CONTENT_EXCEED_LIMIT}):e===j.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,i,r):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,l;return V(this,(function(d){switch(d.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(c=le(s),u=c.isIllgalEx,h=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||h?[2,Promise.resolve({code:ge.EXPANSION_LIMIT_EXCEET})]:u?[2,Promise.resolve({code:ge.BIZ_ERROR_INVALID_PARAMETER})]:(l={mid:r},s&&(l.put=s),o&&(l.del=o),a&&(l.removeAll=1),[4,this._engine.sendMessage(n,i,{content:l,messageType:Ee.EXPANSION_NOTIFY,channelId:t})])):[2,{code:ge.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return D(this,void 0,void 0,(function(){var i;return V(this,(function(r){return i=this.getInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:ge.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,n)]}))}))},e.prototype.getMessageReader=function(e,t,n){return D(this,void 0,void 0,(function(){var i;return V(this,(function(r){return i=this.getInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:ge.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,messageDelivered:void 0,groupMessageDeliveredStatus:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){Dt.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=Mt.getInstance())||void 0===e||e.distroy(),gt({userId:""})},e.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),void 0===s&&(s=""),e===j.ULTRA_GROUP){var c={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(t,c,a)}return this._engine.getHistoryMessage(e,t,n,i,r,o,s||"",a)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,i,r,o,s)},e.prototype.getConversationList=function(e,t,n,i,r){if(void 0===e&&(e=300),void 0===r&&(r=""),t===j.ULTRA_GROUP){var o=ge.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:ge[o]})}return this._engine.getConversationList(e,t,n,i,r)},e.prototype.getConversationsByPage=function(e,t,n,i){return this._engine.getConversationsByPage(e,t,n,i)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===j.ULTRA_GROUP?Promise.resolve(ge.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)},e.prototype.getUltraGroupList=function(e){return this._engine.getUltraGroupList(e)},e.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},e.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),e===j.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(e,t,n)},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(j.ULTRA_GROUP)){var i=ge.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:ge[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[j.PRIVATE,j.GROUP,j.SYSTEM,j.PUBLIC_SERVICE],!!n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(e,t,n)},e.prototype.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),D(this,void 0,void 0,(function(){var r;return V(this,(function(o){return r=[{conversationType:e,targetId:t,notificationLevel:n,channelId:i}],[2,this._engine.batchSetConversationStatus(r)]}))}))},e.prototype.setConversationStatus=function(e,t,n,i,r){if(void 0===r&&(r=""),e===j.ULTRA_GROUP&&void 0!==n)return Promise.resolve(ge.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(e,t,n,i)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,i,r){return this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){return void 0===i&&(i=""),e===j.ULTRA_GROUP?Promise.resolve(ge.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,i)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,i)},e.prototype.joinChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,n)},e.prototype.joinExistChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return tn(n)&&nn(i)?this._engine.setChatroomEntry(e,t):Promise.resolve(ge.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n],r=i.key,o=i.value;if(!tn(r)||!nn(o))return Promise.resolve({code:ge.BIZ_ERROR_INVALID_PARAMETER})}var s=P(P({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,i=t.value;return tn(n)&&nn(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(ge.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return tn(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(ge.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n].key;if(!tn(i))return Promise.resolve({code:ge.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return tn(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(ge.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,i){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===i&&(i=0),this._engine.getChatroomHistoryMessages(e,i,t,n)},e.prototype.getFileToken=function(e,t,n,i){return D(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return V(this,(function(l){switch(l.label){case 0:return r=this.getInfoFromCache(),o=(null==r?void 0:r.bosAddr)||"",s=(null==r?void 0:r.uploadServer)||"",a=(null==r?void 0:r.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,i)];case 1:return c=l.sent(),u=c.code,h=c.data,u===ge.SUCCESS&&h?[2,Promise.resolve(Object.assign(h,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(u)]}}))}))},e.prototype.getFileUrl=function(e,t,n,i,r){return void 0===r&&(r=Me.QINIU),D(this,void 0,void 0,(function(){var o,s,a;return V(this,(function(c){switch(c.label){case 0:return(null==i?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(e,r,t,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===ge.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return D(this,void 0,void 0,(function(){return V(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return t.length>1e3?[2,Promise.reject(ge.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return D(this,void 0,void 0,(function(){return V(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},e.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==j.ULTRA_GROUP){var t=ge.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:ge[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return D(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return V(this,(function(c){switch(c.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==j.ULTRA_GROUP?[2,{code:r=ge.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:ge[r]}]:i?(o=le(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:ge.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:ge.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:ge.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:c.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return D(this,void 0,void 0,(function(){var t;return V(this,(function(n){switch(n.label){case 0:return e.conversationType!==j.ULTRA_GROUP?[2,{code:t=ge.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:ge[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e){return this._engine.getUltraGroupUnreadCountByTargetId(e)},e.prototype.getAllUltraGroupUnreadCount=function(e){return void 0===e&&(e=!1),this._engine.getAllUltraGroupUnreadCount(e)},e.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},e.prototype.callExtra=function(e){for(var t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,k([e],n,!1))},e.prototype.setCallInfo=function(e,t,n){return this._engine.setCallInfo(e,t,n)},e.prototype.getGroupMessageDeliverList=function(e,t,n){return void 0===n&&(n=""),this._engine.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){return void 0===t&&(t=""),this._engine.getPrivateMessageDeliverTime(e,t)},e.prototype.clearConversations=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){switch(n.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Dt.error(e)}}))},e.prototype.addToBlacklist=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return D(this,void 0,void 0,(function(){return V(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){return void 0===r&&(r=""),D(this,void 0,void 0,(function(){return V(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,i,r)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return D(this,void 0,void 0,(function(){return V(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,i){return D(this,void 0,void 0,(function(){return V(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(e,t,n,i)]}))}))},e.prototype.setUserStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return D(this,void 0,void 0,(function(){return V(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,i){return void 0===t&&(t=[]),void 0===n&&(n=""),D(this,void 0,void 0,(function(){return V(this,(function(r){return[2,this._engine.searchConversationByContent(e,t,n,i)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),D(this,void 0,void 0,(function(){return V(this,(function(i){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,i,r,o,s){return void 0===s&&(s=""),D(this,void 0,void 0,(function(){return V(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,i,r,o,s)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){return D(this,void 0,void 0,(function(){return V(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,i,r)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,o,s){return D(this,void 0,void 0,(function(){return V(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,i,r,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(e,t,n,i)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return void 0===t&&(t=""),this._engine.getUltraGroupDefaultNotificationLevel(e,t)},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.setUltraGroupDefaultNotificationLevel(e,t,n)},e.prototype.getConversationNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationLevel(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(e,t,n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,o){return this._engine.getRemoteHistoryMessages(e,t,n,i,r,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return D(this,void 0,void 0,(function(){return V(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.joinRTCRoom=function(e,t,n,i,r,o){return this._engine.joinRTCRoom(e,t,n,i,r,o)},e.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},e.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},e.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},e.prototype.setRTCUserInfo=function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)},e.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},e.prototype.setRTCData=function(e,t,n,i,r,o){return this._engine.setRTCData(e,t,n,i,r,o)},e.prototype.setRTCTotalRes=function(e,t,n,i,r){return void 0===r&&(r=""),this._engine.setRTCTotalRes(e,t,n,i,r)},e.prototype.setRTCCDNUris=function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)},e.prototype.getRTCData=function(e,t,n,i){return this._engine.getRTCData(e,t,n,i)},e.prototype.removeRTCData=function(e,t,n,i,r){return this._engine.removeRTCData(e,t,n,i,r)},e.prototype.setRTCOutData=function(e,t,n,i){return this._engine.setRTCOutData(e,t,n,i)},e.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},e.prototype.getRTCToken=function(e,t,n){return this._engine.getRTCToken(e,t,n)},e.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},e.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},e.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)},e.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},e.prototype.rtcIdentityChange=function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)},e.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},e.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},e.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},e.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},e.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e}();!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(bs||(bs={}));var Ds="5.4.2-beem.1";export{Jo as AEngine,Ps as APIContext,w as AppStorage,Bt as AssertRules,t as CONNECTION_TYPE,I as CPP_PROTOCAL_MSGTYPE_OPTION,Je as CallLibMsgType,be as ChatroomEntryType,De as ChatroomUserChangeType,jo as CometChannel,ve as ConnectResultCode,me as ConnectionStatus,j as ConversationType,O as DB_LOG_FLUSH_FREQUENCY,N as DB_LOG_MAX_SIZE,_n as DelayTimer,ge as ErrorCode,Vt as EventEmitter,W as FileType,fo as HttpMethod,m as IM_CHATROOM_PULL_INTERVAL_TIME,_ as IM_COMET_PULLMSG_TIMEOUT,l as IM_PING_INTERVAL_TIME,f as IM_PING_MIN_TIMEOUT,d as IM_PING_TIMEOUT,h as IM_SIGNAL_TIMEOUT,qe as LiveRole,He as LiveType,Ae as LogLevel,Ue as LogSource,we as LogTagId,Pt as Logger,p as MAX_MESSAGE_CONTENT_BYTES,y as MAX_MESSAGE_EXPANSION_KEY_LENGTH,E as MAX_MESSAGE_EXPANSION_VAL_LENGTH,u as MINI_COMET_CONNECT_URIS,c as MINI_SOCKET_CONNECT_URIS,Ne as MentionedType,ke as MessageBlockType,fe as MessageDirection,Ee as MessageType,i as NAVI_CACHE_DURATION,r as NAVI_REQ_TIMEOUT,po as NetworkType,Re as NotificationLevel,Ie as NotificationStatus,M as ONE_LOG_SIZE_MAX,Ye as OperateStatus,o as PING_REQ_TIMEOUT,a as PUBLIC_CLOUD_NAVI_URIS,zo as PluginContext,Qt as RCAssertError,S as REAT_TIME_LOG_SIZE,je as RTCApiType,Qe as RTCIdentityChangeType,We as RTCJoinType,Ke as RTCMode,ws as RTCPluginContext,n as ReceivedStatus,T as SEND_MESSAGE_TYPE_OPTION,C as STATUS_MESSAGE,v as STORAGE_ROOT_KEY,bs as TagChangeType,Be as UltraGroupChannelChangeType,Ge as UltraGroupChannelType,xe as UltraMsgChangeType,Fe as UltraMsgSubChangeType,Me as UploadMethod,xt as VersionManage,s as WEB_SOCKET_TIMEOUT,Yo as WebSocketChannel,H as appendUrl,Wt as assert,pn as clone,un as cloneByJSON,Dt as engineLogger,rn as forEach,dn as formatConnectResponseCode,ln as getBrowser,Xt as getMimeKey,tt as getUUID,nt as getUUID22,Zt as getUploadFileName,sn as indexOf,X as isArray,$ as isArrayBuffer,z as isBoolean,ie as isFunction,se as isHttpUrl,cn as isInObject,an as isInclude,oe as isNull,Z as isNumber,ne as isObject,J as isString,re as isUndefined,ue as isValidChannelId,tn as isValidChrmEntryKey,nn as isValidChrmEntryValue,ce as isValidConversationType,le as isValidExpansion,he as isValidFileType,Ct as logger,on as map,te as notEmptyArray,ae as notEmptyObject,ee as notEmptyString,$t as pushConfigsToJSON,en as pushJSONToConfigs,et as randomNum,x as todo,hn as usingCppEngine,Jt as validate,Ds as version};
|