@rongcloud/engine 5.16.0-c-rtc-alpha.2 → 5.16.0

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.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- function e(e,t,n,r){var s,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(o<3?s(i):o>3?s(t,n,i):s(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}function t(e,t,n,r){return new(n||(n=Promise))((function(s,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))}function n(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function r(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n}var s,o,i,a,l,d,u,c,h,p,_,E,I,T,f,C,R,S,m,y,v,A,N,O,M,L,U,P,b,x,D,w,V,G,F,B,k,H,q,Y,K,j,Q,W,$,J,X,Z,z,ee,te,ne,re,se,oe,ie,ae,le,de,ue,ce,he,pe,_e,ge,Ee,Ie,Te;Object.defineProperty(exports,"__esModule",{value:!0}),exports.UploadMethod=void 0,(s=exports.UploadMethod||(exports.UploadMethod={}))[s.QINIU=1]="QINIU",s[s.ALI=2]="ALI",s[s.AWS=3]="AWS",s[s.STC=4]="STC",s[s.MINIO=5]="MINIO",exports.LogTagId=void 0,(o=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",o.A_INIT_REPEAT_O="A_INIT_REPEAT_O",o.L_INIT_O="L-init-O",o.A_DESTROY_O="A_DESTROY_O",o.L_DESTROY_O="L_DESTROY_O",o.A_CONNECT_T="A-connect-T",o.A_CONNECT_R="A-connect-R",o.A_CONNECT_S="A-connect-S",o.A_DISCONNECT_O="A-disconnect-O",o.A_RECONNECT_T="A-reconnect-T",o.A_RECONNECT_R="A_RECONNECT_R",o.L_CONNECT_T="L-connect-T",o.L_CONNECT_R="L-connect-R",o.L_CONNECT_S="L-connect-S",o.L_DB_UPGRATE_START_S="L-db_upgrate_start-S",o.L_DB_UPGRATING_S="L-db_upgrating-S",o.L_DB_UPGRATE_COMPLETE_S="L-db_upgrate_complete-S",o.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",o.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",o.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",o.A_MSG_LISTENER_E="A-MSG_LISTENER-E",o.O="L-original-O",o.T="L-TEST-O",o.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",o.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",o.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",o.L_NAVI_CMP_R="L-NAVI_CPM-R",o.A_SEND_MSG_T="A-send_msg-T",o.A_SEND_MSG_R="A-send_msg-R",o.L_SEND_MSG_T="L-send_msg-T",o.L_SEND_MSG_R="L-send_msg-R",o.L_PULL_MSG_T="L-pull_msg-T",o.L_PULL_MSG_R="L-pull_msg-R",o.L_PULL_MSG_E="L-pull_msg-E",o.L_PULL_MSG_O="L-pull_msg-O",o.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",o.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",o.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",o.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",o.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",o.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",o.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",o.L_RECV_S_MSG_O="L-recv_s_msg-O",o.A_DELETE_MESSAGES_S="A-delete_messages-S",o.P_DELETE_MSG_S="P-delete_msg-S",o.L_PULL_CONVERSATION_S="L-pull_conversation-S",o.A_RECALL_MESSAGE_T="A-recall_msg-T",o.A_RECALL_MESSAGE_R="A-recall_msg-R",o.A_RECALL_MESSAGE_E="A-recall_msg-E",o.A_REGTYP_O="A-regtyp-O",o.P_REGTYP_E="P-regtype-E",o.L_GET_NAVI_T="L-get_navi-T",o.L_GET_NAVI_R="L-get_navi-R",o.L_REQUEST_T="L-request-T",o.L_REQUEST_R="L-request-R",o.L_PARSE_NAVI_E="L-parse_navi-E",o.L_ENV_S="L-Env-S",o.L_GET_INDEX_NAVI_S="L-get_index_navi-S",o.A_JOIN_CHATROOM_T="A-join_chatroom-T",o.A_JOIN_CHATROOM_R="A-join_chatroom-R",o.L_JOIN_CHATROOM_T="L-join_chatroom-T",o.L_JOIN_CHATROOM_R="L-join_chatroom-R",o.A_QUIT_CHATROOM_T="A-quit_chatroom-T",o.A_QUIT_CHATROOM_R="A-quit_chatroom-R",o.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",o.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",o.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",o.L_MEDIA_S="L-media-S",o.L_MEDIA_UPLOAD_T="L-media_upload-T",o.L_MEDIA_UPLOAD_R="L-media_upload-R",o.G_UPLOAD_LOG_S="G-upload_log-S",o.G_REPORT_LOG_S="G-report_log-S",o.G_UPLOAD_LOG_E="G-upload_log-E",o.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",o.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",o.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",o.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",o.A_GET_LOCAL_MESSAGE_T="A-get_local_message-T",o.A_GET_LOCAL_MESSAGE_R="A-get_local_message-R",o.A_GET_HISTORY_MSG_T="A-get_history_msg-T",o.A_GET_HISTORY_MSG_R="A-get_history_msg-R",o.L_GET_HISTORY_MSG_T="L-get_history_msg-T",o.L_GET_HISTORY_MSG_R="L-get_history_msg-R",o.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",o.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",o.A_CALLBACK_O="A-callback-O",o.A_CALLBACK_E="A-callback-E",o.L_CALLBACK_E="L-callback-E",o.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",o.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",o.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",o.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",o.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",o.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",o.A_SYNC_READ_STATUS_T="A-sync_read_status-T",o.A_SYNC_READ_STATUS_R="A-sync_read_status-R",o.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",o.L_PB_ENCODE_E="L-pb-encode-E",o.L_PB_DECODE_E="L-pb-decode-E",o.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",o.L_REPORT_FULL_LOG_O="L-report_full_log-O",o.L_REPORT_FULL_LOG_T="L-report_full_log-T",o.L_REPORT_FULL_LOG_R="L-report_full_log-R",o.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",o.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",o.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",o.L_LOGDB_CLOSED_S="L-logDB_closed-S",o.L_LOGDB_ERROR_E="L-logDB_error-S",o.L_LOGDB_ABORT_S="L-logDB_abort-S",o.L_REALTIME_LOG_R="L_REALTIME_LOG_R",o.L_REALTIME_LOG_O="L_REALTIME_LOG_O",o.L_REALTIME_LOG_T="L_REALTIME_LOG_T",o.L_STATISTIC_LOG_R="L_STATISTIC_LOG_R",o.L_STATISTIC_LOG_O="L_STATISTIC_LOG_O",o.L_STATISTIC_LOG_T="L_STATISTIC_LOG_T",o.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",o.L_RECV_RMTP_O="L_RECV_RMTP_O",o.L_RECV_RMTP_E="L_RECV_RMTP_E",o.L_RECV_S_NTF_O="L-recv_s_ntf_O",o.L_VER_REPORT_T="L-VER_REPORT-T",o.L_VER_REPORT_R="L-VER_REPORT-R",o.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",o.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",o.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",o.A_REMOVE_PROXY_O="A-remove_proxy-O",o.A_SET_PROXY_O="A-set_proxy-O",o.A_TEST_PROXY_O="A-test_proxy-O",o.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",o.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",o.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",o.L_GET_STATIC_CONF_T="L-get_static_conf-T",o.L_GET_STATIC_CONF_R="L-get_static_conf-R",o.L_GET_STATIC_CONF_E="L-get_static_conf-E",o.L_CLOUD_DISABLED="L-cloud_disabled",o.L_CLOUD_EXPIRE="L-cloud_expire",o.L_CLOUD_OVERCLOCK="L-cloud_overclock",o.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",o.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",o.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",o.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",o.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",o.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",o.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O",o.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S="L-sync_subscribed_user_status_finished-S",o.L_PULL_SUBSCRIBED_USER_RELATION_T="L-pull_subscribed_user_relation-T",o.L_PULL_SUBSCRIBED_USER_RELATION_R="L-pull_subscribed_user_relation-R",o.L_PULL_SUBSCRIBED_USER_STATUS_T="L-pull_subscribed_user_status-T",o.L_PULL_SUBSCRIBED_USER_STATUS_R="L-pull_subscribed_user_status-R",o.L_OWN_USER_PROFILE_CHANGED_S="L-own_user_profile_changed-S",o.L_QUERY_SUBSCRIBE_DATA_T="L-query_subscribe_data-T",o.L_QUERY_SUBSCRIBE_DATA_R="L-query_subscribe_data-R",o.L_PULL_USER_PROFILE_T="L-pull_user_profile-T",o.L_PULL_USER_PROFILE_R="L-pull_user_profile-R",o.L_PULL_OWN_PROFILE_T="L-pull_own_profile-T",o.L_PULL_OWN_PROFILE_R="L-pull_own_profile-R",o.L_QUERY_FRIEND_LIST_T="L-query_friend_list-T",o.L_QUERY_FRIEND_LIST_R="L-query_friend_list-R",o.L_PULL_USER_PROFILE_REQ_T="L-pull_user_profile_req-T",o.L_PULL_USER_PROFILE_REQ_R="L-pull_user_profile_req-R",o.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S="L-pull_event_change_notify_ultra_online-S",o.L_PULL_EVENT_CHANGE_T="L-pull_event_change-T",o.L_PULL_EVENT_CHANGE_R="L-pull_event_change-R",o.L_PARSE_JSON_E="L-parse_json-E",o.L_REQ_STREAM_MSG_CONTENT_T="L-req_stream_msg_content-T",o.L_REQ_STREAM_MSG_CONTENT_R="L-req_stream_msg_content-R",o.L_REQ_STREAM_MSG_CONTENT_O="L-req_stream_msg_content-O",o.L_REQ_STREAM_MSG_CONTENT_E="L-req_stream_msg_content-E",exports.DirectionType=void 0,(i=exports.DirectionType||(exports.DirectionType={}))[i.BOTH=2]="BOTH",exports.QueryFriendsDirectionType=void 0,(a=exports.QueryFriendsDirectionType||(exports.QueryFriendsDirectionType={}))[a.BOTH=2]="BOTH",exports.FriendAddPermission=void 0,(l=exports.FriendAddPermission||(exports.FriendAddPermission={}))[l.FREE=1]="FREE",l[l.NEED_VERIFY=2]="NEED_VERIFY",l[l.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED",exports.FriendRelationType=void 0,(d=exports.FriendRelationType||(exports.FriendRelationType={}))[d.NONE=0]="NONE",d[d.IN_MY_FRIEND_LIST=1]="IN_MY_FRIEND_LIST",d[d.IN_OTHER_FRIEND_LIST=2]="IN_OTHER_FRIEND_LIST",d[d.BOTH_WAY=3]="BOTH_WAY",exports.FriendApplicationType=void 0,(u=exports.FriendApplicationType||(exports.FriendApplicationType={}))[u.SENT=1]="SENT",u[u.RECEIVED=2]="RECEIVED",exports.FriendApplicationStatus=void 0,(c=exports.FriendApplicationStatus||(exports.FriendApplicationStatus={}))[c.UNHANDLED=0]="UNHANDLED",c[c.ACCEPTED=1]="ACCEPTED",c[c.REFUSED=2]="REFUSED",c[c.EXPIRED=3]="EXPIRED",function(e){e[e.FRIEND_APPLICATION=31]="FRIEND_APPLICATION"}(h||(h={})),function(e){e[e.FRIEND_APPLY=0]="FRIEND_APPLY",e[e.FRIEND_REFUSE=1]="FRIEND_REFUSE",e[e.FRIEND_USER_INFO=2]="FRIEND_USER_INFO",e[e.FRIENDS_INPUT=3]="FRIENDS_INPUT",e[e.FRIEND_CLEAR=4]="FRIEND_CLEAR",e[e.FRIEND_INFO_CHANGE=5]="FRIEND_INFO_CHANGE",e[e.FRIEND_INFO_CHANGE_SYNC=6]="FRIEND_INFO_CHANGE_SYNC"}(p||(p={})),exports.GroupJoinPermission=void 0,(_=exports.GroupJoinPermission||(exports.GroupJoinPermission={}))[_.OWNER_VERIFY=0]="OWNER_VERIFY",_[_.FREE=1]="FREE",_[_.OWNER_OR_MANAGER_VERIFY=2]="OWNER_OR_MANAGER_VERIFY",_[_.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED",exports.GroupOperationPermission=void 0,(E=exports.GroupOperationPermission||(exports.GroupOperationPermission={}))[E.OWNER=0]="OWNER",E[E.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",E[E.EVERYONE=2]="EVERYONE",exports.GroupMemberInfoEditPermission=void 0,(I=exports.GroupMemberInfoEditPermission||(exports.GroupMemberInfoEditPermission={}))[I.OWNER_OR_MANAGER_OR_SELF=0]="OWNER_OR_MANAGER_OR_SELF",I[I.OWNER_OR_SELF=1]="OWNER_OR_SELF",I[I.SELF=2]="SELF",exports.GroupInviteHandlePermission=void 0,(T=exports.GroupInviteHandlePermission||(exports.GroupInviteHandlePermission={}))[T.FREE=0]="FREE",T[T.INVITEE_VERIFY=1]="INVITEE_VERIFY",exports.GroupMemberRole=void 0,(f=exports.GroupMemberRole||(exports.GroupMemberRole={}))[f.UNDEF=0]="UNDEF",f[f.NORMAL=1]="NORMAL",f[f.MANAGER=2]="MANAGER",f[f.OWNER=3]="OWNER",exports.GroupOperation=void 0,(C=exports.GroupOperation||(exports.GroupOperation={}))[C.CREATE=0]="CREATE",C[C.JOIN=1]="JOIN",C[C.KICK=2]="KICK",C[C.QUIT=3]="QUIT",C[C.DISMISS=4]="DISMISS",C[C.ADD_MANAGER=5]="ADD_MANAGER",C[C.REMOVE_MANAGER=6]="REMOVE_MANAGER",C[C.TRANSFER_GROUP_OWNER=7]="TRANSFER_GROUP_OWNER",function(e){e[e.GROUP_INFO_CHANGE=0]="GROUP_INFO_CHANGE",e[e.MEMBER_PROFILE_CHANGE=1]="MEMBER_PROFILE_CHANGE",e[e.GROUP_REMARK_SET=2]="GROUP_REMARK_SET",e[e.GROUP_REMARK_DELETE=3]="GROUP_REMARK_DELETE"}(R||(R={})),exports.GroupOperationType=void 0,(S=exports.GroupOperationType||(exports.GroupOperationType={}))[S.ADD=1]="ADD",S[S.REMOVE=2]="REMOVE",exports.GroupApplicationStatus=void 0,(m=exports.GroupApplicationStatus||(exports.GroupApplicationStatus={}))[m.MANAGER_UNHANDLED=0]="MANAGER_UNHANDLED",m[m.MANAGER_REFUSED=1]="MANAGER_REFUSED",m[m.INVITEE_UNHANDLED=2]="INVITEE_UNHANDLED",m[m.INVITEE_REFUSED=3]="INVITEE_REFUSED",m[m.JOINED=4]="JOINED",m[m.EXPIRED=5]="EXPIRED",exports.GroupOperationStatus=void 0,(y=exports.GroupOperationStatus||(exports.GroupOperationStatus={}))[y.REFUSE=0]="REFUSE",y[y.ACCEPT=1]="ACCEPT",exports.GroupOperationRole=void 0,(v=exports.GroupOperationRole||(exports.GroupOperationRole={}))[v.APPLICANT=0]="APPLICANT",v[v.MANAGER=1]="MANAGER",function(e){e[e.GROUP_OPERATION=11]="GROUP_OPERATION",e[e.GROUP_PROFILE_CHANGE=12]="GROUP_PROFILE_CHANGE",e[e.GROUP_APPLICATION_INVITATION=13]="GROUP_APPLICATION_INVITATION",e[e.GROUP_FOLLOW_USER_CHANGE=14]="GROUP_FOLLOW_USER_CHANGE"}(A||(A={})),exports.GroupApplicationType=void 0,(N=exports.GroupApplicationType||(exports.GroupApplicationType={}))[N.APPLICATION=0]="APPLICATION",N[N.INVITATION=1]="INVITATION",exports.GroupApplicationDirection=void 0,(O=exports.GroupApplicationDirection||(exports.GroupApplicationDirection={}))[O.APPLICATION_SENT=0]="APPLICATION_SENT",O[O.INVITATION_SENT=1]="INVITATION_SENT",O[O.INVITATION_RECEIVED=2]="INVITATION_RECEIVED",O[O.APPLICATION_RECEIVED=3]="APPLICATION_RECEIVED",exports.ChatroomEntryType=void 0,(M=exports.ChatroomEntryType||(exports.ChatroomEntryType={}))[M.UPDATE=1]="UPDATE",M[M.DELETE=2]="DELETE",exports.ChrmSyncStatus=void 0,(L=exports.ChrmSyncStatus||(exports.ChrmSyncStatus={}))[L.QUIT=0]="QUIT",L[L.JOIN=1]="JOIN",exports.ChatroomSyncStatusReason=void 0,(U=exports.ChatroomSyncStatusReason||(exports.ChatroomSyncStatusReason={}))[U.LeaveOnMyOwn=0]="LeaveOnMyOwn",U[U.OtherDeviceLogin=1]="OtherDeviceLogin",exports.ChatroomUserChangeType=void 0,(P=exports.ChatroomUserChangeType||(exports.ChatroomUserChangeType={}))[P.QUIT=0]="QUIT",P[P.JOIN=1]="JOIN",exports.ChrmMemBanType=void 0,(b=exports.ChrmMemBanType||(exports.ChrmMemBanType={}))[b.UnmuteUsers=0]="UnmuteUsers",b[b.MuteUsers=1]="MuteUsers",b[b.UnmuteAll=2]="UnmuteAll",b[b.MuteAll=3]="MuteAll",b[b.RemoveWhitelist=4]="RemoveWhitelist",b[b.AddWhitelist=5]="AddWhitelist",b[b.UnmuteGloble=6]="UnmuteGloble",b[b.MuteGloble=7]="MuteGloble",exports.ChrmMemOperateType=void 0,(x=exports.ChrmMemOperateType||(exports.ChrmMemOperateType={}))[x.Deblock=0]="Deblock",x[x.Blocked=1]="Blocked",exports.ErrorCode=void 0,(D=exports.ErrorCode||(exports.ErrorCode={}))[D.SUCCESS=0]="SUCCESS",D[D.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",D[D.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",D[D.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",D[D.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",D[D.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",D[D.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",D[D.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",D[D.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",D[D.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",D[D.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",D[D.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",D[D.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",D[D.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",D[D.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",D[D.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",D[D.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",D[D.NOT_IN_GROUP=22406]="NOT_IN_GROUP",D[D.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",D[D.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",D[D.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",D[D.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",D[D.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",D[D.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",D[D.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",D[D.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",D[D.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",D[D.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",D[D.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",D[D.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",D[D.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",D[D.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",D[D.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",D[D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",D[D.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",D[D.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",D[D.HAVNODEVICEID=24001]="HAVNODEVICEID",D[D.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",D[D.FEILD=24009]="FEILD",D[D.INTERNALERRROR=24015]="INTERNALERRROR",D[D.RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET=24360]="RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET",D[D.RC_USER_PROFILE_KEY_NOT_EXIST=24361]="RC_USER_PROFILE_KEY_NOT_EXIST",D[D.RC_USER_PROFILE_EXT_KEY_NOT_EXIST=24362]="RC_USER_PROFILE_EXT_KEY_NOT_EXIST",D[D.RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT=24363]="RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT",D[D.RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT=24364]="RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT",D[D.RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT=24365]="RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT",D[D.RC_USER_PROFILE_USER_NOT_EXIST=24366]="RC_USER_PROFILE_USER_NOT_EXIST",D[D.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS=24367]="RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS",D[D.RC_USER_PROFILE_VALUE_EXCEED_RANGE=24368]="RC_USER_PROFILE_VALUE_EXCEED_RANGE",D[D.RC_USER_PROFILE_SERVICE_UNAVAILABLE=24369]="RC_USER_PROFILE_SERVICE_UNAVAILABLE",D[D.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",D[D.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",D[D.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",D[D.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",D[D.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",D[D.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",D[D.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",D[D.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",D[D.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",D[D.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",D[D.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",D[D.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",D[D.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",D[D.RECALL_MESSAGE=25101]="RECALL_MESSAGE",D[D.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",D[D.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",D[D.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",D[D.RC_ENTRUST_SERVER_ERROR=25402]="RC_ENTRUST_SERVER_ERROR",D[D.RC_ENTRUST_SERVER_PARAMETER_ERROR=25403]="RC_ENTRUST_SERVER_PARAMETER_ERROR",D[D.RC_GROUP_ILLEGAL_ERROR=25404]="RC_GROUP_ILLEGAL_ERROR",D[D.RC_GROUP_AUTHORITY_ERROR=25405]="RC_GROUP_AUTHORITY_ERROR",D[D.RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT=25406]="RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT",D[D.RC_GROUP_PARAMETER_FORMAT_ERROR=25407]="RC_GROUP_PARAMETER_FORMAT_ERROR",D[D.RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS=25408]="RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS",D[D.RC_GROUP_ID_ALREADY_EXIST=25409]="RC_GROUP_ID_ALREADY_EXIST",D[D.RC_GROUP_ID_NOT_EXIST=25410]="RC_GROUP_ID_NOT_EXIST",D[D.RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT=25411]="RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT",D[D.RC_GROUP_MEMBERS_ALREADY_IN_GROUP=25412]="RC_GROUP_MEMBERS_ALREADY_IN_GROUP",D[D.RC_GROUP_NOT_ALLOW_SDK_OPERATION=25413]="RC_GROUP_NOT_ALLOW_SDK_OPERATION",D[D.RC_GROUP_NOT_ALLOW_JOIN=25414]="RC_GROUP_NOT_ALLOW_JOIN",D[D.RC_GROUP_EXT_KEY_NOT_EXIST=25415]="RC_GROUP_EXT_KEY_NOT_EXIST",D[D.RC_GROUP_REQUEST_OVERFREQUENCY=25416]="RC_GROUP_REQUEST_OVERFREQUENCY",D[D.RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK=25417]="RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK",D[D.RC_GROUP_USER_NOT_IN_GROUP=25418]="RC_GROUP_USER_NOT_IN_GROUP",D[D.RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT=25419]="RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT",D[D.RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP=25420]="RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP",D[D.RC_GROUP_APPLICATION_NOT_EXIST=25421]="RC_GROUP_APPLICATION_NOT_EXIST",D[D.RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT=25422]="RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT",D[D.RC_GROUP_NAME_INVALID=25423]="RC_GROUP_NAME_INVALID",D[D.RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT=25424]="RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT",D[D.RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER=25425]="RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER",D[D.RC_GROUP_NO_INVITE_PERMISSION=25426]="RC_GROUP_NO_INVITE_PERMISSION",D[D.RC_GROUP_NEED_INVITEE_ACCEPT=25427]="RC_GROUP_NEED_INVITEE_ACCEPT",D[D.RC_GROUP_APPLICATION_ALREADY_HANDLE=25428]="RC_GROUP_APPLICATION_ALREADY_HANDLE",D[D.RC_GROUP_OLD_GROUP_NOT_ENTRUST=25429]="RC_GROUP_OLD_GROUP_NOT_ENTRUST",D[D.RC_GROUP_ID_INVALID=25430]="RC_GROUP_ID_INVALID",D[D.RC_PAGE_TOKEN_PARSING_FAILED=25432]="RC_PAGE_TOKEN_PARSING_FAILED",D[D.RC_FRIEND_ALREADY_FRIEND=25460]="RC_FRIEND_ALREADY_FRIEND",D[D.RC_FRIEND_NEED_ACCEPT=25461]="RC_FRIEND_NEED_ACCEPT",D[D.RC_FRIEND_IN_OTHER_BLACK_LIST=25462]="RC_FRIEND_IN_OTHER_BLACK_LIST",D[D.RC_FRIEND_NOT_IN_OTHER_WHITE_LIST=25463]="RC_FRIEND_NOT_IN_OTHER_WHITE_LIST",D[D.RC_FRIEND_IN_MY_BLACK_LIST=25464]="RC_FRIEND_IN_MY_BLACK_LIST",D[D.RC_FRIEND_NOT_IN_MY_WHITE_LIST=25465]="RC_FRIEND_NOT_IN_MY_WHITE_LIST",D[D.RC_FRIEND_APPLICATION_NOT_EXIST=25466]="RC_FRIEND_APPLICATION_NOT_EXIST",D[D.RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT=25467]="RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT",D[D.RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT=25468]="RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT",D[D.RC_FRIEND_NOT_FRIEND=25469]="RC_FRIEND_NOT_FRIEND",D[D.RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT=25470]="RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT",D[D.RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND=25471]="RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND",D[D.RC_FRIEND_NOT_EXIST=25472]="RC_FRIEND_NOT_EXIST",D[D.RC_FRIEND_NOT_ALLOW_ADD_SELF=25473]="RC_FRIEND_NOT_ALLOW_ADD_SELF",D[D.SERVICE_INFORMATION_AUDIT_FAILED=25480]="SERVICE_INFORMATION_AUDIT_FAILED",D[D.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",D[D.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",D[D.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",D[D.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",D[D.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",D[D.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",D[D.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",D[D.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",D[D.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",D[D.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",D[D.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",D[D.RC_FILE_SIZE_EXCEED_LIMIT=26106]="RC_FILE_SIZE_EXCEED_LIMIT",D[D.INVALID_PARAMETER_SIZE_NOT_FOUND=26107]="INVALID_PARAMETER_SIZE_NOT_FOUND",D[D.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",D[D.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",D[D.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",D[D.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",D[D.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",D[D.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",D[D.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",D[D.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",D[D.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",D[D.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",D[D.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",D[D.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",D[D.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",D[D.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",D[D.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",D[D.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",D[D.MESSAGE_NOT_SUPPORT_SENDING=30017]="MESSAGE_NOT_SUPPORT_SENDING",D[D.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",D[D.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",D[D.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",D[D.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",D[D.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",D[D.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",D[D.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",D[D.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",D[D.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",D[D.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",D[D.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",D[D.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",D[D.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",D[D.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",D[D.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",D[D.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",D[D.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",D[D.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",D[D.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",D[D.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",D[D.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",D[D.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",D[D.RC_OTP_USED=31027]="RC_OTP_USED",D[D.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",D[D.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",D[D.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",D[D.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",D[D.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",D[D.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",D[D.RC_TCP_RESET=32054]="RC_TCP_RESET",D[D.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",D[D.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",D[D.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",D[D.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",D[D.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",D[D.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",D[D.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",D[D.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",D[D.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",D[D.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",D[D.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",D[D.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",D[D.TAG_EXISTS=33101]="TAG_EXISTS",D[D.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",D[D.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",D[D.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",D[D.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",D[D.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",D[D.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",D[D.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",D[D.UPLOAD_FAIL=34011]="UPLOAD_FAIL",D[D.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",D[D.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",D[D.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",D[D.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",D[D.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",D[D.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",D[D.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",D[D.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",D[D.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",D[D.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",D[D.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",D[D.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",D[D.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",D[D.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",D[D.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",D[D.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",D[D.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",D[D.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",D[D.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",D[D.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",D[D.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",D[D.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",D[D.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",D[D.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",D[D.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",D[D.INVALID_PARAMETER_TIMESTRING=34224]="INVALID_PARAMETER_TIMESTRING",D[D.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",D[D.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",D[D.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",D[D.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",D[D.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",D[D.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",D[D.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",D[D.INVALID_PARAMETER_UNIQUE_ID=34236]="INVALID_PARAMETER_UNIQUE_ID",D[D.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",D[D.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",D[D.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",D[D.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",D[D.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",D[D.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",D[D.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",D[D.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",D[D.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",D[D.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",D[D.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",D[D.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",D[D.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",D[D.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",D[D.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",D[D.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",D[D.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",D[D.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",D[D.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",D[D.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",D[D.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",D[D.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",D[D.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",D[D.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",D[D.INVALID_PARAMETER_SPAN_MINUTES=34283]="INVALID_PARAMETER_SPAN_MINUTES",D[D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",D[D.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",D[D.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",D[D.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",D[D.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",D[D.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",D[D.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",D[D.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",D[D.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",D[D.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",D[D.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",D[D.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",D[D.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",D[D.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",D[D.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",D[D.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",D[D.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",D[D.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",D[D.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",D[D.INVALID_PARAMETER_USER_PROFILE=34312]="INVALID_PARAMETER_USER_PROFILE",D[D.INVALID_PARAMETER_USER_PROFILE_VISIBILITY=34313]="INVALID_PARAMETER_USER_PROFILE_VISIBILITY",D[D.INVALID_PARAMETER_EXTRA=34314]="INVALID_PARAMETER_EXTRA",D[D.DB_UPGRADE_FAILED=34315]="DB_UPGRADE_FAILED",D[D.INVALID_PARAMETER_GROUP_INFO=34318]="INVALID_PARAMETER_GROUP_INFO",D[D.INVALID_PARAMETER_GROUP_ID=34319]="INVALID_PARAMETER_GROUP_ID",D[D.INVALID_PARAMETER_GROUP_NAME=34320]="INVALID_PARAMETER_GROUP_NAME",D[D.INVALID_PARAMETER_GROUP_IDS=34321]="INVALID_PARAMETER_GROUP_IDS",D[D.INVALID_PARAMETER_GROUP_MEMBER_ROLE=34322]="INVALID_PARAMETER_GROUP_MEMBER_ROLE",D[D.INVALID_PARAMETER_GROUP_APPLICATION_STATUS=34323]="INVALID_PARAMETER_GROUP_APPLICATION_STATUS",D[D.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION=34324]="INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION",D[D.INVALID_PARAMETER_NICK_NAME=34325]="INVALID_PARAMETER_NICK_NAME",D[D.INVALID_PARAMETER_REASON=34326]="INVALID_PARAMETER_REASON",D[D.INVALID_PARAMETER_REMARK=34327]="INVALID_PARAMETER_REMARK",D[D.INVALID_PARAMETER_PAGING_QUERY_OPTION=34328]="INVALID_PARAMETER_PAGING_QUERY_OPTION",D[D.NET_DATA_IS_SYNCHRONIZING=34329]="NET_DATA_IS_SYNCHRONIZING",D[D.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE=34330]="INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE",D[D.INVALID_PARAMETER_DIRECTION_TYPE=34331]="INVALID_PARAMETER_DIRECTION_TYPE",D[D.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE=34332]="INVALID_PARAMETER_FRIEND_APPLICATION_TYPE",D[D.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS=34333]="INVALID_PARAMETER_FRIEND_APPLICATION_STATUS",D[D.INVALID_PARAMETER_FRIEND_ADD_PERMISSION=34334]="INVALID_PARAMETER_FRIEND_ADD_PERMISSION",D[D.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS=34335]="INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS",D[D.RC_REAL_TIME_CONVERSATION_UNAVAILABLE=34336]="RC_REAL_TIME_CONVERSATION_UNAVAILABLE",D[D.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",D[D.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",D[D.NOT_SUPPORT=35004]="NOT_SUPPORT",D[D.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",D[D.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",D[D.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",D[D.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",D[D.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",D[D.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",D[D.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",D[D.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",D[D.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",D[D.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",D[D.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",D[D.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",D[D.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",D[D.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",D[D.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",D[D.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",D[D.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",D[D.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",D[D.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",D[D.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",D[D.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",D[D.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",D[D.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",D[D.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",D[D.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",D[D.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",D[D.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",D[D.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",D[D.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",D[D.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",D[D.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",D[D.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",D[D.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",D[D.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",D[D.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",D[D.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",D[D.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",D[D.DNS_PROXY_TIMEOUT=35051]="DNS_PROXY_TIMEOUT",D[D.DNS_PROXY_ERROR=35052]="DNS_PROXY_ERROR",D[D.DNS_PROXY_DATA_DESTRUCTUR_ERROR=35053]="DNS_PROXY_DATA_DESTRUCTUR_ERROR",D[D.INVALID_DISABLE_UPDATE_LAST_MESSAGE=35054]="INVALID_DISABLE_UPDATE_LAST_MESSAGE",D[D.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",D[D.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",D[D.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",D[D.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",D[D.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",D[D.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",D[D.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",D[D.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",D[D.STREAM_MESSAGE_DISABLE=39001]="STREAM_MESSAGE_DISABLE",D[D.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED=39002]="STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED",D[D.STREAM_MESSAGE_EXPANSION_KEY_ERROR=39003]="STREAM_MESSAGE_EXPANSION_KEY_ERROR",D[D.STREAM_MESSAGE_REQUEST_FAIL=39005]="STREAM_MESSAGE_REQUEST_FAIL",D[D.STREAM_MESSAGE_REQUEST_IN_PROCESS=39006]="STREAM_MESSAGE_REQUEST_IN_PROCESS",D[D.STREAM_MESSAGE_SYNCED=39007]="STREAM_MESSAGE_SYNCED",D[D.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",D[D.TIMEOUT=-1]="TIMEOUT",exports.ConversationType=void 0,(w=exports.ConversationType||(exports.ConversationType={}))[w.NONE=0]="NONE",w[w.PRIVATE=1]="PRIVATE",w[w.DISCUSSION=2]="DISCUSSION",w[w.GROUP=3]="GROUP",w[w.CHATROOM=4]="CHATROOM",w[w.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",w[w.SYSTEM=6]="SYSTEM",w[w.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",w[w.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",w[w.ULTRA_GROUP=10]="ULTRA_GROUP",w[w.RTC_ROOM=12]="RTC_ROOM",function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(V||(V={})),exports.FileType=void 0,(G=exports.FileType||(exports.FileType={}))[G.IMAGE=1]="IMAGE",G[G.AUDIO=2]="AUDIO",G[G.VIDEO=3]="VIDEO",G[G.FILE=4]="FILE",G[G.SIGHT=5]="SIGHT",G[G.COMBINE_HTML=6]="COMBINE_HTML",exports.MentionedType=void 0,(F=exports.MentionedType||(exports.MentionedType={}))[F.ALL=1]="ALL",F[F.SINGAL=2]="SINGAL",exports.MessageType=void 0,(B=exports.MessageType||(exports.MessageType={})).TextMessage="RC:TxtMsg",B.VOICE="RC:VcMsg",B.HQ_VOICE="RC:HQVCMsg",B.IMAGE="RC:ImgMsg",B.GIF="RC:GIFMsg",B.RICH_CONTENT="RC:ImgTextMsg",B.LOCATION="RC:LBSMsg",B.FILE="RC:FileMsg",B.SIGHT="RC:SightMsg",B.COMBINE="RC:CombineMsg",B.COMBINE_V2="RC:CombineV2Msg",B.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",B.LOG_COMMAND="RC:LogCmdMsg",B.EXPANSION_NOTIFY="RC:MsgExMsg",B.REFERENCE="RC:ReferenceMsg",B.RECALL="RC:RcCmd",B.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",B.READ_RECEIPT="RC:ReadNtf",B.READ_RECEIPT_REQUEST="RC:RRReqMsg",B.READ_RECEIPT_RESPONSE="RC:RRRspMsg",B.SYNC_READ_STATUS="RC:SRSMsg",B.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",B.READ_STATE="RC:RSMsg",B.DELIVERED="RC:Delivered",B.DELIVERED_MSG="RC:DRMsg",B.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",B.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",B.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",B.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",B.TYPING_STATUS="RC:TypSts",B.INTERCEPT="RC:InterceptMsg",B.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg",B.STREAM_MESSAGE="RC:StreamMsg",exports.UltraGroupChannelType=void 0,(k=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[k.PUBLIC=0]="PUBLIC",k[k.PRIVATE=1]="PRIVATE",exports.UltraGroupChannelChangeType=void 0,(H=exports.UltraGroupChannelChangeType||(exports.UltraGroupChannelChangeType={}))[H.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",H[H.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",H[H.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",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",e[e.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}(q||(q={})),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"}(Y||(Y={})),function(e){e[e.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",e[e.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",e[e.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",e[e.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",e[e.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(K||(K={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(j||(j={})),exports.SentStatus=void 0,(Q=exports.SentStatus||(exports.SentStatus={}))[Q.SENDING=10]="SENDING",Q[Q.FAILED=20]="FAILED",Q[Q.SENT=30]="SENT",Q[Q.RECEIVED=40]="RECEIVED",Q[Q.READ=50]="READ",Q[Q.DESTROYED=60]="DESTROYED",exports.OperateStatus=void 0,(W=exports.OperateStatus||(exports.OperateStatus={}))[W.typing=0]="typing",exports.OnlineStatus=void 0,($=exports.OnlineStatus||(exports.OnlineStatus={}))[$.ONLINE=1]="ONLINE",$[$.OFFLINE=0]="OFFLINE",exports.PlatformInfo=void 0,(J=exports.PlatformInfo||(exports.PlatformInfo={}))[J.Other=0]="Other",J[J.iOS=1]="iOS",J[J.Android=2]="Android",J[J.Web=3]="Web",J[J.PC=4]="PC",J[J.Mini=5]="Mini",J[J.HarmonyOS=6]="HarmonyOS",exports.SubscribeType=void 0,(X=exports.SubscribeType||(exports.SubscribeType={}))[X.ONLINE_STATUS=1]="ONLINE_STATUS",X[X.USER_PROFILE=2]="USER_PROFILE",X[X.FRIEND_ONLINE_STATUS=3]="FRIEND_ONLINE_STATUS",X[X.FRIEND_USER_PROFILE=4]="FRIEND_USER_PROFILE",exports.SubscribeOperationType=void 0,(Z=exports.SubscribeOperationType||(exports.SubscribeOperationType={}))[Z.SUBSCRIBE=0]="SUBSCRIBE",Z[Z.UNSUBSCRIBE=1]="UNSUBSCRIBE",exports.UserProfileVisibility=void 0,(z=exports.UserProfileVisibility||(exports.UserProfileVisibility={}))[z.NOT_SET=0]="NOT_SET",z[z.INVISIBLE=1]="INVISIBLE",z[z.EVERYONE=2]="EVERYONE",z[z.FriendVisible=3]="FriendVisible",exports.RCConnectionStatus=void 0,(ee=exports.RCConnectionStatus||(exports.RCConnectionStatus={}))[ee.CONNECTED=0]="CONNECTED",ee[ee.CONNECTING=1]="CONNECTING",ee[ee.DISCONNECTED=2]="DISCONNECTED",ee[ee.SUSPENDED=3]="SUSPENDED",exports.MessageBlockType=void 0,(te=exports.MessageBlockType||(exports.MessageBlockType={}))[te.GLOBAL=1]="GLOBAL",te[te.CUSTOM=2]="CUSTOM",te[te.THIRD_PARTY=3]="THIRD_PARTY",exports.MessageBlockSourceType=void 0,(ne=exports.MessageBlockSourceType||(exports.MessageBlockSourceType={}))[ne.MSG_ORIGINAL=0]="MSG_ORIGINAL",ne[ne.MSG_EXPANSION=1]="MSG_EXPANSION",ne[ne.MSG_MODIFY=2]="MSG_MODIFY",exports.MessageDirection=void 0,(re=exports.MessageDirection||(exports.MessageDirection={}))[re.SEND=1]="SEND",re[re.RECEIVE=2]="RECEIVE",exports.PushImportanceHonor=void 0,(se=exports.PushImportanceHonor||(exports.PushImportanceHonor={})).NORMAL="NORMAL",se.LOW="LOW",function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S",e.IM_CMP="IM-stats_cmp-S",e.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",e.IM_STATS_CS="IM-stats_cs-S",e.IM_NETWORK_CHANGE="IM-stats_network_change-S",e.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",e.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",e.IM_MSG_SEND="IM-msg_send-S",e.IM_MSG_RECEIVE="IM-msg_receive-S"}(oe||(oe={})),exports.NotificationStatus=void 0,(ie=exports.NotificationStatus||(exports.NotificationStatus={}))[ie.OPEN=1]="OPEN",ie[ie.CLOSE=2]="CLOSE",exports.NotificationLevel=void 0,(ae=exports.NotificationLevel||(exports.NotificationLevel={}))[ae.ALL_MESSAGE=-1]="ALL_MESSAGE",ae[ae.NOT_SET=0]="NOT_SET",ae[ae.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",ae[ae.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",ae[ae.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",ae[ae.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION",exports.ReceivedStatus=void 0,(le=exports.ReceivedStatus||(exports.ReceivedStatus={}))[le.READ=1]="READ",le[le.LISTENED=2]="LISTENED",le[le.DOWNLOADED=4]="DOWNLOADED",le[le.RETRIEVED=8]="RETRIEVED",le[le.UNREAD=0]="UNREAD",function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(de||(de={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(ue||(ue={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(ce||(ce={})),function(e){e[e.CURRENT=2]="CURRENT"}(he||(he={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(pe||(pe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(_e||(_e={})),exports.InterruptionLevel=void 0,(ge=exports.InterruptionLevel||(exports.InterruptionLevel={})).PASSIVE="passive",ge.ACTIVE="active",ge.TIME_SENSITIVE="time-sensitive",ge.CRITICAL="critical",exports.PushNotificationQuietHoursLevel=void 0,(Ee=exports.PushNotificationQuietHoursLevel||(exports.PushNotificationQuietHoursLevel={}))[Ee.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT=0]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT",Ee[Ee.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE=1]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE",Ee[Ee.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED=5]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED",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"}(Ie||(Ie={})),exports.HttpMethod=void 0,(Te=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",Te.POST="POST",Te.PUT="PUT";const fe=72e5,Ce=6e4,Re=131072,Se={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0,searchProps:["content","title"]},"RC:FileMsg":{isCounted:!0,isPersited:!0,searchProps:["name"]},"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:CombineV2Msg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0,searchProps:["content"]},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:RLStart":{isCounted:!0,isPersited:!0},"RC:RLEnd":{isCounted:!0,isPersited:!0},"RC:StreamMsg":{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:RcNtf":{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:RcCmd":{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},"RC:RLJoin":{isCounted:!1,isPersited:!1},"RC:RLQuit":{isCounted:!1,isPersited:!1},"RC:RL":{isCounted:!1,isPersited:!1},"RC:CCConfigChangeRequestMsg":{isCounted:!1,isPersited:!1}},me="5.16.0-c-rtc-alpha.2".replace(/-.+$/,""),ye="rongcloudsystem",ve=864e5,Ae=e=>`navi_${e}`,Ne=(e,t)=>`RCV4-con-s-${e}-${t}`,Oe=(e,t)=>`RCV4-con-${e}-${t}`,Me=(e,t)=>`RCV4-CONVER-${e}-${t}`,Le=(e,t)=>`RCV4-ultragroupconversation-${e}-${t}`,Ue=(e,t)=>`outbox_${e}_${t}`,Pe=(e,t)=>`inbox_${e}_${t}`,be=(e,t)=>`broadcastbox_${e}_${t}`,xe=(e,t)=>`send_msg_${e}_${t}`,De=(e,t)=>`RC-us-${e}-${t}`,we=e=>`rc-static-config-${e}`,Ve=e=>`RC-cc-${e}`,Ge=(e,t)=>`RC-RR-${e}-${t}`,Fe=(e,t)=>`RC-PEC-${e}-${t}`,Be="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Be.engine="5.16.0-c-rtc-alpha.2";class ke{static add(e,t){Be[e]=t}static validEngine(e){const t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;const n=t[0].split(".").map((e=>e.padStart(3,"0"))).join("");return Be.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((e=>e.padStart(3,"0"))).join("")>=n}static getInfo(){return Be}}const He={gen:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=Math.floor(36*Math.random());return("x"===e?t:3&t|8).toString(36)})),genWithLen(e=22){const t=Date.now(),n=t.toString(36),r=Math.floor(Math.random()*t).toString(36),s=e-n.length-r.length;var o;return[r,n,s>0?(o=s,Array.from({length:o}).map((()=>Math.floor(36*Math.random()).toString(36))).join("")):""].join("").slice(0,e)}},qe=He.genWithLen(22),Ye=Date.now();class Ke extends Error{constructor(e){super(e),this.name="CMSYError"}static InvalidParameters(e){return(null==e?void 0:e.length)?new Ke(`Invalid parameter -> ${e}`):new Ke("Invalid parameters.")}static ParameterTypeError(){return new Ke("Wrong parameter type")}}class je{constructor(){this._map=new Map,this._piped=new Set}_addItem(e,t,n,r,s=0){const o=Symbol(),i=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:o,priority:Math.min(s,100),listener:t.bind(r),once:n},l=i.findIndex((e=>e.priority>s));return-1===l?i.push(a):i.splice(l,0,a),o}on(e,t,n,r=0){return this._addItem(e,t,!1,n,r)}once(e,t,n,r=0){return this._addItem(e,t,!0,n,r)}off(e){for(let[t,n]of this._map){const t=n.findIndex((t=>t.symbol===e));if(-1!==t)return void n.splice(t,1)}}emit(e,...t){const n=this._map.get(e);if(n&&n.length>0)for(let e=n.length-1;e>=0;e-=1){const{once:r,listener:s}=n[e];r&&n.splice(e,1);try{s(...t)}catch(e){null===console||void 0===console||console.error(e)}}[...this._piped.values()].forEach((n=>n.emit(e,...t)))}removeAll(e){this._map.delete(e)}clear(){this._piped.clear(),this._map.clear()}pipe(e){this._piped.add(e)}}class Qe{constructor(e,t){this._promise=new Promise((t=>{this._resolve=t,e(this._onResolve.bind(this))})),this._onCancel=t}_onResolve(e){this._resolve(e)}result(){return this._promise}abort(){this._onCancel(this._onResolve.bind(this))}}class We{constructor(e,t,n){this.code=e,this.msg=t,this.data=n,this.isOk=0===e}next(e){return t(this,void 0,void 0,(function*(){return this.isOk?e(this.data):this.wipe()}))}or(e){return t(this,void 0,void 0,(function*(){return this.isOk?this:e(this.code)}))}trans(e){return this.isOk?$e(e(this.data)):this.wipe()}tryTrans(e){return this.isOk?e(this.data):this.wipe()}errmsg(){return JSON.stringify({code:this.code,msg:this.msg})}wipe(){return this.isOk?$e(void 0,this.msg):Je(this.code,this.msg)}}const $e=(e,t)=>new We(0,t||"success",e),Je=(e,t,n)=>new We(e,t||`fail: ${e}`,n);class Xe{constructor(e){this._apiName=e,this._isValid=!0,this._code=0}static create(e){return new Xe(e)}fail(e,t){return this._isValid||0!==this._code||(this._code=e,this._errmsg=t||this._errmsg),this}result(){if(!this._isValid&&0===this._code)throw new Error("Validator: result() should not be called without fail()");return this._isValid?$e():Je(this._code,this._errmsg)}validate(e,t,n,r=!1){if(!this._isValid)return this;const s=r?n(t):null==t||n(t);return this._isValid=s,s||(this._errmsg=`param '${e}' is invalid`),this}assert(e,t,n,r=!1){if(!this._isValid)return this;if(this.validate(e,t,n,r),!this._isValid)throw Ke.InvalidParameters(`'${e}' at '${this._apiName}'`);return this}isString(e,t,n=!1){return this.validate(e,t,(()=>"string"==typeof t),n)}assertString(e,t,n=!1){return this.assert(e,t,(()=>"string"==typeof t),n)}isNotEmptyString(e,t,n=!1){return this.isString(e,t,n).validate(e,t,(e=>e.trim().length>0),n)}assertNotEmptyString(e,t,n=!1){return this.assertString(e,t,n),this.assert(e,t,(e=>e.trim().length>0),n)}isLimitedString(e,t,n,r,s=!1){return this.isString(e,t,s).validate(e,t,(e=>e.length>=n&&e.length<=r),s)}assertLimitedString(e,t,n,r,s=!1){return this.assertString(e,t,s),this.assert(e,t,(e=>e.length>=n&&e.length<=r),s)}isBoolean(e,t,n=!1){return this.validate(e,t,(e=>"boolean"==typeof e),n)}assertBoolean(e,t,n=!1){return this.assert(e,t,(e=>"boolean"==typeof e),n)}isNumber(e,t,n=!1){return this.validate(e,t,(e=>"number"==typeof e&&!Number.isNaN(e)),n)}assertNumber(e,t,n=!1){return this.assert(e,t,(e=>"number"==typeof e&&!Number.isNaN(e)),n)}isLimitedNumber(e,t,n,r,s=!1){return this.isNumber(e,t,s).validate(e,t,(e=>e>=n&&e<=r),s)}assertLimitedNumber(e,t,n,r,s=!1){return this.assertNumber(e,t,s),this.assert(e,t,(e=>e>=n&&e<=r),s)}isInteger(e,t,n=!1){return this.validate(e,t,(e=>Number.isInteger(e)),n)}assertInteger(e,t,n=!1){return this.assert(e,t,(e=>Number.isInteger(e)),n)}isLimitedInteger(e,t,n,r,s=!1){return this.isInteger(e,t,s).validate(e,t,(e=>e>=n&&e<=r),s)}assertLimitedInteger(e,t,n,r,s=!1){return this.assertInteger(e,t,s),this.assert(e,t,(e=>e>=n&&e<=r),s)}isArray(e,t,n=!1){return this.validate(e,t,(e=>-1!==Object.prototype.toString.call(e).indexOf("Array")),n)}assertArray(e,t,n=!1){return this.assert(e,t,(e=>-1!==Object.prototype.toString.call(e).indexOf("Array")),n)}isLimitedArray(e,t,n,r=!1,s=1){return this.isArray(e,t,r).validate(e,t,(e=>e.length>=s&&e.length<=n),r)}assertLimitedArray(e,t,n,r=!1,s=1){return this.assertArray(e,t,r),this.assert(e,t,(e=>e.length>=s&&e.length<=n),r)}isTypedArray(e,t,n,r=!1){return this.isArray(e,t,r).validate(e,t,(e=>e.every(n)),r)}assertTypedArray(e,t,n,r=!1){return this.assertArray(e,t,r),this.assert(e,t,(e=>e.every(n)),r)}isLimitedTypedArray(e,t,n,r,s=!1,o=1){return this.isLimitedArray(e,t,n,s,o).validate(e,t,(e=>e.every(r)),s)}assertLimitedTypedArray(e,t,n,r,s=!1,o=1){return this.assertLimitedArray(e,t,n,s,o),this.assert(e,t,(e=>e.every(r)),s)}isObject(e,t,n=!1){return this.validate(e,t,(e=>"[object Object]"===Object.prototype.toString.call(e)),n)}assertObject(e,t,n=!1){return this.assert(e,t,(e=>"[object Object]"===Object.prototype.toString.call(e)),n)}isValueOf(e,t,n,r=!1){return this.validate(e,t,(()=>Object.values(n).includes(t)),r)}assertValueOf(e,t,n,r=!1){return this.assert(e,t,(()=>Object.values(n).includes(t)),r)}isFunction(e,t,n=!1){return this.validate(e,t,(e=>"[object Function]"===Object.prototype.toString.call(e)),n)}assertFunction(e,t,n=!1){return this.assert(e,t,(e=>"[object Function]"===Object.prototype.toString.call(e)),n)}}const Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function ze(e){let t,n,r,s,o,i,a,l="",d=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");d<e.length;)s=Ze.indexOf(e.charAt(d++)),o=Ze.indexOf(e.charAt(d++)),i=Ze.indexOf(e.charAt(d++)),a=Ze.indexOf(e.charAt(d++)),t=s<<2|o>>4,n=(15&o)<<4|i>>2,r=(3&i)<<6|a,l+=String.fromCharCode(t),64!==i&&(l+=String.fromCharCode(n)),64!==a&&(l+=String.fromCharCode(r));return l}const et=e=>"string"==typeof e,nt=e=>"number"==typeof e&&!Number.isNaN(e),rt=e=>-1!==Object.prototype.toString.call(e).indexOf("Array"),st=e=>t=>et(t)&&(void 0===e.isTrim||0===t.length||t.trim().length>0)&&(void 0===e.minLength||t.length>=e.minLength)&&(void 0===e.maxLength||t.length<=e.maxLength)&&(void 0===e.validator||e.validator(t)),ot=e=>et(e)&&e.length>0,it=e=>"[object Object]"===Object.prototype.toString.call(e),at=e=>"[object Function]"===Object.prototype.toString.call(e),lt=e=>void 0===e||"[object Undefined]"===Object.prototype.toString.call(e),dt=e=>et(e)&&/https?:\/\//.test(e),ut=e=>{for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},ct=e=>nt(e)&&Object.prototype.hasOwnProperty.call(exports.ConversationType,e),ht=e=>{let t=!1;return et(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},pt=e=>st({minLength:1,maxLength:64})(e),_t=e=>{let t=!1,n=!1,r=!1;if(it(e)){t=Object.keys(e).length>20;for(const t in e)if(n||(n=et(t)&&!/^[A-Za-z0-9_=+-]+$/.test(t)),!r){const n=e[t];r=t.length>32||n.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:r}},gt=e=>{if(!it(e)||void 0===e.low||void 0===e.high)return e;let{low:t}=e;t<0&&(t+=4294967296),t=t.toString(16);return parseInt(e.high.toString(16)+"00000000".replace(new RegExp(`0{${t.length}}$`),t),16)},Et=(e,t,n)=>{const r=null==n?void 0:n.isReverse;it(e)&&(()=>{for(const n in e)t(e[n],n,e)})(),(rt(e)||et(e))&&(()=>{if(r)for(let n=e.length-1;n>=0;n--)t(e[n],n);else for(let n=0,r=e.length;n<r;n++)t(e[n],n)})()},It=(e,t)=>(Et(e,((n,r)=>{e[r]=t(n,r)})),e),Tt=e=>JSON.parse(JSON.stringify(e)),ft=()=>"undefined"!=typeof RCCppEngine,Ct=e=>{let t;if("object"==typeof e&&null!==e)if(Array.isArray(e)){t=[];for(let n in e)t.push(Ct(e[n]))}else{t={};for(let n in e)t[n]=Ct(e[n])}else t=e;return t},Rt=e=>{let t;try{t=Ct(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},St=e=>({isRead:(e&exports.ReceivedStatus.READ)===exports.ReceivedStatus.READ,isListened:(e&exports.ReceivedStatus.LISTENED)===exports.ReceivedStatus.LISTENED,isDownload:(e&exports.ReceivedStatus.DOWNLOADED)===exports.ReceivedStatus.DOWNLOADED,isRetrieved:(e&exports.ReceivedStatus.RETRIEVED)===exports.ReceivedStatus.RETRIEVED}),mt=e=>[exports.PlatformInfo.Android,exports.PlatformInfo.iOS,exports.PlatformInfo.Web,exports.PlatformInfo.PC,exports.PlatformInfo.Mini,exports.PlatformInfo.HarmonyOS].map((t=>{const n=e.findIndex((e=>e.platform===t));return-1===n?{platform:t,changeTime:0,eventValue:0}:e[n]})),yt=(e,t,n)=>{const r=t.reduce(((e,t)=>(["gender","role","level"].includes(t.key)?e[t.key]=Number(t.value):e[t.key]=t.value,e)),{});return r.userId=e,n.forEach((e=>{r.extraProfile=r.extraProfile||{},r.extraProfile[e.key]=e.value})),r},vt=(e,t,n)=>t?1===n?V.TLS:V.RMTP:"http"===e?V.WS:V.WSS,At=(e,t)=>{const{server:n,backupServer:r,bs:s,serverAddr:o,protocol:i,openTLS:a}=e;if(o){return[...o.filter((e=>e.addr))]}const l=[],d=[];return n&&d.push(n),(r||s||"").split(",").forEach((e=>{d.indexOf(e)<0&&d.push(e)})),d.forEach(((e,r)=>{e&&l.push({addr:e,protocol:vt(i,t,a),weight:n.length-r,race:!1})})),[...l]},Nt=(e=[])=>e.map((e=>{var t,n,r,s,o,i,a,l,d;const u=Pt(e.settingProfile)||{},c=e.extProfile||[],{targetId:h,baseInfo:p,userInfo:_}=e;return{groupId:h,groupName:null!==(t=u.name)&&void 0!==t?t:"",portraitUri:null!==(n=u.portraitUrl)&&void 0!==n?n:"",introduction:null!==(r=u.introduction)&&void 0!==r?r:"",notice:null!==(s=u.announcement)&&void 0!==s?s:"",extProfile:Pt(c),joinPermission:~~u.joinPerm,removeMemberPermission:~~u.removePerm,invitePermission:~~u.memInvitePerm,inviteHandlePermission:~~u.invitePerm,groupInfoEditPermission:~~u.profilePerm,memberInfoEditPermission:~~u.memProfilePerm,creatorId:null!==(o=null==p?void 0:p.creatorId)&&void 0!==o?o:"",ownerId:null!==(i=null==p?void 0:p.ownerId)&&void 0!==i?i:"",createTime:(null==p?void 0:p.createTime)?gt(p.createTime):0,membersCount:null!==(a=null==p?void 0:p.memberCount)&&void 0!==a?a:0,remark:null!==(l=null==_?void 0:_.remarkName)&&void 0!==l?l:"",joinedTime:(null==_?void 0:_.joinTime)?gt(_.joinTime):0,role:null!==(d=null==_?void 0:_.role)&&void 0!==d?d:exports.GroupMemberRole.UNDEF}})),Ot=(e=[])=>e.map((e=>{const t=Pt(e.settingProfile),n=e.extProfile||[],{targetId:r,baseInfo:s,userInfo:o}=e;return JSON.parse(JSON.stringify(Object.assign(Object.assign({groupId:r},Lt(t)),{extProfile:n.length>0?Pt(n):void 0,creatorId:null==s?void 0:s.creatorId,ownerId:null==s?void 0:s.ownerId,createTime:(null==s?void 0:s.createTime)?gt(s.createTime):void 0,membersCount:null==s?void 0:s.memberCount,remark:null==o?void 0:o.remarkName})))})),Mt=e=>{if(void 0===e)return;const t=Number(e);return Number.isNaN(t)?void 0:t},Lt=e=>JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:Mt(e.joinPerm),removeMemberPermission:Mt(e.removePerm),invitePermission:Mt(e.memInvitePerm),inviteHandlePermission:Mt(e.invitePerm),groupInfoEditPermission:Mt(e.profilePerm),memberInfoEditPermission:Mt(e.memProfilePerm)})),Ut=(e=[])=>e.map((e=>{const{ext:t,userId:n,name:r,portraitUrl:s}=e||{},{role:o,joinTime:i,channelNickName:a,additional:l}=t||{};return{userId:n,name:r||"",portraitUri:s||"",nickname:a||"",role:o||exports.GroupMemberRole.UNDEF,joinedTime:gt(i)||0,extra:l||""}})),Pt=e=>{let t={};return e&&0!==e.length?(e.forEach((e=>{t[e.key]=e.value})),t):t},bt=e=>e.map((e=>{const{targetId:t,joinUserInfo:n,inviterInfo:r,status:s,directionType:o,detail:i,joinType:a,processInfo:l,processTime:d}=e;return Object.assign(Object.assign(Object.assign(Object.assign({groupId:t},n&&{joinMemberInfo:Ut([n])[0]}),r&&{inviterInfo:Ut([r])[0]}),l&&{operatorInfo:Ut([l])[0]}),{status:s,direction:o,type:a,operationTime:gt(d),reason:i})})),xt=(e,t)=>{if(e=e.replace(/\?$/,""),!t)return e;const n=Object.keys(t).map((e=>`${e}=${t[e]}`)).filter((e=>!!e));return n.length?[e,n.join("&")].join("?"):e};const Dt=(e,t)=>{const n=Math.floor(1e3*Math.random()%1e4),r=He.gen(),s=(e=>{e=e||"-";const t=new Date;return`${t.getFullYear()}${e}${t.getMonth()+1}${e}${t.getDate()}`})(),o=(new Date).getTime();let i="";if(t){const e=t.split(".");i=`.${e[e.length-1]}`}return`${e}__RC-${s}_${n}_${o}${r}${i}`},wt=e=>{const t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Vt=e=>{const{length:t}=e;return t<=4096&&t>=1},Gt=(()=>{let e=0;return()=>{const t=((4294967295&Date.now())>>>0).toString(2),n=Math.floor(1048575*Math.random()),r=t+e.toString(2).padStart(11,"0")+n.toString(2).padStart(20,"0");return e=2047&++e,parseInt(r,2)}})(),Ft=()=>{const e=ke.getInfo();let t="electron";for(let n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return t},Bt=(e,n,r)=>t(void 0,void 0,void 0,(function*(){const t=yield window.crypto.subtle.importKey("raw",(new TextEncoder).encode(n),"AES-CBC",!0,["decrypt"]),s=yield window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(r)},t,function(e){const t=null===window||void 0===window?void 0:window.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}(e));return(new TextDecoder).decode(s)}));function kt(e,t){var n;if(!e)return"";const r="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?r?e.replace(/^https?:\/\//i,"https://"):e:t!==V.HTTP||r?`https://${e}`:`http://${e}`}const Ht=(e,t)=>{if(!e)return"";const{ossConfig:n=""}=e;let r="";try{const e=JSON.parse(n);if(e.length>0){const t=e.find((e=>e.minio));t&&(r=t.minio)}}catch(e){t.warn(exports.LogTagId.L_PARSE_JSON_E,JSON.stringify({ossConfig:n,error:e}))}return r};function qt(e){const t=e.method||exports.HttpMethod.GET,n=e.timeout||Ce,{headers:r,query:s,body:o,onProgress:i}=e,a=xt(e.url,s),l=new XMLHttpRequest;if(l.open(t,a),r&&l.setRequestHeader)for(const e in r)l.setRequestHeader(e,r[e]);return function(e,t,n,r){return new Qe((s=>{e.onreadystatechange=()=>{4===e.readyState&&s({data:e.responseText,status:e.status,xhr:e})},e.onerror=()=>{s({status:e.status})},r&&(e.upload.onprogress=e=>r(e)),0!==t&&setTimeout((()=>{e.abort(),s({status:e.status})}),t),e.send(n)}),(t=>{e.abort(),t({status:-1})}))}(l,n,o,i)}var Yt,Kt;!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Yt||(Yt={})),exports.AreaCode=void 0,(Kt=exports.AreaCode||(exports.AreaCode={}))[Kt.BJ=1]="BJ",Kt[Kt.SG=2]="SG",Kt[Kt.NA=3]="NA",Kt[Kt.SG_A=4]="SG_A",Kt[Kt.SG_B=4]="SG_B",Kt[Kt.SA=5]="SA";const jt={[exports.AreaCode.BJ]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:V.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},[exports.AreaCode.SG]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:V.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},[exports.AreaCode.NA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:V.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},[exports.AreaCode.SG_B]:{naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:V.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},[exports.AreaCode.SA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:V.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]}};function Qt(e){return exports.AreaCode[e]?e:exports.AreaCode.BJ}const Wt=new class{constructor(){this.initOption={}}init(e){this.initOption=e}getNaviUrlList(e,t){const{areaCode:n,navigators:r}=this.initOption||{},s=function(e=exports.AreaCode.BJ){return jt[Qt(e)].naviUrlBase64}(n).map((e=>ze(e)));let o=[];const[,i]=e.split("@");t&&(o=i?i.split(";"):[]);const a=r&&r.length>0?[...o,...r]:[...o,...s];return a.filter(((e,t)=>a.indexOf(e)===t)).map((e=>kt(e)))}getLogUrlPolicyList(e,t){const{log:n,logPolicy:r}=e||{},{areaCode:s,logServerUrl:o}=this.initOption||{},i=function(e=exports.AreaCode.BJ){return jt[Qt(e)].logUrlBase64}(s).map((e=>Object.assign(Object.assign({},e),{addr:ze(e.addr)}))),a=[],l={level:1,itv:6,times:5};if(n)a.push(...n.addrs),Object.assign(l,n.policy);else if(r)try{const e=JSON.parse(r);a.push({addr:e.url,protocol:V.HTTPS,weight:1}),l.level=e.level,l.itv=e.itv,l.times=e.times}catch(n){t.warn(exports.LogTagId.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}const d=o?[{addr:o,protocol:V.HTTPS,weight:101},...a]:[...a,...i];return{policy:l,addrs:d.filter(((e,t)=>d.findIndex((t=>t.addr===e.addr&&t.protocol===e.protocol))===t)).map((e=>Object.assign(Object.assign({},e),{addr:kt(e.addr,e.protocol)}))).sort(((e,t)=>t.weight-e.weight))}}getMiniCmpUrlList(){var e;const t=function(e=exports.AreaCode.BJ){return jt[Qt(e)].miniCmpBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>ze(e))),{miniCMPProxy:n}=this.initOption||{};return n&&n.length>0?n:t}getStaticConfigUrl(){var e;return function(e=exports.AreaCode.BJ){return jt[Qt(e)].staticConfigUrlBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>ze(e)))}getCloudControllerUrl(e){var t;return function(e=exports.AreaCode.BJ){return jt[Qt(e)].cloudControllerUrlBase64}(null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>ze(e)))}getAreaCode(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:exports.AreaCode.BJ}setAreaCode(e){return!(!e||!exports.AreaCode[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}};class $t{constructor(e,t){this.appkey=e,this.logger=t,this.staticUrls=[]}getStaticConfig(){var e;return t(this,void 0,void 0,(function*(){const t=this.getCache();if(t){try{const e=JSON.parse(t);if(Date.now()-(null==e?void 0:e.time)<18e5){const t=(yield this.decryptData(e.val)).resources.navi.slice();return t.sort(((e,t)=>t.weight-e.weight)),{navi:t.map((e=>kt(e.addr,e.protocol)))||[]}}}catch(e){this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==e?void 0:e.stack}))}this.clearCache()}const n=yield this._requestHandle();if(!n)return;const r=yield this.decryptData(n);if((null==r?void 0:r.areaCode)!==Wt.getAreaCode())return;this.setCache(JSON.stringify({time:Date.now(),val:n})),this.staticUrls=(null==r?void 0:r.bootstrap)||[];const s=null===(e=null==r?void 0:r.resources)||void 0===e?void 0:e.navi.slice();return s.sort(((e,t)=>t.weight-e.weight)),{navi:s.map((e=>kt(e.addr,e.protocol)))||[]}}))}_requestHandle(){return t(this,void 0,void 0,(function*(){let e=[...this.staticUrls,...Wt.getStaticConfigUrl()].map((e=>kt(e)));e=e.filter(((t,n)=>e.indexOf(t)===n));for(let t of e){this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_T,JSON.stringify({url:t}));const e=Date.now(),{code:n,data:r}=yield this.sendRequest(`${t}/${this.appkey}`);if(200===n)return this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:n,duration:Date.now()-e})),r;this.logger.warn(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:n,duration:Date.now()-e}))}}))}}var Jt;exports.LogL=void 0,(Jt=exports.LogL||(exports.LogL={}))[Jt.STATISTICS=-2]="STATISTICS",Jt[Jt.RECORD=-1]="RECORD",Jt[Jt.FATAL=0]="FATAL",Jt[Jt.ERROR=1]="ERROR",Jt[Jt.WARN=2]="WARN",Jt[Jt.INFO=3]="INFO",Jt[Jt.DEBUG=4]="DEBUG";class Xt{constructor(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=exports.LogL.WARN,this.debug=this._log.bind(this,exports.LogL.DEBUG),this.info=this._log.bind(this,exports.LogL.INFO),this.warn=this._log.bind(this,exports.LogL.WARN),this.error=this._log.bind(this,exports.LogL.ERROR),this.__statistics=this._log.bind(this,exports.LogL.STATISTICS),this.record=this.__statistics}_write(e){const{tag:t,level:n,content:r,traceId:s}=e;/^[\w-]+$/.test(t)?n!==exports.LogL.DEBUG&&this._handleWrite(e):console.error(`${(new Date).toISOString()}[${this._id}]['ERROR']: ${t} | ${r} | ${s}`)}createTraceId(){return""+ ++Xt._traceIdCount}getSessionId(){return qe}_stdout(e){const{time:t,tag:n,content:r,traceId:s,level:o,loggerId:i}=e;if(!console)return;if(o<=exports.LogL.FATAL)return;if(o>this.outputLevel)return;const a=["error","warn","info","debug"][o-1],l=`${new Date(t).toISOString()}[${null!=i?i:this._id}][${(a||"stat").toUpperCase()}]: ${n} | ${r} | ${s}`;console[a||"warn"](l)}setOutputLevel(e){(e=>[exports.LogL.DEBUG,exports.LogL.INFO,exports.LogL.WARN,exports.LogL.ERROR].some((t=>t===e)))(e)&&(this.outputLevel=e)}_log(e,t,n,r){const s={time:Date.now(),level:e,tag:t,content:n,traceId:r,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(s),this._write(s)}summary(e,t,n,r={},s,o){var i,a;t.isOk?this.info(e,null!==(i=null==s?void 0:s())&&void 0!==i?i:JSON.stringify(Object.assign({isOk:!0},r)),n):this.warn(e,null!==(a=null==o?void 0:o())&&void 0!==a?a:JSON.stringify(Object.assign({code:t.code,msg:t.msg},r)),n)}}Xt._traceIdCount=0;class Zt{constructor(e,t,n,r,s,o=!1){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=r,this.logger=s,this.disableLogReport=o,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}checkStart(e,n){return t(this,void 0,void 0,(function*(){if(this.started)return;if(this.userId=e.userId,!e.logSwitch||this.disableLogReport)return;const{policy:t,addrs:r}=Wt.getLogUrlPolicyList(e,this.logger);this.started=!0,this.itvByNavi=t.itv,this.timesByNavi=t.times,r.length>0&&this.realtimeReport(r[0].addr,t.level,t.itv,n)}))}_sendLogs2Realtime(e,n,r,s){return t(this,void 0,void 0,(function*(){this.logger.debug(exports.LogTagId.L_REALTIME_LOG_O,`compress logs: ${e.length}`);const{success:t,data:o}=yield this.compressLogs(e);if(!t)return this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"compress failed",n),{isOk:!1,itv:s};this.logger.debug(exports.LogTagId.L_REALTIME_LOG_O,"compress done",n);let i=dt(r)?r:`https://${r}`;i+=`?version=5.16.0-c-rtc-alpha.2&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.deviceId}&deviceInfo=${this.deviceInfo}&platform=Web`;const{status:a,data:l}=yield this.send({url:i,body:o,method:"POST"});if(this.logger.debug(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:a,data:l}),n),200!==a)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(s+=s),this.reportFailedNumber++,{isOk:!1,itv:s};let d,u;if(this.reportFailedNumber=0,l)try{const e=JSON.parse(l);e.nextTime&&(s=e.nextTime),d=e.level,u=e.logSwitch}catch(e){this.logger.warn(exports.LogTagId.L_PARSE_JSON_E,JSON.stringify({error:null==e?void 0:e.stack}),n)}return{isOk:!0,itv:s,level:d,logSwitch:u}}))}realtimeReport(e,n,r,s){return t(this,void 0,void 0,(function*(){const t=Date.now(),o=this.logDB.getTimestamp4RealtimeLog()||Ye,i=Math.max(t-3e4,o+1),a=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:o,endTime:i,level:n,itv:r}),a);const{dbReady:l,logs:d}=yield this.logDB.getLogs(o,i,n,!0,s);if(l){if(0===d.length)this.logger.debug(exports.LogTagId.L_REALTIME_LOG_R,"no logs",a);else if(d.length>0){const{itv:t,level:s,logSwitch:o,isOk:i}=yield this._sendLogs2Realtime(d,a,e,r);if(i){const e=Math.max(...d.map((e=>e.time)));this.logDB.setTimestamp4RealtimeLog(e+1),0===o&&(this.started=!1),void 0!==s&&(n=s)}r=t}}else this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"get logs failed",a);this.started&&(r>=60&&this.itvByNavi<60&&(r=60),this.timer=setTimeout((()=>this.realtimeReport(e,n,r,s)),1e3*r))}))}report(e,n,r,s,o,i,a=!1){return t(this,void 0,void 0,(function*(){if("web"!==r.toLowerCase()||this.disableLogReport)return;const t=this.logger.createTraceId();this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:n,logId:o,messageUId:i,isCloudControl:a}),t);const{dbReady:l,logs:d}=yield this.logDB.getLogs(e,n,exports.LogL.DEBUG,!1);this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:d.length}),t);let u,c=dt(s)?s:`https://${s}`;if(c+=`?version=5.16.0-c-rtc-alpha.2&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.deviceId}&deviceInfo=${this.deviceInfo}&platform=Web&logId=${o}`,l)if(d.length>0){const{success:e,data:t}=yield this.compressLogs(d);u=e?t:"compress failed"}else u="no data";else u="no database";this.logger.debug(exports.LogTagId.L_REPORT_FULL_LOG_O,"compress done",t),a&&(c+="&source=cloud");const{status:h}=yield this.send({url:c,body:u,method:"POST"});this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_R,JSON.stringify({status:h}),t)}))}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}const zt=e=>{const{sessionId:t,level:n,loggerId:r,traceId:s,time:o,tag:i,type:a}=e;let{content:l}=e;et(l)||(l=JSON.stringify(l));let d=n<0?l||"":JSON.stringify({content:l,traceId:s,from:r});return d=`"${d.replace(/"/g,'""')}"`,`${t},${o},${a},${n},${i},${d}\n`};var en,tn,nn,rn;!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(en||(en={}));class sn{constructor(e){this.reporter=e,this.logId="",this.uploadTask=[],this.taskLock=!0}uploadLogCmdTask(e){this.uploadTask.push(e),this.enqueueTask()}reportLogCmdTask(e){var t,n,r,s;this.taskLock=!1;const o=null!==(t=e.startTime)&&void 0!==t?t:0,i=null!==(n=e.endTime)&&void 0!==n?n:0,a=null!==(r=e.platform)&&void 0!==r?r:"",l=null!==(s=e.uri)&&void 0!==s?s:"";e.logId!==this.logId&&""!==l&&(this.logId=e.logId,this.reporter.report(o,i,a,l,e.logId,"",!0).finally((()=>{this.taskLock=!0,this.uploadTask.length>0&&this.enqueueTask()})))}enqueueTask(){if(!this.taskLock)return;const e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}}class on{constructor(e,t,n){this.logger=e,this.appkey=t,this.reporter=n,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new sn(n)}init(){try{const e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):{timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}catch(e){this._cache={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache),this.setMRTRConfig(this._handleMrtrData(this._cache.mrtr)))}isExire(){return(new Date).getTime()-this.timestamp<this.expire}isOverclock(){return(new Date).getTime()-this.lastRequestTime<this.interval}logCmdMsgTasks(e){if(e.uploadLog){const{tasks:t}=e.uploadLog;t.forEach((e=>{e.objectName===exports.MessageType.LOG_COMMAND&&this.uploadTaskManage.uploadLogCmdTask(e)}))}}dataHandle(e){const t=this._cache;t.lastRequestTime=this.lastRequestTime,ut(e)&&(t.timestamp=e.timestamp,e.uploadLog&&!e.uploadLog.temporary&&(t.uploadLog=e.uploadLog),e.cc&&!e.cc.temporary&&(t.cc=e.cc),e.mrtr&&!e.mrtr.temporary&&(t.mrtr=this._handleMrtrData(e.mrtr)),e.mrtr&&this.setMRTRConfig(this._handleMrtrData(e.mrtr))),this.setCloudControllerCache(t),this.expire=t.cc.expire,this.interval=t.cc.interval,this.timestamp=t.timestamp,this.logCmdMsgTasks(e)}request(e,n,r){return t(this,void 0,void 0,(function*(){if(!this.isEable&&n===en.init&&this.isExire())return this.logger.info(exports.LogTagId.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),this.timestamp;if(!this.isEable&&n===en.newWorkChange&&this.isOverclock())return this.logger.info(exports.LogTagId.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),this.timestamp;const t=kt(e);this.lastRequestTime=(new Date).getTime();const s=`${t}/v1/config`,o={"Content-Type":"application/json","RC-App-Key":this.appkey};r&&(o["RC-Token"]=r);const i={platform:"web",version:"5.16.0-c-rtc-alpha.2",timestamp:this.timestamp};this.logger.record(oe.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!r,uri:s}));const{code:a,data:l}=yield this.httpRequest(s,exports.HttpMethod.POST,o,i);if(this.logger.record(oe.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:l})),a===exports.ErrorCode.CLOUD_DATA_CENTER_INVALID&&l&&l.targetRegion){const e=l.targetRegion;if(this.changeAreaCode===e)return this.timestamp;const t=Wt.setAreaCode(e);this.logger.info(exports.LogTagId.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:t,originAreaCode:Wt.getAreaCode(),newAreaCode:e})),this.changeAreaCode=e;const n=Wt.getCloudControllerUrl(e);return n[0]?this.request(n[0],en.other):(this.logger.info(exports.LogTagId.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:s,msg:"appkey region error"})),this.timestamp)}return l&&this.dataHandle(l),this.timestamp||this.lastRequestTime}))}_handleMrtrData(e){return{chatroom:(null==e?void 0:e.chatroom)||0,group:(null==e?void 0:e.group)||0,private:(null==e?void 0:e.private)||0,ultraGroup:(null==e?void 0:e.ultraGroup)||0,temporary:!!(null==e?void 0:e.temporary)}}}const an=e=>e===exports.ErrorCode.RC_CONN_REDIRECTED;class ln{constructor(e,t,n,r){this.appkey=e,this.navi=t,this.logger=n,this.listener=r,tn.add(this),this.token="",this.curCmpUrl="",this.retryCount=0,this.uuid="",rn.set(this,0),this._doConnectReason=0,this._network={status:!0,type:Ie.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=exports.RCConnectionStatus.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}getToken(){return this.token}get cid(){return`${this.uuid}_${this.retryCount}`}getCurrentUserId(){return this._crtUserId}setConnectionStatus(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus===exports.RCConnectionStatus.DISCONNECTED&&e===exports.RCConnectionStatus.CONNECTING&&(this._doConnectReason=_e.CONNECT,n(this,tn,"m",nn).call(this)),this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED&&e===exports.RCConnectionStatus.SUSPENDED&&(t===exports.ErrorCode.RC_PING_EXCEED_LIMIT?this._doConnectReason=_e.TIMEOUT:t===exports.ErrorCode.RC_CONN_REDIRECTED?this._doConnectReason=_e.REDIRECTED:this._doConnectReason=_e.RECONNECT),this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED){const r={bid:Ft(),cod:t,net:this.getNetwork().type,dur:Date.now()-n(this,rn,"f"),cid:this.cid};this.logger.record(oe.IM_CONNECTION_DURATION,JSON.stringify(r)),e===exports.RCConnectionStatus.SUSPENDED&&n(this,tn,"m",nn).call(this)}switch(this._crtConnectionStatus=e,e){case exports.RCConnectionStatus.CONNECTED:this.logger.info(exports.LogTagId.L_CONNECT_S,`status: ${e}`),this.checkAlive(),this.listener.onConnected();break;case exports.RCConnectionStatus.CONNECTING:this.logger.warn(exports.LogTagId.L_CONNECT_S,`status: ${e}`),this.listener.onConnecting();break;case exports.RCConnectionStatus.SUSPENDED:this.logger.warn(exports.LogTagId.L_CONNECT_S,`status: ${e}, code: ${t}`),an(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(exports.LogTagId.L_CONNECT_S,`status: ${e}, code: ${t}`),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(t)}}}getConnectionStatus(){return this._crtConnectionStatus}setNetwork(e,t){if(!t){const t={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(oe.IM_NETWORK_CHANGE,JSON.stringify(t))}this._network=e}getNetwork(){return this._network}connect(e,n,r,s){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED)return $e(this._crtUserId);if(this._crtConnectionTask)return this._crtConnectionTask;this._openCallPlus=r,this.token=e,this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING);const{code:t,data:o}=yield this.try2Connect(e,n,!1,s,!0);return t!==exports.ErrorCode.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,t),Je(t)):(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),$e(o))}))}try2Connect(e,n,r,s,o){return t(this,void 0,void 0,(function*(){if(this._crtConnectionTask)return this._crtConnectionTask;this._crtConnectionTask=this.createConnectionTask(e,n,r,s,o);const t=yield this._crtConnectionTask;return this._crtConnectionTask=null,t}))}createConnectionTask(e,n,s,o,i){return t(this,void 0,void 0,(function*(){const t={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0};this.logger.record(oe.IM_STATS_CS,JSON.stringify(t));const a={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},{code:l,data:d}=yield this.navi.request(e,s,!1,o,a);if(l!==exports.ErrorCode.SUCCESS)return Je(l);const u=d;if(1===u.type)return Je(exports.ErrorCode.PACKAGE_ENVIRONMENT_ERROR);this.logger.info(exports.LogTagId.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:n}),o);const{code:c,data:h}=yield this.connectWithToken(e.replace(/@.+$/,"@"),u,n,o);if(i||c===exports.ErrorCode.SUCCESS||(this.retryCount+=1),an(c))return this.logger.warn(exports.LogTagId.L_CONNECT_R,`redirect code: ${c}`,o),this.clearCmpWeightCache(),this.createConnectionTask(e,n,!0,o,i);if([exports.ErrorCode.RC_TCP_RESET,exports.ErrorCode.RC_CONN_ACK_TIMEOUT,exports.ErrorCode.RC_TCP_DISCONNECTED_NO_RMTP].includes(c)&&this.cmpWeightCache&&this.cmpWeightCache.length>1){this.updateCmpWeight(this.curCmpUrl,!1);const t=this.cmpWeightCache.every((e=>e.failed));return i&&t?(this.logger.warn(exports.LogTagId.L_CONNECT_R,`cpp code:${c},reture code:${exports.ErrorCode.SERVER_UNAVAILABLE}`,o),Je(exports.ErrorCode.SERVER_UNAVAILABLE)):(this.logger.warn(exports.LogTagId.L_CONNECT_R,`cmp ack timeout, code: ${c}`,o),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,c),this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),this.createConnectionTask(e,n,!1,o,i))}return c!==exports.ErrorCode.SUCCESS?(this.logger.warn(exports.LogTagId.L_CONNECT_R,`code: ${c}`,o),Je(c)):(this.logger.info(exports.LogTagId.L_CONNECT_R,`userId: ${h}`,o),r(this,rn,Date.now(),"f"),this._crtUserId=h,$e(h))}))}try2Reconnect(e,n){return t(this,void 0,void 0,(function*(){const r=this.logger.createTraceId();this.logger.debug(exports.LogTagId.T,`try2Reconnect -> ignoreNaviCache: ${e}, reason: ${n}`,r),this.stopReconnectTimer();const s=()=>t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==exports.RCConnectionStatus.SUSPENDED)return;this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING,n);const{code:t}=yield this.try2Connect(this.token,!0,e,r,!1);this.reconnectTimer=null,t!==exports.ErrorCode.SUCCESS?[exports.ErrorCode.SERVER_UNAVAILABLE,exports.ErrorCode.TIMEOUT,exports.ErrorCode.RC_SOCKET_DISCONNECTED,exports.ErrorCode.RC_SOCKET_NOT_CREATED,exports.ErrorCode.RC_CONN_ACK_TIMEOUT,exports.ErrorCode.RC_TCP_RESET,exports.ErrorCode.RC_NAVI_REQ_FAILED,exports.ErrorCode.RC_NETWORK_DOWN,exports.ErrorCode.RC_TCP_DISCONNECTED_NO_RMTP].includes(t)?this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTING&&(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,t),this.reconnectTimer=setTimeout(s,5e3)):this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,t):this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED)}));s()}))}onDisconnectByServer(e,t){return an(e)?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===exports.ErrorCode.RC_UDP_DISCONNECTED?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void setTimeout((()=>{this.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,e)}onDisconenctUnusual(e){this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),this.try2Reconnect(!1,e)}checkAlive(){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED)return this._failedCount=0,void this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_S,"stop ping because of no connection");const e=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_T,null,e);const t=yield this.sendPing(15e3);if(t===exports.ErrorCode.SUCCESS)return this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,void(this._checkAliveTimer=setTimeout((()=>this.checkAlive()),15e3));if(this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED){if(this._failedCount+=1,this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_R,`code: ${t}, count: ${this._failedCount}`,e),this._failedCount<this.ALLOW_FAILED_TIMES)return this.checkAlive();this._failedCount=0,this.logger.warn(exports.LogTagId.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,exports.ErrorCode.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,exports.ErrorCode.RC_PING_EXCEED_LIMIT)}}))}disconnect(e){return t(this,void 0,void 0,(function*(){this.stopReconnectTimer(),this._crtConnectionTask&&(yield this._crtConnectionTask),this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,exports.ErrorCode.ACTIVE_DISCONNECT),this.close(!1,e)}))}stopReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}getCmpList(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return[...this.cmpWeightCache];const n=At(e,t);return this.cmpWeightCache=[...n],[...n]}updateCmpWeight(e,t,n){if(!this.cmpWeightCache)return;const r=this.cmpWeightCache.find((t=>n?t.addr===e&&t.protocol===V.QUIC:t.addr===e));if(r)if(t){const e=Math.max(...this.cmpWeightCache.map((e=>e.weight)));r.weight!==e&&(r.weight=e+1)}else{const e=Math.min(...this.cmpWeightCache.map((e=>e.weight)));r.weight!==e&&(r.weight=e-1),r.failed=!0}}clearCmpWeightCache(){this.cmpWeightCache=void 0}reconnect(e,t,n,r){this.token=e,this._openCallPlus=n,this.onDisconenctUnusual(r)}}rn=new WeakMap,tn=new WeakSet,nn=function(){this.uuid=He.gen(),this.retryCount=0};const dn=e=>e.replace(/@.+$/,"@");class un{constructor(e,t,n,r=!0,s=!0){this.appkey=e,this.logger=t,this.staticConfigManager=n,this.isRequestProfile=r,this.isUseDynamicNaviUrl=s,this.crtRequest=null,this._environment="default"}getCatchKey(e){return e+(this._environment?`-${this._environment}`:"")}request(e,n,r,s,o){return t(this,void 0,void 0,(function*(){if(this.crtRequest)return this.crtRequest;this.crtRequest=this.sendRequest(e,n,r,s,o);const t=yield this.crtRequest;return this.crtRequest=null,t}))}sendRequest(e,n,r,s,o){var i;return t(this,void 0,void 0,(function*(){const t=dn(e),a=this.getNaviCache(t);if(!n&&a){const{timestamp:e,naviInfo:t}=a;if(r||Date.now()-e<fe){if(this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:t}),s),o){const{uuid:e,retryCount:n,reason:r}=o,a={bid:Ft(),ptc:ue.NAVI,cod:exports.ErrorCode.SUCCESS,net:o.type,dur:0,spr:0,pr:null!==(i=t.type)&&void 0!==i?i:0,hos:"",cache:ce.LOCAL,v:he.CURRENT,rsn:r,cid:`${e}_${n}`,count:n};this.logger.record(oe.IM_NAVI,JSON.stringify(a),s)}return $e(t)}}const l=Wt.getNaviUrlList(e,this.isUseDynamicNaviUrl);this.logger.info(exports.LogTagId.L_GET_NAVI_T,JSON.stringify({token:e,uris:l}),s);let{code:d,data:u}=yield this.requestHandler(l,e,s,o);if(d===exports.ErrorCode.RC_NAVI_REQ_FAILED&&this.isRequestProfile){const t=yield this.staticConfigManager.getStaticConfig();if((null==t?void 0:t.navi)&&(null==t?void 0:t.navi.length)>0){const{navi:n}=t,r=yield this.requestHandler(n,e,s,o);d=r.code,u=r.data}}if(d!==exports.ErrorCode.SUCCESS)return this.logger.warn(exports.LogTagId.L_GET_NAVI_R,d,s),Je(d);const c=u;if(c.code&&200!==c.code)return this.logger.warn(exports.LogTagId.L_GET_NAVI_R,c.code,s),Je(this.transHttpCode(c.code));if(!(At(c).length>0)){const e={server:c.server,backupServer:c.backupServer,serverAddr:c.serverAddr,bs:c.bs};return this.logger.warn(exports.LogTagId.L_GET_NAVI_R,`navi server address invalid: ${JSON.stringify(e)}`,s),Je(exports.ErrorCode.SERVER_UNAVAILABLE)}return this.logger.info(exports.LogTagId.L_GET_NAVI_R,JSON.stringify({naviInfo:c}),s),this.setNaviCache(t,c),$e(c)}))}requestHandler(e,n,r,s){return t(this,void 0,void 0,(function*(){for(let t=0,o=e.length;t<o;t+=1){const o=t===e.length-1,i=this.useV2Navi()?this.httpRequestV2:this.httpRequest,a=Date.now(),{code:l,data:d}=yield i.call(this,e[t],this.appkey,n,r,o),u={bid:Ft(),ptc:ue.NAVI,cod:l,net:null==s?void 0:s.type,dur:Date.now()-a,spr:0,pr:(null==d?void 0:d.type)||0,hos:e[t],cache:ce.REQUEST,v:he.CURRENT,rsn:null==s?void 0:s.reason,cid:`${null==s?void 0:s.uuid}_${null==s?void 0:s.retryCount}`,count:null==s?void 0:s.retryCount};if(this.logger.record(oe.IM_NAVI,JSON.stringify(u),r),[exports.ErrorCode.SUCCESS,exports.ErrorCode.RC_CONN_TOKEN_INCORRECT,exports.ErrorCode.RC_LICENSE_EXPIRED].includes(l))return l===exports.ErrorCode.SUCCESS?$e(d):Je(l)}return Je(exports.ErrorCode.RC_NAVI_REQ_FAILED)}))}transHttpCode(e){switch(e){case 401:case 403:return exports.ErrorCode.RC_CONN_TOKEN_INCORRECT;case 416:return exports.ErrorCode.RC_LICENSE_EXPIRED;default:return exports.ErrorCode.RC_NAVI_REQ_FAILED}}getNaviInfoFromCache(e){const t=this.getNaviCache(dn(e));return t?t.naviInfo:null}updateVoipCallInfo(e,t){const n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(dn(e),Object.assign(Object.assign({},n),{voipCallInfo:t}))}getNaviV2RequestOption(e){const{uri:t,token:n,platform:r,protocol:s,mac:o}=e;let i="";i=`${t}/v2/navi.json?cloud=0`;let a=`token=${encodeURIComponent(n)}&version=5.16.0-c-rtc-alpha.2&platfrom=${r}`;return o&&(a+=`&m=${o}`),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":`conn=${s};rtc=4;log=2;iptype=v4,v6`},body:a,url:i,timeout:1e4}}useV2Navi(){return!0}}const cn=()=>!("undefined"==typeof uni||!(e=>{const t=["request","getSystemInfo"];for(let n=0,r=t.length;n<r;n++)if(!e[t[n]])return!1;return!0})(uni));var hn,pn,_n;class gn{constructor(e){hn.add(this),pn.set(this,void 0),r(this,pn,e,"f"),this._logger=e.logger}open(e){return t(this,void 0,void 0,(function*(){return e=e.sort(((e,t)=>t.weight-e.weight)),n(this,hn,"m",_n).call(this,e,n(this,pn,"f"))}))}}pn=new WeakMap,hn=new WeakSet,_n=function e(r,s){return t(this,void 0,void 0,(function*(){if(0===r.length)return Je(exports.ErrorCode.STREAM_MESSAGE_REQUEST_FAIL,"All addrs failed");const o=r.shift();let i=kt(o.addr,o.protocol);i=`${i}/v3/message/get_stream.json?sdkVersion=5.16.0-c-rtc-alpha.2&platform=${this._platform}&messageUID=${s.msgUId}`;const a=yield this._openHandler(i,s);return a.or((o=>t(this,void 0,void 0,(function*(){return-1===o?n(this,hn,"m",e).call(this,r,s):a}))))}))};const En=cn();let In=null;const Tn=e=>t(void 0,void 0,void 0,(function*(){const t=yield Cn.getNetworkType();In({status:"online"===e.type,type:t})}));class fn extends gn{constructor(){super(...arguments),this._platform="Websocket"}_openHandler(e,n){return t(this,void 0,void 0,(function*(){return new Promise((t=>{this._logger.debug(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_O,`try open -> ${e}`);const r=new XMLHttpRequest;r.open("GET",e,!0),r.timeout=n.timeout,r.ontimeout=()=>{this._logger.warn(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_E,`timeout -> ${e}`),t(Je(-1,"timeout"))},r.onreadystatechange=s=>{if(r.readyState!==XMLHttpRequest.HEADERS_RECEIVED)return;const o=r.getResponseHeader("Content-Type"),i=null==o?void 0:o.startsWith("text/event-stream");if(200!==r.status||!i)return void(r.onloadend=()=>{const e=JSON.parse(r.response);t(Je(e.code,e.message))});t($e());let a=0;r.onprogress=e=>{const t=r.response.slice(a);a=r.response.length,n.onRawContent(t)},r.onerror=t=>{this._logger.warn(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_E,`network error in transit -> ${e}`),r.onprogress=null,r.abort(),n.onNetworkError(exports.ErrorCode.STREAM_MESSAGE_REQUEST_FAIL)}},r.onerror=n=>{this._logger.warn(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_E,`req fail -> ${e}`),t(Je(-1))},r.setRequestHeader("Content-Type","application/json;charset=UTF-8"),r.setRequestHeader("App-Key",n.appkey),r.setRequestHeader("Authorization",`Bearer ${n.token}`),r.send()}))}))}}const Cn={tag:"browser",httpReq:e=>qt(e).result(),localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:En,createWebSocket:function(e,t){const n=new WebSocket(e,t);return n.binaryType="arraybuffer",{id:Date.now(),onClose(e){n.onclose=t=>{const{code:n,reason:r}=t;e(n,r)}},onError(e){n.onerror=e},onMessage(e){n.onmessage=t=>{e(t.data)}},onOpen(e){n.onopen=e},send(e){n.send(e)},close(e,t){n.close()}}},getNetworkType(){const{type:e,effectiveType:t}=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:Ie.UNKONWN},n=e||t||Ie.UNKONWN;return Promise.resolve(n)},setNetworkStatusListener:function(e){In=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",Tn),window.addEventListener("online",Tn))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",Tn),window.removeEventListener("online",Tn)),In=null},createSSEClient:e=>$e(new fn(e))},Rn=cn(),Sn=e=>(...t)=>{try{return wx[e](...t)}catch(e){null===console||void 0===console||console.error(e)}},mn={setItem:Sn("setStorageSync"),getItem:Sn("getStorageSync"),removeItem:Sn("removeStorageSync"),clear:Sn("clearStorageSync")};let yn=null;const vn=e=>{const{isConnected:t,networkType:n}=e;yn({status:t,type:n})};const An={tag:"wechat",httpReq(e){const t=e.method||exports.HttpMethod.GET,n=e.timeout||Ce,{headers:r,query:s,body:o}=e,i=xt(e.url,s);return new Promise((e=>{wx.request({url:i,method:t,header:r,timeout:n,data:o,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:mn,sessionStorage:mn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Rn,createWebSocket(e,t){const n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose(e){n.onClose((t=>{e(t.code,t.reason)}))},onError(e){n.onError((t=>{e(t.errMsg)}))},onMessage(e){n.onMessage((t=>{e(t.data)}))},onOpen(e){n.onOpen(e)},send(e){n.send({data:e})},close(e,t){n.close({code:e,reason:t})}}},getNetworkType:()=>new Promise((e=>{wx.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ie.UNKONWN)}})})),setNetworkStatusListener:function(e){yn=e,wx.onNetworkStatusChange(vn)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(vn),yn=null},createSSEClient:e=>Je(exports.ErrorCode.NOT_SUPPORT)},Nn=cn(),On=e=>(...t)=>{try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});const{data:n}=my[e]({key:t[0]});return n?JSON.stringify(n):n}catch(e){}},Mn={setItem:On("setStorageSync"),getItem:On("getStorageSync"),removeItem:On("removeStorageSync"),clear:On("clearStorageSync")};let Ln=null;const Un=e=>{const{isConnected:t,networkType:n}=e;Ln({status:t,type:n})};const Pn={tag:"alipay",httpReq(e){const t=e.method||exports.HttpMethod.GET,n=e.timeout||Ce,{headers:r,query:s,body:o}=e,i=xt(e.url,s),a=e.dataType||"json";return new Promise((e=>{my.request({url:i,method:t,headers:r,timeout:n,data:o,dataType:a,success:t=>{e({data:t.data,status:t.status})},fail:()=>{e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:Mn,sessionStorage:Mn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Nn,createWebSocket(e){const t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose(e){t.onClose(e)},onError(e){t.onError((t=>{e(t.errMsg)}))},onMessage(e){t.onMessage((t=>{t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen(e){t.onOpen(e)},send(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close(){t.close()}}},getNetworkType:()=>new Promise((e=>{my.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ie.UNKONWN)}})})),setNetworkStatusListener:function(e){Ln=e,my.onNetworkStatusChange(Un)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(Un),Ln=null},createSSEClient:e=>Je(exports.ErrorCode.NOT_SUPPORT,"Not supported yet")},bn=cn(),xn=e=>(...t)=>{try{return tt[e](...t)}catch(e){}},Dn={setItem:xn("setStorageSync"),getItem:xn("getStorageSync"),removeItem:xn("removeStorageSync"),clear:xn("clearStorageSync")};let wn=null;const Vn=e=>{const{isConnected:t,networkType:n}=e;wn({status:t,type:n})};const Gn={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:bn,localStorage:Dn,sessionStorage:Dn,httpReq:e=>new Promise((t=>{tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail(e){t({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})})),createWebSocket(e,t){const n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen(e){n.onOpen(e)},onClose(e){n.onClose((t=>e(t.code,t.reason)))},onError(e){n.onError((t=>e(t.errMsg)))},onMessage(e){n.onMessage((t=>e(t.data)))},send(e){n.send({data:e})},close(e,t){n.close({code:e,reason:t})}}},getNetworkType:()=>new Promise((e=>{tt.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ie.UNKONWN)}})})),setNetworkStatusListener:function(e){wn=e,tt.onNetworkStatusChange(Vn)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(Vn),wn=null},createSSEClient:e=>Je(exports.ErrorCode.NOT_SUPPORT)},Fn=cn(),Bn=e=>(...t)=>{try{return swan[e](...t)}catch(e){}},kn={setItem:Bn("setStorageSync"),getItem:Bn("getStorageSync"),removeItem:Bn("removeStorageSync"),clear:Bn("clearStorageSync")};let Hn=null;const qn=e=>{const{isConnected:t,networkType:n}=e;Hn({status:t,type:n})};const Yn={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Fn,localStorage:kn,sessionStorage:kn,httpReq:e=>new Promise((t=>{swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail(e){t({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})})),createWebSocket(e,t){const n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen(e){n.onOpen(e)},onClose(e){n.onClose((t=>e(t.code,t.reason)))},onError(e){n.onError((t=>e(t.errMsg)))},onMessage(e){n.onMessage((t=>e(t.data)))},send(e){n.send({data:e})},close(e,t){n.close({code:e,reason:t})}}},getNetworkType(){return t(this,void 0,void 0,(function*(){return new Promise((e=>{swan.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ie.UNKONWN)}})}))}))},setNetworkStatusListener:function(e){Hn=e,swan.onNetworkStatusChange(qn)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(qn),Hn=null},createSSEClient:e=>Je(exports.ErrorCode.NOT_SUPPORT)},Kn=cn(),jn=e=>(...t)=>{try{return jd[e](...t)}catch(e){null===console||void 0===console||console.error(e)}},Qn={setItem:jn("setStorageSync"),getItem:jn("getStorageSync"),removeItem:jn("removeStorageSync"),clear:jn("clearStorageSync")};let Wn=null;const $n=e=>{const{isConnected:t,networkType:n}=e;Wn({status:t,type:n})};const Jn={tag:"jingdong",httpReq(e){const t=e.method||exports.HttpMethod.GET,n=e.timeout||Ce,{headers:r,query:s,body:o}=e,i=xt(e.url,s);return new Promise((e=>{jd.request({url:i,method:t,header:r,timeout:n,data:o,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:Qn,sessionStorage:Qn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Kn,createWebSocket:(e,t)=>(jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose(e){jd.onSocketClose((t=>{e(t.code,t.reason)}))},onError(e){jd.onSocketError((t=>{e(t.errMsg)}))},onMessage(e){jd.onSocketMessage((t=>{e(t.data)}))},onOpen(e){jd.onSocketOpen(e)},send(e){jd.sendSocketMessage({data:e})},close(e,t){jd.closeSocket({code:e,reason:t})}}),getNetworkType:()=>new Promise((e=>{jd.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ie.UNKONWN)}})})),setNetworkStatusListener:function(e){Wn=e,jd.onNetworkStatusChange($n)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange($n),Wn=null},createSSEClient:e=>Je(exports.ErrorCode.NOT_SUPPORT)},Xn=e=>(...t)=>{try{return uni[e](...t)}catch(e){null===console||void 0===console||console.error(e)}},Zn={setItem:Xn("setStorageSync"),getItem:Xn("getStorageSync"),removeItem:Xn("removeStorageSync"),clear:Xn("clearStorageSync")};let zn=null;const er=e=>{const{isConnected:t,networkType:n}=e;zn({status:t,type:n})};const tr={tag:"uniapp",httpReq(e){const t=e.method||exports.HttpMethod.GET,n=e.timeout||Ce,{headers:r,query:s,body:o}=e,i=xt(e.url,s);return new Promise((e=>{uni.request({url:i,method:t,header:r,timeout:n,data:o,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:Zn,sessionStorage:Zn,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket(e,t){const n={complete(){},url:e,protocols:t},r=uni.connectSocket(n);return{id:Date.now(),onClose(e){r.onClose((t=>{e(t.code,t.reason)}))},onError(e){r.onError((t=>{e(t.errMsg)}))},onMessage(e){r.onMessage((t=>{e(t.data)}))},onOpen(e){r.onOpen(e)},send(e){r.send({data:e})},close(e,t){r.close({code:e,reason:t})}}},getNetworkType:()=>new Promise((e=>{uni.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ie.UNKONWN)}})})),setNetworkStatusListener:function(e){zn=e,uni.onNetworkStatusChange(er)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(er),zn=null},createSSEClient:e=>Je(exports.ErrorCode.NOT_SUPPORT)},nr=e=>e&&e.request&&e.getSystemInfo,rr="undefined"!=typeof uni&&nr(uni)?(()=>{switch(process.env.VUE_APP_PLATFORM){case"app-plus":case"app":return tr;case"mp-jd":return Jn;case"mp-baidu":return Yn;case"mp-toutiao":return Gn;case"mp-alipay":return Pn;case"mp-weixin":return An;default:return Cn}})():"undefined"!=typeof jd&&nr(jd)?Jn:"undefined"!=typeof my&&nr(my)?Pn:"undefined"!=typeof tt&&nr(tt)?Gn:"undefined"!=typeof swan&&nr(swan)?Yn:"undefined"!=typeof wx&&nr(wx)?An:Cn;function sr(e){var t=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,o;return t?(o=(e>>>=0)>=0&&e<256)&&(r=l[e])?r:(n=s(e,(0|e)<0?-1:0,!0),o&&(l[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=s(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?g:_;if(t){if(e<0)return g;if(e>=c)return C}else{if(-h>=e)return R;if(e+1>=h)return f}return e<0?r(-e,t).neg():s(0|e%u,0|e/u,t)}function s(t,n,r){return new e(t,n,r)}function o(e,t,n){var s,i,a,l,u,c,h;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return _;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((s=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===s)return o(e.substring(1),t,n).neg();for(i=r(d(n,8)),a=_,l=0;l<e.length;l+=8)u=Math.min(8,e.length-l),c=parseInt(e.substring(l,l+u),n),u<8?(h=r(d(n,u)),a=a.mul(h).add(r(c))):a=(a=a.mul(i)).add(r(c));return a.unsigned=t,a}function i(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):s(t.low,t.high,t.unsigned)}var a,l,d,u,c,h,p,_,g,E,I,T,f,C,R,S;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},l={},e.fromInt=n,e.fromNumber=r,e.fromBits=s,d=Math.pow,e.fromString=o,e.fromValue=i,h=(c=(u=4294967296)*u)/2,p=n(16777216),_=n(0),e.ZERO=_,g=n(0,!0),e.UZERO=g,E=n(1),e.ONE=E,I=n(1,!0),e.UONE=I,T=n(-1),e.NEG_ONE=T,f=s(-1,2147483647,!1),e.MAX_VALUE=f,C=s(-1,-1,!0),e.MAX_UNSIGNED_VALUE=C,R=s(0,-2147483648,!1),e.MIN_VALUE=R,(S=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},S.toString=function(e){var t,n,s,o,i,a,l,u;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(R)?(t=r(e),s=(n=this.div(t)).mul(t).sub(this),n.toString(e)+s.toInt().toString(e)):"-"+this.neg().toString(e);for(o=r(d(e,6),this.unsigned),i=this,a="";;){if(l=i.div(o),u=(i.sub(l.mul(o)).toInt()>>>0).toString(e),(i=l).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(R)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},S.isZero=function(){return 0===this.high&&0===this.low},S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return!(1&~this.low)},S.isEven=function(){return!(1&this.low)},S.equals=function(e){return t(e)||(e=i(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.compare=function(e){if(t(e)||(e=i(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(E)},S.neg=S.negate,S.add=function(e){var n,r,o,a,l,d,u,c,h,p,_;return t(e)||(e=i(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,l=e.high>>>16,d=65535&e.high,u=e.low>>>16,c=0,h=0,p=0,_=0,p+=(_+=a+(65535&e.low))>>>16,h+=(p+=o+u)>>>16,c+=(h+=r+d)>>>16,c+=n+l,s((p&=65535)<<16|(_&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},S.subtract=function(e){return t(e)||(e=i(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){var n,o,a,l,d,u,c,h,g,E,I,T;return this.isZero()?_:(t(e)||(e=i(e)),e.isZero()?_:this.eq(R)?e.isOdd()?R:_:e.eq(R)?this.isOdd()?R:_:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(p)&&e.lt(p)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,l=65535&this.low,d=e.high>>>16,u=65535&e.high,c=e.low>>>16,g=0,E=0,I=0,T=0,I+=(T+=l*(h=65535&e.low))>>>16,E+=(I+=a*h)>>>16,I&=65535,E+=(I+=l*c)>>>16,g+=(E+=o*h)>>>16,E&=65535,g+=(E+=a*c)>>>16,E&=65535,g+=(E+=l*u)>>>16,g+=n*h+o*c+a*u+l*d,s((I&=65535)<<16|(T&=65535),(g&=65535)<<16|(E&=65535),this.unsigned)))},S.mul=S.multiply,S.divide=function(e){var n,s,o,a,l,u,c;if(t(e)||(e=i(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:_;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return I;o=g}else{if(this.eq(R))return e.eq(E)||e.eq(T)?R:e.eq(R)?E:(n=this.shr(1).div(e).shl(1)).eq(_)?e.isNegative()?E:T:(s=this.sub(e.mul(n)),o=n.add(s.div(e)));if(e.eq(R))return this.unsigned?g:_;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=_}for(s=this;s.gte(e);){for(n=Math.max(1,Math.floor(s.toNumber()/e.toNumber())),l=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:d(2,a-48),c=(u=r(n)).mul(e);c.isNegative()||c.gt(s);)c=(u=r(n-=l,this.unsigned)).mul(e);u.isZero()&&(u=E),o=o.add(u),s=s.sub(c)}return o},S.div=S.divide,S.modulo=function(e){return t(e)||(e=i(e)),this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.not=function(){return s(~this.low,~this.high,this.unsigned)},S.and=function(e){return t(e)||(e=i(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return t(e)||(e=i(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return t(e)||(e=i(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},S.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):s(0,this.low<<e-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0===(e&=63)?this:(n=this.high,e<32?s(this.low>>>e|n<<32-e,n>>>e,this.unsigned):s(32===e?n:n>>>e-32,0,this.unsigned))},S.shru=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.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]},S.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}(),n=function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,s){var o,i,a=8*s-r-1,l=(1<<a)-1,d=l>>1,u=-7,c=n?s-1:0,h=n?-1:1,p=e[t+c];for(c+=h,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+c],c+=h,u-=8);for(i=o&(1<<-u)-1,o>>=-u,u+=r;u>0;i=256*i+e[t+c],c+=h,u-=8);if(0===o)o=1-d;else{if(o===l)return i?NaN:1/0*(p?-1:1);i+=Math.pow(2,r),o-=d}return(p?-1:1)*i*Math.pow(2,o-r)}function s(e,t,n,r,s,o){var i,a,l,d=8*o-s-1,u=(1<<d)-1,c=u>>1,h=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,_=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,i=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-i))<1&&(i--,l*=2),(t+=i+c>=1?h/l:h*Math.pow(2,1-c))*l>=2&&(i++,l/=2),i+c>=u?(a=0,i=u):i+c>=1?(a=(t*l-1)*Math.pow(2,s),i+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,s),i=0));s>=8;e[n+p]=255&a,p+=_,a/=256,s-=8);for(i=i<<s|a,d+=s;d>0;e[n+p]=255&i,p+=_,i/=256,d-=8);e[n+p-_]|=128*g}var o,i,a,l,d,u=function(e,t,n){if(void 0===e&&(e=u.DEFAULT_CAPACITY),void 0===t&&(t=u.DEFAULT_ENDIAN),void 0===n&&(n=u.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?i: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 u.VERSION="5.0.1",u.LITTLE_ENDIAN=!0,u.BIG_ENDIAN=!1,u.DEFAULT_CAPACITY=16,u.DEFAULT_ENDIAN=u.BIG_ENDIAN,u.DEFAULT_NOASSERT=!1,u.Long=e||null,(o=u.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),i=new ArrayBuffer(0),a=String.fromCharCode,u.accessor=function(){return Uint8Array},u.allocate=function(e,t,n){return new u(e,t,n)},u.concat=function(e,t,n,r){var s,o,i,a,l,d;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),s=0,i=0,a=e.length;a>i;++i)u.isByteBuffer(e[i])||(e[i]=u.wrap(e[i],t)),(o=e[i].limit-e[i].offset)>0&&(s+=o);if(0===s)return new u(0,n,r);for(d=new u(s,n,r),i=0;a>i;)(o=(l=e[i++]).limit-l.offset)<=0||(d.view.set(l.view.subarray(l.offset,l.limit),d.offset),d.offset+=o);return d.limit=d.offset,d.offset=0,d},u.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},u.type=function(){return ArrayBuffer},u.wrap=function(e,t,n,r){var s,i;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return u.fromBase64(e,n);case"hex":return u.fromHex(e,n);case"binary":return u.fromBinary(e,n);case"utf8":return u.fromUTF8(e,n);case"debug":return u.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(u.isByteBuffer(e))return(s=o.clone.call(e)).markedOffset=-1,s;if(e instanceof Uint8Array)s=new u(0,n,r),e.length>0&&(s.buffer=e.buffer,s.offset=e.byteOffset,s.limit=e.byteOffset+e.byteLength,s.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)s=new u(0,n,r),e.byteLength>0&&(s.buffer=e,s.offset=0,s.limit=e.byteLength,s.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((s=new u(e.length,n,r)).limit=e.length,i=0;i<e.length;++i)s.view[i]=e[i]}return s},o.writeBitSet=function(e,t){var n,r,s,o,i,a,l=void 0===t;if(l&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(r=t,o=(s=e.length)>>3,i=0,t+=this.writeVarint32(s,t);o--;)n=1&!!e[i++]|(1&!!e[i++])<<1|(1&!!e[i++])<<2|(1&!!e[i++])<<3|(1&!!e[i++])<<4|(1&!!e[i++])<<5|(1&!!e[i++])<<6|(1&!!e[i++])<<7,this.writeByte(n,t++);if(s>i){for(a=0,n=0;s>i;)n|=(1&!!e[i++])<<a++;this.writeByte(n,t++)}return l?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,s,o,i,a,l=void 0===e;for(l&&(e=this.offset),s=(r=(n=this.readVarint32(e)).value)>>3,o=0,i=[],e+=n.length;s--;)t=this.readByte(e++),i[o++]=!!(1&t),i[o++]=!!(2&t),i[o++]=!!(4&t),i[o++]=!!(8&t),i[o++]=!!(16&t),i[o++]=!!(32&t),i[o++]=!!(64&t),i[o++]=!!(128&t);if(r>o)for(a=0,t=this.readByte(e++);r>o;)i[o++]=!!(1&t>>a++);return l&&(this.offset=e),i},o.readBytes=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return!(128&~(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),!(32768&~t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var r,s,o,i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,s=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s,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&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s),i&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,r,s,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),s=new e(n,r,!1),o&&(this.offset+=8),s},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r,s,o,i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,s=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s,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&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s),i&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,r,s,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),s=new e(n,r,!0),o&&(this.offset+=8),s},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,s(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,s(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,u.MAX_VARINT32_BYTES=5,u.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},u.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},u.zigZagDecode32=function(e){return e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,r,s,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=r=u.calculateVarint32(e))>(s=this.buffer.byteLength)&&this.resize((s*=2)>t?s:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(u.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,r,s,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(s=Error("Truncated")).truncated=!0,s;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(128&t);return r|=0,o?(this.offset=e,r):{value:r,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=u.zigZagDecode32(t.value):t=u.zigZagDecode32(t),t},e&&(u.MAX_VARINT64_BYTES=10,u.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0;return 0==s?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:s<128?9:10},u.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()},u.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var r,s,o,i,a,l=void 0===n;if(l&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=u.calculateVarint64(t),s=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&i>>>7;case 9:this.view[n+8]=9!==r?128|i:127&i;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;case 4:this.view[n+3]=4!==r?128|s>>>21:127&s>>>21;case 3:this.view[n+2]=3!==r?128|s>>>14:127&s>>>14;case 2:this.view[n+1]=2!==r?128|s>>>7:127&s>>>7;case 1:this.view[n]=1!==r?128|s:127&s}return l?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(u.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,s,o,i,a,l=void 0===t;if(l&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,r=0,s=0,o=0,i=0,r=127&(i=this.view[t++]),128&i&&(r|=(127&(i=this.view[t++]))<<7,(128&i||this.noAssert&&void 0===i)&&(r|=(127&(i=this.view[t++]))<<14,(128&i||this.noAssert&&void 0===i)&&(r|=(127&(i=this.view[t++]))<<21,(128&i||this.noAssert&&void 0===i)&&(s=127&(i=this.view[t++]),(128&i||this.noAssert&&void 0===i)&&(s|=(127&(i=this.view[t++]))<<7,(128&i||this.noAssert&&void 0===i)&&(s|=(127&(i=this.view[t++]))<<14,(128&i||this.noAssert&&void 0===i)&&(s|=(127&(i=this.view[t++]))<<21,(128&i||this.noAssert&&void 0===i)&&(o=127&(i=this.view[t++]),(128&i||this.noAssert&&void 0===i)&&(o|=(127&(i=this.view[t++]))<<7,128&i||this.noAssert&&void 0===i))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|s<<28,s>>>4|o<<24,!1),l?(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=u.zigZagDecode64(n.value):n=u.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,s,o,i=void 0===n;if(i&&(n=this.offset),s=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;s>r;++r)if(0===e.charCodeAt(r))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return s=d.calculateUTF16asUTF8(t(e))[1],n+=s+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=s+1,d.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,i?(this.offset=n,this):s},o.readCString=function(e){var t,r,s,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,s=-1,d.decodeUTF8toUTF16(function(){if(0===s)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(s=this.view[e++])?null:s}.bind(this),r=n(),!0),o?(this.offset=e,r()):{string:r(),length:e-t}},o.writeIString=function(e,n){var r,s,o,i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(s=n,r=d.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+r,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r):(this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),n+=4,d.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return i?(this.offset=n,this):n-s},o.readIString=function(e){var t,n,r,s=void 0===e;if(s&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,u.METRICS_BYTES,e+=4),e+=r.length,s?(this.offset=e,r.string):{string:r.string,length:e-t}},u.METRICS_CHARS="c",u.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,s,o,i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return s=n,r=d.calculateUTF16asUTF8(t(e))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,d.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),i?(this.offset=n,this):n-s},o.writeString=o.writeUTF8String,u.calculateUTF8Chars=function(e){return d.calculateUTF16asUTF8(t(e))[0]},u.calculateUTF8Bytes=function(e){return d.calculateUTF16asUTF8(t(e))[1]},u.calculateString=u.calculateUTF8Bytes,o.readUTF8String=function(e,t,r){var s,o,i,a,l;if("number"==typeof t&&(r=t,t=void 0),(s=void 0===r)&&(r=this.offset),void 0===t&&(t=u.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(i=0,a=r,t===u.METRICS_CHARS){if(o=n(),d.decodeUTF8(function(){return e>i&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++i,d.UTF8toUTF16(e,o)})),i!==e)throw RangeError("Illegal range: Truncated data, "+i+" == "+e);return s?(this.offset=r,o()):{string:o(),length:r-a}}if(t===u.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(l=r+e,d.decodeUTF8toUTF16(function(){return l>r?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==l)throw RangeError("Illegal range: Truncated data, "+r+" == "+l);return s?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,s,o,i,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,r=d.calculateUTF16asUTF8(t(e),this.noAssert)[1],s=u.calculateVarint32(r),n+=s+r,i=this.buffer.byteLength,n>i&&this.resize((i*=2)>n?i:n),n-=s+r,n+=this.writeVarint32(r,n),d.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+r+s)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+s));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,r,s=void 0===e;if(s&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,u.METRICS_BYTES,e+=n.length),e+=r.length,s?(this.offset=e,r.string):{string:r.string,length:e-t}},o.append=function(e,t,n){var r,s,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof u||(e=u.wrap(e,t)),(s=e.limit-e.offset)<=0||((n+=s)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=s,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=s,r&&(this.offset+=s)),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 u(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,r,s;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=i,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(s=new Uint8Array(r)).set(this.view.subarray(e,t)),this.buffer=r,this.view=s,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 u(0,this.littleEndian,this.noAssert);var n=t-e,r=new u(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var s,o,i;if(!this.noAssert&&!u.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(s=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(i=r-n)?e:(e.ensureCapacity(t+i),e.view.set(this.view.subarray(n,r),t),s&&(this.offset+=i),o&&(e.offset+=i),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var r,s,o,i,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof u||(e=u.wrap(e,t)),(s=e.limit-e.offset)<=0||((o=s-n)>0?(i=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(i)).set(this.view.subarray(n,this.buffer.byteLength),s),this.buffer=i,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-s),e.offset=e.limit,r&&(this.offset-=s)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?i:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},l=function(){var e,t,n={},r=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],s=[];for(e=0,t=r.length;t>e;++e)s[r[e]]=e;return n.encode=function(e,t){for(var n,s;null!==(n=e());)t(r[63&n>>2]),s=(3&n)<<4,null!==(n=e())?(t(r[63&((s|=15&n>>4)|15&n>>4)]),s=(15&n)<<2,null!==(n=e())?(t(r[63&(s|3&n>>6)]),t(r[63&n])):(t(r[63&s]),t(61))):(t(r[63&s]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,o,i;null!==(r=e());)if(void 0===(o=s[r])&&n(r),null!==(r=e())&&(void 0===(i=s[r])&&n(r),t(o<<2>>>0|(48&i)>>4),null!==(r=e()))){if(void 0===(o=s[r])){if(61===r)break;n(r)}if(t((15&i)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(i=s[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|i)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return l.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},u.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new u(e.length/4*3,n),s=0;return l.decode(t(e),(function(e){r.view[s++]=e})),r.limit=s,r},u.btoa=function(e){return u.fromBinary(e).toBase64()},u.atob=function(e){return u.fromBase64(e).toBinary()},o.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},u.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,s=e.length,o=new u(s,t);s>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=s,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,s="",o="",i="";r>n;){if(-1!==n&&(s+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;s.length<51;)s+=" ";i+=s+o+"\n",s=o=""}s+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==s){for(;s.length<51;)s+=" ";i+=s+o+"\n"}return e?i:s},u.fromDebug=function(e,t,n){for(var r,s,o=e.length,i=new u(0|(o+1)/3,t,n),a=0,l=0,d=!1,c=!1,h=!1,p=!1,_=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(c||h||p){_=!0;break}c=h=p=!0}i.offset=i.markedOffset=i.limit=l,d=!1;break;case"|":if(!n){if(c||p){_=!0;break}c=p=!0}i.offset=i.limit=l,d=!1;break;case"[":if(!n){if(c||h){_=!0;break}c=h=!0}i.offset=i.markedOffset=l,d=!1;break;case"<":if(!n){if(c){_=!0;break}c=!0}i.offset=l,d=!1;break;case"]":if(!n){if(p||h){_=!0;break}p=h=!0}i.limit=i.markedOffset=l,d=!1;break;case">":if(!n){if(p){_=!0;break}p=!0}i.limit=l,d=!1;break;case"'":if(!n){if(h){_=!0;break}h=!0}i.markedOffset=l,d=!1;break;case" ":d=!1;break;default:if(!n&&d){_=!0;break}if(s=parseInt(r+e.charAt(a++),16),!n&&(isNaN(s)||s<0||s>255))throw TypeError("Illegal str: Not a debug encoded string");i.view[l++]=s,d=!0}if(_)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!c||!p)throw TypeError("Illegal str: Missing offset or limit");if(l<i.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+l+" < "+o)}return i},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},u.fromHex=function(e,t,n){var r,s,o,i,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(s=e.length,o=new u(0|s/2,t),i=0,a=0;s>i;i+=2){if(r=parseInt(e.substring(i,i+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},d=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,r,s,o,i=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(128&n)if(192==(224&n))null===(r=e())&&i([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(s=e()))&&i([n,r,s]),t((15&n)<<12|(63&r)<<6|63&s);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(s=e())||null===(o=e()))&&i([n,r,s,o]),t((7&n)<<18|(63&r)<<12|(63&s)<<6|63&o)}else t(n)},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n);null!==r&&t(r)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,r=0;return e.UTF16toUTF8(t,(function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4})),[n,r]}};return e}(),o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{d.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},u.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var s=new u(d.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return d.encodeUTF16toUTF8(t(e),(function(e){s.view[o++]=e})),s.limit=o,s},u}(t),r=function(t,n){var r,s,o={};return o.ByteBuffer=t,o.c=t,r=t,o.Long=n||null,o.VERSION="5.0.1",o.WIRE_TYPES={},o.WIRE_TYPES.VARINT=0,o.WIRE_TYPES.BITS64=1,o.WIRE_TYPES.LDELIM=2,o.WIRE_TYPES.STARTGROUP=3,o.WIRE_TYPES.ENDGROUP=4,o.WIRE_TYPES.BITS32=5,o.PACKABLE_WIRE_TYPES=[o.WIRE_TYPES.VARINT,o.WIRE_TYPES.BITS64,o.WIRE_TYPES.BITS32],o.TYPES={int32:{name:"int32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},uint64:{name:"uint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.UZERO:void 0},sint64:{name:"sint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},bool:{name:"bool",wireType:o.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:o.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:o.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.ZERO:void 0},float:{name:"float",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:o.WIRE_TYPES.STARTGROUP,defaultValue:null}},o.MAP_KEY_TYPES=[o.TYPES.int32,o.TYPES.sint32,o.TYPES.sfixed32,o.TYPES.uint32,o.TYPES.fixed32,o.TYPES.int64,o.TYPES.sint64,o.TYPES.sfixed64,o.TYPES.uint64,o.TYPES.fixed64,o.TYPES.bool,o.TYPES.string,o.TYPES.bytes],o.ID_MIN=1,o.ID_MAX=536870911,o.convertFieldsToCamelCase=!1,o.populateAccessors=!0,o.populateDefaults=!0,o.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 r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),o.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},o.DotProto=function(e,t){function n(e,n){var r=-1,s=1;if("-"==e.charAt(0)&&(s=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(s<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|s*r,!n&&r<0)throw Error("illegal id value: "+(s<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function s(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,i,a={},l=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},d=l.prototype;return d._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]},d.next=function(){var e,n,r,s,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(s=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(s++)))for(;s<this.source.length&&!t.DELIM.test(this.source.charAt(s));)++s;return('"'===(o=this.source.substring(this.index,this.index=s))||"'"===o)&&(this._stringOpen=o),o},d.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},d.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},d.omit=function(e){return this.peek()===e&&(this.next(),!0)},d.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=l,o=function(e){this.tn=new l(e),this.proto3=!1},(i=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},i._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},i._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},i._parseOption=function(e,n){var r,s=this.tn.next(),o=!1;if("("===s&&(o=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal option name: "+s);r=s,o&&(this.tn.skip(")"),r="("+r+")",s=this.tn.peek(),t.FQTYPEREF.test(s)&&(r+=s,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},i._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)s(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?s(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},i._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},i._parseServiceRPC=function(e){var n,r,s="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.response_stream=!0,o=this.tn.next()),r.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[s]&&(e[s]={}),e[s][n]=r},i._parseMessage=function(e,r){var s=!!r,o=this.tn.next(),i={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(s?"group":"message")+" name: "+o);for(i.name=o,s&&(this.tn.skip("="),r.id=n(this.tn.next()),i.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(i,o);else if("oneof"===o)this._parseMessageOneOf(i);else if("enum"===o)this._parseEnum(i);else if("message"===o)this._parseMessage(i);else if("option"===o)this._parseOption(i);else if("service"===o)this._parseService(i);else if("extensions"===o)i.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(i);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(i,"optional",o)}return this.tn.omit(";"),e.messages.push(i),i},i._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},i._parseMessageField=function(e,r,s){var o,i,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(s)throw Error("illegal type: "+s);if(this.tn.skip("<"),i=this.tn.next(),!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.keytype=i,this.tn.skip(","),i=this.tn.next(),!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field: "+i);if(o.type=i,this.tn.skip(">"),i=this.tn.next(),!t.NAME.test(i))throw Error("illegal message field name: "+i);o.name=i,this.tn.skip("="),o.id=n(this.tn.next()),"["===(i=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(s=void 0!==s?s: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(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.type=s,i=this.tn.next(),!t.NAME.test(i))throw Error("illegal message field name: "+i);o.name=i,this.tn.skip("="),o.id=n(this.tn.next()),"["===(i=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},i._parseMessageOneOf=function(e){var n,r,s,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,s=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=r,s.push(n.id);this.tn.omit(";"),e.oneofs[r]=s},i._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()},i._parseEnum=function(e){var r,s={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(s.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(s);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),s.values.push(r)}this.tn.omit(";"),e.enums.push(s)},i._parseExtensionRanges=function(){var t,n,s,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":s=e.ID_MIN;break;case"max":s=e.ID_MAX;break;default:s=r(t)}if(n.push(s),2===n.length)break;if("to"!==this.tn.peek()){n.push(s);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},i._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},i.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(e){function n(t,n){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}function s(t,n){var r=n.readVarint32(),o=7&r,i=r>>>3;switch(o){case e.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(!(128&~r));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:s(i,n);break;case e.WIRE_TYPES.ENDGROUP:if(i===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+i+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+o)}return!0}var o,i,a,l,d,u,c,h,p,_,g,E,I,T,f,C,R={},S=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},m=S.prototype;return m.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},m.toString=function(e){return(e?this.className+" ":"")+this.fqn()},m.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=S,o=function(e,t,n,r,s){S.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=s||"proto2"},(i=o.prototype=Object.create(S.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},i.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof d.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof d.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)},i.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},i.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,s=this,o=0;if(""===r[o]){for(;null!==s.parent;)s=s.parent;o++}do{do{if(!(s instanceof R.Namespace)){s=null;break}if(!((n=s.getChild(r[o]))&&n instanceof R.T&&(!t||n instanceof R.Namespace))){s=null;break}s=n,o++}while(o<r.length);if(null!=s)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=s);return s},i.qn=function(e){var t,n,r=[],s=e;do{r.unshift(s.name),s=s.parent}while(null!==s);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof R.Namespace))return n.join(".");return e.fqn()},i.build=function(){var e,t,n,r={},s=this.children;for(t=0,n=s.length;n>t;++t)(e=s[t])instanceof o&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},i.buildOpt=function(){var e,t,n,r,s={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],r=this.options[o[e]],s[n]=r;return s},i.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},R.Namespace=o,a=function(t,n,r,s){if(this.type=t,this.resolvedType=n,this.isMapKey=r,this.syntax=s,r&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},l=a.prototype,a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new r(0):t.defaultValue},l.verifyValue=function(r){var s,o,i,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 e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r>4294967295?0|r:r;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r<0?r>>>0:r;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(r,!1)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(r,!0)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof r&&a(typeof r,"not a boolean"),r;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof r&&a(typeof r,"not a number"),r;case e.TYPES.string:return"string"==typeof r||r&&r instanceof String||a(typeof r,"not a string"),""+r;case e.TYPES.bytes:return t.isByteBuffer(r)?r:t.wrap(r);case e.TYPES.enum:for(s=this.resolvedType.getChildren(e.Reflect.Enum.Value),i=0;i<s.length;i++){if(s[i].name==r)return s[i].id;if(s[i].id==r)return s[i].id}if("proto3"===this.syntax)return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),(r>4294967295||r<0)&&a(typeof r,"not in range for uint32"),r;a(r,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(r&&"object"==typeof r||a(typeof r,"object expected"),r instanceof this.resolvedType.clazz)return r;if(r instanceof e.Builder.Message){for(i in o={},r)r.hasOwnProperty(i)&&(o[i]=r[i]);r=o}return new this.resolvedType.clazz(r)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+r+" (undefined type "+this.type+")")},l.calculateLength=function(t,n){if(null===n)return 0;var s;switch(this.type){case e.TYPES.int32:return n<0?r.calculateVarint64(n):r.calculateVarint32(n);case e.TYPES.uint32:return r.calculateVarint32(n);case e.TYPES.sint32:return r.calculateVarint32(r.zigZagEncode32(n));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return r.calculateVarint64(n);case e.TYPES.sint64:return r.calculateVarint64(r.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return r.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return s=r.calculateUTF8Bytes(n),r.calculateVarint32(s)+s;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return r.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return s=this.resolvedType.calculate(n),r.calculateVarint32(s)+s;case e.TYPES.group:return(s=this.resolvedType.calculate(n))+r.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},l.encodeValue=function(t,n,s){var o,i;if(null===n)return s;switch(this.type){case e.TYPES.int32:n<0?s.writeVarint64(n):s.writeVarint32(n);break;case e.TYPES.uint32:s.writeVarint32(n);break;case e.TYPES.sint32:s.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:s.writeUint32(n);break;case e.TYPES.sfixed32:s.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:s.writeVarint64(n);break;case e.TYPES.sint64:s.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:s.writeUint64(n);break;case e.TYPES.sfixed64:s.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?s.writeVarint32("false"===n.toLowerCase()?0:!!n):s.writeVarint32(n?1:0);break;case e.TYPES.enum:s.writeVarint32(n);break;case e.TYPES.float:s.writeFloat32(n);break;case e.TYPES.double:s.writeFloat64(n);break;case e.TYPES.string:s.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,s.writeVarint32(n.remaining()),s.append(n),n.offset=o;break;case e.TYPES.message:i=(new r).LE(),this.resolvedType.encode(n,i),s.writeVarint32(i.offset),s.append(i.flip());break;case e.TYPES.group:this.resolvedType.encode(n,s),s.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return s},l.decode=function(t,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var s,o;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(o=t.readVarint32(),t.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+t.remaining());return(s=t.clone()).limit=s.offset+o,t.offset+=o,s;case e.TYPES.message:return o=t.readVarint32(),this.resolvedType.decode(t,o);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}throw Error("[INTERNAL] Illegal decode type")},l.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return r.fromBinary(t)}},l.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},R.Element=a,d=function(e,t,n,r,s,i){o.call(this,e,t,n,r,i),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!s,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(u=d.prototype=Object.create(o.prototype)).build=function(n){var s,o,i,a;if(this.clazz&&!n)return this.clazz;for(s=function(e,n){function s(t,n,o,i){var a,l,d,u,c,h,p;if(null===t||"object"!=typeof t)return i&&i instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(i.object,t))?a:t;if(r.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return o?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return l=[],t.forEach((function(e,t){l[t]=s(e,n,o,i)})),l;if(l={},t instanceof e.Map){for(u=(d=t.entries()).next();!u.done;u=d.next())l[t.keyElem.valueToString(u.value[0])]=s(u.value[1],n,o,t.valueElem.resolvedType);return l}for(p in c=t.$type,h=void 0,t)t.hasOwnProperty(p)&&(l[p]=c&&(h=c.getChild(p))?s(t[p],n,o,h.resolvedType):s(t[p],n,o));return l}var o,i,a=n.getChildren(e.Reflect.Message.Field),l=n.getChildren(e.Reflect.Message.OneOf),d=function(t){var s,o,i,u;for(e.Builder.Message.call(this),s=0,o=l.length;o>s;++s)this[l[s].name]=null;for(s=0,o=a.length;o>s;++s)this[(i=a[s]).name]=i.repeated?[]:i.map?new e.Map(i):null,!i.required&&"proto3"!==n.syntax||null===i.defaultValue||(this[i.name]=i.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof d)||Array.isArray(t)||t instanceof e.Map||r.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(s=0,o=arguments.length;o>s;++s)void 0!==(u=arguments[s])&&this.$set(a[s].name,u);else this.$set(t)},u=d.prototype=Object.create(e.Builder.Message.prototype);for(u.add=function(t,r,s){var o=n._fieldsByName[t];if(!s){if(!o)throw Error(this+"#"+t+" is undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+t+" is not a repeated field");r=o.verifyValue(r,!0)}return null===this[t]&&(this[t]=[]),this[t].push(r),this},u.$add=u.add,u.set=function(t,r,s){var o,i,a;if(t&&"object"==typeof t){for(o in s=r,t)t.hasOwnProperty(o)&&void 0!==(r=t[o])&&this.$set(o,r,s);return this}if(i=n._fieldsByName[t],s)this[t]=r;else{if(!i)throw Error(this+"#"+t+" is not a field: undefined");if(!(i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+i.toString(!0));this[i.name]=r=i.verifyValue(r)}return i&&i.oneof&&(a=this[i.oneof.name],null!==r?(null!==a&&a!==i.name&&(this[a]=null),this[i.oneof.name]=i.name):a===t&&(this[i.oneof.name]=null)),this},u.$set=u.set,u.get=function(t,r){if(r)return this[t];var s=n._fieldsByName[t];if(!(s&&s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));return this[s.name]},u.$get=u.get,o=0;o<a.length;o++)(i=a[o])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,r,s,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})),r=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},s=function(){return this[e.name]},null===n.getChild("set"+o)&&(u["set"+o]=r),null===n.getChild("set_"+t)&&(u["set_"+t]=r),null===n.getChild("get"+o)&&(u["get"+o]=s),null===n.getChild("get_"+t)&&(u["get_"+t]=s)}(i);return u.encode=function(e,r){var s,o;"boolean"==typeof e&&(r=e,e=void 0),s=!1,e||(e=new t,s=!0),o=e.littleEndian;try{return n.encode(this,e.LE(),r),(s?e.flip():e).LE(o)}catch(t){throw e.LE(o),t}},d.encode=function(e,t,n){return new d(e).encode(t,n)},u.calculate=function(){return n.calculate(this)},u.encodeDelimited=function(e){var t,s=!1;return e||(e=new r,s=!0),t=(new r).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),s?e.flip():e},u.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},u.toArrayBuffer=u.encodeAB,u.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},u.toBuffer=u.encodeNB,u.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},u.toBase64=u.encode64,u.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},u.toHex=u.encodeHex,u.toRaw=function(e,t){return s(this,!!e,!!t,this.$type)},u.encodeJSON=function(){return JSON.stringify(s(this,!0,!0,this.$type))},d.decode=function(e,t){var s,o;"string"==typeof e&&(e=r.wrap(e,t||"base64")),s=(e=r.isByteBuffer(e)?e:r.wrap(e)).littleEndian;try{return o=n.decode(e.LE()),e.LE(s),o}catch(t){throw e.LE(s),t}},d.decodeDelimited=function(e,t){var s,o,i;if("string"==typeof e&&(e=r.wrap(e,t||"base64")),(e=r.isByteBuffer(e)?e:r.wrap(e)).remaining()<1)return null;if(s=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=s,null;try{return i=n.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,i}catch(t){throw e.offset+=o,t}},d.decode64=function(e){return d.decode(e,"base64")},d.decodeHex=function(e){return d.decode(e,"hex")},d.decodeJSON=function(e){return new d(JSON.parse(e))},u.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(d,"$options",{value:n.buildOpt()}),Object.defineProperty(u,"$options",{value:d.$options}),Object.defineProperty(d,"$type",{value:n}),Object.defineProperty(u,"$type",{value:n})),d}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},i=0,a=this.children.length;a>i;i++)if((o=this.children[i])instanceof g||o instanceof d||o instanceof T){if(s.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");s[o.name]=o.build()}else if(o instanceof d.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof d.OneOf||o instanceof I))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[i].toString(!0));return this.clazz=s},u.encode=function(e,t,n){var r,s,o,i,a,l=null;for(o=0,i=this._fields.length;i>o;++o)s=e[(r=this._fields[o]).name],r.required&&null===s?null===l&&(l=r):r.encode(n?s:r.verifyValue(s),t,e);if(null!==l)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+l)).encoded=t,a;return t},u.calculate=function(e){for(var t,n,r=0,s=0,o=this._fields.length;o>s;++s){if(n=e[(t=this._fields[s]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},u.decode=function(t,n,r){var o,i,a,l,d,u,c,h,p,_,g,E;for(n="number"==typeof n?n:-1,d=t.offset,u=new this.clazz;t.offset<d+n||-1===n&&t.remaining()>0;){if(a=(o=t.readVarint32())>>>3,(i=7&o)===e.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(l=this._fieldsById[a])l.repeated&&!l.options.packed?u[l.name].push(l.decode(i,t)):l.map?(h=l.decode(i,t),u[l.name].set(h[0],h[1])):(u[l.name]=l.decode(i,t),l.oneof&&(null!==(p=u[l.oneof.name])&&p!==l.name&&(u[p]=null),u[l.oneof.name]=l.name));else switch(i){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:c=t.readVarint32(),t.offset+=c;break;case e.WIRE_TYPES.STARTGROUP:for(;s(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+i)}}for(_=0,g=this._fields.length;g>_;++_)if(null===u[(l=this._fields[_]).name])if("proto3"===this.syntax)u[l.name]=l.defaultValue;else{if(l.required)throw(E=Error("Missing at least one required field for "+this.toString(!0)+": "+l.name)).decoded=u,E;e.populateDefaults&&null!==l.defaultValue&&(u[l.name]=l.defaultValue)}return u},R.Message=d,c=function(t,n,r,s,o,i,a,l,u,c){S.call(this,t,n,i),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=s||null,this.type=o,this.resolvedType=null,this.id=a,this.options=l||{},this.defaultValue=null,this.oneof=u||null,this.syntax=c||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof d.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(h=c.prototype=Object.create(S.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},h.verifyValue=function(t,n){var r,s,o;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),o=[],s=0;s<t.length;s++)o.push(this.element.verifyValue(t[s]));return o}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},h.hasWirePresence=function(t,n){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},h.encode=function(t,n,s){var o,i,a,l,d;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),i=n.offset,o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],n);a=n.offset-i,(l=r.calculateVarint32(a))>1&&(d=n.slice(i,n.offset),i+=l-1,n.offset=i,n.append(d)),n.writeVarint32(a,i-l)}else for(o=0;o<t.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[o],n);else this.map?t.forEach((function(t,s){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,s)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(o),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,s,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,s)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},h.calculate=function(t,n){var s,o,i;if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;s=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(s+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i=0,o=0;o<t.length;o++)i+=this.element.calculateLength(this.id,t[o]);s+=r.calculateVarint32(i),s+=i}else for(o=0;o<t.length;o++)s+=r.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,t[o]);else this.map?t.forEach((function(t,n){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);s+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s+=r.calculateVarint32(o),s+=o}),this):this.hasWirePresence(t,n)&&(s+=r.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return s},h.decode=function(t,n,r){var s,o,i,l,d,u,c;if(!(!this.map&&t==this.type.wireType||!r&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){for(o=n.readVarint32(),o=n.offset+o,i=[];n.offset<o;)i.push(this.decode(this.type.wireType,n,!0));return i}if(this.map){if(l=a.defaultFieldValue(this.keyType),s=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((d=n.clone()).limit=d.offset+o,n.offset+=o;d.remaining()>0;)if(t=7&(u=d.readVarint32()),1===(c=u>>>3))l=this.keyElement.decode(d,t,c);else{if(2!==c)throw Error("Unexpected tag in map field key/value submessage");s=this.element.decode(d,t,c)}return[l,s]}return this.element.decode(n,t,this.id)},R.Message.Field=c,p=function(e,t,n,r,s,o,i){c.call(this,e,t,n,null,r,s,o,i),this.extension},p.prototype=Object.create(c.prototype),R.Message.ExtensionField=p,_=function(e,t,n){S.call(this,e,t,n),this.fields=[]},R.Message.OneOf=_,g=function(e,t,n,r,s){o.call(this,e,t,n,r,s),this.className="Enum",this.object=null},g.getName=function(e,t){var n,r,s=Object.keys(e);for(r=0;r<s.length;++r)if(e[n=s[r]]===t)return n;return null},(g.prototype=Object.create(o.prototype)).build=function(t){var n,r,s,o;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,s=0,o=(r=this.getChildren(g.Value)).length;o>s;++s)n[r[s].name]=r[s].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},R.Enum=g,E=function(e,t,n,r){S.call(this,e,t,n),this.className="Enum.Value",this.id=r},E.prototype=Object.create(S.prototype),R.Enum.Value=E,I=function(e,t,n,r){S.call(this,e,t,n),this.field=r},I.prototype=Object.create(S.prototype),R.Extension=I,T=function(e,t,n,r){o.call(this,e,t,n,r),this.className="Service",this.clazz=null},(T.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,s=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=s.prototype=Object.create(e.Builder.Service.prototype),i=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<i.length;n++)!function(e){o[e.name]=function(n,s){try{try{n=e.resolvedRequestType.clazz.decode(r.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void s(null,r):void s(Error("Illegal response type received in service method "+t.name+"#"+e.name))}s(n)}))}catch(e){setTimeout(s.bind(this,e),0)}},s[e.name]=function(t,n,r){new s(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(s[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:s[e.name].$options}))}(i[n]);return Object.defineProperty&&(Object.defineProperty(s,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:s.$options}),Object.defineProperty(s,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),s}(e,this)},R.Service=T,f=function(e,t,n,r){S.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(f.prototype=Object.create(S.prototype)).buildOpt=i.buildOpt,R.Service.Method=f,C=function(e,t,n,r,s,o,i,a){f.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=s,this.requestStream=o,this.responseStream=i,this.resolvedRequestType=null,this.resolvedResponseType=null},C.prototype=Object.create(f.prototype),R.Service.RPCMethod=C,R}(o),o.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var s=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=s.prototype;return s.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},s.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},s.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},s.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},s.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var r,o,i,a,l;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),s.isMessage(o)){if(i=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){i.addChild(a[e]=new n.Message.OneOf(this,i,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==i.getChild(0|e.id))throw Error("duplicate or invalid field id in "+i.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+i.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+i.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,i,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),i.addChild(e)}),this),l=[],o.enums&&o.enums.forEach((function(e){l.push(e)})),o.messages&&o.messages.forEach((function(e){l.push(e)})),o.services&&o.services.forEach((function(e){l.push(e)})),o.extensions&&(i.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(i),l.length>0){r.push(t),t=l,l=null,this.ptr=i,i=null;continue}l=null}else if(s.isEnum(o))i=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){i.addChild(new n.Enum.Value(this,i,e.name,e.id))}),this),this.ptr.addChild(i);else if(s.isService(o))i=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];i.addChild(new n.Service.RPCMethod(this,i,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(i);else{if(!s.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(i=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,s,o,a;if(null!==i.getChild(0|t.id))throw Error("duplicate extended field id in "+i.name+": "+t.id);if(i.extensions&&(r=!1,i.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+i.name+": "+t.id+" (not within valid ranges)");s=t.name,this.options.convertFieldsToCamelCase&&(s=e.Util.toCamelCase(s)),o=new n.Message.ExtensionField(this,i,t.rule,t.type,this.ptr.fqn()+"."+s,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),i.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,i=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var s,o,i,a,l,d,u,c,h="/";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(s=n.root,e.Util.IS_NODE,(s.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(h="\\"),o=s+h+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,i=this.importRoot,n=n.file,(i.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(h="\\")):"string"==typeof n?this.importRoot?i=this.importRoot:n.indexOf("/")>=0?""===(i=n.replace(/\/[^\/]*$/,""))&&(i="/"):n.indexOf("\\")>=0?(i=n.replace(/\\[^\\]*$/,""),h="\\"):i=".":i=null,l=0;l<t.imports.length;l++)if("string"==typeof t.imports[l]){if(!i)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(d=t.imports[l]))continue;if(d=i+h+d,!0===this.files[d])continue;if(/\.proto$/i.test(d)&&!e.DotProto&&(d=d.replace(/\.proto$/,".json")),null===(u=e.Util.fetch(d)))throw Error("failed to import '"+d+"' in '"+n+"': file not found");/\.json$/i.test(d)?this.import(JSON.parse(u+""),d):this.import(e.DotProto.Parser.parse(u),d)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[l],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+l+"."+n}))):this.import(t.imports[l],n+"_import"+l):this.import(t.imports[l]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),c=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){c.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=c),t.enums&&(this.create(t.enums),this.ptr=c),t.services&&(this.create(t.services),this.ptr=c),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var r;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(!(r=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,r;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},s.Message=function(){},s.Enum=function(){},s.Service=function(){},s}(o,o.Lang,o.Reflect),o.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,s,o,i;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(r=Object.keys(n),s=0;s<r.length;s++)o=this.keyElem.valueFromString(r[s]),i=this.valueElem.verifyValue(n[r[s]]),this.map[this.keyElem.valueToString(o)]={key:o,value:i}},s=r.prototype;return s.clear=function(){this.map={}},s.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},s.entries=function(){var e,t,r=[],s=Object.keys(this.map);for(t=0;t<s.length;t++)r.push([(e=this.map[s[t]]).key,e.value]);return n(r)},s.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},s.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},s.forEach=function(e,t){var n,r,s=Object.keys(this.map);for(r=0;r<s.length;r++)e.call(t,(n=this.map[s[r]]).value,n.key,this)},s.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},s.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},s.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,o.Reflect),o.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),o.loadJson(o.DotProto.Parser.parse(e),t,n)},o.protoFromString=o.loadProto,o.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadProto(r,n,e)},o.protoFromFile=o.loadProtoFile,o.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=o.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=o.populateAccessors),new o.Builder(e)},o.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=o.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},o.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadJson(JSON.parse(r),n,e)},s=e,o.loadProto(s,void 0,"").build("Modules").probuf}(n,t);return r}var or,ir;const ar=(e,t,n)=>{if(void 0===t||void 0===n)return e.toUpperCase();const r=e.slice(t,n);return e=e.replace(r,(e=>e.toUpperCase()))};class lr{constructor(e,t){this.nestedMap=t,or.add(this),this.pbModules=sr(e)}_encode(e,t,n){const r=new this.pbModules[e];if(t)try{Object.keys(t).forEach((n=>{const s=t[n];if(void 0===s)return;const o=this.nestedMap.get(`${e}_${n}`);if(o){const e=s instanceof Array?s.map((e=>this._encode(o,e,!0))):this._encode(o,s,!0);r[`set${ar(n,0,1)}`](e)}else r[`set${ar(n,0,1)}`](s)}))}catch(t){const n=`name: ${e}, stack: ${t.stack}`;null===console||void 0===console||console.error("pb encode error!",n)}return n?r:r.toArrayBuffer()}encode(e,t){return this._encode(e,t)}decode(e,t){const r=this.pbModules[e].decode(t);return n(this,or,"m",ir).call(this,r)}getModule(e){return new this.pbModules[e]}}or=new WeakSet,ir=function e(t){if(t instanceof Array)return t.map((t=>n(this,or,"m",e).call(this,t)));if(r=t,"[object Object]"!==Object.prototype.toString.call(r))return t;var r;if(void 0!==t.low&&void 0!==t.high&&Object.prototype.hasOwnProperty.call(t,"unsigned")){let{low:e}=t;e<0&&(e+=4294967296),e=e.toString(16);return parseInt(t.high.toString(16)+"00000000".replace(new RegExp(`0{${e.length}}$`),e),16)}const s=t;return Object.keys(t).forEach((r=>{s[r]=n(this,or,"m",e).call(this,t[r])})),s};const dr="NotifyMsg",ur="SyncRequestMsg",cr="UpStreamMessage",hr="PushExtra",pr="DownStreamMessages",_r="DownStreamMessage",gr="GetQNupTokenInput",Er="GetDownloadUrlInput",Ir="GetQNupTokenOutput",Tr="GetDownloadUrlOutput",fr="ChrmInput",Cr="ChrmOutput",Rr="ChrmPullMsg",Sr="RelationQryInput",mr="RelationsInput",yr="RelationsOutput",vr="QryRemindListReq",Ar="QryRemindListResp",Nr="CleanHisMsgInput",Or="CleanMsgBatchReq",Mr="QueryChatRoomInfoInput",Lr="QueryChatRoomInfoOutput",Ur="HistoryMsgInput",Pr="HistoryMsgOuput",br="SessionsAttQryInput",xr="SessionsAttOutput",Dr="SessionMsgReadInput",wr="DeleteSessionsInput",Vr="SessionInfo",Gr="QuerySessionsInput",Fr="QuerySessionsOutPut",Br="RelationDelBatchReq",kr="RelationOpInput",Hr="DeleteMsgInput",qr="SetChrmKV",Yr="SetChrmKVS",Kr="ChrmKVOutput",jr="ChrmKVSOutput",Qr="QueryChrmKV",Wr="SetUserSettingOutput",$r="PullUserSettingInput",Jr="PullUserSettingOutput",Xr="SessionReq",Zr="SessionStates",zr="SessionState",es="SessionStateItem",ts="SessionStateModifyReq",ns="GroupUnpushQuery",rs="GroupUnpushSet",ss="GroupUnpushResult",os="SessionStateModifyResp",is="TypeUnpushInput",as="TypeUnpushOutput",ls="GrpReadReceiptMsg",ds="GrpReadReceiptQryResp",us="SessionTagAddInput",cs="SessionTagItem",hs="SessionTagDelInput",ps="SessionDisTagReq",_s="UserSettingNotification",gs="ReportSDKInput",Es="UltraGrpPullSes",Is="UltraGrpPullMsg",Ts="MsgChangeReq",fs="QueryMsgChange",Cs="EventChangeList",Rs="MsgChangeList",Ss="MsgQuery",ms="MsgQueryAck",ys="OperateStatus",vs="OperateStatusNotify",As="SetRtcRoomIdInput",Ns="CallInfoUpStream",Os="CallInfoDownStream",Ms="KvInput",Ls="KvOutput",Us="ReadReceiptMsg",Ps="ReceiptQryReq",bs="QueryReceiptResp",xs="ReceiptCntQryReq",Ds="ReceiptCntQryResp",ws="UpdateUserSubReq",Vs="UserSubDetail",Gs="UpdateUserSubResp",Fs="PullUserSubReq",Bs="PUllUserSubResp",ks="PullSubDataReq",Hs="PullSubDataResp",qs="SubDataDetail",Ys="QrySubDataReq",Ks="UserProfile",js="ProfileInfo",Qs="SetUserProfileResp",Ws="PullUserProfileReq",$s="UserProfiles",Js="UserProfileInput",Xs="UserProfilePermission",Zs="SearchUserProfile",zs="ChannelsInput",eo="ChannelsOutput",to="MultiChannels",no="ModifyChannelsInput",ro="QuitChannelsSetting",so="ChannelsQueryInput",oo="ChannelsPageParam",io="ChannelsListResult",ao="ChannelsMemberUpdateInput",lo="ChannelsMemberResponseInput",uo="ChannelsMembersInput",co="FriendInput",ho="FriendsInput",po="FriendsCheckOutput",_o="FriendProfileInput",go="FriendProfileOutput",Eo="FriendQueryInput",Io="FriendsListInput",To="FriendLevelSet",fo="FriendUserInfos",Co="AddUnpushPeriodInput",Ro="DeleteUnpushPeriodInput",So="QueryUnpushPeriodInput",mo="QueryUnpushPeriodOutput",yo=new Map([["UpStreamMessage_pushExt","PushExtra"],["DownStreamMessages_list","DownStreamMessage"],["DownStreamMessage_pushExt","PushExtra"],["ChannelInfosOutput_channels","ChannelInfoOutput"],["GroupMembersOutput_members","MemberInfo"],["GroupInput_groupInfo","GroupInfo"],["RelationsInput_msg","DownStreamMessage"],["RelationsOutput_info","RelationInfo"],["RelationInfo_msg","DownStreamMessage"],["RelationInfo_msgInfo","UnreadMsgInfo"],["QryRemindListResp_msgInfo","UnreadMsgInfo"],["CleanMsgBatchReq_input","CleanHisMsgInput"],["HistoryMessagesOuput_list","DownStreamMessage"],["QueryChatRoomInfoOutput_userInfos","ChrmMember"],["MPFollowOutput_info","MpInfo"],["MCFollowOutput_info","MpInfo"],["SearchMpOutput_info","MpInfo"],["PullMpOutput_info","MpInfo"],["HistoryMsgOuput_list","DownStreamMessage"],["DeleteSessionsInput_sessions","SessionInfo"],["QuerySessionsInput_sessions","SessionInfo"],["QuerySessionsOutPut_sessions","SessionInfo"],["RelationDelBatchReq_relation","RelationOpInput"],["DeleteMsgInput_msgs","DeleteMsg"],["SetChrmKV_entry","ChrmKVEntity"],["SetChrmKV_notification","UpStreamMessage"],["SetChrmKVS_entry","ChrmKVEntity"],["SetChrmKVS_notification","UpStreamMessage"],["DeleteChrmKVS_entry","ChrmKVEntity"],["DeleteChrmKVS_notification","UpStreamMessage"],["ChrmKVOutput_entries","ChrmKVEntity"],["ChrmKVSOutput_errorKeys","ChrmKVSOutputEntity"],["ChrmKVSOutput_keysVersion","ChrmKVSVersionEntity"],["PullUserSettingOutput_items","UserSettingItem"],["UserSettingItem_tags","SessionTagItem"],["SessionStates_state","SessionState"],["SessionState_stateItem","SessionStateItem"],["SessionStateItem_tags","SessionTagItem"],["SessionStateModifyReq_state","SessionState"],["GrpReadReceiptQryResp_list","GrpMsgReadUser"],["SessionTagAddInput_tags","SessionTagItem"],["SessionTagDelInput_tags","SessionTagItem"],["EventChangeList_list","EventChange"],["MsgChangeList_list","MsgChange"],["MsgQuery_query","MessageQueryInfo"],["MsgQueryAck_list","DownStreamMessage"],["OperateStatusNotify_info","OperateInfo"],["OperateStatusNotify_summary","OperateSummary"],["KvOutput_info","KvInfo"],["QueryReceiptResp_list","ReceiptUser"],["ReceiptCntQryResp_result","MsgReadCnt"],["UpdateUserSubReq_subUsers","UserSubDetail"],["UpdateUserSubResp_subUsers","UserSubDetail"],["PUllUserSubResp_list","UserSubList"],["UserSubList_subUsers","UserSubDetail"],["PullSubDataResp_list","SubDataDetail"],["SubDataDetail_data","SubData"],["QrySubDataReq_subUsers","UserSubDetail"],["UserProfile_userProfile","ProfileInfo"],["UserProfile_userExtProfile","ProfileInfo"],["UserProfiles_UserProfile","UserProfile"],["ChannelsInput_settingProfile","ProfileInfo"],["ChannelsInput_extProfile","ProfileInfo"],["ChannelsInput_baseInfo","ChannelBaseInfo"],["ChannelsOutput_channelInfo","ChannelsJoinedInfo"],["ChannelsOutput_userInfos","ChannelsUserInfo"],["ChannelsOutput_friendInviteInfo","FriendInviteInfo"],["ChannelsOutput_friendUserInfo","FriendUserInfo"],["MultiChannels_list","ChannelsInput"],["ModifyChannelsInput_settingInfo","QuitChannelsSetting"],["ChannelsQueryInput_page","ChannelsPageParam"],["ChannelsListResult_page","ChannelsPageParam"],["ChannelsInviteStatusInfos_list","ChannelsInviteStatusInfo"],["ChannelsUserInfos_list","ChannelsUserInfo"],["ChannelsJoinedInfos_list","ChannelsJoinedInfo"],["ChannelsUserInfo_ext","ChannelsUserExtInfo"],["ChannelsJoinedInfo_settingProfile","ProfileInfo"],["ChannelsJoinedInfo_extProfile","ProfileInfo"],["ChannelsJoinedInfo_baseInfo","ChannelBaseInfo"],["ChannelsJoinedInfo_userInfo","ChannelsUserExtInfo"],["ChannelsInviteStatusInfo_joinUserInfo","ChannelsUserInfo"],["ChannelsInviteStatusInfo_inviterInfo","ChannelsUserInfo"],["ChannelsInviteStatusInfo_processInfo","ChannelsUserInfo"],["FriendsOutput_list","FriendOutput"],["FriendsCheckOutput_list","FriendCheckOutput"],["FriendProfileInput_extProfile","ProfileInfo"],["FriendQueryInput_page","ChannelsPageParam"],["FriendUserInfo_extProfile","ProfileInfo"],["FriendUserInfos_list","FriendUserInfo"],["FriendInviteInfos_list","FriendInviteInfo"],["UpdateChannnelInfo_channelInfo","ChannelsJoinedInfo"],["UpdateChannnelInfo_userInfo","ChannelsUserInfo"],["UpdateUserInfo_updatedUserInfo","ChannelsUserInfo"],["UpdateUserInfo_optUserInfo","ChannelsUserInfo"],["ChannelApplyInfo_statusInfo","ChannelsInviteStatusInfo"],["ChannelEventData_optUserInfo","ChannelsUserInfo"],["ChannelEventData_channelInfo","ChannelsJoinedInfo"],["ChannelEventData_userInfos","ChannelsUserInfo"],["ChannelEventData_channelFullInfo","ChannelsJoinedInfo"],["FriendUpdateEvent_extProfile","ProfileInfo"]]);var vo,Ao,No,Oo;!function(e){e[e.PERSON=1]="PERSON",e[e.PERSONS=2]="PERSONS",e[e.GROUP=3]="GROUP",e[e.TEMPGROUP=4]="TEMPGROUP",e[e.CUSTOMERSERVICE=5]="CUSTOMERSERVICE",e[e.NOTIFY=6]="NOTIFY",e[e.MC=7]="MC",e[e.MP=8]="MP",e[e.ULTRAGROUP=10]="ULTRAGROUP"}(vo||(vo={})),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"}(Ao||(Ao={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(No||(No={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags"}(Oo||(Oo={}));const Mo=new lr("package Modules;\nmessage probuf {\n message SetUserStatusOutput {\n optional int32 nothing=1;\n }\n message GetUserStatusInput {\n optional int32 nothing=1;\n }\n message GetUserStatusOutput {\n optional string status=1;\n optional string subUserId=2;\n }\n message SubUserStatusInput {\n repeated string userid =1;\n }\n message SubUserStatusOutput {\n optional int32 nothing=1;\n }\n message VoipDynamicInput {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n message VoipDynamicOutput {\n required string dynamicKey=1;\n }\n message NotifyMsg {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message SyncRequestMsg {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message UpStreamMessage {\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 toUserIds = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13;\n optional string systemId = 16;\n optional string senderPortrait = 21;\n optional int64 optionBits = 22;\n }\n message PushExtra {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message DownStreamMessages {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message DownStreamMessage {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required 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;\n optional int64 extStatus = 20;\n repeated string toUserIds = 21;\n optional int32 groupUnpush = 22;\n optional int64 optionBits = 23;\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n IMAGE = 1;\n AUDIO = 2;\n VIDEO = 3;\n FILE = 4;\n SIGHT = 5;\n COMBINE_HTML = 6;\n }\n message GetQNupTokenInput {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5;\n optional string ext = 6;\n optional int64 size = 7;\n optional int32 ipType = 8;\n }\n message GetQNdownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message GetDownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n optional string ext = 4;\n optional int64 size = 5;\n optional int32 ipType = 6;\n }\n message GetQNupTokenOutput {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n optional string minioAuthorization = 20;\n optional string minioContentSha256 = 21;\n optional string minioDate = 22;\n optional string minioBucketName = 23;\n\n optional string downloadAuthInfo = 24;\n optional string ossConfig = 25;\n }\n message GetQNdownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message GetDownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n GROUP_SUCCESS = 0x00;\n GROUP_FAILURE = 0x01;\n }\n message ChrmInput {\n required int32 nothing = 1;\n optional string extra = 2;\n }\n message ChrmOutput {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n optional int64 createTime = 4;\n optional int32 memberCount = 5;\n optional int32 chatroomBanState = 6;\n optional int32 whiteListState = 7;\n }\n message ChrmPullMsg {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n message ChrmPullMsgNew {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message RelationQryInput {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message RelationsInput {\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 RelationsOutput {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;\n }\n message RelationInfo {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;\n optional int64 versionTime = 7;\n optional int64 remindCount = 8;\n optional int32 busChannelType = 9;\n optional UnreadMsgInfo msgInfo = 10;\n optional int32 remindMeCount = 11;\n }\n message UnreadMsgInfo {\n required string msgId = 1;\n required int64 msgTime= 2;\n optional int32 remindType= 3;\n optional string className = 4;\n }\n message QryRemindListReq {\n required string groupId = 1;\n optional string busChannel = 2;\n optional int64 msgTime = 3;\n optional int32 size = 4;\n }\n message QryRemindListResp {\n repeated UnreadMsgInfo msgInfo = 1;\n }\n message RelationInfoReadTime {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message CleanHisMsgInput {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4;\n }\n message CleanMsgBatchReq {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message QueryChatRoomInfoInput {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message QueryChatRoomInfoOutput {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput {\n required string id = 1;\n }\n\n message MPFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message HistoryMsgInput {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5;\n }\n\n message HistoryMsgOuput {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message SessionsAttQryInput {\n required int32 nothing = 1;\n }\n message SessionsAttOutput {\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message SessionMsgReadInput {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;\n }\n message SessionMsgReadOutput {\n optional int32 nothing=1;\n }\n message DeleteSessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message SessionInfo {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 unreadCount = 3;\n optional string busChannel = 4;\n }\n message QuerySessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message QuerySessionsOutPut {\n repeated SessionInfo sessions = 1;\n }\n message DeleteSessionsOutput {\n optional int32 nothing=1;\n }\n message RelationDelBatchReq {\n repeated RelationOpInput relation = 1;\n }\n message RelationOpInput {\n required string conversationId = 1;\n required ChannelType conversationType = 2;\n optional string busChannel = 3;\n }\n message DeleteMsgInput {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4;\n }\n message DeleteMsg {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message SetChrmKV {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message SetChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message DeleteChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ChrmKVOutput {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ChrmKVSOutput {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ChrmKVSOutputEntity {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message QueryChrmKV {\n required int64 timestamp = 1;\n }\n message SetUserSettingInput {\n required int64 version=1;\n required string value=2;\n }\n message SetUserSettingOutput {\n required int64 version=1;\n required bool reserve=2;\n }\n message PullUserSettingInput {\n required int64 version=1;\n optional bool reserve=2;\n optional int32 ipType = 3;\n }\n message PullUserSettingOutput {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message SessionReq {\n required int64 time = 1;\n }\n message SessionStates {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message SessionState {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;\n }\n message SessionStateItem {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message SessionStateModifyReq {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message GroupUnpushQuery {\n optional string busChannel = 1;\n }\n message GroupUnpushSet{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message GroupUnpushResult {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message SessionStateModifyResp {\n required int64 version=1;\n }\n message TypeUnpushInput {\n required ChannelType type = 1;\n required int64 version = 2;\n required int32 unpushLevel = 3;\n }\n message TypeUnpushOutput {\n required int64 version = 1;\n }\n message GrpReadReceiptMsg {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message GrpReadReceiptQryReq {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message GrpReadReceiptQryResp {\n required int32 totalMemberNum = 1;\n repeated GrpMsgReadUser list = 2;\n }\n message GrpMsgReadUser {\n required int64 readTime = 1;\n required string userId = 2;\n }\n message SessionTagAddInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message SessionTagItem {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message SessionTagDelInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message SessionDisTagReq {\n repeated string tagId=1;\n }\n message UserSettingNotification {\n required int64 version=1;\n required bool reserve=2;\n }\n message ReportSDKInput {\n required string sdkInfo=1;\n }\n message ReportSDKOutput {\n optional int32 nothing=1;\n }\n message UltraGrpPullSes {\n required int64 syncTime = 1;\n optional bool isEraseMsgContent = 2;\n }\n message UltraGrpPullMsg {\n required int64 syncTime = 1;\n }\n message MsgChangeReq {\n required string fromUserId = 1;\n required string targetId = 2;\n required ChannelType type = 3;\n required string msgUID = 4;\n required int64 msgTime = 5;\n optional string busChannel = 6;\n optional string content = 7;\n }\n message QueryMsgChange {\n required int64 syncTime = 1;\n optional int32 needCompress = 2;\n optional int64 onlineTime = 3;\n optional string targetId = 4;\n }\n message EventChangeList {\n repeated EventChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n optional string targetId = 4;\n optional bool isCompress = 5 ;\n }\n message EventChange {\n optional string businessId = 1;\n optional ChannelType channelType = 2;\n optional int64 time = 3;\n optional int32 changeType = 4;\n optional string originalId = 5;\n optional int64 originalTime = 6;\n optional string secondaryId = 7;\n optional bool isAdmin = 8;\n optional bool additionalMark = 9; \n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 secondaryType = 12;\n optional bool isRemindMe = 13;\n repeated string extIds = 14;\n optional int32 remindType = 15;\n optional bytes eventData = 16;\n }\n message MsgChangeList {\n repeated MsgChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n }\n message MsgChange {\n required string targetId = 1;\n required ChannelType type = 2;\n required int64 time = 3;\n required int32 changeType = 4;\n required string msgUID = 5;\n required int64 msgTime = 6;\n optional string busChannel = 7;\n optional bool isAdmin = 8;\n optional bool isDel = 9;\n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12;\n optional bool isRemindMe = 13;\n repeated string userGroupIds = 14;\n optional int32 remindType = 15;\n }\n message MsgQuery {\n required string targetId = 1;\n required ChannelType type = 2;\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo {\n required int64 msgTime = 1;\n required string msgUID = 2;\n optional string busChannel = 3;\n }\n message MsgQueryAck {\n repeated DownStreamMessage list = 1;\n }\n message OperateStatus {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 opType = 3;\n optional string busChannel = 4;\n }\n message OperateStatusNotify {\n optional ChannelType type = 1;\n optional int64 notifyType = 2;\n repeated OperateInfo info = 3 ;\n repeated OperateSummary summary = 4 ;\n }\n message OperateInfo {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional string userId = 3;\n optional int32 opType = 4;\n optional int64 optime = 5;\n }\n \n message OperateSummary {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 count = 3;\n optional int32 opType = 4;\n }\n\n message SetRtcRoomIdInput {\n required string rtcRoomId= 1;\n }\n message SetRtcRoomIdOutput {\n required int32 nothing = 1;\n }\n message CallInfoUpStream {\n required string key= 1;\n required string dataContent=2;\n }\n message CallInfoDownStream {\n required string key= 1;\n required string dataContent=2;\n required int64 maxTime=3;\n }\n message KvInput {\n required int64 syncTime = 1;\n }\n message KvOutput {\n required int64 maxTime = 1;\n repeated KvInfo info = 2;\n }\n message KvInfo {\n required string key =1;\n required string value =2;\n }\n message ReadReceiptMsg {\n required string targetId = 1;\n required ChannelType type = 2;\n optional string busChannel = 3;\n optional string startMsgId = 4;\n optional string endMsgId = 5;\n }\n message ReceiptQryReq {\n required string msgId = 1;\n optional string busChannel = 2;\n required string targetId = 3;\n }\n message QueryReceiptResp {\n optional int32 num = 1;\n repeated ReceiptUser list = 2;\n optional int32 readCnt = 3;\n }\n message ReceiptUser {\n required int64 receiptTime = 1;\n required string userId = 2;\n }\n message ReceiptCntQryReq {\n optional ChannelType type = 1;\n optional string channelId = 2;\n optional string busChannel = 3;\n repeated string msgId = 4;\n }\n message ReceiptCntQryResp {\n repeated MsgReadCnt result= 1;\n }\n\n message MsgReadCnt {\n optional string msgId = 1;\n optional int32 cnt = 2;\n optional int32 tmn = 3;\n }\n message UpdateUserSubReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n optional int32 opType = 3;\n optional int32 expiry = 4;\n }\n message UserSubDetail {\n optional string subUserId = 1;\n }\n message UpdateUserSubResp {\n repeated UserSubDetail subUsers = 1;\n optional int64 subTime = 2;\n }\n message PullUserSubReq {\n optional int64 version = 1;\n optional string pageToken = 2;\n }\n message PUllUserSubResp {\n repeated UserSubList list = 1;\n optional int64 version = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message UserSubList {\n repeated UserSubDetail subUsers = 1;\n optional int32 subType = 2;\n optional int64 subTime = 3;\n optional int32 expiry = 4;\n optional int32 opType = 5;\n }\n message PullSubDataReq {\n optional int64 versionTime = 1;\n optional bool needAllData = 2;\n optional string pageToken = 3;\n }\n message PullSubDataResp {\n repeated SubDataDetail list = 1;\n optional int64 versionTime = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message SubDataDetail {\n optional string statusStr = 1;\n optional string subUserId = 2;\n repeated SubData data = 3;\n optional int32 subType = 4;\n }\n\n message SubData {\n optional int32 platformInfo = 1;\n optional int32 value = 2;\n optional int64 versionTime = 3;\n }\n message QrySubDataReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n }\n message UserProfile {\n optional int64 version = 1;\n optional string userId = 2;\n repeated ProfileInfo userProfile = 3;\n repeated ProfileInfo userExtProfile = 4;\n }\n message ProfileInfo {\n optional string key = 1;\n optional string value = 2;\n }\n message SetUserProfileResp {\n optional int64 version = 1;\n optional string key = 2;\n repeated string censorFailedFields = 3;\n }\n message PullUserProfileReq {\n repeated string userId = 1;\n }\n message UserProfiles {\n repeated UserProfile UserProfile = 1;\n }\n message UserProfileInput {\n required int32 nothing = 1;\n }\n message UserProfilePermission {\n optional int32 permission = 1;\n }\n message UserProfileOutput {\n required int32 nothing = 1;\n }\n message SearchUserProfile {\n optional string uniqueId = 1;\n }\n message ChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated ProfileInfo settingProfile = 3;\n repeated ProfileInfo extProfile = 4;\n optional ChannelBaseInfo baseInfo = 5;\n repeated string users = 6;\n }\n\n message ChannelBaseInfo {\n optional string creatorId = 1;\n optional string ownerId = 2;\n optional int64 createTime = 3;\n optional int32 memberCount = 4;\n }\n\n message ChannelsOutput {\n optional int64 operateTime = 1;\n optional int32 flag = 2;\n optional string msg = 3;\n optional int32 processCode = 4;\n optional ChannelsJoinedInfo channelInfo = 5;\n repeated ChannelsUserInfo userInfos = 6;\n optional FriendInviteInfo friendInviteInfo = 7;\n optional FriendUserInfo friendUserInfo = 8;\n repeated string censorFailedFields = 9;\n }\n\n message MultiChannels {\n optional ChannelType type = 1;\n repeated ChannelsInput list = 2;\n }\n\n message ModifyChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional QuitChannelsSetting settingInfo = 3;\n repeated string users = 4;\n optional int32 operateType = 5;\n }\n\n message QuitChannelsSetting {\n optional bool isQuit = 1;\n optional bool isDelBan = 2;\n optional bool isDelWhite = 3;\n optional bool isDelAttention = 4;\n }\n\n message ChannelsQueryInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional ChannelsPageParam page = 3;\n repeated string ids = 4;\n optional int32 roleType = 5;\n }\n\n message ChannelsPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n optional bool hasNext = 3 ;\n optional int32 total = 4 ;\n optional int32 order = 5 ;\n }\n\n message ChannelsListResult {\n optional int32 listType = 1;\n optional bytes result = 2;\n optional ChannelsPageParam page = 3;\n }\n \n message ChannelsInviteStatusInfos {\n repeated ChannelsInviteStatusInfo list = 1;\n }\n \n message ChannelsUserInfos {\n repeated ChannelsUserInfo list = 1;\n }\n \n message ChannelsJoinedInfos {\n repeated ChannelsJoinedInfo list = 1;\n }\n\n message ChannelsUserInfo {\n optional string userId = 1;\n optional ChannelsUserExtInfo ext = 2;\n optional int64 opTime = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n\n message ChannelsUserExtInfo {\n optional int32 role = 1;\n optional int64 joinTime = 2;\n optional string channelNickName = 3;\n optional string additional = 4;\n optional string remarkName = 5;\n }\n\n message ChannelsMemberUpdateInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional string userId = 3;\n optional string channelNickName = 4;\n optional string additional = 5;\n optional int32 operateType = 6;\n }\n message ChannelsJoinedInfo {\n optional string targetId = 1;\n repeated ProfileInfo settingProfile = 2;\n repeated ProfileInfo extProfile = 3;\n optional ChannelBaseInfo baseInfo = 4;\n optional ChannelsUserExtInfo userInfo = 5;\n }\n message ChannelsInviteStatusInfo {\n optional string targetId = 1;\n optional ChannelsUserInfo joinUserInfo = 2;\n optional ChannelsUserInfo inviterInfo = 3;\n optional int32 status = 4;\n optional int32 directionType = 5;\n optional int32 joinType = 6;\n optional string detail = 7;\n optional int64 applyTime = 8;\n optional ChannelsUserInfo processInfo = 9;\n optional int64 processTime = 10;\n }\n message ChannelsMemberResponseInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 optType = 3;\n optional int32 optResult = 4;\n optional string joinUserId = 5;\n optional string inviterId = 6;\n optional string detail = 7;\n }\n message ChannelsMembersInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string userIds = 3;\n }\n message FriendInput {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string info = 3;\n }\n message FriendsOutput {\n repeated FriendOutput list = 1;\n }\n message FriendOutput {\n optional string userId = 1;\n optional int64 operateTime = 2;\n optional string flag = 3;\n }\n message FriendsInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendsCheckOutput {\n repeated FriendCheckOutput list = 1;\n }\n\n message FriendCheckOutput {\n optional string targetId = 1;\n optional int32 status = 2;\n }\n message FriendProfileInput {\n optional string targetId = 1;\n optional string remarkName = 2;\n repeated ProfileInfo extProfile = 3;\n }\n message FriendProfileOutput {\n repeated string censorFailedFields = 1;\n }\n message FriendQueryInput {\n optional int32 queryType = 1;\n optional ChannelsPageParam page = 2;\n optional int32 friendType= 3;\n }\n message FriendUserInfo {\n optional string userId = 1;\n optional int64 relationTime = 2;\n optional int32 friendType = 3;\n optional int32 flag = 4;\n optional string remarkName = 5;\n optional string name = 6;\n optional string portraitUrl = 7;\n repeated ProfileInfo extProfile = 8;\n \n }\n message FriendInviteInfo {\n optional string userId = 1;\n optional string name = 2;\n optional string portraitUrl = 3;\n optional int32 type = 4;\n optional int32 status = 5;\n optional int64 operateTime = 6;\n optional string info = 7;\n optional int32 friendType = 8;\n }\n message FriendsListInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendLevelSet {\n optional int32 level = 1;\n }\n\n message FriendPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n }\n message FriendUserInfos {\n repeated FriendUserInfo list = 1;\n }\n\n message FriendInviteInfos {\n repeated FriendInviteInfo list = 1;\n }\n \n message FriendApplyEvent {\n optional int32 applyType = 1;\n optional int32 friendType = 2;\n optional string info = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n message UpdateChannnelInfo {\n optional ChannelsJoinedInfo channelInfo = 1;\n optional ChannelsUserInfo userInfo = 2;\n }\n message UpdateUserInfo {\n optional ChannelsUserInfo updatedUserInfo = 1;\n optional ChannelsUserInfo optUserInfo = 2;\n }\n message ChannelApplyInfo {\n repeated ChannelsInviteStatusInfo statusInfo = 1;\n }\n message ChannelEventData {\n optional ChannelsUserInfo optUserInfo = 1;\n optional ChannelsJoinedInfo channelInfo = 2;\n repeated ChannelsUserInfo userInfos = 3;\n optional ChannelsJoinedInfo channelFullInfo = 4;\n }\n message FriendTypeChangeEvent {\n optional string friendId = 1;\n optional int32 friendType = 2;\n }\n message FriendUpdateEvent {\n optional string remarkname = 1;\n repeated ProfileInfo extProfile = 2;\n }\n message AddUnpushPeriodInput {\n required string startTime = 1;\n required int32 spanMinutes = 2;\n optional int32 level = 3;\n optional string timezone = 4;\n }\n message DeleteUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodOutput {\n required int32 isUnpush = 1;\n optional string startTime = 2;\n optional int32 spanMinutes = 3;\n optional int32 level = 4;\n optional string timezone = 5;\n }\n}\n",yo);var Lo,Uo,Po,bo,xo,Do,wo,Vo,Go;exports.LogLevel=void 0,(Lo=exports.LogLevel||(exports.LogLevel={}))[Lo.LOG=0]="LOG",Lo[Lo.DEBUG=0]="DEBUG",Lo[Lo.INFO=1]="INFO",Lo[Lo.WARN=2]="WARN",Lo[Lo.ERROR=3]="ERROR",Lo[Lo.FATAL=4]="FATAL",Lo[Lo.STATISTICS=6]="STATISTICS",Lo[Lo.NONE=1e3]="NONE",exports.LogSource=void 0,(Uo=exports.LogSource||(exports.LogSource={})).IM="IM",Uo.RTC="RTC",exports.ConnectionStatus=void 0,(Po=exports.ConnectionStatus||(exports.ConnectionStatus={}))[Po.CONNECTED=0]="CONNECTED",Po[Po.CONNECTING=1]="CONNECTING",Po[Po.DISCONNECTED=2]="DISCONNECTED",Po[Po.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",Po[Po.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",Po[Po.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",Po[Po.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",Po[Po.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",Po[Po.BLOCKED=9]="BLOCKED",Po[Po.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",Po[Po.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",Po[Po.REDIRECT=14]="REDIRECT",Po[Po.USER_LOGOUT=19]="USER_LOGOUT",Po[Po.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",Po[Po.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",Po[Po.ULTRALIMIT=1101]="ULTRALIMIT",Po[Po.REQUEST_NAVI=201]="REQUEST_NAVI",Po[Po.RESPONSE_NAVI=202]="RESPONSE_NAVI",Po[Po.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",Po[Po.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",Po[Po.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",Po[Po.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",exports.RTCMode=void 0,(bo=exports.RTCMode||(exports.RTCMode={}))[bo.RTC=0]="RTC",bo[bo.LIVE=2]="LIVE",bo[bo.SIP=4]="SIP",bo[bo.CALL=5]="CALL",bo[bo.MEETING=6]="MEETING",bo[bo.CROSS_MUTI=7]="CROSS_MUTI",bo[bo.CROSS_LIVE=8]="CROSS_LIVE",function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(xo||(xo={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Do||(Do={})),exports.RTCApiType=void 0,(wo=exports.RTCApiType||(exports.RTCApiType={}))[wo.ROOM=1]="ROOM",wo[wo.PERSON=2]="PERSON",function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Vo||(Vo={})),exports.RTCJoinType=void 0,(Go=exports.RTCJoinType||(exports.RTCJoinType={}))[Go.KICK=0]="KICK",Go[Go.REFUSE=1]="REFUSE",Go[Go.COEXIST=2]="COEXIST";let Fo=null;function Bo(e,t,n={},r={}){const s=["error","warn","info","debug"][3-e];if(Fo&&e<exports.LogLevel.FATAL)try{const e=JSON.stringify(n);Fo[s](t,e)}catch(e){console.error(e)}}const ko=Bo.bind(null,exports.LogLevel.DEBUG),Ho={init:function(e){Fo=e},info:Bo.bind(null,exports.LogLevel.INFO),debug:ko,warn:Bo.bind(null,exports.LogLevel.WARN),error:Bo.bind(null,exports.LogLevel.ERROR),fatal:Bo.bind(null,exports.LogLevel.FATAL)};class qo{constructor(){this._map={}}on(e,t,n){const r=this._map[e]||(this._map[e]=[]);r.some((e=>e.listener===t&&e.target===n))||r.push({listener:t,target:n})}once(e,t,n){const r=this._map[e]||(this._map[e]=[]);r.some((e=>e.listener===t&&e.target===n))||r.push({listener:t,target:n,once:!0})}off(e,t,n){let r=this._map[e];r&&(r=r.filter((e=>e.listener!==t||e.target!==n)),r.length?this._map[e]=r:delete this._map[e])}emit(e,...t){const n=this._map[e];if(n)for(let e=n.length-1;e>=0;e-=1){const{target:r,once:s,listener:o}=n[e];s&&n.splice(e,1);try{o.call(r,...t)}catch(e){null===console||void 0===console||console.error(e)}}}removeAll(e){delete this._map[e]}clear(){Object.keys(this._map).forEach(this.removeAll,this)}}class Yo{constructor(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=sr(t)}getModule(e){return new this.pbModules[e]}encode(e,t,n){const r=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((e=>{const n=t[e];void 0!==n&&r[`set${((e,t,n)=>{if(void 0===t||void 0===n)return e.toUpperCase();const r=e.slice(t,n);return e.replace(r,(e=>e.toUpperCase()))})(e,0,1)}`](n)}))}catch(t){const n=`pbname: ${e}, stack: ${t.stack}`;this.logger?this.logger.error(exports.LogTagId.L_PB_ENCODE_E,n):null===console||void 0===console||console.error(exports.LogTagId.L_PB_ENCODE_E,n)}return n?r:r.toArrayBuffer()}decode(e,t){const n=this.pbModules[e].decode(t);return this.fixInt64Values(n)}fixInt64Values(e){if(e instanceof Array)return e.map((e=>this.fixInt64Values(e)));if(!it(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){let{low:t}=e;t<0&&(t+=4294967296),t=t.toString(16);return parseInt(e.high.toString(16)+"00000000".replace(new RegExp(`0{${t.length}}$`),t),16)}for(const t in e)e[t]=this.fixInt64Values(e[t]);return e}}var Ko;!function(e){e.RtcInput="RtcInput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcOutput="RtcOutput"}(Ko||(Ko={}));const jo={[Ko.RtcInput]:["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],[Ko.RtcUserListOutput]:["users","token","sessionId","roomInfo"],[Ko.SetUserStatusInput]:["status"],[Ko.RtcSetDataInput]:["interior","target","key","value","objectName","content"],[Ko.RtcUserSetDataInput]:["valueInfo","objectName","content"],[Ko.RtcDataInput]:["interior","target","key","objectName","content"],[Ko.RtcSetOutDataInput]:["target","valueInfo","objectName","content"],[Ko.MCFollowInput]:["state"],[Ko.RtcTokenOutput]:["rtcToken"],[Ko.RtcQryOutput]:["outInfo"],[Ko.RtcQryUserOutDataInput]:["userId"],[Ko.RtcUserOutDataOutput]:["user"],[Ko.RtcQueryListInput]:["order"],[Ko.RtcRoomInfoOutput]:["roomId","roomData","userCount","list"],[Ko.RtcValueInfo]:["key","value"],[Ko.RtcKeyDeleteInput]:["key"],[Ko.RtcNotifyMsg]:["type","time","roomId"],[Ko.RtcPullKV]:["timestamp","roomId"],[Ko.RtcKVOutput]:["entries","bFullUpdate","syncTime"],[Ko.RtcQueryUserJoinedInput]:["userId"],[Ko.RtcQueryUserJoinedOutput]:["info"],[Ko.RtcInviteInput]:["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],[Ko.RtcCancelInviteInput]:["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],[Ko.RtcInviteAnswerInput]:["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],[Ko.RtcEndInviteInput]:["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]},Qo=`\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ${Ko.SetUserStatusInput}\n {\n optional int32 status=1;\n }\n message ${Ko.MCFollowInput}\n {\n required string state = 1;\n }\n message ${Ko.RtcQueryListInput}{\n optional int32 order=1;\n }\n message ${Ko.RtcKeyDeleteInput}{\n repeated string key=1;\n }\n message ${Ko.RtcValueInfo}{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ${Ko.RtcValueInfo} userData=2; //用户资源信息\n }\n message ${Ko.RtcUserListOutput}{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ${Ko.RtcValueInfo} roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ${Ko.RtcInput}{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ${Ko.RtcValueInfo} innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ${Ko.RtcValueInfo} outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ${Ko.RtcQryOutput}{\n repeated ${Ko.RtcValueInfo} outInfo=1;\n }\n message ${Ko.RtcDataInput}{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ${Ko.RtcSetDataInput}{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ${Ko.RtcUserSetDataInput} {\n repeated ${Ko.RtcValueInfo} valueInfo = 1;\n required string objectName = 2;\n repeated ${Ko.RtcValueInfo} content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ${Ko.RtcTokenOutput}{\n required string rtcToken=1;\n }\n message ${Ko.RtcSetOutDataInput}{\n required targetType target=1;\n repeated ${Ko.RtcValueInfo} valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ${Ko.RtcQryUserOutDataInput}{\n repeated string userId = 1;\n }\n message ${Ko.RtcUserOutDataOutput}{\n repeated RtcUserInfo user = 1;\n }\n message ${Ko.RtcNotifyMsg} \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ${Ko.RtcPullKV}\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ${Ko.RtcKVOutput}\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ${Ko.RtcQueryUserJoinedInput}\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ${Ko.RtcQueryUserJoinedOutput}\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ${Ko.RtcViewerJoinedOutput}\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ${Ko.RtcInviteInput}\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ${Ko.RtcCancelInviteInput}\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ${Ko.RtcInviteAnswerInput}\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ${Ko.RtcEndInviteInput}\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n}\n`,Wo=(e,t,n,r,s,o)=>{const i=s?Object.keys(s).map((t=>e.encode(Ko.RtcValueInfo,{key:t,value:s[t]},!0))):void 0,a=o?Object.keys(o).map((t=>e.encode(Ko.RtcValueInfo,{key:t,value:o[t]},!0))):void 0;return e.encode(Ko.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:i,outerDatas:a})},$o=(e,t)=>{const n=e.decode(Ko.RtcUserListOutput,t),{users:r,token:s,sessionId:o,roomInfo:i,entries:a,offlineKickTime:l}=n,d={};return Et(r,(e=>{const{userId:t,userData:n}=e,r={};Et(n,(e=>{const{key:t,value:n}=e;r[t]=n})),d[t]=r})),{users:d,token:s,sessionId:o,roomInfo:i,kvEntries:a,offlineKickTime:l}};var Jo;!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.prMsgS=7]="prMsgS",e[e.pbMsgP=8]="pbMsgP",e[e.qryPMsg=9]="qryPMsg",e[e.qryGMsg=10]="qryGMsg",e[e.qryCHMsg=11]="qryCHMsg",e[e.qryCMsg=12]="qryCMsg",e[e.qrySMsg=13]="qrySMsg",e[e.qryMCMsg=14]="qryMCMsg",e[e.qryMPMsg=15]="qryMPMsg",e[e.recallMsg=16]="recallMsg",e[e.rrMsg=17]="rrMsg",e[e.rrList=18]="rrList",e[e.s_ntf=19]="s_ntf",e[e.s_msg=20]="s_msg",e[e.s_stat=21]="s_stat",e[e.s_cmd=22]="s_cmd",e[e.s_us=23]="s_us",e[e.pullUS=24]="pullUS",e[e.sendMsgRead=25]="sendMsgRead",e[e.qryMsgRead=26]="qryMsgRead",e[e.qryMsgReadCntBatch=27]="qryMsgReadCntBatch",e[e.updRTime=28]="updRTime",e[e.pgMsgS=29]="pgMsgS",e[e.chatMsgS=30]="chatMsgS",e[e.qrySessionsAtt=31]="qrySessionsAtt",e[e.pullMsg=32]="pullMsg",e[e.qrySessions=33]="qrySessions",e[e.delSessions=34]="delSessions",e[e.delMsg=35]="delMsg",e[e.delUgMsg=36]="delUgMsg",e[e.updRRTime=37]="updRRTime",e[e.qrySessionsUnread=38]="qrySessionsUnread",e[e.setTypeUnpush=39]="setTypeUnpush",e[e.chrmPull=40]="chrmPull",e[e.joinChrm=41]="joinChrm",e[e.joinChrmR=42]="joinChrmR",e[e.exitChrm=43]="exitChrm",e[e.queryChrmI=44]="queryChrmI",e[e.setKV=45]="setKV",e[e.delKV=46]="delKV",e[e.setKVS=47]="setKVS",e[e.delKVS=48]="delKVS",e[e.pullKV=49]="pullKV",e[e.qryRelation=50]="qryRelation",e[e.qryRelationR=51]="qryRelationR",e[e.delRelation=52]="delRelation",e[e.delRelationBatch=53]="delRelationBatch",e[e.pullSeAtts=54]="pullSeAtts",e[e.setSeAtt=55]="setSeAtt",e[e.qnTkn=56]="qnTkn",e[e.qnUrl=57]="qnUrl",e[e.aliUrl=58]="aliUrl",e[e.s3Url=59]="s3Url",e[e.stcUrl=60]="stcUrl",e[e.minioUrl=61]="minioUrl",e[e.cleanPMsg=62]="cleanPMsg",e[e.cleanGMsg=63]="cleanGMsg",e[e.cleanCMsg=64]="cleanCMsg",e[e.cleanSMsg=65]="cleanSMsg",e[e.cleanMCMsg=66]="cleanMCMsg",e[e.cleanMPMsg=67]="cleanMPMsg",e[e.cleanMsgBatch=68]="cleanMsgBatch",e[e.rtcPing=69]="rtcPing",e[e.rtc_ntf=70]="rtc_ntf",e[e.rtcSetOutData=71]="rtcSetOutData",e[e.rtcQryUserOutData=72]="rtcQryUserOutData",e[e.addSeTag=73]="addSeTag",e[e.delSeTag=74]="delSeTag",e[e.addTag=75]="addTag",e[e.delTag=76]="delTag",e[e.disTag=77]="disTag",e[e.reportsdk=78]="reportsdk",e[e.pullUgSes=79]="pullUgSes",e[e.pullUgMsg=80]="pullUgMsg",e[e.ugMsg=81]="ugMsg",e[e.qryUgMsg=82]="qryUgMsg",e[e.updUgRTime=83]="updUgRTime",e[e.upMsgEx=84]="upMsgEx",e[e.modifyMsg=85]="modifyMsg",e[e.qryMsgChange=86]="qryMsgChange",e[e.qryMsg=87]="qryMsg",e[e.operate=88]="operate",e[e.s_opNtf=89]="s_opNtf",e[e.ugUnpushQuery=90]="ugUnpushQuery",e[e.ugUnpushSet=91]="ugUnpushSet",e[e.setRtcRoomId=92]="setRtcRoomId",e[e.qryUgUal=93]="qryUgUal",e[e.updUserSub=94]="updUserSub",e[e.pullUserSub=95]="pullUserSub",e[e.pullSubData=96]="pullSubData",e[e.qrySubData=97]="qrySubData",e[e.pullUserProfile=98]="pullUserProfile",e[e.pullOwnProfile=99]="pullOwnProfile",e[e.updProfilePermiss=100]="updProfilePermiss",e[e.qProfilePermiss=101]="qProfilePermiss",e[e.searchUserProfile=102]="searchUserProfile",e[e.updUserProfile=103]="updUserProfile",e[e.pullEventChange=104]="pullEventChange",e[e.channelCreate=105]="channelCreate",e[e.upChannelInfo=106]="upChannelInfo",e[e.qChannelInfo=107]="qChannelInfo",e[e.channelMemKick=108]="channelMemKick",e[e.channelMemQuit=109]="channelMemQuit",e[e.channelDismiss=110]="channelDismiss",e[e.channelTransfer=111]="channelTransfer",e[e.upChannelManager=112]="upChannelManager",e[e.qChannelMem=113]="qChannelMem",e[e.qChannelSpeMem=114]="qChannelSpeMem",e[e.upChannelMem=115]="upChannelMem",e[e.channelMemJoin=116]="channelMemJoin",e[e.channelMemInvite=117]="channelMemInvite",e[e.channelApplyResp=118]="channelApplyResp",e[e.qChannelApplyList=119]="qChannelApplyList",e[e.qChannelMemJoin=120]="qChannelMemJoin",e[e.qChannelMemSpeJoin=121]="qChannelMemSpeJoin",e[e.upChannelRemark=122]="upChannelRemark",e[e.qChannelRemark=123]="qChannelRemark",e[e.upChannelFollow=124]="upChannelFollow",e[e.qChannelFollow=125]="qChannelFollow",e[e.qSimpleUserProfile=126]="qSimpleUserProfile",e[e.friendAdd=127]="friendAdd",e[e.friendDel=128]="friendDel",e[e.friendHandle=129]="friendHandle",e[e.friendSetPf=130]="friendSetPf",e[e.friendCheck=131]="friendCheck",e[e.friendsQuery=132]="friendsQuery",e[e.friendApplyDel=133]="friendApplyDel",e[e.friendsInfoQry=134]="friendsInfoQry",e[e.friendAuthSet=135]="friendAuthSet",e[e.friendAuthGet=136]="friendAuthGet",e[e.addUnpush=137]="addUnpush",e[e.qryUnpush=138]="qryUnpush",e[e.delUnpush=139]="delUnpush",e[e.s_pubCall=140]="s_pubCall",e[e.reqCall=141]="reqCall",e[e.pullKvMsg=142]="pullKvMsg"}(Jo||(Jo={}));const Xo=e=>{const t=Jo[e];if(void 0===t)throw new Error(`topic ${e} not found`);return t},Zo=e=>Jo[e];var zo,ei,ti;!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"}(zo||(zo={})),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.PING=12]="PING",e[e.PONG=13]="PONG",e[e.DISCONNECT=14]="DISCONNECT",e[e.PCONNECT=8]="PCONNECT",e[e.PCONNECT_ACK=9]="PCONNECT_ACK",e[e.RESERVED=10]="RESERVED",e[e.RESERVED_2=11]="RESERVED_2",e[e.RESERVED_3=15]="RESERVED_3"}(ei||(ei={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(ti||(ti={}));const ni="rtcRJoin_data",ri="rtcRExit",si="rtcRInfo",oi="rtcUData",ii="rtcUPut",ai="rtcUDel",li="rtcSetData",di="userSetData",ui="rtcQryData",ci="rtcDelData",hi="rtcToken",pi="rtcUserState",_i="rtcUList",gi="viewerJoinR",Ei="viewerExitR",Ii="rtcPullKv",Ti="rtcIdentityChange",fi="rtcInvite",Ci="rtcCancelInvite",Ri="rtcInviteAnswer",Si="rtcEndInvite",mi="rtcQueryJoined";class yi{static writeUTF(e,t){let{back:n,byteSize:r}=this._getBackAndByteSize(e);for(let e=0,t=n.length;e<t;e++)n[e]>255&&(n[e]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)}static _getBackAndByteSize(e){const t=[];let n=0;if("string"==typeof e)for(let r=0,s=e.length;r<s;r++){const s=e.charCodeAt(r);s>=0&&s<=127?(n+=1,t.push(s)):s>=128&&s<=2047?(n+=2,t.push(192|31&s>>6),t.push(128|63&s)):s>=2048&&s<=65535&&(n+=3,t.push(224|15&s>>12),t.push(128|63&s>>6),t.push(128|63&s))}return{byteSize:n,back:t}}static readUTF(e){const t=[];let n,r,s=-1;const o=e;let i="";for(;++s<o.length;){let e=Number(o[s]);if(e===(127&e)||(240&~e?224&~e?192&~e||(e^=192,e=e<<6|128^o[++s]):(e^=224,e=e<<6|128^o[++s],e=e<<6|128^o[++s]):(e^=240,e=e<<6|128^o[++s],e=e<<6|128^o[++s],e=e<<6|128^o[++s])),!Number.isFinite(e)||e<0||e>1114111||Math.floor(e)!==e)throw RangeError(`Invalid code point: ${e}`);e<=65535?t.push(e):(e-=65536,n=e>>10|55296,r=e%1024|56320,t.push(n,r)),(s+1===o.length||t.length>16384)&&(i+=String.fromCharCode.apply(null,t),t.length=0)}return i}}class vi{constructor(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}check(){return this._position>=this._pool.length}read2Byte(){const e=this;if(e.check())return-1;let t="";for(let n=0;n<2;n++){let n=e._pool[e._position++].toString(16);1===n.length&&(n=`0${n}`),t+=n.toString()}return parseInt(t,16)}readInt32(){return(this.readByte()<<24)+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()}readLong(){const e=this;if(e.check())return-1;let t="";for(let n=0;n<8;n++){let n=e._pool[e._position++].toString(16);1===n.length&&(n=`0${n}`),t+=n}return parseInt(t,16)}readByte(){if(this.check())return-1;let e=this._pool[this._position++];return e>255&&(e&=255),e}readUTF(){if(this.check())return"";const e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;const n=this._pool.subarray(t,this._position);return yi.readUTF(n)}readAll(){return this._pool.subarray(this._position,this._poolLen)}}class Ai{constructor(){this._pool=[]}writeByte(e){e>=0&&(e>255&&(e&=255),this._pool.push(e))}writeBuffer(e){this._pool=this._pool.concat([...new Int8Array(e)])}writeArr(e){this._pool=this._pool.concat(e)}writeUTF(e){const t=yi.writeUTF(e);this._pool=this._pool.concat(t)}getBytesArray(){return this._pool}}class Ni{constructor(e,t=zo.AT_LEAST_ONCE,n=!1,r=!1,s=!1){this.command=e,this.qos=t,this._retain=n,this._dup=r,this.syncMsg=s}static parse(e){return new Ni(e>>4&15,(6&e)>>1,(1&e)>0,(8&e)>0,!(8&~e))}encode(){let e=this.command<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0,e}}class Oi{constructor(e){this.header=e,this.timestamp=0}read(e,t,n){this.readMessage(e,t,n)}readMessage(e,t,n){return{stream:e,length:t}}}class Mi{constructor(e){this.messageId=0,this._header=new Ni(e,zo.AT_MOST_ONCE)}write(e){const t=this.getHeaderFlag();e.writeByte(t),this.writeMessage(e)}setHeaderQos(e){this._header.qos=e}getHeaderFlag(){return this._header.encode()}getArrayBuffer(){const e=new Ai;this.write(e);const t=e.getBytesArray();return new Int8Array(t).buffer}}class Li extends Oi{constructor(){super(...arguments),this.status=null,this.userId=null,this.timestamp=0,this.messageId=0,this.sessionId=""}readMessage(e,t,n){if(e.readByte(),this.status=e.readByte(),t<=Li.MESSAGE_LENGTH)return{stream:e,length:t};if(n===ti.V4){const t=e.readByte();1&t&&(this.userId=e.readUTF()),2&t&&(this.sessionId=e.readUTF()),4&t&&(this.timestamp=e.readLong()),8&t&&(this.messageId=e.read2Byte())}else this.userId=e.readUTF(),this.sessionId=e.readUTF(),this.timestamp=e.readLong();return{stream:e,length:t}}}Li.MESSAGE_LENGTH=2;class Ui extends Oi{constructor(){super(...arguments),this.status=0}readMessage(e,t){return e.readByte(),this.status=e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}Ui.MESSAGE_LENGTH=2;class Pi extends Mi{constructor(){super(ei.PING)}writeMessage(e){}}class bi extends Oi{constructor(e){super(e)}}class xi extends Oi{constructor(){super(...arguments),this.messageId=0}readMessage(e,t){const n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}}}class Di extends Mi{writeMessage(e){const t=this.messageId,n=255&t,r=(65280&t)>>8;e.writeByte(r),e.writeByte(n)}}class wi extends xi{constructor(e){super(e),this.topic="",this.targetId="",this.date=0,this.syncMsg=!1,this.syncMsg=e.syncMsg}readMessage(e,t){return this.date=e.readInt32(),this.topic=e.readUTF(),this.targetId=e.readUTF(),super.readMessage(e,t),this.pbData=e.readAll(),{stream:e,length:t}}}class Vi extends Di{constructor(e,t,n,r){super(e),this.targetId=n,this.pbData=r,this.topic="string"==typeof t?t:Zo(t)}writeMessage(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),super.writeMessage(e),e.writeBuffer(this.pbData)}}class Gi extends Vi{constructor(e,t,n){super(ei.QUERY,e,n,t)}}class Fi extends Vi{constructor(e,t,n){super(ei.PUBLISH,e,n,t)}}class Bi extends xi{constructor(){super(...arguments),this.status=0,this.date=0,this.millisecond=0,this.messageUId="",this.timestamp=0}readMessage(e,t){return super.readMessage(e,t),this.date=e.readInt32(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:t}}}class ki extends Di{constructor(e){super(ei.PUB_ACK),this.messageId=e}}class Hi extends Di{constructor(e){super(ei.QUERY_CONFIRM),this.messageId=e}}class qi extends xi{constructor(){super(...arguments),this.status=0,this.date=0}readMessage(e,t){return super.readMessage(e,t),this.date=e.readInt32(),this.status=256*e.readByte()+e.readByte(),this.pbData=e.readAll(),{stream:e,length:t}}}const Yi=(e,t)=>{const n=new Uint8Array(e),r=new vi(n),s=r.readByte(),o=(e=>{const{command:t}=e;let n;switch(t){case ei.CONN_ACK:n=new Li(e);break;case ei.PUBLISH:n=new wi(e);break;case ei.PUB_ACK:n=new Bi(e);break;case ei.QUERY_ACK:n=new qi(e);break;case ei.PONG:n=new bi(e);break;case ei.DISCONNECT:n=new Ui(e);break;default:console.error(`No support for deserializing ${t} messages`)}return n})(Ni.parse(s));return o&&o.read(r,n.length-1,t),o};class Ki{constructor(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}_startPull(){return t(this,void 0,void 0,(function*(){if(this._isPulling||0===this._pullQueue.length)return;this._isPulling=!0;const{roomId:e,timestamp:t}=this._pullQueue.splice(0,1)[0],n=this._pullTime;if(n>t)return this._isPulling=!1,void this._startPull();const{code:r,data:s}=yield this._engine.pullRTCRoomEntry(e,n);r===exports.ErrorCode.SUCCESS?(this._isPulling=!1,this._pullTime=s||0,this._startPull()):this._startPull()}))}pullEntry(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()}reset(){this._pullTime=0,this._isPulling=!1}}class ji{constructor(e,t,n,r){this.rtcCodec=e,this._watcher=t,this._options=n,this.logger=r,this._appkey=this._options.appkey,this._rtcKVManager=new Ki(this)}registerRTCSignalingListener(e){this._rtcSignalingListener=e}getInnerLogger(){return this.logger}pullRTCRoomEntry(e,n){return t(this,void 0,void 0,(function*(){const t=this.rtcCodec.encode(Ko.RtcPullKV,{timestamp:0,roomId:e}),{code:n,buffer:r}=yield this.rtcSignaling(e,Ii,!0,t);if(n!==exports.ErrorCode.SUCCESS)return{code:n};const s=this.rtcCodec.decode(Ko.RtcKVOutput,r);let{entries:o,syncTime:i}=s;return o=(o||[]).map((e=>Object.assign(Object.assign({},e),{timestamp:gt(e.timestamp)}))),this._watcher.onRTCDataChange(o,e),{code:n,data:i}}))}_receiveRtcKv(e){if(this._rtcSignalingListener)return void this._rtcSignalingListener(e);const{time:t,type:n,roomId:r}=this.rtcCodec.decode(Ko.RtcNotifyMsg,e);1===n&&this._rtcKVManager.pullEntry(r,gt(t))}destroy(){}}class Qi{constructor(){this._callerQueue=[],this._isCalling=!1,this._retryCount=0}pushTask(e){return new Promise((t=>{this._callerQueue.push({task:e,resolve:t}),this._startCall()}))}_startCall(){return t(this,void 0,void 0,(function*(){if(this._isCalling||0===this._callerQueue.length)return;this._isCalling=!0;const e=this._callerQueue.shift(),t=yield this._callHandler(e);e.resolve(t),this._isCalling=!1,this._startCall()}))}_callHandler(e){return t(this,void 0,void 0,(function*(){const{task:t}=e,n=this.getVersion(),r=yield t(n);return r.code===exports.ErrorCode.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,yield this._triggerPull(n),this._callHandler(e)):(this._retryCount=0,r)}))}stopAllTask(){this._callerQueue.forEach((e=>{e.resolve({code:exports.ErrorCode.RC_NET_UNAVAILABLE})})),this._callerQueue=[]}}const Wi={"set.proxy":exports.ErrorCode.INVALID_PARAMETER_PROXY,"test.proxy":exports.ErrorCode.INVALID_PARAMETER_TESTHOST,"test.proxy.socksHost":exports.ErrorCode.INVALID_PARAMETER_TESTHOST,"test.proxy.socksPort":exports.ErrorCode.INVALID_PARAMETER_TESTHOST,channelId:exports.ErrorCode.INVALID_PARAMETER_CHANNEL_ID,count:exports.ErrorCode.INVALID_PARAMETER_COUNT,startTime:exports.ErrorCode.INVALID_PARAMETER_START_TIME,endTime:exports.ErrorCode.INVALID_PARAMETER_END_TIME,offset:exports.ErrorCode.INVALID_PARAMETER_OFFSET,limit:exports.ErrorCode.INVALID_PARAMETER_LIMIT,keyword:exports.ErrorCode.INVALID_PARAMETER_KEYWORD,messageTypes:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_TYPE,messageType:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_TYPE,typingContentType:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_TYPE,conversation:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION,conversationType:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_TYPE,targetId:exports.ErrorCode.INVALID_PARAMETER_TARGET_ID,targetIds:exports.ErrorCode.INVALID_PARAMETER_TARGET_ID,userId:exports.ErrorCode.INVALID_PARAMETER_USER_ID,senderUserId:exports.ErrorCode.INVALID_PARAMETER_USER_ID,timestamp:exports.ErrorCode.INVALID_PARAMETER_TIMESTAMP,order:exports.ErrorCode.INVALID_PARAMETER_ORDER,messageId:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_ID,receivedStatus:exports.ErrorCode.INVALID_PARAMETER_RECEIVED_STATUS,receivedStatusInfo:exports.ErrorCode.INVALID_PARAMETER_RECEIVED_STATUS,sentStatus:exports.ErrorCode.INVALID_PARAMETER_SENT_STATUS,content:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_CONTENT,messageIds:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_ARRAY,cleanSpace:exports.ErrorCode.INVALID_PARAMETER_CLEAN_SPACE,messageDirection:exports.ErrorCode.INVALID_MESSAGE_DIRECTION,canIncludeExpansion:exports.ErrorCode.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION,expansion:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION,disableNotification:exports.ErrorCode.INVALID_PARAMETER_DISABLE_NOTIFICATION,messages:exports.ErrorCode.MSG_LIMIT_ERROR,checkDuplicate:exports.ErrorCode.INVALID_PARAMETER_CHECK_DUPLICATE,messageUId:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_UID,key:exports.ErrorCode.INVALID_PARAMETER_KEY,keys:exports.ErrorCode.INVALID_PARAMETER_KEYS,value:exports.ErrorCode.INVALID_PARAMETER_VALUE,isAutoDelete:exports.ErrorCode.INVALID_PARAMETER_IS_AUTO_DELETE,isSendNotification:exports.ErrorCode.INVALID_PARAMETER_IS_SEND_NOTIFICATION,notificationExtra:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_EXTRA,entries:exports.ErrorCode.INVALID_PARAMETER_ENTRIES,isForce:exports.ErrorCode.INVALID_PARAMETER_IS_FORCE,rtcRoomId:exports.ErrorCode.INVALID_PARAMETER_RTCROOMID,token:exports.ErrorCode.RC_CONN_TOKEN_INCORRECT,conversations:exports.ErrorCode.INVALID_PARAMETER_CONVERSATIONS,draft:exports.ErrorCode.INVALID_PARAMETER_DRAFT,conversationTypes:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_TYPE_LIST,levels:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevel:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevels:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationStatus:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,isTop:exports.ErrorCode.INVALID_PARAMETER_IS_TOP,isUpdateTime:exports.ErrorCode.INVALID_PARAMETER_IS_UPDATE_TIME,message:exports.ErrorCode.INVALID_PARAMETER_MESSAGE,mentionedUserIdList:exports.ErrorCode.INVALID_PARAMETER_USERIDLIST,directionalUserIdList:exports.ErrorCode.INVALID_PARAMETER_USERIDLIST,directedUserIds:exports.ErrorCode.INVALID_PARAMETER_USERIDLIST,isStatusMessage:exports.ErrorCode.INVALID_PARAMETER_IS_STATUS_MESSAGE,pushContent:exports.ErrorCode.INVALID_PARAMETER_PUSH_CONTENT,pushData:exports.ErrorCode.INVALID_PARAMETER_PUSH_DATA,isMentioned:exports.ErrorCode.INVALID_PARAMETER_IS_MENTIONED,mentionedType:exports.ErrorCode.INVALID_PARAMETER_MENTIONED_TYPE,isVoipPush:exports.ErrorCode.INVALID_PARAMETER_IS_VOIP_PUSH,pushConfig:exports.ErrorCode.INVALID_PARAMETER_PUSH_CONFIG,startMsgUId:exports.ErrorCode.INVALID_PARAMETER_START_MESSAGE_UID,endMsgUId:exports.ErrorCode.INVALID_PARAMETER_END_MESSAGE_UID,sentTime:exports.ErrorCode.INVALID_PARAMETER_TIMESTAMP,clearMessageOption:exports.ErrorCode.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,searchContent:exports.ErrorCode.SEARCH_PROPS_LIMIT_ERROR,tagId:exports.ErrorCode.INVALID_PARAMETER_TAG_ID,tagIds:exports.ErrorCode.INVALID_PARAMETER_TAG_ID,tagName:exports.ErrorCode.INVALID_PARAMETER_TAG_NAME,containMuted:exports.ErrorCode.INVALID_PARAMETER_CONTAIN_MUTED,channelType:exports.ErrorCode.INVALID_PARAMETER_CHANNEL_TYPE,file:exports.ErrorCode.MEDIA_EXCEPTION,fileType:exports.ErrorCode.INVALID_PARAMETER_MEDIA_TYPE,contentDisposition:exports.ErrorCode.INVALID_PARAMETER_CONTENT_DISPOSITION,mediaUrl:exports.ErrorCode.INVALID_PARAMETER_MEDIA_URL,filename:exports.ErrorCode.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME,saveName:exports.ErrorCode.INVALID_PARAMETER_SAVE_NAME,serverType:exports.ErrorCode.INVALID_PARAMETER_SERVER_TYPE,subscribeType:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_TYPE,expiry:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_EXPIRY,subscribeUserIds:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS,subscribePageSize:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE,beforeCount:exports.ErrorCode.INVALID_PARAMETER_BEFORE,afterCount:exports.ErrorCode.INVALID_PARAMETER_AFTER,conversationList:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_LIST,conversationTypeNotSupport:exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT,profile:exports.ErrorCode.INVALID_PARAMETER_USER_PROFILE,userProfileVisibility:exports.ErrorCode.INVALID_PARAMETER_USER_PROFILE_VISIBILITY,uniqueId:exports.ErrorCode.INVALID_PARAMETER_UNIQUE_ID,extra:exports.ErrorCode.INVALID_PARAMETER_EXTRA,disableUpdateLastMessage:exports.ErrorCode.INVALID_DISABLE_UPDATE_LAST_MESSAGE};var $i;exports.AssertRules=void 0,($i=exports.AssertRules||(exports.AssertRules={}))[$i.STRING=0]="STRING",$i[$i.ONLY_STRING=1]="ONLY_STRING",$i[$i.NUMBER=2]="NUMBER",$i[$i.BOOLEAN=3]="BOOLEAN",$i[$i.OBJECT=4]="OBJECT",$i[$i.ARRAY=5]="ARRAY",$i[$i.CALLBACK=6]="CALLBACK",$i[$i.CHANNEL_ID=7]="CHANNEL_ID",$i[$i.CONVERSATION=8]="CONVERSATION",$i[$i.CONVERSATION_TYPE=9]="CONVERSATION_TYPE";const Ji={[exports.AssertRules.STRING]:ot,[exports.AssertRules.ONLY_STRING]:et,[exports.AssertRules.NUMBER]:nt,[exports.AssertRules.BOOLEAN]:e=>"boolean"==typeof e,[exports.AssertRules.OBJECT]:it,[exports.AssertRules.ARRAY]:rt,[exports.AssertRules.CALLBACK]:e=>{let t=!0;return it(e)||(t=!1),(e=e||{}).onSuccess&&!at(e.onSuccess)&&(t=!1),e.onError&&!at(e.onError)&&(t=!1),t},[exports.AssertRules.CHANNEL_ID]:ht,[exports.AssertRules.CONVERSATION]:e=>{let t=!0;return it(e)||(t=!1),et(e.targetId)||(t=!1),ct(e.conversationType)||(t=!1),lt(e.channelId)||ht(e.channelId)||(t=!1),t},[exports.AssertRules.CONVERSATION_TYPE]:ct};class Xi extends Error{constructor(e){super(e),this.name="RCAssertError"}}const Zi=(e,t,n,r=!1)=>{n=Ji[n]||n;const s=r?n(t):lt(t)||null==t||n(t);return s||null===console||void 0===console||console.error(`'${e}' is invalid: ${JSON.stringify(t)}`),s};class zi{constructor(e){this._context=e}__getContext(){return this._context}createCodec(e,t){return new Yo(e,t)}createPBCodec(e,t){return new lr(e,t)}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._context.refetchNaviInfo()}))}getNaviInfo(){return this._context.getNaviInfoFromCache()}getCoreVersion(){return"5.16.0-c-rtc-alpha.2"}getAPIVersion(){return"5.16.0-c-rtc-alpha.2"}getAppkey(){return this._context.appkey}getCurrentId(){return this._context.getCurrentUserId()}getConnectionStatus(){return this._context.getConnectionStatus()}getDeviceId(){return this._context.getDeviceId()}sendMessage(e,t,n){return this._context.sendMessage(e,t,n)}registerMessageType(e,t,n,r=[]){this._context.registerMessageType(e,t,n,r)}getServerTime(){return this._context.getServerTime()}getOSInfo(){return this._context.getOSInfo()}getProcessInfo(){return this._context.getProcessInfo()}getMainProcessInfo(){return this._context.getMainProcessInfo()}setCallInfo(e,t,n){return this._context.setCallInfo(e,t,n)}createLogger(e,t){return this._context.createLogger(e,t)}}class ea extends zi{joinRTCRoom(e,n,r,s,o,i){return t(this,void 0,void 0,(function*(){const t=Wo(this._context.rtcCodec,n,r,s,o,i),{code:a,buffer:l}=yield this.rtcSignaling(e,ni,!0,t);let d;return a===exports.ErrorCode.SUCCESS&&l&&(d=$o(this._context.rtcCodec,l)),{code:a,data:d}}))}quitRTCRoom(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.SetUserStatusInput,{status:0}),{code:n}=yield this.rtcSignaling(e,ri,!0,t);return n}))}rtcPing(e,n,r){return t(this,void 0,void 0,(function*(){const{code:t}=yield this._context.rtcPing(e,n,r);return t}))}rtcPingResVersion(e,t,n){return this._context.rtcPing(e,t,n)}getRTCRoomInfo(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcQueryListInput,{order:2}),{code:n,buffer:r}=yield this.rtcSignaling(e,si,!0,t);let s;return n===exports.ErrorCode.SUCCESS&&r&&(s=this._context.rtcCodec.decode(Ko.RtcRoomInfoOutput,r)),{code:n,data:s}}))}getRTCUserInfoList(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcQueryListInput,{order:2}),{code:n,buffer:r}=yield this.rtcSignaling(e,oi,!0,t);let s;if(n===exports.ErrorCode.SUCCESS&&r){s={users:$o(this._context.rtcCodec,r).users}}return{code:n,data:s}}))}getRTCUserInfo(e){throw new Error("Method not implemented.")}setRTCUserInfo(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcValueInfo,{key:n,value:r}),{code:s}=yield this.rtcSignaling(e,ii,!0,t);return s}))}removeRTCUserInfo(e,n){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcKeyDeleteInput,{key:n}),{code:r}=yield this.rtcSignaling(e,ai,!1,t);return r}))}setRTCData(e,n,r,s,o,i){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcSetDataInput,{interior:s,target:o,key:n,value:r,objectName:null==i?void 0:i.name,content:null==i?void 0:i.content}),{code:a}=yield this.rtcSignaling(e,li,!1,t);return a}))}setRTCTotalRes(e,n,r,s,o=""){return t(this,void 0,void 0,(function*(){const t={objectName:s,content:this._context.rtcCodec.encode(Ko.RtcValueInfo,{key:n.name,value:n.content},!0),valueInfo:[this._context.rtcCodec.encode(Ko.RtcValueInfo,{key:"uris",value:r},!0),this._context.rtcCodec.encode(Ko.RtcValueInfo,{key:"mcu_uris",value:o},!0)]},i=this._context.rtcCodec.encode(Ko.RtcUserSetDataInput,t),{code:a}=yield this.rtcSignaling(e,di,!0,i);return a}))}setRTCCDNUris(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcUserSetDataInput,{objectName:n,valueInfo:this._context.rtcCodec.encode(Ko.RtcValueInfo,{key:"cdn_uris",value:r},!0)}),{code:s}=yield this.rtcSignaling(e,di,!0,t);return s}))}getRTCData(e,n,r,s){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcDataInput,{interior:r,target:s,key:n}),{code:o,buffer:i}=yield this.rtcSignaling(e,ui,!0,t);if(o!==exports.ErrorCode.SUCCESS||!i)return{code:o};const{outInfo:a}=this._context.rtcCodec.decode(Ko.RtcQryOutput,i),l={};return a.forEach((e=>{l[e.key]=e.value})),{code:o,data:l}}))}removeRTCData(e,n,r,s,o){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcDataInput,{interior:r,target:s,key:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),{code:i}=yield this.rtcSignaling(e,ci,!1,t);return i}))}setRTCOutData(e,n,r,s){return t(this,void 0,void 0,(function*(){throw new Error("JSEngine's method not implemented.")}))}getRTCOutData(e,n){return t(this,void 0,void 0,(function*(){throw new Error("JSEngine's method not implemented.")}))}getRTCToken(e,n,r){return t(this,void 0,void 0,(function*(){const t=Wo(this._context.rtcCodec,n,r),{code:s,buffer:o}=yield this.rtcSignaling(e,hi,!0,t);if(s!==exports.ErrorCode.SUCCESS||!o)return{code:s};const{rtcToken:i}=this._context.rtcCodec.decode(Ko.RtcTokenOutput,o);return{code:s,data:{rtcToken:i}}}))}setRTCState(e,n){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.MCFollowInput,{state:n}),{code:r}=yield this.rtcSignaling(e,pi,!0,t);return r}))}getRTCUserList(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcQueryListInput,{order:2}),{code:n,buffer:r}=yield this.rtcSignaling(e,_i,!0,t);if(n!==exports.ErrorCode.SUCCESS||!r)return{code:n};return{code:n,data:$o(this._context.rtcCodec,r)}}))}joinLivingRoomAsAudience(e,n,r){return t(this,void 0,void 0,(function*(){const t=Wo(this._context.rtcCodec,n,r),{code:s,buffer:o}=yield this.rtcSignaling(e,gi,!0,t);if(s!==exports.ErrorCode.SUCCESS||!o)return{code:s};const{rtcToken:i,entries:a}=this._context.rtcCodec.decode(Ko.RtcViewerJoinedOutput,o);return{code:s,data:{token:i,kvEntries:a}}}))}quitLivingRoomAsAudience(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.SetUserStatusInput,{status:0}),{code:n}=yield this.rtcSignaling(e,Ei,!0,t);return n}))}rtcIdentityChange(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:r,identityChangeType:n,needSysChatroom:!1}),{code:s,buffer:o}=yield this.rtcSignaling(e,Ti,!0,t);if(s!==exports.ErrorCode.SUCCESS||!o)return{code:s};return{code:s,data:$o(this._context.rtcCodec,o)}}))}requestRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteTimeout:s,inviteInfo:o,roomId:i}=e,a=this._context.rtcCodec.encode(Ko.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,timeoutTime:s,inviteInfo:o}),{code:l}=yield this.rtcSignaling(i,fi,!0,a);return l}))}cancelRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteInfo:s,roomId:o}=e,i=this._context.rtcCodec.encode(Ko.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteInfo:s}),{code:a}=yield this.rtcSignaling(o,Ci,!0,i);return a}))}responseRoomPK(e){return t(this,void 0,void 0,(function*(){const{inviteUserId:t,inviteRoomId:n,inviteSessionId:r,content:s,key:o,value:i,agree:a,roomId:l}=e,d=this._context.rtcCodec.encode(Ko.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:r,content:s,key:o,value:i,answerCode:a?1:0}),{code:u}=yield this.rtcSignaling(l,Ri,!0,d);return u}))}endRoomPK(e){return t(this,void 0,void 0,(function*(){const{endRoomId:t,sessionId:n,content:r,keys:s,roomId:o}=e,i=this._context.rtcCodec.encode(Ko.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:r,inviteRoomKeys:s}),{code:a}=yield this.rtcSignaling(o,Si,!0,i);return a}))}registerRTCSignalListener(e){this._context.registerRTCSignalingListener(e)}rtcSignaling(e,t,n,r){return this._context.rtcSignaling(e,t,n,r)}getRTCJoinedUserInfo(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(Ko.RtcQueryUserJoinedInput,{userId:e}),{code:n,buffer:r}=yield this.rtcSignaling("",mi,!0,t);if(n!==exports.ErrorCode.SUCCESS||!r)return{code:n};return{code:n,data:(this._context.rtcCodec.decode(Ko.RtcQueryUserJoinedOutput,r).info||[]).map((e=>({deviceId:e.deviceId,roomId:e.roomId,joinTime:e.joinTime})))}}))}}var ta,na,ra,sa,oa,ia,aa,la,da,ua,ca;exports.StreamMessageResponseEventType=void 0,(ta=exports.StreamMessageResponseEventType||(exports.StreamMessageResponseEventType={})).INIT="INIT",ta.DATA="DATA",ta.END="END";class ha extends je{constructor(e,t){super(),na.add(this),ra.set(this,void 0),sa.set(this,new Map),oa.set(this,void 0),r(this,ra,e,"f"),r(this,oa,t,"f")}requestStreamMessageContent(e){return t(this,void 0,void 0,(function*(){const t=n(this,na,"a",ia).createTraceId();n(this,na,"a",ia).info(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_T,`messageUId: ${e}`,t);const r=yield Xe.create("requestStreamMessageContent").isLimitedString("messageUId",e,1,64,!0).fail(exports.ErrorCode.INVALID_PARAMETER_MESSAGE_UID,"messageUId is invalid.").result().tryTrans(n(this,ra,"f").validatorConnected).tryTrans((e=>{var t,n;return(null===(n=null===(t=null==e?void 0:e.streamServer)||void 0===t?void 0:t.addrs)||void 0===n?void 0:n.length)?$e(e.streamServer.addrs):Je(exports.ErrorCode.STREAM_MESSAGE_DISABLE)})).next((t=>n(this,na,"m",ca).call(this,e,t)));return n(this,na,"a",ia).summary(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_R,r,t,{messageUId:e}),r.wipe()}))}}function pa(e){return Object.assign({},e)}function _a(e,t,n){const r=n.value;n.value=function(...e){var t;if(1!==(null===(t=this.getNaviInfoFromCache())||void 0===t?void 0:t.userProfile))return Promise.resolve({code:exports.ErrorCode.RC_USER_PROFILE_SERVICE_UNAVAILABLE});return r.call(this,...e)}}function ga(e,t,n){const r=n.value;n.value=function(...e){if(!ma(this.getNaviInfoFromCache()))return Promise.resolve({code:exports.ErrorCode.RC_REAL_TIME_CONVERSATION_UNAVAILABLE});return r.call(this,...e)}}ra=new WeakMap,sa=new WeakMap,oa=new WeakMap,na=new WeakSet,ia=function(){return n(this,ra,"f").logger},aa=function(e,t,r){const s=n(this,sa,"f").get(e);s&&(n(this,sa,"f").delete(e),n(this,na,"m",la).call(this,e,exports.StreamMessageResponseEventType.END,t,s.msg))},la=function(e,t,n,r,s){this.emit("message",{code:n,messageUId:e,type:t,chunk:s,message:r})},da=function(e,t){e.content=Object.assign(Object.assign({},e.content),t),n(this,ra,"f").setMessageContent(e.messageId,e.content,e.messageType)},ua=function(e,t,r){const s=n(this,sa,"f").get(t);let o,i;switch(e){case"init":s.msg&&n(this,na,"m",da).call(this,s.msg,{content:"",stopReason:0,completeReason:0,isSynced:!1}),n(this,na,"m",la).call(this,t,exports.StreamMessageResponseEventType.INIT,exports.ErrorCode.SUCCESS,s.msg);break;case"complete":o=r.length?JSON.parse(r):{},i=o.complete||!1,s.msg&&n(this,na,"m",da).call(this,s.msg,{stopReason:o.stopReason||0,completeReason:o.completeReason||0,complete:i,isSynced:i}),n(this,na,"m",aa).call(this,t,o.stopReason||0,i);break;default:o=JSON.parse(r),s.cached+=o.content,s.msg&&n(this,na,"m",da).call(this,s.msg,{content:s.cached}),n(this,na,"m",la).call(this,t,exports.StreamMessageResponseEventType.DATA,exports.ErrorCode.SUCCESS,s.msg,{content:o.content,fullContent:s.cached})}},ca=function(e,r){return t(this,void 0,void 0,(function*(){if(n(this,sa,"f").has(e))return Je(exports.ErrorCode.STREAM_MESSAGE_REQUEST_IN_PROCESS,`Request in process, msgUId: ${e}`);if(n(this,sa,"f").size>=3)return Je(exports.ErrorCode.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED,"The request queue is full");const t=rr.createSSEClient({logger:n(this,na,"a",ia),msgUId:e,appkey:n(this,ra,"f").appkey,token:n(this,ra,"f").token,timeout:3e4,onRawContent:t=>{const r=t.split("\n\n");console.log("recv events ->",r),r.forEach((t=>{if(0===t.length)return;t.startsWith("data:")&&(t=`event:delta\n${t}`);const r=t.indexOf("\n"),s=t.slice(0,r).replace("event:",""),o=t.slice(r+1+5);n(this,na,"m",ua).call(this,s,e,o.trim())}))},onNetworkError:t=>{n(this,na,"m",aa).call(this,e,t,!1)}});if(!t.isOk)return t.wipe();const s=t.data,o={client:s,cached:"",msg:void 0};if(n(this,sa,"f").set(e,o),n(this,oa,"f")){const{code:t,data:r}=yield n(this,ra,"f").getLocalMessage(e);if(!r)return n(this,sa,"f").delete(e),Je(t,`message not found, msgUId: ${e}`);if(r.content.isSynced)return n(this,sa,"f").delete(e),Je(exports.ErrorCode.STREAM_MESSAGE_SYNCED,"synced");o.msg=r}const i=yield s.open(r.slice());return i.isOk||n(this,sa,"f").delete(e),i.wipe()}))};class Ea{constructor(e){this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor={[exports.MessageType.CHATROOM_MERGE_CHANGE]:this._processChrmMemChangeMessage.bind(this),[exports.MessageType.TYPING_STATUS]:this._processTypingStatusMessage.bind(this),[exports.MessageType.INTERCEPT]:this._processInterceptMessage.bind(this),[exports.MessageType.CHATROOM_SYNC_MSG]:this._processChrmSyncMessage.bind(this),[exports.MessageType.CHATROOM_MERGE_BLOCK]:this._processChrmMemBlockMessage.bind(this),[exports.MessageType.CHATROOM_MERGE_BAN]:this._processChrmMemBanMessage.bind(this)},this._messageProccessor={[exports.MessageType.READ_RECEIPT]:this._processReadReceiptMessage.bind(this),[exports.MessageType.READ_RECEIPT_REQUEST]:this._processReadReceiptRequestMessage.bind(this),[exports.MessageType.READ_RECEIPT_RESPONSE]:this._processReadReceiptResponseMessage.bind(this)},this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connection:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished: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,userGroupStatus:void 0,messageReadReceipt:void 0,syncReadStatus:void 0,subscribedUserStatusChange:void 0,subscribedRelationChange:void 0,syncSubscribedUserStatusFinished:void 0,ownUserProfileChanged:void 0,groupOperation:void 0,groupInfoChanged:void 0,groupMemberInfoChanged:void 0,groupApplicationEvent:void 0,groupRemarkChangedSync:void 0,groupFollowsChangedSync:void 0,friendAdd:void 0,friendDelete:void 0,friendApplicationStatusChanged:void 0,friendCleared:void 0,friendInfoChangedSync:void 0,databaseUpgradeWillStart:void 0,databaseUpgrading:void 0,databaseUpgradeDidComplete:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},e),this.appkey=this._options.appkey,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.map((e=>e.replace(/\/$/g,"")));const t={onConnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.DISCONNECTED),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),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this),messageReadReceipt:this._messageReadReceipt.bind(this),syncReadStatus:this._syncReadStatus.bind(this),subscribedUserStatusChange:this._subscribedUserStatusChange.bind(this),subscribedRelationChange:this._subscribedRelationChange.bind(this),syncSubscribedUserStatusFinished:this._syncSubscribedUserStatusFinished.bind(this),ownUserProfileChanged:this._ownUserProfileChanged.bind(this),groupOperation:this._groupOperation.bind(this),groupInfoChanged:this._groupInfoChanged.bind(this),groupMemberInfoChanged:this._groupMemberInfoChanged.bind(this),groupApplicationEvent:this._groupApplicationEvent.bind(this),groupRemarkChangedSync:this._groupRemarkChangedSync.bind(this),groupFollowsChangedSync:this._groupFollowsChangedSync.bind(this),friendAdd:this._friendAdd.bind(this),friendDelete:this._friendDelete.bind(this),friendApplicationStatusChanged:this._friendApplicationStatusChanged.bind(this),friendCleared:this._friendCleared.bind(this),friendInfoChangedSync:this._friendInfoChangedSync.bind(this),databaseUpgradeWillStart:this._databaseUpgradeWillStart.bind(this),databaseUpgrading:this._databaseUpgrading.bind(this),databaseUpgradeDidComplete:this._databaseUpgradeDidComplete.bind(this)};this.rtcCodec=new Yo(jo,Qo);const n=ft();this._engine=n?new RCCppEngine(this.rtcCodec,t,this._options):new hd(this.rtcCodec,t,this._options),this.logger=this._engine.getInnerLogger(),this.sse=new ha(this,n)}static init(e){if(this._context)return this._context.logger.warn(exports.LogTagId.A_INIT_REPEAT_O),this._context;this._context=new Ea(e),this._context.logger.info(exports.LogTagId.L_INIT_O,JSON.stringify({appkey:e.appkey,navigators:e.navigators,typingExpireTime:e.typingExpireTime})),this._context.logger.warn(exports.LogTagId.L_IMSDK_VER_O,JSON.stringify({commitId:"9c0e8c0961368f1def21261305314c8406ca410e",version:"5.16.0-c-rtc-alpha.2"}));const t=this._context._engine;return rr.setNetworkStatusListener(t.setNetwork.bind(t)),this._context}static getContext(){return this._context}getOptions(){return this._options}static destroy(){return t(this,void 0,void 0,(function*(){this._context&&(this._context.logger.info(exports.LogTagId.L_DESTROY_O),yield this._context._destroy(),this._context=void 0)}))}get chatroom(){return this._engine.chatroom}install(e,t){const n=this.logger.createTraceId();if(this.logger.info(exports.LogTagId.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(exports.LogTagId.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];const r="RCRTC"===e.tag?new ea(this):new zi(this);let s=null;try{if(!e.verify(rr))return null;s=e.setup(r,rr,t)}catch(e){this.logger.error(exports.LogTagId.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,n)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),s&&(this._pluginContextQueue.push(r),this._pluginInstanseMap[e.tag]=s),s}_onConnectionStatusChange(e,t){var n,r;this.logger.warn(exports.LogTagId.A_CONNECT_S,`status: ${e}, code: ${t}`),null===(r=(n=this._watcher).connection)||void 0===r||r.call(n,e,t),this._pluginContextQueue.forEach((n=>{var r;null===(r=n.onconnectionstatechange)||void 0===r||r.call(n,e,t)}))}_processChrmMemChangeMessage(e){if("function"==typeof this._watcher.chatroomState){const t={},n=[];let{memberCount:r=0}=e.content;Array.isArray(e.content.userList)&&e.content.userList.forEach((e=>{t[e.userId]=e.status,n.push({userId:e.userId,action:e.status,extra:e.extra})})),this._watcher.chatroomState({userChange:{users:t,chatroomId:e.targetId,memberCount:r,userList:n}})}return!0}_processTypingStatusMessage(e){if(this._addTypingInfo(pa(e)),this._watcher.typingState)return!0}_processInterceptMessage(e){const t={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===exports.ConversationType.ULTRA_GROUP){const{sourceType:n}=e.content;if(t.sourceType=n,(n===exports.MessageBlockSourceType.MSG_EXPANSION||n===exports.MessageBlockSourceType.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(exports.LogTagId.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0}_processChrmSyncMessage(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:e.content.chatroomId,status:e.content.status,reason:e.content.reason,time:e.content.time,extra:e.content.extra||null}}),!0}_processChrmMemBlockMessage(e){var t;const{content:n}=e;return n.operateType===exports.ChrmMemOperateType.Blocked&&(null===(t=n.userList)||void 0===t?void 0:t.includes(this.getCurrentUserId()))&&this._engine.removeChatroomFromCatch(n.chatroomId),"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:n.chatroomId,operateType:n.operateType,durationTime:n.durationTime,operateTime:n.operateTime,userIdList:n.userList,extra:n.extra||null}}),!0}_processChrmMemBanMessage(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:e.content.chatroomId,banType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0}_processReadReceiptMessage(e){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime,e.senderUserId)}_processReadReceiptRequestMessage(e){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId)}_processReadReceiptResponseMessage(e){var t;const n=null===(t=e.content)||void 0===t?void 0:t.receiptMessageDic,r=this._engine.getCurrentUserId();n&&Array.isArray(n[r])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[r])}_messageReceiver(e,t,n){var r,s,o,i;if(!(null===(s=(r=this._compatibleMessageProccessor)[e.messageType])||void 0===s?void 0:s.call(r,e))&&!this._pluginContextQueue.some((t=>{if(!t.onmessage)return!1;try{return t.onmessage(pa(e))}catch(e){return this.logger.error(exports.LogTagId.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(i=(o=this._watcher).message)||void 0===i||i.call(o,pa(e),t,n),e}_batchMessageReceiver(e,t,n){const r=[],s=[],o=[exports.MessageType.READ_RECEIPT,exports.MessageType.READ_RECEIPT_REQUEST,exports.MessageType.READ_RECEIPT_RESPONSE];e.forEach((e=>{const i=this._messageReceiver(e,t,n);i&&o.includes(i.messageType)?s.push(i):i&&r.push(i)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(exports.LogTagId.L_BATCH_MESSAGE_O,r.map((e=>e.messageUId)).join(",")),this._watcher.batchMessage(r)),s.length&&s.forEach((e=>{this._messageProccessor[e.messageType]&&this._messageProccessor[e.messageType](e)}))}_chatroomInfoListener(e){var t,n;null===(n=(t=this._watcher).chatroomState)||void 0===n||n.call(t,e)}_conversationInfoListener(e){var t,n;null===(n=(t=this._watcher).conversationState)||void 0===n||n.call(t,e)}_expansionInfoListener(e){var t,n;null===(n=(t=this._watcher).expansion)||void 0===n||n.call(t,e)}_tagListener(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)}_conversationTagListener(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)}_typingStatusListener(e){var t,n;null===(n=(t=this._watcher).typingState)||void 0===n||n.call(t,e)}_pullFinishedListener(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)}_MessageBlockedListener(e){var t,n;null===(n=(t=this._watcher).messageBlocked)||void 0===n||n.call(t,e)}_messageDeliveredListerer(e){var t,n;null===(n=(t=this._watcher).messageDelivered)||void 0===n||n.call(t,e)}_groupMessageDeliveredStatusListerer(e){var t,n;null===(n=(t=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(t,e)}_callInfoListener(e){this._pluginContextQueue.forEach((t=>{try{t.onCallInfo&&t.onCallInfo(e)}catch(e){this.logger.warn(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))}_ultraGroupEnableListener(e){var t,n;null===(n=(t=this._watcher).ultraGroupEnable)||void 0===n||n.call(t,e)}_operateStatusListener(e){var t,n;null===(n=(t=this._watcher).operateStatus)||void 0===n||n.call(t,e)}_ultraGroupMessageExpansionUpdatedListener(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(t,e)}_ultraGroupMessageModifiedListener(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(t,e)}_ultraGroupMessageRecalledListener(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(t,e)}_ultraGroupChannelChangeTypeListener(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(t,e)}_ultraGroupChannelUserKickedListener(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(t,e)}_ultraGroupChannelDeleteListener(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(t,e)}_userGroupStatusListener(e){var t,n;null===(n=(t=this._watcher).userGroupStatus)||void 0===n||n.call(t,e)}_messageReadReceipt(e){var t,n;null===(n=(t=this._watcher).messageReadReceipt)||void 0===n||n.call(t,e)}_syncReadStatus(e){var t,n;null===(n=(t=this._watcher).syncReadStatus)||void 0===n||n.call(t,e)}_subscribedUserStatusChange(e){var t,n;null===(n=(t=this._watcher).subscribedUserStatusChange)||void 0===n||n.call(t,e)}_subscribedRelationChange(e){var t,n;null===(n=(t=this._watcher).subscribedRelationChange)||void 0===n||n.call(t,e)}_syncSubscribedUserStatusFinished(e){var t,n;this.logger.info(exports.LogTagId.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S),null===(n=(t=this._watcher).syncSubscribedUserStatusFinished)||void 0===n||n.call(t,e)}_ownUserProfileChanged(e){var t,n;this.logger.info(exports.LogTagId.L_OWN_USER_PROFILE_CHANGED_S),null===(n=(t=this._watcher).ownUserProfileChanged)||void 0===n||n.call(t,e)}_groupOperation(e){var t,n;null===(n=(t=this._watcher).groupOperation)||void 0===n||n.call(t,e)}_groupInfoChanged(e){var t,n;null===(n=(t=this._watcher).groupInfoChanged)||void 0===n||n.call(t,e)}_groupMemberInfoChanged(e){var t,n;null===(n=(t=this._watcher).groupMemberInfoChanged)||void 0===n||n.call(t,e)}_groupApplicationEvent(e){var t,n;null===(n=(t=this._watcher).groupApplicationEvent)||void 0===n||n.call(t,e)}_groupRemarkChangedSync(e){var t,n;null===(n=(t=this._watcher).groupRemarkChangedSync)||void 0===n||n.call(t,e)}_groupFollowsChangedSync(e){var t,n;null===(n=(t=this._watcher).groupFollowsChangedSync)||void 0===n||n.call(t,e)}_friendAdd(e){var t,n;null===(n=(t=this._watcher).friendAdd)||void 0===n||n.call(t,e)}_friendDelete(e){var t,n;null===(n=(t=this._watcher).friendDelete)||void 0===n||n.call(t,e)}_friendApplicationStatusChanged(e){var t,n;null===(n=(t=this._watcher).friendApplicationStatusChanged)||void 0===n||n.call(t,e)}_friendCleared(e){var t,n;null===(n=(t=this._watcher).friendCleared)||void 0===n||n.call(t,e)}_friendInfoChangedSync(e){var t,n;null===(n=(t=this._watcher).friendInfoChangedSync)||void 0===n||n.call(t,e)}_rtcDataChange(e,t){this._pluginContextQueue.forEach((n=>{var r;null===(r=n.onrtcdatachange)||void 0===r||r.call(n,e,t)}))}_naviDataChange(e){this._pluginContextQueue.forEach((t=>{var n;null===(n=t.onnavidatachange)||void 0===n||n.call(t,e)}))}_databaseUpgradeWillStart(){var e,t;this.logger.info(exports.LogTagId.L_DB_UPGRATE_START_S),null===(t=(e=this._watcher).databaseUpgradeWillStart)||void 0===t||t.call(e)}_databaseUpgrading(e){var t,n;this.logger.info(exports.LogTagId.L_DB_UPGRATING_S,e),null===(n=(t=this._watcher).databaseUpgrading)||void 0===n||n.call(t,e)}_databaseUpgradeDidComplete(e){var t,n;this.logger.info(exports.LogTagId.L_DB_UPGRATE_COMPLETE_S),null===(n=(t=this._watcher).databaseUpgradeDidComplete)||void 0===n||n.call(t,e)}assignWatcher(e){Object.keys(this._watcher).forEach((t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];this._watcher[t]=at(n)||it(n)?n:void 0}}))}_resetWatcher(){Object.keys(this._watcher).forEach((e=>{this._watcher[e]=void 0}))}_addTypingInfo(e){const{senderUserId:t,conversationType:n,targetId:r,content:s,channelId:o}=e,{typingContentType:i}=s,a=`${n}#${r}#${o||""}`;this._typingInfo[a]||(this._typingInfo[a]=[]);const l=this._typingInfo[a].findIndex((e=>e.userId===t));l>=0&&this._typingInfo[a][l].messageType===i?this._typingInfo[a][l].timestamp=Date.now():(l>=0&&this._typingInfo[a].splice(l,1),this._typingInfo[a].push({userId:t,messageType:i,timestamp:Date.now()}),this._typingChangedList.includes(a)||this._typingChangedList.push(a),this._startCheckTypingInfo())}_startCheckTypingInfo(){-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((()=>{for(const e in this._typingInfo){const t=this._typingInfo[e].length;this._typingInfo[e]=this._typingInfo[e].filter((e=>Date.now()-e.timestamp<this._typingExpireTime)),this._typingInfo[e].length===t||this._typingChangedList.includes(e)||this._typingChangedList.push(e),0===this._typingInfo[e].length&&delete this._typingInfo[e]}this._notifyTypingChanged()}),500))}_notifyTypingChanged(){if(this._typingChangedList.length>0){const e=this._typingChangedList.map((e=>({conversationType:Number(e.split("#")[0]),targetId:e.split("#")[1],channelId:e.split("#")[2],list:this._typingInfo[e]||[]})));this._typingStatusListener(e),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)}getConnectedTime(){return this._engine.getConnectedTime()}getServerTime(){return this._engine.getServerTime()}getDeviceId(){return this._engine.getDeviceId()}getCurrentUserId(){return this._engine.getCurrentUserId()}getConnectionStatus(){return this._engine.getConnectionStatus()}get validatorConnected(){return()=>this._engine.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED?$e(this._engine.getNaviInfoFromCache()):Je(exports.ErrorCode.RC_NET_UNAVAILABLE)}get token(){return this._token}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._engine.refetchNaviInfo()}))}connect(e,n,r){var s,o;return t(this,void 0,void 0,(function*(){this._token=e;const t=yield rr.getNetworkType();this._engine.setNetwork({status:!0,type:t},!0);const i=!!this._pluginInstanseMap.RCCallPlus,{code:a,data:l}=yield this._engine.connect(e,n,i,r);if(a!==exports.ErrorCode.SUCCESS)return{code:a};if(1!==this._engine.getNaviInfoFromCache().type){const e=ke.getInfo();null===(o=(s=this._engine).reportSDKInfo)||void 0===o||o.call(s,e)}return{code:a,userId:l}}))}disconnect(e){return t(this,void 0,void 0,(function*(){return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},yield this._engine.disconnect(e),this._pluginContextQueue.forEach((e=>{if(e.ondisconnect)try{e.ondisconnect()}catch(e){this.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}})),Promise.resolve()}))}reconnect(e){return this.connect(this.token,!!e,this.logger.createTraceId())}_getTokenWithoutNavi(){return this._token.replace(/@.+$/,"@")}_channelIdConvert(e,t){if(e!==exports.ConversationType.ULTRA_GROUP)return t;const n=this.getNaviInfoFromCache();return!!(2&((null==n?void 0:n.ugDriven)||0))&&!t?"RCDefault":t}getNaviInfoFromCache(){return this._engine.getNaviInfoFromCache()}registerMessageType(e,t,n,r=[],s=!1){rt(r)&&r.length>0&&(this._registerMessageSearchPropsMapping[e]=r),this._engine.registerMessageType(e,t,n,r,s)}registerRTCSignalingListener(e){this._engine.registerRTCSignalingListener(e)}checkSearchPropsMsg(e,t){const n=this._registerMessageSearchPropsMapping[e],r={};return n&&it(t)&&Object.keys(t).forEach((e=>{if(!n.includes(e))return;const s=t[e];nt(s)&&(s>-(2**64)&&s<2**64&&Number.isInteger(s)||(r[e]=s))})),Object.keys(r).length>0?{msg:JSON.stringify(r),code:exports.ErrorCode.SEARCH_PROPS_LIMIT_ERROR}:{code:exports.ErrorCode.SUCCESS}}_handleExpansioResult(e,t){if(!t)return;const{isIllgalEx:n,isExKeyOrValLengthExceedLimit:r,isExceedLimit:s}=_t(e);return s||r?exports.ErrorCode.EXPANSION_LIMIT_EXCEET:n?exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION:void 0}sendMessage(e,t,n,r,s){const{code:o,msg:i}=this.checkSearchPropsMsg(n.messageType,n.content);if(o!==exports.ErrorCode.SUCCESS)return Promise.resolve({code:o,msg:i});if(e===exports.ConversationType.SYSTEM&&n.messageType!==exports.MessageType.SYNC_READ_STATUS)return Promise.resolve({code:exports.ErrorCode.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(n.messageType===exports.MessageType.STREAM_MESSAGE)return Promise.resolve({code:exports.ErrorCode.MESSAGE_NOT_SUPPORT_SENDING});const{canIncludeExpansion:a=!1,expansion:l}=n,d=this._handleExpansioResult(l,a);if(d)return Promise.resolve({code:d});const{isMentioned:u,mentionedUserIdList:c,mentionedType:h}=n;u&&[exports.ConversationType.GROUP,exports.ConversationType.ULTRA_GROUP].includes(e)?n.content.mentionedInfo=function(e,t,n){var r,s,o;return{userIdList:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.userIdList)||t,type:(null===(s=e.mentionedInfo)||void 0===s?void 0:s.type)||n||exports.MentionedType.ALL,mentionedContent:(null===(o=e.mentionedInfo)||void 0===o?void 0:o.mentionedContent)||""}}(n.content,c,h):delete n.content.mentionedInfo;const p=JSON.stringify(n.content);if((e=>{let t,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),n+=t<127?1:t<=2047?2:t<=65535?3:4;return n})(p)>Re)return Promise.resolve({code:exports.ErrorCode.RC_MSG_CONTENT_EXCEED_LIMIT});if(e===exports.ConversationType.ULTRA_GROUP)return n.channelId=this._channelIdConvert(e,n.channelId),this._engine.sendUltraMessage(t,n,r,s);const _=this.getNaviInfoFromCache();return(null==_?void 0:_.grpRRVer)&&n.messageType===exports.MessageType.READ_RECEIPT_RESPONSE?Promise.resolve({code:exports.ErrorCode.READ_RECEIPT_ERROR}):this._engine.sendMessage(e,t,n,r,s)}sendExpansionMessage(e){return t(this,void 0,void 0,(function*(){const{channelId:t,conversationType:n,targetId:r,messageUId:s,keys:o,expansion:i,removeAll:a,canIncludeExpansion:l,messageType:d}=e;if(d===exports.MessageType.STREAM_MESSAGE&&((null==o?void 0:o.includes("RC_Ext_StreamMsgSummary"))||(null==i?void 0:i.RC_Ext_StreamMsgSummary)))return{code:exports.ErrorCode.STREAM_MESSAGE_EXPANSION_KEY_ERROR};if(!l)return{code:exports.ErrorCode.MESSAGE_KV_NOT_SUPPORT};const{isIllgalEx:u,isExKeyOrValLengthExceedLimit:c,isExceedLimit:h}=_t(i);if(h||c)return Promise.resolve({code:exports.ErrorCode.EXPANSION_LIMIT_EXCEET});if(u)return Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION});const p={mid:s};i&&(p.put=i),o&&(p.del=o),a&&(p.removeAll=1);const{code:_}=yield this._engine.sendMessage(n,r,{content:p,messageType:exports.MessageType.EXPANSION_NOTIFY,channelId:t});return{code:_}}))}sendReadReceiptMessage(e,n,r){return t(this,void 0,void 0,(function*(){const t=this.getNaviInfoFromCache();return 1!==((null==t?void 0:t.grpRRVer)||0)?{code:exports.ErrorCode.READ_RECEIPT_ERROR,msg:"The read receipt switch is not on, please call the sendMessage method!"}:this._engine.sendReadReceiptMessage(e,n,r)}))}getMessageReader(e,n,r){return t(this,void 0,void 0,(function*(){const t=this.getNaviInfoFromCache();return 1!==((null==t?void 0:t.grpRRVer)||0)?{code:exports.ErrorCode.READ_RECEIPT_ERROR}:this._engine.getMessageReader(e,n,r||"")}))}sendReadReceiptMessageV4(e,n,r){return t(this,void 0,void 0,(function*(){return this._engine.sendReadReceiptMessageV4(e,n,r)}))}getMessageReadReceiptV4(e,n){return t(this,void 0,void 0,(function*(){return this._engine.getMessageReadReceiptV4(e,n)}))}batchGetMessageReadReceiptInfoV4(e,n){return t(this,void 0,void 0,(function*(){return this._engine.batchGetMessageReadReceiptInfoV4(e,n)}))}updateConversationReadTime(e,n){return t(this,void 0,void 0,(function*(){return this._engine.updateConversationReadTime(e,n)}))}_destroy(){return t(this,void 0,void 0,(function*(){this._resetWatcher(),this._engine.destroy(),rr.removeNetworkStatusListener(),yield this.disconnect(),this._pluginContextQueue.forEach((e=>{if(e.ondestroy)try{e.ondestroy()}catch(e){this.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={}}))}getHistoryMessage(e,t,n,r,s,o,i,a){const l={timestamp:n||0,count:r||20,order:s||0,channelId:o||""};if(e===exports.ConversationType.ULTRA_GROUP){const n=this._channelIdConvert(e,l.channelId);return l.channelId=n,this._engine.getUltraHistoryMsg(t,l,a)}return this._engine.getHistoryMessage(e,t,l.timestamp,l.count,l.order,l.channelId,i||"",a)}getMessages(e,t,n,r,s,o,i){const a={timestamp:n||0,count:r||20,order:s||0,channelId:o||""};if(e===exports.ConversationType.ULTRA_GROUP){const n=this._channelIdConvert(e,a.channelId);return a.channelId=n,this._engine.getUltraHistoryMsg(t,a,i)}return this._engine.getMessages(e,t,a.timestamp,a.count,a.order,a.channelId,i)}getContinuousMessages(e,t,n=0,r=20,s=0,o=""){return this._engine.getContinuousMessages(e,t,n,r,s,o)}getHistoryMessagesByObjectNames(e,t,n,r,s,o,i){return this._engine.getHistoryMessagesByObjectNames(e,t,n,r,s,o,i)}getConversationList(e,t,n,r,s){if(t===exports.ConversationType.ULTRA_GROUP){const e=exports.ErrorCode.METHOD_NOT_SUPPORT;return Promise.resolve({code:e,msg:exports.ErrorCode[e]})}return this._engine.getConversationList(e||300,t,n,r,s||"")}getConversationsByPage(e,t,n,r,s){return this._engine.getConversationsByPage(e,t,n,r,s)}getConversation(e,t,n){const r=this._channelIdConvert(e,n);return this._engine.getConversation(e,t,r||"")}removeConversation(e,t,n){return e===exports.ConversationType.ULTRA_GROUP?Promise.resolve(exports.ErrorCode.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n||"")}batchRemoveConversation(e){return this._engine.batchRemoveConversation(e)}getUltraGroupList(e){return this._engine.getUltraGroupList(e)}getBlockUltraGroupList(){return this._engine.getBlockUltraGroupList()}getTopUltraGroupList(){return this._engine.getTopUltraGroupList()}clearUnreadCount(e,t,n){if(e===exports.ConversationType.ULTRA_GROUP){const r=this._channelIdConvert(e,n);return this._engine.clearUltraUnreadcount(t,r||"")}return this._engine.clearConversationUnreadCount(e,t,n||"")}clearAllUnreadCount(){return this._engine.clearAllUnreadCount()}getUnreadCount(e,t,n){const r=this._channelIdConvert(e,n);return this._engine.getConversationUnreadCount(e,t,r||"")}getTotalUnreadCount(e,t,n){if(t&&t.includes(exports.ConversationType.ULTRA_GROUP)){const e=exports.ErrorCode.METHOD_NOT_SUPPORT;return Promise.resolve({code:e,msg:exports.ErrorCode[e]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[exports.ConversationType.PRIVATE,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.PUBLIC_SERVICE],!!n)}getTotalUnreadCountByLevels(e,t,n){return this._engine.getTotalUnreadCountByLevels(e,t,n)}getFirstUnreadMessage(e,t,n){return this._engine.getFirstUnreadMessage(e,t,n||"")}getFirstUnreadMessageInfo(e,t,n){return this._engine.getFirstUnreadMessageInfo(e,t,n)}setConversationNotificationLevel(e,n,r,s){return t(this,void 0,void 0,(function*(){const t=this._channelIdConvert(e,s);return this._engine.setConversationNotificationLevel(e,n,r,t||"")}))}batchSetConversationNotificationLevel(e,t){return this._engine.batchSetConversationNotificationLevel(e,t)}setConversationStatus(e,t,n,r,s,o=!0){if(e===exports.ConversationType.ULTRA_GROUP&&void 0!==n)return Promise.resolve(exports.ErrorCode.METHOD_NOT_SUPPORT);const i=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:this._channelIdConvert(e,s)||"",isUpdateTime:o}];return this._engine.batchSetConversationStatus(i)}setConversationToTop(e,t,n,r,s){return this._engine.setConversationToTop(e,t,n,r,s)}batchSetConversationToTop(e,t,n){return this._engine.batchSetConversationToTop(e,t,!!n)}saveConversationMessageDraft(e,t,n,r){const s=this._channelIdConvert(e,r);return this._engine.saveConversationMessageDraft(e,t,n,s||"")}getConversationMessageDraft(e,t,n){const r=this._channelIdConvert(e,n);return this._engine.getConversationMessageDraft(e,t,r||"")}clearConversationMessageDraft(e,t,n){const r=this._channelIdConvert(e,n);return this._engine.clearConversationMessageDraft(e,t,r||"")}recallMessage(e,n){return t(this,void 0,void 0,(function*(){const t=((e,t)=>Xe.create(e).isObject("conversatino",t,!0).fail(exports.ErrorCode.INVALID_PARAMETER_CONVERSATION).isValueOf("conversationType",t.conversationType,exports.ConversationType,!0).fail(exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_TYPE).validate("targetId",t.targetId,pt,!0).fail(exports.ErrorCode.INVALID_PARAMETER_TARGET_ID).validate("channelId",t.channelId,ht).fail(exports.ErrorCode.INVALID_PARAMETER_CHANNEL_ID))("recallMessage",e).isString("messageUId",n.messageUId,!0).fail(exports.ErrorCode.INVALID_PARAMETER_MESSAGE_UID).isInteger("sentTime",n.sentTime,!1).fail(exports.ErrorCode.INVALID_PARAMETER_TIMESTAMP).isBoolean("disableNotification",n.disableNotification).fail(exports.ErrorCode.INVALID_PARAMETER_DISABLE_NOTIFICATION).isObject("pushConfig",n.pushConfig).fail(exports.ErrorCode.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("disableUpdateLastMessage",n.disableUpdateLastMessage).fail(exports.ErrorCode.INVALID_DISABLE_UPDATE_LAST_MESSAGE).isLimitedTypedArray("directionalUserIdList",n.directionalUserIdList,300,pt,!1,1).fail(exports.ErrorCode.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validatorConnected);if(!t.isOk)return this.logger.warn(exports.LogTagId.A_RECALL_MESSAGE_E,t.errmsg()),t.wipe();const{messageUId:r}=n,s=this.logger.createTraceId();this.logger.info(exports.LogTagId.A_RECALL_MESSAGE_T,JSON.stringify({messageUId:r}),s);const{conversationType:o,channelId:i}=e;e.channelId=this._channelIdConvert(o,i)||"";const a=yield this._engine.recallMsg(e,n);return this.logger.summary(exports.LogTagId.A_RECALL_MESSAGE_R,a,s,{messageUId:r}),a}))}deleteRemoteMessage(e,t,n,r){if(e===exports.ConversationType.ULTRA_GROUP&&ft())return Promise.resolve(exports.ErrorCode.METHOD_NOT_SUPPORT);const s=this._channelIdConvert(e,r);return this._engine.deleteRemoteMessage(e,t,n,s||"")}deleteRemoteMessageByTimestamp(e,t,n,r){const s=this._channelIdConvert(e,r);return this._engine.deleteRemoteMessageByTimestamp(e,t,n,s||"")}joinChatroom(e,t=10,n,r){return this._engine.joinChatroom(e,t,r,n)}joinExistChatroom(e,t=10,n,r){return this._engine.joinExistChatroom(e,t,r,n)}quitChatroom(e){return this._engine.quitChatroom(e)}getChatroomInfo(e,t,n){return this._engine.getChatroomInfo(e,t||0,n||0)}setChatroomEntry(e,t){const{key:n,value:r}=t;return wt(n)?Vt(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_VALUE):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)}setChatroomEntries(e,t){for(let e=0;e<t.entries.length;e++){const n=t.entries[e],{key:r,value:s}=n;if(!wt(r))return Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_KEY});if(!Vt(s))return Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_VALUE})}const n=Object.assign(Object.assign({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,n)}forceSetChatroomEntry(e,t){const{key:n,value:r}=t;return wt(n)?Vt(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_VALUE):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)}removeChatroomEntry(e,t){const{key:n}=t;return wt(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)}removeChatroomEntries(e,t){for(let e=0;e<t.entries.length;e++){const n=t.entries[e],{key:r}=n;if(!wt(r))return Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_KEY})}return this._engine.removeChatroomEntries(e,t)}forceRemoveChatroomEntry(e,t){const{key:n}=t;return wt(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)}getChatroomEntry(e,t){return this._engine.getChatroomEntry(e,t)}getAllChatroomEntries(e){return this._engine.getAllChatroomEntry(e)}getChatroomHistoryMessages(e,t,n,r){return this._engine.getChatroomHistoryMessages(e,r||0,t||20,n||0)}getFileToken(e,n,r,s,o,i){return t(this,void 0,void 0,(function*(){const t=this.getNaviInfoFromCache(),a=(null==t?void 0:t.uploadServer)||"",l=(null==t?void 0:t.ossConfig)||"",{code:d,data:u}=yield this._engine.getFileToken(e,n,r,s,o,i);return d===exports.ErrorCode.SUCCESS&&u?Promise.resolve(Object.assign(u,{qiniu:a,ossConfig:u.ossConfig||l})):Promise.reject(d)}))}getFileUrl(e,n,r,s){return t(this,void 0,void 0,(function*(){const{code:t,data:o}=yield this._engine.getFileUrl(e,r,n,s);return t===exports.ErrorCode.SUCCESS?Promise.resolve(o):Promise.reject(t)}))}createTag(e){return t(this,void 0,void 0,(function*(){return this._engine.createTag(e)}))}removeTag(e){return t(this,void 0,void 0,(function*(){return this._engine.removeTag(e)}))}updateTag(e){return t(this,void 0,void 0,(function*(){return this._engine.updateTag(e)}))}getTagList(){return t(this,void 0,void 0,(function*(){return this._engine.getTagList()}))}addTagForConversations(e,n){return t(this,void 0,void 0,(function*(){if(n.length>1e3)return Promise.resolve({code:exports.ErrorCode.CONVER_OUT_LIMIT_ERROR});const t=n.map((e=>{const{conversationType:t,targetId:n,channelId:r}=e;return{conversationType:t,targetId:n,channelId:this._channelIdConvert(t,r)}}));return this._engine.addTagForConversations(e,t)}))}removeTagForConversations(e,n){return t(this,void 0,void 0,(function*(){const t=n.map((e=>{const{conversationType:t,targetId:n,channelId:r}=e;return{conversationType:t,targetId:n,channelId:this._channelIdConvert(t,r)}}));return this._engine.removeTagForConversations(e,t)}))}removeTagsForConversation(e,n){return t(this,void 0,void 0,(function*(){const t=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=t,this._engine.removeTagsForConversation(e,n)}))}getConversationListByTag(e,n,r,s){return t(this,void 0,void 0,(function*(){return this._engine.getConversationListByTag(e,n,r,s)}))}getUnreadCountByTag(e,n){return t(this,void 0,void 0,(function*(){return this._engine.getUnreadCountByTag(e,n)}))}setConversationStatusInTag(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._channelIdConvert(n.conversationType,n.channelId);return n.channelId=t,this._engine.setConversationStatusInTag(e,n,r)}))}getTagsForConversation(e){return t(this,void 0,void 0,(function*(){const t=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=t,this._engine.getTagsForConversation(e)}))}getBlockConversationList(){return this._engine.getBlockConversationList()}getTopConversationList(e,t){return e&&0!==e.length||(e=[exports.ConversationType.PRIVATE,exports.ConversationType.CHATROOM,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.APP_PUBLIC_SERVICE,exports.ConversationType.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t||"")}getUnreadConversationList(e){return e&&0!==e.length||(e=[exports.ConversationType.PRIVATE,exports.ConversationType.CHATROOM,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.APP_PUBLIC_SERVICE,exports.ConversationType.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(e)}getUnreadMentionedCount(e){const t=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=t,this._engine.getUnreadMentionedCount(e)}getAllUnreadMentionedCount(){return this._engine.getAllUnreadMentionedCount()}sendUltraGroupTypingStatus(e){if(e.conversationType!==exports.ConversationType.ULTRA_GROUP){const e=exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:e,msg:exports.ErrorCode[e]})}const t=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=t,this._engine.sendUltraGroupTypingStatus(e)}getUltraGroupMessageListByMessageUId(e){const t=e.messages.map((t=>{const{sendTime:n,messageUId:r,channelId:s}=t;return{sendTime:n,messageUId:r,channelId:this._channelIdConvert(e.conversationType,s)}}));return e.messages=t,this._engine.getUltraGroupMessageListByMessageUId(e)}expandUltraMessage(e){return t(this,void 0,void 0,(function*(){const{conversationType:t,expansion:n,canIncludeExpansion:r}=e;if(t!==exports.ConversationType.ULTRA_GROUP){const e=exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT;return{code:e,msg:exports.ErrorCode[e]}}if(!r)return{code:exports.ErrorCode.MESSAGE_KV_NOT_SUPPORT};const{isIllgalEx:s,isExKeyOrValLengthExceedLimit:o,isExceedLimit:i}=_t(n);if(i||o)return{code:exports.ErrorCode.EXPANSION_LIMIT_EXCEET};if(s)return{code:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION};const{code:a}=yield this._engine.expandUltraMessage(e);return{code:a}}))}modifyMessage(e){return t(this,void 0,void 0,(function*(){if(e.conversationType!==exports.ConversationType.ULTRA_GROUP){const e=exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT;return{code:e,msg:exports.ErrorCode[e]}}const{code:t}=yield this._engine.modifyMessage(e);return{code:t}}))}getUltraGroupUnreadMentionedCountByTargetId(e,t){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e,t)}getUltraGroupUnreadCountByTargetId(e,t){return this._engine.getUltraGroupUnreadCountByTargetId(e,t)}getAllUltraGroupUnreadCount(e=!1){return this._engine.getAllUltraGroupUnreadCount(e)}getAllConversationState(){return this._engine.getAllConversationState()}getUltraGroupUnreadMentionedMessages(e){const t=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupUnreadMentionedMessages(e)}getUltraGroupFirstUnreadMessageTimestamp(e){const t=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupFirstUnreadMessageTimestamp(e)}getUltraGroupUnreadInfoList(e){return this._engine.getUltraGroupUnreadInfoList(e)}callExtra(e,...t){return this._engine.callExtra(e,...t)}getOSInfo(){return this._engine.getOSInfo()}getProcessInfo(){return this._engine.getProcessInfo()}getMainProcessInfo(){return this._engine.getMainProcessInfo()}setCallInfo(e,t,n){return this._engine.setCallInfo(e,t,n)}getGroupMessageDeliverList(e,t,n=""){return this._engine.getGroupMessageDeliverList(e,t,n)}getPrivateMessageDeliverTime(e,t=""){return this._engine.getPrivateMessageDeliverTime(e,t)}_isEnableSubDriven(e){const{subDriven:t=0}=this.getNaviInfoFromCache()||{};switch(e){case exports.SubscribeType.ONLINE_STATUS:return 1&t;case exports.SubscribeType.USER_PROFILE:return 2&t;default:return!1}}subscribeUser(e,t,n){return this._isEnableSubDriven(t)?this._engine.subscribeUser(e,t,n):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})}unSubscribeUser(e,t){return this._isEnableSubDriven(t)?this._engine.unSubscribeUser(e,t):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})}getSubscribeUserList(e,t,n){return this._isEnableSubDriven(e)?this._engine.getSubscribeUserList(e,t,n):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})}getSubscribeUserStatus(e,t){return this._isEnableSubDriven(e)?this._engine.getSubscribeUserStatus(e,t):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})}updateMyUserProfile(e){return this._engine.updateMyUserProfile(e)}getUserProfiles(e){return this._engine.getUserProfiles(e)}getMyUserProfile(){return this._engine.getMyUserProfile()}updateMyUserProfileVisibility(e){return this._engine.updateMyUserProfileVisibility(e)}getMyUserProfileVisibility(){return this._engine.getMyUserProfileVisibility()}searchUserProfileByUniqueId(e){return this._engine.searchUserProfileByUniqueId(e)}clearConversations(e,n){return t(this,void 0,void 0,(function*(){return this._engine.clearConversations(e,n)}))}setUserStatusListener(e,t){return this._engine.setUserStatusListener(e,(e=>{try{t(e)}catch(e){this.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))}addToBlacklist(e){return t(this,void 0,void 0,(function*(){return this._engine.addToBlacklist(e)}))}removeFromBlacklist(e){return t(this,void 0,void 0,(function*(){return this._engine.removeFromBlacklist(e)}))}getBlacklist(){return t(this,void 0,void 0,(function*(){return this._engine.getBlacklist()}))}getBlacklistStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.getBlacklistStatus(e)}))}insertMessage(e,n,r){return t(this,void 0,void 0,(function*(){const{code:t,msg:s}=this.checkSearchPropsMsg(r.messageType,r.content);return t!==exports.ErrorCode.SUCCESS?Promise.resolve({code:t,msg:s}):this._engine.insertMessage(e,n,r)}))}batchInsertMessage(e,t){return this._engine.batchInsertMessage(e,t)}getMessageCount(e,n,r=""){return t(this,void 0,void 0,(function*(){return this._engine.getMessageCount(e,n,r)}))}deleteMessages(e){return t(this,void 0,void 0,(function*(){return this._engine.deleteMessages(e)}))}deleteMessagesByTimestamp(e,n,r,s,o=""){return t(this,void 0,void 0,(function*(){return this._engine.deleteMessagesByTimestamp(e,n,r,!!s,o)}))}batchClearMessagesByTimestamp(e){return t(this,void 0,void 0,(function*(){return this._engine.batchClearMessagesByTimestamp(e)}))}batchClearRemoteHistoryMessages(e,n){return t(this,void 0,void 0,(function*(){return this._engine.batchClearRemoteHistoryMessages(e,n)}))}clearMessages(e,n,r=""){return t(this,void 0,void 0,(function*(){return this._engine.clearMessages(e,n,r)}))}getLocalMessage(e){return t(this,void 0,void 0,(function*(){const t=Xe.create("getLocalMessage").validate("messageId",e,(()=>et(e)||nt(e)),!0).fail(exports.ErrorCode.INVALID_PARAMETER_MESSAGE_ID).result(),n=this.logger.createTraceId();this.logger.info(exports.LogTagId.A_GET_LOCAL_MESSAGE_T,JSON.stringify({messageId:e}),n);const r=yield t.next((()=>this._engine.getMessage(e)));return this.logger.summary(exports.LogTagId.A_GET_LOCAL_MESSAGE_R,r,n,{messageId:e}),r}))}setMessageContent(e,n,r){return t(this,void 0,void 0,(function*(){return this._engine.setMessageContent(e,n,r)}))}setMessageSearchField(e,n,r){return t(this,void 0,void 0,(function*(){return this._engine.setMessageSearchField(e,n,r)}))}setMessageSentStatus(e,n){return t(this,void 0,void 0,(function*(){return this._engine.setMessageSentStatus(e,n)}))}setMessageReceivedStatus(e,n){return t(this,void 0,void 0,(function*(){return this._engine.setMessageReceivedStatus(e,n)}))}setMessageStatusToRead(e,n,r,s){return t(this,void 0,void 0,(function*(){return this._engine.updateMessageReceiptStatus(e,n,r,s)}))}setUserStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.setUserStatus(e)}))}subscribeUserStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.subscribeUserStatus(e)}))}getUserStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.getUserStatus(e)}))}searchConversationByContent(e,n=[],r,s){return t(this,void 0,void 0,(function*(){return this._engine.searchConversationByContent(e,n,r||"",s)}))}searchConversationByContentWithAllChannel(e,n=[],r){return t(this,void 0,void 0,(function*(){return this._engine.searchConversationByContentWithAllChannel(e,n,r)}))}searchMessageByContent(e,n,r,s,o,i,a=""){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContent(e,n,r,s,o,i,a)}))}searchMessageByContentAndMessageType(e,n,r,s,o,i,a){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContentAndMessageType(e,n,r,s,o,i,a)}))}searchMessagesByUser(e,n,r,s,o=5,i=""){return t(this,void 0,void 0,(function*(){return this._engine.searchMessagesByUser(e,n,r,s,o,i)}))}getMessagesByTimestamp(e,n,r,s){return t(this,void 0,void 0,(function*(){return this._engine.getMessagesByTimestamp(e,n,r,s)}))}searchMessageByContentWithAllChannel(e,n,r,s,o){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContentWithAllChannel(e,n,r,s,o)}))}searchMessageByContentInTimeRangeWithAllChannel(e,n,r,s,o,i,a){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,n,r,s,o,i,a)}))}getUnreadMentionedMessages(e,t,n=""){return this._engine.getUnreadMentionedMessages(e,t,n)}clearUnreadCountByTimestamp(e,t,n,r=""){return this._engine.clearUnreadCountByTimestamp(e,t,n,r)}getUltraGroupDefaultNotificationLevel(e,t){const n=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,t);return this._engine.getUltraGroupDefaultNotificationLevel(e,n||"")}setUltraGroupDefaultNotificationLevel(e,t,n){const r=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,n);return this._engine.setUltraGroupDefaultNotificationLevel(e,t,r||"")}getConversationNotificationLevel(e,t,n){const r=this._channelIdConvert(e,n);return this._engine.getConversationNotificationLevel(e,t,r||"")}setConversationTypeNotificationLevel(e,t){return this._engine.setConversationTypeNotificationLevel(e,t)}getConversationTypeNotificationLevel(e){return this._engine.getConversationTypeNotificationLevel(e)}getConversationNotificationStatus(e,t,n){const r=this._channelIdConvert(e,n);return this._engine.getConversationNotificationStatus(e,t,r||"")}getRemoteHistoryMessages(e,t,n,r,s,o){return this._engine.getRemoteHistoryMessages(e,t,n,r,s,o)}getConversationListWithAllChannel(){return this._engine.getConversationListWithAllChannel()}getConversationListWithAllChannelByPage(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)}clearData(){return t(this,void 0,void 0,(function*(){return this._engine.clearData()}))}createLogger(e,t){return this._engine.createLogger(e,t)}getConversations(e){return this._engine.getConversations(e)}setCheckDuplicateMessage(e){return this._engine.setCheckDuplicateMessage(e)}setCheckChatRoomDuplicateMessage(e){return this._engine.setCheckChatRoomDuplicateMessage(e)}rtcSignaling(e,t,n,r){return this._engine.rtcSignaling(e,t,n,r)}rtcPing(e,t,n){return this._engine.rtcPing(e,t,n)}bindRTCRoomForChatroom(e){return this._engine.bindRTCRoomForChatroom(e)}setProxy(e){return this._engine.setProxy(e)}getProxy(){return this._engine.getProxy()}testProxy(e,t){return this._engine.testProxy(e,t)}createGroup(e,t,n,r=[]){return this._engine.createGroup(e,t,n,r)}updateGroupInfo(e,t,n){return this._engine.updateGroupInfo(e,t,n)}getGroupsInfo(e){return this._engine.getGroupsInfo(e)}kickGroupMembers(e,t,n){return this._engine.kickGroupMembers(e,t,n)}quitGroup(e,t){return this._engine.quitGroup(e,t)}dismissGroup(e){return this._engine.dismissGroup(e)}transferGroupOwner(e,t,n,r=!1){return this._engine.transferGroupOwner(e,t,r,n)}setGroupManagers(e,t,n){return this._engine.setGroupManagers(e,t,n)}getGroupMembersByRole(e,t,n){return this._engine.getGroupMembersByRole(e,t,n)}getGroupMembers(e,t){return this._engine.getGroupMembers(e,t)}setGroupMemberInfo(e,t,n,r){return this._engine.setGroupMemberInfo(e,t,n,r)}searchGroupMembers(e,t,n){return this._engine.searchGroupMembers(e,t,n)}joinGroup(e){return this._engine.joinGroup(e)}inviteUsersToGroup(e,t){return this._engine.inviteUsersToGroup(e,t)}acceptGroupInvite(e,t){return this._engine.memberInviteResponse({groupId:e,inviterId:t,optType:0,optResult:exports.GroupOperationStatus.ACCEPT})}refuseGroupInvite(e,t,n){return this._engine.memberInviteResponse({groupId:e,inviterId:t,optType:0,optResult:exports.GroupOperationStatus.REFUSE,reason:n})}acceptGroupApplication(e,t,n){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:exports.GroupOperationStatus.ACCEPT})}refuseGroupApplication(e,t,n,r){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:exports.GroupOperationStatus.REFUSE,reason:r})}getGroupApplications(e,t,n){return this._engine.getGroupApplications(e,t,n)}getJoinedGroupsByRole(e,t){return this._engine.getJoinedGroupsByRole(e,t)}searchJoinedGroups(e,t){return this._engine.searchJoinedGroups(e,t)}getJoinedGroups(e){return this._engine.getJoinedGroups(e)}setGroupRemark(e,t){return this._engine.setGroupRemark(e,t)}addGroupFollows(e,t){return this._engine.setGroupFollows(exports.GroupOperationType.ADD,e,t)}removeGroupFollows(e,t){return this._engine.setGroupFollows(exports.GroupOperationType.REMOVE,e,t)}getGroupFollows(e){return this._engine.getGroupFollows(e)}addFriend(e,t,n){return this._engine.addFriend(e,t,n)}deleteFriends(e,t){return this._engine.deleteFriends(e,t)}acceptFriendApplication(e){return this._engine.acceptFriendApplication(e)}refuseFriendApplication(e,t){return this._engine.refuseFriendApplication(e,t)}setFriendInfo(e,t,n){return this._engine.setFriendInfo(e,t,n)}checkFriends(e,t){return this._engine.checkFriends(e,t)}getFriends(e,t){return this._engine.getFriends(e,t)}getFriendApplications(e,t,n){return this._engine.getFriendApplications(e,t,n)}getFriendsInfo(e){return this._engine.getFriendsInfo(e)}searchFriendsInfo(e){return this._engine.searchFriendsInfo(e)}setFriendAddPermission(e){return this._engine.setFriendAddPermission(e)}getFriendAddPermission(){return this._engine.getFriendAddPermission()}getRealtimeConversations(e,t,n){return this._engine.getRealtimeConversations(e,t,n)}getRealtimeConTotalUnreadCount(){return this._engine.getRealtimeConTotalUnreadCount()}clearRealtimeConUnreadCount(e){return this._engine.clearRealtimeConUnreadCount(e)}removeRealtimeConversations(e){return this._engine.removeRealtimeConversations(e)}getRealtimeConUnreadCounts(e){return this._engine.getRealtimeConUnreadCounts(e)}setNotificationQuietHoursWithSetting(e){return Xe.create("setNotificationQuietHoursWithSetting").isObject("opts",e,!0).isString("timezone",e.timezone).fail(exports.ErrorCode.BIZ_ERROR_INVALID_PARAMETER).validate("startTime",e.startTime,(e=>/^\d{2}(:\d{2}){2}$/.test(e)),!0).fail(exports.ErrorCode.INVALID_PARAMETER_TIMESTRING).isLimitedNumber("spanMinutes",e.spanMinutes,1,1439,!0).fail(exports.ErrorCode.INVALID_PARAMETER_SPAN_MINUTES).isValueOf("level",e.level,exports.PushNotificationQuietHoursLevel,!0).fail(exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().next((()=>this._engine.setNotificationQuietHoursWithSetting(e)))}removeNotificationQuietHoursSetting(){return this._engine.removeNotificationQuietHoursSetting()}getNotificationQuietHoursSetting(){return this._engine.getNotificationQuietHoursSetting()}}e([_a],Ea.prototype,"updateMyUserProfile",null),e([_a],Ea.prototype,"getUserProfiles",null),e([_a],Ea.prototype,"getMyUserProfile",null),e([_a],Ea.prototype,"updateMyUserProfileVisibility",null),e([_a],Ea.prototype,"getMyUserProfileVisibility",null),e([_a],Ea.prototype,"searchUserProfileByUniqueId",null),e([_a],Ea.prototype,"createGroup",null),e([_a],Ea.prototype,"updateGroupInfo",null),e([_a],Ea.prototype,"getGroupsInfo",null),e([_a],Ea.prototype,"kickGroupMembers",null),e([_a],Ea.prototype,"quitGroup",null),e([_a],Ea.prototype,"dismissGroup",null),e([_a],Ea.prototype,"transferGroupOwner",null),e([_a],Ea.prototype,"setGroupManagers",null),e([_a],Ea.prototype,"getGroupMembersByRole",null),e([_a],Ea.prototype,"getGroupMembers",null),e([_a],Ea.prototype,"setGroupMemberInfo",null),e([_a],Ea.prototype,"searchGroupMembers",null),e([_a],Ea.prototype,"joinGroup",null),e([_a],Ea.prototype,"inviteUsersToGroup",null),e([_a],Ea.prototype,"acceptGroupInvite",null),e([_a],Ea.prototype,"refuseGroupInvite",null),e([_a],Ea.prototype,"acceptGroupApplication",null),e([_a],Ea.prototype,"refuseGroupApplication",null),e([_a],Ea.prototype,"getGroupApplications",null),e([_a],Ea.prototype,"getJoinedGroupsByRole",null),e([_a],Ea.prototype,"searchJoinedGroups",null),e([_a],Ea.prototype,"getJoinedGroups",null),e([_a],Ea.prototype,"setGroupRemark",null),e([_a],Ea.prototype,"addGroupFollows",null),e([_a],Ea.prototype,"removeGroupFollows",null),e([_a],Ea.prototype,"getGroupFollows",null),e([_a],Ea.prototype,"addFriend",null),e([_a],Ea.prototype,"deleteFriends",null),e([_a],Ea.prototype,"acceptFriendApplication",null),e([_a],Ea.prototype,"refuseFriendApplication",null),e([_a],Ea.prototype,"setFriendInfo",null),e([_a],Ea.prototype,"checkFriends",null),e([_a],Ea.prototype,"getFriends",null),e([_a],Ea.prototype,"getFriendApplications",null),e([_a],Ea.prototype,"getFriendsInfo",null),e([_a],Ea.prototype,"searchFriendsInfo",null),e([_a],Ea.prototype,"setFriendAddPermission",null),e([_a],Ea.prototype,"getFriendAddPermission",null),e([ga],Ea.prototype,"getRealtimeConversations",null),e([ga],Ea.prototype,"getRealtimeConTotalUnreadCount",null),e([ga],Ea.prototype,"clearRealtimeConUnreadCount",null),e([ga],Ea.prototype,"removeRealtimeConversations",null),e([ga],Ea.prototype,"getRealtimeConUnreadCounts",null);let Ia;const Ta=()=>(Ia||(Ia={set:(e,t)=>{rr.localStorage.setItem(e,JSON.stringify(t))},get:e=>{let t;try{t=JSON.parse(rr.localStorage.getItem(e))}catch(e){t=null}return t},remove:e=>rr.localStorage.removeItem(e),getKeys:()=>{const e=[];for(const t in rr.localStorage)e.push(t);return e}}),Ia);class fa{constructor(e){this._caches={},e&&(this._caches=e)}set(e,t){this._caches[e]=t}remove(e){const t=this.get(e);return delete this._caches[e],t}get(e){return this._caches[e]}getKeys(){const e=[];for(const t in this._caches)e.push(t);return e}}class Ca{constructor(e){this._rootStorage=Ta();const t=this._rootStorage.get(e)||{};this._cache=new fa({[e]:t}),this._storageKey=e}_get(){const e=this._storageKey;return this._cache.get(e)||{}}_set(e){const t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)}set(e,t){const n=this._get();n[e]=t,this._set(n)}remove(e){const t=this._get();delete t[e],this._set(t)}clear(){const e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)}get(e){return this._get()[e]}getKeys(){const e=this._get(),t=[];for(const n in e)t.push(n);return t}getValues(){return this._get()||{}}update(e={}){const t=this._storageKey;this._cache.set(t,e),this._rootStorage.set(t,e)}}const Ra=()=>{let e="",{tag:t}=rr;if("browser"===t)return qe;const n="RCDeviceId",r=Ta(),s=r.get(n);return s?e=s:(e=He.genWithLen(22),r.set(n,e)),e},Sa=()=>{if("browser"!==rr.tag)return{type:rr.tag,version:"UnKonw"};const{userAgent:e}=navigator;let t,n;const 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(const s in r){if(!r.hasOwnProperty(s))continue;let o=e.match(r[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}};function ma(e){return Boolean(1&((null==e?void 0:e.sessionMode)||0))}const ya="converStatusChanged";class va extends Qi{constructor(e,t,n){super(),this._eventEmitter=new qo,this._pullQueue=[],this._isPulling=!1,this._pullPromise=null,this._storagePullTimeKey=`con-s-${t}-${n}`,this._oldStorage=Ta(),this._storage=new Ca(Ne(t,n)),this._engine=e,this.adaptOldStatus()}adaptOldStatus(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;const e=this._oldStorage.get(this._storagePullTimeKey)||0;if(!e)return;this._storage.set(this._storagePullTimeKey,e),this._oldStorage.remove(this._storagePullTimeKey)}catch(e){this._engine.getInnerLogger().error(exports.LogTagId.A_CALLBACK_E,`adaptOldStatus error: ${e.message}`)}}_set(e){if(lt(e)||!Array.isArray(e))return;let t=this._storage.get(this._storagePullTimeKey)||0;const n=e.length;e.forEach(((e,r)=>{const s=e.updatedTime||0;t=s>t?s:t,e.conversationType=e.type,this._eventEmitter.emit(ya,{statusItem:e,isLastPull:r===n-1})})),this._storage.set(this._storagePullTimeKey,t),this._pullQueue=this._pullQueue.filter((e=>e>t))}_startPull(){return t(this,void 0,void 0,(function*(){if(this._isPulling||0===this._pullQueue.length)return this._pullPromise;this._isPulling=!0,this._pullQueue.shift();const e=this.getVersion();this._pullPromise=this._engine.pullConversationStatus(e);const{code:t,data:n}=yield this._pullPromise;this._isPulling=!1,this._pullPromise=null,t===exports.ErrorCode.SUCCESS&&this._set(n),0===this._pullQueue.length?this._startCall():this._startPull()}))}_startCall(){const e=Object.create(null,{_startCall:{get:()=>super._startCall}});return t(this,void 0,void 0,(function*(){this._isPulling||e._startCall.call(this)}))}pull(e){const t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}_triggerPull(e){return t(this,void 0,void 0,(function*(){this._pullQueue.push(e),yield this._startPull()}))}watch(e){this._eventEmitter.on(ya,(t=>{e(t)}))}setConversationUpdatedTime(e){const t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t}getVersion(){return this._storage.get(this._storagePullTimeKey)||0}}const Aa={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},fut:{keyName:"firstUnreadTime",defaultVal:0},fuid:{keyName:"firstUnreadMessageUid",defaultVal:""},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},Na={};for(const e in Aa){const{keyName:t}=Aa[e];Na[t]=e}class Oa{constructor(e,t,n){this._currentUserId=t,this.logger=n,this.storage=new Ca(Oe(e,t)),this._localStore=new Ca(Me(e,t))}_getStoreKey(e,t,n){return`${n||""}_${e}_${t}`}_getConOptionByKey(e){const t=(e=e||"").split("_");if(t.length>=2){const e=t.shift(),n=t.shift(),r=t.join("_");return{conversationType:Number(n),targetId:r,channelId:e}}return{conversationType:exports.ConversationType.PRIVATE,targetId:"",channelId:""}}_updateMentionedUserList(e,t,n){const{conversationType:r,messageType:s,isMentioned:o,senderUserId:i}=e;if(o&&r===exports.ConversationType.GROUP){(n.userIdList||[]).forEach((e=>{e===this._currentUserId&&t.indexOf(i)<0&&t.push(i)})),n.type===exports.MentionedType.ALL&&t.indexOf(i)<0&&t.push(i)}if(s===exports.MessageType.RECALL&&r===exports.ConversationType.GROUP){const e=t.indexOf(i);e>=0&&t.splice(e,1)}return t}updateMentionedData(e){const{conversationType:t,targetId:n,content:r,channelId:s,senderUserId:o}=e;let i=r.mentionedInfo;if(!i||o===this._currentUserId)return;const a=this._getStoreKey(t,n,s),l=this._localStore.get(a)||{},d=Na.mentionedInfo,u=Na.hasMentioned,c=l[d]||{};let h=c.userIdList||[];h=this._updateMentionedUserList(e,h,i),i={userIdList:h,type:(null==i?void 0:i.type)||c.type},0!==h.length?(l[d]=i,l[u]=!0):(delete l[d],delete l[u]),ut(l)?this._localStore.set(a,l):this._localStore.remove(a)}_setLocal(e,t){if("tags"===e)for(const e in t)t[e].isTop||delete t[e].isTop;return t}set(e,t,n,r){const s=this._getStoreKey(e,t,r),o=this._localStore.get(s)||{};for(const e in n){const t=Na[e],r=n[e];if(lt(t)||lt(r)||"hasMentioned"===e||"MentionedInfo"===e)continue;const{defaultVal:s}=Aa[t];r===s||"tags"===e&&!ut(r)?delete o[t]:o[t]=this._setLocal(e,r),o.c||(delete o.t,delete o.fut,delete o.fuid,delete o.hm,delete o.m,delete o.mc)}const i=Object.keys(o);1===i.length&&i.includes("st")&&delete o.st,ut(o)?this._localStore.set(s,o):this._localStore.remove(s)}get(e,t,n=""){const r=this._getStoreKey(e,t,n),s=this._localStore.get(r)||{},o={};for(const e in Aa){const{keyName:t,defaultVal:n}=Aa[e];o[t]=s[e]||Tt(n)}return o}getValue(e){const t=this._localStore.getValues()||{},n=[];for(const r in t){const{conversationType:s,targetId:o,channelId:i}=this._getConOptionByKey(r);let a={conversationType:s,targetId:o,channelId:i};const l=t[r];for(const e in l)if(Aa[e]){const{keyName:t,defaultVal:n}=Aa[e];a[t]=l[e]||Tt(n)}a=e?e(a):a,n.push(a)}return n}getValueForTag(){const e=this._localStore.getValues()||{},t={};for(const n in e){const{conversationType:r,targetId:s}=this._getConOptionByKey(n),o={},i=e[n];for(const e in i){const{keyName:t,defaultVal:n}=Aa[e];o[t]=i[e]||Tt(n)}for(const e in o.tags){lt(t[e])&&(t[e]=[]);const n=Object.assign(Object.assign({},o),{conversationType:r,targetId:s});delete n.tags,t[e].push(n)}}return t}adaptOldStore(){try{const e=this.storage.getValues();if(0===Object.keys(e).length)return;for(const t in e){const n=`_${t}`;this._localStore.set(n,e[t])}this.storage.clear()}catch(e){this.logger.error(exports.LogTagId.O,`adaptOldStore error: ${e.message}`)}}remove(e,t,n){const r=this._getStoreKey(e,t,n);this._localStore.remove(r)}}const Ma=[exports.ConversationType.PRIVATE,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.PUBLIC_SERVICE,exports.ConversationType.APP_PUBLIC_SERVICE],La="conversationChanged",Ua="conTagStatusChanged";class Pa{constructor(e,t,n,r,s,o){this.isEnableRealtimeSession=o,this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new qo,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new Oa(t,n,e.getInnerLogger()),this._statusManager=new va(e,t,n),this._statusManager.watch((e=>{const{statusItem:t,isLastPull:n}=e;this.addStatus(t,n)})),this._eventEmitter.on(La,(e=>{r(e)})),this._eventEmitter.on(Ua,(()=>{s()}));let i=this._store.getValue();if(i.length>1e3){i=i.sort(((e,t)=>{const{lastMessageSentTime:n=0}=e,{lastMessageSentTime:r=0}=t;return r-n})),i.splice(1e3,i.length).forEach((e=>{this._store.remove(e.conversationType,e.targetId,e.channelId)}))}}_calcMsg(e,t,n,r){const s=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((e=>e===r.sentTime));let o=t>=r.sentTime;return n&&(o=n<r.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:s}}_calcUnreadCount(e,t){if(this.isEnableRealtimeSession)return{hasChanged:!1,localConversation:t,updateItems:{}};const{content:n,messageType:r,sentTime:s,isCounted:o,messageDirection:i,senderUserId:a,messageUId:l}=e,d=i===exports.MessageDirection.SEND&&a===this._loginUserId,u=r===exports.MessageType.RECALL,c=it(n);let h=!1;const p={},_=t.lastUnreadTime,g=t.lastReadTime,E=t.unreadMessageCount;if(_>s||d)return{hasChanged:h,localConversation:t,updateItems:p};if(o&&(0===t.unreadMessageCount&&(t.firstUnreadMessageUid=l,t.firstUnreadTime=s),t.unreadMessageCount=E+1,t.lastUnreadTime=s,h=!0),u&&c){const{unreadMessageCount:n,hasChanged:r}=this._handleRecall2UnreadCount(e,_,g,E,h);t.unreadMessageCount=n,h=r,0===t.unreadMessageCount&&(t.firstUnreadMessageUid="",t.firstUnreadTime=0)}return h&&(p.unreadMessageCount={val:t.unreadMessageCount||0,time:s}),{hasChanged:h,localConversation:t,updateItems:p}}_handleRecall2UnreadCount(e,t,n,r,s){const o=`${e.conversationType}_${e.channelId}_${e.targetId}`,{isNotRead:i,isNotRepeadRecallSendTime:a}=this._calcMsg(o,t,n,e.content);return i&&r&&a?(this._recallMsgTimeMap[o]||(this._recallMsgTimeMap[o]=[]),this._recallMsgTimeMap[o].push(e.content.sentTime),{unreadMessageCount:r-1,hasChanged:!0}):{unreadMessageCount:r,hasChanged:s}}_calcMentionedInfo(e,t){const{content:n,messageDirection:r,isMentioned:s,sentTime:o}=e,i=r===exports.MessageDirection.SEND,a=it(n);let l=!1;const d={};return!i&&s&&a&&n.mentionedInfo&&(t.hasMentioned=!0,l=!0,d.hasMentioned={val:!0,time:o},d.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:l,localConversation:t,updateItems:d}}_calcMentionedCount(e,t){const{content:n,messageDirection:r,isMentioned:s}=e;let o=!1;if(s&&r===exports.MessageDirection.RECEIVE&&(null==n?void 0:n.mentionedInfo)){const{mentionedInfo:{type:e,userIdList:r}}=n;if(e===exports.MentionedType.ALL||(r||[]).includes(this._loginUserId)){o=!0;const e=t.unreadMentionedCount||0;t.unreadMentionedCount=e+1}}return{hasChanged:o,localConversation:t}}_setUpdatedConversation(e){if(it(e)){const{conversationType:t,targetId:n,channelId:r}=e,s=`${t}_${n}`,o=this._store.get(t,n,r)||{};this._updatedConversations[s]=Object.assign(o,e)}}_setConTagStatusChanged(e,t,n,r){const s=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(s).length===Object.keys(n).length){for(const e in s)if(!n[e]||!!s[e].isTop!=!!n[e].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0}addStatus(e,t){const{conversationType:n,targetId:r,updatedTime:s,notificationStatus:o,notificationLevel:i,isTop:a,tags:l,channelId:d}=e,u={},c={};if(n===exports.ConversationType.ULTRA_GROUP)return;lt(o)||(c.notificationStatus={time:s,val:o}),lt(i)||(c.notificationLevel={time:s,val:i}),lt(a)||(c.isTop={time:s,val:a}),lt(l)||(c.tags={time:s,val:l},null==l||l.forEach((e=>{u[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,u,d);const h=this._store.get(n,r,d).lastMessageSentTime||(new Date).getTime();this._store.set(n,r,{notificationStatus:o,notificationLevel:i,isTop:a,tags:u,lastMessageSentTime:h},d),r&&(this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:c,channelId:d}),t&&this._notifyConversationChanged())}_notifyConversationChanged(){const e=[];for(const t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(La,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Ua),this._conTagStatusChanged=!1))}setConversationCacheByMessage(e,t){const{conversationType:n,isPersited:r,targetId:s,channelId:o,sentTime:i,disableUpdateLastMessage:a}=e;if(!(Ma.indexOf(n)>=0))return;let l=!1,d=this._store.get(n,s,o),u={};d.lastMessageSentTime=i;if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((t=>{const{hasChanged:n,localConversation:r,updateItems:s}=t.call(this,e,d);l=l||n,u=Object.assign(Object.assign({},u),s),d=Tt(r)})),this._store.set(n,s,d,o),this._store.updateMentionedData(e),r&&!a){const t=this._store.get(n,s,o);t.updatedItems=Object.assign({latestMessage:{time:e.sentTime,val:e}},u),t.latestMessage=e;const r=Object.assign(t,{conversationType:n,targetId:s,channelId:o});this._setUpdatedConversation(r)}(l||r&&!a)&&this._notifyConversationChanged()}get(e,t,n=""){return this._store.get(e,t,n)}getAllUnreadCount(e,t,n){const r=this._store.getValue();let s=0;return r.forEach((({unreadMessageCount:e,notificationStatus:r,notificationLevel:o,conversationType:i})=>{e=e||0,(n||void 0!==o&&o<=0||void 0===o&&r!==exports.NotificationStatus.OPEN)&&(t.length>0?t.includes(Number(i))&&(s+=Number(e)):s+=Number(e))})),s}getTotalUnreadCountByLevels(e,t,n){const r=this._store.getValue();let s=0;return r.forEach((({unreadMessageCount:r,notificationLevel:o=0,conversationType:i,unreadMentionedCount:a})=>{e.includes(i)&&(0===t.length||t.includes(o))&&(s+=(n?a:r)||0)})),s}getUnreadCountByTag(e,t){const n=this._store.getValueForTag()[e]||[];let r=0;return n.forEach((({unreadMessageCount:e,notificationStatus:n,notificationLevel:s})=>{(t||1!==n||-1===s||0===s)&&(e=e||0,r+=Number(e))})),r}getUnreadCount(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0}clearUnreadCount(e,t,n,r,s=!0){const o=this._store.get(e,t,n);o.lastReadTime=o.lastUnreadTime,this._recallMsgTimeMap[`${e}_${n}_${t}`]=[];const{unreadMessageCount:i,hasMentioned:a}=o,l={};if(i&&(o.unreadMessageCount=0,l.unreadMessageCount={val:0,time:r}),a&&(o.hasMentioned=!1,o.unreadMentionedCount=0,o.mentionedInfo=void 0,l.hasMentioned={val:!1,time:r},l.mentionedInfo={val:void 0,time:r}),this._store.set(e,t,o,n),!s)return;if(0===Object.keys(l).length)return;const d=Object.assign(o,{conversationType:e,targetId:t,channelId:n,updatedItems:l});this._setUpdatedConversation(d),this._notifyConversationChanged()}clearAllUnreadCount(){this._store.getValue().forEach((e=>{e.unreadMessageCount&&(e.unreadMessageCount=0,e.lastReadTime=e.lastUnreadTime,this._recallMsgTimeMap={},this._store.set(e.conversationType,e.targetId,e,e.channelId))}))}startPullConversationStatus(e){this._statusManager.pull(e)}setDraft(e,t,n,r){const s=`${e}_${t}_${r}`;this._draftMap[s]=n}getDraft(e,t,n){const r=`${e}_${t}_${n}`;return this._draftMap[r]}clearDraft(e,t,n){const r=`${e}_${t}_${n}`;delete this._draftMap[r]}addTagStatus(e,t,n,r=""){const s=this._store.get(e,t,r);let{tags:o}=s;o=Object.assign(o,n);const i=s.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:o,lastMessageSentTime:i},r)}deleteTagStatus(e,t,n,r=""){const{tags:s}=this._store.get(e,t,r);n.forEach((e=>{delete s[e]})),this._store.set(e,t,{tags:s},r)}getConversationListForTag(){return this._store.getValueForTag()}getBlockConversationList(){return this._store.getValue().filter((e=>e.notificationStatus===exports.NotificationStatus.OPEN||e.notificationLevel&&e.notificationLevel>0)).map((e=>({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,notificationLevel:e.notificationLevel||0,notificationStatus:e.notificationStatus||2})))}getTopConversationList(e,t){return(this._store.getValue()||{}).filter((n=>e.includes(n.conversationType)&&(lt(t)||t===n.channelId)&&n.isTop)).map((e=>this._buildConversation(e)))}adaptOldStore(){this._store.adaptOldStore()}getUnreadMentionedCount(e,t,n=""){return this.get(e,t,n).unreadMentionedCount||0}getAllUnreadMentionedCount(){const e=this._store.getValue();let t=0;return e.forEach((({unreadMentionedCount:e})=>{e=e||0,t+=Number(e)})),t}getAllConversationState(){return this._store.getValue().filter((e=>e.unreadMessageCount||e.unreadMentionedCount)).map((e=>({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0})))}getUnreadConversationList(e){return(this._store.getValue()||{}).filter((t=>e.includes(t.conversationType)&&t.unreadMessageCount&&t.unreadMessageCount>0)).map((e=>this._buildConversation(e)))}_buildConversation(e){const t=this.getDraft(e.conversationType,e.targetId,e.channelId);return{channelId:e.channelId,conversationType:e.conversationType,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount||0,latestMessage:null,hasMentioned:e.hasMentioned||!1,mentionedInfo:e.mentionedInfo,notificationStatus:e.notificationStatus||0,notificationLevel:e.notificationLevel||0,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0,draft:t}}setConversationUpdatedTime(e){return this._statusManager.setConversationUpdatedTime(e)}getConversationUpdatedTime(){return this._statusManager.getVersion()}pushTask(e){return this._statusManager.pushTask(e)}stopAllTask(){this._statusManager.stopAllTask()}}class ba{constructor(e,t){this._localStore=new Ca(Le(e,t))}set(e,t,n,r){const s=this._getStoreKey(e,t,r),o=this._localStore.get(s)||{};for(const e in n){const t=Da[e],r=n[e];if(lt(t)||lt(r))continue;const{defaultVal:s}=xa[t];r===s?delete o[t]:o[t]=r}ut(o)?this._localStore.set(s,o):this._localStore.remove(s)}get(e,t,n=""){const r=this._getStoreKey(e,t,n),s=this._localStore.get(r)||{},o={};for(const e in xa){const{keyName:t,defaultVal:n}=xa[e];o[t]=s[e]||Tt(n)}return o}_getStoreKey(e,t,n){return`${n}_${e}_${t}`}}const xa={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Da={};for(const e in xa){const{keyName:t}=xa[e];Da[t]=e}class wa{constructor(e,t){this._store=new ba(e,t)}addUltraGroupStatus(e){const{conversationType:t,targetId:n,notificationStatus:r,notificationLevel:s,channelId:o}=e;t===exports.ConversationType.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:r,notificationLevel:s},o)}get(e,t,n=""){return this._store.get(e,t,n)}}const Va={_caches:{},set(e,t){this._caches[e]=t},get(e){return this._caches[e]||0},clear(e){this._caches[e]=0}};class Ga{constructor(e,t,n){this.logger=e,this._kvCaches={},this._chatroomId=t,this._currentUserId=n}_add(e){const{key:t}=e;e.isDeleted=!1,this._kvCaches[t]=e}_remove(e){const{key:t}=e,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)}_setEntry(e,t){const{key:n,type:r,isOverwrite:s,userId:o}=e,i=this._getSetUserId(n),a=r===exports.ChatroomEntryType.DELETE,l=i===o,d=!this._isExisted(n),u=a?this._remove:this._add;(t||s||l||d)&&u.call(this,e)}getValue(e){const t=this._kvCaches[e]||{},{isDeleted:n}=t;return n?null:t.value}getVersion(e){const t=this._kvCaches[e]||{},{isDeleted:n}=t;return n?null:t.version}getAllValue(){const e={};for(const t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e}_getSetUserId(e){return(this._kvCaches[e]||{}).userId}_isExisted(e){const t=this._kvCaches[e]||{},{value:n,isDeleted:r}=t;return n&&!r}setEntries(e){let{kvEntries:t,isFullUpdate:n}=e;t=t||[],n=n||!1,n&&this.clear(),t.forEach((e=>{this._setEntry(e,n)}))}clear(){this._kvCaches={}}}class Fa{constructor(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}_startPull(){return t(this,void 0,void 0,(function*(){if(this._isPulling||0===this._pullQueue.length)return;this._isPulling=!0;const{chrmId:e,timestamp:t}=this._pullQueue.splice(0,1)[0],n=Va.get(e);if(n>t)return this._isPulling=!1,void this._startPull();const{code:r,data:s}=yield this._engine.pullChatroomEntry(e,n);this._isPulling=!1,r===exports.ErrorCode.SUCCESS?(Va.set(e,s.syncTime||0),this._startPull()):this._startPull()}))}reset(e){Va.clear(e);const t=this._storeCaches[e];null==t||t.clear()}pullEntry(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()}setLocal(e,t,n){let r=this._storeCaches[e];ut(r)||(r=new Ga(this._engine.getInnerLogger(),e,n)),r.setEntries(t),this._storeCaches[e]=r}getValue(e,t){const n=this._storeCaches[e];return n?n.getValue(t):null}getVersion(e,t){const n=this._storeCaches[e];return n?n.getVersion(t):null}getAll(e){const t=this._storeCaches[e];let n={};return t&&(n=t.getAllValue()),n}}class Ba{constructor(e){this._canJoinMulipleChrm=e,this._joinedChrmsInfo={}}set(e,t=10,n=""){this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]={count:t,extra:n}}get(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))}remove(e){delete this._joinedChrmsInfo[e]}clear(){this._joinedChrmsInfo={}}}class ka extends Qi{constructor(e,t,n,r){super(),this._tagKey="tags",this._versionKey="version",this._pullQueue=[],this._isPulling=!1,this._pullPromise=null,this._storageKey=De(t,n),this._storage=new Ca(this._storageKey),this._engine=e,this._tagWatcherFunc=r}_updateTag(e){const{tags:t}=e,n={};t.forEach((e=>{n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._tagKey,n),this._tagWatcherFunc()}addTag(e,t){const n=this._storage.get(this._tagKey)||{};e.forEach((e=>{var t;const r=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:r}})),this._storage.update({[this._tagKey]:n,[this._versionKey]:t})}deleteTag(e,t){const n=this._storage.get(this._tagKey)||{};e.forEach((e=>{delete n[e]})),this._storage.update({[this._tagKey]:n,[this._versionKey]:t})}getTagsInfo(){return this._storage.get(this._tagKey)||{}}getTags(){const e=this._storage.get(this._tagKey)||{},t=[];for(const 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)}))}getTagById(e){const t=this._storage.get(this._tagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null}_startPull(){return t(this,void 0,void 0,(function*(){if(this._isPulling||0===this._pullQueue.length)return this._pullPromise;this._isPulling=!0,this._pullQueue.shift();const e=this.getVersion();this._pullPromise=this._engine.pullUserSettings(e);const{code:t,data:n}=yield this._pullPromise;if(this._isPulling=!1,this._pullPromise=null,t===exports.ErrorCode.SUCCESS&&!lt(n)){const{settings:e,version:t}=n,r=e.Tag;lt(r)||this._updateTag(r),this._storage.set(this._versionKey,t),this._pullQueue=this._pullQueue.filter((e=>e>t))}0===this._pullQueue.length?this._startCall():this._startPull()}))}_startCall(){const e=Object.create(null,{_startCall:{get:()=>super._startCall}});return t(this,void 0,void 0,(function*(){this._isPulling||e._startCall.call(this)}))}pullUserSettings(e){const t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())}_triggerPull(e){return t(this,void 0,void 0,(function*(){this._pullQueue.push(e),yield this._startPull()}))}getVersion(){return this._storage.get(this._versionKey)||0}updateVersion(e){this._storage.set(this._versionKey,e)}}const Ha={};function qa(){return{code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,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:Wt.getMiniCmpUrlList().join(",")}}class Ya extends un{constructor(e,t,n,r="default"){super(e,t,n,rr.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),rr.useNavi),this._environment=r}httpRequest(e,n,r,s,o){return t(this,void 0,void 0,(function*(){const t=`${e}/navi.js?appId=${n}&token=${encodeURIComponent(r)}&callBack=x&v=${me}&r=${Date.now()}&env=${this._environment}`;this.logger.debug(exports.LogTagId.L_REQUEST_T,`req navi => ${t}`,s);const i=yield rr.httpReq({url:t,timeout:1e4,dataType:"text"});if(200!==i.status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,`request navi failed: ${i.status}`,s),!rr.useNavi&&o?$e(qa()):Je(this.transHttpCode(i.status));try{let e=i.data.match(/{[\d\D]+}/)[0];0===e.indexOf('{\\"code\\":')&&(e=JSON.parse(`"${e}"`));const n=JSON.parse(e);return n.protocol=/^https/.test(t)?"https":"http",n.code&&200!==n.code?Je(this.transHttpCode(n.code)):(rr.useNavi||(n.server="",n.backupServer=Wt.getMiniCmpUrlList().join(","),n.logSwitch=0),$e(n))}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,i.data,s)}return Je(exports.ErrorCode.RC_NAVI_REQ_FAILED)}))}httpRequestV2(e,n,r,s,o){return t(this,void 0,void 0,(function*(){const t=this.getNaviV2RequestOption({appkey:n,token:r,uri:e,platform:rr.tag,protocol:(/^https/.test(e)?V.WSS:V.WS).toString()});this.logger.debug(exports.LogTagId.L_REQUEST_T,`req navi => ${t.url}`,s);const i=yield rr.httpReq(t);if(200!==i.status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,`request navi failed: ${i.status}`,s),!rr.useNavi&&o?$e(qa()):Je(this.transHttpCode(i.status));try{let e=i.data;const n="object"!=typeof e?JSON.parse(e):e;if(n.protocol=/^https/.test(t.url)?"https":"http",!rr.useNavi){n.logSwitch=0;const e=Wt.getMiniCmpUrlList();n.serverAddr=e.map(((n,r)=>({addr:n,protocol:/^https/.test(t.url)?V.WSS:V.WS,weight:e.length-r})))}return $e(n)}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,i.data,s)}return Je(exports.ErrorCode.RC_NAVI_REQ_FAILED)}))}getNaviCache(e){const t=this.getCatchKey(e);if(Ha[t])return Ha[t];const n=Ae(this.appkey),r=rr.localStorage;let s;try{const e=r.getItem(n);s=e?JSON.parse(e):[]}catch(e){s=[]}if(0===s.length)return null;const o=s.find((t=>t.token===e&&t.environment===this._environment))||null;return Ha[t]=o,o}setNaviCache(e,t){const n=Ae(this.appkey),r=rr.localStorage;let s;try{const e=r.getItem(n);s=e?JSON.parse(e):[]}catch(e){s=[]}const o=Date.now();s.length>0&&(s=s.filter((t=>o-t.timestamp<fe&&(e!==t.token||this._environment!==t.environment))));const i={timestamp:o,naviInfo:t,token:e,environment:this._environment};s.push(i),r.setItem(n,JSON.stringify(s)),Ha[this.getCatchKey(e)]=i}}class Ka{constructor(e){this._appkey=e,this._users={}}_getMemData(e){return this._users[e]=this._users[e]||{inboxTime:0,outboxTime:0,broadcastSyncTime:0},this._users[e]}setInboxTime(e,t){const n=this._getMemData(t);if(n.inboxTime>e)return;n.inboxTime=e;const r=Pe(this._appkey,t);rr.localStorage.setItem(r,e.toString())}getInboxTime(e){const t=this._getMemData(e);if(0===t.inboxTime){const n=Pe(this._appkey,e);t.inboxTime=parseInt(rr.localStorage.getItem(n),10)||0}return t.inboxTime}setBroadcastSyncTime(e,t){const n=this._getMemData(t);if(n.broadcastSyncTime>=e||lt(e))return;n.broadcastSyncTime=e;const r=be(this._appkey,t);rr.localStorage.setItem(r,e.toString())}getBroadcastSyncTime(e){const t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){const n=be(this._appkey,e);t.broadcastSyncTime=parseInt(rr.localStorage.getItem(n),10)||1}return t.broadcastSyncTime}setOutboxTime(e,t){const n=this._getMemData(t);if(n.outboxTime>=e)return;n.outboxTime=e;const r=Ue(this._appkey,t);rr.localStorage.setItem(r,e.toString())}getOutboxTime(e){const t=this._getMemData(e);if(0===t.outboxTime){const n=Ue(this._appkey,e);t.outboxTime=parseInt(rr.localStorage.getItem(n),10)||0}return t.outboxTime}}class ja{constructor(e){this._appkey=e,this._sendMessageMap={},this._userId=""}init(e){this._userId=e;const t=xe(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)}_getLocalInfo(e){const t=rr.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}}setMessage(e,t){this._sendMessageMap[e]=t;const n=xe(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,rr.localStorage.setItem(n,JSON.stringify(r))}getSendMessageMap(){return this._sendMessageMap}removeByUID(e){delete this._sendMessageMap[e]}removeByTimestamp(e){const t=xe(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((t=>{n[t]<e&&delete n[t]})),rr.localStorage.setItem(t,JSON.stringify(n))}}class Qa{constructor(e){this._delayTime=e,this.subscribeData={[exports.SubscribeType.ONLINE_STATUS]:{},[exports.SubscribeType.USER_PROFILE]:{}},this._ownProfile=null}clearSubscribeRelation(){this.subscribeData={[exports.SubscribeType.ONLINE_STATUS]:{},[exports.SubscribeType.USER_PROFILE]:{}}}clearSubscribeStatusData(e){e===exports.SubscribeType.ONLINE_STATUS?Object.keys(this.subscribeData[e]).forEach((t=>{this.subscribeData[e][t].statusMap={}})):e===exports.SubscribeType.USER_PROFILE&&Object.keys(this.subscribeData[e]).forEach((t=>{this.subscribeData[e][t].profile=void 0}))}getSubscribeUserData(e,t){const n=this.subscribeData[e][t];return n?Object.assign({},n):void 0}removeSubscribeUserData(e,t){delete this.subscribeData[e][t]}updateSubscribeUserData(e,t,n){this.subscribeData[e][t]=n}clearExpiredData(e){for(const t in this.subscribeData[e]){const n=this.subscribeData[e][t];n.expiry<(Date.now()+this._delayTime-n.subscribeTime)/1e3&&delete this.subscribeData[e][t]}}getSubscribeUserList(e,t,n){return[...Object.values(this.subscribeData[e])].sort(((e,t)=>e.subscribeTime-t.subscribeTime)).slice(n,n+t)}updateOwnProfile(e){this._ownProfile=Object.assign(Object.assign({},e),{extraProfile:Object.assign({},e.extraProfile)})}getOwnProfile(){return this._ownProfile?Object.assign(Object.assign({},this._ownProfile),{extraProfile:Object.assign({},this._ownProfile.extraProfile)}):null}}class Wa{constructor(e){this._delayTime=e,this._relationshipStatusVersion=0,this._subUserStatusVersion=0,this._ownProfileVersion=0,this._subStore=new Qa(e)}updateRelationshipStatusVersion(e){e>this._relationshipStatusVersion&&(this._relationshipStatusVersion=e)}getRelationshipStatusVersion(){return this._relationshipStatusVersion}updateSubscribeUserStatusVersion(e){e>this._subUserStatusVersion&&(this._subUserStatusVersion=e)}getSubscribeUserStatusVersion(){return this._subUserStatusVersion}_filterSubscribeRelationData(e){return e.reduce(((e,t)=>(t.subUsers.forEach((n=>{let r=e.find((e=>e.subscribeType===t.subType&&e.userId===n.subUserId));r?r.subscribeTime<t.subTime&&(r.expiry=t.expiry,r.operationType=t.opType,r.subscribeTime=t.subTime):e.push({userId:n.subUserId,subscribeTime:t.subTime,subscribeType:t.subType,expiry:t.expiry,operationType:t.opType})})),e)),[])}updateSubscribeRelation(e,t=!1){const n=[],r=[],s=[];t&&this._subStore.clearSubscribeRelation();return this._filterSubscribeRelationData(e).forEach((e=>{var t,o;const{userId:i,subscribeTime:a,subscribeType:l,expiry:d,operationType:u}=e;if(u===exports.SubscribeOperationType.UNSUBSCRIBE)return this._subStore.removeSubscribeUserData(l,i),void s.push(e);const c=this._subStore.getSubscribeUserData(l,i);if(!(c&&c.subscribeTime>=a)){if(l===exports.SubscribeType.ONLINE_STATUS){n.push(i);const e=(null===(t=c)||void 0===t?void 0:t.statusMap)||{};this._subStore.updateSubscribeUserData(l,i,{subscribeTime:a,expiry:d,userId:i,subscribeType:l,statusMap:e})}else{r.push(i);const e=null===(o=c)||void 0===o?void 0:o.profile;this._subStore.updateSubscribeUserData(l,i,{subscribeTime:a,expiry:d,userId:i,subscribeType:l,profile:e,isSubscribed:!0})}s.push(e)}})),{newSubscribeOnlineStatusList:n,newSubscribeUserProfileList:r,subscribeUserChangeList:s}}clearSubscribeStatus(){this._subStore.clearSubscribeStatusData(exports.SubscribeType.ONLINE_STATUS),this._subStore.clearSubscribeStatusData(exports.SubscribeType.USER_PROFILE)}updateSubscribeUserOnlineStatus(e){const t=[];return e.forEach((e=>{const{subUserId:n,data:r}=e,s=this._subStore.getSubscribeUserData(exports.SubscribeType.ONLINE_STATUS,n);if(!s)return;const o=[],i=Object.assign({},s.statusMap);r.forEach((e=>{const t=i[e.platformInfo];if(t&&t.changeTime>e.versionTime)return;const n={eventValue:e.value,changeTime:e.versionTime};i[e.platformInfo]=n,o.push(Object.assign(Object.assign({},n),{platform:e.platformInfo}))})),this._subStore.updateSubscribeUserData(exports.SubscribeType.ONLINE_STATUS,n,{subscribeTime:s.subscribeTime,expiry:s.expiry,userId:n,subscribeType:exports.SubscribeType.ONLINE_STATUS,statusMap:i}),t.push({userId:n,subscribeType:exports.SubscribeType.ONLINE_STATUS,subscribeTime:s.subscribeTime,expiry:s.expiry,details:o})})),t}updateSubscribeUserProfile(e){const t=[];return e.forEach((e=>{const{userId:n,version:r,userProfile:s,userExtProfile:o}=e,i=this._subStore.getSubscribeUserData(exports.SubscribeType.USER_PROFILE,n),a=yt(n,s,o);i?i.profile&&i.profile.version>=r||(this._subStore.updateSubscribeUserData(exports.SubscribeType.USER_PROFILE,n,{subscribeTime:i.subscribeTime,expiry:i.expiry,userId:n,subscribeType:exports.SubscribeType.USER_PROFILE,profile:{info:a,version:r},isSubscribed:i.isSubscribed}),i.isSubscribed&&t.push({userId:n,subscribeType:exports.SubscribeType.USER_PROFILE,subscribeTime:i.subscribeTime,expiry:i.expiry,userProfile:Object.assign({},a)})):this._subStore.updateSubscribeUserData(exports.SubscribeType.USER_PROFILE,n,{subscribeTime:0,expiry:0,userId:n,subscribeType:exports.SubscribeType.USER_PROFILE,profile:{info:a,version:r},isSubscribed:!1})})),t}getSubscribeUserStatus(e,t){const n=[];return t.forEach((t=>{const r=this._subStore.getSubscribeUserData(e,t);if(!r||r.expiry<(Date.now()+this._delayTime-r.subscribeTime)/1e3)this._subStore.removeSubscribeUserData(e,t);else{const t={subscribeTime:r.subscribeTime,expiry:r.expiry,userId:r.userId,subscribeType:r.subscribeType};if(e===exports.SubscribeType.ONLINE_STATUS){const{statusMap:e}=r,n=Object.keys(e).map((t=>Object.assign({platform:~~t},e[~~t])));t.details=mt(n)}else if(e===exports.SubscribeType.USER_PROFILE&&!r.isSubscribed)return;n.push(t)}})),n}getUserProfiles(e){const t=[],n=[];return e.forEach((e=>{const r=this._subStore.getSubscribeUserData(exports.SubscribeType.USER_PROFILE,e);if(!r||!r.profile)return void n.push(e);const{version:s,info:o}=r.profile;if(r.isSubscribed)return this._delayTime+Date.now()-s>6048e5?void n.push(e):void t.push(Object.assign(Object.assign({},o),{extraProfile:Object.assign({},o.extraProfile)}));this._delayTime+Date.now()-s>6e5?n.push(e):t.push(Object.assign(Object.assign({},o),{extraProfile:Object.assign({},o.extraProfile)}))})),{list:t,needQueryUserIds:n}}getSubscribeUserList(e,t,n){this._subStore.clearExpiredData(e);return this._subStore.getSubscribeUserList(e,t,n).map((t=>{const n={subscribeTime:t.subscribeTime,expiry:t.expiry,userId:t.userId,subscribeType:t.subscribeType};if(e===exports.SubscribeType.ONLINE_STATUS){const e=Object.keys(t.statusMap).map((e=>Object.assign({platform:~~e},t.statusMap[~~e])));n.details=mt(e)}return n}))}updateOwnProfile(e,t){this._ownProfileVersion>t||this._subStore.updateOwnProfile(e)}getOwnProfile(){return this._subStore.getOwnProfile()}}class $a{constructor(e,t,n,r,s,o,i){this._connectManager=e,this._event=t,this._currentUserId=n,this._delayTime=r,this._logger=s,this._isOpenUserProfile=o,this._subDriven=i,this._isPullingRelationship=!1,this._pullRelationshipQueue=[],this._pullRelationshipFailTime=0,this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue=[],this._pullSubUserStatusFailTime=0,this._subscribeService=new Wa(r)}syncData(){return t(this,void 0,void 0,(function*(){this._subDriven&&(yield this._syncSubscribeRelationship(!1),yield this._syncSubscribeUserStatus(!0)),this._isOpenUserProfile&&(yield this.syncOwnProfile()),1&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.ONLINE_STATUS),2&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.USER_PROFILE),3&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.FRIEND_ONLINE_STATUS),4&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.FRIEND_USER_PROFILE)}))}startSyncSubscribeRelationship(e){return t(this,void 0,void 0,(function*(){this._pullRelationshipQueue.push(e),this._syncSubscribeRelationship()}))}_syncSubscribeRelationship(e=!0){return t(this,void 0,void 0,(function*(){this._isPullingRelationship||(this._isPullingRelationship=!0,yield this._pullSubscribeRelationship(e),this._isPullingRelationship=!1,this._pullRelationshipQueue.length>0&&(this._pullRelationshipQueue.length=0,yield this._syncSubscribeRelationship(e)))}))}_pullSubscribeRelationship(e,n=""){return t(this,void 0,void 0,(function*(){const t=this._subscribeService.getRelationshipStatusVersion(),r=this._logger.createTraceId();this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:t,_pageToken:n}),r);const s=this._connectManager.codec.encodePullUserSubReq({version:t,pageToken:n}),o=new Gi(Jo.pullUserSub,s,this._currentUserId),{code:i,data:a}=yield this._connectManager.send(o,Bs);if(i!==exports.ErrorCode.SUCCESS||!a)return this._logger.error(exports.LogTagId.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:i,failTime:this._pullRelationshipFailTime}),r),this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?void(this._pullRelationshipFailTime=0):this._pullSubscribeRelationship(e,n);this._pullRelationshipFailTime=0;let{list:l,version:d,hasNext:u,pageToken:c}=a;if(d=gt(d),l.forEach((e=>{e.subTime=gt(e.subTime)})),this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:i,data:a}),r),e){const{newSubscribeOnlineStatusList:e,newSubscribeUserProfileList:t,subscribeUserChangeList:n}=this._subscribeService.updateSubscribeRelation(l);this._event.subscribeRelationChanged(n),e.length>0&&this._queryAndUpdateUserOnlineStatus(e),t.length>0&&this._queryAndUpdateUserProfile(t)}else this._subscribeService.updateSubscribeRelation(l,!n);this._subscribeService.updateRelationshipStatusVersion(d),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((e=>e>d)),u&&(yield this._pullSubscribeRelationship(e,c))}))}startsyncSubscribeUserStatus(e){return t(this,void 0,void 0,(function*(){this._pullSubUserStatusQueue.push(e),this._syncSubscribeUserStatus()}))}_syncSubscribeUserStatus(e=!1){return t(this,void 0,void 0,(function*(){this._isPullingSubUserStatus||(this._isPullingSubUserStatus=!0,yield this._pullSubscribeUserStatus(e),this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue.length>0&&(this._pullSubUserStatusQueue.length=0,yield this._syncSubscribeUserStatus(e)))}))}_pullSubscribeUserStatus(e=!1,n=""){return t(this,void 0,void 0,(function*(){const t=this._subscribeService.getSubscribeUserStatusVersion(),r=this._logger.createTraceId();this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:t,_pageToken:n,needAllData:e}),r);const s=this._connectManager.codec.encodePullSubDataReq({version:t,needAllData:e,pageToken:n}),o=new Gi(Jo.pullSubData,s,this._currentUserId),{code:i,data:a}=yield this._connectManager.send(o,Hs);if(i!==exports.ErrorCode.SUCCESS||!a)return this._logger.warn(exports.LogTagId.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:i,failTime:this._pullSubUserStatusFailTime}),r),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?void(this._pullSubUserStatusFailTime=0):this._pullSubscribeUserStatus(e,n);this._pullSubUserStatusFailTime=0;let{list:l,versionTime:d,hasNext:u,pageToken:c,isFull:h}=a;d=gt(d),this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:i,data:a}),r),l.forEach((e=>{e.data.forEach((e=>{e.versionTime=gt(e.versionTime)}))})),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((e=>e>d)),this._subscribeService.updateSubscribeUserStatusVersion(d);const p=[],_=[];l.forEach((e=>{e.subType===exports.SubscribeType.ONLINE_STATUS?p.push(e):e.subType===exports.SubscribeType.USER_PROFILE&&_.push(e.subUserId)})),h&&""===n&&this._subscribeService.clearSubscribeStatus(),p.length>0&&this._updateUserOnlineStatus(p,!h),_.length>0&&(yield this._queryAndUpdateUserProfile(_,!h)),u&&(yield this._pullSubscribeUserStatus(e,c))}))}_queryAndUpdateUserOnlineStatus(e){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(exports.LogTagId.L_QUERY_SUBSCRIBE_DATA_T,JSON.stringify(e),t);const n=this._connectManager.codec.encodeQrySubDataReq(exports.SubscribeType.ONLINE_STATUS,e),r=new Gi(Jo.qrySubData,n,this._currentUserId),{code:s,data:o}=yield this._connectManager.send(r,Hs);this._logger.info(exports.LogTagId.L_QUERY_SUBSCRIBE_DATA_R,JSON.stringify({code:s,data:o}),t),s===exports.ErrorCode.SUCCESS&&o&&this._updateUserOnlineStatus(o.list)}))}_updateUserOnlineStatus(e,t=!0){e.forEach((e=>{e.data.forEach((e=>{e.versionTime=gt(e.versionTime)}))}));let n=this._subscribeService.updateSubscribeUserOnlineStatus(e);n=n.filter((e=>e.details&&e.details.length>0)),t&&n.length>0&&this._event.subscribeUserStatusChanged(n)}_queryAndUpdateUserProfile(e,n=!0){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(exports.LogTagId.L_PULL_USER_PROFILE_T,JSON.stringify(e),t);const r=this._connectManager.codec.encodePullUserProfileReq(e),s=new Gi(Jo.pullUserProfile,r,this._currentUserId),{code:o,data:i}=yield this._connectManager.send(s,$s);if(this._logger.info(exports.LogTagId.L_PULL_USER_PROFILE_R,JSON.stringify({code:o,data:i}),t),o!==exports.ErrorCode.SUCCESS||!i)return{code:o};i.UserProfile.forEach((e=>{e.version=gt(e.version)}));const a=this._subscribeService.updateSubscribeUserProfile(i.UserProfile);return n&&a.length>0&&this._event.subscribeUserStatusChanged(a),{code:o,data:i.UserProfile}}))}updateUserStatus(e){return t(this,void 0,void 0,(function*(){const t=this._connectManager.codec.decodeByPBName(e.pbData,qs);if(t.subType===exports.SubscribeType.ONLINE_STATUS)this._updateUserOnlineStatus([t]);else if(t.subType===exports.SubscribeType.USER_PROFILE)this._queryAndUpdateUserProfile([t.subUserId]);else if(t.subType===exports.SubscribeType.FRIEND_ONLINE_STATUS){const e=t.data.map((e=>({changeTime:gt(e.versionTime),eventValue:e.value,platform:e.platformInfo})));this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,details:e}])}else if(t.subType===exports.SubscribeType.FRIEND_USER_PROFILE){const e=yield this._queryAndUpdateUserProfile([t.subUserId]),{data:n}=e;n&&this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,userProfile:yt(t.subUserId,n[0].userProfile,n[0].userExtProfile)}])}}))}getSubscribeUserStatus(e,t){return this._subscribeService.getSubscribeUserStatus(e,t)}getSubscribeUserList(e,t,n){return this._subscribeService.getSubscribeUserList(e,t,n)}updateSubscribeRelation(e,n,r,s=0){return t(this,void 0,void 0,(function*(){const t=this._connectManager.codec.encodeUpdateUserSubReq(n,e,r,s),o=new Gi(Jo.updUserSub,t,this._currentUserId),{code:i,data:a}=yield this._connectManager.send(o,Gs);if(i===exports.ErrorCode.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT&&a)return{code:i,data:a.subUsers.map((e=>e.subUserId))};if(i!==exports.ErrorCode.SUCCESS||!a)return{code:i};const{subTime:l}=a;return this._subscribeService.updateSubscribeRelation([{subType:n,subTime:l,expiry:s,opType:r,subUsers:e.map((e=>({subUserId:e})))}]),r===exports.SubscribeOperationType.SUBSCRIBE&&(n===exports.SubscribeType.ONLINE_STATUS?this._queryAndUpdateUserOnlineStatus(e):n===exports.SubscribeType.USER_PROFILE&&this._queryAndUpdateUserProfile(e,!1)),{code:i}}))}getUserProfiles(e){return t(this,void 0,void 0,(function*(){const{needQueryUserIds:t,list:n}=this._subscribeService.getUserProfiles(e);if(0===t.length)return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n});const{code:r,data:s}=yield this._queryAndUpdateUserProfile(t,!1);if(r!==exports.ErrorCode.SUCCESS||!s)return{code:r,data:[...n]};const o=s.map((e=>yt(e.userId,e.userProfile,e.userExtProfile)));return{code:r,data:[...n,...o]}}))}syncOwnProfile(e=!1){return t(this,void 0,void 0,(function*(){if(!this._isOpenUserProfile)return Promise.resolve({code:exports.ErrorCode.RC_USER_PROFILE_SERVICE_UNAVAILABLE});const t=this._logger.createTraceId();this._logger.info(exports.LogTagId.L_PULL_OWN_PROFILE_T,"",t);const n=this._connectManager.codec.encodeUserProfileInput(),r=new Gi(Jo.pullOwnProfile,n,this._currentUserId),{code:s,data:o}=yield this._connectManager.send(r,Ks);if(this._logger.info(exports.LogTagId.L_PULL_OWN_PROFILE_R,JSON.stringify({code:s,data:o}),t),s!==exports.ErrorCode.SUCCESS||!o)return{code:s};const{userExtProfile:i,userProfile:a,version:l,userId:d}=o,u=gt(l),c=yt(d,a,i);return this._subscribeService.updateOwnProfile(c,u),e&&this._event.ownUserProfileChanged(c),{code:s,data:c}}))}getOwnProfile(){return t(this,void 0,void 0,(function*(){const e=this._subscribeService.getOwnProfile();return e?{code:exports.ErrorCode.SUCCESS,data:e}:this.syncOwnProfile()}))}updateOwnProfile(e,n){return t(this,void 0,void 0,(function*(){this._subscribeService.updateOwnProfile(e,n)}))}}class Ja{constructor(e,t,n){this._storage=new Ca(Ge(e,t)),this._delayTime=n,this.clear()}_getConversationKey(e){return`${e.targetId}_${e.channelId}`}_removeExcessData(e){let t=Object.keys(e).map((t=>({key:t,value:e[t]}))).sort(((e,t)=>e.value.t-t.value.t)).slice(-30);const n={};for(let e of t)n[e.key]=e.value;return n}insert(e,t,n,r,s){if(r<Date.now()-this._delayTime-ve)return;const o=this._getConversationKey(e),i=this._storage.get(o)||{};if(i[t])return;const a={t:r,d:n};s&&(a.sId=s);let l=Object.assign(Object.assign({},i),{[t]:a});Object.keys(l).length>30&&(l=this._removeExcessData(l)),this._storage.set(o,l)}addReadedUser(e,t,n){const r=this._getConversationKey(e),s=this._storage.get(r)||{},o=s[t];if(o){if(o.us){if(o.us.includes(n))return}else o.us=[];o.us.push(n),this._storage.set(r,Object.assign(Object.assign({},s),{[t]:o}))}}getReadReceiptInfo(e,t){const n=this._getConversationKey(e),r=(this._storage.get(n)||{})[t];return r?{time:r.t,direction:r.d,users:r.us||[],senderId:r.sId}:null}getReceiptMessageDic(e){const t=this._getConversationKey(e),n=this._storage.get(t)||{},r={};for(const e in n){const t=n[e];t.d===exports.MessageDirection.RECEIVE&&(r[t.sId]||(r[t.sId]=[]),r[t.sId].push(e))}return r}remove(e,t){const n=this._getConversationKey(e),r=this._storage.get(n)||{};r[t]&&(delete r[t],0===Object.keys(r).length?this._storage.remove(n):this._storage.set(n,r))}clear(){const e=this._storage.getValues(),t={};for(const n in e){const r=e[n],s={};for(const e in r){const t=r[e];Date.now()-this._delayTime-t.t<ve&&(s[e]=t)}Object.keys(s).length&&(t[n]=s)}this._storage.update(t)}}class Xa extends $t{constructor(e,t){super(e,t),this.appkey=e,this.logger=t,this._storageKey="",this._storageKey=we(e)}getCache(){return rr.localStorage.getItem(this._storageKey)}setCache(e){rr.localStorage.setItem(this._storageKey,e)}clearCache(){rr.localStorage.removeItem(this._storageKey)}sendRequest(e){return t(this,void 0,void 0,(function*(){const{status:t,data:n}=yield rr.httpReq({url:e});return{code:t,data:n}}))}decryptData(e){return t(this,void 0,void 0,(function*(){try{const t=yield Bt(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91");return JSON.parse(t)}catch(e){this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==e?void 0:e.stack}))}}))}}class Za extends Qi{constructor(){super(...arguments),this._pullQueue=[],this._isPulling=!1}startPull(){return t(this,void 0,void 0,(function*(){if(this._isPulling)return;this._isPulling=!0;const{code:e,data:t}=yield this.pullQueueConsumption();this._isPulling=!1;let n=t&&t.hasNext||!1;if(e===exports.ErrorCode.SUCCESS&&!lt(t)){this.pullDataHandler(t);const e=this.getVersion(),n=this._pullQueue.filter((t=>t>e));this._pullQueue.length=0,this._pullQueue.push(...n)}n?this.startPull():this._pullQueue.length>0&&(this._pullQueue.length=0,this.startPull())}))}_triggerPull(e){return t(this,void 0,void 0,(function*(){this._pullQueue.push(e),yield this.startPull()}))}}class za extends Za{constructor(e,t,n,r,s){super(),this._connectManager=e,this._currentUserId=t,this._logger=n,this._appkey=r,this._callBack=s,this._lastPullingChangeMessageTime=0,this._lastPullingChangeMessageTimeLocal=(new Date).getTime(),this._duration=18e4,this._pullEventChangeIntervalTimer=-1,this._localStorageKey=Fe(r,t),this._storage=new Ca(this._localStorageKey),this._lastPullingChangeMessageTime=this._storage.get(t)||0}get _isConnected(){return this._connectManager.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED}_setLastPullingChangeMessageTime(e){this._lastPullingChangeMessageTime=e,this._storage.set(this._currentUserId,e)}_startPullEventChangeInterval(){const e=()=>{this._pullEventChangeIntervalTimer=setTimeout((()=>{const t=Date.now();t-this._lastPullingChangeMessageTimeLocal>=this._duration&&(this.startPullEventChange(this._lastPullingChangeMessageTime,!0),this._lastPullingChangeMessageTimeLocal=t),this._stopUltraSyncInterval(),e()}),3e4)};e()}_stopUltraSyncInterval(){-1!==this._pullEventChangeIntervalTimer&&(clearTimeout(this._pullEventChangeIntervalTimer),this._pullEventChangeIntervalTimer=-1)}startPullEventChange(e,t=!1){const n=this.getVersion();(e>n||0===e||t)&&this._triggerPull(n)}pullQueueConsumption(){if(!this._isConnected)return Promise.resolve({code:exports.ErrorCode.CONNECTION_TIMEOUT});this._logger.info(exports.LogTagId.L_PULL_EVENT_CHANGE_T,`PullEventChange time: ${this._lastPullingChangeMessageTime}`);const e=this._connectManager.codec.encodeQueryMsgChange(this._lastPullingChangeMessageTime),t=new Gi(Jo.pullEventChange,e,this._currentUserId);return t.setHeaderQos(zo.AT_LEAST_ONCE),this._connectManager.send(t,Cs)}pullDataHandler(e){this._logger.info(exports.LogTagId.L_PULL_EVENT_CHANGE_R,`PullEventChange data: ${JSON.stringify(e)}`);const{list:t}=e,n=(null==e?void 0:e.syncTime)||0;this._callBack(t),this._setLastPullingChangeMessageTime(n)}getVersion(){return this._lastPullingChangeMessageTime||0}notificationOnline(){return t(this,void 0,void 0,(function*(){this._isConnected&&(this.startPullEventChange(this._lastPullingChangeMessageTime,!0),this._startPullEventChangeInterval(),this._logger.info(exports.LogTagId.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S,"PullEventChange notify online"))}))}}var el,tl;!function(e){e[e.ACCEPTED=0]="ACCEPTED",e[e.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",e[e.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",e[e.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",e[e.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",e[e.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",e[e.REDIRECT=6]="REDIRECT",e[e.PACKAGE_ERROR=7]="PACKAGE_ERROR",e[e.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",e[e.BLOCK=9]="BLOCK",e[e.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",e[e.DEVICE_ERROR=11]="DEVICE_ERROR",e[e.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",e[e.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",e[e.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",e[e.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",e[e.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",e[e.OTP_USED=17]="OTP_USED",e[e.PLATFORM_ERROR=18]="PLATFORM_ERROR",e[e.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",e[e.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(el||(el={})),function(e){e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW",e[e.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",e[e.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",e[e.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(tl||(tl={}));const nl={[tl.OTHER_DEVICE_LOGIN]:exports.ErrorCode.RC_DISCONN_KICK,[tl.BLOCK]:exports.ErrorCode.RC_DISCONN_EXCEPTION,[tl.BLOCK_NEW]:exports.ErrorCode.RC_DISCONN_EXCEPTION,[tl.REDIRECT_NEW]:exports.ErrorCode.RC_CONN_REDIRECTED,[tl.TOKEN_EXPIRED]:exports.ErrorCode.RC_CONN_TOKEN_EXPIRED,[tl.ILLEGAL_PROTOCOL_VERSION]:exports.ErrorCode.RC_CONN_PROTO_VERSION_ERROR,[tl.ACCOUNT_CANCELLATION]:exports.ErrorCode.RC_ACCOUNT_CANCELLATION},rl={[el.ACCEPTED]:exports.ErrorCode.SUCCESS,[el.UNACCEPTABLE_PROTOCOL_VERSION]:exports.ErrorCode.RC_CONN_PROTO_VERSION_ERROR,[el.IDENTIFIER_REJECTED]:exports.ErrorCode.RC_CONN_IDENTIFIER_REJECTED,[el.SERVER_UNAVAILABLE]:exports.ErrorCode.RC_CONN_SERVER_UNAVAILABLE,[el.TOKEN_INCORRECT]:exports.ErrorCode.RC_CONN_TOKEN_INCORRECT,[el.NOT_AUTHORIZED]:exports.ErrorCode.RC_CONN_NOT_AUTHRORIZED,[el.REDIRECT]:exports.ErrorCode.RC_CONN_REDIRECTED,[el.PACKAGE_ERROR]:exports.ErrorCode.RC_CONN_PACKAGE_NAME_INVALID,[el.APP_BLOCK_OR_DELETE]:exports.ErrorCode.RC_CONN_APP_BLOCKED_OR_DELETED,[el.BLOCK]:exports.ErrorCode.RC_CONN_USER_BLOCKED,[el.TOKEN_EXPIRE]:exports.ErrorCode.RC_CONN_TOKEN_EXPIRED,[el.DEVICE_ERROR]:exports.ErrorCode.RC_CONN_DEVICE_ERROR,[el.HOSTNAME_ERROR]:exports.ErrorCode.RC_CONN_HOSTNAME_ERROR,[el.HASOHTERSAMECLIENTONLINE]:exports.ErrorCode.RC_DISCONN_SAME_CLIENT_ON_LINE,[el.OUT_OF_LIMIT]:exports.ErrorCode.RC_LISCENSE_COUNT_OUT_OF_LIMIT,[el.IN_OTHER_CLUSTER]:exports.ErrorCode.RC_CONN_WRONG_CLUSTER,[el.APP_AUTH_NOT_PASS]:exports.ErrorCode.RC_APP_AUTH_NOT_PASS,[el.OTP_USED]:exports.ErrorCode.RC_OTP_USED,[el.PLATFORM_ERROR]:exports.ErrorCode.RC_PLATFORM_ERROR,[el.ACCOUNT_CANCELLATION]:exports.ErrorCode.RC_ACCOUNT_CANCELLATION,[el.LICENSE_EXPIRED]:exports.ErrorCode.RC_LICENSE_EXPIRED},sl=e=>[Jo.ppMsgS,Jo.pgMsgS,Jo.chatMsgS].includes(Xo(e)),ol=(e,t)=>{let n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};function il(e){return Object.keys(e).map((t=>{let n=e[t];return"string"!=typeof n&&(n=`${n}`),{key:t,value:n}}))}function al(e,t,n,r){return Mo.encode(zs,{targetId:e,type:exports.ConversationType.GROUP,users:r,extProfile:n?il(n):void 0,settingProfile:il(t)})}const ll={[Zo(Jo.ppMsgP)]:exports.ConversationType.PRIVATE,[Zo(Jo.pgMsgP)]:exports.ConversationType.GROUP,[Zo(Jo.chatMsg)]:exports.ConversationType.CHATROOM,[Zo(Jo.pcMsgP)]:exports.ConversationType.CUSTOMER_SERVICE,[Zo(Jo.pbMsgP)]:exports.ConversationType.SYSTEM},dl="1",ul="0",cl=1,hl=2,pl=3,_l={1:"ChannelsUserInfos",2:"ChannelsInviteStatusInfos",3:"ChannelsJoinedInfos",11:"FriendUserInfos",12:"FriendInviteInfos"},gl={[A.GROUP_OPERATION]:e=>"ChannelEventData",[A.GROUP_PROFILE_CHANGE]:e=>"ChannelEventData",[A.GROUP_APPLICATION_INVITATION]:e=>"ChannelApplyInfo",[h.FRIEND_APPLICATION]:e=>({0:"FriendApplyEvent",1:"FriendApplyEvent",2:"FriendUserInfo",3:"FriendsInput",5:"FriendTypeChangeEvent",6:"FriendUpdateEvent"}[e])};class El{constructor(e){this.logger=e}decodeByPBName(e,t,n){const r=this;let s=e;const o={[pr]:r._formatSyncMessages,[_r]:r._formatReceivedMessage,[cr]:r._formatSentMessage,[Pr]:r._formatHistoryMessages,[yr]:r._formatConversationList,[Lr]:r._formatChatRoomInfos,[Kr]:r._formatChatRoomKVList,[Jr]:r._formatUserSetting,[Zr]:r._formatConversationStatus,[ds]:r._formatGrpReadReceiptQryResp,[bs]:r._formatQueryReceiptResp,[Wr]:r._formatSetUserSettingOutput,[_s]:r._formatUserSettingNotification,[Cs]:r._formatEventChangeList,[Rs]:r._formatUltraMsgChangeList,[vs]:r._formatUltraOperateStatusNotifyList,[ms]:r._formatUltraMsgList,[Ar]:r._formatUltraGroupUnreadMentionedList,[Cr]:r._formatChrmKVVersion,[Ls]:r._formatCallKVInfo,[Os]:r._fromatCallInfoDownStream,[Dr]:r._formateSessionMsgReadInput,[io]:r._formateChannelsListResult}[t];try{s=e.length>0&&Mo.decode(t,e),at(o)&&(s=o.call(this,s,n))}catch(e){this.logger.error(exports.LogTagId.L_PB_DECODE_E,t)}return s}_readBytes(e){const{offset:t,buffer:n,limit:r}=e;if(t)try{const e=(s=n,"[object ArrayBuffer]"===Object.prototype.toString.call(s)?new Uint8Array(n):n);return yi.readUTF(e.subarray(t,r))}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}var s;return e}_formatBytes(e){if(!e)return e;let t=this._readBytes(e);try{t=t?JSON.parse(t):t}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return t||e}_formatSyncMessages(e,t){t=t||{};const n=this,{list:r,syncTime:s,finished:o}=e;return(lt(o)||null===o)&&(e.finished=!0),e.syncTime=gt(s),e.list=It(r,(e=>n._formatReceivedMessage(e,t))),e}_getUtfContent(e){if(e.user){const{portrait:t,portraitUri:n}=e.user,r=t||n;r&&(e.user.portrait=e.user.portraitUri=r)}return e}_setExpansion(e){let t;return e&&(t=(e=>{const t={},n=JSON.parse(e);return Et(n,((e,n)=>{t[n]=e.v})),t})(e)),t}_setPushConfig(e,t){const{pushContent:n,pushExt:r,configFlag:s}=e;let o={};r&&(o=((e,t,n)=>{const r={},s={notificationId:n||""},o={};if(!t)return{iOSConfig:r,androidConfig:s,harmonyOSConfig:o};try{const e=JSON.parse(t);null==e||e.forEach((e=>{var t,n,i,a,l,d,u,c,h,p,_,g;const E=Object.keys(e);if(0===E.length)return;const I=E[0];switch(I){case"HW":return s.channelIdHW=null===(t=e[I])||void 0===t?void 0:t.channelId,s.importanceHW=null===(n=e[I])||void 0===n?void 0:n.importance,s.imageUrlHW=null===(i=e[I])||void 0===i?void 0:i.image,void(s.categoryHW=null===(a=e[I])||void 0===a?void 0:a.category);case"MI":return void(s.channelIdMi=null===(l=e[I])||void 0===l?void 0:l.channelId);case"OPPO":return void(s.channelIdOPPO=null===(d=e[I])||void 0===d?void 0:d.channelId);case"VIVO":return s.typeVivo=null===(u=e[I])||void 0===u?void 0:u.classification,void(s.categoryVivo=null===(c=e[I])||void 0===c?void 0:c.category);case"APNS":return r.threadId=e[I]["thread-id"],r.apnsCollapseId=e[I]["apns-collapse-id"],r.category=e[I].category,r.richMediaUri=e[I].richMediaUri,void(r.interruptionLevel=e[I]["interruption-level"]);case"FCM":return void(s.googleConfig={collapseKey:e[I].collapse_key||"",imageUrl:e[I].imageUrl||"",priority:e[I].priority||""});case"HONOR":return s.importanceHonor=null===(h=e[I])||void 0===h?void 0:h.importance,void(s.imageUrlHonor=null===(p=e[I])||void 0===p?void 0:p.image);case"OHOS":o.category=null===(_=e[I])||void 0===_?void 0:_.category,o.image=null===(g=e[I])||void 0===g?void 0:g.image}}))}catch(n){e.error(exports.LogTagId.O,`Wrong format for pushConfigs field! content: ${t}`)}return{iOSConfig:r,androidConfig:s,harmonyOSConfig:o}})(t,r.pushConfigs,r.pushId));return Object.assign(Object.assign({},o),{pushTitle:null==r?void 0:r.title,pushContent:n,pushData:"",disablePushTitle:!!s&&Boolean(4&s),forceShowDetailContent:!!s&&Boolean(8&s),templateId:null==r?void 0:r.templateId})}_formatReceivedMessage(e,t){var n;if(!e)return e;const r=this,{currentUserId:s,connectedTime:o,afterDecode:i,customMessageTypes:a={}}=t||{},{content:l,fromUserId:d,type:u,groupId:c,status:h,dataTime:p,extraContent:_,extStatus:g,clientUniqueId:E,busChannel:I,msgId:T,classname:f,toUserIds:C,optionBits:R}=e,S=e.direction||exports.MessageDirection.RECEIVE,{isPersited:m,isCounted:y,isMentioned:v,disableNotification:A,receivedStatus:N,canIncludeExpansion:O}=(e=>{let t=!0,n=!0,r=!1,s=!1,o=exports.ReceivedStatus.READ,i=!1,a=!1;return t=!!(16&e),n=!!(32&e),r=!!(64&e),s=!!(512&e),i=!!(2&e),o=i?exports.ReceivedStatus.RETRIEVED:o,a=!!(1024&e),{isPersited:t,isCounted:n,isMentioned:r,disableNotification:s,receivedStatus:o,canIncludeExpansion:a}})(h),M=!!(2&(g||0)),L=!!(4&(g||0)),U=!!(8&(g||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,P=[exports.ConversationType.GROUP,exports.ConversationType.CHATROOM,exports.ConversationType.RTC_ROOM,exports.ConversationType.ULTRA_GROUP].indexOf(u)>-1?c:d;let b=d,x=exports.MessageDirection.RECEIVE;S===exports.MessageDirection.SEND&&(b=s,x=exports.MessageDirection.SEND);const D=gt(p),w=D<o,V=u===exports.ConversationType.CHATROOM;let G=r._setExpansion(_),F=r._formatBytes(l);F=r._getUtfContent(F);const B=r._setPushConfig(e,this.logger);V&&d===s&&(x=exports.MessageDirection.SEND);const k={conversationType:u,targetId:P,senderUserId:b,messageType:f,messageUId:T,isPersited:m,isCounted:y,isMentioned:v,sentTime:D,messageDirection:x,receivedTime:Date.now(),disableNotification:A,receivedStatus:N,receivedStatusInfo:St(N),canIncludeExpansion:O,content:F,expansion:G,pushConfig:B,channelId:I||"",isInterrupt:M,isModifyMessage:L,messageId:gt(E)||0,sentStatus:exports.SentStatus.SENT,isOffLineMessage:w,channelType:U,isStatusMessage:(null===(n=a[f])||void 0===n?void 0:n.isStatusMessage)||!1,readReceiptInfo:void 0,directedUserIds:C,disableUpdateLastMessage:!!(1&(R||0))};return(null==i?void 0:i(k))||k}_formatSentMessage(e,t){const n=this,{content:r,classname:s,sessionId:o,msgId:i,extraContent:a,pushExt:l,pushContent:d,configFlag:u,extStatus:c,clientUniqueId:h,systemId:p,toUserIds:_,optionBits:g}=e,{signal:E,currentUserId:I}=t,{date:T,topic:f,targetId:C}=E,R=!!(2&(c||0)),{isPersited:S,isCounted:m,disableNotification:y,canIncludeExpansion:v,isMentioned:A}=(e=>{let t=!1,n=!1,r=!1,s=!1,o=!1;return t=!!(1&e),n=!!(2&e),o=!!(4&e),r=!!(32&e),s=!!(64&e),{isPersited:t,isCounted:n,disableNotification:r,canIncludeExpansion:s,isMentioned:o}})(o);let N=ll[f]||exports.ConversationType.PRIVATE;const O=sl(f),M=n._formatBytes(r);let L=p||C;s===exports.MessageType.RECALL&&(N=M.conversationType||N,L=M.targetId||C);let U=n._setExpansion(a),P=n._setPushConfig(e,this.logger);const b=Object.assign(Object.assign({},P),{pushTitle:null==l?void 0:l.title,pushContent:d,pushData:d,disablePushTitle:!!u&&Boolean(4&u),forceShowDetailContent:!!u&&Boolean(8&u),templateId:null==l?void 0:l.templateId});return{conversationType:N,targetId:L,messageType:s,messageUId:i,isPersited:S,isCounted:m,isStatusMessage:O,senderUserId:I,content:n._formatBytes(r),sentTime:1e3*T,receivedTime:Date.now(),messageDirection:exports.MessageDirection.SEND,isOffLineMessage:!1,disableNotification:y,canIncludeExpansion:v,expansion:U,pushConfig:b,channelId:e.busChannel||"",isInterrupt:R,messageId:gt(h)||0,receivedStatus:exports.ReceivedStatus.UNREAD,receivedStatusInfo:St(exports.ReceivedStatus.UNREAD),isMentioned:A,directedUserIds:_,disableUpdateLastMessage:!!(1&(g||0))}}_formatHistoryMessages(e,t){const n=t.conversation||{},{list:r,hasMsg:s}=e,{targetId:o}=n,i=gt(e.syncTime),a=[];return Et(r,(e=>{const r=this._formatReceivedMessage(e,t);n.conversationType===exports.ConversationType.ULTRA_GROUP?r.targetId=e.groupId||n.targetId:r.targetId=o,a.push(r)}),{isReverse:!0}),{syncTime:i,list:a,hasMore:!!s}}_formatUltraMsgChangeList(e){const{list:t,syncTime:n,hasNext:r}=e;return{syncTime:n,list:t&&t.map((e=>{const{targetId:t,type:n,time:r,changeType:s,msgUID:o,msgTime:i,busChannel:a,isAdmin:l,isDel:d,operatorId:u,subChangeType:c,userGroupIds:h,busChannelType:p,remindType:_}=e;return{targetId:t,conversationType:n,changeType:s,messageUId:o,changeTime:gt(r),sendTime:gt(i),channelId:a||"",isAdmin:l,isDel:d,operatorId:u,subChangeType:c,userGroupIds:h,busChannelType:p,mentionedType:_}})),hasNext:r}}_formatEventChangeList(e){const{list:t,syncTime:n,hasNext:r}=e;return{syncTime:n,list:t&&t.map((e=>{const{businessId:t,type:n,time:r,changeType:s,originalId:o,originalTime:i,secondaryId:a,isAdmin:l,additionalMark:d,operatorId:u,subChangeType:c,secondaryType:h,remindType:p,isRemindMe:_,extIds:g,eventData:E}=e;let I;return E&&(I=this._formatEventData(E,s,c)),{businessId:t,conversationType:n,changeType:s,originalId:o,time:gt(r),originalTime:gt(i),secondaryId:a||"",isAdmin:l,additionalMark:d,operatorId:u,subChangeType:c,userGroupIds:g,secondaryType:h,remindType:p,isRemindMe:_,eventData:I}})),hasNext:r}}_formatEventData(e,t,n){let r={};return e&&gl[t]&&gl[t](n)&&(r=Mo.decode(gl[t](n),e)||{}),r}_formatUltraOperateStatusNotifyList(e){const{type:t,notifyType:n,info:r,summary:s}=e,o=[],i=[],a=!(2&~n),l=!(1&~n);return l&&Array.isArray(r)&&r.forEach((e=>{const{targetId:t,busChannel:n,userId:r,opType:s,optime:i}=e,a=gt(i);o.push({targetId:t,channelId:n,userId:r,operationType:s,operationTime:a})})),a&&Array.isArray(s)&&s.forEach((e=>{const{targetId:t,busChannel:n,count:r,opType:s}=e;i.push({targetId:t,channelId:n,count:r,operationType:s})})),{conversationType:t,info:o,summary:i,hasInfo:l,hasSummary:a}}_formatUltraMsgList(e,t){const{list:n}=e;return{list:n&&n.map((e=>this._formatReceivedMessage(e,t)))}}_formatUltraGroupUnreadMentionedList(e){const{msgInfo:t=[]}=e;return t.map((e=>({messageUId:e.msgId,sentTime:gt(e.msgTime),mentionedType:e.remindType,messageType:e.className||""})))}_getUltraGroupConversationInfo(e,t){const{versionTime:n,unreadCount:r,remindCount:s,busChannelType:o,msgInfo:i,remindMeCount:a}=t;return e.versionTime=gt(n)||0,e.unreadMessageCount=this._getUnreadCount(gt(r)||0),e.unreadMentionedCount=this._getUnreadCount(gt(s)||0),e.unreadMentionedMeCount=this._getUnreadCount(gt(a)||0),e.channelType=o||exports.UltraGroupChannelType.PUBLIC,e.lastReadTime=0,i&&(e.firstUnreadMessage={sentTime:gt(i.msgTime)},e.lastReadTime=gt(i.msgTime)-1),e}_getUnreadCount(e){return e>999?999:e}_formatConversationList(e,t){const n=this;let{info:r}=e;const{afterDecode:s}=t;r=It(r,(e=>{const{msg:r,userId:o,type:i,unreadCount:a,busChannel:l,versionTime:d}=e;let u=null;r&&(u=n._formatReceivedMessage(r,t),u.targetId=o);let c={targetId:o,conversationType:i,unreadMessageCount:gt(a)||0,latestMessage:u,channelId:l||"",operationTime:gt(d)||0};return i===exports.ConversationType.ULTRA_GROUP&&(c=this._getUltraGroupConversationInfo(c,e)),(null==s?void 0:s(c))||c}));const o={list:r||[]};return((null==t?void 0:t.conversationType)||exports.ConversationType.NONE)===exports.ConversationType.ULTRA_GROUP&&(o.isFinished=e.isFinished),o}_formatSetUserSettingOutput(e){return e}_formatChatRoomInfos(e){const{userTotalNums:t,userInfos:n}=e;return{userCount:t,userInfos:It(n,(e=>{const{id:t,time:n}=e;return{id:t,time:gt(n)}}))}}_formatChatRoomKVList(e){let{entries:t,bFullUpdate:n,syncTime:r}=e;return t=t||[],t=It(t,(e=>{const{key:t,value:n,status:r,timestamp:s,uid:o,version:i}=e,{isAutoDelete:a,isOverwrite:l,type:d}=(e=>({isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?exports.ChatroomEntryType.DELETE:exports.ChatroomEntryType.UPDATE}))(r);return{key:t,value:n,isAutoDelete:a,isOverwrite:l,type:d,userId:o,timestamp:gt(s),version:gt(i)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}}_formatUserSetting(e){const{items:t,version:n}=e,r={};return Et(t||[],(e=>{const{key:t,version:n,value:s}=e;e.version=gt(n),e.value=this._readBytes(s),"Tag"===t&&e.tags.forEach((e=>{e.createdTime=gt(e.createdTime),e.tagName=e.name})),r[t]=e})),{settings:r,version:n}}_formatConversationStatus(e){const{state:t}=e,n=[];return Et(t,(e=>{const{type:t,channelId:r,time:s,stateItem:o,busChannel:i}=e;let a=exports.NotificationStatus.CLOSE,l=exports.NotificationLevel.NOT_SET,d=!1,u=[];Et(o,(e=>{const{sessionStateType:t,value:n,tags:r}=e;switch(t){case cl:a=n===dl?exports.NotificationStatus.OPEN:exports.NotificationStatus.CLOSE,l=Number(n)||exports.NotificationLevel.NOT_SET;break;case hl:d=n===dl;break;case pl:u=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,notificationLevel:l,isTop:d,updatedTime:gt(s),tags:u,channelId:i||""})})),n}_formatGrpReadReceiptQryResp(e){const{totalMemberNum:t,list:n}=e;return n.forEach((e=>{e.readTime=gt(e.readTime)})),{totalMemberCount:t,list:n}}_formatQueryReceiptResp(e){const{list:t=[],num:n,readCnt:r}=e;return{list:t.map((e=>({readTime:gt(e.receiptTime),userId:e.userId}))),totalCount:n,readCount:r}}_formatUserSettingNotification(e){return e}_formatChrmKVVersion(e){const{joinTime:t,createTime:n,memberCount:r,chatroomBanState:s,whiteListState:o}=e;return{joinTime:t,createTime:n||0,memberCount:r||0,isAllChatroomBanned:!!(1&s),isCurrentUserBanned:!!(2&s),isCurrentChatroomBanned:!!(4&s),isCurrentChatroomInWhitelist:!!(1&o)}}_formatRTCJoinedUserInfo(e){return(e.info||[]).map((e=>({deviceId:e.deviceId,roomId:e.roomId,joinTime:gt(e.joinTime)})))}_formatCallKVInfo(e){return e}_fromatCallInfoDownStream(e){return e}_formateSessionMsgReadInput(e){const{busChannel:t,channelId:n,msgTime:r,type:s}=e;return{conversationType:s,targetId:n,channelId:t||"",timestamp:r}}_formateChannelsListResult(e){if(!e)return{result:{list:[]}};const{listType:t,result:n,page:r}=e;if(!n)return{listType:t,result:{list:[]},page:r};return{listType:t,result:Mo.decode(_l[t],n)||[],page:r}}encodeSessionAttInput(){const e=Mo.getModule(br);return e.setNothing(1),e.toArrayBuffer()}_calculateFlag(e){const{isFilerWhiteBlacklist:t,isVoipPush:n,pushConfig:r}=e,{disablePushTitle:s,forceShowDetailContent:o}=r||{};let i=0;return i|=n?1:0,i|=t?2:0,i|=s?4:0,i|=o?8:0,i}_getPushExtraModule(e){const{pushTitle:t,iOSConfig:n,androidConfig:r,templateId:s="",harmonyOSConfig:o}=e,i=Mo.getModule(hr);if(t&&i.setTitle(t),n||r||o){const e=((e={},t={},n={})=>{const{channelIdMi:r,channelIdHW:s,channelIdOPPO:o,typeVivo:i,importanceHW:a,categoryHW:l,imageUrlHW:d,categoryVivo:u,importanceHonor:c,imageUrlHonor:h}=t,{APNS:p,FCM:_}=((e={},t={})=>{const{threadId:n,apnsCollapseId:r,category:s,richMediaUri:o,interruptionLevel:i}=e,{googleConfig:a}=t,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=r||"",l.category=s||"",l.richMediaUri=o||"",l["interruption-level"]=i||"active";const d={};d.collapse_key=null==a?void 0:a.collapseKey,d.imageUrl=null==a?void 0:a.imageUrl;let u=null==a?void 0:a.priority;return u&&!["high","normal"].includes(u)&&(u="normal"),d.priority=u,{APNS:l,FCM:d}})(e,t),g=[{HW:{channelId:s||"",importance:a||"NORMAL",image:d||"",category:l||""}},{MI:{channelId:r||""}},{OPPO:{channelId:o||""}},{VIVO:{classification:i||"",category:u||""}},{APNS:p},{FCM:_},{HONOR:{importance:c||exports.PushImportanceHonor.NORMAL,image:h||""}},{OHOS:{category:n.category||null,image:n.image||""}}];return JSON.stringify(g)})(n,r,o);i.setPushConfigs(e)}return(null==r?void 0:r.notificationId)&&i.setPushId(null==r?void 0:r.notificationId),i.setTemplateId(s),i}_getUpMsgModule(e,t){const{messageType:n,content:r,directionalUserIdList:s,canIncludeExpansion:o,expansion:i,pushConfig:a,channelId:l,pushData:d="",pushContent:u="",messageId:c=0,disableUpdateLastMessage:h=!1,isPersited:p}=t,{conversationType:_,targetId:g}=e,E=Mo.getModule(cr),I=(e=>{const{isStatusMessage:t}=e;let{isPersited:n,isCounted:r,isMentioned:s,disableNotification:o,canIncludeExpansion:i}=e;t&&(n=r=!1);let a=0;return n&&(a|=1),r&&(a|=2),s&&(a|=4),o&&(a|=32),i&&(a|=64),a})(t),{pushContent:T=u,pushData:f=d}=a||{};E.setSessionId(I),T&&E.setPushText(T),f&&E.setAppData(f),s&&E.setToUserIds(s);let C=this._calculateFlag(t);if(E.setConfigFlag(C),E.setClassname(n),r.user&&r.user.portraitUri&&(r.user.portrait=r.user.portraitUri),E.setContent(JSON.stringify(r)),o&&i){const e={};Et(i,((t,n)=>{e[n]={v:t}})),E.setExtraContent(JSON.stringify(e))}if(a){const e=this._getPushExtraModule(a);E.setPushExt(e)}E.setClientUniqueId(c),lt(l)||E.setBusChannel(l),_===exports.ConversationType.SYSTEM&&E.setSystemId(g);let R=0;return p&&h&&(R|=1),E.setOptionBits(R),E}encodeUpMsg(e,t){return this._getUpMsgModule(e,t).toArrayBuffer()}encodeGetHistoryMsg(e,t){const{count:n,order:r,timestamp:s,channelId:o}=t,i=Mo.getModule(Ur);return i.setTargetId(e),i.setTime(s),i.setCount(n),i.setOrder(r),i.setBusChannel(o||""),i.toArrayBuffer()}encodeSuperSyncMsg(e){const t=Mo.getModule(Is);return t.setSyncTime(e),t.toArrayBuffer()}encodeOldConversationList(e){e=e||{};let{count:t,type:n,startTime:r,order:s}=e;t=t||0,r=r||0,s=s||0;const o=Mo.getModule(Sr);return o.setType(n),o.setCount(t),o.setStartTime(r),o.setOrder(s),o.toArrayBuffer()}encodeRemoveOldConversationList(e){e=e||{};const{conversationType:t,channelId:n}=e,r=Mo.getModule(mr);return r.setType(t),n&&r.setBusChannel([n]),r.toArrayBuffer()}encodeBatchDeleteConversation(e){const t=Mo.getModule(Br),n=[];return e.forEach((e=>{const{conversationType:t,targetId:r,channelId:s}=e,o=Mo.getModule(kr);o.setConversationType(t),o.setConversationId(r),o.setBusChannel(s||""),n.push(o)})),t.setRelation(n),t.toArrayBuffer()}_encodeSessions(e){return e.map((e=>{const{conversationType:t,targetId:n}=e,r=Mo.getModule(Vr);return r.setType(t),r.setChannelId(n),r}))}encodeRemoveConversationList(e){const t=Mo.getModule(wr);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()}encodeDeleteMessages(e,t,n,r){const s=Mo.getModule(Hr),o=[];return Et(n,(e=>{o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),s.setType(e),s.setConversationId(t),s.setMsgs(o),s.setBusChannel(r),s.toArrayBuffer()}encodeClearMessages(e,t,n,r){const s=Mo.getModule(Nr);return t=t||(new Date).getTime(),s.setDataTime(t),s.setTargetId(e),s.setBusChannel(n),s.setConversationType(r),s.toArrayBuffer()}encodeBatchClearRemoteMessages(e){const t=Mo.getModule(Or),n=e.map((e=>{const t=Mo.getModule(Nr);return t.setTargetId(e.targetId),t.setConversationType(e.conversationType),t.setBusChannel(e.channelId),t.setDataTime(e.timestamp),t}));return t.setInput(n),t.toArrayBuffer()}encodeClearUnreadCount(e,t){const{conversationType:n,targetId:r,channelId:s}=e;let{timestamp:o}=t;const i=Mo.getModule(Dr);return o=o||+new Date,i.setType(n),i.setChannelId(r),i.setMsgTime(o),i.setBusChannel(s),i.toArrayBuffer()}encodeExpandUltraMessage(e,t){const{targetId:n,conversationType:r,channelId:s,messageUId:o,sendTime:i,keys:a,expansion:l,removeAll:d}=e,u={mid:o,put:l,del:a,clear:d?1:0},c=Mo.getModule(Ts);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(s||""),c.setMsgUID(o),c.setMsgTime(i),c.setContent(JSON.stringify(u)),c.toArrayBuffer()}encodemodifyMessage(e,t){const{targetId:n,conversationType:r,channelId:s,messageUId:o,sendTime:i,content:a}=e,l=Mo.getModule(Ts);return l.setFromUserId(t),l.setTargetId(n),l.setType(r),l.setBusChannel(s||""),l.setMsgUID(o),l.setMsgTime(i),l.setContent(JSON.stringify(a)),l.toArrayBuffer()}encodeQueryMsgChange(e){const t=Mo.getModule(fs);return t.setSyncTime(e),t.toArrayBuffer()}encodeMsgQuery(e){const{targetId:t,conversationType:n,messages:r}=e,s=Mo.getModule(Ss),o=r.map((e=>{const{sendTime:t,messageUId:n,channelId:r}=e;return{msgTime:t,msgUID:n,busChannel:r}}));return s.setTargetId(t),s.setType(n),s.setQuery(o),s.toArrayBuffer()}encodeUnreadMentionedMsgQuery(e){const{targetId:t,channelId:n,sentTime:r,count:s}=e,o=Mo.getModule(vr);return o.setGroupId(t),o.setBusChannel(n),o.setMsgTime(r),o.setSize(s),o.toArrayBuffer()}encodeOperateStatus(e,t,n,r){const s=Mo.getModule(ys);return s.setTargetId(e),s.setType(t),s.setBusChannel(n),s.setOpType(r),s.toArrayBuffer()}encodeGetChatRoomInfo(e,t){const n=Mo.getModule(Mr);return n.setCount(e),n.setOrder(t),n.toArrayBuffer()}encodeSetUltraGroupDefaultNotificationLevel(e,t){const n=Mo.getModule(rs);return n.setUnpushLevel(e),n.setBusChannel(t),n.toArrayBuffer()}encodeGetUltraGroupDefaultNotificationLevel(e){const t=Mo.getModule(ns);return t.setBusChannel(e),t.toArrayBuffer()}encodeModifyChatRoomKV(e,t,n){const r=Mo.getModule(qr),{key:s,value:o,notificationExtra:i,isSendNotification:a,type:l,timestamp:d}=t,u=l||exports.ChatroomEntryType.UPDATE,c=ol(t,u),h={key:s,value:o||"",uid:n,version:d};if(lt(c)||(h.status=c),r.setEntry(h),a){const t={conversationType:exports.ConversationType.CHATROOM,targetId:e},n={key:s,value:o,extra:i,type:u},a=this._getUpMsgModule(t,{messageType:exports.MessageType.CHRM_KV_NOTIFY,content:n,isPersited:!1,isCounted:!1});r.setNotification(a),r.setBNotify(!0),r.setType(exports.ConversationType.CHATROOM)}return r.toArrayBuffer()}encodeModifyChatRoomKVS(e,t,n){const r=Mo.getModule(Yr),{entries:s,type:o}=t,i=o||exports.ChatroomEntryType.UPDATE,a=ol(t,i),l=[];return s.forEach((e=>{const t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};lt(a)||(t.status=a),l.push(t)})),r.setEntry(l),r.toArrayBuffer()}encodePullChatRoomKV(e){const t=Mo.getModule(Qr);return t.setTimestamp(e),t.toArrayBuffer()}encodeGetConversationStatus(e){const t=Mo.getModule(Xr);return t.setTime(e),t.toArrayBuffer()}encodeSetConversationStatus(e,t){const n=Mo.getModule(ts),r=Date.now(),s=[];return Et(e,(e=>{const t=Mo.getModule(zr),{conversationType:n,targetId:o,notificationStatus:i,isTop:a,channelId:l,notificationLevel:d}=e,u=[];t.setType(n),t.setChannelId(o),t.setTime(r),t.setBusChannel(l);const c=i===exports.NotificationStatus.OPEN,h={};lt(i)||(h[cl]=c),lt(d)||(h[cl]=d),lt(a)||(h[hl]=a),Et(h,((e,t)=>{if(!lt(e)){const n=Mo.getModule(es);e=e?dl:ul,lt(d)||Number(t)!==cl||(e=String(d)),n.setSessionStateType(Number(t)),n.setValue(e),u.push(n)}})),t.setStateItem(u),s.push(t)})),n.setVersion(t||r),n.setState(s),n.toArrayBuffer()}encodeSetConversationTypeLevel(e,t,n){const r=Mo.getModule(is);return r.setType(e),r.setVersion(t),r.setUnpushLevel(n),r.toArrayBuffer()}encodeReadReceipt(e,t){const n=Mo.getModule(ls);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()}encodeCreateTag(e,t){const n=Mo.getModule(us),r=[];return e.forEach((e=>{const t=Mo.getModule(cs);t.setTagId(e.tagId),t.setName(e.tagName),r.push(t)})),n.setTags(r),n.setVersion(t),n.toArrayBuffer()}encodeMessageReader(e,t){const n=Mo.getModule(ls);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()}encodeReadReceiptMsg(e,t,n){const r=Mo.getModule(Us),{conversationType:s,targetId:o,channelId:i=""}=e;return r.setType(s),r.setTargetId(o),r.setBusChannel(i),r.setStartMsgId(t),r.setEndMsgId(n),r.toArrayBuffer()}encodeReceiptQryReq(e,t){const n=Mo.getModule(Ps),{targetId:r,channelId:s=""}=e;return n.setTargetId(r),n.setBusChannel(s),n.setMsgId(t),n.toArrayBuffer()}encodeReceiptCntQryReq(e,t){const n=Mo.getModule(xs),{targetId:r,conversationType:s,channelId:o=""}=e;return n.setChannelId(r),n.setBusChannel(o),n.setType(s),n.setMsgId(t),n.toArrayBuffer()}encodeSessionMsgReadInput(e,t){const n=Mo.getModule(Dr),{conversationType:r,targetId:s,channelId:o=""}=e;return n.setType(r),n.setChannelId(s),n.setBusChannel(o),n.setMsgTime(t),n.toArrayBuffer()}encodeRemoveTag(e,t){const n=Mo.getModule(hs),r=[];return e.forEach((e=>{const t=Mo.getModule(cs);t.setTagId(e),r.push(t)})),n.setTags(r),n.setVersion(t),n.toArrayBuffer()}encodeDisConversationTag(e){const t=Mo.getModule(ps);return t.setTagId(e),t.toArrayBuffer()}encodeUpdateConversationTag(e,t,n){const r=Mo.getModule(ts),s=[];return t.forEach((t=>{const n=Mo.getModule(zr),r=Mo.getModule(es),o=[];e.forEach((e=>{const t=Mo.getModule(cs);t.setTagId(e.tagId),lt(e.isTop)||t.setIsTop(e.isTop),o.push(t)})),r.setSessionStateType(pl),r.setValue(JSON.stringify(o)),r.setTags(o),n.setType(t.conversationType),n.setChannelId(t.targetId),n.setTime(Date.now()),n.setStateItem([r]),s.push(n)})),r.setState(s),r.setVersion(n),r.toArrayBuffer()}encodeReportSDKInfo(e){const t=Mo.getModule(gs);return t.setSdkInfo(e),t.toArrayBuffer()}encodeUltraGroup(e,t){const n=Mo.getModule(Es);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.toArrayBuffer()}encodebindRTCRoomForChatroom(e){const t=Mo.getModule(As);return t.setRtcRoomId(e.rtcRoomId),t.toArrayBuffer()}encodeSetCallInfo(e,t){const n=Mo.getModule(Ns);return n.setKey(e),n.setDataContent(t),n.toArrayBuffer()}encodePullKVMsg(e){const t=Mo.getModule(Ms);return t.setSyncTime(e),t.toArrayBuffer()}encodeUpdateUserSubReq(e,t,n,r){const s=Mo.getModule(ws);s.setSubType(e),s.setOpType(n),s.setExpiry(r);const o=[];return t.forEach((e=>{const t=Mo.getModule(Vs);t.setSubUserId(e),o.push(t)})),s.setSubUsers(o),s.toArrayBuffer()}encodePullUserSubReq(e){const{version:t,pageToken:n}=e,r=Mo.getModule(Fs);return r.setVersion(t),r.setPageToken(n),r.toArrayBuffer()}encodePullSubDataReq(e){const{version:t,needAllData:n,pageToken:r}=e,s=Mo.getModule(ks);return s.setVersionTime(t),s.setNeedAllData(n),s.setPageToken(r),s.toArrayBuffer()}encodeQrySubDataReq(e,t){const n=Mo.getModule(Ys);n.setSubType(e);const r=[];return t.forEach((e=>{const t=Mo.getModule(Vs);t.setSubUserId(e),r.push(t)})),n.setSubUsers(r),n.toArrayBuffer()}encodePullUserProfileReq(e){const t=Mo.getModule(Ws);return t.setUserId(e),t.toArrayBuffer()}encodeUserProfileInput(){const e=Mo.getModule(Js);return e.setNothing(1),e.toArrayBuffer()}encodeUserProfilePermission(e){const t=Mo.getModule(Xs);return t.setPermission(e),t.toArrayBuffer()}encodeSearchUserProfile(e){const t=Mo.getModule(Zs);return t.setUniqueId(e),t.toArrayBuffer()}encodeUserProfile(e){const t=Mo.getModule(Ks),n=[],r=[];return Object.keys(e).forEach((t=>{if("extraProfile"===t){if(e.extraProfile){const{extraProfile:t}=e;Object.keys(t).forEach((e=>{const n=t[e],s=Mo.getModule(js);s.setKey(e),s.setValue(n.toString()||""),r.push(s)}))}return}const s=e[t],o=Mo.getModule(js);o.setKey(t),o.setValue((null==s?void 0:s.toString())||""),n.push(o)})),t.setUserProfile(n),t.setUserExtProfile(r),t.toArrayBuffer()}encodeMultiChannels(e){const t=Mo.getModule(to),n=[];return e.forEach((e=>{const t=Mo.getModule(zs);t.setTargetId(e),n.push(t)})),t.setType(exports.ConversationType.GROUP),t.setList(n),t.toArrayBuffer()}encodeQuitGroup(e,t,n=[],r=!0,s){const o=Mo.getModule(no);if(o.setTargetId(t),o.setType(exports.ConversationType.GROUP),"dismiss"!==e&&s){const e=this.encodeQuitChannelsSetting(s,r);o.setSettingInfo(e)}return"quit"!==e&&"dismiss"!==e&&o.setUsers(n),o.toArrayBuffer()}encodeQuitChannelsSetting(e,t){const n=Mo.getModule(ro);return n.setIsQuit(t),n.setIsDelBan(!!(null==e?void 0:e.removeMuteStatus)),n.setIsDelWhite(!!(null==e?void 0:e.removeWhiteList)),n.setIsDelAttention(!!(null==e?void 0:e.removeFollow)),n}encodeModifyChannelsInput(e,t,n){const r=Mo.getModule(no);return r.setTargetId(t),r.setType(exports.ConversationType.GROUP),r.setUsers(n),r.setOperateType(e),r.toArrayBuffer()}encodeChannelsQueryInput(e){const{type:t,groupId:n,option:r,ids:s}=e,o=Mo.getModule(so);if(n&&o.setTargetId(n),o.setType(exports.ConversationType.GROUP),["getGroupMembersByRole","getGroupApplications","getJoinedGroupsByRole"].includes(t)&&r){const e=this.encodePagingQuery(r);o.setPage(e)}return["getGroupMembers","getJoinedGroups"].includes(t)&&o.setIds(null!=s?s:[]),e.roleType&&o.setRoleType(e.roleType),o.toArrayBuffer()}encodePagingQuery(e){const t=Mo.getModule(oo),{count:n,order:r,pageToken:s}=e;return t.setSize(n),t.setOrder(r?0:1),t.setPageToken(s),t}encodeJoinGroup(e,t,n=[]){const r=Mo.getModule(uo);return r.setTargetId(t),r.setType(exports.ConversationType.GROUP),"invite"===e&&r.setUserIds(n),r.toArrayBuffer()}encodeMemberResponseInput(e){const{groupId:t,inviterId:n,optType:r,optResult:s,joinUserId:o,reason:i}=e,a=Mo.getModule(lo);return a.setTargetId(t),a.setType(exports.ConversationType.GROUP),a.setOptType(r),a.setOptResult(s),a.setInviterId(n),r===exports.GroupOperationRole.MANAGER&&a.setJoinUserId(o),s||a.setDetail(null!=i?i:""),a.toArrayBuffer()}encodeSetGroupRemark(e,t){const n=Mo.getModule(ao);let r=exports.GroupOperationType.ADD;return n.setTargetId(e),n.setType(exports.ConversationType.GROUP),t||(r=exports.GroupOperationType.REMOVE),n.setOperateType(r),n.setChannelNickName(t),n.toArrayBuffer()}encodeSetGroupFollows(e,t,n){const r=Mo.getModule(no);return r.setTargetId(t),r.setType(exports.ConversationType.GROUP),r.setUsers(n),r.setOperateType(e),r.toArrayBuffer()}encodeFriendInput(e){const t=Mo.getModule(co);return t.setTargetId(e.targetId),e.type&&t.setType(e.type),e.info&&t.setInfo(e.info),t.toArrayBuffer()}encodeFriendsInput(e,t){return Mo.encode(ho,{targetId:e,type:t})}encodeFriendQueryInput(e,t,n){const{count:r=200,pageToken:s="",order:o=!1}=null!=t?t:{},i=Mo.getModule(Eo);i.setQueryType(e),11===e&&i.setFriendType(n);const a=Mo.getModule(oo);return a.setSize(r),a.setOrder(o?0:1),a.setPageToken(s),i.setPage(a),i.toArrayBuffer()}encodeFriendsListInput(e,t){return Mo.encode(Io,{targetId:e,type:t})}encodeFriendLevelSet(e){return Mo.encode(To,{level:e})}encodeQuerySessionsInput(e){const t=Mo.getModule(Gr);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()}}const Il=(e,t,n,r,s,o)=>{const{type:i,version:a}=Sa(),l="browser"===rr.tag?`|${i}|${a}`:"||",d=o?`&protocolVer=${o}`:"",u=Ra();return`${e}://${t}/websocket?appId=${n}&token=${encodeURIComponent(r)}&sdkVer=${me}&pid=${s}&deviceId=${u}&apiVer=${rr.isFromUniapp?"uniapp":rr.tag+encodeURIComponent(l)}${rr.connectPlatform?`&platform=${rr.connectPlatform}`:""}${d}`};class Tl extends ln{constructor(e,t,n,r){super(e,t,n,r),this.wsListener=r,this._socket=null,this._connectedTime=0,this._socketIndex=0,this._serverSessionId="",this._localConnectedTime=0,this._idCount=0,this._generateMessageId=()=>(this._idCount>=65535&&(this._idCount=0),++this._idCount),this._messageIds={},this._syncMessageIds={},this.codec=new El(this.logger)}getConnectedTime(){return this._connectedTime}getLocalConnectedTime(){return this._localConnectedTime}getCrtServerTime(){return Date.now()-this._localConnectedTime+this._connectedTime}getDelayTime(){return this._localConnectedTime-this._connectedTime}connectWithToken(e,n,r,s){return t(this,void 0,void 0,(function*(){const{openAnti:t,type:r}=n,o=this.getCmpList(n);this.logger.debug(exports.LogTagId.L_NAVI_CMP_R,JSON.stringify(o),s);const i=o.filter(((e,t)=>o.findIndex((t=>t.addr===e.addr))===t)).sort(((e,t)=>e.weight>t.weight?-1:1));if(0===i.length)return this.logger.error(exports.LogTagId.L_NAVI_CONF_E,"no service available",s),Je(exports.ErrorCode.SERVER_UNAVAILABLE);const a=1===t?ti.V4:ti.V3;for(let t=0;t<i.length;t+=1){const{protocol:n,addr:o,weight:l}=i[t],d=Il(n===V.WS?"ws":"wss",o,this.appkey,e,"",a),u=Date.now(),{code:c,data:h}=yield this.connectWebSocket(d,a,s),p=this.cmpWeightCache.findIndex((e=>e.addr===o)),_={bid:Ft(),ptc:ue.WS,cod:c,net:this.getNetwork().type,dur:Date.now()-u,spr:0,pr:r||0,hos:o,idx:p,rct:this.retryCount?pe.RECONNECT:pe.CONNECT,cid:this.cid,v:he.CURRENT,rsn:this._doConnectReason,count:this.retryCount,weight:l,ssid:this._serverSessionId};if(this.logger.record(oe.IM_WEBSOCKET,JSON.stringify(_),s),c!==exports.ErrorCode.RC_SOCKET_DISCONNECTED&&c!==exports.ErrorCode.TIMEOUT)return c!==exports.ErrorCode.SUCCESS?Je(c):(this._localConnectedTime=Math.floor((Date.now()+u)/2),this._socket=h.socket,this.updateCmpWeight(i[t].addr,!0),this.curCmpUrl=i[t].addr,$e(h.userId))}return Je(exports.ErrorCode.SERVER_UNAVAILABLE)}))}connectWebSocket(e,n,r){return t(this,void 0,void 0,(function*(){return this.logger.info(exports.LogTagId.T,`connect start: ${e}`,r),new Promise((t=>{const s=rr.createWebSocket(e);this._socketIndex=s.id;const o=setTimeout((()=>{this.logger.info(exports.LogTagId.T,`connect timeout: ${e}`,r),t(Je(exports.ErrorCode.TIMEOUT)),s&&s.close()}),5e3);s.onOpen((()=>{clearTimeout(o),this.logger.info(exports.LogTagId.T,"socket open",r)})),s.onMessage((e=>{if(this._socketIndex!==s.id)return void this.logger.warn(exports.LogTagId.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:this._socketIndex,curSocketId:s.id}));if("[object ArrayBuffer]"!==Object.prototype.toString.call(e))return;const o=Yi(e,n);if(o){if(o instanceof Li){const e=o.status;if(e!==el.ACCEPTED)return this.logger.info(exports.LogTagId.T,`connect failed: ${e}`,r),void t(Je((e=>rl[e])(e)));this.logger.info(exports.LogTagId.T,"connect success",r);const{timestamp:n,userId:i,messageId:a,sessionId:l}=o;return this._serverSessionId=l,this._connectedTime=n,this._idCount=a,void t($e({userId:i,socket:s}))}if(o instanceof Ui){const e=o.status;return this.logger.info(exports.LogTagId.T,`recv disconnect signal -> status: ${e}`),void this.onRecvDisconnect(e,s)}this._onReceiveSignal(o)}})),s.onClose((()=>{this.logger.info(exports.LogTagId.T,"socket close",r);const e=exports.ErrorCode.RC_SOCKET_DISCONNECTED;t(Je(e)),this.onSocketEnd(s,e)})),s.onError((e=>{this.logger.info(exports.LogTagId.T,"socket error",r);const n=exports.ErrorCode.RC_SOCKET_DISCONNECTED;t(Je(n)),this.onSocketEnd(s,n)}))}))}))}_qosNeedAck(e){e.header.qos!==zo.AT_MOST_ONCE&&(e instanceof wi&&!e.syncMsg&&(this.logger.debug(exports.LogTagId.O,`send pubAck -> ${e.messageId} ${e.topic}`),this.sendOnly(new ki(e.messageId))),e instanceof qi&&(this.logger.debug(exports.LogTagId.O,`send queryCon -> ${e.messageId}`),this.sendOnly(new Hi(e.messageId))))}_publishReader(e){return t(this,void 0,void 0,(function*(){const{syncMsg:t,topic:n,messageId:r}=e;if(this.logger.debug(exports.LogTagId.O,`recv PublishReader -> messageId: ${r} ${n}`),n===di)return;if(!t||sl(n))return void this.wsListener.signal(e);const s=yield new Promise((e=>{this._syncMessageIds[r]=e}));delete this._syncMessageIds[r],this.wsListener.signal(e,s)}))}_onReceiveSignal(e){return t(this,void 0,void 0,(function*(){if(e instanceof bi&&this._pingResolve)return this._pingResolve(exports.ErrorCode.SUCCESS),void(this._pingResolve=void 0);if(this._qosNeedAck(e),e instanceof Bi||e instanceof qi){const{messageId:t}=e;this.logger.debug(exports.LogTagId.O,`recv ack -> messageId: ${t}`);const n=this._messageIds[t];n&&(n(e),delete this._messageIds[t]);const r=this._syncMessageIds[t];r&&(delete this._syncMessageIds[t],r(e))}e instanceof wi&&(yield this._publishReader(e))}))}onRecvDisconnect(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer((e=>nl[e])(e)))}onSocketEnd(e,t){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t),this._pingResolve&&(this._pingResolve(t),this._pingResolve=void 0))}clearResolves(){for(const e in this._messageIds){const t=this._messageIds[e];delete this._messageIds[e],t(exports.ErrorCode.RC_SOCKET_DISCONNECTED)}}sendPing(e){return new Promise((t=>{this._pingResolve=t,setTimeout((()=>t(exports.ErrorCode.TIMEOUT)),e),this.sendOnly(new Pi)}))}sendOnly(e){this._socket&&((e instanceof Fi||e instanceof Gi)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getArrayBuffer()))}_sendHandler(e){return t(this,void 0,void 0,(function*(){if(!this._socket)return Je(exports.ErrorCode.RC_NET_CHANNEL_INVALID);const t=this._generateMessageId();e.messageId=t,this._socket.send(e.getArrayBuffer());const n=yield new Promise((e=>{this._messageIds[t]=e,setTimeout((()=>{this._messageIds[t]&&delete this._messageIds[t],e(exports.ErrorCode.TIMEOUT)}),3e4)})),r="number"==typeof n?n:n.status;return r!==exports.ErrorCode.SUCCESS&&this.logger.warn(exports.LogTagId.O,`send rmtp fail -> messageId: ${t}, code: ${r}, topic: ${e.topic}`),"number"==typeof n?Je(n):r===exports.ErrorCode.SUCCESS?$e(n):Je(r,"",n)}))}query(e,n,r,s,o){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.debug(exports.LogTagId.O,`send query -> topic: ${Zo(e)}, targetId: ${n}`,t);const i=new Gi(e,r,n);o&&i.setHeaderQos(o);const{code:a,data:l,isOk:d,msg:u}=yield this._sendHandler(i),c=l&&s?Mo.decode(s,l.pbData):void 0;return d?(this.logger.info(exports.LogTagId.O,"send query success",t),$e(c)):(this.logger.warn(exports.LogTagId.O,`send query fail -> ${a}`,t),Je(a,u,c))}))}send(e,n,r){return t(this,void 0,void 0,(function*(){const t=yield this._sendHandler(e);if(!t.data)return t.wipe();if(t.data instanceof Bi)return t;const s=t.data,o=n&&s.pbData&&[exports.ErrorCode.SUCCESS,exports.ErrorCode.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,exports.ErrorCode.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT,exports.ErrorCode.RC_USER_PROFILE_KEY_NOT_EXIST,exports.ErrorCode.RC_USER_PROFILE_EXT_KEY_NOT_EXIST,exports.ErrorCode.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS,exports.ErrorCode.RC_USER_PROFILE_VALUE_EXCEED_RANGE,exports.ErrorCode.RC_GROUP_PARAMETER_FORMAT_ERROR].indexOf(s.status)>=0?this.codec.decodeByPBName(s.pbData,n,r):s;return 0!==s.status?(this.logger.warn(exports.LogTagId.O,`send failed -> messageId: ${s.messageId}, respPBName: ${n}, status: ${s.status}`),Je(s.status,void 0,n&&s.pbData?o:null)):$e(o)}))}close(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()}}class fl{}class Cl extends on{constructor(e,t,n){super(t,e,n),this._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};const r=Sa();this.deviceId=Ra(),this.model=`Web|${r.type}|${r.version}`,this.init()}httpRequest(e,n,r,s){return t(this,void 0,void 0,(function*(){const t=s;t.deviceId=this.deviceId,t.model=this.model;const o={url:e,method:n,headers:r,body:JSON.stringify(t)};this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify(o));const{status:i,data:a=""}=yield rr.httpReq(o);this.logger.info(exports.LogTagId.L_REQUEST_R,JSON.stringify({status:i,data:a}));try{const e=JSON.parse(a),t=e.data;return{code:parseInt(e.code,10),data:t}}catch(e){return this.logger.warn(exports.LogTagId.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:i,data:a,error:e})),{code:i,msg:e}}}))}setCloudControllerCache(e){const t=Ve(this.appkey);rr.localStorage.setItem(t,JSON.stringify(e)),this.logger.info(exports.LogTagId.L_CLOUD_SET_CACHE_O,JSON.stringify(e))}getLocalCloudControllerCache(){const e=Ve(this.appkey),t=rr.localStorage.getItem(e);return this.logger.info(exports.LogTagId.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:e,data:t})),t}setMRTRConfig(e){this.logger.info(exports.LogTagId.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e}getMRTRConfig(){return this._mrtr}}let Rl=null;const Sl="RC_LOGS",ml="RC_STATISTICS",yl="RC_CONF",vl={[Sl]:["level","time"],[yl]:["key"],[ml]:["level","time"]},Al=(e,t,n)=>new Promise((r=>{const s=e.transaction(t,"readwrite").objectStore(t).index("time"),o=IDBKeyRange.upperBound(Date.now()-n),i=s.openCursor(o);i.onsuccess=e=>{const t=e.target.result;t?(t.delete(),t.continue()):r()},i.onerror=()=>{r()}}));let Nl=null;const Ol=e=>t(void 0,void 0,void 0,(function*(){const t=yield Rl;if(!t)return;const{db:n}=t;yield Al(n,Sl,e),yield Al(n,ml,e),Nl=setTimeout((()=>Ol(e)),6e5)})),Ml=(e,t,n=168)=>{Rl||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Sa().type?Rl=new Promise((r=>{const s=window.indexedDB;(e=>{const t=window.indexedDB;t.databases&&t.databases().then((n=>{n.forEach((n=>{n.name&&e.includes(n.name)&&t.deleteDatabase(n.name)}))}))})(["RC_ENGINE_DB",`RC_STATISTIC_${e}`]);const o=`RC_LOGS_${e}`,i=s.open(o,2);i.onerror=e=>{t.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,e.target.error),r(null)},i.onsuccess=s=>{const o=s.target.result;o?(o.onclose=e=>{Rl=null,t.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=e=>{Rl=null,t.error(exports.LogTagId.L_LOGDB_ERROR_E,e.target.error)},o.onabort=e=>{t.info(exports.LogTagId.L_LOGDB_ABORT_S,e.target.error)},Ol(3600*Math.max(24,Math.min(168,n))*1e3),r({appkey:e,db:o})):r(null)},i.onupgradeneeded=e=>{const t=e.target.result;Object.keys(vl).forEach((e=>{t.objectStoreNames.contains(e)&&t.deleteObjectStore(e);const n=e===yl?{keyPath:"key"}:{autoIncrement:!0},r=t.createObjectStore(e,n);vl[e].forEach((e=>r.createIndex(e,e,{unique:!1})))}))}})):t.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},Ll=[],Ul=(e,t,n)=>new Promise((r=>{const s=e.transaction(t,"readwrite");s.oncomplete=r,s.onabort=r;const o=s.objectStore(t);n.forEach((e=>{try{o.add(e)}catch(t){null===console||void 0===console||console.error("write failed ->",e,t)}}))})),Pl=[];let bl=!1;const xl=e=>t(void 0,void 0,void 0,(function*(){if(bl||0===Pl.length)return;bl=!0;const t=Pl.filter((e=>e.level<exports.LogL.FATAL)),n=Pl.filter((e=>e.level>=exports.LogL.FATAL));Pl.length=0,yield Ul(e,Sl,n),yield Ul(e,ml,t),bl=!1,0===Pl.length&&Ll.length>0&&(Ll.forEach((e=>e.close())),Ll.length=0),setTimeout((()=>xl(e)))}));function Dl(e){return t(this,void 0,void 0,(function*(){const t=yield Rl;return t?new Promise((n=>{const{db:r}=t,s=r.transaction(yl,"readonly").objectStore(yl).get(e);s.onsuccess=e=>{var t;n({value:null===(t=s.result)||void 0===t?void 0:t.value,success:!0})},s.onerror=e=>{n({success:!1})}})):{success:!1}}))}let wl=Ye;const Vl=()=>({setTimestamp4RealtimeLog(e){wl=e},getTimestamp4RealtimeLog:()=>wl,getLogs(e,n,r,s,o=Sl){return t(this,void 0,void 0,(function*(){const t=yield Rl;return t?new Promise((i=>{const{db:a}=t,l=a.transaction(o,"readonly").objectStore(o),d=[],u=IDBKeyRange.bound(e,n),c=l.index("time").openCursor(u);c.onsuccess=e=>{const t=e.target.result;if(t){const e=t.value;e.level<=r&&(s?e.sessionId===qe:e.level>=0)&&d.push(e),t.continue()}else i({dbReady:!0,logs:d})},c.onerror=e=>{i({dbReady:!1,logs:[]})}})):{dbReady:!1,logs:[]}}))}}),Gl="REPORT_SESSION",Fl=(e,n)=>t(void 0,void 0,void 0,(function*(){const r=`${Gl}_${e}`,{success:s,value:o}=yield Dl(`${Gl}_${e}`);s&&n!==(null==o?void 0:o.sessionId)&&function(e,n){t(this,void 0,void 0,(function*(){const t=yield Rl;if(!t)return!1;const{db:r}=t;return r.transaction(yl,"readwrite").objectStore(yl).put({key:e,value:n}),!0}))}(r,{sessionId:n})}));class Bl extends Xt{_handleWrite(e){(e=>{t(void 0,void 0,void 0,(function*(){const t=yield Rl;if(t){if(e.content&&et(e.content))try{e.content=JSON.parse(e.content)}catch(e){}Pl.push(e),xl(t.db)}}))})(e)}}const kl=144e5;if("undefined"!=typeof window){const e=(e,t)=>{const n=t.map((({sessionId:e,time:t,type:n,level:r,tag:s,traceId:o,loggerId:i,content:a})=>`${e},${t},${n},${r},${s},${o},${i},"${a}"\n`)),r=new Blob(n,{type:"text/csv"}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=`${e}.csv`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s)};window.__rongcloud_devtools__={logger:{get(n,r=Date.now()-kl,s=Date.now()){return t(this,void 0,void 0,(function*(){r=r<0?Date.now()+r:r,(s=s<=0?Date.now():s)-r>kl&&(r=s-kl);const t=new Bl(n,"RC-IM","IM");t.debug(exports.LogTagId.T,`get logs: startTime ${r} endTime ${s}`),Ml(n,t);const o=Vl(),{logs:i}=yield o.getLogs(r,s,exports.LogL.DEBUG,!1);t.debug(exports.LogTagId.T,`get logs ${i.length}`),e(`${n}-${r}-${s}`,i)}))}}}}const Hl=48,ql=64,Yl=80,Kl=96,jl="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ql=e=>{const t={};for(let n=0;n<e.length-1;n++){const r=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(r)?t[r].push(n):t[r]=[n]}const n=[];let r=[];const s=function(){if(r.length>0){const e=r.join("");if(r=[],e.length>26){const t=$l(e.length),r=String.fromCharCode(Yl|t.length);n.push(r+t)}else{const t=String.fromCharCode(Kl|e.length);n.push(t)}n.push(e)}};let o=0;for(;o<e.length;){const i=Wl(t,e,o);if(i.length<2){r.push(e.charAt(o++));continue}if(i.length<4){r.push(e.substr(o,i.length)),o+=i.length;continue}const a=$l(o-i.offset),l=$l(i.length);if(a.length+l.length>=i.length){r.push(e.substr(o,i.length)),o+=i.length;continue}s();const d=String.fromCharCode(ql|a.length<<2|l.length);n.push(d+a+l),o+=i.length}s();const i=$l(e.length),a=String.fromCharCode(Hl|i.length);return n.push(a+i),n.join("")},Wl=(e,t,n)=>{const r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;const s=e[t.charAt(n)+t.charAt(n+1)];if(s[0]===n)return r;const o=t.length-n;for(let e=0,i=s.length;e<i;e++){const i=s[e],a=n-i;if(a>238327)continue;const l=Math.min(o,a);if(l<=r.length)break;if(r.length>2&&t.charAt(i+r.length-1)!==t.charAt(n+r.length-1))continue;let d=2;for(let e=d;e<l&&t.charAt(i+e)===t.charAt(n+e);e++)d++;d>=r.length&&(r.length=d,r.offset=i)}return r},$l=e=>{const t=[];let n=0;do{n=e%62,t.push(jl.charAt(n)),e=(e-n)/62}while(e>0);return t.join("")};class Jl extends Zt{constructor(e,t,n){const r=Ra(),s=Sa();super(e,r,`${s.type}|${s.version}|${t.getSessionId()}`,Vl(),t),this.tableName=n}send(e){return rr.httpReq(e)}checkStart(e){const n=Object.create(null,{checkStart:{get:()=>super.checkStart}});return t(this,void 0,void 0,(function*(){return yield Fl(e.userId,this.logger.getSessionId()),n.checkStart.call(this,e,this.tableName)}))}compressLogs(e){return t(this,void 0,void 0,(function*(){return{success:!0,data:Ql(e.map(zt).join(""))}}))}realtimeReport(e,n,r){const s=Object.create(null,{realtimeReport:{get:()=>super.realtimeReport}});return t(this,void 0,void 0,(function*(){return s.realtimeReport.call(this,e,n,r,this.tableName)}))}}class Xl extends Jl{constructor(e,t){super(e,t,Sl)}isReporter(){return t(this,void 0,void 0,(function*(){var e,n;return yield(e=this.userId,n=this.logger.getSessionId(),t(void 0,void 0,void 0,(function*(){const{success:t,value:r}=yield Dl(`${Gl}_${e}`);return t&&(null==r?void 0:r.sessionId)===n})))}))}report(e,n,r,s,o,i,a=!1){const l=Object.create(null,{report:{get:()=>super.report}});return t(this,void 0,void 0,(function*(){const t=yield this.isReporter();if(!this.userId||t)return l.report.call(this,e,n,r,s,o,i,a)}))}}class Zl extends Jl{constructor(e,t){super(e,t,ml)}}var zl,ed;const td={[exports.ConversationType.PRIVATE]:Jo.qryPMsg,[exports.ConversationType.GROUP]:Jo.qryGMsg,[exports.ConversationType.CHATROOM]:Jo.qryCHMsg,[exports.ConversationType.CUSTOMER_SERVICE]:Jo.qryCMsg,[exports.ConversationType.SYSTEM]:Jo.qrySMsg,[exports.ConversationType.APP_PUBLIC_SERVICE]:Jo.qryMCMsg,[exports.ConversationType.PUBLIC_SERVICE]:Jo.qryMPMsg},nd={[exports.ConversationType.PRIVATE]:Jo.cleanPMsg,[exports.ConversationType.GROUP]:Jo.cleanGMsg,[exports.ConversationType.ULTRA_GROUP]:Jo.cleanGMsg,[exports.ConversationType.CUSTOMER_SERVICE]:Jo.cleanCMsg,[exports.ConversationType.SYSTEM]:Jo.cleanSMsg,[exports.ConversationType.APP_PUBLIC_SERVICE]:Jo.cleanMCMsg,[exports.ConversationType.PUBLIC_SERVICE]:Jo.cleanMPMsg},rd=(e,t,n,r,s,o,i)=>({conversationType:e,targetId:t,senderUserId:o,messageDirection:exports.MessageDirection.SEND,isCounted:!!n.isCounted,isMentioned:!!n.isMentioned,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:!!n.isPersited,messageUId:r,sentTime:s,receivedTime:0,disableNotification:!!n.disableNotification,isStatusMessage:!!n.isStatusMessage,canIncludeExpansion:!!n.canIncludeExpansion,expansion:n.canIncludeExpansion?n.expansion:null,receivedStatus:exports.ReceivedStatus.UNREAD,receivedStatusInfo:St(exports.ReceivedStatus.UNREAD),pushConfig:n.pushConfig,channelId:n.channelId,isInterrupt:n.isInterrupt,messageId:i||0,sentStatus:exports.SentStatus.SENT,directedUserIds:n.directionalUserIdList,disableUpdateLastMessage:n.disableUpdateLastMessage}),sd=e=>(e.sort(((e,t)=>{var n,r;const s=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-s})),e),od=[A.GROUP_OPERATION,A.GROUP_PROFILE_CHANGE,A.GROUP_APPLICATION_INVITATION,A.GROUP_FOLLOW_USER_CHANGE],id=[h.FRIEND_APPLICATION],ad=["RC:TypSts","RC:InterceptMsg","RC:RL"];function ld(){return(e,n,r)=>{const s=r.value;return r.value=function(...e){return t(this,void 0,void 0,(function*(){return this._isConnected?s.apply(this,e):Promise.resolve({code:exports.ErrorCode.RC_NET_UNAVAILABLE})}))},r}}function dd(){return(e,n,r)=>{const s=r.value;return r.value=function(...e){return t(this,void 0,void 0,(function*(){return this._isConnected?s.apply(this,e):Promise.resolve(Je(exports.ErrorCode.RC_NET_UNAVAILABLE))}))},r}}function ud(e){return e?e.map((e=>{var t;return{userId:e.userId,name:e.name,portraitUri:e.portraitUrl,remark:null!==(t=e.remarkName)&&void 0!==t?t:"",directionType:e.friendType,extProfile:e.extProfile,addTime:gt(e.relationTime),inBlackList:!!e.flag}})):[]}function cd(e){return e&&e.list?e.list.map((e=>({userId:e.userId,name:e.name||"",portraitUri:e.portraitUrl||"",applicationType:e.type,applicationStatus:e.status,operationTime:gt(e.operateTime),extra:e.info||"",friendType:e.friendType}))):[]}class hd extends ji{constructor(e,t,n){super(e,t,n,new Bl(n.appkey,"IMLib","IM")),zl.add(this),this._customMessageType={},this._reconnectTimer=-1,this._pullOfflineFinished=!1,this.currentUserId="",this._openCallPlus=!1,this.cloudControllerUri="",this._pullingMsg=!1,this._pullQueue=[],this._chrmsQueue={},this._latestSyncTimestamp=0,this._intervalTimer=-1,this._latestPullKVMsgTimestamp=0,this._intervalTimerForChrmPull=-1,this._handleInnerMsgOptions=(e,t,n)=>{var r;const{messageType:s}=n;if(s===exports.MessageType.SYNC_READ_STATUS&&(e=>[exports.ConversationType.GROUP,exports.ConversationType.DISCUSSION,exports.ConversationType.ULTRA_GROUP,exports.ConversationType.PUBLIC_SERVICE,exports.ConversationType.APP_PUBLIC_SERVICE].includes(e))(e)&&Object.assign(n,{directionalUserIdList:[this.currentUserId]}),s===exports.MessageType.READ_RECEIPT_RESPONSE){if(!n.content.receiptMessageDic||0===Object.keys(n.content.receiptMessageDic).length){const s=null===(r=this._readReceiptManager)||void 0===r?void 0:r.getReceiptMessageDic({conversationType:e,targetId:t,channelId:n.channelId});n.content.receiptMessageDic=s||{}}n.directionalUserIdList=[];for(const e in n.content.receiptMessageDic)n.directionalUserIdList.push(e)}return n},this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._ultraGroupTimer=-1,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={},this._ultraMsgMap={},this._pullUltraChangeMessageQue=[],this._isPullingUltraChangeMessage=!1,this._lastPullingUltraChangeMessageTime=0;const{appkey:r,logOutputLevel:s,logExpireTime:o,navigators:i,areaCode:a,logServerUrl:l,miniCMPProxy:d,environment:u}=n;this._environment=u||"default",this.logger.setOutputLevel(s),Wt.init({areaCode:a,navigators:i,logServerUrl:l,miniCMPProxy:d}),Ml(r,this.logger,o),this.reporter=new Xl(r,this.logger),this.navi=new Ya(r,this.logger,new Xa(r,this.logger),this._environment),this.reporterStatistic=new Zl(r,this.logger),this._letterbox=new Ka(r),this._sendMessageStore=new ja(r),this._chrmEntryHandler=new Fa(this),this._connMgr=new Tl(r,this.navi,this.logger,{signal:this._signalHandler.bind(this),onConnected:this.onConnected.bind(this),onDisconnected:this.onDisconnected.bind(this),onConnecting:this._watcher.onConnecting,onSuspend:this.onSuspend.bind(this)}),"browser"===rr.tag&&this._initCloudController(),this._chatroom=new fl}get chatroom(){return this._chatroom}_initCloudController(){const e=Wt.getCloudControllerUrl();[this.cloudControllerUri]=e,this.cloudController=new Cl(this._appkey,this.logger,this.reporter),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,en.init)}onConnected(){var e;const t=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),n=this._connMgr.getCurrentUserId();this.currentUserId=n,this._pullOfflineFinished=!1,this._EventChangeManager||(this._EventChangeManager=new za(this._connMgr,this.currentUserId,this.logger,this._appkey,this._handleEventChangeList.bind(this))),this._joinedChrmManager||(this._joinedChrmManager=new Ba(t.joinMChrm)),this._conversationManager||(this._conversationManager=new Pa(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag,ma(t))),this._ultraGroupManager||(this._ultraGroupManager=new wa(this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new ka(this,this._appkey,this.currentUserId,this._watcher.tag)),this._readReceiptManager||(this._readReceiptManager=new Ja(this._appkey,this.currentUserId,this._connMgr.getDelayTime())),this._initSubscribeManager(t),this._conversationManager.startPullConversationStatus(0),this._conversationManager.adaptOldStore(),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._rejoinChrm(),this._startSyncInterval(),this._openCallPlus&&this._syncCallPullKVMsg(),1===t.ugMsg&&this._notificationOnline(),1&~(t.eventDriven||0)||null===(e=this._EventChangeManager)||void 0===e||e.notificationOnline(),this._watcher.onConnected(),this.reporter.checkStart(t),this.reporterStatistic.checkStart(t)}onDisconnected(e){var t,n,r;this._resetMemoryState(),null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),null===(r=this._EventChangeManager)||void 0===r||r.stopAllTask(),this._watcher.onDisconnected(e)}onSuspend(e){var t,n,r;null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),null===(r=this._EventChangeManager)||void 0===r||r.stopAllTask(),this._watcher.onSuspend(e)}_initSubscribeManager(e){(e.subDriven||e.userProfile)&&(this._subscribeManager||(this._subscribeManager=new $a(this._connMgr,{syncSubscribeUserStatusFinished:e=>{var t,n;null===(n=(t=this._watcher).syncSubscribedUserStatusFinished)||void 0===n||n.call(t,e)},subscribeUserStatusChanged:e=>{var t,n;null===(n=(t=this._watcher).subscribedUserStatusChange)||void 0===n||n.call(t,e)},subscribeRelationChanged:e=>{var t,n;null===(n=(t=this._watcher).subscribedRelationChange)||void 0===n||n.call(t,e)},ownUserProfileChanged:e=>{var t,n;null===(n=(t=this._watcher).ownUserProfileChanged)||void 0===n||n.call(t,e)}},this.currentUserId,this._connMgr.getDelayTime(),this.logger,!!e.userProfile,e.subDriven||0)),this._subscribeManager.syncData())}createLogger(e,t){return new Bl(this._appkey,e,t)}refetchNaviInfo(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())}getNaviInfoFromCache(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())}getConnectedTime(){return this._connMgr.getConnectedTime()}getConnectionStatus(){return this._connMgr.getConnectionStatus()}connect(e,n,r,s){return t(this,void 0,void 0,(function*(){return this._openCallPlus=r,this._connMgr.connect(e,n,r,s)}))}_signalHandler(e,t){var n;const{syncMsg:r,topic:s}=e;if(r)return void this._receiveSyncMsg(e,t);const o=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_RECV_RMTP_O,s,o);const i=Xo(s);if(i)switch(i){case Jo.s_ntf:this._pullMsg(e);break;case Jo.s_msg:this._receiveMsg(e);break;case Jo.s_cmd:this._receiveStateNotify(e);break;case Jo.s_us:this._receiveSettingNotify(e);break;case Jo.rtc_ntf:this._receiveRtcKv(e.pbData);break;case Jo.s_opNtf:this._pullOperateStatusNotify(e);break;case Jo.s_pubCall:this._pubCallInfo(e);break;case Jo.s_stat:null===(n=this._subscribeManager)||void 0===n||n.updateUserStatus(e)}else this.logger.error(exports.LogTagId.L_RECV_RMTP_E,s,o)}_receiveStateNotify(e){var t,n,r;const{time:s,type:o,chrmId:i}=this._connMgr.codec.decodeByPBName(e.pbData,dr);switch(o){case 2:if(!this._chrmsQueue[i])return;this._chrmEntryHandler.pullEntry(i,s);break;case 3:this._conversationManager.startPullConversationStatus(s);break;case 4:this._chrmEntryHandler.reset(i),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(s),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(s),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime);break;case 8:null===(t=this._subscribeManager)||void 0===t||t.startsyncSubscribeUserStatus(s);break;case 9:null===(n=this._subscribeManager)||void 0===n||n.startSyncSubscribeRelationship(s);break;case 10:null===(r=this._subscribeManager)||void 0===r||r.syncOwnProfile(!0);break;case 11:this._EventChangeManager.startPullEventChange(s)}}_receiveSettingNotify(e){const{version:t}=this._connMgr.codec.decodeByPBName(e.pbData,_s);this._userSettingManager.pullUserSettings(t)}_receiveMessageExpansion(e){const{content:t,channelId:n="",conversationType:r,targetId:s}=e,{put:o,del:i,mid:a}=t;o&&this._watcher.expansion({updatedExpansion:{messageUId:a,expansion:o,channelId:n,conversationType:r,targetId:s}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:a,deletedKeys:i,channelId:n,conversationType:r,targetId:s}})}_clearUltraGroupUnreadCount(e,t){const{targetId:n,channelId:r,timestamp:s}=this._connMgr.codec.decodeByPBName(e.pbData,Dr),o=this._ultraGroupMap[`${r}_${n}`];o&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.unreadMentionedMeCount=0,o.firstUnreadMessage&&(o.firstUnreadMessage=null),o.lastReadTime=s,this._watcher.conversation(Rt([o]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)}_receiveSyncMsg(e,t){const n=Xo(e.topic),r={[Jo.ugMsg]:()=>{this._ultraGroupTimeQue.push(t.timestamp),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp)},[Jo.updRTime]:()=>{this._receivesyncReadStatus(e)},[Jo.updUgRTime]:()=>{this._clearUltraGroupUnreadCount(e,t)},[Jo.updUserSub]:()=>{var e;null===(e=this._subscribeManager)||void 0===e||e.startSyncSubscribeRelationship(t.timestamp)}};if(r[n])return void r[n]();if(![Jo.recallMsg,Jo.ppMsgS,Jo.pgMsgS,Jo.ppMsgP,Jo.pgMsgP,Jo.chatMsg,Jo.pcMsgP,Jo.prMsgS,Jo.pbMsgP].includes(n))return;let s=this._connMgr.codec.decodeByPBName(e.pbData,cr,{currentUserId:this.currentUserId,signal:e});s=this._handleMsgProperties(s),(s.conversationType!==exports.ConversationType.CHATROOM||this._chrmsQueue[s.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||s.sentTime):(t&&(s.sentTime=t.timestamp,s.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(exports.LogTagId.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:s.messageUId,messgeId:s.messageId,sentTime:s.sentTime})),s.messageType!==exports.MessageType.EXPANSION_NOTIFY?((s.messageType===exports.MessageType.SYNC_READ_STATUS||s.messageType===exports.MessageType.READ_RECEIPT&&s.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(s.conversationType,s.targetId,s.channelId,s.sentTime),s.messageType===exports.MessageType.READ_RECEIPT_REQUEST&&this._processRRReqMsg(s),s.messageType===exports.MessageType.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(s),this._conversationManager.setConversationCacheByMessage(s,!0),this._batchMessage([s])):this._receiveMessageExpansion(s)))}_batchMessage(e){const t=[],n=[],r=[];for(let s=e.length-1;s>=0;s-=1){const o=e[s];o.messageType===exports.MessageType.LOG_COMMAND&&o.senderUserId===ye?n.unshift(o):o.messageType===exports.MessageType.CLOUD_CONTROL&&o.senderUserId===ye?r.push(o):t.unshift(o)}this._watcher.batchMessage(t),n.forEach((e=>{const{startTime:t,endTime:n,platform:r,logId:s,uri:o}=e.content;this.reporter.report(parseInt(t,10),parseInt(n,10),r,o,s,e.messageUId)})),r.length>0&&this._ccMsgHandler(r)}_ccMsgHandler(e){var n;return t(this,void 0,void 0,(function*(){if(e.shift()){const t=this._connMgr.getToken(),r=(yield null===(n=this.cloudController)||void 0===n?void 0:n.request(this.cloudControllerUri,en.other,t))||0,s=e.filter((e=>e.sentTime>r));s.length>0&&this._ccMsgHandler(s)}}))}_pubCallInfo(e){const{key:t,dataContent:n,maxTime:r}=this._connMgr.codec.decodeByPBName(e.pbData,Os);this._latestPullKVMsgTimestamp=r,this._watcher.callInfo(JSON.stringify({list:[{key:t,value:n}]}))}_pullMsg(e){const{type:t,chrmId:n,time:r}=this._connMgr.codec.decodeByPBName(e.pbData,dr);if(this.logger.info(exports.LogTagId.L_RECV_S_NTF_O,`type: ${t}, chrmId: ${t}, time: ${r}`),2===t){const e=this._chrmsQueue[n];if(!e)return;e.queue.push(r),this._pullChrmMsg(n)}else this._pullQueue.push(r),this._syncMsg()}_receivesyncReadStatus(e){const t=this._connMgr.codec.decodeByPBName(e.pbData,Dr),{conversationType:n,targetId:r,channelId:s,timestamp:o,sentTime:i}=t;this._conversationManager.clearUnreadCount(n,r,s,i),this._watcher.syncReadStatus({conversationType:n,targetId:r,channelId:s,timestamp:o})}_startSyncInterval(){this._stopSyncInterval();this._intervalTimer=setInterval((()=>{Date.now()-this._latestSyncTimestamp>=18e4&&this._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()}_stopSyncInterval(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)}_syncCallPullKVMsg(){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new Gi(Jo.pullKvMsg,e,this.currentUserId),{code:n,data:r}=yield this._connMgr.send(t,Ls);n===exports.ErrorCode.SUCCESS&&r&&(this._latestPullKVMsgTimestamp=r.maxTime,this._watcher.callInfo(JSON.stringify({list:r.info})))}))}get _isConnected(){return this._connMgr.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED}_filterMessage(e){const{messageType:t}=e;return t===exports.MessageType.DELIVERED||t===exports.MessageType.DELIVERED_MSG||t===exports.MessageType.SYNC_READ_STATUS&&!this._processSRSMsg(e)}_messageProcessor(e){let t=0;const n=[],r=[],s=[],o=[],i=[];return e.forEach((e=>{const{conversationType:a,targetId:l,channelId:d,messageDirection:u,messageUId:c,messageType:h,sentTime:p,senderUserId:_,content:g}=e;if(n.push(c),u===exports.MessageDirection.SEND){t=Math.max(p,t);const e=this._sendMessageStore.getSendMessageMap(),n=h===exports.MessageType.RECALL?`Cmd:${g.messageUId}`:c;if(e[n])return void this._sendMessageStore.removeByUID(n)}if(this._filterMessage(e))return;if(h===exports.MessageType.EXPANSION_NOTIFY)return void s.push(e);if(p>=this._connMgr.getConnectedTime()&&this._writeMessagesLog(a,c)&&i.push(c),h===exports.MessageType.READ_RECEIPT&&_===this.currentUserId&&this._conversationManager.clearUnreadCount(a,l,d,p),h===exports.MessageType.READ_STATE)return void o.push(e);h===exports.MessageType.READ_RECEIPT_REQUEST&&this._processRRReqMsg(e),h===exports.MessageType.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(e);const E=this._handleMsgProperties(e);this._conversationManager.setConversationCacheByMessage(E,!0),r.push(E)})),{newOutboxTime:t,messageUIds:n,messages:r,messageExpansionList:s,RSMsgList:o,msgUIds2Statistic:i}}_processSRSMsg(e){const{conversationType:t,targetId:n,channelId:r,content:s,senderUserId:o,sentTime:i}=e;if(o!==this.currentUserId)return!1;const a=this.getNaviInfoFromCache();return this._conversationManager.clearUnreadCount(t,n,r,i),1!==a.sesDriven||(i>this.getConnectedTime()||this._watcher.syncReadStatus({conversationType:t,targetId:n,channelId:r,timestamp:s.lastMessageSendTime}),!1)}_processRSMsg(e){const{conversationType:t,targetId:n,channelId:r,content:s}=e,o={conversationType:t,targetId:n,channelId:r};this._watcher.messageReadReceipt(t===exports.ConversationType.PRIVATE?{privateReadReceipt:Object.assign(Object.assign({},o),{endMsgTime:s.endMsgTime})}:{groupReadReceipt:Object.assign(Object.assign({},o),{totalCount:s.tmn,readedCount:s.rrn,messageUId:s.msgId})})}_processRRReqMsg(e){var t;const{conversationType:n,channelId:r,targetId:s,content:o,sentTime:i,messageDirection:a,senderUserId:l}=e;null===(t=this._readReceiptManager)||void 0===t||t.insert({conversationType:n,channelId:r,targetId:s},o.messageUId,a,i,l)}_processRRRspMsg(e){var t;const{conversationType:n,channelId:r,targetId:s,content:o,senderUserId:i}=e,{receiptMessageDic:a={}}=o;if(i===this.currentUserId)for(const e in a){const o=a[e];for(const e of o)null===(t=this._readReceiptManager)||void 0===t||t.remove({conversationType:n,channelId:r,targetId:s},e)}else{(a[this.currentUserId]||[]).forEach((e=>{var t;null===(t=this._readReceiptManager)||void 0===t||t.addReadedUser({conversationType:n,channelId:r,targetId:s},e,i)}))}}_syncMsg(){return t(this,void 0,void 0,(function*(){if(this._pullingMsg)return;if(!this._isConnected)return void(this._pullingMsg=!1);this._pullingMsg=!0;const e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),r=Mo.encode(ur,{ispolling:!1,isPullSend:!0,sendBoxSyncTime:e,syncTime:t,broadcastSyncTime:n}),s=new Gi(Jo[Jo.pullMsg],r,this.currentUserId),o=this.logger.createTraceId();this.logger.info(exports.LogTagId.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o);const{code:i,data:a}=yield this._connMgr.send(s,pr,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId,customMessageTypes:this._customMessageType});if(this._latestSyncTimestamp=Date.now(),this._pullingMsg=!1,i!==exports.ErrorCode.SUCCESS||!a||lt(a.finished)||lt(a.list)||lt(a.syncTime))return void this.logger.warn(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:i,timestamp:this._latestSyncTimestamp}),o);const{list:l,finished:d,syncTime:u,broadcastSyncTime:c=1}=a;this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({syncTime:u,finished:d,messages:l.map((e=>({messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime})))}),o);try{let{newOutboxTime:e,messageUIds:t,messages:n,messageExpansionList:r,RSMsgList:s,msgUIds2Statistic:a}=this._messageProcessor(l);a.length>0&&this.logger.record(oe.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:a.join(",")})),this._batchMessage(n),r.forEach((e=>{this._receiveMessageExpansion(e)})),s.forEach((e=>{this._processRSMsg(e)})),this._letterbox.setInboxTime(u,this.currentUserId),this._letterbox.setOutboxTime(e,this.currentUserId),this._letterbox.setBroadcastSyncTime(c,this.currentUserId),this._sendMessageStore.removeByTimestamp(e);const h=this._pullQueue.filter((e=>e>u));if(this._pullQueue.length=0,this._pullQueue.push(...h),d&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:i,messageUIds:t.join(","),timestamp:this._latestSyncTimestamp,hasmore:!d,tmpPullQueue:h}),o),!d)return void this._syncMsg();this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg())}catch(e){this.logger.error(exports.LogTagId.L_PULL_MSG_E,null==e?void 0:e.stack,o)}}))}_receiveMsg(e){if(!this._isConnected)return;let t=this._connMgr.codec.decodeByPBName(e.pbData,_r,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});t=this._handleMsgProperties(t);const{conversationType:n,messageType:r,senderUserId:s,messageUId:o,sentTime:i,isStatusMessage:a}=t;if(this.logger.info(exports.LogTagId.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),this._writeMessagesLog(n,o)&&this.logger.record(oe.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:o})),n!==exports.ConversationType.RTC_ROOM&&r!==exports.MessageType.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}s===this.currentUserId&&this._sendMessageStore.setMessage(o,i),a||s===this.currentUserId||this._letterbox.setInboxTime(i,this.currentUserId),this._handleNotNotifyMsg(t)||(r===exports.MessageType.READ_RECEIPT_REQUEST&&this._processRRReqMsg(t),r===exports.MessageType.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(t),this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t]))}_handleNotNotifyMsg(e){const{messageType:t,senderUserId:n}=e;return t===exports.MessageType.DELIVERED||(t===exports.MessageType.DELIVERED_MSG||(t===exports.MessageType.EXPANSION_NOTIFY?(this._receiveMessageExpansion(e),!0):t===exports.MessageType.SYNC_READ_STATUS&&n!==this.currentUserId||t===exports.MessageType.READ_STATE&&(this._processRSMsg(e),!0)))}_handleMsgProperties(e,t=!1){const{messageType:n,isStatusMessage:r,isCounted:s=!1,isPersited:o=!1}=e;let i;const a=n in Se,l=n in this._customMessageType;if(i=a?Object.assign(Object.assign({},Se[n]),{isStatusMessage:ad.includes(n)}):l?this._customMessageType[n]:{isCounted:s,isPersited:o,isStatusMessage:!1},Object.assign(e,i),t&&!lt(r)&&(e.isStatusMessage=r),!t){const t=e.content.user;if(t){const{portrait:e,portraitUri:n}=t,r=e||n;r&&(t.portrait=t.portraitUri=r)}}return e}_fixDownstreamData(e,t,n){return e&&2===t.list.length&&(t.hasMore=!0,0===n?t.list.shift():t.list.pop()),t}getHistoryMessage(e,n,r,s,o,i="",a="",l){var d;return t(this,void 0,void 0,(function*(){const{currentUserId:t,_connMgr:a}=this,u=td[e]||Jo.qryPMsg,c=1===s&&0===r;if(a){const h=a.codec.encodeGetHistoryMsg(n,{timestamp:r,count:c?2:s,order:o,channelId:i});this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:n,conversationType:e,channelId:i,timestamp:r,count:s,order:o}),l);const p=yield a.send(new Gi(u,h,t),Pr,{currentUserId:t,connectedTime:a.getConnectedTime(),conversation:{targetId:n},afterDecode:t=>{var r;const s=null===(r=this._readReceiptManager)||void 0===r?void 0:r.getReadReceiptInfo({conversationType:e,channelId:i,targetId:n},t.messageUId);if(s){const{users:e}=s;t.readReceiptInfo={isReceiptRequestMessage:!0,readerList:e}}return t}}),{code:_,data:g}=p;if(_!==exports.ErrorCode.SUCCESS||!g)return this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:""}),l),{code:_};const E=this._fixDownstreamData(c,g,o),I=[];return null===(d=E.list)||void 0===d||d.forEach((e=>{e&&I.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:I.join(",")}),l),{code:_,data:{list:E.list,hasMore:E.hasMore}}}return{code:exports.ErrorCode.RC_NET_CHANNEL_INVALID}}))}getMessages(e,t,n,r,s,o,i){return this.getHistoryMessage(e,t,n,r,s,o,i)}reportSDKInfo(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const{currentUserId:t,_connMgr:n}=this,r=this.logger.createTraceId(),s=JSON.stringify(e);this.logger.debug(exports.LogTagId.L_VER_REPORT_T,s,r);const o=n.codec.encodeReportSDKInfo(s),i=new Gi(Jo[Jo.reportsdk],o,t),{code:a}=yield n.send(i);a!==exports.ErrorCode.SUCCESS&&this.logger.warn(exports.LogTagId.L_VER_REPORT_R,a,r)}))}deleteRemoteMessage(e,n,r,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{currentUserId:t,_connMgr:o}=this,i=o.codec.encodeDeleteMessages(e,n,r,s);let a=Jo.delMsg;e===exports.ConversationType.ULTRA_GROUP&&(a=Jo.delUgMsg);const l=new Gi(a,i,t),d=yield o.send(l),{code:u}=d;return u}))}deleteRemoteMessageByTimestamp(e,n,r,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{currentUserId:t,_connMgr:o}=this,i=o.codec.encodeClearMessages(n,r,s,e),a=new Gi(nd[e],i,t),l=yield o.send(a),{code:d}=l;return d}))}batchClearRemoteHistoryMessages(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{currentUserId:t,_connMgr:n}=this,r=n.codec.encodeBatchClearRemoteMessages(e),s=new Gi(Jo.cleanMsgBatch,r,t),o=yield n.send(s),{code:i}=o;return i}))}getConversationList(e=300,n,r,s,o){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{currentUserId:t,_connMgr:o}=this;n=n||exports.ConversationType.PRIVATE;const i=o.codec.encodeOldConversationList({count:e,type:n,startTime:r,order:s}),a=new Gi(Jo.qryRelationR,i,t),l=yield o.send(a,yr,{currentUserId:t,connectedTime:o.getConnectedTime(),afterDecode:e=>{const{conversationType:t,targetId:n,channelId:r}=e,s=this._conversationManager.get(t,n,r);Object.assign(e,s);const o=this._conversationManager.getDraft(t,n,r);return e.draft=o,e}}),{code:d,data:u}=l;return d!==exports.ErrorCode.SUCCESS?{code:d}:{code:d,data:null==u?void 0:u.list}}))}removeConversation(e,n,r){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{_connMgr:t}=this,s=t.codec.encodeRemoveOldConversationList({conversationType:e,channelId:r,targetId:n}),o=new Gi(Jo.delRelation,s,n);return(yield t.send(o)).code}))}batchRemoveConversation(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{_connMgr:t}=this,n=t.codec.encodeBatchDeleteConversation(e),r=new Gi(Jo.delRelationBatch,n,this.getCurrentUserId());return(yield t.send(r)).code}))}getConversation(e,n,r){return t(this,void 0,void 0,(function*(){let t;if(e===exports.ConversationType.ULTRA_GROUP){if(t=this._ultraGroupMap[`${r}_${n}`],!t)return{code:exports.ErrorCode.CONVER_GET_ERROR}}else{const s=this._conversationManager.get(e,n,r);if(!s)return{code:exports.ErrorCode.CONVER_GET_ERROR};const{code:o,data:i}=yield this.getHistoryMessage(e,n,0,1,0);if(o!==exports.ErrorCode.SUCCESS)return{code:exports.ErrorCode.CONVER_GET_ERROR};const a=this._conversationManager.getDraft(e,n,r),l=(null==i?void 0:i.list[0])||null;t={conversationType:e,targetId:n,channelId:r,unreadMessageCount:s.unreadMessageCount||0,latestMessage:l,notificationStatus:s.notificationStatus||exports.NotificationStatus.CLOSE,notificationLevel:s.notificationLevel||exports.NotificationLevel.NOT_SET,isTop:s.isTop||!1,lastUnreadTime:s.lastUnreadTime||0,unreadMentionedCount:s.unreadMentionedCount||0,draft:a}}return{code:exports.ErrorCode.SUCCESS,data:t}}))}getAllConversationUnreadCount(e,t,n){const r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})}getTotalUnreadCountByLevels(e,t,n=!1){let r=0;if(e.includes(exports.ConversationType.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});for(const e in this._ultraGroupMap){const s=this._ultraGroupMap[e];(0===t.length||t.includes(s.notificationLevel))&&(r+=n?s.unreadMentionedCount:s.unreadMessageCount)}}return r+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})}getConversationUnreadCount(e,t,n){var r;let s;return e===exports.ConversationType.ULTRA_GROUP?(s=(null===(r=this._ultraGroupMap[`${n}_${t}`])||void 0===r?void 0:r.unreadMessageCount)||0,s=this._getUnreadCount(s)):s=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:s})}clearConversationUnreadCount(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,this.getServerTime(),!1),Promise.resolve(exports.ErrorCode.SUCCESS)}clearAllUnreadCount(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(exports.ErrorCode.SUCCESS)}getFirstUnreadMessage(e,t){throw new Error("Method not implemented.")}getFirstUnreadMessageInfo(e,t,n){const{firstUnreadMessageUid:r,firstUnreadTime:s}=this._conversationManager.get(e,t,n);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:s&&r?{messageUId:r,sentTime:s}:null})}saveConversationMessageDraft(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(exports.ErrorCode.SUCCESS)}getConversationMessageDraft(e,t,n){const r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})}clearConversationMessageDraft(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(exports.ErrorCode.SUCCESS)}pullConversationStatus(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:t,currentUserId:n}=this,r=t.codec.encodeGetConversationStatus(e),s=new Gi(Jo[Jo.pullSeAtts],r,n),o=yield t.send(s,Zr),{code:i,data:a}=o;if(this.logger.info(exports.LogTagId.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:n})),i!==exports.ErrorCode.SUCCESS)return{code:i};const l=[];return Array.isArray(a)&&a.forEach((e=>{const{conversationType:t,updatedTime:n}=e;n&&this._conversationManager.setConversationUpdatedTime(n),t===exports.ConversationType.ULTRA_GROUP?this._setUltraConversationStatus(e):l.push(e)})),{code:i,data:l}}))}_setUltraConversationStatus(e){const{targetId:t,notificationStatus:n,notificationLevel:r,channelId:s,isTop:o,conversationType:i}=e;if(""===t&&void 0!==r)return void this._ultraGroupManager.addUltraGroupStatus({conversationType:i,targetId:"",channelId:"",notificationLevel:r});const a=this._ultraGroupMap[`${s}_${t}`];return a&&void 0!==r&&(a.notificationLevel=r,this._ultraGroupManager.addUltraGroupStatus(a)),a&&void 0!==n&&(a.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(a)),a&&void 0!==o&&(a.isTop=o),a}batchSetConversationStatus(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{currentUserId:n,_connMgr:r}=this,{code:s}=yield this._conversationManager.pushTask((s=>t(this,void 0,void 0,(function*(){const t=r.codec.encodeSetConversationStatus(e,s),o=new Gi(Jo.setSeAtt,t,n),i=yield r.send(o,os),{code:a,data:l}=i;if(a!==exports.ErrorCode.SUCCESS)return{code:a};const d=l;this._conversationManager.setConversationUpdatedTime(d.version);const u=[];if(e.forEach((e=>{const{conversationType:t}=e;if(t!==exports.ConversationType.ULTRA_GROUP)this._conversationManager.addStatus(Object.assign(Object.assign({},e),{updatedTime:d.version}),!0);else{const t=this._setUltraConversationStatus(e);t&&u.push(t)}})),u.length>0){let e=Rt(u);e=sd(e),this._watcher.conversation(e)}return{code:a}}))));return s}))}setConversationToTop(e,n,r,s,o){return t(this,void 0,void 0,(function*(){return this.batchSetConversationStatus([{conversationType:e,targetId:n,isTop:r,channelId:s}])}))}batchSetConversationToTop(e,n,r){return t(this,void 0,void 0,(function*(){return this.batchSetConversationStatus(e.map((e=>Object.assign(Object.assign({},e),{isTop:n}))))}))}setConversationNotificationLevel(e,n,r,s=""){return t(this,void 0,void 0,(function*(){return this.batchSetConversationStatus([{conversationType:e,targetId:n,notificationLevel:r,channelId:s}])}))}batchSetConversationNotificationLevel(e,n){return t(this,void 0,void 0,(function*(){return this.batchSetConversationStatus(e.map((e=>Object.assign(Object.assign({},e),{notificationLevel:n}))))}))}_joinChrm(e,n,r,s,o){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,i=Mo.encode(fr,{nothing:1,extra:s}),a=r?Jo.joinChrmR:Jo.joinChrm,l=new Gi(a,i,e);this.logger.info(exports.LogTagId.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:n,topic:Jo[a]}),o);const{code:d,data:u}=yield t.send(l,Cr),c=d===exports.ErrorCode.SUCCESS?"info":"warn";if(this.logger[c](exports.LogTagId.L_JOIN_CHATROOM_R,JSON.stringify({code:d,timestamp:(new Date).getTime()}),o),d===exports.ErrorCode.SUCCESS){const{joinTime:t,createTime:r,memberCount:o,isAllChatroomBanned:i,isCurrentUserBanned:a,isCurrentChatroomBanned:l,isCurrentChatroomInWhitelist:c}=u;this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,n,t);const{kvStorage:h}=this.getNaviInfoFromCache();return h&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,n,s),this._startSyncIntervalForChrmPull(),{code:d,data:{joinTime:t,createTime:r,memberCount:o,isAllChatroomBanned:i,isCurrentUserBanned:a,isCurrentChatroomBanned:l,isCurrentChatroomInWhitelist:c}}}return{code:d}}))}_rejoinChrm(){return t(this,void 0,void 0,(function*(){const e=this._joinedChrmManager.get();for(const t in e){const{count:n=10,extra:r}=e[t];this.logger.info(exports.LogTagId.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:t,count:n,extra:r}));const s=this.logger.createTraceId(),{code:o,data:i}=yield this._joinChrm(t,n,!0,r,s),a=o===exports.ErrorCode.SUCCESS?"info":"warn";if(this.logger[a](exports.LogTagId.L_REJOIN_CHATROOM_R,JSON.stringify({code:o,timestamp:(new Date).getTime()}),s),o===exports.ErrorCode.SUCCESS)return void this._watcher.chatroom({rejoinedRoom:Object.assign({chatroomId:t,count:n},i)});o===exports.ErrorCode.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(t),delete this._chrmsQueue[t]),this._watcher.chatroom({rejoinedRoom:{chatroomId:t,errorCode:o}})}}))}_pullChrmMsg(e,n=10,r=0){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const t=this._chrmsQueue[e],{pulling:s,timestamp:o}=t;if(s)return;t.pulling=!0;const i=r?0:o,a=Mo.encode(Rr,{count:n,syncTime:i});this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,syncTime:i}));const l=new Gi(Jo[Jo.chrmPull],a,e),{code:d,data:u}=yield this._connMgr.send(l,pr,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId});if(t.pulling=!1,d!==exports.ErrorCode.SUCCESS||!u)return void this.logger.warn(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:d,timestamp:o,messageUIds:""}));const{list:c,syncTime:h,finished:p}=u;t.timestamp=r?Math.max(h,r):h,t.queue=t.queue.filter((e=>e>h));const _=[],g=[],E=[];c.forEach((e=>{e.sentTime<o||(e.sentTime>=this._connMgr.getConnectedTime()&&this._writeMessagesLog(exports.ConversationType.CHATROOM,e.messageUId)&&g.push(e.messageUId),_.push(e.messageUId),E.push(e))})),this._batchMessage(E),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:d,timestamp:o,messageUIds:_.join(",")})),g.length>0&&this.logger.record(oe.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:g.join(",")})),p?t.queue.length>0&&(t.queue.length=0,this._pullChrmMsg(e)):this._pullChrmMsg(e)}))}joinChatroom(e,n,r,s){return t(this,void 0,void 0,(function*(){const{code:t}=yield this._joinChrm(e,n,!1,r,s);return t}))}joinExistChatroom(e,n,r,s){return t(this,void 0,void 0,(function*(){return this._joinChrm(e,n,!0,r,s)}))}quitChatroom(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{_connMgr:t}=this;delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e);const n=Mo.encode(fr,{nothing:1}),{code:r}=yield t.query(Jo.exitChrm,e,n);return r}))}getChatroomInfo(e,n,r){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,s=t.codec.encodeGetChatRoomInfo(n,r),o=new Gi(Jo[Jo.queryChrmI],s,e),i=yield t.send(o,Lr),{code:a,data:l}=i;return a!==exports.ErrorCode.SUCCESS?{code:a}:{code:a,data:l}}))}getChatroomHistoryMessages(e,n,r,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,o=t.codec.encodeGetHistoryMsg(e,{timestamp:n,count:r,order:s}),i=new Gi(Jo.qryCHMsg,o,e),a=yield t.send(i,Pr,{conversation:{targetId:e}}),{code:l}=a,d=a.data;return l!==exports.ErrorCode.SUCCESS?{code:l}:{code:l,data:{list:d.list,hasMore:d.hasMore}}}))}_modifyChatroomKV(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{_connMgr:t,currentUserId:r}=this,s=this._chrmEntryHandler.getVersion(e,n.key);n.version=null==s?this.getServerTime():s;const o=t.codec.encodeModifyChatRoomKV(e,n,r),i=n.type===exports.ChatroomEntryType.UPDATE?Jo.setKV:Jo.delKV,a=new Gi(i,o,e),l=yield t.send(a,Cr),{code:d}=l;return d===exports.ErrorCode.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[n],syncTime:this.getServerTime()},r),d):d}))}_chatroomKVStoreNotAllSuccess(e,t){const n=t.data;let r=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((e=>{const t=r.findIndex((t=>e.key===t.key));-1!==t&&r.splice(t,1)})),r}_modifyChatroomKVS(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:t,currentUserId:r}=this,{entries:s}=n;s.forEach((t=>{const n=this._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?this.getServerTime():n}));const o=t.codec.encodeModifyChatRoomKVS(e,n,r),i=n.type===exports.ChatroomEntryType.UPDATE?Jo.setKVS:Jo.delKVS,a=new Gi(i,o,e),l=yield t.send(a,jr),{code:d}=l;let u;if(-1!==[exports.ErrorCode.SUCCESS,exports.ErrorCode.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(d)){let t=[];const s=Object.assign({},n);if(delete s.entries,n.entries.forEach((e=>{t.push(Object.assign(Object.assign({},e),s))})),d===exports.ErrorCode.CHATROOM_KV_STORE_NOT_ALL_SUCCESS){u=l.data.errorKeys,t=this._chatroomKVStoreNotAllSuccess(t,l)}this._chrmEntryHandler.setLocal(e,{kvEntries:t,syncTime:(new Date).getTime()},r)}return{code:d,data:u}}))}setChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){return n.type=exports.ChatroomEntryType.UPDATE,n.userId=n.userId||this.currentUserId,this._modifyChatroomKV(e,n)}))}setChatroomEntries(e,n){return t(this,void 0,void 0,(function*(){return n.type=exports.ChatroomEntryType.UPDATE,n.userId=n.userId||this.currentUserId,this._modifyChatroomKVS(e,n)}))}forceSetChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){return n.type=exports.ChatroomEntryType.UPDATE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,this._modifyChatroomKV(e,n)}))}removeChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){return n.type=exports.ChatroomEntryType.DELETE,n.userId=n.userId||this.currentUserId,this._modifyChatroomKV(e,n)}))}removeChatroomEntries(e,n){return t(this,void 0,void 0,(function*(){return n.type=exports.ChatroomEntryType.DELETE,n.userId=n.userId||this.currentUserId,this._modifyChatroomKVS(e,n)}))}forceRemoveChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){return n.type=exports.ChatroomEntryType.DELETE,n.isOverwrite=!0,n.userId=n.userId||this.currentUserId,this._modifyChatroomKV(e,n)}))}getChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){const t=this._chrmEntryHandler.getValue(e,n);if(t)return{code:exports.ErrorCode.SUCCESS,data:t};if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:r}=this,s=r.codec.encodePullChatRoomKV(0),o=new Gi(Jo[Jo.pullKV],s,e),i=yield r.send(o,Kr),{data:a}=i;if(a&&a.kvEntries&&a.kvEntries.length){const e=a.kvEntries.find((e=>e.key===n));if(void 0!==e)return{code:exports.ErrorCode.SUCCESS,data:null==e?void 0:e.value}}return{code:exports.ErrorCode.CHATROOM_KEY_NOT_EXIST}}))}getAllChatroomEntry(e){return t(this,void 0,void 0,(function*(){let t=this._chrmEntryHandler.getAll(e);if(t&&Object.keys(t).length)return{code:exports.ErrorCode.SUCCESS,data:t};if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:n}=this;t={};const r=n.codec.encodePullChatRoomKV(0),s=new Gi(Jo[Jo.pullKV],r,e),o=yield n.send(s,Kr),{data:i}=o;return i&&i.kvEntries&&i.kvEntries.length&&i.kvEntries.forEach((e=>{e.key&&(t[e.key]=e.value||"")})),{code:exports.ErrorCode.SUCCESS,data:t}}))}pullChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:t,currentUserId:r}=this;if(!this._chrmsQueue[e])return{code:exports.ErrorCode.RC_CHATROOM_NOT_EXIST};const s=t.codec.encodePullChatRoomKV(n),o=new Gi(Jo[Jo.pullKV],s,e);this.logger.info(exports.LogTagId.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:n}));const{code:i,data:a}=yield t.send(o,Kr);if(!this._chrmsQueue[e])return{code:exports.ErrorCode.RC_CHATROOM_NOT_EXIST};const l=i===exports.ErrorCode.SUCCESS?"info":"warn";if(this.logger[l](exports.LogTagId.L_PULL_CHATROOM_KV_R,JSON.stringify({code:i,timestamp:n})),i===exports.ErrorCode.SUCCESS&&a){const{kvEntries:t}=a,n=[];return t.length>0&&(t.forEach((t=>{const{key:r,value:s,type:o,timestamp:i,userId:a}=t;this._chrmEntryHandler.getValue(e,r)===s&&a===this.getCurrentUserId()||n.push({key:r,value:s,type:o,timestamp:i,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,a,r),n.length>0&&this._watcher.chatroom({updatedEntries:n})),{code:i,data:a}}return{code:i}}))}_startSyncIntervalForChrmPull(){this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((()=>{const e=Object.keys(this._chrmsQueue);0!==e.length&&this._isConnected?e.forEach((e=>{this._pullChrmMsg(e);const{kvStorage:t}=this.getNaviInfoFromCache();t&&this._chrmEntryHandler.pullEntry(e,0)})):this._stopSyncIntervalForChrmPull()}),18e4)}_stopSyncIntervalForChrmPull(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)}removeChatroomFromCatch(e){var t;null===(t=this._joinedChrmManager)||void 0===t||t.remove(e)}_writeMessagesLog(e,t){var n;const r=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!r)return!1;const s=function(e){if(!e)return Math.floor(4294967296*Math.random());let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}(t);let o=0;switch(e){case exports.ConversationType.PRIVATE:o=r.private;break;case exports.ConversationType.GROUP:o=r.group;break;case exports.ConversationType.CHATROOM:o=r.chatroom;break;case exports.ConversationType.ULTRA_GROUP:o=r.ultraGroup}return!!o&&s%(1/o)==0}sendMessage(e,n,r,s,o){var i;return t(this,void 0,void 0,(function*(){r=this._handleInnerMsgOptions(e,n,r),r=this._handleMsgProperties(r,!0);let t=!1;[exports.ConversationType.PRIVATE,exports.ConversationType.GROUP].includes(e)&&(r.isStatusMessage||(null===(i=this._customMessageType[r.messageType])||void 0===i?void 0:i.isStatusMessage))&&(t=!0);const a=t?(l=e,{[exports.ConversationType.PRIVATE]:Jo.ppMsgS,[exports.ConversationType.GROUP]:Jo.pgMsgS}[l]):(e=>({[exports.ConversationType.PRIVATE]:Jo.ppMsgP,[exports.ConversationType.GROUP]:Jo.pgMsgP,[exports.ConversationType.CHATROOM]:Jo.chatMsg,[exports.ConversationType.CUSTOMER_SERVICE]:Jo.pcMsgP,[exports.ConversationType.RTC_ROOM]:Jo.prMsgS,[exports.ConversationType.SYSTEM]:Jo.pbMsgP}[e]))(e)||Jo.ppMsgP;var l;t&&(r.isPersited=!1,r.isCounted=!1);const d=r.messageId?r.messageId:Gt();r.messageId=d;const u=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:n},r),c=new Fi(Jo[a],u,e===exports.ConversationType.SYSTEM?this.currentUserId:n);if(c.setHeaderQos(zo.AT_LEAST_ONCE),t)return this._connMgr.sendOnly(c),{code:exports.ErrorCode.SUCCESS,data:rd(e,n,Object.assign({},r),"",0,this.currentUserId,d)};const h=this._connMgr.getCrtServerTime(),p=rd(e,n,Object.assign(Object.assign({},r),{isStatusMessage:t}),"",h,this.currentUserId,d);null==s||s(d),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:n,channelId:r.channelId}),o);const _=Date.now(),{code:g,data:E}=yield this._connMgr.send(c);if(g!==exports.ErrorCode.SUCCESS)return this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:p.messageUId,messageId:p.messageId}),o),this._writeMessagesLog(e)&&this.logger.record(oe.IM_MSG_SEND,JSON.stringify({channel:e,start_ts:_,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:g})),p.sentStatus=exports.SentStatus.FAILED,{code:g,data:p};this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:null==E?void 0:E.messageUId,messageId:null==E?void 0:E.messageId}),o);const I=E;return this._sendMessageSuccessHandle(p,I),this._writeMessagesLog(e,I.messageUId)&&this.logger.record(oe.IM_MSG_SEND,JSON.stringify({msg_id:I.messageUId,channel:e,start_ts:_,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:g})),{code:exports.ErrorCode.SUCCESS,data:p}}))}_sendMessageSuccessHandle(e,t){var n;this._sendMessageStore.setMessage(t.messageUId,t.timestamp),e.sentTime=t.timestamp,e.messageUId=t.messageUId,this._conversationManager.setConversationCacheByMessage(e,!0);const{messageType:r,conversationType:s,targetId:o,channelId:i,sentTime:a,content:l,messageDirection:d}=e;if(r===exports.MessageType.READ_RECEIPT_REQUEST){const{messageUId:e}=l;null===(n=this._readReceiptManager)||void 0===n||n.insert({conversationType:s,targetId:o,channelId:i},e,d,a)}if(r===exports.MessageType.READ_RECEIPT_RESPONSE){const{receiptMessageDic:e}=l;if(!e)return;for(const t in e)e[t].forEach((e=>{var t;null===(t=this._readReceiptManager)||void 0===t||t.remove({conversationType:s,targetId:o,channelId:i},e)}))}}recallMsg(e,n){var r;return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:s}=e,o=e.channelId||"",{user:i,extra:a,isDelete:l,directionalUserIdList:d,disableUpdateLastMessage:u,messageUId:c,sentTime:h}=n,p={conversationType:s,targetId:t,messageUId:c,sentTime:h,channelId:o,isDelete:l||!1,isAdmin:n.isAdmin};i&&(p.user=i),a&&(p.extra=a);const _={content:p,messageType:"RC:RcCmd",disableNotification:null==n?void 0:n.disableNotification,pushConfig:null==n?void 0:n.pushConfig,pushContent:(null===(r=n.pushConfig)||void 0===r?void 0:r.pushContent)||n.pushContent||"",channelId:o,disableUpdateLastMessage:u};[exports.ConversationType.GROUP,exports.ConversationType.ULTRA_GROUP].includes(s)&&d&&(_.directionalUserIdList=d);const g=this._connMgr.codec.encodeUpMsg({conversationType:s,targetId:t},_),E=new Fi(Jo.recallMsg,g,this.currentUserId);E.setHeaderQos(zo.AT_LEAST_ONCE);const I=yield this._connMgr.send(E);if(!I.isOk)return I.wipe();const T=I.data;if(s!==exports.ConversationType.ULTRA_GROUP){const e=`Cmd:${c}`;T.messageUId=e}const f=rd(s,t,Object.assign(Object.assign({},_),{isPersited:!0}),T.messageUId,T.timestamp,this.currentUserId);return s===exports.ConversationType.ULTRA_GROUP?(this._ultraMsgMap[T.messageUId]=T.timestamp,this._updateUltraGroupWhenRecallMsg(t,o,c)):(this._sendMessageStore.setMessage(T.messageUId,T.timestamp),this._conversationManager.setConversationCacheByMessage(f,!0)),$e(f)}))}sendReadReceiptMessage(e,n,r){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeReadReceipt(n,r),s=new Gi(Jo[Jo.rrMsg],t,e);return this._connMgr.send(s)}))}getMessageReader(e,n,r){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeMessageReader(n,r),s=new Gi(Jo[Jo.rrList],t,e);return this._connMgr.send(s,ds)}))}sendReadReceiptMessageV4(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeReadReceiptMsg(e,n,r),s=new Fi(Jo[Jo.sendMsgRead],t,e.targetId);return this._connMgr.send(s)}))}getMessageReadReceiptV4(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeReceiptQryReq(e,n),r=new Gi(Jo[Jo.qryMsgRead],t,e.targetId);return this._connMgr.send(r,bs)}))}batchGetMessageReadReceiptInfoV4(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeReceiptCntQryReq(e,n),r=new Gi(Jo[Jo.qryMsgReadCntBatch],t,e.targetId),{code:s,data:o}=yield this._connMgr.send(r,Ds),{result:i}=o||{result:[]};return s===exports.ErrorCode.SUCCESS&&i?{code:s,data:i.map((t=>Object.assign({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)))}:{code:s}}))}updateConversationReadTime(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeSessionMsgReadInput(e,n),r=new Fi(Jo[Jo.updRTime],t,this.currentUserId);return this._connMgr.send(r)}))}pullUserSettings(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this.getNaviInfoFromCache(),n=Mo.encode($r,{version:e,ipType:t.ipType||0}),r=new Gi(Jo.pullUS,n,this.currentUserId),{code:s,data:o}=yield this._connMgr.send(r,Jr);return s===exports.ErrorCode.SUCCESS&&this._naviChangeHandler(o),{code:s,data:o}}))}_naviChangeHandler(e){var t;if(!e)return void this.logger.warn(exports.LogTagId.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}));const{settings:n}=e,r=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(!r)return;const s=this._connMgr.getToken();this.navi.updateVoipCallInfo(s,r);const o=this.navi.getNaviInfoFromCache(s);this._watcher.onNaviDataChange(Object.assign({},o))}getFileToken(e,n,r,s,o,i){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};let t;t=s&&"uploads"!==s?n||"":Dt(e,n);const a=this.getNaviInfoFromCache(),l=Ht(a,this.logger);let d="";l||(d=JSON.stringify({uploadDomain:l}));const u=Mo.encode(gr,{type:e,key:t,httpMethod:r||"",queryString:s||"",url:o||"",ext:d,size:i?Math.ceil(i):0,ipType:a.ipType||0});return(yield this._connMgr.query(Jo.qnTkn,this.currentUserId,u,Ir)).trans((e=>Object.assign(Object.assign({},e),{fileName:t,downloadAuthInfo:e.downloadAuthInfo?JSON.parse(e.downloadAuthInfo):null})))}))}getFileUrl(e,n,r,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this.getNaviInfoFromCache();let o,i="",a="";n===exports.UploadMethod.QINIU?o=Jo.qnUrl:n===exports.UploadMethod.AWS?o=Jo.s3Url:n===exports.UploadMethod.STC?o=Jo.stcUrl:n===exports.UploadMethod.MINIO?(o=Jo.minioUrl,i=Ht(t,this.logger),a=JSON.stringify({url:i})):o=Jo.aliUrl;const l=Mo.encode(Er,{type:e,key:r,fileName:s,ext:a,size:-1,ipType:t.ipType||0});return(yield this._connMgr.query(o,this.currentUserId,l,Tr)).trans((({downloadUrl:e})=>({downloadUrl:e})))}))}disconnect(){return t(this,void 0,void 0,(function*(){this.reporter.stop(),this.reporterStatistic.stop(),yield this._connMgr.disconnect(),this._resetMemoryState()}))}_resetMemoryState(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData(),this._joinedChrmManager&&(this._joinedChrmManager.clear(),delete this._joinedChrmManager),this._conversationManager&&delete this._conversationManager,this._ultraGroupManager&&delete this._ultraGroupManager,this._userSettingManager&&delete this._userSettingManager,this._readReceiptManager&&delete this._readReceiptManager,this._subscribeManager&&delete this._subscribeManager,this._chrmsQueue={}}resetUltraGroupData(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}}registerMessageType(e,t,n,r,s){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:s}}getServerTime(){return this._connMgr.getCrtServerTime()}getCurrentUserId(){return this.currentUserId}createTag(e){return t(this,void 0,void 0,(function*(){return this._isConnected?this._userSettingManager.pushTask((n=>t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeCreateTag([e],n),r=new Gi(Jo[Jo.addSeTag],t,this.currentUserId),{code:s,data:o}=yield this._connMgr.send(r,Wr);if(s===exports.ErrorCode.SUCCESS&&o){const{version:t}=o;this._userSettingManager.addTag([Object.assign(Object.assign({},e),{createdTime:t})],t)}return{code:s}})))):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}removeTag(e){return t(this,void 0,void 0,(function*(){return this._isConnected?this._userSettingManager.pushTask((n=>t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeRemoveTag([e],n),r=new Gi(Jo[Jo.delSeTag],t,this.currentUserId),{code:s,data:o}=yield this._connMgr.send(r,Wr);if(s===exports.ErrorCode.SUCCESS&&o){const{version:t}=o;this._userSettingManager.deleteTag([e],t)}return{code:s}})))):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}updateTag(e){return t(this,void 0,void 0,(function*(){return this._isConnected?this._userSettingManager.pushTask((n=>t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeCreateTag([e],n),r=new Gi(Jo[Jo.addSeTag],t,this.currentUserId),{code:s,data:o}=yield this._connMgr.send(r,Wr);if(s===exports.ErrorCode.SUCCESS){const{version:t}=o;this._userSettingManager.addTag([e],t)}return{code:s}})))):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}getTagList(){return t(this,void 0,void 0,(function*(){const e=this._userSettingManager.getTags(),t=this._conversationManager.getConversationListForTag();return e.forEach((e=>{e.conversationCount=t[e.tagId]?t[e.tagId].length:0})),{code:exports.ErrorCode.SUCCESS,data:e}}))}addTagForConversations(e,n){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((r=>t(this,void 0,void 0,(function*(){if(!this._userSettingManager.getTagById(e))return{code:exports.ErrorCode.TAG_NOT_EXIST};const t=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],n,r),s=new Gi(Jo[Jo.addTag],t,this.currentUserId),{code:o,data:i}=yield this._connMgr.send(s,os);if(o===exports.ErrorCode.SUCCESS&&i){const t={};t[e]={},n.forEach((e=>{this._conversationManager.addTagStatus(e.conversationType,e.targetId,t,e.channelId)})),this._conversationManager.setConversationUpdatedTime(i.version)}return{code:o}})))):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}removeTagForConversations(e,n){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((r=>t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],n,r),s=new Gi(Jo[Jo.delTag],t,this.currentUserId),{code:o,data:i}=yield this._connMgr.send(s,os);return o===exports.ErrorCode.SUCCESS&&i&&(n.forEach((t=>{this._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),this._conversationManager.setConversationUpdatedTime(i.version)),{code:o}})))):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}removeTagsForConversation(e,n){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((r=>t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:s,channelId:o}=e,i=n.map((e=>({tagId:e}))),a=this._connMgr.codec.encodeUpdateConversationTag(i,[e],r),l=new Gi(Jo[Jo.delTag],a,this.currentUserId),{code:d,data:u}=yield this._connMgr.send(l,os);return d===exports.ErrorCode.SUCCESS&&u&&(this._conversationManager.deleteTagStatus(t,s,n,o),this._conversationManager.setConversationUpdatedTime(u.version)),{code:d}})))):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}getConversationListByTag(e,n,r){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{currentUserId:t,_connMgr:s}=this,o=s.codec.encodeOldConversationList({count:r,type:exports.ConversationType.PRIVATE,startTime:n}),i=new Gi(Jo.qryRelationR,o,t),a=yield s.send(i,yr,{currentUserId:t,connectedTime:s.getConnectedTime()}),{code:l,data:d}=a;if(l!==exports.ErrorCode.SUCCESS)return{code:l};return{code:l,data:this._conversationHasTagFilter(e,null==d?void 0:d.list)}}))}_conversationHasTagFilter(e,t){let n=[],r=[];function s(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}t.forEach((t=>{const{conversationType:s,targetId:o,channelId:i}=t,{hasMentioned:a,mentionedInfo:l,lastUnreadTime:d,notificationStatus:u,isTop:c,tags:h,unreadMessageCount:p}=this._conversationManager.get(s,o,i),_=h&&h[e];if(_){const e=Object.assign(Object.assign({},t),{hasMentioned:a,mentionedInfo:l,lastUnreadTime:d,notificationStatus:u,isTop:c,unreadMessageCount:p});_.isTop?n.push(Object.assign(Object.assign({},e),{isTopInTag:!0})):r.push(Object.assign(Object.assign({},e),{isTopInTag:!1}))}})),n.sort(s),r.sort(s);return[...n,...r]}getUnreadCountByTag(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._conversationManager.getUnreadCountByTag(e,n);return{code:exports.ErrorCode.SUCCESS,data:t}}))}setConversationStatusInTag(e,n,r){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((s=>t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:o,channelId:i}=n,{isTop:a}=r,l=[{tagId:e,isTop:a}],d=this._conversationManager.get(o,t,i);if(!d.tags||!Object.hasOwnProperty.call(d.tags,e))return{code:exports.ErrorCode.NO_TAG_IN_CONVER};const u=this._connMgr.codec.encodeUpdateConversationTag(l,[n],s),c=new Gi(Jo[Jo.addTag],u,this.currentUserId),{code:h,data:p}=yield this._connMgr.send(c,os);if(h===exports.ErrorCode.SUCCESS&&p){const n={};n[e]={},a&&(n[e].isTop=!0),this._conversationManager.addTagStatus(o,t,n,i),this._conversationManager.setConversationUpdatedTime(p.version)}return{code:h}})))):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}getTagsForConversation(e){var n;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),s=[];if(t.tags)for(const e in t.tags)s.push({tagId:e,tagName:null===(n=r[e])||void 0===n?void 0:n.tagName});return{code:exports.ErrorCode.SUCCESS,data:s}}))}getBlockConversationList(){const e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:e})}getTopConversationList(e,t){const n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})}getUnreadConversationList(e){return t(this,void 0,void 0,(function*(){const t=this._conversationManager.getUnreadConversationList(e);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})}))}getUnreadMentionedCount(e){var t;let n;return n=e.conversationType===exports.ConversationType.ULTRA_GROUP?(null===(t=this._ultraGroupMap[`${e.channelId}_${e.targetId}`])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.conversationType,e.targetId,e.channelId),n=this._getUnreadCount(n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})}getAllUnreadMentionedCount(){const e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:e})}getConversationNotificationLevel(e,t,n){if(!this._isUltraGroupListExist&&e===exports.ConversationType.ULTRA_GROUP)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});let r;if(r=e===exports.ConversationType.ULTRA_GROUP?this._ultraGroupManager.get(exports.ConversationType.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n),!r)return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:exports.NotificationLevel.NOT_SET});let s=r.notificationLevel;return lt(r.notificationLevel)&&!lt(r.notificationStatus)&&(s=exports.NotificationStatus.OPEN===r.notificationStatus?1:0),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:s})}getConversationNotificationStatus(e,t,n){let r;return r=e===exports.ConversationType.ULTRA_GROUP?this._ultraGroupManager.get(exports.ConversationType.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n),r?Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:exports.ErrorCode.SUCCESS,data:exports.NotificationStatus.CLOSE})}setConversationTypeNotificationLevel(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{currentUserId:t,_connMgr:r}=this,s=this._conversationManager.getConversationUpdatedTime();return(yield r.query(Jo.setTypeUnpush,t,Mo.encode(is,{type:e,unpushLevel:n,version:s}),as)).trans((t=>{var r;const{version:s}=t;this._conversationManager.setConversationUpdatedTime(s),e===exports.ConversationType.ULTRA_GROUP?null===(r=this._ultraGroupManager)||void 0===r||r.addUltraGroupStatus({conversationType:e,targetId:"",notificationLevel:n,channelId:""}):this._conversationManager.addStatus({conversationType:e,targetId:"",channelId:"",updatedTime:s,notificationLevel:n},!0)}))}))}getConversationTypeNotificationLevel(e){if(e===exports.ConversationType.ULTRA_GROUP){const t=this._ultraGroupManager.get(e,"","");return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t.notificationLevel||0})}const t=this._conversationManager.get(e,"","");return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t.notificationLevel||0})}getRemoteHistoryMessages(e,t,n,r,s,o){return this.getHistoryMessage(e,t,n,r,s,o)}getUltraGroupList(e){return t(this,void 0,void 0,(function*(){const{targetId:t,channelType:n}=e;if(!this._isUltraGroupListExist)return{code:exports.ErrorCode.METHOD_NOT_AVAILABLE};let r=Object.values(this._ultraGroupMap).filter((e=>!(e.targetId!==t&&t||e.channelType!==n&&nt(n))));r=r.map((e=>{let{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:r}=e;return t=this._getUnreadCount(t),n=this._getUnreadCount(n),r=this._getUnreadCount(r),Object.assign(Object.assign({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:r})})),r=sd(r);const s=Rt(r);return{code:exports.ErrorCode.SUCCESS,data:s}}))}_getUnreadCount(e){return e>999?999:e}getBlockUltraGroupList(){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});const e=Object.values(this._ultraGroupMap),t=[];return e.forEach((e=>{(e.notificationStatus===exports.NotificationStatus.OPEN||e.notificationLevel>0)&&t.push({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})}getTopUltraGroupList(){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});const e=Object.values(this._ultraGroupMap),t=[];return e.forEach((e=>{!0===e.isTop&&t.push({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})}getUltraGroupUnreadMentionedCountByTargetId(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});let n=0;for(const r in this._ultraGroupMap){r.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=this._ultraGroupMap[r].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})}getUltraGroupUnreadCountByTargetId(e,t){let n=0;for(const r in this._ultraGroupMap){const s=this._ultraGroupMap[r];s.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=s.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})}getUltraGroupUnreadInfoList(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});const t=[];return Object.keys(this._ultraGroupMap).forEach((n=>{const r=this._ultraGroupMap[n];e.includes(r.targetId)&&t.push({type:r.conversationType,targetId:r.targetId,channelId:r.channelId,unreadMessageCount:this._getUnreadCount(r.unreadMessageCount),mentionedCount:this._getUnreadCount(r.unreadMentionedCount),mentionedMeCount:this._getUnreadCount(r.unreadMentionedMeCount),notificationLevel:r.notificationLevel})})),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})}getAllUltraGroupUnreadCount(e=!1){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});let t=0;for(const n in this._ultraGroupMap)t+=e?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return t=this._getUnreadCount(t),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})}clearUltraUnreadcount(e,n=""){return t(this,void 0,void 0,(function*(){if(!this._isUltraGroupListExist)return Promise.resolve(exports.ErrorCode.METHOD_NOT_AVAILABLE);if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const t=this.getServerTime(),r=this._connMgr.codec.encodeClearUnreadCount({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e,channelId:n},{timestamp:t}),s=new Fi(Jo[Jo.updUgRTime],r,this.currentUserId);s.setHeaderQos(zo.AT_LEAST_ONCE);const{code:o}=yield this._connMgr.send(s);if(o===exports.ErrorCode.SUCCESS){const r=this._ultraGroupMap[`${n}_${e}`];r&&(r.unreadMessageCount=0,r.unreadMentionedCount=0,r.unreadMentionedMeCount=0,r.lastReadTime=t),r&&r.firstUnreadMessage&&(r.firstUnreadMessage=null)}return o}))}_getUltraGroupList(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const t=this._connMgr.codec.encodeUltraGroup(e,!1),n=new Gi(Jo[Jo.pullUgSes],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,yr,{currentUserId:this.currentUserId,conversationType:exports.ConversationType.ULTRA_GROUP});if(r!==exports.ErrorCode.SUCCESS||!s){this.logger.warn(exports.LogTagId.L_ULTRA_SYNC_DONE_S,`Pull ultra group conversation failured, code: ${r}, try again`);const t=setTimeout((()=>{this._getUltraGroupList(e),clearTimeout(t)}),3e3);return}const{list:o,isFinished:i}=s;if(o.forEach((e=>{e.notificationStatus=exports.NotificationStatus.CLOSE,e.notificationLevel=exports.NotificationLevel.NOT_SET,e.isTop=!1,this._ultraGroupMap[`${e.channelId}_${e.targetId}`]=e,this._ultraGroupManager.addUltraGroupStatus(e)})),!1===i){const e=o.length>0&&o[o.length-1].versionTime||0;this._getUltraGroupList(e)}else{this.logger.info(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success");const{code:e,data:t}=yield this.pullConversationStatus(0);e!==exports.ErrorCode.SUCCESS&&this.logger.warn(exports.LogTagId.O,`pullConversationStatus fail code: ${e}, data: ${t}`);let n=Object.values(this._ultraGroupMap);n=sd(n),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Rt(n)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp)}}))}_startUltraSyncInterval(){const e=()=>{this._ultraGroupTimer=setTimeout((()=>{Date.now()-this._lastSyncUltraMsgLocalTimeStamp>=18e4&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),this._stopUltraSyncInterval(),e()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),e()}_stopUltraSyncInterval(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)}_notificationOnline(){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const{code:e,data:t}=yield this._fetchUltraMsg(0);if(e!==exports.ErrorCode.SUCCESS||!t)return this.logger.warn(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),void setTimeout((()=>{this._notificationOnline()}),3e3);this.logger.info(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval()}))}_fetchUltraMsg(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Gi(Jo[Jo.pullUgMsg],t,this.currentUserId),r=this.logger.createTraceId();this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),r);const{code:s,data:o}=yield this._connMgr.send(n,pr,{currentUserId:this.currentUserId,conversation:{conversationType:exports.ConversationType.ULTRA_GROUP}});if(s===exports.ErrorCode.SUCCESS&&o){const{list:t,syncTime:n}=o,i=t.map((e=>e.messageUId)).join(",");this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,messageUIds:i,timestamp:e,syncTime:n}),r)}else this.logger.warn(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,timestamp:e}),r);return{code:s,data:o}}))}_getUltraGroup(e,t,n){var r,s,o;const{targetId:i,messageType:a,channelId:l,isCounted:d,channelType:u,sentTime:c,senderUserId:h,content:p,isMentioned:_}=e,g=this._ultraGroupMap[`${l}_${i}`],E=g||{conversationType:exports.ConversationType.ULTRA_GROUP,targetId:i,channelId:l,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:exports.NotificationStatus.CLOSE,notificationLevel:exports.NotificationLevel.NOT_SET,isTop:!1};return d&&h!==this.currentUserId&&a!==exports.MessageType.RECALL&&(E.unreadMessageCount+=1,E.unreadMentionedCount+=t,E.firstUnreadMessage||(E.firstUnreadMessage={sentTime:c}),_&&(null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.type)!==exports.MentionedType.ALL&&(null===(o=null===(s=null==p?void 0:p.mentionedInfo)||void 0===s?void 0:s.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(E.unreadMentionedMeCount+=1)),E.versionTime=n,E.latestMessage=e,E.channelType=u,g||(this._ultraGroupMap[`${l}_${i}`]=E),E}_syncUltraMsg(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected||this._isUltraPulling)return;this._isUltraPulling=!0;const{code:t,data:n}=yield this._fetchUltraMsg(e);if(this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,t!==exports.ErrorCode.SUCCESS||!n)return;const{list:r,syncTime:s,finished:o}=n,i={},a=[];if(r.forEach((e=>{var t,n,r;const{targetId:o,content:l,messageUId:d,channelId:u,isMentioned:c}=e;if(this._ultraMsgMap[d])return void delete this._ultraMsgMap[d];let h=0;c&&((null===(t=null==l?void 0:l.mentionedInfo)||void 0===t?void 0:t.type)===exports.MentionedType.ALL||(null===(r=null===(n=null==l?void 0:l.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(this.currentUserId)))&&(h=1);const p=this._getUltraGroup(e,h,s);i[`${u}_${o}`]=p,this._ultraGroupManager.addUltraGroupStatus(p),a.push(e)})),Object.keys(i).length>0){this.logger.debug(exports.LogTagId.O,"notice ultragroups");let e=Object.values(i);e=sd(e),this._watcher.conversation(Rt(e))}this.logger.debug(exports.LogTagId.O,"notice ultragroup message"),this._batchMessage(a),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((e=>e>s)),this._lastSyncUltraMsgTimeStamp=s,o?this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(s)):this._syncUltraMsg(s)}))}sendUltraMessage(e,n,r,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};"RC:SRSMsg"===n.messageType&&this.logger.warn(exports.LogTagId.O,"ultra group -> direction message convert to message");const t=(n=this._handleMsgProperties(n,!0)).messageId?n.messageId:Gt();n.messageId=t;const o=this._connMgr.codec.encodeUpMsg({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e},n),i=new Fi(Jo[Jo.ugMsg],o,e);i.setHeaderQos(zo.AT_LEAST_ONCE);const a=this._connMgr.getCrtServerTime(),l=rd(exports.ConversationType.ULTRA_GROUP,e,Object.assign({},n),"",a,this.currentUserId,t);r&&r(t),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e,channelId:n.channelId}),s);const d=Date.now(),{code:u,data:c}=yield this._connMgr.send(i);if(u!==exports.ErrorCode.SUCCESS)return this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:u,messageUId:l.messageUId,messageId:l.messageId}),s),this._writeMessagesLog(exports.ConversationType.ULTRA_GROUP)&&this.logger.record(oe.IM_MSG_SEND,JSON.stringify({channel:exports.ConversationType.ULTRA_GROUP,start_ts:d,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:u})),l.sentStatus=exports.SentStatus.FAILED,{code:u,data:l};this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:u,messageUId:null==c?void 0:c.messageUId,messageId:null==c?void 0:c.messageId}),s);const h=c;this._writeMessagesLog(exports.ConversationType.ULTRA_GROUP,h.messageUId)&&this.logger.record(oe.IM_MSG_SEND,JSON.stringify({msg_id:h.messageUId,channel:exports.ConversationType.ULTRA_GROUP,start_ts:d,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:u})),l.sentTime=h.timestamp,l.messageUId=h.messageUId,this._ultraMsgMap[h.messageUId]=h.timestamp;const p=n.channelId||"";let _=this._ultraGroupMap[`${p}_${e}`];return _?(_.latestMessage=l,nt(_.channelType)&&(l.channelType=_.channelType)):(_={conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e,channelId:p,unreadMessageCount:0,unreadMentionedCount:0,versionTime:l.sentTime,latestMessage:l,notificationStatus:exports.NotificationStatus.CLOSE,notificationLevel:exports.NotificationLevel.NOT_SET,isTop:!1},this._ultraGroupMap[`${p}_${e}`]=_,this._ultraGroupManager.addUltraGroupStatus(_)),this._watcher.conversation(Rt([_])),{code:u,data:l}}))}sendUltraGroupTypingStatus(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{conversationType:t,channelId:r,targetId:s}=e,o=this._connMgr.codec.encodeOperateStatus(s,t,r||"",n||0),i=new Fi(Jo[Jo.operate],o,s);i.setHeaderQos(zo.AT_LEAST_ONCE);const{code:a}=yield this._connMgr.send(i);return a!==exports.ErrorCode.SUCCESS?{code:a,msg:exports.ErrorCode[a]}:{code:a}}))}getUltraGroupMessageListByMessageUId(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};if(e.messages&&e.messages.length<1)return{code:exports.ErrorCode.MSG_LIMIT_ERROR};if(e.messages&&e.messages.length>20)return{code:exports.ErrorCode.MSG_LIMIT_ERROR};const t={};e.messages.forEach((e=>{t[e.messageUId]=void 0}));const n=this._connMgr.codec.encodeMsgQuery(e),r=new Gi(Jo[Jo.qryMsg],n,this.currentUserId);r.setHeaderQos(zo.AT_LEAST_ONCE);const{code:s,data:o}=yield this._connMgr.send(r,ms,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId});if(s!==exports.ErrorCode.SUCCESS)return{code:s,msg:exports.ErrorCode[s]};const{list:i}=o||{};return Array.isArray(i)&&i.forEach((e=>{const{messageUId:n}=e;t[n]=e})),{code:0,data:t}}))}_pullOperateStatusNotify(e){if(!this._isConnected)return;const t=this._connMgr.codec.decodeByPBName(e.pbData,vs),{conversationType:n,info:r,summary:s}=t;this.logger.debug(exports.LogTagId.O,`s_opNtf -> type: ${n}, info: ${r}, summary: ${s}`),this._watcher.operateStatus(t)}expandUltraMessage(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),n=new Gi(Jo[Jo.upMsgEx],t,e.targetId);n.setHeaderQos(zo.AT_LEAST_ONCE);const{code:r}=yield this._connMgr.send(n);return r!==exports.ErrorCode.SUCCESS?{code:r,msg:exports.ErrorCode[r]}:{code:r}}))}modifyMessage(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),n=new Gi(Jo[Jo.modifyMsg],t,e.targetId);n.setHeaderQos(zo.AT_LEAST_ONCE);const{code:r,data:s}=yield this._connMgr.send(n);if(r!==exports.ErrorCode.SUCCESS)return{code:r,msg:exports.ErrorCode[r]};const o=s;return this._ultraMsgMap[o.messageUId]=o.timestamp,{code:r}}))}_handleEventChangeList(e){const t={Group:{map:{},types:od},Friend:{map:{},types:id}},n=(e,t,n)=>{e[t]||(e[t]=[]),e[t].push(n)};e.forEach((e=>{const{changeType:r}=e;for(const s in t)if(t[s].types.includes(r)){n(t[s].map,r,e);break}}));const r={Group:this._processChangeMapGroup.bind(this),Friend:this._processChangeMapFriend.bind(this)};for(const e in t)Object.keys(t[e].map).length>0&&r[e](t[e].map)}_pullUltraChangeMessageList(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;if(this._isPullingUltraChangeMessage)return;this._isPullingUltraChangeMessage=!0;const t=this._connMgr.codec.encodeQueryMsgChange(e),n=new Gi(Jo[Jo.qryMsgChange],t,this.currentUserId);n.setHeaderQos(zo.AT_LEAST_ONCE);const{code:r,data:s}=yield this._connMgr.send(n,Rs);if(this._isPullingUltraChangeMessage=!1,r!==exports.ErrorCode.SUCCESS||!s)return;const{hasNext:o,list:i}=s,a=(null==s?void 0:s.syncTime)||0;this._handleUltraChangeList(i);const l=this._pullUltraChangeMessageQue.filter((e=>e>a));this._pullUltraChangeMessageQue.length=0,this._pullUltraChangeMessageQue.push(...l),o?this._pullUltraChangeMessageList(a):this._lastPullingUltraChangeMessageTime=a}))}_handleUltraChangeList(e){const t={};e.forEach((e=>{const{changeType:n}=e;t[n]||(t[n]=[]),t[n].push(e)}));const{CHANNEL_CHANGE:n,MSG_RECALL:r,MSG_EXPANSION:s,MSG_MODIFY:o,USER_GROUP_CHANGE:i}=q;t[n]&&this._handleUltraChannelChange(t[n]),t[r]&&this._handleMsgRecall(t[r]),t[s]&&this._handleMsgUpdate(t[s]),t[o]&&this._handleMsgUpdate(t[o]),t[i]&&this._handleUserGroupStatus(t[i])}_processChangeMapGroup(e){const{GROUP_OPERATION:t,GROUP_PROFILE_CHANGE:n,GROUP_APPLICATION_INVITATION:r,GROUP_FOLLOW_USER_CHANGE:s}=A;e[t]&&this._handleGroupOperation(e[t]),e[n]&&this._handleGroupProfileChange(e[n]),e[r]&&this._handleApplication(e[r]),e[s]&&this._handleFollowUserChange(e[s])}_processChangeMapFriend(e){(e[h.FRIEND_APPLICATION]||[]).forEach((e=>{var t,n,r,s,o,i,a,l,d,u;const{subChangeType:c,businessId:h,time:_,eventData:g}=e,{FRIEND_APPLY:E,FRIEND_REFUSE:I,FRIEND_USER_INFO:T,FRIENDS_INPUT:f,FRIEND_CLEAR:C,FRIEND_INFO_CHANGE:R,FRIEND_INFO_CHANGE_SYNC:S}=p;switch(c){case E:case I:{const e=c===E?exports.FriendApplicationStatus.UNHANDLED:exports.FriendApplicationStatus.REFUSED;null===(n=(t=this._watcher).friendApplicationStatusChanged)||void 0===n||n.call(t,{userId:h,applicationType:g.applyType,applicationStatus:e,directionType:g.friendType,operationTime:_,extra:g.info||""});break}case T:null===(s=(r=this._watcher).friendAdd)||void 0===s||s.call(r,{userId:h,name:g.name,portraitUri:g.portraitUrl,directionType:g.friendType,operationTime:_});break;case f:null===(i=(o=this._watcher).friendDelete)||void 0===i||i.call(o,{userIds:g.targetId,directionType:g.type,operationTime:_});break;case C:null===(l=(a=this._watcher).friendCleared)||void 0===l||l.call(a,_);break;case R:break;case S:null===(u=(d=this._watcher).friendInfoChangedSync)||void 0===u||u.call(d,{userId:h,remark:g.remarkname,extProfile:g.extProfile,operationTime:_})}}))}_handleGroupOperation(e){e.forEach((e=>{var t,n;const{subChangeType:r,businessId:s,time:o,eventData:i}=e,{optUserInfo:a,channelInfo:l,userInfos:d}=i;let u={groupId:s,operation:r,operationTime:o};a&&([u.operatorInfo]=Ut([a])),r===exports.GroupOperation.CREATE&&([u.groupInfo]=Nt([l])),[exports.GroupOperation.CREATE,exports.GroupOperation.DISMISS].includes(r)||(u.memberInfos=Ut(d)),null===(n=(t=this._watcher).groupOperation)||void 0===n||n.call(t,u)}))}_handleGroupProfileChange(e){e.forEach((e=>{var t,n,r,s,o,i;const{businessId:a,time:l,eventData:d,subChangeType:u,secondaryId:c}=e;switch(u){case R.GROUP_INFO_CHANGE:{const[e]=Ut([d.optUserInfo]),[r]=Ot([d.channelInfo]),[s]=d.channelFullInfo?Ot([d.channelFullInfo]):[void 0];null===(n=(t=this._watcher).groupInfoChanged)||void 0===n||n.call(t,{operatorInfo:e,groupInfo:r,changedGroupInfo:r,operationTime:l,fullGroupInfo:s});break}case R.MEMBER_PROFILE_CHANGE:{const[e]=Ut([d.optUserInfo]),t=Ut(d.userInfos)[0];null===(s=(r=this._watcher).groupMemberInfoChanged)||void 0===s||s.call(r,{groupId:a,operatorInfo:e,memberInfo:t,operationTime:l});break}case R.GROUP_REMARK_DELETE:case R.GROUP_REMARK_SET:{const e=u===R.GROUP_REMARK_SET?exports.GroupOperationType.ADD:exports.GroupOperationType.REMOVE;null===(i=(o=this._watcher).groupRemarkChangedSync)||void 0===i||i.call(o,{groupId:a,operationType:e,operationTime:l,groupRemark:c});break}}}))}_handleApplication(e){let t=[];e.forEach((e=>{const{eventData:n}=e,{statusInfo:r}=n;t=bt(r),t.forEach((e=>{var t,n;null===(n=(t=this._watcher).groupApplicationEvent)||void 0===n||n.call(t,e)}))}))}_handleFollowUserChange(e){e.forEach((e=>{var t,n;const{subChangeType:r,businessId:s,time:o,userGroupIds:i}=e,a=1===r?exports.GroupOperationType.ADD:exports.GroupOperationType.REMOVE;null===(n=(t=this._watcher).groupFollowsChangedSync)||void 0===n||n.call(t,{groupId:s,operationType:a,operationTime:o,userIds:i})}))}_handleUltraChannelChange(e){const t=[],n=[],r=[];e.forEach((e=>{const{subChangeType:s,targetId:o,channelId:i,sendTime:a,operatorId:l}=e,d=`${i}_${o}`,u=this._ultraGroupMap[d];if(!u)return;const{PUBLIC_TO_PRIVATE:c,PRIVATE_TO_PUBLIC:h,PUBLIC_TO_PRIVATE_USER_NOT_IN:p,CHANNEL_DELETE:_,CHANNEL_USER_KICKED:g}=Y;switch(s){case h:u.channelType=exports.UltraGroupChannelType.PUBLIC,t.push({targetId:o,channelId:i,changeType:exports.UltraGroupChannelChangeType.PRIVATE_TO_PUBLIC,channelType:u.channelType});break;case c:u.channelType=exports.UltraGroupChannelType.PRIVATE,t.push({targetId:o,channelId:i,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE,channelType:u.channelType});break;case p:t.push({targetId:o,channelId:i,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:u.channelType}),delete this._ultraGroupMap[d];break;case _:n.push({targetId:o,channelId:i,channelType:u.channelType,deleteTime:a}),delete this._ultraGroupMap[d];break;case g:r.push({targetId:o,channelId:i,userId:l,channelType:exports.UltraGroupChannelType.PRIVATE}),l===this.currentUserId&&delete this._ultraGroupMap[d]}})),t.length>0&&this._watcher.ultraGroupChannelChangeType(t),n.length>0&&this._watcher.ultraGroupChannelDelete(n),r.length>0&&this._watcher.ultraGroupChannelUserKicked(r)}_handleMsgRecall(e){const t=[];e.forEach((({targetId:e,channelId:n,messageUId:r,sendTime:s,conversationType:o,operatorId:i,mentionedType:a})=>{this._updateUltraGroupWhenRecallMsg(e,n,r,s,a),t.push({targetId:e,conversationType:o,sentTime:s,messageUId:r,senderUserId:i,channelId:n,content:{conversationType:o,targetId:e,messageUId:r,channelId:n},messageDirection:1,messageType:exports.MessageType.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:exports.ReceivedStatus.UNREAD,receivedStatusInfo:St(exports.ReceivedStatus.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(t)}_handleMsgUpdate(e){const t={};e.forEach((({targetId:e,conversationType:n,sendTime:r,messageUId:s,channelId:o})=>{const i=`${n}_${e}`;t[i]||(t[i]=[]),t[i].push({messageUId:s,channelId:o,sendTime:r})}));for(const n in t){const r=n.split("_"),s=r.shift(),o=r.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:o,conversationType:Number(s),messages:[...t[n]]})}}_pullUltraMessageList(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeMsgQuery(n),r=new Gi(Jo[Jo.qryMsg],t,this.currentUserId);r.setHeaderQos(zo.AT_LEAST_ONCE);const{code:s,data:o}=yield this._connMgr.send(r,ms,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId});if(s!==exports.ErrorCode.SUCCESS)return{code:s,msg:exports.ErrorCode[s]};const{list:i}=o||{},a=[];Array.isArray(i)&&i.forEach((e=>{const{targetId:t,channelId:n,messageUId:r}=e,s=this._ultraGroupMap[`${n}_${t}`];s&&s.latestMessage.messageUId===r&&(s.latestMessage=e),a.push(e)})),e===q.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(a),e===q.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(a)}))}_handleUserGroupStatus(e){return t(this,void 0,void 0,(function*(){const{REMOVE_USER_GROUP:t,JOIN_USER_GROUP:n,EXIT_USER_GROUP:r,CHANNEL_BIND_USER_GROUP:s,CHANNEL_UNBIND_USER_GROUP:o}=K,i=[],a=[],l=[],d=[],u=[];e.forEach((e=>{const{conversationType:c,targetId:h,userGroupIds:p,busChannelType:_,channelId:g}=e;switch(e.subChangeType){case t:i.push({conversation:{conversationType:c,targetId:h},userGroupIds:p});break;case n:a.push({conversation:{conversationType:c,targetId:h},userGroupIds:p});break;case r:l.push({conversation:{conversationType:c,targetId:h},userGroupIds:p});break;case s:d.push({conversation:{conversationType:c,targetId:h,channelId:g},channelType:_,userGroupIds:p});break;case o:u.push({conversation:{conversationType:c,targetId:h,channelId:g},channelType:_,userGroupIds:p})}}));const c={};i.length>0&&(c.userGroupDisband=i),a.length>0&&(c.userAdded=a),l.length>0&&(c.userRemoved=l),d.length>0&&(c.userGroupBindChannel=d),u.length>0&&(c.userGroupUnBindChannel=u),this._watcher.userGroupStatus(c)}))}getUltraHistoryMsg(e,n,r){var s;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeGetHistoryMsg(e,n),o=new Gi(Jo[Jo.qryUgMsg],t,this.currentUserId);this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:exports.ConversationType.ULTRA_GROUP,channelId:n.channelId,timestamp:null==n?void 0:n.timestamp,count:null==n?void 0:n.count}),r);const{code:i,data:a}=yield this._connMgr.send(o,Pr,{currentUserId:this.currentUserId,conversation:{conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e}});if(i!==exports.ErrorCode.SUCCESS||!a)return this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:i,messageUIds:""}),r),{code:i};const l=[];return null===(s=a.list)||void 0===s||s.forEach((e=>{e&&l.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:i,messageUIds:l.join(",")}),r),{code:i,data:a}}))}setUltraGroupDefaultNotificationLevel(e,n,r){return t(this,void 0,void 0,(function*(){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(n,r),s=new Gi(Jo[Jo.ugUnpushSet],t,e),o=yield this._connMgr.send(s),{code:i}=o;return exports.ErrorCode.SUCCESS,{code:i}}))}getUltraGroupDefaultNotificationLevel(e,n){return t(this,void 0,void 0,(function*(){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,r=t.codec.encodeGetUltraGroupDefaultNotificationLevel(n),s=new Gi(Jo[Jo.ugUnpushQuery],r,e),o=yield t.send(s,ss),{code:i,data:a}=o;if(i!==exports.ErrorCode.SUCCESS||!a)return{code:i};const{unpushLevel:l}=a;return{code:i,data:l}}))}_updateUltraGroupWhenRecallMsg(e,t,n,r,s){const o=`${t}_${e}`;if(!this._ultraGroupMap[o])return;const i=this._ultraGroupMap[o],{latestMessage:a,lastReadTime:l}=i;a&&a.messageUId===n&&(i.latestMessage=null),r&&l<r&&i.unreadMessageCount>0&&(--i.unreadMessageCount,(s===j.ALL||s===j.ME)&&i.unreadMentionedCount>0&&--i.unreadMentionedCount,s===j.ME&&i.unreadMentionedCount>0&&--i.unreadMentionedMeCount,this._watcher.conversation(Rt([i])))}getAllConversationState(){return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:this._conversationManager.getAllConversationState()})}getUltraGroupUnreadMentionedMessages(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});const t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Gi(Jo[Jo.qryUgUal],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,Ar);return r===exports.ErrorCode.SUCCESS&&s?{code:r,data:s}:{code:r}}))}getUltraGroupFirstUnreadMessageTimestamp(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});const{targetId:t,channelId:n}=e,r=(this._ultraGroupMap[`${n}_${t}`]||{}).firstUnreadMessage||null;return{code:exports.ErrorCode.SUCCESS,data:r}}))}subscribeUser(e,n,r){return t(this,void 0,void 0,(function*(){return this._isConnected?this._subscribeManager.updateSubscribeRelation(e,n,exports.SubscribeOperationType.SUBSCRIBE,r):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}unSubscribeUser(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const{code:t}=yield this._subscribeManager.updateSubscribeRelation(e,n,exports.SubscribeOperationType.UNSUBSCRIBE);return{code:t}}))}getSubscribeUserList(e,n,r){var s;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=null===(s=this._subscribeManager)||void 0===s?void 0:s.getSubscribeUserList(e,n,r);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})}))}getSubscribeUserStatus(e,n){var r;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=null===(r=this._subscribeManager)||void 0===r?void 0:r.getSubscribeUserStatus(e,n);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})}))}updateMyUserProfile(e){var r;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=Mo.encode(Ks,n(this,zl,"m",ed).call(this,e)),s=yield this._connMgr.query(Jo.updUserProfile,this.currentUserId,t,Qs);if(s.isOk){const{version:t}=s.data;return null===(r=this._subscribeManager)||void 0===r||r.updateOwnProfile(e,t),s.wipe()}const o=s.data.censorFailedFields;return Je(s.code,"",o&&0!==o.length?{errorKeys:o,errorKey:o[0]}:void 0)}))}getMyUserProfile(){return this._isConnected?this._subscribeManager.getOwnProfile():Promise.resolve({code:exports.ErrorCode.RC_NET_UNAVAILABLE})}getUserProfiles(e){return t(this,void 0,void 0,(function*(){return this._isConnected?this._subscribeManager.getUserProfiles(e):{code:exports.ErrorCode.RC_NET_UNAVAILABLE}}))}updateMyUserProfileVisibility(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeUserProfilePermission(e),n=new Gi(Jo[Jo.updProfilePermiss],t,this.currentUserId),{code:r}=yield this._connMgr.send(n);return{code:r}}))}getMyUserProfileVisibility(){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const e=this._connMgr.codec.encodeUserProfileInput(),t=new Gi(Jo[Jo.qProfilePermiss],e,this.currentUserId),{code:n,data:r}=yield this._connMgr.send(t,Xs);return n!==exports.ErrorCode.SUCCESS?{code:n}:{code:n,data:null==r?void 0:r.permission}}))}searchUserProfileByUniqueId(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeSearchUserProfile(e),n=new Gi(Jo[Jo.searchUserProfile],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,Ks);if(r!==exports.ErrorCode.SUCCESS||!s)return{code:r};return{code:r,data:yt(s.userId,s.userProfile,s.userExtProfile)}}))}bindRTCRoomForChatroom(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return exports.ErrorCode.RC_NET_UNAVAILABLE;const{chatRoomId:t}=e,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),r=new Gi(Jo[Jo.setRtcRoomId],n,t),s=yield this._connMgr.send(r),{code:o}=s;return o}))}rtcSignaling(e,n,r,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:exports.ErrorCode.RC_NET_UNAVAILABLE};const t=r?new Gi(n,s,e):new Fi(n,s,e),{code:o,data:i}=yield this._connMgr.send(t);return{code:o,buffer:i instanceof Bi||null==i?void 0:i.pbData}}))}rtcPing(e,n,r){return t(this,void 0,void 0,(function*(){const t=Wo(this.rtcCodec,n,r),{code:s,buffer:o}=yield this.rtcSignaling(e,Jo[Jo.rtcPing],!0,t);if(s!==exports.ErrorCode.SUCCESS)return{code:s};const i=this.rtcCodec.decode(Ko.RtcOutput,o);return i.version=gt(i.version),{code:s,data:i}}))}getDeviceId(){return Ra()}getOSInfo(){return t(this,void 0,void 0,(function*(){return{code:exports.ErrorCode.NOT_SUPPORT}}))}getProcessInfo(){return t(this,void 0,void 0,(function*(){return{code:exports.ErrorCode.NOT_SUPPORT}}))}getMainProcessInfo(){return t(this,void 0,void 0,(function*(){return{code:exports.ErrorCode.NOT_SUPPORT}}))}destroy(){t(void 0,void 0,void 0,(function*(){if(!Rl)return;Nl&&(clearTimeout(Nl),Nl=null);const e=yield Rl;if(e){const{db:t}=e;Ll.push(t)}Rl=null}))}callExtra(e,...t){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}setProxy(e){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}getProxy(){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}testProxy(e,t){return Promise.resolve({status:exports.ErrorCode.NOT_SUPPORT})}setNetwork(e,t){var n;if(this._connMgr.setNetwork(e,t),e.status&&this.cloudControllerUri){const e=this._connMgr.getToken();null===(n=this.cloudController)||void 0===n||n.request(this.cloudControllerUri,en.newWorkChange,e)}}createGroup(e,n,r,s){return t(this,void 0,void 0,(function*(){const t=al(e,n,r,s),o=yield this._connMgr.query(Jo.channelCreate,e,t,eo);if(!o.data)return o.wipe();const i={errorKeys:o.data.censorFailedFields,processCode:o.data.processCode||0};return o.isOk?$e():Je(o.code,o.msg,i)}))}updateGroupInfo(e,n,r){return t(this,void 0,void 0,(function*(){const t=al(e,n,r),s=yield this._connMgr.query(Jo.upChannelInfo,e,t,eo);return s.data?s.isOk?$e():Je(s.code,s.msg,{errorKeys:s.data.censorFailedFields}):s.wipe()}))}getGroupsInfo(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeMultiChannels(e),n=new Gi(Jo[Jo.qChannelInfo],t,e[0]),{code:r,data:s}=yield this._connMgr.send(n,io);if(r!==exports.ErrorCode.SUCCESS||!s)return{code:r};const{list:o=[]}=s.result;return{code:r,data:Nt(o)}}))}kickGroupMembers(e,n,r){var s;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("kick",e,n,!0,r),o=new Gi(Jo[Jo.channelMemKick],t,e),{code:i,data:a}=yield this._connMgr.send(o,eo);return i!==exports.ErrorCode.SUCCESS?{code:i,msg:null!==(s=null==a?void 0:a.msg)&&void 0!==s?s:""}:{code:i}}))}quitGroup(e,n){var r;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("quit",e,[],!0,n),s=new Gi(Jo[Jo.channelMemQuit],t,e),{code:o,data:i}=yield this._connMgr.send(s,eo);return o!==exports.ErrorCode.SUCCESS?{code:o,msg:null!==(r=null==i?void 0:i.msg)&&void 0!==r?r:""}:{code:o}}))}dismissGroup(e){var n;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("dismiss",e),r=new Gi(Jo[Jo.channelDismiss],t,e),{code:s,data:o}=yield this._connMgr.send(r,eo);return s!==exports.ErrorCode.SUCCESS?{code:s,msg:null!==(n=null==o?void 0:o.msg)&&void 0!==n?n:""}:{code:s}}))}transferGroupOwner(e,n,r,s){var o;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("transfer",e,[n],r,s),i=new Gi(Jo[Jo.channelTransfer],t,e),{code:a,data:l}=yield this._connMgr.send(i,eo);return a!==exports.ErrorCode.SUCCESS?{code:a,msg:null!==(o=null==l?void 0:l.msg)&&void 0!==o?o:""}:{code:a}}))}setGroupManagers(e,n,r){var s;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeModifyChannelsInput(e,n,r),o=new Gi(Jo[Jo.upChannelManager],t,n),{code:i,data:a}=yield this._connMgr.send(o,eo);return i!==exports.ErrorCode.SUCCESS?{code:i,msg:null!==(s=null==a?void 0:a.msg)&&void 0!==s?s:""}:{code:i}}))}getGroupMembersByRole(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupMembersByRole",groupId:e,option:r,roleType:n}),s=new Gi(Jo[Jo.qChannelMem],t,e),{code:o,data:i}=yield this._connMgr.send(s,io);if(o!==exports.ErrorCode.SUCCESS||!i)return{code:o};const{result:a,page:l}=i,{pageToken:d,hasNext:u}=l||{};let c=[];return c=Ut(a.list),{code:o,data:{data:c,pageToken:u&&d?d:""}}}))}getGroupMembers(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupMembers",groupId:e,ids:n}),r=new Gi(Jo[Jo.qChannelSpeMem],t,e),{code:s,data:o}=yield this._connMgr.send(r,io);if(s!==exports.ErrorCode.SUCCESS)return{code:s};if(!o)return{code:s,data:[]};const{result:i}=o;let a=[];return a=Ut(i.list),{code:s,data:a}}))}setGroupMemberInfo(e,n,r,s){return t(this,void 0,void 0,(function*(){const t=Mo.encode(ao,{targetId:e,type:exports.ConversationType.GROUP,userId:n,channelNickName:r,additional:s}),o=yield this._connMgr.query(Jo.upChannelMem,e,t,eo);return o.data?o.isOk?$e():Je(o.code,o.msg,{errorKeys:o.data.censorFailedFields}):o.wipe()}))}searchGroupMembers(e,t,n){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}joinGroup(e){var n;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeJoinGroup("join",e),r=new Gi(Jo[Jo.channelMemJoin],t,e),{code:s,data:o}=yield this._connMgr.send(r,eo);return{code:s,data:{processCode:null!==(n=null==o?void 0:o.processCode)&&void 0!==n?n:0}}}))}inviteUsersToGroup(e,n){var r,s;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeJoinGroup("invite",e,n),o=new Gi(Jo[Jo.channelMemInvite],t,e),{code:i,data:a}=yield this._connMgr.send(o,eo);return i!==exports.ErrorCode.SUCCESS?{code:i,msg:null!==(r=null==a?void 0:a.msg)&&void 0!==r?r:""}:{code:i,data:{processCode:null!==(s=null==a?void 0:a.processCode)&&void 0!==s?s:0}}}))}memberInviteResponse(e){var n,r;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeMemberResponseInput(e),s=new Gi(Jo[Jo.channelApplyResp],t,e.groupId),{code:o,data:i}=yield this._connMgr.send(s,eo);return o!==exports.ErrorCode.SUCCESS?{code:o,msg:null!==(n=null==i?void 0:i.msg)&&void 0!==n?n:""}:{code:o,data:{processCode:null!==(r=null==i?void 0:i.processCode)&&void 0!==r?r:0}}}))}getGroupApplications(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupApplications",option:e}),n=new Gi(Jo[Jo.qChannelApplyList],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,io);if(r!==exports.ErrorCode.SUCCESS||!s)return{code:r};const{result:o,page:i}=s;let{pageToken:a,hasNext:l}=i||{};return{code:r,data:{data:bt(null==o?void 0:o.list)||[],pageToken:l&&a?a:""}}}))}getJoinedGroupsByRole(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getJoinedGroupsByRole",option:n,roleType:e}),r=new Gi(Jo[Jo.qChannelMemJoin],t,this.currentUserId),{code:s,data:o}=yield this._connMgr.send(r,io);if(s!==exports.ErrorCode.SUCCESS||!o)return{code:s};const{result:i,page:a}=o;let{pageToken:l,hasNext:d}=a||{};return{code:s,data:{data:Nt(i.list),pageToken:d&&l?l:""}}}))}searchJoinedGroups(e,t){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}getJoinedGroups(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getJoinedGroups",ids:e}),n=new Gi(Jo[Jo.qChannelMemSpeJoin],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,io);if(r!==exports.ErrorCode.SUCCESS||!s)return{code:r};const{list:o}=s.result;return{code:r,data:Nt(o)}}))}setGroupRemark(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeSetGroupRemark(e,n),r=new Gi(Jo[Jo.upChannelRemark],t,e),{code:s}=yield this._connMgr.send(r);return{code:s}}))}setGroupFollows(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeSetGroupFollows(e,n,r),s=new Gi(Jo[Jo.upChannelFollow],t,n),{code:o}=yield this._connMgr.send(s);return{code:o}}))}getGroupFollows(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupFollows",groupId:e}),n=new Gi(Jo[Jo.qChannelFollow],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,io);if(r!==exports.ErrorCode.SUCCESS||!s)return{code:r};const{result:o}=s;return{code:r,data:o.list.map((e=>{const{userId:t,opTime:n}=e;return{userId:t,time:gt(n)}}))}}))}addFriend(e,n,r){var s;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendInput({targetId:e,type:n,info:r}),o=new Gi(Jo[Jo.friendAdd],t,this.currentUserId),{code:i,data:a}=yield this._connMgr.send(o,eo);return i===exports.ErrorCode.SUCCESS&&a?{code:i,data:{processCode:null!==(s=null==a?void 0:a.processCode)&&void 0!==s?s:0}}:{code:i}}))}deleteFriends(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendsInput(e,n),r=new Gi(Jo[Jo.friendDel],t,this.currentUserId),{code:s}=yield this._connMgr.send(r);return{code:s}}))}acceptFriendApplication(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendInput({targetId:e,type:1}),n=new Gi(Jo[Jo.friendHandle],t,this.currentUserId),{code:r}=yield this._connMgr.send(n);return{code:r}}))}refuseFriendApplication(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendInput({targetId:e,type:2,info:n}),r=new Gi(Jo[Jo.friendHandle],t,this.currentUserId),{code:s}=yield this._connMgr.send(r);return{code:s}}))}setFriendInfo(e,n,r){return t(this,void 0,void 0,(function*(){const t=Mo.encode(_o,{targetId:e,remarkName:n,extProfile:il(r)}),s=yield this._connMgr.query(Jo.friendSetPf,this.currentUserId,t,go);return s.isOk?s.wipe():Je(s.code,"",{errorKeys:s.data.censorFailedFields})}))}checkFriends(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendsInput(e,n),r=new Gi(Jo[Jo.friendCheck],t,this.currentUserId),{code:s,data:o}=yield this._connMgr.send(r,po);if(s!==exports.ErrorCode.SUCCESS)return{code:s};if(!o)return{code:s,data:[]};return{code:s,data:o.list.map((e=>({userId:e.targetId,relationType:e.status})))}}))}getFriends(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendQueryInput(11,n,e),r=new Gi(Jo[Jo.friendsQuery],t,this.currentUserId),{code:s,data:o}=yield this._connMgr.send(r,io);if(s!==exports.ErrorCode.SUCCESS||!o)return{code:s};const{result:i,page:a}=o,{pageToken:l,hasNext:d}=a||{};return i&&i.list?{code:s,data:{data:ud(i.list),pageToken:d&&l?l:""}}:{code:s,data:{data:[],pageToken:d&&l?l:""}}}))}getFriendApplications(e,n,r){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendQueryInput(12,e),n=new Gi(Jo[Jo.friendsQuery],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,io);if(r!==exports.ErrorCode.SUCCESS)return{code:r};if(!s)return{code:r,data:{data:[],pageToken:""}};const{result:o,page:i}=s,{pageToken:a,hasNext:l}=i||{};return{code:r,data:{data:cd(o),pageToken:l&&a?a:""}}}))}deleteFriendApplication(e,n){return t(this,void 0,void 0,(function*(){return{code:exports.ErrorCode.NOT_SUPPORT}}))}getFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendsListInput(e),n=new Gi(Jo[Jo.friendsInfoQry],t,this.currentUserId),{code:r,data:s}=yield this._connMgr.send(n,fo);return r!==exports.ErrorCode.SUCCESS?{code:r}:s?{code:r,data:ud(s.list)}:{code:r,data:[]}}))}searchFriendsInfo(e){return t(this,void 0,void 0,(function*(){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}))}setFriendAddPermission(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendLevelSet(e),n=new Gi(Jo[Jo.friendAuthSet],t,this.currentUserId),{code:r}=yield this._connMgr.send(n);return{code:r}}))}getFriendAddPermission(){return t(this,void 0,void 0,(function*(){const e=this._connMgr.codec.encodeFriendInput({targetId:this.currentUserId}),t=new Gi(Jo.friendAuthGet,e,this.currentUserId),{code:n,data:r}=yield this._connMgr.send(t,To);return n===exports.ErrorCode.SUCCESS&&r?{code:n,data:r}:{code:n}}))}getConversationListWithAllChannel(){throw new Error("Method not implemented.")}getConversationListWithAllChannelByPage(e,t){throw new Error("Method not implemented.")}getConversationsByPage(e,t,n,r,s){throw new Error("Method not implemented.")}getContinuousMessages(e,t,n,r,s,o){throw new Error("Method not implemented.")}getHistoryMessagesByObjectNames(e,t,n,r,s,o,i){throw new Error("Method not implemented.")}clearConversations(){throw new Error("Method not implemented.")}setUserStatusListener(e,t){throw new Error("Method not implemented.")}setUserStatus(e){throw new Error("Method not implemented.")}subscribeUserStatus(e){throw new Error("Method not implemented.")}getUserStatus(e){throw new Error("Method not implemented.")}addToBlacklist(e){return Promise.resolve(exports.ErrorCode.NOT_SUPPORT)}removeFromBlacklist(e){return Promise.resolve(exports.ErrorCode.NOT_SUPPORT)}getBlacklist(){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}getBlacklistStatus(e){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})}insertMessage(e,t,n){throw new Error("Method not implemented.")}batchInsertMessage(e,t){throw new Error("Method not implemented.")}getMessageCount(e,t,n){throw new Error("Method not implemented.")}deleteMessages(e){throw new Error("Method not implemented.")}deleteMessagesByTimestamp(e,t,n,r,s){throw new Error("Method not implemented.")}batchClearMessagesByTimestamp(e){throw new Error("Method not implemented.")}clearMessages(e,t,n){throw new Error("Method not implemented.")}getMessage(e){return t(this,void 0,void 0,(function*(){return Je(exports.ErrorCode.NOT_SUPPORT,"Not support")}))}setMessageContent(e,t,n){throw new Error("Method not implemented.")}setMessageSearchField(e,t,n){throw new Error("Method not implemented.")}searchConversationByContent(e,t,n,r){throw new Error("Method not implemented.")}searchConversationByContentWithAllChannel(e,t,n){throw new Error("Method not implemented.")}searchMessageByContent(e,t,n,r,s,o){throw new Error("Method not implemented.")}searchMessageByContentAndMessageType(e,t,n,r,s,o,i){throw new Error("Method not implemented.")}searchMessagesByUser(e,t,n,r,s,o){throw new Error("Method not implemented.")}getMessagesByTimestamp(e,t,n,r){throw new Error("Method not implemented.")}searchMessageByContentWithAllChannel(e,t,n,r,s){throw new Error("Method not implemented.")}searchMessageByContentInTimeRangeWithAllChannel(e,t,n,r,s,o,i){throw new Error("Method not implemented.")}getUnreadMentionedMessages(e,t){throw new Error("Method not implemented.")}setMessageSentStatus(e,t){throw new Error("Method not implemented.")}updateMessageReceiptStatus(e,t,n,r){throw new Error("Method not implemented.")}setMessageReceivedStatus(e,t){throw new Error("Method not implemented.")}clearData(){throw new Error("Method not implemented.")}clearUnreadCountByTimestamp(e,t,n,r){throw new Error("Method not implemented.")}setCallInfo(e,n,r){return t(this,void 0,void 0,(function*(){const{_connMgr:t}=this;if(t){const s=t.codec.encodeSetCallInfo(n,r),o=yield t.send(new Gi(Jo.reqCall,s,e),Ns),{code:i}=o;let a=o.data;return i===exports.ErrorCode.SUCCESS&&a?Promise.resolve({code:i,data:{key:a.key,value:a.dataContent}}):Promise.resolve({code:i})}return Promise.resolve({code:exports.ErrorCode.RC_NET_CHANNEL_INVALID})}))}getGroupMessageDeliverList(e,t,n){throw new Error("Method not implemented.")}getPrivateMessageDeliverTime(e,t){throw new Error("Method not implemented.")}setCheckDuplicateMessage(e){throw new Error("Method not implemented.")}setCheckChatRoomDuplicateMessage(e){throw new Error("Method not implemented.")}getConversations(e){throw new Error("Method not implemented.")}getRealtimeConversations(e,n,r){return t(this,void 0,void 0,(function*(){const{currentUserId:t,_connMgr:s}=this,o=exports.ConversationType.PRIVATE,i=s.codec.encodeOldConversationList({count:e,type:o,startTime:n,order:r}),a=new Gi(Jo.qrySessions,i,t),l=yield s.send(a,yr,{currentUserId:t,connectedTime:s.getConnectedTime(),afterDecode:e=>{const{conversationType:t,targetId:n,channelId:r,unreadMessageCount:s}=e,o=this._conversationManager.get(t,n,r);Object.assign(e,o,{unreadMessageCount:s});const i=this._conversationManager.getDraft(t,n,r);return e.draft=i,e}}),{code:d,data:u}=l;return d!==exports.ErrorCode.SUCCESS?{code:d}:{code:d,data:null==u?void 0:u.list.sort(((e,t)=>{var n,s;const o=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0,i=(null===(s=t.latestMessage)||void 0===s?void 0:s.sentTime)||0;return 0===r?i-o:o-i}))}}))}getRealtimeConTotalUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this._connMgr.codec.encodeSessionAttInput(),t=new Gi(Jo.qrySessionsAtt,e,this.getCurrentUserId()),{code:n,data:r}=yield this._connMgr.send(t,xr);return{code:n,data:(null==r?void 0:r.totalUnreadCount)||0}}))}clearRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:n}=e;this._conversationManager.clearUnreadCount(t,n,"",this.getServerTime(),!1);const r=this._connMgr.codec.encodeSessionMsgReadInput(e,this.getServerTime()),s=new Fi(Jo[Jo.updRRTime],r,this.currentUserId),{code:o}=yield this._connMgr.send(s);return{code:o}}))}removeRealtimeConversations(e){return t(this,void 0,void 0,(function*(){const{_connMgr:t}=this,n=new Gi(Jo.delSessions,t.codec.encodeRemoveConversationList(e),this.getCurrentUserId()),{code:r}=yield t.send(n);return{code:r}}))}getRealtimeConUnreadCounts(e){var n,r;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuerySessionsInput(e),s=new Gi(Jo[Jo.qrySessionsUnread],t,this.currentUserId),o=yield this._connMgr.send(s,Fr);return o.code===exports.ErrorCode.SUCCESS&&o.data?{code:o.code,data:null===(r=null===(n=o.data)||void 0===n?void 0:n.sessions)||void 0===r?void 0:r.map((e=>({conversationType:e.type,targetId:e.channelId,channelId:e.busChannel||"",unreadCount:gt(e.unreadCount)})))}:{code:o.code}}))}setNotificationQuietHoursWithSetting(e){return t(this,void 0,void 0,(function*(){const t=Mo.encode(Co,e);return(yield this._connMgr.query(Jo.addUnpush,this.currentUserId,t)).wipe()}))}removeNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Mo.encode(Ro,{nothing:0});return(yield this._connMgr.query(Jo.delUnpush,this.currentUserId,e)).wipe()}))}getNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Mo.encode(So,{nothing:0});return(yield this._connMgr.query(Jo.qryUnpush,this.currentUserId,e,mo)).trans((({isUnpush:e,spanMinutes:t,startTime:n,level:r,timezone:s})=>e?{spanMinutes:t,startTime:n,level:r,timezone:s}:{spanMinutes:0,startTime:"",level:exports.PushNotificationQuietHoursLevel.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT}))}))}}zl=new WeakSet,ed=function(e){const t={},{extraProfile:n}=e;return n&&(delete e.extraProfile,t.userExtProfile=il(n)),t.userProfile=il(e),t},e([ld()],hd.prototype,"createGroup",null),e([ld()],hd.prototype,"updateGroupInfo",null),e([ld()],hd.prototype,"getGroupsInfo",null),e([ld()],hd.prototype,"kickGroupMembers",null),e([ld()],hd.prototype,"quitGroup",null),e([ld()],hd.prototype,"dismissGroup",null),e([ld()],hd.prototype,"transferGroupOwner",null),e([ld()],hd.prototype,"setGroupManagers",null),e([ld()],hd.prototype,"getGroupMembersByRole",null),e([ld()],hd.prototype,"getGroupMembers",null),e([ld()],hd.prototype,"setGroupMemberInfo",null),e([ld()],hd.prototype,"joinGroup",null),e([ld()],hd.prototype,"inviteUsersToGroup",null),e([ld()],hd.prototype,"memberInviteResponse",null),e([ld()],hd.prototype,"getGroupApplications",null),e([ld()],hd.prototype,"getJoinedGroupsByRole",null),e([ld()],hd.prototype,"getJoinedGroups",null),e([ld()],hd.prototype,"setGroupRemark",null),e([ld()],hd.prototype,"setGroupFollows",null),e([ld()],hd.prototype,"getGroupFollows",null),e([ld()],hd.prototype,"addFriend",null),e([ld()],hd.prototype,"deleteFriends",null),e([ld()],hd.prototype,"acceptFriendApplication",null),e([ld()],hd.prototype,"refuseFriendApplication",null),e([ld()],hd.prototype,"setFriendInfo",null),e([ld()],hd.prototype,"checkFriends",null),e([ld()],hd.prototype,"getFriends",null),e([ld()],hd.prototype,"getFriendApplications",null),e([ld()],hd.prototype,"deleteFriendApplication",null),e([ld()],hd.prototype,"getFriendsInfo",null),e([ld()],hd.prototype,"searchFriendsInfo",null),e([ld()],hd.prototype,"setFriendAddPermission",null),e([ld()],hd.prototype,"getFriendAddPermission",null),e([ld()],hd.prototype,"getRealtimeConversations",null),e([ld()],hd.prototype,"getRealtimeConTotalUnreadCount",null),e([ld()],hd.prototype,"clearRealtimeConUnreadCount",null),e([ld()],hd.prototype,"removeRealtimeConversations",null),e([ld()],hd.prototype,"getRealtimeConUnreadCounts",null),e([dd()],hd.prototype,"setNotificationQuietHoursWithSetting",null),e([dd()],hd.prototype,"removeNotificationQuietHoursSetting",null),e([dd()],hd.prototype,"getNotificationQuietHoursSetting",null),exports.AEngine=ji,exports.APIContext=Ea,exports.AppStorage=Ca,exports.BasicLogger=Xt,exports.Codec=Yo,exports.EventEmitter=qo,exports.MAX_MESSAGE_CONTENT_BYTES=Re,exports.MAX_UPLOAD_FILE_SIZE=5368709120,exports.PBCodec=lr,exports.PluginContext=zi,exports.RCResult=We,exports.RTCPluginContext=ea,exports.SEND_MESSAGE_TYPE_OPTION=Se,exports.SuspendablePromise=Qe,exports.UPLOAD_FILE_CHUNK_SIZE=10485760,exports.UUId=He,exports.Validator=Xe,exports.ValidatorManage=class{constructor(e,t){var n,r;this._logTagT=e,this._logTagR=t,this.verificationFaileList=[],this.context=Ea.getContext(),this.logger=null===(n=this.context)||void 0===n?void 0:n.logger,this.option=null===(r=this.context)||void 0===r?void 0:r.getOptions()}validate(e,t,n,r=!1,s){if(this.verificationFaileList.length>0)return this;n=Ji[n]||n;const o=r?n(t):lt(t)||null==t||n(t);if("object"==typeof o){const{valid:e,errorKey:n}=o;return!e&&n&&this.verificationFaileList.push({key:n,value:t,isValid:!1,message:s,code:Wi[n]}),this}return o||this.verificationFaileList.push({key:e,value:t,isValid:o,message:s,code:Wi[e]}),this}validateParameters(e,t,n,r,s=!1,o){if(this.verificationFaileList.length>0)return this;n=Ji[n]||n;const i=s?n(t):lt(t)||null==t||n(t);if("object"==typeof i){const{valid:e,errorKey:n,errorCode:s}=i;return!e&&n&&this.verificationFaileList.push({key:n,value:t,code:s||r,message:o,isValid:!1}),this}return i||this.verificationFaileList.push({key:e,value:t,code:r,message:o,isValid:!1}),this}_getValidationResult(){if(this.verificationFaileList.length>0)return this.verificationFaileList[0]}ifReady(e){var t;if(!this.context)return Promise.resolve({code:exports.ErrorCode.BIZ_ERROR_CLIENT_NOT_INIT});const n=this._getValidationResult();if(n){const{code:e,value:r,message:s,key:o}=n;return null===(t=this.logger)||void 0===t||t.error(this._logTagR,JSON.stringify({code:e})),Promise.resolve({code:e,msg:`'${o}' is invalid: ${s||JSON.stringify(r)}`})}const r=this.logger.createTraceId();return e(this.context,this.logger,this.option,r)}try2do(e){if(!this.context)throw new Error("Not initialized yet!");return e(this.context,this.logger,this.option)}ifReadySync(e){var t;if(!this.context)return{code:exports.ErrorCode.BIZ_ERROR_CLIENT_NOT_INIT};const n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);const{code:r,value:s,message:o,key:i}=n;return null===(t=this.logger)||void 0===t||t.warn(this._logTagR,JSON.stringify({code:r})),{code:r,msg:`'${i}' is invalid: ${o||s}`}}},exports.VersionManage=ke,exports.assert=(e,t,n,r=!1)=>{if(!Zi(e,t,n,r))throw new Xi(`'${e}' is invalid: ${JSON.stringify(t)}`)},exports.fail=Je,exports.fixUrlProtocol=kt,exports.forEach=Et,exports.getUUID=()=>He.gen(),exports.getUUID22=()=>He.genWithLen(22),exports.httpRequest=qt,exports.isArray=rt,exports.isBoolean=e=>"boolean"==typeof e,exports.isFunction=at,exports.isHttpUrl=dt,exports.isInteger=e=>t=>Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max),exports.isLimitedArray=e=>t=>{if(!rt(t)||void 0!==e.minLength&&t.length<e.minLength||void 0!==e.maxLength&&t.length>e.maxLength)return!1;if(!e.itemValidator)return!0;let n=!0;return t.every((t=>{const r=e.itemValidator&&e.itemValidator(t);return"object"==typeof r?r.errorKey?(n={errorKey:r.errorKey,valid:r.valid},!1):(n=r.valid,r.valid):(n=!!r,r)})),n},exports.isLimitedString=st,exports.isNull=e=>"[object Null]"===Object.prototype.toString.call(e),exports.isNumber=nt,exports.isObject=it,exports.isString=et,exports.isUndefined=lt,exports.isValidConversation=(e,t)=>{let n;return it(e)?(t&&!t.includes(e.conversationType)&&(n="conversationTypeNotSupport"),pt(e.targetId)||(n="targetId"),ct(e.conversationType)||(n="conversationType"),lt(e.channelId)||ht(e.channelId)||(n="channelId"),lt(n)?{valid:!0}:{valid:lt(n),errorKey:n}):{valid:!1,errorKey:"conversation"}},exports.isValidConversationType=ct,exports.isValidEnum=e=>Object.values(e.type).includes(e.value),exports.isValidFileType=e=>nt(e)&&Object.prototype.hasOwnProperty.call(exports.FileType,e),exports.isValidGroupId=e=>st({minLength:1,maxLength:64})(e)&&/^[a-zA-Z0-9+=\-_|:]*$/.test(e),exports.isValidNotificationLevel=e=>nt(e)&&Object.prototype.hasOwnProperty.call(exports.NotificationLevel,e),exports.isValidTargetId=pt,exports.logger=Ho,exports.map=It,exports.notEmptyArray=e=>rt(e)&&e.length>0,exports.notEmptyObject=ut,exports.notEmptyString=ot,exports.ok=$e,exports.runtime=rr,exports.transformReceivedStatusFlag=e=>{let t=exports.ReceivedStatus.UNREAD;return(null==e?void 0:e.isRead)&&(t|=exports.ReceivedStatus.READ),(null==e?void 0:e.isListened)&&(t|=exports.ReceivedStatus.LISTENED),(null==e?void 0:e.isDownload)&&(t|=exports.ReceivedStatus.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=exports.ReceivedStatus.RETRIEVED),t},exports.transformReceivedStatusInfo=St,exports.usingCppEngine=ft,exports.validate=Zi;
16
+ var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n,r,o,i,s,a,u,c,l,p,d,h,_,f,E,I,T,C,R,v,y,S,m,A,N,O,M,L,U,P,b,x,D,w,V,G,F,B,k,H,q,Y,K,Q,W,j,J,X,Z,z,$,ee,te,ne,re,oe,ie,se,ae,ue,ce,le,pe,de,he,_e,ge,fe,Ee=function(){return Ee=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ee.apply(this,arguments)};function Ie(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function Te(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Ce(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function Re(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ve(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function ye(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Se(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function me(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}exports.UploadMethod=void 0,(n=exports.UploadMethod||(exports.UploadMethod={}))[n.QINIU=1]="QINIU",n[n.ALI=2]="ALI",n[n.AWS=3]="AWS",n[n.STC=4]="STC",n[n.MINIO=5]="MINIO",exports.LogTagId=void 0,(r=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",r.A_INIT_REPEAT_O="A_INIT_REPEAT_O",r.L_INIT_O="L-init-O",r.A_DESTROY_O="A_DESTROY_O",r.L_DESTROY_O="L_DESTROY_O",r.A_CONNECT_T="A-connect-T",r.A_CONNECT_R="A-connect-R",r.A_CONNECT_S="A-connect-S",r.A_DISCONNECT_O="A-disconnect-O",r.A_RECONNECT_T="A-reconnect-T",r.A_RECONNECT_R="A_RECONNECT_R",r.L_CONNECT_T="L-connect-T",r.L_CONNECT_R="L-connect-R",r.L_CONNECT_S="L-connect-S",r.L_DB_UPGRATE_START_S="L-db_upgrate_start-S",r.L_DB_UPGRATING_S="L-db_upgrating-S",r.L_DB_UPGRATE_COMPLETE_S="L-db_upgrate_complete-S",r.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",r.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",r.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",r.A_MSG_LISTENER_E="A-MSG_LISTENER-E",r.O="L-original-O",r.T="L-TEST-O",r.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",r.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",r.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",r.L_NAVI_CMP_R="L-NAVI_CPM-R",r.A_SEND_MSG_T="A-send_msg-T",r.A_SEND_MSG_R="A-send_msg-R",r.L_SEND_MSG_T="L-send_msg-T",r.L_SEND_MSG_R="L-send_msg-R",r.L_PULL_MSG_T="L-pull_msg-T",r.L_PULL_MSG_R="L-pull_msg-R",r.L_PULL_MSG_E="L-pull_msg-E",r.L_PULL_MSG_O="L-pull_msg-O",r.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",r.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",r.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",r.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",r.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",r.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",r.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",r.L_RECV_S_MSG_O="L-recv_s_msg-O",r.A_DELETE_MESSAGES_S="A-delete_messages-S",r.P_DELETE_MSG_S="P-delete_msg-S",r.L_PULL_CONVERSATION_S="L-pull_conversation-S",r.A_RECALL_MESSAGE_T="A-recall_msg-T",r.A_RECALL_MESSAGE_R="A-recall_msg-R",r.A_RECALL_MESSAGE_E="A-recall_msg-E",r.A_REGTYP_O="A-regtyp-O",r.P_REGTYP_E="P-regtype-E",r.L_GET_NAVI_T="L-get_navi-T",r.L_GET_NAVI_R="L-get_navi-R",r.L_REQUEST_T="L-request-T",r.L_REQUEST_R="L-request-R",r.L_PARSE_NAVI_E="L-parse_navi-E",r.L_ENV_S="L-Env-S",r.L_GET_INDEX_NAVI_S="L-get_index_navi-S",r.A_JOIN_CHATROOM_T="A-join_chatroom-T",r.A_JOIN_CHATROOM_R="A-join_chatroom-R",r.L_JOIN_CHATROOM_T="L-join_chatroom-T",r.L_JOIN_CHATROOM_R="L-join_chatroom-R",r.A_QUIT_CHATROOM_T="A-quit_chatroom-T",r.A_QUIT_CHATROOM_R="A-quit_chatroom-R",r.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",r.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",r.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",r.L_MEDIA_S="L-media-S",r.L_MEDIA_UPLOAD_T="L-media_upload-T",r.L_MEDIA_UPLOAD_R="L-media_upload-R",r.G_UPLOAD_LOG_S="G-upload_log-S",r.G_REPORT_LOG_S="G-report_log-S",r.G_UPLOAD_LOG_E="G-upload_log-E",r.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",r.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",r.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",r.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",r.A_GET_LOCAL_MESSAGE_T="A-get_local_message-T",r.A_GET_LOCAL_MESSAGE_R="A-get_local_message-R",r.A_GET_HISTORY_MSG_T="A-get_history_msg-T",r.A_GET_HISTORY_MSG_R="A-get_history_msg-R",r.L_GET_HISTORY_MSG_T="L-get_history_msg-T",r.L_GET_HISTORY_MSG_R="L-get_history_msg-R",r.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",r.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",r.A_CALLBACK_O="A-callback-O",r.A_CALLBACK_E="A-callback-E",r.L_CALLBACK_E="L-callback-E",r.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",r.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",r.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",r.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",r.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",r.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",r.A_SYNC_READ_STATUS_T="A-sync_read_status-T",r.A_SYNC_READ_STATUS_R="A-sync_read_status-R",r.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",r.L_PB_ENCODE_E="L-pb-encode-E",r.L_PB_DECODE_E="L-pb-decode-E",r.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",r.L_REPORT_FULL_LOG_O="L-report_full_log-O",r.L_REPORT_FULL_LOG_T="L-report_full_log-T",r.L_REPORT_FULL_LOG_R="L-report_full_log-R",r.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",r.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",r.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",r.L_LOGDB_CLOSED_S="L-logDB_closed-S",r.L_LOGDB_ERROR_E="L-logDB_error-S",r.L_LOGDB_ABORT_S="L-logDB_abort-S",r.L_REALTIME_LOG_R="L_REALTIME_LOG_R",r.L_REALTIME_LOG_O="L_REALTIME_LOG_O",r.L_REALTIME_LOG_T="L_REALTIME_LOG_T",r.L_STATISTIC_LOG_R="L_STATISTIC_LOG_R",r.L_STATISTIC_LOG_O="L_STATISTIC_LOG_O",r.L_STATISTIC_LOG_T="L_STATISTIC_LOG_T",r.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",r.L_RECV_RMTP_O="L_RECV_RMTP_O",r.L_RECV_RMTP_E="L_RECV_RMTP_E",r.L_RECV_S_NTF_O="L-recv_s_ntf_O",r.L_VER_REPORT_T="L-VER_REPORT-T",r.L_VER_REPORT_R="L-VER_REPORT-R",r.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",r.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",r.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",r.A_REMOVE_PROXY_O="A-remove_proxy-O",r.A_SET_PROXY_O="A-set_proxy-O",r.A_TEST_PROXY_O="A-test_proxy-O",r.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",r.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",r.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",r.L_GET_STATIC_CONF_T="L-get_static_conf-T",r.L_GET_STATIC_CONF_R="L-get_static_conf-R",r.L_GET_STATIC_CONF_E="L-get_static_conf-E",r.L_CLOUD_DISABLED="L-cloud_disabled",r.L_CLOUD_EXPIRE="L-cloud_expire",r.L_CLOUD_OVERCLOCK="L-cloud_overclock",r.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",r.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",r.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",r.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",r.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",r.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",r.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O",r.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S="L-sync_subscribed_user_status_finished-S",r.L_PULL_SUBSCRIBED_USER_RELATION_T="L-pull_subscribed_user_relation-T",r.L_PULL_SUBSCRIBED_USER_RELATION_R="L-pull_subscribed_user_relation-R",r.L_PULL_SUBSCRIBED_USER_STATUS_T="L-pull_subscribed_user_status-T",r.L_PULL_SUBSCRIBED_USER_STATUS_R="L-pull_subscribed_user_status-R",r.L_OWN_USER_PROFILE_CHANGED_S="L-own_user_profile_changed-S",r.L_QUERY_SUBSCRIBE_DATA_T="L-query_subscribe_data-T",r.L_QUERY_SUBSCRIBE_DATA_R="L-query_subscribe_data-R",r.L_PULL_USER_PROFILE_T="L-pull_user_profile-T",r.L_PULL_USER_PROFILE_R="L-pull_user_profile-R",r.L_PULL_OWN_PROFILE_T="L-pull_own_profile-T",r.L_PULL_OWN_PROFILE_R="L-pull_own_profile-R",r.L_QUERY_FRIEND_LIST_T="L-query_friend_list-T",r.L_QUERY_FRIEND_LIST_R="L-query_friend_list-R",r.L_PULL_USER_PROFILE_REQ_T="L-pull_user_profile_req-T",r.L_PULL_USER_PROFILE_REQ_R="L-pull_user_profile_req-R",r.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S="L-pull_event_change_notify_ultra_online-S",r.L_PULL_EVENT_CHANGE_T="L-pull_event_change-T",r.L_PULL_EVENT_CHANGE_R="L-pull_event_change-R",r.L_PARSE_JSON_E="L-parse_json-E",r.L_REQ_STREAM_MSG_CONTENT_T="L-req_stream_msg_content-T",r.L_REQ_STREAM_MSG_CONTENT_R="L-req_stream_msg_content-R",r.L_REQ_STREAM_MSG_CONTENT_O="L-req_stream_msg_content-O",r.L_REQ_STREAM_MSG_CONTENT_E="L-req_stream_msg_content-E",exports.DirectionType=void 0,(o=exports.DirectionType||(exports.DirectionType={}))[o.BOTH=2]="BOTH",exports.QueryFriendsDirectionType=void 0,(i=exports.QueryFriendsDirectionType||(exports.QueryFriendsDirectionType={}))[i.BOTH=2]="BOTH",exports.FriendAddPermission=void 0,(s=exports.FriendAddPermission||(exports.FriendAddPermission={}))[s.FREE=1]="FREE",s[s.NEED_VERIFY=2]="NEED_VERIFY",s[s.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED",exports.FriendRelationType=void 0,(a=exports.FriendRelationType||(exports.FriendRelationType={}))[a.NONE=0]="NONE",a[a.IN_MY_FRIEND_LIST=1]="IN_MY_FRIEND_LIST",a[a.IN_OTHER_FRIEND_LIST=2]="IN_OTHER_FRIEND_LIST",a[a.BOTH_WAY=3]="BOTH_WAY",exports.FriendApplicationType=void 0,(u=exports.FriendApplicationType||(exports.FriendApplicationType={}))[u.SENT=1]="SENT",u[u.RECEIVED=2]="RECEIVED",exports.FriendApplicationStatus=void 0,(c=exports.FriendApplicationStatus||(exports.FriendApplicationStatus={}))[c.UNHANDLED=0]="UNHANDLED",c[c.ACCEPTED=1]="ACCEPTED",c[c.REFUSED=2]="REFUSED",c[c.EXPIRED=3]="EXPIRED",function(e){e[e.FRIEND_APPLICATION=31]="FRIEND_APPLICATION"}(l||(l={})),function(e){e[e.FRIEND_APPLY=0]="FRIEND_APPLY",e[e.FRIEND_REFUSE=1]="FRIEND_REFUSE",e[e.FRIEND_USER_INFO=2]="FRIEND_USER_INFO",e[e.FRIENDS_INPUT=3]="FRIENDS_INPUT",e[e.FRIEND_CLEAR=4]="FRIEND_CLEAR",e[e.FRIEND_INFO_CHANGE=5]="FRIEND_INFO_CHANGE",e[e.FRIEND_INFO_CHANGE_SYNC=6]="FRIEND_INFO_CHANGE_SYNC"}(p||(p={})),exports.GroupJoinPermission=void 0,(d=exports.GroupJoinPermission||(exports.GroupJoinPermission={}))[d.OWNER_VERIFY=0]="OWNER_VERIFY",d[d.FREE=1]="FREE",d[d.OWNER_OR_MANAGER_VERIFY=2]="OWNER_OR_MANAGER_VERIFY",d[d.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED",exports.GroupOperationPermission=void 0,(h=exports.GroupOperationPermission||(exports.GroupOperationPermission={}))[h.OWNER=0]="OWNER",h[h.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",h[h.EVERYONE=2]="EVERYONE",exports.GroupMemberInfoEditPermission=void 0,(_=exports.GroupMemberInfoEditPermission||(exports.GroupMemberInfoEditPermission={}))[_.OWNER_OR_MANAGER_OR_SELF=0]="OWNER_OR_MANAGER_OR_SELF",_[_.OWNER_OR_SELF=1]="OWNER_OR_SELF",_[_.SELF=2]="SELF",exports.GroupInviteHandlePermission=void 0,(f=exports.GroupInviteHandlePermission||(exports.GroupInviteHandlePermission={}))[f.FREE=0]="FREE",f[f.INVITEE_VERIFY=1]="INVITEE_VERIFY",exports.GroupMemberRole=void 0,(E=exports.GroupMemberRole||(exports.GroupMemberRole={}))[E.UNDEF=0]="UNDEF",E[E.NORMAL=1]="NORMAL",E[E.MANAGER=2]="MANAGER",E[E.OWNER=3]="OWNER",exports.GroupOperation=void 0,(I=exports.GroupOperation||(exports.GroupOperation={}))[I.CREATE=0]="CREATE",I[I.JOIN=1]="JOIN",I[I.KICK=2]="KICK",I[I.QUIT=3]="QUIT",I[I.DISMISS=4]="DISMISS",I[I.ADD_MANAGER=5]="ADD_MANAGER",I[I.REMOVE_MANAGER=6]="REMOVE_MANAGER",I[I.TRANSFER_GROUP_OWNER=7]="TRANSFER_GROUP_OWNER",function(e){e[e.GROUP_INFO_CHANGE=0]="GROUP_INFO_CHANGE",e[e.MEMBER_PROFILE_CHANGE=1]="MEMBER_PROFILE_CHANGE",e[e.GROUP_REMARK_SET=2]="GROUP_REMARK_SET",e[e.GROUP_REMARK_DELETE=3]="GROUP_REMARK_DELETE"}(T||(T={})),exports.GroupOperationType=void 0,(C=exports.GroupOperationType||(exports.GroupOperationType={}))[C.ADD=1]="ADD",C[C.REMOVE=2]="REMOVE",exports.GroupApplicationStatus=void 0,(R=exports.GroupApplicationStatus||(exports.GroupApplicationStatus={}))[R.MANAGER_UNHANDLED=0]="MANAGER_UNHANDLED",R[R.MANAGER_REFUSED=1]="MANAGER_REFUSED",R[R.INVITEE_UNHANDLED=2]="INVITEE_UNHANDLED",R[R.INVITEE_REFUSED=3]="INVITEE_REFUSED",R[R.JOINED=4]="JOINED",R[R.EXPIRED=5]="EXPIRED",exports.GroupOperationStatus=void 0,(v=exports.GroupOperationStatus||(exports.GroupOperationStatus={}))[v.REFUSE=0]="REFUSE",v[v.ACCEPT=1]="ACCEPT",exports.GroupOperationRole=void 0,(y=exports.GroupOperationRole||(exports.GroupOperationRole={}))[y.APPLICANT=0]="APPLICANT",y[y.MANAGER=1]="MANAGER",function(e){e[e.GROUP_OPERATION=11]="GROUP_OPERATION",e[e.GROUP_PROFILE_CHANGE=12]="GROUP_PROFILE_CHANGE",e[e.GROUP_APPLICATION_INVITATION=13]="GROUP_APPLICATION_INVITATION",e[e.GROUP_FOLLOW_USER_CHANGE=14]="GROUP_FOLLOW_USER_CHANGE"}(S||(S={})),exports.GroupApplicationType=void 0,(m=exports.GroupApplicationType||(exports.GroupApplicationType={}))[m.APPLICATION=0]="APPLICATION",m[m.INVITATION=1]="INVITATION",exports.GroupApplicationDirection=void 0,(A=exports.GroupApplicationDirection||(exports.GroupApplicationDirection={}))[A.APPLICATION_SENT=0]="APPLICATION_SENT",A[A.INVITATION_SENT=1]="INVITATION_SENT",A[A.INVITATION_RECEIVED=2]="INVITATION_RECEIVED",A[A.APPLICATION_RECEIVED=3]="APPLICATION_RECEIVED",exports.ChatroomEntryType=void 0,(N=exports.ChatroomEntryType||(exports.ChatroomEntryType={}))[N.UPDATE=1]="UPDATE",N[N.DELETE=2]="DELETE",exports.ChrmSyncStatus=void 0,(O=exports.ChrmSyncStatus||(exports.ChrmSyncStatus={}))[O.QUIT=0]="QUIT",O[O.JOIN=1]="JOIN",exports.ChatroomSyncStatusReason=void 0,(M=exports.ChatroomSyncStatusReason||(exports.ChatroomSyncStatusReason={}))[M.LeaveOnMyOwn=0]="LeaveOnMyOwn",M[M.OtherDeviceLogin=1]="OtherDeviceLogin",exports.ChatroomUserChangeType=void 0,(L=exports.ChatroomUserChangeType||(exports.ChatroomUserChangeType={}))[L.QUIT=0]="QUIT",L[L.JOIN=1]="JOIN",exports.ChrmMemBanType=void 0,(U=exports.ChrmMemBanType||(exports.ChrmMemBanType={}))[U.UnmuteUsers=0]="UnmuteUsers",U[U.MuteUsers=1]="MuteUsers",U[U.UnmuteAll=2]="UnmuteAll",U[U.MuteAll=3]="MuteAll",U[U.RemoveWhitelist=4]="RemoveWhitelist",U[U.AddWhitelist=5]="AddWhitelist",U[U.UnmuteGloble=6]="UnmuteGloble",U[U.MuteGloble=7]="MuteGloble",exports.ChrmMemOperateType=void 0,(P=exports.ChrmMemOperateType||(exports.ChrmMemOperateType={}))[P.Deblock=0]="Deblock",P[P.Blocked=1]="Blocked",exports.ErrorCode=void 0,(b=exports.ErrorCode||(exports.ErrorCode={}))[b.SUCCESS=0]="SUCCESS",b[b.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",b[b.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",b[b.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",b[b.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",b[b.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",b[b.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",b[b.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",b[b.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",b[b.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",b[b.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",b[b.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",b[b.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",b[b.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",b[b.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",b[b.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",b[b.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",b[b.NOT_IN_GROUP=22406]="NOT_IN_GROUP",b[b.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",b[b.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",b[b.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",b[b.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",b[b.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",b[b.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",b[b.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",b[b.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",b[b.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",b[b.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",b[b.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",b[b.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",b[b.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",b[b.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",b[b.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",b[b.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",b[b.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",b[b.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",b[b.HAVNODEVICEID=24001]="HAVNODEVICEID",b[b.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",b[b.FEILD=24009]="FEILD",b[b.INTERNALERRROR=24015]="INTERNALERRROR",b[b.RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET=24360]="RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET",b[b.RC_USER_PROFILE_KEY_NOT_EXIST=24361]="RC_USER_PROFILE_KEY_NOT_EXIST",b[b.RC_USER_PROFILE_EXT_KEY_NOT_EXIST=24362]="RC_USER_PROFILE_EXT_KEY_NOT_EXIST",b[b.RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT=24363]="RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT",b[b.RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT=24364]="RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT",b[b.RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT=24365]="RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT",b[b.RC_USER_PROFILE_USER_NOT_EXIST=24366]="RC_USER_PROFILE_USER_NOT_EXIST",b[b.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS=24367]="RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS",b[b.RC_USER_PROFILE_VALUE_EXCEED_RANGE=24368]="RC_USER_PROFILE_VALUE_EXCEED_RANGE",b[b.RC_USER_PROFILE_SERVICE_UNAVAILABLE=24369]="RC_USER_PROFILE_SERVICE_UNAVAILABLE",b[b.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",b[b.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",b[b.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",b[b.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",b[b.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",b[b.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",b[b.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",b[b.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",b[b.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",b[b.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",b[b.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",b[b.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",b[b.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",b[b.RECALL_MESSAGE=25101]="RECALL_MESSAGE",b[b.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",b[b.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",b[b.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",b[b.RC_ENTRUST_SERVER_ERROR=25402]="RC_ENTRUST_SERVER_ERROR",b[b.RC_ENTRUST_SERVER_PARAMETER_ERROR=25403]="RC_ENTRUST_SERVER_PARAMETER_ERROR",b[b.RC_GROUP_ILLEGAL_ERROR=25404]="RC_GROUP_ILLEGAL_ERROR",b[b.RC_GROUP_AUTHORITY_ERROR=25405]="RC_GROUP_AUTHORITY_ERROR",b[b.RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT=25406]="RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT",b[b.RC_GROUP_PARAMETER_FORMAT_ERROR=25407]="RC_GROUP_PARAMETER_FORMAT_ERROR",b[b.RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS=25408]="RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS",b[b.RC_GROUP_ID_ALREADY_EXIST=25409]="RC_GROUP_ID_ALREADY_EXIST",b[b.RC_GROUP_ID_NOT_EXIST=25410]="RC_GROUP_ID_NOT_EXIST",b[b.RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT=25411]="RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT",b[b.RC_GROUP_MEMBERS_ALREADY_IN_GROUP=25412]="RC_GROUP_MEMBERS_ALREADY_IN_GROUP",b[b.RC_GROUP_NOT_ALLOW_SDK_OPERATION=25413]="RC_GROUP_NOT_ALLOW_SDK_OPERATION",b[b.RC_GROUP_NOT_ALLOW_JOIN=25414]="RC_GROUP_NOT_ALLOW_JOIN",b[b.RC_GROUP_EXT_KEY_NOT_EXIST=25415]="RC_GROUP_EXT_KEY_NOT_EXIST",b[b.RC_GROUP_REQUEST_OVERFREQUENCY=25416]="RC_GROUP_REQUEST_OVERFREQUENCY",b[b.RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK=25417]="RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK",b[b.RC_GROUP_USER_NOT_IN_GROUP=25418]="RC_GROUP_USER_NOT_IN_GROUP",b[b.RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT=25419]="RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT",b[b.RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP=25420]="RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP",b[b.RC_GROUP_APPLICATION_NOT_EXIST=25421]="RC_GROUP_APPLICATION_NOT_EXIST",b[b.RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT=25422]="RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT",b[b.RC_GROUP_NAME_INVALID=25423]="RC_GROUP_NAME_INVALID",b[b.RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT=25424]="RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT",b[b.RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER=25425]="RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER",b[b.RC_GROUP_NO_INVITE_PERMISSION=25426]="RC_GROUP_NO_INVITE_PERMISSION",b[b.RC_GROUP_NEED_INVITEE_ACCEPT=25427]="RC_GROUP_NEED_INVITEE_ACCEPT",b[b.RC_GROUP_APPLICATION_ALREADY_HANDLE=25428]="RC_GROUP_APPLICATION_ALREADY_HANDLE",b[b.RC_GROUP_OLD_GROUP_NOT_ENTRUST=25429]="RC_GROUP_OLD_GROUP_NOT_ENTRUST",b[b.RC_GROUP_ID_INVALID=25430]="RC_GROUP_ID_INVALID",b[b.RC_PAGE_TOKEN_PARSING_FAILED=25432]="RC_PAGE_TOKEN_PARSING_FAILED",b[b.RC_FRIEND_ALREADY_FRIEND=25460]="RC_FRIEND_ALREADY_FRIEND",b[b.RC_FRIEND_NEED_ACCEPT=25461]="RC_FRIEND_NEED_ACCEPT",b[b.RC_FRIEND_IN_OTHER_BLACK_LIST=25462]="RC_FRIEND_IN_OTHER_BLACK_LIST",b[b.RC_FRIEND_NOT_IN_OTHER_WHITE_LIST=25463]="RC_FRIEND_NOT_IN_OTHER_WHITE_LIST",b[b.RC_FRIEND_IN_MY_BLACK_LIST=25464]="RC_FRIEND_IN_MY_BLACK_LIST",b[b.RC_FRIEND_NOT_IN_MY_WHITE_LIST=25465]="RC_FRIEND_NOT_IN_MY_WHITE_LIST",b[b.RC_FRIEND_APPLICATION_NOT_EXIST=25466]="RC_FRIEND_APPLICATION_NOT_EXIST",b[b.RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT=25467]="RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT",b[b.RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT=25468]="RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT",b[b.RC_FRIEND_NOT_FRIEND=25469]="RC_FRIEND_NOT_FRIEND",b[b.RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT=25470]="RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT",b[b.RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND=25471]="RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND",b[b.RC_FRIEND_NOT_EXIST=25472]="RC_FRIEND_NOT_EXIST",b[b.RC_FRIEND_NOT_ALLOW_ADD_SELF=25473]="RC_FRIEND_NOT_ALLOW_ADD_SELF",b[b.SERVICE_INFORMATION_AUDIT_FAILED=25480]="SERVICE_INFORMATION_AUDIT_FAILED",b[b.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",b[b.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",b[b.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",b[b.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",b[b.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",b[b.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",b[b.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",b[b.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",b[b.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",b[b.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",b[b.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",b[b.RC_FILE_SIZE_EXCEED_LIMIT=26106]="RC_FILE_SIZE_EXCEED_LIMIT",b[b.INVALID_PARAMETER_SIZE_NOT_FOUND=26107]="INVALID_PARAMETER_SIZE_NOT_FOUND",b[b.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",b[b.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",b[b.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",b[b.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",b[b.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",b[b.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",b[b.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",b[b.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",b[b.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",b[b.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",b[b.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",b[b.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",b[b.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",b[b.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",b[b.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",b[b.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",b[b.MESSAGE_NOT_SUPPORT_SENDING=30017]="MESSAGE_NOT_SUPPORT_SENDING",b[b.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",b[b.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",b[b.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",b[b.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",b[b.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",b[b.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",b[b.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",b[b.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",b[b.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",b[b.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",b[b.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",b[b.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",b[b.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",b[b.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",b[b.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",b[b.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",b[b.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",b[b.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",b[b.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",b[b.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",b[b.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",b[b.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",b[b.RC_OTP_USED=31027]="RC_OTP_USED",b[b.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",b[b.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",b[b.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",b[b.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",b[b.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",b[b.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",b[b.RC_TCP_RESET=32054]="RC_TCP_RESET",b[b.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",b[b.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",b[b.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",b[b.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",b[b.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",b[b.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",b[b.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",b[b.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",b[b.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",b[b.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",b[b.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",b[b.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",b[b.TAG_EXISTS=33101]="TAG_EXISTS",b[b.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",b[b.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",b[b.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",b[b.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",b[b.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",b[b.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",b[b.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",b[b.UPLOAD_FAIL=34011]="UPLOAD_FAIL",b[b.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",b[b.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",b[b.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",b[b.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",b[b.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",b[b.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",b[b.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",b[b.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",b[b.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",b[b.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",b[b.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",b[b.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",b[b.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",b[b.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",b[b.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",b[b.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",b[b.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",b[b.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",b[b.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",b[b.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",b[b.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",b[b.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",b[b.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",b[b.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",b[b.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",b[b.INVALID_PARAMETER_TIMESTRING=34224]="INVALID_PARAMETER_TIMESTRING",b[b.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",b[b.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",b[b.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",b[b.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",b[b.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",b[b.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",b[b.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",b[b.INVALID_PARAMETER_UNIQUE_ID=34236]="INVALID_PARAMETER_UNIQUE_ID",b[b.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",b[b.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",b[b.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",b[b.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",b[b.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",b[b.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",b[b.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",b[b.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",b[b.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",b[b.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",b[b.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",b[b.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",b[b.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",b[b.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",b[b.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",b[b.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",b[b.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",b[b.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",b[b.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",b[b.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",b[b.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",b[b.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",b[b.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",b[b.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",b[b.INVALID_PARAMETER_SPAN_MINUTES=34283]="INVALID_PARAMETER_SPAN_MINUTES",b[b.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",b[b.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",b[b.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",b[b.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",b[b.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",b[b.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",b[b.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",b[b.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",b[b.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",b[b.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",b[b.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",b[b.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",b[b.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",b[b.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",b[b.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",b[b.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",b[b.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",b[b.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",b[b.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",b[b.INVALID_PARAMETER_USER_PROFILE=34312]="INVALID_PARAMETER_USER_PROFILE",b[b.INVALID_PARAMETER_USER_PROFILE_VISIBILITY=34313]="INVALID_PARAMETER_USER_PROFILE_VISIBILITY",b[b.INVALID_PARAMETER_EXTRA=34314]="INVALID_PARAMETER_EXTRA",b[b.DB_UPGRADE_FAILED=34315]="DB_UPGRADE_FAILED",b[b.INVALID_PARAMETER_GROUP_INFO=34318]="INVALID_PARAMETER_GROUP_INFO",b[b.INVALID_PARAMETER_GROUP_ID=34319]="INVALID_PARAMETER_GROUP_ID",b[b.INVALID_PARAMETER_GROUP_NAME=34320]="INVALID_PARAMETER_GROUP_NAME",b[b.INVALID_PARAMETER_GROUP_IDS=34321]="INVALID_PARAMETER_GROUP_IDS",b[b.INVALID_PARAMETER_GROUP_MEMBER_ROLE=34322]="INVALID_PARAMETER_GROUP_MEMBER_ROLE",b[b.INVALID_PARAMETER_GROUP_APPLICATION_STATUS=34323]="INVALID_PARAMETER_GROUP_APPLICATION_STATUS",b[b.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION=34324]="INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION",b[b.INVALID_PARAMETER_NICK_NAME=34325]="INVALID_PARAMETER_NICK_NAME",b[b.INVALID_PARAMETER_REASON=34326]="INVALID_PARAMETER_REASON",b[b.INVALID_PARAMETER_REMARK=34327]="INVALID_PARAMETER_REMARK",b[b.INVALID_PARAMETER_PAGING_QUERY_OPTION=34328]="INVALID_PARAMETER_PAGING_QUERY_OPTION",b[b.NET_DATA_IS_SYNCHRONIZING=34329]="NET_DATA_IS_SYNCHRONIZING",b[b.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE=34330]="INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE",b[b.INVALID_PARAMETER_DIRECTION_TYPE=34331]="INVALID_PARAMETER_DIRECTION_TYPE",b[b.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE=34332]="INVALID_PARAMETER_FRIEND_APPLICATION_TYPE",b[b.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS=34333]="INVALID_PARAMETER_FRIEND_APPLICATION_STATUS",b[b.INVALID_PARAMETER_FRIEND_ADD_PERMISSION=34334]="INVALID_PARAMETER_FRIEND_ADD_PERMISSION",b[b.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS=34335]="INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS",b[b.RC_REAL_TIME_CONVERSATION_UNAVAILABLE=34336]="RC_REAL_TIME_CONVERSATION_UNAVAILABLE",b[b.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",b[b.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",b[b.NOT_SUPPORT=35004]="NOT_SUPPORT",b[b.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",b[b.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",b[b.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",b[b.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",b[b.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",b[b.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",b[b.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",b[b.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",b[b.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",b[b.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",b[b.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",b[b.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",b[b.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",b[b.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",b[b.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",b[b.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",b[b.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",b[b.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",b[b.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",b[b.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",b[b.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",b[b.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",b[b.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",b[b.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",b[b.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",b[b.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",b[b.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",b[b.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",b[b.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",b[b.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",b[b.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",b[b.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",b[b.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",b[b.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",b[b.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",b[b.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",b[b.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",b[b.DNS_PROXY_TIMEOUT=35051]="DNS_PROXY_TIMEOUT",b[b.DNS_PROXY_ERROR=35052]="DNS_PROXY_ERROR",b[b.DNS_PROXY_DATA_DESTRUCTUR_ERROR=35053]="DNS_PROXY_DATA_DESTRUCTUR_ERROR",b[b.INVALID_DISABLE_UPDATE_LAST_MESSAGE=35054]="INVALID_DISABLE_UPDATE_LAST_MESSAGE",b[b.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",b[b.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",b[b.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",b[b.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",b[b.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",b[b.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",b[b.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",b[b.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",b[b.STREAM_MESSAGE_DISABLE=39001]="STREAM_MESSAGE_DISABLE",b[b.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED=39002]="STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED",b[b.STREAM_MESSAGE_EXPANSION_KEY_ERROR=39003]="STREAM_MESSAGE_EXPANSION_KEY_ERROR",b[b.STREAM_MESSAGE_REQUEST_FAIL=39005]="STREAM_MESSAGE_REQUEST_FAIL",b[b.STREAM_MESSAGE_REQUEST_IN_PROCESS=39006]="STREAM_MESSAGE_REQUEST_IN_PROCESS",b[b.STREAM_MESSAGE_SYNCED=39007]="STREAM_MESSAGE_SYNCED",b[b.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",b[b.TIMEOUT=-1]="TIMEOUT",exports.ConversationType=void 0,(x=exports.ConversationType||(exports.ConversationType={}))[x.NONE=0]="NONE",x[x.PRIVATE=1]="PRIVATE",x[x.DISCUSSION=2]="DISCUSSION",x[x.GROUP=3]="GROUP",x[x.CHATROOM=4]="CHATROOM",x[x.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",x[x.SYSTEM=6]="SYSTEM",x[x.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",x[x.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",x[x.ULTRA_GROUP=10]="ULTRA_GROUP",x[x.RTC_ROOM=12]="RTC_ROOM",function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(D||(D={})),exports.FileType=void 0,(w=exports.FileType||(exports.FileType={}))[w.IMAGE=1]="IMAGE",w[w.AUDIO=2]="AUDIO",w[w.VIDEO=3]="VIDEO",w[w.FILE=4]="FILE",w[w.SIGHT=5]="SIGHT",w[w.COMBINE_HTML=6]="COMBINE_HTML",exports.MentionedType=void 0,(V=exports.MentionedType||(exports.MentionedType={}))[V.ALL=1]="ALL",V[V.SINGAL=2]="SINGAL",exports.MessageType=void 0,(G=exports.MessageType||(exports.MessageType={})).TextMessage="RC:TxtMsg",G.VOICE="RC:VcMsg",G.HQ_VOICE="RC:HQVCMsg",G.IMAGE="RC:ImgMsg",G.GIF="RC:GIFMsg",G.RICH_CONTENT="RC:ImgTextMsg",G.LOCATION="RC:LBSMsg",G.FILE="RC:FileMsg",G.SIGHT="RC:SightMsg",G.COMBINE="RC:CombineMsg",G.COMBINE_V2="RC:CombineV2Msg",G.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",G.LOG_COMMAND="RC:LogCmdMsg",G.EXPANSION_NOTIFY="RC:MsgExMsg",G.REFERENCE="RC:ReferenceMsg",G.RECALL="RC:RcCmd",G.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",G.READ_RECEIPT="RC:ReadNtf",G.READ_RECEIPT_REQUEST="RC:RRReqMsg",G.READ_RECEIPT_RESPONSE="RC:RRRspMsg",G.SYNC_READ_STATUS="RC:SRSMsg",G.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",G.READ_STATE="RC:RSMsg",G.DELIVERED="RC:Delivered",G.DELIVERED_MSG="RC:DRMsg",G.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",G.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",G.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",G.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",G.TYPING_STATUS="RC:TypSts",G.INTERCEPT="RC:InterceptMsg",G.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg",G.STREAM_MESSAGE="RC:StreamMsg",exports.UltraGroupChannelType=void 0,(F=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[F.PUBLIC=0]="PUBLIC",F[F.PRIVATE=1]="PRIVATE",exports.UltraGroupChannelChangeType=void 0,(B=exports.UltraGroupChannelChangeType||(exports.UltraGroupChannelChangeType={}))[B.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",B[B.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",B[B.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",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",e[e.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}(k||(k={})),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"}(H||(H={})),function(e){e[e.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",e[e.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",e[e.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",e[e.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",e[e.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(q||(q={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(Y||(Y={})),exports.SentStatus=void 0,(K=exports.SentStatus||(exports.SentStatus={}))[K.SENDING=10]="SENDING",K[K.FAILED=20]="FAILED",K[K.SENT=30]="SENT",K[K.RECEIVED=40]="RECEIVED",K[K.READ=50]="READ",K[K.DESTROYED=60]="DESTROYED",exports.OperateStatus=void 0,(Q=exports.OperateStatus||(exports.OperateStatus={}))[Q.typing=0]="typing",exports.OnlineStatus=void 0,(W=exports.OnlineStatus||(exports.OnlineStatus={}))[W.ONLINE=1]="ONLINE",W[W.OFFLINE=0]="OFFLINE",exports.PlatformInfo=void 0,(j=exports.PlatformInfo||(exports.PlatformInfo={}))[j.Other=0]="Other",j[j.iOS=1]="iOS",j[j.Android=2]="Android",j[j.Web=3]="Web",j[j.PC=4]="PC",j[j.Mini=5]="Mini",j[j.HarmonyOS=6]="HarmonyOS",exports.SubscribeType=void 0,(J=exports.SubscribeType||(exports.SubscribeType={}))[J.ONLINE_STATUS=1]="ONLINE_STATUS",J[J.USER_PROFILE=2]="USER_PROFILE",J[J.FRIEND_ONLINE_STATUS=3]="FRIEND_ONLINE_STATUS",J[J.FRIEND_USER_PROFILE=4]="FRIEND_USER_PROFILE",exports.SubscribeOperationType=void 0,(X=exports.SubscribeOperationType||(exports.SubscribeOperationType={}))[X.SUBSCRIBE=0]="SUBSCRIBE",X[X.UNSUBSCRIBE=1]="UNSUBSCRIBE",exports.UserProfileVisibility=void 0,(Z=exports.UserProfileVisibility||(exports.UserProfileVisibility={}))[Z.NOT_SET=0]="NOT_SET",Z[Z.INVISIBLE=1]="INVISIBLE",Z[Z.EVERYONE=2]="EVERYONE",Z[Z.FriendVisible=3]="FriendVisible",exports.RCConnectionStatus=void 0,(z=exports.RCConnectionStatus||(exports.RCConnectionStatus={}))[z.CONNECTED=0]="CONNECTED",z[z.CONNECTING=1]="CONNECTING",z[z.DISCONNECTED=2]="DISCONNECTED",z[z.SUSPENDED=3]="SUSPENDED",exports.MessageBlockType=void 0,($=exports.MessageBlockType||(exports.MessageBlockType={}))[$.GLOBAL=1]="GLOBAL",$[$.CUSTOM=2]="CUSTOM",$[$.THIRD_PARTY=3]="THIRD_PARTY",exports.MessageBlockSourceType=void 0,(ee=exports.MessageBlockSourceType||(exports.MessageBlockSourceType={}))[ee.MSG_ORIGINAL=0]="MSG_ORIGINAL",ee[ee.MSG_EXPANSION=1]="MSG_EXPANSION",ee[ee.MSG_MODIFY=2]="MSG_MODIFY",exports.MessageDirection=void 0,(te=exports.MessageDirection||(exports.MessageDirection={}))[te.SEND=1]="SEND",te[te.RECEIVE=2]="RECEIVE",exports.PushImportanceHonor=void 0,(ne=exports.PushImportanceHonor||(exports.PushImportanceHonor={})).NORMAL="NORMAL",ne.LOW="LOW",function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S",e.IM_CMP="IM-stats_cmp-S",e.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",e.IM_STATS_CS="IM-stats_cs-S",e.IM_NETWORK_CHANGE="IM-stats_network_change-S",e.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",e.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",e.IM_MSG_SEND="IM-msg_send-S",e.IM_MSG_RECEIVE="IM-msg_receive-S"}(re||(re={})),exports.NotificationStatus=void 0,(oe=exports.NotificationStatus||(exports.NotificationStatus={}))[oe.OPEN=1]="OPEN",oe[oe.CLOSE=2]="CLOSE",exports.NotificationLevel=void 0,(ie=exports.NotificationLevel||(exports.NotificationLevel={}))[ie.ALL_MESSAGE=-1]="ALL_MESSAGE",ie[ie.NOT_SET=0]="NOT_SET",ie[ie.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",ie[ie.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",ie[ie.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",ie[ie.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION",exports.ReceivedStatus=void 0,(se=exports.ReceivedStatus||(exports.ReceivedStatus={}))[se.READ=1]="READ",se[se.LISTENED=2]="LISTENED",se[se.DOWNLOADED=4]="DOWNLOADED",se[se.RETRIEVED=8]="RETRIEVED",se[se.UNREAD=0]="UNREAD",function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(ae||(ae={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(ue||(ue={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(ce||(ce={})),function(e){e[e.CURRENT=2]="CURRENT"}(le||(le={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(pe||(pe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(de||(de={})),exports.InterruptionLevel=void 0,(he=exports.InterruptionLevel||(exports.InterruptionLevel={})).PASSIVE="passive",he.ACTIVE="active",he.TIME_SENSITIVE="time-sensitive",he.CRITICAL="critical",exports.PushNotificationQuietHoursLevel=void 0,(_e=exports.PushNotificationQuietHoursLevel||(exports.PushNotificationQuietHoursLevel={}))[_e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT=0]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT",_e[_e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE=1]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE",_e[_e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED=5]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED",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"}(ge||(ge={})),exports.HttpMethod=void 0,(fe=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",fe.POST="POST",fe.PUT="PUT";var Ae=72e5,Ne=6e4,Oe=131072,Me={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0,searchProps:["content","title"]},"RC:FileMsg":{isCounted:!0,isPersited:!0,searchProps:["name"]},"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:CombineV2Msg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0,searchProps:["content"]},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:RLStart":{isCounted:!0,isPersited:!0},"RC:RLEnd":{isCounted:!0,isPersited:!0},"RC:StreamMsg":{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:RcNtf":{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:RcCmd":{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},"RC:RLJoin":{isCounted:!1,isPersited:!1},"RC:RLQuit":{isCounted:!1,isPersited:!1},"RC:RL":{isCounted:!1,isPersited:!1},"RC:CCConfigChangeRequestMsg":{isCounted:!1,isPersited:!1}},Le="5.16.0".replace(/-.+$/,""),Ue="rongcloudsystem",Pe=864e5,be=function(e){return"navi_".concat(e)},xe=function(e,t){return"RCV4-con-s-".concat(e,"-").concat(t)},De=function(e,t){return"RCV4-con-".concat(e,"-").concat(t)},we=function(e,t){return"RCV4-CONVER-".concat(e,"-").concat(t)},Ve=function(e,t){return"RCV4-ultragroupconversation-".concat(e,"-").concat(t)},Ge=function(e,t){return"outbox_".concat(e,"_").concat(t)},Fe=function(e,t){return"inbox_".concat(e,"_").concat(t)},Be=function(e,t){return"broadcastbox_".concat(e,"_").concat(t)},ke=function(e,t){return"send_msg_".concat(e,"_").concat(t)},He=function(e,t){return"RC-us-".concat(e,"-").concat(t)},qe=function(e){return"rc-static-config-".concat(e)},Ye=function(e){return"RC-cc-".concat(e)},Ke=function(e,t){return"RC-RR-".concat(e,"-").concat(t)},Qe=function(e,t){return"RC-PEC-".concat(e,"-").concat(t)},We="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};We.engine="5.16.0";var je=function(){function e(){}return e.add=function(e,t){We[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return We.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return We},e}();var Je={gen:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=Math.floor(36*Math.random());return("x"===e?t:3&t|8).toString(36)}))},genWithLen:function(e){void 0===e&&(e=22);var t,n=Date.now(),r=n.toString(36),o=Math.floor(Math.random()*n).toString(36),i=e-r.length-o.length;return[o,r,i>0?(t=i,Array.from({length:t}).map((function(){return Math.floor(36*Math.random()).toString(36)})).join("")):""].join("").slice(0,e)}},Xe=Je.genWithLen(22),Ze=Date.now(),ze=function(e){function n(t){var n=e.call(this,t)||this;return n.name="CMSYError",n}return t(n,e),n.InvalidParameters=function(e){return(null==e?void 0:e.length)?new n("Invalid parameter -> ".concat(e)):new n("Invalid parameters.")},n.ParameterTypeError=function(){return new n("Wrong parameter type")},n}(Error),$e=function(){function e(){this._map=new Map,this._piped=new Set}return e.prototype._addItem=function(e,t,n,r,o){void 0===o&&(o=0);var i=Symbol(),s=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:i,priority:Math.min(o,100),listener:t.bind(r),once:n},u=s.findIndex((function(e){return e.priority>o}));return-1===u?s.push(a):s.splice(u,0,a),i},e.prototype.on=function(e,t,n,r){return void 0===r&&(r=0),this._addItem(e,t,!1,n,r)},e.prototype.once=function(e,t,n,r){return void 0===r&&(r=0),this._addItem(e,t,!0,n,r)},e.prototype.off=function(e){var t,n;try{for(var r=Re(this._map),o=r.next();!o.done;o=r.next()){var i=ve(o.value,2),s=(i[0],i[1]),a=s.findIndex((function(t){return t.symbol===e}));if(-1!==a)return void s.splice(a,1)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map.get(e);if(r&&r.length>0)for(var o=r.length-1;o>=0;o-=1){var i=r[o],s=i.once,a=i.listener;s&&r.splice(o,1);try{a.apply(void 0,ye([],ve(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}ye([],ve(this._piped.values()),!1).forEach((function(n){return n.emit.apply(n,ye([e],ve(t),!1))}))},e.prototype.removeAll=function(e){this._map.delete(e)},e.prototype.clear=function(){this._piped.clear(),this._map.clear()},e.prototype.pipe=function(e){this._piped.add(e)},e}();!function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._versionQueue=[],t._isPulling=null,t._dataVersion=0,t._invervalTimer=-1,t._intervalGap=0,t}t(n,e),n.prototype.setInitVersion=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){switch(n.label){case 0:return 0!==this._dataVersion?[2]:(this._dataVersion=e,t?[4,this._execPulling()]:[3,2]);case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},n.prototype.push=function(e){e<this._dataVersion||(this._versionQueue.push(e),0!==this._dataVersion&&this._execPulling())},n.prototype._execPulling=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return this._isPulling?[4,this._isPulling]:[3,2];case 1:return i.sent(),[2];case 2:return this._isPulling=this._sendRequest(this._dataVersion),[4,this._isPulling];case 3:if(e=i.sent(),t=e.code,n=e.version,r=e.hasNext,this._isPulling=null,0!==t)return[2];if(void 0===n||n<this._dataVersion)throw new Error("version error, please check: lastVersion: ".concat(this._dataVersion,", newVersion: ").concat(n));return o=this._versionQueue.filter((function(e){return e>n})),this._versionQueue=ye([],ve(o),!1),this._dataVersion=n,this._resetIntervalTimer(),r?(this._execPulling(),[2]):(this._versionQueue.length>0&&(this._versionQueue.length=0,this._execPulling()),[2])}}))}))},n.prototype.startInterval=function(e){var t=this;-1===this._invervalTimer&&(this._intervalGap=e,this._invervalTimer=setInterval((function(){return t._execPulling()}),e))},n.prototype._resetIntervalTimer=function(){var e=this;-1!==this._invervalTimer&&(clearInterval(this._invervalTimer),this._invervalTimer=setInterval((function(){return e._execPulling()}),this._intervalGap))},n.prototype.stopInterval=function(){-1!==this._invervalTimer&&clearInterval(this._invervalTimer)},n.prototype.reset=function(){this.stopInterval(),this._versionQueue.length=0,this._dataVersion=0}}($e);var et=function(){function e(e,t){var n=this;this._promise=new Promise((function(t){n._resolve=t,e(n._onResolve.bind(n))})),this._onCancel=t}return e.prototype._onResolve=function(e){this._resolve(e)},e.prototype.result=function(){return this._promise},e.prototype.abort=function(){this._onCancel(this._onResolve.bind(this))},e}(),nt=function(){function e(e,t,n){this.code=e,this.msg=t,this.data=n,this.isOk=0===e}return e.prototype.next=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this.isOk?[2,e(this.data)]:[2,this.wipe()]}))}))},e.prototype.or=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this.isOk?[2,this]:[2,e(this.code)]}))}))},e.prototype.trans=function(e){return this.isOk?rt(e(this.data)):this.wipe()},e.prototype.tryTrans=function(e){return this.isOk?e(this.data):this.wipe()},e.prototype.errmsg=function(){return JSON.stringify({code:this.code,msg:this.msg})},e.prototype.wipe=function(){return this.isOk?rt(void 0,this.msg):ot(this.code,this.msg)},e}(),rt=function(e,t){return new nt(0,t||"success",e)},ot=function(e,t,n){return new nt(e,t||"fail: ".concat(e),n)},it=function(){function e(e){this._apiName=e,this._isValid=!0,this._code=0}return e.create=function(t){return new e(t)},e.prototype.fail=function(e,t){return this._isValid||0!==this._code||(this._code=e,this._errmsg=t||this._errmsg),this},e.prototype.result=function(){if(!this._isValid&&0===this._code)throw new Error("Validator: result() should not be called without fail()");return this._isValid?rt():ot(this._code,this._errmsg)},e.prototype.validate=function(e,t,n,r){if(void 0===r&&(r=!1),!this._isValid)return this;var o=r?n(t):null==t||n(t);return this._isValid=o,o||(this._errmsg="param '".concat(e,"' is invalid")),this},e.prototype.assert=function(e,t,n,r){if(void 0===r&&(r=!1),!this._isValid)return this;if(this.validate(e,t,n,r),!this._isValid)throw ze.InvalidParameters("'".concat(e,"' at '").concat(this._apiName,"'"));return this},e.prototype.isString=function(e,t,n){return void 0===n&&(n=!1),this.validate(e,t,(function(){return"string"==typeof t}),n)},e.prototype.assertString=function(e,t,n){return void 0===n&&(n=!1),this.assert(e,t,(function(){return"string"==typeof t}),n)},e.prototype.isNotEmptyString=function(e,t,n){return void 0===n&&(n=!1),this.isString(e,t,n).validate(e,t,(function(e){return e.trim().length>0}),n)},e.prototype.assertNotEmptyString=function(e,t,n){return void 0===n&&(n=!1),this.assertString(e,t,n),this.assert(e,t,(function(e){return e.trim().length>0}),n)},e.prototype.isLimitedString=function(e,t,n,r,o){return void 0===o&&(o=!1),this.isString(e,t,o).validate(e,t,(function(e){return e.length>=n&&e.length<=r}),o)},e.prototype.assertLimitedString=function(e,t,n,r,o){return void 0===o&&(o=!1),this.assertString(e,t,o),this.assert(e,t,(function(e){return e.length>=n&&e.length<=r}),o)},e.prototype.isBoolean=function(e,t,n){return void 0===n&&(n=!1),this.validate(e,t,(function(e){return"boolean"==typeof e}),n)},e.prototype.assertBoolean=function(e,t,n){return void 0===n&&(n=!1),this.assert(e,t,(function(e){return"boolean"==typeof e}),n)},e.prototype.isNumber=function(e,t,n){return void 0===n&&(n=!1),this.validate(e,t,(function(e){return"number"==typeof e&&!Number.isNaN(e)}),n)},e.prototype.assertNumber=function(e,t,n){return void 0===n&&(n=!1),this.assert(e,t,(function(e){return"number"==typeof e&&!Number.isNaN(e)}),n)},e.prototype.isLimitedNumber=function(e,t,n,r,o){return void 0===o&&(o=!1),this.isNumber(e,t,o).validate(e,t,(function(e){return e>=n&&e<=r}),o)},e.prototype.assertLimitedNumber=function(e,t,n,r,o){return void 0===o&&(o=!1),this.assertNumber(e,t,o),this.assert(e,t,(function(e){return e>=n&&e<=r}),o)},e.prototype.isInteger=function(e,t,n){return void 0===n&&(n=!1),this.validate(e,t,(function(e){return Number.isInteger(e)}),n)},e.prototype.assertInteger=function(e,t,n){return void 0===n&&(n=!1),this.assert(e,t,(function(e){return Number.isInteger(e)}),n)},e.prototype.isLimitedInteger=function(e,t,n,r,o){return void 0===o&&(o=!1),this.isInteger(e,t,o).validate(e,t,(function(e){return e>=n&&e<=r}),o)},e.prototype.assertLimitedInteger=function(e,t,n,r,o){return void 0===o&&(o=!1),this.assertInteger(e,t,o),this.assert(e,t,(function(e){return e>=n&&e<=r}),o)},e.prototype.isArray=function(e,t,n){return void 0===n&&(n=!1),this.validate(e,t,(function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")}),n)},e.prototype.assertArray=function(e,t,n){return void 0===n&&(n=!1),this.assert(e,t,(function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")}),n)},e.prototype.isLimitedArray=function(e,t,n,r,o){return void 0===r&&(r=!1),void 0===o&&(o=1),this.isArray(e,t,r).validate(e,t,(function(e){return e.length>=o&&e.length<=n}),r)},e.prototype.assertLimitedArray=function(e,t,n,r,o){return void 0===r&&(r=!1),void 0===o&&(o=1),this.assertArray(e,t,r),this.assert(e,t,(function(e){return e.length>=o&&e.length<=n}),r)},e.prototype.isTypedArray=function(e,t,n,r){return void 0===r&&(r=!1),this.isArray(e,t,r).validate(e,t,(function(e){return e.every(n)}),r)},e.prototype.assertTypedArray=function(e,t,n,r){return void 0===r&&(r=!1),this.assertArray(e,t,r),this.assert(e,t,(function(e){return e.every(n)}),r)},e.prototype.isLimitedTypedArray=function(e,t,n,r,o,i){return void 0===o&&(o=!1),void 0===i&&(i=1),this.isLimitedArray(e,t,n,o,i).validate(e,t,(function(e){return e.every(r)}),o)},e.prototype.assertLimitedTypedArray=function(e,t,n,r,o,i){return void 0===o&&(o=!1),void 0===i&&(i=1),this.assertLimitedArray(e,t,n,o,i),this.assert(e,t,(function(e){return e.every(r)}),o)},e.prototype.isObject=function(e,t,n){return void 0===n&&(n=!1),this.validate(e,t,(function(e){return"[object Object]"===Object.prototype.toString.call(e)}),n)},e.prototype.assertObject=function(e,t,n){return void 0===n&&(n=!1),this.assert(e,t,(function(e){return"[object Object]"===Object.prototype.toString.call(e)}),n)},e.prototype.isValueOf=function(e,t,n,r){return void 0===r&&(r=!1),this.validate(e,t,(function(){return Object.values(n).includes(t)}),r)},e.prototype.assertValueOf=function(e,t,n,r){return void 0===r&&(r=!1),this.assert(e,t,(function(){return Object.values(n).includes(t)}),r)},e.prototype.isFunction=function(e,t,n){return void 0===n&&(n=!1),this.validate(e,t,(function(e){return"[object Function]"===Object.prototype.toString.call(e)}),n)},e.prototype.assertFunction=function(e,t,n){return void 0===n&&(n=!1),this.assert(e,t,(function(e){return"[object Function]"===Object.prototype.toString.call(e)}),n)},e}(),st="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function at(e){var t,n,r,o,i,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=st.indexOf(e.charAt(u++))<<2|(o=st.indexOf(e.charAt(u++)))>>4,n=(15&o)<<4|(i=st.indexOf(e.charAt(u++)))>>2,r=(3&i)<<6|(s=st.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==i&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(r));return a}var ut=function(e){return"string"==typeof e},ct=function(e){return"number"==typeof e&&!Number.isNaN(e)},lt=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},pt=function(e){return function(t){return ut(t)&&(void 0===e.isTrim||0===t.length||t.trim().length>0)&&(void 0===e.minLength||t.length>=e.minLength)&&(void 0===e.maxLength||t.length<=e.maxLength)&&(void 0===e.validator||e.validator(t))}},dt=function(e){return ut(e)&&e.length>0},ht=function(e){return"[object Object]"===Object.prototype.toString.call(e)},_t=function(e){return"[object Function]"===Object.prototype.toString.call(e)},gt=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},ft=function(e){return ut(e)&&/https?:\/\//.test(e)},Et=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},It=function(e){return ct(e)&&Object.prototype.hasOwnProperty.call(exports.ConversationType,e)},Tt=function(e){var t=!1;return ut(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Ct=function(e){return pt({minLength:1,maxLength:64})(e)},Rt=function(e){var t=!1,n=!1,r=!1;if(ht(e)){var o=Object.keys(e).length;for(var i in t=o>20,e)if(n||(n=ut(i)&&!/^[A-Za-z0-9_=+-]+$/.test(i)),!r){var s=e[i];r=i.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:r}},vt=function(e){if(!ht(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(t.length,"}$")),t),16)},yt=function(e,t,n){var r=null==n?void 0:n.isReverse;ht(e)&&function(){for(var n in e)t(e[n],n,e)}(),(lt(e)||ut(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var o=0,i=e.length;o<i;o++)t(e[o],o)}()},St=function(e,t){return yt(e,(function(n,r){e[r]=t(n,r)})),e},mt=function(e){return JSON.parse(JSON.stringify(e))},At=function(){return"undefined"!=typeof RCCppEngine},Nt=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(Nt(e[n]));else for(var n in t={},e)t[n]=Nt(e[n]);else t=e;return t},Ot=function(e){var t;try{t=Nt(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},Mt=function(e){return{isRead:(e&exports.ReceivedStatus.READ)===exports.ReceivedStatus.READ,isListened:(e&exports.ReceivedStatus.LISTENED)===exports.ReceivedStatus.LISTENED,isDownload:(e&exports.ReceivedStatus.DOWNLOADED)===exports.ReceivedStatus.DOWNLOADED,isRetrieved:(e&exports.ReceivedStatus.RETRIEVED)===exports.ReceivedStatus.RETRIEVED}},Lt=function(e){return[exports.PlatformInfo.Android,exports.PlatformInfo.iOS,exports.PlatformInfo.Web,exports.PlatformInfo.PC,exports.PlatformInfo.Mini,exports.PlatformInfo.HarmonyOS].map((function(t){var n=e.findIndex((function(e){return e.platform===t}));return-1===n?{platform:t,changeTime:0,eventValue:0}:e[n]}))},Ut=function(e,t,n){var r=t.reduce((function(e,t){return["gender","role","level"].includes(t.key)?e[t.key]=Number(t.value):e[t.key]=t.value,e}),{});return r.userId=e,n.forEach((function(e){r.extraProfile=r.extraProfile||{},r.extraProfile[e.key]=e.value})),r},Pt=function(e,t,n){return t?1===n?D.TLS:D.RMTP:"http"===e?D.WS:D.WSS},bt=function(e,t){var n=e.server,r=e.backupServer,o=e.bs,i=e.serverAddr,s=e.protocol,a=e.openTLS;if(i)return ye([],ve(i.filter((function(e){return e.addr}))),!1);var u=[],c=[];return n&&c.push(n),(r||o||"").split(",").forEach((function(e){c.indexOf(e)<0&&c.push(e)})),c.forEach((function(e,r){e&&u.push({addr:e,protocol:Pt(s,t,a),weight:n.length-r,race:!1})})),ye([],ve(u),!1)},xt=function(e){return void 0===e&&(e=[]),e.map((function(e){var t,n,r,o,i,s,a,u,c,l=Ft(e.settingProfile)||{},p=e.extProfile||[],d=e.targetId,h=e.baseInfo,_=e.userInfo;return{groupId:d,groupName:null!==(t=l.name)&&void 0!==t?t:"",portraitUri:null!==(n=l.portraitUrl)&&void 0!==n?n:"",introduction:null!==(r=l.introduction)&&void 0!==r?r:"",notice:null!==(o=l.announcement)&&void 0!==o?o:"",extProfile:Ft(p),joinPermission:~~l.joinPerm,removeMemberPermission:~~l.removePerm,invitePermission:~~l.memInvitePerm,inviteHandlePermission:~~l.invitePerm,groupInfoEditPermission:~~l.profilePerm,memberInfoEditPermission:~~l.memProfilePerm,creatorId:null!==(i=null==h?void 0:h.creatorId)&&void 0!==i?i:"",ownerId:null!==(s=null==h?void 0:h.ownerId)&&void 0!==s?s:"",createTime:(null==h?void 0:h.createTime)?vt(h.createTime):0,membersCount:null!==(a=null==h?void 0:h.memberCount)&&void 0!==a?a:0,remark:null!==(u=null==_?void 0:_.remarkName)&&void 0!==u?u:"",joinedTime:(null==_?void 0:_.joinTime)?vt(_.joinTime):0,role:null!==(c=null==_?void 0:_.role)&&void 0!==c?c:exports.GroupMemberRole.UNDEF}}))},Dt=function(e){return void 0===e&&(e=[]),e.map((function(e){var t=Ft(e.settingProfile),n=e.extProfile||[],r=e.targetId,o=e.baseInfo,i=e.userInfo;return JSON.parse(JSON.stringify(Ee(Ee({groupId:r},Vt(t)),{extProfile:n.length>0?Ft(n):void 0,creatorId:null==o?void 0:o.creatorId,ownerId:null==o?void 0:o.ownerId,createTime:(null==o?void 0:o.createTime)?vt(o.createTime):void 0,membersCount:null==o?void 0:o.memberCount,remark:null==i?void 0:i.remarkName})))}))},wt=function(e){if(void 0!==e){var t=Number(e);return Number.isNaN(t)?void 0:t}},Vt=function(e){return JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:wt(e.joinPerm),removeMemberPermission:wt(e.removePerm),invitePermission:wt(e.memInvitePerm),inviteHandlePermission:wt(e.invitePerm),groupInfoEditPermission:wt(e.profilePerm),memberInfoEditPermission:wt(e.memProfilePerm)}))},Gt=function(e){void 0===e&&(e=[]);var t=e.map((function(e){var t=e||{},n=t.ext,r=t.userId,o=t.name,i=t.portraitUrl,s=n||{},a=s.role,u=s.joinTime,c=s.channelNickName,l=s.additional;return{userId:r,name:o||"",portraitUri:i||"",nickname:c||"",role:a||exports.GroupMemberRole.UNDEF,joinedTime:vt(u)||0,extra:l||""}}));return t},Ft=function(e){var t={};return e&&0!==e.length?(e.forEach((function(e){t[e.key]=e.value})),t):t},Bt=function(e){return e.map((function(e){var t=e.targetId,n=e.joinUserInfo,r=e.inviterInfo,o=e.status,i=e.directionType,s=e.detail,a=e.joinType,u=e.processInfo,c=e.processTime;return Ee(Ee(Ee(Ee({groupId:t},n&&{joinMemberInfo:Gt([n])[0]}),r&&{inviterInfo:Gt([r])[0]}),u&&{operatorInfo:Gt([u])[0]}),{status:o,direction:i,type:a,operationTime:vt(c),reason:s})}))},kt=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};function Ht(e){for(var t=null===window||void 0===window?void 0:window.atob(e),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n.buffer}var qt,Yt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Je.gen(),o=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,o=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(o)}(),i=(new Date).getTime(),s="";if(t){var a=t.split(".");s=".".concat(a[a.length-1])}return"".concat(e,"__RC-").concat(o,"_").concat(n,"_").concat(i).concat(r).concat(s)},Kt=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Qt=function(e){var t=e.length;return t<=4096&&t>=1},Wt=(qt=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+qt.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return qt=2047&++qt,parseInt(n,2)}),jt=function(){var e=je.getInfo(),t="electron";for(var n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return t},Jt=function(e,t,n){return Te(void 0,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){switch(i.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(t),"AES-CBC",!0,["decrypt"])];case 1:return r=i.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},r,Ht(e))];case 2:return o=i.sent(),[2,(new TextDecoder).decode(o)]}}))}))};function Xt(e,t){var n;if(!e)return"";var r="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?r?e.replace(/^https?:\/\//i,"https://"):e:t!==D.HTTP||r?"https://".concat(e):"http://".concat(e)}var Zt,zt,$t,en=function(e,t){if(!e)return"";var n=e.ossConfig,r=void 0===n?"":n,o="";try{var i=JSON.parse(r);if(i.length>0){var s=i.find((function(e){return e.minio}));s&&(o=s.minio)}}catch(e){t.warn(exports.LogTagId.L_PARSE_JSON_E,JSON.stringify({ossConfig:r,error:e}))}return o};function tn(e){var t=e.method||exports.HttpMethod.GET,n=e.timeout||Ne,r=e.headers,o=e.query,i=e.body,s=e.onProgress,a=kt(e.url,o),u=new XMLHttpRequest;if(u.open(t,a),r&&u.setRequestHeader)for(var c in r)u.setRequestHeader(c,r[c]);return function(e,t,n,r){return new et((function(o){e.onreadystatechange=function(){4===e.readyState&&o({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){o({status:e.status})},r&&(e.upload.onprogress=function(e){return r(e)}),0!==t&&setTimeout((function(){e.abort(),o({status:e.status})}),t),e.send(n)}),(function(t){e.abort(),t({status:-1})}))}(u,n,i,s)}!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Zt||(Zt={})),exports.AreaCode=void 0,($t=exports.AreaCode||(exports.AreaCode={}))[$t.BJ=1]="BJ",$t[$t.SG=2]="SG",$t[$t.NA=3]="NA",$t[$t.SG_A=4]="SG_A",$t[$t.SG_B=4]="SG_B",$t[$t.SA=5]="SA";var nn=((zt={})[exports.AreaCode.BJ]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},zt[exports.AreaCode.SG]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},zt[exports.AreaCode.NA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},zt[exports.AreaCode.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},zt[exports.AreaCode.SA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]},zt);function rn(e){return exports.AreaCode[e]?e:exports.AreaCode.BJ}var on,sn=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e,t){var n,r=this.initOption||{},o=r.areaCode,i=r.navigators,s=(n=o,void 0===n&&(n=exports.AreaCode.BJ),nn[rn(n)].naviUrlBase64).map((function(e){return at(e)})),a=[],u=ve(e.split("@"),2)[1];t&&(a=u?u.split(";"):[]);var c=i&&i.length>0?ye(ye([],ve(a),!1),ve(i),!1):ye(ye([],ve(a),!1),ve(s),!1);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return Xt(e)}))},e.prototype.getLogUrlPolicyList=function(e,t){var n,r=e||{},o=r.log,i=r.logPolicy,s=this.initOption||{},a=s.areaCode,u=s.logServerUrl,c=(n=a,void 0===n&&(n=exports.AreaCode.BJ),nn[rn(n)].logUrlBase64).map((function(e){return Ee(Ee({},e),{addr:at(e.addr)})})),l=[],p={level:1,itv:6,times:5};if(o)l.push.apply(l,ye([],ve(o.addrs),!1)),Object.assign(p,o.policy);else if(i)try{var d=JSON.parse(i);l.push({addr:d.url,protocol:D.HTTPS,weight:1}),p.level=d.level,p.itv=d.itv,p.times=d.times}catch(n){t.warn(exports.LogTagId.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var h=u?ye([{addr:u,protocol:D.HTTPS,weight:101}],ve(l),!1):ye(ye([],ve(l),!1),ve(c),!1);return{policy:p,addrs:h.filter((function(e,t){return h.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return Ee(Ee({},e),{addr:Xt(e.addr,e.protocol)})})).sort((function(e,t){return t.weight-e.weight}))}},e.prototype.getMiniCmpUrlList=function(){var e,t,n=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=exports.AreaCode.BJ),nn[rn(t)].miniCmpBase64).map((function(e){return at(e)})),r=(this.initOption||{}).miniCMPProxy;return r&&r.length>0?r:n},e.prototype.getStaticConfigUrl=function(){var e,t;return(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=exports.AreaCode.BJ),nn[rn(t)].staticConfigUrlBase64).map((function(e){return at(e)}))},e.prototype.getCloudControllerUrl=function(e){var t,n,r=null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode;return(n=r,void 0===n&&(n=exports.AreaCode.BJ),nn[rn(n)].cloudControllerUrlBase64).map((function(e){return at(e)}))},e.prototype.getAreaCode=function(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:exports.AreaCode.BJ},e.prototype.setAreaCode=function(e){return!(!e||!exports.AreaCode[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)},e}(),an=new sn,un=function(){function e(e,t){this.appkey=e,this.logger=t,this.staticUrls=[]}return e.prototype.getStaticConfig=function(){var e;return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:if(!(t=this.getCache()))return[3,6];c.label=1;case 1:return c.trys.push([1,4,,5]),n=JSON.parse(t),Date.now()-(null==n?void 0:n.time)<18e5?[4,this.decryptData(n.val)]:[3,3];case 2:return r=c.sent(),(o=r.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:o.map((function(e){return Xt(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return i=c.sent(),this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==i?void 0:i.stack})),[3,5];case 5:this.clearCache(),c.label=6;case 6:return[4,this._requestHandle()];case 7:return(s=c.sent())?[4,this.decryptData(s)]:[2];case 8:return(null==(a=c.sent())?void 0:a.areaCode)!==an.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:s})),this.staticUrls=(null==a?void 0:a.bootstrap)||[],(u=null===(e=null==a?void 0:a.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:u.map((function(e){return Xt(e.addr,e.protocol)}))||[]}])}}))}))},e.prototype._requestHandle=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:e=(e=ye(ye([],ve(this.staticUrls),!1),ve(an.getStaticConfigUrl()),!1).map((function(e){return Xt(e)}))).filter((function(t,n){return e.indexOf(t)===n})),p.label=1;case 1:p.trys.push([1,6,7,8]),t=Re(e),n=t.next(),p.label=2;case 2:return n.done?[3,5]:(r=n.value,this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_T,JSON.stringify({url:r})),o=Date.now(),[4,this.sendRequest("".concat(r,"/").concat(this.appkey))]);case 3:if(i=p.sent(),s=i.code,a=i.data,200===s)return this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:r,code:s,duration:Date.now()-o})),[2,a];this.logger.warn(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:r,code:s,duration:Date.now()-o})),p.label=4;case 4:return n=t.next(),[3,2];case 5:return[3,8];case 6:return u=p.sent(),c={error:u},[3,8];case 7:try{n&&!n.done&&(l=t.return)&&l.call(t)}finally{if(c)throw c.error}return[7];case 8:return[2]}}))}))},e}();exports.LogL=void 0,(on=exports.LogL||(exports.LogL={}))[on.STATISTICS=-2]="STATISTICS",on[on.RECORD=-1]="RECORD",on[on.FATAL=0]="FATAL",on[on.ERROR=1]="ERROR",on[on.WARN=2]="WARN",on[on.INFO=3]="INFO",on[on.DEBUG=4]="DEBUG";var cn,ln=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=exports.LogL.WARN,this.debug=this._log.bind(this,exports.LogL.DEBUG),this.info=this._log.bind(this,exports.LogL.INFO),this.warn=this._log.bind(this,exports.LogL.WARN),this.error=this._log.bind(this,exports.LogL.ERROR),this.__statistics=this._log.bind(this,exports.LogL.STATISTICS),this.record=this.__statistics}return e.prototype._write=function(e){var t=e.tag,n=e.level,r=e.content,o=e.traceId;/^[\w-]+$/.test(t)?n!==exports.LogL.DEBUG&&this._handleWrite(e):console.error("".concat((new Date).toISOString(),"[").concat(this._id,"]['ERROR']: ").concat(t," | ").concat(r," | ").concat(o))},e.prototype.createTraceId=function(){return"".concat(++e._traceIdCount)},e.prototype.getSessionId=function(){return Xe},e.prototype._stdout=function(e){var t=e.time,n=e.tag,r=e.content,o=e.traceId,i=e.level,s=e.loggerId;if(console&&!(i<=exports.LogL.FATAL||i>this.outputLevel)){var a=["error","warn","info","debug"][i-1],u="".concat(new Date(t).toISOString(),"[").concat(null!=s?s:this._id,"][").concat((a||"stat").toUpperCase(),"]: ").concat(n," | ").concat(r," | ").concat(o);console[a||"warn"](u)}},e.prototype.setOutputLevel=function(e){(function(e){return[exports.LogL.DEBUG,exports.LogL.INFO,exports.LogL.WARN,exports.LogL.ERROR].some((function(t){return t===e}))})(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,r){var o={time:Date.now(),level:e,tag:t,content:n,traceId:r,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(o),this._write(o)},e.prototype.summary=function(e,t,n,r,o,i){var s,a;void 0===r&&(r={}),t.isOk?this.info(e,null!==(s=null==o?void 0:o())&&void 0!==s?s:JSON.stringify(Ee({isOk:!0},r)),n):this.warn(e,null!==(a=null==i?void 0:i())&&void 0!==a?a:JSON.stringify(Ee({code:t.code,msg:t.msg},r)),n)},e._traceIdCount=0,e}(),pn=function(){function e(e,t,n,r,o,i){void 0===i&&(i=!1),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=r,this.logger=o,this.disableLogReport=i,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o;return Ce(this,(function(i){return this.started?[2]:(this.userId=e.userId,!e.logSwitch||this.disableLogReport||(n=an.getLogUrlPolicyList(e,this.logger),r=n.policy,o=n.addrs,this.started=!0,this.itvByNavi=r.itv,this.timesByNavi=r.times,o.length>0&&this.realtimeReport(o[0].addr,r.level,r.itv,t)),[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l,p,d,h;return Ce(this,(function(_){switch(_.label){case 0:return this.logger.debug(exports.LogTagId.L_REALTIME_LOG_O,"compress logs: ".concat(e.length)),[4,this.compressLogs(e)];case 1:return o=_.sent(),i=o.success,s=o.data,i?(this.logger.debug(exports.LogTagId.L_REALTIME_LOG_O,"compress done",t),a=ft(n)?n:"https://".concat(n),a+="?version=".concat("5.16.0","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:a,body:s,method:"POST"})]):(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"compress failed",t),[2,{isOk:!1,itv:r}]);case 2:if(u=_.sent(),c=u.status,l=u.data,this.logger.debug(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:c,data:l}),t),200!==c)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++,[2,{isOk:!1,itv:r}];if(this.reportFailedNumber=0,l)try{(h=JSON.parse(l)).nextTime&&(r=h.nextTime),p=h.level,d=h.logSwitch}catch(e){this.logger.warn(exports.LogTagId.L_PARSE_JSON_E,JSON.stringify({error:null==e?void 0:e.stack}),t)}return[2,{isOk:!0,itv:r,level:p,logSwitch:d}]}}))}))},e.prototype.realtimeReport=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l,p,d,h,_,g,f=this;return Ce(this,(function(E){switch(E.label){case 0:return o=Date.now(),i=this.logDB.getTimestamp4RealtimeLog()||Ze,s=Math.max(o-3e4,i+1),a=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:s,level:t,itv:n}),a),[4,this.logDB.getLogs(i,s,t,!0,r)];case 1:return u=E.sent(),c=u.dbReady,l=u.logs,c?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"get logs failed",a),[3,5]);case 2:return 0!==l.length?[3,3]:(this.logger.debug(exports.LogTagId.L_REALTIME_LOG_R,"no logs",a),[3,5]);case 3:return l.length>0?[4,this._sendLogs2Realtime(l,a,e,n)]:[3,5];case 4:p=E.sent(),d=p.itv,h=p.level,_=p.logSwitch,p.isOk&&(g=Math.max.apply(Math,ye([],ve(l.map((function(e){return e.time}))),!1)),this.logDB.setTimestamp4RealtimeLog(g+1),0===_&&(this.started=!1),void 0!==h&&(t=h)),n=d,E.label=5;case 5:return this.started&&(n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return f.realtimeReport(e,t,n,r)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,r,o,i,s){return void 0===s&&(s=!1),Te(this,void 0,void 0,(function(){var a,u,c,l,p,d,h,_,g,f;return Ce(this,(function(E){switch(E.label){case 0:return"web"!==n.toLowerCase()||this.disableLogReport?[2]:(a=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:o,messageUId:i,isCloudControl:s}),a),[4,this.logDB.getLogs(e,t,exports.LogL.DEBUG,!1)]);case 1:return u=E.sent(),c=u.dbReady,l=u.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:l.length}),a),p=ft(r)?r:"https://".concat(r),p+="?version=".concat("5.16.0","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(o),c?l.length>0?[4,this.compressLogs(l)]:[3,3]:[3,5];case 2:return h=E.sent(),_=h.success,g=h.data,d=_?g:"compress failed",[3,4];case 3:d="no data",E.label=4;case 4:return[3,6];case 5:d="no database",E.label=6;case 6:return this.logger.debug(exports.LogTagId.L_REPORT_FULL_LOG_O,"compress done",a),s&&(p+="&source=cloud"),[4,this.send({url:p,body:d,method:"POST"})];case 7:return f=E.sent().status,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_R,JSON.stringify({status:f}),a),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),dn=function(e){var t=e.sessionId,n=e.level,r=e.loggerId,o=e.traceId,i=e.time,s=e.tag,a=e.type,u=e.content;ut(u)||(u=JSON.stringify(u));var c=n<0?u||"":JSON.stringify({content:u,traceId:o,from:r});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(i,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")};!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(cn||(cn={}));var hn=function(){function e(e){this.reporter=e,this.logId="",this.uploadTask=[],this.taskLock=!0}return e.prototype.uploadLogCmdTask=function(e){this.uploadTask.push(e),this.enqueueTask()},e.prototype.reportLogCmdTask=function(e){var t,n,r,o,i=this;this.taskLock=!1;var s=null!==(t=e.startTime)&&void 0!==t?t:0,a=null!==(n=e.endTime)&&void 0!==n?n:0,u=null!==(r=e.platform)&&void 0!==r?r:"",c=null!==(o=e.uri)&&void 0!==o?o:"";e.logId!==this.logId&&""!==c&&(this.logId=e.logId,this.reporter.report(s,a,u,c,e.logId,"",!0).finally((function(){i.taskLock=!0,i.uploadTask.length>0&&i.enqueueTask()})))},e.prototype.enqueueTask=function(){if(this.taskLock){var e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}},e}();var _n,gn,fn,En=function(){function e(e,t,n){this.logger=e,this.appkey=t,this.reporter=n,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new hn(n)}return e.prototype.init=function(){try{var e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):{timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}catch(e){this._cache={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache),this.setMRTRConfig(this._handleMrtrData(this._cache.mrtr)))},e.prototype.isExire=function(){return(new Date).getTime()-this.timestamp<this.expire},e.prototype.isOverclock=function(){return(new Date).getTime()-this.lastRequestTime<this.interval},e.prototype.logCmdMsgTasks=function(e){var t=this;e.uploadLog&&e.uploadLog.tasks.forEach((function(e){e.objectName===exports.MessageType.LOG_COMMAND&&t.uploadTaskManage.uploadLogCmdTask(e)}))},e.prototype.dataHandle=function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,Et(e)&&(t.timestamp=e.timestamp,e.uploadLog&&!e.uploadLog.temporary&&(t.uploadLog=e.uploadLog),e.cc&&!e.cc.temporary&&(t.cc=e.cc),e.mrtr&&!e.mrtr.temporary&&(t.mrtr=this._handleMrtrData(e.mrtr)),e.mrtr&&this.setMRTRConfig(this._handleMrtrData(e.mrtr))),this.setCloudControllerCache(t),this.expire=t.cc.expire,this.interval=t.cc.interval,this.timestamp=t.timestamp,this.logCmdMsgTasks(e)},e.prototype.request=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c,l,p,d;return Ce(this,(function(h){switch(h.label){case 0:return!this.isEable&&t===cn.init&&this.isExire()?(this.logger.info(exports.LogTagId.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===cn.newWorkChange&&this.isOverclock()?(this.logger.info(exports.LogTagId.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(r=Xt(e),this.lastRequestTime=(new Date).getTime(),o="".concat(r,"/v1/config"),i={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(i["RC-Token"]=n),s={platform:"web",version:"5.16.0",timestamp:this.timestamp},this.logger.record(re.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!n,uri:o})),[4,this.httpRequest(o,exports.HttpMethod.POST,i,s)]);case 1:return a=h.sent(),u=a.code,c=a.data,this.logger.record(re.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),u===exports.ErrorCode.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion?(l=c.targetRegion,this.changeAreaCode===l?[2,this.timestamp]:(p=an.setAreaCode(l),this.logger.info(exports.LogTagId.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:p,originAreaCode:an.getAreaCode(),newAreaCode:l})),this.changeAreaCode=l,(d=an.getCloudControllerUrl(l))[0]?[2,this.request(d[0],cn.other)]:(this.logger.info(exports.LogTagId.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:o,msg:"appkey region error"})),[2,this.timestamp]))):(c&&this.dataHandle(c),[2,this.timestamp||this.lastRequestTime])}}))}))},e.prototype._handleMrtrData=function(e){return{chatroom:(null==e?void 0:e.chatroom)||0,group:(null==e?void 0:e.group)||0,private:(null==e?void 0:e.private)||0,ultraGroup:(null==e?void 0:e.ultraGroup)||0,temporary:!!(null==e?void 0:e.temporary)}},e}(),In=function(e){return e===exports.ErrorCode.RC_CONN_REDIRECTED},Tn=function(){function e(e,t,n,r){this.appkey=e,this.navi=t,this.logger=n,this.listener=r,_n.add(this),this.token="",this.curCmpUrl="",this.retryCount=0,this.uuid="",fn.set(this,0),this._doConnectReason=0,this._network={status:!0,type:ge.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=exports.RCConnectionStatus.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return e.prototype.getToken=function(){return this.token},Object.defineProperty(e.prototype,"cid",{get:function(){return"".concat(this.uuid,"_").concat(this.retryCount)},enumerable:!1,configurable:!0}),e.prototype.getCurrentUserId=function(){return this._crtUserId},e.prototype.setConnectionStatus=function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus===exports.RCConnectionStatus.DISCONNECTED&&e===exports.RCConnectionStatus.CONNECTING&&(this._doConnectReason=de.CONNECT,Se(this,_n,"m",gn).call(this)),this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED&&e===exports.RCConnectionStatus.SUSPENDED&&(t===exports.ErrorCode.RC_PING_EXCEED_LIMIT?this._doConnectReason=de.TIMEOUT:t===exports.ErrorCode.RC_CONN_REDIRECTED?this._doConnectReason=de.REDIRECTED:this._doConnectReason=de.RECONNECT),this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED){var n={bid:jt(),cod:t,net:this.getNetwork().type,dur:Date.now()-Se(this,fn,"f"),cid:this.cid};this.logger.record(re.IM_CONNECTION_DURATION,JSON.stringify(n)),e===exports.RCConnectionStatus.SUSPENDED&&Se(this,_n,"m",gn).call(this)}switch(this._crtConnectionStatus=e,e){case exports.RCConnectionStatus.CONNECTED:this.logger.info(exports.LogTagId.L_CONNECT_S,"status: ".concat(e)),this.checkAlive(),this.listener.onConnected();break;case exports.RCConnectionStatus.CONNECTING:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e)),this.listener.onConnecting();break;case exports.RCConnectionStatus.SUSPENDED:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),In(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(t)}}},e.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},e.prototype.setNetwork=function(e,t){if(!t){var n={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(re.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED?[2,rt(this._crtUserId)]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.token=e,this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),[4,this.try2Connect(e,t,!1,r,!0)]);case 1:return o=a.sent(),i=o.code,s=o.data,i!==exports.ErrorCode.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,i),[2,ot(i)]):(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2,rt(s)])}}))}))},e.prototype.try2Connect=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i;return Ce(this,(function(s){switch(s.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,r,o),[4,this._crtConnectionTask]);case 1:return i=s.sent(),this._crtConnectionTask=null,[2,i]}}))}))},e.prototype.createConnectionTask=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i,s,a,u,c,l,p,d,h,_;return Ce(this,(function(g){switch(g.label){case 0:return i={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0},this.logger.record(re.IM_STATS_CS,JSON.stringify(i)),s={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},[4,this.navi.request(e,n,!1,r,s)];case 1:return a=g.sent(),u=a.code,c=a.data,u!==exports.ErrorCode.SUCCESS?[2,ot(u)]:1===(l=c).type?[2,ot(exports.ErrorCode.PACKAGE_ENVIRONMENT_ERROR)]:(this.logger.info(exports.LogTagId.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),r),[4,this.connectWithToken(e.replace(/@.+$/,"@"),l,t,r)]);case 2:return p=g.sent(),d=p.code,h=p.data,o||d===exports.ErrorCode.SUCCESS||(this.retryCount+=1),In(d)?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"redirect code: ".concat(d),r),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,r,o)]):[exports.ErrorCode.RC_TCP_RESET,exports.ErrorCode.RC_CONN_ACK_TIMEOUT,exports.ErrorCode.RC_TCP_DISCONNECTED_NO_RMTP].includes(d)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),_=this.cmpWeightCache.every((function(e){return e.failed})),o&&_?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"cpp code:".concat(d,",reture code:").concat(exports.ErrorCode.SERVER_UNAVAILABLE),r),[2,ot(exports.ErrorCode.SERVER_UNAVAILABLE)]):(this.logger.warn(exports.LogTagId.L_CONNECT_R,"cmp ack timeout, code: ".concat(d),r),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,d),this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),[2,this.createConnectionTask(e,t,!1,r,o)])):d!==exports.ErrorCode.SUCCESS?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"code: ".concat(d),r),[2,ot(d)]):(this.logger.info(exports.LogTagId.L_CONNECT_R,"userId: ".concat(h),r),me(this,fn,Date.now(),"f"),this._crtUserId=h,[2,rt(h)])}}))}))},e.prototype.try2Reconnect=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o=this;return Ce(this,(function(i){return n=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),r=function(){return Te(o,void 0,void 0,(function(){var o;return Ce(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.SUSPENDED?[2]:(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING,t),[4,this.try2Connect(this.token,!0,e,n,!1)]);case 1:return o=i.sent().code,this.reconnectTimer=null,o===exports.ErrorCode.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2]):[exports.ErrorCode.SERVER_UNAVAILABLE,exports.ErrorCode.TIMEOUT,exports.ErrorCode.RC_SOCKET_DISCONNECTED,exports.ErrorCode.RC_SOCKET_NOT_CREATED,exports.ErrorCode.RC_CONN_ACK_TIMEOUT,exports.ErrorCode.RC_TCP_RESET,exports.ErrorCode.RC_NAVI_REQ_FAILED,exports.ErrorCode.RC_NETWORK_DOWN,exports.ErrorCode.RC_TCP_DISCONNECTED_NO_RMTP].includes(o)?(this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTING||(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,o),this.reconnectTimer=setTimeout(r,5e3)),[2]):(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,o),[2])}}))}))},r(),[2]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return In(e)?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===exports.ErrorCode.RC_UDP_DISCONNECTED?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return Te(this,void 0,void 0,(function(){var e,t,n=this;return Ce(this,(function(r){switch(r.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?(this._failedCount=0,this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=r.sent())===exports.ErrorCode.SUCCESS?(this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?[2]:(this._failedCount+=1,this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_R,"code: ".concat(t,", count: ").concat(this._failedCount),e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(exports.LogTagId.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,exports.ErrorCode.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,exports.ErrorCode.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,exports.ErrorCode.ACTIVE_DISCONNECT),this.close(!1,e),[2]}}))}))},e.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},e.prototype.getCmpList=function(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return ye([],ve(this.cmpWeightCache),!1);var n=bt(e,t);return this.cmpWeightCache=ye([],ve(n),!1),ye([],ve(n),!1)},e.prototype.updateCmpWeight=function(e,t,n){if(this.cmpWeightCache){var r=this.cmpWeightCache.find((function(t){return n?t.addr===e&&t.protocol===D.QUIC:t.addr===e}));if(r)if(t){var o=Math.max.apply(Math,ye([],ve(this.cmpWeightCache.map((function(e){return e.weight}))),!1));r.weight!==o&&(r.weight=o+1)}else{var i=Math.min.apply(Math,ye([],ve(this.cmpWeightCache.map((function(e){return e.weight}))),!1));r.weight!==i&&(r.weight=i-1),r.failed=!0}}},e.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},e.prototype.reconnect=function(e,t,n,r){this.token=e,this._openCallPlus=n,this.onDisconenctUnusual(r)},e}();fn=new WeakMap,_n=new WeakSet,gn=function(){this.uuid=Je.gen(),this.retryCount=0};var Cn,Rn,vn,yn=function(e){return e.replace(/@.+$/,"@")},Sn=function(){function e(e,t,n,r,o){void 0===r&&(r=!0),void 0===o&&(o=!0),this.appkey=e,this.logger=t,this.staticConfigManager=n,this.isRequestProfile=r,this.isUseDynamicNaviUrl=o,this.crtRequest=null,this._environment="default"}return e.prototype.getCatchKey=function(e){return e+(this._environment?"-".concat(this._environment):"")},e.prototype.request=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i;return Ce(this,(function(s){switch(s.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,r,o),[4,this.crtRequest]);case 1:return i=s.sent(),this.crtRequest=null,[2,i]}}))}))},e.prototype.sendRequest=function(e,t,n,r,o){var i;return Te(this,void 0,void 0,(function(){var s,a,u,c,l,p,d,h,_,g,f,E,I,T,C,R,v;return Ce(this,(function(y){switch(y.label){case 0:return s=yn(e),a=this.getNaviCache(s),!t&&a&&(u=a.timestamp,c=a.naviInfo,n||Date.now()-u<Ae)?(this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),r),o&&(l=o.uuid,p=o.retryCount,d=o.reason,h={bid:jt(),ptc:ue.NAVI,cod:exports.ErrorCode.SUCCESS,net:o.type,dur:0,spr:0,pr:null!==(i=c.type)&&void 0!==i?i:0,hos:"",cache:ce.LOCAL,v:le.CURRENT,rsn:d,cid:"".concat(l,"_").concat(p),count:p},this.logger.record(re.IM_NAVI,JSON.stringify(h),r)),[2,rt(c)]):(_=an.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(exports.LogTagId.L_GET_NAVI_T,JSON.stringify({token:e,uris:_}),r),[4,this.requestHandler(_,e,r,o)]);case 1:return g=y.sent(),f=g.code,E=g.data,f===exports.ErrorCode.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(I=y.sent())?void 0:I.navi)&&(null==I?void 0:I.navi.length)>0?(T=I.navi,[4,this.requestHandler(T,e,r,o)]):[3,4];case 3:C=y.sent(),f=C.code,E=C.data,y.label=4;case 4:return f!==exports.ErrorCode.SUCCESS?(this.logger.warn(exports.LogTagId.L_GET_NAVI_R,f,r),[2,ot(f)]):(R=E).code&&200!==R.code?(this.logger.warn(exports.LogTagId.L_GET_NAVI_R,R.code,r),[2,ot(this.transHttpCode(R.code))]):bt(R).length>0?(this.logger.info(exports.LogTagId.L_GET_NAVI_R,JSON.stringify({naviInfo:R}),r),this.setNaviCache(s,R),[2,rt(R)]):(v={server:R.server,backupServer:R.backupServer,serverAddr:R.serverAddr,bs:R.bs},this.logger.warn(exports.LogTagId.L_GET_NAVI_R,"navi server address invalid: ".concat(JSON.stringify(v)),r),[2,ot(exports.ErrorCode.SERVER_UNAVAILABLE)])}}))}))},e.prototype.requestHandler=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l,p,d;return Ce(this,(function(h){switch(h.label){case 0:o=0,i=e.length,h.label=1;case 1:return o<i?(s=o===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,e[o],this.appkey,t,n,s)]):[3,4];case 2:if(c=h.sent(),l=c.code,p=c.data,d={bid:jt(),ptc:ue.NAVI,cod:l,net:null==r?void 0:r.type,dur:Date.now()-u,spr:0,pr:(null==p?void 0:p.type)||0,hos:e[o],cache:ce.REQUEST,v:le.CURRENT,rsn:null==r?void 0:r.reason,cid:"".concat(null==r?void 0:r.uuid,"_").concat(null==r?void 0:r.retryCount),count:null==r?void 0:r.retryCount},this.logger.record(re.IM_NAVI,JSON.stringify(d),n),[exports.ErrorCode.SUCCESS,exports.ErrorCode.RC_CONN_TOKEN_INCORRECT,exports.ErrorCode.RC_LICENSE_EXPIRED].includes(l))return[2,l===exports.ErrorCode.SUCCESS?rt(p):ot(l)];h.label=3;case 3:return o+=1,[3,1];case 4:return[2,ot(exports.ErrorCode.RC_NAVI_REQ_FAILED)]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return exports.ErrorCode.RC_CONN_TOKEN_INCORRECT;case 416:return exports.ErrorCode.RC_LICENSE_EXPIRED;default:return exports.ErrorCode.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(yn(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(yn(e),Ee(Ee({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,r=e.token,o=e.platform,i=e.protocol,s=e.mac;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var a="token=".concat(encodeURIComponent(r),"&version=").concat("5.16.0","&platfrom=").concat(o);return s&&(a+="&m=".concat(s)),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(i,";rtc=4;log=2;iptype=v4,v6")},body:a,url:t,timeout:1e4}},e.prototype.useV2Navi=function(){return!0},e}(),mn=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,r=t.length;n<r;n++)if(!e[t[n]])return!1;return!0}(uni))},An=function(){function e(e){Cn.add(this),Rn.set(this,void 0),me(this,Rn,e,"f"),this._logger=e.logger}return e.prototype.open=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return e=e.sort((function(e,t){return t.weight-e.weight})),[2,Se(this,Cn,"m",vn).call(this,e,Se(this,Rn,"f"))]}))}))},e}();Rn=new WeakMap,Cn=new WeakSet,vn=function e(t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s=this;return Ce(this,(function(a){switch(a.label){case 0:return 0===t.length?[2,ot(exports.ErrorCode.STREAM_MESSAGE_REQUEST_FAIL,"All addrs failed")]:(r=t.shift(),o=Xt(r.addr,r.protocol),o="".concat(o,"/v3/message/get_stream.json?sdkVersion=").concat("5.16.0","&platform=").concat(this._platform,"&messageUID=").concat(n.msgUId),[4,this._openHandler(o,n)]);case 1:return[2,(i=a.sent()).or((function(r){return Te(s,void 0,void 0,(function(){return Ce(this,(function(o){return-1===r?[2,Se(this,Cn,"m",e).call(this,t,n)]:[2,i]}))}))}))]}}))}))};var Nn=mn();var On=null,Mn=function(e){return Te(void 0,void 0,void 0,(function(){var t;return Ce(this,(function(n){switch(n.label){case 0:return[4,Un.getNetworkType()];case 1:return t=n.sent(),On({status:"online"===e.type,type:t}),[2]}}))}))};var Ln=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._platform="Websocket",t}return t(n,e),n.prototype._openHandler=function(e,t){return Te(this,void 0,void 0,(function(){var n=this;return Ce(this,(function(r){return[2,new Promise((function(r){n._logger.debug(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_O,"try open -> ".concat(e));var o=new XMLHttpRequest;o.open("GET",e,!0),o.timeout=t.timeout,o.ontimeout=function(){n._logger.warn(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_E,"timeout -> ".concat(e)),r(ot(-1,"timeout"))},o.onreadystatechange=function(i){if(o.readyState===XMLHttpRequest.HEADERS_RECEIVED){var s=o.getResponseHeader("Content-Type"),a=null==s?void 0:s.startsWith("text/event-stream");if(200===o.status&&a){r(rt());var u=0;o.onprogress=function(e){var n=o.response.slice(u);u=o.response.length,t.onRawContent(n)},o.onerror=function(r){n._logger.warn(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_E,"network error in transit -> ".concat(e)),o.onprogress=null,o.abort(),t.onNetworkError(exports.ErrorCode.STREAM_MESSAGE_REQUEST_FAIL)}}else o.onloadend=function(){var e=JSON.parse(o.response);r(ot(e.code,e.message))}}},o.onerror=function(t){n._logger.warn(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_E,"req fail -> ".concat(e)),r(ot(-1))},o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.setRequestHeader("App-Key",t.appkey),o.setRequestHeader("Authorization","Bearer ".concat(t.token)),o.send()}))]}))}))},n}(An),Un={tag:"browser",httpReq:function(e){return tn(e).result()},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:Nn,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){n.onclose=function(t){var n=t.code,r=t.reason;e(n,r)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:ge.UNKONWN},t=e.type,n=e.effectiveType,r=t||n||ge.UNKONWN;return Promise.resolve(r)},setNetworkStatusListener:function(e){On=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",Mn),window.addEventListener("online",Mn))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",Mn),window.removeEventListener("online",Mn)),On=null},createSSEClient:function(e){return rt(new Ln(e))}},Pn=mn(),bn=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,ye([],ve(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}},xn={setItem:bn("setStorageSync"),getItem:bn("getStorageSync"),removeItem:bn("removeStorageSync"),clear:bn("clearStorageSync")},Dn=null,wn=function(e){var t=e.isConnected,n=e.networkType;Dn({status:t,type:n})};var Vn={tag:"wechat",httpReq:function(e){var t=e.method||exports.HttpMethod.GET,n=e.timeout||Ne,r=e.headers,o=e.query,i=e.body,s=kt(e.url,o);return new Promise((function(e){wx.request({url:s,method:t,header:r,timeout:n,data:i,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:xn,sessionStorage:xn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Pn,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(ge.UNKONWN)}})}))},setNetworkStatusListener:function(e){Dn=e,wx.onNetworkStatusChange(wn)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(wn),Dn=null},createSSEClient:function(e){return ot(exports.ErrorCode.NOT_SUPPORT)}},Gn=mn(),Fn=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var r=my[e]({key:t[0]}).data;return r?JSON.stringify(r):r}catch(e){}}},Bn={setItem:Fn("setStorageSync"),getItem:Fn("getStorageSync"),removeItem:Fn("removeStorageSync"),clear:Fn("clearStorageSync")},kn=null,Hn=function(e){var t=e.isConnected,n=e.networkType;kn({status:t,type:n})};var qn={tag:"alipay",httpReq:function(e){var t=e.method||exports.HttpMethod.GET,n=e.timeout||Ne,r=e.headers,o=e.query,i=e.body,s=kt(e.url,o),a=e.dataType||"json";return new Promise((function(e){my.request({url:s,method:t,headers:r,timeout:n,data:i,dataType:a,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:Bn,sessionStorage:Bn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Gn,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(ge.UNKONWN)}})}))},setNetworkStatusListener:function(e){kn=e,my.onNetworkStatusChange(Hn)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(Hn),kn=null},createSSEClient:function(e){return ot(exports.ErrorCode.NOT_SUPPORT,"Not supported yet")}},Yn=mn(),Kn=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,ye([],ve(t),!1))}catch(e){}}},Qn={setItem:Kn("setStorageSync"),getItem:Kn("getStorageSync"),removeItem:Kn("removeStorageSync"),clear:Kn("clearStorageSync")},Wn=null,jn=function(e){var t=e.isConnected,n=e.networkType;Wn({status:t,type:n})};var Jn={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Yn,localStorage:Qn,sessionStorage:Qn,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail:function(e){t({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(ge.UNKONWN)}})}))},setNetworkStatusListener:function(e){Wn=e,tt.onNetworkStatusChange(jn)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(jn),Wn=null},createSSEClient:function(e){return ot(exports.ErrorCode.NOT_SUPPORT)}},Xn=mn(),Zn=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,ye([],ve(t),!1))}catch(e){}}},zn={setItem:Zn("setStorageSync"),getItem:Zn("getStorageSync"),removeItem:Zn("removeStorageSync"),clear:Zn("clearStorageSync")},$n=null,er=function(e){var t=e.isConnected,n=e.networkType;$n({status:t,type:n})};var tr={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Xn,localStorage:zn,sessionStorage:zn,httpReq:function(e){return new Promise((function(t){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail:function(e){t({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(ge.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){$n=e,swan.onNetworkStatusChange(er)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(er),$n=null},createSSEClient:function(e){return ot(exports.ErrorCode.NOT_SUPPORT)}},nr=mn(),rr=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,ye([],ve(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}},or={setItem:rr("setStorageSync"),getItem:rr("getStorageSync"),removeItem:rr("removeStorageSync"),clear:rr("clearStorageSync")},ir=null,sr=function(e){var t=e.isConnected,n=e.networkType;ir({status:t,type:n})};var ar={tag:"jingdong",httpReq:function(e){var t=e.method||exports.HttpMethod.GET,n=e.timeout||Ne,r=e.headers,o=e.query,i=e.body,s=kt(e.url,o);return new Promise((function(e){jd.request({url:s,method:t,header:r,timeout:n,data:i,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:or,sessionStorage:or,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:nr,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(ge.UNKONWN)}})}))},setNetworkStatusListener:function(e){ir=e,jd.onNetworkStatusChange(sr)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(sr),ir=null},createSSEClient:function(e){return ot(exports.ErrorCode.NOT_SUPPORT)}},ur=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,ye([],ve(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}},cr={setItem:ur("setStorageSync"),getItem:ur("getStorageSync"),removeItem:ur("removeStorageSync"),clear:ur("clearStorageSync")},lr=null,pr=function(e){var t=e.isConnected,n=e.networkType;lr({status:t,type:n})};var dr,hr,_r={tag:"uniapp",httpReq:function(e){var t=e.method||exports.HttpMethod.GET,n=e.timeout||Ne,r=e.headers,o=e.query,i=e.body,s=kt(e.url,o);return new Promise((function(e){uni.request({url:s,method:t,header:r,timeout:n,data:i,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:exports.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:cr,sessionStorage:cr,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},r=uni.connectSocket(n);return{id:Date.now(),onClose:function(e){r.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){r.onError((function(t){e(t.errMsg)}))},onMessage:function(e){r.onMessage((function(t){e(t.data)}))},onOpen:function(e){r.onOpen(e)},send:function(e){r.send({data:e})},close:function(e,t){r.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(ge.UNKONWN)}})}))},setNetworkStatusListener:function(e){lr=e,uni.onNetworkStatusChange(pr)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(pr),lr=null},createSSEClient:function(e){return ot(exports.ErrorCode.NOT_SUPPORT)}},gr=function(e){return e&&e.request&&e.getSystemInfo},fr="undefined"!=typeof uni&&gr(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":case"app":return _r;case"mp-jd":return ar;case"mp-baidu":return tr;case"mp-toutiao":return Jn;case"mp-alipay":return qn;case"mp-weixin":return Vn;default:return Un}}():"undefined"!=typeof jd&&gr(jd)?ar:"undefined"!=typeof my&&gr(my)?qn:"undefined"!=typeof tt&&gr(tt)?Jn:"undefined"!=typeof swan&&gr(swan)?tr:"undefined"!=typeof wx&&gr(wx)?Vn:Un;function Er(e){var t=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,i;return t?(i=(e>>>=0)>=0&&e<256)&&(r=u[e])?r:(n=o(e,(0|e)<0?-1:0,!0),i&&(u[e]=n),n):(i=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=o(e,e<0?-1:0,!1),i&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?g:_;if(t){if(e<0)return g;if(e>=p)return C}else{if(-d>=e)return R;if(e+1>=d)return T}return e<0?r(-e,t).neg():o(0|e%l,0|e/l,t)}function o(t,n,r){return new e(t,n,r)}function i(e,t,n){var o,s,a,u,l,p,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return _;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return i(e.substring(1),t,n).neg();for(s=r(c(n,8)),a=_,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),p=parseInt(e.substring(u,u+l),n),l<8?(d=r(c(n,l)),a=a.mul(d).add(r(p))):a=(a=a.mul(s)).add(r(p));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?i(t):o(t.low,t.high,t.unsigned)}var a,u,c,l,p,d,h,_,g,f,E,I,T,C,R,v;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=o,c=Math.pow,e.fromString=i,e.fromValue=s,d=(p=(l=4294967296)*l)/2,h=n(16777216),_=n(0),e.ZERO=_,g=n(0,!0),e.UZERO=g,f=n(1),e.ONE=f,E=n(1,!0),e.UONE=E,I=n(-1),e.NEG_ONE=I,T=o(-1,2147483647,!1),e.MAX_VALUE=T,C=o(-1,-1,!0),e.MAX_UNSIGNED_VALUE=C,R=o(0,-2147483648,!1),e.MIN_VALUE=R,(v=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},v.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},v.toString=function(e){var t,n,o,i,s,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(R)?(t=r(e),o=(n=this.div(t)).mul(t).sub(this),n.toString(e)+o.toInt().toString(e)):"-"+this.neg().toString(e);for(i=r(c(e,6),this.unsigned),s=this,a="";;){if(u=s.div(i),l=(s.sub(u.mul(i)).toInt()>>>0).toString(e),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},v.getHighBits=function(){return this.high},v.getHighBitsUnsigned=function(){return this.high>>>0},v.getLowBits=function(){return this.low},v.getLowBitsUnsigned=function(){return this.low>>>0},v.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(R)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},v.isZero=function(){return 0===this.high&&0===this.low},v.isNegative=function(){return!this.unsigned&&this.high<0},v.isPositive=function(){return this.unsigned||this.high>=0},v.isOdd=function(){return!(1&~this.low)},v.isEven=function(){return!(1&this.low)},v.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)},v.eq=v.equals,v.notEquals=function(e){return!this.eq(e)},v.neq=v.notEquals,v.lessThan=function(e){return this.comp(e)<0},v.lt=v.lessThan,v.lessThanOrEqual=function(e){return this.comp(e)<=0},v.lte=v.lessThanOrEqual,v.greaterThan=function(e){return this.comp(e)>0},v.gt=v.greaterThan,v.greaterThanOrEqual=function(e){return this.comp(e)>=0},v.gte=v.greaterThanOrEqual,v.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},v.comp=v.compare,v.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(f)},v.neg=v.negate,v.add=function(e){var n,r,i,a,u,c,l,p,d,h,_;return t(e)||(e=s(e)),n=this.high>>>16,r=65535&this.high,i=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,p=0,d=0,h=0,_=0,h+=(_+=a+(65535&e.low))>>>16,d+=(h+=i+l)>>>16,p+=(d+=r+c)>>>16,p+=n+u,o((h&=65535)<<16|(_&=65535),(p&=65535)<<16|(d&=65535),this.unsigned)},v.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},v.sub=v.subtract,v.multiply=function(e){var n,i,a,u,c,l,p,d,g,f,E,I;return this.isZero()?_:(t(e)||(e=s(e)),e.isZero()?_:this.eq(R)?e.isOdd()?R:_:e.eq(R)?this.isOdd()?R:_:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(h)&&e.lt(h)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,i=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,p=e.low>>>16,g=0,f=0,E=0,I=0,E+=(I+=u*(d=65535&e.low))>>>16,f+=(E+=a*d)>>>16,E&=65535,f+=(E+=u*p)>>>16,g+=(f+=i*d)>>>16,f&=65535,g+=(f+=a*p)>>>16,f&=65535,g+=(f+=u*l)>>>16,g+=n*d+i*p+a*l+u*c,o((E&=65535)<<16|(I&=65535),(g&=65535)<<16|(f&=65535),this.unsigned)))},v.mul=v.multiply,v.divide=function(e){var n,o,i,a,u,l,p;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:_;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return E;i=g}else{if(this.eq(R))return e.eq(f)||e.eq(I)?R:e.eq(R)?f:(n=this.shr(1).div(e).shl(1)).eq(_)?e.isNegative()?f:I:(o=this.sub(e.mul(n)),i=n.add(o.div(e)));if(e.eq(R))return this.unsigned?g:_;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=_}for(o=this;o.gte(e);){for(n=Math.max(1,Math.floor(o.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),p=(l=r(n)).mul(e);p.isNegative()||p.gt(o);)p=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=f),i=i.add(l),o=o.sub(p)}return i},v.div=v.divide,v.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},v.mod=v.modulo,v.not=function(){return o(~this.low,~this.high,this.unsigned)},v.and=function(e){return t(e)||(e=s(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},v.or=function(e){return t(e)||(e=s(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},v.xor=function(e){return t(e)||(e=s(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},v.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):o(0,this.low<<e-32,this.unsigned)},v.shl=v.shiftLeft,v.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):o(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},v.shr=v.shiftRight,v.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0===(e&=63)?this:(n=this.high,e<32?o(this.low>>>e|n<<32-e,n>>>e,this.unsigned):o(32===e?n:n>>>e-32,0,this.unsigned))},v.shru=v.shiftRightUnsigned,v.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},v.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},v.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},v.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]},v.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}(),n=function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,o){var i,s,a=8*o-r-1,u=(1<<a)-1,c=u>>1,l=-7,p=n?o-1:0,d=n?-1:1,h=e[t+p];for(p+=d,i=h&(1<<-l)-1,h>>=-l,l+=a;l>0;i=256*i+e[t+p],p+=d,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+p],p+=d,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),i-=c}return(h?-1:1)*s*Math.pow(2,i-r)}function o(e,t,n,r,o,i){var s,a,u,c=8*i-o-1,l=(1<<c)-1,p=l>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,_=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+p>=1?d/u:d*Math.pow(2,1-p))*u>=2&&(s++,u/=2),s+p>=l?(a=0,s=l):s+p>=1?(a=(t*u-1)*Math.pow(2,o),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;e[n+h]=255&a,h+=_,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+h]=255&s,h+=_,s/=256,c-=8);e[n+h-_]|=128*g}var i,s,a,u,c,l=function(e,t,n){if(void 0===e&&(e=l.DEFAULT_CAPACITY),void 0===t&&(t=l.DEFAULT_ENDIAN),void 0===n&&(n=l.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 l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(i=l.prototype).__isByteBuffer__,Object.defineProperty(i,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var o,i,s,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),o=0,s=0,a=e.length;a>s;++s)l.isByteBuffer(e[s])||(e[s]=l.wrap(e[s],t)),(i=e[s].limit-e[s].offset)>0&&(o+=i);if(0===o)return new l(0,n,r);for(c=new l(o,n,r),s=0;a>s;)(i=(u=e[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=i);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var o,s;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(o=i.clone.call(e)).markedOffset=-1,o;if(e instanceof Uint8Array)o=new l(0,n,r),e.length>0&&(o.buffer=e.buffer,o.offset=e.byteOffset,o.limit=e.byteOffset+e.byteLength,o.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)o=new l(0,n,r),e.byteLength>0&&(o.buffer=e,o.offset=0,o.limit=e.byteLength,o.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((o=new l(e.length,n,r)).limit=e.length,s=0;s<e.length;++s)o.view[s]=e[s]}return o},i.writeBitSet=function(e,t){var n,r,o,i,s,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(r=t,i=(o=e.length)>>3,s=0,t+=this.writeVarint32(o,t);i--;)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(o>s){for(a=0,n=0;o>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},i.readBitSet=function(e){var t,n,r,o,i,s,a,u=void 0===e;for(u&&(e=this.offset),o=(r=(n=this.readVarint32(e)).value)>>3,i=0,s=[],e+=n.length;o--;)t=this.readByte(e++),s[i++]=!!(1&t),s[i++]=!!(2&t),s[i++]=!!(4&t),s[i++]=!!(8&t),s[i++]=!!(16&t),s[i++]=!!(32&t),s[i++]=!!(64&t),s[i++]=!!(128&t);if(r>i)for(a=0,t=this.readByte(e++);r>i;)s[i++]=!!(1&t>>a++);return u&&(this.offset=e),s},i.readBytes=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},i.writeBytes=i.append,i.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},i.writeByte=i.writeInt8,i.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&~(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},i.readByte=i.readInt8,i.writeUint8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},i.writeUInt8=i.writeUint8,i.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},i.readUInt8=i.readUint8,i.writeInt16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},i.writeShort=i.writeInt16,i.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&~t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},i.readShort=i.readInt16,i.writeUint16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},i.writeUInt16=i.writeUint16,i.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},i.readUInt16=i.readUint16,i.writeInt32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},i.writeInt=i.writeInt32,i.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},i.readInt=i.readInt32,i.writeUint32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},i.writeUInt32=i.writeUint32,i.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},i.readUInt32=i.readUint32,e&&(i.writeInt64=function(t,n){var r,o,i,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,o=t.low,i=t.high,this.littleEndian?(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,n+=4,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,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),s&&(this.offset+=8),this},i.writeLong=i.writeInt64,i.readInt64=function(t){var n,r,o,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+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),o=new e(n,r,!1),i&&(this.offset+=8),o},i.readLong=i.readInt64,i.writeUint64=function(t,n){var r,o,i,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,o=t.low,i=t.high,this.littleEndian?(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,n+=4,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,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),s&&(this.offset+=8),this},i.writeUInt64=i.writeUint64,i.readUint64=function(t){var n,r,o,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+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),o=new e(n,r,!0),i&&(this.offset+=8),o},i.readUInt64=i.readUint64),i.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,o(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},i.writeFloat=i.writeFloat32,i.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},i.readFloat=i.readFloat32,i.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,o(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},i.writeDouble=i.writeFloat64,i.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},i.readDouble=i.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return e>>>1^-(1&e)},i.writeVarint32=function(e,t){var n,r,o,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)}for((t+=r=l.calculateVarint32(e))>(o=this.buffer.byteLength)&&this.resize((o*=2)>t?o:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,i?(this.offset=t,this):r},i.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},i.readVarint32=function(e){var t,n,r,o,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(o=Error("Truncated")).truncated=!0,o;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(128&t);return r|=0,i?(this.offset=e,r):{value:r,length:n}},i.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,o=t.shiftRightUnsigned(56).toInt()>>>0;return 0==o?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:o<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},i.writeVarint64=function(t,n){var r,o,i,s,a,u=void 0===n;if(u&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=l.calculateVarint64(t),o=t.toInt()>>>0,i=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|i>>>21:127&i>>>21;case 7:this.view[n+6]=7!==r?128|i>>>14:127&i>>>14;case 6:this.view[n+5]=6!==r?128|i>>>7:127&i>>>7;case 5:this.view[n+4]=5!==r?128|i:127&i;case 4:this.view[n+3]=4!==r?128|o>>>21:127&o>>>21;case 3:this.view[n+2]=3!==r?128|o>>>14:127&o>>>14;case 2:this.view[n+1]=2!==r?128|o>>>7:127&o>>>7;case 1:this.view[n]=1!==r?128|o:127&o}return u?(this.offset+=r,this):r},i.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},i.readVarint64=function(t){var n,r,o,i,s,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,r=0,o=0,i=0,s=0,r=127&(s=this.view[t++]),128&s&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(i=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|o<<28,o>>>4|i<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},i.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),i.writeCString=function(e,n){var r,o,i,s=void 0===n;if(s&&(n=this.offset),o=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;o>r;++r)if(0===e.charCodeAt(r))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return o=c.calculateUTF16asUTF8(t(e))[1],n+=o+1,i=this.buffer.byteLength,n>i&&this.resize((i*=2)>n?i:n),n-=o+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):o},i.readCString=function(e){var t,r,o,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,o=-1,c.decodeUTF8toUTF16(function(){if(0===o)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(o=this.view[e++])?null:o}.bind(this),r=n(),!0),i?(this.offset=e,r()):{string:r(),length:e-t}},i.writeIString=function(e,n){var r,o,i,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(o=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,i=this.buffer.byteLength,n>i&&this.resize((i*=2)>n?i:n),n-=4+r,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r):(this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),n+=4,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return s?(this.offset=n,this):n-o},i.readIString=function(e){var t,n,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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=r.length,o?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",i.writeUTF8String=function(e,n){var r,o,i,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 o=n,r=c.calculateUTF16asUTF8(t(e))[1],n+=r,i=this.buffer.byteLength,n>i&&this.resize((i*=2)>n?i:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-o},i.writeString=i.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,i.readUTF8String=function(e,t,r){var o,i,s,a,u;if("number"==typeof t&&(r=t,t=void 0),(o=void 0===r)&&(r=this.offset),void 0===t&&(t=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=r,t===l.METRICS_CHARS){if(i=n(),c.decodeUTF8(function(){return e>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++s,c.UTF8toUTF16(e,i)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return o?(this.offset=r,i()):{string:i(),length:r-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(u=r+e,c.decodeUTF8toUTF16(function(){return u>r?this.view[r++]:null}.bind(this),i=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return o?(this.offset=r,i()):{string:i(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},i.readString=i.readUTF8String,i.writeVString=function(e,n){var r,o,i,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],o=l.calculateVarint32(r),n+=o+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=o+r,n+=this.writeVarint32(r,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+r+o)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+o));return a?(this.offset=n,this):n-i},i.readVString=function(e){var t,n,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,n=this.readVarint32(e),r=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=r.length,o?(this.offset=e,r.string):{string:r.string,length:e-t}},i.append=function(e,t,n){var r,o,i;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(o=e.limit-e.offset)<=0||((n+=o)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=o,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=o,r&&(this.offset+=o)),this},i.appendTo=function(e,t){return e.append(this,t),this},i.assert=function(e){return this.noAssert=!e,this},i.capacity=function(){return this.buffer.byteLength},i.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},i.clone=function(e){var t=new l(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},i.compact=function(e,t){var n,r,o;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0===(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(o=new Uint8Array(r)).set(this.view.subarray(e,t)),this.buffer=r,this.view=o,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},i.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},i.copyTo=function(e,t,n,r){var o,i,s;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(i=void 0===t)?e.offset:0|t,n=(o=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=r-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,r),t),o&&(this.offset+=s),i&&(e.offset+=s),this)},i.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},i.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},i.flip=function(){return this.limit=this.offset,this.offset=0,this},i.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},i.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},i.LE=function(e){return this.littleEndian=void 0===e||!!e,this},i.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},i.prepend=function(e,t,n){var r,o,i,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(o=e.limit-e.offset)<=0||((i=o-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+i),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),o),this.buffer=s,this.view=a,this.offset+=i,this.markedOffset>=0&&(this.markedOffset+=i),this.limit+=i,n+=i):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-o),e.offset=e.limit,r&&(this.offset-=o)),this},i.prependTo=function(e,t){return e.prepend(this,t),this},i.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},i.remaining=function(){return this.limit-this.offset},i.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},i.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},i.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},i.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},i.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},i.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?s:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},i.toArrayBuffer=i.toBuffer,i.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},u=function(){var e,t,n={},r=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],o=[];for(e=0,t=r.length;t>e;++e)o[r[e]]=e;return n.encode=function(e,t){for(var n,o;null!==(n=e());)t(r[63&n>>2]),o=(3&n)<<4,null!==(n=e())?(t(r[63&((o|=15&n>>4)|15&n>>4)]),o=(15&n)<<2,null!==(n=e())?(t(r[63&(o|3&n>>6)]),t(r[63&n])):(t(r[63&o]),t(61))):(t(r[63&o]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,i,s;null!==(r=e());)if(void 0===(i=o[r])&&n(r),null!==(r=e())&&(void 0===(s=o[r])&&n(r),t(i<<2>>>0|(48&s)>>4),null!==(r=e()))){if(void 0===(i=o[r])){if(61===r)break;n(r)}if(t((15&s)<<4>>>0|(60&i)>>2),null!==(r=e())){if(void 0===(s=o[r])){if(61===r)break;n(r)}t((3&i)<<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}(),i.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),o=0;return u.decode(t(e),(function(e){r.view[o++]=e})),r.limit=o,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},i.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,o=e.length,i=new l(o,t);o>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);i.view[r++]=n}return i.limit=o,i},i.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,o="",i="",s="";r>n;){if(-1!==n&&(o+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(i+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;o.length<51;)o+=" ";s+=o+i+"\n",o=i=""}o+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==o){for(;o.length<51;)o+=" ";s+=o+i+"\n"}return e?s:o},l.fromDebug=function(e,t,n){for(var r,o,i=e.length,s=new l(0|(i+1)/3,t,n),a=0,u=0,c=!1,p=!1,d=!1,h=!1,_=!1;i>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(p||d||h){_=!0;break}p=d=h=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(p||h){_=!0;break}p=h=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(p||d){_=!0;break}p=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(p){_=!0;break}p=!0}s.offset=u,c=!1;break;case"]":if(!n){if(h||d){_=!0;break}h=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(h){_=!0;break}h=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){_=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){_=!0;break}if(o=parseInt(r+e.charAt(a++),16),!n&&(isNaN(o)||o<0||o>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=o,c=!0}if(_)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!p||!h)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+i)}return s},i.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(e,t,n){var r,o,i,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(o=e.length,i=new l(0|o/2,t),s=0,a=0;o>s;s+=2){if(r=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");i.view[a++]=r}return i.limit=a,i},c=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,r,o,i,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(128&n)if(192==(224&n))null===(r=e())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(o=e()))&&s([n,r,o]),t((15&n)<<12|(63&r)<<6|63&o);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(o=e())||null===(i=e()))&&s([n,r,o,i]),t((7&n)<<18|(63&r)<<12|(63&o)<<6|63&i)}else t(n)},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n);null!==r&&t(r)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,r=0;return e.UTF16toUTF8(t,(function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4})),[n,r]}};return e}(),i.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{c.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var o=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),i=0;return c.encodeUTF16toUTF8(t(e),(function(e){o.view[i++]=e})),o.limit=i,o},l}(t),r=function(t,n){var r,o,i={};return i.ByteBuffer=t,i.c=t,r=t,i.Long=n||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var e={};return e.IS_NODE=!("object"!=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 r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),i.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},i.DotProto=function(e,t){function n(e,n){var r=-1,o=1;if("-"==e.charAt(0)&&(o=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(o<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|o*r,!n&&r<0)throw Error("illegal id value: "+(o<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function o(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var i,s,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,r,o,i;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(o=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(o++)))for(;o<this.source.length&&!t.DELIM.test(this.source.charAt(o));)++o;return('"'===(i=this.source.substring(this.index,this.index=o))||"'"===i)&&(this._stringOpen=i),i},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,i=function(e){this.tn=new u(e),this.proto3=!1},(s=i.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},i.parse=function(e){return new i(e).parse()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var r,o=this.tn.next(),i=!1;if("("===o&&(i=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal option name: "+o);r=o,i&&(this.tn.skip(")"),r="("+r+")",o=this.tn.peek(),t.FQTYPEREF.test(o)&&(r+=o,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)o(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?o(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},s._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,r,o="rpc",i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal rpc service method name: "+i);if(n=i,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(i=this.tn.next()).toLowerCase()&&(r.request_stream=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal rpc service request type: "+i);if(r.request=i,this.tn.skip(")"),"returns"!==(i=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+i);if(this.tn.skip("("),"stream"===(i=this.tn.next()).toLowerCase()&&(r.response_stream=!0,i=this.tn.next()),r.response=i,this.tn.skip(")"),"{"===(i=this.tn.peek())){for(this.tn.next();"}"!==(i=this.tn.next());){if("option"!==i)throw Error("illegal rpc service token: "+i);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[o]&&(e[o]={}),e[o][n]=r},s._parseMessage=function(e,r){var o=!!r,i=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(i))throw Error("illegal "+(o?"group":"message")+" name: "+i);for(s.name=i,o&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(i=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(s,i);else if("oneof"===i)this._parseMessageOneOf(s);else if("enum"===i)this._parseEnum(s);else if("message"===i)this._parseMessage(s);else if("option"===i)this._parseOption(s);else if("service"===i)this._parseService(s);else if("extensions"===i)s.extensions=this._parseExtensionRanges();else if("reserved"===i)this._parseIgnored();else if("extend"===i)this._parseExtend(s);else{if(!t.TYPEREF.test(i))throw Error("illegal message token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(s,"optional",i)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,r,o){var i,s,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(i={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(o)throw Error("illegal type: "+o);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(i.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(i.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);i.name=s,this.tn.skip("="),i.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(i),this.tn.skip(";")}else if("group"===(o=void 0!==o?o:this.tn.next())){if(a=this._parseMessage(e,i),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);i.type=a.name,i.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(i.type=o,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);i.name=s,this.tn.skip("="),i.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(i),this.tn.skip(";")}return e.fields.push(i),i},s._parseMessageOneOf=function(e){var n,r,o,i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal oneof name: "+i);for(r=i,o=[],this.tn.skip("{");"}"!==(i=this.tn.next());)(n=this._parseMessageField(e,"optional",i)).oneof=r,o.push(n.id);this.tn.omit(";"),e.oneofs[r]=o},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var r,o={name:"",values:[],options:{}},i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal name: "+i);for(o.name=i,this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(o);else{if(!t.NAME.test(i))throw Error("illegal name: "+i);this.tn.skip("="),r={name:i,id:n(this.tn.next(),!0)},"["===(i=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),o.values.push(r)}this.tn.omit(";"),e.enums.push(o)},s._parseExtensionRanges=function(){var t,n,o,i=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":o=e.ID_MIN;break;case"max":o=e.ID_MAX;break;default:o=r(t)}if(n.push(o),2===n.length)break;if("to"!==this.tn.peek()){n.push(o);break}this.tn.next()}i.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),i},s._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=i,a}(i,i.Lang),i.Reflect=function(e){function n(t,n){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}function o(t,n){var r=n.readVarint32(),i=7&r,s=r>>>3;switch(i){case e.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(!(128&~r));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:o(s,n);break;case e.WIRE_TYPES.ENDGROUP:if(s===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+i)}return!0}var i,s,a,u,c,l,p,d,h,_,g,f,E,I,T,C,R={},v=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},y=v.prototype;return y.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},y.toString=function(e){return(e?this.className+" ":"")+this.fqn()},y.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=v,i=function(e,t,n,r,o){v.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=o||"proto2"},(s=i.prototype=Object.create(v.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},s.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,o=this,i=0;if(""===r[i]){for(;null!==o.parent;)o=o.parent;i++}do{do{if(!(o instanceof R.Namespace)){o=null;break}if(!((n=o.getChild(r[i]))&&n instanceof R.T&&(!t||n instanceof R.Namespace))){o=null;break}o=n,i++}while(i<r.length);if(null!=o)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=o);return o},s.qn=function(e){var t,n,r=[],o=e;do{r.unshift(o.name),o=o.parent}while(null!==o);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof R.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,r={},o=this.children;for(t=0,n=o.length;n>t;++t)(e=o[t])instanceof i&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var e,t,n,r,o={},i=Object.keys(this.options);for(e=0,t=i.length;t>e;++e)n=i[e],r=this.options[i[e]],o[n]=r;return o},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},R.Namespace=i,a=function(t,n,r,o){if(this.type=t,this.resolvedType=n,this.isMapKey=r,this.syntax=o,r&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},u=a.prototype,a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new r(0):t.defaultValue},u.verifyValue=function(r){var o,i,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 e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r>4294967295?0|r:r;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r<0?r>>>0:r;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(r,!1)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(r,!0)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof r&&a(typeof r,"not a boolean"),r;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof r&&a(typeof r,"not a number"),r;case e.TYPES.string:return"string"==typeof r||r&&r instanceof String||a(typeof r,"not a string"),""+r;case e.TYPES.bytes:return t.isByteBuffer(r)?r:t.wrap(r);case e.TYPES.enum:for(o=this.resolvedType.getChildren(e.Reflect.Enum.Value),s=0;s<o.length;s++){if(o[s].name==r)return o[s].id;if(o[s].id==r)return o[s].id}if("proto3"===this.syntax)return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),(r>4294967295||r<0)&&a(typeof r,"not in range for uint32"),r;a(r,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(r&&"object"==typeof r||a(typeof r,"object expected"),r instanceof this.resolvedType.clazz)return r;if(r instanceof e.Builder.Message){for(s in i={},r)r.hasOwnProperty(s)&&(i[s]=r[s]);r=i}return new this.resolvedType.clazz(r)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+r+" (undefined type "+this.type+")")},u.calculateLength=function(t,n){if(null===n)return 0;var o;switch(this.type){case e.TYPES.int32:return n<0?r.calculateVarint64(n):r.calculateVarint32(n);case e.TYPES.uint32:return r.calculateVarint32(n);case e.TYPES.sint32:return r.calculateVarint32(r.zigZagEncode32(n));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return r.calculateVarint64(n);case e.TYPES.sint64:return r.calculateVarint64(r.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return r.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return o=r.calculateUTF8Bytes(n),r.calculateVarint32(o)+o;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return r.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return o=this.resolvedType.calculate(n),r.calculateVarint32(o)+o;case e.TYPES.group:return(o=this.resolvedType.calculate(n))+r.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},u.encodeValue=function(t,n,o){var i,s;if(null===n)return o;switch(this.type){case e.TYPES.int32:n<0?o.writeVarint64(n):o.writeVarint32(n);break;case e.TYPES.uint32:o.writeVarint32(n);break;case e.TYPES.sint32:o.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:o.writeUint32(n);break;case e.TYPES.sfixed32:o.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:o.writeVarint64(n);break;case e.TYPES.sint64:o.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:o.writeUint64(n);break;case e.TYPES.sfixed64:o.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?o.writeVarint32("false"===n.toLowerCase()?0:!!n):o.writeVarint32(n?1:0);break;case e.TYPES.enum:o.writeVarint32(n);break;case e.TYPES.float:o.writeFloat32(n);break;case e.TYPES.double:o.writeFloat64(n);break;case e.TYPES.string:o.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");i=n.offset,o.writeVarint32(n.remaining()),o.append(n),n.offset=i;break;case e.TYPES.message:s=(new r).LE(),this.resolvedType.encode(n,s),o.writeVarint32(s.offset),o.append(s.flip());break;case e.TYPES.group:this.resolvedType.encode(n,o),o.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return o},u.decode=function(t,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var o,i;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(i=t.readVarint32(),t.remaining()<i)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+i+" required but got only "+t.remaining());return(o=t.clone()).limit=o.offset+i,t.offset+=i,o;case e.TYPES.message:return i=t.readVarint32(),this.resolvedType.decode(t,i);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return r.fromBinary(t)}},u.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},R.Element=a,c=function(e,t,n,r,o,s){i.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!o,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=c.prototype=Object.create(i.prototype)).build=function(n){var o,i,s,a;if(this.clazz&&!n)return this.clazz;for(o=function(e,n){function o(t,n,i,s){var a,u,c,l,p,d,h;if(null===t||"object"!=typeof t)return s&&s instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(s.object,t))?a:t;if(r.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return i?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return u=[],t.forEach((function(e,t){u[t]=o(e,n,i,s)})),u;if(u={},t instanceof e.Map){for(l=(c=t.entries()).next();!l.done;l=c.next())u[t.keyElem.valueToString(l.value[0])]=o(l.value[1],n,i,t.valueElem.resolvedType);return u}for(h in p=t.$type,d=void 0,t)t.hasOwnProperty(h)&&(u[h]=p&&(d=p.getChild(h))?o(t[h],n,i,d.resolvedType):o(t[h],n,i));return u}var i,s,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var o,i,s,l;for(e.Builder.Message.call(this),o=0,i=u.length;i>o;++o)this[u[o].name]=null;for(o=0,i=a.length;i>o;++o)this[(s=a[o]).name]=s.repeated?[]:s.map?new e.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof c)||Array.isArray(t)||t instanceof e.Map||r.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(o=0,i=arguments.length;i>o;++o)void 0!==(l=arguments[o])&&this.$set(a[o].name,l);else this.$set(t)},l=c.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,r,o){var i=n._fieldsByName[t];if(!o){if(!i)throw Error(this+"#"+t+" is undefined");if(!(i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+i.toString(!0));if(!i.repeated)throw Error(this+"#"+t+" is not a repeated field");r=i.verifyValue(r,!0)}return null===this[t]&&(this[t]=[]),this[t].push(r),this},l.$add=l.add,l.set=function(t,r,o){var i,s,a;if(t&&"object"==typeof t){for(i in o=r,t)t.hasOwnProperty(i)&&void 0!==(r=t[i])&&this.$set(i,r,o);return this}if(s=n._fieldsByName[t],o)this[t]=r;else{if(!s)throw Error(this+"#"+t+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));this[s.name]=r=s.verifyValue(r)}return s&&s.oneof&&(a=this[s.oneof.name],null!==r?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===t&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(t,r){if(r)return this[t];var o=n._fieldsByName[t];if(!(o&&o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));return this[o.name]},l.$get=l.get,i=0;i<a.length;i++)(s=a[i])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,r,o,i=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));i=i.substring(0,1).toUpperCase()+i.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),r=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},o=function(){return this[e.name]},null===n.getChild("set"+i)&&(l["set"+i]=r),null===n.getChild("set_"+t)&&(l["set_"+t]=r),null===n.getChild("get"+i)&&(l["get"+i]=o),null===n.getChild("get_"+t)&&(l["get_"+t]=o)}(s);return l.encode=function(e,r){var o,i;"boolean"==typeof e&&(r=e,e=void 0),o=!1,e||(e=new t,o=!0),i=e.littleEndian;try{return n.encode(this,e.LE(),r),(o?e.flip():e).LE(i)}catch(t){throw e.LE(i),t}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,o=!1;return e||(e=new r,o=!0),t=(new r).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),o?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return o(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(o(this,!0,!0,this.$type))},c.decode=function(e,t){var o,i;"string"==typeof e&&(e=r.wrap(e,t||"base64")),o=(e=r.isByteBuffer(e)?e:r.wrap(e)).littleEndian;try{return i=n.decode(e.LE()),e.LE(o),i}catch(t){throw e.LE(o),t}},c.decodeDelimited=function(e,t){var o,i,s;if("string"==typeof e&&(e=r.wrap(e,t||"base64")),(e=r.isByteBuffer(e)?e:r.wrap(e)).remaining()<1)return null;if(o=e.offset,i=e.readVarint32(),e.remaining()<i)return e.offset=o,null;try{return s=n.decode(e.slice(e.offset,e.offset+i).LE()),e.offset+=i,s}catch(t){throw e.offset+=i,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),c}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((i=this.children[s])instanceof g||i instanceof c||i instanceof I){if(o.hasOwnProperty(i.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+i.toString(!0)+" cannot override static property '"+i.name+"'");o[i.name]=i.build()}else if(i instanceof c.Field)i.build(),this._fields.push(i),this._fieldsById[i.id]=i,this._fieldsByName[i.name]=i;else if(!(i instanceof c.OneOf||i instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=o},l.encode=function(e,t,n){var r,o,i,s,a,u=null;for(i=0,s=this._fields.length;s>i;++i)o=e[(r=this._fields[i]).name],r.required&&null===o?null===u&&(u=r):r.encode(n?o:r.verifyValue(o),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,r=0,o=0,i=this._fields.length;i>o;++o){if(n=e[(t=this._fields[o]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},l.decode=function(t,n,r){var i,s,a,u,c,l,p,d,h,_,g,f;for(n="number"==typeof n?n:-1,c=t.offset,l=new this.clazz;t.offset<c+n||-1===n&&t.remaining()>0;){if(a=(i=t.readVarint32())>>>3,(s=7&i)===e.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(s,t)):u.map?(d=u.decode(s,t),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(s,t),u.oneof&&(null!==(h=l[u.oneof.name])&&h!==u.name&&(l[h]=null),l[u.oneof.name]=u.name));else switch(s){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:p=t.readVarint32(),t.offset+=p;break;case e.WIRE_TYPES.STARTGROUP:for(;o(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(_=0,g=this._fields.length;g>_;++_)if(null===l[(u=this._fields[_]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(f=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,f;e.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},R.Message=c,p=function(t,n,r,o,i,s,a,u,l,p){v.call(this,t,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=o||null,this.type=i,this.resolvedType=null,this.id=a,this.options=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=p||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(d=p.prototype=Object.create(v.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(t,n){var r,o,i;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),i=[],o=0;o<t.length;o++)i.push(this.element.verifyValue(t[o]));return i}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},d.hasWirePresence=function(t,n){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},d.encode=function(t,n,o){var i,s,a,u,c;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,i=0;i<t.length;i++)this.element.encodeValue(this.id,t[i],n);a=n.offset-s,(u=r.calculateVarint32(a))>1&&(c=n.slice(s,n.offset),s+=u-1,n.offset=s,n.append(c)),n.writeVarint32(a,s-u)}else for(i=0;i<t.length;i++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[i],n);else this.map?t.forEach((function(t,o){var i=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,o)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(i),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,o,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,o)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},d.calculate=function(t,n){var o,i,s;if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;o=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(o+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s=0,i=0;i<t.length;i++)s+=this.element.calculateLength(this.id,t[i]);o+=r.calculateVarint32(s),o+=s}else for(i=0;i<t.length;i++)o+=r.calculateVarint32(this.id<<3|this.type.wireType),o+=this.element.calculateLength(this.id,t[i]);else this.map?t.forEach((function(t,n){var i=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);o+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o+=r.calculateVarint32(i),o+=i}),this):this.hasWirePresence(t,n)&&(o+=r.calculateVarint32(this.id<<3|this.type.wireType),o+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return o},d.decode=function(t,n,r){var o,i,s,u,c,l,p;if(!(!this.map&&t==this.type.wireType||!r&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){for(i=n.readVarint32(),i=n.offset+i,s=[];n.offset<i;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(u=a.defaultFieldValue(this.keyType),o=a.defaultFieldValue(this.type),i=n.readVarint32(),n.remaining()<i)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+i+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+i,n.offset+=i;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(p=l>>>3))u=this.keyElement.decode(c,t,p);else{if(2!==p)throw Error("Unexpected tag in map field key/value submessage");o=this.element.decode(c,t,p)}return[u,o]}return this.element.decode(n,t,this.id)},R.Message.Field=p,h=function(e,t,n,r,o,i,s){p.call(this,e,t,n,null,r,o,i,s),this.extension},h.prototype=Object.create(p.prototype),R.Message.ExtensionField=h,_=function(e,t,n){v.call(this,e,t,n),this.fields=[]},R.Message.OneOf=_,g=function(e,t,n,r,o){i.call(this,e,t,n,r,o),this.className="Enum",this.object=null},g.getName=function(e,t){var n,r,o=Object.keys(e);for(r=0;r<o.length;++r)if(e[n=o[r]]===t)return n;return null},(g.prototype=Object.create(i.prototype)).build=function(t){var n,r,o,i;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,o=0,i=(r=this.getChildren(g.Value)).length;i>o;++o)n[r[o].name]=r[o].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},R.Enum=g,f=function(e,t,n,r){v.call(this,e,t,n),this.className="Enum.Value",this.id=r},f.prototype=Object.create(v.prototype),R.Enum.Value=f,E=function(e,t,n,r){v.call(this,e,t,n),this.field=r},E.prototype=Object.create(v.prototype),R.Extension=E,I=function(e,t,n,r){i.call(this,e,t,n,r),this.className="Service",this.clazz=null},(I.prototype=Object.create(i.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,o=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)}},i=o.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(e){i[e.name]=function(n,o){try{try{n=e.resolvedRequestType.clazz.decode(r.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void o(null,r):void o(Error("Illegal response type received in service method "+t.name+"#"+e.name))}o(n)}))}catch(e){setTimeout(o.bind(this,e),0)}},o[e.name]=function(t,n,r){new o(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(o[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(i[e.name],"$options",{value:o[e.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(o,"$options",{value:t.buildOpt()}),Object.defineProperty(i,"$options",{value:o.$options}),Object.defineProperty(o,"$type",{value:t}),Object.defineProperty(i,"$type",{value:t})),o}(e,this)},R.Service=I,T=function(e,t,n,r){v.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(T.prototype=Object.create(v.prototype)).buildOpt=s.buildOpt,R.Service.Method=T,C=function(e,t,n,r,o,i,s,a){T.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=o,this.requestStream=i,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},C.prototype=Object.create(T.prototype),R.Service.RPCMethod=C,R}(i),i.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var o=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||{}},i=o.prototype;return o.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},o.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},o.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},o.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},o.isExtend=function(e){return"string"==typeof e.ref},i.reset=function(){return this.ptr=this.ns,this},i.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},i.create=function(t){var r,i,s,a,u;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(i=t.shift(),o.isMessage(i)){if(s=new n.Message(this,this.ptr,i.name,i.options,i.isGroup,i.syntax),a={},i.oneofs&&Object.keys(i.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),i.fields&&i.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,i.syntax),t&&t.fields.push(e),s.addChild(e)}),this),u=[],i.enums&&i.enums.forEach((function(e){u.push(e)})),i.messages&&i.messages.forEach((function(e){u.push(e)})),i.services&&i.services.forEach((function(e){u.push(e)})),i.extensions&&(s.extensions="number"==typeof i.extensions[0]?[i.extensions]:i.extensions),this.ptr.addChild(s),u.length>0){r.push(t),t=u,u=null,this.ptr=s,s=null;continue}u=null}else if(o.isEnum(i))s=new n.Enum(this,this.ptr,i.name,i.options,i.syntax),i.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(o.isService(i))s=new n.Service(this,this.ptr,i.name,i.options),Object.keys(i.rpc).forEach((function(e){var t=i.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(!o.isExtend(i))throw Error("not a valid definition: "+JSON.stringify(i));if(s=this.ptr.resolve(i.ref,!0))i.fields.forEach((function(t){var r,o,i,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");o=t.name,this.options.convertFieldsToCamelCase&&(o=e.Util.toCamelCase(o)),i=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+o,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,i),i.extension=a,this.ptr.addChild(a),s.addChild(i)}),this);else if(!/\.?google\.protobuf\./.test(i.ref))throw Error("extended message "+i.ref+" is not defined")}i=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},i.import=function(t,n){var o,i,s,a,u,c,l,p,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(o=n.root,e.Util.IS_NODE,(o.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),i=o+d+n.file,!0===this.files[i])return this.reset();this.files[i]=!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,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=s+d+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),p=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){p.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=p),t.enums&&(this.create(t.enums),this.ptr=p),t.services&&(this.create(t.services),this.ptr=p),t.extends&&this.create(t.extends),this.reset()},i.resolveAll=function(){var r;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(!(r=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},i.build=function(e){var t,n,r;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},i.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},i.toString=function(){return"Builder"},o.Message=function(){},o.Enum=function(){},o.Service=function(){},o}(i,i.Lang,i.Reflect),i.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,o,i,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(r=Object.keys(n),o=0;o<r.length;o++)i=this.keyElem.valueFromString(r[o]),s=this.valueElem.verifyValue(n[r[o]]),this.map[this.keyElem.valueToString(i)]={key:i,value:s}},o=r.prototype;return o.clear=function(){this.map={}},o.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},o.entries=function(){var e,t,r=[],o=Object.keys(this.map);for(t=0;t<o.length;t++)r.push([(e=this.map[o[t]]).key,e.value]);return n(r)},o.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},o.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},o.forEach=function(e,t){var n,r,o=Object.keys(this.map);for(r=0;r<o.length;r++)e.call(t,(n=this.map[o[r]]).value,n.key,this)},o.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},o.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},o.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,i.Reflect),i.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),i.loadJson(i.DotProto.Parser.parse(e),t,n)},i.protoFromString=i.loadProto,i.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=i.populateAccessors),new i.Builder(e)},i.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=i.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},i.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},o=e,i.loadProto(o,void 0,"").build("Modules").probuf}(n,t);return r}var Ir=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e=e.replace(r,(function(e){return e.toUpperCase()}))},Tr=function(){function e(e,t){this.nestedMap=t,dr.add(this),this.pbModules=Er(e)}return e.prototype._encode=function(e,t,n){var r=this,o=new this.pbModules[e];if(t)try{Object.keys(t).forEach((function(n){var i=t[n];if(void 0!==i){var s=r.nestedMap.get("".concat(e,"_").concat(n));if(s){var a=i instanceof Array?i.map((function(e){return r._encode(s,e,!0)})):r._encode(s,i,!0);o["set".concat(Ir(n,0,1))](a)}else o["set".concat(Ir(n,0,1))](i)}}))}catch(t){var i="name: ".concat(e,", stack: ").concat(t.stack);null===console||void 0===console||console.error("pb encode error!",i)}return n?o:o.toArrayBuffer()},e.prototype.encode=function(e,t){return this._encode(e,t)},e.prototype.decode=function(e,t){var n=this.pbModules[e].decode(t);return Se(this,dr,"m",hr).call(this,n)},e.prototype.getModule=function(e){return new this.pbModules[e]},e}();dr=new WeakSet,hr=function e(t){var n,r=this;if(t instanceof Array)return t.map((function(t){return Se(r,dr,"m",e).call(r,t)}));if(n=t,"[object Object]"!==Object.prototype.toString.call(n))return t;if(void 0!==t.low&&void 0!==t.high&&Object.prototype.hasOwnProperty.call(t,"unsigned")){var o=t.low;return o<0&&(o+=4294967296),o=o.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(o.length,"}$")),o),16)}var i=t;return Object.keys(t).forEach((function(n){i[n]=Se(r,dr,"m",e).call(r,t[n])})),i};var Cr,Rr,vr,yr,Sr="NotifyMsg",mr="SyncRequestMsg",Ar="UpStreamMessage",Nr="PushExtra",Or="DownStreamMessages",Mr="DownStreamMessage",Lr="GetQNupTokenInput",Ur="GetDownloadUrlInput",Pr="GetQNupTokenOutput",br="GetDownloadUrlOutput",xr="ChrmInput",Dr="ChrmOutput",wr="ChrmPullMsg",Vr="RelationQryInput",Gr="RelationsInput",Fr="RelationsOutput",Br="QryRemindListReq",kr="QryRemindListResp",Hr="CleanHisMsgInput",qr="CleanMsgBatchReq",Yr="QueryChatRoomInfoInput",Kr="QueryChatRoomInfoOutput",Qr="HistoryMsgInput",Wr="HistoryMsgOuput",jr="SessionsAttQryInput",Jr="SessionsAttOutput",Xr="SessionMsgReadInput",Zr="DeleteSessionsInput",zr="SessionInfo",$r="QuerySessionsInput",eo="QuerySessionsOutPut",to="RelationDelBatchReq",no="RelationOpInput",ro="DeleteMsgInput",oo="SetChrmKV",io="SetChrmKVS",so="ChrmKVOutput",ao="ChrmKVSOutput",uo="QueryChrmKV",co="SetUserSettingOutput",lo="PullUserSettingInput",po="PullUserSettingOutput",ho="SessionReq",_o="SessionStates",go="SessionState",fo="SessionStateItem",Eo="SessionStateModifyReq",Io="GroupUnpushQuery",To="GroupUnpushSet",Co="GroupUnpushResult",Ro="SessionStateModifyResp",vo="TypeUnpushInput",yo="TypeUnpushOutput",So="GrpReadReceiptMsg",mo="GrpReadReceiptQryResp",Ao="SessionTagAddInput",No="SessionTagItem",Oo="SessionTagDelInput",Mo="SessionDisTagReq",Lo="UserSettingNotification",Uo="ReportSDKInput",Po="UltraGrpPullSes",bo="UltraGrpPullMsg",xo="MsgChangeReq",Do="QueryMsgChange",wo="EventChangeList",Vo="MsgChangeList",Go="MsgQuery",Fo="MsgQueryAck",Bo="OperateStatus",ko="OperateStatusNotify",Ho="SetRtcRoomIdInput",qo="CallInfoUpStream",Yo="CallInfoDownStream",Ko="KvInput",Qo="KvOutput",Wo="ReadReceiptMsg",jo="ReceiptQryReq",Jo="QueryReceiptResp",Xo="ReceiptCntQryReq",Zo="ReceiptCntQryResp",zo="UpdateUserSubReq",$o="UserSubDetail",ei="UpdateUserSubResp",ti="PullUserSubReq",ni="PUllUserSubResp",ri="PullSubDataReq",oi="PullSubDataResp",ii="SubDataDetail",si="QrySubDataReq",ai="UserProfile",ui="ProfileInfo",ci="SetUserProfileResp",li="PullUserProfileReq",pi="UserProfiles",di="UserProfileInput",hi="UserProfilePermission",_i="SearchUserProfile",gi="ChannelsInput",fi="ChannelsOutput",Ei="MultiChannels",Ii="ModifyChannelsInput",Ti="QuitChannelsSetting",Ci="ChannelsQueryInput",Ri="ChannelsPageParam",vi="ChannelsListResult",yi="ChannelsMemberUpdateInput",Si="ChannelsMemberResponseInput",mi="ChannelsMembersInput",Ai="FriendInput",Ni="FriendsInput",Oi="FriendsCheckOutput",Mi="FriendProfileInput",Li="FriendProfileOutput",Ui="FriendQueryInput",Pi="FriendsListInput",bi="FriendLevelSet",xi="FriendUserInfos",Di="AddUnpushPeriodInput",wi="DeleteUnpushPeriodInput",Vi="QueryUnpushPeriodInput",Gi="QueryUnpushPeriodOutput",Fi=new Map([["UpStreamMessage_pushExt","PushExtra"],["DownStreamMessages_list","DownStreamMessage"],["DownStreamMessage_pushExt","PushExtra"],["ChannelInfosOutput_channels","ChannelInfoOutput"],["GroupMembersOutput_members","MemberInfo"],["GroupInput_groupInfo","GroupInfo"],["RelationsInput_msg","DownStreamMessage"],["RelationsOutput_info","RelationInfo"],["RelationInfo_msg","DownStreamMessage"],["RelationInfo_msgInfo","UnreadMsgInfo"],["QryRemindListResp_msgInfo","UnreadMsgInfo"],["CleanMsgBatchReq_input","CleanHisMsgInput"],["HistoryMessagesOuput_list","DownStreamMessage"],["QueryChatRoomInfoOutput_userInfos","ChrmMember"],["MPFollowOutput_info","MpInfo"],["MCFollowOutput_info","MpInfo"],["SearchMpOutput_info","MpInfo"],["PullMpOutput_info","MpInfo"],["HistoryMsgOuput_list","DownStreamMessage"],["DeleteSessionsInput_sessions","SessionInfo"],["QuerySessionsInput_sessions","SessionInfo"],["QuerySessionsOutPut_sessions","SessionInfo"],["RelationDelBatchReq_relation","RelationOpInput"],["DeleteMsgInput_msgs","DeleteMsg"],["SetChrmKV_entry","ChrmKVEntity"],["SetChrmKV_notification","UpStreamMessage"],["SetChrmKVS_entry","ChrmKVEntity"],["SetChrmKVS_notification","UpStreamMessage"],["DeleteChrmKVS_entry","ChrmKVEntity"],["DeleteChrmKVS_notification","UpStreamMessage"],["ChrmKVOutput_entries","ChrmKVEntity"],["ChrmKVSOutput_errorKeys","ChrmKVSOutputEntity"],["ChrmKVSOutput_keysVersion","ChrmKVSVersionEntity"],["PullUserSettingOutput_items","UserSettingItem"],["UserSettingItem_tags","SessionTagItem"],["SessionStates_state","SessionState"],["SessionState_stateItem","SessionStateItem"],["SessionStateItem_tags","SessionTagItem"],["SessionStateModifyReq_state","SessionState"],["GrpReadReceiptQryResp_list","GrpMsgReadUser"],["SessionTagAddInput_tags","SessionTagItem"],["SessionTagDelInput_tags","SessionTagItem"],["EventChangeList_list","EventChange"],["MsgChangeList_list","MsgChange"],["MsgQuery_query","MessageQueryInfo"],["MsgQueryAck_list","DownStreamMessage"],["OperateStatusNotify_info","OperateInfo"],["OperateStatusNotify_summary","OperateSummary"],["KvOutput_info","KvInfo"],["QueryReceiptResp_list","ReceiptUser"],["ReceiptCntQryResp_result","MsgReadCnt"],["UpdateUserSubReq_subUsers","UserSubDetail"],["UpdateUserSubResp_subUsers","UserSubDetail"],["PUllUserSubResp_list","UserSubList"],["UserSubList_subUsers","UserSubDetail"],["PullSubDataResp_list","SubDataDetail"],["SubDataDetail_data","SubData"],["QrySubDataReq_subUsers","UserSubDetail"],["UserProfile_userProfile","ProfileInfo"],["UserProfile_userExtProfile","ProfileInfo"],["UserProfiles_UserProfile","UserProfile"],["ChannelsInput_settingProfile","ProfileInfo"],["ChannelsInput_extProfile","ProfileInfo"],["ChannelsInput_baseInfo","ChannelBaseInfo"],["ChannelsOutput_channelInfo","ChannelsJoinedInfo"],["ChannelsOutput_userInfos","ChannelsUserInfo"],["ChannelsOutput_friendInviteInfo","FriendInviteInfo"],["ChannelsOutput_friendUserInfo","FriendUserInfo"],["MultiChannels_list","ChannelsInput"],["ModifyChannelsInput_settingInfo","QuitChannelsSetting"],["ChannelsQueryInput_page","ChannelsPageParam"],["ChannelsListResult_page","ChannelsPageParam"],["ChannelsInviteStatusInfos_list","ChannelsInviteStatusInfo"],["ChannelsUserInfos_list","ChannelsUserInfo"],["ChannelsJoinedInfos_list","ChannelsJoinedInfo"],["ChannelsUserInfo_ext","ChannelsUserExtInfo"],["ChannelsJoinedInfo_settingProfile","ProfileInfo"],["ChannelsJoinedInfo_extProfile","ProfileInfo"],["ChannelsJoinedInfo_baseInfo","ChannelBaseInfo"],["ChannelsJoinedInfo_userInfo","ChannelsUserExtInfo"],["ChannelsInviteStatusInfo_joinUserInfo","ChannelsUserInfo"],["ChannelsInviteStatusInfo_inviterInfo","ChannelsUserInfo"],["ChannelsInviteStatusInfo_processInfo","ChannelsUserInfo"],["FriendsOutput_list","FriendOutput"],["FriendsCheckOutput_list","FriendCheckOutput"],["FriendProfileInput_extProfile","ProfileInfo"],["FriendQueryInput_page","ChannelsPageParam"],["FriendUserInfo_extProfile","ProfileInfo"],["FriendUserInfos_list","FriendUserInfo"],["FriendInviteInfos_list","FriendInviteInfo"],["UpdateChannnelInfo_channelInfo","ChannelsJoinedInfo"],["UpdateChannnelInfo_userInfo","ChannelsUserInfo"],["UpdateUserInfo_updatedUserInfo","ChannelsUserInfo"],["UpdateUserInfo_optUserInfo","ChannelsUserInfo"],["ChannelApplyInfo_statusInfo","ChannelsInviteStatusInfo"],["ChannelEventData_optUserInfo","ChannelsUserInfo"],["ChannelEventData_channelInfo","ChannelsJoinedInfo"],["ChannelEventData_userInfos","ChannelsUserInfo"],["ChannelEventData_channelFullInfo","ChannelsJoinedInfo"],["FriendUpdateEvent_extProfile","ProfileInfo"]]);!function(e){e[e.PERSON=1]="PERSON",e[e.PERSONS=2]="PERSONS",e[e.GROUP=3]="GROUP",e[e.TEMPGROUP=4]="TEMPGROUP",e[e.CUSTOMERSERVICE=5]="CUSTOMERSERVICE",e[e.NOTIFY=6]="NOTIFY",e[e.MC=7]="MC",e[e.MP=8]="MP",e[e.ULTRAGROUP=10]="ULTRAGROUP"}(Cr||(Cr={})),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"}(Rr||(Rr={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(vr||(vr={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags"}(yr||(yr={}));var Bi,ki,Hi,qi,Yi,Ki,Qi,Wi,ji,Ji=new Tr("package Modules;\nmessage probuf {\n message SetUserStatusOutput {\n optional int32 nothing=1;\n }\n message GetUserStatusInput {\n optional int32 nothing=1;\n }\n message GetUserStatusOutput {\n optional string status=1;\n optional string subUserId=2;\n }\n message SubUserStatusInput {\n repeated string userid =1;\n }\n message SubUserStatusOutput {\n optional int32 nothing=1;\n }\n message VoipDynamicInput {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n message VoipDynamicOutput {\n required string dynamicKey=1;\n }\n message NotifyMsg {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message SyncRequestMsg {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message UpStreamMessage {\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 toUserIds = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13;\n optional string systemId = 16;\n optional string senderPortrait = 21;\n optional int64 optionBits = 22;\n }\n message PushExtra {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message DownStreamMessages {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message DownStreamMessage {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required 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;\n optional int64 extStatus = 20;\n repeated string toUserIds = 21;\n optional int32 groupUnpush = 22;\n optional int64 optionBits = 23;\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n IMAGE = 1;\n AUDIO = 2;\n VIDEO = 3;\n FILE = 4;\n SIGHT = 5;\n COMBINE_HTML = 6;\n }\n message GetQNupTokenInput {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5;\n optional string ext = 6;\n optional int64 size = 7;\n optional int32 ipType = 8;\n }\n message GetQNdownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message GetDownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n optional string ext = 4;\n optional int64 size = 5;\n optional int32 ipType = 6;\n }\n message GetQNupTokenOutput {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n optional string minioAuthorization = 20;\n optional string minioContentSha256 = 21;\n optional string minioDate = 22;\n optional string minioBucketName = 23;\n\n optional string downloadAuthInfo = 24;\n optional string ossConfig = 25;\n }\n message GetQNdownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message GetDownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n GROUP_SUCCESS = 0x00;\n GROUP_FAILURE = 0x01;\n }\n message ChrmInput {\n required int32 nothing = 1;\n optional string extra = 2;\n }\n message ChrmOutput {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n optional int64 createTime = 4;\n optional int32 memberCount = 5;\n optional int32 chatroomBanState = 6;\n optional int32 whiteListState = 7;\n }\n message ChrmPullMsg {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n message ChrmPullMsgNew {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message RelationQryInput {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message RelationsInput {\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 RelationsOutput {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;\n }\n message RelationInfo {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;\n optional int64 versionTime = 7;\n optional int64 remindCount = 8;\n optional int32 busChannelType = 9;\n optional UnreadMsgInfo msgInfo = 10;\n optional int32 remindMeCount = 11;\n }\n message UnreadMsgInfo {\n required string msgId = 1;\n required int64 msgTime= 2;\n optional int32 remindType= 3;\n optional string className = 4;\n }\n message QryRemindListReq {\n required string groupId = 1;\n optional string busChannel = 2;\n optional int64 msgTime = 3;\n optional int32 size = 4;\n }\n message QryRemindListResp {\n repeated UnreadMsgInfo msgInfo = 1;\n }\n message RelationInfoReadTime {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message CleanHisMsgInput {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4;\n }\n message CleanMsgBatchReq {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message QueryChatRoomInfoInput {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message QueryChatRoomInfoOutput {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput {\n required string id = 1;\n }\n\n message MPFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message HistoryMsgInput {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5;\n }\n\n message HistoryMsgOuput {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message SessionsAttQryInput {\n required int32 nothing = 1;\n }\n message SessionsAttOutput {\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message SessionMsgReadInput {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;\n }\n message SessionMsgReadOutput {\n optional int32 nothing=1;\n }\n message DeleteSessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message SessionInfo {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 unreadCount = 3;\n optional string busChannel = 4;\n }\n message QuerySessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message QuerySessionsOutPut {\n repeated SessionInfo sessions = 1;\n }\n message DeleteSessionsOutput {\n optional int32 nothing=1;\n }\n message RelationDelBatchReq {\n repeated RelationOpInput relation = 1;\n }\n message RelationOpInput {\n required string conversationId = 1;\n required ChannelType conversationType = 2;\n optional string busChannel = 3;\n }\n message DeleteMsgInput {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4;\n }\n message DeleteMsg {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message SetChrmKV {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message SetChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message DeleteChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ChrmKVOutput {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ChrmKVSOutput {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ChrmKVSOutputEntity {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message QueryChrmKV {\n required int64 timestamp = 1;\n }\n message SetUserSettingInput {\n required int64 version=1;\n required string value=2;\n }\n message SetUserSettingOutput {\n required int64 version=1;\n required bool reserve=2;\n }\n message PullUserSettingInput {\n required int64 version=1;\n optional bool reserve=2;\n optional int32 ipType = 3;\n }\n message PullUserSettingOutput {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message SessionReq {\n required int64 time = 1;\n }\n message SessionStates {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message SessionState {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;\n }\n message SessionStateItem {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message SessionStateModifyReq {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message GroupUnpushQuery {\n optional string busChannel = 1;\n }\n message GroupUnpushSet{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message GroupUnpushResult {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message SessionStateModifyResp {\n required int64 version=1;\n }\n message TypeUnpushInput {\n required ChannelType type = 1;\n required int64 version = 2;\n required int32 unpushLevel = 3;\n }\n message TypeUnpushOutput {\n required int64 version = 1;\n }\n message GrpReadReceiptMsg {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message GrpReadReceiptQryReq {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message GrpReadReceiptQryResp {\n required int32 totalMemberNum = 1;\n repeated GrpMsgReadUser list = 2;\n }\n message GrpMsgReadUser {\n required int64 readTime = 1;\n required string userId = 2;\n }\n message SessionTagAddInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message SessionTagItem {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message SessionTagDelInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message SessionDisTagReq {\n repeated string tagId=1;\n }\n message UserSettingNotification {\n required int64 version=1;\n required bool reserve=2;\n }\n message ReportSDKInput {\n required string sdkInfo=1;\n }\n message ReportSDKOutput {\n optional int32 nothing=1;\n }\n message UltraGrpPullSes {\n required int64 syncTime = 1;\n optional bool isEraseMsgContent = 2;\n }\n message UltraGrpPullMsg {\n required int64 syncTime = 1;\n }\n message MsgChangeReq {\n required string fromUserId = 1;\n required string targetId = 2;\n required ChannelType type = 3;\n required string msgUID = 4;\n required int64 msgTime = 5;\n optional string busChannel = 6;\n optional string content = 7;\n }\n message QueryMsgChange {\n required int64 syncTime = 1;\n optional int32 needCompress = 2;\n optional int64 onlineTime = 3;\n optional string targetId = 4;\n }\n message EventChangeList {\n repeated EventChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n optional string targetId = 4;\n optional bool isCompress = 5 ;\n }\n message EventChange {\n optional string businessId = 1;\n optional ChannelType channelType = 2;\n optional int64 time = 3;\n optional int32 changeType = 4;\n optional string originalId = 5;\n optional int64 originalTime = 6;\n optional string secondaryId = 7;\n optional bool isAdmin = 8;\n optional bool additionalMark = 9; \n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 secondaryType = 12;\n optional bool isRemindMe = 13;\n repeated string extIds = 14;\n optional int32 remindType = 15;\n optional bytes eventData = 16;\n }\n message MsgChangeList {\n repeated MsgChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n }\n message MsgChange {\n required string targetId = 1;\n required ChannelType type = 2;\n required int64 time = 3;\n required int32 changeType = 4;\n required string msgUID = 5;\n required int64 msgTime = 6;\n optional string busChannel = 7;\n optional bool isAdmin = 8;\n optional bool isDel = 9;\n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12;\n optional bool isRemindMe = 13;\n repeated string userGroupIds = 14;\n optional int32 remindType = 15;\n }\n message MsgQuery {\n required string targetId = 1;\n required ChannelType type = 2;\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo {\n required int64 msgTime = 1;\n required string msgUID = 2;\n optional string busChannel = 3;\n }\n message MsgQueryAck {\n repeated DownStreamMessage list = 1;\n }\n message OperateStatus {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 opType = 3;\n optional string busChannel = 4;\n }\n message OperateStatusNotify {\n optional ChannelType type = 1;\n optional int64 notifyType = 2;\n repeated OperateInfo info = 3 ;\n repeated OperateSummary summary = 4 ;\n }\n message OperateInfo {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional string userId = 3;\n optional int32 opType = 4;\n optional int64 optime = 5;\n }\n \n message OperateSummary {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 count = 3;\n optional int32 opType = 4;\n }\n\n message SetRtcRoomIdInput {\n required string rtcRoomId= 1;\n }\n message SetRtcRoomIdOutput {\n required int32 nothing = 1;\n }\n message CallInfoUpStream {\n required string key= 1;\n required string dataContent=2;\n }\n message CallInfoDownStream {\n required string key= 1;\n required string dataContent=2;\n required int64 maxTime=3;\n }\n message KvInput {\n required int64 syncTime = 1;\n }\n message KvOutput {\n required int64 maxTime = 1;\n repeated KvInfo info = 2;\n }\n message KvInfo {\n required string key =1;\n required string value =2;\n }\n message ReadReceiptMsg {\n required string targetId = 1;\n required ChannelType type = 2;\n optional string busChannel = 3;\n optional string startMsgId = 4;\n optional string endMsgId = 5;\n }\n message ReceiptQryReq {\n required string msgId = 1;\n optional string busChannel = 2;\n required string targetId = 3;\n }\n message QueryReceiptResp {\n optional int32 num = 1;\n repeated ReceiptUser list = 2;\n optional int32 readCnt = 3;\n }\n message ReceiptUser {\n required int64 receiptTime = 1;\n required string userId = 2;\n }\n message ReceiptCntQryReq {\n optional ChannelType type = 1;\n optional string channelId = 2;\n optional string busChannel = 3;\n repeated string msgId = 4;\n }\n message ReceiptCntQryResp {\n repeated MsgReadCnt result= 1;\n }\n\n message MsgReadCnt {\n optional string msgId = 1;\n optional int32 cnt = 2;\n optional int32 tmn = 3;\n }\n message UpdateUserSubReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n optional int32 opType = 3;\n optional int32 expiry = 4;\n }\n message UserSubDetail {\n optional string subUserId = 1;\n }\n message UpdateUserSubResp {\n repeated UserSubDetail subUsers = 1;\n optional int64 subTime = 2;\n }\n message PullUserSubReq {\n optional int64 version = 1;\n optional string pageToken = 2;\n }\n message PUllUserSubResp {\n repeated UserSubList list = 1;\n optional int64 version = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message UserSubList {\n repeated UserSubDetail subUsers = 1;\n optional int32 subType = 2;\n optional int64 subTime = 3;\n optional int32 expiry = 4;\n optional int32 opType = 5;\n }\n message PullSubDataReq {\n optional int64 versionTime = 1;\n optional bool needAllData = 2;\n optional string pageToken = 3;\n }\n message PullSubDataResp {\n repeated SubDataDetail list = 1;\n optional int64 versionTime = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message SubDataDetail {\n optional string statusStr = 1;\n optional string subUserId = 2;\n repeated SubData data = 3;\n optional int32 subType = 4;\n }\n\n message SubData {\n optional int32 platformInfo = 1;\n optional int32 value = 2;\n optional int64 versionTime = 3;\n }\n message QrySubDataReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n }\n message UserProfile {\n optional int64 version = 1;\n optional string userId = 2;\n repeated ProfileInfo userProfile = 3;\n repeated ProfileInfo userExtProfile = 4;\n }\n message ProfileInfo {\n optional string key = 1;\n optional string value = 2;\n }\n message SetUserProfileResp {\n optional int64 version = 1;\n optional string key = 2;\n repeated string censorFailedFields = 3;\n }\n message PullUserProfileReq {\n repeated string userId = 1;\n }\n message UserProfiles {\n repeated UserProfile UserProfile = 1;\n }\n message UserProfileInput {\n required int32 nothing = 1;\n }\n message UserProfilePermission {\n optional int32 permission = 1;\n }\n message UserProfileOutput {\n required int32 nothing = 1;\n }\n message SearchUserProfile {\n optional string uniqueId = 1;\n }\n message ChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated ProfileInfo settingProfile = 3;\n repeated ProfileInfo extProfile = 4;\n optional ChannelBaseInfo baseInfo = 5;\n repeated string users = 6;\n }\n\n message ChannelBaseInfo {\n optional string creatorId = 1;\n optional string ownerId = 2;\n optional int64 createTime = 3;\n optional int32 memberCount = 4;\n }\n\n message ChannelsOutput {\n optional int64 operateTime = 1;\n optional int32 flag = 2;\n optional string msg = 3;\n optional int32 processCode = 4;\n optional ChannelsJoinedInfo channelInfo = 5;\n repeated ChannelsUserInfo userInfos = 6;\n optional FriendInviteInfo friendInviteInfo = 7;\n optional FriendUserInfo friendUserInfo = 8;\n repeated string censorFailedFields = 9;\n }\n\n message MultiChannels {\n optional ChannelType type = 1;\n repeated ChannelsInput list = 2;\n }\n\n message ModifyChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional QuitChannelsSetting settingInfo = 3;\n repeated string users = 4;\n optional int32 operateType = 5;\n }\n\n message QuitChannelsSetting {\n optional bool isQuit = 1;\n optional bool isDelBan = 2;\n optional bool isDelWhite = 3;\n optional bool isDelAttention = 4;\n }\n\n message ChannelsQueryInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional ChannelsPageParam page = 3;\n repeated string ids = 4;\n optional int32 roleType = 5;\n }\n\n message ChannelsPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n optional bool hasNext = 3 ;\n optional int32 total = 4 ;\n optional int32 order = 5 ;\n }\n\n message ChannelsListResult {\n optional int32 listType = 1;\n optional bytes result = 2;\n optional ChannelsPageParam page = 3;\n }\n \n message ChannelsInviteStatusInfos {\n repeated ChannelsInviteStatusInfo list = 1;\n }\n \n message ChannelsUserInfos {\n repeated ChannelsUserInfo list = 1;\n }\n \n message ChannelsJoinedInfos {\n repeated ChannelsJoinedInfo list = 1;\n }\n\n message ChannelsUserInfo {\n optional string userId = 1;\n optional ChannelsUserExtInfo ext = 2;\n optional int64 opTime = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n\n message ChannelsUserExtInfo {\n optional int32 role = 1;\n optional int64 joinTime = 2;\n optional string channelNickName = 3;\n optional string additional = 4;\n optional string remarkName = 5;\n }\n\n message ChannelsMemberUpdateInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional string userId = 3;\n optional string channelNickName = 4;\n optional string additional = 5;\n optional int32 operateType = 6;\n }\n message ChannelsJoinedInfo {\n optional string targetId = 1;\n repeated ProfileInfo settingProfile = 2;\n repeated ProfileInfo extProfile = 3;\n optional ChannelBaseInfo baseInfo = 4;\n optional ChannelsUserExtInfo userInfo = 5;\n }\n message ChannelsInviteStatusInfo {\n optional string targetId = 1;\n optional ChannelsUserInfo joinUserInfo = 2;\n optional ChannelsUserInfo inviterInfo = 3;\n optional int32 status = 4;\n optional int32 directionType = 5;\n optional int32 joinType = 6;\n optional string detail = 7;\n optional int64 applyTime = 8;\n optional ChannelsUserInfo processInfo = 9;\n optional int64 processTime = 10;\n }\n message ChannelsMemberResponseInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 optType = 3;\n optional int32 optResult = 4;\n optional string joinUserId = 5;\n optional string inviterId = 6;\n optional string detail = 7;\n }\n message ChannelsMembersInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string userIds = 3;\n }\n message FriendInput {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string info = 3;\n }\n message FriendsOutput {\n repeated FriendOutput list = 1;\n }\n message FriendOutput {\n optional string userId = 1;\n optional int64 operateTime = 2;\n optional string flag = 3;\n }\n message FriendsInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendsCheckOutput {\n repeated FriendCheckOutput list = 1;\n }\n\n message FriendCheckOutput {\n optional string targetId = 1;\n optional int32 status = 2;\n }\n message FriendProfileInput {\n optional string targetId = 1;\n optional string remarkName = 2;\n repeated ProfileInfo extProfile = 3;\n }\n message FriendProfileOutput {\n repeated string censorFailedFields = 1;\n }\n message FriendQueryInput {\n optional int32 queryType = 1;\n optional ChannelsPageParam page = 2;\n optional int32 friendType= 3;\n }\n message FriendUserInfo {\n optional string userId = 1;\n optional int64 relationTime = 2;\n optional int32 friendType = 3;\n optional int32 flag = 4;\n optional string remarkName = 5;\n optional string name = 6;\n optional string portraitUrl = 7;\n repeated ProfileInfo extProfile = 8;\n \n }\n message FriendInviteInfo {\n optional string userId = 1;\n optional string name = 2;\n optional string portraitUrl = 3;\n optional int32 type = 4;\n optional int32 status = 5;\n optional int64 operateTime = 6;\n optional string info = 7;\n optional int32 friendType = 8;\n }\n message FriendsListInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendLevelSet {\n optional int32 level = 1;\n }\n\n message FriendPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n }\n message FriendUserInfos {\n repeated FriendUserInfo list = 1;\n }\n\n message FriendInviteInfos {\n repeated FriendInviteInfo list = 1;\n }\n \n message FriendApplyEvent {\n optional int32 applyType = 1;\n optional int32 friendType = 2;\n optional string info = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n message UpdateChannnelInfo {\n optional ChannelsJoinedInfo channelInfo = 1;\n optional ChannelsUserInfo userInfo = 2;\n }\n message UpdateUserInfo {\n optional ChannelsUserInfo updatedUserInfo = 1;\n optional ChannelsUserInfo optUserInfo = 2;\n }\n message ChannelApplyInfo {\n repeated ChannelsInviteStatusInfo statusInfo = 1;\n }\n message ChannelEventData {\n optional ChannelsUserInfo optUserInfo = 1;\n optional ChannelsJoinedInfo channelInfo = 2;\n repeated ChannelsUserInfo userInfos = 3;\n optional ChannelsJoinedInfo channelFullInfo = 4;\n }\n message FriendTypeChangeEvent {\n optional string friendId = 1;\n optional int32 friendType = 2;\n }\n message FriendUpdateEvent {\n optional string remarkname = 1;\n repeated ProfileInfo extProfile = 2;\n }\n message AddUnpushPeriodInput {\n required string startTime = 1;\n required int32 spanMinutes = 2;\n optional int32 level = 3;\n optional string timezone = 4;\n }\n message DeleteUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodOutput {\n required int32 isUnpush = 1;\n optional string startTime = 2;\n optional int32 spanMinutes = 3;\n optional int32 level = 4;\n optional string timezone = 5;\n }\n}\n",Fi);exports.LogLevel=void 0,(Bi=exports.LogLevel||(exports.LogLevel={}))[Bi.LOG=0]="LOG",Bi[Bi.DEBUG=0]="DEBUG",Bi[Bi.INFO=1]="INFO",Bi[Bi.WARN=2]="WARN",Bi[Bi.ERROR=3]="ERROR",Bi[Bi.FATAL=4]="FATAL",Bi[Bi.STATISTICS=6]="STATISTICS",Bi[Bi.NONE=1e3]="NONE",exports.LogSource=void 0,(ki=exports.LogSource||(exports.LogSource={})).IM="IM",ki.RTC="RTC",exports.ConnectionStatus=void 0,(Hi=exports.ConnectionStatus||(exports.ConnectionStatus={}))[Hi.CONNECTED=0]="CONNECTED",Hi[Hi.CONNECTING=1]="CONNECTING",Hi[Hi.DISCONNECTED=2]="DISCONNECTED",Hi[Hi.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",Hi[Hi.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",Hi[Hi.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",Hi[Hi.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",Hi[Hi.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",Hi[Hi.BLOCKED=9]="BLOCKED",Hi[Hi.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",Hi[Hi.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",Hi[Hi.REDIRECT=14]="REDIRECT",Hi[Hi.USER_LOGOUT=19]="USER_LOGOUT",Hi[Hi.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",Hi[Hi.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",Hi[Hi.ULTRALIMIT=1101]="ULTRALIMIT",Hi[Hi.REQUEST_NAVI=201]="REQUEST_NAVI",Hi[Hi.RESPONSE_NAVI=202]="RESPONSE_NAVI",Hi[Hi.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",Hi[Hi.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",Hi[Hi.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",Hi[Hi.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",exports.RTCMode=void 0,(qi=exports.RTCMode||(exports.RTCMode={}))[qi.RTC=0]="RTC",qi[qi.LIVE=2]="LIVE",qi[qi.SIP=4]="SIP",qi[qi.CALL=5]="CALL",qi[qi.MEETING=6]="MEETING",qi[qi.CROSS_MUTI=7]="CROSS_MUTI",qi[qi.CROSS_LIVE=8]="CROSS_LIVE",function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Yi||(Yi={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Ki||(Ki={})),exports.RTCApiType=void 0,(Qi=exports.RTCApiType||(exports.RTCApiType={}))[Qi.ROOM=1]="ROOM",Qi[Qi.PERSON=2]="PERSON",function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Wi||(Wi={})),exports.RTCJoinType=void 0,(ji=exports.RTCJoinType||(exports.RTCJoinType={}))[ji.KICK=0]="KICK",ji[ji.REFUSE=1]="REFUSE",ji[ji.COEXIST=2]="COEXIST";var Xi=null;function Zi(e,t,n,r){void 0===n&&(n={});var o=["error","warn","info","debug"][3-e];if(Xi&&e<exports.LogLevel.FATAL)try{var i=JSON.stringify(n);Xi[o](t,i)}catch(e){console.error(e)}}var zi,$i,es=Zi.bind(null,exports.LogLevel.DEBUG),ts={init:function(e){Xi=e},info:Zi.bind(null,exports.LogLevel.INFO),debug:es,warn:Zi.bind(null,exports.LogLevel.WARN),error:Zi.bind(null,exports.LogLevel.ERROR),fatal:Zi.bind(null,exports.LogLevel.FATAL)},ns=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map[e];if(r)for(var o=r.length-1;o>=0;o-=1){var i=r[o],s=i.target,a=i.once,u=i.listener;a&&r.splice(o,1);try{u.call.apply(u,ye([s],ve(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),rs=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=Er(t)}return e.prototype.getModule=function(e){return new this.pbModules[e]},e.prototype.encode=function(e,t,n){var r=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((function(e){var n=t[e];void 0!==n&&r["set".concat(function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e.replace(r,(function(e){return e.toUpperCase()}))}(e,0,1))](n)}))}catch(t){var o="pbname: ".concat(e,", stack: ").concat(t.stack);this.logger?this.logger.error(exports.LogTagId.L_PB_ENCODE_E,o):null===console||void 0===console||console.error(exports.LogTagId.L_PB_ENCODE_E,o)}return n?r:r.toArrayBuffer()},e.prototype.decode=function(e,t){var n=this.pbModules[e].decode(t);return this.fixInt64Values(n)},e.prototype.fixInt64Values=function(e){var t=this;if(e instanceof Array)return e.map((function(e){return t.fixInt64Values(e)}));if(!ht(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){var n=e.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var r in e)e[r]=this.fixInt64Values(e[r]);return e},e}();!function(e){e.RtcInput="RtcInput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcOutput="RtcOutput"}($i||($i={}));var os,is=((zi={})[$i.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],zi[$i.RtcUserListOutput]=["users","token","sessionId","roomInfo"],zi[$i.SetUserStatusInput]=["status"],zi[$i.RtcSetDataInput]=["interior","target","key","value","objectName","content"],zi[$i.RtcUserSetDataInput]=["valueInfo","objectName","content"],zi[$i.RtcDataInput]=["interior","target","key","objectName","content"],zi[$i.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],zi[$i.MCFollowInput]=["state"],zi[$i.RtcTokenOutput]=["rtcToken"],zi[$i.RtcQryOutput]=["outInfo"],zi[$i.RtcQryUserOutDataInput]=["userId"],zi[$i.RtcUserOutDataOutput]=["user"],zi[$i.RtcQueryListInput]=["order"],zi[$i.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],zi[$i.RtcValueInfo]=["key","value"],zi[$i.RtcKeyDeleteInput]=["key"],zi[$i.RtcNotifyMsg]=["type","time","roomId"],zi[$i.RtcPullKV]=["timestamp","roomId"],zi[$i.RtcKVOutput]=["entries","bFullUpdate","syncTime"],zi[$i.RtcQueryUserJoinedInput]=["userId"],zi[$i.RtcQueryUserJoinedOutput]=["info"],zi[$i.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],zi[$i.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],zi[$i.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],zi[$i.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],zi),ss="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat($i.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat($i.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat($i.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat($i.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat($i.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat($i.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat($i.RtcUserListOutput,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat($i.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat($i.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat($i.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat($i.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat($i.RtcQryOutput,"{\n repeated ").concat($i.RtcValueInfo," outInfo=1;\n }\n message ").concat($i.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat($i.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat($i.RtcUserSetDataInput," {\n repeated ").concat($i.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat($i.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat($i.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat($i.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat($i.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat($i.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat($i.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat($i.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat($i.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat($i.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat($i.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat($i.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat($i.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat($i.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat($i.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat($i.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat($i.RtcEndInviteInput,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n}\n"),as=function(e,t,n,r,o,i){var s=o?Object.keys(o).map((function(t){return e.encode($i.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0,a=i?Object.keys(i).map((function(t){return e.encode($i.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0;return e.encode($i.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:s,outerDatas:a})},us=function(e,t){var n=e.decode($i.RtcUserListOutput,t),r=n.users,o=n.token,i=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return yt(r,(function(e){var t=e.userId,n=e.userData,r={};yt(n,(function(e){var t=e.key,n=e.value;r[t]=n})),c[t]=r})),{users:c,token:o,sessionId:i,roomInfo:s,kvEntries:a,offlineKickTime:u}};!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.prMsgS=7]="prMsgS",e[e.pbMsgP=8]="pbMsgP",e[e.qryPMsg=9]="qryPMsg",e[e.qryGMsg=10]="qryGMsg",e[e.qryCHMsg=11]="qryCHMsg",e[e.qryCMsg=12]="qryCMsg",e[e.qrySMsg=13]="qrySMsg",e[e.qryMCMsg=14]="qryMCMsg",e[e.qryMPMsg=15]="qryMPMsg",e[e.recallMsg=16]="recallMsg",e[e.rrMsg=17]="rrMsg",e[e.rrList=18]="rrList",e[e.s_ntf=19]="s_ntf",e[e.s_msg=20]="s_msg",e[e.s_stat=21]="s_stat",e[e.s_cmd=22]="s_cmd",e[e.s_us=23]="s_us",e[e.pullUS=24]="pullUS",e[e.sendMsgRead=25]="sendMsgRead",e[e.qryMsgRead=26]="qryMsgRead",e[e.qryMsgReadCntBatch=27]="qryMsgReadCntBatch",e[e.updRTime=28]="updRTime",e[e.pgMsgS=29]="pgMsgS",e[e.chatMsgS=30]="chatMsgS",e[e.qrySessionsAtt=31]="qrySessionsAtt",e[e.pullMsg=32]="pullMsg",e[e.qrySessions=33]="qrySessions",e[e.delSessions=34]="delSessions",e[e.delMsg=35]="delMsg",e[e.delUgMsg=36]="delUgMsg",e[e.updRRTime=37]="updRRTime",e[e.qrySessionsUnread=38]="qrySessionsUnread",e[e.setTypeUnpush=39]="setTypeUnpush",e[e.chrmPull=40]="chrmPull",e[e.joinChrm=41]="joinChrm",e[e.joinChrmR=42]="joinChrmR",e[e.exitChrm=43]="exitChrm",e[e.queryChrmI=44]="queryChrmI",e[e.setKV=45]="setKV",e[e.delKV=46]="delKV",e[e.setKVS=47]="setKVS",e[e.delKVS=48]="delKVS",e[e.pullKV=49]="pullKV",e[e.qryRelation=50]="qryRelation",e[e.qryRelationR=51]="qryRelationR",e[e.delRelation=52]="delRelation",e[e.delRelationBatch=53]="delRelationBatch",e[e.pullSeAtts=54]="pullSeAtts",e[e.setSeAtt=55]="setSeAtt",e[e.qnTkn=56]="qnTkn",e[e.qnUrl=57]="qnUrl",e[e.aliUrl=58]="aliUrl",e[e.s3Url=59]="s3Url",e[e.stcUrl=60]="stcUrl",e[e.minioUrl=61]="minioUrl",e[e.cleanPMsg=62]="cleanPMsg",e[e.cleanGMsg=63]="cleanGMsg",e[e.cleanCMsg=64]="cleanCMsg",e[e.cleanSMsg=65]="cleanSMsg",e[e.cleanMCMsg=66]="cleanMCMsg",e[e.cleanMPMsg=67]="cleanMPMsg",e[e.cleanMsgBatch=68]="cleanMsgBatch",e[e.rtcPing=69]="rtcPing",e[e.rtc_ntf=70]="rtc_ntf",e[e.rtcSetOutData=71]="rtcSetOutData",e[e.rtcQryUserOutData=72]="rtcQryUserOutData",e[e.addSeTag=73]="addSeTag",e[e.delSeTag=74]="delSeTag",e[e.addTag=75]="addTag",e[e.delTag=76]="delTag",e[e.disTag=77]="disTag",e[e.reportsdk=78]="reportsdk",e[e.pullUgSes=79]="pullUgSes",e[e.pullUgMsg=80]="pullUgMsg",e[e.ugMsg=81]="ugMsg",e[e.qryUgMsg=82]="qryUgMsg",e[e.updUgRTime=83]="updUgRTime",e[e.upMsgEx=84]="upMsgEx",e[e.modifyMsg=85]="modifyMsg",e[e.qryMsgChange=86]="qryMsgChange",e[e.qryMsg=87]="qryMsg",e[e.operate=88]="operate",e[e.s_opNtf=89]="s_opNtf",e[e.ugUnpushQuery=90]="ugUnpushQuery",e[e.ugUnpushSet=91]="ugUnpushSet",e[e.setRtcRoomId=92]="setRtcRoomId",e[e.qryUgUal=93]="qryUgUal",e[e.updUserSub=94]="updUserSub",e[e.pullUserSub=95]="pullUserSub",e[e.pullSubData=96]="pullSubData",e[e.qrySubData=97]="qrySubData",e[e.pullUserProfile=98]="pullUserProfile",e[e.pullOwnProfile=99]="pullOwnProfile",e[e.updProfilePermiss=100]="updProfilePermiss",e[e.qProfilePermiss=101]="qProfilePermiss",e[e.searchUserProfile=102]="searchUserProfile",e[e.updUserProfile=103]="updUserProfile",e[e.pullEventChange=104]="pullEventChange",e[e.channelCreate=105]="channelCreate",e[e.upChannelInfo=106]="upChannelInfo",e[e.qChannelInfo=107]="qChannelInfo",e[e.channelMemKick=108]="channelMemKick",e[e.channelMemQuit=109]="channelMemQuit",e[e.channelDismiss=110]="channelDismiss",e[e.channelTransfer=111]="channelTransfer",e[e.upChannelManager=112]="upChannelManager",e[e.qChannelMem=113]="qChannelMem",e[e.qChannelSpeMem=114]="qChannelSpeMem",e[e.upChannelMem=115]="upChannelMem",e[e.channelMemJoin=116]="channelMemJoin",e[e.channelMemInvite=117]="channelMemInvite",e[e.channelApplyResp=118]="channelApplyResp",e[e.qChannelApplyList=119]="qChannelApplyList",e[e.qChannelMemJoin=120]="qChannelMemJoin",e[e.qChannelMemSpeJoin=121]="qChannelMemSpeJoin",e[e.upChannelRemark=122]="upChannelRemark",e[e.qChannelRemark=123]="qChannelRemark",e[e.upChannelFollow=124]="upChannelFollow",e[e.qChannelFollow=125]="qChannelFollow",e[e.qSimpleUserProfile=126]="qSimpleUserProfile",e[e.friendAdd=127]="friendAdd",e[e.friendDel=128]="friendDel",e[e.friendHandle=129]="friendHandle",e[e.friendSetPf=130]="friendSetPf",e[e.friendCheck=131]="friendCheck",e[e.friendsQuery=132]="friendsQuery",e[e.friendApplyDel=133]="friendApplyDel",e[e.friendsInfoQry=134]="friendsInfoQry",e[e.friendAuthSet=135]="friendAuthSet",e[e.friendAuthGet=136]="friendAuthGet",e[e.addUnpush=137]="addUnpush",e[e.qryUnpush=138]="qryUnpush",e[e.delUnpush=139]="delUnpush",e[e.s_pubCall=140]="s_pubCall",e[e.reqCall=141]="reqCall",e[e.pullKvMsg=142]="pullKvMsg"}(os||(os={}));var cs,ls,ps,ds=function(e){var t=os[e];if(void 0===t)throw new Error("topic ".concat(e," not found"));return t},hs=function(e){return os[e]};!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"}(cs||(cs={})),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.PING=12]="PING",e[e.PONG=13]="PONG",e[e.DISCONNECT=14]="DISCONNECT",e[e.PCONNECT=8]="PCONNECT",e[e.PCONNECT_ACK=9]="PCONNECT_ACK",e[e.RESERVED=10]="RESERVED",e[e.RESERVED_2=11]="RESERVED_2",e[e.RESERVED_3=15]="RESERVED_3"}(ls||(ls={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(ps||(ps={}));var _s,gs,fs="rtcRJoin_data",Es="rtcRExit",Is="rtcRInfo",Ts="rtcUData",Cs="rtcUPut",Rs="rtcUDel",vs="rtcSetData",ys="userSetData",Ss="rtcQryData",ms="rtcDelData",As="rtcToken",Ns="rtcUserState",Os="rtcUList",Ms="viewerJoinR",Ls="viewerExitR",Us="rtcPullKv",Ps="rtcIdentityChange",bs="rtcInvite",xs="rtcCancelInvite",Ds="rtcInviteAnswer",ws="rtcEndInvite",Vs="rtcQueryJoined",Gs=function(){function e(){}return e.writeUTF=function(e,t){for(var n=this._getBackAndByteSize(e),r=n.back,o=n.byteSize,i=0,s=r.length;i<s;i++)r[i]>255&&(r[i]&=255);return t?r:o<=255?[0,o].concat(r):[o>>8,255&o].concat(r)},e._getBackAndByteSize=function(e){var t=[],n=0;if("string"==typeof e)for(var r=0,o=e.length;r<o;r++){var i=e.charCodeAt(r);i>=0&&i<=127?(n+=1,t.push(i)):i>=128&&i<=2047?(n+=2,t.push(192|31&i>>6),t.push(128|63&i)):i>=2048&&i<=65535&&(n+=3,t.push(224|15&i>>12),t.push(128|63&i>>6),t.push(128|63&i))}return{byteSize:n,back:t}},e.readUTF=function(e){for(var t,n,r=[],o=-1,i=e,s="";++o<i.length;){var a=Number(i[o]);if(a===(127&a)||(240&~a?224&~a?192&~a||(a=(a^=192)<<6|128^i[++o]):a=(a=(a^=224)<<6|128^i[++o])<<6|128^i[++o]:a=(a=(a=(a^=240)<<6|128^i[++o])<<6|128^i[++o])<<6|128^i[++o]),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(o+1===i.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},e}(),Fs=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r.toString()}return parseInt(t,16)},e.prototype.readInt32=function(){return(this.readByte()<<24)+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;var n=this._pool.subarray(t,this._position);return Gs.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),Bs=function(){function e(){this._pool=[]}return e.prototype.writeByte=function(e){e>=0&&(e>255&&(e&=255),this._pool.push(e))},e.prototype.writeBuffer=function(e){this._pool=this._pool.concat(ye([],ve(new Int8Array(e)),!1))},e.prototype.writeArr=function(e){this._pool=this._pool.concat(e)},e.prototype.writeUTF=function(e){var t=Gs.writeUTF(e);this._pool=this._pool.concat(t)},e.prototype.getBytesArray=function(){return this._pool},e}(),ks=function(){function e(e,t,n,r,o){void 0===t&&(t=cs.AT_LEAST_ONCE),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),this.command=e,this.qos=t,this._retain=n,this._dup=r,this.syncMsg=o}return e.parse=function(t){return new e(t>>4&15,(6&t)>>1,(1&t)>0,(8&t)>0,!(8&~t))},e.prototype.encode=function(){var e=this.command<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0},e}(),Hs=function(){function e(e){this.header=e,this.timestamp=0}return 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}(),qs=function(){function e(e){this.messageId=0,this._header=new ks(e,cs.AT_MOST_ONCE)}return e.prototype.write=function(e){var t=this.getHeaderFlag();e.writeByte(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getArrayBuffer=function(){var e=new Bs;this.write(e);var t=e.getBytesArray();return new Int8Array(t).buffer},e}(),Ys=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=null,t.userId=null,t.timestamp=0,t.messageId=0,t.sessionId="",t}return t(n,e),n.prototype.readMessage=function(e,t,r){if(e.readByte(),this.status=e.readByte(),t<=n.MESSAGE_LENGTH)return{stream:e,length:t};if(r===ps.V4){var o=e.readByte();1&o&&(this.userId=e.readUTF()),2&o&&(this.sessionId=e.readUTF()),4&o&&(this.timestamp=e.readLong()),8&o&&(this.messageId=e.read2Byte())}else this.userId=e.readUTF(),this.sessionId=e.readUTF(),this.timestamp=e.readLong();return{stream:e,length:t}},n.MESSAGE_LENGTH=2,n}(Hs),Ks=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return t(n,e),n.prototype.readMessage=function(e,t){return e.readByte(),this.status=e.readByte(),this.data=e.readAll(),{stream:e,length:t}},n.MESSAGE_LENGTH=2,n}(Hs),Qs=function(e){function n(){return e.call(this,ls.PING)||this}return t(n,e),n.prototype.writeMessage=function(e){},n}(qs),Ws=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(Hs),js=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return t(n,e),n.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},n}(Hs),Js=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.writeByte(r),e.writeByte(n)},n}(qs),Xs=function(e){function n(t){var n=e.call(this,t)||this;return n.topic="",n.targetId="",n.date=0,n.syncMsg=!1,n.syncMsg=t.syncMsg,n}return t(n,e),n.prototype.readMessage=function(t,n){return this.date=t.readInt32(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.pbData=t.readAll(),{stream:t,length:n}},n}(js),Zs=function(e){function n(t,n,r,o){var i=e.call(this,t)||this;return i.targetId=r,i.pbData=o,i.topic="string"==typeof n?n:hs(n),i}return t(n,e),n.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.writeBuffer(this.pbData)},n}(Js),zs=function(e){function n(t,n,r){return e.call(this,ls.QUERY,t,r,n)||this}return t(n,e),n}(Zs),$s=function(e){function n(t,n,r){return e.call(this,ls.PUBLISH,t,r,n)||this}return t(n,e),n}(Zs),ea=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t}return t(n,e),n.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt32(),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}},n}(js),ta=function(e){function n(t){var n=e.call(this,ls.PUB_ACK)||this;return n.messageId=t,n}return t(n,e),n}(Js),na=function(e){function n(t){var n=e.call(this,ls.QUERY_CONFIRM)||this;return n.messageId=t,n}return t(n,e),n}(Js),ra=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.date=0,t}return t(n,e),n.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt32(),this.status=256*t.readByte()+t.readByte(),this.pbData=t.readAll(),{stream:t,length:n}},n}(js),oa=function(e,t){var n=new Uint8Array(e),r=new Fs(n),o=r.readByte(),i=function(e){var t,n=e.command;switch(n){case ls.CONN_ACK:t=new Ys(e);break;case ls.PUBLISH:t=new Xs(e);break;case ls.PUB_ACK:t=new ea(e);break;case ls.QUERY_ACK:t=new ra(e);break;case ls.PONG:t=new Ws(e);break;case ls.DISCONNECT:t=new Ks(e);break;default:console.error("No support for deserializing ".concat(n," messages"))}return t}(ks.parse(o));return i&&i.read(r,n.length-1,t),i},ia=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(r=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,r)]);case 1:return o=a.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS?(this._isPulling=!1,this._pullTime=s||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}(),sa=function(){function e(e,t,n,r){this.rtcCodec=e,this._watcher=t,this._options=n,this.logger=r,this._appkey=this._options.appkey,this._rtcKVManager=new ia(this)}return e.prototype.registerRTCSignalingListener=function(e){this._rtcSignalingListener=e},e.prototype.getInnerLogger=function(){return this.logger},e.prototype.pullRTCRoomEntry=function(e,t){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode($i.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,Us,!0,t)];case 1:return n=u.sent(),r=n.code,o=n.buffer,r!==exports.ErrorCode.SUCCESS?[2,{code:r}]:(i=this.rtcCodec.decode($i.RtcKVOutput,o),s=i.entries,a=i.syncTime,s=(s||[]).map((function(e){return Ee(Ee({},e),{timestamp:vt(e.timestamp)})})),this._watcher.onRTCDataChange(s,e),[2,{code:r,data:a}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode($i.RtcNotifyMsg,e),n=t.time,r=t.type,o=t.roomId;1===r&&this._rtcKVManager.pullEntry(o,vt(n))}},e.prototype.destroy=function(){},e}(),aa=function(){function e(){this._callerQueue=[],this._isCalling=!1,this._retryCount=0}return e.prototype.pushTask=function(e){var t=this;return new Promise((function(n){t._callerQueue.push({task:e,resolve:n}),t._startCall()}))},e.prototype._startCall=function(){return Te(this,void 0,void 0,(function(){var e,t;return Ce(this,(function(n){switch(n.label){case 0:return this._isCalling||0===this._callerQueue.length?[2]:(this._isCalling=!0,e=this._callerQueue.shift(),[4,this._callHandler(e)]);case 1:return t=n.sent(),e.resolve(t),this._isCalling=!1,this._startCall(),[2]}}))}))},e.prototype._callHandler=function(e){return Te(this,void 0,void 0,(function(){var t,n,r;return Ce(this,(function(o){switch(o.label){case 0:return t=e.task,n=this.getVersion(),[4,t(n)];case 1:return(r=o.sent()).code===exports.ErrorCode.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,[4,this._triggerPull(n)]):[3,3];case 2:return o.sent(),[2,this._callHandler(e)];case 3:return this._retryCount=0,[2,r]}}))}))},e.prototype.stopAllTask=function(){this._callerQueue.forEach((function(e){e.resolve({code:exports.ErrorCode.RC_NET_UNAVAILABLE})})),this._callerQueue=[]},e}(),ua={"set.proxy":exports.ErrorCode.INVALID_PARAMETER_PROXY,"test.proxy":exports.ErrorCode.INVALID_PARAMETER_TESTHOST,"test.proxy.socksHost":exports.ErrorCode.INVALID_PARAMETER_TESTHOST,"test.proxy.socksPort":exports.ErrorCode.INVALID_PARAMETER_TESTHOST,channelId:exports.ErrorCode.INVALID_PARAMETER_CHANNEL_ID,count:exports.ErrorCode.INVALID_PARAMETER_COUNT,startTime:exports.ErrorCode.INVALID_PARAMETER_START_TIME,endTime:exports.ErrorCode.INVALID_PARAMETER_END_TIME,offset:exports.ErrorCode.INVALID_PARAMETER_OFFSET,limit:exports.ErrorCode.INVALID_PARAMETER_LIMIT,keyword:exports.ErrorCode.INVALID_PARAMETER_KEYWORD,messageTypes:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_TYPE,messageType:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_TYPE,typingContentType:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_TYPE,conversation:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION,conversationType:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_TYPE,targetId:exports.ErrorCode.INVALID_PARAMETER_TARGET_ID,targetIds:exports.ErrorCode.INVALID_PARAMETER_TARGET_ID,userId:exports.ErrorCode.INVALID_PARAMETER_USER_ID,senderUserId:exports.ErrorCode.INVALID_PARAMETER_USER_ID,timestamp:exports.ErrorCode.INVALID_PARAMETER_TIMESTAMP,order:exports.ErrorCode.INVALID_PARAMETER_ORDER,messageId:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_ID,receivedStatus:exports.ErrorCode.INVALID_PARAMETER_RECEIVED_STATUS,receivedStatusInfo:exports.ErrorCode.INVALID_PARAMETER_RECEIVED_STATUS,sentStatus:exports.ErrorCode.INVALID_PARAMETER_SENT_STATUS,content:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_CONTENT,messageIds:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_ARRAY,cleanSpace:exports.ErrorCode.INVALID_PARAMETER_CLEAN_SPACE,messageDirection:exports.ErrorCode.INVALID_MESSAGE_DIRECTION,canIncludeExpansion:exports.ErrorCode.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION,expansion:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION,disableNotification:exports.ErrorCode.INVALID_PARAMETER_DISABLE_NOTIFICATION,messages:exports.ErrorCode.MSG_LIMIT_ERROR,checkDuplicate:exports.ErrorCode.INVALID_PARAMETER_CHECK_DUPLICATE,messageUId:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_UID,key:exports.ErrorCode.INVALID_PARAMETER_KEY,keys:exports.ErrorCode.INVALID_PARAMETER_KEYS,value:exports.ErrorCode.INVALID_PARAMETER_VALUE,isAutoDelete:exports.ErrorCode.INVALID_PARAMETER_IS_AUTO_DELETE,isSendNotification:exports.ErrorCode.INVALID_PARAMETER_IS_SEND_NOTIFICATION,notificationExtra:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_EXTRA,entries:exports.ErrorCode.INVALID_PARAMETER_ENTRIES,isForce:exports.ErrorCode.INVALID_PARAMETER_IS_FORCE,rtcRoomId:exports.ErrorCode.INVALID_PARAMETER_RTCROOMID,token:exports.ErrorCode.RC_CONN_TOKEN_INCORRECT,conversations:exports.ErrorCode.INVALID_PARAMETER_CONVERSATIONS,draft:exports.ErrorCode.INVALID_PARAMETER_DRAFT,conversationTypes:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_TYPE_LIST,levels:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevel:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevels:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationStatus:exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL,isTop:exports.ErrorCode.INVALID_PARAMETER_IS_TOP,isUpdateTime:exports.ErrorCode.INVALID_PARAMETER_IS_UPDATE_TIME,message:exports.ErrorCode.INVALID_PARAMETER_MESSAGE,mentionedUserIdList:exports.ErrorCode.INVALID_PARAMETER_USERIDLIST,directionalUserIdList:exports.ErrorCode.INVALID_PARAMETER_USERIDLIST,directedUserIds:exports.ErrorCode.INVALID_PARAMETER_USERIDLIST,isStatusMessage:exports.ErrorCode.INVALID_PARAMETER_IS_STATUS_MESSAGE,pushContent:exports.ErrorCode.INVALID_PARAMETER_PUSH_CONTENT,pushData:exports.ErrorCode.INVALID_PARAMETER_PUSH_DATA,isMentioned:exports.ErrorCode.INVALID_PARAMETER_IS_MENTIONED,mentionedType:exports.ErrorCode.INVALID_PARAMETER_MENTIONED_TYPE,isVoipPush:exports.ErrorCode.INVALID_PARAMETER_IS_VOIP_PUSH,pushConfig:exports.ErrorCode.INVALID_PARAMETER_PUSH_CONFIG,startMsgUId:exports.ErrorCode.INVALID_PARAMETER_START_MESSAGE_UID,endMsgUId:exports.ErrorCode.INVALID_PARAMETER_END_MESSAGE_UID,sentTime:exports.ErrorCode.INVALID_PARAMETER_TIMESTAMP,clearMessageOption:exports.ErrorCode.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,searchContent:exports.ErrorCode.SEARCH_PROPS_LIMIT_ERROR,tagId:exports.ErrorCode.INVALID_PARAMETER_TAG_ID,tagIds:exports.ErrorCode.INVALID_PARAMETER_TAG_ID,tagName:exports.ErrorCode.INVALID_PARAMETER_TAG_NAME,containMuted:exports.ErrorCode.INVALID_PARAMETER_CONTAIN_MUTED,channelType:exports.ErrorCode.INVALID_PARAMETER_CHANNEL_TYPE,file:exports.ErrorCode.MEDIA_EXCEPTION,fileType:exports.ErrorCode.INVALID_PARAMETER_MEDIA_TYPE,contentDisposition:exports.ErrorCode.INVALID_PARAMETER_CONTENT_DISPOSITION,mediaUrl:exports.ErrorCode.INVALID_PARAMETER_MEDIA_URL,filename:exports.ErrorCode.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME,saveName:exports.ErrorCode.INVALID_PARAMETER_SAVE_NAME,serverType:exports.ErrorCode.INVALID_PARAMETER_SERVER_TYPE,subscribeType:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_TYPE,expiry:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_EXPIRY,subscribeUserIds:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS,subscribePageSize:exports.ErrorCode.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE,beforeCount:exports.ErrorCode.INVALID_PARAMETER_BEFORE,afterCount:exports.ErrorCode.INVALID_PARAMETER_AFTER,conversationList:exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_LIST,conversationTypeNotSupport:exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT,profile:exports.ErrorCode.INVALID_PARAMETER_USER_PROFILE,userProfileVisibility:exports.ErrorCode.INVALID_PARAMETER_USER_PROFILE_VISIBILITY,uniqueId:exports.ErrorCode.INVALID_PARAMETER_UNIQUE_ID,extra:exports.ErrorCode.INVALID_PARAMETER_EXTRA,disableUpdateLastMessage:exports.ErrorCode.INVALID_DISABLE_UPDATE_LAST_MESSAGE};exports.AssertRules=void 0,(gs=exports.AssertRules||(exports.AssertRules={}))[gs.STRING=0]="STRING",gs[gs.ONLY_STRING=1]="ONLY_STRING",gs[gs.NUMBER=2]="NUMBER",gs[gs.BOOLEAN=3]="BOOLEAN",gs[gs.OBJECT=4]="OBJECT",gs[gs.ARRAY=5]="ARRAY",gs[gs.CALLBACK=6]="CALLBACK",gs[gs.CHANNEL_ID=7]="CHANNEL_ID",gs[gs.CONVERSATION=8]="CONVERSATION",gs[gs.CONVERSATION_TYPE=9]="CONVERSATION_TYPE";var ca,la,pa,da,ha,_a,ga,fa,Ea,Ia,Ta,Ca=((_s={})[exports.AssertRules.STRING]=dt,_s[exports.AssertRules.ONLY_STRING]=ut,_s[exports.AssertRules.NUMBER]=ct,_s[exports.AssertRules.BOOLEAN]=function(e){return"boolean"==typeof e},_s[exports.AssertRules.OBJECT]=ht,_s[exports.AssertRules.ARRAY]=lt,_s[exports.AssertRules.CALLBACK]=function(e){var t=!0;return ht(e)||(t=!1),(e=e||{}).onSuccess&&!_t(e.onSuccess)&&(t=!1),e.onError&&!_t(e.onError)&&(t=!1),t},_s[exports.AssertRules.CHANNEL_ID]=Tt,_s[exports.AssertRules.CONVERSATION]=function(e){var t=!0;return ht(e)||(t=!1),ut(e.targetId)||(t=!1),It(e.conversationType)||(t=!1),gt(e.channelId)||Tt(e.channelId)||(t=!1),t},_s[exports.AssertRules.CONVERSATION_TYPE]=It,_s),Ra=function(e){function n(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return t(n,e),n}(Error),va=function(e,t,n,r){void 0===r&&(r=!1),n=Ca[n]||n;var o=r?n(t):gt(t)||null==t||n(t);return o||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),o},ya=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.createCodec=function(e,t){return new rs(e,t)},e.prototype.createPBCodec=function(e,t){return new Tr(e,t)},e.prototype.refetchNaviInfo=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.16.0"},e.prototype.getAPIVersion=function(){return"5.16.0"},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._context.registerMessageType(e,t,n,r)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getOSInfo=function(){return this._context.getOSInfo()},e.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._context.setCallInfo(e,t,n)},e.prototype.createLogger=function(e,t){return this._context.createLogger(e,t)},e}(),Sa=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.joinRTCRoom=function(e,t,n,r,o,i){return Te(this,void 0,void 0,(function(){var s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return s=as(this._context.rtcCodec,t,n,r,o,i),[4,this.rtcSignaling(e,fs,!0,s)];case 1:return a=p.sent(),u=a.code,c=a.buffer,u===exports.ErrorCode.SUCCESS&&c&&(l=us(this._context.rtcCodec,c)),[2,{code:u,data:l}]}}))}))},n.prototype.quitRTCRoom=function(e){return Te(this,void 0,void 0,(function(){var t;return Ce(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode($i.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Es,!0,t)];case 1:return[2,n.sent().code]}}))}))},n.prototype.rtcPing=function(e,t,n){return Te(this,void 0,void 0,(function(){return Ce(this,(function(r){switch(r.label){case 0:return[4,this._context.rtcPing(e,t,n)];case 1:return[2,r.sent().code]}}))}))},n.prototype.rtcPingResVersion=function(e,t,n){return this._context.rtcPing(e,t,n)},n.prototype.getRTCRoomInfo=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode($i.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Is,!0,t)];case 1:return n=s.sent(),r=n.code,o=n.buffer,r===exports.ErrorCode.SUCCESS&&o&&(i=this._context.rtcCodec.decode($i.RtcRoomInfoOutput,o)),[2,{code:r,data:i}]}}))}))},n.prototype.getRTCUserInfoList=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode($i.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Ts,!0,t)];case 1:return n=a.sent(),r=n.code,o=n.buffer,r===exports.ErrorCode.SUCCESS&&o&&(s=us(this._context.rtcCodec,o),i={users:s.users}),[2,{code:r,data:i}]}}))}))},n.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},n.prototype.setRTCUserInfo=function(e,t,n){return Te(this,void 0,void 0,(function(){var r;return Ce(this,(function(o){switch(o.label){case 0:return r=this._context.rtcCodec.encode($i.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,Cs,!0,r)];case 1:return[2,o.sent().code]}}))}))},n.prototype.removeRTCUserInfo=function(e,t){return Te(this,void 0,void 0,(function(){var n;return Ce(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode($i.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,Rs,!1,n)];case 1:return[2,r.sent().code]}}))}))},n.prototype.setRTCData=function(e,t,n,r,o,i){return Te(this,void 0,void 0,(function(){var s;return Ce(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode($i.RtcSetDataInput,{interior:r,target:o,key:t,value:n,objectName:null==i?void 0:i.name,content:null==i?void 0:i.content}),[4,this.rtcSignaling(e,vs,!1,s)];case 1:return[2,a.sent().code]}}))}))},n.prototype.setRTCTotalRes=function(e,t,n,r,o){return void 0===o&&(o=""),Te(this,void 0,void 0,(function(){var i,s;return Ce(this,(function(a){switch(a.label){case 0:return i={objectName:r,content:this._context.rtcCodec.encode($i.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode($i.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode($i.RtcValueInfo,{key:"mcu_uris",value:o},!0)]},s=this._context.rtcCodec.encode($i.RtcUserSetDataInput,i),[4,this.rtcSignaling(e,ys,!0,s)];case 1:return[2,a.sent().code]}}))}))},n.prototype.setRTCCDNUris=function(e,t,n){return Te(this,void 0,void 0,(function(){var r;return Ce(this,(function(o){switch(o.label){case 0:return r=this._context.rtcCodec.encode($i.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode($i.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,ys,!0,r)];case 1:return[2,o.sent().code]}}))}))},n.prototype.getRTCData=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return o=this._context.rtcCodec.encode($i.RtcDataInput,{interior:n,target:r,key:t}),[4,this.rtcSignaling(e,Ss,!0,o)];case 1:return i=l.sent(),s=i.code,a=i.buffer,s===exports.ErrorCode.SUCCESS&&a?(u=this._context.rtcCodec.decode($i.RtcQryOutput,a).outInfo,c={},u.forEach((function(e){c[e.key]=e.value})),[2,{code:s,data:c}]):[2,{code:s}]}}))}))},n.prototype.removeRTCData=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i;return Ce(this,(function(s){switch(s.label){case 0:return i=this._context.rtcCodec.encode($i.RtcDataInput,{interior:n,target:r,key:t,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(e,ms,!1,i)];case 1:return[2,s.sent().code]}}))}))},n.prototype.setRTCOutData=function(e,t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},n.prototype.getRTCOutData=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},n.prototype.getRTCToken=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return r=as(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,As,!0,r)];case 1:return o=u.sent(),i=o.code,s=o.buffer,i===exports.ErrorCode.SUCCESS&&s?(a=this._context.rtcCodec.decode($i.RtcTokenOutput,s).rtcToken,[2,{code:i,data:{rtcToken:a}}]):[2,{code:i}]}}))}))},n.prototype.setRTCState=function(e,t){return Te(this,void 0,void 0,(function(){var n;return Ce(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode($i.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,Ns,!0,n)];case 1:return[2,r.sent().code]}}))}))},n.prototype.getRTCUserList=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode($i.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Os,!0,t)];case 1:return n=s.sent(),r=n.code,o=n.buffer,r===exports.ErrorCode.SUCCESS&&o?(i=us(this._context.rtcCodec,o),[2,{code:r,data:i}]):[2,{code:r}]}}))}))},n.prototype.joinLivingRoomAsAudience=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return r=as(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Ms,!0,r)];case 1:return o=l.sent(),i=o.code,s=o.buffer,i===exports.ErrorCode.SUCCESS&&s?(a=this._context.rtcCodec.decode($i.RtcViewerJoinedOutput,s),u=a.rtcToken,c=a.entries,[2,{code:i,data:{token:u,kvEntries:c}}]):[2,{code:i}]}}))}))},n.prototype.quitLivingRoomAsAudience=function(e){return Te(this,void 0,void 0,(function(){var t;return Ce(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode($i.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Ls,!0,t)];case 1:return[2,n.sent().code]}}))}))},n.prototype.rtcIdentityChange=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return r=this._context.rtcCodec.encode($i.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,Ps,!0,r)];case 1:return o=u.sent(),i=o.code,s=o.buffer,i===exports.ErrorCode.SUCCESS&&s?(a=us(this._context.rtcCodec,s),[2,{code:i,data:a}]):[2,{code:i}]}}))}))},n.prototype.requestRoomPK=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,o=e.inviteTimeout,i=e.inviteInfo,s=e.roomId,a=this._context.rtcCodec.encode($i.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,timeoutTime:o,inviteInfo:i}),[4,this.rtcSignaling(s,bs,!0,a)];case 1:return[2,u.sent().code]}}))}))},n.prototype.cancelRoomPK=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,o=e.inviteInfo,i=e.roomId,s=this._context.rtcCodec.encode($i.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteInfo:o}),[4,this.rtcSignaling(i,xs,!0,s)];case 1:return[2,a.sent().code]}}))}))},n.prototype.responseRoomPK=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,o=e.content,i=e.key,s=e.value,a=e.agree,u=e.roomId,c=this._context.rtcCodec.encode($i.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:r,content:o,key:i,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,Ds,!0,c)];case 1:return[2,l.sent().code]}}))}))},n.prototype.endRoomPK=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return t=e.endRoomId,n=e.sessionId,r=e.content,o=e.keys,i=e.roomId,s=this._context.rtcCodec.encode($i.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:r,inviteRoomKeys:o}),[4,this.rtcSignaling(i,ws,!0,s)];case 1:return[2,a.sent().code]}}))}))},n.prototype.registerRTCSignalListener=function(e){this._context.registerRTCSignalingListener(e)},n.prototype.rtcSignaling=function(e,t,n,r){return this._context.rtcSignaling(e,t,n,r)},n.prototype.getRTCJoinedUserInfo=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode($i.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",Vs,!0,t)];case 1:return n=s.sent(),r=n.code,o=n.buffer,r===exports.ErrorCode.SUCCESS&&o?(i=this._context.rtcCodec.decode($i.RtcQueryUserJoinedOutput,o).info||[],[2,{code:r,data:i.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:e.joinTime}}))}]):[2,{code:r}]}}))}))},n}(ya);exports.StreamMessageResponseEventType=void 0,(ca=exports.StreamMessageResponseEventType||(exports.StreamMessageResponseEventType={})).INIT="INIT",ca.DATA="DATA",ca.END="END";var ma=function(e){function n(t,n){var r=e.call(this)||this;return la.add(r),pa.set(r,void 0),da.set(r,new Map),ha.set(r,void 0),me(r,pa,t,"f"),me(r,ha,n,"f"),r}return t(n,e),n.prototype.requestStreamMessageContent=function(e){return Te(this,void 0,void 0,(function(){var t,n,r=this;return Ce(this,(function(o){switch(o.label){case 0:return t=Se(this,la,"a",_a).createTraceId(),Se(this,la,"a",_a).info(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_T,"messageUId: ".concat(e),t),[4,it.create("requestStreamMessageContent").isLimitedString("messageUId",e,1,64,!0).fail(exports.ErrorCode.INVALID_PARAMETER_MESSAGE_UID,"messageUId is invalid.").result().tryTrans(Se(this,pa,"f").validatorConnected).tryTrans((function(e){var t,n;return(null===(n=null===(t=null==e?void 0:e.streamServer)||void 0===t?void 0:t.addrs)||void 0===n?void 0:n.length)?rt(e.streamServer.addrs):ot(exports.ErrorCode.STREAM_MESSAGE_DISABLE)})).next((function(t){return Se(r,la,"m",Ta).call(r,e,t)}))];case 1:return n=o.sent(),Se(this,la,"a",_a).summary(exports.LogTagId.L_REQ_STREAM_MSG_CONTENT_R,n,t,{messageUId:e}),[2,n.wipe()]}}))}))},n}($e);function Aa(e){return Ee({},e)}function Na(e,t,n){var r=n.value;n.value=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1!==(null===(e=this.getNaviInfoFromCache())||void 0===e?void 0:e.userProfile)?Promise.resolve({code:exports.ErrorCode.RC_USER_PROFILE_SERVICE_UNAVAILABLE}):r.call.apply(r,ye([this],ve(t),!1))}}function Oa(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Va(this.getNaviInfoFromCache())?r.call.apply(r,ye([this],ve(e),!1)):Promise.resolve({code:exports.ErrorCode.RC_REAL_TIME_CONVERSATION_UNAVAILABLE})}}pa=new WeakMap,da=new WeakMap,ha=new WeakMap,la=new WeakSet,_a=function(){return Se(this,pa,"f").logger},ga=function(e,t,n){var r=Se(this,da,"f").get(e);r&&(Se(this,da,"f").delete(e),Se(this,la,"m",fa).call(this,e,exports.StreamMessageResponseEventType.END,t,r.msg))},fa=function(e,t,n,r,o){this.emit("message",{code:n,messageUId:e,type:t,chunk:o,message:r})},Ea=function(e,t){e.content=Ee(Ee({},e.content),t),Se(this,pa,"f").setMessageContent(e.messageId,e.content,e.messageType)},Ia=function(e,t,n){var r,o,i=Se(this,da,"f").get(t);switch(e){case"init":i.msg&&Se(this,la,"m",Ea).call(this,i.msg,{content:"",stopReason:0,completeReason:0,isSynced:!1}),Se(this,la,"m",fa).call(this,t,exports.StreamMessageResponseEventType.INIT,exports.ErrorCode.SUCCESS,i.msg);break;case"complete":o=(r=n.length?JSON.parse(n):{}).complete||!1,i.msg&&Se(this,la,"m",Ea).call(this,i.msg,{stopReason:r.stopReason||0,completeReason:r.completeReason||0,complete:o,isSynced:o}),Se(this,la,"m",ga).call(this,t,r.stopReason||0,o);break;default:r=JSON.parse(n),i.cached+=r.content,i.msg&&Se(this,la,"m",Ea).call(this,i.msg,{content:i.cached}),Se(this,la,"m",fa).call(this,t,exports.StreamMessageResponseEventType.DATA,exports.ErrorCode.SUCCESS,i.msg,{content:r.content,fullContent:i.cached})}},Ta=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c=this;return Ce(this,(function(l){switch(l.label){case 0:return Se(this,da,"f").has(e)?[2,ot(exports.ErrorCode.STREAM_MESSAGE_REQUEST_IN_PROCESS,"Request in process, msgUId: ".concat(e))]:Se(this,da,"f").size>=3?[2,ot(exports.ErrorCode.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED,"The request queue is full")]:(n=fr.createSSEClient({logger:Se(this,la,"a",_a),msgUId:e,appkey:Se(this,pa,"f").appkey,token:Se(this,pa,"f").token,timeout:3e4,onRawContent:function(t){var n=t.split("\n\n");console.log("recv events ->",n),n.forEach((function(t){if(0!==t.length){t.startsWith("data:")&&(t="event:delta\n".concat(t));var n=t.indexOf("\n"),r=t.slice(0,n).replace("event:",""),o=t.slice(n+1+5);Se(c,la,"m",Ia).call(c,r,e,o.trim())}}))},onNetworkError:function(t){Se(c,la,"m",ga).call(c,e,t,!1)}}),n.isOk?(r=n.data,o={client:r,cached:"",msg:void 0},Se(this,da,"f").set(e,o),Se(this,ha,"f")?[4,Se(this,pa,"f").getLocalMessage(e)]:[3,2]):[2,n.wipe()]);case 1:if(i=l.sent(),s=i.code,!(a=i.data))return Se(this,da,"f").delete(e),[2,ot(s,"message not found, msgUId: ".concat(e))];if(a.content.isSynced)return Se(this,da,"f").delete(e),[2,ot(exports.ErrorCode.STREAM_MESSAGE_SYNCED,"synced")];o.msg=a,l.label=2;case 2:return[4,r.open(t.slice())];case 3:return(u=l.sent()).isOk||Se(this,da,"f").delete(e),[2,u.wipe()]}}))}))};var Ma,La=function(){function e(e){var t,n;this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((t={})[exports.MessageType.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),t[exports.MessageType.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),t[exports.MessageType.INTERCEPT]=this._processInterceptMessage.bind(this),t[exports.MessageType.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),t[exports.MessageType.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),t[exports.MessageType.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),t),this._messageProccessor=((n={})[exports.MessageType.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),n[exports.MessageType.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),n[exports.MessageType.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),n),this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connection:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished: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,userGroupStatus:void 0,messageReadReceipt:void 0,syncReadStatus:void 0,subscribedUserStatusChange:void 0,subscribedRelationChange:void 0,syncSubscribedUserStatusFinished:void 0,ownUserProfileChanged:void 0,groupOperation:void 0,groupInfoChanged:void 0,groupMemberInfoChanged:void 0,groupApplicationEvent:void 0,groupRemarkChangedSync:void 0,groupFollowsChangedSync:void 0,friendAdd:void 0,friendDelete:void 0,friendApplicationStatusChanged:void 0,friendCleared:void 0,friendInfoChangedSync:void 0,databaseUpgradeWillStart:void 0,databaseUpgrading:void 0,databaseUpgradeDidComplete:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Ee({},e),this.appkey=this._options.appkey,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.map((function(e){return e.replace(/\/$/g,"")}));var r={onConnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.DISCONNECTED),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),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this),messageReadReceipt:this._messageReadReceipt.bind(this),syncReadStatus:this._syncReadStatus.bind(this),subscribedUserStatusChange:this._subscribedUserStatusChange.bind(this),subscribedRelationChange:this._subscribedRelationChange.bind(this),syncSubscribedUserStatusFinished:this._syncSubscribedUserStatusFinished.bind(this),ownUserProfileChanged:this._ownUserProfileChanged.bind(this),groupOperation:this._groupOperation.bind(this),groupInfoChanged:this._groupInfoChanged.bind(this),groupMemberInfoChanged:this._groupMemberInfoChanged.bind(this),groupApplicationEvent:this._groupApplicationEvent.bind(this),groupRemarkChangedSync:this._groupRemarkChangedSync.bind(this),groupFollowsChangedSync:this._groupFollowsChangedSync.bind(this),friendAdd:this._friendAdd.bind(this),friendDelete:this._friendDelete.bind(this),friendApplicationStatusChanged:this._friendApplicationStatusChanged.bind(this),friendCleared:this._friendCleared.bind(this),friendInfoChangedSync:this._friendInfoChangedSync.bind(this),databaseUpgradeWillStart:this._databaseUpgradeWillStart.bind(this),databaseUpgrading:this._databaseUpgrading.bind(this),databaseUpgradeDidComplete:this._databaseUpgradeDidComplete.bind(this)};this.rtcCodec=new rs(is,ss);var o=At();this._engine=o?new RCCppEngine(this.rtcCodec,r,this._options):new xc(this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.sse=new ma(this,o)}return e.init=function(t){if(this._context)return this._context.logger.warn(exports.LogTagId.A_INIT_REPEAT_O),this._context;this._context=new e(t),this._context.logger.info(exports.LogTagId.L_INIT_O,JSON.stringify({appkey:t.appkey,navigators:t.navigators,typingExpireTime:t.typingExpireTime})),this._context.logger.warn(exports.LogTagId.L_IMSDK_VER_O,JSON.stringify({commitId:"7382fb9d6273f9a8e584f870f449dffce5e45888",version:"5.16.0"}));var n=this._context._engine;return fr.setNetworkStatusListener(n.setNetwork.bind(n)),this._context},e.getContext=function(){return this._context},e.prototype.getOptions=function(){return this._options},e.destroy=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(exports.LogTagId.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return e.sent(),this._context=void 0,[2]}}))}))},Object.defineProperty(e.prototype,"chatroom",{get:function(){return this._engine.chatroom},enumerable:!1,configurable:!0}),e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(exports.LogTagId.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(exports.LogTagId.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var r="RCRTC"===e.tag?new Sa(this):new ya(this),o=null;try{if(!e.verify(fr))return null;o=e.setup(r,fr,t)}catch(e){this.logger.error(exports.LogTagId.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,n)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),o&&(this._pluginContextQueue.push(r),this._pluginInstanseMap[e.tag]=o),o},e.prototype._onConnectionStatusChange=function(e,t){var n,r;this.logger.warn(exports.LogTagId.A_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),null===(r=(n=this._watcher).connection)||void 0===r||r.call(n,e,t),this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onconnectionstatechange)||void 0===r||r.call(n,e,t)}))},e.prototype._processChrmMemChangeMessage=function(e){if("function"==typeof this._watcher.chatroomState){var t={},n=[],r=e.content.memberCount,o=void 0===r?0:r;Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){t[e.userId]=e.status,n.push({userId:e.userId,action:e.status,extra:e.extra})})),this._watcher.chatroomState({userChange:{users:t,chatroomId:e.targetId,memberCount:o,userList:n}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo(Aa(e)),this._watcher.typingState)return!0},e.prototype._processInterceptMessage=function(e){var t={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===exports.ConversationType.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===exports.MessageBlockSourceType.MSG_EXPANSION||n===exports.MessageBlockSourceType.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(exports.LogTagId.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0},e.prototype._processChrmSyncMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:e.content.chatroomId,status:e.content.status,reason:e.content.reason,time:e.content.time,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBlockMessage=function(e){var t,n=e.content;return n.operateType===exports.ChrmMemOperateType.Blocked&&(null===(t=n.userList)||void 0===t?void 0:t.includes(this.getCurrentUserId()))&&this._engine.removeChatroomFromCatch(n.chatroomId),"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:n.chatroomId,operateType:n.operateType,durationTime:n.durationTime,operateTime:n.operateTime,userIdList:n.userList,extra:n.extra||null}}),!0},e.prototype._processChrmMemBanMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:e.content.chatroomId,banType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0},e.prototype._processReadReceiptMessage=function(e){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime,e.senderUserId)},e.prototype._processReadReceiptRequestMessage=function(e){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId)},e.prototype._processReadReceiptResponseMessage=function(e){var t,n=null===(t=e.content)||void 0===t?void 0:t.receiptMessageDic,r=this._engine.getCurrentUserId();n&&Array.isArray(n[r])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[r])},e.prototype._messageReceiver=function(e,t,n){var r,o,i,s,a=this;if(!(null===(o=(r=this._compatibleMessageProccessor)[e.messageType])||void 0===o?void 0:o.call(r,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Aa(e))}catch(e){return a.logger.error(exports.LogTagId.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(s=(i=this._watcher).message)||void 0===s||s.call(i,Aa(e),t,n),e},e.prototype._batchMessageReceiver=function(e,t,n){var r=this,o=[],i=[],s=[exports.MessageType.READ_RECEIPT,exports.MessageType.READ_RECEIPT_REQUEST,exports.MessageType.READ_RECEIPT_RESPONSE];e.forEach((function(e){var a=r._messageReceiver(e,t,n);a&&s.includes(a.messageType)?i.push(a):a&&o.push(a)})),o.length&&this._watcher.batchMessage&&(this.logger.debug(exports.LogTagId.L_BATCH_MESSAGE_O,o.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(o)),i.length&&i.forEach((function(e){r._messageProccessor[e.messageType]&&r._messageProccessor[e.messageType](e)}))},e.prototype._chatroomInfoListener=function(e){var t,n;null===(n=(t=this._watcher).chatroomState)||void 0===n||n.call(t,e)},e.prototype._conversationInfoListener=function(e){var t,n;null===(n=(t=this._watcher).conversationState)||void 0===n||n.call(t,e)},e.prototype._expansionInfoListener=function(e){var t,n;null===(n=(t=this._watcher).expansion)||void 0===n||n.call(t,e)},e.prototype._tagListener=function(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)},e.prototype._conversationTagListener=function(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)},e.prototype._typingStatusListener=function(e){var t,n;null===(n=(t=this._watcher).typingState)||void 0===n||n.call(t,e)},e.prototype._pullFinishedListener=function(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)},e.prototype._MessageBlockedListener=function(e){var t,n;null===(n=(t=this._watcher).messageBlocked)||void 0===n||n.call(t,e)},e.prototype._messageDeliveredListerer=function(e){var t,n;null===(n=(t=this._watcher).messageDelivered)||void 0===n||n.call(t,e)},e.prototype._groupMessageDeliveredStatusListerer=function(e){var t,n;null===(n=(t=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(t,e)},e.prototype._callInfoListener=function(e){var t=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(e)}catch(e){t.logger.warn(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype._ultraGroupEnableListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupEnable)||void 0===n||n.call(t,e)},e.prototype._operateStatusListener=function(e){var t,n;null===(n=(t=this._watcher).operateStatus)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageModifiedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageRecalledListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelDeleteListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(t,e)},e.prototype._userGroupStatusListener=function(e){var t,n;null===(n=(t=this._watcher).userGroupStatus)||void 0===n||n.call(t,e)},e.prototype._messageReadReceipt=function(e){var t,n;null===(n=(t=this._watcher).messageReadReceipt)||void 0===n||n.call(t,e)},e.prototype._syncReadStatus=function(e){var t,n;null===(n=(t=this._watcher).syncReadStatus)||void 0===n||n.call(t,e)},e.prototype._subscribedUserStatusChange=function(e){var t,n;null===(n=(t=this._watcher).subscribedUserStatusChange)||void 0===n||n.call(t,e)},e.prototype._subscribedRelationChange=function(e){var t,n;null===(n=(t=this._watcher).subscribedRelationChange)||void 0===n||n.call(t,e)},e.prototype._syncSubscribedUserStatusFinished=function(e){var t,n;this.logger.info(exports.LogTagId.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S),null===(n=(t=this._watcher).syncSubscribedUserStatusFinished)||void 0===n||n.call(t,e)},e.prototype._ownUserProfileChanged=function(e){var t,n;this.logger.info(exports.LogTagId.L_OWN_USER_PROFILE_CHANGED_S),null===(n=(t=this._watcher).ownUserProfileChanged)||void 0===n||n.call(t,e)},e.prototype._groupOperation=function(e){var t,n;null===(n=(t=this._watcher).groupOperation)||void 0===n||n.call(t,e)},e.prototype._groupInfoChanged=function(e){var t,n;null===(n=(t=this._watcher).groupInfoChanged)||void 0===n||n.call(t,e)},e.prototype._groupMemberInfoChanged=function(e){var t,n;null===(n=(t=this._watcher).groupMemberInfoChanged)||void 0===n||n.call(t,e)},e.prototype._groupApplicationEvent=function(e){var t,n;null===(n=(t=this._watcher).groupApplicationEvent)||void 0===n||n.call(t,e)},e.prototype._groupRemarkChangedSync=function(e){var t,n;null===(n=(t=this._watcher).groupRemarkChangedSync)||void 0===n||n.call(t,e)},e.prototype._groupFollowsChangedSync=function(e){var t,n;null===(n=(t=this._watcher).groupFollowsChangedSync)||void 0===n||n.call(t,e)},e.prototype._friendAdd=function(e){var t,n;null===(n=(t=this._watcher).friendAdd)||void 0===n||n.call(t,e)},e.prototype._friendDelete=function(e){var t,n;null===(n=(t=this._watcher).friendDelete)||void 0===n||n.call(t,e)},e.prototype._friendApplicationStatusChanged=function(e){var t,n;null===(n=(t=this._watcher).friendApplicationStatusChanged)||void 0===n||n.call(t,e)},e.prototype._friendCleared=function(e){var t,n;null===(n=(t=this._watcher).friendCleared)||void 0===n||n.call(t,e)},e.prototype._friendInfoChangedSync=function(e){var t,n;null===(n=(t=this._watcher).friendInfoChangedSync)||void 0===n||n.call(t,e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onrtcdatachange)||void 0===r||r.call(n,e,t)}))},e.prototype._naviDataChange=function(e){this._pluginContextQueue.forEach((function(t){var n;null===(n=t.onnavidatachange)||void 0===n||n.call(t,e)}))},e.prototype._databaseUpgradeWillStart=function(){var e,t;this.logger.info(exports.LogTagId.L_DB_UPGRATE_START_S),null===(t=(e=this._watcher).databaseUpgradeWillStart)||void 0===t||t.call(e)},e.prototype._databaseUpgrading=function(e){var t,n;this.logger.info(exports.LogTagId.L_DB_UPGRATING_S,e),null===(n=(t=this._watcher).databaseUpgrading)||void 0===n||n.call(t,e)},e.prototype._databaseUpgradeDidComplete=function(e){var t,n;this.logger.info(exports.LogTagId.L_DB_UPGRATE_COMPLETE_S),null===(n=(t=this._watcher).databaseUpgradeDidComplete)||void 0===n||n.call(t,e)},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t._watcher[n]=_t(r)||ht(r)?r:void 0}}))},e.prototype._resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,o=e.content,i=e.channelId,s=o.typingContentType,a=i||"",u="".concat(n,"#").concat(r,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===s?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),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]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},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._engine.getConnectionStatus()},Object.defineProperty(e.prototype,"validatorConnected",{get:function(){var e=this;return function(){return e._engine.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED?rt(e._engine.getNaviInfoFromCache()):ot(exports.ErrorCode.RC_NET_UNAVAILABLE)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.refetchNaviInfo=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var r,o;return Te(this,void 0,void 0,(function(){var i,s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return this._token=e,[4,fr.getNetworkType()];case 1:return i=p.sent(),this._engine.setNetwork({status:!0,type:i},!0),s=!!this._pluginInstanseMap.RCCallPlus,[4,this._engine.connect(e,t,s,n)];case 2:return a=p.sent(),u=a.code,c=a.data,u!==exports.ErrorCode.SUCCESS?[2,{code:u}]:(1!==this._engine.getNaviInfoFromCache().type&&(l=je.getInfo(),null===(o=(r=this._engine).reportSDKInfo)||void 0===o||o.call(r,l)),[2,{code:u,userId:c}])}}))}))},e.prototype.disconnect=function(e){return Te(this,void 0,void 0,(function(){var t=this;return Ce(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){t.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}})),[2,Promise.resolve()]}}))}))},e.prototype.reconnect=function(e){return this.connect(this.token,!!e,this.logger.createTraceId())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype._channelIdConvert=function(e,t){if(e!==exports.ConversationType.ULTRA_GROUP)return t;var n=this.getNaviInfoFromCache();return!!(2&((null==n?void 0:n.ugDriven)||0))&&!t?"RCDefault":t},e.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,r,o){void 0===r&&(r=[]),void 0===o&&(o=!1),lt(r)&&r.length>0&&(this._registerMessageSearchPropsMapping[e]=r),this._engine.registerMessageType(e,t,n,r,o)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],r={};return n&&ht(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var o=t[e];ct(o)&&(o>-Math.pow(2,64)&&o<Math.pow(2,64)&&Number.isInteger(o)||(r[e]=o))}})),Object.keys(r).length>0?{msg:JSON.stringify(r),code:exports.ErrorCode.SEARCH_PROPS_LIMIT_ERROR}:{code:exports.ErrorCode.SUCCESS}},e.prototype._handleExpansioResult=function(e,t){if(t){var n=Rt(e),r=n.isIllgalEx,o=n.isExKeyOrValLengthExceedLimit;return n.isExceedLimit||o?exports.ErrorCode.EXPANSION_LIMIT_EXCEET:r?exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION:void 0}},e.prototype.sendMessage=function(e,t,n,r,o){var i=this.checkSearchPropsMsg(n.messageType,n.content),s=i.code,a=i.msg;if(s!==exports.ErrorCode.SUCCESS)return Promise.resolve({code:s,msg:a});if(e===exports.ConversationType.SYSTEM&&n.messageType!==exports.MessageType.SYNC_READ_STATUS)return Promise.resolve({code:exports.ErrorCode.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(n.messageType===exports.MessageType.STREAM_MESSAGE)return Promise.resolve({code:exports.ErrorCode.MESSAGE_NOT_SUPPORT_SENDING});var u=n.canIncludeExpansion,c=void 0!==u&&u,l=n.expansion,p=this._handleExpansioResult(l,c);if(p)return Promise.resolve({code:p});var d=n.isMentioned,h=n.mentionedUserIdList,_=n.mentionedType;d&&[exports.ConversationType.GROUP,exports.ConversationType.ULTRA_GROUP].includes(e)?n.content.mentionedInfo=function(e,t,n){var r,o,i;return{userIdList:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.userIdList)||t,type:(null===(o=e.mentionedInfo)||void 0===o?void 0:o.type)||n||exports.MentionedType.ALL,mentionedContent:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.mentionedContent)||""}}(n.content,h,_):delete n.content.mentionedInfo;var g=JSON.stringify(n.content);if(function(e){for(var t,n=0,r=0,o=e.length;r<o;r++)n+=(t=e.charCodeAt(r))<127?1:t<=2047?2:t<=65535?3:4;return n}(g)>Oe)return Promise.resolve({code:exports.ErrorCode.RC_MSG_CONTENT_EXCEED_LIMIT});if(e===exports.ConversationType.ULTRA_GROUP)return n.channelId=this._channelIdConvert(e,n.channelId),this._engine.sendUltraMessage(t,n,r,o);var f=this.getNaviInfoFromCache();return(null==f?void 0:f.grpRRVer)&&n.messageType===exports.MessageType.READ_RECEIPT_RESPONSE?Promise.resolve({code:exports.ErrorCode.READ_RECEIPT_ERROR}):this._engine.sendMessage(e,t,n,r,o)},e.prototype.sendExpansionMessage=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l,p,d;return Ce(this,(function(h){switch(h.label){case 0:return t=e.channelId,n=e.conversationType,r=e.targetId,o=e.messageUId,i=e.keys,s=e.expansion,a=e.removeAll,u=e.canIncludeExpansion,e.messageType===exports.MessageType.STREAM_MESSAGE&&((null==i?void 0:i.includes("RC_Ext_StreamMsgSummary"))||(null==s?void 0:s.RC_Ext_StreamMsgSummary))?[2,{code:exports.ErrorCode.STREAM_MESSAGE_EXPANSION_KEY_ERROR}]:u?(c=Rt(s),l=c.isIllgalEx,p=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||p?[2,Promise.resolve({code:exports.ErrorCode.EXPANSION_LIMIT_EXCEET})]:l?[2,Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION})]:(d={mid:o},s&&(d.put=s),i&&(d.del=i),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,r,{content:d,messageType:exports.MessageType.EXPANSION_NOTIFY,channelId:t})])):[2,{code:exports.ErrorCode.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:h.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return Te(this,void 0,void 0,(function(){var r;return Ce(this,(function(o){return r=this.getNaviInfoFromCache(),1!==((null==r?void 0:r.grpRRVer)||0)?[2,{code:exports.ErrorCode.READ_RECEIPT_ERROR,msg:"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 Te(this,void 0,void 0,(function(){var r;return Ce(this,(function(o){return r=this.getNaviInfoFromCache(),1!==((null==r?void 0:r.grpRRVer)||0)?[2,{code:exports.ErrorCode.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n||"")]}))}))},e.prototype.sendReadReceiptMessageV4=function(e,t,n){return Te(this,void 0,void 0,(function(){return Ce(this,(function(r){return[2,this._engine.sendReadReceiptMessageV4(e,t,n)]}))}))},e.prototype.getMessageReadReceiptV4=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.getMessageReadReceiptV4(e,t)]}))}))},e.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.batchGetMessageReadReceiptInfoV4(e,t)]}))}))},e.prototype.updateConversationReadTime=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.updateConversationReadTime(e,t)]}))}))},e.prototype._destroy=function(){return Te(this,void 0,void 0,(function(){var e=this;return Ce(this,(function(t){switch(t.label){case 0:return this._resetWatcher(),this._engine.destroy(),fr.removeNetworkStatusListener(),[4,this.disconnect()];case 1:return t.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondestroy)try{t.ondestroy()}catch(t){e.logger.error(exports.LogTagId.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,r,o,i,s,a){var u={timestamp:n||0,count:r||20,order:o||0,channelId:i||""};if(e===exports.ConversationType.ULTRA_GROUP){var c=this._channelIdConvert(e,u.channelId);return u.channelId=c,this._engine.getUltraHistoryMsg(t,u,a)}return this._engine.getHistoryMessage(e,t,u.timestamp,u.count,u.order,u.channelId,s||"",a)},e.prototype.getMessages=function(e,t,n,r,o,i,s){var a={timestamp:n||0,count:r||20,order:o||0,channelId:i||""};if(e===exports.ConversationType.ULTRA_GROUP){var u=this._channelIdConvert(e,a.channelId);return a.channelId=u,this._engine.getUltraHistoryMsg(t,a,s)}return this._engine.getMessages(e,t,a.timestamp,a.count,a.order,a.channelId,s)},e.prototype.getContinuousMessages=function(e,t,n,r,o,i){return void 0===n&&(n=0),void 0===r&&(r=20),void 0===o&&(o=0),void 0===i&&(i=""),this._engine.getContinuousMessages(e,t,n,r,o,i)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,o,i,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,r,o,i,s)},e.prototype.getConversationList=function(e,t,n,r,o){if(t===exports.ConversationType.ULTRA_GROUP){var i=exports.ErrorCode.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:exports.ErrorCode[i]})}return this._engine.getConversationList(e||300,t,n,r,o||"")},e.prototype.getConversationsByPage=function(e,t,n,r,o){return this._engine.getConversationsByPage(e,t,n,r,o)},e.prototype.getConversation=function(e,t,n){var r=this._channelIdConvert(e,n);return this._engine.getConversation(e,t,r||"")},e.prototype.removeConversation=function(e,t,n){return e===exports.ConversationType.ULTRA_GROUP?Promise.resolve(exports.ErrorCode.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n||"")},e.prototype.batchRemoveConversation=function(e){return this._engine.batchRemoveConversation(e)},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){if(e===exports.ConversationType.ULTRA_GROUP){var r=this._channelIdConvert(e,n);return this._engine.clearUltraUnreadcount(t,r||"")}return this._engine.clearConversationUnreadCount(e,t,n||"")},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){var r=this._channelIdConvert(e,n);return this._engine.getConversationUnreadCount(e,t,r||"")},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(exports.ConversationType.ULTRA_GROUP)){var r=exports.ErrorCode.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:exports.ErrorCode[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[exports.ConversationType.PRIVATE,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.PUBLIC_SERVICE],!!n)},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){return this._engine.getTotalUnreadCountByLevels(e,t,n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._engine.getFirstUnreadMessage(e,t,n||"")},e.prototype.getFirstUnreadMessageInfo=function(e,t,n){return this._engine.getFirstUnreadMessageInfo(e,t,n)},e.prototype.setConversationNotificationLevel=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o;return Ce(this,(function(i){return o=this._channelIdConvert(e,r),[2,this._engine.setConversationNotificationLevel(e,t,n,o||"")]}))}))},e.prototype.batchSetConversationNotificationLevel=function(e,t){return this._engine.batchSetConversationNotificationLevel(e,t)},e.prototype.setConversationStatus=function(e,t,n,r,o,i){if(void 0===i&&(i=!0),e===exports.ConversationType.ULTRA_GROUP&&void 0!==n)return Promise.resolve(exports.ErrorCode.METHOD_NOT_SUPPORT);var s=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:this._channelIdConvert(e,o)||"",isUpdateTime:i}];return this._engine.batchSetConversationStatus(s)},e.prototype.setConversationToTop=function(e,t,n,r,o){return this._engine.setConversationToTop(e,t,n,r,o)},e.prototype.batchSetConversationToTop=function(e,t,n){return this._engine.batchSetConversationToTop(e,t,!!n)},e.prototype.saveConversationMessageDraft=function(e,t,n,r){var o=this._channelIdConvert(e,r);return this._engine.saveConversationMessageDraft(e,t,n,o||"")},e.prototype.getConversationMessageDraft=function(e,t,n){var r=this._channelIdConvert(e,n);return this._engine.getConversationMessageDraft(e,t,r||"")},e.prototype.clearConversationMessageDraft=function(e,t,n){var r=this._channelIdConvert(e,n);return this._engine.clearConversationMessageDraft(e,t,r||"")},e.prototype.recallMessage=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return n=function(e,t){return it.create(e).isObject("conversatino",t,!0).fail(exports.ErrorCode.INVALID_PARAMETER_CONVERSATION).isValueOf("conversationType",t.conversationType,exports.ConversationType,!0).fail(exports.ErrorCode.INVALID_PARAMETER_CONVERSATION_TYPE).validate("targetId",t.targetId,Ct,!0).fail(exports.ErrorCode.INVALID_PARAMETER_TARGET_ID).validate("channelId",t.channelId,Tt).fail(exports.ErrorCode.INVALID_PARAMETER_CHANNEL_ID)}("recallMessage",e).isString("messageUId",t.messageUId,!0).fail(exports.ErrorCode.INVALID_PARAMETER_MESSAGE_UID).isInteger("sentTime",t.sentTime,!1).fail(exports.ErrorCode.INVALID_PARAMETER_TIMESTAMP).isBoolean("disableNotification",t.disableNotification).fail(exports.ErrorCode.INVALID_PARAMETER_DISABLE_NOTIFICATION).isObject("pushConfig",t.pushConfig).fail(exports.ErrorCode.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("disableUpdateLastMessage",t.disableUpdateLastMessage).fail(exports.ErrorCode.INVALID_DISABLE_UPDATE_LAST_MESSAGE).isLimitedTypedArray("directionalUserIdList",t.directionalUserIdList,300,Ct,!1,1).fail(exports.ErrorCode.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validatorConnected),n.isOk?(r=t.messageUId,o=this.logger.createTraceId(),this.logger.info(exports.LogTagId.A_RECALL_MESSAGE_T,JSON.stringify({messageUId:r}),o),i=e.conversationType,s=e.channelId,e.channelId=this._channelIdConvert(i,s)||"",[4,this._engine.recallMsg(e,t)]):(this.logger.warn(exports.LogTagId.A_RECALL_MESSAGE_E,n.errmsg()),[2,n.wipe()]);case 1:return a=u.sent(),this.logger.summary(exports.LogTagId.A_RECALL_MESSAGE_R,a,o,{messageUId:r}),[2,a]}}))}))},e.prototype.deleteRemoteMessage=function(e,t,n,r){if(e===exports.ConversationType.ULTRA_GROUP&&At())return Promise.resolve(exports.ErrorCode.METHOD_NOT_SUPPORT);var o=this._channelIdConvert(e,r);return this._engine.deleteRemoteMessage(e,t,n,o||"")},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){var o=this._channelIdConvert(e,r);return this._engine.deleteRemoteMessageByTimestamp(e,t,n,o||"")},e.prototype.joinChatroom=function(e,t,n,r){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,r,n)},e.prototype.joinExistChatroom=function(e,t,n,r){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,r,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return this._engine.getChatroomInfo(e,t||0,n||0)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,r=t.value;return Kt(n)?Qt(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_VALUE):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],o=r.key,i=r.value;if(!Kt(o))return Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_KEY});if(!Qt(i))return Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_VALUE})}var s=Ee(Ee({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return Kt(n)?Qt(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_VALUE):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return Kt(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!Kt(r))return Promise.resolve({code:exports.ErrorCode.INVALID_PARAMETER_KEY})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return Kt(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(exports.ErrorCode.INVALID_PARAMETER_KEY)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,r){return this._engine.getChatroomHistoryMessages(e,r||0,t||20,n||0)},e.prototype.getFileToken=function(e,t,n,r,o,i){return Te(this,void 0,void 0,(function(){var s,a,u,c,l,p;return Ce(this,(function(d){switch(d.label){case 0:return s=this.getNaviInfoFromCache(),a=(null==s?void 0:s.uploadServer)||"",u=(null==s?void 0:s.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,r,o,i)];case 1:return c=d.sent(),l=c.code,p=c.data,l===exports.ErrorCode.SUCCESS&&p?[2,Promise.resolve(Object.assign(p,{qiniu:a,ossConfig:p.ossConfig||u}))]:[2,Promise.reject(l)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return[4,this._engine.getFileUrl(e,n,t,r)];case 1:return o=a.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS?[2,Promise.resolve(s)]:[2,Promise.reject(i)]}}))}))},e.prototype.createTag=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return Te(this,void 0,void 0,(function(){var n,r=this;return Ce(this,(function(o){return t.length>1e3?[2,Promise.resolve({code:exports.ErrorCode.CONVER_OUT_LIMIT_ERROR})]:(n=t.map((function(e){var t=e.conversationType,n=e.targetId,o=e.channelId;return{conversationType:t,targetId:n,channelId:r._channelIdConvert(t,o)}})),[2,this._engine.addTagForConversations(e,n)])}))}))},e.prototype.removeTagForConversations=function(e,t){return Te(this,void 0,void 0,(function(){var n,r=this;return Ce(this,(function(o){return n=t.map((function(e){var t=e.conversationType,n=e.targetId,o=e.channelId;return{conversationType:t,targetId:n,channelId:r._channelIdConvert(t,o)}})),[2,this._engine.removeTagForConversations(e,n)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return Te(this,void 0,void 0,(function(){var n;return Ce(this,(function(r){return n=this._channelIdConvert(e.conversationType,e.channelId),e.channelId=n,[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return Te(this,void 0,void 0,(function(){var r;return Ce(this,(function(o){return r=this._channelIdConvert(t.conversationType,t.channelId),t.channelId=r,[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return Te(this,void 0,void 0,(function(){var t;return Ce(this,(function(n){return t=this._channelIdConvert(e.conversationType,e.channelId),e.channelId=t,[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(e,t){return e&&0!==e.length||(e=[exports.ConversationType.PRIVATE,exports.ConversationType.CHATROOM,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.APP_PUBLIC_SERVICE,exports.ConversationType.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t||"")},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[exports.ConversationType.PRIVATE,exports.ConversationType.CHATROOM,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.APP_PUBLIC_SERVICE,exports.ConversationType.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(e)},e.prototype.getUnreadMentionedCount=function(e){var t=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=t,this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==exports.ConversationType.ULTRA_GROUP){var t=exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:t,msg:exports.ErrorCode[t]})}var n=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=n,this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){var t=this,n=e.messages.map((function(n){var r=n.sendTime,o=n.messageUId,i=n.channelId;return{sendTime:r,messageUId:o,channelId:t._channelIdConvert(e.conversationType,i)}}));return e.messages=n,this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,r=e.canIncludeExpansion,t!==exports.ConversationType.ULTRA_GROUP?[2,{code:o=exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT,msg:exports.ErrorCode[o]}]:r?(i=Rt(n),s=i.isIllgalEx,a=i.isExKeyOrValLengthExceedLimit,i.isExceedLimit||a?[2,{code:exports.ErrorCode.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:exports.ErrorCode.INVALID_PARAMETER_MESSAGE_EXPANSION}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:exports.ErrorCode.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return Te(this,void 0,void 0,(function(){var t;return Ce(this,(function(n){switch(n.label){case 0:return e.conversationType!==exports.ConversationType.ULTRA_GROUP?[2,{code:t=exports.ErrorCode.CONVERSATION_TYPE_NOT_SUPPORT,msg:exports.ErrorCode[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e,t)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadCountByTargetId(e,t)},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.getUltraGroupUnreadMentionedMessages=function(e){var t=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupUnreadMentionedMessages(e)},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){var t=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupFirstUnreadMessageTimestamp(e)},e.prototype.getUltraGroupUnreadInfoList=function(e){return this._engine.getUltraGroupUnreadInfoList(e)},e.prototype.callExtra=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this._engine).callExtra.apply(t,ye([e],ve(n),!1))},e.prototype.getOSInfo=function(){return this._engine.getOSInfo()},e.prototype.getProcessInfo=function(){return this._engine.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._engine.getMainProcessInfo()},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._isEnableSubDriven=function(e){var t=(this.getNaviInfoFromCache()||{}).subDriven,n=void 0===t?0:t;switch(e){case exports.SubscribeType.ONLINE_STATUS:return 1&n;case exports.SubscribeType.USER_PROFILE:return 2&n;default:return!1}},e.prototype.subscribeUser=function(e,t,n){return this._isEnableSubDriven(t)?this._engine.subscribeUser(e,t,n):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.unSubscribeUser=function(e,t){return this._isEnableSubDriven(t)?this._engine.unSubscribeUser(e,t):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.getSubscribeUserList=function(e,t,n){return this._isEnableSubDriven(e)?this._engine.getSubscribeUserList(e,t,n):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.getSubscribeUserStatus=function(e,t){return this._isEnableSubDriven(e)?this._engine.getSubscribeUserStatus(e,t):Promise.resolve({code:exports.ErrorCode.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.updateMyUserProfile=function(e){return this._engine.updateMyUserProfile(e)},e.prototype.getUserProfiles=function(e){return this._engine.getUserProfiles(e)},e.prototype.getMyUserProfile=function(){return this._engine.getMyUserProfile()},e.prototype.updateMyUserProfileVisibility=function(e){return this._engine.updateMyUserProfileVisibility(e)},e.prototype.getMyUserProfileVisibility=function(){return this._engine.getMyUserProfileVisibility()},e.prototype.searchUserProfileByUniqueId=function(e){return this._engine.searchUserProfileByUniqueId(e)},e.prototype.clearConversations=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.clearConversations(e,t)]}))}))},e.prototype.setUserStatusListener=function(e,t){var n=this;return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){n.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i;return Ce(this,(function(s){return r=this.checkSearchPropsMsg(n.messageType,n.content),o=r.code,i=r.msg,o!==exports.ErrorCode.SUCCESS?[2,Promise.resolve({code:o,msg:i})]:[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.batchInsertMessage=function(e,t){return this._engine.batchInsertMessage(e,t)},e.prototype.getMessageCount=function(e,t,n){return void 0===n&&(n=""),Te(this,void 0,void 0,(function(){return Ce(this,(function(r){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,o){return void 0===o&&(o=""),Te(this,void 0,void 0,(function(){return Ce(this,(function(i){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,!!r,o)]}))}))},e.prototype.batchClearMessagesByTimestamp=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.batchClearMessagesByTimestamp(e)]}))}))},e.prototype.batchClearRemoteHistoryMessages=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.batchClearRemoteHistoryMessages(e,t)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),Te(this,void 0,void 0,(function(){return Ce(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getLocalMessage=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o=this;return Ce(this,(function(i){switch(i.label){case 0:return t=it.create("getLocalMessage").validate("messageId",e,(function(){return ut(e)||ct(e)}),!0).fail(exports.ErrorCode.INVALID_PARAMETER_MESSAGE_ID).result(),n=this.logger.createTraceId(),this.logger.info(exports.LogTagId.A_GET_LOCAL_MESSAGE_T,JSON.stringify({messageId:e}),n),[4,t.next((function(){return o._engine.getMessage(e)}))];case 1:return r=i.sent(),this.logger.summary(exports.LogTagId.A_GET_LOCAL_MESSAGE_R,r,n,{messageId:e}),[2,r]}}))}))},e.prototype.setMessageContent=function(e,t,n){return Te(this,void 0,void 0,(function(){return Ce(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return Te(this,void 0,void 0,(function(){return Ce(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,this._engine.updateMessageReceiptStatus(e,t,n,r)]}))}))},e.prototype.setUserStatus=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,r){return void 0===t&&(t=[]),Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,this._engine.searchConversationByContent(e,t,n||"",r)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),Te(this,void 0,void 0,(function(){return Ce(this,(function(r){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,r,o,i,s){return void 0===s&&(s=""),Te(this,void 0,void 0,(function(){return Ce(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,r,o,i,s)]}))}))},e.prototype.searchMessageByContentAndMessageType=function(e,t,n,r,o,i,s){return Te(this,void 0,void 0,(function(){return Ce(this,(function(a){return[2,this._engine.searchMessageByContentAndMessageType(e,t,n,r,o,i,s)]}))}))},e.prototype.searchMessagesByUser=function(e,t,n,r,o,i){return void 0===o&&(o=5),void 0===i&&(i=""),Te(this,void 0,void 0,(function(){return Ce(this,(function(s){return[2,this._engine.searchMessagesByUser(e,t,n,r,o,i)]}))}))},e.prototype.getMessagesByTimestamp=function(e,t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,this._engine.getMessagesByTimestamp(e,t,n,r)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){return Ce(this,(function(i){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,r,o)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,o,i,s){return Te(this,void 0,void 0,(function(){return Ce(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,r,o,i,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(e,t,n,r)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){var n=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,t);return this._engine.getUltraGroupDefaultNotificationLevel(e,n||"")},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){var r=this._channelIdConvert(exports.ConversationType.ULTRA_GROUP,n);return this._engine.setUltraGroupDefaultNotificationLevel(e,t,r||"")},e.prototype.getConversationNotificationLevel=function(e,t,n){var r=this._channelIdConvert(e,n);return this._engine.getConversationNotificationLevel(e,t,r||"")},e.prototype.setConversationTypeNotificationLevel=function(e,t){return this._engine.setConversationTypeNotificationLevel(e,t)},e.prototype.getConversationTypeNotificationLevel=function(e){return this._engine.getConversationTypeNotificationLevel(e)},e.prototype.getConversationNotificationStatus=function(e,t,n){var r=this._channelIdConvert(e,n);return this._engine.getConversationNotificationStatus(e,t,r||"")},e.prototype.getRemoteHistoryMessages=function(e,t,n,r,o,i){return this._engine.getRemoteHistoryMessages(e,t,n,r,o,i)},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 Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.createLogger=function(e,t){return this._engine.createLogger(e,t)},e.prototype.getConversations=function(e){return this._engine.getConversations(e)},e.prototype.setCheckDuplicateMessage=function(e){return this._engine.setCheckDuplicateMessage(e)},e.prototype.setCheckChatRoomDuplicateMessage=function(e){return this._engine.setCheckChatRoomDuplicateMessage(e)},e.prototype.rtcSignaling=function(e,t,n,r){return this._engine.rtcSignaling(e,t,n,r)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e.prototype.setProxy=function(e){return this._engine.setProxy(e)},e.prototype.getProxy=function(){return this._engine.getProxy()},e.prototype.testProxy=function(e,t){return this._engine.testProxy(e,t)},e.prototype.createGroup=function(e,t,n,r){return void 0===r&&(r=[]),this._engine.createGroup(e,t,n,r)},e.prototype.updateGroupInfo=function(e,t,n){return this._engine.updateGroupInfo(e,t,n)},e.prototype.getGroupsInfo=function(e){return this._engine.getGroupsInfo(e)},e.prototype.kickGroupMembers=function(e,t,n){return this._engine.kickGroupMembers(e,t,n)},e.prototype.quitGroup=function(e,t){return this._engine.quitGroup(e,t)},e.prototype.dismissGroup=function(e){return this._engine.dismissGroup(e)},e.prototype.transferGroupOwner=function(e,t,n,r){return void 0===r&&(r=!1),this._engine.transferGroupOwner(e,t,r,n)},e.prototype.setGroupManagers=function(e,t,n){return this._engine.setGroupManagers(e,t,n)},e.prototype.getGroupMembersByRole=function(e,t,n){return this._engine.getGroupMembersByRole(e,t,n)},e.prototype.getGroupMembers=function(e,t){return this._engine.getGroupMembers(e,t)},e.prototype.setGroupMemberInfo=function(e,t,n,r){return this._engine.setGroupMemberInfo(e,t,n,r)},e.prototype.searchGroupMembers=function(e,t,n){return this._engine.searchGroupMembers(e,t,n)},e.prototype.joinGroup=function(e){return this._engine.joinGroup(e)},e.prototype.inviteUsersToGroup=function(e,t){return this._engine.inviteUsersToGroup(e,t)},e.prototype.acceptGroupInvite=function(e,t){return this._engine.memberInviteResponse({groupId:e,inviterId:t,optType:0,optResult:exports.GroupOperationStatus.ACCEPT})},e.prototype.refuseGroupInvite=function(e,t,n){return this._engine.memberInviteResponse({groupId:e,inviterId:t,optType:0,optResult:exports.GroupOperationStatus.REFUSE,reason:n})},e.prototype.acceptGroupApplication=function(e,t,n){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:exports.GroupOperationStatus.ACCEPT})},e.prototype.refuseGroupApplication=function(e,t,n,r){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:exports.GroupOperationStatus.REFUSE,reason:r})},e.prototype.getGroupApplications=function(e,t,n){return this._engine.getGroupApplications(e,t,n)},e.prototype.getJoinedGroupsByRole=function(e,t){return this._engine.getJoinedGroupsByRole(e,t)},e.prototype.searchJoinedGroups=function(e,t){return this._engine.searchJoinedGroups(e,t)},e.prototype.getJoinedGroups=function(e){return this._engine.getJoinedGroups(e)},e.prototype.setGroupRemark=function(e,t){return this._engine.setGroupRemark(e,t)},e.prototype.addGroupFollows=function(e,t){return this._engine.setGroupFollows(exports.GroupOperationType.ADD,e,t)},e.prototype.removeGroupFollows=function(e,t){return this._engine.setGroupFollows(exports.GroupOperationType.REMOVE,e,t)},e.prototype.getGroupFollows=function(e){return this._engine.getGroupFollows(e)},e.prototype.addFriend=function(e,t,n){return this._engine.addFriend(e,t,n)},e.prototype.deleteFriends=function(e,t){return this._engine.deleteFriends(e,t)},e.prototype.acceptFriendApplication=function(e){return this._engine.acceptFriendApplication(e)},e.prototype.refuseFriendApplication=function(e,t){return this._engine.refuseFriendApplication(e,t)},e.prototype.setFriendInfo=function(e,t,n){return this._engine.setFriendInfo(e,t,n)},e.prototype.checkFriends=function(e,t){return this._engine.checkFriends(e,t)},e.prototype.getFriends=function(e,t){return this._engine.getFriends(e,t)},e.prototype.getFriendApplications=function(e,t,n){return this._engine.getFriendApplications(e,t,n)},e.prototype.getFriendsInfo=function(e){return this._engine.getFriendsInfo(e)},e.prototype.searchFriendsInfo=function(e){return this._engine.searchFriendsInfo(e)},e.prototype.setFriendAddPermission=function(e){return this._engine.setFriendAddPermission(e)},e.prototype.getFriendAddPermission=function(){return this._engine.getFriendAddPermission()},e.prototype.getRealtimeConversations=function(e,t,n){return this._engine.getRealtimeConversations(e,t,n)},e.prototype.getRealtimeConTotalUnreadCount=function(){return this._engine.getRealtimeConTotalUnreadCount()},e.prototype.clearRealtimeConUnreadCount=function(e){return this._engine.clearRealtimeConUnreadCount(e)},e.prototype.removeRealtimeConversations=function(e){return this._engine.removeRealtimeConversations(e)},e.prototype.getRealtimeConUnreadCounts=function(e){return this._engine.getRealtimeConUnreadCounts(e)},e.prototype.setNotificationQuietHoursWithSetting=function(e){var t=this;return it.create("setNotificationQuietHoursWithSetting").isObject("opts",e,!0).isString("timezone",e.timezone).fail(exports.ErrorCode.BIZ_ERROR_INVALID_PARAMETER).validate("startTime",e.startTime,(function(e){return/^\d{2}(:\d{2}){2}$/.test(e)}),!0).fail(exports.ErrorCode.INVALID_PARAMETER_TIMESTRING).isLimitedNumber("spanMinutes",e.spanMinutes,1,1439,!0).fail(exports.ErrorCode.INVALID_PARAMETER_SPAN_MINUTES).isValueOf("level",e.level,exports.PushNotificationQuietHoursLevel,!0).fail(exports.ErrorCode.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().next((function(){return t._engine.setNotificationQuietHoursWithSetting(e)}))},e.prototype.removeNotificationQuietHoursSetting=function(){return this._engine.removeNotificationQuietHoursSetting()},e.prototype.getNotificationQuietHoursSetting=function(){return this._engine.getNotificationQuietHoursSetting()},Ie([Na],e.prototype,"updateMyUserProfile",null),Ie([Na],e.prototype,"getUserProfiles",null),Ie([Na],e.prototype,"getMyUserProfile",null),Ie([Na],e.prototype,"updateMyUserProfileVisibility",null),Ie([Na],e.prototype,"getMyUserProfileVisibility",null),Ie([Na],e.prototype,"searchUserProfileByUniqueId",null),Ie([Na],e.prototype,"createGroup",null),Ie([Na],e.prototype,"updateGroupInfo",null),Ie([Na],e.prototype,"getGroupsInfo",null),Ie([Na],e.prototype,"kickGroupMembers",null),Ie([Na],e.prototype,"quitGroup",null),Ie([Na],e.prototype,"dismissGroup",null),Ie([Na],e.prototype,"transferGroupOwner",null),Ie([Na],e.prototype,"setGroupManagers",null),Ie([Na],e.prototype,"getGroupMembersByRole",null),Ie([Na],e.prototype,"getGroupMembers",null),Ie([Na],e.prototype,"setGroupMemberInfo",null),Ie([Na],e.prototype,"searchGroupMembers",null),Ie([Na],e.prototype,"joinGroup",null),Ie([Na],e.prototype,"inviteUsersToGroup",null),Ie([Na],e.prototype,"acceptGroupInvite",null),Ie([Na],e.prototype,"refuseGroupInvite",null),Ie([Na],e.prototype,"acceptGroupApplication",null),Ie([Na],e.prototype,"refuseGroupApplication",null),Ie([Na],e.prototype,"getGroupApplications",null),Ie([Na],e.prototype,"getJoinedGroupsByRole",null),Ie([Na],e.prototype,"searchJoinedGroups",null),Ie([Na],e.prototype,"getJoinedGroups",null),Ie([Na],e.prototype,"setGroupRemark",null),Ie([Na],e.prototype,"addGroupFollows",null),Ie([Na],e.prototype,"removeGroupFollows",null),Ie([Na],e.prototype,"getGroupFollows",null),Ie([Na],e.prototype,"addFriend",null),Ie([Na],e.prototype,"deleteFriends",null),Ie([Na],e.prototype,"acceptFriendApplication",null),Ie([Na],e.prototype,"refuseFriendApplication",null),Ie([Na],e.prototype,"setFriendInfo",null),Ie([Na],e.prototype,"checkFriends",null),Ie([Na],e.prototype,"getFriends",null),Ie([Na],e.prototype,"getFriendApplications",null),Ie([Na],e.prototype,"getFriendsInfo",null),Ie([Na],e.prototype,"searchFriendsInfo",null),Ie([Na],e.prototype,"setFriendAddPermission",null),Ie([Na],e.prototype,"getFriendAddPermission",null),Ie([Oa],e.prototype,"getRealtimeConversations",null),Ie([Oa],e.prototype,"getRealtimeConTotalUnreadCount",null),Ie([Oa],e.prototype,"clearRealtimeConUnreadCount",null),Ie([Oa],e.prototype,"removeRealtimeConversations",null),Ie([Oa],e.prototype,"getRealtimeConUnreadCounts",null),e}(),Ua=function(){function e(e,t){var n,r;this._logTagT=e,this._logTagR=t,this.verificationFaileList=[],this.context=La.getContext(),this.logger=null===(n=this.context)||void 0===n?void 0:n.logger,this.option=null===(r=this.context)||void 0===r?void 0:r.getOptions()}return e.prototype.validate=function(e,t,n,r,o){if(void 0===r&&(r=!1),this.verificationFaileList.length>0)return this;n=Ca[n]||n;var i=r?n(t):gt(t)||null==t||n(t);if("object"==typeof i){var s=i.valid,a=i.errorKey;return!s&&a&&this.verificationFaileList.push({key:a,value:t,isValid:!1,message:o,code:ua[a]}),this}return i||this.verificationFaileList.push({key:e,value:t,isValid:i,message:o,code:ua[e]}),this},e.prototype.validateParameters=function(e,t,n,r,o,i){if(void 0===o&&(o=!1),this.verificationFaileList.length>0)return this;n=Ca[n]||n;var s=o?n(t):gt(t)||null==t||n(t);if("object"==typeof s){var a=s.valid,u=s.errorKey,c=s.errorCode;return!a&&u&&this.verificationFaileList.push({key:u,value:t,code:c||r,message:i,isValid:!1}),this}return s||this.verificationFaileList.push({key:e,value:t,code:r,message:i,isValid:!1}),this},e.prototype._getValidationResult=function(){if(this.verificationFaileList.length>0)return this.verificationFaileList[0]},e.prototype.ifReady=function(e){var t;if(!this.context)return Promise.resolve({code:exports.ErrorCode.BIZ_ERROR_CLIENT_NOT_INIT});var n=this._getValidationResult();if(n){var r=n.code,o=n.value,i=n.message,s=n.key;return null===(t=this.logger)||void 0===t||t.error(this._logTagR,JSON.stringify({code:r})),Promise.resolve({code:r,msg:"'".concat(s,"' is invalid: ").concat(i||JSON.stringify(o))})}var a=this.logger.createTraceId();return e(this.context,this.logger,this.option,a)},e.prototype.try2do=function(e){if(!this.context)throw new Error("Not initialized yet!");return e(this.context,this.logger,this.option)},e.prototype.ifReadySync=function(e){var t;if(!this.context)return{code:exports.ErrorCode.BIZ_ERROR_CLIENT_NOT_INIT};var n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);var r=n.code,o=n.value,i=n.message,s=n.key;return null===(t=this.logger)||void 0===t||t.warn(this._logTagR,JSON.stringify({code:r})),{code:r,msg:"'".concat(s,"' is invalid: ").concat(i||o)}},e}(),Pa=function(){return Ma||(Ma={set:function(e,t){fr.localStorage.setItem(e,JSON.stringify(t))},get:function(e){var t;try{t=JSON.parse(fr.localStorage.getItem(e))}catch(e){t=null}return t},remove:function(e){return fr.localStorage.removeItem(e)},getKeys:function(){var e=[];for(var t in fr.localStorage)e.push(t);return e}}),Ma},ba=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}(),xa=function(){function e(e){var t;this._rootStorage=Pa();var n=this._rootStorage.get(e)||{};this._cache=new ba(((t={})[e]=n,t)),this._storageKey=e}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.prototype.update=function(e){void 0===e&&(e={});var t=this._storageKey;this._cache.set(t,e),this._rootStorage.set(t,e)},e}(),Da=function(){var e="";if("browser"===fr.tag)return Xe;var t="RCDeviceId",n=Pa(),r=n.get(t);return r?e=r:(e=Je.genWithLen(22),n.set(t,e)),e},wa=function(){if("browser"!==fr.tag)return{type:fr.tag,version:"UnKonw"};var e,t,n=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 i=n.match(r[o]);if(i){t=o,e=i[1]||i[2];break}}return{type:t||"UnKonw",version:e||"UnKonw"}};function Va(e){return Boolean(1&((null==e?void 0:e.sessionMode)||0))}var Ga="converStatusChanged",Fa=function(e){function n(t,n,r){var o=e.call(this)||this;return o._eventEmitter=new ns,o._pullQueue=[],o._isPulling=!1,o._pullPromise=null,o._storagePullTimeKey="con-s-".concat(n,"-").concat(r),o._oldStorage=Pa(),o._storage=new xa(xe(n,r)),o._engine=t,o.adaptOldStatus(),o}return t(n,e),n.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var e=this._oldStorage.get(this._storagePullTimeKey)||0;if(!e)return;this._storage.set(this._storagePullTimeKey,e),this._oldStorage.remove(this._storagePullTimeKey)}catch(e){this._engine.getInnerLogger().error(exports.LogTagId.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},n.prototype._set=function(e){var t=this;if(!gt(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,o){var i=e.updatedTime||0;n=i>n?i:n,e.conversationType=e.type,t._eventEmitter.emit(Ga,{statusItem:e,isLastPull:o===r-1})})),this._storage.set(this._storagePullTimeKey,n),this._pullQueue=this._pullQueue.filter((function(e){return e>n}))}},n.prototype._startPull=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r;return Ce(this,(function(o){switch(o.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),e=this.getVersion(),this._pullPromise=this._engine.pullConversationStatus(e),[4,this._pullPromise]);case 1:return t=o.sent(),n=t.code,r=t.data,this._isPulling=!1,this._pullPromise=null,n===exports.ErrorCode.SUCCESS&&this._set(r),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},n.prototype._startCall=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},n.prototype.pull=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},n.prototype._triggerPull=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},n.prototype.watch=function(e){this._eventEmitter.on(Ga,(function(t){e(t)}))},n.prototype.setConversationUpdatedTime=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t},n.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},n}(aa),Ba={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},fut:{keyName:"firstUnreadTime",defaultVal:0},fuid:{keyName:"firstUnreadMessageUid",defaultVal:""},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},ka={};for(var Ha in Ba){var qa=Ba[Ha].keyName;ka[qa]=Ha}var Ya=function(){function e(e,t,n){this._currentUserId=t,this.logger=n,this.storage=new xa(De(e,t)),this._localStore=new xa(we(e,t))}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(),r=t.shift(),o=t.join("_");return{conversationType:Number(r),targetId:o,channelId:n}}return{conversationType:exports.ConversationType.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var r=this,o=e.conversationType,i=e.messageType,s=e.isMentioned,a=e.senderUserId;s&&o===exports.ConversationType.GROUP&&((n.userIdList||[]).forEach((function(e){e===r._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===exports.MentionedType.ALL&&t.indexOf(a)<0&&t.push(a));if(i===exports.MessageType.RECALL&&o===exports.ConversationType.GROUP){var u=t.indexOf(a);u>=0&&t.splice(u,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,r=e.content,o=e.channelId,i=e.senderUserId,s=r.mentionedInfo;if(s&&i!==this._currentUserId){var a=this._getStoreKey(t,n,o),u=this._localStore.get(a)||{},c=ka.mentionedInfo,l=ka.hasMentioned,p=u[c]||{},d=p.userIdList||[];s={userIdList:d=this._updateMentionedUserList(e,d,s),type:(null==s?void 0:s.type)||p.type},0!==d.length?(u[c]=s,u[l]=!0):(delete u[c],delete u[l]),Et(u)?this._localStore.set(a,u):this._localStore.remove(a)}},e.prototype._setLocal=function(e,t){if("tags"===e)for(var n in t)t[n].isTop||delete t[n].isTop;return t},e.prototype.set=function(e,t,n,r){var o=this._getStoreKey(e,t,r),i=this._localStore.get(o)||{};for(var s in n){var a=ka[s],u=n[s];if(!gt(a)&&!gt(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===Ba[a].defaultVal||"tags"===s&&!Et(u)?delete i[a]:i[a]=this._setLocal(s,u),i.c||(delete i.t,delete i.fut,delete i.fuid,delete i.hm,delete i.m,delete i.mc)}var c=Object.keys(i);1===c.length&&c.includes("st")&&delete i.st,Et(i)?this._localStore.set(o,i):this._localStore.remove(o)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),o=this._localStore.get(r)||{},i={};for(var s in Ba){var a=Ba[s],u=a.keyName,c=a.defaultVal;i[u]=o[s]||mt(c)}return i},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var o=this._getConOptionByKey(r),i={conversationType:o.conversationType,targetId:o.targetId,channelId:o.channelId},s=t[r];for(var a in s)if(Ba[a]){var u=Ba[a],c=u.keyName,l=u.defaultVal;i[c]=s[a]||mt(l)}i=e?e(i):i,n.push(i)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),o=r.conversationType,i=r.targetId,s={},a=e[n];for(var u in a){var c=Ba[u],l=c.keyName,p=c.defaultVal;s[l]=a[u]||mt(p)}for(var d in s.tags){gt(t[d])&&(t[d]=[]);var h=Ee(Ee({},s),{conversationType:o,targetId:i});delete h.tags,t[d].push(h)}}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){this.logger.error(exports.LogTagId.O,"adaptOldStore error: ".concat(e.message))}},e.prototype.remove=function(e,t,n){var r=this._getStoreKey(e,t,n);this._localStore.remove(r)},e}(),Ka=[exports.ConversationType.PRIVATE,exports.ConversationType.GROUP,exports.ConversationType.SYSTEM,exports.ConversationType.PUBLIC_SERVICE,exports.ConversationType.APP_PUBLIC_SERVICE],Qa="conversationChanged",Wa="conTagStatusChanged",ja=function(){function e(e,t,n,r,o,i){var s=this;this.isEnableRealtimeSession=i,this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new ns,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new Ya(t,n,e.getInnerLogger()),this._statusManager=new Fa(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;s.addStatus(t,n)})),this._eventEmitter.on(Qa,(function(e){r(e)})),this._eventEmitter.on(Wa,(function(){o()}));var a=this._store.getValue();a.length>1e3&&(a=a.sort((function(e,t){var n=e.lastMessageSentTime,r=void 0===n?0:n,o=t.lastMessageSentTime;return(void 0===o?0:o)-r})),a.splice(1e3,a.length).forEach((function(e){s._store.remove(e.conversationType,e.targetId,e.channelId)})))}return e.prototype._calcMsg=function(e,t,n,r){var o=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===r.sentTime})),i=t>=r.sentTime;return n&&(i=n<r.sentTime),{isNotRead:i,isNotRepeadRecallSendTime:o}},e.prototype._calcUnreadCount=function(e,t){if(this.isEnableRealtimeSession)return{hasChanged:!1,localConversation:t,updateItems:{}};var n=e.content,r=e.messageType,o=e.sentTime,i=e.isCounted,s=e.messageDirection,a=e.senderUserId,u=e.messageUId,c=s===exports.MessageDirection.SEND&&a===this._loginUserId,l=r===exports.MessageType.RECALL,p=ht(n),d=!1,h={},_=t.lastUnreadTime,g=t.lastReadTime,f=t.unreadMessageCount;if(_>o||c)return{hasChanged:d,localConversation:t,updateItems:h};if(i&&(0===t.unreadMessageCount&&(t.firstUnreadMessageUid=u,t.firstUnreadTime=o),t.unreadMessageCount=f+1,t.lastUnreadTime=o,d=!0),l&&p){var E=this._handleRecall2UnreadCount(e,_,g,f,d),I=E.unreadMessageCount,T=E.hasChanged;t.unreadMessageCount=I,d=T,0===t.unreadMessageCount&&(t.firstUnreadMessageUid="",t.firstUnreadTime=0)}return d&&(h.unreadMessageCount={val:t.unreadMessageCount||0,time:o}),{hasChanged:d,localConversation:t,updateItems:h}},e.prototype._handleRecall2UnreadCount=function(e,t,n,r,o){var i="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),s=this._calcMsg(i,t,n,e.content),a=s.isNotRead,u=s.isNotRepeadRecallSendTime;return a&&r&&u?(this._recallMsgTimeMap[i]||(this._recallMsgTimeMap[i]=[]),this._recallMsgTimeMap[i].push(e.content.sentTime),{unreadMessageCount:r-1,hasChanged:!0}):{unreadMessageCount:r,hasChanged:o}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=e.messageDirection,o=e.isMentioned,i=e.sentTime,s=r===exports.MessageDirection.SEND,a=ht(n),u=!1,c={};return!s&&o&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:i},c.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,o=!1;if(e.isMentioned&&r===exports.MessageDirection.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var i=n.mentionedInfo,s=i.type,a=i.userIdList;if(s===exports.MentionedType.ALL||(a||[]).includes(this._loginUserId)){o=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:o,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(ht(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,o="".concat(t,"_").concat(n),i=this._store.get(t,n,r)||{};this._updatedConversations[o]=Object.assign(i,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,r){var o=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(o).length===Object.keys(n).length){for(var i in o)if(!n[i]||!!o[i].isTop!=!!n[i].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,r=e.targetId,o=e.updatedTime,i=e.notificationStatus,s=e.notificationLevel,a=e.isTop,u=e.tags,c=e.channelId,l={},p={};if(n!==exports.ConversationType.ULTRA_GROUP){gt(i)||(p.notificationStatus={time:o,val:i}),gt(s)||(p.notificationLevel={time:o,val:s}),gt(a)||(p.isTop={time:o,val:a}),gt(u)||(p.tags={time:o,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,l,c);var d=this._store.get(n,r,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,r,{notificationStatus:i,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},c),r&&(this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:p,channelId:c}),t&&this._notifyConversationChanged())}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(Qa,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Wa),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,o=e.isPersited,i=e.targetId,s=e.channelId,a=e.sentTime,u=e.disableUpdateLastMessage;if(Ka.indexOf(r)>=0){var c=!1,l=this._store.get(r,i,s),p={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,l),o=r.hasChanged,i=r.localConversation,s=r.updateItems;c=c||o,p=Ee(Ee({},p),s),l=mt(i)})),this._store.set(r,i,l,s),this._store.updateMentionedData(e),o&&!u){var d=this._store.get(r,i,s);d.updatedItems=Ee({latestMessage:{time:e.sentTime,val:e}},p),d.latestMessage=e;var h=Object.assign(d,{conversationType:r,targetId:i,channelId:s});this._setUpdatedConversation(h)}(c||o&&!u)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var r=this._store.getValue(),o=0;return r.forEach((function(e){var r=e.unreadMessageCount,i=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;r=r||0,(n||void 0!==s&&s<=0||void 0===s&&i!==exports.NotificationStatus.OPEN)&&(t.length>0?t.includes(Number(a))&&(o+=Number(r)):o+=Number(r))})),o},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var r=this._store.getValue(),o=0;return r.forEach((function(r){var i=r.unreadMessageCount,s=r.notificationLevel,a=void 0===s?0:s,u=r.conversationType,c=r.unreadMentionedCount;e.includes(u)&&(0===t.length||t.includes(a))&&(o+=(n?c:i)||0)})),o},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,o=e.notificationStatus,i=e.notificationLevel;(t||1!==o||-1===i||0===i)&&(n=n||0,r+=Number(n))})),r},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,r,o){void 0===o&&(o=!0);var i=this._store.get(e,t,n);i.lastReadTime=i.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var s=i.unreadMessageCount,a=i.hasMentioned,u={};if(s&&(i.unreadMessageCount=0,u.unreadMessageCount={val:0,time:r}),a&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,u.hasMentioned={val:!1,time:r},u.mentionedInfo={val:void 0,time:r}),this._store.set(e,t,i,n),o&&0!==Object.keys(u).length){var c=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:u});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,r){var o="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[o]=n},e.prototype.getDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]},e.prototype.clearDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]},e.prototype.addTagStatus=function(e,t,n,r){void 0===r&&(r="");var o=this._store.get(e,t,r),i=o.tags;i=Object.assign(i,n);var s=o.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:i,lastMessageSentTime:s},r)},e.prototype.deleteTagStatus=function(e,t,n,r){void 0===r&&(r="");var o=this._store.get(e,t,r).tags;n.forEach((function(e){delete o[e]})),this._store.set(e,t,{tags:o},r)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===exports.NotificationStatus.OPEN||e.notificationLevel&&e.notificationLevel>0})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,notificationLevel:e.notificationLevel||0,notificationStatus:e.notificationStatus||2}}))},e.prototype.getTopConversationList=function(e,t){var n=this;return(this._store.getValue()||{}).filter((function(n){return e.includes(n.conversationType)&&(gt(t)||t===n.channelId)&&n.isTop})).map((function(e){return n._buildConversation(e)}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===n&&(n=""),this.get(e,t,n).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.prototype.getUnreadConversationList=function(e){var t=this;return(this._store.getValue()||{}).filter((function(t){return e.includes(t.conversationType)&&t.unreadMessageCount&&t.unreadMessageCount>0})).map((function(e){return t._buildConversation(e)}))},e.prototype._buildConversation=function(e){var t=this.getDraft(e.conversationType,e.targetId,e.channelId);return{channelId:e.channelId,conversationType:e.conversationType,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount||0,latestMessage:null,hasMentioned:e.hasMentioned||!1,mentionedInfo:e.mentionedInfo,notificationStatus:e.notificationStatus||0,notificationLevel:e.notificationLevel||0,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0,draft:t}},e.prototype.setConversationUpdatedTime=function(e){return this._statusManager.setConversationUpdatedTime(e)},e.prototype.getConversationUpdatedTime=function(){return this._statusManager.getVersion()},e.prototype.pushTask=function(e){return this._statusManager.pushTask(e)},e.prototype.stopAllTask=function(){this._statusManager.stopAllTask()},e}(),Ja=function(){function e(e,t){this._localStore=new xa(Ve(e,t))}return e.prototype.set=function(e,t,n,r){var o=this._getStoreKey(e,t,r),i=this._localStore.get(o)||{};for(var s in n){var a=Za[s],u=n[s];if(!gt(a)&&!gt(u))u===Xa[a].defaultVal?delete i[a]:i[a]=u}Et(i)?this._localStore.set(o,i):this._localStore.remove(o)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),o=this._localStore.get(r)||{},i={};for(var s in Xa){var a=Xa[s],u=a.keyName,c=a.defaultVal;i[u]=o[s]||mt(c)}return i},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Xa={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Za={};for(var za in Xa){var $a=Xa[za].keyName;Za[$a]=za}var eu=function(){function e(e,t){this._store=new Ja(e,t)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,o=e.notificationLevel,i=e.channelId;t===exports.ConversationType.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:r,notificationLevel:o},i)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),tu={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},nu=function(){function e(e,t,n){this.logger=e,this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,r=e.type,o=e.isOverwrite,i=e.userId,s=this._getSetUserId(n),a=r===exports.ChatroomEntryType.DELETE,u=s===i,c=!this._isExisted(n),l=a?this._remove:this._add;(t||o||u||c)&&l.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,r=t.isDeleted;return n&&!r},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,r=e.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,r)}))},e.prototype.clear=function(){this._kvCaches={}},e}(),ru=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(r=tu.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return o=a.sent(),i=o.code,s=o.data,this._isPulling=!1,i===exports.ErrorCode.SUCCESS?(tu.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){tu.clear(e);var t=this._storeCaches[e];null==t||t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var r=this._storeCaches[e];Et(r)||(r=new nu(this._engine.getInnerLogger(),e,n)),r.setEntries(t),this._storeCaches[e]=r},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.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}(),ou=function(){function e(e){this._canJoinMulipleChrm=e,this._joinedChrmsInfo={}}return e.prototype.set=function(e,t,n){void 0===t&&(t=10),void 0===n&&(n=""),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]={count:t,extra:n}},e.prototype.get=function(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e]},e.prototype.clear=function(){this._joinedChrmsInfo={}},e}(),iu=function(e){function n(t,n,r,o){var i=e.call(this)||this;return i._tagKey="tags",i._versionKey="version",i._pullQueue=[],i._isPulling=!1,i._pullPromise=null,i._storageKey=He(n,r),i._storage=new xa(i._storageKey),i._engine=t,i._tagWatcherFunc=o,i}return t(n,e),n.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._tagKey,n),this._tagWatcherFunc()},n.prototype.addTag=function(e,t){var n,r=this._storage.get(this._tagKey)||{};e.forEach((function(e){var t,n=(null===(t=r[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;r[e.tagId]={tagName:e.tagName,createdTime:n}})),this._storage.update(((n={})[this._tagKey]=r,n[this._versionKey]=t,n))},n.prototype.deleteTag=function(e,t){var n,r=this._storage.get(this._tagKey)||{};e.forEach((function(e){delete r[e]})),this._storage.update(((n={})[this._tagKey]=r,n[this._versionKey]=t,n))},n.prototype.getTagsInfo=function(){return this._storage.get(this._tagKey)||{}},n.prototype.getTags=function(){var e=this._storage.get(this._tagKey)||{},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)}))},n.prototype.getTagById=function(e){var t=this._storage.get(this._tagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},n.prototype._startPull=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),e=this.getVersion(),this._pullPromise=this._engine.pullUserSettings(e),[4,this._pullPromise]);case 1:return t=u.sent(),n=t.code,r=t.data,this._isPulling=!1,this._pullPromise=null,n!==exports.ErrorCode.SUCCESS||gt(r)||(i=(o=r).settings,s=o.version,a=i.Tag,gt(a)||this._updateTag(a),this._storage.set(this._versionKey,s),this._pullQueue=this._pullQueue.filter((function(e){return e>s}))),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},n.prototype._startCall=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},n.prototype.pullUserSettings=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},n.prototype._triggerPull=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},n.prototype.getVersion=function(){return this._storage.get(this._versionKey)||0},n.prototype.updateVersion=function(e){this._storage.set(this._versionKey,e)},n}(aa),su={};function au(){return{code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,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:an.getMiniCmpUrlList().join(",")}}var uu,cu,lu,pu,du=function(e){function n(t,n,r,o){void 0===o&&(o="default");var i=e.call(this,t,n,r,fr.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),fr.useNavi)||this;return i._environment=o,i}return t(n,e),n.prototype.httpRequest=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return i="".concat(e,"/navi.js?appId=").concat(t,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(Le,"&r=").concat(Date.now(),"&env=").concat(this._environment),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(i),r),[4,fr.httpReq({url:i,timeout:1e4,dataType:"text"})];case 1:if(200!==(s=c.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(s.status),r),!fr.useNavi&&o?[2,rt(au())]:[2,ot(this.transHttpCode(s.status))];try{return 0===(a=s.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'.concat(a,'"'))),(u=JSON.parse(a)).protocol=/^https/.test(i)?"https":"http",u.code&&200!==u.code?[2,ot(this.transHttpCode(u.code))]:(fr.useNavi||(u.server="",u.backupServer=an.getMiniCmpUrlList().join(","),u.logSwitch=0),[2,rt(u)])}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,s.data,r)}return[2,ot(exports.ErrorCode.RC_NAVI_REQ_FAILED)]}}))}))},n.prototype.httpRequestV2=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return i=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:fr.tag,protocol:(/^https/.test(e)?D.WSS:D.WS).toString()}),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(i.url),r),[4,fr.httpReq(i)];case 1:if(200!==(s=l.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(s.status),r),!fr.useNavi&&o?[2,rt(au())]:[2,ot(this.transHttpCode(s.status))];try{return a=s.data,(u="object"!=typeof a?JSON.parse(a):a).protocol=/^https/.test(i.url)?"https":"http",fr.useNavi||(u.logSwitch=0,c=an.getMiniCmpUrlList(),u.serverAddr=c.map((function(e,t){return{addr:e,protocol:/^https/.test(i.url)?D.WSS:D.WS,weight:c.length-t}}))),[2,rt(u)]}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,s.data,r)}return[2,ot(exports.ErrorCode.RC_NAVI_REQ_FAILED)]}}))}))},n.prototype.getNaviCache=function(e){var t=this,n=this.getCatchKey(e);if(su[n])return su[n];var r,o=be(this.appkey),i=fr.localStorage;try{var s=i.getItem(o);r=s?JSON.parse(s):[]}catch(e){r=[]}if(0===r.length)return null;var a=r.find((function(n){return n.token===e&&n.environment===t._environment}))||null;return su[n]=a,a},n.prototype.setNaviCache=function(e,t){var n,r=this,o=be(this.appkey),i=fr.localStorage;try{var s=i.getItem(o);n=s?JSON.parse(s):[]}catch(e){n=[]}var a=Date.now();n.length>0&&(n=n.filter((function(t){return a-t.timestamp<Ae&&(e!==t.token||r._environment!==t.environment)})));var u={timestamp:a,naviInfo:t,token:e,environment:this._environment};n.push(u),i.setItem(o,JSON.stringify(n)),su[this.getCatchKey(e)]=u},n}(Sn),hu=function(){function e(e){this._appkey=e,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]=this._users[e]||{inboxTime:0,outboxTime:0,broadcastSyncTime:0},this._users[e]},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=Fe(this._appkey,t);fr.localStorage.setItem(r,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=Fe(this._appkey,e);t.inboxTime=parseInt(fr.localStorage.getItem(n),10)||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||gt(e))){n.broadcastSyncTime=e;var r=Be(this._appkey,t);fr.localStorage.setItem(r,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=Be(this._appkey,e);t.broadcastSyncTime=parseInt(fr.localStorage.getItem(n),10)||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=Ge(this._appkey,t);fr.localStorage.setItem(r,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=Ge(this._appkey,e);t.outboxTime=parseInt(fr.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),_u=function(){function e(e){this._appkey=e,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=ke(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=fr.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=ke(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,fr.localStorage.setItem(n,JSON.stringify(r))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=ke(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),fr.localStorage.setItem(t,JSON.stringify(n))},e}(),gu=function(){function e(e){var t;this._delayTime=e,this.subscribeData=((t={})[exports.SubscribeType.ONLINE_STATUS]={},t[exports.SubscribeType.USER_PROFILE]={},t),this._ownProfile=null}return e.prototype.clearSubscribeRelation=function(){var e;this.subscribeData=((e={})[exports.SubscribeType.ONLINE_STATUS]={},e[exports.SubscribeType.USER_PROFILE]={},e)},e.prototype.clearSubscribeStatusData=function(e){var t=this;e===exports.SubscribeType.ONLINE_STATUS?Object.keys(this.subscribeData[e]).forEach((function(n){t.subscribeData[e][n].statusMap={}})):e===exports.SubscribeType.USER_PROFILE&&Object.keys(this.subscribeData[e]).forEach((function(n){t.subscribeData[e][n].profile=void 0}))},e.prototype.getSubscribeUserData=function(e,t){var n=this.subscribeData[e][t];return n?Ee({},n):void 0},e.prototype.removeSubscribeUserData=function(e,t){delete this.subscribeData[e][t]},e.prototype.updateSubscribeUserData=function(e,t,n){this.subscribeData[e][t]=n},e.prototype.clearExpiredData=function(e){for(var t in this.subscribeData[e]){var n=this.subscribeData[e][t];n.expiry<(Date.now()+this._delayTime-n.subscribeTime)/1e3&&delete this.subscribeData[e][t]}},e.prototype.getSubscribeUserList=function(e,t,n){return ye([],ve(Object.values(this.subscribeData[e])),!1).sort((function(e,t){return e.subscribeTime-t.subscribeTime})).slice(n,n+t)},e.prototype.updateOwnProfile=function(e){this._ownProfile=Ee(Ee({},e),{extraProfile:Ee({},e.extraProfile)})},e.prototype.getOwnProfile=function(){return this._ownProfile?Ee(Ee({},this._ownProfile),{extraProfile:Ee({},this._ownProfile.extraProfile)}):null},e}(),fu=function(){function e(e){this._delayTime=e,this._relationshipStatusVersion=0,this._subUserStatusVersion=0,this._ownProfileVersion=0,this._subStore=new gu(e)}return e.prototype.updateRelationshipStatusVersion=function(e){e>this._relationshipStatusVersion&&(this._relationshipStatusVersion=e)},e.prototype.getRelationshipStatusVersion=function(){return this._relationshipStatusVersion},e.prototype.updateSubscribeUserStatusVersion=function(e){e>this._subUserStatusVersion&&(this._subUserStatusVersion=e)},e.prototype.getSubscribeUserStatusVersion=function(){return this._subUserStatusVersion},e.prototype._filterSubscribeRelationData=function(e){return e.reduce((function(e,t){return t.subUsers.forEach((function(n){var r=e.find((function(e){return e.subscribeType===t.subType&&e.userId===n.subUserId}));r?r.subscribeTime<t.subTime&&(r.expiry=t.expiry,r.operationType=t.opType,r.subscribeTime=t.subTime):e.push({userId:n.subUserId,subscribeTime:t.subTime,subscribeType:t.subType,expiry:t.expiry,operationType:t.opType})})),e}),[])},e.prototype.updateSubscribeRelation=function(e,t){var n=this;void 0===t&&(t=!1);var r=[],o=[],i=[];return t&&this._subStore.clearSubscribeRelation(),this._filterSubscribeRelationData(e).forEach((function(e){var t,s,a=e.userId,u=e.subscribeTime,c=e.subscribeType,l=e.expiry;if(e.operationType===exports.SubscribeOperationType.UNSUBSCRIBE)return n._subStore.removeSubscribeUserData(c,a),void i.push(e);var p=n._subStore.getSubscribeUserData(c,a);if(!(p&&p.subscribeTime>=u)){if(c===exports.SubscribeType.ONLINE_STATUS){r.push(a);var d=(null===(t=p)||void 0===t?void 0:t.statusMap)||{};n._subStore.updateSubscribeUserData(c,a,{subscribeTime:u,expiry:l,userId:a,subscribeType:c,statusMap:d})}else{o.push(a);var h=null===(s=p)||void 0===s?void 0:s.profile;n._subStore.updateSubscribeUserData(c,a,{subscribeTime:u,expiry:l,userId:a,subscribeType:c,profile:h,isSubscribed:!0})}i.push(e)}})),{newSubscribeOnlineStatusList:r,newSubscribeUserProfileList:o,subscribeUserChangeList:i}},e.prototype.clearSubscribeStatus=function(){this._subStore.clearSubscribeStatusData(exports.SubscribeType.ONLINE_STATUS),this._subStore.clearSubscribeStatusData(exports.SubscribeType.USER_PROFILE)},e.prototype.updateSubscribeUserOnlineStatus=function(e){var t=this,n=[];return e.forEach((function(e){var r=e.subUserId,o=e.data,i=t._subStore.getSubscribeUserData(exports.SubscribeType.ONLINE_STATUS,r);if(i){var s=[],a=Ee({},i.statusMap);o.forEach((function(e){var t=a[e.platformInfo];if(!(t&&t.changeTime>e.versionTime)){var n={eventValue:e.value,changeTime:e.versionTime};a[e.platformInfo]=n,s.push(Ee(Ee({},n),{platform:e.platformInfo}))}})),t._subStore.updateSubscribeUserData(exports.SubscribeType.ONLINE_STATUS,r,{subscribeTime:i.subscribeTime,expiry:i.expiry,userId:r,subscribeType:exports.SubscribeType.ONLINE_STATUS,statusMap:a}),n.push({userId:r,subscribeType:exports.SubscribeType.ONLINE_STATUS,subscribeTime:i.subscribeTime,expiry:i.expiry,details:s})}})),n},e.prototype.updateSubscribeUserProfile=function(e){var t=this,n=[];return e.forEach((function(e){var r=e.userId,o=e.version,i=e.userProfile,s=e.userExtProfile,a=t._subStore.getSubscribeUserData(exports.SubscribeType.USER_PROFILE,r),u=Ut(r,i,s);a?a.profile&&a.profile.version>=o||(t._subStore.updateSubscribeUserData(exports.SubscribeType.USER_PROFILE,r,{subscribeTime:a.subscribeTime,expiry:a.expiry,userId:r,subscribeType:exports.SubscribeType.USER_PROFILE,profile:{info:u,version:o},isSubscribed:a.isSubscribed}),a.isSubscribed&&n.push({userId:r,subscribeType:exports.SubscribeType.USER_PROFILE,subscribeTime:a.subscribeTime,expiry:a.expiry,userProfile:Ee({},u)})):t._subStore.updateSubscribeUserData(exports.SubscribeType.USER_PROFILE,r,{subscribeTime:0,expiry:0,userId:r,subscribeType:exports.SubscribeType.USER_PROFILE,profile:{info:u,version:o},isSubscribed:!1})})),n},e.prototype.getSubscribeUserStatus=function(e,t){var n=this,r=[];return t.forEach((function(t){var o=n._subStore.getSubscribeUserData(e,t);if(!o||o.expiry<(Date.now()+n._delayTime-o.subscribeTime)/1e3)n._subStore.removeSubscribeUserData(e,t);else{var i={subscribeTime:o.subscribeTime,expiry:o.expiry,userId:o.userId,subscribeType:o.subscribeType};if(e===exports.SubscribeType.ONLINE_STATUS){var s=o.statusMap,a=Object.keys(s).map((function(e){return Ee({platform:~~e},s[~~e])}));i.details=Lt(a)}else if(e===exports.SubscribeType.USER_PROFILE&&!o.isSubscribed)return;r.push(i)}})),r},e.prototype.getUserProfiles=function(e){var t=this,n=[],r=[];return e.forEach((function(e){var o=t._subStore.getSubscribeUserData(exports.SubscribeType.USER_PROFILE,e);if(o&&o.profile){var i=o.profile,s=i.version,a=i.info;if(o.isSubscribed)return t._delayTime+Date.now()-s>6048e5?void r.push(e):void n.push(Ee(Ee({},a),{extraProfile:Ee({},a.extraProfile)}));t._delayTime+Date.now()-s>6e5?r.push(e):n.push(Ee(Ee({},a),{extraProfile:Ee({},a.extraProfile)}))}else r.push(e)})),{list:n,needQueryUserIds:r}},e.prototype.getSubscribeUserList=function(e,t,n){return this._subStore.clearExpiredData(e),this._subStore.getSubscribeUserList(e,t,n).map((function(t){var n={subscribeTime:t.subscribeTime,expiry:t.expiry,userId:t.userId,subscribeType:t.subscribeType};if(e===exports.SubscribeType.ONLINE_STATUS){var r=Object.keys(t.statusMap).map((function(e){return Ee({platform:~~e},t.statusMap[~~e])}));n.details=Lt(r)}return n}))},e.prototype.updateOwnProfile=function(e,t){this._ownProfileVersion>t||this._subStore.updateOwnProfile(e)},e.prototype.getOwnProfile=function(){return this._subStore.getOwnProfile()},e}(),Eu=function(){function e(e,t,n,r,o,i,s){this._connectManager=e,this._event=t,this._currentUserId=n,this._delayTime=r,this._logger=o,this._isOpenUserProfile=i,this._subDriven=s,this._isPullingRelationship=!1,this._pullRelationshipQueue=[],this._pullRelationshipFailTime=0,this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue=[],this._pullSubUserStatusFailTime=0,this._subscribeService=new fu(r)}return e.prototype.syncData=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){switch(e.label){case 0:return this._subDriven?[4,this._syncSubscribeRelationship(!1)]:[3,3];case 1:return e.sent(),[4,this._syncSubscribeUserStatus(!0)];case 2:e.sent(),e.label=3;case 3:return this._isOpenUserProfile?[4,this.syncOwnProfile()]:[3,5];case 4:e.sent(),e.label=5;case 5:return 1&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.ONLINE_STATUS),2&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.USER_PROFILE),3&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.FRIEND_ONLINE_STATUS),4&this._subDriven&&this._event.syncSubscribeUserStatusFinished(exports.SubscribeType.FRIEND_USER_PROFILE),[2]}}))}))},e.prototype.startSyncSubscribeRelationship=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this._pullRelationshipQueue.push(e),this._syncSubscribeRelationship(),[2]}))}))},e.prototype._syncSubscribeRelationship=function(e){return void 0===e&&(e=!0),Te(this,void 0,void 0,(function(){return Ce(this,(function(t){switch(t.label){case 0:return this._isPullingRelationship?[2]:(this._isPullingRelationship=!0,[4,this._pullSubscribeRelationship(e)]);case 1:return t.sent(),this._isPullingRelationship=!1,this._pullRelationshipQueue.length>0?(this._pullRelationshipQueue.length=0,[4,this._syncSubscribeRelationship(e)]):[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},e.prototype._pullSubscribeRelationship=function(e,t){return void 0===t&&(t=""),Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c,l,p,d,h,_,g,f;return Ce(this,(function(E){switch(E.label){case 0:return n=this._subscribeService.getRelationshipStatusVersion(),r=this._logger.createTraceId(),this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:n,_pageToken:t}),r),o=this._connectManager.codec.encodePullUserSubReq({version:n,pageToken:t}),i=new zs(os.pullUserSub,o,this._currentUserId),[4,this._connectManager.send(i,ni)];case 1:return s=E.sent(),a=s.code,u=s.data,a===exports.ErrorCode.SUCCESS&&u?(this._pullRelationshipFailTime=0,c=u.list,l=u.version,p=u.hasNext,d=u.pageToken,l=vt(l),c.forEach((function(e){e.subTime=vt(e.subTime)})),this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:a,data:u}),r),e?(h=this._subscribeService.updateSubscribeRelation(c),_=h.newSubscribeOnlineStatusList,g=h.newSubscribeUserProfileList,f=h.subscribeUserChangeList,this._event.subscribeRelationChanged(f),_.length>0&&this._queryAndUpdateUserOnlineStatus(_),g.length>0&&this._queryAndUpdateUserProfile(g)):this._subscribeService.updateSubscribeRelation(c,!t),this._subscribeService.updateRelationshipStatusVersion(l),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((function(e){return e>l})),p?[4,this._pullSubscribeRelationship(e,d)]:[3,3]):(this._logger.error(exports.LogTagId.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:a,failTime:this._pullRelationshipFailTime}),r),this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?(this._pullRelationshipFailTime=0,[2]):[2,this._pullSubscribeRelationship(e,t)]);case 2:E.sent(),E.label=3;case 3:return[2]}}))}))},e.prototype.startsyncSubscribeUserStatus=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this._pullSubUserStatusQueue.push(e),this._syncSubscribeUserStatus(),[2]}))}))},e.prototype._syncSubscribeUserStatus=function(e){return void 0===e&&(e=!1),Te(this,void 0,void 0,(function(){return Ce(this,(function(t){switch(t.label){case 0:return this._isPullingSubUserStatus?[2]:(this._isPullingSubUserStatus=!0,[4,this._pullSubscribeUserStatus(e)]);case 1:return t.sent(),this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue.length>0?(this._pullSubUserStatusQueue.length=0,[4,this._syncSubscribeUserStatus(e)]):[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},e.prototype._pullSubscribeUserStatus=function(e,t){return void 0===e&&(e=!1),void 0===t&&(t=""),Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c,l,p,d,h,_,g;return Ce(this,(function(f){switch(f.label){case 0:return n=this._subscribeService.getSubscribeUserStatusVersion(),r=this._logger.createTraceId(),this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:n,_pageToken:t,needAllData:e}),r),o=this._connectManager.codec.encodePullSubDataReq({version:n,needAllData:e,pageToken:t}),i=new zs(os.pullSubData,o,this._currentUserId),[4,this._connectManager.send(i,oi)];case 1:return s=f.sent(),a=s.code,u=s.data,a===exports.ErrorCode.SUCCESS&&u?(this._pullSubUserStatusFailTime=0,c=u.list,l=u.versionTime,p=u.hasNext,d=u.pageToken,h=u.isFull,l=vt(l),this._logger.info(exports.LogTagId.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,data:u}),r),c.forEach((function(e){e.data.forEach((function(e){e.versionTime=vt(e.versionTime)}))})),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((function(e){return e>l})),this._subscribeService.updateSubscribeUserStatusVersion(l),_=[],g=[],c.forEach((function(e){e.subType===exports.SubscribeType.ONLINE_STATUS?_.push(e):e.subType===exports.SubscribeType.USER_PROFILE&&g.push(e.subUserId)})),h&&""===t&&this._subscribeService.clearSubscribeStatus(),_.length>0&&this._updateUserOnlineStatus(_,!h),g.length>0?[4,this._queryAndUpdateUserProfile(g,!h)]:[3,3]):(this._logger.warn(exports.LogTagId.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,failTime:this._pullSubUserStatusFailTime}),r),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?(this._pullSubUserStatusFailTime=0,[2]):[2,this._pullSubscribeUserStatus(e,t)]);case 2:f.sent(),f.label=3;case 3:return p?[4,this._pullSubscribeUserStatus(e,d)]:[3,5];case 4:f.sent(),f.label=5;case 5:return[2]}}))}))},e.prototype._queryAndUpdateUserOnlineStatus=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return t=this._logger.createTraceId(),this._logger.info(exports.LogTagId.L_QUERY_SUBSCRIBE_DATA_T,JSON.stringify(e),t),n=this._connectManager.codec.encodeQrySubDataReq(exports.SubscribeType.ONLINE_STATUS,e),r=new zs(os.qrySubData,n,this._currentUserId),[4,this._connectManager.send(r,oi)];case 1:return o=a.sent(),i=o.code,s=o.data,this._logger.info(exports.LogTagId.L_QUERY_SUBSCRIBE_DATA_R,JSON.stringify({code:i,data:s}),t),i===exports.ErrorCode.SUCCESS&&s?(this._updateUserOnlineStatus(s.list),[2]):[2]}}))}))},e.prototype._updateUserOnlineStatus=function(e,t){void 0===t&&(t=!0),e.forEach((function(e){e.data.forEach((function(e){e.versionTime=vt(e.versionTime)}))}));var n=this._subscribeService.updateSubscribeUserOnlineStatus(e);n=n.filter((function(e){return e.details&&e.details.length>0})),t&&n.length>0&&this._event.subscribeUserStatusChanged(n)},e.prototype._queryAndUpdateUserProfile=function(e,t){return void 0===t&&(t=!0),Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return n=this._logger.createTraceId(),this._logger.info(exports.LogTagId.L_PULL_USER_PROFILE_T,JSON.stringify(e),n),r=this._connectManager.codec.encodePullUserProfileReq(e),o=new zs(os.pullUserProfile,r,this._currentUserId),[4,this._connectManager.send(o,pi)];case 1:return i=c.sent(),s=i.code,a=i.data,this._logger.info(exports.LogTagId.L_PULL_USER_PROFILE_R,JSON.stringify({code:s,data:a}),n),s===exports.ErrorCode.SUCCESS&&a?(a.UserProfile.forEach((function(e){e.version=vt(e.version)})),u=this._subscribeService.updateSubscribeUserProfile(a.UserProfile),t&&u.length>0&&this._event.subscribeUserStatusChanged(u),[2,{code:s,data:a.UserProfile}]):[2,{code:s}]}}))}))},e.prototype.updateUserStatus=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return(t=this._connectManager.codec.decodeByPBName(e.pbData,ii)).subType!==exports.SubscribeType.ONLINE_STATUS?[3,1]:(this._updateUserOnlineStatus([t]),[3,5]);case 1:return t.subType!==exports.SubscribeType.USER_PROFILE?[3,2]:(this._queryAndUpdateUserProfile([t.subUserId]),[3,5]);case 2:return t.subType!==exports.SubscribeType.FRIEND_ONLINE_STATUS?[3,3]:(n=t.data.map((function(e){return{changeTime:vt(e.versionTime),eventValue:e.value,platform:e.platformInfo}})),this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,details:n}]),[3,5]);case 3:return t.subType!==exports.SubscribeType.FRIEND_USER_PROFILE?[3,5]:[4,this._queryAndUpdateUserProfile([t.subUserId])];case 4:r=i.sent(),(o=r.data)&&this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,userProfile:Ut(t.subUserId,o[0].userProfile,o[0].userExtProfile)}]),i.label=5;case 5:return[2]}}))}))},e.prototype.getSubscribeUserStatus=function(e,t){return this._subscribeService.getSubscribeUserStatus(e,t)},e.prototype.getSubscribeUserList=function(e,t,n){return this._subscribeService.getSubscribeUserList(e,t,n)},e.prototype.updateSubscribeRelation=function(e,t,n,r){return void 0===r&&(r=0),Te(this,void 0,void 0,(function(){var o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return o=this._connectManager.codec.encodeUpdateUserSubReq(t,e,n,r),i=new zs(os.updUserSub,o,this._currentUserId),[4,this._connectManager.send(i,ei)];case 1:return s=l.sent(),a=s.code,u=s.data,a===exports.ErrorCode.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT&&u?[2,{code:a,data:u.subUsers.map((function(e){return e.subUserId}))}]:a===exports.ErrorCode.SUCCESS&&u?(c=u.subTime,this._subscribeService.updateSubscribeRelation([{subType:t,subTime:c,expiry:r,opType:n,subUsers:e.map((function(e){return{subUserId:e}}))}]),n===exports.SubscribeOperationType.SUBSCRIBE&&(t===exports.SubscribeType.ONLINE_STATUS?this._queryAndUpdateUserOnlineStatus(e):t===exports.SubscribeType.USER_PROFILE&&this._queryAndUpdateUserProfile(e,!1)),[2,{code:a}]):[2,{code:a}]}}))}))},e.prototype.getUserProfiles=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this._subscribeService.getUserProfiles(e),n=t.needQueryUserIds,r=t.list,0===n.length?[2,Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})]:[4,this._queryAndUpdateUserProfile(n,!1)];case 1:return o=u.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&s?(a=s.map((function(e){return Ut(e.userId,e.userProfile,e.userExtProfile)})),[2,{code:i,data:ye(ye([],ve(r),!1),ve(a),!1)}]):[2,{code:i,data:ye([],ve(r),!1)}]}}))}))},e.prototype.syncOwnProfile=function(e){return void 0===e&&(e=!1),Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l,p,d;return Ce(this,(function(h){switch(h.label){case 0:return this._isOpenUserProfile?(t=this._logger.createTraceId(),this._logger.info(exports.LogTagId.L_PULL_OWN_PROFILE_T,"",t),n=this._connectManager.codec.encodeUserProfileInput(),r=new zs(os.pullOwnProfile,n,this._currentUserId),[4,this._connectManager.send(r,ai)]):[2,Promise.resolve({code:exports.ErrorCode.RC_USER_PROFILE_SERVICE_UNAVAILABLE})];case 1:return o=h.sent(),i=o.code,s=o.data,this._logger.info(exports.LogTagId.L_PULL_OWN_PROFILE_R,JSON.stringify({code:i,data:s}),t),i===exports.ErrorCode.SUCCESS&&s?(a=s.userExtProfile,u=s.userProfile,c=s.version,l=s.userId,p=vt(c),d=Ut(l,u,a),this._subscribeService.updateOwnProfile(d,p),e&&this._event.ownUserProfileChanged(d),[2,{code:i,data:d}]):[2,{code:i}]}}))}))},e.prototype.getOwnProfile=function(){return Te(this,void 0,void 0,(function(){var e;return Ce(this,(function(t){return(e=this._subscribeService.getOwnProfile())?[2,{code:exports.ErrorCode.SUCCESS,data:e}]:[2,this.syncOwnProfile()]}))}))},e.prototype.updateOwnProfile=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return this._subscribeService.updateOwnProfile(e,t),[2]}))}))},e}(),Iu=function(){function e(e,t,n){this._storage=new xa(Ke(e,t)),this._delayTime=n,this.clear()}return e.prototype._getConversationKey=function(e){return"".concat(e.targetId,"_").concat(e.channelId)},e.prototype._removeExcessData=function(e){var t,n,r=Object.keys(e).map((function(t){return{key:t,value:e[t]}})).sort((function(e,t){return e.value.t-t.value.t})).slice(-30),o={};try{for(var i=Re(r),s=i.next();!s.done;s=i.next()){var a=s.value;o[a.key]=a.value}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},e.prototype.insert=function(e,t,n,r,o){var i;if(!(r<Date.now()-this._delayTime-Pe)){var s=this._getConversationKey(e),a=this._storage.get(s)||{};if(!a[t]){var u={t:r,d:n};o&&(u.sId=o);var c=Ee(Ee({},a),((i={})[t]=u,i));Object.keys(c).length>30&&(c=this._removeExcessData(c)),this._storage.set(s,c)}}},e.prototype.addReadedUser=function(e,t,n){var r,o=this._getConversationKey(e),i=this._storage.get(o)||{},s=i[t];if(s){if(s.us){if(s.us.includes(n))return}else s.us=[];s.us.push(n),this._storage.set(o,Ee(Ee({},i),((r={})[t]=s,r)))}},e.prototype.getReadReceiptInfo=function(e,t){var n=this._getConversationKey(e),r=(this._storage.get(n)||{})[t];return r?{time:r.t,direction:r.d,users:r.us||[],senderId:r.sId}:null},e.prototype.getReceiptMessageDic=function(e){var t=this._getConversationKey(e),n=this._storage.get(t)||{},r={};for(var o in n){var i=n[o];i.d===exports.MessageDirection.RECEIVE&&(r[i.sId]||(r[i.sId]=[]),r[i.sId].push(o))}return r},e.prototype.remove=function(e,t){var n=this._getConversationKey(e),r=this._storage.get(n)||{};r[t]&&(delete r[t],0===Object.keys(r).length?this._storage.remove(n):this._storage.set(n,r))},e.prototype.clear=function(){var e=this._storage.getValues(),t={};for(var n in e){var r=e[n],o={};for(var i in r){var s=r[i];Date.now()-this._delayTime-s.t<Pe&&(o[i]=s)}Object.keys(o).length&&(t[n]=o)}this._storage.update(t)},e}(),Tu=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.appkey=t,r.logger=n,r._storageKey="",r._storageKey=qe(t),r}return t(n,e),n.prototype.getCache=function(){return fr.localStorage.getItem(this._storageKey)},n.prototype.setCache=function(e){fr.localStorage.setItem(this._storageKey,e)},n.prototype.clearCache=function(){fr.localStorage.removeItem(this._storageKey)},n.prototype.sendRequest=function(e){return Te(this,void 0,void 0,(function(){var t,n,r;return Ce(this,(function(o){switch(o.label){case 0:return[4,fr.httpReq({url:e})];case 1:return t=o.sent(),n=t.status,r=t.data,[2,{code:n,data:r}]}}))}))},n.prototype.decryptData=function(e){return Te(this,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,Jt(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91")];case 1:return t=r.sent(),[2,JSON.parse(t)];case 2:return n=r.sent(),this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},n}(un),Cu=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._pullQueue=[],t._isPulling=!1,t}return t(n,e),n.prototype.startPull=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isPulling?[2]:(this._isPulling=!0,[4,this.pullQueueConsumption()]);case 1:return e=a.sent(),t=e.code,n=e.data,this._isPulling=!1,r=n&&n.hasNext||!1,t!==exports.ErrorCode.SUCCESS||gt(n)||(this.pullDataHandler(n),o=this.getVersion(),i=this._pullQueue.filter((function(e){return e>o})),this._pullQueue.length=0,(s=this._pullQueue).push.apply(s,ye([],ve(i),!1))),r?(this.startPull(),[2]):(this._pullQueue.length>0&&(this._pullQueue.length=0,this.startPull()),[2])}}))}))},n.prototype._triggerPull=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this.startPull()];case 1:return t.sent(),[2]}}))}))},n}(aa),Ru=function(e){function n(t,n,r,o,i){var s=e.call(this)||this;return s._connectManager=t,s._currentUserId=n,s._logger=r,s._appkey=o,s._callBack=i,s._lastPullingChangeMessageTime=0,s._lastPullingChangeMessageTimeLocal=(new Date).getTime(),s._duration=18e4,s._pullEventChangeIntervalTimer=-1,s._localStorageKey=Qe(o,n),s._storage=new xa(s._localStorageKey),s._lastPullingChangeMessageTime=s._storage.get(n)||0,s}return t(n,e),Object.defineProperty(n.prototype,"_isConnected",{get:function(){return this._connectManager.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED},enumerable:!1,configurable:!0}),n.prototype._setLastPullingChangeMessageTime=function(e){this._lastPullingChangeMessageTime=e,this._storage.set(this._currentUserId,e)},n.prototype._startPullEventChangeInterval=function(){var e=this,t=function(){e._pullEventChangeIntervalTimer=setTimeout((function(){var n=Date.now();n-e._lastPullingChangeMessageTimeLocal>=e._duration&&(e.startPullEventChange(e._lastPullingChangeMessageTime,!0),e._lastPullingChangeMessageTimeLocal=n),e._stopUltraSyncInterval(),t()}),3e4)};t()},n.prototype._stopUltraSyncInterval=function(){-1!==this._pullEventChangeIntervalTimer&&(clearTimeout(this._pullEventChangeIntervalTimer),this._pullEventChangeIntervalTimer=-1)},n.prototype.startPullEventChange=function(e,t){void 0===t&&(t=!1);var n=this.getVersion();(e>n||0===e||t)&&this._triggerPull(n)},n.prototype.pullQueueConsumption=function(){if(!this._isConnected)return Promise.resolve({code:exports.ErrorCode.CONNECTION_TIMEOUT});this._logger.info(exports.LogTagId.L_PULL_EVENT_CHANGE_T,"PullEventChange time: ".concat(this._lastPullingChangeMessageTime));var e=this._connectManager.codec.encodeQueryMsgChange(this._lastPullingChangeMessageTime),t=new zs(os.pullEventChange,e,this._currentUserId);return t.setHeaderQos(cs.AT_LEAST_ONCE),this._connectManager.send(t,wo)},n.prototype.pullDataHandler=function(e){this._logger.info(exports.LogTagId.L_PULL_EVENT_CHANGE_R,"PullEventChange data: ".concat(JSON.stringify(e)));var t=e.list,n=(null==e?void 0:e.syncTime)||0;this._callBack(t),this._setLastPullingChangeMessageTime(n)},n.prototype.getVersion=function(){return this._lastPullingChangeMessageTime||0},n.prototype.notificationOnline=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return this._isConnected?(this.startPullEventChange(this._lastPullingChangeMessageTime,!0),this._startPullEventChangeInterval(),this._logger.info(exports.LogTagId.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S,"PullEventChange notify online"),[2]):[2]}))}))},n}(Cu);!function(e){e[e.ACCEPTED=0]="ACCEPTED",e[e.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",e[e.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",e[e.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",e[e.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",e[e.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",e[e.REDIRECT=6]="REDIRECT",e[e.PACKAGE_ERROR=7]="PACKAGE_ERROR",e[e.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",e[e.BLOCK=9]="BLOCK",e[e.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",e[e.DEVICE_ERROR=11]="DEVICE_ERROR",e[e.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",e[e.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",e[e.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",e[e.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",e[e.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",e[e.OTP_USED=17]="OTP_USED",e[e.PLATFORM_ERROR=18]="PLATFORM_ERROR",e[e.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",e[e.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(uu||(uu={})),function(e){e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW",e[e.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",e[e.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",e[e.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(cu||(cu={}));var vu,yu,Su=((lu={})[cu.OTHER_DEVICE_LOGIN]=exports.ErrorCode.RC_DISCONN_KICK,lu[cu.BLOCK]=exports.ErrorCode.RC_DISCONN_EXCEPTION,lu[cu.BLOCK_NEW]=exports.ErrorCode.RC_DISCONN_EXCEPTION,lu[cu.REDIRECT_NEW]=exports.ErrorCode.RC_CONN_REDIRECTED,lu[cu.TOKEN_EXPIRED]=exports.ErrorCode.RC_CONN_TOKEN_EXPIRED,lu[cu.ILLEGAL_PROTOCOL_VERSION]=exports.ErrorCode.RC_CONN_PROTO_VERSION_ERROR,lu[cu.ACCOUNT_CANCELLATION]=exports.ErrorCode.RC_ACCOUNT_CANCELLATION,lu),mu=((pu={})[uu.ACCEPTED]=exports.ErrorCode.SUCCESS,pu[uu.UNACCEPTABLE_PROTOCOL_VERSION]=exports.ErrorCode.RC_CONN_PROTO_VERSION_ERROR,pu[uu.IDENTIFIER_REJECTED]=exports.ErrorCode.RC_CONN_IDENTIFIER_REJECTED,pu[uu.SERVER_UNAVAILABLE]=exports.ErrorCode.RC_CONN_SERVER_UNAVAILABLE,pu[uu.TOKEN_INCORRECT]=exports.ErrorCode.RC_CONN_TOKEN_INCORRECT,pu[uu.NOT_AUTHORIZED]=exports.ErrorCode.RC_CONN_NOT_AUTHRORIZED,pu[uu.REDIRECT]=exports.ErrorCode.RC_CONN_REDIRECTED,pu[uu.PACKAGE_ERROR]=exports.ErrorCode.RC_CONN_PACKAGE_NAME_INVALID,pu[uu.APP_BLOCK_OR_DELETE]=exports.ErrorCode.RC_CONN_APP_BLOCKED_OR_DELETED,pu[uu.BLOCK]=exports.ErrorCode.RC_CONN_USER_BLOCKED,pu[uu.TOKEN_EXPIRE]=exports.ErrorCode.RC_CONN_TOKEN_EXPIRED,pu[uu.DEVICE_ERROR]=exports.ErrorCode.RC_CONN_DEVICE_ERROR,pu[uu.HOSTNAME_ERROR]=exports.ErrorCode.RC_CONN_HOSTNAME_ERROR,pu[uu.HASOHTERSAMECLIENTONLINE]=exports.ErrorCode.RC_DISCONN_SAME_CLIENT_ON_LINE,pu[uu.OUT_OF_LIMIT]=exports.ErrorCode.RC_LISCENSE_COUNT_OUT_OF_LIMIT,pu[uu.IN_OTHER_CLUSTER]=exports.ErrorCode.RC_CONN_WRONG_CLUSTER,pu[uu.APP_AUTH_NOT_PASS]=exports.ErrorCode.RC_APP_AUTH_NOT_PASS,pu[uu.OTP_USED]=exports.ErrorCode.RC_OTP_USED,pu[uu.PLATFORM_ERROR]=exports.ErrorCode.RC_PLATFORM_ERROR,pu[uu.ACCOUNT_CANCELLATION]=exports.ErrorCode.RC_ACCOUNT_CANCELLATION,pu[uu.LICENSE_EXPIRED]=exports.ErrorCode.RC_LICENSE_EXPIRED,pu),Au=function(e){return[os.ppMsgS,os.pgMsgS,os.chatMsgS].includes(ds(e))},Nu=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};function Ou(e){return Object.keys(e).map((function(t){var n=e[t];return"string"!=typeof n&&(n="".concat(n)),{key:t,value:n}}))}function Mu(e,t,n,r){return Ji.encode(gi,{targetId:e,type:exports.ConversationType.GROUP,users:r,extProfile:n?Ou(n):void 0,settingProfile:Ou(t)})}var Lu,Uu=((vu={})[hs(os.ppMsgP)]=exports.ConversationType.PRIVATE,vu[hs(os.pgMsgP)]=exports.ConversationType.GROUP,vu[hs(os.chatMsg)]=exports.ConversationType.CHATROOM,vu[hs(os.pcMsgP)]=exports.ConversationType.CUSTOMER_SERVICE,vu[hs(os.pbMsgP)]=exports.ConversationType.SYSTEM,vu),Pu="1",bu="0",xu=1,Du=2,wu=3,Vu={1:"ChannelsUserInfos",2:"ChannelsInviteStatusInfos",3:"ChannelsJoinedInfos",11:"FriendUserInfos",12:"FriendInviteInfos"},Gu=((yu={})[S.GROUP_OPERATION]=function(e){return"ChannelEventData"},yu[S.GROUP_PROFILE_CHANGE]=function(e){return"ChannelEventData"},yu[S.GROUP_APPLICATION_INVITATION]=function(e){return"ChannelApplyInfo"},yu[l.FRIEND_APPLICATION]=function(e){return{0:"FriendApplyEvent",1:"FriendApplyEvent",2:"FriendUserInfo",3:"FriendsInput",5:"FriendTypeChangeEvent",6:"FriendUpdateEvent"}[e]},yu),Fu=function(){function e(e){this.logger=e}return e.prototype.decodeByPBName=function(e,t,n){var r,o=this,i=e,s=((r={})[Or]=o._formatSyncMessages,r[Mr]=o._formatReceivedMessage,r[Ar]=o._formatSentMessage,r[Wr]=o._formatHistoryMessages,r[Fr]=o._formatConversationList,r[Kr]=o._formatChatRoomInfos,r[so]=o._formatChatRoomKVList,r[po]=o._formatUserSetting,r[_o]=o._formatConversationStatus,r[mo]=o._formatGrpReadReceiptQryResp,r[Jo]=o._formatQueryReceiptResp,r[co]=o._formatSetUserSettingOutput,r[Lo]=o._formatUserSettingNotification,r[wo]=o._formatEventChangeList,r[Vo]=o._formatUltraMsgChangeList,r[ko]=o._formatUltraOperateStatusNotifyList,r[Fo]=o._formatUltraMsgList,r[kr]=o._formatUltraGroupUnreadMentionedList,r[Dr]=o._formatChrmKVVersion,r[Qo]=o._formatCallKVInfo,r[Yo]=o._fromatCallInfoDownStream,r[Xr]=o._formateSessionMsgReadInput,r[vi]=o._formateChannelsListResult,r)[t];try{i=e.length>0&&Ji.decode(t,e),_t(s)&&(i=s.call(this,i,n))}catch(e){this.logger.error(exports.LogTagId.L_PB_DECODE_E,t)}return i},e.prototype._readBytes=function(e){var t,n=e.offset,r=e.buffer,o=e.limit;if(n)try{var i=(t=r,"[object ArrayBuffer]"===Object.prototype.toString.call(t)?new Uint8Array(r):r);return Gs.readUTF(i.subarray(n,o))}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=t?JSON.parse(t):t}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,o=e.syncTime,i=e.finished;return(gt(i)||null===i)&&(e.finished=!0),e.syncTime=vt(o),e.list=St(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._getUtfContent=function(e){if(e.user){var t=e.user,n=t.portrait,r=t.portraitUri,o=n||r;o&&(e.user.portrait=e.user.portraitUri=o)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return yt(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,r=e.pushExt,o=e.configFlag,i={};return r&&(i=function(e,t,n){var r={},o={notificationId:n||""},i={};if(!t)return{iOSConfig:r,androidConfig:o,harmonyOSConfig:i};try{var s=JSON.parse(t);null==s||s.forEach((function(e){var t,n,s,a,u,c,l,p,d,h,_,g,f=Object.keys(e);if(0!==f.length){var E=f[0];switch(E){case"HW":return o.channelIdHW=null===(t=e[E])||void 0===t?void 0:t.channelId,o.importanceHW=null===(n=e[E])||void 0===n?void 0:n.importance,o.imageUrlHW=null===(s=e[E])||void 0===s?void 0:s.image,void(o.categoryHW=null===(a=e[E])||void 0===a?void 0:a.category);case"MI":return void(o.channelIdMi=null===(u=e[E])||void 0===u?void 0:u.channelId);case"OPPO":return void(o.channelIdOPPO=null===(c=e[E])||void 0===c?void 0:c.channelId);case"VIVO":return o.typeVivo=null===(l=e[E])||void 0===l?void 0:l.classification,void(o.categoryVivo=null===(p=e[E])||void 0===p?void 0:p.category);case"APNS":return r.threadId=e[E]["thread-id"],r.apnsCollapseId=e[E]["apns-collapse-id"],r.category=e[E].category,r.richMediaUri=e[E].richMediaUri,void(r.interruptionLevel=e[E]["interruption-level"]);case"FCM":return void(o.googleConfig={collapseKey:e[E].collapse_key||"",imageUrl:e[E].imageUrl||"",priority:e[E].priority||""});case"HONOR":return o.importanceHonor=null===(d=e[E])||void 0===d?void 0:d.importance,void(o.imageUrlHonor=null===(h=e[E])||void 0===h?void 0:h.image);case"OHOS":i.category=null===(_=e[E])||void 0===_?void 0:_.category,i.image=null===(g=e[E])||void 0===g?void 0:g.image}}}))}catch(n){e.error(exports.LogTagId.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:r,androidConfig:o,harmonyOSConfig:i}}(t,r.pushConfigs,r.pushId)),Ee(Ee({},i),{pushTitle:null==r?void 0:r.title,pushContent:n,pushData:"",disablePushTitle:!!o&&Boolean(4&o),forceShowDetailContent:!!o&&Boolean(8&o),templateId:null==r?void 0:r.templateId})},e.prototype._formatReceivedMessage=function(e,t){var n;if(!e)return e;var r=this,o=t||{},i=o.currentUserId,s=o.connectedTime,a=o.afterDecode,u=o.customMessageTypes,c=void 0===u?{}:u,l=e.content,p=e.fromUserId,d=e.type,h=e.groupId,_=e.status,g=e.dataTime,f=e.extraContent,E=e.extStatus,I=e.clientUniqueId,T=e.busChannel,C=e.msgId,R=e.classname,v=e.toUserIds,y=e.optionBits,S=e.direction||exports.MessageDirection.RECEIVE,m=function(e){var t=exports.ReceivedStatus.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?exports.ReceivedStatus.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(_),A=m.isPersited,N=m.isCounted,O=m.isMentioned,M=m.disableNotification,L=m.receivedStatus,U=m.canIncludeExpansion,P=!!(2&(E||0)),b=!!(4&(E||0)),x=!!(8&(E||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,D=[exports.ConversationType.GROUP,exports.ConversationType.CHATROOM,exports.ConversationType.RTC_ROOM,exports.ConversationType.ULTRA_GROUP].indexOf(d)>-1?h:p,w=p,V=exports.MessageDirection.RECEIVE;S===exports.MessageDirection.SEND&&(w=i,V=exports.MessageDirection.SEND);var G=vt(g),F=G<s,B=d===exports.ConversationType.CHATROOM,k=r._setExpansion(f),H=r._formatBytes(l);H=r._getUtfContent(H);var q=r._setPushConfig(e,this.logger);B&&p===i&&(V=exports.MessageDirection.SEND);var Y={conversationType:d,targetId:D,senderUserId:w,messageType:R,messageUId:C,isPersited:A,isCounted:N,isMentioned:O,sentTime:G,messageDirection:V,receivedTime:Date.now(),disableNotification:M,receivedStatus:L,receivedStatusInfo:Mt(L),canIncludeExpansion:U,content:H,expansion:k,pushConfig:q,channelId:T||"",isInterrupt:P,isModifyMessage:b,messageId:vt(I)||0,sentStatus:exports.SentStatus.SENT,isOffLineMessage:F,channelType:x,isStatusMessage:(null===(n=c[R])||void 0===n?void 0:n.isStatusMessage)||!1,readReceiptInfo:void 0,directedUserIds:v,disableUpdateLastMessage:!!(1&(y||0))};return(null==a?void 0:a(Y))||Y},e.prototype._formatSentMessage=function(e,t){var n=this,r=e.content,o=e.classname,i=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,p=e.extStatus,d=e.clientUniqueId,h=e.systemId,_=e.toUserIds,g=e.optionBits,f=t.signal,E=t.currentUserId,I=f.date,T=f.topic,C=f.targetId,R=!!(2&(p||0)),v=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e),isMentioned:!!(4&e)}}(i),y=v.isPersited,S=v.isCounted,m=v.disableNotification,A=v.canIncludeExpansion,N=v.isMentioned,O=Uu[T]||exports.ConversationType.PRIVATE,M=Au(T),L=n._formatBytes(r),U=h||C;o===exports.MessageType.RECALL&&(O=L.conversationType||O,U=L.targetId||C);var P=n._setExpansion(a),b=n._setPushConfig(e,this.logger),x=Ee(Ee({},b),{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==u?void 0:u.templateId});return{conversationType:O,targetId:U,messageType:o,messageUId:s,isPersited:y,isCounted:S,isStatusMessage:M,senderUserId:E,content:n._formatBytes(r),sentTime:1e3*I,receivedTime:Date.now(),messageDirection:exports.MessageDirection.SEND,isOffLineMessage:!1,disableNotification:m,canIncludeExpansion:A,expansion:P,pushConfig:x,channelId:e.busChannel||"",isInterrupt:R,messageId:vt(d)||0,receivedStatus:exports.ReceivedStatus.UNREAD,receivedStatusInfo:Mt(exports.ReceivedStatus.UNREAD),isMentioned:N,directedUserIds:_,disableUpdateLastMessage:!!(1&(g||0))}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},o=e.list,i=e.hasMsg,s=r.targetId,a=vt(e.syncTime),u=[];return yt(o,(function(e){var o=n._formatReceivedMessage(e,t);r.conversationType===exports.ConversationType.ULTRA_GROUP?o.targetId=e.groupId||r.targetId:o.targetId=s,u.push(o)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!i}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,r=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,r=e.time,o=e.changeType,i=e.msgUID,s=e.msgTime,a=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId,p=e.subChangeType,d=e.userGroupIds,h=e.busChannelType,_=e.remindType;return{targetId:t,conversationType:n,changeType:o,messageUId:i,changeTime:vt(r),sendTime:vt(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:p,userGroupIds:d,busChannelType:h,mentionedType:_}})),hasNext:r}},e.prototype._formatEventChangeList=function(e){var t=this,n=e.list,r=e.syncTime,o=e.hasNext;return{syncTime:r,list:n&&n.map((function(e){var n,r=e.businessId,o=e.type,i=e.time,s=e.changeType,a=e.originalId,u=e.originalTime,c=e.secondaryId,l=e.isAdmin,p=e.additionalMark,d=e.operatorId,h=e.subChangeType,_=e.secondaryType,g=e.remindType,f=e.isRemindMe,E=e.extIds,I=e.eventData;return I&&(n=t._formatEventData(I,s,h)),{businessId:r,conversationType:o,changeType:s,originalId:a,time:vt(i),originalTime:vt(u),secondaryId:c||"",isAdmin:l,additionalMark:p,operatorId:d,subChangeType:h,userGroupIds:E,secondaryType:_,remindType:g,isRemindMe:f,eventData:n}})),hasNext:o}},e.prototype._formatEventData=function(e,t,n){var r={};return e&&Gu[t]&&Gu[t](n)&&(r=Ji.decode(Gu[t](n),e)||{}),r},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,r=e.info,o=e.summary,i=[],s=[],a=!(2&~n),u=!(1&~n);return u&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.userId,o=e.opType,s=e.optime,a=vt(s);i.push({targetId:t,channelId:n,userId:r,operationType:o,operationTime:a})})),a&&Array.isArray(o)&&o.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,o=e.opType;s.push({targetId:t,channelId:n,count:r,operationType:o})})),{conversationType:t,info:i,summary:s,hasInfo:u,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,r=e.list;return{list:r&&r.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatUltraGroupUnreadMentionedList=function(e){var t=e.msgInfo;return(void 0===t?[]:t).map((function(e){return{messageUId:e.msgId,sentTime:vt(e.msgTime),mentionedType:e.remindType,messageType:e.className||""}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,r=t.unreadCount,o=t.remindCount,i=t.busChannelType,s=t.msgInfo,a=t.remindMeCount;return e.versionTime=vt(n)||0,e.unreadMessageCount=this._getUnreadCount(vt(r)||0),e.unreadMentionedCount=this._getUnreadCount(vt(o)||0),e.unreadMentionedMeCount=this._getUnreadCount(vt(a)||0),e.channelType=i||exports.UltraGroupChannelType.PUBLIC,e.lastReadTime=0,s&&(e.firstUnreadMessage={sentTime:vt(s.msgTime)},e.lastReadTime=vt(s.msgTime)-1),e},e.prototype._getUnreadCount=function(e){return e>999?999:e},e.prototype._formatConversationList=function(e,t){var n=this,r=this,o=e.info,i=t.afterDecode,s={list:(o=St(o,(function(e){var o=e.msg,s=e.userId,a=e.type,u=e.unreadCount,c=e.busChannel,l=e.versionTime,p=null;o&&((p=r._formatReceivedMessage(o,t)).targetId=s);var d={targetId:s,conversationType:a,unreadMessageCount:vt(u)||0,latestMessage:p,channelId:c||"",operationTime:vt(l)||0};return a===exports.ConversationType.ULTRA_GROUP&&(d=n._getUltraGroupConversationInfo(d,e)),(null==i?void 0:i(d))||d})))||[]};return((null==t?void 0:t.conversationType)||exports.ConversationType.NONE)===exports.ConversationType.ULTRA_GROUP&&(s.isFinished=e.isFinished),s},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:St(n,(function(e){var t=e.id,n=e.time;return{id:t,time:vt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=St(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,o=e.timestamp,i=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?exports.ChatroomEntryType.DELETE:exports.ChatroomEntryType.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:i,timestamp:vt(o),version:vt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,o={};return yt(n||[],(function(e){var n=e.key,r=e.version,i=e.value;e.version=vt(r),e.value=t._readBytes(i),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=vt(e.createdTime),e.tagName=e.name})),o[n]=e})),{settings:o,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return yt(t,(function(e){var t=e.type,r=e.channelId,o=e.time,i=e.stateItem,s=e.busChannel,a=exports.NotificationStatus.CLOSE,u=exports.NotificationLevel.NOT_SET,c=!1,l=[];yt(i,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case xu:a=n===Pu?exports.NotificationStatus.OPEN:exports.NotificationStatus.CLOSE,u=Number(n)||exports.NotificationLevel.NOT_SET;break;case Du:c=n===Pu;break;case wu:l=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:vt(o),tags:l,channelId:s||""})})),n},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=vt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatQueryReceiptResp=function(e){var t=e.list,n=void 0===t?[]:t,r=e.num,o=e.readCnt;return{list:n.map((function(e){return{readTime:vt(e.receiptTime),userId:e.userId}})),totalCount:r,readCount:o}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){var t=e.joinTime,n=e.createTime,r=e.memberCount,o=e.chatroomBanState;return{joinTime:t,createTime:n||0,memberCount:r||0,isAllChatroomBanned:!!(1&o),isCurrentUserBanned:!!(2&o),isCurrentChatroomBanned:!!(4&o),isCurrentChatroomInWhitelist:!!(1&e.whiteListState)}},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:vt(e.joinTime)}}))},e.prototype._formatCallKVInfo=function(e){return e},e.prototype._fromatCallInfoDownStream=function(e){return e},e.prototype._formateSessionMsgReadInput=function(e){var t=e.busChannel,n=e.channelId,r=e.msgTime;return{conversationType:e.type,targetId:n,channelId:t||"",timestamp:r}},e.prototype._formateChannelsListResult=function(e){if(!e)return{result:{list:[]}};var t=e.listType,n=e.result,r=e.page;return n?{listType:t,result:Ji.decode(Vu[t],n)||[],page:r}:{listType:t,result:{list:[]},page:r}},e.prototype.encodeSessionAttInput=function(){var e=Ji.getModule(jr);return e.setNothing(1),e.toArrayBuffer()},e.prototype._calculateFlag=function(e){var t=e.isFilerWhiteBlacklist,n=e.isVoipPush,r=e.pushConfig||{},o=0;return o|=n?1:0,o|=t?2:0,o|=r.disablePushTitle?4:0,o|=r.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,r=e.androidConfig,o=e.templateId,i=void 0===o?"":o,s=e.harmonyOSConfig,a=Ji.getModule(Nr);if(t&&a.setTitle(t),n||r||s){var u=function(e,t,n){void 0===e&&(e={}),void 0===t&&(t={}),void 0===n&&(n={});var r=t.channelIdMi,o=t.channelIdHW,i=t.channelIdOPPO,s=t.typeVivo,a=t.importanceHW,u=t.categoryHW,c=t.imageUrlHW,l=t.categoryVivo,p=t.importanceHonor,d=t.imageUrlHonor,h=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,r=e.apnsCollapseId,o=e.category,i=e.richMediaUri,s=e.interruptionLevel,a=t.googleConfig,u={};u["thread-id"]=n||"",u["apns-collapse-id"]=r||"",u.category=o||"",u.richMediaUri=i||"",u["interruption-level"]=s||"active";var c={};c.collapse_key=null==a?void 0:a.collapseKey,c.imageUrl=null==a?void 0:a.imageUrl;var l=null==a?void 0:a.priority;return l&&!["high","normal"].includes(l)&&(l="normal"),c.priority=l,{APNS:u,FCM:c}}(e,t),_=[{HW:{channelId:o||"",importance:a||"NORMAL",image:c||"",category:u||""}},{MI:{channelId:r||""}},{OPPO:{channelId:i||""}},{VIVO:{classification:s||"",category:l||""}},{APNS:h.APNS},{FCM:h.FCM},{HONOR:{importance:p||exports.PushImportanceHonor.NORMAL,image:d||""}},{OHOS:{category:n.category||null,image:n.image||""}}];return JSON.stringify(_)}(n,r,s);a.setPushConfigs(u)}return(null==r?void 0:r.notificationId)&&a.setPushId(null==r?void 0:r.notificationId),a.setTemplateId(i),a},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,r=t.content,o=t.directionalUserIdList,i=t.canIncludeExpansion,s=t.expansion,a=t.pushConfig,u=t.channelId,c=t.pushData,l=void 0===c?"":c,p=t.pushContent,d=void 0===p?"":p,h=t.messageId,_=void 0===h?0:h,g=t.disableUpdateLastMessage,f=void 0!==g&&g,E=t.isPersited,I=e.conversationType,T=e.targetId,C=Ji.getModule(Ar),R=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var o=0;return n&&(o|=1),r&&(o|=2),e.isMentioned&&(o|=4),e.disableNotification&&(o|=32),e.canIncludeExpansion&&(o|=64),o}(t),v=a||{},y=v.pushContent,S=void 0===y?d:y,m=v.pushData,A=void 0===m?l:m;C.setSessionId(R),S&&C.setPushText(S),A&&C.setAppData(A),o&&C.setToUserIds(o);var N=this._calculateFlag(t);if(C.setConfigFlag(N),C.setClassname(n),r.user&&r.user.portraitUri&&(r.user.portrait=r.user.portraitUri),C.setContent(JSON.stringify(r)),i&&s){var O={};yt(s,(function(e,t){O[t]={v:e}})),C.setExtraContent(JSON.stringify(O))}if(a){var M=this._getPushExtraModule(a);C.setPushExt(M)}C.setClientUniqueId(_),gt(u)||C.setBusChannel(u),I===exports.ConversationType.SYSTEM&&C.setSystemId(T);var L=0;return E&&f&&(L|=1),C.setOptionBits(L),C},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).toArrayBuffer()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,r=t.order,o=t.timestamp,i=t.channelId,s=Ji.getModule(Qr);return s.setTargetId(e),s.setTime(o),s.setCount(n),s.setOrder(r),s.setBusChannel(i||""),s.toArrayBuffer()},e.prototype.encodeSuperSyncMsg=function(e){var t=Ji.getModule(bo);return t.setSyncTime(e),t.toArrayBuffer()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,r=e.startTime,o=e.order;t=t||0,r=r||0,o=o||0;var i=Ji.getModule(Vr);return i.setType(n),i.setCount(t),i.setStartTime(r),i.setOrder(o),i.toArrayBuffer()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,r=Ji.getModule(Gr);return r.setType(t),n&&r.setBusChannel([n]),r.toArrayBuffer()},e.prototype.encodeBatchDeleteConversation=function(e){var t=Ji.getModule(to),n=[];return e.forEach((function(e){var t=e.conversationType,r=e.targetId,o=e.channelId,i=Ji.getModule(no);i.setConversationType(t),i.setConversationId(r),i.setBusChannel(o||""),n.push(i)})),t.setRelation(n),t.toArrayBuffer()},e.prototype._encodeSessions=function(e){return e.map((function(e){var t=e.conversationType,n=e.targetId,r=Ji.getModule(zr);return r.setType(t),r.setChannelId(n),r}))},e.prototype.encodeRemoveConversationList=function(e){var t=Ji.getModule(Zr);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()},e.prototype.encodeDeleteMessages=function(e,t,n,r){var o=Ji.getModule(ro),i=[];return yt(n,(function(e){i.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),o.setType(e),o.setConversationId(t),o.setMsgs(i),o.setBusChannel(r),o.toArrayBuffer()},e.prototype.encodeClearMessages=function(e,t,n,r){var o=Ji.getModule(Hr);return t=t||(new Date).getTime(),o.setDataTime(t),o.setTargetId(e),o.setBusChannel(n),o.setConversationType(r),o.toArrayBuffer()},e.prototype.encodeBatchClearRemoteMessages=function(e){var t=Ji.getModule(qr),n=e.map((function(e){var t=Ji.getModule(Hr);return t.setTargetId(e.targetId),t.setConversationType(e.conversationType),t.setBusChannel(e.channelId),t.setDataTime(e.timestamp),t}));return t.setInput(n),t.toArrayBuffer()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,r=e.targetId,o=e.channelId,i=t.timestamp,s=Ji.getModule(Xr);return i=i||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(i),s.setBusChannel(o),s.toArrayBuffer()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,r=e.conversationType,o=e.channelId,i=e.messageUId,s=e.sendTime,a=e.keys,u={mid:i,put:e.expansion,del:a,clear:e.removeAll?1:0},c=Ji.getModule(xo);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(o||""),c.setMsgUID(i),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.toArrayBuffer()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,r=e.conversationType,o=e.channelId,i=e.messageUId,s=e.sendTime,a=e.content,u=Ji.getModule(xo);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(o||""),u.setMsgUID(i),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.toArrayBuffer()},e.prototype.encodeQueryMsgChange=function(e){var t=Ji.getModule(Do);return t.setSyncTime(e),t.toArrayBuffer()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,r=e.messages,o=Ji.getModule(Go),i=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return o.setTargetId(t),o.setType(n),o.setQuery(i),o.toArrayBuffer()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,r=e.sentTime,o=e.count,i=Ji.getModule(Br);return i.setGroupId(t),i.setBusChannel(n),i.setMsgTime(r),i.setSize(o),i.toArrayBuffer()},e.prototype.encodeOperateStatus=function(e,t,n,r){var o=Ji.getModule(Bo);return o.setTargetId(e),o.setType(t),o.setBusChannel(n),o.setOpType(r),o.toArrayBuffer()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=Ji.getModule(Yr);return n.setCount(e),n.setOrder(t),n.toArrayBuffer()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=Ji.getModule(To);return n.setUnpushLevel(e),n.setBusChannel(t),n.toArrayBuffer()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=Ji.getModule(Io);return t.setBusChannel(e),t.toArrayBuffer()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var r=Ji.getModule(oo),o=t.key,i=t.value,s=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||exports.ChatroomEntryType.UPDATE,p=Nu(t,l),d={key:o,value:i||"",uid:n,version:c};if(gt(p)||(d.status=p),r.setEntry(d),a){var h={conversationType:exports.ConversationType.CHATROOM,targetId:e},_={key:o,value:i,extra:s,type:l},g=this._getUpMsgModule(h,{messageType:exports.MessageType.CHRM_KV_NOTIFY,content:_,isPersited:!1,isCounted:!1});r.setNotification(g),r.setBNotify(!0),r.setType(exports.ConversationType.CHATROOM)}return r.toArrayBuffer()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var r=Ji.getModule(io),o=t.entries,i=t.type||exports.ChatroomEntryType.UPDATE,s=Nu(t,i),a=[];return o.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};gt(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.toArrayBuffer()},e.prototype.encodePullChatRoomKV=function(e){var t=Ji.getModule(uo);return t.setTimestamp(e),t.toArrayBuffer()},e.prototype.encodeGetConversationStatus=function(e){var t=Ji.getModule(ho);return t.setTime(e),t.toArrayBuffer()},e.prototype.encodeSetConversationStatus=function(e,t){var n=Ji.getModule(Eo),r=Date.now(),o=[];return yt(e,(function(e){var t=Ji.getModule(go),n=e.conversationType,i=e.targetId,s=e.notificationStatus,a=e.isTop,u=e.channelId,c=e.notificationLevel,l=[];t.setType(n),t.setChannelId(i),t.setTime(r),t.setBusChannel(u);var p=s===exports.NotificationStatus.OPEN,d={};gt(s)||(d[xu]=p),gt(c)||(d[xu]=c),gt(a)||(d[Du]=a),yt(d,(function(e,t){if(!gt(e)){var n=Ji.getModule(fo);e=e?Pu:bu,gt(c)||Number(t)!==xu||(e=String(c)),n.setSessionStateType(Number(t)),n.setValue(e),l.push(n)}})),t.setStateItem(l),o.push(t)})),n.setVersion(t||r),n.setState(o),n.toArrayBuffer()},e.prototype.encodeSetConversationTypeLevel=function(e,t,n){var r=Ji.getModule(vo);return r.setType(e),r.setVersion(t),r.setUnpushLevel(n),r.toArrayBuffer()},e.prototype.encodeReadReceipt=function(e,t){var n=Ji.getModule(So);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()},e.prototype.encodeCreateTag=function(e,t){var n=Ji.getModule(Ao),r=[];return e.forEach((function(e){var t=Ji.getModule(No);t.setTagId(e.tagId),t.setName(e.tagName),r.push(t)})),n.setTags(r),n.setVersion(t),n.toArrayBuffer()},e.prototype.encodeMessageReader=function(e,t){var n=Ji.getModule(So);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()},e.prototype.encodeReadReceiptMsg=function(e,t,n){var r=Ji.getModule(Wo),o=e.conversationType,i=e.targetId,s=e.channelId,a=void 0===s?"":s;return r.setType(o),r.setTargetId(i),r.setBusChannel(a),r.setStartMsgId(t),r.setEndMsgId(n),r.toArrayBuffer()},e.prototype.encodeReceiptQryReq=function(e,t){var n=Ji.getModule(jo),r=e.targetId,o=e.channelId,i=void 0===o?"":o;return n.setTargetId(r),n.setBusChannel(i),n.setMsgId(t),n.toArrayBuffer()},e.prototype.encodeReceiptCntQryReq=function(e,t){var n=Ji.getModule(Xo),r=e.targetId,o=e.conversationType,i=e.channelId,s=void 0===i?"":i;return n.setChannelId(r),n.setBusChannel(s),n.setType(o),n.setMsgId(t),n.toArrayBuffer()},e.prototype.encodeSessionMsgReadInput=function(e,t){var n=Ji.getModule(Xr),r=e.conversationType,o=e.targetId,i=e.channelId,s=void 0===i?"":i;return n.setType(r),n.setChannelId(o),n.setBusChannel(s),n.setMsgTime(t),n.toArrayBuffer()},e.prototype.encodeRemoveTag=function(e,t){var n=Ji.getModule(Oo),r=[];return e.forEach((function(e){var t=Ji.getModule(No);t.setTagId(e),r.push(t)})),n.setTags(r),n.setVersion(t),n.toArrayBuffer()},e.prototype.encodeDisConversationTag=function(e){var t=Ji.getModule(Mo);return t.setTagId(e),t.toArrayBuffer()},e.prototype.encodeUpdateConversationTag=function(e,t,n){var r=Ji.getModule(Eo),o=[];return t.forEach((function(t){var n=Ji.getModule(go),r=Ji.getModule(fo),i=[];e.forEach((function(e){var t=Ji.getModule(No);t.setTagId(e.tagId),gt(e.isTop)||t.setIsTop(e.isTop),i.push(t)})),r.setSessionStateType(wu),r.setValue(JSON.stringify(i)),r.setTags(i),n.setType(t.conversationType),n.setChannelId(t.targetId),n.setTime(Date.now()),n.setStateItem([r]),o.push(n)})),r.setState(o),r.setVersion(n),r.toArrayBuffer()},e.prototype.encodeReportSDKInfo=function(e){var t=Ji.getModule(Uo);return t.setSdkInfo(e),t.toArrayBuffer()},e.prototype.encodeUltraGroup=function(e,t){var n=Ji.getModule(Po);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.toArrayBuffer()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=Ji.getModule(Ho);return t.setRtcRoomId(e.rtcRoomId),t.toArrayBuffer()},e.prototype.encodeSetCallInfo=function(e,t){var n=Ji.getModule(qo);return n.setKey(e),n.setDataContent(t),n.toArrayBuffer()},e.prototype.encodePullKVMsg=function(e){var t=Ji.getModule(Ko);return t.setSyncTime(e),t.toArrayBuffer()},e.prototype.encodeUpdateUserSubReq=function(e,t,n,r){var o=Ji.getModule(zo);o.setSubType(e),o.setOpType(n),o.setExpiry(r);var i=[];return t.forEach((function(e){var t=Ji.getModule($o);t.setSubUserId(e),i.push(t)})),o.setSubUsers(i),o.toArrayBuffer()},e.prototype.encodePullUserSubReq=function(e){var t=e.version,n=e.pageToken,r=Ji.getModule(ti);return r.setVersion(t),r.setPageToken(n),r.toArrayBuffer()},e.prototype.encodePullSubDataReq=function(e){var t=e.version,n=e.needAllData,r=e.pageToken,o=Ji.getModule(ri);return o.setVersionTime(t),o.setNeedAllData(n),o.setPageToken(r),o.toArrayBuffer()},e.prototype.encodeQrySubDataReq=function(e,t){var n=Ji.getModule(si);n.setSubType(e);var r=[];return t.forEach((function(e){var t=Ji.getModule($o);t.setSubUserId(e),r.push(t)})),n.setSubUsers(r),n.toArrayBuffer()},e.prototype.encodePullUserProfileReq=function(e){var t=Ji.getModule(li);return t.setUserId(e),t.toArrayBuffer()},e.prototype.encodeUserProfileInput=function(){var e=Ji.getModule(di);return e.setNothing(1),e.toArrayBuffer()},e.prototype.encodeUserProfilePermission=function(e){var t=Ji.getModule(hi);return t.setPermission(e),t.toArrayBuffer()},e.prototype.encodeSearchUserProfile=function(e){var t=Ji.getModule(_i);return t.setUniqueId(e),t.toArrayBuffer()},e.prototype.encodeUserProfile=function(e){var t=Ji.getModule(ai),n=[],r=[];return Object.keys(e).forEach((function(t){if("extraProfile"!==t){var o=e[t],i=Ji.getModule(ui);i.setKey(t),i.setValue((null==o?void 0:o.toString())||""),n.push(i)}else if(e.extraProfile){var s=e.extraProfile;Object.keys(s).forEach((function(e){var t=s[e],n=Ji.getModule(ui);n.setKey(e),n.setValue(t.toString()||""),r.push(n)}))}})),t.setUserProfile(n),t.setUserExtProfile(r),t.toArrayBuffer()},e.prototype.encodeMultiChannels=function(e){var t=Ji.getModule(Ei),n=[];return e.forEach((function(e){var t=Ji.getModule(gi);t.setTargetId(e),n.push(t)})),t.setType(exports.ConversationType.GROUP),t.setList(n),t.toArrayBuffer()},e.prototype.encodeQuitGroup=function(e,t,n,r,o){void 0===n&&(n=[]),void 0===r&&(r=!0);var i=Ji.getModule(Ii);if(i.setTargetId(t),i.setType(exports.ConversationType.GROUP),"dismiss"!==e&&o){var s=this.encodeQuitChannelsSetting(o,r);i.setSettingInfo(s)}return"quit"!==e&&"dismiss"!==e&&i.setUsers(n),i.toArrayBuffer()},e.prototype.encodeQuitChannelsSetting=function(e,t){var n=Ji.getModule(Ti);return n.setIsQuit(t),n.setIsDelBan(!!(null==e?void 0:e.removeMuteStatus)),n.setIsDelWhite(!!(null==e?void 0:e.removeWhiteList)),n.setIsDelAttention(!!(null==e?void 0:e.removeFollow)),n},e.prototype.encodeModifyChannelsInput=function(e,t,n){var r=Ji.getModule(Ii);return r.setTargetId(t),r.setType(exports.ConversationType.GROUP),r.setUsers(n),r.setOperateType(e),r.toArrayBuffer()},e.prototype.encodeChannelsQueryInput=function(e){var t=e.type,n=e.groupId,r=e.option,o=e.ids,i=Ji.getModule(Ci);if(n&&i.setTargetId(n),i.setType(exports.ConversationType.GROUP),["getGroupMembersByRole","getGroupApplications","getJoinedGroupsByRole"].includes(t)&&r){var s=this.encodePagingQuery(r);i.setPage(s)}return["getGroupMembers","getJoinedGroups"].includes(t)&&i.setIds(null!=o?o:[]),e.roleType&&i.setRoleType(e.roleType),i.toArrayBuffer()},e.prototype.encodePagingQuery=function(e){var t=Ji.getModule(Ri),n=e.count,r=e.order,o=e.pageToken;return t.setSize(n),t.setOrder(r?0:1),t.setPageToken(o),t},e.prototype.encodeJoinGroup=function(e,t,n){void 0===n&&(n=[]);var r=Ji.getModule(mi);return r.setTargetId(t),r.setType(exports.ConversationType.GROUP),"invite"===e&&r.setUserIds(n),r.toArrayBuffer()},e.prototype.encodeMemberResponseInput=function(e){var t=e.groupId,n=e.inviterId,r=e.optType,o=e.optResult,i=e.joinUserId,s=e.reason,a=Ji.getModule(Si);return a.setTargetId(t),a.setType(exports.ConversationType.GROUP),a.setOptType(r),a.setOptResult(o),a.setInviterId(n),r===exports.GroupOperationRole.MANAGER&&a.setJoinUserId(i),o||a.setDetail(null!=s?s:""),a.toArrayBuffer()},e.prototype.encodeSetGroupRemark=function(e,t){var n=Ji.getModule(yi),r=exports.GroupOperationType.ADD;return n.setTargetId(e),n.setType(exports.ConversationType.GROUP),t||(r=exports.GroupOperationType.REMOVE),n.setOperateType(r),n.setChannelNickName(t),n.toArrayBuffer()},e.prototype.encodeSetGroupFollows=function(e,t,n){var r=Ji.getModule(Ii);return r.setTargetId(t),r.setType(exports.ConversationType.GROUP),r.setUsers(n),r.setOperateType(e),r.toArrayBuffer()},e.prototype.encodeFriendInput=function(e){var t=Ji.getModule(Ai);return t.setTargetId(e.targetId),e.type&&t.setType(e.type),e.info&&t.setInfo(e.info),t.toArrayBuffer()},e.prototype.encodeFriendsInput=function(e,t){return Ji.encode(Ni,{targetId:e,type:t})},e.prototype.encodeFriendQueryInput=function(e,t,n){var r=null!=t?t:{},o=r.count,i=void 0===o?200:o,s=r.pageToken,a=void 0===s?"":s,u=r.order,c=void 0!==u&&u,l=Ji.getModule(Ui);l.setQueryType(e),11===e&&l.setFriendType(n);var p=Ji.getModule(Ri);return p.setSize(i),p.setOrder(c?0:1),p.setPageToken(a),l.setPage(p),l.toArrayBuffer()},e.prototype.encodeFriendsListInput=function(e,t){return Ji.encode(Pi,{targetId:e,type:t})},e.prototype.encodeFriendLevelSet=function(e){return Ji.encode(bi,{level:e})},e.prototype.encodeQuerySessionsInput=function(e){var t=Ji.getModule($r);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()},e}(),Bu=function(e){function n(t,n,r,o){var i=e.call(this,t,n,r,o)||this;return i.wsListener=o,i._socket=null,i._connectedTime=0,i._socketIndex=0,i._serverSessionId="",i._localConnectedTime=0,i._idCount=0,i._generateMessageId=function(){return i._idCount>=65535&&(i._idCount=0),++i._idCount},i._messageIds={},i._syncMessageIds={},i.codec=new Fu(i.logger),i}return t(n,e),n.prototype.getConnectedTime=function(){return this._connectedTime},n.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},n.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},n.prototype.getDelayTime=function(){return this._localConnectedTime-this._connectedTime},n.prototype.connectWithToken=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var n,o,i,s,a,u,c,l,p;return Ce(this,(function(d){switch(d.label){case 0:if(n=t.openAnti,o=t.type,i=this.getCmpList(t),this.logger.debug(exports.LogTagId.L_NAVI_CMP_R,JSON.stringify(i),r),0===(s=i.filter((function(e,t){return i.findIndex((function(t){return t.addr===e.addr}))===t})).sort((function(e,t){return e.weight>t.weight?-1:1}))).length)return this.logger.error(exports.LogTagId.L_NAVI_CONF_E,"no service available",r),[2,ot(exports.ErrorCode.SERVER_UNAVAILABLE)];a=1===n?ps.V4:ps.V3,u=function(t){var n,i,u,l,p,d,h,_,g,f,E;return Ce(this,(function(I){switch(I.label){case 0:return n=s[t],i=n.protocol,u=n.addr,l=n.weight,p=function(e,t,n,r,o,i){var s=wa(),a=s.type,u=s.version,c="browser"===fr.tag?"|".concat(a,"|").concat(u):"||",l=i?"&protocolVer=".concat(i):"",p=Da();return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(Le,"&pid=").concat(o,"&deviceId=").concat(p,"&apiVer=").concat(fr.isFromUniapp?"uniapp":fr.tag+encodeURIComponent(c)).concat(fr.connectPlatform?"&platform=".concat(fr.connectPlatform):"").concat(l)}(i===D.WS?"ws":"wss",u,c.appkey,e,"",a),d=Date.now(),[4,c.connectWebSocket(p,a,r)];case 1:return h=I.sent(),_=h.code,g=h.data,f=c.cmpWeightCache.findIndex((function(e){return e.addr===u})),E={bid:jt(),ptc:ue.WS,cod:_,net:c.getNetwork().type,dur:Date.now()-d,spr:0,pr:o||0,hos:u,idx:f,rct:c.retryCount?pe.RECONNECT:pe.CONNECT,cid:c.cid,v:le.CURRENT,rsn:c._doConnectReason,count:c.retryCount,weight:l,ssid:c._serverSessionId},c.logger.record(re.IM_WEBSOCKET,JSON.stringify(E),r),_===exports.ErrorCode.RC_SOCKET_DISCONNECTED||_===exports.ErrorCode.TIMEOUT?[2,"continue"]:_!==exports.ErrorCode.SUCCESS?[2,{value:ot(_)}]:(c._localConnectedTime=Math.floor((Date.now()+d)/2),c._socket=g.socket,c.updateCmpWeight(s[t].addr,!0),c.curCmpUrl=s[t].addr,[2,{value:rt(g.userId)}])}}))},c=this,l=0,d.label=1;case 1:return l<s.length?[5,u(l)]:[3,4];case 2:if("object"==typeof(p=d.sent()))return[2,p.value];d.label=3;case 3:return l+=1,[3,1];case 4:return[2,ot(exports.ErrorCode.SERVER_UNAVAILABLE)]}}))}))},n.prototype.connectWebSocket=function(e,t,n){return Te(this,void 0,void 0,(function(){var r=this;return Ce(this,(function(o){return this.logger.info(exports.LogTagId.T,"connect start: ".concat(e),n),[2,new Promise((function(o){var i=fr.createWebSocket(e);r._socketIndex=i.id;var s=setTimeout((function(){r.logger.info(exports.LogTagId.T,"connect timeout: ".concat(e),n),o(ot(exports.ErrorCode.TIMEOUT)),i&&i.close()}),5e3);i.onOpen((function(){clearTimeout(s),r.logger.info(exports.LogTagId.T,"socket open",n)})),i.onMessage((function(e){if(r._socketIndex===i.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var s=oa(e,t);if(s){if(s instanceof Ys){var a=s.status;if(a!==uu.ACCEPTED)return r.logger.info(exports.LogTagId.T,"connect failed: ".concat(a),n),void o(ot((d=a,mu[d])));r.logger.info(exports.LogTagId.T,"connect success",n);var u=s.timestamp,c=s.userId,l=s.messageId,p=s.sessionId;return r._serverSessionId=p,r._connectedTime=u,r._idCount=l,void o(rt({userId:c,socket:i}))}var d;if(s instanceof Ks){var h=s.status;return r.logger.info(exports.LogTagId.T,"recv disconnect signal -> status: ".concat(h)),void r.onRecvDisconnect(h,i)}r._onReceiveSignal(s)}}}else r.logger.warn(exports.LogTagId.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:r._socketIndex,curSocketId:i.id}))})),i.onClose((function(){r.logger.info(exports.LogTagId.T,"socket close",n);var e=exports.ErrorCode.RC_SOCKET_DISCONNECTED;o(ot(e)),r.onSocketEnd(i,e)})),i.onError((function(e){r.logger.info(exports.LogTagId.T,"socket error",n);var t=exports.ErrorCode.RC_SOCKET_DISCONNECTED;o(ot(t)),r.onSocketEnd(i,t)}))}))]}))}))},n.prototype._qosNeedAck=function(e){e.header.qos!==cs.AT_MOST_ONCE&&(e instanceof Xs&&!e.syncMsg&&(this.logger.debug(exports.LogTagId.O,"send pubAck -> ".concat(e.messageId," ").concat(e.topic)),this.sendOnly(new ta(e.messageId))),e instanceof ra&&(this.logger.debug(exports.LogTagId.O,"send queryCon -> ".concat(e.messageId)),this.sendOnly(new na(e.messageId))))},n.prototype._publishReader=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i=this;return Ce(this,(function(s){switch(s.label){case 0:return t=e.syncMsg,n=e.topic,r=e.messageId,this.logger.debug(exports.LogTagId.O,"recv PublishReader -> messageId: ".concat(r," ").concat(n)),n===ys?[2]:!t||Au(n)?(this.wsListener.signal(e),[2]):[4,new Promise((function(e){i._syncMessageIds[r]=e}))];case 1:return o=s.sent(),delete this._syncMessageIds[r],this.wsListener.signal(e,o),[2]}}))}))},n.prototype._onReceiveSignal=function(e){return Te(this,void 0,void 0,(function(){var t,n,r;return Ce(this,(function(o){switch(o.label){case 0:return e instanceof Ws&&this._pingResolve?(this._pingResolve(exports.ErrorCode.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(e),(e instanceof ea||e instanceof ra)&&(t=e.messageId,this.logger.debug(exports.LogTagId.O,"recv ack -> messageId: ".concat(t)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(r=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],r(e))),e instanceof Xs?[4,this._publishReader(e)]:[3,2]);case 1:o.sent(),o.label=2;case 2:return[2]}}))}))},n.prototype.onRecvDisconnect=function(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(e){return Su[e]}(e)))},n.prototype.onSocketEnd=function(e,t){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t),this._pingResolve&&(this._pingResolve(t),this._pingResolve=void 0))},n.prototype.clearResolves=function(){for(var e in this._messageIds){var t=this._messageIds[e];delete this._messageIds[e],t(exports.ErrorCode.RC_SOCKET_DISCONNECTED)}},n.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n(exports.ErrorCode.TIMEOUT)}),e),t.sendOnly(new Qs)}))},n.prototype.sendOnly=function(e){this._socket&&((e instanceof $s||e instanceof zs)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getArrayBuffer()))},n.prototype._sendHandler=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o=this;return Ce(this,(function(i){switch(i.label){case 0:return this._socket?(t=this._generateMessageId(),e.messageId=t,this._socket.send(e.getArrayBuffer()),[4,new Promise((function(e){o._messageIds[t]=e,setTimeout((function(){o._messageIds[t]&&delete o._messageIds[t],e(exports.ErrorCode.TIMEOUT)}),3e4)}))]):[2,ot(exports.ErrorCode.RC_NET_CHANNEL_INVALID)];case 1:return n=i.sent(),(r="number"==typeof n?n:n.status)!==exports.ErrorCode.SUCCESS&&this.logger.warn(exports.LogTagId.O,"send rmtp fail -> messageId: ".concat(t,", code: ").concat(r,", topic: ").concat(e.topic)),"number"==typeof n?[2,ot(n)]:[2,r===exports.ErrorCode.SUCCESS?rt(n):ot(r,"",n)]}}))}))},n.prototype.query=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i,s,a,u,c,l,p,d;return Ce(this,(function(h){switch(h.label){case 0:return i=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.O,"send query -> topic: ".concat(hs(e),", targetId: ").concat(t),i),s=new zs(e,n,t),o&&s.setHeaderQos(o),[4,this._sendHandler(s)];case 1:return a=h.sent(),u=a.code,c=a.data,l=a.isOk,p=a.msg,d=c&&r?Ji.decode(r,c.pbData):void 0,l?(this.logger.info(exports.LogTagId.O,"send query success",i),[2,rt(d)]):(this.logger.warn(exports.LogTagId.O,"send query fail -> ".concat(u),i),[2,ot(u,p,d)])}}))}))},n.prototype.send=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return[4,this._sendHandler(e)];case 1:return(r=a.sent()).data?r.data instanceof ea?[2,r]:(o=r.data,i=t&&o.pbData&&[exports.ErrorCode.SUCCESS,exports.ErrorCode.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,exports.ErrorCode.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT,exports.ErrorCode.RC_USER_PROFILE_KEY_NOT_EXIST,exports.ErrorCode.RC_USER_PROFILE_EXT_KEY_NOT_EXIST,exports.ErrorCode.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS,exports.ErrorCode.RC_USER_PROFILE_VALUE_EXCEED_RANGE,exports.ErrorCode.RC_GROUP_PARAMETER_FORMAT_ERROR].indexOf(o.status)>=0,s=i?this.codec.decodeByPBName(o.pbData,t,n):o,0!==o.status?(this.logger.warn(exports.LogTagId.O,"send failed -> messageId: ".concat(o.messageId,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,ot(o.status,void 0,t&&o.pbData?s:null)]):[2,rt(s)]):[2,r.wipe()]}}))}))},n.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},n}(Tn),ku=function(){},Hu=function(e){function n(t,n,r){var o=e.call(this,n,t,r)||this;o._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};var i=wa();return o.deviceId=Da(),o.model="Web|".concat(i.type,"|").concat(i.version),o.init(),o}return t(n,e),n.prototype.httpRequest=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l,p;return Ce(this,(function(d){switch(d.label){case 0:return(o=r).deviceId=this.deviceId,o.model=this.model,i={url:e,method:t,headers:n,body:JSON.stringify(o)},this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify(i)),[4,fr.httpReq(i)];case 1:s=d.sent(),a=s.status,u=s.data,c=void 0===u?"":u,this.logger.info(exports.LogTagId.L_REQUEST_R,JSON.stringify({status:a,data:c}));try{return l=JSON.parse(c),p=l.data,[2,{code:parseInt(l.code,10),data:p}]}catch(e){return this.logger.warn(exports.LogTagId.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:c,error:e})),[2,{code:a,msg:e}]}return[2]}}))}))},n.prototype.setCloudControllerCache=function(e){var t=Ye(this.appkey);fr.localStorage.setItem(t,JSON.stringify(e)),this.logger.info(exports.LogTagId.L_CLOUD_SET_CACHE_O,JSON.stringify(e))},n.prototype.getLocalCloudControllerCache=function(){var e=Ye(this.appkey),t=fr.localStorage.getItem(e);return this.logger.info(exports.LogTagId.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:e,data:t})),t},n.prototype.setMRTRConfig=function(e){this.logger.info(exports.LogTagId.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e},n.prototype.getMRTRConfig=function(){return this._mrtr},n}(En),qu=null,Yu="RC_LOGS",Ku="RC_STATISTICS",Qu="RC_CONF",Wu=((Lu={})[Yu]=["level","time"],Lu[Qu]=["key"],Lu[Ku]=["level","time"],Lu),ju=function(e,t,n){return new Promise((function(r){var o=e.transaction(t,"readwrite").objectStore(t).index("time"),i=IDBKeyRange.upperBound(Date.now()-n),s=o.openCursor(i);s.onsuccess=function(e){var t=e.target.result;t?(t.delete(),t.continue()):r()},s.onerror=function(){r()}}))},Ju=null,Xu=function(e){return Te(void 0,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return[4,qu];case 1:return(t=r.sent())?(n=t.db,[4,ju(n,Yu,e)]):[2];case 2:return r.sent(),[4,ju(n,Ku,e)];case 3:return r.sent(),Ju=setTimeout((function(){return Xu(e)}),6e5),[2]}}))}))},Zu=function(e,t,n){void 0===n&&(n=168),qu||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==wa().type?qu=new Promise((function(r){var o=window.indexedDB;!function(e){var t=window.indexedDB;t.databases&&t.databases().then((function(n){n.forEach((function(n){n.name&&e.includes(n.name)&&t.deleteDatabase(n.name)}))}))}(["RC_ENGINE_DB","RC_STATISTIC_".concat(e)]);var i="RC_LOGS_".concat(e),s=o.open(i,2);s.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,e.target.error),r(null)},s.onsuccess=function(o){var i=o.target.result;i?(i.onclose=function(e){qu=null,t.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},i.onerror=function(e){qu=null,t.error(exports.LogTagId.L_LOGDB_ERROR_E,e.target.error)},i.onabort=function(e){t.info(exports.LogTagId.L_LOGDB_ABORT_S,e.target.error)},Xu(3600*Math.max(24,Math.min(168,n))*1e3),r({appkey:e,db:i})):r(null)},s.onupgradeneeded=function(e){var t=e.target.result;Object.keys(Wu).forEach((function(e){t.objectStoreNames.contains(e)&&t.deleteObjectStore(e);var n=e===Qu?{keyPath:"key"}:{autoIncrement:!0},r=t.createObjectStore(e,n);Wu[e].forEach((function(e){return r.createIndex(e,e,{unique:!1})}))}))}})):t.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},zu=[],$u=function(e,t,n){return new Promise((function(r){var o=e.transaction(t,"readwrite");o.oncomplete=r,o.onabort=r;var i=o.objectStore(t);n.forEach((function(e){try{i.add(e)}catch(t){null===console||void 0===console||console.error("write failed ->",e,t)}}))}))},ec=[],tc=!1,nc=function(e){return Te(void 0,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return tc||0===ec.length?[2]:(tc=!0,t=ec.filter((function(e){return e.level<exports.LogL.FATAL})),n=ec.filter((function(e){return e.level>=exports.LogL.FATAL})),ec.length=0,[4,$u(e,Yu,n)]);case 1:return r.sent(),[4,$u(e,Ku,t)];case 2:return r.sent(),tc=!1,0===ec.length&&zu.length>0&&(zu.forEach((function(e){return e.close()})),zu.length=0),setTimeout((function(){return nc(e)})),[2]}}))}))};function rc(e){return Te(this,void 0,void 0,(function(){var t;return Ce(this,(function(n){switch(n.label){case 0:return[4,qu];case 1:return(t=n.sent())?[2,new Promise((function(n){var r=t.db.transaction(Qu,"readonly").objectStore(Qu).get(e);r.onsuccess=function(e){var t;n({value:null===(t=r.result)||void 0===t?void 0:t.value,success:!0})},r.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var oc=Ze,ic=function(){return{setTimestamp4RealtimeLog:function(e){oc=e},getTimestamp4RealtimeLog:function(){return oc},getLogs:function(e,t,n,r,o){return void 0===o&&(o=Yu),Te(this,void 0,void 0,(function(){var i;return Ce(this,(function(s){switch(s.label){case 0:return[4,qu];case 1:return(i=s.sent())?[2,new Promise((function(s){var a=i.db.transaction(o,"readonly").objectStore(o),u=[],c=IDBKeyRange.bound(e,t),l=a.index("time").openCursor(c);l.onsuccess=function(e){var t=e.target.result;if(t){var o=t.value;o.level<=n&&(r?o.sessionId===Xe:o.level>=0)&&u.push(o),t.continue()}else s({dbReady:!0,logs:u})},l.onerror=function(e){s({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},sc="REPORT_SESSION",ac=function(e,t){return Te(void 0,void 0,void 0,(function(){var n,r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return n="".concat(sc,"_").concat(e),[4,rc("".concat(sc,"_").concat(e))];case 1:return r=s.sent(),o=r.success,i=r.value,o?(t===(null==i?void 0:i.sessionId)||function(e,t){Te(this,void 0,void 0,(function(){var n,r;return Ce(this,(function(o){switch(o.label){case 0:return[4,qu];case 1:return(n=o.sent())?(r=n.db,r.transaction(Qu,"readwrite").objectStore(Qu).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},uc=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype._handleWrite=function(e){!function(e){Te(void 0,void 0,void 0,(function(){var t;return Ce(this,(function(n){switch(n.label){case 0:return[4,qu];case 1:if(!(t=n.sent()))return[2];if(e.content&&ut(e.content))try{e.content=JSON.parse(e.content)}catch(e){}return ec.push(e),nc(t.db),[2]}}))}))}(e)},n}(ln),cc=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(e,t,n){return void 0===t&&(t=Date.now()-cc),void 0===n&&(n=Date.now()),Te(this,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){switch(i.label){case 0:return t=t<0?Date.now()+t:t,(n=n<=0?Date.now():n)-t>cc&&(t=n-cc),(r=new uc(e,"RC-IM","IM")).debug(exports.LogTagId.T,"get logs: startTime ".concat(t," endTime ").concat(n)),Zu(e,r),[4,ic().getLogs(t,n,exports.LogL.DEBUG,!1)];case 1:return o=i.sent().logs,r.debug(exports.LogTagId.T,"get logs ".concat(o.length)),function(e,t){var n=t.map((function(e){var t=e.sessionId,n=e.time,r=e.type,o=e.level,i=e.tag,s=e.traceId,a=e.loggerId,u=e.content;return"".concat(t,",").concat(n,",").concat(r,",").concat(o,",").concat(i,",").concat(s,",").concat(a,',"').concat(u,'"\n')})),r=new Blob(n,{type:"text/csv"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download="".concat(e,".csv"),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}("".concat(e,"-").concat(t,"-").concat(n),o),[2]}}))}))}}}}var lc,pc,dc=48,hc=64,_c=80,gc=96,fc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ec=function(e){for(var t={},n=0;n<e.length-1;n++){var r=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(r)?t[r].push(n):t[r]=[n]}for(var o=[],i=[],s=function(){if(i.length>0){var e=i.join("");if(i=[],e.length>26){var t=Tc(e.length),n=String.fromCharCode(_c|t.length);o.push(n+t)}else{var r=String.fromCharCode(gc|e.length);o.push(r)}o.push(e)}},a=0;a<e.length;){var u=Ic(t,e,a);if(u.length<2)i.push(e.charAt(a++));else if(u.length<4)i.push(e.substr(a,u.length)),a+=u.length;else{var c=Tc(a-u.offset),l=Tc(u.length);if(c.length+l.length>=u.length)i.push(e.substr(a,u.length)),a+=u.length;else{s();var p=String.fromCharCode(hc|c.length<<2|l.length);o.push(p+c+l),a+=u.length}}}s();var d=Tc(e.length),h=String.fromCharCode(dc|d.length);return o.push(h+d),o.join("")},Ic=function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var o=e[t.charAt(n)+t.charAt(n+1)];if(o[0]===n)return r;for(var i=t.length-n,s=0,a=o.length;s<a;s++){var u=o[s],c=n-u;if(!(c>238327)){var l=Math.min(i,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var p=2,d=p;d<l&&t.charAt(u+d)===t.charAt(n+d);d++)p++;p>=r.length&&(r.length=p,r.offset=u)}}}return r},Tc=function(e){var t=[],n=0;do{n=e%62,t.push(fc.charAt(n)),e=(e-n)/62}while(e>0);return t.join("")},Cc=function(e){function n(t,n,r){var o=this,i=Da(),s=wa(),a="".concat(s.type,"|").concat(s.version,"|").concat(n.getSessionId());return(o=e.call(this,t,i,a,ic(),n)||this).tableName=r,o}return t(n,e),n.prototype.send=function(e){return fr.httpReq(e)},n.prototype.checkStart=function(t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){switch(n.label){case 0:return[4,ac(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t,this.tableName)]}}))}))},n.prototype.compressLogs=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return[2,{success:!0,data:Ec(e.map(dn).join(""))}]}))}))},n.prototype.realtimeReport=function(t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,e.prototype.realtimeReport.call(this,t,n,r,this.tableName)]}))}))},n}(pn),Rc=function(e){function n(t,n){return e.call(this,t,n,Yu)||this}return t(n,e),n.prototype.isReporter=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),Te(void 0,void 0,void 0,(function(){var e,r,o;return Ce(this,(function(i){switch(i.label){case 0:return[4,rc("".concat(sc,"_").concat(t))];case 1:return e=i.sent(),r=e.success,o=e.value,[2,r&&(null==o?void 0:o.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},n.prototype.report=function(t,n,r,o,i,s,a){return void 0===a&&(a=!1),Te(this,void 0,void 0,(function(){var u;return Ce(this,(function(c){switch(c.label){case 0:return[4,this.isReporter()];case 1:return u=c.sent(),this.userId&&!u?[2]:[2,e.prototype.report.call(this,t,n,r,o,i,s,a)]}}))}))},n}(Cc),vc=function(e){function n(t,n){return e.call(this,t,n,Ku)||this}return t(n,e),n}(Cc),yc=((lc={})[exports.ConversationType.PRIVATE]=os.qryPMsg,lc[exports.ConversationType.GROUP]=os.qryGMsg,lc[exports.ConversationType.CHATROOM]=os.qryCHMsg,lc[exports.ConversationType.CUSTOMER_SERVICE]=os.qryCMsg,lc[exports.ConversationType.SYSTEM]=os.qrySMsg,lc[exports.ConversationType.APP_PUBLIC_SERVICE]=os.qryMCMsg,lc[exports.ConversationType.PUBLIC_SERVICE]=os.qryMPMsg,lc),Sc=((pc={})[exports.ConversationType.PRIVATE]=os.cleanPMsg,pc[exports.ConversationType.GROUP]=os.cleanGMsg,pc[exports.ConversationType.ULTRA_GROUP]=os.cleanGMsg,pc[exports.ConversationType.CUSTOMER_SERVICE]=os.cleanCMsg,pc[exports.ConversationType.SYSTEM]=os.cleanSMsg,pc[exports.ConversationType.APP_PUBLIC_SERVICE]=os.cleanMCMsg,pc[exports.ConversationType.PUBLIC_SERVICE]=os.cleanMPMsg,pc),mc=function(e,t,n,r,o,i,s){return{conversationType:e,targetId:t,senderUserId:i,messageDirection:exports.MessageDirection.SEND,isCounted:!!n.isCounted,isMentioned:!!n.isMentioned,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:!!n.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!n.disableNotification,isStatusMessage:!!n.isStatusMessage,canIncludeExpansion:!!n.canIncludeExpansion,expansion:n.canIncludeExpansion?n.expansion:null,receivedStatus:exports.ReceivedStatus.UNREAD,receivedStatusInfo:Mt(exports.ReceivedStatus.UNREAD),pushConfig:n.pushConfig,channelId:n.channelId,isInterrupt:n.isInterrupt,messageId:s||0,sentStatus:exports.SentStatus.SENT,directedUserIds:n.directionalUserIdList,disableUpdateLastMessage:n.disableUpdateLastMessage}},Ac=function(e){return e.sort((function(e,t){var n,r,o=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-o})),e},Nc=[S.GROUP_OPERATION,S.GROUP_PROFILE_CHANGE,S.GROUP_APPLICATION_INVITATION,S.GROUP_FOLLOW_USER_CHANGE],Oc=[l.FRIEND_APPLICATION],Mc=["RC:TypSts","RC:InterceptMsg","RC:RL"];function Lc(){return function(e,t,n){var r=n.value;return n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this._isConnected?[2,r.apply(this,e)]:[2,Promise.resolve({code:exports.ErrorCode.RC_NET_UNAVAILABLE})]}))}))},n}}function Uc(){return function(e,t,n){var r=n.value;return n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this._isConnected?[2,r.apply(this,e)]:[2,Promise.resolve(ot(exports.ErrorCode.RC_NET_UNAVAILABLE))]}))}))},n}}function Pc(e){return e?e.map((function(e){var t;return{userId:e.userId,name:e.name,portraitUri:e.portraitUrl,remark:null!==(t=e.remarkName)&&void 0!==t?t:"",directionType:e.friendType,extProfile:e.extProfile,addTime:vt(e.relationTime),inBlackList:!!e.flag}})):[]}function bc(e){return e&&e.list?e.list.map((function(e){return{userId:e.userId,name:e.name||"",portraitUri:e.portraitUrl||"",applicationType:e.type,applicationStatus:e.status,operationTime:vt(e.operateTime),extra:e.info||"",friendType:e.friendType}})):[]}var xc=function(e){function n(t,n,o){var i=e.call(this,t,n,o,new uc(o.appkey,"IMLib","IM"))||this;r.add(i),i._customMessageType={},i._reconnectTimer=-1,i._pullOfflineFinished=!1,i.currentUserId="",i._openCallPlus=!1,i.cloudControllerUri="",i._pullingMsg=!1,i._pullQueue=[],i._chrmsQueue={},i._latestSyncTimestamp=0,i._intervalTimer=-1,i._latestPullKVMsgTimestamp=0,i._intervalTimerForChrmPull=-1,i._handleInnerMsgOptions=function(e,t,n){var r,o=n.messageType;if(o===exports.MessageType.SYNC_READ_STATUS&&function(e){return[exports.ConversationType.GROUP,exports.ConversationType.DISCUSSION,exports.ConversationType.ULTRA_GROUP,exports.ConversationType.PUBLIC_SERVICE,exports.ConversationType.APP_PUBLIC_SERVICE].includes(e)}(e)&&Object.assign(n,{directionalUserIdList:[i.currentUserId]}),o===exports.MessageType.READ_RECEIPT_RESPONSE){if(!n.content.receiptMessageDic||0===Object.keys(n.content.receiptMessageDic).length){var s=null===(r=i._readReceiptManager)||void 0===r?void 0:r.getReceiptMessageDic({conversationType:e,targetId:t,channelId:n.channelId});n.content.receiptMessageDic=s||{}}for(var a in n.directionalUserIdList=[],n.content.receiptMessageDic)n.directionalUserIdList.push(a)}return n},i._lastSyncUltraMsgTimeStamp=0,i._lastSyncUltraMsgLocalTimeStamp=0,i._ultraGroupTimer=-1,i._isUltraPulling=!1,i._ultraGroupTimeQue=[],i._isUltraGroupListExist=!1,i._ultraGroupMap={},i._ultraMsgMap={},i._pullUltraChangeMessageQue=[],i._isPullingUltraChangeMessage=!1,i._lastPullingUltraChangeMessageTime=0;var s=o.appkey,a=o.logOutputLevel,u=o.logExpireTime,c=o.navigators,l=o.areaCode,p=o.logServerUrl,d=o.miniCMPProxy,h=o.environment;return i._environment=h||"default",i.logger.setOutputLevel(a),an.init({areaCode:l,navigators:c,logServerUrl:p,miniCMPProxy:d}),Zu(s,i.logger,u),i.reporter=new Rc(s,i.logger),i.navi=new du(s,i.logger,new Tu(s,i.logger),i._environment),i.reporterStatistic=new vc(s,i.logger),i._letterbox=new hu(s),i._sendMessageStore=new _u(s),i._chrmEntryHandler=new ru(i),i._connMgr=new Bu(s,i.navi,i.logger,{signal:i._signalHandler.bind(i),onConnected:i.onConnected.bind(i),onDisconnected:i.onDisconnected.bind(i),onConnecting:i._watcher.onConnecting,onSuspend:i.onSuspend.bind(i)}),"browser"===fr.tag&&i._initCloudController(),i._chatroom=new ku,i}var r,o;return t(n,e),Object.defineProperty(n.prototype,"chatroom",{get:function(){return this._chatroom},enumerable:!1,configurable:!0}),n.prototype._initCloudController=function(){var e;e=ve(an.getCloudControllerUrl(),1),this.cloudControllerUri=e[0],this.cloudController=new Hu(this._appkey,this.logger,this.reporter),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,cn.init)},n.prototype.onConnected=function(){var e,t=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),n=this._connMgr.getCurrentUserId();this.currentUserId=n,this._pullOfflineFinished=!1,this._EventChangeManager||(this._EventChangeManager=new Ru(this._connMgr,this.currentUserId,this.logger,this._appkey,this._handleEventChangeList.bind(this))),this._joinedChrmManager||(this._joinedChrmManager=new ou(t.joinMChrm)),this._conversationManager||(this._conversationManager=new ja(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag,Va(t))),this._ultraGroupManager||(this._ultraGroupManager=new eu(this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new iu(this,this._appkey,this.currentUserId,this._watcher.tag)),this._readReceiptManager||(this._readReceiptManager=new Iu(this._appkey,this.currentUserId,this._connMgr.getDelayTime())),this._initSubscribeManager(t),this._conversationManager.startPullConversationStatus(0),this._conversationManager.adaptOldStore(),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._rejoinChrm(),this._startSyncInterval(),this._openCallPlus&&this._syncCallPullKVMsg(),1===t.ugMsg&&this._notificationOnline(),1&~(t.eventDriven||0)||null===(e=this._EventChangeManager)||void 0===e||e.notificationOnline(),this._watcher.onConnected(),this.reporter.checkStart(t),this.reporterStatistic.checkStart(t)},n.prototype.onDisconnected=function(e){var t,n,r;this._resetMemoryState(),null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),null===(r=this._EventChangeManager)||void 0===r||r.stopAllTask(),this._watcher.onDisconnected(e)},n.prototype.onSuspend=function(e){var t,n,r;null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),null===(r=this._EventChangeManager)||void 0===r||r.stopAllTask(),this._watcher.onSuspend(e)},n.prototype._initSubscribeManager=function(e){var t=this;(e.subDriven||e.userProfile)&&(this._subscribeManager||(this._subscribeManager=new Eu(this._connMgr,{syncSubscribeUserStatusFinished:function(e){var n,r;null===(r=(n=t._watcher).syncSubscribedUserStatusFinished)||void 0===r||r.call(n,e)},subscribeUserStatusChanged:function(e){var n,r;null===(r=(n=t._watcher).subscribedUserStatusChange)||void 0===r||r.call(n,e)},subscribeRelationChanged:function(e){var n,r;null===(r=(n=t._watcher).subscribedRelationChange)||void 0===r||r.call(n,e)},ownUserProfileChanged:function(e){var n,r;null===(r=(n=t._watcher).ownUserProfileChanged)||void 0===r||r.call(n,e)}},this.currentUserId,this._connMgr.getDelayTime(),this.logger,!!e.userProfile,e.subDriven||0)),this._subscribeManager.syncData())},n.prototype.createLogger=function(e,t){return new uc(this._appkey,e,t)},n.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},n.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},n.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},n.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},n.prototype.connect=function(e,t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return this._openCallPlus=n,[2,this._connMgr.connect(e,t,n,r)]}))}))},n.prototype._signalHandler=function(e,t){var n,r=e.syncMsg,o=e.topic;if(r)this._receiveSyncMsg(e,t);else{var i=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_RECV_RMTP_O,o,i);var s=ds(o);if(s)switch(s){case os.s_ntf:this._pullMsg(e);break;case os.s_msg:this._receiveMsg(e);break;case os.s_cmd:this._receiveStateNotify(e);break;case os.s_us:this._receiveSettingNotify(e);break;case os.rtc_ntf:this._receiveRtcKv(e.pbData);break;case os.s_opNtf:this._pullOperateStatusNotify(e);break;case os.s_pubCall:this._pubCallInfo(e);break;case os.s_stat:null===(n=this._subscribeManager)||void 0===n||n.updateUserStatus(e)}else this.logger.error(exports.LogTagId.L_RECV_RMTP_E,o,i)}},n.prototype._receiveStateNotify=function(e){var t,n,r,o=this._connMgr.codec.decodeByPBName(e.pbData,Sr),i=o.time,s=o.type,a=o.chrmId;switch(s){case 2:if(!this._chrmsQueue[a])return;this._chrmEntryHandler.pullEntry(a,i);break;case 3:this._conversationManager.startPullConversationStatus(i);break;case 4:this._chrmEntryHandler.reset(a),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);break;case 8:null===(t=this._subscribeManager)||void 0===t||t.startsyncSubscribeUserStatus(i);break;case 9:null===(n=this._subscribeManager)||void 0===n||n.startSyncSubscribeRelationship(i);break;case 10:null===(r=this._subscribeManager)||void 0===r||r.syncOwnProfile(!0);break;case 11:this._EventChangeManager.startPullEventChange(i)}},n.prototype._receiveSettingNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,Lo).version;this._userSettingManager.pullUserSettings(t)},n.prototype._receiveMessageExpansion=function(e){var t=e.content,n=e.channelId,r=void 0===n?"":n,o=e.conversationType,i=e.targetId,s=t.put,a=t.del,u=t.mid;s&&this._watcher.expansion({updatedExpansion:{messageUId:u,expansion:s,channelId:r,conversationType:o,targetId:i}}),a&&this._watcher.expansion({deletedExpansion:{messageUId:u,deletedKeys:a,channelId:r,conversationType:o,targetId:i}})},n.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.pbData,Xr),r=n.targetId,o=n.channelId,i=n.timestamp,s=this._ultraGroupMap["".concat(o,"_").concat(r)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=i,this._watcher.conversation(Ot([s]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},n.prototype._receiveSyncMsg=function(e,t){var n,r=this,o=ds(e.topic),i=((n={})[os.ugMsg]=function(){r._ultraGroupTimeQue.push(t.timestamp),r._syncUltraMsg(r._lastSyncUltraMsgTimeStamp)},n[os.updRTime]=function(){r._receivesyncReadStatus(e)},n[os.updUgRTime]=function(){r._clearUltraGroupUnreadCount(e,t)},n[os.updUserSub]=function(){var e;null===(e=r._subscribeManager)||void 0===e||e.startSyncSubscribeRelationship(t.timestamp)},n);if(i[o])i[o]();else if([os.recallMsg,os.ppMsgS,os.pgMsgS,os.ppMsgP,os.pgMsgP,os.chatMsg,os.pcMsgP,os.prMsgS,os.pbMsgP].includes(o)){var s=this._connMgr.codec.decodeByPBName(e.pbData,Ar,{currentUserId:this.currentUserId,signal:e});((s=this._handleMsgProperties(s)).conversationType!==exports.ConversationType.CHATROOM||this._chrmsQueue[s.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||s.sentTime):(t&&(s.sentTime=t.timestamp,s.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(exports.LogTagId.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:s.messageUId,messgeId:s.messageId,sentTime:s.sentTime})),s.messageType!==exports.MessageType.EXPANSION_NOTIFY?((s.messageType===exports.MessageType.SYNC_READ_STATUS||s.messageType===exports.MessageType.READ_RECEIPT&&s.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(s.conversationType,s.targetId,s.channelId,s.sentTime),s.messageType===exports.MessageType.READ_RECEIPT_REQUEST&&this._processRRReqMsg(s),s.messageType===exports.MessageType.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(s),this._conversationManager.setConversationCacheByMessage(s,!0),this._batchMessage([s])):this._receiveMessageExpansion(s)))}},n.prototype._batchMessage=function(e){for(var t=this,n=[],r=[],o=[],i=e.length-1;i>=0;i-=1){var s=e[i];s.messageType===exports.MessageType.LOG_COMMAND&&s.senderUserId===Ue?r.unshift(s):s.messageType===exports.MessageType.CLOUD_CONTROL&&s.senderUserId===Ue?o.push(s):n.unshift(s)}this._watcher.batchMessage(n),r.forEach((function(e){var n=e.content,r=n.startTime,o=n.endTime,i=n.platform,s=n.logId,a=n.uri;t.reporter.report(parseInt(r,10),parseInt(o,10),i,a,s,e.messageUId)})),o.length>0&&this._ccMsgHandler(o)},n.prototype._ccMsgHandler=function(e){var t;return Te(this,void 0,void 0,(function(){var n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return e.shift()?(n=this._connMgr.getToken(),[4,null===(t=this.cloudController)||void 0===t?void 0:t.request(this.cloudControllerUri,cn.other,n)]):[3,2];case 1:r=i.sent()||0,(o=e.filter((function(e){return e.sentTime>r}))).length>0&&this._ccMsgHandler(o),i.label=2;case 2:return[2]}}))}))},n.prototype._pubCallInfo=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,Yo),n=t.key,r=t.dataContent,o=t.maxTime;this._latestPullKVMsgTimestamp=o,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:r}]}))},n.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,Sr),n=t.type,r=t.chrmId,o=t.time;if(this.logger.info(exports.LogTagId.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(o)),2===n){var i=this._chrmsQueue[r];if(!i)return;i.queue.push(o),this._pullChrmMsg(r)}else this._pullQueue.push(o),this._syncMsg()},n.prototype._receivesyncReadStatus=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,Xr),n=t.conversationType,r=t.targetId,o=t.channelId,i=t.timestamp,s=t.sentTime;this._conversationManager.clearUnreadCount(n,r,o,s),this._watcher.syncReadStatus({conversationType:n,targetId:r,channelId:o,timestamp:i})},n.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()},n.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},n.prototype._syncCallPullKVMsg=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new zs(os.pullKvMsg,e,this.currentUserId),[4,this._connMgr.send(t,Qo)]):[2];case 1:return n=i.sent(),r=n.code,o=n.data,r===exports.ErrorCode.SUCCESS&&o?(this._latestPullKVMsgTimestamp=o.maxTime,this._watcher.callInfo(JSON.stringify({list:o.info})),[2]):[2]}}))}))},Object.defineProperty(n.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED},enumerable:!1,configurable:!0}),n.prototype._filterMessage=function(e){var t=e.messageType;return t===exports.MessageType.DELIVERED||t===exports.MessageType.DELIVERED_MSG||t===exports.MessageType.SYNC_READ_STATUS&&!this._processSRSMsg(e)},n.prototype._messageProcessor=function(e){var t=this,n=0,r=[],o=[],i=[],s=[],a=[];return e.forEach((function(e){var u=e.conversationType,c=e.targetId,l=e.channelId,p=e.messageDirection,d=e.messageUId,h=e.messageType,_=e.sentTime,g=e.senderUserId,f=e.content;if(r.push(d),p===exports.MessageDirection.SEND){n=Math.max(_,n);var E=t._sendMessageStore.getSendMessageMap(),I=h===exports.MessageType.RECALL?"Cmd:".concat(f.messageUId):d;if(E[I])return void t._sendMessageStore.removeByUID(I)}if(!t._filterMessage(e))if(h!==exports.MessageType.EXPANSION_NOTIFY)if(_>=t._connMgr.getConnectedTime()&&t._writeMessagesLog(u,d)&&a.push(d),h===exports.MessageType.READ_RECEIPT&&g===t.currentUserId&&t._conversationManager.clearUnreadCount(u,c,l,_),h!==exports.MessageType.READ_STATE){h===exports.MessageType.READ_RECEIPT_REQUEST&&t._processRRReqMsg(e),h===exports.MessageType.READ_RECEIPT_RESPONSE&&t._processRRRspMsg(e);var T=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(T,!0),o.push(T)}else s.push(e);else i.push(e)})),{newOutboxTime:n,messageUIds:r,messages:o,messageExpansionList:i,RSMsgList:s,msgUIds2Statistic:a}},n.prototype._processSRSMsg=function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,o=e.content,i=e.senderUserId,s=e.sentTime;if(i!==this.currentUserId)return!1;var a=this.getNaviInfoFromCache();return this._conversationManager.clearUnreadCount(t,n,r,s),1!==a.sesDriven||(s>this.getConnectedTime()||this._watcher.syncReadStatus({conversationType:t,targetId:n,channelId:r,timestamp:o.lastMessageSendTime}),!1)},n.prototype._processRSMsg=function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,o=e.content,i={conversationType:t,targetId:n,channelId:r};this._watcher.messageReadReceipt(t===exports.ConversationType.PRIVATE?{privateReadReceipt:Ee(Ee({},i),{endMsgTime:o.endMsgTime})}:{groupReadReceipt:Ee(Ee({},i),{totalCount:o.tmn,readedCount:o.rrn,messageUId:o.msgId})})},n.prototype._processRRReqMsg=function(e){var t,n=e.conversationType,r=e.channelId,o=e.targetId,i=e.content,s=e.sentTime,a=e.messageDirection,u=e.senderUserId;null===(t=this._readReceiptManager)||void 0===t||t.insert({conversationType:n,channelId:r,targetId:o},i.messageUId,a,s,u)},n.prototype._processRRRspMsg=function(e){var t,n,r,o=this,i=e.conversationType,s=e.channelId,a=e.targetId,u=e.content,c=e.senderUserId,l=u.receiptMessageDic,p=void 0===l?{}:l;if(c===this.currentUserId)for(var d in p){var h=p[d];try{for(var _=(t=void 0,Re(h)),g=_.next();!g.done;g=_.next()){var f=g.value;null===(r=this._readReceiptManager)||void 0===r||r.remove({conversationType:i,channelId:s,targetId:a},f)}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=_.return)&&n.call(_)}finally{if(t)throw t.error}}}else(p[this.currentUserId]||[]).forEach((function(e){var t;null===(t=o._readReceiptManager)||void 0===t||t.addReadedUser({conversationType:i,channelId:s,targetId:a},e,c)}))},n.prototype._syncMsg=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,u,c,l,p,d,h,_,g,f,E,I,T,C,R,v,y=this;return Ce(this,(function(S){switch(S.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),r=Ji.encode(mr,{ispolling:!1,isPullSend:!0,sendBoxSyncTime:e,syncTime:t,broadcastSyncTime:n}),o=new zs(os[os.pullMsg],r,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),i),[4,this._connMgr.send(o,Or,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId,customMessageTypes:this._customMessageType})]):(this._pullingMsg=!1,[2]);case 1:if(s=S.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),this._pullingMsg=!1,a!==exports.ErrorCode.SUCCESS||!u||gt(u.finished)||gt(u.list)||gt(u.syncTime))return this.logger.warn(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),i),[2];c=u.list,l=u.finished,p=u.syncTime,d=u.broadcastSyncTime,h=void 0===d?1:d,this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({syncTime:p,finished:l,messages:c.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),i);try{if(_=this._messageProcessor(c),g=_.newOutboxTime,f=_.messageUIds,E=_.messages,I=_.messageExpansionList,T=_.RSMsgList,(C=_.msgUIds2Statistic).length>0&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:C.join(",")})),this._batchMessage(E),I.forEach((function(e){y._receiveMessageExpansion(e)})),T.forEach((function(e){y._processRSMsg(e)})),this._letterbox.setInboxTime(p,this.currentUserId),this._letterbox.setOutboxTime(g,this.currentUserId),this._letterbox.setBroadcastSyncTime(h,this.currentUserId),this._sendMessageStore.removeByTimestamp(g),R=this._pullQueue.filter((function(e){return e>p})),this._pullQueue.length=0,(v=this._pullQueue).push.apply(v,ye([],ve(R),!1)),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:f.join(","),timestamp:this._latestSyncTimestamp,hasmore:!l,tmpPullQueue:R}),i),!l)return this._syncMsg(),[2];this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg())}catch(e){this.logger.error(exports.LogTagId.L_PULL_MSG_E,null==e?void 0:e.stack,i)}return[2]}}))}))},n.prototype._receiveMsg=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.pbData,Mr,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()}),n=(t=this._handleMsgProperties(t)).conversationType,r=t.messageType,o=t.senderUserId,i=t.messageUId,s=t.sentTime,a=t.isStatusMessage;if(this.logger.info(exports.LogTagId.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),this._writeMessagesLog(n,i)&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:i})),n!==exports.ConversationType.RTC_ROOM&&r!==exports.MessageType.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}o===this.currentUserId&&this._sendMessageStore.setMessage(i,s),a||o===this.currentUserId||this._letterbox.setInboxTime(s,this.currentUserId),this._handleNotNotifyMsg(t)||(r===exports.MessageType.READ_RECEIPT_REQUEST&&this._processRRReqMsg(t),r===exports.MessageType.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(t),this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t]))}},n.prototype._handleNotNotifyMsg=function(e){var t=e.messageType,n=e.senderUserId;return t===exports.MessageType.DELIVERED||(t===exports.MessageType.DELIVERED_MSG||(t===exports.MessageType.EXPANSION_NOTIFY?(this._receiveMessageExpansion(e),!0):t===exports.MessageType.SYNC_READ_STATUS&&n!==this.currentUserId||t===exports.MessageType.READ_STATE&&(this._processRSMsg(e),!0)))},n.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,r=e.messageType,o=e.isStatusMessage,i=e.isCounted,s=void 0!==i&&i,a=e.isPersited,u=void 0!==a&&a,c=r in Me,l=r in this._customMessageType;if(n=c?Ee(Ee({},Me[r]),{isStatusMessage:Mc.includes(r)}):l?this._customMessageType[r]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(e,n),t&&!gt(o)&&(e.isStatusMessage=o),!t){var p=e.content.user;if(p){var d=p.portrait,h=p.portraitUri,_=d||h;_&&(p.portrait=p.portraitUri=_)}}return e},n.prototype._fixDownstreamData=function(e,t,n){return e&&2===t.list.length&&(t.hasMore=!0,0===n?t.list.shift():t.list.pop()),t},n.prototype.getHistoryMessage=function(e,t,n,r,o,i,s,a){var u;return void 0===i&&(i=""),Te(this,void 0,void 0,(function(){var s,c,l,p,d,h,_,g,f,E,I,T=this;return Ce(this,(function(C){switch(C.label){case 0:return c=(s=this).currentUserId,l=s._connMgr,p=yc[e]||os.qryPMsg,d=1===r&&0===n,l?(h=l.codec.encodeGetHistoryMsg(t,{timestamp:n,count:d?2:r,order:o,channelId:i}),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:i,timestamp:n,count:r,order:o}),a),[4,l.send(new zs(p,h,c),Wr,{currentUserId:c,connectedTime:l.getConnectedTime(),conversation:{targetId:t},afterDecode:function(n){var r,o=null===(r=T._readReceiptManager)||void 0===r?void 0:r.getReadReceiptInfo({conversationType:e,channelId:i,targetId:t},n.messageUId);if(o){var s=o.users;n.readReceiptInfo={isReceiptRequestMessage:!0,readerList:s}}return n}})]):[3,2];case 1:return _=C.sent(),g=_.code,f=_.data,g===exports.ErrorCode.SUCCESS&&f?(E=this._fixDownstreamData(d,f,o),I=[],null===(u=E.list)||void 0===u||u.forEach((function(e){e&&I.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:g,messageUIds:I.join(",")}),a),[2,{code:g,data:{list:E.list,hasMore:E.hasMore}}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:g,messageUIds:""}),a),[2,{code:g}]);case 2:return[2,{code:exports.ErrorCode.RC_NET_CHANNEL_INVALID}]}}))}))},n.prototype.getMessages=function(e,t,n,r,o,i,s){return this.getHistoryMessage(e,t,n,r,o,i,s)},n.prototype.reportSDKInfo=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,o=this.logger.createTraceId(),i=JSON.stringify(e),this.logger.debug(exports.LogTagId.L_VER_REPORT_T,i,o),s=r.codec.encodeReportSDKInfo(i),a=new zs(os[os.reportsdk],s,n),[4,r.send(a)]):[2];case 1:return(u=c.sent().code)!==exports.ErrorCode.SUCCESS&&this.logger.warn(exports.LogTagId.L_VER_REPORT_R,u,o),[2]}}))}))},n.prototype.deleteRemoteMessage=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return this._isConnected?(i=(o=this).currentUserId,s=o._connMgr,a=s.codec.encodeDeleteMessages(e,t,n,r),u=os.delMsg,e===exports.ConversationType.ULTRA_GROUP&&(u=os.delUgMsg),c=new zs(u,a,i),[4,s.send(c)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return l=p.sent(),[2,l.code]}}))}))},n.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return this._isConnected?(i=(o=this).currentUserId,s=o._connMgr,a=s.codec.encodeClearMessages(t,n,r,e),u=Sc[e],c=new zs(u,a,i),[4,s.send(c)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return l=p.sent(),[2,l.code]}}))}))},n.prototype.batchClearRemoteHistoryMessages=function(e,t){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,o=r.codec.encodeBatchClearRemoteMessages(e),i=new zs(os.cleanMsgBatch,o,n),[4,r.send(i)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},n.prototype.getConversationList=function(e,t,n,r,o){return void 0===e&&(e=300),Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l,p,d=this;return Ce(this,(function(h){switch(h.label){case 0:return this._isConnected?(i=(o=this).currentUserId,s=o._connMgr,t=t||exports.ConversationType.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),u=new zs(os.qryRelationR,a,i),[4,s.send(u,Fr,{currentUserId:i,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,o=d._conversationManager.get(t,n,r);Object.assign(e,o);var i=d._conversationManager.getDraft(t,n,r);return e.draft=i,e}})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return c=h.sent(),l=c.code,p=c.data,l!==exports.ErrorCode.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==p?void 0:p.list}]}}))}))},n.prototype.removeConversation=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),i=new zs(os.delRelation,o,t),[4,r.send(i)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return[2,s.sent().code]}}))}))},n.prototype.batchRemoveConversation=function(e){return Te(this,void 0,void 0,(function(){var t,n,r;return Ce(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeBatchDeleteConversation(e),r=new zs(os.delRelationBatch,n,this.getCurrentUserId()),[4,t.send(r)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return[2,o.sent().code]}}))}))},n.prototype.getConversation=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return e!==exports.ConversationType.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:exports.ErrorCode.CONVER_GET_ERROR}];case 1:return(o=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:exports.ErrorCode.CONVER_GET_ERROR}];case 2:if(i=l.sent(),s=i.code,a=i.data,s!==exports.ErrorCode.SUCCESS)return[2,{code:exports.ErrorCode.CONVER_GET_ERROR}];u=this._conversationManager.getDraft(e,t,n),c=(null==a?void 0:a.list[0])||null,r={conversationType:e,targetId:t,channelId:n,unreadMessageCount:o.unreadMessageCount||0,latestMessage:c,notificationStatus:o.notificationStatus||exports.NotificationStatus.CLOSE,notificationLevel:o.notificationLevel||exports.NotificationLevel.NOT_SET,isTop:o.isTop||!1,lastUnreadTime:o.lastUnreadTime||0,unreadMentionedCount:o.unreadMentionedCount||0,draft:u},l.label=3;case 3:return[2,{code:exports.ErrorCode.SUCCESS,data:r}]}}))}))},n.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})},n.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var r=0;if(e.includes(exports.ConversationType.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});for(var o in this._ultraGroupMap){var i=this._ultraGroupMap[o];(0===t.length||t.includes(i.notificationLevel))&&(r+=n?i.unreadMentionedCount:i.unreadMessageCount)}}return r+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})},n.prototype.getConversationUnreadCount=function(e,t,n){var r,o;return e===exports.ConversationType.ULTRA_GROUP?(o=(null===(r=this._ultraGroupMap["".concat(n,"_").concat(t)])||void 0===r?void 0:r.unreadMessageCount)||0,o=this._getUnreadCount(o)):o=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:o})},n.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,this.getServerTime(),!1),Promise.resolve(exports.ErrorCode.SUCCESS)},n.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(exports.ErrorCode.SUCCESS)},n.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},n.prototype.getFirstUnreadMessageInfo=function(e,t,n){var r=this._conversationManager.get(e,t,n),o=r.firstUnreadMessageUid,i=r.firstUnreadTime;return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:i&&o?{messageUId:o,sentTime:i}:null})},n.prototype.saveConversationMessageDraft=function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(exports.ErrorCode.SUCCESS)},n.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})},n.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(exports.ErrorCode.SUCCESS)},n.prototype.pullConversationStatus=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l=this;return Ce(this,(function(p){switch(p.label){case 0:return this._isConnected?(n=(t=this)._connMgr,r=t.currentUserId,o=n.codec.encodeGetConversationStatus(e),i=new zs(os[os.pullSeAtts],o,r),[4,n.send(i,_o)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return s=p.sent(),a=s.code,u=s.data,this.logger.info(exports.LogTagId.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:r})),a!==exports.ErrorCode.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.updatedTime;n&&l._conversationManager.setConversationUpdatedTime(n),t===exports.ConversationType.ULTRA_GROUP?l._setUltraConversationStatus(e):c.push(e)})),[2,{code:a,data:c}])}}))}))},n.prototype._setUltraConversationStatus=function(e){var t=e.targetId,n=e.notificationStatus,r=e.notificationLevel,o=e.channelId,i=e.isTop,s=e.conversationType;if(""!==t||void 0===r){var a=this._ultraGroupMap["".concat(o,"_").concat(t)];return a&&void 0!==r&&(a.notificationLevel=r,this._ultraGroupManager.addUltraGroupStatus(a)),a&&void 0!==n&&(a.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(a)),a&&void 0!==i&&(a.isTop=i),a}this._ultraGroupManager.addUltraGroupStatus({conversationType:s,targetId:"",channelId:"",notificationLevel:r})},n.prototype.batchSetConversationStatus=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o=this;return Ce(this,(function(i){switch(i.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,[4,this._conversationManager.pushTask((function(t){return Te(o,void 0,void 0,(function(){var o,i,s,a,u,c,l,p,d=this;return Ce(this,(function(h){switch(h.label){case 0:return o=r.codec.encodeSetConversationStatus(e,t),i=new zs(os.setSeAtt,o,n),[4,r.send(i,Ro)];case 1:return s=h.sent(),a=s.code,u=s.data,a!==exports.ErrorCode.SUCCESS?[2,{code:a}]:(c=u,this._conversationManager.setConversationUpdatedTime(c.version),l=[],e.forEach((function(e){if(e.conversationType!==exports.ConversationType.ULTRA_GROUP)d._conversationManager.addStatus(Ee(Ee({},e),{updatedTime:c.version}),!0);else{var t=d._setUltraConversationStatus(e);t&&l.push(t)}})),l.length>0&&(p=Ot(l),p=Ac(p),this._watcher.conversation(p)),[2,{code:a}])}}))}))}))]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return[2,i.sent().code]}}))}))},n.prototype.setConversationToTop=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,isTop:n,channelId:r}])]}))}))},n.prototype.batchSetConversationToTop=function(e,t,n){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return Ee(Ee({},e),{isTop:t})})))]}))}))},n.prototype.setConversationNotificationLevel=function(e,t,n,r){return void 0===r&&(r=""),Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,notificationLevel:n,channelId:r}])]}))}))},n.prototype.batchSetConversationNotificationLevel=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return Ee(Ee({},e),{notificationLevel:t})})))]}))}))},n.prototype._joinChrm=function(e,t,n,r,o){return Te(this,void 0,void 0,(function(){var i,s,a,u,c,l,p,d,h,_,g,f,E,I,T,C;return Ce(this,(function(R){switch(R.label){case 0:return this._isConnected?(i=this._connMgr,s=Ji.encode(xr,{nothing:1,extra:r}),a=n?os.joinChrmR:os.joinChrm,u=new zs(a,s,e),this.logger.info(exports.LogTagId.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:os[a]}),o),[4,i.send(u,Dr)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return c=R.sent(),l=c.code,p=c.data,d=l===exports.ErrorCode.SUCCESS?"info":"warn",this.logger[d](exports.LogTagId.L_JOIN_CHATROOM_R,JSON.stringify({code:l,timestamp:(new Date).getTime()}),o),l===exports.ErrorCode.SUCCESS?(_=(h=p).joinTime,g=h.createTime,f=h.memberCount,E=h.isAllChatroomBanned,I=h.isCurrentUserBanned,T=h.isCurrentChatroomBanned,C=h.isCurrentChatroomInWhitelist,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,_),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t,r),this._startSyncIntervalForChrmPull(),[2,{code:l,data:{joinTime:_,createTime:g,memberCount:f,isAllChatroomBanned:E,isCurrentUserBanned:I,isCurrentChatroomBanned:T,isCurrentChatroomInWhitelist:C}}]):[2,{code:l}]}}))}))},n.prototype._rejoinChrm=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,u,c,l,p,d,h;return Ce(this,(function(_){switch(_.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,_.label=1;case 1:return r<t.length?(o=t[r],i=e[o],s=i.count,a=void 0===s?10:s,u=i.extra,this.logger.info(exports.LogTagId.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:o,count:a,extra:u})),c=this.logger.createTraceId(),[4,this._joinChrm(o,a,!0,u,c)]):[3,4];case 2:if(l=_.sent(),p=l.code,d=l.data,h=p===exports.ErrorCode.SUCCESS?"info":"warn",this.logger[h](exports.LogTagId.L_REJOIN_CHATROOM_R,JSON.stringify({code:p,timestamp:(new Date).getTime()}),c),p===exports.ErrorCode.SUCCESS)return this._watcher.chatroom({rejoinedRoom:Ee({chatroomId:o,count:a},d)}),[2];p===exports.ErrorCode.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(o),delete this._chrmsQueue[o]),this._watcher.chatroom({rejoinedRoom:{chatroomId:o,errorCode:p}}),_.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))},n.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c,l,p,d,h,_,g,f,E,I=this;return Ce(this,(function(T){switch(T.label){case 0:return this._isConnected?(r=this._chrmsQueue[e],o=r.pulling,i=r.timestamp,o?[2]:(r.pulling=!0,s=n?0:i,a=Ji.encode(wr,{count:t,syncTime:s}),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,syncTime:s})),u=new zs(os[os.chrmPull],a,e),[4,this._connMgr.send(u,Or,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return c=T.sent(),l=c.code,p=c.data,r.pulling=!1,l===exports.ErrorCode.SUCCESS&&p?(d=p.list,h=p.syncTime,_=p.finished,r.timestamp=n?Math.max(h,n):h,r.queue=r.queue.filter((function(e){return e>h})),g=[],f=[],E=[],d.forEach((function(e){e.sentTime<i||(e.sentTime>=I._connMgr.getConnectedTime()&&I._writeMessagesLog(exports.ConversationType.CHATROOM,e.messageUId)&&f.push(e.messageUId),g.push(e.messageUId),E.push(e))})),this._batchMessage(E),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:l,timestamp:i,messageUIds:g.join(",")})),f.length>0&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:f.join(",")})),_?(r.queue.length>0&&(r.queue.length=0,this._pullChrmMsg(e)),[2]):(this._pullChrmMsg(e),[2])):(this.logger.warn(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:l,timestamp:i,messageUIds:""})),[2])}}))}))},n.prototype.joinChatroom=function(e,t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){switch(o.label){case 0:return[4,this._joinChrm(e,t,!1,n,r)];case 1:return[2,o.sent().code]}}))}))},n.prototype.joinExistChatroom=function(e,t,n,r){return Te(this,void 0,void 0,(function(){return Ce(this,(function(o){return[2,this._joinChrm(e,t,!0,n,r)]}))}))},n.prototype.quitChatroom=function(e){return Te(this,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return this._isConnected?(t=this._connMgr,delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e),n=Ji.encode(xr,{nothing:1}),[4,t.query(os.exitChrm,e,n)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return[2,r.sent().code]}}))}))},n.prototype.getChatroomInfo=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeGetChatRoomInfo(t,n),i=new zs(os[os.queryChrmI],o,e),[4,r.send(i,Kr)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==exports.ErrorCode.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},n.prototype.getChatroomHistoryMessages=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=this._connMgr,i=o.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new zs(os.qryCHMsg,i,e),[4,o.send(s,Wr,{conversation:{targetId:e}})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==exports.ErrorCode.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},n.prototype._modifyChatroomKV=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return this._isConnected?(r=(n=this)._connMgr,o=n.currentUserId,i=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==i?this.getServerTime():i,s=r.codec.encodeModifyChatRoomKV(e,t,o),a=t.type===exports.ChatroomEntryType.UPDATE?os.setKV:os.delKV,u=new zs(a,s,e),[4,r.send(u,Dr)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return c=p.sent(),(l=c.code)===exports.ErrorCode.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},o),[2,l]):[2,l]}}))}))},n.prototype._chatroomKVStoreNotAllSuccess=function(e,t){var n=t.data,r=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(e){var t=r.findIndex((function(t){return e.key===t.key}));-1!==t&&r.splice(t,1)})),r},n.prototype._modifyChatroomKVS=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c,l,p,d,h,_=this;return Ce(this,(function(g){switch(g.label){case 0:return this._isConnected?(r=(n=this)._connMgr,o=n.currentUserId,t.entries.forEach((function(t){var n=_._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?_.getServerTime():n})),i=r.codec.encodeModifyChatRoomKVS(e,t,o),s=t.type===exports.ChatroomEntryType.UPDATE?os.setKVS:os.delKVS,a=new zs(s,i,e),[4,r.send(a,ao)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return u=g.sent(),c=u.code,-1!==[exports.ErrorCode.SUCCESS,exports.ErrorCode.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(p=[],delete(d=Ee({},t)).entries,t.entries.forEach((function(e){p.push(Ee(Ee({},e),d))})),c===exports.ErrorCode.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(h=u.data,l=h.errorKeys,p=this._chatroomKVStoreNotAllSuccess(p,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:p,syncTime:(new Date).getTime()},o)),[2,{code:c,data:l}]}}))}))},n.prototype.setChatroomEntry=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return t.type=exports.ChatroomEntryType.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},n.prototype.setChatroomEntries=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return t.type=exports.ChatroomEntryType.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},n.prototype.forceSetChatroomEntry=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return t.type=exports.ChatroomEntryType.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},n.prototype.removeChatroomEntry=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return t.type=exports.ChatroomEntryType.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},n.prototype.removeChatroomEntries=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return t.type=exports.ChatroomEntryType.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},n.prototype.forceRemoveChatroomEntry=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){return t.type=exports.ChatroomEntryType.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},n.prototype.getChatroomEntry=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:exports.ErrorCode.SUCCESS,data:n}]:this._isConnected?(r=this._connMgr,o=r.codec.encodePullChatRoomKV(0),i=new zs(os[os.pullKV],o,e),[4,r.send(i,so)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(u=a.kvEntries.find((function(e){return e.key===t})),void 0!==u)?[2,{code:exports.ErrorCode.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:exports.ErrorCode.CHATROOM_KEY_NOT_EXIST}]}}))}))},n.prototype.getAllChatroomEntry=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:exports.ErrorCode.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},r=n.codec.encodePullChatRoomKV(0),o=new zs(os[os.pullKV],r,e),[4,n.send(o,so)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),(s=i.data)&&s.kvEntries&&s.kvEntries.length&&s.kvEntries.forEach((function(e){e.key&&(t[e.key]=e.value||"")})),[2,{code:exports.ErrorCode.SUCCESS,data:t}]}}))}))},n.prototype.pullChatroomEntry=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c,l,p,d,h=this;return Ce(this,(function(_){switch(_.label){case 0:return this._isConnected?(r=(n=this)._connMgr,o=n.currentUserId,this._chrmsQueue[e]?(i=r.codec.encodePullChatRoomKV(t),s=new zs(os[os.pullKV],i,e),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,r.send(s,so)]):[2,{code:exports.ErrorCode.RC_CHATROOM_NOT_EXIST}]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return a=_.sent(),u=a.code,c=a.data,this._chrmsQueue[e]?(l=u===exports.ErrorCode.SUCCESS?"info":"warn",this.logger[l](exports.LogTagId.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:t})),u===exports.ErrorCode.SUCCESS&&c?(p=c.kvEntries,d=[],p.length>0&&(p.forEach((function(t){var n=t.key,r=t.value,o=t.type,i=t.timestamp,s=t.userId;h._chrmEntryHandler.getValue(e,n)===r&&s===h.getCurrentUserId()||d.push({key:n,value:r,type:o,timestamp:i,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,c,o),d.length>0&&this._watcher.chatroom({updatedEntries:d})),[2,{code:u,data:c}]):[2,{code:u}]):[2,{code:exports.ErrorCode.RC_CHATROOM_NOT_EXIST}]}}))}))},n.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._isConnected?t.forEach((function(t){e._pullChrmMsg(t),e.getNaviInfoFromCache().kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),18e4)},n.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},n.prototype.removeChatroomFromCatch=function(e){var t;null===(t=this._joinedChrmManager)||void 0===t||t.remove(e)},n.prototype._writeMessagesLog=function(e,t){var n,r=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!r)return!1;var o=function(e){if(!e)return Math.floor(4294967296*Math.random());var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}(t),i=0;switch(e){case exports.ConversationType.PRIVATE:i=r.private;break;case exports.ConversationType.GROUP:i=r.group;break;case exports.ConversationType.CHATROOM:i=r.chatroom;break;case exports.ConversationType.ULTRA_GROUP:i=r.ultraGroup}return!!i&&o%(1/i)==0},n.prototype.sendMessage=function(e,t,n,r,o){var i;return Te(this,void 0,void 0,(function(){var s,a,u,c,l,p,d,h,_,g,f,E;return Ce(this,(function(I){switch(I.label){case 0:return n=this._handleInnerMsgOptions(e,t,n),n=this._handleMsgProperties(n,!0),s=!1,[exports.ConversationType.PRIVATE,exports.ConversationType.GROUP].includes(e)&&(n.isStatusMessage||(null===(i=this._customMessageType[n.messageType])||void 0===i?void 0:i.isStatusMessage))&&(s=!0),a=s?function(e){var t;return(t={},t[exports.ConversationType.PRIVATE]=os.ppMsgS,t[exports.ConversationType.GROUP]=os.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[exports.ConversationType.PRIVATE]=os.ppMsgP,t[exports.ConversationType.GROUP]=os.pgMsgP,t[exports.ConversationType.CHATROOM]=os.chatMsg,t[exports.ConversationType.CUSTOMER_SERVICE]=os.pcMsgP,t[exports.ConversationType.RTC_ROOM]=os.prMsgS,t[exports.ConversationType.SYSTEM]=os.pbMsgP,t)[e]}(e)||os.ppMsgP,s&&(n.isPersited=!1,n.isCounted=!1),u=n.messageId?n.messageId:Wt(),n.messageId=u,c=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(l=new $s(os[a],c,e===exports.ConversationType.SYSTEM?this.currentUserId:t)).setHeaderQos(cs.AT_LEAST_ONCE),s?(this._connMgr.sendOnly(l),[2,{code:exports.ErrorCode.SUCCESS,data:mc(e,t,Ee({},n),"",0,this.currentUserId,u)}]):(p=this._connMgr.getCrtServerTime(),d=mc(e,t,Ee(Ee({},n),{isStatusMessage:s}),"",p,this.currentUserId,u),null==r||r(u),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),o),h=Date.now(),[4,this._connMgr.send(l)]);case 1:return _=I.sent(),g=_.code,f=_.data,g!==exports.ErrorCode.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:d.messageUId,messageId:d.messageId}),o),this._writeMessagesLog(e)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({channel:e,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:g})),d.sentStatus=exports.SentStatus.FAILED,[2,{code:g,data:d}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:null==f?void 0:f.messageUId,messageId:null==f?void 0:f.messageId}),o),E=f,this._sendMessageSuccessHandle(d,E),this._writeMessagesLog(e,E.messageUId)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({msg_id:E.messageUId,channel:e,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:g})),[2,{code:exports.ErrorCode.SUCCESS,data:d}])}}))}))},n.prototype._sendMessageSuccessHandle=function(e,t){var n,r=this;this._sendMessageStore.setMessage(t.messageUId,t.timestamp),e.sentTime=t.timestamp,e.messageUId=t.messageUId,this._conversationManager.setConversationCacheByMessage(e,!0);var o=e.messageType,i=e.conversationType,s=e.targetId,a=e.channelId,u=e.sentTime,c=e.content,l=e.messageDirection;if(o===exports.MessageType.READ_RECEIPT_REQUEST){var p=c.messageUId;null===(n=this._readReceiptManager)||void 0===n||n.insert({conversationType:i,targetId:s,channelId:a},p,l,u)}if(o===exports.MessageType.READ_RECEIPT_RESPONSE){var d=c.receiptMessageDic;if(!d)return;for(var h in d)d[h].forEach((function(e){var t;null===(t=r._readReceiptManager)||void 0===t||t.remove({conversationType:i,targetId:s,channelId:a},e)}))}},n.prototype.recallMsg=function(e,t){var n;return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c,l,p,d,h,_,g,f,E,I,T,C;return Ce(this,(function(R){switch(R.label){case 0:return r=e.targetId,o=e.conversationType,i=e.channelId||"",s=t.user,a=t.extra,u=t.isDelete,c=t.directionalUserIdList,l=t.disableUpdateLastMessage,p=t.messageUId,d=t.sentTime,h={conversationType:o,targetId:r,messageUId:p,sentTime:d,channelId:i,isDelete:u||!1,isAdmin:t.isAdmin},s&&(h.user=s),a&&(h.extra=a),_={content:h,messageType:"RC:RcCmd",disableNotification:null==t?void 0:t.disableNotification,pushConfig:null==t?void 0:t.pushConfig,pushContent:(null===(n=t.pushConfig)||void 0===n?void 0:n.pushContent)||t.pushContent||"",channelId:i,disableUpdateLastMessage:l},[exports.ConversationType.GROUP,exports.ConversationType.ULTRA_GROUP].includes(o)&&c&&(_.directionalUserIdList=c),g=this._connMgr.codec.encodeUpMsg({conversationType:o,targetId:r},_),(f=new $s(os.recallMsg,g,this.currentUserId)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(f)];case 1:return(E=R.sent()).isOk?(I=E.data,o!==exports.ConversationType.ULTRA_GROUP&&(T="Cmd:".concat(p),I.messageUId=T),C=mc(o,r,Ee(Ee({},_),{isPersited:!0}),I.messageUId,I.timestamp,this.currentUserId),o===exports.ConversationType.ULTRA_GROUP?(this._ultraMsgMap[I.messageUId]=I.timestamp,this._updateUltraGroupWhenRecallMsg(r,i,p)):(this._sendMessageStore.setMessage(I.messageUId,I.timestamp),this._conversationManager.setConversationCacheByMessage(C,!0)),[2,rt(C)]):[2,E.wipe()]}}))}))},n.prototype.sendReadReceiptMessage=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){return this._isConnected?(r=this._connMgr.codec.encodeReadReceipt(t,n),o=new zs(os[os.rrMsg],r,e),[2,this._connMgr.send(o)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.getMessageReader=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){return this._isConnected?(r=this._connMgr.codec.encodeMessageReader(t,n),o=new zs(os[os.rrList],r,e),[2,this._connMgr.send(o,mo)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.sendReadReceiptMessageV4=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){return r=this._connMgr.codec.encodeReadReceiptMsg(e,t,n),o=new $s(os[os.sendMsgRead],r,e.targetId),[2,this._connMgr.send(o)]}))}))},n.prototype.getMessageReadReceiptV4=function(e,t){return Te(this,void 0,void 0,(function(){var n,r;return Ce(this,(function(o){return n=this._connMgr.codec.encodeReceiptQryReq(e,t),r=new zs(os[os.qryMsgRead],n,e.targetId),[2,this._connMgr.send(r,Jo)]}))}))},n.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeReceiptCntQryReq(e,t),r=new zs(os[os.qryMsgReadCntBatch],n,e.targetId),[4,this._connMgr.send(r,Zo)];case 1:return o=u.sent(),i=o.code,s=o.data,a=(s||{result:[]}).result,i===exports.ErrorCode.SUCCESS&&a?[2,{code:i,data:a.map((function(t){return Ee({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)}))}]:[2,{code:i}]}}))}))},n.prototype.updateConversationReadTime=function(e,t){return Te(this,void 0,void 0,(function(){var n,r;return Ce(this,(function(o){return n=this._connMgr.codec.encodeSessionMsgReadInput(e,t),r=new $s(os[os.updRTime],n,this.currentUserId),[2,this._connMgr.send(r)]}))}))},n.prototype.pullUserSettings=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this.getNaviInfoFromCache(),n=Ji.encode(lo,{version:e,ipType:t.ipType||0}),r=new zs(os.pullUS,n,this.currentUserId),[4,this._connMgr.send(r,po)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return o=a.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&this._naviChangeHandler(s),[2,{code:i,data:s}]}}))}))},n.prototype._naviChangeHandler=function(e){var t;if(e){var n=e.settings,r=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(r){var o=this._connMgr.getToken();this.navi.updateVoipCallInfo(o,r);var i=this.navi.getNaviInfoFromCache(o);this._watcher.onNaviDataChange(Ee({},i))}}else this.logger.warn(exports.LogTagId.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},n.prototype.getFileToken=function(e,t,n,r,o,i){return Te(this,void 0,void 0,(function(){var s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return this._isConnected?(s=r&&"uploads"!==r?t||"":Yt(e,t),a=this.getNaviInfoFromCache(),u=en(a,this.logger),c="",u||(c=JSON.stringify({uploadDomain:u})),l=Ji.encode(Lr,{type:e,key:s,httpMethod:n||"",queryString:r||"",url:o||"",ext:c,size:i?Math.ceil(i):0,ipType:a.ipType||0}),[4,this._connMgr.query(os.qnTkn,this.currentUserId,l,Pr)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return[2,p.sent().trans((function(e){return Ee(Ee({},e),{fileName:s,downloadAuthInfo:e.downloadAuthInfo?JSON.parse(e.downloadAuthInfo):null})}))]}}))}))},n.prototype.getFileUrl=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return this._isConnected?(o=this.getNaviInfoFromCache(),s="",a="",t===exports.UploadMethod.QINIU?i=os.qnUrl:t===exports.UploadMethod.AWS?i=os.s3Url:t===exports.UploadMethod.STC?i=os.stcUrl:t===exports.UploadMethod.MINIO?(i=os.minioUrl,s=en(o,this.logger),a=JSON.stringify({url:s})):i=os.aliUrl,u=Ji.encode(Ur,{type:e,key:n,fileName:r,ext:a,size:-1,ipType:o.ipType||0}),[4,this._connMgr.query(i,this.currentUserId,u,br)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return[2,c.sent().trans((function(e){return{downloadUrl:e.downloadUrl}}))]}}))}))},n.prototype.disconnect=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){switch(e.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return e.sent(),this._resetMemoryState(),[2]}}))}))},n.prototype._resetMemoryState=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData(),this._joinedChrmManager&&(this._joinedChrmManager.clear(),delete this._joinedChrmManager),this._conversationManager&&delete this._conversationManager,this._ultraGroupManager&&delete this._ultraGroupManager,this._userSettingManager&&delete this._userSettingManager,this._readReceiptManager&&delete this._readReceiptManager,this._subscribeManager&&delete this._subscribeManager,this._chrmsQueue={}},n.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},n.prototype.registerMessageType=function(e,t,n,r,o){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:o}},n.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},n.prototype.getCurrentUserId=function(){return this.currentUserId},n.prototype.createTag=function(e){return Te(this,void 0,void 0,(function(){var t=this;return Ce(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return Te(t,void 0,void 0,(function(){var t,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),r=new zs(os[os.addSeTag],t,this.currentUserId),[4,this._connMgr.send(r,co)];case 1:return o=u.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&s&&(a=s.version,this._userSettingManager.addTag([Ee(Ee({},e),{createdTime:a})],a)),[2,{code:i}]}}))}))}))]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.removeTag=function(e){return Te(this,void 0,void 0,(function(){var t=this;return Ce(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return Te(t,void 0,void 0,(function(){var t,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeRemoveTag([e],n),r=new zs(os[os.delSeTag],t,this.currentUserId),[4,this._connMgr.send(r,co)];case 1:return o=u.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&s&&(a=s.version,this._userSettingManager.deleteTag([e],a)),[2,{code:i}]}}))}))}))]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.updateTag=function(e){return Te(this,void 0,void 0,(function(){var t=this;return Ce(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return Te(t,void 0,void 0,(function(){var t,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),r=new zs(os[os.addSeTag],t,this.currentUserId),[4,this._connMgr.send(r,co)];case 1:return o=u.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&(a=s.version,this._userSettingManager.addTag([e],a)),[2,{code:i}]}}))}))}))]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.getTagList=function(){return Te(this,void 0,void 0,(function(){var e,t;return Ce(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:exports.ErrorCode.SUCCESS,data:e}]}))}))},n.prototype.addTagForConversations=function(e,t){return Te(this,void 0,void 0,(function(){var n=this;return Ce(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return Te(n,void 0,void 0,(function(){var n,o,i,s,a,u,c=this;return Ce(this,(function(l){switch(l.label){case 0:return this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,r),o=new zs(os[os.addTag],n,this.currentUserId),[4,this._connMgr.send(o,Ro)]):[2,{code:exports.ErrorCode.TAG_NOT_EXIST}];case 1:return i=l.sent(),s=i.code,a=i.data,s===exports.ErrorCode.SUCCESS&&a&&((u={})[e]={},t.forEach((function(e){c._conversationManager.addTagStatus(e.conversationType,e.targetId,u,e.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:s}]}}))}))}))]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.removeTagForConversations=function(e,t){return Te(this,void 0,void 0,(function(){var n=this;return Ce(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return Te(n,void 0,void 0,(function(){var n,o,i,s,a,u=this;return Ce(this,(function(c){switch(c.label){case 0:return n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,r),o=new zs(os[os.delTag],n,this.currentUserId),[4,this._connMgr.send(o,Ro)];case 1:return i=c.sent(),s=i.code,a=i.data,s===exports.ErrorCode.SUCCESS&&a&&(t.forEach((function(t){u._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:s}]}}))}))}))]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.removeTagsForConversation=function(e,t){return Te(this,void 0,void 0,(function(){var n=this;return Ce(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return Te(n,void 0,void 0,(function(){var n,o,i,s,a,u,c,l,p;return Ce(this,(function(d){switch(d.label){case 0:return n=e.conversationType,o=e.targetId,i=e.channelId,s=t.map((function(e){return{tagId:e}})),a=this._connMgr.codec.encodeUpdateConversationTag(s,[e],r),u=new zs(os[os.delTag],a,this.currentUserId),[4,this._connMgr.send(u,Ro)];case 1:return c=d.sent(),l=c.code,p=c.data,l===exports.ErrorCode.SUCCESS&&p&&(this._conversationManager.deleteTagStatus(n,o,t,i),this._conversationManager.setConversationUpdatedTime(p.version)),[2,{code:l}]}}))}))}))]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.getConversationListByTag=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c,l,p;return Ce(this,(function(d){switch(d.label){case 0:return this._isConnected?(o=(r=this).currentUserId,i=r._connMgr,s=i.codec.encodeOldConversationList({count:n,type:exports.ConversationType.PRIVATE,startTime:t}),a=new zs(os.qryRelationR,s,o),[4,i.send(a,Fr,{currentUserId:o,connectedTime:i.getConnectedTime()})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return u=d.sent(),c=u.code,l=u.data,c!==exports.ErrorCode.SUCCESS?[2,{code:c}]:(p=this._conversationHasTagFilter(e,null==l?void 0:l.list),[2,{code:c,data:p}])}}))}))},n.prototype._conversationHasTagFilter=function(e,t){var n=this,r=[],o=[];function i(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var i=t.conversationType,s=t.targetId,a=t.channelId,u=n._conversationManager.get(i,s,a),c=u.hasMentioned,l=u.mentionedInfo,p=u.lastUnreadTime,d=u.notificationStatus,h=u.isTop,_=u.tags,g=u.unreadMessageCount,f=_&&_[e];if(f){var E=Ee(Ee({},t),{hasMentioned:c,mentionedInfo:l,lastUnreadTime:p,notificationStatus:d,isTop:h,unreadMessageCount:g});f.isTop?r.push(Ee(Ee({},E),{isTopInTag:!0})):o.push(Ee(Ee({},E),{isTopInTag:!1}))}})),r.sort(i),o.sort(i),ye(ye([],ve(r),!1),ve(o),!1)},n.prototype.getUnreadCountByTag=function(e,t){return Te(this,void 0,void 0,(function(){var n;return Ce(this,(function(r){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:exports.ErrorCode.SUCCESS,data:n}]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.setConversationStatusInTag=function(e,t,n){return Te(this,void 0,void 0,(function(){var r=this;return Ce(this,(function(o){return this._isConnected?[2,this._conversationManager.pushTask((function(o){return Te(r,void 0,void 0,(function(){var r,i,s,a,u,c,l,p,d,h,_,g;return Ce(this,(function(f){switch(f.label){case 0:return r=t.targetId,i=t.conversationType,s=t.channelId,a=n.isTop,u=[{tagId:e,isTop:a}],(c=this._conversationManager.get(i,r,s)).tags&&Object.hasOwnProperty.call(c.tags,e)?(l=this._connMgr.codec.encodeUpdateConversationTag(u,[t],o),p=new zs(os[os.addTag],l,this.currentUserId),[4,this._connMgr.send(p,Ro)]):[2,{code:exports.ErrorCode.NO_TAG_IN_CONVER}];case 1:return d=f.sent(),h=d.code,_=d.data,h===exports.ErrorCode.SUCCESS&&_&&((g={})[e]={},a&&(g[e].isTop=!0),this._conversationManager.addTagStatus(i,r,g,s),this._conversationManager.setConversationUpdatedTime(_.version)),[2,{code:h}]}}))}))}))]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.getTagsForConversation=function(e){var t;return Te(this,void 0,void 0,(function(){var n,r,o,i;return Ce(this,(function(s){if(!this._isConnected)return[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),o=[],n.tags)for(i in n.tags)o.push({tagId:i,tagName:null===(t=r[i])||void 0===t?void 0:t.tagName});return[2,{code:exports.ErrorCode.SUCCESS,data:o}]}))}))},n.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:e})},n.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})},n.prototype.getUnreadConversationList=function(e){return Te(this,void 0,void 0,(function(){var t;return Ce(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})]}))}))},n.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===exports.ConversationType.ULTRA_GROUP?(null===(t=this._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.conversationType,e.targetId,e.channelId),n=this._getUnreadCount(n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})},n.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:e})},n.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===exports.ConversationType.ULTRA_GROUP)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});var r;if(!(r=e===exports.ConversationType.ULTRA_GROUP?this._ultraGroupManager.get(exports.ConversationType.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:exports.NotificationLevel.NOT_SET});var o=r.notificationLevel;return gt(r.notificationLevel)&&!gt(r.notificationStatus)&&(o=exports.NotificationStatus.OPEN===r.notificationStatus?1:0),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:o})},n.prototype.getConversationNotificationStatus=function(e,t,n){var r;return(r=e===exports.ConversationType.ULTRA_GROUP?this._ultraGroupManager.get(exports.ConversationType.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:exports.ErrorCode.SUCCESS,data:exports.NotificationStatus.CLOSE})},n.prototype.setConversationTypeNotificationLevel=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s=this;return Ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(r=(n=this).currentUserId,o=n._connMgr,i=this._conversationManager.getConversationUpdatedTime(),[4,o.query(os.setTypeUnpush,r,Ji.encode(vo,{type:e,unpushLevel:t,version:i}),yo)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return[2,a.sent().trans((function(n){var r,o=n.version;s._conversationManager.setConversationUpdatedTime(o),e===exports.ConversationType.ULTRA_GROUP?null===(r=s._ultraGroupManager)||void 0===r||r.addUltraGroupStatus({conversationType:e,targetId:"",notificationLevel:t,channelId:""}):s._conversationManager.addStatus({conversationType:e,targetId:"",channelId:"",updatedTime:o,notificationLevel:t},!0)}))]}}))}))},n.prototype.getConversationTypeNotificationLevel=function(e){if(e===exports.ConversationType.ULTRA_GROUP){var t=this._ultraGroupManager.get(e,"","");return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t.notificationLevel||0})}var n=this._conversationManager.get(e,"","");return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n.notificationLevel||0})},n.prototype.getRemoteHistoryMessages=function(e,t,n,r,o,i){return this.getHistoryMessage(e,t,n,r,o,i)},n.prototype.getUltraGroupList=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i=this;return Ce(this,(function(s){return t=e.targetId,n=e.channelType,this._isUltraGroupListExist?(r=(r=Object.values(this._ultraGroupMap).filter((function(e){return!(e.targetId!==t&&t||e.channelType!==n&&ct(n))}))).map((function(e){var t=e.unreadMessageCount,n=e.unreadMentionedCount,r=e.unreadMentionedMeCount;return t=i._getUnreadCount(t),n=i._getUnreadCount(n),r=i._getUnreadCount(r),Ee(Ee({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:r})})),r=Ac(r),o=Ot(r),[2,{code:exports.ErrorCode.SUCCESS,data:o}]):[2,{code:exports.ErrorCode.METHOD_NOT_AVAILABLE}]}))}))},n.prototype._getUnreadCount=function(e){return e>999?999:e},n.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===exports.NotificationStatus.OPEN||e.notificationLevel>0)&&t.push({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})},n.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})},n.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});var n=0;for(var r in this._ultraGroupMap){r.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=this._ultraGroupMap[r].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})},n.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var r in this._ultraGroupMap){var o=this._ultraGroupMap[r];o.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=o.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})},n.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(r){var o=t._ultraGroupMap[r];e.includes(o.targetId)&&n.push({type:o.conversationType,targetId:o.targetId,channelId:o.channelId,unreadMessageCount:t._getUnreadCount(o.unreadMessageCount),mentionedCount:t._getUnreadCount(o.unreadMentionedCount),mentionedMeCount:t._getUnreadCount(o.unreadMentionedMeCount),notificationLevel:o.notificationLevel})})),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:n})},n.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:exports.ErrorCode.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 t=this._getUnreadCount(t),Promise.resolve({code:exports.ErrorCode.SUCCESS,data:t})},n.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),Te(this,void 0,void 0,(function(){var n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),r=this._connMgr.codec.encodeClearUnreadCount({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(o=new $s(os[os.updUgRTime],r,this.currentUserId)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(o)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE]:[2,Promise.resolve(exports.ErrorCode.METHOD_NOT_AVAILABLE)];case 1:return(i=a.sent().code)===exports.ErrorCode.SUCCESS&&((s=this._ultraGroupMap["".concat(t,"_").concat(e)])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=n),s&&s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,i]}}))}))},n.prototype._getUltraGroupList=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l,p,d,h,_=this;return Ce(this,(function(g){switch(g.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeUltraGroup(e,false),n=new zs(os[os.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,Fr,{currentUserId:this.currentUserId,conversationType:exports.ConversationType.ULTRA_GROUP})]):[2];case 1:return r=g.sent(),o=r.code,i=r.data,o===exports.ErrorCode.SUCCESS&&i?(a=i.list,u=i.isFinished,a.forEach((function(e){e.notificationStatus=exports.NotificationStatus.CLOSE,e.notificationLevel=exports.NotificationLevel.NOT_SET,e.isTop=!1,_._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,_._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(o,", try again")),s=setTimeout((function(){_._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:l=g.sent(),p=l.code,d=l.data,p!==exports.ErrorCode.SUCCESS&&this.logger.warn(exports.LogTagId.O,"pullConversationStatus fail code: ".concat(p,", data: ").concat(d)),h=Object.values(this._ultraGroupMap),h=Ac(h),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Ot(h)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),g.label=4;case 4:return[2]}}))}))},n.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(),t()},n.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},n.prototype._notificationOnline=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r=this;return Ce(this,(function(o){switch(o.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return e=o.sent(),t=e.code,n=e.data,t===exports.ErrorCode.SUCCESS&&n?(this.logger.info(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){r._notificationOnline()}),3e3),[2])}}))}))},n.prototype._fetchUltraMsg=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new zs(os[os.pullUgMsg],t,this.currentUserId),r=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),r),[4,this._connMgr.send(n,Or,{currentUserId:this.currentUserId,conversation:{conversationType:exports.ConversationType.ULTRA_GROUP}})];case 1:return o=l.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&s?(a=s.list,u=s.syncTime,c=a.map((function(e){return e.messageUId})).join(","),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:i,messageUIds:c,timestamp:e,syncTime:u}),r)):this.logger.warn(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:i,timestamp:e}),r),[2,{code:i,data:s}]}}))}))},n.prototype._getUltraGroup=function(e,t,n){var r,o,i,s=e.targetId,a=e.messageType,u=e.channelId,c=e.isCounted,l=e.channelType,p=e.sentTime,d=e.senderUserId,h=e.content,_=e.isMentioned,g=this._ultraGroupMap["".concat(u,"_").concat(s)],f=g||{conversationType:exports.ConversationType.ULTRA_GROUP,targetId:s,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:exports.NotificationStatus.CLOSE,notificationLevel:exports.NotificationLevel.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==exports.MessageType.RECALL&&(f.unreadMessageCount+=1,f.unreadMentionedCount+=t,f.firstUnreadMessage||(f.firstUnreadMessage={sentTime:p}),_&&(null===(r=null==h?void 0:h.mentionedInfo)||void 0===r?void 0:r.type)!==exports.MentionedType.ALL&&(null===(i=null===(o=null==h?void 0:h.mentionedInfo)||void 0===o?void 0:o.userIdList)||void 0===i?void 0:i.includes(this.currentUserId))&&(f.unreadMentionedMeCount+=1)),f.versionTime=n,f.latestMessage=e,f.channelType=l,g||(this._ultraGroupMap["".concat(u,"_").concat(s)]=f),f},n.prototype._syncUltraMsg=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l=this;return Ce(this,(function(p){switch(p.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=p.sent(),n=t.code,r=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===exports.ErrorCode.SUCCESS&&r?(o=r.list,i=r.syncTime,s=r.finished,a={},u=[],o.forEach((function(e){var t,n,r,o=e.targetId,s=e.content,c=e.messageUId,p=e.channelId,d=e.isMentioned;if(l._ultraMsgMap[c])delete l._ultraMsgMap[c];else{var h=0;d&&((null===(t=null==s?void 0:s.mentionedInfo)||void 0===t?void 0:t.type)===exports.MentionedType.ALL||(null===(r=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(l.currentUserId)))&&(h=1);var _=l._getUltraGroup(e,h,i);a["".concat(p,"_").concat(o)]=_,l._ultraGroupManager.addUltraGroupStatus(_),u.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(exports.LogTagId.O,"notice ultragroups"),c=Object.values(a),c=Ac(c),this._watcher.conversation(Ot(c))),this.logger.debug(exports.LogTagId.O,"notice ultragroup message"),this._batchMessage(u),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>i})),this._lastSyncUltraMsgTimeStamp=i,s?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(i)),[2]):(this._syncUltraMsg(i),[2])):[2]}}))}))},n.prototype.sendUltraMessage=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c,l,p,d,h,_,g;return Ce(this,(function(f){switch(f.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(exports.LogTagId.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),o=t.messageId?t.messageId:Wt(),t.messageId=o,i=this._connMgr.codec.encodeUpMsg({conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e},t),(s=new $s(os[os.ugMsg],i,e)).setHeaderQos(cs.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=mc(exports.ConversationType.ULTRA_GROUP,e,Ee({},t),"",a,this.currentUserId,o),n&&n(o),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e,channelId:t.channelId}),r),c=Date.now(),[4,this._connMgr.send(s)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return l=f.sent(),p=l.code,d=l.data,p!==exports.ErrorCode.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:u.messageUId,messageId:u.messageId}),r),this._writeMessagesLog(exports.ConversationType.ULTRA_GROUP)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({channel:exports.ConversationType.ULTRA_GROUP,start_ts:c,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),u.sentStatus=exports.SentStatus.FAILED,[2,{code:p,data:u}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:null==d?void 0:d.messageUId,messageId:null==d?void 0:d.messageId}),r),h=d,this._writeMessagesLog(exports.ConversationType.ULTRA_GROUP,h.messageUId)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({msg_id:h.messageUId,channel:exports.ConversationType.ULTRA_GROUP,start_ts:c,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),u.sentTime=h.timestamp,u.messageUId=h.messageUId,this._ultraMsgMap[h.messageUId]=h.timestamp,_=t.channelId||"",(g=this._ultraGroupMap["".concat(_,"_").concat(e)])?(g.latestMessage=u,ct(g.channelType)&&(u.channelType=g.channelType)):(g={conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e,channelId:_,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:exports.NotificationStatus.CLOSE,notificationLevel:exports.NotificationLevel.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(_,"_").concat(e)]=g,this._ultraGroupManager.addUltraGroupStatus(g)),this._watcher.conversation(Ot([g])),[2,{code:p,data:u}])}}))}))},n.prototype.sendUltraGroupTypingStatus=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=e.conversationType,r=e.channelId,o=e.targetId,i=this._connMgr.codec.encodeOperateStatus(o,n,r||"",t||0),(s=new $s(os[os.operate],i,o)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==exports.ErrorCode.SUCCESS?[2,{code:a,msg:exports.ErrorCode[a]}]:[2,{code:a}]}}))}))},n.prototype.getUltraGroupMessageListByMessageUId=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return this._isConnected?e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:exports.ErrorCode.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(r=new zs(os[os.qryMsg],n,this.currentUserId)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(r,Fo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return o=u.sent(),i=o.code,s=o.data,i!==exports.ErrorCode.SUCCESS?[2,{code:i,msg:exports.ErrorCode[i]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(e){var n=e.messageUId;t[n]=e})),[2,{code:0,data:t}])}}))}))},n.prototype._pullOperateStatusNotify=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.pbData,ko),n=t.conversationType,r=t.info,o=t.summary;this.logger.debug(exports.LogTagId.O,"s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(o)),this._watcher.operateStatus(t)}},n.prototype.expandUltraMessage=function(e){return Te(this,void 0,void 0,(function(){var t,n,r;return Ce(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new zs(os[os.upMsgEx],t,e.targetId)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return(r=o.sent().code)!==exports.ErrorCode.SUCCESS?[2,{code:r,msg:exports.ErrorCode[r]}]:[2,{code:r}]}}))}))},n.prototype.modifyMessage=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new zs(os[os.modifyMsg],t,e.targetId)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),o=r.code,i=r.data,o!==exports.ErrorCode.SUCCESS?[2,{code:o,msg:exports.ErrorCode[o]}]:(s=i,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:o}])}}))}))},n.prototype._handleEventChangeList=function(e){var t={Group:{map:{},types:Nc},Friend:{map:{},types:Oc}},n=function(e,t,n){e[t]||(e[t]=[]),e[t].push(n)};e.forEach((function(e){var r=e.changeType;for(var o in t)if(t[o].types.includes(r)){n(t[o].map,r,e);break}}));var r={Group:this._processChangeMapGroup.bind(this),Friend:this._processChangeMapFriend.bind(this)};for(var o in t)Object.keys(t[o].map).length>0&&r[o](t[o].map)},n.prototype._pullUltraChangeMessageList=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new zs(os[os.qryMsgChange],t,this.currentUserId)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(n,Vo)]):[2];case 1:return r=p.sent(),o=r.code,i=r.data,this._isPullingUltraChangeMessage=!1,o===exports.ErrorCode.SUCCESS&&i?(s=i.hasNext,a=i.list,u=(null==i?void 0:i.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(l=this._pullUltraChangeMessageQue).push.apply(l,ye([],ve(c),!1)),s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]):[2]}}))}))},n.prototype._handleUltraChangeList=function(e){var t={};e.forEach((function(e){var n=e.changeType;t[n]||(t[n]=[]),t[n].push(e)}));var n=k.CHANNEL_CHANGE,r=k.MSG_RECALL,o=k.MSG_EXPANSION,i=k.MSG_MODIFY,s=k.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[r]&&this._handleMsgRecall(t[r]),t[o]&&this._handleMsgUpdate(t[o]),t[i]&&this._handleMsgUpdate(t[i]),t[s]&&this._handleUserGroupStatus(t[s])},n.prototype._processChangeMapGroup=function(e){var t=S.GROUP_OPERATION,n=S.GROUP_PROFILE_CHANGE,r=S.GROUP_APPLICATION_INVITATION,o=S.GROUP_FOLLOW_USER_CHANGE;e[t]&&this._handleGroupOperation(e[t]),e[n]&&this._handleGroupProfileChange(e[n]),e[r]&&this._handleApplication(e[r]),e[o]&&this._handleFollowUserChange(e[o])},n.prototype._processChangeMapFriend=function(e){var t=this;(e[l.FRIEND_APPLICATION]||[]).forEach((function(e){var n,r,o,i,s,a,u,c,l,d,h=e.subChangeType,_=e.businessId,g=e.time,f=e.eventData,E=p.FRIEND_APPLY,I=p.FRIEND_REFUSE,T=p.FRIEND_USER_INFO,C=p.FRIENDS_INPUT,R=p.FRIEND_CLEAR,v=p.FRIEND_INFO_CHANGE,y=p.FRIEND_INFO_CHANGE_SYNC;switch(h){case E:case I:var S=h===E?exports.FriendApplicationStatus.UNHANDLED:exports.FriendApplicationStatus.REFUSED;null===(r=(n=t._watcher).friendApplicationStatusChanged)||void 0===r||r.call(n,{userId:_,applicationType:f.applyType,applicationStatus:S,directionType:f.friendType,operationTime:g,extra:f.info||""});break;case T:null===(i=(o=t._watcher).friendAdd)||void 0===i||i.call(o,{userId:_,name:f.name,portraitUri:f.portraitUrl,directionType:f.friendType,operationTime:g});break;case C:null===(a=(s=t._watcher).friendDelete)||void 0===a||a.call(s,{userIds:f.targetId,directionType:f.type,operationTime:g});break;case R:null===(c=(u=t._watcher).friendCleared)||void 0===c||c.call(u,g);break;case v:break;case y:null===(d=(l=t._watcher).friendInfoChangedSync)||void 0===d||d.call(l,{userId:_,remark:f.remarkname,extProfile:f.extProfile,operationTime:g})}}))},n.prototype._handleGroupOperation=function(e){var t=this;e.forEach((function(e){var n,r,o,i,s=e.subChangeType,a=e.businessId,u=e.time,c=e.eventData,l=c.optUserInfo,p=c.channelInfo,d=c.userInfos,h={groupId:a,operation:s,operationTime:u};l&&(n=ve(Gt([l]),1),h.operatorInfo=n[0]),s===exports.GroupOperation.CREATE&&(r=ve(xt([p]),1),h.groupInfo=r[0]),[exports.GroupOperation.CREATE,exports.GroupOperation.DISMISS].includes(s)||(h.memberInfos=Gt(d)),null===(i=(o=t._watcher).groupOperation)||void 0===i||i.call(o,h)}))},n.prototype._handleGroupProfileChange=function(e){var t=this;e.forEach((function(e){var n,r,o,i,s,a,u=e.businessId,c=e.time,l=e.eventData,p=e.subChangeType,d=e.secondaryId;switch(p){case T.GROUP_INFO_CHANGE:var h=ve(Gt([l.optUserInfo]),1)[0],_=ve(Dt([l.channelInfo]),1)[0],g=ve(l.channelFullInfo?Dt([l.channelFullInfo]):[void 0],1)[0];null===(r=(n=t._watcher).groupInfoChanged)||void 0===r||r.call(n,{operatorInfo:h,groupInfo:_,changedGroupInfo:_,operationTime:c,fullGroupInfo:g});break;case T.MEMBER_PROFILE_CHANGE:h=ve(Gt([l.optUserInfo]),1)[0];var f=Gt(l.userInfos)[0];null===(i=(o=t._watcher).groupMemberInfoChanged)||void 0===i||i.call(o,{groupId:u,operatorInfo:h,memberInfo:f,operationTime:c});break;case T.GROUP_REMARK_DELETE:case T.GROUP_REMARK_SET:var E=p===T.GROUP_REMARK_SET?exports.GroupOperationType.ADD:exports.GroupOperationType.REMOVE;null===(a=(s=t._watcher).groupRemarkChangedSync)||void 0===a||a.call(s,{groupId:u,operationType:E,operationTime:c,groupRemark:d})}}))},n.prototype._handleApplication=function(e){var t=this;e.forEach((function(e){var n=e.eventData.statusInfo;Bt(n).forEach((function(e){var n,r;null===(r=(n=t._watcher).groupApplicationEvent)||void 0===r||r.call(n,e)}))}))},n.prototype._handleFollowUserChange=function(e){var t=this;e.forEach((function(e){var n,r,o=e.subChangeType,i=e.businessId,s=e.time,a=e.userGroupIds,u=1===o?exports.GroupOperationType.ADD:exports.GroupOperationType.REMOVE;null===(r=(n=t._watcher).groupFollowsChangedSync)||void 0===r||r.call(n,{groupId:i,operationType:u,operationTime:s,userIds:a})}))},n.prototype._handleUltraChannelChange=function(e){var t=this,n=[],r=[],o=[];e.forEach((function(e){var i=e.subChangeType,s=e.targetId,a=e.channelId,u=e.sendTime,c=e.operatorId,l="".concat(a,"_").concat(s),p=t._ultraGroupMap[l];if(p){var d=H.PUBLIC_TO_PRIVATE,h=H.PRIVATE_TO_PUBLIC,_=H.PUBLIC_TO_PRIVATE_USER_NOT_IN,g=H.CHANNEL_DELETE,f=H.CHANNEL_USER_KICKED;switch(i){case h:p.channelType=exports.UltraGroupChannelType.PUBLIC,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PRIVATE_TO_PUBLIC,channelType:p.channelType});break;case d:p.channelType=exports.UltraGroupChannelType.PRIVATE,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE,channelType:p.channelType});break;case _:n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:p.channelType}),delete t._ultraGroupMap[l];break;case g:r.push({targetId:s,channelId:a,channelType:p.channelType,deleteTime:u}),delete t._ultraGroupMap[l];break;case f:o.push({targetId:s,channelId:a,userId:c,channelType:exports.UltraGroupChannelType.PRIVATE}),c===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),r.length>0&&this._watcher.ultraGroupChannelDelete(r),o.length>0&&this._watcher.ultraGroupChannelUserKicked(o)},n.prototype._handleMsgRecall=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,o=e.channelId,i=e.messageUId,s=e.sendTime,a=e.conversationType,u=e.operatorId,c=e.mentionedType;t._updateUltraGroupWhenRecallMsg(r,o,i,s,c),n.push({targetId:r,conversationType:a,sentTime:s,messageUId:i,senderUserId:u,channelId:o,content:{conversationType:a,targetId:r,messageUId:i,channelId:o},messageDirection:1,messageType:exports.MessageType.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:exports.ReceivedStatus.UNREAD,receivedStatusInfo:Mt(exports.ReceivedStatus.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(n)},n.prototype._handleMsgUpdate=function(e){var t={};for(var n in e.forEach((function(e){var n=e.targetId,r=e.conversationType,o=e.sendTime,i=e.messageUId,s=e.channelId,a="".concat(r,"_").concat(n);t[a]||(t[a]=[]),t[a].push({messageUId:i,channelId:s,sendTime:o})})),t){var r=n.split("_"),o=r.shift(),i=r.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:i,conversationType:Number(o),messages:ye([],ve(t[n]),!1)})}},n.prototype._pullUltraMessageList=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c=this;return Ce(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(r=new zs(os[os.qryMsg],n,this.currentUserId)).setHeaderQos(cs.AT_LEAST_ONCE),[4,this._connMgr.send(r,Fo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return o=l.sent(),i=o.code,s=o.data,i!==exports.ErrorCode.SUCCESS?[2,{code:i,msg:exports.ErrorCode[i]}]:(a=(s||{}).list,u=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,o=c._ultraGroupMap["".concat(n,"_").concat(t)];o&&o.latestMessage.messageUId===r&&(o.latestMessage=e),u.push(e)})),e===k.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===k.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},n.prototype._handleUserGroupStatus=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l,p;return Ce(this,(function(d){return t=q.REMOVE_USER_GROUP,n=q.JOIN_USER_GROUP,r=q.EXIT_USER_GROUP,o=q.CHANNEL_BIND_USER_GROUP,i=q.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],l=[],e.forEach((function(e){var p=e.conversationType,d=e.targetId,h=e.userGroupIds,_=e.busChannelType,g=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:p,targetId:d},userGroupIds:h});break;case n:a.push({conversation:{conversationType:p,targetId:d},userGroupIds:h});break;case r:u.push({conversation:{conversationType:p,targetId:d},userGroupIds:h});break;case o:c.push({conversation:{conversationType:p,targetId:d,channelId:g},channelType:_,userGroupIds:h});break;case i:l.push({conversation:{conversationType:p,targetId:d,channelId:g},channelType:_,userGroupIds:h})}})),p={},s.length>0&&(p.userGroupDisband=s),a.length>0&&(p.userAdded=a),u.length>0&&(p.userRemoved=u),c.length>0&&(p.userGroupBindChannel=c),l.length>0&&(p.userGroupUnBindChannel=l),this._watcher.userGroupStatus(p),[2]}))}))},n.prototype.getUltraHistoryMsg=function(e,t,n){var r;return Te(this,void 0,void 0,(function(){var o,i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=this._connMgr.codec.encodeGetHistoryMsg(e,t),i=new zs(os[os.qryUgMsg],o,this.currentUserId),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:exports.ConversationType.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count}),n),[4,this._connMgr.send(i,Wr,{currentUserId:this.currentUserId,conversation:{conversationType:exports.ConversationType.ULTRA_GROUP,targetId:e}})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,a===exports.ErrorCode.SUCCESS&&u?(c=[],null===(r=u.list)||void 0===r||r.forEach((function(e){e&&c.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},n.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(r=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),o=new zs(os[os.ugUnpushSet],r,e),[4,this._connMgr.send(o)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE})];case 1:return i=a.sent(),s=i.code,exports.ErrorCode.SUCCESS,[2,{code:s}]}}))}))},n.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,r=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),o=new zs(os[os.ugUnpushQuery],r,e),[4,n.send(o,Co)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE})];case 1:return i=c.sent(),s=i.code,a=i.data,s===exports.ErrorCode.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[2,{code:s}]}}))}))},n.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n,r,o){var i="".concat(t,"_").concat(e);if(this._ultraGroupMap[i]){var s=this._ultraGroupMap[i],a=s.latestMessage,u=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),r&&u<r&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(o===Y.ALL||o===Y.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,o===Y.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(Ot([s])))}},n.prototype.getAllConversationState=function(){return Promise.resolve({code:exports.ErrorCode.SUCCESS,data:this._conversationManager.getAllConversationState()})},n.prototype.getUltraGroupUnreadMentionedMessages=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new zs(os[os.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,kr)]):[2,Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE})]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),o=r.code,i=r.data,o===exports.ErrorCode.SUCCESS&&i?[2,{code:o,data:i}]:[2,{code:o}]}}))}))},n.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o;return Ce(this,(function(i){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,r=this._ultraGroupMap["".concat(n,"_").concat(t)]||{},o=r.firstUnreadMessage||null,[2,{code:exports.ErrorCode.SUCCESS,data:o}]):[2,Promise.resolve({code:exports.ErrorCode.METHOD_NOT_AVAILABLE})]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.subscribeUser=function(e,t,n){return Te(this,void 0,void 0,(function(){return Ce(this,(function(r){return this._isConnected?[2,this._subscribeManager.updateSubscribeRelation(e,t,exports.SubscribeOperationType.SUBSCRIBE,n)]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.unSubscribeUser=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(n){switch(n.label){case 0:return this._isConnected?[4,this._subscribeManager.updateSubscribeRelation(e,t,exports.SubscribeOperationType.UNSUBSCRIBE)]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return[2,{code:n.sent().code}]}}))}))},n.prototype.getSubscribeUserList=function(e,t,n){var r;return Te(this,void 0,void 0,(function(){var o;return Ce(this,(function(i){return this._isConnected?(o=null===(r=this._subscribeManager)||void 0===r?void 0:r.getSubscribeUserList(e,t,n),[2,Promise.resolve({code:exports.ErrorCode.SUCCESS,data:o})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.getSubscribeUserStatus=function(e,t){var n;return Te(this,void 0,void 0,(function(){var r;return Ce(this,(function(o){return this._isConnected?(r=null===(n=this._subscribeManager)||void 0===n?void 0:n.getSubscribeUserStatus(e,t),[2,Promise.resolve({code:exports.ErrorCode.SUCCESS,data:r})]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.updateMyUserProfile=function(e){var t;return Te(this,void 0,void 0,(function(){var n,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=Ji.encode(ai,Se(this,r,"m",o).call(this,e)),[4,this._connMgr.query(os.updUserProfile,this.currentUserId,n,ci)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return(i=u.sent()).isOk?(s=i.data.version,null===(t=this._subscribeManager)||void 0===t||t.updateOwnProfile(e,s),[2,i.wipe()]):(a=i.data.censorFailedFields,[2,ot(i.code,"",a&&0!==a.length?{errorKeys:a,errorKey:a[0]}:void 0)])}}))}))},n.prototype.getMyUserProfile=function(){return this._isConnected?this._subscribeManager.getOwnProfile():Promise.resolve({code:exports.ErrorCode.RC_NET_UNAVAILABLE})},n.prototype.getUserProfiles=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(t){return this._isConnected?[2,this._subscribeManager.getUserProfiles(e)]:[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}]}))}))},n.prototype.updateMyUserProfileVisibility=function(e){return Te(this,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeUserProfilePermission(e),n=new zs(os[os.updProfilePermiss],t,this.currentUserId),[4,this._connMgr.send(n)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return[2,{code:r.sent().code}]}}))}))},n.prototype.getMyUserProfileVisibility=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodeUserProfileInput(),t=new zs(os[os.qProfilePermiss],e,this.currentUserId),[4,this._connMgr.send(t,hi)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return n=i.sent(),r=n.code,o=n.data,r!==exports.ErrorCode.SUCCESS?[2,{code:r}]:[2,{code:r,data:null==o?void 0:o.permission}]}}))}))},n.prototype.searchUserProfileByUniqueId=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeSearchUserProfile(e),n=new zs(os[os.searchUserProfile],t,this.currentUserId),[4,this._connMgr.send(n,ai)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),o=r.code,i=r.data,o===exports.ErrorCode.SUCCESS&&i?(s=Ut(i.userId,i.userProfile,i.userExtProfile),[2,{code:o,data:s}]):[2,{code:o}]}}))}))},n.prototype.bindRTCRoomForChatroom=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),r=new zs(os[os.setRtcRoomId],n,t),[4,this._connMgr.send(r)]):[2,exports.ErrorCode.RC_NET_UNAVAILABLE];case 1:return o=i.sent(),[2,o.code]}}))}))},n.prototype.rtcSignaling=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return this._isConnected?(o=n?new zs(t,r,e):new $s(t,r,e),[4,this._connMgr.send(o)]):[2,{code:exports.ErrorCode.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),s=i.code,a=i.data,[2,{code:s,buffer:a instanceof ea||null==a?void 0:a.pbData}]}}))}))},n.prototype.rtcPing=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return r=as(this.rtcCodec,t,n),[4,this.rtcSignaling(e,os[os.rtcPing],!0,r)];case 1:return o=u.sent(),i=o.code,s=o.buffer,i!==exports.ErrorCode.SUCCESS?[2,{code:i}]:((a=this.rtcCodec.decode($i.RtcOutput,s)).version=vt(a.version),[2,{code:i,data:a}])}}))}))},n.prototype.getDeviceId=function(){return Da()},n.prototype.getOSInfo=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,{code:exports.ErrorCode.NOT_SUPPORT}]}))}))},n.prototype.getProcessInfo=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,{code:exports.ErrorCode.NOT_SUPPORT}]}))}))},n.prototype.getMainProcessInfo=function(){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,{code:exports.ErrorCode.NOT_SUPPORT}]}))}))},n.prototype.destroy=function(){Te(void 0,void 0,void 0,(function(){var e,t;return Ce(this,(function(n){switch(n.label){case 0:return qu?(Ju&&(clearTimeout(Ju),Ju=null),[4,qu]):[2];case 1:return(e=n.sent())&&(t=e.db,zu.push(t)),qu=null,[2]}}))}))},n.prototype.callExtra=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})},n.prototype.setProxy=function(e){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})},n.prototype.getProxy=function(){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})},n.prototype.testProxy=function(e,t){return Promise.resolve({status:exports.ErrorCode.NOT_SUPPORT})},n.prototype.setNetwork=function(e,t){var n;if(this._connMgr.setNetwork(e,t),e.status&&this.cloudControllerUri){var r=this._connMgr.getToken();null===(n=this.cloudController)||void 0===n||n.request(this.cloudControllerUri,cn.newWorkChange,r)}},n.prototype.createGroup=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return o=Mu(e,t,n,r),[4,this._connMgr.query(os.channelCreate,e,o,fi)];case 1:return(i=a.sent()).data?(s={errorKeys:i.data.censorFailedFields,processCode:i.data.processCode||0},[2,i.isOk?rt():ot(i.code,i.msg,s)]):[2,i.wipe()]}}))}))},n.prototype.updateGroupInfo=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){switch(i.label){case 0:return r=Mu(e,t,n),[4,this._connMgr.query(os.upChannelInfo,e,r,fi)];case 1:return(o=i.sent()).data?[2,o.isOk?rt():ot(o.code,o.msg,{errorKeys:o.data.censorFailedFields})]:[2,o.wipe()]}}))}))},n.prototype.getGroupsInfo=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeMultiChannels(e),n=new zs(os[os.qChannelInfo],t,e[0]),[4,this._connMgr.send(n,vi)];case 1:return r=u.sent(),o=r.code,i=r.data,o===exports.ErrorCode.SUCCESS&&i?(s=i.result.list,a=xt(void 0===s?[]:s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},n.prototype.kickGroupMembers=function(e,t,n){var r;return Te(this,void 0,void 0,(function(){var o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return o=this._connMgr.codec.encodeQuitGroup("kick",e,t,!0,n),i=new zs(os[os.channelMemKick],o,e),[4,this._connMgr.send(i,fi)];case 1:return s=c.sent(),a=s.code,u=s.data,a!==exports.ErrorCode.SUCCESS?[2,{code:a,msg:null!==(r=null==u?void 0:u.msg)&&void 0!==r?r:""}]:[2,{code:a}]}}))}))},n.prototype.quitGroup=function(e,t){var n;return Te(this,void 0,void 0,(function(){var r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return r=this._connMgr.codec.encodeQuitGroup("quit",e,[],!0,t),o=new zs(os[os.channelMemQuit],r,e),[4,this._connMgr.send(o,fi)];case 1:return i=u.sent(),s=i.code,a=i.data,s!==exports.ErrorCode.SUCCESS?[2,{code:s,msg:null!==(n=null==a?void 0:a.msg)&&void 0!==n?n:""}]:[2,{code:s}]}}))}))},n.prototype.dismissGroup=function(e){var t;return Te(this,void 0,void 0,(function(){var n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return n=this._connMgr.codec.encodeQuitGroup("dismiss",e),r=new zs(os[os.channelDismiss],n,e),[4,this._connMgr.send(r,fi)];case 1:return o=a.sent(),i=o.code,s=o.data,i!==exports.ErrorCode.SUCCESS?[2,{code:i,msg:null!==(t=null==s?void 0:s.msg)&&void 0!==t?t:""}]:[2,{code:i}]}}))}))},n.prototype.transferGroupOwner=function(e,t,n,r){var o;return Te(this,void 0,void 0,(function(){var i,s,a,u,c;return Ce(this,(function(l){switch(l.label){case 0:return i=this._connMgr.codec.encodeQuitGroup("transfer",e,[t],n,r),s=new zs(os[os.channelTransfer],i,e),[4,this._connMgr.send(s,fi)];case 1:return a=l.sent(),u=a.code,c=a.data,u!==exports.ErrorCode.SUCCESS?[2,{code:u,msg:null!==(o=null==c?void 0:c.msg)&&void 0!==o?o:""}]:[2,{code:u}]}}))}))},n.prototype.setGroupManagers=function(e,t,n){var r;return Te(this,void 0,void 0,(function(){var o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return o=this._connMgr.codec.encodeModifyChannelsInput(e,t,n),i=new zs(os[os.upChannelManager],o,t),[4,this._connMgr.send(i,fi)];case 1:return s=c.sent(),a=s.code,u=s.data,a!==exports.ErrorCode.SUCCESS?[2,{code:a,msg:null!==(r=null==u?void 0:u.msg)&&void 0!==r?r:""}]:[2,{code:a}]}}))}))},n.prototype.getGroupMembersByRole=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c,l,p,d,h;return Ce(this,(function(_){switch(_.label){case 0:return r=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupMembersByRole",groupId:e,option:n,roleType:t}),o=new zs(os[os.qChannelMem],r,e),[4,this._connMgr.send(o,vi)];case 1:return i=_.sent(),s=i.code,a=i.data,s===exports.ErrorCode.SUCCESS&&a?(u=a.result,c=a.page,p=(l=c||{}).pageToken,d=l.hasNext,[],h=Gt(u.list),[2,{code:s,data:{data:h,pageToken:d&&p?p:""}}]):[2,{code:s}]}}))}))},n.prototype.getGroupMembers=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return n=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupMembers",groupId:e,ids:t}),r=new zs(os[os.qChannelSpeMem],n,e),[4,this._connMgr.send(r,vi)];case 1:return o=c.sent(),i=o.code,s=o.data,i!==exports.ErrorCode.SUCCESS?[2,{code:i}]:s?(a=s.result,[],u=Gt(a.list),[2,{code:i,data:u}]):[2,{code:i,data:[]}]}}))}))},n.prototype.setGroupMemberInfo=function(e,t,n,r){return Te(this,void 0,void 0,(function(){var o,i;return Ce(this,(function(s){switch(s.label){case 0:return o=Ji.encode(yi,{targetId:e,type:exports.ConversationType.GROUP,userId:t,channelNickName:n,additional:r}),[4,this._connMgr.query(os.upChannelMem,e,o,fi)];case 1:return(i=s.sent()).data?[2,i.isOk?rt():ot(i.code,i.msg,{errorKeys:i.data.censorFailedFields})]:[2,i.wipe()]}}))}))},n.prototype.searchGroupMembers=function(e,t,n){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})},n.prototype.joinGroup=function(e){var t;return Te(this,void 0,void 0,(function(){var n,r,o,i,s;return Ce(this,(function(a){switch(a.label){case 0:return n=this._connMgr.codec.encodeJoinGroup("join",e),r=new zs(os[os.channelMemJoin],n,e),[4,this._connMgr.send(r,fi)];case 1:return o=a.sent(),i=o.code,s=o.data,[2,{code:i,data:{processCode:null!==(t=null==s?void 0:s.processCode)&&void 0!==t?t:0}}]}}))}))},n.prototype.inviteUsersToGroup=function(e,t){var n,r;return Te(this,void 0,void 0,(function(){var o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return o=this._connMgr.codec.encodeJoinGroup("invite",e,t),i=new zs(os[os.channelMemInvite],o,e),[4,this._connMgr.send(i,fi)];case 1:return s=c.sent(),a=s.code,u=s.data,a!==exports.ErrorCode.SUCCESS?[2,{code:a,msg:null!==(n=null==u?void 0:u.msg)&&void 0!==n?n:""}]:[2,{code:a,data:{processCode:null!==(r=null==u?void 0:u.processCode)&&void 0!==r?r:0}}]}}))}))},n.prototype.memberInviteResponse=function(e){var t,n;return Te(this,void 0,void 0,(function(){var r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return r=this._connMgr.codec.encodeMemberResponseInput(e),o=new zs(os[os.channelApplyResp],r,e.groupId),[4,this._connMgr.send(o,fi)];case 1:return i=u.sent(),s=i.code,a=i.data,s!==exports.ErrorCode.SUCCESS?[2,{code:s,msg:null!==(t=null==a?void 0:a.msg)&&void 0!==t?t:""}]:[2,{code:s,data:{processCode:null!==(n=null==a?void 0:a.processCode)&&void 0!==n?n:0}}]}}))}))},n.prototype.getGroupApplications=function(e,t,n){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l,p;return Ce(this,(function(d){switch(d.label){case 0:return t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupApplications",option:e}),n=new zs(os[os.qChannelApplyList],t,this.currentUserId),[4,this._connMgr.send(n,vi)];case 1:return r=d.sent(),o=r.code,i=r.data,o===exports.ErrorCode.SUCCESS&&i?(s=i.result,a=i.page,c=(u=a||{}).pageToken,l=u.hasNext,p=Bt(null==s?void 0:s.list)||[],[2,{code:o,data:{data:p,pageToken:l&&c?c:""}}]):[2,{code:o}]}}))}))},n.prototype.getJoinedGroupsByRole=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c,l,p,d;return Ce(this,(function(h){switch(h.label){case 0:return n=this._connMgr.codec.encodeChannelsQueryInput({type:"getJoinedGroupsByRole",option:t,roleType:e}),r=new zs(os[os.qChannelMemJoin],n,this.currentUserId),[4,this._connMgr.send(r,vi)];case 1:return o=h.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&s?(a=s.result,u=s.page,l=(c=u||{}).pageToken,p=c.hasNext,d=xt(a.list),[2,{code:i,data:{data:d,pageToken:p&&l?l:""}}]):[2,{code:i}]}}))}))},n.prototype.searchJoinedGroups=function(e,t){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})},n.prototype.getJoinedGroups=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeChannelsQueryInput({type:"getJoinedGroups",ids:e}),n=new zs(os[os.qChannelMemSpeJoin],t,this.currentUserId),[4,this._connMgr.send(n,vi)];case 1:return r=u.sent(),o=r.code,i=r.data,o===exports.ErrorCode.SUCCESS&&i?(s=i.result.list,a=xt(s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},n.prototype.setGroupRemark=function(e,t){return Te(this,void 0,void 0,(function(){var n,r;return Ce(this,(function(o){switch(o.label){case 0:return n=this._connMgr.codec.encodeSetGroupRemark(e,t),r=new zs(os[os.upChannelRemark],n,e),[4,this._connMgr.send(r)];case 1:return[2,{code:o.sent().code}]}}))}))},n.prototype.setGroupFollows=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){switch(i.label){case 0:return r=this._connMgr.codec.encodeSetGroupFollows(e,t,n),o=new zs(os[os.upChannelFollow],r,t),[4,this._connMgr.send(o)];case 1:return[2,{code:i.sent().code}]}}))}))},n.prototype.getGroupFollows=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupFollows",groupId:e}),n=new zs(os[os.qChannelFollow],t,this.currentUserId),[4,this._connMgr.send(n,vi)];case 1:return r=u.sent(),o=r.code,i=r.data,o===exports.ErrorCode.SUCCESS&&i?(s=i.result,c=s.list,a=c.map((function(e){var t=e.userId,n=e.opTime;return{userId:t,time:vt(n)}})),[2,{code:o,data:a}]):[2,{code:o}]}var c}))}))},n.prototype.addFriend=function(e,t,n){var r;return Te(this,void 0,void 0,(function(){var o,i,s,a,u;return Ce(this,(function(c){switch(c.label){case 0:return o=this._connMgr.codec.encodeFriendInput({targetId:e,type:t,info:n}),i=new zs(os[os.friendAdd],o,this.currentUserId),[4,this._connMgr.send(i,fi)];case 1:return s=c.sent(),a=s.code,u=s.data,a===exports.ErrorCode.SUCCESS&&u?[2,{code:a,data:{processCode:null!==(r=null==u?void 0:u.processCode)&&void 0!==r?r:0}}]:[2,{code:a}]}}))}))},n.prototype.deleteFriends=function(e,t){return Te(this,void 0,void 0,(function(){var n,r;return Ce(this,(function(o){switch(o.label){case 0:return n=this._connMgr.codec.encodeFriendsInput(e,t),r=new zs(os[os.friendDel],n,this.currentUserId),[4,this._connMgr.send(r)];case 1:return[2,{code:o.sent().code}]}}))}))},n.prototype.acceptFriendApplication=function(e){return Te(this,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return t=this._connMgr.codec.encodeFriendInput({targetId:e,type:1}),n=new zs(os[os.friendHandle],t,this.currentUserId),[4,this._connMgr.send(n)];case 1:return[2,{code:r.sent().code}]}}))}))},n.prototype.refuseFriendApplication=function(e,t){return Te(this,void 0,void 0,(function(){var n,r;return Ce(this,(function(o){switch(o.label){case 0:return n=this._connMgr.codec.encodeFriendInput({targetId:e,type:2,info:t}),r=new zs(os[os.friendHandle],n,this.currentUserId),[4,this._connMgr.send(r)];case 1:return[2,{code:o.sent().code}]}}))}))},n.prototype.setFriendInfo=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o;return Ce(this,(function(i){switch(i.label){case 0:return r=Ji.encode(Mi,{targetId:e,remarkName:t,extProfile:Ou(n)}),[4,this._connMgr.query(os.friendSetPf,this.currentUserId,r,Li)];case 1:return(o=i.sent()).isOk?[2,o.wipe()]:[2,ot(o.code,"",{errorKeys:o.data.censorFailedFields})]}}))}))},n.prototype.checkFriends=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeFriendsInput(e,t),r=new zs(os[os.friendCheck],n,this.currentUserId),[4,this._connMgr.send(r,Oi)];case 1:return o=u.sent(),i=o.code,s=o.data,i!==exports.ErrorCode.SUCCESS?[2,{code:i}]:s?(a=s.list.map((function(e){return{userId:e.targetId,relationType:e.status}})),[2,{code:i,data:a}]):[2,{code:i,data:[]}]}}))}))},n.prototype.getFriends=function(e,t){return Te(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c,l,p;return Ce(this,(function(d){switch(d.label){case 0:return n=this._connMgr.codec.encodeFriendQueryInput(11,t,e),r=new zs(os[os.friendsQuery],n,this.currentUserId),[4,this._connMgr.send(r,vi)];case 1:return o=d.sent(),i=o.code,s=o.data,i===exports.ErrorCode.SUCCESS&&s?(a=s.result,u=s.page,l=(c=u||{}).pageToken,p=c.hasNext,a&&a.list?[2,{code:i,data:{data:Pc(a.list),pageToken:p&&l?l:""}}]:[2,{code:i,data:{data:[],pageToken:p&&l?l:""}}]):[2,{code:i}]}}))}))},n.prototype.getFriendApplications=function(e,t,n){return Te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,c,l;return Ce(this,(function(p){switch(p.label){case 0:return t=this._connMgr.codec.encodeFriendQueryInput(12,e),n=new zs(os[os.friendsQuery],t,this.currentUserId),[4,this._connMgr.send(n,vi)];case 1:return r=p.sent(),o=r.code,i=r.data,o!==exports.ErrorCode.SUCCESS?[2,{code:o}]:i?(s=i.result,a=i.page,c=(u=a||{}).pageToken,l=u.hasNext,[2,{code:o,data:{data:bc(s),pageToken:l&&c?c:""}}]):[2,{code:o,data:{data:[],pageToken:""}}]}}))}))},n.prototype.deleteFriendApplication=function(e,t){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,{code:exports.ErrorCode.NOT_SUPPORT}]}))}))},n.prototype.getFriendsInfo=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return t=this._connMgr.codec.encodeFriendsListInput(e),n=new zs(os[os.friendsInfoQry],t,this.currentUserId),[4,this._connMgr.send(n,xi)];case 1:return r=s.sent(),o=r.code,i=r.data,o!==exports.ErrorCode.SUCCESS?[2,{code:o}]:i?[2,{code:o,data:Pc(i.list)}]:[2,{code:o,data:[]}]}}))}))},n.prototype.searchFriendsInfo=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})]}))}))},n.prototype.setFriendAddPermission=function(e){return Te(this,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return t=this._connMgr.codec.encodeFriendLevelSet(e),n=new zs(os[os.friendAuthSet],t,this.currentUserId),[4,this._connMgr.send(n)];case 1:return[2,{code:r.sent().code}]}}))}))},n.prototype.getFriendAddPermission=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return e=this._connMgr.codec.encodeFriendInput({targetId:this.currentUserId}),t=new zs(os.friendAuthGet,e,this.currentUserId),[4,this._connMgr.send(t,bi)];case 1:return n=i.sent(),r=n.code,o=n.data,r===exports.ErrorCode.SUCCESS&&o?[2,{code:r,data:o}]:[2,{code:r}]}}))}))},n.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},n.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},n.prototype.getConversationsByPage=function(e,t,n,r,o){throw new Error("Method not implemented.")},n.prototype.getContinuousMessages=function(e,t,n,r,o,i){throw new Error("Method not implemented.")},n.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,o,i,s){throw new Error("Method not implemented.")},n.prototype.clearConversations=function(){throw new Error("Method not implemented.")},n.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},n.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},n.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},n.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},n.prototype.addToBlacklist=function(e){return Promise.resolve(exports.ErrorCode.NOT_SUPPORT)},n.prototype.removeFromBlacklist=function(e){return Promise.resolve(exports.ErrorCode.NOT_SUPPORT)},n.prototype.getBlacklist=function(){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})},n.prototype.getBlacklistStatus=function(e){return Promise.resolve({code:exports.ErrorCode.NOT_SUPPORT})},n.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},n.prototype.batchInsertMessage=function(e,t){throw new Error("Method not implemented.")},n.prototype.getMessageCount=function(e,t,n){throw new Error("Method not implemented.")},n.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},n.prototype.deleteMessagesByTimestamp=function(e,t,n,r,o){throw new Error("Method not implemented.")},n.prototype.batchClearMessagesByTimestamp=function(e){throw new Error("Method not implemented.")},n.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},n.prototype.getMessage=function(e){return Te(this,void 0,void 0,(function(){return Ce(this,(function(e){return[2,ot(exports.ErrorCode.NOT_SUPPORT,"Not support")]}))}))},n.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},n.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},n.prototype.searchConversationByContent=function(e,t,n,r){throw new Error("Method not implemented.")},n.prototype.searchConversationByContentWithAllChannel=function(e,t,n){throw new Error("Method not implemented.")},n.prototype.searchMessageByContent=function(e,t,n,r,o,i){throw new Error("Method not implemented.")},n.prototype.searchMessageByContentAndMessageType=function(e,t,n,r,o,i,s){throw new Error("Method not implemented.")},n.prototype.searchMessagesByUser=function(e,t,n,r,o,i){throw new Error("Method not implemented.")},n.prototype.getMessagesByTimestamp=function(e,t,n,r){throw new Error("Method not implemented.")},n.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,o){throw new Error("Method not implemented.")},n.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,o,i,s){throw new Error("Method not implemented.")},n.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},n.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},n.prototype.updateMessageReceiptStatus=function(e,t,n,r){throw new Error("Method not implemented.")},n.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},n.prototype.clearData=function(){throw new Error("Method not implemented.")},n.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){throw new Error("Method not implemented.")},n.prototype.setCallInfo=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a;return Ce(this,(function(u){switch(u.label){case 0:return(r=this._connMgr)?(o=r.codec.encodeSetCallInfo(t,n),[4,r.send(new zs(os.reqCall,o,e),qo)]):[3,2];case 1:return i=u.sent(),s=i.code,a=i.data,s===exports.ErrorCode.SUCCESS&&a?[2,Promise.resolve({code:s,data:{key:a.key,value:a.dataContent}})]:[2,Promise.resolve({code:s})];case 2:return[2,Promise.resolve({code:exports.ErrorCode.RC_NET_CHANNEL_INVALID})]}}))}))},n.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},n.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},n.prototype.setCheckDuplicateMessage=function(e){throw new Error("Method not implemented.")},n.prototype.setCheckChatRoomDuplicateMessage=function(e){throw new Error("Method not implemented.")},n.prototype.getConversations=function(e){throw new Error("Method not implemented.")},n.prototype.getRealtimeConversations=function(e,t,n){return Te(this,void 0,void 0,(function(){var r,o,i,s,a,u,c,l,p,d=this;return Ce(this,(function(h){switch(h.label){case 0:return o=(r=this).currentUserId,i=r._connMgr,s=exports.ConversationType.PRIVATE,a=i.codec.encodeOldConversationList({count:e,type:s,startTime:t,order:n}),u=new zs(os.qrySessions,a,o),[4,i.send(u,Fr,{currentUserId:o,connectedTime:i.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,o=e.unreadMessageCount,i=d._conversationManager.get(t,n,r);Object.assign(e,i,{unreadMessageCount:o});var s=d._conversationManager.getDraft(t,n,r);return e.draft=s,e}})];case 1:return c=h.sent(),l=c.code,p=c.data,l!==exports.ErrorCode.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==p?void 0:p.list.sort((function(e,t){var r,o,i=(null===(r=e.latestMessage)||void 0===r?void 0:r.sentTime)||0,s=(null===(o=t.latestMessage)||void 0===o?void 0:o.sentTime)||0;return 0===n?s-i:i-s}))}]}}))}))},n.prototype.getRealtimeConTotalUnreadCount=function(){return Te(this,void 0,void 0,(function(){var e,t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return e=this._connMgr.codec.encodeSessionAttInput(),t=new zs(os.qrySessionsAtt,e,this.getCurrentUserId()),[4,this._connMgr.send(t,Jr)];case 1:return n=i.sent(),r=n.code,o=n.data,[2,{code:r,data:(null==o?void 0:o.totalUnreadCount)||0}]}}))}))},n.prototype.clearRealtimeConUnreadCount=function(e){return Te(this,void 0,void 0,(function(){var t,n,r,o;return Ce(this,(function(i){switch(i.label){case 0:return t=e.conversationType,n=e.targetId,this._conversationManager.clearUnreadCount(t,n,"",this.getServerTime(),!1),r=this._connMgr.codec.encodeSessionMsgReadInput(e,this.getServerTime()),o=new $s(os[os.updRRTime],r,this.currentUserId),[4,this._connMgr.send(o)];case 1:return[2,{code:i.sent().code}]}}))}))},n.prototype.removeRealtimeConversations=function(e){return Te(this,void 0,void 0,(function(){var t,n;return Ce(this,(function(r){switch(r.label){case 0:return t=this._connMgr,n=new zs(os.delSessions,t.codec.encodeRemoveConversationList(e),this.getCurrentUserId()),[4,t.send(n)];case 1:return[2,{code:r.sent().code}]}}))}))},n.prototype.getRealtimeConUnreadCounts=function(e){var t,n;return Te(this,void 0,void 0,(function(){var r,o,i;return Ce(this,(function(s){switch(s.label){case 0:return r=this._connMgr.codec.encodeQuerySessionsInput(e),o=new zs(os[os.qrySessionsUnread],r,this.currentUserId),[4,this._connMgr.send(o,eo)];case 1:return(i=s.sent()).code===exports.ErrorCode.SUCCESS&&i.data?[2,{code:i.code,data:null===(n=null===(t=i.data)||void 0===t?void 0:t.sessions)||void 0===n?void 0:n.map((function(e){return{conversationType:e.type,targetId:e.channelId,channelId:e.busChannel||"",unreadCount:vt(e.unreadCount)}}))}]:[2,{code:i.code}]}}))}))},n.prototype.setNotificationQuietHoursWithSetting=function(e){return Te(this,void 0,void 0,(function(){var t;return Ce(this,(function(n){switch(n.label){case 0:return t=Ji.encode(Di,e),[4,this._connMgr.query(os.addUnpush,this.currentUserId,t)];case 1:return[2,n.sent().wipe()]}}))}))},n.prototype.removeNotificationQuietHoursSetting=function(){return Te(this,void 0,void 0,(function(){var e;return Ce(this,(function(t){switch(t.label){case 0:return e=Ji.encode(wi,{nothing:0}),[4,this._connMgr.query(os.delUnpush,this.currentUserId,e)];case 1:return[2,t.sent().wipe()]}}))}))},n.prototype.getNotificationQuietHoursSetting=function(){return Te(this,void 0,void 0,(function(){var e;return Ce(this,(function(t){switch(t.label){case 0:return e=Ji.encode(Vi,{nothing:0}),[4,this._connMgr.query(os.qryUnpush,this.currentUserId,e,Gi)];case 1:return[2,t.sent().trans((function(e){var t=e.isUnpush,n=e.spanMinutes,r=e.startTime,o=e.level,i=e.timezone;return t?{spanMinutes:n,startTime:r,level:o,timezone:i}:{spanMinutes:0,startTime:"",level:exports.PushNotificationQuietHoursLevel.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT}}))]}}))}))},r=new WeakSet,o=function(e){var t={},n=e.extraProfile;return n&&(delete e.extraProfile,t.userExtProfile=Ou(n)),t.userProfile=Ou(e),t},Ie([Lc()],n.prototype,"createGroup",null),Ie([Lc()],n.prototype,"updateGroupInfo",null),Ie([Lc()],n.prototype,"getGroupsInfo",null),Ie([Lc()],n.prototype,"kickGroupMembers",null),Ie([Lc()],n.prototype,"quitGroup",null),Ie([Lc()],n.prototype,"dismissGroup",null),Ie([Lc()],n.prototype,"transferGroupOwner",null),Ie([Lc()],n.prototype,"setGroupManagers",null),Ie([Lc()],n.prototype,"getGroupMembersByRole",null),Ie([Lc()],n.prototype,"getGroupMembers",null),Ie([Lc()],n.prototype,"setGroupMemberInfo",null),Ie([Lc()],n.prototype,"joinGroup",null),Ie([Lc()],n.prototype,"inviteUsersToGroup",null),Ie([Lc()],n.prototype,"memberInviteResponse",null),Ie([Lc()],n.prototype,"getGroupApplications",null),Ie([Lc()],n.prototype,"getJoinedGroupsByRole",null),Ie([Lc()],n.prototype,"getJoinedGroups",null),Ie([Lc()],n.prototype,"setGroupRemark",null),Ie([Lc()],n.prototype,"setGroupFollows",null),Ie([Lc()],n.prototype,"getGroupFollows",null),Ie([Lc()],n.prototype,"addFriend",null),Ie([Lc()],n.prototype,"deleteFriends",null),Ie([Lc()],n.prototype,"acceptFriendApplication",null),Ie([Lc()],n.prototype,"refuseFriendApplication",null),Ie([Lc()],n.prototype,"setFriendInfo",null),Ie([Lc()],n.prototype,"checkFriends",null),Ie([Lc()],n.prototype,"getFriends",null),Ie([Lc()],n.prototype,"getFriendApplications",null),Ie([Lc()],n.prototype,"deleteFriendApplication",null),Ie([Lc()],n.prototype,"getFriendsInfo",null),Ie([Lc()],n.prototype,"searchFriendsInfo",null),Ie([Lc()],n.prototype,"setFriendAddPermission",null),Ie([Lc()],n.prototype,"getFriendAddPermission",null),Ie([Lc()],n.prototype,"getRealtimeConversations",null),Ie([Lc()],n.prototype,"getRealtimeConTotalUnreadCount",null),Ie([Lc()],n.prototype,"clearRealtimeConUnreadCount",null),Ie([Lc()],n.prototype,"removeRealtimeConversations",null),Ie([Lc()],n.prototype,"getRealtimeConUnreadCounts",null),Ie([Uc()],n.prototype,"setNotificationQuietHoursWithSetting",null),Ie([Uc()],n.prototype,"removeNotificationQuietHoursSetting",null),Ie([Uc()],n.prototype,"getNotificationQuietHoursSetting",null),n}(sa);exports.AEngine=sa,exports.APIContext=La,exports.AppStorage=xa,exports.BasicLogger=ln,exports.Codec=rs,exports.EventEmitter=ns,exports.MAX_MESSAGE_CONTENT_BYTES=Oe,exports.MAX_UPLOAD_FILE_SIZE=5368709120,exports.PBCodec=Tr,exports.PluginContext=ya,exports.RCResult=nt,exports.RTCPluginContext=Sa,exports.SEND_MESSAGE_TYPE_OPTION=Me,exports.SuspendablePromise=et,exports.UPLOAD_FILE_CHUNK_SIZE=10485760,exports.UUId=Je,exports.Validator=it,exports.ValidatorManage=Ua,exports.VersionManage=je,exports.assert=function(e,t,n,r){if(void 0===r&&(r=!1),!va(e,t,n,r))throw new Ra("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},exports.fail=ot,exports.fixUrlProtocol=Xt,exports.forEach=yt,exports.getUUID=function(){return Je.gen()},exports.getUUID22=function(){return Je.genWithLen(22)},exports.httpRequest=tn,exports.isArray=lt,exports.isBoolean=function(e){return"boolean"==typeof e},exports.isFunction=_t,exports.isHttpUrl=ft,exports.isInteger=function(e){return function(t){return Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max)}},exports.isLimitedArray=function(e){return function(t){if(!lt(t)||void 0!==e.minLength&&t.length<e.minLength||void 0!==e.maxLength&&t.length>e.maxLength)return!1;if(!e.itemValidator)return!0;var n=!0;return t.every((function(t){var r=e.itemValidator&&e.itemValidator(t);return"object"==typeof r?r.errorKey?(n={errorKey:r.errorKey,valid:r.valid},!1):(n=r.valid,r.valid):(n=!!r,r)})),n}},exports.isLimitedString=pt,exports.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},exports.isNumber=ct,exports.isObject=ht,exports.isString=ut,exports.isUndefined=gt,exports.isValidConversation=function(e,t){var n;return ht(e)?(t&&!t.includes(e.conversationType)&&(n="conversationTypeNotSupport"),Ct(e.targetId)||(n="targetId"),It(e.conversationType)||(n="conversationType"),gt(e.channelId)||Tt(e.channelId)||(n="channelId"),gt(n)?{valid:!0}:{valid:gt(n),errorKey:n}):{valid:!1,errorKey:"conversation"}},exports.isValidConversationType=It,exports.isValidEnum=function(e){return Object.values(e.type).includes(e.value)},exports.isValidFileType=function(e){return ct(e)&&Object.prototype.hasOwnProperty.call(exports.FileType,e)},exports.isValidGroupId=function(e){return pt({minLength:1,maxLength:64})(e)&&/^[a-zA-Z0-9+=\-_|:]*$/.test(e)},exports.isValidNotificationLevel=function(e){return ct(e)&&Object.prototype.hasOwnProperty.call(exports.NotificationLevel,e)},exports.isValidTargetId=Ct,exports.logger=ts,exports.map=St,exports.notEmptyArray=function(e){return lt(e)&&e.length>0},exports.notEmptyObject=Et,exports.notEmptyString=dt,exports.ok=rt,exports.runtime=fr,exports.transformReceivedStatusFlag=function(e){var t=exports.ReceivedStatus.UNREAD;return(null==e?void 0:e.isRead)&&(t|=exports.ReceivedStatus.READ),(null==e?void 0:e.isListened)&&(t|=exports.ReceivedStatus.LISTENED),(null==e?void 0:e.isDownload)&&(t|=exports.ReceivedStatus.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=exports.ReceivedStatus.RETRIEVED),t},exports.transformReceivedStatusInfo=Mt,exports.usingCppEngine=At,exports.validate=va;