@rongcloud/engine 5.20.0-c-esm-alpha.1 → 5.20.0-c-unikit.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.cjs.js +1 -1
- package/index.d.ts +68 -4
- package/index.esm.js +1 -2
- package/index.mjs +1 -2
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -12,5 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
function e(e,t,n,s){var i,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,s);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}function t(e,t,n,s){return new(n||(n=Promise))((function(i,r){function o(e){try{l(s.next(e))}catch(e){r(e)}}function a(e){try{l(s.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))}function n(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)}function s(e,t,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(e,n):i?i.value=n:t.set(e,n),n}var i,r,o,a,l,u,d,c,h,_,p,E,f,I,R,T,m,S,C,v,y,A,N,O,M,U,L,P,b,D,w,V,G,k,B,F,x,H,q,Y,K,j,Q,W,$,J,z,Z,X,ee,te,ne,se,ie,re,oe,ae;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(i||(i={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_REPEAT_O="A_INIT_REPEAT_O",e.L_INIT_O="L-init-O",e.A_DESTROY_O="A_DESTROY_O",e.L_DESTROY_O="L_DESTROY_O",e.A_CONNECT_T="A-connect-T",e.A_CONNECT_R="A-connect-R",e.A_CONNECT_S="A-connect-S",e.A_DISCONNECT_O="A-disconnect-O",e.A_RECONNECT_T="A-reconnect-T",e.A_RECONNECT_R="A_RECONNECT_R",e.L_CONNECT_T="L-connect-T",e.L_CONNECT_R="L-connect-R",e.L_CONNECT_S="L-connect-S",e.L_DB_UPGRATE_START_S="L-db_upgrate_start-S",e.L_DB_UPGRATING_S="L-db_upgrating-S",e.L_DB_UPGRATE_COMPLETE_S="L-db_upgrate_complete-S",e.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",e.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",e.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",e.A_MSG_LISTENER_E="A-MSG_LISTENER-E",e.O="L-original-O",e.T="L-TEST-O",e.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",e.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",e.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",e.L_NAVI_CMP_R="L-NAVI_CPM-R",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-send_msg-R",e.L_SEND_MSG_T="L-send_msg-T",e.L_SEND_MSG_R="L-send_msg-R",e.L_PULL_MSG_T="L-pull_msg-T",e.L_PULL_MSG_R="L-pull_msg-R",e.L_PULL_MSG_E="L-pull_msg-E",e.L_PULL_MSG_O="L-pull_msg-O",e.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",e.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",e.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",e.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",e.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",e.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",e.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",e.L_RECV_S_MSG_O="L-recv_s_msg-O",e.A_DELETE_MESSAGES_S="A-delete_messages-S",e.P_DELETE_MSG_S="P-delete_msg-S",e.L_PULL_CONVERSATION_S="L-pull_conversation-S",e.A_RECALL_MESSAGE_T="A-recall_msg-T",e.A_RECALL_MESSAGE_R="A-recall_msg-R",e.A_RECALL_MESSAGE_E="A-recall_msg-E",e.A_REGTYP_O="A-regtyp-O",e.P_REGTYP_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_REQUEST_T="L-request-T",e.L_REQUEST_R="L-request-R",e.L_PARSE_NAVI_E="L-parse_navi-E",e.L_ENV_S="L-Env-S",e.L_GET_INDEX_NAVI_S="L-get_index_navi-S",e.A_JOIN_CHATROOM_T="A-join_chatroom-T",e.A_JOIN_CHATROOM_R="A-join_chatroom-R",e.L_JOIN_CHATROOM_T="L-join_chatroom-T",e.L_JOIN_CHATROOM_R="L-join_chatroom-R",e.A_QUIT_CHATROOM_T="A-quit_chatroom-T",e.A_QUIT_CHATROOM_R="A-quit_chatroom-R",e.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",e.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",e.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",e.L_MEDIA_S="L-media-S",e.L_MEDIA_UPLOAD_T="L-media_upload-T",e.L_MEDIA_UPLOAD_R="L-media_upload-R",e.G_UPLOAD_LOG_S="G-upload_log-S",e.G_REPORT_LOG_S="G-report_log-S",e.G_UPLOAD_LOG_E="G-upload_log-E",e.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",e.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",e.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",e.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",e.A_GET_LOCAL_MESSAGE_T="A-get_local_message-T",e.A_GET_LOCAL_MESSAGE_R="A-get_local_message-R",e.A_GET_HISTORY_MSG_T="A-get_history_msg-T",e.A_GET_HISTORY_MSG_R="A-get_history_msg-R",e.L_GET_HISTORY_MSG_T="L-get_history_msg-T",e.L_GET_HISTORY_MSG_R="L-get_history_msg-R",e.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",e.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E",e.L_CALLBACK_E="L-callback-E",e.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",e.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",e.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",e.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",e.A_SYNC_READ_STATUS_T="A-sync_read_status-T",e.A_SYNC_READ_STATUS_R="A-sync_read_status-R",e.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",e.L_PB_ENCODE_E="L-pb-encode-E",e.L_PB_DECODE_E="L-pb-decode-E",e.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",e.L_REPORT_FULL_LOG_O="L-report_full_log-O",e.L_REPORT_FULL_LOG_T="L-report_full_log-T",e.L_REPORT_FULL_LOG_R="L-report_full_log-R",e.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",e.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",e.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",e.L_LOGDB_CLOSED_S="L-logDB_closed-S",e.L_LOGDB_ERROR_E="L-logDB_error-S",e.L_LOGDB_ABORT_S="L-logDB_abort-S",e.L_REALTIME_LOG_R="L_REALTIME_LOG_R",e.L_REALTIME_LOG_O="L_REALTIME_LOG_O",e.L_REALTIME_LOG_T="L_REALTIME_LOG_T",e.L_STATISTIC_LOG_R="L_STATISTIC_LOG_R",e.L_STATISTIC_LOG_O="L_STATISTIC_LOG_O",e.L_STATISTIC_LOG_T="L_STATISTIC_LOG_T",e.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",e.L_RECV_RMTP_O="L_RECV_RMTP_O",e.L_RECV_RMTP_E="L_RECV_RMTP_E",e.L_RECV_S_NTF_O="L-recv_s_ntf_O",e.L_VER_REPORT_T="L-VER_REPORT-T",e.L_VER_REPORT_R="L-VER_REPORT-R",e.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",e.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",e.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",e.A_REMOVE_PROXY_O="A-remove_proxy-O",e.A_SET_PROXY_O="A-set_proxy-O",e.A_TEST_PROXY_O="A-test_proxy-O",e.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",e.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",e.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",e.L_GET_STATIC_CONF_T="L-get_static_conf-T",e.L_GET_STATIC_CONF_R="L-get_static_conf-R",e.L_GET_STATIC_CONF_E="L-get_static_conf-E",e.L_CLOUD_DISABLED="L-cloud_disabled",e.L_CLOUD_EXPIRE="L-cloud_expire",e.L_CLOUD_OVERCLOCK="L-cloud_overclock",e.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",e.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",e.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",e.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",e.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",e.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",e.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O",e.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S="L-sync_subscribed_user_status_finished-S",e.L_PULL_SUBSCRIBED_USER_RELATION_T="L-pull_subscribed_user_relation-T",e.L_PULL_SUBSCRIBED_USER_RELATION_R="L-pull_subscribed_user_relation-R",e.L_PULL_SUBSCRIBED_USER_STATUS_T="L-pull_subscribed_user_status-T",e.L_PULL_SUBSCRIBED_USER_STATUS_R="L-pull_subscribed_user_status-R",e.L_OWN_USER_PROFILE_CHANGED_S="L-own_user_profile_changed-S",e.L_QUERY_SUBSCRIBE_DATA_T="L-query_subscribe_data-T",e.L_QUERY_SUBSCRIBE_DATA_R="L-query_subscribe_data-R",e.L_PULL_USER_PROFILE_T="L-pull_user_profile-T",e.L_PULL_USER_PROFILE_R="L-pull_user_profile-R",e.L_PULL_OWN_PROFILE_T="L-pull_own_profile-T",e.L_PULL_OWN_PROFILE_R="L-pull_own_profile-R",e.L_QUERY_FRIEND_LIST_T="L-query_friend_list-T",e.L_QUERY_FRIEND_LIST_R="L-query_friend_list-R",e.L_PULL_USER_PROFILE_REQ_T="L-pull_user_profile_req-T",e.L_PULL_USER_PROFILE_REQ_R="L-pull_user_profile_req-R",e.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S="L-pull_event_change_notify_ultra_online-S",e.L_PULL_EVENT_CHANGE_T="L-pull_event_change-T",e.L_PULL_EVENT_CHANGE_R="L-pull_event_change-R",e.L_PARSE_JSON_E="L-parse_json-E",e.L_REQ_STREAM_MSG_CONTENT_T="L-req_stream_msg_content-T",e.L_REQ_STREAM_MSG_CONTENT_R="L-req_stream_msg_content-R",e.L_REQ_STREAM_MSG_CONTENT_O="L-req_stream_msg_content-O",e.L_REQ_STREAM_MSG_CONTENT_E="L-req_stream_msg_content-E"}(r||(r={})),function(e){e[e.BOTH=2]="BOTH"}(o||(o={})),function(e){e[e.BOTH=2]="BOTH"}(a||(a={})),function(e){e[e.FREE=1]="FREE",e[e.NEED_VERIFY=2]="NEED_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(l||(l={})),function(e){e[e.NONE=0]="NONE",e[e.IN_MY_FRIEND_LIST=1]="IN_MY_FRIEND_LIST",e[e.IN_OTHER_FRIEND_LIST=2]="IN_OTHER_FRIEND_LIST",e[e.BOTH_WAY=3]="BOTH_WAY"}(u||(u={})),function(e){e[e.SENT=1]="SENT",e[e.RECEIVED=2]="RECEIVED"}(d||(d={})),function(e){e[e.UNHANDLED=0]="UNHANDLED",e[e.ACCEPTED=1]="ACCEPTED",e[e.REFUSED=2]="REFUSED",e[e.EXPIRED=3]="EXPIRED"}(c||(c={})),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"}(_||(_={})),function(e){e[e.OWNER_VERIFY=0]="OWNER_VERIFY",e[e.FREE=1]="FREE",e[e.OWNER_OR_MANAGER_VERIFY=2]="OWNER_OR_MANAGER_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(p||(p={})),function(e){e[e.OWNER=0]="OWNER",e[e.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",e[e.EVERYONE=2]="EVERYONE"}(E||(E={})),function(e){e[e.OWNER_OR_MANAGER_OR_SELF=0]="OWNER_OR_MANAGER_OR_SELF",e[e.OWNER_OR_SELF=1]="OWNER_OR_SELF",e[e.SELF=2]="SELF"}(f||(f={})),function(e){e[e.FREE=0]="FREE",e[e.INVITEE_VERIFY=1]="INVITEE_VERIFY"}(I||(I={})),function(e){e[e.UNDEF=0]="UNDEF",e[e.NORMAL=1]="NORMAL",e[e.MANAGER=2]="MANAGER",e[e.OWNER=3]="OWNER"}(R||(R={})),function(e){e[e.CREATE=0]="CREATE",e[e.JOIN=1]="JOIN",e[e.KICK=2]="KICK",e[e.QUIT=3]="QUIT",e[e.DISMISS=4]="DISMISS",e[e.ADD_MANAGER=5]="ADD_MANAGER",e[e.REMOVE_MANAGER=6]="REMOVE_MANAGER",e[e.TRANSFER_GROUP_OWNER=7]="TRANSFER_GROUP_OWNER"}(T||(T={})),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"}(m||(m={})),function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE"}(S||(S={})),function(e){e[e.MANAGER_UNHANDLED=0]="MANAGER_UNHANDLED",e[e.MANAGER_REFUSED=1]="MANAGER_REFUSED",e[e.INVITEE_UNHANDLED=2]="INVITEE_UNHANDLED",e[e.INVITEE_REFUSED=3]="INVITEE_REFUSED",e[e.JOINED=4]="JOINED",e[e.EXPIRED=5]="EXPIRED"}(C||(C={})),function(e){e[e.REFUSE=0]="REFUSE",e[e.ACCEPT=1]="ACCEPT"}(v||(v={})),function(e){e[e.APPLICANT=0]="APPLICANT",e[e.MANAGER=1]="MANAGER"}(y||(y={})),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={})),function(e){e[e.APPLICATION=0]="APPLICATION",e[e.INVITATION=1]="INVITATION"}(N||(N={})),function(e){e[e.APPLICATION_SENT=0]="APPLICATION_SENT",e[e.INVITATION_SENT=1]="INVITATION_SENT",e[e.INVITATION_RECEIVED=2]="INVITATION_RECEIVED",e[e.APPLICATION_RECEIVED=3]="APPLICATION_RECEIVED"}(O||(O={})),function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(M||(M={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(U||(U={})),function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(L||(L={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(P||(P={})),function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(b||(b={})),function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(D||(D={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET=24360]="RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET",e[e.RC_USER_PROFILE_KEY_NOT_EXIST=24361]="RC_USER_PROFILE_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KEY_NOT_EXIST=24362]="RC_USER_PROFILE_EXT_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT=24363]="RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT=24364]="RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT",e[e.RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT=24365]="RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_USER_NOT_EXIST=24366]="RC_USER_PROFILE_USER_NOT_EXIST",e[e.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS=24367]="RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_USER_PROFILE_VALUE_EXCEED_RANGE=24368]="RC_USER_PROFILE_VALUE_EXCEED_RANGE",e[e.RC_USER_PROFILE_SERVICE_UNAVAILABLE=24369]="RC_USER_PROFILE_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.RC_ENTRUST_SERVER_ERROR=25402]="RC_ENTRUST_SERVER_ERROR",e[e.RC_ENTRUST_SERVER_PARAMETER_ERROR=25403]="RC_ENTRUST_SERVER_PARAMETER_ERROR",e[e.RC_GROUP_ILLEGAL_ERROR=25404]="RC_GROUP_ILLEGAL_ERROR",e[e.RC_GROUP_AUTHORITY_ERROR=25405]="RC_GROUP_AUTHORITY_ERROR",e[e.RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT=25406]="RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT",e[e.RC_GROUP_PARAMETER_FORMAT_ERROR=25407]="RC_GROUP_PARAMETER_FORMAT_ERROR",e[e.RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS=25408]="RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_GROUP_ID_ALREADY_EXIST=25409]="RC_GROUP_ID_ALREADY_EXIST",e[e.RC_GROUP_ID_NOT_EXIST=25410]="RC_GROUP_ID_NOT_EXIST",e[e.RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT=25411]="RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_MEMBERS_ALREADY_IN_GROUP=25412]="RC_GROUP_MEMBERS_ALREADY_IN_GROUP",e[e.RC_GROUP_NOT_ALLOW_SDK_OPERATION=25413]="RC_GROUP_NOT_ALLOW_SDK_OPERATION",e[e.RC_GROUP_NOT_ALLOW_JOIN=25414]="RC_GROUP_NOT_ALLOW_JOIN",e[e.RC_GROUP_EXT_KEY_NOT_EXIST=25415]="RC_GROUP_EXT_KEY_NOT_EXIST",e[e.RC_GROUP_REQUEST_OVERFREQUENCY=25416]="RC_GROUP_REQUEST_OVERFREQUENCY",e[e.RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK=25417]="RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK",e[e.RC_GROUP_USER_NOT_IN_GROUP=25418]="RC_GROUP_USER_NOT_IN_GROUP",e[e.RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT=25419]="RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP=25420]="RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP",e[e.RC_GROUP_APPLICATION_NOT_EXIST=25421]="RC_GROUP_APPLICATION_NOT_EXIST",e[e.RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT=25422]="RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_NAME_INVALID=25423]="RC_GROUP_NAME_INVALID",e[e.RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT=25424]="RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT",e[e.RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER=25425]="RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER",e[e.RC_GROUP_NO_INVITE_PERMISSION=25426]="RC_GROUP_NO_INVITE_PERMISSION",e[e.RC_GROUP_NEED_INVITEE_ACCEPT=25427]="RC_GROUP_NEED_INVITEE_ACCEPT",e[e.RC_GROUP_APPLICATION_ALREADY_HANDLE=25428]="RC_GROUP_APPLICATION_ALREADY_HANDLE",e[e.RC_GROUP_OLD_GROUP_NOT_ENTRUST=25429]="RC_GROUP_OLD_GROUP_NOT_ENTRUST",e[e.RC_GROUP_ID_INVALID=25430]="RC_GROUP_ID_INVALID",e[e.RC_PAGE_TOKEN_PARSING_FAILED=25432]="RC_PAGE_TOKEN_PARSING_FAILED",e[e.RC_FRIEND_ALREADY_FRIEND=25460]="RC_FRIEND_ALREADY_FRIEND",e[e.RC_FRIEND_NEED_ACCEPT=25461]="RC_FRIEND_NEED_ACCEPT",e[e.RC_FRIEND_IN_OTHER_BLACK_LIST=25462]="RC_FRIEND_IN_OTHER_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_OTHER_WHITE_LIST=25463]="RC_FRIEND_NOT_IN_OTHER_WHITE_LIST",e[e.RC_FRIEND_IN_MY_BLACK_LIST=25464]="RC_FRIEND_IN_MY_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_MY_WHITE_LIST=25465]="RC_FRIEND_NOT_IN_MY_WHITE_LIST",e[e.RC_FRIEND_APPLICATION_NOT_EXIST=25466]="RC_FRIEND_APPLICATION_NOT_EXIST",e[e.RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT=25467]="RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT=25468]="RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_NOT_FRIEND=25469]="RC_FRIEND_NOT_FRIEND",e[e.RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT=25470]="RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND=25471]="RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND",e[e.RC_FRIEND_NOT_EXIST=25472]="RC_FRIEND_NOT_EXIST",e[e.RC_FRIEND_NOT_ALLOW_ADD_SELF=25473]="RC_FRIEND_NOT_ALLOW_ADD_SELF",e[e.SERVICE_INFORMATION_AUDIT_FAILED=25480]="SERVICE_INFORMATION_AUDIT_FAILED",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",e[e.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",e[e.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",e[e.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",e[e.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",e[e.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",e[e.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",e[e.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",e[e.RC_FILE_SIZE_EXCEED_LIMIT=26106]="RC_FILE_SIZE_EXCEED_LIMIT",e[e.INVALID_PARAMETER_SIZE_NOT_FOUND=26107]="INVALID_PARAMETER_SIZE_NOT_FOUND",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.MESSAGE_NOT_SUPPORT_SENDING=30017]="MESSAGE_NOT_SUPPORT_SENDING",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",e[e.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",e[e.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",e[e.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",e[e.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",e[e.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",e[e.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",e[e.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",e[e.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",e[e.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",e[e.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",e[e.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",e[e.INVALID_PARAMETER_TIMESTRING=34224]="INVALID_PARAMETER_TIMESTRING",e[e.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",e[e.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",e[e.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",e[e.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",e[e.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",e[e.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",e[e.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",e[e.INVALID_PARAMETER_UNIQUE_ID=34236]="INVALID_PARAMETER_UNIQUE_ID",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",e[e.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",e[e.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",e[e.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",e[e.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",e[e.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",e[e.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",e[e.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",e[e.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",e[e.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",e[e.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",e[e.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",e[e.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",e[e.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",e[e.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",e[e.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",e[e.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",e[e.INVALID_PARAMETER_SPAN_MINUTES=34283]="INVALID_PARAMETER_SPAN_MINUTES",e[e.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",e[e.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",e[e.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",e[e.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",e[e.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",e[e.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",e[e.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",e[e.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",e[e.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",e[e.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",e[e.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",e[e.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",e[e.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",e[e.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",e[e.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",e[e.INVALID_PARAMETER_USER_PROFILE=34312]="INVALID_PARAMETER_USER_PROFILE",e[e.INVALID_PARAMETER_USER_PROFILE_VISIBILITY=34313]="INVALID_PARAMETER_USER_PROFILE_VISIBILITY",e[e.INVALID_PARAMETER_EXTRA=34314]="INVALID_PARAMETER_EXTRA",e[e.DB_UPGRADE_FAILED=34315]="DB_UPGRADE_FAILED",e[e.INVALID_PARAMETER_GROUP_INFO=34318]="INVALID_PARAMETER_GROUP_INFO",e[e.INVALID_PARAMETER_GROUP_ID=34319]="INVALID_PARAMETER_GROUP_ID",e[e.INVALID_PARAMETER_GROUP_NAME=34320]="INVALID_PARAMETER_GROUP_NAME",e[e.INVALID_PARAMETER_GROUP_IDS=34321]="INVALID_PARAMETER_GROUP_IDS",e[e.INVALID_PARAMETER_GROUP_MEMBER_ROLE=34322]="INVALID_PARAMETER_GROUP_MEMBER_ROLE",e[e.INVALID_PARAMETER_GROUP_APPLICATION_STATUS=34323]="INVALID_PARAMETER_GROUP_APPLICATION_STATUS",e[e.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION=34324]="INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION",e[e.INVALID_PARAMETER_NICK_NAME=34325]="INVALID_PARAMETER_NICK_NAME",e[e.INVALID_PARAMETER_REASON=34326]="INVALID_PARAMETER_REASON",e[e.INVALID_PARAMETER_REMARK=34327]="INVALID_PARAMETER_REMARK",e[e.INVALID_PARAMETER_PAGING_QUERY_OPTION=34328]="INVALID_PARAMETER_PAGING_QUERY_OPTION",e[e.NET_DATA_IS_SYNCHRONIZING=34329]="NET_DATA_IS_SYNCHRONIZING",e[e.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE=34330]="INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE",e[e.INVALID_PARAMETER_DIRECTION_TYPE=34331]="INVALID_PARAMETER_DIRECTION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE=34332]="INVALID_PARAMETER_FRIEND_APPLICATION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS=34333]="INVALID_PARAMETER_FRIEND_APPLICATION_STATUS",e[e.INVALID_PARAMETER_FRIEND_ADD_PERMISSION=34334]="INVALID_PARAMETER_FRIEND_ADD_PERMISSION",e[e.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS=34335]="INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS",e[e.RC_REAL_TIME_CONVERSATION_UNAVAILABLE=34336]="RC_REAL_TIME_CONVERSATION_UNAVAILABLE",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",e[e.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",e[e.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",e[e.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",e[e.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",e[e.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",e[e.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",e[e.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",e[e.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",e[e.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",e[e.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",e[e.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",e[e.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",e[e.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",e[e.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",e[e.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",e[e.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",e[e.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",e[e.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",e[e.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",e[e.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",e[e.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",e[e.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",e[e.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",e[e.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",e[e.DNS_PROXY_TIMEOUT=35051]="DNS_PROXY_TIMEOUT",e[e.DNS_PROXY_ERROR=35052]="DNS_PROXY_ERROR",e[e.DNS_PROXY_DATA_DESTRUCTUR_ERROR=35053]="DNS_PROXY_DATA_DESTRUCTUR_ERROR",e[e.INVALID_DISABLE_UPDATE_LAST_MESSAGE=35054]="INVALID_DISABLE_UPDATE_LAST_MESSAGE",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.STREAM_MESSAGE_DISABLE=39001]="STREAM_MESSAGE_DISABLE",e[e.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED=39002]="STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED",e[e.STREAM_MESSAGE_EXPANSION_KEY_ERROR=39003]="STREAM_MESSAGE_EXPANSION_KEY_ERROR",e[e.STREAM_MESSAGE_REQUEST_FAIL=39005]="STREAM_MESSAGE_REQUEST_FAIL",e[e.STREAM_MESSAGE_REQUEST_IN_PROCESS=39006]="STREAM_MESSAGE_REQUEST_IN_PROCESS",e[e.STREAM_MESSAGE_SYNCED=39007]="STREAM_MESSAGE_SYNCED",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.TIMEOUT=-1]="TIMEOUT"}(w||(w={})),function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(V||(V={})),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"}(G||(G={})),function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(k||(k={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(B||(B={})),function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.COMBINE_V2="RC:CombineV2Msg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",e.READ_STATE="RC:RSMsg",e.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",e.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",e.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg",e.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg",e.STREAM_MESSAGE="RC:StreamMsg"}(F||(F={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(x||(x={})),function(e){e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(H||(H={})),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={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(Q||(Q={})),function(e){e[e.typing=0]="typing"}(W||(W={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}($||($={})),function(e){e[e.Other=0]="Other",e[e.iOS=1]="iOS",e[e.Android=2]="Android",e[e.Web=3]="Web",e[e.PC=4]="PC",e[e.Mini=5]="Mini",e[e.HarmonyOS=6]="HarmonyOS"}(J||(J={})),function(e){e[e.ONLINE_STATUS=1]="ONLINE_STATUS",e[e.USER_PROFILE=2]="USER_PROFILE",e[e.FRIEND_ONLINE_STATUS=3]="FRIEND_ONLINE_STATUS",e[e.FRIEND_USER_PROFILE=4]="FRIEND_USER_PROFILE"}(z||(z={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(Z||(Z={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(X||(X={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ee||(ee={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(te||(te={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(ne||(ne={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(se||(se={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(ie||(ie={})),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={})),function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(oe||(oe={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(ae||(ae={}));const le=e=>e===ae.OPEN?oe.AT_MESSAGE_NOTIFICATION:oe.NOT_SET,ue=e=>e<=oe.NOT_SET?ae.CLOSE:ae.OPEN;var de,ce,he,_e,ge,pe,Ee,fe,Ie,Re,Te;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(de||(de={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(ce||(ce={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(he||(he={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(_e||(_e={})),function(e){e[e.CURRENT=2]="CURRENT"}(ge||(ge={})),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"}(Ee||(Ee={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(fe||(fe={})),function(e){e[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"}(Ie||(Ie={})),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"}(Re||(Re={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Te||(Te={}));const me=72e5,Se=6e4,Ce=131072,ve={"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}},ye="5.20.0-c-esm-alpha.1".replace(/-.+$/,""),Ae=5368709120,Ne=10485760,Oe="rongcloudsystem",Me=864e5,Ue=e=>`navi_${e}`,Le=(e,t)=>`RCV4-con-s-${e}-${t}`,Pe=(e,t)=>`RCV4-con-${e}-${t}`,be=(e,t)=>`RCV4-CONVER-${e}-${t}`,De=(e,t)=>`RCV4-ultragroupconversation-${e}-${t}`,we=(e,t)=>`outbox_${e}_${t}`,Ve=(e,t)=>`inbox_${e}_${t}`,Ge=(e,t)=>`broadcastbox_${e}_${t}`,ke=(e,t)=>`send_msg_${e}_${t}`,Be=(e,t)=>`RC-us-${e}-${t}`,Fe=e=>`rc-static-config-${e}`,xe=e=>`RC-cc-${e}`,He=(e,t)=>`RC-RR-${e}-${t}`,qe=(e,t)=>`RC-PEC-${e}-${t}`,Ye="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Ye.engine="5.20.0-c-esm-alpha.1";class Ke{static add(e,t){Ye[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 Ye.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((e=>e.padStart(3,"0"))).join("")>=n}static getInfo(){return Ye}}const je={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),s=Math.floor(Math.random()*t).toString(36),i=e-n.length-s.length;var r;return[s,n,i>0?(r=i,Array.from({length:r}).map((()=>Math.floor(36*Math.random()).toString(36))).join("")):""].join("").slice(0,e)}},Qe=je.genWithLen(22),We=Date.now();class $e extends Error{constructor(e){super(e),this.name="CMSYError"}static InvalidParameters(e){return(null==e?void 0:e.length)?new $e(`Invalid parameter -> ${e}`):new $e("Invalid parameters.")}static ParameterTypeError(){return new $e("Wrong parameter type")}}class Je{constructor(){this._map=new Map,this._piped=new Set}_addItem(e,t,n,s,i=0){const r=Symbol(),o=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:r,priority:Math.min(i,100),listener:t.bind(s),once:n},l=o.findIndex((e=>e.priority>i));return-1===l?o.push(a):o.splice(l,0,a),r}on(e,t,n,s=0){return this._addItem(e,t,!1,n,s)}once(e,t,n,s=0){return this._addItem(e,t,!0,n,s)}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:s,listener:i}=n[e];s&&n.splice(e,1);try{i(...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 ze{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 Ze{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?Xe(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?Xe(void 0,this.msg):et(this.code,this.msg)}}const Xe=(e,t)=>new Ze(0,t||"success",e),et=(e,t,n)=>new Ze(e,t||`fail: ${e}`,n);class nt{constructor(e){this._apiName=e,this._isValid=!0,this._code=0}static create(e){return new nt(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?Xe():et(this._code,this._errmsg)}validate(e,t,n,s=!1){if(!this._isValid)return this;const i=s?n(t):null==t||n(t);return this._isValid=i,i||(this._errmsg=`param '${e}' is invalid`),this}assert(e,t,n,s=!1){if(!this._isValid)return this;if(this.validate(e,t,n,s),!this._isValid)throw $e.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,s,i=!1){return this.isString(e,t,i).validate(e,t,(e=>e.length>=n&&e.length<=s),i)}assertLimitedString(e,t,n,s,i=!1){return this.assertString(e,t,i),this.assert(e,t,(e=>e.length>=n&&e.length<=s),i)}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,s,i=!1){return this.isNumber(e,t,i).validate(e,t,(e=>e>=n&&e<=s),i)}assertLimitedNumber(e,t,n,s,i=!1){return this.assertNumber(e,t,i),this.assert(e,t,(e=>e>=n&&e<=s),i)}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,s,i=!1){return this.isInteger(e,t,i).validate(e,t,(e=>e>=n&&e<=s),i)}assertLimitedInteger(e,t,n,s,i=!1){return this.assertInteger(e,t,i),this.assert(e,t,(e=>e>=n&&e<=s),i)}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,s=!1,i=1){return this.isArray(e,t,s).validate(e,t,(e=>e.length>=i&&e.length<=n),s)}assertLimitedArray(e,t,n,s=!1,i=1){return this.assertArray(e,t,s),this.assert(e,t,(e=>e.length>=i&&e.length<=n),s)}isTypedArray(e,t,n,s=!1){return this.isArray(e,t,s).validate(e,t,(e=>e.every(n)),s)}assertTypedArray(e,t,n,s=!1){return this.assertArray(e,t,s),this.assert(e,t,(e=>e.every(n)),s)}isLimitedTypedArray(e,t,n,s,i=!1,r=1){return this.isLimitedArray(e,t,n,i,r).validate(e,t,(e=>e.every(s)),i)}assertLimitedTypedArray(e,t,n,s,i=!1,r=1){return this.assertLimitedArray(e,t,n,i,r),this.assert(e,t,(e=>e.every(s)),i)}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,s=!1){return this.validate(e,t,(()=>Object.values(n).includes(t)),s)}assertValueOf(e,t,n,s=!1){return this.assert(e,t,(()=>Object.values(n).includes(t)),s)}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 st="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function it(e){let t,n,s,i,r,o,a,l="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)i=st.indexOf(e.charAt(u++)),r=st.indexOf(e.charAt(u++)),o=st.indexOf(e.charAt(u++)),a=st.indexOf(e.charAt(u++)),t=i<<2|r>>4,n=(15&r)<<4|o>>2,s=(3&o)<<6|a,l+=String.fromCharCode(t),64!==o&&(l+=String.fromCharCode(n)),64!==a&&(l+=String.fromCharCode(s));return l}const rt=e=>"string"==typeof e,ot=e=>"boolean"==typeof e,at=e=>"number"==typeof e&&!Number.isNaN(e),lt=e=>t=>Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max),ut=e=>-1!==Object.prototype.toString.call(e).indexOf("Array"),dt=e=>t=>rt(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)),ct=e=>rt(e)&&e.length>0,ht=e=>ut(e)&&e.length>0,_t=e=>"[object Object]"===Object.prototype.toString.call(e),gt=e=>"[object Function]"===Object.prototype.toString.call(e),pt=e=>void 0===e||"[object Undefined]"===Object.prototype.toString.call(e),Et=e=>"[object Null]"===Object.prototype.toString.call(e),ft=e=>rt(e)&&/https?:\/\//.test(e),It=e=>{for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},Rt=e=>at(e)&&Object.prototype.hasOwnProperty.call(V,e),Tt=e=>at(e)&&Object.prototype.hasOwnProperty.call(oe,e),mt=e=>{let t=!1;return rt(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},St=e=>Object.values(e.type).includes(e.value),Ct=e=>dt({minLength:1,maxLength:64})(e),vt=e=>dt({minLength:1,maxLength:64})(e)&&/^[a-zA-Z0-9+=\-_|:]*$/.test(e),yt=e=>at(e)&&Object.prototype.hasOwnProperty.call(k,e),At=e=>{let t=!1,n=!1,s=!1;if(_t(e)){t=Object.keys(e).length>20;for(const t in e)if(n||(n=rt(t)&&!/^[A-Za-z0-9_=+-]+$/.test(t)),!s){const n=e[t];s=t.length>32||n.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:s}},Nt=e=>{if(!_t(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)},Ot=(e,t,n)=>{const s=null==n?void 0:n.isReverse;_t(e)&&(()=>{for(const n in e)t(e[n],n,e)})(),(ut(e)||rt(e))&&(()=>{if(s)for(let n=e.length-1;n>=0;n--)t(e[n],n);else for(let n=0,s=e.length;n<s;n++)t(e[n],n)})()},Mt=(e,t)=>(Ot(e,((n,s)=>{e[s]=t(n,s)})),e),Ut=e=>JSON.parse(JSON.stringify(e)),Lt=()=>"undefined"!=typeof RCCppEngine,Pt=e=>{let t;if("object"==typeof e&&null!==e)if(Array.isArray(e)){t=[];for(let n in e)t.push(Pt(e[n]))}else{t={};for(let n in e)t[n]=Pt(e[n])}else t=e;return t},bt=e=>{let t;try{t=Pt(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},Dt=e=>({isRead:(e&de.READ)===de.READ,isListened:(e&de.LISTENED)===de.LISTENED,isDownload:(e&de.DOWNLOADED)===de.DOWNLOADED,isRetrieved:(e&de.RETRIEVED)===de.RETRIEVED}),wt=e=>{let t=de.UNREAD;return(null==e?void 0:e.isRead)&&(t|=de.READ),(null==e?void 0:e.isListened)&&(t|=de.LISTENED),(null==e?void 0:e.isDownload)&&(t|=de.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=de.RETRIEVED),t},Vt=e=>[J.Android,J.iOS,J.Web,J.PC,J.Mini,J.HarmonyOS].map((t=>{const n=e.findIndex((e=>e.platform===t));return-1===n?{platform:t,changeTime:0,eventValue:0}:e[n]})),Gt=(e,t,n)=>{const s=t.reduce(((e,t)=>(["gender","role","level"].includes(t.key)?e[t.key]=Number(t.value):e[t.key]=t.value,e)),{});return s.userId=e,n.forEach((e=>{s.extraProfile=s.extraProfile||{},s.extraProfile[e.key]=e.value})),s},kt=(e,t,n)=>t?1===n?G.TLS:G.RMTP:"http"===e?G.WS:G.WSS,Bt=(e,t)=>{const{server:n,backupServer:s,bs:i,serverAddr:r,protocol:o,openTLS:a}=e;if(r){return[...r.filter((e=>e.addr))]}const l=[],u=[];return n&&u.push(n),(s||i||"").split(",").forEach((e=>{u.indexOf(e)<0&&u.push(e)})),u.forEach(((e,s)=>{e&&l.push({addr:e,protocol:kt(o,t,a),weight:n.length-s,race:!1})})),[...l]},Ft=(e=[])=>e.map((e=>{var t,n,s,i,r,o,a,l,u;const d=Kt(e.settingProfile)||{},c=e.extProfile||[],{targetId:h,baseInfo:_,userInfo:g}=e;return{groupId:h,groupName:null!==(t=d.name)&&void 0!==t?t:"",portraitUri:null!==(n=d.portraitUrl)&&void 0!==n?n:"",introduction:null!==(s=d.introduction)&&void 0!==s?s:"",notice:null!==(i=d.announcement)&&void 0!==i?i:"",extProfile:Kt(c),joinPermission:~~d.joinPerm,removeMemberPermission:~~d.removePerm,invitePermission:~~d.memInvitePerm,inviteHandlePermission:~~d.invitePerm,groupInfoEditPermission:~~d.profilePerm,memberInfoEditPermission:~~d.memProfilePerm,creatorId:null!==(r=null==_?void 0:_.creatorId)&&void 0!==r?r:"",ownerId:null!==(o=null==_?void 0:_.ownerId)&&void 0!==o?o:"",createTime:(null==_?void 0:_.createTime)?Nt(_.createTime):0,membersCount:null!==(a=null==_?void 0:_.memberCount)&&void 0!==a?a:0,remark:null!==(l=null==g?void 0:g.remarkName)&&void 0!==l?l:"",joinedTime:(null==g?void 0:g.joinTime)?Nt(g.joinTime):0,role:null!==(u=null==g?void 0:g.role)&&void 0!==u?u:R.UNDEF}})),xt=(e=[])=>e.map((e=>{const t=Kt(e.settingProfile),n=e.extProfile||[],{targetId:s,baseInfo:i,userInfo:r}=e;return JSON.parse(JSON.stringify(Object.assign(Object.assign({groupId:s},qt(t)),{extProfile:n.length>0?Kt(n):void 0,creatorId:null==i?void 0:i.creatorId,ownerId:null==i?void 0:i.ownerId,createTime:(null==i?void 0:i.createTime)?Nt(i.createTime):void 0,membersCount:null==i?void 0:i.memberCount,remark:null==r?void 0:r.remarkName})))})),Ht=e=>{if(void 0===e)return;const t=Number(e);return Number.isNaN(t)?void 0:t},qt=e=>JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:Ht(e.joinPerm),removeMemberPermission:Ht(e.removePerm),invitePermission:Ht(e.memInvitePerm),inviteHandlePermission:Ht(e.invitePerm),groupInfoEditPermission:Ht(e.profilePerm),memberInfoEditPermission:Ht(e.memProfilePerm)})),Yt=(e=[])=>e.map((e=>{const{ext:t,userId:n,name:s,portraitUrl:i}=e||{},{role:r,joinTime:o,channelNickName:a,additional:l}=t||{};return{userId:n,name:s||"",portraitUri:i||"",nickname:a||"",role:r||R.UNDEF,joinedTime:Nt(o)||0,extra:l||""}})),Kt=e=>{let t={};return e&&0!==e.length?(e.forEach((e=>{t[e.key]=e.value})),t):t},jt=e=>e.map((e=>{const{targetId:t,joinUserInfo:n,inviterInfo:s,status:i,directionType:r,detail:o,joinType:a,processInfo:l,processTime:u}=e;return Object.assign(Object.assign(Object.assign(Object.assign({groupId:t},n&&{joinMemberInfo:Yt([n])[0]}),s&&{inviterInfo:Yt([s])[0]}),l&&{operatorInfo:Yt([l])[0]}),{status:i,direction:r,type:a,operationTime:Nt(u),reason:o})})),Qt=(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 Wt=(e,t)=>{const n=Math.floor(1e3*Math.random()%1e4),s=je.gen(),i=(e=>{e=e||"-";const t=new Date;return`${t.getFullYear()}${e}${t.getMonth()+1}${e}${t.getDate()}`})(),r=(new Date).getTime();let o="";if(t){const e=t.split(".");o=`.${e[e.length-1]}`}return`${e}__RC-${i}_${n}_${r}${s}${o}`},$t=e=>{const t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Jt=e=>{const{length:t}=e;return t<=4096&&t>=1},zt=(()=>{let e=0;return()=>{const t=((4294967295&Date.now())>>>0).toString(2),n=Math.floor(1048575*Math.random()),s=t+e.toString(2).padStart(11,"0")+n.toString(2).padStart(20,"0");return e=2047&++e,parseInt(s,2)}})(),Zt=()=>{const e=Ke.getInfo();let t="electron";for(let n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-next"].includes(n)?n:"electron");return t},Xt=(e,n,s)=>t(void 0,void 0,void 0,(function*(){const t=yield window.crypto.subtle.importKey("raw",(new TextEncoder).encode(n),"AES-CBC",!0,["decrypt"]),i=yield window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(s)},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(i)}));function en(e,t){var n;if(!e)return"";const s="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)?s?e.replace(/^https?:\/\//i,"https://"):e:t!==G.HTTP||s?`https://${e}`:`http://${e}`}const tn=(e,t)=>{if(!e)return"";const{ossConfig:n=""}=e;let s="";try{const e=JSON.parse(n);if(e.length>0){const t=e.find((e=>e.minio));t&&(s=t.minio)}}catch(e){t.warn(r.L_PARSE_JSON_E,JSON.stringify({ossConfig:n,error:e}))}return s};function nn(e){const t=e.method||Te.GET,n=e.timeout||Se,{headers:s,query:i,body:r,onProgress:o}=e,a=Qt(e.url,i),l=new XMLHttpRequest;if(l.open(t,a),s&&l.setRequestHeader)for(const e in s)l.setRequestHeader(e,s[e]);return function(e,t,n,s){return new ze((i=>{e.onreadystatechange=()=>{4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=()=>{i({status:e.status})},s&&(e.upload.onprogress=e=>s(e)),0!==t&&setTimeout((()=>{e.abort(),i({status:e.status})}),t),e.send(n)}),(t=>{e.abort(),t({status:-1})}))}(l,n,r,o)}var sn,rn;!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(sn||(sn={})),function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA",e[e.SG_A=4]="SG_A",e[e.SG_B=4]="SG_B",e[e.SA=5]="SA"}(rn||(rn={}));const on={[rn.BJ]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:G.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},[rn.SG]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:G.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},[rn.NA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:G.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},[rn.SG_B]:{naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:G.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},[rn.SA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:G.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]}};function an(e){return rn[e]?e:rn.BJ}const ln=new class{constructor(){this.initOption={}}init(e){this.initOption=e}getNaviUrlList(e,t){const{areaCode:n,navigators:s}=this.initOption||{},i=function(e=rn.BJ){return on[an(e)].naviUrlBase64}(n).map((e=>it(e)));let r=[];const[,o]=e.split("@");t&&(r=o?o.split(";"):[]);const a=s&&s.length>0?[...r,...s]:[...r,...i];return a.filter(((e,t)=>a.indexOf(e)===t)).map((e=>en(e)))}getLogUrlPolicyList(e,t){const{log:n,logPolicy:s}=e||{},{areaCode:i,logServerUrl:o}=this.initOption||{},a=function(e=rn.BJ){return on[an(e)].logUrlBase64}(i).map((e=>Object.assign(Object.assign({},e),{addr:it(e.addr)}))),l=[],u={level:1,itv:6,times:5};if(n)l.push(...n.addrs),Object.assign(u,n.policy);else if(s)try{const e=JSON.parse(s);l.push({addr:e.url,protocol:G.HTTPS,weight:1}),u.level=e.level,u.itv=e.itv,u.times=e.times}catch(n){t.warn(r.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}const d=o?[{addr:o,protocol:G.HTTPS,weight:101},...l]:[...l,...a];return{policy:u,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:en(e.addr,e.protocol)}))).sort(((e,t)=>t.weight-e.weight))}}getMiniCmpUrlList(){var e;const t=function(e=rn.BJ){return on[an(e)].miniCmpBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>it(e))),{miniCMPProxy:n}=this.initOption||{};return n&&n.length>0?n:t}getStaticConfigUrl(){var e;return function(e=rn.BJ){return on[an(e)].staticConfigUrlBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>it(e)))}getCloudControllerUrl(e){var t;return function(e=rn.BJ){return on[an(e)].cloudControllerUrlBase64}(null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>it(e)))}getAreaCode(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:rn.BJ}setAreaCode(e){return!(!e||!rn[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}};class un{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=>en(e.addr,e.protocol)))||[]}}}catch(e){this.logger.error(r.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 s=yield this.decryptData(n);if((null==s?void 0:s.areaCode)!==ln.getAreaCode())return;this.setCache(JSON.stringify({time:Date.now(),val:n})),this.staticUrls=(null==s?void 0:s.bootstrap)||[];const i=null===(e=null==s?void 0:s.resources)||void 0===e?void 0:e.navi.slice();return i.sort(((e,t)=>t.weight-e.weight)),{navi:i.map((e=>en(e.addr,e.protocol)))||[]}}))}_requestHandle(){return t(this,void 0,void 0,(function*(){let e=[...this.staticUrls,...ln.getStaticConfigUrl()].map((e=>en(e)));e=e.filter(((t,n)=>e.indexOf(t)===n));for(let t of e){this.logger.info(r.L_GET_STATIC_CONF_T,JSON.stringify({url:t}));const e=Date.now(),{code:n,data:s}=yield this.sendRequest(`${t}/${this.appkey}`);if(200===n)return this.logger.info(r.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:n,duration:Date.now()-e})),s;this.logger.warn(r.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:n,duration:Date.now()-e}))}}))}}var dn;!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD",e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(dn||(dn={}));class cn{constructor(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=dn.WARN,this.debug=this._log.bind(this,dn.DEBUG),this.info=this._log.bind(this,dn.INFO),this.warn=this._log.bind(this,dn.WARN),this.error=this._log.bind(this,dn.ERROR),this.__statistics=this._log.bind(this,dn.STATISTICS),this.record=this.__statistics}_write(e){const{tag:t,level:n,content:s,traceId:i}=e;/^[\w-]+$/.test(t)?n!==dn.DEBUG&&this._handleWrite(e):console.error(`${(new Date).toISOString()}[${this._id}]['ERROR']: ${t} | ${s} | ${i}`)}createTraceId(){return""+ ++cn._traceIdCount}getSessionId(){return Qe}_stdout(e){const{time:t,tag:n,content:s,traceId:i,level:r,loggerId:o}=e;if(!console)return;if(r<=dn.FATAL)return;if(r>this.outputLevel)return;const a=["error","warn","info","debug"][r-1],l=`${new Date(t).toISOString()}[${null!=o?o:this._id}][${(a||"stat").toUpperCase()}]: ${n} | ${s} | ${i}`;console[a||"warn"](l)}setOutputLevel(e){(e=>[dn.DEBUG,dn.INFO,dn.WARN,dn.ERROR].some((t=>t===e)))(e)&&(this.outputLevel=e)}_log(e,t,n,s){const i={time:Date.now(),level:e,tag:t,content:n,traceId:s,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(i),this._write(i)}summary(e,t,n,s={},i,r){var o,a;t.isOk?this.info(e,null!==(o=null==i?void 0:i())&&void 0!==o?o:JSON.stringify(Object.assign({isOk:!0},s)),n):this.warn(e,null!==(a=null==r?void 0:r())&&void 0!==a?a:JSON.stringify(Object.assign({code:t.code,msg:t.msg},s)),n)}}cn._traceIdCount=0;class hn{constructor(e,t,n,s,i,r=!1){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=s,this.logger=i,this.disableLogReport=r,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:s}=ln.getLogUrlPolicyList(e,this.logger);this.started=!0,this.itvByNavi=t.itv,this.timesByNavi=t.times,s.length>0&&this.realtimeReport(s[0].addr,t.level,t.itv,n)}))}_sendLogs2Realtime(e,n,s,i){return t(this,void 0,void 0,(function*(){this.logger.debug(r.L_REALTIME_LOG_O,`compress logs: ${e.length}`);const{success:t,data:o}=yield this.compressLogs(e);if(!t)return this.logger.warn(r.L_REALTIME_LOG_R,"compress failed",n),{isOk:!1,itv:i};this.logger.debug(r.L_REALTIME_LOG_O,"compress done",n);let a=ft(s)?s:`https://${s}`;a+=`?version=5.20.0-c-esm-alpha.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.deviceId}&deviceInfo=${this.deviceInfo}&platform=Web`;const{status:l,data:u}=yield this.send({url:a,body:o,method:"POST"});if(this.logger.debug(r.L_REALTIME_LOG_R,JSON.stringify({status:l,data:u}),n),200!==l)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(i+=i),this.reportFailedNumber++,{isOk:!1,itv:i};let d,c;if(this.reportFailedNumber=0,u)try{const e=JSON.parse(u);e.nextTime&&(i=e.nextTime),d=e.level,c=e.logSwitch}catch(e){this.logger.warn(r.L_PARSE_JSON_E,JSON.stringify({error:null==e?void 0:e.stack}),n)}return{isOk:!0,itv:i,level:d,logSwitch:c}}))}realtimeReport(e,n,s,i){return t(this,void 0,void 0,(function*(){const t=Date.now(),o=this.logDB.getTimestamp4RealtimeLog()||We,a=Math.max(t-3e4,o+1),l=this.logger.createTraceId();this.logger.debug(r.L_REALTIME_LOG_T,JSON.stringify({startTime:o,endTime:a,level:n,itv:s}),l);const{dbReady:u,logs:d}=yield this.logDB.getLogs(o,a,n,!0,i);if(u){if(0===d.length)this.logger.debug(r.L_REALTIME_LOG_R,"no logs",l);else if(d.length>0){const{itv:t,level:i,logSwitch:r,isOk:o}=yield this._sendLogs2Realtime(d,l,e,s);if(o){const e=Math.max(...d.map((e=>e.time)));this.logDB.setTimestamp4RealtimeLog(e+1),0===r&&(this.started=!1),void 0!==i&&(n=i)}s=t}}else this.logger.warn(r.L_REALTIME_LOG_R,"get logs failed",l);this.started&&(s>=60&&this.itvByNavi<60&&(s=60),this.timer=setTimeout((()=>this.realtimeReport(e,n,s,i)),1e3*s))}))}report(e,n,s,i,o,a,l=!1){return t(this,void 0,void 0,(function*(){if("web"!==s.toLowerCase()||this.disableLogReport)return;const t=this.logger.createTraceId();this.logger.info(r.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:n,logId:o,messageUId:a,isCloudControl:l}),t);const{dbReady:u,logs:d}=yield this.logDB.getLogs(e,n,dn.DEBUG,!1);this.logger.info(r.L_REPORT_FULL_LOG_O,JSON.stringify({count:d.length}),t);let c,h=ft(i)?i:`https://${i}`;if(h+=`?version=5.20.0-c-esm-alpha.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.deviceId}&deviceInfo=${this.deviceInfo}&platform=Web&logId=${o}`,u)if(d.length>0){const{success:e,data:t}=yield this.compressLogs(d);c=e?t:"compress failed"}else c="no data";else c="no database";this.logger.debug(r.L_REPORT_FULL_LOG_O,"compress done",t),l&&(h+="&source=cloud");const{status:_}=yield this.send({url:h,body:c,method:"POST"});this.logger.info(r.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),t)}))}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}const _n=e=>{const{sessionId:t,level:n,loggerId:s,traceId:i,time:r,tag:o,type:a}=e;let{content:l}=e;rt(l)||(l=JSON.stringify(l));let u=n<0?l||"":JSON.stringify({content:l,traceId:i,from:s});return u=`"${u.replace(/"/g,'""')}"`,`${t},${r},${a},${n},${o},${u}\n`};var gn,pn,En,fn,In;!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(gn||(gn={}));class Rn{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,s,i;this.taskLock=!1;const r=null!==(t=e.startTime)&&void 0!==t?t:0,o=null!==(n=e.endTime)&&void 0!==n?n:0,a=null!==(s=e.platform)&&void 0!==s?s:"",l=null!==(i=e.uri)&&void 0!==i?i:"";e.logId!==this.logId&&""!==l&&(this.logId=e.logId,this.reporter.report(r,o,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 Tn{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 Rn(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===F.LOG_COMMAND&&this.uploadTaskManage.uploadLogCmdTask(e)}))}}dataHandle(e){const t=this._cache;t.lastRequestTime=this.lastRequestTime,It(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,s){return t(this,void 0,void 0,(function*(){if(!this.isEable&&n===gn.init&&this.isExire())return this.logger.info(r.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),this.timestamp;if(!this.isEable&&n===gn.newWorkChange&&this.isOverclock())return this.logger.info(r.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),this.timestamp;const t=en(e);this.lastRequestTime=(new Date).getTime();const i=`${t}/v1/config`,o={"Content-Type":"application/json","RC-App-Key":this.appkey};s&&(o["RC-Token"]=s);const a={platform:"web",version:"5.20.0-c-esm-alpha.1",timestamp:this.timestamp};this.logger.record(re.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!s,uri:i}));const{code:l,data:u}=yield this.httpRequest(i,Te.POST,o,a);if(this.logger.record(re.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:u})),l===w.CLOUD_DATA_CENTER_INVALID&&u&&u.targetRegion){const e=u.targetRegion;if(this.changeAreaCode===e)return this.timestamp;const t=ln.setAreaCode(e);this.logger.info(r.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:t,originAreaCode:ln.getAreaCode(),newAreaCode:e})),this.changeAreaCode=e;const n=ln.getCloudControllerUrl(e);return n[0]?this.request(n[0],gn.other):(this.logger.info(r.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:i,msg:"appkey region error"})),this.timestamp)}return u&&this.dataHandle(u),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 mn=e=>e===w.RC_CONN_REDIRECTED;class Sn extends Je{constructor(e,t,n){super(),this.appkey=e,this.navi=t,this.logger=n,pn.add(this),this.token="",this.curCmpUrl="",this.retryCount=0,this.uuid="",In.set(this,0),this._doConnectReason=0,this._network={status:!0,type:Re.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=ee.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===ee.DISCONNECTED&&e===ee.CONNECTING&&(this._doConnectReason=Ee.CONNECT,n(this,pn,"m",fn).call(this)),this._crtConnectionStatus===ee.CONNECTED&&e===ee.SUSPENDED&&(t===w.RC_PING_EXCEED_LIMIT?this._doConnectReason=Ee.TIMEOUT:t===w.RC_CONN_REDIRECTED?this._doConnectReason=Ee.REDIRECTED:this._doConnectReason=Ee.RECONNECT),this._crtConnectionStatus===ee.CONNECTED){const s={bid:Zt(),cod:t,net:this.getNetwork().type,dur:Date.now()-n(this,In,"f"),cid:this.cid};this.logger.record(re.IM_CONNECTION_DURATION,JSON.stringify(s)),e===ee.SUSPENDED&&n(this,pn,"m",fn).call(this)}switch(this._crtConnectionStatus=e,e){case ee.CONNECTED:this.logger.info(r.L_CONNECT_S,`status: ${e}`),this.checkAlive(),n(this,pn,"m",En).call(this).emit("onConnected");break;case ee.CONNECTING:this.logger.warn(r.L_CONNECT_S,`status: ${e}`),n(this,pn,"m",En).call(this).emit("onConnecting");break;case ee.SUSPENDED:this.logger.warn(r.L_CONNECT_S,`status: ${e}, code: ${t}`),mn(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),n(this,pn,"m",En).call(this).emit("onSuspend",t);break;default:this.logger.warn(r.L_CONNECT_S,`status: ${e}, code: ${t}`),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),n(this,pn,"m",En).call(this).emit("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(re.IM_NETWORK_CHANGE,JSON.stringify(t))}this._network=e}getNetwork(){return this._network}connect(e,n,s,i){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus===ee.CONNECTED)return Xe(this._crtUserId);if(this._crtConnectionTask)return this._crtConnectionTask;this._openCallPlus=s,this.token=e,this.setConnectionStatus(ee.CONNECTING);const{code:t,data:r}=yield this.try2Connect(e,n,!1,i,!0);return t!==w.SUCCESS?(this.setConnectionStatus(ee.DISCONNECTED,t),et(t)):(this.setConnectionStatus(ee.CONNECTED),Xe(r))}))}try2Connect(e,n,s,i,r){return t(this,void 0,void 0,(function*(){if(this._crtConnectionTask)return this._crtConnectionTask;this._crtConnectionTask=this.createConnectionTask(e,n,s,i,r);const t=yield this._crtConnectionTask;return this._crtConnectionTask=null,t}))}createConnectionTask(e,n,i,o,a){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(re.IM_STATS_CS,JSON.stringify(t));const l={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},{code:u,data:d}=yield this.navi.request(e,i,!1,o,l);if(u!==w.SUCCESS)return et(u);const c=d;if(1===c.type)return et(w.PACKAGE_ENVIRONMENT_ERROR);this.logger.info(r.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:n}),o);const{code:h,data:_}=yield this.connectWithToken(e.replace(/@.+$/,"@"),c,n,o);if(a||h===w.SUCCESS||(this.retryCount+=1),mn(h))return this.logger.warn(r.L_CONNECT_R,`redirect code: ${h}`,o),this.clearCmpWeightCache(),this.createConnectionTask(e,n,!0,o,a);if([w.RC_TCP_RESET,w.RC_CONN_ACK_TIMEOUT,w.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1){this.updateCmpWeight(this.curCmpUrl,!1);const t=this.cmpWeightCache.every((e=>e.failed));return a&&t?(this.logger.warn(r.L_CONNECT_R,`cpp code:${h},reture code:${w.SERVER_UNAVAILABLE}`,o),et(w.SERVER_UNAVAILABLE)):(this.logger.warn(r.L_CONNECT_R,`cmp ack timeout, code: ${h}`,o),this.setConnectionStatus(ee.SUSPENDED,h),this.setConnectionStatus(ee.CONNECTING),this.createConnectionTask(e,n,!1,o,a))}return h!==w.SUCCESS?(this.logger.warn(r.L_CONNECT_R,`code: ${h}`,o),et(h)):(this.logger.info(r.L_CONNECT_R,`userId: ${_}`,o),s(this,In,Date.now(),"f"),this._crtUserId=_,Xe(_))}))}try2Reconnect(e,n){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.debug(r.T,`try2Reconnect -> ignoreNaviCache: ${e}, reason: ${n}`,s),this.stopReconnectTimer();const i=()=>t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==ee.SUSPENDED)return;this.setConnectionStatus(ee.CONNECTING,n);const{code:t}=yield this.try2Connect(this.token,!0,e,s,!1);this.reconnectTimer=null,t!==w.SUCCESS?[w.SERVER_UNAVAILABLE,w.TIMEOUT,w.RC_SOCKET_DISCONNECTED,w.RC_SOCKET_NOT_CREATED,w.RC_CONN_ACK_TIMEOUT,w.RC_TCP_RESET,w.RC_NAVI_REQ_FAILED,w.RC_NETWORK_DOWN,w.RC_TCP_DISCONNECTED_NO_RMTP].includes(t)?this._crtConnectionStatus===ee.CONNECTING&&(this.setConnectionStatus(ee.SUSPENDED,t),this.reconnectTimer=setTimeout(i,5e3)):this.setConnectionStatus(ee.DISCONNECTED,t):this.setConnectionStatus(ee.CONNECTED)}));i()}))}onDisconnectByServer(e,t){return mn(e)?(this.setConnectionStatus(ee.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===w.RC_UDP_DISCONNECTED?(this.setConnectionStatus(ee.SUSPENDED,e),void setTimeout((()=>{this.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(ee.DISCONNECTED,e)}onDisconenctUnusual(e){this.setConnectionStatus(ee.SUSPENDED,e),this.try2Reconnect(!1,e)}checkAlive(){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==ee.CONNECTED)return this._failedCount=0,void this.logger.debug(r.L_CHECK_ALIVE_IM_S,"stop ping because of no connection");const e=this.logger.createTraceId();this.logger.debug(r.L_CHECK_ALIVE_IM_T,null,e);const t=yield this.sendPing(15e3);if(t===w.SUCCESS)return this.logger.debug(r.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,void(this._checkAliveTimer=setTimeout((()=>this.checkAlive()),15e3));if(this._crtConnectionStatus===ee.CONNECTED){if(this._failedCount+=1,this.logger.debug(r.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(r.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(ee.SUSPENDED,w.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,w.RC_PING_EXCEED_LIMIT)}}))}disconnect(e){return t(this,void 0,void 0,(function*(){this.stopReconnectTimer(),this._crtConnectionTask&&(yield this._crtConnectionTask),this.setConnectionStatus(ee.DISCONNECTED,w.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=Bt(e,t);return this.cmpWeightCache=[...n],[...n]}updateCmpWeight(e,t,n){if(!this.cmpWeightCache)return;const s=this.cmpWeightCache.find((t=>n?t.addr===e&&t.protocol===G.QUIC:t.addr===e));if(s)if(t){const e=Math.max(...this.cmpWeightCache.map((e=>e.weight)));s.weight!==e&&(s.weight=e+1)}else{const e=Math.min(...this.cmpWeightCache.map((e=>e.weight)));s.weight!==e&&(s.weight=e-1),s.failed=!0}}clearCmpWeightCache(){this.cmpWeightCache=void 0}reconnect(e,t,n,s){this.token=e,this._openCallPlus=n,this.onDisconenctUnusual(s)}}In=new WeakMap,pn=new WeakSet,En=function(){return this},fn=function(){this.uuid=je.gen(),this.retryCount=0};const Cn=e=>e.replace(/@.+$/,"@");class vn{constructor(e,t,n,s=!0,i=!0){this.appkey=e,this.logger=t,this.staticConfigManager=n,this.isRequestProfile=s,this.isUseDynamicNaviUrl=i,this.crtRequest=null,this._environment="default"}getCatchKey(e){return e+(this._environment?`-${this._environment}`:"")}request(e,n,s,i,r){return t(this,void 0,void 0,(function*(){if(this.crtRequest)return this.crtRequest;this.crtRequest=this.sendRequest(e,n,s,i,r);const t=yield this.crtRequest;return this.crtRequest=null,t}))}sendRequest(e,n,s,i,o){var a;return t(this,void 0,void 0,(function*(){const t=Cn(e),l=this.getNaviCache(t);if(!n&&l){const{timestamp:e,naviInfo:t}=l;if(s||Date.now()-e<me){if(this.logger.info(r.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:t}),i),o){const{uuid:e,retryCount:n,reason:s}=o,r={bid:Zt(),ptc:he.NAVI,cod:w.SUCCESS,net:o.type,dur:0,spr:0,pr:null!==(a=t.type)&&void 0!==a?a:0,hos:"",cache:_e.LOCAL,v:ge.CURRENT,rsn:s,cid:`${e}_${n}`,count:n};this.logger.record(re.IM_NAVI,JSON.stringify(r),i)}return Xe(t)}}const u=ln.getNaviUrlList(e,this.isUseDynamicNaviUrl);this.logger.info(r.L_GET_NAVI_T,JSON.stringify({token:e,uris:u}),i);let{code:d,data:c}=yield this.requestHandler(u,e,i,o);if(d===w.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,s=yield this.requestHandler(n,e,i,o);d=s.code,c=s.data}}if(d!==w.SUCCESS)return this.logger.warn(r.L_GET_NAVI_R,d,i),et(d);const h=c;if(h.code&&200!==h.code)return this.logger.warn(r.L_GET_NAVI_R,h.code,i),et(this.transHttpCode(h.code));if(!(Bt(h).length>0)){const e={server:h.server,backupServer:h.backupServer,serverAddr:h.serverAddr,bs:h.bs};return this.logger.warn(r.L_GET_NAVI_R,`navi server address invalid: ${JSON.stringify(e)}`,i),et(w.SERVER_UNAVAILABLE)}return this.logger.info(r.L_GET_NAVI_R,JSON.stringify({naviInfo:h}),i),this.setNaviCache(t,h),Xe(h)}))}requestHandler(e,n,s,i){return t(this,void 0,void 0,(function*(){for(let t=0,r=e.length;t<r;t+=1){const r=t===e.length-1,o=this.useV2Navi()?this.httpRequestV2:this.httpRequest,a=Date.now(),{code:l,data:u}=yield o.call(this,e[t],this.appkey,n,s,r),d={bid:Zt(),ptc:he.NAVI,cod:l,net:null==i?void 0:i.type,dur:Date.now()-a,spr:0,pr:(null==u?void 0:u.type)||0,hos:e[t],cache:_e.REQUEST,v:ge.CURRENT,rsn:null==i?void 0:i.reason,cid:`${null==i?void 0:i.uuid}_${null==i?void 0:i.retryCount}`,count:null==i?void 0:i.retryCount};if(this.logger.record(re.IM_NAVI,JSON.stringify(d),s),[w.SUCCESS,w.RC_CONN_TOKEN_INCORRECT,w.RC_LICENSE_EXPIRED].includes(l))return l===w.SUCCESS?Xe(u):et(l)}return et(w.RC_NAVI_REQ_FAILED)}))}transHttpCode(e){switch(e){case 401:case 403:return w.RC_CONN_TOKEN_INCORRECT;case 416:return w.RC_LICENSE_EXPIRED;default:return w.RC_NAVI_REQ_FAILED}}getNaviInfoFromCache(e){const t=this.getNaviCache(Cn(e));return t?t.naviInfo:null}updateVoipCallInfo(e,t){const n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(Cn(e),Object.assign(Object.assign({},n),{voipCallInfo:t}))}getNaviV2RequestOption(e){const{uri:t,token:n,platform:s,protocol:i,mac:r}=e;let o="";o=`${t}/v2/navi.json?cloud=0`;let a=`token=${encodeURIComponent(n)}&version=5.20.0-c-esm-alpha.1&platfrom=${s}`;return r&&(a+=`&m=${r}`),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":`conn=${i};rtc=4;log=2;iptype=v4,v6`},body:a,url:o,timeout:1e4}}useV2Navi(){return!0}}const yn=()=>!("undefined"==typeof uni||!(e=>{const t=["request","getSystemInfo"];for(let n=0,s=t.length;n<s;n++)if(!e[t[n]])return!1;return!0})(uni));var An,Nn,On;class Mn{constructor(e){An.add(this),Nn.set(this,void 0),s(this,Nn,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,An,"m",On).call(this,e,n(this,Nn,"f"))}))}}Nn=new WeakMap,An=new WeakSet,On=function e(s,i){return t(this,void 0,void 0,(function*(){if(0===s.length)return et(w.STREAM_MESSAGE_REQUEST_FAIL,"All addrs failed");const r=s.shift();let o=en(r.addr,r.protocol);o=`${o}/v3/message/get_stream.json?sdkVersion=5.20.0-c-esm-alpha.1&platform=${this._platform}&messageUID=${i.msgUId}`;const a=yield this._openHandler(o,i);return a.or((r=>t(this,void 0,void 0,(function*(){return-1===r?n(this,An,"m",e).call(this,s,i):a}))))}))};const Un=yn();let Ln=null;const Pn=e=>t(void 0,void 0,void 0,(function*(){const t=yield Dn.getNetworkType();Ln({status:"online"===e.type,type:t})}));class bn extends Mn{constructor(){super(...arguments),this._platform="Websocket"}_openHandler(e,n){return t(this,void 0,void 0,(function*(){return new Promise((t=>{this._logger.debug(r.L_REQ_STREAM_MSG_CONTENT_O,`try open -> ${e}`);const s=new XMLHttpRequest;s.open("GET",e,!0),s.timeout=n.timeout,s.ontimeout=()=>{this._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,`timeout -> ${e}`),t(et(-1,"timeout"))},s.onreadystatechange=i=>{if(s.readyState!==XMLHttpRequest.HEADERS_RECEIVED)return;const o=s.getResponseHeader("Content-Type"),a=null==o?void 0:o.startsWith("text/event-stream");if(200!==s.status||!a)return void(s.onloadend=()=>{const e=JSON.parse(s.response);t(et(e.code,e.message))});t(Xe());let l=0;s.onprogress=e=>{const t=s.response.slice(l);l=s.response.length,n.onRawContent(t)},s.onerror=t=>{this._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,`network error in transit -> ${e}`),s.onprogress=null,s.abort(),n.onNetworkError(w.STREAM_MESSAGE_REQUEST_FAIL)}},s.onerror=n=>{this._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,`req fail -> ${e}`),t(et(-1))},s.setRequestHeader("Content-Type","application/json;charset=UTF-8"),s.setRequestHeader("App-Key",n.appkey),s.setRequestHeader("Authorization",`Bearer ${n.token}`),s.send()}))}))}}const Dn={tag:"browser",httpReq:e=>nn(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:Un,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:s}=t;e(n,s)}},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:Re.UNKONWN},n=e||t||Re.UNKONWN;return Promise.resolve(n)},setNetworkStatusListener:function(e){Ln=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",Pn),window.addEventListener("online",Pn))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",Pn),window.removeEventListener("online",Pn)),Ln=null},createSSEClient:e=>Xe(new bn(e))},wn=yn(),Vn=e=>(...t)=>{try{return wx[e](...t)}catch(e){null===console||void 0===console||console.error(e)}},Gn={setItem:Vn("setStorageSync"),getItem:Vn("getStorageSync"),removeItem:Vn("removeStorageSync"),clear:Vn("clearStorageSync")};let kn=null;const Bn=e=>{const{isConnected:t,networkType:n}=e;kn({status:t,type:n})};const Fn={tag:"wechat",httpReq(e){const t=e.method||Te.GET,n=e.timeout||Se,{headers:s,query:i,body:r}=e,o=Qt(e.url,i);return new Promise((e=>{wx.request({url:o,method:t,header:s,timeout:n,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:w.RC_HTTP_REQ_FAIL})}})}))},localStorage:Gn,sessionStorage:Gn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:wn,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(Re.UNKONWN)}})})),setNetworkStatusListener:function(e){kn=e,wx.onNetworkStatusChange(Bn)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(Bn),kn=null},createSSEClient:e=>et(w.NOT_SUPPORT)},xn=yn(),Hn=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){}},qn={setItem:Hn("setStorageSync"),getItem:Hn("getStorageSync"),removeItem:Hn("removeStorageSync"),clear:Hn("clearStorageSync")};let Yn=null;const Kn=e=>{const{isConnected:t,networkType:n}=e;Yn({status:t,type:n})};const jn={tag:"alipay",httpReq(e){const t=e.method||Te.GET,n=e.timeout||Se,{headers:s,query:i,body:r}=e,o=Qt(e.url,i),a=e.dataType||"json";return new Promise((e=>{my.request({url:o,method:t,headers:s,timeout:n,data:r,dataType:a,success:t=>{e({data:t.data,status:t.status})},fail:()=>{e({status:w.RC_HTTP_REQ_FAIL})}})}))},localStorage:qn,sessionStorage:qn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:xn,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(Re.UNKONWN)}})})),setNetworkStatusListener:function(e){Yn=e,my.onNetworkStatusChange(Kn)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(Kn),Yn=null},createSSEClient:e=>et(w.NOT_SUPPORT,"Not supported yet")},Qn=yn(),Wn=e=>(...t)=>{try{return tt[e](...t)}catch(e){}},$n={setItem:Wn("setStorageSync"),getItem:Wn("getStorageSync"),removeItem:Wn("removeStorageSync"),clear:Wn("clearStorageSync")};let Jn=null;const zn=e=>{const{isConnected:t,networkType:n}=e;Jn({status:t,type:n})};const Zn={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Qn,localStorage:$n,sessionStorage:$n,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)||{},s={data:JSON.stringify(n),status:e.statusCode};t(s)},fail(e){t({status:w.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(Re.UNKONWN)}})})),setNetworkStatusListener:function(e){Jn=e,tt.onNetworkStatusChange(zn)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(zn),Jn=null},createSSEClient:e=>et(w.NOT_SUPPORT)},Xn=yn(),es=e=>(...t)=>{try{return swan[e](...t)}catch(e){}},ts={setItem:es("setStorageSync"),getItem:es("getStorageSync"),removeItem:es("removeStorageSync"),clear:es("clearStorageSync")};let ns=null;const ss=e=>{const{isConnected:t,networkType:n}=e;ns({status:t,type:n})};const is={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Xn,localStorage:ts,sessionStorage:ts,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)||{},s={data:JSON.stringify(n),status:e.statusCode};t(s)},fail(e){t({status:w.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(Re.UNKONWN)}})}))}))},setNetworkStatusListener:function(e){ns=e,swan.onNetworkStatusChange(ss)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(ss),ns=null},createSSEClient:e=>et(w.NOT_SUPPORT)},rs=yn(),os=e=>(...t)=>{try{return jd[e](...t)}catch(e){null===console||void 0===console||console.error(e)}},as={setItem:os("setStorageSync"),getItem:os("getStorageSync"),removeItem:os("removeStorageSync"),clear:os("clearStorageSync")};let ls=null;const us=e=>{const{isConnected:t,networkType:n}=e;ls({status:t,type:n})};const ds={tag:"jingdong",httpReq(e){const t=e.method||Te.GET,n=e.timeout||Se,{headers:s,query:i,body:r}=e,o=Qt(e.url,i);return new Promise((e=>{jd.request({url:o,method:t,header:s,timeout:n,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:w.RC_HTTP_REQ_FAIL})}})}))},localStorage:as,sessionStorage:as,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:rs,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(Re.UNKONWN)}})})),setNetworkStatusListener:function(e){ls=e,jd.onNetworkStatusChange(us)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(us),ls=null},createSSEClient:e=>et(w.NOT_SUPPORT)},cs=e=>(...t)=>{try{return uni[e](...t)}catch(e){null===console||void 0===console||console.error(e)}},hs={setItem:cs("setStorageSync"),getItem:cs("getStorageSync"),removeItem:cs("removeStorageSync"),clear:cs("clearStorageSync")};let _s=null;const gs=e=>{const{isConnected:t,networkType:n}=e;_s({status:t,type:n})};const ps={tag:"uniapp",httpReq(e){const t=e.method||Te.GET,n=e.timeout||Se,{headers:s,query:i,body:r}=e,o=Qt(e.url,i);return new Promise((e=>{uni.request({url:o,method:t,header:s,timeout:n,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:w.RC_HTTP_REQ_FAIL})}})}))},localStorage:hs,sessionStorage:hs,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket(e,t){const n={complete(){},url:e,protocols:t},s=uni.connectSocket(n);return{id:Date.now(),onClose(e){s.onClose((t=>{e(t.code,t.reason)}))},onError(e){s.onError((t=>{e(t.errMsg)}))},onMessage(e){s.onMessage((t=>{e(t.data)}))},onOpen(e){s.onOpen(e)},send(e){s.send({data:e})},close(e,t){s.close({code:e,reason:t})}}},getNetworkType:()=>new Promise((e=>{uni.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Re.UNKONWN)}})})),setNetworkStatusListener:function(e){_s=e,uni.onNetworkStatusChange(gs)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(gs),_s=null},createSSEClient:e=>et(w.NOT_SUPPORT)},Es=e=>e&&e.request&&e.getSystemInfo,fs="undefined"!=typeof uni&&Es(uni)?(()=>{switch(process.env.VUE_APP_PLATFORM){case"app-plus":case"app":return ps;case"mp-jd":return ds;case"mp-baidu":return is;case"mp-toutiao":return Zn;case"mp-alipay":return jn;case"mp-weixin":return Fn;default:return Dn}})():"undefined"!=typeof jd&&Es(jd)?ds:"undefined"!=typeof my&&Es(my)?jn:"undefined"!=typeof tt&&Es(tt)?Zn:"undefined"!=typeof swan&&Es(swan)?is:"undefined"!=typeof wx&&Es(wx)?Fn:Dn;function Is(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,s,r;return t?(r=(e>>>=0)>=0&&e<256)&&(s=l[e])?s:(n=i(e,(0|e)<0?-1:0,!0),r&&(l[e]=n),n):(r=(e|=0)>=-128&&e<128)&&(s=a[e])?s:(n=i(e,e<0?-1:0,!1),r&&(a[e]=n),n)}function s(e,t){if(isNaN(e)||!isFinite(e))return t?p:g;if(t){if(e<0)return p;if(e>=c)return T}else{if(-h>=e)return m;if(e+1>=h)return R}return e<0?s(-e,t).neg():i(0|e%d,0|e/d,t)}function i(t,n,s){return new e(t,n,s)}function r(e,t,n){var i,o,a,l,d,c,h;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return r(e.substring(1),t,n).neg();for(o=s(u(n,8)),a=g,l=0;l<e.length;l+=8)d=Math.min(8,e.length-l),c=parseInt(e.substring(l,l+d),n),d<8?(h=s(u(n,d)),a=a.mul(h).add(s(c))):a=(a=a.mul(o)).add(s(c));return a.unsigned=t,a}function o(t){return t instanceof e?t:"number"==typeof t?s(t):"string"==typeof t?r(t):i(t.low,t.high,t.unsigned)}var a,l,u,d,c,h,_,g,p,E,f,I,R,T,m,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=s,e.fromBits=i,u=Math.pow,e.fromString=r,e.fromValue=o,h=(c=(d=4294967296)*d)/2,_=n(16777216),g=n(0),e.ZERO=g,p=n(0,!0),e.UZERO=p,E=n(1),e.ONE=E,f=n(1,!0),e.UONE=f,I=n(-1),e.NEG_ONE=I,R=i(-1,2147483647,!1),e.MAX_VALUE=R,T=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=T,m=i(0,-2147483648,!1),e.MIN_VALUE=m,(S=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},S.toString=function(e){var t,n,i,r,o,a,l,d;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(m)?(t=s(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(r=s(u(e,6),this.unsigned),o=this,a="";;){if(l=o.div(r),d=(o.sub(l.mul(r)).toInt()>>>0).toString(e),(o=l).isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+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(m)?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=o(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=o(e)),this.eq(e))return 0;var n=this.isNegative(),s=e.isNegative();return n&&!s?-1:!n&&s?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(m)?m:this.not().add(E)},S.neg=S.negate,S.add=function(e){var n,s,r,a,l,u,d,c,h,_,g;return t(e)||(e=o(e)),n=this.high>>>16,s=65535&this.high,r=this.low>>>16,a=65535&this.low,l=e.high>>>16,u=65535&e.high,d=e.low>>>16,c=0,h=0,_=0,g=0,_+=(g+=a+(65535&e.low))>>>16,h+=(_+=r+d)>>>16,c+=(h+=s+u)>>>16,c+=n+l,i((_&=65535)<<16|(g&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},S.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){var n,r,a,l,u,d,c,h,p,E,f,I;return this.isZero()?g:(t(e)||(e=o(e)),e.isZero()?g:this.eq(m)?e.isOdd()?m:g:e.eq(m)?this.isOdd()?m:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(_)&&e.lt(_)?s(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,r=65535&this.high,a=this.low>>>16,l=65535&this.low,u=e.high>>>16,d=65535&e.high,c=e.low>>>16,p=0,E=0,f=0,I=0,f+=(I+=l*(h=65535&e.low))>>>16,E+=(f+=a*h)>>>16,f&=65535,E+=(f+=l*c)>>>16,p+=(E+=r*h)>>>16,E&=65535,p+=(E+=a*c)>>>16,E&=65535,p+=(E+=l*d)>>>16,p+=n*h+r*c+a*d+l*u,i((f&=65535)<<16|(I&=65535),(p&=65535)<<16|(E&=65535),this.unsigned)))},S.mul=S.multiply,S.divide=function(e){var n,i,r,a,l,d,c;if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return p;if(e.gt(this.shru(1)))return f;r=p}else{if(this.eq(m))return e.eq(E)||e.eq(I)?m:e.eq(m)?E:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?E:I:(i=this.sub(e.mul(n)),r=n.add(i.div(e)));if(e.eq(m))return this.unsigned?p:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),l=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),c=(d=s(n)).mul(e);c.isNegative()||c.gt(i);)c=(d=s(n-=l,this.unsigned)).mul(e);d.isZero()&&(d=E),r=r.add(d),i=i.sub(c)}return r},S.div=S.divide,S.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.not=function(){return i(~this.low,~this.high,this.unsigned)},S.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return t(e)||(e=o(e)),i(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?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(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?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},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?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},S.shru=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:i(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 s(e,t,n,s,i){var r,o,a=8*i-s-1,l=(1<<a)-1,u=l>>1,d=-7,c=n?i-1:0,h=n?-1:1,_=e[t+c];for(c+=h,r=_&(1<<-d)-1,_>>=-d,d+=a;d>0;r=256*r+e[t+c],c+=h,d-=8);for(o=r&(1<<-d)-1,r>>=-d,d+=s;d>0;o=256*o+e[t+c],c+=h,d-=8);if(0===r)r=1-u;else{if(r===l)return o?NaN:1/0*(_?-1:1);o+=Math.pow(2,s),r-=u}return(_?-1:1)*o*Math.pow(2,r-s)}function i(e,t,n,s,i,r){var o,a,l,u=8*r-i-1,d=(1<<u)-1,c=d>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,_=s?0:r-1,g=s?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,o=d):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+c>=1?h/l:h*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=d?(a=0,o=d):o+c>=1?(a=(t*l-1)*Math.pow(2,i),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;e[n+_]=255&a,_+=g,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[n+_]=255&o,_+=g,o/=256,u-=8);e[n+_-g]|=128*p}var r,o,a,l,u,d=function(e,t,n){if(void 0===e&&(e=d.DEFAULT_CAPACITY),void 0===t&&(t=d.DEFAULT_ENDIAN),void 0===n&&(n=d.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?o: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 d.VERSION="5.0.1",d.LITTLE_ENDIAN=!0,d.BIG_ENDIAN=!1,d.DEFAULT_CAPACITY=16,d.DEFAULT_ENDIAN=d.BIG_ENDIAN,d.DEFAULT_NOASSERT=!1,d.Long=e||null,(r=d.prototype).__isByteBuffer__,Object.defineProperty(r,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=new ArrayBuffer(0),a=String.fromCharCode,d.accessor=function(){return Uint8Array},d.allocate=function(e,t,n){return new d(e,t,n)},d.concat=function(e,t,n,s){var i,r,o,a,l,u;for(("boolean"==typeof t||"string"!=typeof t)&&(s=n,n=t,t=void 0),i=0,o=0,a=e.length;a>o;++o)d.isByteBuffer(e[o])||(e[o]=d.wrap(e[o],t)),(r=e[o].limit-e[o].offset)>0&&(i+=r);if(0===i)return new d(0,n,s);for(u=new d(i,n,s),o=0;a>o;)(r=(l=e[o++]).limit-l.offset)<=0||(u.view.set(l.view.subarray(l.offset,l.limit),u.offset),u.offset+=r);return u.limit=u.offset,u.offset=0,u},d.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},d.type=function(){return ArrayBuffer},d.wrap=function(e,t,n,s){var i,o;if("string"!=typeof t&&(s=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return d.fromBase64(e,n);case"hex":return d.fromHex(e,n);case"binary":return d.fromBinary(e,n);case"utf8":return d.fromUTF8(e,n);case"debug":return d.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(d.isByteBuffer(e))return(i=r.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new d(0,n,s),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new d(0,n,s),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((i=new d(e.length,n,s)).limit=e.length,o=0;o<e.length;++o)i.view[o]=e[o]}return i},r.writeBitSet=function(e,t){var n,s,i,r,o,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(s=t,r=(i=e.length)>>3,o=0,t+=this.writeVarint32(i,t);r--;)n=1&!!e[o++]|(1&!!e[o++])<<1|(1&!!e[o++])<<2|(1&!!e[o++])<<3|(1&!!e[o++])<<4|(1&!!e[o++])<<5|(1&!!e[o++])<<6|(1&!!e[o++])<<7,this.writeByte(n,t++);if(i>o){for(a=0,n=0;i>o;)n|=(1&!!e[o++])<<a++;this.writeByte(n,t++)}return l?(this.offset=t,this):t-s},r.readBitSet=function(e){var t,n,s,i,r,o,a,l=void 0===e;for(l&&(e=this.offset),i=(s=(n=this.readVarint32(e)).value)>>3,r=0,o=[],e+=n.length;i--;)t=this.readByte(e++),o[r++]=!!(1&t),o[r++]=!!(2&t),o[r++]=!!(4&t),o[r++]=!!(8&t),o[r++]=!!(16&t),o[r++]=!!(32&t),o[r++]=!!(64&t),o[r++]=!!(128&t);if(s>r)for(a=0,t=this.readByte(e++);s>r;)o[r++]=!!(1&t>>a++);return l&&(this.offset=e),o},r.readBytes=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),s&&(this.offset+=e),n},r.writeBytes=r.append,r.writeInt8=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,s&&(this.offset+=1),this},r.writeByte=r.writeInt8,r.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},r.readByte=r.readInt8,r.writeUint8=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,s&&(this.offset+=1),this},r.writeUInt8=r.writeUint8,r.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},r.readUInt8=r.readUint8,r.writeInt16=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}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),s&&(this.offset+=2),this},r.writeShort=r.writeInt16,r.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},r.readShort=r.readInt16,r.writeUint16=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}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),s&&(this.offset+=2),this},r.writeUInt16=r.writeUint16,r.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},r.readUInt16=r.readUint16,r.writeInt32=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}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),s&&(this.offset+=4),this},r.writeInt=r.writeInt32,r.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},r.readInt=r.readInt32,r.writeUint32=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}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),s&&(this.offset+=4),this},r.writeUInt32=r.writeUint32,r.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},r.readUInt32=r.readUint32,e&&(r.writeInt64=function(t,n){var s,i,r,o=void 0===n;if(o&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=8,i=t.low,r=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&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,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),o&&(this.offset+=8),this},r.writeLong=r.writeInt64,r.readInt64=function(t){var n,s,i,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+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,s=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,s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0):(s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,s,!1),r&&(this.offset+=8),i},r.readLong=r.readInt64,r.writeUint64=function(t,n){var s,i,r,o=void 0===n;if(o&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=8,i=t.low,r=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&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,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),o&&(this.offset+=8),this},r.writeUInt64=r.writeUint64,r.readUint64=function(t){var n,s,i,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+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,s=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,s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0):(s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,s,!0),r&&(this.offset+=8),i},r.readUInt64=r.readUint64),r.writeFloat32=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),s&&(this.offset+=4),this},r.writeFloat=r.writeFloat32,r.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=s(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},r.readFloat=r.readFloat32,r.writeFloat64=function(e,t){var n,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),s&&(this.offset+=8),this},r.writeDouble=r.writeFloat64,r.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=s(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},r.readDouble=r.readFloat64,d.MAX_VARINT32_BYTES=5,d.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},d.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},d.zigZagDecode32=function(e){return e>>>1^-(1&e)},r.writeVarint32=function(e,t){var n,s,i,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)}for((t+=s=d.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=s,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,r?(this.offset=t,this):s},r.writeVarint32ZigZag=function(e,t){return this.writeVarint32(d.zigZagEncode32(e),t)},r.readVarint32=function(e){var t,n,s,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,s=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(s|=(127&t)<<7*n),++n}while(128&t);return s|=0,r?(this.offset=e,s):{value:s,length:n}},r.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=d.zigZagDecode32(t.value):t=d.zigZagDecode32(t),t},e&&(d.MAX_VARINT64_BYTES=10,d.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==s?n<16384?n<128?1:2:1<<21>n?3:4:s<16384?s<128?5:6:1<<21>s?7:8:i<128?9:10},d.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},d.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},r.writeVarint64=function(t,n){var s,i,r,o,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()),s=d.calculateVarint64(t),i=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,o=t.shiftRightUnsigned(56).toInt()>>>0,(n+=s)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=s,s){case 10:this.view[n+9]=1&o>>>7;case 9:this.view[n+8]=9!==s?128|o:127&o;case 8:this.view[n+7]=8!==s?128|r>>>21:127&r>>>21;case 7:this.view[n+6]=7!==s?128|r>>>14:127&r>>>14;case 6:this.view[n+5]=6!==s?128|r>>>7:127&r>>>7;case 5:this.view[n+4]=5!==s?128|r:127&r;case 4:this.view[n+3]=4!==s?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==s?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==s?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==s?128|i:127&i}return l?(this.offset+=s,this):s},r.writeVarint64ZigZag=function(e,t){return this.writeVarint64(d.zigZagEncode64(e),t)},r.readVarint64=function(t){var n,s,i,r,o,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,s=0,i=0,r=0,o=0,s=127&(o=this.view[t++]),128&o&&(s|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(i=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(r=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<7,128&o||this.noAssert&&void 0===o))))))))))throw Error("Buffer overrun");return a=e.fromBits(s|i<<28,i>>>4|r<<24,!1),l?(this.offset=t,a):{value:a,length:t-n}},r.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=d.zigZagDecode64(n.value):n=d.zigZagDecode64(n),n}),r.writeCString=function(e,n){var s,i,r,o=void 0===n;if(o&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(s=0;i>s;++s)if(0===e.charCodeAt(s))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=u.calculateUTF16asUTF8(t(e))[1],n+=i+1,r=this.buffer.byteLength,n>r&&this.resize((r*=2)>n?r:n),n-=i+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,o?(this.offset=n,this):i},r.readCString=function(e){var t,s,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,i=-1,u.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),s=n(),!0),r?(this.offset=e,s()):{string:s(),length:e-t}},r.writeIString=function(e,n){var s,i,r,o=void 0===n;if(o&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,s=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+s,r=this.buffer.byteLength,n>r&&this.resize((r*=2)>n?r:n),n-=4+s,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):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s),n+=4,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+s)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+s));return o?(this.offset=n,this):n-i},r.readIString=function(e){var t,n,s,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),s=this.readUTF8String(n,d.METRICS_BYTES,e+=4),e+=s.length,i?(this.offset=e,s.string):{string:s.string,length:e-t}},d.METRICS_CHARS="c",d.METRICS_BYTES="b",r.writeUTF8String=function(e,n){var s,i,r,o=void 0===n;if(o&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=n,s=u.calculateUTF16asUTF8(t(e))[1],n+=s,r=this.buffer.byteLength,n>r&&this.resize((r*=2)>n?r:n),n-=s,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),o?(this.offset=n,this):n-i},r.writeString=r.writeUTF8String,d.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},d.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},d.calculateString=d.calculateUTF8Bytes,r.readUTF8String=function(e,t,s){var i,r,o,a,l;if("number"==typeof t&&(s=t,t=void 0),(i=void 0===s)&&(s=this.offset),void 0===t&&(t=d.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}if(o=0,a=s,t===d.METRICS_CHARS){if(r=n(),u.decodeUTF8(function(){return e>o&&s<this.limit?this.view[s++]:null}.bind(this),(function(e){++o,u.UTF8toUTF16(e,r)})),o!==e)throw RangeError("Illegal range: Truncated data, "+o+" == "+e);return i?(this.offset=s,r()):{string:r(),length:s-a}}if(t===d.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+"+e+") <= "+this.buffer.byteLength)}if(l=s+e,u.decodeUTF8toUTF16(function(){return l>s?this.view[s++]:null}.bind(this),r=n(),this.noAssert),s!==l)throw RangeError("Illegal range: Truncated data, "+s+" == "+l);return i?(this.offset=s,r()):{string:r(),length:s-a}}throw TypeError("Unsupported metrics: "+t)},r.readString=r.readUTF8String,r.writeVString=function(e,n){var s,i,r,o,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(r=n,s=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=d.calculateVarint32(s),n+=i+s,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+s,n+=this.writeVarint32(s,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==r+s+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+s+i));return a?(this.offset=n,this):n-r},r.readVString=function(e){var t,n,s,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),s=this.readUTF8String(n.value,d.METRICS_BYTES,e+=n.length),e+=s.length,i?(this.offset=e,s.string):{string:s.string,length:e-t}},r.append=function(e,t,n){var s,i,r;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(s=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof d||(e=d.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,s&&(this.offset+=i)),this},r.appendTo=function(e,t){return e.append(this,t),this},r.assert=function(e){return this.noAssert=!e,this},r.capacity=function(){return this.buffer.byteLength},r.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},r.clone=function(e){var t=new d(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},r.compact=function(e,t){var n,s,i;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0===(n=t-e)?(this.buffer=o,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(s=new ArrayBuffer(n),(i=new Uint8Array(s)).set(this.view.subarray(e,t)),this.buffer=s,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},r.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new d(0,this.littleEndian,this.noAssert);var n=t-e,s=new d(n,this.littleEndian,this.noAssert);return s.offset=0,s.limit=n,s.markedOffset>=0&&(s.markedOffset-=e),this.copyTo(s,0,e,t),s},r.copyTo=function(e,t,n,s){var i,r,o;if(!this.noAssert&&!d.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(r=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,s=void 0===s?this.limit:0|s,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||s>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(o=s-n)?e:(e.ensureCapacity(t+o),e.view.set(this.view.subarray(n,s),t),i&&(this.offset+=o),r&&(e.offset+=o),this)},r.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},r.fill=function(e,t,n){var s=void 0===t;if(s&&(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 s&&(this.offset=t),this},r.flip=function(){return this.limit=this.offset,this.offset=0,this},r.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},r.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},r.LE=function(e){return this.littleEndian=void 0===e||!!e,this},r.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},r.prepend=function(e,t,n){var s,i,r,o,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(s=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof d||(e=d.wrap(e,t)),(i=e.limit-e.offset)<=0||((r=i-n)>0?(o=new ArrayBuffer(this.buffer.byteLength+r),(a=new Uint8Array(o)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=o,this.view=a,this.offset+=r,this.markedOffset>=0&&(this.markedOffset+=r),this.limit+=r,n+=r):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,s&&(this.offset-=i)),this},r.prependTo=function(e,t){return e.prepend(this,t),this},r.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},r.remaining=function(){return this.limit-this.offset},r.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},r.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},r.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},r.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},r.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},r.toBuffer=function(e){var t,n=this.offset,s=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof s||s%1!=0)throw TypeError("Illegal limit: Not an integer");if(s>>>=0,n<0||n>s||s>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+s+" <= "+this.buffer.byteLength)}return e||0!==n||s!==this.buffer.byteLength?n===s?o:(t=new ArrayBuffer(s-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,s),0),t):this.buffer},r.toArrayBuffer=r.toBuffer,r.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={},s=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[];for(e=0,t=s.length;t>e;++e)i[s[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(s[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(s[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(s[63&(i|3&n>>6)]),t(s[63&n])):(t(s[63&i]),t(61))):(t(s[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var s,r,o;null!==(s=e());)if(void 0===(r=i[s])&&n(s),null!==(s=e())&&(void 0===(o=i[s])&&n(s),t(r<<2>>>0|(48&o)>>4),null!==(s=e()))){if(void 0===(r=i[s])){if(61===s)break;n(s)}if(t((15&o)<<4>>>0|(60&r)>>2),null!==(s=e())){if(void 0===(o=i[s])){if(61===s)break;n(s)}t((3&r)<<6>>>0|o)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),r.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 s;return l.encode(function(){return t>e?this.view[e++]:null}.bind(this),s=n()),s()},d.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var s=new d(e.length/4*3,n),i=0;return l.decode(t(e),(function(e){s.view[i++]=e})),s.limit=i,s},d.btoa=function(e){return d.fromBinary(e).toBase64()},d.atob=function(e){return d.fromBase64(e).toBinary()},r.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=[],s=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(s.push(String.fromCharCode.apply(String,n)),n=[]);return s.join("")+String.fromCharCode.apply(String,n)},d.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,s=0,i=e.length,r=new d(i,t);i>s;){if((n=e.charCodeAt(s))>255)throw RangeError("illegal char code: "+n);r.view[s++]=n}return r.limit=i,r},r.toDebug=function(e){for(var t,n=-1,s=this.buffer.byteLength,i="",r="",o="";s>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(r+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==s){for(;i.length<51;)i+=" ";o+=i+r+"\n",i=r=""}i+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==s?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";o+=i+r+"\n"}return e?o:i},d.fromDebug=function(e,t,n){for(var s,i,r=e.length,o=new d(0|(r+1)/3,t,n),a=0,l=0,u=!1,c=!1,h=!1,_=!1,g=!1;r>a;){switch(s=e.charAt(a++)){case"!":if(!n){if(c||h||_){g=!0;break}c=h=_=!0}o.offset=o.markedOffset=o.limit=l,u=!1;break;case"|":if(!n){if(c||_){g=!0;break}c=_=!0}o.offset=o.limit=l,u=!1;break;case"[":if(!n){if(c||h){g=!0;break}c=h=!0}o.offset=o.markedOffset=l,u=!1;break;case"<":if(!n){if(c){g=!0;break}c=!0}o.offset=l,u=!1;break;case"]":if(!n){if(_||h){g=!0;break}_=h=!0}o.limit=o.markedOffset=l,u=!1;break;case">":if(!n){if(_){g=!0;break}_=!0}o.limit=l,u=!1;break;case"'":if(!n){if(h){g=!0;break}h=!0}o.markedOffset=l,u=!1;break;case" ":u=!1;break;default:if(!n&&u){g=!0;break}if(i=parseInt(s+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");o.view[l++]=i,u=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!c||!_)throw TypeError("Illegal str: Missing offset or limit");if(l<o.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+l+" < "+r)}return o},r.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,s=new Array(t-e);t>e;)(n=this.view[e++])<16?s.push("0",n.toString(16)):s.push(n.toString(16));return s.join("")},d.fromHex=function(e,t,n){var s,i,r,o,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(i=e.length,r=new d(0|i/2,t),o=0,a=0;i>o;o+=2){if(s=parseInt(e.substring(o,o+2),16),!n&&(!isFinite(s)||s<0||s>255))throw TypeError("Illegal str: Contains non-hex characters");r.view[a++]=s}return r.limit=a,r},u=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,s,i,r,o=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(128&n)if(192==(224&n))null===(s=e())&&o([n,s]),t((31&n)<<6|63&s);else if(224==(240&n))(null===(s=e())||null===(i=e()))&&o([n,s,i]),t((15&n)<<12|(63&s)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(s=e())||null===(i=e())||null===(r=e()))&&o([n,s,i,r]),t((7&n)<<18|(63&s)<<12|(63&i)<<6|63&r)}else t(n)},UTF16toUTF8:function(e,t){for(var n,s=null;null!==(n=null!==s?s:e());)n>=55296&&n<=57343&&null!==(s=e())&&s>=56320&&s<=57343?(t(1024*(n-55296)+s-56320+65536),s=null):t(n);null!==s&&t(s)},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,s=0;return e.UTF16toUTF8(t,(function(e){++n,s+=e<128?1:e<2048?2:e<65536?3:4})),[n,s]}};return e}(),r.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 s;try{u.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),s=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return s()},d.fromUTF8=function(e,n,s){if(!s&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new d(u.calculateUTF16asUTF8(t(e),!0)[1],n,s),r=0;return u.encodeUTF16toUTF8(t(e),(function(e){i.view[r++]=e})),i.limit=r,i},d}(t),s=function(t,n){var s,i,r={};return r.ByteBuffer=t,r.c=t,s=t,r.Long=n||null,r.VERSION="5.0.1",r.WIRE_TYPES={},r.WIRE_TYPES.VARINT=0,r.WIRE_TYPES.BITS64=1,r.WIRE_TYPES.LDELIM=2,r.WIRE_TYPES.STARTGROUP=3,r.WIRE_TYPES.ENDGROUP=4,r.WIRE_TYPES.BITS32=5,r.PACKABLE_WIRE_TYPES=[r.WIRE_TYPES.VARINT,r.WIRE_TYPES.BITS64,r.WIRE_TYPES.BITS32],r.TYPES={int32:{name:"int32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},uint64:{name:"uint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.UZERO:void 0},sint64:{name:"sint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},bool:{name:"bool",wireType:r.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:r.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:r.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.ZERO:void 0},float:{name:"float",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:r.WIRE_TYPES.STARTGROUP,defaultValue:null}},r.MAP_KEY_TYPES=[r.TYPES.int32,r.TYPES.sint32,r.TYPES.sfixed32,r.TYPES.uint32,r.TYPES.fixed32,r.TYPES.int64,r.TYPES.sint64,r.TYPES.sfixed64,r.TYPES.uint64,r.TYPES.fixed64,r.TYPES.bool,r.TYPES.string,r.TYPES.bytes],r.ID_MIN=1,r.ID_MAX=536870911,r.convertFieldsToCamelCase=!1,r.populateAccessors=!0,r.populateDefaults=!0,r.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var s=e.XHR();if(s.open("GET",t,!!n),s.setRequestHeader("Accept","text/plain"),"function"==typeof s.overrideMimeType&&s.overrideMimeType("text/plain"),!n)return s.send(null),200==s.status||0==s.status&&"string"==typeof s.responseText?s.responseText:null;if(s.onreadystatechange=function(){4==s.readyState&&(200==s.status||0==s.status&&"string"==typeof s.responseText?n(s.responseText):n(null))},4==s.readyState)return;s.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),r.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},r.DotProto=function(e,t){function n(e,n){var s=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))s=parseInt(e);else if(t.NUMBER_HEX.test(e))s=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);s=parseInt(e.substring(1),8)}if(s=0|i*s,!n&&s<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return s}function s(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var r,o,a={},l=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=l.prototype;return u._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},u.next=function(){var e,n,s,i,r;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(s=this.source.charAt(this.index));)if("\n"===s&&++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("*"!==(s=this.source.charAt(this.index)))return"/";do{if("\n"===s&&++this.line,++this.index===this.source.length)return null;n=s,s=this.source.charAt(this.index)}while("*"!==n||"/"!==s);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(r=this.source.substring(this.index,this.index=i))||"'"===r)&&(this._stringOpen=r),r},u.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},u.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},u.omit=function(e){return this.peek()===e&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=l,r=function(e){this.tn=new l(e),this.proto3=!1},(o=r.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},s=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!s||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(!s)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(!s)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),s=!1;break;case"enum":this._parseEnum(n),s=!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},r.parse=function(e){return new r(e).parse()},o._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},o._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return s(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},o._parseOption=function(e,n){var s,i=this.tn.next(),r=!1;if("("===i&&(r=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);s=i,r&&(this.tn.skip(")"),s="("+s+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(s+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,s),n||this.tn.skip(";")},o._parseOptionValue=function(e,n){var s=this.tn.peek();if("{"!==s)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(s=this.tn.next());){if(!t.NAME.test(s))throw Error("illegal option name: "+n+"."+s);this.tn.omit(":")?i(e.options,n+"."+s,this._readValue(!0)):this._parseOptionValue(e,n+"."+s)}},o._parseService=function(e){var n,s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal service name at line "+this.tn.line+": "+s);for(n={name:s,rpc:{},options:{}},this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(n);else{if("rpc"!==s)throw Error("illegal service token: "+s);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},o._parseServiceRPC=function(e){var n,s,i="rpc",r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal rpc service method name: "+r);if(n=r,s={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(r=this.tn.next()).toLowerCase()&&(s.request_stream=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal rpc service request type: "+r);if(s.request=r,this.tn.skip(")"),"returns"!==(r=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+r);if(this.tn.skip("("),"stream"===(r=this.tn.next()).toLowerCase()&&(s.response_stream=!0,r=this.tn.next()),s.response=r,this.tn.skip(")"),"{"===(r=this.tn.peek())){for(this.tn.next();"}"!==(r=this.tn.next());){if("option"!==r)throw Error("illegal rpc service token: "+r);this._parseOption(s)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=s},o._parseMessage=function(e,s){var i=!!s,r=this.tn.next(),o={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(r))throw Error("illegal "+(i?"group":"message")+" name: "+r);for(o.name=r,i&&(this.tn.skip("="),s.id=n(this.tn.next()),o.isGroup=!0),"["===(r=this.tn.peek())&&s&&this._parseFieldOptions(s),this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(o,r);else if("oneof"===r)this._parseMessageOneOf(o);else if("enum"===r)this._parseEnum(o);else if("message"===r)this._parseMessage(o);else if("option"===r)this._parseOption(o);else if("service"===r)this._parseService(o);else if("extensions"===r)o.extensions=this._parseExtensionRanges();else if("reserved"===r)this._parseIgnored();else if("extend"===r)this._parseExtend(o);else{if(!t.TYPEREF.test(r))throw Error("illegal message token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(o,"optional",r)}return this.tn.omit(";"),e.messages.push(o),o},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,s,i){var r,o,a;if(!t.RULE.test(s))throw Error("illegal message field rule: "+s);if(r={rule:s,type:"",name:"",options:{},id:0},"map"===s){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(r.keytype=o,this.tn.skip(","),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field: "+o);if(r.type=o,this.tn.skip(">"),o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);r.name=o,this.tn.skip("="),r.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,r),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);r.type=a.name,r.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(r.type=i,o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);r.name=o,this.tn.skip("="),r.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}return e.fields.push(r),r},o._parseMessageOneOf=function(e){var n,s,i,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal oneof name: "+r);for(s=r,i=[],this.tn.skip("{");"}"!==(r=this.tn.next());)(n=this._parseMessageField(e,"optional",r)).oneof=s,i.push(n.id);this.tn.omit(";"),e.oneofs[s]=i},o._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},o._parseEnum=function(e){var s,i={name:"",values:[],options:{}},r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal name: "+r);for(i.name=r,this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(i);else{if(!t.NAME.test(r))throw Error("illegal name: "+r);this.tn.skip("="),s={name:r,id:n(this.tn.next(),!0)},"["===(r=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(s)}this.tn.omit(";"),e.enums.push(i)},o._parseExtensionRanges=function(){var t,n,i,r=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":i=e.ID_MIN;break;case"max":i=e.ID_MAX;break;default:i=s(t)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}r.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),r},o._parseExtend=function(e){var n,s=this.tn.next();if(!t.TYPEREF.test(s))throw Error("illegal extend reference: "+s);for(n={ref:s,fields:[]},this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(n,s);else{if(!t.TYPEREF.test(s))throw Error("illegal extend token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(n,"optional",s)}return this.tn.omit(";"),e.messages.push(n),n},o.toString=function(){return"Parser at line "+this.tn.line},a.Parser=r,a}(r,r.Lang),r.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 i(t,n){var s=n.readVarint32(),r=7&s,o=s>>>3;switch(r){case e.WIRE_TYPES.VARINT:do{s=n.readUint8()}while(!(128&~s));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:s=n.readVarint32(),n.offset+=s;break;case e.WIRE_TYPES.STARTGROUP:i(o,n);break;case e.WIRE_TYPES.ENDGROUP:if(o===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+r)}return!0}var r,o,a,l,u,d,c,h,_,g,p,E,f,I,R,T,m={},S=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=S.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},m.T=S,r=function(e,t,n,s,i){S.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=s||{},this.syntax=i||"proto2"},(o=r.prototype=Object.create(S.prototype)).getChildren=function(e){var t,n,s;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,s=this.children.length;s>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},o.getChild=function(e){var t,n,s="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][s]===e)return this.children[t];return null},o.resolve=function(e,t){var n,s="string"==typeof e?e.split("."):e,i=this,r=0;if(""===s[r]){for(;null!==i.parent;)i=i.parent;r++}do{do{if(!(i instanceof m.Namespace)){i=null;break}if(!((n=i.getChild(s[r]))&&n instanceof m.T&&(!t||n instanceof m.Namespace))){i=null;break}i=n,r++}while(r<s.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},o.qn=function(e){var t,n,s=[],i=e;do{s.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=s.length;t++)if(n=s.slice(s.length-t),e===this.resolve(n,e instanceof m.Namespace))return n.join(".");return e.fqn()},o.build=function(){var e,t,n,s={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof r&&(s[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(s,"$options",{value:this.buildOpt()}),s},o.buildOpt=function(){var e,t,n,s,i={},r=Object.keys(this.options);for(e=0,t=r.length;t>e;++e)n=r[e],s=this.options[r[e]],i[n]=s;return i},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},m.Namespace=r,a=function(t,n,s,i){if(this.type=t,this.resolvedType=n,this.isMapKey=s,this.syntax=i,s&&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 s(0):t.defaultValue},l.verifyValue=function(s){var i,r,o,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof s||s==s&&s%1!=0)&&a(typeof s,"not an integer"),s>4294967295?0|s:s;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof s||s==s&&s%1!=0)&&a(typeof s,"not an integer"),s<0?s>>>0:s;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(s,!1)}catch(e){a(typeof s,e.message)}else a(typeof s,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(s,!0)}catch(e){a(typeof s,e.message)}else a(typeof s,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof s&&a(typeof s,"not a boolean"),s;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof s&&a(typeof s,"not a number"),s;case e.TYPES.string:return"string"==typeof s||s&&s instanceof String||a(typeof s,"not a string"),""+s;case e.TYPES.bytes:return t.isByteBuffer(s)?s:t.wrap(s);case e.TYPES.enum:for(i=this.resolvedType.getChildren(e.Reflect.Enum.Value),o=0;o<i.length;o++){if(i[o].name==s)return i[o].id;if(i[o].id==s)return i[o].id}if("proto3"===this.syntax)return("number"!=typeof s||s==s&&s%1!=0)&&a(typeof s,"not an integer"),(s>4294967295||s<0)&&a(typeof s,"not in range for uint32"),s;a(s,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(s&&"object"==typeof s||a(typeof s,"object expected"),s instanceof this.resolvedType.clazz)return s;if(s instanceof e.Builder.Message){for(o in r={},s)s.hasOwnProperty(o)&&(r[o]=s[o]);s=r}return new this.resolvedType.clazz(s)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+s+" (undefined type "+this.type+")")},l.calculateLength=function(t,n){if(null===n)return 0;var i;switch(this.type){case e.TYPES.int32:return n<0?s.calculateVarint64(n):s.calculateVarint32(n);case e.TYPES.uint32:return s.calculateVarint32(n);case e.TYPES.sint32:return s.calculateVarint32(s.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 s.calculateVarint64(n);case e.TYPES.sint64:return s.calculateVarint64(s.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return s.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return i=s.calculateUTF8Bytes(n),s.calculateVarint32(i)+i;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return s.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return i=this.resolvedType.calculate(n),s.calculateVarint32(i)+i;case e.TYPES.group:return(i=this.resolvedType.calculate(n))+s.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,i){var r,o;if(null===n)return i;switch(this.type){case e.TYPES.int32:n<0?i.writeVarint64(n):i.writeVarint32(n);break;case e.TYPES.uint32:i.writeVarint32(n);break;case e.TYPES.sint32:i.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:i.writeUint32(n);break;case e.TYPES.sfixed32:i.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:i.writeVarint64(n);break;case e.TYPES.sint64:i.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:i.writeUint64(n);break;case e.TYPES.sfixed64:i.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?i.writeVarint32("false"===n.toLowerCase()?0:!!n):i.writeVarint32(n?1:0);break;case e.TYPES.enum:i.writeVarint32(n);break;case e.TYPES.float:i.writeFloat32(n);break;case e.TYPES.double:i.writeFloat64(n);break;case e.TYPES.string:i.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");r=n.offset,i.writeVarint32(n.remaining()),i.append(n),n.offset=r;break;case e.TYPES.message:o=(new s).LE(),this.resolvedType.encode(n,o),i.writeVarint32(o.offset),i.append(o.flip());break;case e.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i},l.decode=function(t,n,s){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,r;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(r=t.readVarint32(),t.remaining()<r)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+r+" required but got only "+t.remaining());return(i=t.clone()).limit=i.offset+r,t.offset+=r,i;case e.TYPES.message:return r=t.readVarint32(),this.resolvedType.decode(t,r);case e.TYPES.group:return this.resolvedType.decode(t,-1,s)}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 s.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()},m.Element=a,u=function(e,t,n,s,i,o){r.call(this,e,t,n,s,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(d=u.prototype=Object.create(r.prototype)).build=function(n){var i,r,o,a;if(this.clazz&&!n)return this.clazz;for(i=function(e,n){function i(t,n,r,o){var a,l,u,d,c,h,_;if(null===t||"object"!=typeof t)return o&&o instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(o.object,t))?a:t;if(s.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return r?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return l=[],t.forEach((function(e,t){l[t]=i(e,n,r,o)})),l;if(l={},t instanceof e.Map){for(d=(u=t.entries()).next();!d.done;d=u.next())l[t.keyElem.valueToString(d.value[0])]=i(d.value[1],n,r,t.valueElem.resolvedType);return l}for(_ in c=t.$type,h=void 0,t)t.hasOwnProperty(_)&&(l[_]=c&&(h=c.getChild(_))?i(t[_],n,r,h.resolvedType):i(t[_],n,r));return l}var r,o,a=n.getChildren(e.Reflect.Message.Field),l=n.getChildren(e.Reflect.Message.OneOf),u=function(t){var i,r,o,d;for(e.Builder.Message.call(this),i=0,r=l.length;r>i;++i)this[l[i].name]=null;for(i=0,r=a.length;r>i;++i)this[(o=a[i]).name]=o.repeated?[]:o.map?new e.Map(o):null,!o.required&&"proto3"!==n.syntax||null===o.defaultValue||(this[o.name]=o.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof u)||Array.isArray(t)||t instanceof e.Map||s.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(i=0,r=arguments.length;r>i;++i)void 0!==(d=arguments[i])&&this.$set(a[i].name,d);else this.$set(t)},d=u.prototype=Object.create(e.Builder.Message.prototype);for(d.add=function(t,s,i){var r=n._fieldsByName[t];if(!i){if(!r)throw Error(this+"#"+t+" is undefined");if(!(r instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+r.toString(!0));if(!r.repeated)throw Error(this+"#"+t+" is not a repeated field");s=r.verifyValue(s,!0)}return null===this[t]&&(this[t]=[]),this[t].push(s),this},d.$add=d.add,d.set=function(t,s,i){var r,o,a;if(t&&"object"==typeof t){for(r in i=s,t)t.hasOwnProperty(r)&&void 0!==(s=t[r])&&this.$set(r,s,i);return this}if(o=n._fieldsByName[t],i)this[t]=s;else{if(!o)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));this[o.name]=s=o.verifyValue(s)}return o&&o.oneof&&(a=this[o.oneof.name],null!==s?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===t&&(this[o.oneof.name]=null)),this},d.$set=d.set,d.get=function(t,s){if(s)return this[t];var i=n._fieldsByName[t];if(!(i&&i instanceof e.Reflect.Message.Field))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));return this[i.name]},d.$get=d.get,r=0;r<a.length;r++)(o=a[r])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,s,i,r=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));r=r.substring(0,1).toUpperCase()+r.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),s=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===n.getChild("set"+r)&&(d["set"+r]=s),null===n.getChild("set_"+t)&&(d["set_"+t]=s),null===n.getChild("get"+r)&&(d["get"+r]=i),null===n.getChild("get_"+t)&&(d["get_"+t]=i)}(o);return d.encode=function(e,s){var i,r;"boolean"==typeof e&&(s=e,e=void 0),i=!1,e||(e=new t,i=!0),r=e.littleEndian;try{return n.encode(this,e.LE(),s),(i?e.flip():e).LE(r)}catch(t){throw e.LE(r),t}},u.encode=function(e,t,n){return new u(e).encode(t,n)},d.calculate=function(){return n.calculate(this)},d.encodeDelimited=function(e){var t,i=!1;return e||(e=new s,i=!0),t=(new s).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},d.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},d.toArrayBuffer=d.encodeAB,d.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},d.toBuffer=d.encodeNB,d.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},d.toBase64=d.encode64,d.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},d.toHex=d.encodeHex,d.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},d.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},u.decode=function(e,t){var i,r;"string"==typeof e&&(e=s.wrap(e,t||"base64")),i=(e=s.isByteBuffer(e)?e:s.wrap(e)).littleEndian;try{return r=n.decode(e.LE()),e.LE(i),r}catch(t){throw e.LE(i),t}},u.decodeDelimited=function(e,t){var i,r,o;if("string"==typeof e&&(e=s.wrap(e,t||"base64")),(e=s.isByteBuffer(e)?e:s.wrap(e)).remaining()<1)return null;if(i=e.offset,r=e.readVarint32(),e.remaining()<r)return e.offset=i,null;try{return o=n.decode(e.slice(e.offset,e.offset+r).LE()),e.offset+=r,o}catch(t){throw e.offset+=r,t}},u.decode64=function(e){return u.decode(e,"base64")},u.decodeHex=function(e){return u.decode(e,"hex")},u.decodeJSON=function(e){return new u(JSON.parse(e))},d.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:n.buildOpt()}),Object.defineProperty(d,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:n}),Object.defineProperty(d,"$type",{value:n})),u}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,a=this.children.length;a>o;o++)if((r=this.children[o])instanceof p||r instanceof u||r instanceof I){if(i.hasOwnProperty(r.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+r.toString(!0)+" cannot override static property '"+r.name+"'");i[r.name]=r.build()}else if(r instanceof u.Field)r.build(),this._fields.push(r),this._fieldsById[r.id]=r,this._fieldsByName[r.name]=r;else if(!(r instanceof u.OneOf||r instanceof f))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=i},d.encode=function(e,t,n){var s,i,r,o,a,l=null;for(r=0,o=this._fields.length;o>r;++r)i=e[(s=this._fields[r]).name],s.required&&null===i?null===l&&(l=s):s.encode(n?i:s.verifyValue(i),t,e);if(null!==l)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+l)).encoded=t,a;return t},d.calculate=function(e){for(var t,n,s=0,i=0,r=this._fields.length;r>i;++i){if(n=e[(t=this._fields[i]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);s+=t.calculate(n,e)}return s},d.decode=function(t,n,s){var r,o,a,l,u,d,c,h,_,g,p,E;for(n="number"==typeof n?n:-1,u=t.offset,d=new this.clazz;t.offset<u+n||-1===n&&t.remaining()>0;){if(a=(r=t.readVarint32())>>>3,(o=7&r)===e.WIRE_TYPES.ENDGROUP){if(a!==s)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(s?s+" expected":"not a group")+")");break}if(l=this._fieldsById[a])l.repeated&&!l.options.packed?d[l.name].push(l.decode(o,t)):l.map?(h=l.decode(o,t),d[l.name].set(h[0],h[1])):(d[l.name]=l.decode(o,t),l.oneof&&(null!==(_=d[l.oneof.name])&&_!==l.name&&(d[_]=null),d[l.oneof.name]=l.name));else switch(o){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(;i(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}for(g=0,p=this._fields.length;p>g;++g)if(null===d[(l=this._fields[g]).name])if("proto3"===this.syntax)d[l.name]=l.defaultValue;else{if(l.required)throw(E=Error("Missing at least one required field for "+this.toString(!0)+": "+l.name)).decoded=d,E;e.populateDefaults&&null!==l.defaultValue&&(d[l.name]=l.defaultValue)}return d},m.Message=u,c=function(t,n,s,i,r,o,a,l,d,c){S.call(this,t,n,o),this.className="Message.Field",this.required="required"===s,this.repeated="repeated"===s,this.map="map"===s,this.keyType=i||null,this.type=r,this.resolvedType=null,this.id=a,this.options=l||{},this.defaultValue=null,this.oneof=d||null,this.syntax=c||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.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 s,i,r;if(n=n||!1,s=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&&s(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&s(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),r=[],i=0;i<t.length;i++)r.push(this.element.verifyValue(t[i]));return r}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||s(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&s(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,i){var r,o,a,l,u;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),o=n.offset,r=0;r<t.length;r++)this.element.encodeValue(this.id,t[r],n);a=n.offset-o,(l=s.calculateVarint32(a))>1&&(u=n.slice(o,n.offset),o+=l-1,n.offset=o,n.append(u)),n.writeVarint32(a,o-l)}else for(r=0;r<t.length;r++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[r],n);else this.map?t.forEach((function(t,i){var r=s.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+s.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(r),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,i)&&(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 i,r,o;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;i=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=s.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,r=0;r<t.length;r++)o+=this.element.calculateLength(this.id,t[r]);i+=s.calculateVarint32(o),i+=o}else for(r=0;r<t.length;r++)i+=s.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t[r]);else this.map?t.forEach((function(t,n){var r=s.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+s.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);i+=s.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i+=s.calculateVarint32(r),i+=r}),this):this.hasWirePresence(t,n)&&(i+=s.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return i},h.decode=function(t,n,s){var i,r,o,l,u,d,c;if(!(!this.map&&t==this.type.wireType||!s&&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&&!s){for(r=n.readVarint32(),r=n.offset+r,o=[];n.offset<r;)o.push(this.decode(this.type.wireType,n,!0));return o}if(this.map){if(l=a.defaultFieldValue(this.keyType),i=a.defaultFieldValue(this.type),r=n.readVarint32(),n.remaining()<r)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+r+" required but got only "+n.remaining());for((u=n.clone()).limit=u.offset+r,n.offset+=r;u.remaining()>0;)if(t=7&(d=u.readVarint32()),1===(c=d>>>3))l=this.keyElement.decode(u,t,c);else{if(2!==c)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,t,c)}return[l,i]}return this.element.decode(n,t,this.id)},m.Message.Field=c,_=function(e,t,n,s,i,r,o){c.call(this,e,t,n,null,s,i,r,o),this.extension},_.prototype=Object.create(c.prototype),m.Message.ExtensionField=_,g=function(e,t,n){S.call(this,e,t,n),this.fields=[]},m.Message.OneOf=g,p=function(e,t,n,s,i){r.call(this,e,t,n,s,i),this.className="Enum",this.object=null},p.getName=function(e,t){var n,s,i=Object.keys(e);for(s=0;s<i.length;++s)if(e[n=i[s]]===t)return n;return null},(p.prototype=Object.create(r.prototype)).build=function(t){var n,s,i,r;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,i=0,r=(s=this.getChildren(p.Value)).length;r>i;++i)n[s[i].name]=s[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},m.Enum=p,E=function(e,t,n,s){S.call(this,e,t,n),this.className="Enum.Value",this.id=s},E.prototype=Object.create(S.prototype),m.Enum.Value=E,f=function(e,t,n,s){S.call(this,e,t,n),this.field=s},f.prototype=Object.create(S.prototype),m.Extension=f,I=function(e,t,n,s){r.call(this,e,t,n,s),this.className="Service",this.clazz=null},(I.prototype=Object.create(r.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,i=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},r=i.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<o.length;n++)!function(e){r[e.name]=function(n,i){try{try{n=e.resolvedRequestType.clazz.decode(s.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,s){if(!n){try{s=e.resolvedResponseType.clazz.decode(s)}catch(e){}return s&&s instanceof e.resolvedResponseType.clazz?void i(null,s):void i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,s){new i(t)[e.name](n,s)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(r[e.name],"$options",{value:i[e.name].$options}))}(o[n]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(r,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(r,"$type",{value:t})),i}(e,this)},m.Service=I,R=function(e,t,n,s){S.call(this,e,t,n),this.className="Service.Method",this.options=s||{}},(R.prototype=Object.create(S.prototype)).buildOpt=o.buildOpt,m.Service.Method=R,T=function(e,t,n,s,i,r,o,a){R.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=s,this.responseName=i,this.requestStream=r,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null},T.prototype=Object.create(R.prototype),m.Service.RPCMethod=T,m}(r),r.Builder=function(e,t,n){function s(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,s(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},r=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},r.reset=function(){return this.ptr=this.ns,this},r.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},r.create=function(t){var s,r,o,a,l;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(s=[t];s.length>0;){if(t=s.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(r=t.shift(),i.isMessage(r)){if(o=new n.Message(this,this.ptr,r.name,r.options,r.isGroup,r.syntax),a={},r.oneofs&&Object.keys(r.oneofs).forEach((function(e){o.addChild(a[e]=new n.Message.OneOf(this,o,e))}),this),r.fields&&r.fields.forEach((function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,r.syntax),t&&t.fields.push(e),o.addChild(e)}),this),l=[],r.enums&&r.enums.forEach((function(e){l.push(e)})),r.messages&&r.messages.forEach((function(e){l.push(e)})),r.services&&r.services.forEach((function(e){l.push(e)})),r.extensions&&(o.extensions="number"==typeof r.extensions[0]?[r.extensions]:r.extensions),this.ptr.addChild(o),l.length>0){s.push(t),t=l,l=null,this.ptr=o,o=null;continue}l=null}else if(i.isEnum(r))o=new n.Enum(this,this.ptr,r.name,r.options,r.syntax),r.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(i.isService(r))o=new n.Service(this,this.ptr,r.name,r.options),Object.keys(r.rpc).forEach((function(e){var t=r.rpc[e];o.addChild(new n.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!i.isExtend(r))throw Error("not a valid definition: "+JSON.stringify(r));if(o=this.ptr.resolve(r.ref,!0))r.fields.forEach((function(t){var s,i,r,a;if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions&&(s=!1,o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(s=!0)})),!s))throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),r=new n.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,r),r.extension=a,this.ptr.addChild(a),o.addChild(r)}),this);else if(!/\.?google\.protobuf\./.test(r.ref))throw Error("extended message "+r.ref+" is not defined")}r=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},r.import=function(t,n){var i,r,o,a,l,u,d,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(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(h="\\"),r=i+h+n.file,!0===this.files[r])return this.reset();this.files[r]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(h="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),h="\\"):o=".":o=null,l=0;l<t.imports.length;l++)if("string"==typeof t.imports[l]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[l]))continue;if(u=o+h+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(d=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(d+""),u):this.import(e.DotProto.Parser.parse(d),u)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[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&&s(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()},r.resolveAll=function(){var s;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(!(s=(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=s,s instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==s.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(s instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=s.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(!((s=this.ptr.parent.resolve(this.ptr.requestName,!0))&&s instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=s,!((s=this.ptr.parent.resolve(this.ptr.responseName,!0))&&s instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=s}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()},r.build=function(e){var t,n,s;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,s=0;s<t.length;s++){if(!n[t[s]]){n=null;break}n=n[t[s]]}return n},r.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},r.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(r,r.Lang,r.Reflect),r.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var s=function(e,n){var s,i,r,o;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(s=Object.keys(n),i=0;i<s.length;i++)r=this.keyElem.valueFromString(s[i]),o=this.valueElem.verifyValue(n[s[i]]),this.map[this.keyElem.valueToString(r)]={key:r,value:o}},i=s.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){var e,t,s=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)s.push([(e=this.map[i[t]]).key,e.value]);return n(s)},i.keys=function(){var e,t=[],s=Object.keys(this.map);for(e=0;e<s.length;e++)t.push(this.map[s[e]].key);return n(t)},i.values=function(){var e,t=[],s=Object.keys(this.map);for(e=0;e<s.length;e++)t.push(this.map[s[e]].value);return n(t)},i.forEach=function(e,t){var n,s,i=Object.keys(this.map);for(s=0;s<i.length;s++)e.call(t,(n=this.map[i[s]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),s=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:s},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},s}(0,r.Reflect),r.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),r.loadJson(r.DotProto.Parser.parse(e),t,n)},r.protoFromString=r.loadProto,r.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return r.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(s){if(null!==s)try{t(null,r.loadProto(s,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var s=r.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===s?null:r.loadProto(s,n,e)},r.protoFromFile=r.loadProtoFile,r.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=r.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=r.populateAccessors),new r.Builder(e)},r.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=r.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},r.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return r.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(s){if(null!==s)try{t(null,r.loadJson(JSON.parse(s),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var s=r.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===s?null:r.loadJson(JSON.parse(s),n,e)},i=e,r.loadProto(i,void 0,"").build("Modules").probuf}(n,t);return s}var Rs,Ts;const ms=(e,t,n)=>{if(void 0===t||void 0===n)return e.toUpperCase();const s=e.slice(t,n);return e=e.replace(s,(e=>e.toUpperCase()))};class Ss{constructor(e,t){this.nestedMap=t,Rs.add(this),this.pbModules=Is(e)}_encode(e,t,n){const s=new this.pbModules[e];if(t)try{Object.keys(t).forEach((n=>{const i=t[n];if(void 0===i)return;const r=this.nestedMap.get(`${e}_${n}`);if(r){const e=i instanceof Array?i.map((e=>this._encode(r,e,!0))):this._encode(r,i,!0);s[`set${ms(n,0,1)}`](e)}else s[`set${ms(n,0,1)}`](i)}))}catch(t){const n=`name: ${e}, stack: ${t.stack}`;null===console||void 0===console||console.error("pb encode error!",n)}return n?s:s.toArrayBuffer()}encode(e,t){return this._encode(e,t)}decode(e,t){const s=this.pbModules[e].decode(t);return n(this,Rs,"m",Ts).call(this,s)}getModule(e){return new this.pbModules[e]}}Rs=new WeakSet,Ts=function e(t){if(t instanceof Array)return t.map((t=>n(this,Rs,"m",e).call(this,t)));if(s=t,"[object Object]"!==Object.prototype.toString.call(s))return t;var s;if(t.buffer instanceof ArrayBuffer&&"number"==typeof t.offset&&"number"==typeof t.limit){const{buffer:e,offset:n,limit:s}=t;return e.slice(n,s)}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 i=t;return Object.keys(t).forEach((s=>{i[s]=n(this,Rs,"m",e).call(this,t[s])})),i};const Cs="NotifyMsg",vs="SyncRequestMsg",ys="UpStreamMessage",As="PushExtra",Ns="DownStreamMessages",Os="DownStreamMessage",Ms="GetQNupTokenInput",Us="GetDownloadUrlInput",Ls="GetQNupTokenOutput",Ps="GetDownloadUrlOutput",bs="ChrmInput",Ds="ChrmOutput",ws="ChrmPullMsg",Vs="RelationQryInput",Gs="RelationsInput",ks="RelationsOutput",Bs="QryRemindListReq",Fs="QryRemindListResp",xs="CleanHisMsgInput",Hs="CleanMsgBatchReq",qs="QueryChatRoomInfoInput",Ys="QueryChatRoomInfoOutput",Ks="HistoryMsgInput",js="HistoryMsgOuput",Qs="SessionsAttQryInput",Ws="SessionsAttOutput",$s="SessionMsgReadInput",Js="DeleteSessionsInput",zs="SessionInfo",Zs="QuerySessionsInput",Xs="QuerySessionsOutPut",ei="RelationDelBatchReq",ti="RelationOpInput",ni="DeleteMsgInput",si="SetChrmKV",ii="SetChrmKVS",ri="ChrmKVOutput",oi="ChrmKVSOutput",ai="QueryChrmKV",li="SetUserSettingOutput",ui="PullUserSettingInput",di="PullUserSettingOutput",ci="SessionReq",hi="SessionStates",_i="SessionState",gi="SessionStateItem",pi="SessionStateModifyReq",Ei="GroupUnpushQuery",fi="GroupUnpushSet",Ii="GroupUnpushResult",Ri="SessionStateModifyResp",Ti="TypeUnpushInput",mi="TypeUnpushOutput",Si="GrpReadReceiptMsg",Ci="GrpReadReceiptQryResp",vi="SessionTagAddInput",yi="SessionTagItem",Ai="SessionTagDelInput",Ni="SessionDisTagReq",Oi="UserSettingNotification",Mi="ReportSDKInput",Ui="UltraGrpPullSes",Li="UltraGrpPullMsg",Pi="MsgChangeReq",bi="QueryMsgChange",Di="EventChangeList",wi="MsgChangeList",Vi="MsgQuery",Gi="MsgQueryAck",ki="OperateStatus",Bi="OperateStatusNotify",Fi="SetRtcRoomIdInput",xi="CallInfoUpStream",Hi="CallInfoDownStream",qi="KvInput",Yi="KvOutput",Ki="ReadReceiptMsg",ji="ReceiptQryReq",Qi="QueryReceiptResp",Wi="ReceiptCntQryReq",$i="ReceiptCntQryResp",Ji="UpdateUserSubReq",zi="UserSubDetail",Zi="UpdateUserSubResp",Xi="PullUserSubReq",er="PUllUserSubResp",tr="PullSubDataReq",nr="PullSubDataResp",sr="SubDataDetail",ir="QrySubDataReq",rr="UserProfile",or="ProfileInfo",ar="SetUserProfileResp",lr="PullUserProfileReq",ur="UserProfiles",dr="UserProfileInput",cr="UserProfilePermission",hr="SearchUserProfile",_r="ChannelsInput",gr="ChannelsOutput",pr="MultiChannels",Er="ModifyChannelsInput",fr="QuitChannelsSetting",Ir="ChannelsQueryInput",Rr="ChannelsPageParam",Tr="ChannelsListResult",mr="ChannelsMemberUpdateInput",Sr="ChannelsMemberResponseInput",Cr="ChannelsMembersInput",vr="FriendInput",yr="FriendsInput",Ar="FriendsCheckOutput",Nr="FriendProfileInput",Or="FriendProfileOutput",Mr="FriendQueryInput",Ur="FriendsListInput",Lr="FriendLevelSet",Pr="FriendUserInfos",br="AddUnpushPeriodInput",Dr="DeleteUnpushPeriodInput",wr="QueryUnpushPeriodInput",Vr="QueryUnpushPeriodOutput",Gr=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 kr,Br,Fr,xr;!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"}(kr||(kr={})),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"}(Br||(Br={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(Fr||(Fr={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags"}(xr||(xr={}));const Hr=new Ss("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 optional int64 endTime = 8;\n optional bool compressioEnabled = 9;\n }\n message UpStreamMessage {\n required int32 sessionId = 1;\n required string classname = 2;\n required string 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 optional int64 systemTime = 5;\n optional int64 credibleStartTime = 6;\n optional int64 credibleEndTime = 7;\n optional bool compressioEnabled = 8;\n optional bytes compressedData = 9;\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 string 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 optional int32 pullMsgType = 3;\n optional bool compressioEnabled = 4;\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 optional bool isEraseMsgContent = 5;\n optional int64 endTime = 6;\n optional bool compressioEnabled = 7;\n optional int32 qryType = 8;\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 optional int64 pullTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\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 optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6; \n optional bytes compressedData = 7;\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 optional bool compressioEnabled = 6;\n }\n\n message HistoryMsgOuput {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6;\n optional bytes compressedData = 7;\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 optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\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 optional bool compressioEnabled = 2;\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 optional bool compressioEnabled = 2;\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",Gr);var qr,Yr,Kr,jr,Qr,Wr,$r,Jr,zr;!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.STATISTICS=6]="STATISTICS",e[e.NONE=1e3]="NONE"}(qr||(qr={})),function(e){e.IM="IM",e.RTC="RTC"}(Yr||(Yr={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.USER_LOGOUT=19]="USER_LOGOUT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(Kr||(Kr={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(jr||(jr={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Qr||(Qr={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Wr||(Wr={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}($r||($r={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Jr||(Jr={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(zr||(zr={}));let Zr=null;function Xr(e,t,n={},s={}){const i=["error","warn","info","debug"][3-e];if(Zr&&e<qr.FATAL)try{const e=JSON.stringify(n);Zr[i](t,e)}catch(e){console.error(e)}}const eo=Xr.bind(null,qr.DEBUG),to={init:function(e){Zr=e},info:Xr.bind(null,qr.INFO),debug:eo,warn:Xr.bind(null,qr.WARN),error:Xr.bind(null,qr.ERROR),fatal:Xr.bind(null,qr.FATAL)};class no{constructor(){this._map={}}on(e,t,n){const s=this._map[e]||(this._map[e]=[]);s.some((e=>e.listener===t&&e.target===n))||s.push({listener:t,target:n})}once(e,t,n){const s=this._map[e]||(this._map[e]=[]);s.some((e=>e.listener===t&&e.target===n))||s.push({listener:t,target:n,once:!0})}off(e,t,n){let s=this._map[e];s&&(s=s.filter((e=>e.listener!==t||e.target!==n)),s.length?this._map[e]=s: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:s,once:i,listener:r}=n[e];i&&n.splice(e,1);try{r.call(s,...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 so{constructor(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=Is(t)}getModule(e){return new this.pbModules[e]}encode(e,t,n){const s=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((e=>{const n=t[e];void 0!==n&&s[`set${((e,t,n)=>{if(void 0===t||void 0===n)return e.toUpperCase();const s=e.slice(t,n);return e.replace(s,(e=>e.toUpperCase()))})(e,0,1)}`](n)}))}catch(t){const n=`pbname: ${e}, stack: ${t.stack}`;this.logger?this.logger.error(r.L_PB_ENCODE_E,n):null===console||void 0===console||console.error(r.L_PB_ENCODE_E,n)}return n?s:s.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(!_t(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 io;!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"}(io||(io={}));const ro={[io.RtcInput]:["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],[io.RtcUserListOutput]:["users","token","sessionId","roomInfo"],[io.SetUserStatusInput]:["status"],[io.RtcSetDataInput]:["interior","target","key","value","objectName","content"],[io.RtcUserSetDataInput]:["valueInfo","objectName","content"],[io.RtcDataInput]:["interior","target","key","objectName","content"],[io.RtcSetOutDataInput]:["target","valueInfo","objectName","content"],[io.MCFollowInput]:["state"],[io.RtcTokenOutput]:["rtcToken"],[io.RtcQryOutput]:["outInfo"],[io.RtcQryUserOutDataInput]:["userId"],[io.RtcUserOutDataOutput]:["user"],[io.RtcQueryListInput]:["order"],[io.RtcRoomInfoOutput]:["roomId","roomData","userCount","list"],[io.RtcValueInfo]:["key","value"],[io.RtcKeyDeleteInput]:["key"],[io.RtcNotifyMsg]:["type","time","roomId"],[io.RtcPullKV]:["timestamp","roomId"],[io.RtcKVOutput]:["entries","bFullUpdate","syncTime"],[io.RtcQueryUserJoinedInput]:["userId"],[io.RtcQueryUserJoinedOutput]:["info"],[io.RtcInviteInput]:["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],[io.RtcCancelInviteInput]:["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],[io.RtcInviteAnswerInput]:["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],[io.RtcEndInviteInput]:["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]},oo=`\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 ${io.SetUserStatusInput}\n {\n optional int32 status=1;\n }\n message ${io.MCFollowInput}\n {\n required string state = 1;\n }\n message ${io.RtcQueryListInput}{\n optional int32 order=1;\n }\n message ${io.RtcKeyDeleteInput}{\n repeated string key=1;\n }\n message ${io.RtcValueInfo}{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ${io.RtcValueInfo} userData=2; //用户资源信息\n }\n message ${io.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 ${io.RtcValueInfo} roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ${io.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 ${io.RtcValueInfo} innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ${io.RtcValueInfo} outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ${io.RtcQryOutput}{\n repeated ${io.RtcValueInfo} outInfo=1;\n }\n message ${io.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 ${io.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 ${io.RtcUserSetDataInput} {\n repeated ${io.RtcValueInfo} valueInfo = 1;\n required string objectName = 2;\n repeated ${io.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 ${io.RtcTokenOutput}{\n required string rtcToken=1;\n }\n message ${io.RtcSetOutDataInput}{\n required targetType target=1;\n repeated ${io.RtcValueInfo} valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ${io.RtcQryUserOutDataInput}{\n repeated string userId = 1;\n }\n message ${io.RtcUserOutDataOutput}{\n repeated RtcUserInfo user = 1;\n }\n message ${io.RtcNotifyMsg} \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ${io.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 ${io.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 ${io.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 ${io.RtcQueryUserJoinedOutput}\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ${io.RtcViewerJoinedOutput}\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ${io.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 ${io.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 ${io.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 ${io.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`,ao=(e,t,n,s,i,r)=>{const o=i?Object.keys(i).map((t=>e.encode(io.RtcValueInfo,{key:t,value:i[t]},!0))):void 0,a=r?Object.keys(r).map((t=>e.encode(io.RtcValueInfo,{key:t,value:r[t]},!0))):void 0;return e.encode(io.RtcInput,{roomType:t,broadcastType:n,joinType:s,innerDatas:o,outerDatas:a})},lo=(e,t)=>{const n=e.decode(io.RtcUserListOutput,t),{users:s,token:i,sessionId:r,roomInfo:o,entries:a,offlineKickTime:l}=n,u={};return Ot(s,(e=>{const{userId:t,userData:n}=e,s={};Ot(n,(e=>{const{key:t,value:n}=e;s[t]=n})),u[t]=s})),{users:u,token:i,sessionId:r,roomInfo:o,kvEntries:a,offlineKickTime:l}};var uo;!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"}(uo||(uo={}));const co=e=>{const t=uo[e];return t},ho=e=>uo[e];var _o,go,po;!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"}(_o||(_o={})),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"}(go||(go={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(po||(po={}));const Eo="rtcRJoin_data",fo="rtcRExit",Io="rtcRInfo",Ro="rtcUData",To="rtcUPut",mo="rtcUDel",So="rtcSetData",Co="userSetData",vo="rtcQryData",yo="rtcDelData",Ao="rtcToken",No="rtcUserState",Oo="rtcUList",Mo="viewerJoinR",Uo="viewerExitR",Lo="rtcPullKv",Po="rtcIdentityChange",bo="rtcInvite",Do="rtcCancelInvite",wo="rtcInviteAnswer",Vo="rtcEndInvite",Go="rtcQueryJoined";class ko{static writeUTF(e,t){let{back:n,byteSize:s}=this._getBackAndByteSize(e);for(let e=0,t=n.length;e<t;e++)n[e]>255&&(n[e]&=255);return t?n:s<=255?[0,s].concat(n):[s>>8,255&s].concat(n)}static _getBackAndByteSize(e){const t=[];let n=0;if("string"==typeof e)for(let s=0,i=e.length;s<i;s++){const i=e.charCodeAt(s);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}}static readUTF(e){const t=[];let n,s,i=-1;const r=e;let o="";for(;++i<r.length;){let e=Number(r[i]);if(e===(127&e)||(240&~e?224&~e?192&~e||(e^=192,e=e<<6|128^r[++i]):(e^=224,e=e<<6|128^r[++i],e=e<<6|128^r[++i]):(e^=240,e=e<<6|128^r[++i],e=e<<6|128^r[++i],e=e<<6|128^r[++i])),!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,s=e%1024|56320,t.push(n,s)),(i+1===r.length||t.length>16384)&&(o+=String.fromCharCode.apply(null,t),t.length=0)}return o}}class Bo{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 ko.readUTF(n)}readAll(){return this._pool.subarray(this._position,this._poolLen)}}class Fo{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=ko.writeUTF(e);this._pool=this._pool.concat(t)}getBytesArray(){return this._pool}}class xo{constructor(e,t=_o.AT_LEAST_ONCE,n=!1,s=!1,i=!1){this.command=e,this.qos=t,this._retain=n,this._dup=s,this.syncMsg=i}static parse(e){return new xo(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 Ho{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 qo{constructor(e){this.messageId=0,this._header=new xo(e,_o.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 Fo;this.write(e);const t=e.getBytesArray();return new Int8Array(t).buffer}}class Yo extends Ho{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<=Yo.MESSAGE_LENGTH)return{stream:e,length:t};if(n===po.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}}}Yo.MESSAGE_LENGTH=2;class Ko extends Ho{constructor(){super(...arguments),this.status=0}readMessage(e,t){return e.readByte(),this.status=e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}Ko.MESSAGE_LENGTH=2;class jo extends qo{constructor(){super(go.PING)}writeMessage(e){}}class Qo extends Ho{constructor(e){super(e)}}class Wo extends Ho{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 $o extends qo{writeMessage(e){const t=this.messageId,n=255&t,s=(65280&t)>>8;e.writeByte(s),e.writeByte(n)}}class Jo extends Wo{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 zo extends $o{constructor(e,t,n,s){super(e),this.targetId=n,this.pbData=s,this.topic="string"==typeof t?t:ho(t)}writeMessage(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),super.writeMessage(e),e.writeBuffer(this.pbData)}}class Zo extends zo{constructor(e,t,n){super(go.QUERY,e,n,t)}}class Xo extends zo{constructor(e,t,n){super(go.PUBLISH,e,n,t)}}class ea extends Wo{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 ta extends $o{constructor(e){super(go.PUB_ACK),this.messageId=e}}class na extends $o{constructor(e){super(go.QUERY_CONFIRM),this.messageId=e}}class sa extends Wo{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 ia=(e,t)=>{const n=new Uint8Array(e),s=new Bo(n),i=s.readByte(),r=(e=>{const{command:t}=e;let n;switch(t){case go.CONN_ACK:n=new Yo(e);break;case go.PUBLISH:n=new Jo(e);break;case go.PUB_ACK:n=new ea(e);break;case go.QUERY_ACK:n=new sa(e);break;case go.PONG:n=new Qo(e);break;case go.DISCONNECT:n=new Ko(e);break;default:console.error(`No support for deserializing ${t} messages`)}return n})(xo.parse(i));return r&&r.read(s,n.length-1,t),r};class ra{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:s,data:i}=yield this._engine.pullRTCRoomEntry(e,n);s===w.SUCCESS?(this._isPulling=!1,this._pullTime=i||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 oa{constructor(e,t,n,s){this.rtcCodec=e,this._watcher=t,this._options=n,this.logger=s,this._appkey=this._options.appkey,this._rtcKVManager=new ra(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(io.RtcPullKV,{timestamp:0,roomId:e}),{code:n,buffer:s}=yield this.rtcSignaling(e,Lo,!0,t);if(n!==w.SUCCESS)return{code:n};const i=this.rtcCodec.decode(io.RtcKVOutput,s);let{entries:r,syncTime:o}=i;return r=(r||[]).map((e=>Object.assign(Object.assign({},e),{timestamp:Nt(e.timestamp)}))),this._watcher.onRTCDataChange(r,e),{code:n,data:o}}))}_receiveRtcKv(e){if(this._rtcSignalingListener)return void this._rtcSignalingListener(e);const{time:t,type:n,roomId:s}=this.rtcCodec.decode(io.RtcNotifyMsg,e);1===n&&this._rtcKVManager.pullEntry(s,Nt(t))}destroy(){}}var aa,la,ua,da,ca,ha,_a,ga,pa,Ea,fa;!function(e){e.INIT="INIT",e.DATA="DATA",e.END="END"}(aa||(aa={}));class Ia extends Je{constructor(e,t){super(),la.add(this),ua.set(this,void 0),da.set(this,new Map),ca.set(this,void 0),s(this,ua,e,"f"),s(this,ca,t,"f")}requestStreamMessageContent(e){return t(this,void 0,void 0,(function*(){const t=n(this,la,"a",ha).createTraceId();n(this,la,"a",ha).info(r.L_REQ_STREAM_MSG_CONTENT_T,`messageUId: ${e}`,t);const s=yield nt.create("requestStreamMessageContent").isLimitedString("messageUId",e,1,64,!0).fail(w.INVALID_PARAMETER_MESSAGE_UID,"messageUId is invalid.").result().tryTrans(n(this,ua,"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)?Xe(e.streamServer.addrs):et(w.STREAM_MESSAGE_DISABLE)})).next((t=>n(this,la,"m",fa).call(this,e,t)));return n(this,la,"a",ha).summary(r.L_REQ_STREAM_MSG_CONTENT_R,s,t,{messageUId:e}),s.wipe()}))}}ua=new WeakMap,da=new WeakMap,ca=new WeakMap,la=new WeakSet,ha=function(){return n(this,ua,"f").logger},_a=function(e,t,s){const i=n(this,da,"f").get(e);i&&(n(this,da,"f").delete(e),n(this,la,"m",ga).call(this,e,aa.END,t,i.msg))},ga=function(e,t,n,s,i){this.emit("message",{code:n,messageUId:e,type:t,chunk:i,message:s})},pa=function(e,t){e.content=Object.assign(Object.assign({},e.content),t),n(this,ua,"f").setMessageContent(e.messageId,e.content,e.messageType)},Ea=function(e,t,s){const i=n(this,da,"f").get(t);let r,o;switch(e){case"init":i.msg&&n(this,la,"m",pa).call(this,i.msg,{content:"",stopReason:0,completeReason:0,isSynced:!1}),n(this,la,"m",ga).call(this,t,aa.INIT,w.SUCCESS,i.msg);break;case"complete":r=s.length?JSON.parse(s):{},o=r.complete||!1,i.msg&&n(this,la,"m",pa).call(this,i.msg,{stopReason:r.stopReason||0,completeReason:r.completeReason||0,complete:o,isSynced:o}),n(this,la,"m",_a).call(this,t,r.stopReason||0,o);break;default:r=JSON.parse(s),i.cached+=r.content,i.msg&&n(this,la,"m",pa).call(this,i.msg,{content:i.cached}),n(this,la,"m",ga).call(this,t,aa.DATA,w.SUCCESS,i.msg,{content:r.content,fullContent:i.cached})}},fa=function(e,s){return t(this,void 0,void 0,(function*(){if(n(this,da,"f").has(e))return et(w.STREAM_MESSAGE_REQUEST_IN_PROCESS,`Request in process, msgUId: ${e}`);if(n(this,da,"f").size>=3)return et(w.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED,"The request queue is full");const t=fs.createSSEClient({logger:n(this,la,"a",ha),msgUId:e,appkey:n(this,ua,"f").appkey,token:n(this,ua,"f").token,timeout:3e4,onRawContent:t=>{const s=t.split("\n\n");console.log("recv events ->",s),s.forEach((t=>{if(0===t.length)return;t.startsWith("data:")&&(t=`event:delta\n${t}`);const s=t.indexOf("\n"),i=t.slice(0,s).replace("event:",""),r=t.slice(s+1+5);n(this,la,"m",Ea).call(this,i,e,r.trim())}))},onNetworkError:t=>{n(this,la,"m",_a).call(this,e,t,!1)}});if(!t.isOk)return t.wipe();const i=t.data,r={client:i,cached:"",msg:void 0};if(n(this,da,"f").set(e,r),n(this,ca,"f")){const{code:t,data:s}=yield n(this,ua,"f").getLocalMessage(e);if(!s)return n(this,da,"f").delete(e),et(t,`message not found, msgUId: ${e}`);if(s.content.isSynced)return n(this,da,"f").delete(e),et(w.STREAM_MESSAGE_SYNCED,"synced");r.msg=s}const o=yield i.open(s.slice());return o.isOk||n(this,da,"f").delete(e),o.wipe()}))};class Ra{constructor(e){this._context=e}__getContext(){return this._context}createCodec(e,t){return new so(e,t)}createPBCodec(e,t){return new Ss(e,t)}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._context.refetchNaviInfo()}))}getNaviInfo(){return this._context.getNaviInfoFromCache()}getCoreVersion(){return"5.20.0-c-esm-alpha.1"}getAPIVersion(){return"5.20.0-c-esm-alpha.1"}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,s=[]){this._context.registerMessageType(e,t,n,s)}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 Ta extends Ra{joinRTCRoom(e,n,s,i,r,o){return t(this,void 0,void 0,(function*(){const t=ao(this._context.rtcCodec,n,s,i,r,o),{code:a,buffer:l}=yield this.rtcSignaling(e,Eo,!0,t);let u;return a===w.SUCCESS&&l&&(u=lo(this._context.rtcCodec,l)),{code:a,data:u}}))}quitRTCRoom(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.SetUserStatusInput,{status:0}),{code:n}=yield this.rtcSignaling(e,fo,!0,t);return n}))}rtcPing(e,n,s){return t(this,void 0,void 0,(function*(){const{code:t}=yield this._context.rtcPing(e,n,s);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(io.RtcQueryListInput,{order:2}),{code:n,buffer:s}=yield this.rtcSignaling(e,Io,!0,t);let i;return n===w.SUCCESS&&s&&(i=this._context.rtcCodec.decode(io.RtcRoomInfoOutput,s)),{code:n,data:i}}))}getRTCUserInfoList(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcQueryListInput,{order:2}),{code:n,buffer:s}=yield this.rtcSignaling(e,Ro,!0,t);let i;if(n===w.SUCCESS&&s){i={users:lo(this._context.rtcCodec,s).users}}return{code:n,data:i}}))}getRTCUserInfo(e){throw new Error("Method not implemented.")}setRTCUserInfo(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcValueInfo,{key:n,value:s}),{code:i}=yield this.rtcSignaling(e,To,!0,t);return i}))}removeRTCUserInfo(e,n){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcKeyDeleteInput,{key:n}),{code:s}=yield this.rtcSignaling(e,mo,!1,t);return s}))}setRTCData(e,n,s,i,r,o){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcSetDataInput,{interior:i,target:r,key:n,value:s,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),{code:a}=yield this.rtcSignaling(e,So,!1,t);return a}))}setRTCTotalRes(e,n,s,i,r=""){return t(this,void 0,void 0,(function*(){const t={objectName:i,content:this._context.rtcCodec.encode(io.RtcValueInfo,{key:n.name,value:n.content},!0),valueInfo:[this._context.rtcCodec.encode(io.RtcValueInfo,{key:"uris",value:s},!0),this._context.rtcCodec.encode(io.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},o=this._context.rtcCodec.encode(io.RtcUserSetDataInput,t),{code:a}=yield this.rtcSignaling(e,Co,!0,o);return a}))}setRTCCDNUris(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcUserSetDataInput,{objectName:n,valueInfo:this._context.rtcCodec.encode(io.RtcValueInfo,{key:"cdn_uris",value:s},!0)}),{code:i}=yield this.rtcSignaling(e,Co,!0,t);return i}))}getRTCData(e,n,s,i){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcDataInput,{interior:s,target:i,key:n}),{code:r,buffer:o}=yield this.rtcSignaling(e,vo,!0,t);if(r!==w.SUCCESS||!o)return{code:r};const{outInfo:a}=this._context.rtcCodec.decode(io.RtcQryOutput,o),l={};return a.forEach((e=>{l[e.key]=e.value})),{code:r,data:l}}))}removeRTCData(e,n,s,i,r){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcDataInput,{interior:s,target:i,key:n,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),{code:o}=yield this.rtcSignaling(e,yo,!1,t);return o}))}setRTCOutData(e,n,s,i){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,s){return t(this,void 0,void 0,(function*(){const t=ao(this._context.rtcCodec,n,s),{code:i,buffer:r}=yield this.rtcSignaling(e,Ao,!0,t);if(i!==w.SUCCESS||!r)return{code:i};const{rtcToken:o}=this._context.rtcCodec.decode(io.RtcTokenOutput,r);return{code:i,data:{rtcToken:o}}}))}setRTCState(e,n){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.MCFollowInput,{state:n}),{code:s}=yield this.rtcSignaling(e,No,!0,t);return s}))}getRTCUserList(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcQueryListInput,{order:2}),{code:n,buffer:s}=yield this.rtcSignaling(e,Oo,!0,t);if(n!==w.SUCCESS||!s)return{code:n};return{code:n,data:lo(this._context.rtcCodec,s)}}))}joinLivingRoomAsAudience(e,n,s){return t(this,void 0,void 0,(function*(){const t=ao(this._context.rtcCodec,n,s),{code:i,buffer:r}=yield this.rtcSignaling(e,Mo,!0,t);if(i!==w.SUCCESS||!r)return{code:i};const{rtcToken:o,entries:a}=this._context.rtcCodec.decode(io.RtcViewerJoinedOutput,r);return{code:i,data:{token:o,kvEntries:a}}}))}quitLivingRoomAsAudience(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.SetUserStatusInput,{status:0}),{code:n}=yield this.rtcSignaling(e,Uo,!0,t);return n}))}rtcIdentityChange(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcInput,{roomType:jr.LIVE,broadcastType:s,identityChangeType:n,needSysChatroom:!1}),{code:i,buffer:r}=yield this.rtcSignaling(e,Po,!0,t);if(i!==w.SUCCESS||!r)return{code:i};return{code:i,data:lo(this._context.rtcCodec,r)}}))}requestRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:n,inviteSessionId:s,inviteTimeout:i,inviteInfo:r,roomId:o}=e,a=this._context.rtcCodec.encode(io.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:s,timeoutTime:i,inviteInfo:r}),{code:l}=yield this.rtcSignaling(o,bo,!0,a);return l}))}cancelRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:n,inviteSessionId:s,inviteInfo:i,roomId:r}=e,o=this._context.rtcCodec.encode(io.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:s,inviteInfo:i}),{code:a}=yield this.rtcSignaling(r,Do,!0,o);return a}))}responseRoomPK(e){return t(this,void 0,void 0,(function*(){const{inviteUserId:t,inviteRoomId:n,inviteSessionId:s,content:i,key:r,value:o,agree:a,roomId:l}=e,u=this._context.rtcCodec.encode(io.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:s,content:i,key:r,value:o,answerCode:a?1:0}),{code:d}=yield this.rtcSignaling(l,wo,!0,u);return d}))}endRoomPK(e){return t(this,void 0,void 0,(function*(){const{endRoomId:t,sessionId:n,content:s,keys:i,roomId:r}=e,o=this._context.rtcCodec.encode(io.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:s,inviteRoomKeys:i}),{code:a}=yield this.rtcSignaling(r,Vo,!0,o);return a}))}registerRTCSignalListener(e){this._context.registerRTCSignalingListener(e)}rtcSignaling(e,t,n,s){return this._context.rtcSignaling(e,t,n,s)}getRTCJoinedUserInfo(e){return t(this,void 0,void 0,(function*(){const t=this._context.rtcCodec.encode(io.RtcQueryUserJoinedInput,{userId:e}),{code:n,buffer:s}=yield this.rtcSignaling("",Go,!0,t);if(n!==w.SUCCESS||!s)return{code:n};return{code:n,data:(this._context.rtcCodec.decode(io.RtcQueryUserJoinedOutput,s).info||[]).map((e=>({deviceId:e.deviceId,roomId:e.roomId,joinTime:e.joinTime})))}}))}}const ma={"set.proxy":w.INVALID_PARAMETER_PROXY,"test.proxy":w.INVALID_PARAMETER_TESTHOST,"test.proxy.socksHost":w.INVALID_PARAMETER_TESTHOST,"test.proxy.socksPort":w.INVALID_PARAMETER_TESTHOST,channelId:w.INVALID_PARAMETER_CHANNEL_ID,count:w.INVALID_PARAMETER_COUNT,startTime:w.INVALID_PARAMETER_START_TIME,endTime:w.INVALID_PARAMETER_END_TIME,offset:w.INVALID_PARAMETER_OFFSET,limit:w.INVALID_PARAMETER_LIMIT,keyword:w.INVALID_PARAMETER_KEYWORD,messageTypes:w.INVALID_PARAMETER_MESSAGE_TYPE,messageType:w.INVALID_PARAMETER_MESSAGE_TYPE,typingContentType:w.INVALID_PARAMETER_MESSAGE_TYPE,conversation:w.INVALID_PARAMETER_CONVERSATION,conversationType:w.INVALID_PARAMETER_CONVERSATION_TYPE,targetId:w.INVALID_PARAMETER_TARGET_ID,targetIds:w.INVALID_PARAMETER_TARGET_ID,userId:w.INVALID_PARAMETER_USER_ID,senderUserId:w.INVALID_PARAMETER_USER_ID,timestamp:w.INVALID_PARAMETER_TIMESTAMP,order:w.INVALID_PARAMETER_ORDER,messageId:w.INVALID_PARAMETER_MESSAGE_ID,receivedStatus:w.INVALID_PARAMETER_RECEIVED_STATUS,receivedStatusInfo:w.INVALID_PARAMETER_RECEIVED_STATUS,sentStatus:w.INVALID_PARAMETER_SENT_STATUS,content:w.INVALID_PARAMETER_MESSAGE_CONTENT,messageIds:w.INVALID_PARAMETER_MESSAGE_ARRAY,cleanSpace:w.INVALID_PARAMETER_CLEAN_SPACE,messageDirection:w.INVALID_MESSAGE_DIRECTION,canIncludeExpansion:w.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION,expansion:w.INVALID_PARAMETER_MESSAGE_EXPANSION,disableNotification:w.INVALID_PARAMETER_DISABLE_NOTIFICATION,messages:w.MSG_LIMIT_ERROR,checkDuplicate:w.INVALID_PARAMETER_CHECK_DUPLICATE,messageUId:w.INVALID_PARAMETER_MESSAGE_UID,key:w.INVALID_PARAMETER_KEY,keys:w.INVALID_PARAMETER_KEYS,value:w.INVALID_PARAMETER_VALUE,isAutoDelete:w.INVALID_PARAMETER_IS_AUTO_DELETE,isSendNotification:w.INVALID_PARAMETER_IS_SEND_NOTIFICATION,notificationExtra:w.INVALID_PARAMETER_NOTIFICATION_EXTRA,entries:w.INVALID_PARAMETER_ENTRIES,isForce:w.INVALID_PARAMETER_IS_FORCE,rtcRoomId:w.INVALID_PARAMETER_RTCROOMID,token:w.RC_CONN_TOKEN_INCORRECT,conversations:w.INVALID_PARAMETER_CONVERSATIONS,draft:w.INVALID_PARAMETER_DRAFT,conversationTypes:w.INVALID_PARAMETER_CONVERSATION_TYPE_LIST,levels:w.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevel:w.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevels:w.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationStatus:w.INVALID_PARAMETER_NOTIFICATION_LEVEL,isTop:w.INVALID_PARAMETER_IS_TOP,isUpdateTime:w.INVALID_PARAMETER_IS_UPDATE_TIME,message:w.INVALID_PARAMETER_MESSAGE,mentionedUserIdList:w.INVALID_PARAMETER_USERIDLIST,directionalUserIdList:w.INVALID_PARAMETER_USERIDLIST,directedUserIds:w.INVALID_PARAMETER_USERIDLIST,isStatusMessage:w.INVALID_PARAMETER_IS_STATUS_MESSAGE,pushContent:w.INVALID_PARAMETER_PUSH_CONTENT,pushData:w.INVALID_PARAMETER_PUSH_DATA,isMentioned:w.INVALID_PARAMETER_IS_MENTIONED,mentionedType:w.INVALID_PARAMETER_MENTIONED_TYPE,isVoipPush:w.INVALID_PARAMETER_IS_VOIP_PUSH,pushConfig:w.INVALID_PARAMETER_PUSH_CONFIG,startMsgUId:w.INVALID_PARAMETER_START_MESSAGE_UID,endMsgUId:w.INVALID_PARAMETER_END_MESSAGE_UID,sentTime:w.INVALID_PARAMETER_TIMESTAMP,clearMessageOption:w.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,searchContent:w.SEARCH_PROPS_LIMIT_ERROR,tagId:w.INVALID_PARAMETER_TAG_ID,tagIds:w.INVALID_PARAMETER_TAG_ID,tagName:w.INVALID_PARAMETER_TAG_NAME,containMuted:w.INVALID_PARAMETER_CONTAIN_MUTED,channelType:w.INVALID_PARAMETER_CHANNEL_TYPE,file:w.MEDIA_EXCEPTION,fileType:w.INVALID_PARAMETER_MEDIA_TYPE,contentDisposition:w.INVALID_PARAMETER_CONTENT_DISPOSITION,mediaUrl:w.INVALID_PARAMETER_MEDIA_URL,filename:w.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME,saveName:w.INVALID_PARAMETER_SAVE_NAME,serverType:w.INVALID_PARAMETER_SERVER_TYPE,subscribeType:w.INVALID_PARAMETER_SUBSCRIBE_TYPE,expiry:w.INVALID_PARAMETER_SUBSCRIBE_EXPIRY,subscribeUserIds:w.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS,subscribePageSize:w.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE,beforeCount:w.INVALID_PARAMETER_BEFORE,afterCount:w.INVALID_PARAMETER_AFTER,conversationList:w.INVALID_PARAMETER_CONVERSATION_LIST,conversationTypeNotSupport:w.CONVERSATION_TYPE_NOT_SUPPORT,profile:w.INVALID_PARAMETER_USER_PROFILE,userProfileVisibility:w.INVALID_PARAMETER_USER_PROFILE_VISIBILITY,uniqueId:w.INVALID_PARAMETER_UNIQUE_ID,extra:w.INVALID_PARAMETER_EXTRA,disableUpdateLastMessage:w.INVALID_DISABLE_UPDATE_LAST_MESSAGE};var Sa;!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK",e[e.CHANNEL_ID=7]="CHANNEL_ID",e[e.CONVERSATION=8]="CONVERSATION",e[e.CONVERSATION_TYPE=9]="CONVERSATION_TYPE"}(Sa||(Sa={}));const Ca={[Sa.STRING]:ct,[Sa.ONLY_STRING]:rt,[Sa.NUMBER]:at,[Sa.BOOLEAN]:e=>"boolean"==typeof e,[Sa.OBJECT]:_t,[Sa.ARRAY]:ut,[Sa.CALLBACK]:e=>{let t=!0;return _t(e)||(t=!1),(e=e||{}).onSuccess&&!gt(e.onSuccess)&&(t=!1),e.onError&&!gt(e.onError)&&(t=!1),t},[Sa.CHANNEL_ID]:mt,[Sa.CONVERSATION]:e=>{let t=!0;return _t(e)||(t=!1),rt(e.targetId)||(t=!1),Rt(e.conversationType)||(t=!1),pt(e.channelId)||mt(e.channelId)||(t=!1),t},[Sa.CONVERSATION_TYPE]:Rt};class va extends Error{constructor(e){super(e),this.name="RCAssertError"}}const ya=(e,t,n,s=!1)=>{if(!Aa(e,t,n,s))throw new va(`'${e}' is invalid: ${JSON.stringify(t)}`)},Aa=(e,t,n,s=!1)=>{n=Ca[n]||n;const i=s?n(t):pt(t)||null==t||n(t);return i||null===console||void 0===console||console.error(`'${e}' is invalid: ${JSON.stringify(t)}`),i};class Na{constructor(e,t){var n,s;this._logTagT=e,this._logTagR=t,this.verificationFaileList=[],this.context=Fh.getContext(),this.logger=null===(n=this.context)||void 0===n?void 0:n.logger,this.option=null===(s=this.context)||void 0===s?void 0:s.getOptions()}validate(e,t,n,s=!1,i){if(this.verificationFaileList.length>0)return this;n=Ca[n]||n;const r=s?n(t):pt(t)||null==t||n(t);if("object"==typeof r){const{valid:e,errorKey:n}=r;return!e&&n&&this.verificationFaileList.push({key:n,value:t,isValid:!1,message:i,code:ma[n]}),this}return r||this.verificationFaileList.push({key:e,value:t,isValid:r,message:i,code:ma[e]}),this}validateParameters(e,t,n,s,i=!1,r){if(this.verificationFaileList.length>0)return this;n=Ca[n]||n;const o=i?n(t):pt(t)||null==t||n(t);if("object"==typeof o){const{valid:e,errorKey:n,errorCode:i}=o;return!e&&n&&this.verificationFaileList.push({key:n,value:t,code:i||s,message:r,isValid:!1}),this}return o||this.verificationFaileList.push({key:e,value:t,code:s,message:r,isValid:!1}),this}_getValidationResult(){if(this.verificationFaileList.length>0)return this.verificationFaileList[0]}ifReady(e){var t;if(!this.context)return Promise.resolve({code:w.BIZ_ERROR_CLIENT_NOT_INIT});const n=this._getValidationResult();if(n){const{code:e,value:s,message:i,key:r}=n;return null===(t=this.logger)||void 0===t||t.error(this._logTagR,JSON.stringify({code:e})),Promise.resolve({code:e,msg:`'${r}' is invalid: ${i||JSON.stringify(s)}`})}const s=this.logger.createTraceId();return e(this.context,this.logger,this.option,s)}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:w.BIZ_ERROR_CLIENT_NOT_INIT};const n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);const{code:s,value:i,message:r,key:o}=n;return null===(t=this.logger)||void 0===t||t.warn(this._logTagR,JSON.stringify({code:s})),{code:s,msg:`'${o}' is invalid: ${r||i}`}}}const Oa=e=>t=>{if(!ut(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 s=e.itemValidator&&e.itemValidator(t);return"object"==typeof s?s.errorKey?(n={errorKey:s.errorKey,valid:s.valid},!1):(n=s.valid,s.valid):(n=!!s,s)})),n},Ma=(e,t)=>{let n;return _t(e)?(t&&!t.includes(e.conversationType)&&(n="conversationTypeNotSupport"),Ct(e.targetId)||(n="targetId"),Rt(e.conversationType)||(n="conversationType"),pt(e.channelId)||mt(e.channelId)||(n="channelId"),pt(n)?{valid:!0}:{valid:pt(n),errorKey:n}):{valid:!1,errorKey:"conversation"}};let Ua;const La=()=>(Ua||(Ua={set:(e,t)=>{fs.localStorage.setItem(e,JSON.stringify(t))},get:e=>{let t;try{t=JSON.parse(fs.localStorage.getItem(e))}catch(e){t=null}return t},remove:e=>fs.localStorage.removeItem(e),getKeys:()=>{const e=[];for(const t in fs.localStorage)e.push(t);return e}}),Ua);class Pa{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 ba{constructor(e){this._rootStorage=La();const t=this._rootStorage.get(e)||{};this._cache=new Pa({[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 Da=()=>{let e="",{tag:t}=fs;if("browser"===t)return Qe;const n="RCDeviceId",s=La(),i=s.get(n);return i?e=i:(e=je.genWithLen(22),s.set(n,e)),e},wa=()=>je.gen(),Va=()=>je.genWithLen(22),Ga=()=>{if("browser"!==fs.tag)return{type:fs.tag,version:"UnKonw"};const{userAgent:e}=navigator;let t,n;const s={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 i in s){if(!s.hasOwnProperty(i))continue;let r=e.match(s[i]);if(r){n=i,t=r[1]||r[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}};function ka(e){return Boolean(1&((null==e?void 0:e.sessionMode)||0))}class Ba{static enable(){return!0}}const Fa=48,xa=64,Ha=80,qa=96,Ya="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ka=e=>{const t={};for(let n=0;n<e.length-1;n++){const s=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(s)?t[s].push(n):t[s]=[n]}const n=[];let s=[];const i=function(){if(s.length>0){const e=s.join("");if(s=[],e.length>26){const t=Qa(e.length),s=String.fromCharCode(Ha|t.length);n.push(s+t)}else{const t=String.fromCharCode(qa|e.length);n.push(t)}n.push(e)}};let r=0;for(;r<e.length;){const o=ja(t,e,r);if(o.length<2){s.push(e.charAt(r++));continue}if(o.length<4){s.push(e.substr(r,o.length)),r+=o.length;continue}const a=Qa(r-o.offset),l=Qa(o.length);if(a.length+l.length>=o.length){s.push(e.substr(r,o.length)),r+=o.length;continue}i();const u=String.fromCharCode(xa|a.length<<2|l.length);n.push(u+a+l),r+=o.length}i();const o=Qa(e.length),a=String.fromCharCode(Fa|o.length);return n.push(a+o),n.join("")},ja=(e,t,n)=>{const s={length:0,offset:-1};if(t.length,n>=t.length-1)return s;const i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return s;const r=t.length-n;for(let e=0,o=i.length;e<o;e++){const o=i[e],a=n-o;if(a>238327)continue;const l=Math.min(r,a);if(l<=s.length)break;if(s.length>2&&t.charAt(o+s.length-1)!==t.charAt(n+s.length-1))continue;let u=2;for(let e=u;e<l&&t.charAt(o+e)===t.charAt(n+e);e++)u++;u>=s.length&&(s.length=u,s.offset=o)}return s},Qa=e=>{const t=[];let n=0;do{n=e%62,t.push(Ya.charAt(n)),e=(e-n)/62}while(e>0);return t.join("")};class Wa{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(),s=yield t(n);return s.code===w.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,yield this._triggerPull(n),this._callHandler(e)):(this._retryCount=0,s)}))}stopAllTask(){this._callerQueue.forEach((e=>{e.resolve({code:w.RC_NET_UNAVAILABLE})})),this._callerQueue=[]}}const $a="converStatusChanged";class Ja extends Wa{constructor(e,t,n){super(),this._eventEmitter=new no,this._pullQueue=[],this._isPulling=!1,this._pullPromise=null,this._storagePullTimeKey=`con-s-${t}-${n}`,this._oldStorage=La(),this._storage=new ba(Le(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(r.A_CALLBACK_E,`adaptOldStatus error: ${e.message}`)}}_set(e){if(pt(e)||!Array.isArray(e))return;let t=this._storage.get(this._storagePullTimeKey)||0;const n=e.length;e.forEach(((e,s)=>{const i=e.updatedTime||0;t=i>t?i:t,this._eventEmitter.emit($a,{statusItem:e,isLastPull:s===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===w.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($a,(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 za={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}},Za={};for(const e in za){const{keyName:t}=za[e];Za[t]=e}class Xa{constructor(e,t,n){this._currentUserId=t,this.logger=n,this.storage=new ba(Pe(e,t)),this._localStore=new ba(be(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(),s=t.join("_");return{conversationType:Number(n),targetId:s,channelId:e}}return{conversationType:V.PRIVATE,targetId:"",channelId:""}}_updateMentionedUserList(e,t,n){const{conversationType:s,messageType:i,isMentioned:r,senderUserId:o}=e;if(r&&s===V.GROUP){(n.userIdList||[]).forEach((e=>{e===this._currentUserId&&t.indexOf(o)<0&&t.push(o)})),n.type===B.ALL&&t.indexOf(o)<0&&t.push(o)}if(i===F.RECALL&&s===V.GROUP){const e=t.indexOf(o);e>=0&&t.splice(e,1)}return t}updateMentionedData(e){const{conversationType:t,targetId:n,content:s,channelId:i,senderUserId:r}=e;let o=s.mentionedInfo;if(!o||r===this._currentUserId)return;const a=this._getStoreKey(t,n,i),l=this._localStore.get(a)||{},u=Za.mentionedInfo,d=Za.hasMentioned,c=l[u]||{};let h=c.userIdList||[];h=this._updateMentionedUserList(e,h,o),o={userIdList:h,type:(null==o?void 0:o.type)||c.type},0!==h.length?(l[u]=o,l[d]=!0):(delete l[u],delete l[d]),It(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,s){const i=this._getStoreKey(e,t,s),r=this._localStore.get(i)||{};for(const e in n){const t=Za[e],s=n[e];if(pt(t)||pt(s)||"hasMentioned"===e||"MentionedInfo"===e)continue;const{defaultVal:i}=za[t];s===i||"tags"===e&&!It(s)?delete r[t]:r[t]=this._setLocal(e,s),r.c||(delete r.t,delete r.fut,delete r.fuid,delete r.hm,delete r.m,delete r.mc)}const o=Object.keys(r);1===o.length&&o.includes("st")&&delete r.st,It(r)?this._localStore.set(i,r):this._localStore.remove(i)}get(e,t,n=""){const s=this._getStoreKey(e,t,n),i=this._localStore.get(s)||{},r={};for(const e in za){const{keyName:t,defaultVal:n}=za[e];r[t]=i[e]||Ut(n)}return r}getValue(e){const t=this._localStore.getValues()||{},n=[];for(const s in t){const{conversationType:i,targetId:r,channelId:o}=this._getConOptionByKey(s);let a={conversationType:i,targetId:r,channelId:o};const l=t[s];for(const e in l)if(za[e]){const{keyName:t,defaultVal:n}=za[e];a[t]=l[e]||Ut(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:s,targetId:i}=this._getConOptionByKey(n),r={},o=e[n];for(const e in o){const{keyName:t,defaultVal:n}=za[e];r[t]=o[e]||Ut(n)}for(const e in r.tags){pt(t[e])&&(t[e]=[]);const n=Object.assign(Object.assign({},r),{conversationType:s,targetId:i});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(r.O,`adaptOldStore error: ${e.message}`)}}remove(e,t,n){const s=this._getStoreKey(e,t,n);this._localStore.remove(s)}}const el=[V.PRIVATE,V.GROUP,V.SYSTEM,V.PUBLIC_SERVICE,V.APP_PUBLIC_SERVICE],tl="conversationChanged",nl="conTagStatusChanged";class sl{constructor(e,t,n,s,i,r){this.isEnableRealtimeSession=r,this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new no,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new Xa(t,n,e.getInnerLogger()),this._statusManager=new Ja(e,t,n),this._statusManager.watch((e=>{const{statusItem:t,isLastPull:n}=e;this.addStatus(t,n)})),this._eventEmitter.on(tl,(e=>{s(e)})),this._eventEmitter.on(nl,(()=>{i()}));let o=this._store.getValue();if(o.length>1e3){o=o.sort(((e,t)=>{const{lastMessageSentTime:n=0}=e,{lastMessageSentTime:s=0}=t;return s-n})),o.splice(1e3,o.length).forEach((e=>{this._store.remove(e.conversationType,e.targetId,e.channelId)}))}}_calcMsg(e,t,n,s){const i=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((e=>e===s.sentTime));let r=t>=s.sentTime;return n&&(r=n<s.sentTime),{isNotRead:r,isNotRepeadRecallSendTime:i}}_calcUnreadCount(e,t){if(this.isEnableRealtimeSession)return{hasChanged:!1,localConversation:t,updateItems:{}};const{content:n,messageType:s,sentTime:i,isCounted:r,messageDirection:o,senderUserId:a,messageUId:l}=e,u=o===se.SEND&&a===this._loginUserId,d=s===F.RECALL,c=_t(n);let h=!1;const _={},g=t.lastUnreadTime,p=t.lastReadTime,E=t.unreadMessageCount;if(g>i||u)return{hasChanged:h,localConversation:t,updateItems:_};if(r&&(0===t.unreadMessageCount&&(t.firstUnreadMessageUid=l,t.firstUnreadTime=i),t.unreadMessageCount=E+1,t.lastUnreadTime=i,h=!0),d&&c){const{unreadMessageCount:n,hasChanged:s}=this._handleRecall2UnreadCount(e,g,p,E,h);t.unreadMessageCount=n,h=s,0===t.unreadMessageCount&&(t.firstUnreadMessageUid="",t.firstUnreadTime=0)}return h&&(_.unreadMessageCount={val:t.unreadMessageCount||0,time:i}),{hasChanged:h,localConversation:t,updateItems:_}}_handleRecall2UnreadCount(e,t,n,s,i){const r=`${e.conversationType}_${e.channelId}_${e.targetId}`,{isNotRead:o,isNotRepeadRecallSendTime:a}=this._calcMsg(r,t,n,e.content);return o&&s&&a?(this._recallMsgTimeMap[r]||(this._recallMsgTimeMap[r]=[]),this._recallMsgTimeMap[r].push(e.content.sentTime),{unreadMessageCount:s-1,hasChanged:!0}):{unreadMessageCount:s,hasChanged:i}}_calcMentionedInfo(e,t){const{content:n,messageDirection:s,isMentioned:i,sentTime:r}=e,o=s===se.SEND,a=_t(n);let l=!1;const u={};return!o&&i&&a&&n.mentionedInfo&&(t.hasMentioned=!0,l=!0,u.hasMentioned={val:!0,time:r},u.mentionedInfo={val:n.mentionedInfo,time:r}),{hasChanged:l,localConversation:t,updateItems:u}}_calcMentionedCount(e,t){const{content:n,messageDirection:s,isMentioned:i}=e;let r=!1;if(i&&s===se.RECEIVE&&(null==n?void 0:n.mentionedInfo)){const{mentionedInfo:{type:e,userIdList:s}}=n;if(e===B.ALL||(s||[]).includes(this._loginUserId)){r=!0;const e=t.unreadMentionedCount||0;t.unreadMentionedCount=e+1}}return{hasChanged:r,localConversation:t}}_setUpdatedConversation(e){if(_t(e)){const{conversationType:t,targetId:n,channelId:s}=e,i=`${t}_${n}`,r=this._store.get(t,n,s)||{};this._updatedConversations[i]=Object.assign(r,e)}}_setConTagStatusChanged(e,t,n,s){const i=(this._store.get(e,t,s)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(const e in i)if(!n[e]||!!i[e].isTop!=!!n[e].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0}addStatus(e,t){const{conversationType:n,targetId:s,updatedTime:i,notificationStatus:r,notificationLevel:o,isTop:a,tags:l,channelId:u}=e,d={},c={};if(n===V.ULTRA_GROUP)return;pt(o)||(c.notificationLevel={time:i,val:o},c.notificationStatus={time:i,val:ue(o)}),pt(a)||(c.isTop={time:i,val:a}),pt(l)||(c.tags={time:i,val:l},null==l||l.forEach((e=>{d[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,s,d,u);const h=this._store.get(n,s,u).lastMessageSentTime||(new Date).getTime();this._store.set(n,s,{notificationStatus:r,notificationLevel:o,isTop:a,tags:d,lastMessageSentTime:h},u),s&&(this._setUpdatedConversation({conversationType:n,targetId:s,updatedItems:c,channelId:u}),t&&this._notifyConversationChanged())}_notifyConversationChanged(){const e=[];for(const t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(tl,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(nl),this._conTagStatusChanged=!1))}setConversationCacheByMessage(e,t){const{conversationType:n,isPersited:s,targetId:i,channelId:r,sentTime:o,disableUpdateLastMessage:a}=e;if(!(el.indexOf(n)>=0))return;let l=!1,u=this._store.get(n,i,r),d={};u.lastMessageSentTime=o;if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((t=>{const{hasChanged:n,localConversation:s,updateItems:i}=t.call(this,e,u);l=l||n,d=Object.assign(Object.assign({},d),i),u=Ut(s)})),this._store.set(n,i,u,r),this._store.updateMentionedData(e),s&&!a){const t=this._store.get(n,i,r);t.updatedItems=Object.assign({latestMessage:{time:e.sentTime,val:e}},d),t.latestMessage=e;const s=Object.assign(t,{conversationType:n,targetId:i,channelId:r});this._setUpdatedConversation(s)}(l||s&&!a)&&this._notifyConversationChanged()}get(e,t,n=""){return this._store.get(e,t,n)}getAllUnreadCount(e,t,n){const s=this._store.getValue();let i=0;return s.forEach((({unreadMessageCount:e,notificationStatus:s,notificationLevel:r,conversationType:o})=>{e=e||0,(n||void 0!==r&&r<=0||void 0===r&&s!==ae.OPEN)&&(t.length>0?t.includes(Number(o))&&(i+=Number(e)):i+=Number(e))})),i}getTotalUnreadCountByLevels(e,t,n){const s=this._store.getValue();let i=0;return s.forEach((({unreadMessageCount:s,notificationLevel:r=0,conversationType:o,unreadMentionedCount:a})=>{e.includes(o)&&(0===t.length||t.includes(r))&&(i+=(n?a:s)||0)})),i}getUnreadCountByTag(e,t){const n=this._store.getValueForTag()[e]||[];let s=0;return n.forEach((({unreadMessageCount:e,notificationStatus:n,notificationLevel:i})=>{(t||1!==n||-1===i||0===i)&&(e=e||0,s+=Number(e))})),s}getUnreadCount(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0}clearUnreadCount(e,t,n,s,i=!0){const r=this._store.get(e,t,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap[`${e}_${n}_${t}`]=[];const{unreadMessageCount:o,hasMentioned:a}=r,l={};if(o&&(r.unreadMessageCount=0,l.unreadMessageCount={val:0,time:s}),a&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,l.hasMentioned={val:!1,time:s},l.mentionedInfo={val:void 0,time:s}),this._store.set(e,t,r,n),!i)return;if(0===Object.keys(l).length)return;const u=Object.assign(r,{conversationType:e,targetId:t,channelId:n,updatedItems:l});this._setUpdatedConversation(u),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,s){const i=`${e}_${t}_${s}`;this._draftMap[i]=n}getDraft(e,t,n){const s=`${e}_${t}_${n}`;return this._draftMap[s]}clearDraft(e,t,n){const s=`${e}_${t}_${n}`;delete this._draftMap[s]}addTagStatus(e,t,n,s=""){const i=this._store.get(e,t,s);let{tags:r}=i;r=Object.assign(r,n);const o=i.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:r,lastMessageSentTime:o},s)}deleteTagStatus(e,t,n,s=""){const{tags:i}=this._store.get(e,t,s);n.forEach((e=>{delete i[e]})),this._store.set(e,t,{tags:i},s)}getConversationListForTag(){return this._store.getValueForTag()}getBlockConversationList(){return this._store.getValue().filter((e=>e.notificationStatus===ae.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)&&(pt(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 il{constructor(e,t){this._localStore=new ba(De(e,t))}set(e,t,n,s){const i=this._getStoreKey(e,t,s),r=this._localStore.get(i)||{};for(const e in n){const t=ol[e],s=n[e];if(pt(t)||pt(s))continue;const{defaultVal:i}=rl[t];s===i?delete r[t]:r[t]=s}It(r)?this._localStore.set(i,r):this._localStore.remove(i)}get(e,t,n=""){const s=this._getStoreKey(e,t,n),i=this._localStore.get(s)||{},r={};for(const e in rl){const{keyName:t,defaultVal:n}=rl[e];r[t]=i[e]||Ut(n)}return r}_getStoreKey(e,t,n){return`${n}_${e}_${t}`}}const rl={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},ol={};for(const e in rl){const{keyName:t}=rl[e];ol[t]=e}class al{constructor(e,t){this._store=new il(e,t)}addUltraGroupStatus(e){const{conversationType:t,targetId:n,notificationStatus:s,notificationLevel:i,channelId:r}=e;t===V.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:s,notificationLevel:i},r)}get(e,t,n=""){return this._store.get(e,t,n)}}const ll={_caches:{},set(e,t){this._caches[e]=t},get(e){return this._caches[e]||0},clear(e){this._caches[e]=0}};class ul{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:s,isOverwrite:i,userId:r}=e,o=this._getSetUserId(n),a=s===M.DELETE,l=o===r,u=!this._isExisted(n),d=a?this._remove:this._add;(t||i||l||u)&&d.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:s}=t;return n&&!s}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 dl{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=ll.get(e);if(n>t)return this._isPulling=!1,void this._startPull();const{code:s,data:i}=yield this._engine.pullChatroomEntry(e,n);this._isPulling=!1,s===w.SUCCESS?(ll.set(e,i.syncTime||0),this._startPull()):this._startPull()}))}reset(e){ll.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 s=this._storeCaches[e];It(s)||(s=new ul(this._engine.getInnerLogger(),e,n)),s.setEntries(t),this._storeCaches[e]=s}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 cl{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 hl extends Wa{constructor(e,t,n,s){super(),this._tagKey="tags",this._versionKey="version",this._pullQueue=[],this._isPulling=!1,this._pullPromise=null,this._storageKey=Be(t,n),this._storage=new ba(this._storageKey),this._engine=e,this._tagWatcherFunc=s}_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 s=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:s}})),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===w.SUCCESS&&!pt(n)){const{settings:e,version:t}=n,s=e.Tag;pt(s)||this._updateTag(s),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 _l={};function gl(){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:ln.getMiniCmpUrlList().join(",")}}class pl extends vn{constructor(e,t,n,s="default"){super(e,t,n,fs.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),fs.useNavi),this._environment=s}httpRequest(e,n,s,i,o){return t(this,void 0,void 0,(function*(){const t=`${e}/navi.js?appId=${n}&token=${encodeURIComponent(s)}&callBack=x&v=${ye}&r=${Date.now()}&env=${this._environment}`;this.logger.debug(r.L_REQUEST_T,`req navi => ${t}`,i);const a=yield fs.httpReq({url:t,timeout:1e4,dataType:"text"});if(200!==a.status)return this.logger.debug(r.L_REQUEST_R,`request navi failed: ${a.status}`,i),!fs.useNavi&&o?Xe(gl()):et(this.transHttpCode(a.status));try{let e=a.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?et(this.transHttpCode(n.code)):(fs.useNavi||(n.server="",n.backupServer=ln.getMiniCmpUrlList().join(","),n.logSwitch=0),Xe(n))}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,i)}return et(w.RC_NAVI_REQ_FAILED)}))}httpRequestV2(e,n,s,i,o){return t(this,void 0,void 0,(function*(){const t=this.getNaviV2RequestOption({appkey:n,token:s,uri:e,platform:fs.tag,protocol:(/^https/.test(e)?G.WSS:G.WS).toString()});this.logger.debug(r.L_REQUEST_T,`req navi => ${t.url}`,i);const a=yield fs.httpReq(t);if(200!==a.status)return this.logger.debug(r.L_REQUEST_R,`request navi failed: ${a.status}`,i),!fs.useNavi&&o?Xe(gl()):et(this.transHttpCode(a.status));try{let e=a.data;const n="object"!=typeof e?JSON.parse(e):e;if(n.protocol=/^https/.test(t.url)?"https":"http",!fs.useNavi){n.logSwitch=0;const e=ln.getMiniCmpUrlList();n.serverAddr=e.map(((n,s)=>({addr:n,protocol:/^https/.test(t.url)?G.WSS:G.WS,weight:e.length-s})))}return Xe(n)}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,i)}return et(w.RC_NAVI_REQ_FAILED)}))}getNaviCache(e){const t=this.getCatchKey(e);if(_l[t])return _l[t];const n=Ue(this.appkey),s=fs.localStorage;let i;try{const e=s.getItem(n);i=e?JSON.parse(e):[]}catch(e){i=[]}if(0===i.length)return null;const r=i.find((t=>t.token===e&&t.environment===this._environment))||null;return _l[t]=r,r}setNaviCache(e,t){const n=Ue(this.appkey),s=fs.localStorage;let i;try{const e=s.getItem(n);i=e?JSON.parse(e):[]}catch(e){i=[]}const r=Date.now();i.length>0&&(i=i.filter((t=>r-t.timestamp<me&&(e!==t.token||this._environment!==t.environment))));const o={timestamp:r,naviInfo:t,token:e,environment:this._environment};i.push(o),s.setItem(n,JSON.stringify(i)),_l[this.getCatchKey(e)]=o}}class El{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 s=Ve(this._appkey,t);fs.localStorage.setItem(s,e.toString())}getInboxTime(e){const t=this._getMemData(e);if(0===t.inboxTime){const n=Ve(this._appkey,e);t.inboxTime=parseInt(fs.localStorage.getItem(n),10)||0}return t.inboxTime}setBroadcastSyncTime(e,t){const n=this._getMemData(t);if(n.broadcastSyncTime>=e||pt(e))return;n.broadcastSyncTime=e;const s=Ge(this._appkey,t);fs.localStorage.setItem(s,e.toString())}getBroadcastSyncTime(e){const t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){const n=Ge(this._appkey,e);t.broadcastSyncTime=parseInt(fs.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 s=we(this._appkey,t);fs.localStorage.setItem(s,e.toString())}getOutboxTime(e){const t=this._getMemData(e);if(0===t.outboxTime){const n=we(this._appkey,e);t.outboxTime=parseInt(fs.localStorage.getItem(n),10)||0}return t.outboxTime}}class fl{constructor(e){this._appkey=e,this._sendMessageMap={},this._userId=""}init(e){this._userId=e;const t=ke(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)}_getLocalInfo(e){const t=fs.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}}setMessage(e,t){this._sendMessageMap[e]=t;const n=ke(this._appkey,this._userId),s=this._getLocalInfo(n);s[e]=t,fs.localStorage.setItem(n,JSON.stringify(s))}getSendMessageMap(){return this._sendMessageMap}removeByUID(e){delete this._sendMessageMap[e]}removeByTimestamp(e){const t=ke(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((t=>{n[t]<e&&delete n[t]})),fs.localStorage.setItem(t,JSON.stringify(n))}}class Il{constructor(e){this._delayTime=e,this.subscribeData={[z.ONLINE_STATUS]:{},[z.USER_PROFILE]:{}},this._ownProfile=null}clearSubscribeRelation(){this.subscribeData={[z.ONLINE_STATUS]:{},[z.USER_PROFILE]:{}}}clearSubscribeStatusData(e){e===z.ONLINE_STATUS?Object.keys(this.subscribeData[e]).forEach((t=>{this.subscribeData[e][t].statusMap={}})):e===z.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 Rl{constructor(e){this._delayTime=e,this._relationshipStatusVersion=0,this._subUserStatusVersion=0,this._ownProfileVersion=0,this._subStore=new Il(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 s=e.find((e=>e.subscribeType===t.subType&&e.userId===n.subUserId));s?s.subscribeTime<t.subTime&&(s.expiry=t.expiry,s.operationType=t.opType,s.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=[],s=[],i=[];t&&this._subStore.clearSubscribeRelation();return this._filterSubscribeRelationData(e).forEach((e=>{var t,r;const{userId:o,subscribeTime:a,subscribeType:l,expiry:u,operationType:d}=e;if(d===Z.UNSUBSCRIBE)return this._subStore.removeSubscribeUserData(l,o),void i.push(e);const c=this._subStore.getSubscribeUserData(l,o);if(!(c&&c.subscribeTime>=a)){if(l===z.ONLINE_STATUS){n.push(o);const e=(null===(t=c)||void 0===t?void 0:t.statusMap)||{};this._subStore.updateSubscribeUserData(l,o,{subscribeTime:a,expiry:u,userId:o,subscribeType:l,statusMap:e})}else{s.push(o);const e=null===(r=c)||void 0===r?void 0:r.profile;this._subStore.updateSubscribeUserData(l,o,{subscribeTime:a,expiry:u,userId:o,subscribeType:l,profile:e,isSubscribed:!0})}i.push(e)}})),{newSubscribeOnlineStatusList:n,newSubscribeUserProfileList:s,subscribeUserChangeList:i}}clearSubscribeStatus(){this._subStore.clearSubscribeStatusData(z.ONLINE_STATUS),this._subStore.clearSubscribeStatusData(z.USER_PROFILE)}updateSubscribeUserOnlineStatus(e){const t=[];return e.forEach((e=>{const{subUserId:n,data:s}=e,i=this._subStore.getSubscribeUserData(z.ONLINE_STATUS,n);if(!i)return;const r=[],o=Object.assign({},i.statusMap);s.forEach((e=>{const t=o[e.platformInfo];if(t&&t.changeTime>e.versionTime)return;const n={eventValue:e.value,changeTime:e.versionTime};o[e.platformInfo]=n,r.push(Object.assign(Object.assign({},n),{platform:e.platformInfo}))})),this._subStore.updateSubscribeUserData(z.ONLINE_STATUS,n,{subscribeTime:i.subscribeTime,expiry:i.expiry,userId:n,subscribeType:z.ONLINE_STATUS,statusMap:o}),t.push({userId:n,subscribeType:z.ONLINE_STATUS,subscribeTime:i.subscribeTime,expiry:i.expiry,details:r})})),t}updateSubscribeUserProfile(e){const t=[];return e.forEach((e=>{const{userId:n,version:s,userProfile:i,userExtProfile:r}=e,o=this._subStore.getSubscribeUserData(z.USER_PROFILE,n),a=Gt(n,i,r);o?o.profile&&o.profile.version>=s||(this._subStore.updateSubscribeUserData(z.USER_PROFILE,n,{subscribeTime:o.subscribeTime,expiry:o.expiry,userId:n,subscribeType:z.USER_PROFILE,profile:{info:a,version:s},isSubscribed:o.isSubscribed}),o.isSubscribed&&t.push({userId:n,subscribeType:z.USER_PROFILE,subscribeTime:o.subscribeTime,expiry:o.expiry,userProfile:Object.assign({},a)})):this._subStore.updateSubscribeUserData(z.USER_PROFILE,n,{subscribeTime:0,expiry:0,userId:n,subscribeType:z.USER_PROFILE,profile:{info:a,version:s},isSubscribed:!1})})),t}getSubscribeUserStatus(e,t){const n=[];return t.forEach((t=>{const s=this._subStore.getSubscribeUserData(e,t);if(!s||s.expiry<(Date.now()+this._delayTime-s.subscribeTime)/1e3)this._subStore.removeSubscribeUserData(e,t);else{const t={subscribeTime:s.subscribeTime,expiry:s.expiry,userId:s.userId,subscribeType:s.subscribeType};if(e===z.ONLINE_STATUS){const{statusMap:e}=s,n=Object.keys(e).map((t=>Object.assign({platform:~~t},e[~~t])));t.details=Vt(n)}else if(e===z.USER_PROFILE&&!s.isSubscribed)return;n.push(t)}})),n}getUserProfiles(e){const t=[],n=[];return e.forEach((e=>{const s=this._subStore.getSubscribeUserData(z.USER_PROFILE,e);if(!s||!s.profile)return void n.push(e);const{version:i,info:r}=s.profile;if(s.isSubscribed)return this._delayTime+Date.now()-i>6048e5?void n.push(e):void t.push(Object.assign(Object.assign({},r),{extraProfile:Object.assign({},r.extraProfile)}));this._delayTime+Date.now()-i>6e5?n.push(e):t.push(Object.assign(Object.assign({},r),{extraProfile:Object.assign({},r.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===z.ONLINE_STATUS){const e=Object.keys(t.statusMap).map((e=>Object.assign({platform:~~e},t.statusMap[~~e])));n.details=Vt(e)}return n}))}updateOwnProfile(e,t){this._ownProfileVersion>t||this._subStore.updateOwnProfile(e)}getOwnProfile(){return this._subStore.getOwnProfile()}}class Tl{constructor(e,t,n,s,i,r,o){this._connectManager=e,this._event=t,this._currentUserId=n,this._delayTime=s,this._logger=i,this._isOpenUserProfile=r,this._subDriven=o,this._isPullingRelationship=!1,this._pullRelationshipQueue=[],this._pullRelationshipFailTime=0,this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue=[],this._pullSubUserStatusFailTime=0,this._subscribeService=new Rl(s)}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(z.ONLINE_STATUS),2&this._subDriven&&this._event.syncSubscribeUserStatusFinished(z.USER_PROFILE),3&this._subDriven&&this._event.syncSubscribeUserStatusFinished(z.FRIEND_ONLINE_STATUS),4&this._subDriven&&this._event.syncSubscribeUserStatusFinished(z.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(),s=this._logger.createTraceId();this._logger.info(r.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:t,_pageToken:n}),s);const i=this._connectManager.codec.encodePullUserSubReq({version:t,pageToken:n}),o=new Zo(uo.pullUserSub,i,this._currentUserId),{code:a,data:l}=yield this._connectManager.send(o,er);if(a!==w.SUCCESS||!l)return this._logger.error(r.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:a,failTime:this._pullRelationshipFailTime}),s),this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?void(this._pullRelationshipFailTime=0):this._pullSubscribeRelationship(e,n);this._pullRelationshipFailTime=0;let{list:u,version:d,hasNext:c,pageToken:h}=l;if(d=Nt(d),u.forEach((e=>{e.subTime=Nt(e.subTime)})),this._logger.info(r.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:a,data:l}),s),e){const{newSubscribeOnlineStatusList:e,newSubscribeUserProfileList:t,subscribeUserChangeList:n}=this._subscribeService.updateSubscribeRelation(u);n.length>0&&this._event.subscribeRelationChanged(n),e.length>0&&this._queryAndUpdateUserOnlineStatus(e),t.length>0&&this._queryAndUpdateUserProfile(t)}else this._subscribeService.updateSubscribeRelation(u,!n);this._subscribeService.updateRelationshipStatusVersion(d),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((e=>e>d)),c&&(yield this._pullSubscribeRelationship(e,h))}))}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(),s=this._logger.createTraceId();this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:t,_pageToken:n,needAllData:e}),s);const i=this._connectManager.codec.encodePullSubDataReq({version:t,needAllData:e,pageToken:n}),o=new Zo(uo.pullSubData,i,this._currentUserId),{code:a,data:l}=yield this._connectManager.send(o,nr);if(a!==w.SUCCESS||!l)return this._logger.warn(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,failTime:this._pullSubUserStatusFailTime}),s),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?void(this._pullSubUserStatusFailTime=0):this._pullSubscribeUserStatus(e,n);this._pullSubUserStatusFailTime=0;let{list:u,versionTime:d,hasNext:c,pageToken:h,isFull:_}=l;d=Nt(d),this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,data:l}),s),u.forEach((e=>{e.data.forEach((e=>{e.versionTime=Nt(e.versionTime)}))})),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((e=>e>d)),this._subscribeService.updateSubscribeUserStatusVersion(d);const g=[],p=[];u.forEach((e=>{e.subType===z.ONLINE_STATUS?g.push(e):e.subType===z.USER_PROFILE&&p.push(e.subUserId)})),_&&""===n&&this._subscribeService.clearSubscribeStatus(),g.length>0&&this._updateUserOnlineStatus(g,!_),p.length>0&&(yield this._queryAndUpdateUserProfile(p,!_)),c&&(yield this._pullSubscribeUserStatus(e,h))}))}_queryAndUpdateUserOnlineStatus(e){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(r.L_QUERY_SUBSCRIBE_DATA_T,JSON.stringify(e),t);const n=this._connectManager.codec.encodeQrySubDataReq(z.ONLINE_STATUS,e),s=new Zo(uo.qrySubData,n,this._currentUserId),{code:i,data:o}=yield this._connectManager.send(s,nr);this._logger.info(r.L_QUERY_SUBSCRIBE_DATA_R,JSON.stringify({code:i,data:o}),t),i===w.SUCCESS&&o&&this._updateUserOnlineStatus(o.list)}))}_updateUserOnlineStatus(e,t=!0){e.forEach((e=>{e.data.forEach((e=>{e.versionTime=Nt(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(r.L_PULL_USER_PROFILE_T,JSON.stringify(e),t);const s=this._connectManager.codec.encodePullUserProfileReq(e),i=new Zo(uo.pullUserProfile,s,this._currentUserId),{code:o,data:a}=yield this._connectManager.send(i,ur);if(this._logger.info(r.L_PULL_USER_PROFILE_R,JSON.stringify({code:o,data:a}),t),o!==w.SUCCESS||!a)return{code:o};a.UserProfile.forEach((e=>{e.version=Nt(e.version)}));const l=this._subscribeService.updateSubscribeUserProfile(a.UserProfile);return n&&l.length>0&&this._event.subscribeUserStatusChanged(l),{code:o,data:a.UserProfile}}))}updateUserStatus(e){return t(this,void 0,void 0,(function*(){const t=this._connectManager.codec.decodeByPBName(e.pbData,sr);if(t.subType===z.ONLINE_STATUS)this._updateUserOnlineStatus([t]);else if(t.subType===z.USER_PROFILE)this._queryAndUpdateUserProfile([t.subUserId]);else if(t.subType===z.FRIEND_ONLINE_STATUS){const e=t.data.map((e=>({changeTime:Nt(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===z.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:Gt(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,s,i=0){return t(this,void 0,void 0,(function*(){const t=this._connectManager.codec.encodeUpdateUserSubReq(n,e,s,i),r=new Zo(uo.updUserSub,t,this._currentUserId),{code:o,data:a}=yield this._connectManager.send(r,Zi);if(o===w.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT&&a)return{code:o,data:a.subUsers.map((e=>e.subUserId))};if(o!==w.SUCCESS||!a)return{code:o};const{subTime:l}=a;return this._subscribeService.updateSubscribeRelation([{subType:n,subTime:l,expiry:i,opType:s,subUsers:e.map((e=>({subUserId:e})))}]),s===Z.SUBSCRIBE&&(n===z.ONLINE_STATUS?this._queryAndUpdateUserOnlineStatus(e):n===z.USER_PROFILE&&this._queryAndUpdateUserProfile(e,!1)),{code:o}}))}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:w.SUCCESS,data:n});const{code:s,data:i}=yield this._queryAndUpdateUserProfile(t,!1);if(s!==w.SUCCESS||!i)return{code:s,data:[...n]};const r=i.map((e=>Gt(e.userId,e.userProfile,e.userExtProfile)));return{code:s,data:[...n,...r]}}))}syncOwnProfile(e=!1){return t(this,void 0,void 0,(function*(){if(!this._isOpenUserProfile)return Promise.resolve({code:w.RC_USER_PROFILE_SERVICE_UNAVAILABLE});const t=this._logger.createTraceId();this._logger.info(r.L_PULL_OWN_PROFILE_T,"",t);const n=this._connectManager.codec.encodeUserProfileInput(),s=new Zo(uo.pullOwnProfile,n,this._currentUserId),{code:i,data:o}=yield this._connectManager.send(s,rr);if(this._logger.info(r.L_PULL_OWN_PROFILE_R,JSON.stringify({code:i,data:o}),t),i!==w.SUCCESS||!o)return{code:i};const{userExtProfile:a,userProfile:l,version:u,userId:d}=o,c=Nt(u),h=Gt(d,l,a);return this._subscribeService.updateOwnProfile(h,c),e&&this._event.ownUserProfileChanged(h),{code:i,data:h}}))}getOwnProfile(){return t(this,void 0,void 0,(function*(){const e=this._subscribeService.getOwnProfile();return e?{code:w.SUCCESS,data:e}:this.syncOwnProfile()}))}updateOwnProfile(e,n){return t(this,void 0,void 0,(function*(){this._subscribeService.updateOwnProfile(e,n)}))}}class ml{constructor(e,t,n){this._storage=new ba(He(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,s,i){if(s<Date.now()-this._delayTime-Me)return;const r=this._getConversationKey(e),o=this._storage.get(r)||{};if(o[t])return;const a={t:s,d:n};i&&(a.sId=i);let l=Object.assign(Object.assign({},o),{[t]:a});Object.keys(l).length>30&&(l=this._removeExcessData(l)),this._storage.set(r,l)}addReadedUser(e,t,n){const s=this._getConversationKey(e),i=this._storage.get(s)||{},r=i[t];if(r){if(r.us){if(r.us.includes(n))return}else r.us=[];r.us.push(n),this._storage.set(s,Object.assign(Object.assign({},i),{[t]:r}))}}getReadReceiptInfo(e,t){const n=this._getConversationKey(e),s=(this._storage.get(n)||{})[t];return s?{time:s.t,direction:s.d,users:s.us||[],senderId:s.sId}:null}getReceiptMessageDic(e){const t=this._getConversationKey(e),n=this._storage.get(t)||{},s={};for(const e in n){const t=n[e];t.d===se.RECEIVE&&(s[t.sId]||(s[t.sId]=[]),s[t.sId].push(e))}return s}remove(e,t){const n=this._getConversationKey(e),s=this._storage.get(n)||{};s[t]&&(delete s[t],0===Object.keys(s).length?this._storage.remove(n):this._storage.set(n,s))}clear(){const e=this._storage.getValues(),t={};for(const n in e){const s=e[n],i={};for(const e in s){const t=s[e];Date.now()-this._delayTime-t.t<Me&&(i[e]=t)}Object.keys(i).length&&(t[n]=i)}this._storage.update(t)}}class Sl extends un{constructor(e,t){super(e,t),this.appkey=e,this.logger=t,this._storageKey="",this._storageKey=Fe(e)}getCache(){return fs.localStorage.getItem(this._storageKey)}setCache(e){fs.localStorage.setItem(this._storageKey,e)}clearCache(){fs.localStorage.removeItem(this._storageKey)}sendRequest(e){return t(this,void 0,void 0,(function*(){const{status:t,data:n}=yield fs.httpReq({url:e});return{code:t,data:n}}))}decryptData(e){return t(this,void 0,void 0,(function*(){try{const t=yield Xt(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91");return JSON.parse(t)}catch(e){this.logger.error(r.L_GET_STATIC_CONF_E,JSON.stringify({error:null==e?void 0:e.stack}))}}))}}class Cl extends Wa{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===w.SUCCESS&&!pt(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 vl extends Cl{constructor(e,t,n,s,i){super(),this._connectManager=e,this._currentUserId=t,this._logger=n,this._appkey=s,this._callBack=i,this._lastPullingChangeMessageTime=0,this._lastPullingChangeMessageTimeLocal=(new Date).getTime(),this._duration=18e4,this._pullEventChangeIntervalTimer=-1,this._localStorageKey=qe(s,t),this._storage=new ba(this._localStorageKey),this._lastPullingChangeMessageTime=this._storage.get(t)||0}get _isConnected(){return this._connectManager.getConnectionStatus()===ee.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:w.CONNECTION_TIMEOUT});this._logger.info(r.L_PULL_EVENT_CHANGE_T,`PullEventChange time: ${this._lastPullingChangeMessageTime}`);const e=this._connectManager.codec.encodeQueryMsgChange(this._lastPullingChangeMessageTime),t=new Zo(uo.pullEventChange,e,this._currentUserId);return t.setHeaderQos(_o.AT_LEAST_ONCE),this._connectManager.send(t,Di)}pullDataHandler(e){this._logger.info(r.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(r.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S,"PullEventChange notify online"))}))}}
|
|
16
|
-
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function yl(e){let t=e.length;for(;--t>=0;)e[t]=0}const Al=256,Nl=286,Ol=30,Ml=15,Ul=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Ll=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Dl=new Array(576);yl(Dl);const wl=new Array(60);yl(wl);const Vl=new Array(512);yl(Vl);const Gl=new Array(256);yl(Gl);const kl=new Array(29);yl(kl);const Bl=new Array(Ol);function Fl(e,t,n,s,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=s,this.max_length=i,this.has_stree=e&&e.length}let xl,Hl,ql;function Yl(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}yl(Bl);const Kl=e=>e<256?Vl[e]:Vl[256+(e>>>7)],jl=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Ql=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,jl(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Wl=(e,t,n)=>{Ql(e,n[2*t],n[2*t+1])},$l=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},Jl=(e,t,n)=>{const s=new Array(16);let i,r,o=0;for(i=1;i<=Ml;i++)o=o+n[i-1]<<1,s[i]=o;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=$l(s[t]++,t))}},zl=e=>{let t;for(t=0;t<Nl;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ol;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Zl=e=>{e.bi_valid>8?jl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Xl=(e,t,n,s)=>{const i=2*t,r=2*n;return e[i]<e[r]||e[i]===e[r]&&s[t]<=s[n]},eu=(e,t,n)=>{const s=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Xl(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Xl(t,s,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=s},tu=(e,t,n)=>{let s,i,r,o,a=0;if(0!==e.sym_next)do{s=255&e.pending_buf[e.sym_buf+a++],s+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],0===s?Wl(e,i,t):(r=Gl[i],Wl(e,r+Al+1,t),o=Ul[r],0!==o&&(i-=kl[r],Ql(e,i,o)),s--,r=Kl(s),Wl(e,r,n),o=Ll[r],0!==o&&(s-=Bl[r],Ql(e,s,o)))}while(a<e.sym_next);Wl(e,256,t)},nu=(e,t)=>{const n=t.dyn_tree,s=t.stat_desc.static_tree,i=t.stat_desc.has_stree,r=t.stat_desc.elems;let o,a,l,u=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<r;o++)0!==n[2*o]?(e.heap[++e.heap_len]=u=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=u<2?++u:0,n[2*l]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=s[2*l+1]);for(t.max_code=u,o=e.heap_len>>1;o>=1;o--)eu(e,n,o);l=r;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],eu(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,n[2*l]=n[2*o]+n[2*a],e.depth[l]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,n[2*o+1]=n[2*a+1]=l,e.heap[1]=l++,eu(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,s=t.max_code,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,d,c,h,_,g,p=0;for(h=0;h<=Ml;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)d=e.heap[u],h=n[2*n[2*d+1]+1]+1,h>l&&(h=l,p++),n[2*d+1]=h,d>s||(e.bl_count[h]++,_=0,d>=a&&(_=o[d-a]),g=n[2*d],e.opt_len+=g*(h+_),r&&(e.static_len+=g*(i[2*d+1]+_)));if(0!==p){do{for(h=l-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(h=l;0!==h;h--)for(d=e.bl_count[h];0!==d;)c=e.heap[--u],c>s||(n[2*c+1]!==h&&(e.opt_len+=(h-n[2*c+1])*n[2*c],n[2*c+1]=h),d--)}})(e,t),Jl(n,u,e.bl_count)},su=(e,t,n)=>{let s,i,r=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(n+1)+1]=65535,s=0;s<=n;s++)i=o,o=t[2*(s+1)+1],++a<l&&i===o||(a<u?e.bl_tree[2*i]+=a:0!==i?(i!==r&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,r=i,0===o?(l=138,u=3):i===o?(l=6,u=3):(l=7,u=4))},iu=(e,t,n)=>{let s,i,r=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),s=0;s<=n;s++)if(i=o,o=t[2*(s+1)+1],!(++a<l&&i===o)){if(a<u)do{Wl(e,i,e.bl_tree)}while(0!=--a);else 0!==i?(i!==r&&(Wl(e,i,e.bl_tree),a--),Wl(e,16,e.bl_tree),Ql(e,a-3,2)):a<=10?(Wl(e,17,e.bl_tree),Ql(e,a-3,3)):(Wl(e,18,e.bl_tree),Ql(e,a-11,7));a=0,r=i,0===o?(l=138,u=3):i===o?(l=6,u=3):(l=7,u=4)}};let ru=!1;const ou=(e,t,n,s)=>{Ql(e,0+(s?1:0),3),Zl(e),jl(e,n),jl(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var au=(e,t,n,s)=>{let i,r,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Al;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),nu(e,e.l_desc),nu(e,e.d_desc),o=(e=>{let t;for(su(e,e.dyn_ltree,e.l_desc.max_code),su(e,e.dyn_dtree,e.d_desc.max_code),nu(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*bl[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=i&&(i=r)):i=r=n+5,n+4<=i&&-1!==t?ou(e,t,n,s):4===e.strategy||r===i?(Ql(e,2+(s?1:0),3),tu(e,Dl,wl)):(Ql(e,4+(s?1:0),3),((e,t,n,s)=>{let i;for(Ql(e,t-257,5),Ql(e,n-1,5),Ql(e,s-4,4),i=0;i<s;i++)Ql(e,e.bl_tree[2*bl[i]+1],3);iu(e,e.dyn_ltree,t-1),iu(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),tu(e,e.dyn_ltree,e.dyn_dtree)),zl(e),s&&Zl(e)},lu={_tr_init:e=>{ru||((()=>{let e,t,n,s,i;const r=new Array(16);for(n=0,s=0;s<28;s++)for(kl[s]=n,e=0;e<1<<Ul[s];e++)Gl[n++]=s;for(Gl[n-1]=s,i=0,s=0;s<16;s++)for(Bl[s]=i,e=0;e<1<<Ll[s];e++)Vl[i++]=s;for(i>>=7;s<Ol;s++)for(Bl[s]=i<<7,e=0;e<1<<Ll[s]-7;e++)Vl[256+i++]=s;for(t=0;t<=Ml;t++)r[t]=0;for(e=0;e<=143;)Dl[2*e+1]=8,e++,r[8]++;for(;e<=255;)Dl[2*e+1]=9,e++,r[9]++;for(;e<=279;)Dl[2*e+1]=7,e++,r[7]++;for(;e<=287;)Dl[2*e+1]=8,e++,r[8]++;for(Jl(Dl,287,r),e=0;e<Ol;e++)wl[2*e+1]=5,wl[2*e]=$l(e,5);xl=new Fl(Dl,Ul,257,Nl,Ml),Hl=new Fl(wl,Ll,0,Ol,Ml),ql=new Fl(new Array(0),Pl,0,19,7)})(),ru=!0),e.l_desc=new Yl(e.dyn_ltree,xl),e.d_desc=new Yl(e.dyn_dtree,Hl),e.bl_desc=new Yl(e.bl_tree,ql),e.bi_buf=0,e.bi_valid=0,zl(e)},_tr_stored_block:ou,_tr_flush_block:au,_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(Gl[n]+Al+1)]++,e.dyn_dtree[2*Kl(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Ql(e,2,3),Wl(e,256,Dl),(e=>{16===e.bi_valid?(jl(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var uu=(e,t,n,s)=>{let i=65535&e,r=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{i=i+t[s++]|0,r=r+i|0}while(--o);i%=65521,r%=65521}return i|r<<16};const du=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var cu=(e,t,n,s)=>{const i=du,r=s+n;e^=-1;for(let n=s;n<r;n++)e=e>>>8^i[255&(e^t[n])];return~e},hu={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},_u={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:gu,_tr_stored_block:pu,_tr_flush_block:Eu,_tr_tally:fu,_tr_align:Iu}=lu,{Z_NO_FLUSH:Ru,Z_PARTIAL_FLUSH:Tu,Z_FULL_FLUSH:mu,Z_FINISH:Su,Z_BLOCK:Cu,Z_OK:vu,Z_STREAM_END:yu,Z_STREAM_ERROR:Au,Z_DATA_ERROR:Nu,Z_BUF_ERROR:Ou,Z_DEFAULT_COMPRESSION:Mu,Z_FILTERED:Uu,Z_HUFFMAN_ONLY:Lu,Z_RLE:Pu,Z_FIXED:bu,Z_DEFAULT_STRATEGY:Du,Z_UNKNOWN:wu,Z_DEFLATED:Vu}=_u,Gu=258,ku=262,Bu=42,Fu=113,xu=666,Hu=(e,t)=>(e.msg=hu[t],t),qu=e=>2*e-(e>4?9:0),Yu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ku=e=>{let t,n,s,i=e.w_size;t=e.hash_size,s=t;do{n=e.head[--s],e.head[s]=n>=i?n-i:0}while(--t);t=i,s=t;do{n=e.prev[--s],e.prev[s]=n>=i?n-i:0}while(--t)};let ju=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Qu=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},Wu=(e,t)=>{Eu(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Qu(e.strm)},$u=(e,t)=>{e.pending_buf[e.pending++]=t},Ju=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},zu=(e,t,n,s)=>{let i=e.avail_in;return i>s&&(i=s),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),1===e.state.wrap?e.adler=uu(e.adler,t,i,n):2===e.state.wrap&&(e.adler=cu(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Zu=(e,t)=>{let n,s,i=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-ku?e.strstart-(e.w_size-ku):0,u=e.window,d=e.w_mask,c=e.prev,h=e.strstart+Gu;let _=u[r+o-1],g=u[r+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(n=t,u[n+o]===g&&u[n+o-1]===_&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do{}while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&r<h);if(s=Gu-(h-r),r=h-Gu,s>o){if(e.match_start=t,o=s,s>=a)break;_=u[r+o-1],g=u[r+o]}}}while((t=c[t&d])>l&&0!=--i);return o<=e.lookahead?o:e.lookahead},Xu=e=>{const t=e.w_size;let n,s,i;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ku)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ku(e),s+=t),0===e.strm.avail_in)break;if(n=zu(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=ju(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=ju(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<ku&&0!==e.strm.avail_in)},ed=(e,t)=>{let n,s,i,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(n=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,s=e.strstart-e.block_start,n>s+e.strm.avail_in&&(n=s+e.strm.avail_in),n>i&&(n=i),n<r&&(0===n&&t!==Su||t===Ru||n!==s+e.strm.avail_in))break;o=t===Su&&n===s+e.strm.avail_in?1:0,pu(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Qu(e.strm),s&&(s>n&&(s=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,n-=s),n&&(zu(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==Ru&&t!==Su&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(zu(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,r=i>e.w_size?e.w_size:i,s=e.strstart-e.block_start,(s>=r||(s||t===Su)&&t!==Ru&&0===e.strm.avail_in&&s<=i)&&(n=s>i?i:s,o=t===Su&&0===e.strm.avail_in&&n===s?1:0,pu(e,e.block_start,n,o),e.block_start+=n,Qu(e.strm)),o?3:1)},td=(e,t)=>{let n,s;for(;;){if(e.lookahead<ku){if(Xu(e),e.lookahead<ku&&t===Ru)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=ju(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-ku&&(e.match_length=Zu(e,n)),e.match_length>=3)if(s=fu(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=ju(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=ju(e,e.ins_h,e.window[e.strstart+1]);else s=fu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(Wu(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Su?(Wu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wu(e,!1),0===e.strm.avail_out)?1:2},nd=(e,t)=>{let n,s,i;for(;;){if(e.lookahead<ku){if(Xu(e),e.lookahead<ku&&t===Ru)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=ju(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-ku&&(e.match_length=Zu(e,n),e.match_length<=5&&(e.strategy===Uu||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,s=fu(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=ju(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(Wu(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=fu(e,0,e.window[e.strstart-1]),s&&Wu(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=fu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Su?(Wu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wu(e,!1),0===e.strm.avail_out)?1:2};function sd(e,t,n,s,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=s,this.func=i}const id=[new sd(0,0,0,0,ed),new sd(4,4,8,4,td),new sd(4,5,16,8,td),new sd(4,6,32,32,td),new sd(4,4,16,16,nd),new sd(8,16,32,32,nd),new sd(8,16,128,128,nd),new sd(8,32,128,256,nd),new sd(32,128,258,1024,nd),new sd(32,258,258,4096,nd)];function rd(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Vu,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Yu(this.dyn_ltree),Yu(this.dyn_dtree),Yu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Yu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Yu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const od=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Bu&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Fu&&t.status!==xu?1:0},ad=e=>{if(od(e))return Hu(e,Au);e.total_in=e.total_out=0,e.data_type=wu;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Bu:Fu,e.adler=2===t.wrap?0:1,t.last_flush=-2,gu(t),vu},ld=e=>{const t=ad(e);var n;return t===vu&&((n=e.state).window_size=2*n.w_size,Yu(n.head),n.max_lazy_match=id[n.level].max_lazy,n.good_match=id[n.level].good_length,n.nice_match=id[n.level].nice_length,n.max_chain_length=id[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},ud=(e,t,n,s,i,r)=>{if(!e)return Au;let o=1;if(t===Mu&&(t=6),s<0?(o=0,s=-s):s>15&&(o=2,s-=16),i<1||i>9||n!==Vu||s<8||s>15||t<0||t>9||r<0||r>bu||8===s&&1!==o)return Hu(e,Au);8===s&&(s=9);const a=new rd;return e.state=a,a.strm=e,a.status=Bu,a.wrap=o,a.gzhead=null,a.w_bits=s,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=r,a.method=n,ld(e)};var dd={deflateInit:(e,t)=>ud(e,t,Vu,15,8,Du),deflateInit2:ud,deflateReset:ld,deflateResetKeep:ad,deflateSetHeader:(e,t)=>od(e)||2!==e.state.wrap?Au:(e.state.gzhead=t,vu),deflate:(e,t)=>{if(od(e)||t>Cu||t<0)return e?Hu(e,Au):Au;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===xu&&t!==Su)return Hu(e,0===e.avail_out?Ou:Au);const s=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Qu(e),0===e.avail_out)return n.last_flush=-1,vu}else if(0===e.avail_in&&qu(t)<=qu(s)&&t!==Su)return Hu(e,Ou);if(n.status===xu&&0!==e.avail_in)return Hu(e,Ou);if(n.status===Bu&&0===n.wrap&&(n.status=Fu),n.status===Bu){let t=Vu+(n.w_bits-8<<4)<<8,s=-1;if(s=n.strategy>=Lu||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=s<<6,0!==n.strstart&&(t|=32),t+=31-t%31,Ju(n,t),0!==n.strstart&&(Ju(n,e.adler>>>16),Ju(n,65535&e.adler)),e.adler=1,n.status=Fu,Qu(e),0!==n.pending)return n.last_flush=-1,vu}if(57===n.status)if(e.adler=0,$u(n,31),$u(n,139),$u(n,8),n.gzhead)$u(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),$u(n,255&n.gzhead.time),$u(n,n.gzhead.time>>8&255),$u(n,n.gzhead.time>>16&255),$u(n,n.gzhead.time>>24&255),$u(n,9===n.level?2:n.strategy>=Lu||n.level<2?4:0),$u(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&($u(n,255&n.gzhead.extra.length),$u(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=cu(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if($u(n,0),$u(n,0),$u(n,0),$u(n,0),$u(n,0),$u(n,9===n.level?2:n.strategy>=Lu||n.level<2?4:0),$u(n,3),n.status=Fu,Qu(e),0!==n.pending)return n.last_flush=-1,vu;if(69===n.status){if(n.gzhead.extra){let t=n.pending,s=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+s>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=cu(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Qu(e),0!==n.pending)return n.last_flush=-1,vu;t=0,s-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending+=s,n.gzhead.hcrc&&n.pending>t&&(e.adler=cu(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,s=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>s&&(e.adler=cu(e.adler,n.pending_buf,n.pending-s,s)),Qu(e),0!==n.pending)return n.last_flush=-1,vu;s=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,$u(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>s&&(e.adler=cu(e.adler,n.pending_buf,n.pending-s,s)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,s=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>s&&(e.adler=cu(e.adler,n.pending_buf,n.pending-s,s)),Qu(e),0!==n.pending)return n.last_flush=-1,vu;s=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,$u(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>s&&(e.adler=cu(e.adler,n.pending_buf,n.pending-s,s))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Qu(e),0!==n.pending))return n.last_flush=-1,vu;$u(n,255&e.adler),$u(n,e.adler>>8&255),e.adler=0}if(n.status=Fu,Qu(e),0!==n.pending)return n.last_flush=-1,vu}if(0!==e.avail_in||0!==n.lookahead||t!==Ru&&n.status!==xu){let s=0===n.level?ed(n,t):n.strategy===Lu?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(Xu(e),0===e.lookahead)){if(t===Ru)return 1;break}if(e.match_length=0,n=fu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Wu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Su?(Wu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wu(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===Pu?((e,t)=>{let n,s,i,r;const o=e.window;for(;;){if(e.lookahead<=Gu){if(Xu(e),e.lookahead<=Gu&&t===Ru)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,s=o[i],s===o[++i]&&s===o[++i]&&s===o[++i])){r=e.strstart+Gu;do{}while(s===o[++i]&&s===o[++i]&&s===o[++i]&&s===o[++i]&&s===o[++i]&&s===o[++i]&&s===o[++i]&&s===o[++i]&&i<r);e.match_length=Gu-(r-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=fu(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=fu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Wu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Su?(Wu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wu(e,!1),0===e.strm.avail_out)?1:2})(n,t):id[n.level].func(n,t);if(3!==s&&4!==s||(n.status=xu),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),vu;if(2===s&&(t===Tu?Iu(n):t!==Cu&&(pu(n,0,0,!1),t===mu&&(Yu(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Qu(e),0===e.avail_out))return n.last_flush=-1,vu}return t!==Su?vu:n.wrap<=0?yu:(2===n.wrap?($u(n,255&e.adler),$u(n,e.adler>>8&255),$u(n,e.adler>>16&255),$u(n,e.adler>>24&255),$u(n,255&e.total_in),$u(n,e.total_in>>8&255),$u(n,e.total_in>>16&255),$u(n,e.total_in>>24&255)):(Ju(n,e.adler>>>16),Ju(n,65535&e.adler)),Qu(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?vu:yu)},deflateEnd:e=>{if(od(e))return Au;const t=e.state.status;return e.state=null,t===Fu?Hu(e,Nu):vu},deflateSetDictionary:(e,t)=>{let n=t.length;if(od(e))return Au;const s=e.state,i=s.wrap;if(2===i||1===i&&s.status!==Bu||s.lookahead)return Au;if(1===i&&(e.adler=uu(e.adler,t,n,0)),s.wrap=0,n>=s.w_size){0===i&&(Yu(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(n-s.w_size,n),0),t=e,n=s.w_size}const r=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Xu(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=ju(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,Xu(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=o,e.input=a,e.avail_in=r,s.wrap=i,vu},deflateInfo:"pako deflate (from Nodeca project)"};const cd=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var hd={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)cd(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,s=0,i=e.length;t<i;t++){let i=e[t];n.set(i,s),s+=i.length}return n}};let _d=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){_d=!1}const gd=new Uint8Array(256);for(let e=0;e<256;e++)gd[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;gd[254]=gd[254]=1;var pd={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,s,i,r,o=e.length,a=0;for(i=0;i<o;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<o&&(s=e.charCodeAt(i+1),56320==(64512&s)&&(n=65536+(n-55296<<10)+(s-56320),i++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),r=0,i=0;r<a;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<o&&(s=e.charCodeAt(i+1),56320==(64512&s)&&(n=65536+(n-55296<<10)+(s-56320),i++)),n<128?t[r++]=n:n<2048?(t[r++]=192|n>>>6,t[r++]=128|63&n):n<65536?(t[r++]=224|n>>>12,t[r++]=128|n>>>6&63,t[r++]=128|63&n):(t[r++]=240|n>>>18,t[r++]=128|n>>>12&63,t[r++]=128|n>>>6&63,t[r++]=128|63&n);return t},buf2string:(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,i;const r=new Array(2*n);for(i=0,s=0;s<n;){let t=e[s++];if(t<128){r[i++]=t;continue}let o=gd[t];if(o>4)r[i++]=65533,s+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&s<n;)t=t<<6|63&e[s++],o--;o>1?r[i++]=65533:t<65536?r[i++]=t:(t-=65536,r[i++]=55296|t>>10&1023,r[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&_d)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let s=0;s<t;s++)n+=String.fromCharCode(e[s]);return n})(r,i)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+gd[e[n]]>t?n:t}};var Ed=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const fd=Object.prototype.toString,{Z_NO_FLUSH:Id,Z_SYNC_FLUSH:Rd,Z_FULL_FLUSH:Td,Z_FINISH:md,Z_OK:Sd,Z_STREAM_END:Cd,Z_DEFAULT_COMPRESSION:vd,Z_DEFAULT_STRATEGY:yd,Z_DEFLATED:Ad}=_u;function Nd(e){this.options=hd.assign({level:vd,method:Ad,chunkSize:16384,windowBits:15,memLevel:8,strategy:yd},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ed,this.strm.avail_out=0;let n=dd.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Sd)throw new Error(hu[n]);if(t.header&&dd.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?pd.string2buf(t.dictionary):"[object ArrayBuffer]"===fd.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=dd.deflateSetDictionary(this.strm,e),n!==Sd)throw new Error(hu[n]);this._dict_set=!0}}Nd.prototype.push=function(e,t){const n=this.strm,s=this.options.chunkSize;let i,r;if(this.ended)return!1;for(r=t===~~t?t:!0===t?md:Id,"string"==typeof e?n.input=pd.string2buf(e):"[object ArrayBuffer]"===fd.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(s),n.next_out=0,n.avail_out=s),(r===Rd||r===Td)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=dd.deflate(n,r),i===Cd)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=dd.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Sd;if(0!==n.avail_out){if(r>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},Nd.prototype.onData=function(e){this.chunks.push(e)},Nd.prototype.onEnd=function(e){e===Sd&&(this.result=hd.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const Od=16209;var Md=function(e,t){let n,s,i,r,o,a,l,u,d,c,h,_,g,p,E,f,I,R,T,m,S,C,v,y;const A=e.state;n=e.next_in,v=e.input,s=n+(e.avail_in-5),i=e.next_out,y=e.output,r=i-(t-e.avail_out),o=i+(e.avail_out-257),a=A.dmax,l=A.wsize,u=A.whave,d=A.wnext,c=A.window,h=A.hold,_=A.bits,g=A.lencode,p=A.distcode,E=(1<<A.lenbits)-1,f=(1<<A.distbits)-1;e:do{_<15&&(h+=v[n++]<<_,_+=8,h+=v[n++]<<_,_+=8),I=g[h&E];t:for(;;){if(R=I>>>24,h>>>=R,_-=R,R=I>>>16&255,0===R)y[i++]=65535&I;else{if(!(16&R)){if(64&R){if(32&R){A.mode=16191;break e}e.msg="invalid literal/length code",A.mode=Od;break e}I=g[(65535&I)+(h&(1<<R)-1)];continue t}for(T=65535&I,R&=15,R&&(_<R&&(h+=v[n++]<<_,_+=8),T+=h&(1<<R)-1,h>>>=R,_-=R),_<15&&(h+=v[n++]<<_,_+=8,h+=v[n++]<<_,_+=8),I=p[h&f];;){if(R=I>>>24,h>>>=R,_-=R,R=I>>>16&255,16&R){if(m=65535&I,R&=15,_<R&&(h+=v[n++]<<_,_+=8,_<R&&(h+=v[n++]<<_,_+=8)),m+=h&(1<<R)-1,m>a){e.msg="invalid distance too far back",A.mode=Od;break e}if(h>>>=R,_-=R,R=i-r,m>R){if(R=m-R,R>u&&A.sane){e.msg="invalid distance too far back",A.mode=Od;break e}if(S=0,C=c,0===d){if(S+=l-R,R<T){T-=R;do{y[i++]=c[S++]}while(--R);S=i-m,C=y}}else if(d<R){if(S+=l+d-R,R-=d,R<T){T-=R;do{y[i++]=c[S++]}while(--R);if(S=0,d<T){R=d,T-=R;do{y[i++]=c[S++]}while(--R);S=i-m,C=y}}}else if(S+=d-R,R<T){T-=R;do{y[i++]=c[S++]}while(--R);S=i-m,C=y}for(;T>2;)y[i++]=C[S++],y[i++]=C[S++],y[i++]=C[S++],T-=3;T&&(y[i++]=C[S++],T>1&&(y[i++]=C[S++]))}else{S=i-m;do{y[i++]=y[S++],y[i++]=y[S++],y[i++]=y[S++],T-=3}while(T>2);T&&(y[i++]=y[S++],T>1&&(y[i++]=y[S++]))}break}if(64&R){e.msg="invalid distance code",A.mode=Od;break e}I=p[(65535&I)+(h&(1<<R)-1)]}}break}}while(n<s&&i<o);T=_>>3,n-=T,_-=T<<3,h&=(1<<_)-1,e.next_in=n,e.next_out=i,e.avail_in=n<s?s-n+5:5-(n-s),e.avail_out=i<o?o-i+257:257-(i-o),A.hold=h,A.bits=_};const Ud=15,Ld=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Pd=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),bd=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Dd=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var wd=(e,t,n,s,i,r,o,a)=>{const l=a.bits;let u,d,c,h,_,g,p=0,E=0,f=0,I=0,R=0,T=0,m=0,S=0,C=0,v=0,y=null;const A=new Uint16Array(16),N=new Uint16Array(16);let O,M,U,L=null;for(p=0;p<=Ud;p++)A[p]=0;for(E=0;E<s;E++)A[t[n+E]]++;for(R=l,I=Ud;I>=1&&0===A[I];I--);if(R>I&&(R=I),0===I)return i[r++]=20971520,i[r++]=20971520,a.bits=1,0;for(f=1;f<I&&0===A[f];f++);for(R<f&&(R=f),S=1,p=1;p<=Ud;p++)if(S<<=1,S-=A[p],S<0)return-1;if(S>0&&(0===e||1!==I))return-1;for(N[1]=0,p=1;p<Ud;p++)N[p+1]=N[p]+A[p];for(E=0;E<s;E++)0!==t[n+E]&&(o[N[t[n+E]]++]=E);if(0===e?(y=L=o,g=20):1===e?(y=Ld,L=Pd,g=257):(y=bd,L=Dd,g=0),v=0,E=0,p=f,_=r,T=R,m=0,c=-1,C=1<<R,h=C-1,1===e&&C>852||2===e&&C>592)return 1;for(;;){O=p-m,o[E]+1<g?(M=0,U=o[E]):o[E]>=g?(M=L[o[E]-g],U=y[o[E]-g]):(M=96,U=0),u=1<<p-m,d=1<<T,f=d;do{d-=u,i[_+(v>>m)+d]=O<<24|M<<16|U}while(0!==d);for(u=1<<p-1;v&u;)u>>=1;if(0!==u?(v&=u-1,v+=u):v=0,E++,0==--A[p]){if(p===I)break;p=t[n+o[E]]}if(p>R&&(v&h)!==c){for(0===m&&(m=R),_+=f,T=p-m,S=1<<T;T+m<I&&(S-=A[T+m],!(S<=0));)T++,S<<=1;if(C+=1<<T,1===e&&C>852||2===e&&C>592)return 1;c=v&h,i[c]=R<<24|T<<16|_-r}}return 0!==v&&(i[_+v]=p-m<<24|64<<16),a.bits=R,0};const{Z_FINISH:Vd,Z_BLOCK:Gd,Z_TREES:kd,Z_OK:Bd,Z_STREAM_END:Fd,Z_NEED_DICT:xd,Z_STREAM_ERROR:Hd,Z_DATA_ERROR:qd,Z_MEM_ERROR:Yd,Z_BUF_ERROR:Kd,Z_DEFLATED:Qd}=_u,Wd=16180,$d=16190,Jd=16191,zd=16192,Zd=16194,Xd=16199,ec=16200,tc=16206,nc=16209,sc=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function ic(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const rc=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Wd||t.mode>16211?1:0},oc=e=>{if(rc(e))return Hd;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Wd,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Bd},ac=e=>{if(rc(e))return Hd;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,oc(e)},lc=(e,t)=>{let n;if(rc(e))return Hd;const s=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Hd:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,ac(e))},uc=(e,t)=>{if(!e)return Hd;const n=new ic;e.state=n,n.strm=e,n.window=null,n.mode=Wd;const s=lc(e,t);return s!==Bd&&(e.state=null),s};let dc,cc,hc=!0;const _c=e=>{if(hc){dc=new Int32Array(512),cc=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(wd(1,e.lens,0,288,dc,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;wd(2,e.lens,0,32,cc,0,e.work,{bits:5}),hc=!1}e.lencode=dc,e.lenbits=9,e.distcode=cc,e.distbits=5},gc=(e,t,n,s)=>{let i;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),s>=r.wsize?(r.window.set(t.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(i=r.wsize-r.wnext,i>s&&(i=s),r.window.set(t.subarray(n-s,n-s+i),r.wnext),(s-=i)?(r.window.set(t.subarray(n-s,n),0),r.wnext=s,r.whave=r.wsize):(r.wnext+=i,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=i))),0};var pc={inflateReset:ac,inflateReset2:lc,inflateResetKeep:oc,inflateInit:e=>uc(e,15),inflateInit2:uc,inflate:(e,t)=>{let n,s,i,r,o,a,l,u,d,c,h,_,g,p,E,f,I,R,T,m,S,C,v=0;const y=new Uint8Array(4);let A,N;const O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(rc(e)||!e.output||!e.input&&0!==e.avail_in)return Hd;n=e.state,n.mode===Jd&&(n.mode=zd),o=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,s=e.input,a=e.avail_in,u=n.hold,d=n.bits,c=a,h=l,C=Bd;e:for(;;)switch(n.mode){case Wd:if(0===n.wrap){n.mode=zd;break}for(;d<16;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(2&n.wrap&&35615===u){0===n.wbits&&(n.wbits=15),n.check=0,y[0]=255&u,y[1]=u>>>8&255,n.check=cu(n.check,y,2,0),u=0,d=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=nc;break}if((15&u)!==Qd){e.msg="unknown compression method",n.mode=nc;break}if(u>>>=4,d-=4,S=8+(15&u),0===n.wbits&&(n.wbits=S),S>15||S>n.wbits){e.msg="invalid window size",n.mode=nc;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&u?16189:Jd,u=0,d=0;break;case 16181:for(;d<16;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(n.flags=u,(255&n.flags)!==Qd){e.msg="unknown compression method",n.mode=nc;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=nc;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&4&n.wrap&&(y[0]=255&u,y[1]=u>>>8&255,n.check=cu(n.check,y,2,0)),u=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}n.head&&(n.head.time=u),512&n.flags&&4&n.wrap&&(y[0]=255&u,y[1]=u>>>8&255,y[2]=u>>>16&255,y[3]=u>>>24&255,n.check=cu(n.check,y,4,0)),u=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&4&n.wrap&&(y[0]=255&u,y[1]=u>>>8&255,n.check=cu(n.check,y,2,0)),u=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&4&n.wrap&&(y[0]=255&u,y[1]=u>>>8&255,n.check=cu(n.check,y,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(_=n.length,_>a&&(_=a),_&&(n.head&&(S=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(s.subarray(r,r+_),S)),512&n.flags&&4&n.wrap&&(n.check=cu(n.check,s,_,r)),a-=_,r+=_,n.length-=_),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break e;_=0;do{S=s[r+_++],n.head&&S&&n.length<65536&&(n.head.name+=String.fromCharCode(S))}while(S&&_<a);if(512&n.flags&&4&n.wrap&&(n.check=cu(n.check,s,_,r)),a-=_,r+=_,S)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===a)break e;_=0;do{S=s[r+_++],n.head&&S&&n.length<65536&&(n.head.comment+=String.fromCharCode(S))}while(S&&_<a);if(512&n.flags&&4&n.wrap&&(n.check=cu(n.check,s,_,r)),a-=_,r+=_,S)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;d<16;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(4&n.wrap&&u!==(65535&n.check)){e.msg="header crc mismatch",n.mode=nc;break}u=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Jd;break;case 16189:for(;d<32;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}e.adler=n.check=sc(u),u=0,d=0,n.mode=$d;case $d:if(0===n.havedict)return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,n.hold=u,n.bits=d,xd;e.adler=n.check=1,n.mode=Jd;case Jd:if(t===Gd||t===kd)break e;case zd:if(n.last){u>>>=7&d,d-=7&d,n.mode=tc;break}for(;d<3;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}switch(n.last=1&u,u>>>=1,d-=1,3&u){case 0:n.mode=16193;break;case 1:if(_c(n),n.mode=Xd,t===kd){u>>>=2,d-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=nc}u>>>=2,d-=2;break;case 16193:for(u>>>=7&d,d-=7&d;d<32;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.mode=nc;break}if(n.length=65535&u,u=0,d=0,n.mode=Zd,t===kd)break e;case Zd:n.mode=16195;case 16195:if(_=n.length,_){if(_>a&&(_=a),_>l&&(_=l),0===_)break e;i.set(s.subarray(r,r+_),o),a-=_,r+=_,l-=_,o+=_,n.length-=_;break}n.mode=Jd;break;case 16196:for(;d<14;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(n.nlen=257+(31&u),u>>>=5,d-=5,n.ndist=1+(31&u),u>>>=5,d-=5,n.ncode=4+(15&u),u>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=nc;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;d<3;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}n.lens[O[n.have++]]=7&u,u>>>=3,d-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},C=wd(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,C){e.msg="invalid code lengths set",n.mode=nc;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;v=n.lencode[u&(1<<n.lenbits)-1],E=v>>>24,f=v>>>16&255,I=65535&v,!(E<=d);){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(I<16)u>>>=E,d-=E,n.lens[n.have++]=I;else{if(16===I){for(N=E+2;d<N;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(u>>>=E,d-=E,0===n.have){e.msg="invalid bit length repeat",n.mode=nc;break}S=n.lens[n.have-1],_=3+(3&u),u>>>=2,d-=2}else if(17===I){for(N=E+3;d<N;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}u>>>=E,d-=E,S=0,_=3+(7&u),u>>>=3,d-=3}else{for(N=E+7;d<N;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}u>>>=E,d-=E,S=0,_=11+(127&u),u>>>=7,d-=7}if(n.have+_>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=nc;break}for(;_--;)n.lens[n.have++]=S}}if(n.mode===nc)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=nc;break}if(n.lenbits=9,A={bits:n.lenbits},C=wd(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,C){e.msg="invalid literal/lengths set",n.mode=nc;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},C=wd(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,C){e.msg="invalid distances set",n.mode=nc;break}if(n.mode=Xd,t===kd)break e;case Xd:n.mode=ec;case ec:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,n.hold=u,n.bits=d,Md(e,h),o=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,s=e.input,a=e.avail_in,u=n.hold,d=n.bits,n.mode===Jd&&(n.back=-1);break}for(n.back=0;v=n.lencode[u&(1<<n.lenbits)-1],E=v>>>24,f=v>>>16&255,I=65535&v,!(E<=d);){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(f&&!(240&f)){for(R=E,T=f,m=I;v=n.lencode[m+((u&(1<<R+T)-1)>>R)],E=v>>>24,f=v>>>16&255,I=65535&v,!(R+E<=d);){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}u>>>=R,d-=R,n.back+=R}if(u>>>=E,d-=E,n.back+=E,n.length=I,0===f){n.mode=16205;break}if(32&f){n.back=-1,n.mode=Jd;break}if(64&f){e.msg="invalid literal/length code",n.mode=nc;break}n.extra=15&f,n.mode=16201;case 16201:if(n.extra){for(N=n.extra;d<N;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;v=n.distcode[u&(1<<n.distbits)-1],E=v>>>24,f=v>>>16&255,I=65535&v,!(E<=d);){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(!(240&f)){for(R=E,T=f,m=I;v=n.distcode[m+((u&(1<<R+T)-1)>>R)],E=v>>>24,f=v>>>16&255,I=65535&v,!(R+E<=d);){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}u>>>=R,d-=R,n.back+=R}if(u>>>=E,d-=E,n.back+=E,64&f){e.msg="invalid distance code",n.mode=nc;break}n.offset=I,n.extra=15&f,n.mode=16203;case 16203:if(n.extra){for(N=n.extra;d<N;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=nc;break}n.mode=16204;case 16204:if(0===l)break e;if(_=h-l,n.offset>_){if(_=n.offset-_,_>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=nc;break}_>n.wnext?(_-=n.wnext,g=n.wsize-_):g=n.wnext-_,_>n.length&&(_=n.length),p=n.window}else p=i,g=o-n.offset,_=n.length;_>l&&(_=l),l-=_,n.length-=_;do{i[o++]=p[g++]}while(--_);0===n.length&&(n.mode=ec);break;case 16205:if(0===l)break e;i[o++]=n.length,l--,n.mode=ec;break;case tc:if(n.wrap){for(;d<32;){if(0===a)break e;a--,u|=s[r++]<<d,d+=8}if(h-=l,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?cu(n.check,i,h,o-h):uu(n.check,i,h,o-h)),h=l,4&n.wrap&&(n.flags?u:sc(u))!==n.check){e.msg="incorrect data check",n.mode=nc;break}u=0,d=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;d<32;){if(0===a)break e;a--,u+=s[r++]<<d,d+=8}if(4&n.wrap&&u!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=nc;break}u=0,d=0}n.mode=16208;case 16208:C=Fd;break e;case nc:C=qd;break e;case 16210:return Yd;default:return Hd}return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,n.hold=u,n.bits=d,(n.wsize||h!==e.avail_out&&n.mode<nc&&(n.mode<tc||t!==Vd))&&gc(e,e.output,e.next_out,h-e.avail_out),c-=e.avail_in,h-=e.avail_out,e.total_in+=c,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?cu(n.check,i,h,e.next_out-h):uu(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Jd?128:0)+(n.mode===Xd||n.mode===Zd?256:0),(0===c&&0===h||t===Vd)&&C===Bd&&(C=Kd),C},inflateEnd:e=>{if(rc(e))return Hd;let t=e.state;return t.window&&(t.window=null),e.state=null,Bd},inflateGetHeader:(e,t)=>{if(rc(e))return Hd;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,Bd):Hd},inflateSetDictionary:(e,t)=>{const n=t.length;let s,i,r;return rc(e)?Hd:(s=e.state,0!==s.wrap&&s.mode!==$d?Hd:s.mode===$d&&(i=1,i=uu(i,t,n,0),i!==s.check)?qd:(r=gc(e,t,n,n),r?(s.mode=16210,Yd):(s.havedict=1,Bd)))},inflateInfo:"pako inflate (from Nodeca project)"};var Ec=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const fc=Object.prototype.toString,{Z_NO_FLUSH:Ic,Z_FINISH:Rc,Z_OK:Tc,Z_STREAM_END:mc,Z_NEED_DICT:Sc,Z_STREAM_ERROR:Cc,Z_DATA_ERROR:vc,Z_MEM_ERROR:yc}=_u;function Ac(e){this.options=hd.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ed,this.strm.avail_out=0;let n=pc.inflateInit2(this.strm,t.windowBits);if(n!==Tc)throw new Error(hu[n]);if(this.header=new Ec,pc.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=pd.string2buf(t.dictionary):"[object ArrayBuffer]"===fc.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=pc.inflateSetDictionary(this.strm,t.dictionary),n!==Tc)))throw new Error(hu[n])}function Nc(e,t){const n=new Ac(t);if(n.push(e),n.err)throw n.msg||hu[n.err];return n.result}Ac.prototype.push=function(e,t){const n=this.strm,s=this.options.chunkSize,i=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Rc:Ic,"[object ArrayBuffer]"===fc.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(s),n.next_out=0,n.avail_out=s),r=pc.inflate(n,o),r===Sc&&i&&(r=pc.inflateSetDictionary(n,i),r===Tc?r=pc.inflate(n,o):r===vc&&(r=Sc));n.avail_in>0&&r===mc&&n.state.wrap>0&&0!==e[n.next_in];)pc.inflateReset(n),r=pc.inflate(n,o);switch(r){case Cc:case vc:case Sc:case yc:return this.onEnd(r),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||r===mc))if("string"===this.options.to){let e=pd.utf8border(n.output,n.next_out),t=n.next_out-e,i=pd.buf2string(n.output,e);n.next_out=t,n.avail_out=s-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(r!==Tc||0!==a){if(r===mc)return r=pc.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Ac.prototype.onData=function(e){this.chunks.push(e)},Ac.prototype.onEnd=function(e){e===Tc&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=hd.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Oc={Inflate:Ac,inflate:Nc,inflateRaw:function(e,t){return(t=t||{}).raw=!0,Nc(e,t)},ungzip:Nc,constants:_u};const{Inflate:Mc,inflate:Uc,inflateRaw:Lc,ungzip:Pc}=Oc;var bc,Dc,wc=Pc;!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"}(bc||(bc={})),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"}(Dc||(Dc={}));const Vc={[Dc.OTHER_DEVICE_LOGIN]:w.RC_DISCONN_KICK,[Dc.BLOCK]:w.RC_DISCONN_EXCEPTION,[Dc.BLOCK_NEW]:w.RC_DISCONN_EXCEPTION,[Dc.REDIRECT_NEW]:w.RC_CONN_REDIRECTED,[Dc.TOKEN_EXPIRED]:w.RC_CONN_TOKEN_EXPIRED,[Dc.ILLEGAL_PROTOCOL_VERSION]:w.RC_CONN_PROTO_VERSION_ERROR,[Dc.ACCOUNT_CANCELLATION]:w.RC_ACCOUNT_CANCELLATION},Gc={[bc.ACCEPTED]:w.SUCCESS,[bc.UNACCEPTABLE_PROTOCOL_VERSION]:w.RC_CONN_PROTO_VERSION_ERROR,[bc.IDENTIFIER_REJECTED]:w.RC_CONN_IDENTIFIER_REJECTED,[bc.SERVER_UNAVAILABLE]:w.RC_CONN_SERVER_UNAVAILABLE,[bc.TOKEN_INCORRECT]:w.RC_CONN_TOKEN_INCORRECT,[bc.NOT_AUTHORIZED]:w.RC_CONN_NOT_AUTHRORIZED,[bc.REDIRECT]:w.RC_CONN_REDIRECTED,[bc.PACKAGE_ERROR]:w.RC_CONN_PACKAGE_NAME_INVALID,[bc.APP_BLOCK_OR_DELETE]:w.RC_CONN_APP_BLOCKED_OR_DELETED,[bc.BLOCK]:w.RC_CONN_USER_BLOCKED,[bc.TOKEN_EXPIRE]:w.RC_CONN_TOKEN_EXPIRED,[bc.DEVICE_ERROR]:w.RC_CONN_DEVICE_ERROR,[bc.HOSTNAME_ERROR]:w.RC_CONN_HOSTNAME_ERROR,[bc.HASOHTERSAMECLIENTONLINE]:w.RC_DISCONN_SAME_CLIENT_ON_LINE,[bc.OUT_OF_LIMIT]:w.RC_LISCENSE_COUNT_OUT_OF_LIMIT,[bc.IN_OTHER_CLUSTER]:w.RC_CONN_WRONG_CLUSTER,[bc.APP_AUTH_NOT_PASS]:w.RC_APP_AUTH_NOT_PASS,[bc.OTP_USED]:w.RC_OTP_USED,[bc.PLATFORM_ERROR]:w.RC_PLATFORM_ERROR,[bc.ACCOUNT_CANCELLATION]:w.RC_ACCOUNT_CANCELLATION,[bc.LICENSE_EXPIRED]:w.RC_LICENSE_EXPIRED},kc=e=>[uo.ppMsgS,uo.pgMsgS,uo.chatMsgS].includes(co(e)),Bc=(e,t)=>{let n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};function Fc(e){return Object.keys(e).map((t=>{let n=e[t];return"string"!=typeof n&&(n=`${n}`),{key:t,value:n}}))}function xc(e,t,n,s){return Hr.encode(_r,{targetId:e,type:V.GROUP,users:s,extProfile:n?Fc(n):void 0,settingProfile:Fc(t)})}const Hc={[ho(uo.ppMsgP)]:V.PRIVATE,[ho(uo.pgMsgP)]:V.GROUP,[ho(uo.chatMsg)]:V.CHATROOM,[ho(uo.pcMsgP)]:V.CUSTOMER_SERVICE,[ho(uo.pbMsgP)]:V.SYSTEM},qc=3,Yc={1:"ChannelsUserInfos",2:"ChannelsInviteStatusInfos",3:"ChannelsJoinedInfos",11:"FriendUserInfos",12:"FriendInviteInfos"},Kc={[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 jc{constructor(e){this.logger=e}decodeByPBName(e,t,n){const s=this;let i=e;const o={[Ns]:s._formatSyncMessages,[Os]:s._formatReceivedMessage,[ys]:s._formatSentMessage,[js]:s._formatHistoryMessages,[ks]:s._formatConversationList,[Ys]:s._formatChatRoomInfos,[ri]:s._formatChatRoomKVList,[di]:s._formatUserSetting,[Ci]:s._formatGrpReadReceiptQryResp,[Qi]:s._formatQueryReceiptResp,[li]:s._formatSetUserSettingOutput,[Oi]:s._formatUserSettingNotification,[Di]:s._formatEventChangeList,[wi]:s._formatUltraMsgChangeList,[Bi]:s._formatUltraOperateStatusNotifyList,[Gi]:s._formatUltraMsgList,[Fs]:s._formatUltraGroupUnreadMentionedList,[Ds]:s._formatChrmKVVersion,[Yi]:s._formatCallKVInfo,[Hi]:s._fromatCallInfoDownStream,[$s]:s._formateSessionMsgReadInput,[Tr]:s._formateChannelsListResult}[t];try{i=e.length>0&&Hr.decode(t,e),gt(o)&&(i=o.call(this,i,n))}catch(e){this.logger.error(r.L_PB_DECODE_E,t)}return i}_readBytes(e){const{offset:t,buffer:n,limit:s}=e;if(t)try{const e=(i=n,"[object ArrayBuffer]"===Object.prototype.toString.call(i)?new Uint8Array(n):n);return ko.readUTF(e.subarray(t,s))}catch(e){this.logger.error(r.O,null==e?void 0:e.stack)}var i;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(r.O,null==e?void 0:e.stack)}return t||e}_formatSyncMessages(e,t){t=t||{};const n=this,{list:s,syncTime:i,finished:r,compressioEnabled:o,compressedData:a}=e;if(o){const e=wc(a),n=Hr.decode(Ns,e);return this._formatSyncMessages(n,t)}return(pt(r)||null===r)&&(e.finished=!0),e.list=Mt(s,(e=>n._formatReceivedMessage(e,t))),e}_getUtfContent(e){if(e.user){const{portrait:t,portraitUri:n}=e.user,s=t||n;s&&(e.user.portrait=e.user.portraitUri=s)}return e}_setExpansion(e){let t;return e&&(t=(e=>{const t={},n=JSON.parse(e);return Ot(n,((e,n)=>{t[n]=e.v})),t})(e)),t}_setPushConfig(e,t){const{pushContent:n,pushExt:s,configFlag:i}=e;let o={};s&&(o=((e,t,n)=>{const s={},i={notificationId:n||""},o={};if(!t)return{iOSConfig:s,androidConfig:i,harmonyOSConfig:o};try{const e=JSON.parse(t);null==e||e.forEach((e=>{var t,n,r,a,l,u,d,c,h,_,g,p;const E=Object.keys(e);if(0===E.length)return;const f=E[0];switch(f){case"HW":return i.channelIdHW=null===(t=e[f])||void 0===t?void 0:t.channelId,i.importanceHW=null===(n=e[f])||void 0===n?void 0:n.importance,i.imageUrlHW=null===(r=e[f])||void 0===r?void 0:r.image,void(i.categoryHW=null===(a=e[f])||void 0===a?void 0:a.category);case"MI":return void(i.channelIdMi=null===(l=e[f])||void 0===l?void 0:l.channelId);case"OPPO":return void(i.channelIdOPPO=null===(u=e[f])||void 0===u?void 0:u.channelId);case"VIVO":return i.typeVivo=null===(d=e[f])||void 0===d?void 0:d.classification,void(i.categoryVivo=null===(c=e[f])||void 0===c?void 0:c.category);case"APNS":return s.threadId=e[f]["thread-id"],s.apnsCollapseId=e[f]["apns-collapse-id"],s.category=e[f].category,s.richMediaUri=e[f].richMediaUri,void(s.interruptionLevel=e[f]["interruption-level"]);case"FCM":return void(i.googleConfig={collapseKey:e[f].collapse_key||"",imageUrl:e[f].imageUrl||"",priority:e[f].priority||""});case"HONOR":return i.importanceHonor=null===(h=e[f])||void 0===h?void 0:h.importance,void(i.imageUrlHonor=null===(_=e[f])||void 0===_?void 0:_.image);case"OHOS":o.category=null===(g=e[f])||void 0===g?void 0:g.category,o.image=null===(p=e[f])||void 0===p?void 0:p.image}}))}catch(n){e.error(r.O,`Wrong format for pushConfigs field! content: ${t}`)}return{iOSConfig:s,androidConfig:i,harmonyOSConfig:o}})(t,s.pushConfigs,s.pushId));return Object.assign(Object.assign({},o),{pushTitle:null==s?void 0:s.title,pushContent:n,pushData:"",disablePushTitle:!!i&&Boolean(4&i),forceShowDetailContent:!!i&&Boolean(8&i),templateId:null==s?void 0:s.templateId})}_formatReceivedMessage(e,t){var n;if(!e)return e;const s=this,{currentUserId:i,connectedTime:r,afterDecode:o,customMessageTypes:a={}}=t||{},{content:l,fromUserId:u,type:d,groupId:c,status:h,dataTime:_,extraContent:g,extStatus:p,clientUniqueId:E,busChannel:f,msgId:I,classname:R,toUserIds:T,optionBits:m}=e,S=e.direction||se.RECEIVE,{isPersited:C,isCounted:v,isMentioned:y,disableNotification:A,receivedStatus:N,canIncludeExpansion:O}=(e=>{let t=!0,n=!0,s=!1,i=!1,r=de.READ,o=!1,a=!1;return t=!!(16&e),n=!!(32&e),s=!!(64&e),i=!!(512&e),o=!!(2&e),r=o?de.RETRIEVED:r,a=!!(1024&e),{isPersited:t,isCounted:n,isMentioned:s,disableNotification:i,receivedStatus:r,canIncludeExpansion:a}})(h),M=!!(2&(p||0)),U=!!(4&(p||0)),L=!!(8&(p||0))?x.PRIVATE:x.PUBLIC,P=[V.GROUP,V.CHATROOM,V.RTC_ROOM,V.ULTRA_GROUP].indexOf(d)>-1?c:u;let b=u,D=se.RECEIVE;S===se.SEND&&(b=i,D=se.SEND);const w=Nt(_),G=w<r,k=d===V.CHATROOM;let B=s._setExpansion(g),F=s._formatBytes(l);F=s._getUtfContent(F);const H=s._setPushConfig(e,this.logger);k&&u===i&&(D=se.SEND);const q={conversationType:d,targetId:P,senderUserId:b,messageType:R,messageUId:I,isPersited:C,isCounted:v,isMentioned:y,sentTime:w,messageDirection:D,receivedTime:Date.now(),disableNotification:A,receivedStatus:N,receivedStatusInfo:Dt(N),canIncludeExpansion:O,content:F,expansion:B,pushConfig:H,channelId:f||"",isInterrupt:M,isModifyMessage:U,messageId:Nt(E)||0,sentStatus:Q.SENT,isOffLineMessage:G,channelType:L,isStatusMessage:(null===(n=a[R])||void 0===n?void 0:n.isStatusMessage)||!1,readReceiptInfo:void 0,directedUserIds:T,disableUpdateLastMessage:!!(1&(m||0))};return(null==o?void 0:o(q))||q}_formatSentMessage(e,t){const n=this,{content:s,classname:i,sessionId:r,msgId:o,extraContent:a,pushExt:l,pushContent:u,configFlag:d,extStatus:c,clientUniqueId:h,systemId:_,toUserIds:g,optionBits:p}=e,{signal:E,currentUserId:f}=t,{date:I,topic:R,targetId:T}=E,m=!!(2&(c||0)),{isPersited:S,isCounted:C,disableNotification:v,canIncludeExpansion:y,isMentioned:A}=(e=>{let t=!1,n=!1,s=!1,i=!1,r=!1;return t=!!(1&e),n=!!(2&e),r=!!(4&e),s=!!(32&e),i=!!(64&e),{isPersited:t,isCounted:n,disableNotification:s,canIncludeExpansion:i,isMentioned:r}})(r);let N=Hc[R]||V.PRIVATE;const O=kc(R),M=n._formatBytes(s);let U=_||T;i===F.RECALL&&(N=M.conversationType||N,U=M.targetId||T);let L=n._setExpansion(a),P=n._setPushConfig(e,this.logger);const b=Object.assign(Object.assign({},P),{pushTitle:null==l?void 0:l.title,pushContent:u,pushData:u,disablePushTitle:!!d&&Boolean(4&d),forceShowDetailContent:!!d&&Boolean(8&d),templateId:null==l?void 0:l.templateId});return{conversationType:N,targetId:U,messageType:i,messageUId:o,isPersited:S,isCounted:C,isStatusMessage:O,senderUserId:f,content:n._formatBytes(s),sentTime:1e3*I,receivedTime:Date.now(),messageDirection:se.SEND,isOffLineMessage:!1,disableNotification:v,canIncludeExpansion:y,expansion:L,pushConfig:b,channelId:e.busChannel||"",isInterrupt:m,messageId:Nt(h)||0,receivedStatus:de.UNREAD,receivedStatusInfo:Dt(de.UNREAD),isMentioned:A,directedUserIds:g,disableUpdateLastMessage:!!(1&(p||0))}}_formatHistoryMessages(e,t){const{list:n,hasMsg:s,compressedData:i,compressioEnabled:r}=e;if(r){const e=wc(i),n=Hr.decode(js,e);return this._formatHistoryMessages(n,t)}const o=t.conversation||{},{targetId:a}=o,l=Nt(e.syncTime),u=[];return Ot(n,(e=>{const n=this._formatReceivedMessage(e,t);o.conversationType===V.ULTRA_GROUP?n.targetId=e.groupId||o.targetId:n.targetId=a,u.push(n)}),{isReverse:!0}),{syncTime:l,list:u,hasMore:!!s}}_formatUltraMsgChangeList(e){const{list:t,syncTime:n,hasNext:s}=e;return{syncTime:n,list:t&&t.map((e=>{const{targetId:t,type:n,time:s,changeType:i,msgUID:r,msgTime:o,busChannel:a,isAdmin:l,isDel:u,operatorId:d,subChangeType:c,userGroupIds:h,busChannelType:_,remindType:g}=e;return{targetId:t,conversationType:n,changeType:i,messageUId:r,changeTime:Nt(s),sendTime:Nt(o),channelId:a||"",isAdmin:l,isDel:u,operatorId:d,subChangeType:c,userGroupIds:h,busChannelType:_,mentionedType:g}})),hasNext:s}}_formatEventChangeList(e){const{list:t,syncTime:n,hasNext:s}=e;return{syncTime:n,list:t&&t.map((e=>{const{businessId:t,type:n,time:s,changeType:i,originalId:r,originalTime:o,secondaryId:a,isAdmin:l,additionalMark:u,operatorId:d,subChangeType:c,secondaryType:h,remindType:_,isRemindMe:g,extIds:p,eventData:E}=e;let f;return E&&(f=this._formatEventData(E,i,c)),{businessId:t,conversationType:n,changeType:i,originalId:r,time:Nt(s),originalTime:Nt(o),secondaryId:a||"",isAdmin:l,additionalMark:u,operatorId:d,subChangeType:c,userGroupIds:p,secondaryType:h,remindType:_,isRemindMe:g,eventData:f}})),hasNext:s}}_formatEventData(e,t,n){let s={};return e&&Kc[t]&&Kc[t](n)&&(s=Hr.decode(Kc[t](n),e)||{}),s}_formatUltraOperateStatusNotifyList(e){const{type:t,notifyType:n,info:s,summary:i}=e,r=[],o=[],a=!(2&~n),l=!(1&~n);return l&&Array.isArray(s)&&s.forEach((e=>{const{targetId:t,busChannel:n,userId:s,opType:i,optime:o}=e,a=Nt(o);r.push({targetId:t,channelId:n,userId:s,operationType:i,operationTime:a})})),a&&Array.isArray(i)&&i.forEach((e=>{const{targetId:t,busChannel:n,count:s,opType:i}=e;o.push({targetId:t,channelId:n,count:s,operationType:i})})),{conversationType:t,info:r,summary:o,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:Nt(e.msgTime),mentionedType:e.remindType,messageType:e.className||""})))}_getUltraGroupConversationInfo(e,t){const{versionTime:n,unreadCount:s,remindCount:i,busChannelType:r,msgInfo:o,remindMeCount:a}=t;return e.versionTime=Nt(n)||0,e.unreadMessageCount=this._getUnreadCount(Nt(s)||0),e.unreadMentionedCount=this._getUnreadCount(Nt(i)||0),e.unreadMentionedMeCount=this._getUnreadCount(Nt(a)||0),e.channelType=r||x.PUBLIC,e.lastReadTime=0,o&&(e.firstUnreadMessage={sentTime:Nt(o.msgTime)},e.lastReadTime=Nt(o.msgTime)-1),e}_getUnreadCount(e){return e>999?999:e}_formatConversationList(e,t){const n=this;let{info:s,compressedData:i,compressioEnabled:r}=e;if(r){const e=wc(i),n=Hr.decode(ks,e);return this._formatConversationList(n,t)}const{afterDecode:o}=t;s=Mt(s,(e=>{const{msg:s,userId:i,type:r,unreadCount:a,busChannel:l,versionTime:u}=e;let d=null;s&&(d=n._formatReceivedMessage(s,t),d.targetId=i);let c={targetId:i,conversationType:r,unreadMessageCount:Nt(a)||0,latestMessage:d,channelId:l||"",operationTime:Nt(u)||0};return r===V.ULTRA_GROUP&&(c=this._getUltraGroupConversationInfo(c,e)),(null==o?void 0:o(c))||c}));const a={list:s||[]};return((null==t?void 0:t.conversationType)||V.NONE)===V.ULTRA_GROUP&&(a.isFinished=e.isFinished),a}_formatSetUserSettingOutput(e){return e}_formatChatRoomInfos(e){const{userTotalNums:t,userInfos:n}=e;return{userCount:t,userInfos:Mt(n,(e=>{const{id:t,time:n}=e;return{id:t,time:Nt(n)}}))}}_formatChatRoomKVList(e){let{entries:t,bFullUpdate:n,syncTime:s,compressedData:i,compressioEnabled:r}=e;if(r){const e=wc(i),t=Hr.decode(ri,e);return this._formatChatRoomKVList(t)}return t=t||[],t=Mt(t,(e=>{const{key:t,value:n,status:s,timestamp:i,uid:r,version:o}=e,{isAutoDelete:a,isOverwrite:l,type:u}=(e=>({isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?M.DELETE:M.UPDATE}))(s);return{key:t,value:n,isAutoDelete:a,isOverwrite:l,type:u,userId:r,timestamp:Nt(i),version:Nt(o)}})),{kvEntries:t,isFullUpdate:n,syncTime:s}}_formatUserSetting(e){const{items:t,version:n}=e,s={};return Ot(t||[],(e=>{const{key:t,version:n,value:i}=e;e.version=Nt(n),e.value=this._readBytes(i),"Tag"===t&&e.tags.forEach((e=>{e.createdTime=Nt(e.createdTime),e.tagName=e.name})),s[t]=e})),{settings:s,version:n}}_formatGrpReadReceiptQryResp(e){const{totalMemberNum:t,list:n}=e;return n.forEach((e=>{e.readTime=Nt(e.readTime)})),{totalMemberCount:t,list:n}}_formatQueryReceiptResp(e){const{list:t=[],num:n,readCnt:s}=e;return{list:t.map((e=>({readTime:Nt(e.receiptTime),userId:e.userId}))),totalCount:n,readCount:s}}_formatUserSettingNotification(e){return e}_formatChrmKVVersion(e){const{joinTime:t,createTime:n,memberCount:s,chatroomBanState:i,whiteListState:r}=e;return{joinTime:t,createTime:n||0,memberCount:s||0,isAllChatroomBanned:!!(1&i),isCurrentUserBanned:!!(2&i),isCurrentChatroomBanned:!!(4&i),isCurrentChatroomInWhitelist:!!(1&r)}}_formatRTCJoinedUserInfo(e){return(e.info||[]).map((e=>({deviceId:e.deviceId,roomId:e.roomId,joinTime:Nt(e.joinTime)})))}_formatCallKVInfo(e){return e}_fromatCallInfoDownStream(e){return e}_formateSessionMsgReadInput(e){const{busChannel:t,channelId:n,msgTime:s,type:i}=e;return{conversationType:i,targetId:n,channelId:t||"",timestamp:s}}_formateChannelsListResult(e){if(!e)return{result:{list:[]}};const{listType:t,result:n,page:s}=e;if(!n)return{listType:t,result:{list:[]},page:s};return{listType:t,result:Hr.decode(Yc[t],n)||[],page:s}}encodeSessionAttInput(){const e=Hr.getModule(Qs);return e.setNothing(1),e.toArrayBuffer()}_calculateFlag(e){const{isFilerWhiteBlacklist:t,isVoipPush:n,pushConfig:s}=e,{disablePushTitle:i,forceShowDetailContent:r}=s||{};let o=0;return o|=n?1:0,o|=t?2:0,o|=i?4:0,o|=r?8:0,o}_getPushExtraModule(e){const{pushTitle:t,iOSConfig:n,androidConfig:s,templateId:i="",harmonyOSConfig:r}=e,o=Hr.getModule(As);if(t&&o.setTitle(t),n||s||r){const e=((e={},t={},n={})=>{const{channelIdMi:s,channelIdHW:i,channelIdOPPO:r,typeVivo:o,importanceHW:a,categoryHW:l,imageUrlHW:u,categoryVivo:d,importanceHonor:c,imageUrlHonor:h}=t,{APNS:_,FCM:g}=((e={},t={})=>{const{threadId:n,apnsCollapseId:s,category:i,richMediaUri:r,interruptionLevel:o}=e,{googleConfig:a}=t,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=s||"",l.category=i||"",l.richMediaUri=r||"",l["interruption-level"]=o||"active";const u={};u.collapse_key=null==a?void 0:a.collapseKey,u.imageUrl=null==a?void 0:a.imageUrl;let d=null==a?void 0:a.priority;return d&&!["high","normal"].includes(d)&&(d="normal"),u.priority=d,{APNS:l,FCM:u}})(e,t),p=[{HW:{channelId:i||"",importance:a||"NORMAL",image:u||"",category:l||""}},{MI:{channelId:s||""}},{OPPO:{channelId:r||""}},{VIVO:{classification:o||"",category:d||""}},{APNS:_},{FCM:g},{HONOR:{importance:c||ie.NORMAL,image:h||""}},{OHOS:{category:n.category||null,image:n.image||""}}];return JSON.stringify(p)})(n,s,r);o.setPushConfigs(e)}return(null==s?void 0:s.notificationId)&&o.setPushId(null==s?void 0:s.notificationId),o.setTemplateId(i),o}_getUpMsgModule(e,t){const{messageType:n,content:s,directionalUserIdList:i,canIncludeExpansion:r,expansion:o,pushConfig:a,channelId:l,pushData:u="",pushContent:d="",messageId:c=0,disableUpdateLastMessage:h=!1,isPersited:_}=t,{conversationType:g,targetId:p}=e,E=Hr.getModule(ys),f=(e=>{const{isStatusMessage:t}=e;let{isPersited:n,isCounted:s,isMentioned:i,disableNotification:r,canIncludeExpansion:o}=e;t&&(n=s=!1);let a=0;return n&&(a|=1),s&&(a|=2),i&&(a|=4),r&&(a|=32),o&&(a|=64),a})(t),{pushContent:I=d,pushData:R=u}=a||{};E.setSessionId(f),I&&E.setPushText(I),R&&E.setAppData(R),i&&E.setToUserIds(i);let T=this._calculateFlag(t);if(E.setConfigFlag(T),E.setClassname(n),s.user&&s.user.portraitUri&&(s.user.portrait=s.user.portraitUri),E.setContent(JSON.stringify(s)),r&&o){const e={};Ot(o,((t,n)=>{e[n]={v:t}})),E.setExtraContent(JSON.stringify(e))}if(a){const e=this._getPushExtraModule(a);E.setPushExt(e)}E.setClientUniqueId(c),pt(l)||E.setBusChannel(l),g===V.SYSTEM&&E.setSystemId(p);let m=0;return _&&h&&(m|=1),E.setOptionBits(m),E}encodeUpMsg(e,t){return this._getUpMsgModule(e,t).toArrayBuffer()}encodeGetHistoryMsg(e,t){const{count:n,order:s,timestamp:i,channelId:r}=t,o=Hr.getModule(Ks);return o.setTargetId(e),o.setTime(i),o.setCount(n),o.setOrder(s),o.setBusChannel(r||""),o.setCompressioEnabled(Ba.enable()),o.toArrayBuffer()}encodeSuperSyncMsg(e){return Hr.encode(Li,{syncTime:e,compressioEnabled:Ba.enable()})}encodeOldConversationList(e){e=e||{};let{count:t,type:n,startTime:s,order:i}=e;t=t||0,s=s||0,i=i||0;const r=Hr.getModule(Vs);return r.setType(n),r.setCount(t),r.setStartTime(s),r.setOrder(i),r.setCompressioEnabled(Ba.enable()),r.toArrayBuffer()}encodeRemoveOldConversationList(e){e=e||{};const{conversationType:t,channelId:n}=e,s=Hr.getModule(Gs);return s.setType(t),n&&s.setBusChannel([n]),s.toArrayBuffer()}encodeBatchDeleteConversation(e){const t=Hr.getModule(ei),n=[];return e.forEach((e=>{const{conversationType:t,targetId:s,channelId:i}=e,r=Hr.getModule(ti);r.setConversationType(t),r.setConversationId(s),r.setBusChannel(i||""),n.push(r)})),t.setRelation(n),t.toArrayBuffer()}_encodeSessions(e){return e.map((e=>{const{conversationType:t,targetId:n}=e,s=Hr.getModule(zs);return s.setType(t),s.setChannelId(n),s}))}encodeRemoveConversationList(e){const t=Hr.getModule(Js);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()}encodeDeleteMessages(e,t,n,s){const i=Hr.getModule(ni),r=[];return Ot(n,(e=>{r.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(r),i.setBusChannel(s),i.toArrayBuffer()}encodeClearMessages(e,t,n,s){const i=Hr.getModule(xs);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(s),i.toArrayBuffer()}encodeBatchClearRemoteMessages(e){const t=Hr.getModule(Hs),n=e.map((e=>{const t=Hr.getModule(xs);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:s,channelId:i}=e;let{timestamp:r}=t;const o=Hr.getModule($s);return r=r||+new Date,o.setType(n),o.setChannelId(s),o.setMsgTime(r),o.setBusChannel(i),o.toArrayBuffer()}encodeExpandUltraMessage(e,t){const{targetId:n,conversationType:s,channelId:i,messageUId:r,sendTime:o,keys:a,expansion:l,removeAll:u}=e,d={mid:r,put:l,del:a,clear:u?1:0},c=Hr.getModule(Pi);return c.setFromUserId(t),c.setTargetId(n),c.setType(s),c.setBusChannel(i||""),c.setMsgUID(r),c.setMsgTime(o),c.setContent(JSON.stringify(d)),c.toArrayBuffer()}encodemodifyMessage(e,t){const{targetId:n,conversationType:s,channelId:i,messageUId:r,sendTime:o,content:a}=e,l=Hr.getModule(Pi);return l.setFromUserId(t),l.setTargetId(n),l.setType(s),l.setBusChannel(i||""),l.setMsgUID(r),l.setMsgTime(o),l.setContent(JSON.stringify(a)),l.toArrayBuffer()}encodeQueryMsgChange(e){const t=Hr.getModule(bi);return t.setSyncTime(e),t.toArrayBuffer()}encodeMsgQuery(e){const{targetId:t,conversationType:n,messages:s}=e,i=Hr.getModule(Vi),r=s.map((e=>{const{sendTime:t,messageUId:n,channelId:s}=e;return{msgTime:t,msgUID:n,busChannel:s}}));return i.setTargetId(t),i.setType(n),i.setQuery(r),i.toArrayBuffer()}encodeUnreadMentionedMsgQuery(e){const{targetId:t,channelId:n,sentTime:s,count:i}=e,r=Hr.getModule(Bs);return r.setGroupId(t),r.setBusChannel(n),r.setMsgTime(s),r.setSize(i),r.toArrayBuffer()}encodeOperateStatus(e,t,n,s){const i=Hr.getModule(ki);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(s),i.toArrayBuffer()}encodeGetChatRoomInfo(e,t){const n=Hr.getModule(qs);return n.setCount(e),n.setOrder(t),n.toArrayBuffer()}encodeSetUltraGroupDefaultNotificationLevel(e,t){const n=Hr.getModule(fi);return n.setUnpushLevel(e),n.setBusChannel(t),n.toArrayBuffer()}encodeGetUltraGroupDefaultNotificationLevel(e){const t=Hr.getModule(Ei);return t.setBusChannel(e),t.toArrayBuffer()}encodeModifyChatRoomKV(e,t,n){const s=Hr.getModule(si),{key:i,value:r,notificationExtra:o,isSendNotification:a,type:l,timestamp:u}=t,d=l||M.UPDATE,c=Bc(t,d),h={key:i,value:r||"",uid:n,version:u};if(pt(c)||(h.status=c),s.setEntry(h),a){const t={conversationType:V.CHATROOM,targetId:e},n={key:i,value:r,extra:o,type:d},a=this._getUpMsgModule(t,{messageType:F.CHRM_KV_NOTIFY,content:n,isPersited:!1,isCounted:!1});s.setNotification(a),s.setBNotify(!0),s.setType(V.CHATROOM)}return s.toArrayBuffer()}encodeModifyChatRoomKVS(e,t,n){const s=Hr.getModule(ii),{entries:i,type:r}=t,o=r||M.UPDATE,a=Bc(t,o),l=[];return i.forEach((e=>{const t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};pt(a)||(t.status=a),l.push(t)})),s.setEntry(l),s.toArrayBuffer()}encodePullChatRoomKV(e){return Hr.encode(ai,{timestamp:e,compressioEnabled:Ba.enable()})}encodeSetConversationStatus(e,t){const n=Date.now();return Hr.encode(pi,{version:t,state:e.map((e=>{const t={type:e.conversationType,channelId:e.targetId,busChannel:e.channelId,time:n,stateItem:[]};return void 0!==e.notificationLevel&&(t.stateItem=[{sessionStateType:xr.IsSilent,value:e.notificationLevel.toString()}]),void 0!==e.isTop&&(t.stateItem=[{sessionStateType:xr.IsTop,value:e.isTop?"1":"0"}]),t}))})}encodeSetConversationTypeLevel(e,t,n){const s=Hr.getModule(Ti);return s.setType(e),s.setVersion(t),s.setUnpushLevel(n),s.toArrayBuffer()}encodeReadReceipt(e,t){const n=Hr.getModule(Si);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()}encodeCreateTag(e,t){const n=Hr.getModule(vi),s=[];return e.forEach((e=>{const t=Hr.getModule(yi);t.setTagId(e.tagId),t.setName(e.tagName),s.push(t)})),n.setTags(s),n.setVersion(t),n.toArrayBuffer()}encodeMessageReader(e,t){const n=Hr.getModule(Si);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()}encodeReadReceiptMsg(e,t,n){const s=Hr.getModule(Ki),{conversationType:i,targetId:r,channelId:o=""}=e;return s.setType(i),s.setTargetId(r),s.setBusChannel(o),s.setStartMsgId(t),s.setEndMsgId(n),s.toArrayBuffer()}encodeReceiptQryReq(e,t){const n=Hr.getModule(ji),{targetId:s,channelId:i=""}=e;return n.setTargetId(s),n.setBusChannel(i),n.setMsgId(t),n.toArrayBuffer()}encodeReceiptCntQryReq(e,t){const n=Hr.getModule(Wi),{targetId:s,conversationType:i,channelId:r=""}=e;return n.setChannelId(s),n.setBusChannel(r),n.setType(i),n.setMsgId(t),n.toArrayBuffer()}encodeSessionMsgReadInput(e,t){const n=Hr.getModule($s),{conversationType:s,targetId:i,channelId:r=""}=e;return n.setType(s),n.setChannelId(i),n.setBusChannel(r),n.setMsgTime(t),n.toArrayBuffer()}encodeRemoveTag(e,t){const n=Hr.getModule(Ai),s=[];return e.forEach((e=>{const t=Hr.getModule(yi);t.setTagId(e),s.push(t)})),n.setTags(s),n.setVersion(t),n.toArrayBuffer()}encodeDisConversationTag(e){const t=Hr.getModule(Ni);return t.setTagId(e),t.toArrayBuffer()}encodeUpdateConversationTag(e,t,n){const s=Hr.getModule(pi),i=[];return t.forEach((t=>{const n=Hr.getModule(_i),s=Hr.getModule(gi),r=[];e.forEach((e=>{const t=Hr.getModule(yi);t.setTagId(e.tagId),pt(e.isTop)||t.setIsTop(e.isTop),r.push(t)})),s.setSessionStateType(qc),s.setValue(JSON.stringify(r)),s.setTags(r),n.setType(t.conversationType),n.setChannelId(t.targetId),n.setTime(Date.now()),n.setStateItem([s]),i.push(n)})),s.setState(i),s.setVersion(n),s.toArrayBuffer()}encodeReportSDKInfo(e){const t=Hr.getModule(Mi);return t.setSdkInfo(e),t.toArrayBuffer()}encodeUltraGroup(e,t){const n=Hr.getModule(Ui);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.toArrayBuffer()}encodebindRTCRoomForChatroom(e){const t=Hr.getModule(Fi);return t.setRtcRoomId(e.rtcRoomId),t.toArrayBuffer()}encodeSetCallInfo(e,t){const n=Hr.getModule(xi);return n.setKey(e),n.setDataContent(t),n.toArrayBuffer()}encodePullKVMsg(e){const t=Hr.getModule(qi);return t.setSyncTime(e),t.toArrayBuffer()}encodeUpdateUserSubReq(e,t,n,s){const i=Hr.getModule(Ji);i.setSubType(e),i.setOpType(n),i.setExpiry(s);const r=[];return t.forEach((e=>{const t=Hr.getModule(zi);t.setSubUserId(e),r.push(t)})),i.setSubUsers(r),i.toArrayBuffer()}encodePullUserSubReq(e){const{version:t,pageToken:n}=e,s=Hr.getModule(Xi);return s.setVersion(t),s.setPageToken(n),s.toArrayBuffer()}encodePullSubDataReq(e){const{version:t,needAllData:n,pageToken:s}=e,i=Hr.getModule(tr);return i.setVersionTime(t),i.setNeedAllData(n),i.setPageToken(s),i.toArrayBuffer()}encodeQrySubDataReq(e,t){const n=Hr.getModule(ir);n.setSubType(e);const s=[];return t.forEach((e=>{const t=Hr.getModule(zi);t.setSubUserId(e),s.push(t)})),n.setSubUsers(s),n.toArrayBuffer()}encodePullUserProfileReq(e){const t=Hr.getModule(lr);return t.setUserId(e),t.toArrayBuffer()}encodeUserProfileInput(){const e=Hr.getModule(dr);return e.setNothing(1),e.toArrayBuffer()}encodeUserProfilePermission(e){const t=Hr.getModule(cr);return t.setPermission(e),t.toArrayBuffer()}encodeSearchUserProfile(e){const t=Hr.getModule(hr);return t.setUniqueId(e),t.toArrayBuffer()}encodeUserProfile(e){const t=Hr.getModule(rr),n=[],s=[];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],i=Hr.getModule(or);i.setKey(e),i.setValue(n.toString()||""),s.push(i)}))}return}const i=e[t],r=Hr.getModule(or);r.setKey(t),r.setValue((null==i?void 0:i.toString())||""),n.push(r)})),t.setUserProfile(n),t.setUserExtProfile(s),t.toArrayBuffer()}encodeMultiChannels(e){const t=Hr.getModule(pr),n=[];return e.forEach((e=>{const t=Hr.getModule(_r);t.setTargetId(e),n.push(t)})),t.setType(V.GROUP),t.setList(n),t.toArrayBuffer()}encodeQuitGroup(e,t,n=[],s=!0,i){const r=Hr.getModule(Er);if(r.setTargetId(t),r.setType(V.GROUP),"dismiss"!==e&&i){const e=this.encodeQuitChannelsSetting(i,s);r.setSettingInfo(e)}return"quit"!==e&&"dismiss"!==e&&r.setUsers(n),r.toArrayBuffer()}encodeQuitChannelsSetting(e,t){const n=Hr.getModule(fr);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 s=Hr.getModule(Er);return s.setTargetId(t),s.setType(V.GROUP),s.setUsers(n),s.setOperateType(e),s.toArrayBuffer()}encodeChannelsQueryInput(e){const{type:t,groupId:n,option:s,ids:i}=e,r=Hr.getModule(Ir);if(n&&r.setTargetId(n),r.setType(V.GROUP),["getGroupMembersByRole","getGroupApplications","getJoinedGroupsByRole"].includes(t)&&s){const e=this.encodePagingQuery(s);r.setPage(e)}return["getGroupMembers","getJoinedGroups"].includes(t)&&r.setIds(null!=i?i:[]),e.roleType&&r.setRoleType(e.roleType),r.toArrayBuffer()}encodePagingQuery(e){const t=Hr.getModule(Rr),{count:n,order:s,pageToken:i}=e;return t.setSize(n),t.setOrder(s?0:1),t.setPageToken(i),t}encodeJoinGroup(e,t,n=[]){const s=Hr.getModule(Cr);return s.setTargetId(t),s.setType(V.GROUP),"invite"===e&&s.setUserIds(n),s.toArrayBuffer()}encodeMemberResponseInput(e){const{groupId:t,inviterId:n,optType:s,optResult:i,joinUserId:r,reason:o}=e,a=Hr.getModule(Sr);return a.setTargetId(t),a.setType(V.GROUP),a.setOptType(s),a.setOptResult(i),a.setInviterId(n),s===y.MANAGER&&a.setJoinUserId(r),i||a.setDetail(null!=o?o:""),a.toArrayBuffer()}encodeSetGroupRemark(e,t){const n=Hr.getModule(mr);let s=S.ADD;return n.setTargetId(e),n.setType(V.GROUP),t||(s=S.REMOVE),n.setOperateType(s),n.setChannelNickName(t),n.toArrayBuffer()}encodeSetGroupFollows(e,t,n){const s=Hr.getModule(Er);return s.setTargetId(t),s.setType(V.GROUP),s.setUsers(n),s.setOperateType(e),s.toArrayBuffer()}encodeFriendInput(e){const t=Hr.getModule(vr);return t.setTargetId(e.targetId),e.type&&t.setType(e.type),e.info&&t.setInfo(e.info),t.toArrayBuffer()}encodeFriendsInput(e,t){return Hr.encode(yr,{targetId:e,type:t})}encodeFriendQueryInput(e,t,n){const{count:s=200,pageToken:i="",order:r=!1}=null!=t?t:{},o=Hr.getModule(Mr);o.setQueryType(e),11===e&&o.setFriendType(n);const a=Hr.getModule(Rr);return a.setSize(s),a.setOrder(r?0:1),a.setPageToken(i),o.setPage(a),o.toArrayBuffer()}encodeFriendsListInput(e,t){return Hr.encode(Ur,{targetId:e,type:t})}encodeFriendLevelSet(e){return Hr.encode(Lr,{level:e})}encodeQuerySessionsInput(e){const t=Hr.getModule(Zs);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()}}const Qc=(e,t,n,s,i,r,o,a)=>{const{type:l,version:u}=Ga(),d="browser"===fs.tag?`|${l}|${u}`:"||",c=o?`&protocolVer=${o}`:"",h=Da();return`${e}://${t}/websocket?appId=${n}&token=${encodeURIComponent(s)}&sdkVer=${ye}&pid=${r}&deviceId=${h}${1===a?`&baggage=${encodeURIComponent(`cid=${i}`)}`:""}&apiVer=${fs.isFromUniapp?"uniapp":fs.tag+encodeURIComponent(d)}${fs.connectPlatform?`&platform=${fs.connectPlatform}`:""}${c}`};class Wc extends Sn{constructor(e,t,n){super(e,t,n),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 jc(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,s,i){return t(this,void 0,void 0,(function*(){const{openAnti:t,type:s,baggageEnabled:o}=n,a=this.getCmpList(n);this.logger.debug(r.L_NAVI_CMP_R,JSON.stringify(a),i);const l=a.filter(((e,t)=>a.findIndex((t=>t.addr===e.addr))===t)).sort(((e,t)=>e.weight>t.weight?-1:1));if(0===l.length)return this.logger.error(r.L_NAVI_CONF_E,"no service available",i),et(w.SERVER_UNAVAILABLE);const u=1===t?po.V4:po.V3;for(let t=0;t<l.length;t+=1){const{protocol:n,addr:r,weight:a}=l[t],d=Qc(n===G.WS?"ws":"wss",r,this.appkey,e,this.cid,"",u,o),c=Date.now(),{code:h,data:_}=yield this.connectWebSocket(d,u,i),g=this.cmpWeightCache.findIndex((e=>e.addr===r)),p={bid:Zt(),ptc:he.WS,cod:h,net:this.getNetwork().type,dur:Date.now()-c,spr:0,pr:s||0,hos:r,idx:g,rct:this.retryCount?pe.RECONNECT:pe.CONNECT,cid:this.cid,v:ge.CURRENT,rsn:this._doConnectReason,count:this.retryCount,weight:a,ssid:this._serverSessionId};if(this.logger.record(re.IM_WEBSOCKET,JSON.stringify(p),i),h!==w.RC_SOCKET_DISCONNECTED&&h!==w.TIMEOUT)return h!==w.SUCCESS?et(h):(this._localConnectedTime=Math.floor((Date.now()+c)/2),this._socket=_.socket,this.updateCmpWeight(l[t].addr,!0),this.curCmpUrl=l[t].addr,Xe(_.userId))}return et(w.SERVER_UNAVAILABLE)}))}connectWebSocket(e,n,s){return t(this,void 0,void 0,(function*(){return this.logger.info(r.T,`connect start: ${e}`,s),new Promise((t=>{const i=fs.createWebSocket(e);this._socketIndex=i.id;const o=setTimeout((()=>{this.logger.info(r.T,`connect timeout: ${e}`,s),t(et(w.TIMEOUT)),i&&i.close()}),5e3);i.onOpen((()=>{clearTimeout(o),this.logger.info(r.T,"socket open",s)})),i.onMessage((e=>{if(this._socketIndex!==i.id)return void this.logger.warn(r.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:this._socketIndex,curSocketId:i.id}));if("[object ArrayBuffer]"!==Object.prototype.toString.call(e))return;const o=ia(e,n);if(o){if(o instanceof Yo){const e=o.status;if(e!==bc.ACCEPTED)return this.logger.info(r.T,`connect failed: ${e}`,s),void t(et((e=>Gc[e])(e)));this.logger.info(r.T,"connect success",s);const{timestamp:n,userId:a,messageId:l,sessionId:u}=o;return this._serverSessionId=u,this._connectedTime=n,this._idCount=l,void t(Xe({userId:a,socket:i}))}if(o instanceof Ko){const e=o.status;return this.logger.info(r.T,`recv disconnect signal -> status: ${e}`),void this.onRecvDisconnect(e,i)}this._onReceiveSignal(o)}})),i.onClose((()=>{this.logger.info(r.T,"socket close",s);const e=w.RC_SOCKET_DISCONNECTED;t(et(e)),this.onSocketEnd(i,e)})),i.onError((e=>{this.logger.info(r.T,"socket error",s);const n=w.RC_SOCKET_DISCONNECTED;t(et(n)),this.onSocketEnd(i,n)}))}))}))}_qosNeedAck(e){e.header.qos!==_o.AT_MOST_ONCE&&(e instanceof Jo&&!e.syncMsg&&(this.logger.debug(r.O,`send pubAck -> ${e.messageId} ${e.topic}`),this.sendOnly(new ta(e.messageId))),e instanceof sa&&(this.logger.debug(r.O,`send queryCon -> ${e.messageId}`),this.sendOnly(new na(e.messageId))))}_publishReader(e){return t(this,void 0,void 0,(function*(){const{syncMsg:t,topic:n,messageId:s}=e;if(this.logger.debug(r.O,`recv PublishReader -> messageId: ${s} ${n}`),n===Co)return;if(!t||kc(n))return void this.emit("signal",e);const i=yield new Promise((e=>{this._syncMessageIds[s]=e}));delete this._syncMessageIds[s],this.emit("signal",e,i)}))}_onReceiveSignal(e){return t(this,void 0,void 0,(function*(){if(e instanceof Qo&&this._pingResolve)return this._pingResolve(w.SUCCESS),void(this._pingResolve=void 0);if(this._qosNeedAck(e),e instanceof ea||e instanceof sa){const{messageId:t}=e;this.logger.debug(r.O,`recv ack -> messageId: ${t}`);const n=this._messageIds[t];n&&(n(e),delete this._messageIds[t]);const s=this._syncMessageIds[t];s&&(delete this._syncMessageIds[t],s(e))}e instanceof Jo&&(yield this._publishReader(e))}))}onRecvDisconnect(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer((e=>Vc[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(w.RC_SOCKET_DISCONNECTED)}}sendPing(e){return new Promise((t=>{this._pingResolve=t,setTimeout((()=>t(w.TIMEOUT)),e),this.sendOnly(new jo)}))}sendOnly(e){this._socket&&((e instanceof Xo||e instanceof Zo)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getArrayBuffer()))}_sendHandler(e){return t(this,void 0,void 0,(function*(){if(!this._socket)return et(w.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(w.TIMEOUT)}),3e4)})),s="number"==typeof n?n:n.status;return s!==w.SUCCESS&&this.logger.warn(r.O,`send rmtp fail -> messageId: ${t}, code: ${s}, topic: ${e.topic}`),"number"==typeof n?et(n):s===w.SUCCESS?Xe(n):et(s,"",n)}))}query(e,n,s,i,o){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.debug(r.O,`send query -> topic: ${ho(e)}, targetId: ${n}`,t);const a=new Zo(e,s,n);o&&a.setHeaderQos(o);const{code:l,data:u,isOk:d,msg:c}=yield this._sendHandler(a),h=u&&i?Hr.decode(i,u.pbData):void 0;return d?(this.logger.info(r.O,"send query success",t),Xe(h)):(this.logger.warn(r.O,`send query fail -> ${l}`,t),et(l,c,h))}))}send(e,n,s){return t(this,void 0,void 0,(function*(){const t=yield this._sendHandler(e);if(!t.data)return t.wipe();if(t.data instanceof ea)return t;const i=t.data,o=n&&i.pbData&&[w.SUCCESS,w.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,w.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT,w.RC_USER_PROFILE_KEY_NOT_EXIST,w.RC_USER_PROFILE_EXT_KEY_NOT_EXIST,w.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS,w.RC_USER_PROFILE_VALUE_EXCEED_RANGE,w.RC_GROUP_PARAMETER_FORMAT_ERROR].indexOf(i.status)>=0?this.codec.decodeByPBName(i.pbData,n,s):i;return 0!==i.status?(this.logger.warn(r.O,`send failed -> messageId: ${i.messageId}, respPBName: ${n}, status: ${i.status}`),et(i.status,void 0,n&&i.pbData?o:null)):Xe(o)}))}close(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()}}class $c{constructor(e){this.conn=e}}class Jc extends Tn{constructor(e,t,n){super(t,e,n),this._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};const s=Ga();this.deviceId=Da(),this.model=`Web|${s.type}|${s.version}`,this.init()}httpRequest(e,n,s,i){return t(this,void 0,void 0,(function*(){const t=i;t.deviceId=this.deviceId,t.model=this.model;const o={url:e,method:n,headers:s,body:JSON.stringify(t)};this.logger.info(r.L_REQUEST_T,JSON.stringify(o));const{status:a,data:l=""}=yield fs.httpReq(o);this.logger.info(r.L_REQUEST_R,JSON.stringify({status:a,data:l}));try{const e=JSON.parse(l),t=e.data;return{code:parseInt(e.code,10),data:t}}catch(e){return this.logger.warn(r.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:l,error:e})),{code:a,msg:e}}}))}setCloudControllerCache(e){const t=xe(this.appkey);fs.localStorage.setItem(t,JSON.stringify(e)),this.logger.info(r.L_CLOUD_SET_CACHE_O,JSON.stringify(e))}getLocalCloudControllerCache(){const e=xe(this.appkey),t=fs.localStorage.getItem(e);return this.logger.info(r.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:e,data:t})),t}setMRTRConfig(e){this.logger.info(r.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e}getMRTRConfig(){return this._mrtr}}let zc=null;const Zc="RC_LOGS",Xc="RC_STATISTICS",eh="RC_CONF",th={[Zc]:["level","time"],[eh]:["key"],[Xc]:["level","time"]},nh=(e,t,n)=>new Promise((s=>{const i=e.transaction(t,"readwrite").objectStore(t).index("time"),r=IDBKeyRange.upperBound(Date.now()-n),o=i.openCursor(r);o.onsuccess=e=>{const t=e.target.result;t?(t.delete(),t.continue()):s()},o.onerror=()=>{s()}}));let sh=null;const ih=e=>t(void 0,void 0,void 0,(function*(){const t=yield zc;if(!t)return;const{db:n}=t;yield nh(n,Zc,e),yield nh(n,Xc,e),sh=setTimeout((()=>ih(e)),6e5)})),rh=(e,t,n=168)=>{zc||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Ga().type?zc=new Promise((s=>{const i=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}`,a=i.open(o,2);a.onerror=e=>{t.error(r.L_LOGDB_OPEN_FAILED_E,e.target.error),s(null)},a.onsuccess=i=>{const o=i.target.result;o?(o.onclose=e=>{zc=null,t.warn(r.L_LOGDB_CLOSED_S)},o.onerror=e=>{zc=null,t.error(r.L_LOGDB_ERROR_E,e.target.error)},o.onabort=e=>{t.info(r.L_LOGDB_ABORT_S,e.target.error)},ih(3600*Math.max(24,Math.min(168,n))*1e3),s({appkey:e,db:o})):s(null)},a.onupgradeneeded=e=>{const t=e.target.result;Object.keys(th).forEach((e=>{t.objectStoreNames.contains(e)&&t.deleteObjectStore(e);const n=e===eh?{keyPath:"key"}:{autoIncrement:!0},s=t.createObjectStore(e,n);th[e].forEach((e=>s.createIndex(e,e,{unique:!1})))}))}})):t.warn(r.L_UNSUPPORT_INDEXDB_O))},oh=[],ah=(e,t,n)=>new Promise((s=>{const i=e.transaction(t,"readwrite");i.oncomplete=s,i.onabort=s;const r=i.objectStore(t);n.forEach((e=>{try{r.add(e)}catch(t){null===console||void 0===console||console.error("write failed ->",e,t)}}))})),lh=[];let uh=!1;const dh=e=>t(void 0,void 0,void 0,(function*(){if(uh||0===lh.length)return;uh=!0;const t=lh.filter((e=>e.level<dn.FATAL)),n=lh.filter((e=>e.level>=dn.FATAL));lh.length=0,yield ah(e,Zc,n),yield ah(e,Xc,t),uh=!1,0===lh.length&&oh.length>0&&(oh.forEach((e=>e.close())),oh.length=0),setTimeout((()=>dh(e)))}));function ch(e){return t(this,void 0,void 0,(function*(){const t=yield zc;return t?new Promise((n=>{const{db:s}=t,i=s.transaction(eh,"readonly").objectStore(eh).get(e);i.onsuccess=e=>{var t;n({value:null===(t=i.result)||void 0===t?void 0:t.value,success:!0})},i.onerror=e=>{n({success:!1})}})):{success:!1}}))}let hh=We;const _h=()=>({setTimestamp4RealtimeLog(e){hh=e},getTimestamp4RealtimeLog:()=>hh,getLogs(e,n,s,i,r=Zc){return t(this,void 0,void 0,(function*(){const t=yield zc;return t?new Promise((o=>{const{db:a}=t,l=a.transaction(r,"readonly").objectStore(r),u=[],d=IDBKeyRange.bound(e,n),c=l.index("time").openCursor(d);c.onsuccess=e=>{const t=e.target.result;if(t){const e=t.value;e.level<=s&&(i?e.sessionId===Qe:e.level>=0)&&u.push(e),t.continue()}else o({dbReady:!0,logs:u})},c.onerror=e=>{o({dbReady:!1,logs:[]})}})):{dbReady:!1,logs:[]}}))}}),gh="REPORT_SESSION",ph=(e,n)=>t(void 0,void 0,void 0,(function*(){const s=`${gh}_${e}`,{success:i,value:r}=yield ch(`${gh}_${e}`);i&&n!==(null==r?void 0:r.sessionId)&&function(e,n){t(this,void 0,void 0,(function*(){const t=yield zc;if(!t)return!1;const{db:s}=t;return s.transaction(eh,"readwrite").objectStore(eh).put({key:e,value:n}),!0}))}(s,{sessionId:n})}));class Eh extends cn{_handleWrite(e){(e=>{t(void 0,void 0,void 0,(function*(){const t=yield zc;if(t){if(e.content&&rt(e.content))try{e.content=JSON.parse(e.content)}catch(e){}lh.push(e),dh(t.db)}}))})(e)}}const fh=144e5;if("undefined"!=typeof window){const e=(e,t)=>{const n=t.map((({sessionId:e,time:t,type:n,level:s,tag:i,traceId:r,loggerId:o,content:a})=>`${e},${t},${n},${s},${i},${r},${o},"${a}"\n`)),s=new Blob(n,{type:"text/csv"}),i=URL.createObjectURL(s),r=document.createElement("a");r.href=i,r.download=`${e}.csv`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)};window.__rongcloud_devtools__={logger:{get(n,s=Date.now()-fh,i=Date.now()){return t(this,void 0,void 0,(function*(){s=s<0?Date.now()+s:s,(i=i<=0?Date.now():i)-s>fh&&(s=i-fh);const t=new Eh(n,"RC-IM","IM");t.debug(r.T,`get logs: startTime ${s} endTime ${i}`),rh(n,t);const o=_h(),{logs:a}=yield o.getLogs(s,i,dn.DEBUG,!1);t.debug(r.T,`get logs ${a.length}`),e(`${n}-${s}-${i}`,a)}))}}}}class Ih extends hn{constructor(e,t,n){const s=Da(),i=Ga();super(e,s,`${i.type}|${i.version}|${t.getSessionId()}`,_h(),t),this.tableName=n}send(e){return fs.httpReq(e)}checkStart(e){const n=Object.create(null,{checkStart:{get:()=>super.checkStart}});return t(this,void 0,void 0,(function*(){return yield ph(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:Ka(e.map(_n).join(""))}}))}realtimeReport(e,n,s){const i=Object.create(null,{realtimeReport:{get:()=>super.realtimeReport}});return t(this,void 0,void 0,(function*(){return i.realtimeReport.call(this,e,n,s,this.tableName)}))}}class Rh extends Ih{constructor(e,t){super(e,t,Zc)}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:s}=yield ch(`${gh}_${e}`);return t&&(null==s?void 0:s.sessionId)===n})))}))}report(e,n,s,i,r,o,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,s,i,r,o,a)}))}}class Th extends Ih{constructor(e,t){super(e,t,Xc)}}class mh{constructor(e){this.conn=e}}class Sh{constructor(e){this.conn=e}}var Ch,vh;const yh={[V.PRIVATE]:uo.qryPMsg,[V.GROUP]:uo.qryGMsg,[V.CHATROOM]:uo.qryCHMsg,[V.CUSTOMER_SERVICE]:uo.qryCMsg,[V.SYSTEM]:uo.qrySMsg,[V.APP_PUBLIC_SERVICE]:uo.qryMCMsg,[V.PUBLIC_SERVICE]:uo.qryMPMsg},Ah={[V.PRIVATE]:uo.cleanPMsg,[V.GROUP]:uo.cleanGMsg,[V.ULTRA_GROUP]:uo.cleanGMsg,[V.CUSTOMER_SERVICE]:uo.cleanCMsg,[V.SYSTEM]:uo.cleanSMsg,[V.APP_PUBLIC_SERVICE]:uo.cleanMCMsg,[V.PUBLIC_SERVICE]:uo.cleanMPMsg},Nh=(e,t,n,s,i,r,o)=>({conversationType:e,targetId:t,senderUserId:r,messageDirection:se.SEND,isCounted:!!n.isCounted,isMentioned:!!n.isMentioned,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:!!n.isPersited,messageUId:s,sentTime:i,receivedTime:0,disableNotification:!!n.disableNotification,isStatusMessage:!!n.isStatusMessage,canIncludeExpansion:!!n.canIncludeExpansion,expansion:n.canIncludeExpansion?n.expansion:null,receivedStatus:de.UNREAD,receivedStatusInfo:Dt(de.UNREAD),pushConfig:n.pushConfig,channelId:n.channelId,isInterrupt:n.isInterrupt,messageId:o||0,sentStatus:Q.SENT,directedUserIds:n.directionalUserIdList,disableUpdateLastMessage:n.disableUpdateLastMessage}),Oh=e=>(e.sort(((e,t)=>{var n,s;const i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(s=t.latestMessage)||void 0===s?void 0:s.sentTime)||0)-i})),e),Mh=[A.GROUP_OPERATION,A.GROUP_PROFILE_CHANGE,A.GROUP_APPLICATION_INVITATION,A.GROUP_FOLLOW_USER_CHANGE],Uh=[h.FRIEND_APPLICATION],Lh=["RC:TypSts","RC:InterceptMsg","RC:RL"];function Ph(){return(e,n,s)=>{const i=s.value;return s.value=function(...e){return t(this,void 0,void 0,(function*(){return this._isConnected?i.apply(this,e):Promise.resolve({code:w.RC_NET_UNAVAILABLE})}))},s}}function bh(){return(e,n,s)=>{const i=s.value;return s.value=function(...e){return t(this,void 0,void 0,(function*(){return this._isConnected?i.apply(this,e):Promise.resolve(et(w.RC_NET_UNAVAILABLE))}))},s}}function Dh(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:Nt(e.relationTime),inBlackList:!!e.flag}})):[]}function wh(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:Nt(e.operateTime),extra:e.info||"",friendType:e.friendType}))):[]}class Vh extends oa{constructor(e,t,n){super(e,t,n,new Eh(n.appkey,"IMLib","IM")),Ch.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 s;const{messageType:i}=n;if(i===F.SYNC_READ_STATUS&&(e=>[V.GROUP,V.DISCUSSION,V.ULTRA_GROUP,V.PUBLIC_SERVICE,V.APP_PUBLIC_SERVICE].includes(e))(e)&&Object.assign(n,{directionalUserIdList:[this.currentUserId]}),i===F.READ_RECEIPT_RESPONSE){if(!n.content.receiptMessageDic||0===Object.keys(n.content.receiptMessageDic).length){const i=null===(s=this._readReceiptManager)||void 0===s?void 0:s.getReceiptMessageDic({conversationType:e,targetId:t,channelId:n.channelId});n.content.receiptMessageDic=i||{}}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:s,logOutputLevel:i,logExpireTime:r,navigators:o,areaCode:a,logServerUrl:l,miniCMPProxy:u,environment:d}=n;this._environment=d||"default",this.logger.setOutputLevel(i),ln.init({areaCode:a,navigators:o,logServerUrl:l,miniCMPProxy:u}),rh(s,this.logger,r),this.reporter=new Rh(s,this.logger),this.navi=new pl(s,this.logger,new Sl(s,this.logger),this._environment),this.reporterStatistic=new Th(s,this.logger),this._letterbox=new El(s),this._sendMessageStore=new fl(s),this._chrmEntryHandler=new dl(this);const c=this._connMgr=new Wc(s,this.navi,this.logger);"browser"===fs.tag&&this._initCloudController(),this._chatroom=new $c(c),this._chat=new mh(c),this._dataHosting=new Sh(c),c.on("signal",this._signalHandler,this),c.on("onConnected",this.onConnected,this),c.on("onDisconnected",this.onDisconnected,this),c.on("onConnecting",this._watcher.onConnecting,this._watcher),c.on("onSuspend",this.onSuspend,this)}get chatroom(){return this._chatroom}get chat(){return this._chat}get dataHosting(){return this._dataHosting}_initCloudController(){const e=ln.getCloudControllerUrl();[this.cloudControllerUri]=e,this.cloudController=new Jc(this._appkey,this.logger,this.reporter),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,gn.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 vl(this._connMgr,this.currentUserId,this.logger,this._appkey,this._handleEventChangeList.bind(this))),this._joinedChrmManager||(this._joinedChrmManager=new cl(t.joinMChrm)),this._conversationManager||(this._conversationManager=new sl(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag,ka(t))),this._ultraGroupManager||(this._ultraGroupManager=new al(this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new hl(this,this._appkey,this.currentUserId,this._watcher.tag)),this._readReceiptManager||(this._readReceiptManager=new ml(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,s;this._resetMemoryState(),null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),null===(s=this._EventChangeManager)||void 0===s||s.stopAllTask(),this._watcher.onDisconnected(e)}onSuspend(e){var t,n,s;null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),null===(s=this._EventChangeManager)||void 0===s||s.stopAllTask(),this._watcher.onSuspend(e)}_initSubscribeManager(e){(e.subDriven||e.userProfile)&&(this._subscribeManager||(this._subscribeManager=new Tl(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 Eh(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,s,i){return t(this,void 0,void 0,(function*(){return this._openCallPlus=s,this._connMgr.connect(e,n,s,i)}))}_signalHandler(e,t){var n;const{syncMsg:s,topic:i}=e;if(s)return void this._receiveSyncMsg(e,t);const o=this.logger.createTraceId();this.logger.debug(r.L_RECV_RMTP_O,i,o);const a=co(i);if(a)switch(a){case uo.s_ntf:this._pullMsg(e);break;case uo.s_msg:this._receiveMsg(e);break;case uo.s_cmd:this._receiveStateNotify(e);break;case uo.s_us:this._receiveSettingNotify(e);break;case uo.rtc_ntf:this._receiveRtcKv(e.pbData);break;case uo.s_opNtf:this._pullOperateStatusNotify(e);break;case uo.s_pubCall:this._pubCallInfo(e);break;case uo.s_stat:null===(n=this._subscribeManager)||void 0===n||n.updateUserStatus(e)}else this.logger.error(r.L_RECV_RMTP_E,i,o)}_receiveStateNotify(e){var t,n,s;const{time:i,type:r,chrmId:o}=this._connMgr.codec.decodeByPBName(e.pbData,Cs);switch(r){case 2:if(!this._chrmsQueue[o])return;this._chrmEntryHandler.pullEntry(o,i);break;case 3:this._conversationManager.startPullConversationStatus(i);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(i),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(i),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime);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===(s=this._subscribeManager)||void 0===s||s.syncOwnProfile(!0);break;case 11:this._EventChangeManager.startPullEventChange(i)}}_receiveSettingNotify(e){const{version:t}=this._connMgr.codec.decodeByPBName(e.pbData,Oi);this._userSettingManager.pullUserSettings(t)}_receiveMessageExpansion(e){const{content:t,channelId:n="",conversationType:s,targetId:i}=e,{put:r,del:o,mid:a}=t;r&&this._watcher.expansion({updatedExpansion:{messageUId:a,expansion:r,channelId:n,conversationType:s,targetId:i}}),o&&this._watcher.expansion({deletedExpansion:{messageUId:a,deletedKeys:o,channelId:n,conversationType:s,targetId:i}})}_clearUltraGroupUnreadCount(e,t){const{targetId:n,channelId:s,timestamp:i}=this._connMgr.codec.decodeByPBName(e.pbData,$s),r=this._ultraGroupMap[`${s}_${n}`];r&&(r.unreadMessageCount=0,r.unreadMentionedCount=0,r.unreadMentionedMeCount=0,r.firstUnreadMessage&&(r.firstUnreadMessage=null),r.lastReadTime=i,this._watcher.conversation(bt([r]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)}_receiveSyncMsg(e,t){const n=co(e.topic),s={[uo.ugMsg]:()=>{this._ultraGroupTimeQue.push(t.timestamp),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp)},[uo.updRTime]:()=>{this._receivesyncReadStatus(e)},[uo.updUgRTime]:()=>{this._clearUltraGroupUnreadCount(e,t)},[uo.updUserSub]:()=>{var e;null===(e=this._subscribeManager)||void 0===e||e.startSyncSubscribeRelationship(t.timestamp)}};if(s[n])return void s[n]();if(![uo.recallMsg,uo.ppMsgS,uo.pgMsgS,uo.ppMsgP,uo.pgMsgP,uo.chatMsg,uo.pcMsgP,uo.prMsgS,uo.pbMsgP].includes(n))return;let i=this._connMgr.codec.decodeByPBName(e.pbData,ys,{currentUserId:this.currentUserId,signal:e});i=this._handleMsgProperties(i),(i.conversationType!==V.CHATROOM||this._chrmsQueue[i.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||i.sentTime):(t&&(i.sentTime=t.timestamp,i.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(r.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:i.messageUId,messgeId:i.messageId,sentTime:i.sentTime})),i.messageType!==F.EXPANSION_NOTIFY?((i.messageType===F.SYNC_READ_STATUS||i.messageType===F.READ_RECEIPT&&i.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(i.conversationType,i.targetId,i.channelId,i.sentTime),i.messageType===F.READ_RECEIPT_REQUEST&&this._processRRReqMsg(i),i.messageType===F.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(i),this._conversationManager.setConversationCacheByMessage(i,!0),this._batchMessage([i])):this._receiveMessageExpansion(i)))}_batchMessage(e){const t=[],n=[],s=[];for(let i=e.length-1;i>=0;i-=1){const r=e[i];r.messageType===F.LOG_COMMAND&&r.senderUserId===Oe?n.unshift(r):r.messageType===F.CLOUD_CONTROL&&r.senderUserId===Oe?s.push(r):t.unshift(r)}this._watcher.batchMessage(t),n.forEach((e=>{const{startTime:t,endTime:n,platform:s,logId:i,uri:r}=e.content;this.reporter.report(parseInt(t,10),parseInt(n,10),s,r,i,e.messageUId)})),s.length>0&&this._ccMsgHandler(s)}_ccMsgHandler(e){var n;return t(this,void 0,void 0,(function*(){if(e.shift()){const t=this._connMgr.getToken(),s=(yield null===(n=this.cloudController)||void 0===n?void 0:n.request(this.cloudControllerUri,gn.other,t))||0,i=e.filter((e=>e.sentTime>s));i.length>0&&this._ccMsgHandler(i)}}))}_pubCallInfo(e){const{key:t,dataContent:n,maxTime:s}=this._connMgr.codec.decodeByPBName(e.pbData,Hi);this._latestPullKVMsgTimestamp=s,this._watcher.callInfo(JSON.stringify({list:[{key:t,value:n}]}))}_pullMsg(e){const{type:t,chrmId:n,time:s}=this._connMgr.codec.decodeByPBName(e.pbData,Cs);if(this.logger.info(r.L_RECV_S_NTF_O,`type: ${t}, chrmId: ${t}, time: ${s}`),2===t){const e=this._chrmsQueue[n];if(!e)return;e.queue.push(s),this._pullChrmMsg(n)}else this._pullQueue.push(s),this._syncMsg()}_receivesyncReadStatus(e){const t=this._connMgr.codec.decodeByPBName(e.pbData,$s),{conversationType:n,targetId:s,channelId:i,timestamp:r,sentTime:o}=t;this._conversationManager.clearUnreadCount(n,s,i,o),this._watcher.syncReadStatus({conversationType:n,targetId:s,channelId:i,timestamp:r})}_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 Zo(uo.pullKvMsg,e,this.currentUserId),{code:n,data:s}=yield this._connMgr.send(t,Yi);n===w.SUCCESS&&s&&(this._latestPullKVMsgTimestamp=s.maxTime,this._watcher.callInfo(JSON.stringify({list:s.info})))}))}get _isConnected(){return this._connMgr.getConnectionStatus()===ee.CONNECTED}_filterMessage(e){const{messageType:t}=e;return t===F.DELIVERED||t===F.DELIVERED_MSG||t===F.SYNC_READ_STATUS&&!this._processSRSMsg(e)}_messageProcessor(e){let t=0;const n=[],s=[],i=[],r=[],o=[];return e.forEach((e=>{const{conversationType:a,targetId:l,channelId:u,messageDirection:d,messageUId:c,messageType:h,sentTime:_,senderUserId:g,content:p}=e;if(n.push(c),d===se.SEND){t=Math.max(_,t);const e=this._sendMessageStore.getSendMessageMap(),n=h===F.RECALL?`Cmd:${p.messageUId}`:c;if(e[n])return void this._sendMessageStore.removeByUID(n)}if(this._filterMessage(e))return;if(h===F.EXPANSION_NOTIFY)return void i.push(e);if(_>=this._connMgr.getConnectedTime()&&this._writeMessagesLog(a,c)&&o.push(c),h===F.READ_RECEIPT&&g===this.currentUserId&&this._conversationManager.clearUnreadCount(a,l,u,_),h===F.READ_STATE)return void r.push(e);h===F.READ_RECEIPT_REQUEST&&this._processRRReqMsg(e),h===F.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(e);const E=this._handleMsgProperties(e);this._conversationManager.setConversationCacheByMessage(E,!0),s.push(E)})),{newOutboxTime:t,messageUIds:n,messages:s,messageExpansionList:i,RSMsgList:r,msgUIds2Statistic:o}}_processSRSMsg(e){const{conversationType:t,targetId:n,channelId:s,content:i,senderUserId:r,sentTime:o}=e;if(r!==this.currentUserId)return!1;const a=this.getNaviInfoFromCache();return this._conversationManager.clearUnreadCount(t,n,s,o),1!==a.sesDriven||(o>this.getConnectedTime()||this._watcher.syncReadStatus({conversationType:t,targetId:n,channelId:s,timestamp:i.lastMessageSendTime}),!1)}_processRSMsg(e){const{conversationType:t,targetId:n,channelId:s,content:i}=e,r={conversationType:t,targetId:n,channelId:s};this._watcher.messageReadReceipt(t===V.PRIVATE?{privateReadReceipt:Object.assign(Object.assign({},r),{endMsgTime:i.endMsgTime})}:{groupReadReceipt:Object.assign(Object.assign({},r),{totalCount:i.tmn,readedCount:i.rrn,messageUId:i.msgId})})}_processRRReqMsg(e){var t;const{conversationType:n,channelId:s,targetId:i,content:r,sentTime:o,messageDirection:a,senderUserId:l}=e;null===(t=this._readReceiptManager)||void 0===t||t.insert({conversationType:n,channelId:s,targetId:i},r.messageUId,a,o,l)}_processRRRspMsg(e){var t;const{conversationType:n,channelId:s,targetId:i,content:r,senderUserId:o}=e,{receiptMessageDic:a={}}=r;if(o===this.currentUserId)for(const e in a){const r=a[e];for(const e of r)null===(t=this._readReceiptManager)||void 0===t||t.remove({conversationType:n,channelId:s,targetId:i},e)}else{(a[this.currentUserId]||[]).forEach((e=>{var t;null===(t=this._readReceiptManager)||void 0===t||t.addReadedUser({conversationType:n,channelId:s,targetId:i},e,o)}))}}_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),s=Hr.encode(vs,{ispolling:!1,isPullSend:!0,sendBoxSyncTime:e,syncTime:t,broadcastSyncTime:n,compressioEnabled:Ba.enable()}),i=new Zo(uo.pullMsg,s,this.currentUserId),o=this.logger.createTraceId();this.logger.info(r.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o);const{code:a,data:l}=yield this._connMgr.send(i,Ns,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId,customMessageTypes:this._customMessageType});if(this._latestSyncTimestamp=Date.now(),this._pullingMsg=!1,a!==w.SUCCESS||!l||pt(l.finished)||pt(l.list)||pt(l.syncTime))return void this.logger.warn(r.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o);const{list:u,finished:d,syncTime:c,broadcastSyncTime:h=1}=l;this.logger.info(r.L_PULL_MSG_R,JSON.stringify({syncTime:c,finished:d,messages:u.map((e=>({messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime})))}),o);try{let{newOutboxTime:e,messageUIds:t,messages:n,messageExpansionList:s,RSMsgList:i,msgUIds2Statistic:l}=this._messageProcessor(u);l.length>0&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:l.join(",")})),this._batchMessage(n),s.forEach((e=>{this._receiveMessageExpansion(e)})),i.forEach((e=>{this._processRSMsg(e)})),this._letterbox.setInboxTime(c,this.currentUserId),this._letterbox.setOutboxTime(e,this.currentUserId),this._letterbox.setBroadcastSyncTime(h,this.currentUserId),this._sendMessageStore.removeByTimestamp(e);const _=this._pullQueue.filter((e=>e>c));if(this._pullQueue.length=0,this._pullQueue.push(..._),d&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(r.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:t.join(","),timestamp:this._latestSyncTimestamp,hasmore:!d,tmpPullQueue:_}),o),!d)return void this._syncMsg();this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg())}catch(e){this.logger.error(r.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,Os,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});t=this._handleMsgProperties(t);const{conversationType:n,messageType:s,senderUserId:i,messageUId:o,sentTime:a,isStatusMessage:l}=t;if(this.logger.info(r.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),this._writeMessagesLog(n,o)&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:o})),n!==V.RTC_ROOM&&s!==F.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}i===this.currentUserId&&this._sendMessageStore.setMessage(o,a),l||i===this.currentUserId||this._letterbox.setInboxTime(a,this.currentUserId),this._handleNotNotifyMsg(t)||(s===F.READ_RECEIPT_REQUEST&&this._processRRReqMsg(t),s===F.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(t),this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t]))}_handleNotNotifyMsg(e){const{messageType:t,senderUserId:n}=e;return t===F.DELIVERED||(t===F.DELIVERED_MSG||(t===F.EXPANSION_NOTIFY?(this._receiveMessageExpansion(e),!0):t===F.SYNC_READ_STATUS&&n!==this.currentUserId||t===F.READ_STATE&&(this._processRSMsg(e),!0)))}_handleMsgProperties(e,t=!1){const{messageType:n,isStatusMessage:s,isCounted:i=!1,isPersited:r=!1}=e;let o;const a=n in ve,l=n in this._customMessageType;if(o=a?Object.assign(Object.assign({},ve[n]),{isStatusMessage:Lh.includes(n)}):l?this._customMessageType[n]:{isCounted:i,isPersited:r,isStatusMessage:!1},Object.assign(e,o),t&&!pt(s)&&(e.isStatusMessage=s),!t){const t=e.content.user;if(t){const{portrait:e,portraitUri:n}=t,s=e||n;s&&(t.portrait=t.portraitUri=s)}}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,s,i,o,a="",l="",u){var d;return t(this,void 0,void 0,(function*(){const{currentUserId:t,_connMgr:l}=this,c=yh[e]||uo.qryPMsg,h=1===i&&0===s;if(l){const _=l.codec.encodeGetHistoryMsg(n,{timestamp:s,count:h?2:i,order:o,channelId:a});this.logger.info(r.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:n,conversationType:e,channelId:a,timestamp:s,count:i,order:o}),u);const g=yield l.send(new Zo(c,_,t),js,{currentUserId:t,connectedTime:l.getConnectedTime(),conversation:{targetId:n},afterDecode:t=>{var s;const i=null===(s=this._readReceiptManager)||void 0===s?void 0:s.getReadReceiptInfo({conversationType:e,channelId:a,targetId:n},t.messageUId);if(i){const{users:e}=i;t.readReceiptInfo={isReceiptRequestMessage:!0,readerList:e}}return t}}),{code:p,data:E}=g;if(p!==w.SUCCESS||!E)return this.logger.warn(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:p,messageUIds:""}),u),{code:p};const f=this._fixDownstreamData(h,E,o),I=[];return null===(d=f.list)||void 0===d||d.forEach((e=>{e&&I.push(e.messageUId)})),this.logger.info(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:p,messageUIds:I.join(",")}),u),{code:p,data:{list:f.list,hasMore:f.hasMore}}}return{code:w.RC_NET_CHANNEL_INVALID}}))}getMessages(e,t,n,s,i,r,o){return this.getHistoryMessage(e,t,n,s,i,r,o)}reportSDKInfo(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const{currentUserId:t,_connMgr:n}=this,s=this.logger.createTraceId(),i=JSON.stringify(e);this.logger.debug(r.L_VER_REPORT_T,i,s);const o=n.codec.encodeReportSDKInfo(i),a=new Zo(uo[uo.reportsdk],o,t),{code:l}=yield n.send(a);l!==w.SUCCESS&&this.logger.warn(r.L_VER_REPORT_R,l,s)}))}deleteRemoteMessage(e,n,s,i){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{currentUserId:t,_connMgr:r}=this,o=r.codec.encodeDeleteMessages(e,n,s,i);let a=uo.delMsg;e===V.ULTRA_GROUP&&(a=uo.delUgMsg);const l=new Zo(a,o,t),u=yield r.send(l),{code:d}=u;return d}))}deleteRemoteMessageByTimestamp(e,n,s,i){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{currentUserId:t,_connMgr:r}=this,o=r.codec.encodeClearMessages(n,s,i,e),a=new Zo(Ah[e],o,t),l=yield r.send(a),{code:u}=l;return u}))}batchClearRemoteHistoryMessages(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{currentUserId:t,_connMgr:n}=this,s=n.codec.encodeBatchClearRemoteMessages(e),i=new Zo(uo.cleanMsgBatch,s,t),r=yield n.send(i),{code:o}=r;return o}))}getConversationList(e=300,n,s,i,r){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{currentUserId:t,_connMgr:r}=this;n=n||V.PRIVATE;const o=r.codec.encodeOldConversationList({count:e,type:n,startTime:s,order:i}),a=new Zo(uo.qryRelationR,o,t),l=yield r.send(a,ks,{currentUserId:t,connectedTime:r.getConnectedTime(),afterDecode:e=>{const{conversationType:t,targetId:n,channelId:s}=e,i=this._conversationManager.get(t,n,s);Object.assign(e,i);const r=this._conversationManager.getDraft(t,n,s);return e.draft=r,e}}),{code:u,data:d}=l;return u!==w.SUCCESS?{code:u}:{code:u,data:null==d?void 0:d.list}}))}removeConversation(e,n,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{_connMgr:t}=this,i=t.codec.encodeRemoveOldConversationList({conversationType:e,channelId:s,targetId:n}),r=new Zo(uo.delRelation,i,n);return(yield t.send(r)).code}))}batchRemoveConversation(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{_connMgr:t}=this,n=t.codec.encodeBatchDeleteConversation(e),s=new Zo(uo.delRelationBatch,n,this.getCurrentUserId());return(yield t.send(s)).code}))}getConversation(e,n,s){return t(this,void 0,void 0,(function*(){let t;if(e===V.ULTRA_GROUP){if(t=this._ultraGroupMap[`${s}_${n}`],!t)return{code:w.CONVER_GET_ERROR}}else{const i=this._conversationManager.get(e,n,s);if(!i)return{code:w.CONVER_GET_ERROR};const{code:r,data:o}=yield this.getHistoryMessage(e,n,0,1,0);if(r!==w.SUCCESS)return{code:w.CONVER_GET_ERROR};const a=this._conversationManager.getDraft(e,n,s),l=(null==o?void 0:o.list[0])||null;t={conversationType:e,targetId:n,channelId:s,unreadMessageCount:i.unreadMessageCount||0,latestMessage:l,notificationStatus:i.notificationStatus||ae.CLOSE,notificationLevel:i.notificationLevel||oe.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0,draft:a}}return{code:w.SUCCESS,data:t}}))}getAllConversationUnreadCount(e,t,n){const s=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:w.SUCCESS,data:s})}getTotalUnreadCountByLevels(e,t,n=!1){let s=0;if(e.includes(V.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});for(const e in this._ultraGroupMap){const i=this._ultraGroupMap[e];(0===t.length||t.includes(i.notificationLevel))&&(s+=n?i.unreadMentionedCount:i.unreadMessageCount)}}return s+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:w.SUCCESS,data:s})}getConversationUnreadCount(e,t,n){var s;let i;return e===V.ULTRA_GROUP?(i=(null===(s=this._ultraGroupMap[`${n}_${t}`])||void 0===s?void 0:s.unreadMessageCount)||0,i=this._getUnreadCount(i)):i=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:w.SUCCESS,data:i})}clearConversationUnreadCount(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,this.getServerTime(),!1),Promise.resolve(w.SUCCESS)}clearAllUnreadCount(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(w.SUCCESS)}getFirstUnreadMessage(e,t){throw new Error("Method not implemented.")}getFirstUnreadMessageInfo(e,t,n){const{firstUnreadMessageUid:s,firstUnreadTime:i}=this._conversationManager.get(e,t,n);return Promise.resolve({code:w.SUCCESS,data:i&&s?{messageUId:s,sentTime:i}:null})}saveConversationMessageDraft(e,t,n,s){return this._conversationManager.setDraft(e,t,n,s),Promise.resolve(w.SUCCESS)}getConversationMessageDraft(e,t,n){const s=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:w.SUCCESS,data:s})}clearConversationMessageDraft(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(w.SUCCESS)}pullConversationStatus(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return et(w.RC_NET_UNAVAILABLE);const{_connMgr:t,currentUserId:n}=this,s=Hr.encode(ci,{time:e}),i=yield t.query(uo.pullSeAtts,n,s,hi);return this.logger.info(r.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:n,resp:i})),i.trans((e=>{const{state:t,version:n}=e,s=[];return t.forEach((e=>{const{stateItem:t,channelId:n,type:i,busChannel:r,time:o}=e,a={conversationType:i,targetId:n,channelId:r,updatedTime:o};null==t||t.forEach((({sessionStateType:e,value:t,tags:n})=>{switch(e){case xr.IsSilent:a.notificationLevel=Number(t)||oe.NOT_SET,a.notificationStatus=a.notificationLevel?ae.OPEN:ae.CLOSE;break;case xr.IsTop:a.isTop="1"===t;break;case xr.Tags:a.tags=n}a.updatedTime=o})),o&&this._conversationManager.setConversationUpdatedTime(o),i===V.ULTRA_GROUP?this._setUltraConversationStatus(a):s.push(a)})),s}))}))}_setUltraConversationStatus(e){const{targetId:t,notificationLevel:n,channelId:s,isTop:i,conversationType:r}=e;if(""===t&&void 0!==n)return void this._ultraGroupManager.addUltraGroupStatus({conversationType:r,targetId:"",channelId:"",notificationLevel:n,notificationStatus:le(n)});const o=this._ultraGroupMap[`${s}_${t}`];return o&&void 0!==n&&(o.notificationLevel=n,o.notificationStatus=le(n),this._ultraGroupManager.addUltraGroupStatus(o)),o&&void 0!==i&&(o.isTop=i),o}batchSetConversationStatus(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{currentUserId:n,_connMgr:s}=this,{code:i}=yield this._conversationManager.pushTask((i=>t(this,void 0,void 0,(function*(){const t=s.codec.encodeSetConversationStatus(e,i),r=new Zo(uo.setSeAtt,t,n),o=yield s.send(r,Ri),{code:a,data:l}=o;if(a!==w.SUCCESS)return{code:a};const u=l;this._conversationManager.setConversationUpdatedTime(u.version);const d=[];if(e.forEach((e=>{const{conversationType:t}=e;if(t!==V.ULTRA_GROUP)this._conversationManager.addStatus(Object.assign(Object.assign({},e),{updatedTime:u.version}),!0);else{const t=this._setUltraConversationStatus(e);t&&d.push(t)}})),d.length>0){let e=bt(d);e=Oh(e),this._watcher.conversation(e)}return{code:a}}))));return i}))}setConversationToTop(e,n,s,i,r){return t(this,void 0,void 0,(function*(){return this.batchSetConversationStatus([{conversationType:e,targetId:n,isTop:s,channelId:i}])}))}batchSetConversationToTop(e,n,s){return t(this,void 0,void 0,(function*(){return this.batchSetConversationStatus(e.map((e=>Object.assign(Object.assign({},e),{isTop:n}))))}))}setConversationNotificationLevel(e,n,s,i=""){return t(this,void 0,void 0,(function*(){return this.batchSetConversationStatus([{conversationType:e,targetId:n,notificationLevel:s,channelId:i}])}))}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,s,i,o){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,a=Hr.encode(bs,{nothing:1,extra:i}),l=s?uo.joinChrmR:uo.joinChrm,u=new Zo(l,a,e);this.logger.info(r.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:n,topic:uo[l]}),o);const{code:d,data:c}=yield t.send(u,Ds),h=d===w.SUCCESS?"info":"warn";if(this.logger[h](r.L_JOIN_CHATROOM_R,JSON.stringify({code:d,timestamp:(new Date).getTime()}),o),d===w.SUCCESS){const{joinTime:t,createTime:s,memberCount:r,isAllChatroomBanned:o,isCurrentUserBanned:a,isCurrentChatroomBanned:l,isCurrentChatroomInWhitelist:u}=c;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,i),this._startSyncIntervalForChrmPull(),{code:d,data:{joinTime:t,createTime:s,memberCount:r,isAllChatroomBanned:o,isCurrentUserBanned:a,isCurrentChatroomBanned:l,isCurrentChatroomInWhitelist:u}}}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:s}=e[t];this.logger.info(r.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:t,count:n,extra:s}));const i=this.logger.createTraceId(),{code:o,data:a}=yield this._joinChrm(t,n,!0,s,i),l=o===w.SUCCESS?"info":"warn";if(this.logger[l](r.L_REJOIN_CHATROOM_R,JSON.stringify({code:o,timestamp:(new Date).getTime()}),i),o===w.SUCCESS)return void this._watcher.chatroom({rejoinedRoom:Object.assign({chatroomId:t,count:n},a)});o===w.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(t),delete this._chrmsQueue[t]),this._watcher.chatroom({rejoinedRoom:{chatroomId:t,errorCode:o}})}}))}_pullChrmMsg(e,n=10,s=0){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const t=this._chrmsQueue[e],{pulling:i,timestamp:o}=t;if(i)return;t.pulling=!0;const a=s?0:o,l=Hr.encode(ws,{count:n,syncTime:a,compressioEnabled:Ba.enable()});this.logger.info(r.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,syncTime:a}));const u=new Zo(uo[uo.chrmPull],l,e),{code:d,data:c}=yield this._connMgr.send(u,Ns,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId});if(t.pulling=!1,d!==w.SUCCESS||!c)return void this.logger.warn(r.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:d,timestamp:o,messageUIds:""}));const{list:h,syncTime:_,finished:g}=c;t.timestamp=s?Math.max(_,s):_,t.queue=t.queue.filter((e=>e>_));const p=[],E=[],f=[];h.forEach((e=>{e.sentTime<o||(e.sentTime>=this._connMgr.getConnectedTime()&&this._writeMessagesLog(V.CHATROOM,e.messageUId)&&E.push(e.messageUId),p.push(e.messageUId),f.push(e))})),this._batchMessage(f),this.logger.info(r.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:d,timestamp:o,messageUIds:p.join(",")})),E.length>0&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:E.join(",")})),g?t.queue.length>0&&(t.queue.length=0,this._pullChrmMsg(e)):this._pullChrmMsg(e)}))}joinChatroom(e,n,s,i){return t(this,void 0,void 0,(function*(){const{code:t}=yield this._joinChrm(e,n,!1,s,i);return t}))}joinExistChatroom(e,n,s,i){return t(this,void 0,void 0,(function*(){return this._joinChrm(e,n,!0,s,i)}))}quitChatroom(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{_connMgr:t}=this;delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e);const n=Hr.encode(bs,{nothing:1}),{code:s}=yield t.query(uo.exitChrm,e,n);return s}))}getChatroomInfo(e,n,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,i=t.codec.encodeGetChatRoomInfo(n,s),r=new Zo(uo[uo.queryChrmI],i,e),o=yield t.send(r,Ys),{code:a,data:l}=o;return a!==w.SUCCESS?{code:a}:{code:a,data:l}}))}getChatroomHistoryMessages(e,n,s,i){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,r=t.codec.encodeGetHistoryMsg(e,{timestamp:n,count:s,order:i}),o=new Zo(uo.qryCHMsg,r,e),a=yield t.send(o,js,{conversation:{targetId:e}}),{code:l}=a,u=a.data;return l!==w.SUCCESS?{code:l}:{code:l,data:{list:u.list,hasMore:u.hasMore}}}))}_modifyChatroomKV(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{_connMgr:t,currentUserId:s}=this,i=this._chrmEntryHandler.getVersion(e,n.key);n.version=null==i?this.getServerTime():i;const r=t.codec.encodeModifyChatRoomKV(e,n,s),o=n.type===M.UPDATE?uo.setKV:uo.delKV,a=new Zo(o,r,e),l=yield t.send(a,Ds),{code:u}=l;return u===w.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[n],syncTime:this.getServerTime()},s),u):u}))}_chatroomKVStoreNotAllSuccess(e,t){const n=t.data;let s=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((e=>{const t=s.findIndex((t=>e.key===t.key));-1!==t&&s.splice(t,1)})),s}_modifyChatroomKVS(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:t,currentUserId:s}=this,{entries:i}=n;i.forEach((t=>{const n=this._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?this.getServerTime():n}));const r=t.codec.encodeModifyChatRoomKVS(e,n,s),o=n.type===M.UPDATE?uo.setKVS:uo.delKVS,a=new Zo(o,r,e),l=yield t.send(a,oi),{code:u}=l;let d;if(-1!==[w.SUCCESS,w.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(u)){let t=[];const i=Object.assign({},n);if(delete i.entries,n.entries.forEach((e=>{t.push(Object.assign(Object.assign({},e),i))})),u===w.CHATROOM_KV_STORE_NOT_ALL_SUCCESS){d=l.data.errorKeys,t=this._chatroomKVStoreNotAllSuccess(t,l)}this._chrmEntryHandler.setLocal(e,{kvEntries:t,syncTime:(new Date).getTime()},s)}return{code:u,data:d}}))}setChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){return n.type=M.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=M.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=M.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=M.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=M.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=M.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:w.SUCCESS,data:t};if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:s}=this,i=s.codec.encodePullChatRoomKV(0),r=new Zo(uo[uo.pullKV],i,e),o=yield s.send(r,ri),{data:a}=o;if(a&&a.kvEntries&&a.kvEntries.length){const e=a.kvEntries.find((e=>e.key===n));if(void 0!==e)return{code:w.SUCCESS,data:null==e?void 0:e.value}}return{code:w.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:w.SUCCESS,data:t};if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:n}=this;t={};const s=n.codec.encodePullChatRoomKV(0),i=new Zo(uo[uo.pullKV],s,e),r=yield n.send(i,ri),{data:o}=r;return o&&o.kvEntries&&o.kvEntries.length&&o.kvEntries.forEach((e=>{e.key&&(t[e.key]=e.value||"")})),{code:w.SUCCESS,data:t}}))}pullChatroomEntry(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:t,currentUserId:s}=this;if(!this._chrmsQueue[e])return{code:w.RC_CHATROOM_NOT_EXIST};const i=t.codec.encodePullChatRoomKV(n),o=new Zo(uo[uo.pullKV],i,e);this.logger.info(r.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:n}));const{code:a,data:l}=yield t.send(o,ri);if(!this._chrmsQueue[e])return{code:w.RC_CHATROOM_NOT_EXIST};const u=a===w.SUCCESS?"info":"warn";if(this.logger[u](r.L_PULL_CHATROOM_KV_R,JSON.stringify({code:a,timestamp:n})),a===w.SUCCESS&&l){const{kvEntries:t}=l,n=[];return t.length>0&&(t.forEach((t=>{const{key:s,value:i,type:r,timestamp:o,userId:a}=t;this._chrmEntryHandler.getValue(e,s)===i&&a===this.getCurrentUserId()||n.push({key:s,value:i,type:r,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,l,s),n.length>0&&this._watcher.chatroom({updatedEntries:n})),{code:a,data:l}}return{code:a}}))}_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 s=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!s)return!1;const i=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 r=0;switch(e){case V.PRIVATE:r=s.private;break;case V.GROUP:r=s.group;break;case V.CHATROOM:r=s.chatroom;break;case V.ULTRA_GROUP:r=s.ultraGroup}return!!r&&i%(1/r)==0}sendMessage(e,n,s,i,o){var a;return t(this,void 0,void 0,(function*(){s=this._handleInnerMsgOptions(e,n,s),s=this._handleMsgProperties(s,!0);let t=!1;[V.PRIVATE,V.GROUP].includes(e)&&(s.isStatusMessage||(null===(a=this._customMessageType[s.messageType])||void 0===a?void 0:a.isStatusMessage))&&(t=!0);const l=t?(u=e,{[V.PRIVATE]:uo.ppMsgS,[V.GROUP]:uo.pgMsgS}[u]):(e=>({[V.PRIVATE]:uo.ppMsgP,[V.GROUP]:uo.pgMsgP,[V.CHATROOM]:uo.chatMsg,[V.CUSTOMER_SERVICE]:uo.pcMsgP,[V.RTC_ROOM]:uo.prMsgS,[V.SYSTEM]:uo.pbMsgP}[e]))(e)||uo.ppMsgP;var u;t&&(s.isPersited=!1,s.isCounted=!1);const d=s.messageId?s.messageId:zt();s.messageId=d;const c=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:n},s),h=new Xo(uo[l],c,e===V.SYSTEM?this.currentUserId:n);if(h.setHeaderQos(_o.AT_LEAST_ONCE),t)return this._connMgr.sendOnly(h),{code:w.SUCCESS,data:Nh(e,n,Object.assign({},s),"",0,this.currentUserId,d)};const _=this._connMgr.getCrtServerTime(),g=Nh(e,n,Object.assign(Object.assign({},s),{isStatusMessage:t}),"",_,this.currentUserId,d);null==i||i(d),this.logger.info(r.L_SEND_MSG_T,JSON.stringify({messageType:s.messageType,conversationType:e,targetId:n,channelId:s.channelId}),o);const p=Date.now(),{code:E,data:f}=yield this._connMgr.send(h);if(E!==w.SUCCESS)return this.logger.warn(r.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:g.messageUId,messageId:g.messageId}),o),this._writeMessagesLog(e)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({channel:e,start_ts:p,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),g.sentStatus=Q.FAILED,{code:E,data:g};this.logger.info(r.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:null==f?void 0:f.messageUId,messageId:null==f?void 0:f.messageId}),o);const I=f;return this._sendMessageSuccessHandle(g,I),this._writeMessagesLog(e,I.messageUId)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({msg_id:I.messageUId,channel:e,start_ts:p,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),{code:w.SUCCESS,data:g}}))}_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:s,conversationType:i,targetId:r,channelId:o,sentTime:a,content:l,messageDirection:u}=e;if(s===F.READ_RECEIPT_REQUEST){const{messageUId:e}=l;null===(n=this._readReceiptManager)||void 0===n||n.insert({conversationType:i,targetId:r,channelId:o},e,u,a)}if(s===F.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:i,targetId:r,channelId:o},e)}))}}recallMsg(e,n){var s;return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:i}=e,r=e.channelId||"",{user:o,extra:a,isDelete:l,directionalUserIdList:u,disableUpdateLastMessage:d,messageUId:c,sentTime:h}=n,_={conversationType:i,targetId:t,messageUId:c,sentTime:h,channelId:r,isDelete:l||!1,isAdmin:n.isAdmin};o&&(_.user=o),a&&(_.extra=a);const g={content:_,messageType:"RC:RcCmd",disableNotification:null==n?void 0:n.disableNotification,pushConfig:null==n?void 0:n.pushConfig,pushContent:(null===(s=n.pushConfig)||void 0===s?void 0:s.pushContent)||n.pushContent||"",channelId:r,disableUpdateLastMessage:d};[V.GROUP,V.ULTRA_GROUP].includes(i)&&u&&(g.directionalUserIdList=u);const p=this._connMgr.codec.encodeUpMsg({conversationType:i,targetId:t},g),E=new Xo(uo.recallMsg,p,this.currentUserId);E.setHeaderQos(_o.AT_LEAST_ONCE);const f=yield this._connMgr.send(E);if(!f.isOk)return f.wipe();const I=f.data;if(i!==V.ULTRA_GROUP){const e=`Cmd:${c}`;I.messageUId=e}const R=Nh(i,t,Object.assign(Object.assign({},g),{isPersited:!0}),I.messageUId,I.timestamp,this.currentUserId);return i===V.ULTRA_GROUP?(this._ultraMsgMap[I.messageUId]=I.timestamp,this._updateUltraGroupWhenRecallMsg(t,r,c)):(this._sendMessageStore.setMessage(I.messageUId,I.timestamp),this._conversationManager.setConversationCacheByMessage(R,!0)),Xe(R)}))}sendReadReceiptMessage(e,n,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeReadReceipt(n,s),i=new Zo(uo[uo.rrMsg],t,e);return this._connMgr.send(i)}))}getMessageReader(e,n,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeMessageReader(n,s),i=new Zo(uo[uo.rrList],t,e);return this._connMgr.send(i,Ci)}))}sendReadReceiptMessageV4(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeReadReceiptMsg(e,n,s),i=new Xo(uo[uo.sendMsgRead],t,e.targetId);return this._connMgr.send(i)}))}getMessageReadReceiptV4(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeReceiptQryReq(e,n),s=new Zo(uo[uo.qryMsgRead],t,e.targetId);return this._connMgr.send(s,Qi)}))}batchGetMessageReadReceiptInfoV4(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeReceiptCntQryReq(e,n),s=new Zo(uo[uo.qryMsgReadCntBatch],t,e.targetId),{code:i,data:r}=yield this._connMgr.send(s,$i),{result:o}=r||{result:[]};return i===w.SUCCESS&&o?{code:i,data:o.map((t=>Object.assign({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)))}:{code:i}}))}updateConversationReadTime(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeSessionMsgReadInput(e,n),s=new Xo(uo[uo.updRTime],t,this.currentUserId);return this._connMgr.send(s)}))}pullUserSettings(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this.getNaviInfoFromCache(),n=Hr.encode(ui,{version:e,ipType:t.ipType||0}),s=new Zo(uo.pullUS,n,this.currentUserId),{code:i,data:r}=yield this._connMgr.send(s,di);return i===w.SUCCESS&&this._naviChangeHandler(r),{code:i,data:r}}))}_naviChangeHandler(e){var t;if(!e)return void this.logger.warn(r.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}));const{settings:n}=e,s=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(!s)return;const i=this._connMgr.getToken();this.navi.updateVoipCallInfo(i,s);const o=this.navi.getNaviInfoFromCache(i);this._watcher.onNaviDataChange(Object.assign({},o))}getFileToken(e,n,s,i,r,o){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};let t;t=i&&"uploads"!==i?n||"":Wt(e,n);const a=this.getNaviInfoFromCache(),l=tn(a,this.logger);let u="";l||(u=JSON.stringify({uploadDomain:l}));const d=Hr.encode(Ms,{type:e,key:t,httpMethod:s||"",queryString:i||"",url:r||"",ext:u,size:o?Math.ceil(o):0,ipType:a.ipType||0});return(yield this._connMgr.query(uo.qnTkn,this.currentUserId,d,Ls)).trans((e=>Object.assign(Object.assign({},e),{fileName:t,downloadAuthInfo:e.downloadAuthInfo?JSON.parse(e.downloadAuthInfo):null})))}))}getFileUrl(e,n,s,r){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this.getNaviInfoFromCache();let o,a="",l="";n===i.QINIU?o=uo.qnUrl:n===i.AWS?o=uo.s3Url:n===i.STC?o=uo.stcUrl:n===i.MINIO?(o=uo.minioUrl,a=tn(t,this.logger),l=JSON.stringify({url:a})):o=uo.aliUrl;const u=Hr.encode(Us,{type:e,key:s,fileName:r,ext:l,size:-1,ipType:t.ipType||0});return(yield this._connMgr.query(o,this.currentUserId,u,Ps)).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,s,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}}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),s=new Zo(uo[uo.addSeTag],t,this.currentUserId),{code:i,data:r}=yield this._connMgr.send(s,li);if(i===w.SUCCESS&&r){const{version:t}=r;this._userSettingManager.addTag([Object.assign(Object.assign({},e),{createdTime:t})],t)}return{code:i}})))):{code:w.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),s=new Zo(uo[uo.delSeTag],t,this.currentUserId),{code:i,data:r}=yield this._connMgr.send(s,li);if(i===w.SUCCESS&&r){const{version:t}=r;this._userSettingManager.deleteTag([e],t)}return{code:i}})))):{code:w.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),s=new Zo(uo[uo.addSeTag],t,this.currentUserId),{code:i,data:r}=yield this._connMgr.send(s,li);if(i===w.SUCCESS){const{version:t}=r;this._userSettingManager.addTag([e],t)}return{code:i}})))):{code:w.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:w.SUCCESS,data:e}}))}addTagForConversations(e,n){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((s=>t(this,void 0,void 0,(function*(){if(!this._userSettingManager.getTagById(e))return{code:w.TAG_NOT_EXIST};const t=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],n,s),i=new Zo(uo[uo.addTag],t,this.currentUserId),{code:r,data:o}=yield this._connMgr.send(i,Ri);if(r===w.SUCCESS&&o){const t={};t[e]={},n.forEach((e=>{this._conversationManager.addTagStatus(e.conversationType,e.targetId,t,e.channelId)})),this._conversationManager.setConversationUpdatedTime(o.version)}return{code:r}})))):{code:w.RC_NET_UNAVAILABLE}}))}removeTagForConversations(e,n){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((s=>t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],n,s),i=new Zo(uo[uo.delTag],t,this.currentUserId),{code:r,data:o}=yield this._connMgr.send(i,Ri);return r===w.SUCCESS&&o&&(n.forEach((t=>{this._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),this._conversationManager.setConversationUpdatedTime(o.version)),{code:r}})))):{code:w.RC_NET_UNAVAILABLE}}))}removeTagsForConversation(e,n){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((s=>t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,o=n.map((e=>({tagId:e}))),a=this._connMgr.codec.encodeUpdateConversationTag(o,[e],s),l=new Zo(uo[uo.delTag],a,this.currentUserId),{code:u,data:d}=yield this._connMgr.send(l,Ri);return u===w.SUCCESS&&d&&(this._conversationManager.deleteTagStatus(t,i,n,r),this._conversationManager.setConversationUpdatedTime(d.version)),{code:u}})))):{code:w.RC_NET_UNAVAILABLE}}))}getConversationListByTag(e,n,s){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{currentUserId:t,_connMgr:i}=this,r=i.codec.encodeOldConversationList({count:s,type:V.PRIVATE,startTime:n}),o=new Zo(uo.qryRelationR,r,t),a=yield i.send(o,ks,{currentUserId:t,connectedTime:i.getConnectedTime()}),{code:l,data:u}=a;if(l!==w.SUCCESS)return{code:l};return{code:l,data:this._conversationHasTagFilter(e,null==u?void 0:u.list)}}))}_conversationHasTagFilter(e,t){let n=[],s=[];function i(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}t.forEach((t=>{const{conversationType:i,targetId:r,channelId:o}=t,{hasMentioned:a,mentionedInfo:l,lastUnreadTime:u,notificationStatus:d,isTop:c,tags:h,unreadMessageCount:_}=this._conversationManager.get(i,r,o),g=h&&h[e];if(g){const e=Object.assign(Object.assign({},t),{hasMentioned:a,mentionedInfo:l,lastUnreadTime:u,notificationStatus:d,isTop:c,unreadMessageCount:_});g.isTop?n.push(Object.assign(Object.assign({},e),{isTopInTag:!0})):s.push(Object.assign(Object.assign({},e),{isTopInTag:!1}))}})),n.sort(i),s.sort(i);return[...n,...s]}getUnreadCountByTag(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._conversationManager.getUnreadCountByTag(e,n);return{code:w.SUCCESS,data:t}}))}setConversationStatusInTag(e,n,s){return t(this,void 0,void 0,(function*(){return this._isConnected?this._conversationManager.pushTask((i=>t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:r,channelId:o}=n,{isTop:a}=s,l=[{tagId:e,isTop:a}],u=this._conversationManager.get(r,t,o);if(!u.tags||!Object.hasOwnProperty.call(u.tags,e))return{code:w.NO_TAG_IN_CONVER};const d=this._connMgr.codec.encodeUpdateConversationTag(l,[n],i),c=new Zo(uo[uo.addTag],d,this.currentUserId),{code:h,data:_}=yield this._connMgr.send(c,Ri);if(h===w.SUCCESS&&_){const n={};n[e]={},a&&(n[e].isTop=!0),this._conversationManager.addTagStatus(r,t,n,o),this._conversationManager.setConversationUpdatedTime(_.version)}return{code:h}})))):{code:w.RC_NET_UNAVAILABLE}}))}getTagsForConversation(e){var n;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),s=this._userSettingManager.getTagsInfo(),i=[];if(t.tags)for(const e in t.tags)i.push({tagId:e,tagName:null===(n=s[e])||void 0===n?void 0:n.tagName});return{code:w.SUCCESS,data:i}}))}getBlockConversationList(){const e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:w.SUCCESS,data:e})}getTopConversationList(e,t){const n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:w.SUCCESS,data:n})}getUnreadConversationList(e){return t(this,void 0,void 0,(function*(){const t=this._conversationManager.getUnreadConversationList(e);return Promise.resolve({code:w.SUCCESS,data:t})}))}getUnreadMentionedCount(e){var t;let n;return n=e.conversationType===V.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:w.SUCCESS,data:n})}getAllUnreadMentionedCount(){const e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:w.SUCCESS,data:e})}getConversationNotificationLevel(e,t,n){if(!this._isUltraGroupListExist&&e===V.ULTRA_GROUP)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});let s;if(s=e===V.ULTRA_GROUP?this._ultraGroupManager.get(V.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n),!s)return Promise.resolve({code:w.SUCCESS,data:oe.NOT_SET});let i=s.notificationLevel;return pt(s.notificationLevel)&&!pt(s.notificationStatus)&&(i=ae.OPEN===s.notificationStatus?1:0),Promise.resolve({code:w.SUCCESS,data:i})}getConversationNotificationStatus(e,t,n){let s;return s=e===V.ULTRA_GROUP?this._ultraGroupManager.get(V.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n),s?Promise.resolve({code:w.SUCCESS,data:ue(s.notificationLevel||oe.NOT_SET)}):Promise.resolve({code:w.SUCCESS,data:ae.CLOSE})}setConversationTypeNotificationLevel(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{currentUserId:t,_connMgr:s}=this,i=this._conversationManager.getConversationUpdatedTime();return(yield s.query(uo.setTypeUnpush,t,Hr.encode(Ti,{type:e,unpushLevel:n,version:i}),mi)).trans((t=>{var s;const{version:i}=t;this._conversationManager.setConversationUpdatedTime(i),e===V.ULTRA_GROUP?null===(s=this._ultraGroupManager)||void 0===s||s.addUltraGroupStatus({conversationType:e,targetId:"",notificationLevel:n,channelId:""}):this._conversationManager.addStatus({conversationType:e,targetId:"",channelId:"",updatedTime:i,notificationLevel:n},!0)}))}))}getConversationTypeNotificationLevel(e){if(e===V.ULTRA_GROUP){const t=this._ultraGroupManager.get(e,"","");return Promise.resolve({code:w.SUCCESS,data:t.notificationLevel||0})}const t=this._conversationManager.get(e,"","");return Promise.resolve({code:w.SUCCESS,data:t.notificationLevel||0})}getRemoteHistoryMessages(e,t,n,s,i,r){return this.getHistoryMessage(e,t,n,s,i,r)}getUltraGroupList(e){return t(this,void 0,void 0,(function*(){const{targetId:t,channelType:n}=e;if(!this._isUltraGroupListExist)return{code:w.METHOD_NOT_AVAILABLE};let s=Object.values(this._ultraGroupMap).filter((e=>!(e.targetId!==t&&t||e.channelType!==n&&at(n))));s=s.map((e=>{let{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:s}=e;return t=this._getUnreadCount(t),n=this._getUnreadCount(n),s=this._getUnreadCount(s),Object.assign(Object.assign({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:s})})),s=Oh(s);const i=bt(s);return{code:w.SUCCESS,data:i}}))}_getUnreadCount(e){return e>999?999:e}getBlockUltraGroupList(){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});const e=Object.values(this._ultraGroupMap),t=[];return e.forEach((e=>{(e.notificationStatus===ae.OPEN||e.notificationLevel>0)&&t.push({conversationType:V.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:w.SUCCESS,data:t})}getTopUltraGroupList(){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});const e=Object.values(this._ultraGroupMap),t=[];return e.forEach((e=>{!0===e.isTop&&t.push({conversationType:V.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:w.SUCCESS,data:t})}getUltraGroupUnreadMentionedCountByTargetId(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});let n=0;for(const s in this._ultraGroupMap){s.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[s].notificationLevel)||(n+=this._ultraGroupMap[s].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:w.SUCCESS,data:n})}getUltraGroupUnreadCountByTargetId(e,t){let n=0;for(const s in this._ultraGroupMap){const i=this._ultraGroupMap[s];i.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[s].notificationLevel)||(n+=i.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:w.SUCCESS,data:n})}getUltraGroupUnreadInfoList(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});const t=[];return Object.keys(this._ultraGroupMap).forEach((n=>{const s=this._ultraGroupMap[n];e.includes(s.targetId)&&t.push({type:s.conversationType,targetId:s.targetId,channelId:s.channelId,unreadMessageCount:this._getUnreadCount(s.unreadMessageCount),mentionedCount:this._getUnreadCount(s.unreadMentionedCount),mentionedMeCount:this._getUnreadCount(s.unreadMentionedMeCount),notificationLevel:s.notificationLevel})})),Promise.resolve({code:w.SUCCESS,data:t})}getAllUltraGroupUnreadCount(e=!1){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.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:w.SUCCESS,data:t})}clearUltraUnreadcount(e,n=""){return t(this,void 0,void 0,(function*(){if(!this._isUltraGroupListExist)return Promise.resolve(w.METHOD_NOT_AVAILABLE);if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const t=this.getServerTime(),s=this._connMgr.codec.encodeClearUnreadCount({conversationType:V.ULTRA_GROUP,targetId:e,channelId:n},{timestamp:t}),i=new Xo(uo[uo.updUgRTime],s,this.currentUserId);i.setHeaderQos(_o.AT_LEAST_ONCE);const{code:r}=yield this._connMgr.send(i);if(r===w.SUCCESS){const s=this._ultraGroupMap[`${n}_${e}`];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=t),s&&s.firstUnreadMessage&&(s.firstUnreadMessage=null)}return r}))}_getUltraGroupList(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return;const t=this._connMgr.codec.encodeUltraGroup(e,!1),n=new Zo(uo[uo.pullUgSes],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,ks,{currentUserId:this.currentUserId,conversationType:V.ULTRA_GROUP});if(s!==w.SUCCESS||!i){this.logger.warn(r.L_ULTRA_SYNC_DONE_S,`Pull ultra group conversation failured, code: ${s}, try again`);const t=setTimeout((()=>{this._getUltraGroupList(e),clearTimeout(t)}),3e3);return}const{list:o,isFinished:a}=i;if(o.forEach((e=>{e.notificationStatus=ae.CLOSE,e.notificationLevel=oe.NOT_SET,e.isTop=!1,this._ultraGroupMap[`${e.channelId}_${e.targetId}`]=e,this._ultraGroupManager.addUltraGroupStatus(e)})),!1===a){const e=o.length>0&&o[o.length-1].versionTime||0;this._getUltraGroupList(e)}else{this.logger.info(r.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success");const{code:e,data:t}=yield this.pullConversationStatus(0);e!==w.SUCCESS&&this.logger.warn(r.O,`pullConversationStatus fail code: ${e}, data: ${t}`);let n=Object.values(this._ultraGroupMap);n=Oh(n),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(bt(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!==w.SUCCESS||!t)return this.logger.warn(r.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),void setTimeout((()=>{this._notificationOnline()}),3e3);this.logger.info(r.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 Zo(uo[uo.pullUgMsg],t,this.currentUserId),s=this.logger.createTraceId();this.logger.info(r.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),s);const{code:i,data:o}=yield this._connMgr.send(n,Ns,{currentUserId:this.currentUserId,conversation:{conversationType:V.ULTRA_GROUP}});if(i===w.SUCCESS&&o){const{list:t,syncTime:n}=o,a=t.map((e=>e.messageUId)).join(",");this.logger.info(r.L_PULL_ULTRA_MSG_R,JSON.stringify({code:i,messageUIds:a,timestamp:e,syncTime:n}),s)}else this.logger.warn(r.L_PULL_ULTRA_MSG_R,JSON.stringify({code:i,timestamp:e}),s);return{code:i,data:o}}))}_getUltraGroup(e,t,n){var s,i,r;const{targetId:o,messageType:a,channelId:l,isCounted:u,channelType:d,sentTime:c,senderUserId:h,content:_,isMentioned:g}=e,p=this._ultraGroupMap[`${l}_${o}`],E=p||{conversationType:V.ULTRA_GROUP,targetId:o,channelId:l,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:ae.CLOSE,notificationLevel:oe.NOT_SET,isTop:!1};return u&&h!==this.currentUserId&&a!==F.RECALL&&(E.unreadMessageCount+=1,E.unreadMentionedCount+=t,E.firstUnreadMessage||(E.firstUnreadMessage={sentTime:c}),g&&(null===(s=null==_?void 0:_.mentionedInfo)||void 0===s?void 0:s.type)!==B.ALL&&(null===(r=null===(i=null==_?void 0:_.mentionedInfo)||void 0===i?void 0:i.userIdList)||void 0===r?void 0:r.includes(this.currentUserId))&&(E.unreadMentionedMeCount+=1)),E.versionTime=n,E.latestMessage=e,E.channelType=d,p||(this._ultraGroupMap[`${l}_${o}`]=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!==w.SUCCESS||!n)return;const{list:s,syncTime:i,finished:o}=n,a={},l=[];if(s.forEach((e=>{var t,n,s;const{targetId:r,content:o,messageUId:u,channelId:d,isMentioned:c}=e;if(this._ultraMsgMap[u])return void delete this._ultraMsgMap[u];let h=0;c&&((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===B.ALL||(null===(s=null===(n=null==o?void 0:o.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===s?void 0:s.includes(this.currentUserId)))&&(h=1);const _=this._getUltraGroup(e,h,i);a[`${d}_${r}`]=_,this._ultraGroupManager.addUltraGroupStatus(_),l.push(e)})),Object.keys(a).length>0){this.logger.debug(r.O,"notice ultragroups");let e=Object.values(a);e=Oh(e),this._watcher.conversation(bt(e))}this.logger.debug(r.O,"notice ultragroup message"),this._batchMessage(l),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((e=>e>i)),this._lastSyncUltraMsgTimeStamp=i,o?this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(i)):this._syncUltraMsg(i)}))}sendUltraMessage(e,n,s,i){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};"RC:SRSMsg"===n.messageType&&this.logger.warn(r.O,"ultra group -> direction message convert to message");const t=(n=this._handleMsgProperties(n,!0)).messageId?n.messageId:zt();n.messageId=t;const o=this._connMgr.codec.encodeUpMsg({conversationType:V.ULTRA_GROUP,targetId:e},n),a=new Xo(uo[uo.ugMsg],o,e);a.setHeaderQos(_o.AT_LEAST_ONCE);const l=this._connMgr.getCrtServerTime(),u=Nh(V.ULTRA_GROUP,e,Object.assign({},n),"",l,this.currentUserId,t);s&&s(t),this.logger.info(r.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:V.ULTRA_GROUP,targetId:e,channelId:n.channelId}),i);const d=Date.now(),{code:c,data:h}=yield this._connMgr.send(a);if(c!==w.SUCCESS)return this.logger.warn(r.L_SEND_MSG_R,JSON.stringify({code:c,messageUId:u.messageUId,messageId:u.messageId}),i),this._writeMessagesLog(V.ULTRA_GROUP)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({channel:V.ULTRA_GROUP,start_ts:d,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:c})),u.sentStatus=Q.FAILED,{code:c,data:u};this.logger.info(r.L_SEND_MSG_R,JSON.stringify({code:c,messageUId:null==h?void 0:h.messageUId,messageId:null==h?void 0:h.messageId}),i);const _=h;this._writeMessagesLog(V.ULTRA_GROUP,_.messageUId)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({msg_id:_.messageUId,channel:V.ULTRA_GROUP,start_ts:d,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:c})),u.sentTime=_.timestamp,u.messageUId=_.messageUId,this._ultraMsgMap[_.messageUId]=_.timestamp;const g=n.channelId||"";let p=this._ultraGroupMap[`${g}_${e}`];return p?(p.latestMessage=u,at(p.channelType)&&(u.channelType=p.channelType)):(p={conversationType:V.ULTRA_GROUP,targetId:e,channelId:g,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:ae.CLOSE,notificationLevel:oe.NOT_SET,isTop:!1},this._ultraGroupMap[`${g}_${e}`]=p,this._ultraGroupManager.addUltraGroupStatus(p)),this._watcher.conversation(bt([p])),{code:c,data:u}}))}sendUltraGroupTypingStatus(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{conversationType:t,channelId:s,targetId:i}=e,r=this._connMgr.codec.encodeOperateStatus(i,t,s||"",n||0),o=new Xo(uo[uo.operate],r,i);o.setHeaderQos(_o.AT_LEAST_ONCE);const{code:a}=yield this._connMgr.send(o);return a!==w.SUCCESS?{code:a,msg:w[a]}:{code:a}}))}getUltraGroupMessageListByMessageUId(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};if(e.messages&&e.messages.length<1)return{code:w.MSG_LIMIT_ERROR};if(e.messages&&e.messages.length>20)return{code:w.MSG_LIMIT_ERROR};const t={};e.messages.forEach((e=>{t[e.messageUId]=void 0}));const n=this._connMgr.codec.encodeMsgQuery(e),s=new Zo(uo[uo.qryMsg],n,this.currentUserId);s.setHeaderQos(_o.AT_LEAST_ONCE);const{code:i,data:r}=yield this._connMgr.send(s,Gi,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId});if(i!==w.SUCCESS)return{code:i,msg:w[i]};const{list:o}=r||{};return Array.isArray(o)&&o.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,Bi),{conversationType:n,info:s,summary:i}=t;this.logger.debug(r.O,`s_opNtf -> type: ${n}, info: ${s}, summary: ${i}`),this._watcher.operateStatus(t)}expandUltraMessage(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),n=new Zo(uo[uo.upMsgEx],t,e.targetId);n.setHeaderQos(_o.AT_LEAST_ONCE);const{code:s}=yield this._connMgr.send(n);return s!==w.SUCCESS?{code:s,msg:w[s]}:{code:s}}))}modifyMessage(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),n=new Zo(uo[uo.modifyMsg],t,e.targetId);n.setHeaderQos(_o.AT_LEAST_ONCE);const{code:s,data:i}=yield this._connMgr.send(n);if(s!==w.SUCCESS)return{code:s,msg:w[s]};const r=i;return this._ultraMsgMap[r.messageUId]=r.timestamp,{code:s}}))}_handleEventChangeList(e){const t={Group:{map:{},types:Mh},Friend:{map:{},types:Uh}},n=(e,t,n)=>{e[t]||(e[t]=[]),e[t].push(n)};e.forEach((e=>{const{changeType:s}=e;for(const i in t)if(t[i].types.includes(s)){n(t[i].map,s,e);break}}));const s={Group:this._processChangeMapGroup.bind(this),Friend:this._processChangeMapFriend.bind(this)};for(const e in t)Object.keys(t[e].map).length>0&&s[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 Zo(uo[uo.qryMsgChange],t,this.currentUserId);n.setHeaderQos(_o.AT_LEAST_ONCE);const{code:s,data:i}=yield this._connMgr.send(n,wi);if(this._isPullingUltraChangeMessage=!1,s!==w.SUCCESS||!i)return;const{hasNext:r,list:o}=i,a=(null==i?void 0:i.syncTime)||0;this._handleUltraChangeList(o);const l=this._pullUltraChangeMessageQue.filter((e=>e>a));this._pullUltraChangeMessageQue.length=0,this._pullUltraChangeMessageQue.push(...l),r?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:s,MSG_EXPANSION:i,MSG_MODIFY:r,USER_GROUP_CHANGE:o}=q;t[n]&&this._handleUltraChannelChange(t[n]),t[s]&&this._handleMsgRecall(t[s]),t[i]&&this._handleMsgUpdate(t[i]),t[r]&&this._handleMsgUpdate(t[r]),t[o]&&this._handleUserGroupStatus(t[o])}_processChangeMapGroup(e){const{GROUP_OPERATION:t,GROUP_PROFILE_CHANGE:n,GROUP_APPLICATION_INVITATION:s,GROUP_FOLLOW_USER_CHANGE:i}=A;e[t]&&this._handleGroupOperation(e[t]),e[n]&&this._handleGroupProfileChange(e[n]),e[s]&&this._handleApplication(e[s]),e[i]&&this._handleFollowUserChange(e[i])}_processChangeMapFriend(e){(e[h.FRIEND_APPLICATION]||[]).forEach((e=>{var t,n,s,i,r,o,a,l,u,d;const{subChangeType:h,businessId:g,time:p,eventData:E}=e,{FRIEND_APPLY:f,FRIEND_REFUSE:I,FRIEND_USER_INFO:R,FRIENDS_INPUT:T,FRIEND_CLEAR:m,FRIEND_INFO_CHANGE:S,FRIEND_INFO_CHANGE_SYNC:C}=_;switch(h){case f:case I:{const e=h===f?c.UNHANDLED:c.REFUSED;null===(n=(t=this._watcher).friendApplicationStatusChanged)||void 0===n||n.call(t,{userId:g,applicationType:E.applyType,applicationStatus:e,directionType:E.friendType,operationTime:p,extra:E.info||""});break}case R:null===(i=(s=this._watcher).friendAdd)||void 0===i||i.call(s,{userId:g,name:E.name,portraitUri:E.portraitUrl,directionType:E.friendType,operationTime:p});break;case T:null===(o=(r=this._watcher).friendDelete)||void 0===o||o.call(r,{userIds:E.targetId,directionType:E.type,operationTime:p});break;case m:null===(l=(a=this._watcher).friendCleared)||void 0===l||l.call(a,p);break;case S:break;case C:null===(d=(u=this._watcher).friendInfoChangedSync)||void 0===d||d.call(u,{userId:g,remark:E.remarkname,extProfile:E.extProfile,operationTime:p})}}))}_handleGroupOperation(e){e.forEach((e=>{var t,n;const{subChangeType:s,businessId:i,time:r,eventData:o}=e,{optUserInfo:a,channelInfo:l,userInfos:u}=o;let d={groupId:i,operation:s,operationTime:r};a&&([d.operatorInfo]=Yt([a])),s===T.CREATE&&([d.groupInfo]=Ft([l])),[T.CREATE,T.DISMISS].includes(s)||(d.memberInfos=Yt(u)),null===(n=(t=this._watcher).groupOperation)||void 0===n||n.call(t,d)}))}_handleGroupProfileChange(e){e.forEach((e=>{var t,n,s,i,r,o;const{businessId:a,time:l,eventData:u,subChangeType:d,secondaryId:c}=e;switch(d){case m.GROUP_INFO_CHANGE:{const[e]=Yt([u.optUserInfo]),[s]=xt([u.channelInfo]),[i]=u.channelFullInfo?xt([u.channelFullInfo]):[void 0];null===(n=(t=this._watcher).groupInfoChanged)||void 0===n||n.call(t,{operatorInfo:e,groupInfo:s,changedGroupInfo:s,operationTime:l,fullGroupInfo:i});break}case m.MEMBER_PROFILE_CHANGE:{const[e]=Yt([u.optUserInfo]),t=Yt(u.userInfos)[0];null===(i=(s=this._watcher).groupMemberInfoChanged)||void 0===i||i.call(s,{groupId:a,operatorInfo:e,memberInfo:t,operationTime:l});break}case m.GROUP_REMARK_DELETE:case m.GROUP_REMARK_SET:{const e=d===m.GROUP_REMARK_SET?S.ADD:S.REMOVE;null===(o=(r=this._watcher).groupRemarkChangedSync)||void 0===o||o.call(r,{groupId:a,operationType:e,operationTime:l,groupRemark:c});break}}}))}_handleApplication(e){let t=[];e.forEach((e=>{const{eventData:n}=e,{statusInfo:s}=n;t=jt(s),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:s,businessId:i,time:r,userGroupIds:o}=e,a=1===s?S.ADD:S.REMOVE;null===(n=(t=this._watcher).groupFollowsChangedSync)||void 0===n||n.call(t,{groupId:i,operationType:a,operationTime:r,userIds:o})}))}_handleUltraChannelChange(e){const t=[],n=[],s=[];e.forEach((e=>{const{subChangeType:i,targetId:r,channelId:o,sendTime:a,operatorId:l}=e,u=`${o}_${r}`,d=this._ultraGroupMap[u];if(!d)return;const{PUBLIC_TO_PRIVATE:c,PRIVATE_TO_PUBLIC:h,PUBLIC_TO_PRIVATE_USER_NOT_IN:_,CHANNEL_DELETE:g,CHANNEL_USER_KICKED:p}=Y;switch(i){case h:d.channelType=x.PUBLIC,t.push({targetId:r,channelId:o,changeType:H.PRIVATE_TO_PUBLIC,channelType:d.channelType});break;case c:d.channelType=x.PRIVATE,t.push({targetId:r,channelId:o,changeType:H.PUBLIC_TO_PRIVATE,channelType:d.channelType});break;case _:t.push({targetId:r,channelId:o,changeType:H.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:d.channelType}),delete this._ultraGroupMap[u];break;case g:n.push({targetId:r,channelId:o,channelType:d.channelType,deleteTime:a}),delete this._ultraGroupMap[u];break;case p:s.push({targetId:r,channelId:o,userId:l,channelType:x.PRIVATE}),l===this.currentUserId&&delete this._ultraGroupMap[u]}})),t.length>0&&this._watcher.ultraGroupChannelChangeType(t),n.length>0&&this._watcher.ultraGroupChannelDelete(n),s.length>0&&this._watcher.ultraGroupChannelUserKicked(s)}_handleMsgRecall(e){const t=[];e.forEach((({targetId:e,channelId:n,messageUId:s,sendTime:i,conversationType:r,operatorId:o,mentionedType:a})=>{this._updateUltraGroupWhenRecallMsg(e,n,s,i,a),t.push({targetId:e,conversationType:r,sentTime:i,messageUId:s,senderUserId:o,channelId:n,content:{conversationType:r,targetId:e,messageUId:s,channelId:n},messageDirection:1,messageType:F.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:de.UNREAD,receivedStatusInfo:Dt(de.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(t)}_handleMsgUpdate(e){const t={};e.forEach((({targetId:e,conversationType:n,sendTime:s,messageUId:i,channelId:r})=>{const o=`${n}_${e}`;t[o]||(t[o]=[]),t[o].push({messageUId:i,channelId:r,sendTime:s})}));for(const n in t){const s=n.split("_"),i=s.shift(),r=s.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:r,conversationType:Number(i),messages:[...t[n]]})}}_pullUltraMessageList(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeMsgQuery(n),s=new Zo(uo[uo.qryMsg],t,this.currentUserId);s.setHeaderQos(_o.AT_LEAST_ONCE);const{code:i,data:r}=yield this._connMgr.send(s,Gi,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId});if(i!==w.SUCCESS)return{code:i,msg:w[i]};const{list:o}=r||{},a=[];Array.isArray(o)&&o.forEach((e=>{const{targetId:t,channelId:n,messageUId:s}=e,i=this._ultraGroupMap[`${n}_${t}`];i&&i.latestMessage.messageUId===s&&(i.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:s,CHANNEL_BIND_USER_GROUP:i,CHANNEL_UNBIND_USER_GROUP:r}=K,o=[],a=[],l=[],u=[],d=[];e.forEach((e=>{const{conversationType:c,targetId:h,userGroupIds:_,busChannelType:g,channelId:p}=e;switch(e.subChangeType){case t:o.push({conversation:{conversationType:c,targetId:h},userGroupIds:_});break;case n:a.push({conversation:{conversationType:c,targetId:h},userGroupIds:_});break;case s:l.push({conversation:{conversationType:c,targetId:h},userGroupIds:_});break;case i:u.push({conversation:{conversationType:c,targetId:h,channelId:p},channelType:g,userGroupIds:_});break;case r:d.push({conversation:{conversationType:c,targetId:h,channelId:p},channelType:g,userGroupIds:_})}}));const c={};o.length>0&&(c.userGroupDisband=o),a.length>0&&(c.userAdded=a),l.length>0&&(c.userRemoved=l),u.length>0&&(c.userGroupBindChannel=u),d.length>0&&(c.userGroupUnBindChannel=d),this._watcher.userGroupStatus(c)}))}getUltraHistoryMsg(e,n,s){var i;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeGetHistoryMsg(e,n),o=new Zo(uo[uo.qryUgMsg],t,this.currentUserId);this.logger.info(r.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:V.ULTRA_GROUP,channelId:n.channelId,timestamp:null==n?void 0:n.timestamp,count:null==n?void 0:n.count}),s);const{code:a,data:l}=yield this._connMgr.send(o,js,{currentUserId:this.currentUserId,conversation:{conversationType:V.ULTRA_GROUP,targetId:e}});if(a!==w.SUCCESS||!l)return this.logger.warn(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),s),{code:a};const u=[];return null===(i=l.list)||void 0===i||i.forEach((e=>{e&&u.push(e.messageUId)})),this.logger.info(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:u.join(",")}),s),{code:a,data:l}}))}setUltraGroupDefaultNotificationLevel(e,n,s){return t(this,void 0,void 0,(function*(){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(n,s),i=new Zo(uo[uo.ugUnpushSet],t,e),r=yield this._connMgr.send(i),{code:o}=r;return w.SUCCESS,{code:o}}))}getUltraGroupDefaultNotificationLevel(e,n){return t(this,void 0,void 0,(function*(){if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{_connMgr:t}=this,s=t.codec.encodeGetUltraGroupDefaultNotificationLevel(n),i=new Zo(uo[uo.ugUnpushQuery],s,e),r=yield t.send(i,Ii),{code:o,data:a}=r;if(o!==w.SUCCESS||!a)return{code:o};const{unpushLevel:l}=a;return{code:o,data:l}}))}_updateUltraGroupWhenRecallMsg(e,t,n,s,i){const r=`${t}_${e}`;if(!this._ultraGroupMap[r])return;const o=this._ultraGroupMap[r],{latestMessage:a,lastReadTime:l}=o;a&&a.messageUId===n&&(o.latestMessage=null),s&&l<s&&o.unreadMessageCount>0&&(--o.unreadMessageCount,(i===j.ALL||i===j.ME)&&o.unreadMentionedCount>0&&--o.unreadMentionedCount,i===j.ME&&o.unreadMentionedCount>0&&--o.unreadMentionedMeCount,this._watcher.conversation(bt([o])))}getAllConversationState(){return Promise.resolve({code:w.SUCCESS,data:this._conversationManager.getAllConversationState()})}getUltraGroupUnreadMentionedMessages(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});const t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Zo(uo[uo.qryUgUal],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,Fs);return s===w.SUCCESS&&i?{code:s,data:i}:{code:s}}))}getUltraGroupFirstUnreadMessageTimestamp(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};if(!this._isUltraGroupListExist)return Promise.resolve({code:w.METHOD_NOT_AVAILABLE});const{targetId:t,channelId:n}=e,s=(this._ultraGroupMap[`${n}_${t}`]||{}).firstUnreadMessage||null;return{code:w.SUCCESS,data:s}}))}subscribeUser(e,n,s){return t(this,void 0,void 0,(function*(){return this._isConnected?this._subscribeManager.updateSubscribeRelation(e,n,Z.SUBSCRIBE,s):{code:w.RC_NET_UNAVAILABLE}}))}unSubscribeUser(e,n){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const{code:t}=yield this._subscribeManager.updateSubscribeRelation(e,n,Z.UNSUBSCRIBE);return{code:t}}))}getSubscribeUserList(e,n,s){var i;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=null===(i=this._subscribeManager)||void 0===i?void 0:i.getSubscribeUserList(e,n,s);return Promise.resolve({code:w.SUCCESS,data:t})}))}getSubscribeUserStatus(e,n){var s;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=null===(s=this._subscribeManager)||void 0===s?void 0:s.getSubscribeUserStatus(e,n);return Promise.resolve({code:w.SUCCESS,data:t})}))}updateMyUserProfile(e){var s;return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=Hr.encode(rr,n(this,Ch,"m",vh).call(this,e)),i=yield this._connMgr.query(uo.updUserProfile,this.currentUserId,t,ar);if(i.isOk){const{version:t}=i.data;return null===(s=this._subscribeManager)||void 0===s||s.updateOwnProfile(e,t),i.wipe()}const r=i.data.censorFailedFields;return et(i.code,"",r&&0!==r.length?{errorKeys:r,errorKey:r[0]}:void 0)}))}getMyUserProfile(){return this._isConnected?this._subscribeManager.getOwnProfile():Promise.resolve({code:w.RC_NET_UNAVAILABLE})}getUserProfiles(e){return t(this,void 0,void 0,(function*(){return this._isConnected?this._subscribeManager.getUserProfiles(e):{code:w.RC_NET_UNAVAILABLE}}))}updateMyUserProfileVisibility(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeUserProfilePermission(e),n=new Zo(uo[uo.updProfilePermiss],t,this.currentUserId),{code:s}=yield this._connMgr.send(n);return{code:s}}))}getMyUserProfileVisibility(){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const e=this._connMgr.codec.encodeUserProfileInput(),t=new Zo(uo[uo.qProfilePermiss],e,this.currentUserId),{code:n,data:s}=yield this._connMgr.send(t,cr);return n!==w.SUCCESS?{code:n}:{code:n,data:null==s?void 0:s.permission}}))}searchUserProfileByUniqueId(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=this._connMgr.codec.encodeSearchUserProfile(e),n=new Zo(uo[uo.searchUserProfile],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,rr);if(s!==w.SUCCESS||!i)return{code:s};return{code:s,data:Gt(i.userId,i.userProfile,i.userExtProfile)}}))}bindRTCRoomForChatroom(e){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return w.RC_NET_UNAVAILABLE;const{chatRoomId:t}=e,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),s=new Zo(uo[uo.setRtcRoomId],n,t),i=yield this._connMgr.send(s),{code:r}=i;return r}))}rtcSignaling(e,n,s,i){return t(this,void 0,void 0,(function*(){if(!this._isConnected)return{code:w.RC_NET_UNAVAILABLE};const t=s?new Zo(n,i,e):new Xo(n,i,e),{code:r,data:o}=yield this._connMgr.send(t);return{code:r,buffer:o instanceof ea||null==o?void 0:o.pbData}}))}rtcPing(e,n,s){return t(this,void 0,void 0,(function*(){const t=ao(this.rtcCodec,n,s),{code:i,buffer:r}=yield this.rtcSignaling(e,uo[uo.rtcPing],!0,t);if(i!==w.SUCCESS)return{code:i};const o=this.rtcCodec.decode(io.RtcOutput,r);return o.version=Nt(o.version),{code:i,data:o}}))}getDeviceId(){return Da()}getOSInfo(){return t(this,void 0,void 0,(function*(){return{code:w.NOT_SUPPORT}}))}getProcessInfo(){return t(this,void 0,void 0,(function*(){return{code:w.NOT_SUPPORT}}))}getMainProcessInfo(){return t(this,void 0,void 0,(function*(){return{code:w.NOT_SUPPORT}}))}destroy(){t(void 0,void 0,void 0,(function*(){if(!zc)return;sh&&(clearTimeout(sh),sh=null);const e=yield zc;if(e){const{db:t}=e;oh.push(t)}zc=null}))}callExtra(e,...t){return Promise.resolve({code:w.NOT_SUPPORT})}setProxy(e){return Promise.resolve({code:w.NOT_SUPPORT})}getProxy(){return Promise.resolve({code:w.NOT_SUPPORT})}testProxy(e,t){return Promise.resolve({status:w.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,gn.newWorkChange,e)}}createGroup(e,n,s,i){return t(this,void 0,void 0,(function*(){const t=xc(e,n,s,i),r=yield this._connMgr.query(uo.channelCreate,e,t,gr);if(!r.data)return r.wipe();const o={errorKeys:r.data.censorFailedFields,processCode:r.data.processCode||0};return r.isOk?Xe():et(r.code,r.msg,o)}))}updateGroupInfo(e,n,s){return t(this,void 0,void 0,(function*(){const t=xc(e,n,s),i=yield this._connMgr.query(uo.upChannelInfo,e,t,gr);return i.data?i.isOk?Xe():et(i.code,i.msg,{errorKeys:i.data.censorFailedFields}):i.wipe()}))}getGroupsInfo(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeMultiChannels(e),n=new Zo(uo[uo.qChannelInfo],t,e[0]),{code:s,data:i}=yield this._connMgr.send(n,Tr);if(s!==w.SUCCESS||!i)return{code:s};const{list:r=[]}=i.result;return{code:s,data:Ft(r)}}))}kickGroupMembers(e,n,s){var i;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("kick",e,n,!0,s),r=new Zo(uo[uo.channelMemKick],t,e),{code:o,data:a}=yield this._connMgr.send(r,gr);return o!==w.SUCCESS?{code:o,msg:null!==(i=null==a?void 0:a.msg)&&void 0!==i?i:""}:{code:o}}))}quitGroup(e,n){var s;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("quit",e,[],!0,n),i=new Zo(uo[uo.channelMemQuit],t,e),{code:r,data:o}=yield this._connMgr.send(i,gr);return r!==w.SUCCESS?{code:r,msg:null!==(s=null==o?void 0:o.msg)&&void 0!==s?s:""}:{code:r}}))}dismissGroup(e){var n;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("dismiss",e),s=new Zo(uo[uo.channelDismiss],t,e),{code:i,data:r}=yield this._connMgr.send(s,gr);return i!==w.SUCCESS?{code:i,msg:null!==(n=null==r?void 0:r.msg)&&void 0!==n?n:""}:{code:i}}))}transferGroupOwner(e,n,s,i){var r;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuitGroup("transfer",e,[n],s,i),o=new Zo(uo[uo.channelTransfer],t,e),{code:a,data:l}=yield this._connMgr.send(o,gr);return a!==w.SUCCESS?{code:a,msg:null!==(r=null==l?void 0:l.msg)&&void 0!==r?r:""}:{code:a}}))}setGroupManagers(e,n,s){var i;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeModifyChannelsInput(e,n,s),r=new Zo(uo[uo.upChannelManager],t,n),{code:o,data:a}=yield this._connMgr.send(r,gr);return o!==w.SUCCESS?{code:o,msg:null!==(i=null==a?void 0:a.msg)&&void 0!==i?i:""}:{code:o}}))}getGroupMembersByRole(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupMembersByRole",groupId:e,option:s,roleType:n}),i=new Zo(uo[uo.qChannelMem],t,e),{code:r,data:o}=yield this._connMgr.send(i,Tr);if(r!==w.SUCCESS||!o)return{code:r};const{result:a,page:l}=o,{pageToken:u,hasNext:d}=l||{};let c=[];return c=Yt(a.list),{code:r,data:{data:c,pageToken:d&&u?u:""}}}))}getGroupMembers(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupMembers",groupId:e,ids:n}),s=new Zo(uo[uo.qChannelSpeMem],t,e),{code:i,data:r}=yield this._connMgr.send(s,Tr);if(i!==w.SUCCESS)return{code:i};if(!r)return{code:i,data:[]};const{result:o}=r;let a=[];return a=Yt(o.list),{code:i,data:a}}))}setGroupMemberInfo(e,n,s,i){return t(this,void 0,void 0,(function*(){const t=Hr.encode(mr,{targetId:e,type:V.GROUP,userId:n,channelNickName:s,additional:i}),r=yield this._connMgr.query(uo.upChannelMem,e,t,gr);return r.data?r.isOk?Xe():et(r.code,r.msg,{errorKeys:r.data.censorFailedFields}):r.wipe()}))}searchGroupMembers(e,t,n){return Promise.resolve({code:w.NOT_SUPPORT})}joinGroup(e){var n;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeJoinGroup("join",e),s=new Zo(uo[uo.channelMemJoin],t,e),{code:i,data:r}=yield this._connMgr.send(s,gr);return{code:i,data:{processCode:null!==(n=null==r?void 0:r.processCode)&&void 0!==n?n:0}}}))}inviteUsersToGroup(e,n){var s,i;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeJoinGroup("invite",e,n),r=new Zo(uo[uo.channelMemInvite],t,e),{code:o,data:a}=yield this._connMgr.send(r,gr);return o!==w.SUCCESS?{code:o,msg:null!==(s=null==a?void 0:a.msg)&&void 0!==s?s:""}:{code:o,data:{processCode:null!==(i=null==a?void 0:a.processCode)&&void 0!==i?i:0}}}))}memberInviteResponse(e){var n,s;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeMemberResponseInput(e),i=new Zo(uo[uo.channelApplyResp],t,e.groupId),{code:r,data:o}=yield this._connMgr.send(i,gr);return r!==w.SUCCESS?{code:r,msg:null!==(n=null==o?void 0:o.msg)&&void 0!==n?n:""}:{code:r,data:{processCode:null!==(s=null==o?void 0:o.processCode)&&void 0!==s?s:0}}}))}getGroupApplications(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupApplications",option:e}),n=new Zo(uo[uo.qChannelApplyList],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,Tr);if(s!==w.SUCCESS||!i)return{code:s};const{result:r,page:o}=i;let{pageToken:a,hasNext:l}=o||{};return{code:s,data:{data:jt(null==r?void 0:r.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}),s=new Zo(uo[uo.qChannelMemJoin],t,this.currentUserId),{code:i,data:r}=yield this._connMgr.send(s,Tr);if(i!==w.SUCCESS||!r)return{code:i};const{result:o,page:a}=r;let{pageToken:l,hasNext:u}=a||{};return{code:i,data:{data:Ft(o.list),pageToken:u&&l?l:""}}}))}searchJoinedGroups(e,t){return Promise.resolve({code:w.NOT_SUPPORT})}getJoinedGroups(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getJoinedGroups",ids:e}),n=new Zo(uo[uo.qChannelMemSpeJoin],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,Tr);if(s!==w.SUCCESS||!i)return{code:s};const{list:r}=i.result;return{code:s,data:Ft(r)}}))}setGroupRemark(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeSetGroupRemark(e,n),s=new Zo(uo[uo.upChannelRemark],t,e),{code:i}=yield this._connMgr.send(s);return{code:i}}))}setGroupFollows(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeSetGroupFollows(e,n,s),i=new Zo(uo[uo.upChannelFollow],t,n),{code:r}=yield this._connMgr.send(i);return{code:r}}))}getGroupFollows(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupFollows",groupId:e}),n=new Zo(uo[uo.qChannelFollow],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,Tr);if(s!==w.SUCCESS||!i)return{code:s};const{result:r}=i;return{code:s,data:r.list.map((e=>{const{userId:t,opTime:n}=e;return{userId:t,time:Nt(n)}}))}}))}addFriend(e,n,s){var i;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendInput({targetId:e,type:n,info:s}),r=new Zo(uo[uo.friendAdd],t,this.currentUserId),{code:o,data:a}=yield this._connMgr.send(r,gr);return o===w.SUCCESS&&a?{code:o,data:{processCode:null!==(i=null==a?void 0:a.processCode)&&void 0!==i?i:0}}:{code:o}}))}deleteFriends(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendsInput(e,n),s=new Zo(uo[uo.friendDel],t,this.currentUserId),{code:i}=yield this._connMgr.send(s);return{code:i}}))}acceptFriendApplication(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendInput({targetId:e,type:1}),n=new Zo(uo[uo.friendHandle],t,this.currentUserId),{code:s}=yield this._connMgr.send(n);return{code:s}}))}refuseFriendApplication(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendInput({targetId:e,type:2,info:n}),s=new Zo(uo[uo.friendHandle],t,this.currentUserId),{code:i}=yield this._connMgr.send(s);return{code:i}}))}setFriendInfo(e,n,s){return t(this,void 0,void 0,(function*(){const t=Hr.encode(Nr,{targetId:e,remarkName:n,extProfile:Fc(s)}),i=yield this._connMgr.query(uo.friendSetPf,this.currentUserId,t,Or);return i.isOk?i.wipe():et(i.code,"",{errorKeys:i.data.censorFailedFields})}))}checkFriends(e,n){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendsInput(e,n),s=new Zo(uo[uo.friendCheck],t,this.currentUserId),{code:i,data:r}=yield this._connMgr.send(s,Ar);if(i!==w.SUCCESS)return{code:i};if(!r)return{code:i,data:[]};return{code:i,data:r.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),s=new Zo(uo[uo.friendsQuery],t,this.currentUserId),{code:i,data:r}=yield this._connMgr.send(s,Tr);if(i!==w.SUCCESS||!r)return{code:i};const{result:o,page:a}=r,{pageToken:l,hasNext:u}=a||{};return o&&o.list?{code:i,data:{data:Dh(o.list),pageToken:u&&l?l:""}}:{code:i,data:{data:[],pageToken:u&&l?l:""}}}))}getFriendApplications(e,n,s){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendQueryInput(12,e),n=new Zo(uo[uo.friendsQuery],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,Tr);if(s!==w.SUCCESS)return{code:s};if(!i)return{code:s,data:{data:[],pageToken:""}};const{result:r,page:o}=i,{pageToken:a,hasNext:l}=o||{};return{code:s,data:{data:wh(r),pageToken:l&&a?a:""}}}))}deleteFriendApplication(e,n){return t(this,void 0,void 0,(function*(){return{code:w.NOT_SUPPORT}}))}getFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendsListInput(e),n=new Zo(uo[uo.friendsInfoQry],t,this.currentUserId),{code:s,data:i}=yield this._connMgr.send(n,Pr);return s!==w.SUCCESS?{code:s}:i?{code:s,data:Dh(i.list)}:{code:s,data:[]}}))}searchFriendsInfo(e){return t(this,void 0,void 0,(function*(){return Promise.resolve({code:w.NOT_SUPPORT})}))}setFriendAddPermission(e){return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeFriendLevelSet(e),n=new Zo(uo[uo.friendAuthSet],t,this.currentUserId),{code:s}=yield this._connMgr.send(n);return{code:s}}))}getFriendAddPermission(){return t(this,void 0,void 0,(function*(){const e=this._connMgr.codec.encodeFriendInput({targetId:this.currentUserId}),t=new Zo(uo.friendAuthGet,e,this.currentUserId),{code:n,data:s}=yield this._connMgr.send(t,Lr);return n===w.SUCCESS&&s?{code:n,data:s}:{code:n}}))}getConversationListWithAllChannel(){throw new Error("Method not implemented.")}getConversationListWithAllChannelByPage(e,t){throw new Error("Method not implemented.")}getConversationsByPage(e,t,n,s,i){throw new Error("Method not implemented.")}getContinuousMessages(e,t,n,s,i,r){throw new Error("Method not implemented.")}getHistoryMessagesByObjectNames(e,t,n,s,i,r,o){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(w.NOT_SUPPORT)}removeFromBlacklist(e){return Promise.resolve(w.NOT_SUPPORT)}getBlacklist(){return Promise.resolve({code:w.NOT_SUPPORT})}getBlacklistStatus(e){return Promise.resolve({code:w.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,s,i){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 et(w.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,s){throw new Error("Method not implemented.")}searchConversationByContentWithAllChannel(e,t,n){throw new Error("Method not implemented.")}searchMessageByContent(e,t,n,s,i,r){throw new Error("Method not implemented.")}searchMessageByContentAndMessageType(e,t,n,s,i,r,o){throw new Error("Method not implemented.")}searchMessagesByUser(e,t,n,s,i,r){throw new Error("Method not implemented.")}getMessagesByTimestamp(e,t,n,s){throw new Error("Method not implemented.")}searchMessageByContentWithAllChannel(e,t,n,s,i){throw new Error("Method not implemented.")}searchMessageByContentInTimeRangeWithAllChannel(e,t,n,s,i,r,o){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,s){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,s){throw new Error("Method not implemented.")}setCallInfo(e,n,s){return t(this,void 0,void 0,(function*(){const{_connMgr:t}=this;if(t){const i=t.codec.encodeSetCallInfo(n,s),r=yield t.send(new Zo(uo.reqCall,i,e),xi),{code:o}=r;let a=r.data;return o===w.SUCCESS&&a?Promise.resolve({code:o,data:{key:a.key,value:a.dataContent}}):Promise.resolve({code:o})}return Promise.resolve({code:w.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,s){return t(this,void 0,void 0,(function*(){const{currentUserId:t,_connMgr:i}=this,r=V.PRIVATE,o=i.codec.encodeOldConversationList({count:e,type:r,startTime:n,order:s}),a=new Zo(uo.qrySessions,o,t),l=yield i.send(a,ks,{currentUserId:t,connectedTime:i.getConnectedTime(),afterDecode:e=>{const{conversationType:t,targetId:n,channelId:s,unreadMessageCount:i}=e,r=this._conversationManager.get(t,n,s);Object.assign(e,r,{unreadMessageCount:i});const o=this._conversationManager.getDraft(t,n,s);return e.draft=o,e}}),{code:u,data:d}=l;return u!==w.SUCCESS?{code:u}:{code:u,data:null==d?void 0:d.list.sort(((e,t)=>{var n,i;const r=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0,o=(null===(i=t.latestMessage)||void 0===i?void 0:i.sentTime)||0;return 0===s?o-r:r-o}))}}))}getRealtimeConTotalUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this._connMgr.codec.encodeSessionAttInput(),t=new Zo(uo.qrySessionsAtt,e,this.getCurrentUserId()),{code:n,data:s}=yield this._connMgr.send(t,Ws);return{code:n,data:(null==s?void 0:s.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 s=this._connMgr.codec.encodeSessionMsgReadInput(e,this.getServerTime()),i=new Xo(uo[uo.updRRTime],s,this.currentUserId),{code:r}=yield this._connMgr.send(i);return{code:r}}))}removeRealtimeConversations(e){return t(this,void 0,void 0,(function*(){const{_connMgr:t}=this,n=new Zo(uo.delSessions,t.codec.encodeRemoveConversationList(e),this.getCurrentUserId()),{code:s}=yield t.send(n);return{code:s}}))}getRealtimeConUnreadCounts(e){var n,s;return t(this,void 0,void 0,(function*(){const t=this._connMgr.codec.encodeQuerySessionsInput(e),i=new Zo(uo[uo.qrySessionsUnread],t,this.currentUserId),r=yield this._connMgr.send(i,Xs);return r.code===w.SUCCESS&&r.data?{code:r.code,data:null===(s=null===(n=r.data)||void 0===n?void 0:n.sessions)||void 0===s?void 0:s.map((e=>({conversationType:e.type,targetId:e.channelId,channelId:e.busChannel||"",unreadCount:Nt(e.unreadCount)})))}:{code:r.code}}))}setNotificationQuietHoursWithSetting(e){return t(this,void 0,void 0,(function*(){const t=Hr.encode(br,e);return(yield this._connMgr.query(uo.addUnpush,this.currentUserId,t)).wipe()}))}removeNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Hr.encode(Dr,{nothing:0});return(yield this._connMgr.query(uo.delUnpush,this.currentUserId,e)).wipe()}))}getNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Hr.encode(wr,{nothing:0});return(yield this._connMgr.query(uo.qryUnpush,this.currentUserId,e,Vr)).trans((({isUnpush:e,spanMinutes:t,startTime:n,level:s,timezone:i})=>e?{spanMinutes:t,startTime:n,level:s,timezone:i}:{spanMinutes:0,startTime:"",level:Ie.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT}))}))}}function Gh(e){return Object.assign({},e)}function kh(e,t,n){const s=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:w.RC_USER_PROFILE_SERVICE_UNAVAILABLE});return s.call(this,...e)}}function Bh(e,t,n){const s=n.value;n.value=function(...e){if(!ka(this.getNaviInfoFromCache()))return Promise.resolve({code:w.RC_REAL_TIME_CONVERSATION_UNAVAILABLE});return s.call(this,...e)}}Ch=new WeakSet,vh=function(e){const t={},{extraProfile:n}=e;return n&&(delete e.extraProfile,t.userExtProfile=Fc(n)),t.userProfile=Fc(e),t},e([Ph()],Vh.prototype,"createGroup",null),e([Ph()],Vh.prototype,"updateGroupInfo",null),e([Ph()],Vh.prototype,"getGroupsInfo",null),e([Ph()],Vh.prototype,"kickGroupMembers",null),e([Ph()],Vh.prototype,"quitGroup",null),e([Ph()],Vh.prototype,"dismissGroup",null),e([Ph()],Vh.prototype,"transferGroupOwner",null),e([Ph()],Vh.prototype,"setGroupManagers",null),e([Ph()],Vh.prototype,"getGroupMembersByRole",null),e([Ph()],Vh.prototype,"getGroupMembers",null),e([Ph()],Vh.prototype,"setGroupMemberInfo",null),e([Ph()],Vh.prototype,"joinGroup",null),e([Ph()],Vh.prototype,"inviteUsersToGroup",null),e([Ph()],Vh.prototype,"memberInviteResponse",null),e([Ph()],Vh.prototype,"getGroupApplications",null),e([Ph()],Vh.prototype,"getJoinedGroupsByRole",null),e([Ph()],Vh.prototype,"getJoinedGroups",null),e([Ph()],Vh.prototype,"setGroupRemark",null),e([Ph()],Vh.prototype,"setGroupFollows",null),e([Ph()],Vh.prototype,"getGroupFollows",null),e([Ph()],Vh.prototype,"addFriend",null),e([Ph()],Vh.prototype,"deleteFriends",null),e([Ph()],Vh.prototype,"acceptFriendApplication",null),e([Ph()],Vh.prototype,"refuseFriendApplication",null),e([Ph()],Vh.prototype,"setFriendInfo",null),e([Ph()],Vh.prototype,"checkFriends",null),e([Ph()],Vh.prototype,"getFriends",null),e([Ph()],Vh.prototype,"getFriendApplications",null),e([Ph()],Vh.prototype,"deleteFriendApplication",null),e([Ph()],Vh.prototype,"getFriendsInfo",null),e([Ph()],Vh.prototype,"searchFriendsInfo",null),e([Ph()],Vh.prototype,"setFriendAddPermission",null),e([Ph()],Vh.prototype,"getFriendAddPermission",null),e([Ph()],Vh.prototype,"getRealtimeConversations",null),e([Ph()],Vh.prototype,"getRealtimeConTotalUnreadCount",null),e([Ph()],Vh.prototype,"clearRealtimeConUnreadCount",null),e([Ph()],Vh.prototype,"removeRealtimeConversations",null),e([Ph()],Vh.prototype,"getRealtimeConUnreadCounts",null),e([bh()],Vh.prototype,"setNotificationQuietHoursWithSetting",null),e([bh()],Vh.prototype,"removeNotificationQuietHoursSetting",null),e([bh()],Vh.prototype,"getNotificationQuietHoursSetting",null);class Fh{constructor(e){this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor={[F.CHATROOM_MERGE_CHANGE]:this._processChrmMemChangeMessage.bind(this),[F.TYPING_STATUS]:this._processTypingStatusMessage.bind(this),[F.INTERCEPT]:this._processInterceptMessage.bind(this),[F.CHATROOM_SYNC_MSG]:this._processChrmSyncMessage.bind(this),[F.CHATROOM_MERGE_BLOCK]:this._processChrmMemBlockMessage.bind(this),[F.CHATROOM_MERGE_BAN]:this._processChrmMemBanMessage.bind(this)},this._messageProccessor={[F.READ_RECEIPT]:this._processReadReceiptMessage.bind(this),[F.READ_RECEIPT_REQUEST]:this._processReadReceiptRequestMessage.bind(this),[F.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,ee.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,ee.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,ee.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,ee.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 so(ro,oo);const n=Lt();this._engine=n?new RCCppEngine(this.rtcCodec,t,this._options):new Vh(this.rtcCodec,t,this._options),this.logger=this._engine.getInnerLogger(),this.sse=new Ia(this,n)}static init(e){if(this._context)return this._context.logger.warn(r.A_INIT_REPEAT_O),this._context;this._context=new Fh(e),this._context.logger.info(r.L_INIT_O,JSON.stringify({appkey:e.appkey,navigators:e.navigators,typingExpireTime:e.typingExpireTime})),this._context.logger.warn(r.L_IMSDK_VER_O,JSON.stringify({commitId:"d147c2773305ac3e7fde48a06f3798170850a662",version:"5.20.0-c-esm-alpha.1"}));const t=this._context._engine;return fs.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(r.L_DESTROY_O),yield this._context._destroy(),this._context=void 0)}))}get chatroom(){return this._engine.chatroom}get chat(){return this._engine.chat}get dataHosting(){return this._engine.dataHosting}install(e,t){const n=this.logger.createTraceId();if(this.logger.info(r.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(r.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];const s="RCRTC"===e.tag?new Ta(this):new Ra(this);let i=null;try{if(!e.verify(fs))return null;i=e.setup(s,fs,t)}catch(e){this.logger.error(r.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),i&&(this._pluginContextQueue.push(s),this._pluginInstanseMap[e.tag]=i),i}_onConnectionStatusChange(e,t){var n,s;this.logger.warn(r.A_CONNECT_S,`status: ${e}, code: ${t}`),null===(s=(n=this._watcher).connection)||void 0===s||s.call(n,e,t),this._pluginContextQueue.forEach((n=>{var s;null===(s=n.onconnectionstatechange)||void 0===s||s.call(n,e,t)}))}_processChrmMemChangeMessage(e){if("function"==typeof this._watcher.chatroomState){const t={},n=[];let{memberCount:s=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:s,userList:n}})}return!0}_processTypingStatusMessage(e){if(this._addTypingInfo(Gh(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===V.ULTRA_GROUP){const{sourceType:n}=e.content;if(t.sourceType=n,(n===ne.MSG_EXPANSION||n===ne.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(r.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===D.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,s=this._engine.getCurrentUserId();n&&Array.isArray(n[s])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[s])}_messageReceiver(e,t,n){var s,i,o,a;if(!(null===(i=(s=this._compatibleMessageProccessor)[e.messageType])||void 0===i?void 0:i.call(s,e))&&!this._pluginContextQueue.some((t=>{if(!t.onmessage)return!1;try{return t.onmessage(Gh(e))}catch(e){return this.logger.error(r.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(a=(o=this._watcher).message)||void 0===a||a.call(o,Gh(e),t,n),e}_batchMessageReceiver(e,t,n){const s=[],i=[],o=[F.READ_RECEIPT,F.READ_RECEIPT_REQUEST,F.READ_RECEIPT_RESPONSE];e.forEach((e=>{const r=this._messageReceiver(e,t,n);r&&o.includes(r.messageType)?i.push(r):r&&s.push(r)})),s.length&&this._watcher.batchMessage&&(this.logger.debug(r.L_BATCH_MESSAGE_O,s.map((e=>e.messageUId)).join(",")),this._watcher.batchMessage(s)),i.length&&i.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(r.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(r.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(r.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 s;null===(s=n.onrtcdatachange)||void 0===s||s.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(r.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(r.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(r.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]=gt(n)||_t(n)?n:void 0}}))}_resetWatcher(){Object.keys(this._watcher).forEach((e=>{this._watcher[e]=void 0}))}_addTypingInfo(e){const{senderUserId:t,conversationType:n,targetId:s,content:i,channelId:r}=e,{typingContentType:o}=i,a=`${n}#${s}#${r||""}`;this._typingInfo[a]||(this._typingInfo[a]=[]);const l=this._typingInfo[a].findIndex((e=>e.userId===t));l>=0&&this._typingInfo[a][l].messageType===o?this._typingInfo[a][l].timestamp=Date.now():(l>=0&&this._typingInfo[a].splice(l,1),this._typingInfo[a].push({userId:t,messageType:o,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()===ee.CONNECTED?Xe(this._engine.getNaviInfoFromCache()):et(w.RC_NET_UNAVAILABLE)}get token(){return this._token}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._engine.refetchNaviInfo()}))}connect(e,n,s){var i,r;return t(this,void 0,void 0,(function*(){this._token=e;const t=yield fs.getNetworkType();this._engine.setNetwork({status:!0,type:t},!0);const o=!!this._pluginInstanseMap.RCCallPlus,{code:a,data:l}=yield this._engine.connect(e,n,o,s);if(a!==w.SUCCESS)return{code:a};if(1!==this._engine.getNaviInfoFromCache().type){const e=Ke.getInfo();null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,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(r.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!==V.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,s=[],i=!1){ut(s)&&s.length>0&&(this._registerMessageSearchPropsMapping[e]=s),this._engine.registerMessageType(e,t,n,s,i)}registerRTCSignalingListener(e){this._engine.registerRTCSignalingListener(e)}checkSearchPropsMsg(e,t){const n=this._registerMessageSearchPropsMapping[e],s={};return n&&_t(t)&&Object.keys(t).forEach((e=>{if(!n.includes(e))return;const i=t[e];at(i)&&(i>-(2**64)&&i<2**64&&Number.isInteger(i)||(s[e]=i))})),Object.keys(s).length>0?{msg:JSON.stringify(s),code:w.SEARCH_PROPS_LIMIT_ERROR}:{code:w.SUCCESS}}_handleExpansioResult(e,t){if(!t)return;const{isIllgalEx:n,isExKeyOrValLengthExceedLimit:s,isExceedLimit:i}=At(e);return i||s?w.EXPANSION_LIMIT_EXCEET:n?w.INVALID_PARAMETER_MESSAGE_EXPANSION:void 0}sendMessage(e,t,n,s,i){const{code:r,msg:o}=this.checkSearchPropsMsg(n.messageType,n.content);if(r!==w.SUCCESS)return Promise.resolve({code:r,msg:o});if(e===V.SYSTEM&&n.messageType!==F.SYNC_READ_STATUS)return Promise.resolve({code:w.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(n.messageType===F.STREAM_MESSAGE)return Promise.resolve({code:w.MESSAGE_NOT_SUPPORT_SENDING});const{canIncludeExpansion:a=!1,expansion:l}=n,u=this._handleExpansioResult(l,a);if(u)return Promise.resolve({code:u});const{isMentioned:d,mentionedUserIdList:c,mentionedType:h}=n;d&&[V.GROUP,V.ULTRA_GROUP].includes(e)?n.content.mentionedInfo=function(e,t,n){var s,i,r;return{userIdList:(null===(s=e.mentionedInfo)||void 0===s?void 0:s.userIdList)||t,type:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.type)||n||B.ALL,mentionedContent:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.mentionedContent)||""}}(n.content,c,h):delete n.content.mentionedInfo;const _=JSON.stringify(n.content);if((e=>{let t,n=0;for(let s=0,i=e.length;s<i;s++)t=e.charCodeAt(s),n+=t<127?1:t<=2047?2:t<=65535?3:4;return n})(_)>Ce)return Promise.resolve({code:w.RC_MSG_CONTENT_EXCEED_LIMIT});if(e===V.ULTRA_GROUP)return n.channelId=this._channelIdConvert(e,n.channelId),this._engine.sendUltraMessage(t,n,s,i);const g=this.getNaviInfoFromCache();return(null==g?void 0:g.grpRRVer)&&n.messageType===F.READ_RECEIPT_RESPONSE?Promise.resolve({code:w.READ_RECEIPT_ERROR}):this._engine.sendMessage(e,t,n,s,i)}sendExpansionMessage(e){return t(this,void 0,void 0,(function*(){const{channelId:t,conversationType:n,targetId:s,messageUId:i,keys:r,expansion:o,removeAll:a,canIncludeExpansion:l,messageType:u}=e;if(u===F.STREAM_MESSAGE&&((null==r?void 0:r.includes("RC_Ext_StreamMsgSummary"))||(null==o?void 0:o.RC_Ext_StreamMsgSummary)))return{code:w.STREAM_MESSAGE_EXPANSION_KEY_ERROR};if(!l)return{code:w.MESSAGE_KV_NOT_SUPPORT};const{isIllgalEx:d,isExKeyOrValLengthExceedLimit:c,isExceedLimit:h}=At(o);if(h||c)return Promise.resolve({code:w.EXPANSION_LIMIT_EXCEET});if(d)return Promise.resolve({code:w.INVALID_PARAMETER_MESSAGE_EXPANSION});const _={mid:i};o&&(_.put=o),r&&(_.del=r),a&&(_.removeAll=1);const{code:g}=yield this._engine.sendMessage(n,s,{content:_,messageType:F.EXPANSION_NOTIFY,channelId:t});return{code:g}}))}sendReadReceiptMessage(e,n,s){return t(this,void 0,void 0,(function*(){const t=this.getNaviInfoFromCache();return 1!==((null==t?void 0:t.grpRRVer)||0)?{code:w.READ_RECEIPT_ERROR,msg:"The read receipt switch is not on, please call the sendMessage method!"}:this._engine.sendReadReceiptMessage(e,n,s)}))}getMessageReader(e,n,s){return t(this,void 0,void 0,(function*(){const t=this.getNaviInfoFromCache();return 1!==((null==t?void 0:t.grpRRVer)||0)?{code:w.READ_RECEIPT_ERROR}:this._engine.getMessageReader(e,n,s||"")}))}sendReadReceiptMessageV4(e,n,s){return t(this,void 0,void 0,(function*(){return this._engine.sendReadReceiptMessageV4(e,n,s)}))}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(),fs.removeNetworkStatusListener(),yield this.disconnect(),this._pluginContextQueue.forEach((e=>{if(e.ondestroy)try{e.ondestroy()}catch(e){this.logger.error(r.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={}}))}getHistoryMessage(e,t,n,s,i,r,o,a){const l={timestamp:n||0,count:s||20,order:i||0,channelId:r||""};if(e===V.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,o||"",a)}getMessages(e,t,n,s,i,r,o){const a={timestamp:n||0,count:s||20,order:i||0,channelId:r||""};if(e===V.ULTRA_GROUP){const n=this._channelIdConvert(e,a.channelId);return a.channelId=n,this._engine.getUltraHistoryMsg(t,a,o)}return this._engine.getMessages(e,t,a.timestamp,a.count,a.order,a.channelId,o)}getContinuousMessages(e,t,n=0,s=20,i=0,r=""){return this._engine.getContinuousMessages(e,t,n,s,i,r)}getHistoryMessagesByObjectNames(e,t,n,s,i,r,o){return this._engine.getHistoryMessagesByObjectNames(e,t,n,s,i,r,o)}getConversationList(e,t,n,s,i){if(t===V.ULTRA_GROUP){const e=w.METHOD_NOT_SUPPORT;return Promise.resolve({code:e,msg:w[e]})}return this._engine.getConversationList(e||300,t,n,s,i||"")}getConversationsByPage(e,t,n,s,i){return this._engine.getConversationsByPage(e,t,n,s,i)}getConversation(e,t,n){const s=this._channelIdConvert(e,n);return this._engine.getConversation(e,t,s||"")}removeConversation(e,t,n){return e===V.ULTRA_GROUP?Promise.resolve(w.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===V.ULTRA_GROUP){const s=this._channelIdConvert(e,n);return this._engine.clearUltraUnreadcount(t,s||"")}return this._engine.clearConversationUnreadCount(e,t,n||"")}clearAllUnreadCount(){return this._engine.clearAllUnreadCount()}getUnreadCount(e,t,n){const s=this._channelIdConvert(e,n);return this._engine.getConversationUnreadCount(e,t,s||"")}getTotalUnreadCount(e,t,n){if(t&&t.includes(V.ULTRA_GROUP)){const e=w.METHOD_NOT_SUPPORT;return Promise.resolve({code:e,msg:w[e]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[V.PRIVATE,V.GROUP,V.SYSTEM,V.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,s,i){return t(this,void 0,void 0,(function*(){const t=this._channelIdConvert(e,i);return this._engine.setConversationNotificationLevel(e,n,s,t||"")}))}batchSetConversationNotificationLevel(e,t){return this._engine.batchSetConversationNotificationLevel(e,t)}setConversationStatus(e,t,n,s,i,r=!0){if(e===V.ULTRA_GROUP&&void 0!==n)return Promise.resolve(w.METHOD_NOT_SUPPORT);const o=this._channelIdConvert(e,i),a=[{conversationType:e,targetId:t,isTop:n,notificationLevel:s?le(s):void 0,channelId:o||"",isUpdateTime:r}];return this._engine.batchSetConversationStatus(a)}setConversationToTop(e,t,n,s,i){return this._engine.setConversationToTop(e,t,n,s,i)}batchSetConversationToTop(e,t,n){return this._engine.batchSetConversationToTop(e,t,!!n)}saveConversationMessageDraft(e,t,n,s){const i=this._channelIdConvert(e,s);return this._engine.saveConversationMessageDraft(e,t,n,i||"")}getConversationMessageDraft(e,t,n){const s=this._channelIdConvert(e,n);return this._engine.getConversationMessageDraft(e,t,s||"")}clearConversationMessageDraft(e,t,n){const s=this._channelIdConvert(e,n);return this._engine.clearConversationMessageDraft(e,t,s||"")}recallMessage(e,n){return t(this,void 0,void 0,(function*(){const t=((e,t)=>nt.create(e).isObject("conversatino",t,!0).fail(w.INVALID_PARAMETER_CONVERSATION).isValueOf("conversationType",t.conversationType,V,!0).fail(w.INVALID_PARAMETER_CONVERSATION_TYPE).validate("targetId",t.targetId,Ct,!0).fail(w.INVALID_PARAMETER_TARGET_ID).validate("channelId",t.channelId,mt).fail(w.INVALID_PARAMETER_CHANNEL_ID))("recallMessage",e).isString("messageUId",n.messageUId,!0).fail(w.INVALID_PARAMETER_MESSAGE_UID).isInteger("sentTime",n.sentTime,!1).fail(w.INVALID_PARAMETER_TIMESTAMP).isBoolean("disableNotification",n.disableNotification).fail(w.INVALID_PARAMETER_DISABLE_NOTIFICATION).isObject("pushConfig",n.pushConfig).fail(w.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("disableUpdateLastMessage",n.disableUpdateLastMessage).fail(w.INVALID_DISABLE_UPDATE_LAST_MESSAGE).isLimitedTypedArray("directionalUserIdList",n.directionalUserIdList,300,Ct,!1,1).fail(w.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validatorConnected);if(!t.isOk)return this.logger.warn(r.A_RECALL_MESSAGE_E,t.errmsg()),t.wipe();const{messageUId:s}=n,i=this.logger.createTraceId();this.logger.info(r.A_RECALL_MESSAGE_T,JSON.stringify({messageUId:s}),i);const{conversationType:o,channelId:a}=e;e.channelId=this._channelIdConvert(o,a)||"";const l=yield this._engine.recallMsg(e,n);return this.logger.summary(r.A_RECALL_MESSAGE_R,l,i,{messageUId:s}),l}))}deleteRemoteMessage(e,t,n,s){if(e===V.ULTRA_GROUP&&Lt())return Promise.resolve(w.METHOD_NOT_SUPPORT);const i=this._channelIdConvert(e,s);return this._engine.deleteRemoteMessage(e,t,n,i||"")}deleteRemoteMessageByTimestamp(e,t,n,s){const i=this._channelIdConvert(e,s);return this._engine.deleteRemoteMessageByTimestamp(e,t,n,i||"")}joinChatroom(e,t=10,n,s){return this._engine.joinChatroom(e,t,s,n)}joinExistChatroom(e,t=10,n,s){return this._engine.joinExistChatroom(e,t,s,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:s}=t;return $t(n)?Jt(s)?this._engine.setChatroomEntry(e,t):Promise.resolve(w.INVALID_PARAMETER_VALUE):Promise.resolve(w.INVALID_PARAMETER_KEY)}setChatroomEntries(e,t){for(let e=0;e<t.entries.length;e++){const n=t.entries[e],{key:s,value:i}=n;if(!$t(s))return Promise.resolve({code:w.INVALID_PARAMETER_KEY});if(!Jt(i))return Promise.resolve({code:w.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:s}=t;return $t(n)?Jt(s)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(w.INVALID_PARAMETER_VALUE):Promise.resolve(w.INVALID_PARAMETER_KEY)}removeChatroomEntry(e,t){const{key:n}=t;return $t(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(w.INVALID_PARAMETER_KEY)}removeChatroomEntries(e,t){for(let e=0;e<t.entries.length;e++){const n=t.entries[e],{key:s}=n;if(!$t(s))return Promise.resolve({code:w.INVALID_PARAMETER_KEY})}return this._engine.removeChatroomEntries(e,t)}forceRemoveChatroomEntry(e,t){const{key:n}=t;return $t(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(w.INVALID_PARAMETER_KEY)}getChatroomEntry(e,t){return this._engine.getChatroomEntry(e,t)}getAllChatroomEntries(e){return this._engine.getAllChatroomEntry(e)}getChatroomHistoryMessages(e,t,n,s){return this._engine.getChatroomHistoryMessages(e,s||0,t||20,n||0)}getFileToken(e,n,s,i,r,o){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:u,data:d}=yield this._engine.getFileToken(e,n,s,i,r,o);return u===w.SUCCESS&&d?Promise.resolve(Object.assign(d,{qiniu:a,ossConfig:d.ossConfig||l})):Promise.reject(u)}))}getFileUrl(e,n,s,i){return t(this,void 0,void 0,(function*(){const{code:t,data:r}=yield this._engine.getFileUrl(e,s,n,i);return t===w.SUCCESS?Promise.resolve(r):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:w.CONVER_OUT_LIMIT_ERROR});const t=n.map((e=>{const{conversationType:t,targetId:n,channelId:s}=e;return{conversationType:t,targetId:n,channelId:this._channelIdConvert(t,s)}}));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:s}=e;return{conversationType:t,targetId:n,channelId:this._channelIdConvert(t,s)}}));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,s,i){return t(this,void 0,void 0,(function*(){return this._engine.getConversationListByTag(e,n,s,i)}))}getUnreadCountByTag(e,n){return t(this,void 0,void 0,(function*(){return this._engine.getUnreadCountByTag(e,n)}))}setConversationStatusInTag(e,n,s){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,s)}))}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=[V.PRIVATE,V.CHATROOM,V.GROUP,V.SYSTEM,V.APP_PUBLIC_SERVICE,V.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t||"")}getUnreadConversationList(e){return e&&0!==e.length||(e=[V.PRIVATE,V.CHATROOM,V.GROUP,V.SYSTEM,V.APP_PUBLIC_SERVICE,V.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!==V.ULTRA_GROUP){const e=w.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:e,msg:w[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:s,channelId:i}=t;return{sendTime:n,messageUId:s,channelId:this._channelIdConvert(e.conversationType,i)}}));return e.messages=t,this._engine.getUltraGroupMessageListByMessageUId(e)}expandUltraMessage(e){return t(this,void 0,void 0,(function*(){const{conversationType:t,expansion:n,canIncludeExpansion:s}=e;if(t!==V.ULTRA_GROUP){const e=w.CONVERSATION_TYPE_NOT_SUPPORT;return{code:e,msg:w[e]}}if(!s)return{code:w.MESSAGE_KV_NOT_SUPPORT};const{isIllgalEx:i,isExKeyOrValLengthExceedLimit:r,isExceedLimit:o}=At(n);if(o||r)return{code:w.EXPANSION_LIMIT_EXCEET};if(i)return{code:w.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!==V.ULTRA_GROUP){const e=w.CONVERSATION_TYPE_NOT_SUPPORT;return{code:e,msg:w[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(V.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupUnreadMentionedMessages(e)}getUltraGroupFirstUnreadMessageTimestamp(e){const t=this._channelIdConvert(V.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 z.ONLINE_STATUS:return 1&t;case z.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:w.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})}unSubscribeUser(e,t){return this._isEnableSubDriven(t)?this._engine.unSubscribeUser(e,t):Promise.resolve({code:w.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})}getSubscribeUserList(e,t,n){return this._isEnableSubDriven(e)?this._engine.getSubscribeUserList(e,t,n):Promise.resolve({code:w.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})}getSubscribeUserStatus(e,t){return this._isEnableSubDriven(e)?this._engine.getSubscribeUserStatus(e,t):Promise.resolve({code:w.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(r.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,s){return t(this,void 0,void 0,(function*(){const{code:t,msg:i}=this.checkSearchPropsMsg(s.messageType,s.content);return t!==w.SUCCESS?Promise.resolve({code:t,msg:i}):this._engine.insertMessage(e,n,s)}))}batchInsertMessage(e,t){return this._engine.batchInsertMessage(e,t)}getMessageCount(e,n,s=""){return t(this,void 0,void 0,(function*(){return this._engine.getMessageCount(e,n,s)}))}deleteMessages(e){return t(this,void 0,void 0,(function*(){return this._engine.deleteMessages(e)}))}deleteMessagesByTimestamp(e,n,s,i,r=""){return t(this,void 0,void 0,(function*(){return this._engine.deleteMessagesByTimestamp(e,n,s,!!i,r)}))}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,s=""){return t(this,void 0,void 0,(function*(){return this._engine.clearMessages(e,n,s)}))}getLocalMessage(e){return t(this,void 0,void 0,(function*(){const t=nt.create("getLocalMessage").validate("messageId",e,(()=>rt(e)||at(e)),!0).fail(w.INVALID_PARAMETER_MESSAGE_ID).result(),n=this.logger.createTraceId();this.logger.info(r.A_GET_LOCAL_MESSAGE_T,JSON.stringify({messageId:e}),n);const s=yield t.next((()=>this._engine.getMessage(e)));return this.logger.summary(r.A_GET_LOCAL_MESSAGE_R,s,n,{messageId:e}),s}))}setMessageContent(e,n,s){return t(this,void 0,void 0,(function*(){return this._engine.setMessageContent(e,n,s)}))}setMessageSearchField(e,n,s){return t(this,void 0,void 0,(function*(){return this._engine.setMessageSearchField(e,n,s)}))}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,s,i){return t(this,void 0,void 0,(function*(){return this._engine.updateMessageReceiptStatus(e,n,s,i)}))}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=[],s,i){return t(this,void 0,void 0,(function*(){return this._engine.searchConversationByContent(e,n,s||"",i)}))}searchConversationByContentWithAllChannel(e,n=[],s){return t(this,void 0,void 0,(function*(){return this._engine.searchConversationByContentWithAllChannel(e,n,s)}))}searchMessageByContent(e,n,s,i,r,o,a=""){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContent(e,n,s,i,r,o,a)}))}searchMessageByContentAndMessageType(e,n,s,i,r,o,a){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContentAndMessageType(e,n,s,i,r,o,a)}))}searchMessagesByUser(e,n,s,i,r=5,o=""){return t(this,void 0,void 0,(function*(){return this._engine.searchMessagesByUser(e,n,s,i,r,o)}))}getMessagesByTimestamp(e,n,s,i){return t(this,void 0,void 0,(function*(){return this._engine.getMessagesByTimestamp(e,n,s,i)}))}searchMessageByContentWithAllChannel(e,n,s,i,r){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContentWithAllChannel(e,n,s,i,r)}))}searchMessageByContentInTimeRangeWithAllChannel(e,n,s,i,r,o,a){return t(this,void 0,void 0,(function*(){return this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,n,s,i,r,o,a)}))}getUnreadMentionedMessages(e,t,n=""){return this._engine.getUnreadMentionedMessages(e,t,n)}clearUnreadCountByTimestamp(e,t,n,s=""){return this._engine.clearUnreadCountByTimestamp(e,t,n,s)}getUltraGroupDefaultNotificationLevel(e,t){const n=this._channelIdConvert(V.ULTRA_GROUP,t);return this._engine.getUltraGroupDefaultNotificationLevel(e,n||"")}setUltraGroupDefaultNotificationLevel(e,t,n){const s=this._channelIdConvert(V.ULTRA_GROUP,n);return this._engine.setUltraGroupDefaultNotificationLevel(e,t,s||"")}getConversationNotificationLevel(e,t,n){const s=this._channelIdConvert(e,n);return this._engine.getConversationNotificationLevel(e,t,s||"")}setConversationTypeNotificationLevel(e,t){return this._engine.setConversationTypeNotificationLevel(e,t)}getConversationTypeNotificationLevel(e){return this._engine.getConversationTypeNotificationLevel(e)}getConversationNotificationStatus(e,t,n){const s=this._channelIdConvert(e,n);return this._engine.getConversationNotificationStatus(e,t,s||"")}getRemoteHistoryMessages(e,t,n,s,i,r){return this._engine.getRemoteHistoryMessages(e,t,n,s,i,r)}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,s){return this._engine.rtcSignaling(e,t,n,s)}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,s=[]){return this._engine.createGroup(e,t,n,s)}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,s=!1){return this._engine.transferGroupOwner(e,t,s,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,s){return this._engine.setGroupMemberInfo(e,t,n,s)}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:v.ACCEPT})}refuseGroupInvite(e,t,n){return this._engine.memberInviteResponse({groupId:e,inviterId:t,optType:0,optResult:v.REFUSE,reason:n})}acceptGroupApplication(e,t,n){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:v.ACCEPT})}refuseGroupApplication(e,t,n,s){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:v.REFUSE,reason:s})}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(S.ADD,e,t)}removeGroupFollows(e,t){return this._engine.setGroupFollows(S.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 nt.create("setNotificationQuietHoursWithSetting").isObject("opts",e,!0).isString("timezone",e.timezone).fail(w.BIZ_ERROR_INVALID_PARAMETER).validate("startTime",e.startTime,(e=>/^\d{2}(:\d{2}){2}$/.test(e)),!0).fail(w.INVALID_PARAMETER_TIMESTRING).isLimitedNumber("spanMinutes",e.spanMinutes,1,1439,!0).fail(w.INVALID_PARAMETER_SPAN_MINUTES).isValueOf("level",e.level,Ie,!0).fail(w.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().next((()=>this._engine.setNotificationQuietHoursWithSetting(e)))}removeNotificationQuietHoursSetting(){return this._engine.removeNotificationQuietHoursSetting()}getNotificationQuietHoursSetting(){return this._engine.getNotificationQuietHoursSetting()}}e([kh],Fh.prototype,"updateMyUserProfile",null),e([kh],Fh.prototype,"getUserProfiles",null),e([kh],Fh.prototype,"getMyUserProfile",null),e([kh],Fh.prototype,"updateMyUserProfileVisibility",null),e([kh],Fh.prototype,"getMyUserProfileVisibility",null),e([kh],Fh.prototype,"searchUserProfileByUniqueId",null),e([kh],Fh.prototype,"createGroup",null),e([kh],Fh.prototype,"updateGroupInfo",null),e([kh],Fh.prototype,"getGroupsInfo",null),e([kh],Fh.prototype,"kickGroupMembers",null),e([kh],Fh.prototype,"quitGroup",null),e([kh],Fh.prototype,"dismissGroup",null),e([kh],Fh.prototype,"transferGroupOwner",null),e([kh],Fh.prototype,"setGroupManagers",null),e([kh],Fh.prototype,"getGroupMembersByRole",null),e([kh],Fh.prototype,"getGroupMembers",null),e([kh],Fh.prototype,"setGroupMemberInfo",null),e([kh],Fh.prototype,"searchGroupMembers",null),e([kh],Fh.prototype,"joinGroup",null),e([kh],Fh.prototype,"inviteUsersToGroup",null),e([kh],Fh.prototype,"acceptGroupInvite",null),e([kh],Fh.prototype,"refuseGroupInvite",null),e([kh],Fh.prototype,"acceptGroupApplication",null),e([kh],Fh.prototype,"refuseGroupApplication",null),e([kh],Fh.prototype,"getGroupApplications",null),e([kh],Fh.prototype,"getJoinedGroupsByRole",null),e([kh],Fh.prototype,"searchJoinedGroups",null),e([kh],Fh.prototype,"getJoinedGroups",null),e([kh],Fh.prototype,"setGroupRemark",null),e([kh],Fh.prototype,"addGroupFollows",null),e([kh],Fh.prototype,"removeGroupFollows",null),e([kh],Fh.prototype,"getGroupFollows",null),e([kh],Fh.prototype,"addFriend",null),e([kh],Fh.prototype,"deleteFriends",null),e([kh],Fh.prototype,"acceptFriendApplication",null),e([kh],Fh.prototype,"refuseFriendApplication",null),e([kh],Fh.prototype,"setFriendInfo",null),e([kh],Fh.prototype,"checkFriends",null),e([kh],Fh.prototype,"getFriends",null),e([kh],Fh.prototype,"getFriendApplications",null),e([kh],Fh.prototype,"getFriendsInfo",null),e([kh],Fh.prototype,"searchFriendsInfo",null),e([kh],Fh.prototype,"setFriendAddPermission",null),e([kh],Fh.prototype,"getFriendAddPermission",null),e([Bh],Fh.prototype,"getRealtimeConversations",null),e([Bh],Fh.prototype,"getRealtimeConTotalUnreadCount",null),e([Bh],Fh.prototype,"clearRealtimeConUnreadCount",null),e([Bh],Fh.prototype,"removeRealtimeConversations",null),e([Bh],Fh.prototype,"getRealtimeConUnreadCounts",null);export{Fh as APIContext,ba as AppStorage,rn as AreaCode,Sa as AssertRules,oa as BasicEngine,cn as BasicLogger,M as ChatroomEntryType,L as ChatroomSyncStatusReason,P as ChatroomUserChangeType,b as ChrmMemBanType,D as ChrmMemOperateType,U as ChrmSyncStatus,so as Codec,Kr as ConnectionStatus,V as ConversationType,o as DirectionType,w as ErrorCode,no as EventEmitter,k as FileType,l as FriendAddPermission,c as FriendApplicationStatus,d as FriendApplicationType,u as FriendRelationType,O as GroupApplicationDirection,C as GroupApplicationStatus,N as GroupApplicationType,I as GroupInviteHandlePermission,p as GroupJoinPermission,f as GroupMemberInfoEditPermission,R as GroupMemberRole,T as GroupOperation,E as GroupOperationPermission,y as GroupOperationRole,v as GroupOperationStatus,S as GroupOperationType,Te as HttpMethod,fe as InterruptionLevel,dn as LogL,qr as LogLevel,Yr as LogSource,r as LogTagId,Ce as MAX_MESSAGE_CONTENT_BYTES,Ae as MAX_UPLOAD_FILE_SIZE,B as MentionedType,ne as MessageBlockSourceType,te as MessageBlockType,se as MessageDirection,F as MessageType,oe as NotificationLevel,ae as NotificationStatus,$ as OnlineStatus,W as OperateStatus,Ss as PBCodec,J as PlatformInfo,Ra as PluginContext,ie as PushImportanceHonor,Ie as PushNotificationQuietHoursLevel,a as QueryFriendsDirectionType,ee as RCConnectionStatus,Ze as RCResult,$r as RTCApiType,zr as RTCJoinType,jr as RTCMode,Ta as RTCPluginContext,de as ReceivedStatus,ve as SEND_MESSAGE_TYPE_OPTION,Q as SentStatus,aa as StreamMessageResponseEventType,Z as SubscribeOperationType,z as SubscribeType,ze as SuspendablePromise,Ne as UPLOAD_FILE_CHUNK_SIZE,je as UUId,H as UltraGroupChannelChangeType,x as UltraGroupChannelType,i as UploadMethod,X as UserProfileVisibility,nt as Validator,Na as ValidatorManage,Ke as VersionManage,ya as assert,et as fail,en as fixUrlProtocol,Ot as forEach,wa as getUUID,Va as getUUID22,nn as httpRequest,ut as isArray,ot as isBoolean,gt as isFunction,ft as isHttpUrl,lt as isInteger,Oa as isLimitedArray,dt as isLimitedString,Et as isNull,at as isNumber,_t as isObject,rt as isString,pt as isUndefined,Ma as isValidConversation,Rt as isValidConversationType,St as isValidEnum,yt as isValidFileType,vt as isValidGroupId,Tt as isValidNotificationLevel,Ct as isValidTargetId,to as logger,Mt as map,ht as notEmptyArray,It as notEmptyObject,ct as notEmptyString,Xe as ok,fs as runtime,ue as transformNotificationLevel,le as transformNotificationStatus,wt as transformReceivedStatusFlag,Dt as transformReceivedStatusInfo,Lt as usingCppEngine,Aa as validate};
|
|
15
|
+
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,i,o,s,a,u,c,l,d,h,p,_,f,E,I,v,T,R,m,y,S,C,A,N,O,M,U,L,b,P,w,D,V,G,k,F,B,x,H,q,Y,K,Q,W,j,J,z,Z,X,$,ee,te,ne,re,ie,oe,se=function(){return se=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},se.apply(this,arguments)};function ae(e,t,n,r){var i,o=arguments.length,s=o<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--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function ue(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(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,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function le(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 de(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function he(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function pe(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 _e(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(n||(n={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_REPEAT_O="A_INIT_REPEAT_O",e.L_INIT_O="L-init-O",e.A_DESTROY_O="A_DESTROY_O",e.L_DESTROY_O="L_DESTROY_O",e.A_CONNECT_T="A-connect-T",e.A_CONNECT_R="A-connect-R",e.A_CONNECT_S="A-connect-S",e.A_DISCONNECT_O="A-disconnect-O",e.A_RECONNECT_T="A-reconnect-T",e.A_RECONNECT_R="A_RECONNECT_R",e.L_CONNECT_T="L-connect-T",e.L_CONNECT_R="L-connect-R",e.L_CONNECT_S="L-connect-S",e.L_DB_UPGRATE_START_S="L-db_upgrate_start-S",e.L_DB_UPGRATING_S="L-db_upgrating-S",e.L_DB_UPGRATE_COMPLETE_S="L-db_upgrate_complete-S",e.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",e.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",e.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",e.A_MSG_LISTENER_E="A-MSG_LISTENER-E",e.O="L-original-O",e.T="L-TEST-O",e.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",e.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",e.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",e.L_NAVI_CMP_R="L-NAVI_CPM-R",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-send_msg-R",e.L_SEND_MSG_T="L-send_msg-T",e.L_SEND_MSG_R="L-send_msg-R",e.L_PULL_MSG_T="L-pull_msg-T",e.L_PULL_MSG_R="L-pull_msg-R",e.L_PULL_MSG_E="L-pull_msg-E",e.L_PULL_MSG_O="L-pull_msg-O",e.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",e.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",e.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",e.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",e.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",e.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",e.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",e.L_RECV_S_MSG_O="L-recv_s_msg-O",e.A_DELETE_MESSAGES_S="A-delete_messages-S",e.P_DELETE_MSG_S="P-delete_msg-S",e.L_PULL_CONVERSATION_S="L-pull_conversation-S",e.A_RECALL_MESSAGE_T="A-recall_msg-T",e.A_RECALL_MESSAGE_R="A-recall_msg-R",e.A_RECALL_MESSAGE_E="A-recall_msg-E",e.A_REGTYP_O="A-regtyp-O",e.P_REGTYP_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_REQUEST_T="L-request-T",e.L_REQUEST_R="L-request-R",e.L_PARSE_NAVI_E="L-parse_navi-E",e.L_ENV_S="L-Env-S",e.L_GET_INDEX_NAVI_S="L-get_index_navi-S",e.A_JOIN_CHATROOM_T="A-join_chatroom-T",e.A_JOIN_CHATROOM_R="A-join_chatroom-R",e.L_JOIN_CHATROOM_T="L-join_chatroom-T",e.L_JOIN_CHATROOM_R="L-join_chatroom-R",e.A_QUIT_CHATROOM_T="A-quit_chatroom-T",e.A_QUIT_CHATROOM_R="A-quit_chatroom-R",e.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",e.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",e.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",e.L_MEDIA_S="L-media-S",e.L_MEDIA_UPLOAD_T="L-media_upload-T",e.L_MEDIA_UPLOAD_R="L-media_upload-R",e.G_UPLOAD_LOG_S="G-upload_log-S",e.G_REPORT_LOG_S="G-report_log-S",e.G_UPLOAD_LOG_E="G-upload_log-E",e.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",e.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",e.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",e.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",e.A_GET_LOCAL_MESSAGE_T="A-get_local_message-T",e.A_GET_LOCAL_MESSAGE_R="A-get_local_message-R",e.A_GET_HISTORY_MSG_T="A-get_history_msg-T",e.A_GET_HISTORY_MSG_R="A-get_history_msg-R",e.L_GET_HISTORY_MSG_T="L-get_history_msg-T",e.L_GET_HISTORY_MSG_R="L-get_history_msg-R",e.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",e.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E",e.L_CALLBACK_E="L-callback-E",e.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",e.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",e.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",e.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",e.A_SYNC_READ_STATUS_T="A-sync_read_status-T",e.A_SYNC_READ_STATUS_R="A-sync_read_status-R",e.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",e.L_PB_ENCODE_E="L-pb-encode-E",e.L_PB_DECODE_E="L-pb-decode-E",e.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",e.L_REPORT_FULL_LOG_O="L-report_full_log-O",e.L_REPORT_FULL_LOG_T="L-report_full_log-T",e.L_REPORT_FULL_LOG_R="L-report_full_log-R",e.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",e.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",e.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",e.L_LOGDB_CLOSED_S="L-logDB_closed-S",e.L_LOGDB_ERROR_E="L-logDB_error-S",e.L_LOGDB_ABORT_S="L-logDB_abort-S",e.L_REALTIME_LOG_R="L_REALTIME_LOG_R",e.L_REALTIME_LOG_O="L_REALTIME_LOG_O",e.L_REALTIME_LOG_T="L_REALTIME_LOG_T",e.L_STATISTIC_LOG_R="L_STATISTIC_LOG_R",e.L_STATISTIC_LOG_O="L_STATISTIC_LOG_O",e.L_STATISTIC_LOG_T="L_STATISTIC_LOG_T",e.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",e.L_RECV_RMTP_O="L_RECV_RMTP_O",e.L_RECV_RMTP_E="L_RECV_RMTP_E",e.L_RECV_S_NTF_O="L-recv_s_ntf_O",e.L_VER_REPORT_T="L-VER_REPORT-T",e.L_VER_REPORT_R="L-VER_REPORT-R",e.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",e.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",e.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",e.A_REMOVE_PROXY_O="A-remove_proxy-O",e.A_SET_PROXY_O="A-set_proxy-O",e.A_TEST_PROXY_O="A-test_proxy-O",e.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",e.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",e.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",e.L_GET_STATIC_CONF_T="L-get_static_conf-T",e.L_GET_STATIC_CONF_R="L-get_static_conf-R",e.L_GET_STATIC_CONF_E="L-get_static_conf-E",e.L_CLOUD_DISABLED="L-cloud_disabled",e.L_CLOUD_EXPIRE="L-cloud_expire",e.L_CLOUD_OVERCLOCK="L-cloud_overclock",e.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",e.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",e.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",e.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",e.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",e.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",e.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O",e.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S="L-sync_subscribed_user_status_finished-S",e.L_PULL_SUBSCRIBED_USER_RELATION_T="L-pull_subscribed_user_relation-T",e.L_PULL_SUBSCRIBED_USER_RELATION_R="L-pull_subscribed_user_relation-R",e.L_PULL_SUBSCRIBED_USER_STATUS_T="L-pull_subscribed_user_status-T",e.L_PULL_SUBSCRIBED_USER_STATUS_R="L-pull_subscribed_user_status-R",e.L_OWN_USER_PROFILE_CHANGED_S="L-own_user_profile_changed-S",e.L_QUERY_SUBSCRIBE_DATA_T="L-query_subscribe_data-T",e.L_QUERY_SUBSCRIBE_DATA_R="L-query_subscribe_data-R",e.L_PULL_USER_PROFILE_T="L-pull_user_profile-T",e.L_PULL_USER_PROFILE_R="L-pull_user_profile-R",e.L_PULL_OWN_PROFILE_T="L-pull_own_profile-T",e.L_PULL_OWN_PROFILE_R="L-pull_own_profile-R",e.L_QUERY_FRIEND_LIST_T="L-query_friend_list-T",e.L_QUERY_FRIEND_LIST_R="L-query_friend_list-R",e.L_PULL_USER_PROFILE_REQ_T="L-pull_user_profile_req-T",e.L_PULL_USER_PROFILE_REQ_R="L-pull_user_profile_req-R",e.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S="L-pull_event_change_notify_ultra_online-S",e.L_PULL_EVENT_CHANGE_T="L-pull_event_change-T",e.L_PULL_EVENT_CHANGE_R="L-pull_event_change-R",e.L_PARSE_JSON_E="L-parse_json-E",e.L_REQ_STREAM_MSG_CONTENT_T="L-req_stream_msg_content-T",e.L_REQ_STREAM_MSG_CONTENT_R="L-req_stream_msg_content-R",e.L_REQ_STREAM_MSG_CONTENT_O="L-req_stream_msg_content-O",e.L_REQ_STREAM_MSG_CONTENT_E="L-req_stream_msg_content-E"}(r||(r={})),function(e){e[e.BOTH=2]="BOTH"}(i||(i={})),function(e){e[e.BOTH=2]="BOTH"}(o||(o={})),function(e){e[e.FREE=1]="FREE",e[e.NEED_VERIFY=2]="NEED_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(s||(s={})),function(e){e[e.NONE=0]="NONE",e[e.IN_MY_FRIEND_LIST=1]="IN_MY_FRIEND_LIST",e[e.IN_OTHER_FRIEND_LIST=2]="IN_OTHER_FRIEND_LIST",e[e.BOTH_WAY=3]="BOTH_WAY"}(a||(a={})),function(e){e[e.SENT=1]="SENT",e[e.RECEIVED=2]="RECEIVED"}(u||(u={})),function(e){e[e.UNHANDLED=0]="UNHANDLED",e[e.ACCEPTED=1]="ACCEPTED",e[e.REFUSED=2]="REFUSED",e[e.EXPIRED=3]="EXPIRED"}(c||(c={})),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"}(d||(d={})),function(e){e[e.OWNER_VERIFY=0]="OWNER_VERIFY",e[e.FREE=1]="FREE",e[e.OWNER_OR_MANAGER_VERIFY=2]="OWNER_OR_MANAGER_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(h||(h={})),function(e){e[e.OWNER=0]="OWNER",e[e.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",e[e.EVERYONE=2]="EVERYONE"}(p||(p={})),function(e){e[e.OWNER_OR_MANAGER_OR_SELF=0]="OWNER_OR_MANAGER_OR_SELF",e[e.OWNER_OR_SELF=1]="OWNER_OR_SELF",e[e.SELF=2]="SELF"}(_||(_={})),function(e){e[e.FREE=0]="FREE",e[e.INVITEE_VERIFY=1]="INVITEE_VERIFY"}(f||(f={})),function(e){e[e.UNDEF=0]="UNDEF",e[e.NORMAL=1]="NORMAL",e[e.MANAGER=2]="MANAGER",e[e.OWNER=3]="OWNER"}(E||(E={})),function(e){e[e.CREATE=0]="CREATE",e[e.JOIN=1]="JOIN",e[e.KICK=2]="KICK",e[e.QUIT=3]="QUIT",e[e.DISMISS=4]="DISMISS",e[e.ADD_MANAGER=5]="ADD_MANAGER",e[e.REMOVE_MANAGER=6]="REMOVE_MANAGER",e[e.TRANSFER_GROUP_OWNER=7]="TRANSFER_GROUP_OWNER"}(I||(I={})),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"}(v||(v={})),function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE"}(T||(T={})),function(e){e[e.MANAGER_UNHANDLED=0]="MANAGER_UNHANDLED",e[e.MANAGER_REFUSED=1]="MANAGER_REFUSED",e[e.INVITEE_UNHANDLED=2]="INVITEE_UNHANDLED",e[e.INVITEE_REFUSED=3]="INVITEE_REFUSED",e[e.JOINED=4]="JOINED",e[e.EXPIRED=5]="EXPIRED"}(R||(R={})),function(e){e[e.REFUSE=0]="REFUSE",e[e.ACCEPT=1]="ACCEPT"}(m||(m={})),function(e){e[e.APPLICANT=0]="APPLICANT",e[e.MANAGER=1]="MANAGER"}(y||(y={})),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={})),function(e){e[e.APPLICATION=0]="APPLICATION",e[e.INVITATION=1]="INVITATION"}(C||(C={})),function(e){e[e.APPLICATION_SENT=0]="APPLICATION_SENT",e[e.INVITATION_SENT=1]="INVITATION_SENT",e[e.INVITATION_RECEIVED=2]="INVITATION_RECEIVED",e[e.APPLICATION_RECEIVED=3]="APPLICATION_RECEIVED"}(A||(A={})),function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(N||(N={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(O||(O={})),function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(M||(M={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(U||(U={})),function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(L||(L={})),function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(b||(b={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET=24360]="RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET",e[e.RC_USER_PROFILE_KEY_NOT_EXIST=24361]="RC_USER_PROFILE_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KEY_NOT_EXIST=24362]="RC_USER_PROFILE_EXT_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT=24363]="RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT=24364]="RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT",e[e.RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT=24365]="RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_USER_NOT_EXIST=24366]="RC_USER_PROFILE_USER_NOT_EXIST",e[e.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS=24367]="RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_USER_PROFILE_VALUE_EXCEED_RANGE=24368]="RC_USER_PROFILE_VALUE_EXCEED_RANGE",e[e.RC_USER_PROFILE_SERVICE_UNAVAILABLE=24369]="RC_USER_PROFILE_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.RC_ENTRUST_SERVER_ERROR=25402]="RC_ENTRUST_SERVER_ERROR",e[e.RC_ENTRUST_SERVER_PARAMETER_ERROR=25403]="RC_ENTRUST_SERVER_PARAMETER_ERROR",e[e.RC_GROUP_ILLEGAL_ERROR=25404]="RC_GROUP_ILLEGAL_ERROR",e[e.RC_GROUP_AUTHORITY_ERROR=25405]="RC_GROUP_AUTHORITY_ERROR",e[e.RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT=25406]="RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT",e[e.RC_GROUP_PARAMETER_FORMAT_ERROR=25407]="RC_GROUP_PARAMETER_FORMAT_ERROR",e[e.RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS=25408]="RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_GROUP_ID_ALREADY_EXIST=25409]="RC_GROUP_ID_ALREADY_EXIST",e[e.RC_GROUP_ID_NOT_EXIST=25410]="RC_GROUP_ID_NOT_EXIST",e[e.RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT=25411]="RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_MEMBERS_ALREADY_IN_GROUP=25412]="RC_GROUP_MEMBERS_ALREADY_IN_GROUP",e[e.RC_GROUP_NOT_ALLOW_SDK_OPERATION=25413]="RC_GROUP_NOT_ALLOW_SDK_OPERATION",e[e.RC_GROUP_NOT_ALLOW_JOIN=25414]="RC_GROUP_NOT_ALLOW_JOIN",e[e.RC_GROUP_EXT_KEY_NOT_EXIST=25415]="RC_GROUP_EXT_KEY_NOT_EXIST",e[e.RC_GROUP_REQUEST_OVERFREQUENCY=25416]="RC_GROUP_REQUEST_OVERFREQUENCY",e[e.RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK=25417]="RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK",e[e.RC_GROUP_USER_NOT_IN_GROUP=25418]="RC_GROUP_USER_NOT_IN_GROUP",e[e.RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT=25419]="RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP=25420]="RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP",e[e.RC_GROUP_APPLICATION_NOT_EXIST=25421]="RC_GROUP_APPLICATION_NOT_EXIST",e[e.RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT=25422]="RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_NAME_INVALID=25423]="RC_GROUP_NAME_INVALID",e[e.RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT=25424]="RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT",e[e.RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER=25425]="RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER",e[e.RC_GROUP_NO_INVITE_PERMISSION=25426]="RC_GROUP_NO_INVITE_PERMISSION",e[e.RC_GROUP_NEED_INVITEE_ACCEPT=25427]="RC_GROUP_NEED_INVITEE_ACCEPT",e[e.RC_GROUP_APPLICATION_ALREADY_HANDLE=25428]="RC_GROUP_APPLICATION_ALREADY_HANDLE",e[e.RC_GROUP_OLD_GROUP_NOT_ENTRUST=25429]="RC_GROUP_OLD_GROUP_NOT_ENTRUST",e[e.RC_GROUP_ID_INVALID=25430]="RC_GROUP_ID_INVALID",e[e.RC_PAGE_TOKEN_PARSING_FAILED=25432]="RC_PAGE_TOKEN_PARSING_FAILED",e[e.RC_FRIEND_ALREADY_FRIEND=25460]="RC_FRIEND_ALREADY_FRIEND",e[e.RC_FRIEND_NEED_ACCEPT=25461]="RC_FRIEND_NEED_ACCEPT",e[e.RC_FRIEND_IN_OTHER_BLACK_LIST=25462]="RC_FRIEND_IN_OTHER_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_OTHER_WHITE_LIST=25463]="RC_FRIEND_NOT_IN_OTHER_WHITE_LIST",e[e.RC_FRIEND_IN_MY_BLACK_LIST=25464]="RC_FRIEND_IN_MY_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_MY_WHITE_LIST=25465]="RC_FRIEND_NOT_IN_MY_WHITE_LIST",e[e.RC_FRIEND_APPLICATION_NOT_EXIST=25466]="RC_FRIEND_APPLICATION_NOT_EXIST",e[e.RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT=25467]="RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT=25468]="RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_NOT_FRIEND=25469]="RC_FRIEND_NOT_FRIEND",e[e.RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT=25470]="RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND=25471]="RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND",e[e.RC_FRIEND_NOT_EXIST=25472]="RC_FRIEND_NOT_EXIST",e[e.RC_FRIEND_NOT_ALLOW_ADD_SELF=25473]="RC_FRIEND_NOT_ALLOW_ADD_SELF",e[e.SERVICE_INFORMATION_AUDIT_FAILED=25480]="SERVICE_INFORMATION_AUDIT_FAILED",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",e[e.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",e[e.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",e[e.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",e[e.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",e[e.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",e[e.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",e[e.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",e[e.RC_FILE_SIZE_EXCEED_LIMIT=26106]="RC_FILE_SIZE_EXCEED_LIMIT",e[e.INVALID_PARAMETER_SIZE_NOT_FOUND=26107]="INVALID_PARAMETER_SIZE_NOT_FOUND",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.MESSAGE_NOT_SUPPORT_SENDING=30017]="MESSAGE_NOT_SUPPORT_SENDING",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",e[e.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",e[e.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",e[e.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",e[e.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",e[e.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",e[e.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",e[e.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",e[e.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",e[e.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",e[e.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",e[e.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",e[e.INVALID_PARAMETER_TIMESTRING=34224]="INVALID_PARAMETER_TIMESTRING",e[e.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",e[e.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",e[e.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",e[e.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",e[e.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",e[e.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",e[e.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",e[e.INVALID_PARAMETER_UNIQUE_ID=34236]="INVALID_PARAMETER_UNIQUE_ID",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",e[e.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",e[e.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",e[e.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",e[e.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",e[e.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",e[e.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",e[e.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",e[e.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",e[e.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",e[e.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",e[e.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",e[e.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",e[e.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",e[e.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",e[e.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",e[e.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",e[e.INVALID_PARAMETER_SPAN_MINUTES=34283]="INVALID_PARAMETER_SPAN_MINUTES",e[e.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",e[e.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",e[e.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",e[e.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",e[e.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",e[e.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",e[e.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",e[e.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",e[e.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",e[e.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",e[e.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",e[e.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",e[e.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",e[e.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",e[e.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",e[e.INVALID_PARAMETER_USER_PROFILE=34312]="INVALID_PARAMETER_USER_PROFILE",e[e.INVALID_PARAMETER_USER_PROFILE_VISIBILITY=34313]="INVALID_PARAMETER_USER_PROFILE_VISIBILITY",e[e.INVALID_PARAMETER_EXTRA=34314]="INVALID_PARAMETER_EXTRA",e[e.DB_UPGRADE_FAILED=34315]="DB_UPGRADE_FAILED",e[e.INVALID_PARAMETER_GROUP_INFO=34318]="INVALID_PARAMETER_GROUP_INFO",e[e.INVALID_PARAMETER_GROUP_ID=34319]="INVALID_PARAMETER_GROUP_ID",e[e.INVALID_PARAMETER_GROUP_NAME=34320]="INVALID_PARAMETER_GROUP_NAME",e[e.INVALID_PARAMETER_GROUP_IDS=34321]="INVALID_PARAMETER_GROUP_IDS",e[e.INVALID_PARAMETER_GROUP_MEMBER_ROLE=34322]="INVALID_PARAMETER_GROUP_MEMBER_ROLE",e[e.INVALID_PARAMETER_GROUP_APPLICATION_STATUS=34323]="INVALID_PARAMETER_GROUP_APPLICATION_STATUS",e[e.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION=34324]="INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION",e[e.INVALID_PARAMETER_NICK_NAME=34325]="INVALID_PARAMETER_NICK_NAME",e[e.INVALID_PARAMETER_REASON=34326]="INVALID_PARAMETER_REASON",e[e.INVALID_PARAMETER_REMARK=34327]="INVALID_PARAMETER_REMARK",e[e.INVALID_PARAMETER_PAGING_QUERY_OPTION=34328]="INVALID_PARAMETER_PAGING_QUERY_OPTION",e[e.NET_DATA_IS_SYNCHRONIZING=34329]="NET_DATA_IS_SYNCHRONIZING",e[e.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE=34330]="INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE",e[e.INVALID_PARAMETER_DIRECTION_TYPE=34331]="INVALID_PARAMETER_DIRECTION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE=34332]="INVALID_PARAMETER_FRIEND_APPLICATION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS=34333]="INVALID_PARAMETER_FRIEND_APPLICATION_STATUS",e[e.INVALID_PARAMETER_FRIEND_ADD_PERMISSION=34334]="INVALID_PARAMETER_FRIEND_ADD_PERMISSION",e[e.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS=34335]="INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS",e[e.RC_REAL_TIME_CONVERSATION_UNAVAILABLE=34336]="RC_REAL_TIME_CONVERSATION_UNAVAILABLE",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",e[e.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",e[e.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",e[e.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",e[e.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",e[e.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",e[e.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",e[e.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",e[e.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",e[e.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",e[e.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",e[e.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",e[e.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",e[e.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",e[e.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",e[e.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",e[e.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",e[e.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",e[e.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",e[e.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",e[e.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",e[e.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",e[e.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",e[e.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",e[e.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",e[e.DNS_PROXY_TIMEOUT=35051]="DNS_PROXY_TIMEOUT",e[e.DNS_PROXY_ERROR=35052]="DNS_PROXY_ERROR",e[e.DNS_PROXY_DATA_DESTRUCTUR_ERROR=35053]="DNS_PROXY_DATA_DESTRUCTUR_ERROR",e[e.INVALID_DISABLE_UPDATE_LAST_MESSAGE=35054]="INVALID_DISABLE_UPDATE_LAST_MESSAGE",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.STREAM_MESSAGE_DISABLE=39001]="STREAM_MESSAGE_DISABLE",e[e.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED=39002]="STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED",e[e.STREAM_MESSAGE_EXPANSION_KEY_ERROR=39003]="STREAM_MESSAGE_EXPANSION_KEY_ERROR",e[e.STREAM_MESSAGE_REQUEST_FAIL=39005]="STREAM_MESSAGE_REQUEST_FAIL",e[e.STREAM_MESSAGE_REQUEST_IN_PROCESS=39006]="STREAM_MESSAGE_REQUEST_IN_PROCESS",e[e.STREAM_MESSAGE_SYNCED=39007]="STREAM_MESSAGE_SYNCED",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.TIMEOUT=-1]="TIMEOUT"}(P||(P={})),function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(w||(w={})),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={})),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"}(V||(V={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(G||(G={})),function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.COMBINE_V2="RC:CombineV2Msg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",e.READ_STATE="RC:RSMsg",e.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",e.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",e.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg",e.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg",e.STREAM_MESSAGE="RC:StreamMsg"}(k||(k={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(F||(F={})),function(e){e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(B||(B={})),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"}(x||(x={})),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={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(K||(K={})),function(e){e[e.typing=0]="typing"}(Q||(Q={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(W||(W={})),function(e){e[e.Other=0]="Other",e[e.iOS=1]="iOS",e[e.Android=2]="Android",e[e.Web=3]="Web",e[e.PC=4]="PC",e[e.Mini=5]="Mini",e[e.HarmonyOS=6]="HarmonyOS"}(j||(j={})),function(e){e[e.ONLINE_STATUS=1]="ONLINE_STATUS",e[e.USER_PROFILE=2]="USER_PROFILE",e[e.FRIEND_ONLINE_STATUS=3]="FRIEND_ONLINE_STATUS",e[e.FRIEND_USER_PROFILE=4]="FRIEND_USER_PROFILE"}(J||(J={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(z||(z={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(Z||(Z={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(X||(X={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}($||($={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(ee||(ee={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(te||(te={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(ne||(ne={})),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={})),function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(ie||(ie={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(oe||(oe={}));var fe,ge,Ee,Ie,ve,Te,Re,me,ye,Se,Ce,Ae=function(e){return e===oe.OPEN?ie.AT_MESSAGE_NOTIFICATION:ie.NOT_SET},Ne=function(e){return e<=ie.NOT_SET?oe.CLOSE:oe.OPEN};!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(fe||(fe={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(ge||(ge={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Ee||(Ee={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(Ie||(Ie={})),function(e){e[e.CURRENT=2]="CURRENT"}(ve||(ve={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(Te||(Te={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Re||(Re={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(me||(me={})),function(e){e[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"}(ye||(ye={})),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"}(Se||(Se={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Ce||(Ce={}));var Oe=72e5,Me=6e4,Ue=131072,Le={"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:!0},"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}},be="5.20.0-c-unikit.1".replace(/-.+$/,""),Pe=5368709120,we=10485760,De="rongcloudsystem",Ve=864e5,Ge=function(e){return"navi_".concat(e)},ke=function(e,t){return"RCV4-con-s-".concat(e,"-").concat(t)},Fe=function(e,t){return"RCV4-con-".concat(e,"-").concat(t)},Be=function(e,t){return"RCV4-CONVER-".concat(e,"-").concat(t)},xe=function(e,t){return"RCV4-ultragroupconversation-".concat(e,"-").concat(t)},He=function(e,t){return"outbox_".concat(e,"_").concat(t)},qe=function(e,t){return"inbox_".concat(e,"_").concat(t)},Ye=function(e,t){return"broadcastbox_".concat(e,"_").concat(t)},Ke=function(e,t){return"send_msg_".concat(e,"_").concat(t)},Qe=function(e,t){return"RC-us-".concat(e,"-").concat(t)},We=function(e){return"rc-static-config-".concat(e)},je=function(e){return"RC-cc-".concat(e)},Je=function(e,t){return"RC-RR-".concat(e,"-").concat(t)},ze=function(e,t){return"RC-PEC-".concat(e,"-").concat(t)},Ze="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Ze.engine="5.20.0-c-unikit.1";var Xe=function(){function e(){}return e.add=function(e,t){Ze[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 Ze.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Ze},e}();var $e={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),i=Math.floor(Math.random()*n).toString(36),o=e-r.length-i.length;return[i,r,o>0?(t=o,Array.from({length:t}).map((function(){return Math.floor(36*Math.random()).toString(36)})).join("")):""].join("").slice(0,e)}},et=$e.genWithLen(22),nt=Date.now(),rt=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),it=function(){function e(){this._map=new Map,this._piped=new Set}return e.prototype._addItem=function(e,t,n,r,i){void 0===i&&(i=0);var o=Symbol(),s=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:o,priority:Math.min(i,100),listener:t.bind(r),once:n},u=s.findIndex((function(e){return e.priority>i}));return-1===u?s.push(a):s.splice(u,0,a),o},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=le(this._map),i=r.next();!i.done;i=r.next()){var o=de(i.value,2),s=(o[0],o[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{i&&!i.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 i=r.length-1;i>=0;i-=1){var o=r[i],s=o.once,a=o.listener;s&&r.splice(i,1);try{a.apply(void 0,he([],de(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}he([],de(this._piped.values()),!1).forEach((function(n){return n.emit.apply(n,he([e],de(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 ue(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 ue(this,void 0,void 0,(function(){var e,t,n,r,i;return ce(this,(function(o){switch(o.label){case 0:return this._isPulling?[4,this._isPulling]:[3,2];case 1:return o.sent(),[2];case 2:return this._isPulling=this._sendRequest(this._dataVersion),[4,this._isPulling];case 3:if(e=o.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 i=this._versionQueue.filter((function(e){return e>n})),this._versionQueue=he([],de(i),!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}}(it);var ot=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}(),st=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 ue(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 ue(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?at(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?at(void 0,this.msg):ut(this.code,this.msg)},e}(),at=function(e,t){return new st(0,t||"success",e)},ut=function(e,t,n){return new st(e,t||"fail: ".concat(e),n)},ct=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?at():ut(this._code,this._errmsg)},e.prototype.validate=function(e,t,n,r){if(void 0===r&&(r=!1),!this._isValid)return this;var i=r?n(t):null==t||n(t);return this._isValid=i,i||(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 rt.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,i){return void 0===i&&(i=!1),this.isString(e,t,i).validate(e,t,(function(e){return e.length>=n&&e.length<=r}),i)},e.prototype.assertLimitedString=function(e,t,n,r,i){return void 0===i&&(i=!1),this.assertString(e,t,i),this.assert(e,t,(function(e){return e.length>=n&&e.length<=r}),i)},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,i){return void 0===i&&(i=!1),this.isNumber(e,t,i).validate(e,t,(function(e){return e>=n&&e<=r}),i)},e.prototype.assertLimitedNumber=function(e,t,n,r,i){return void 0===i&&(i=!1),this.assertNumber(e,t,i),this.assert(e,t,(function(e){return e>=n&&e<=r}),i)},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,i){return void 0===i&&(i=!1),this.isInteger(e,t,i).validate(e,t,(function(e){return e>=n&&e<=r}),i)},e.prototype.assertLimitedInteger=function(e,t,n,r,i){return void 0===i&&(i=!1),this.assertInteger(e,t,i),this.assert(e,t,(function(e){return e>=n&&e<=r}),i)},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,i){return void 0===r&&(r=!1),void 0===i&&(i=1),this.isArray(e,t,r).validate(e,t,(function(e){return e.length>=i&&e.length<=n}),r)},e.prototype.assertLimitedArray=function(e,t,n,r,i){return void 0===r&&(r=!1),void 0===i&&(i=1),this.assertArray(e,t,r),this.assert(e,t,(function(e){return e.length>=i&&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,i,o){return void 0===i&&(i=!1),void 0===o&&(o=1),this.isLimitedArray(e,t,n,i,o).validate(e,t,(function(e){return e.every(r)}),i)},e.prototype.assertLimitedTypedArray=function(e,t,n,r,i,o){return void 0===i&&(i=!1),void 0===o&&(o=1),this.assertLimitedArray(e,t,n,i,o),this.assert(e,t,(function(e){return e.every(r)}),i)},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}(),lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function dt(e){var t,n,r,i,o,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=lt.indexOf(e.charAt(u++))<<2|(i=lt.indexOf(e.charAt(u++)))>>4,n=(15&i)<<4|(o=lt.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(s=lt.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(r));return a}var ht=function(e){return"string"==typeof e},pt=function(e){return"boolean"==typeof e},_t=function(e){return"number"==typeof e&&!Number.isNaN(e)},ft=function(e){return function(t){return Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max)}},gt=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Et=function(e){return function(t){return ht(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))}},It=function(e){return ht(e)&&e.length>0},vt=function(e){return gt(e)&&e.length>0},Tt=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Rt=function(e){return"[object Function]"===Object.prototype.toString.call(e)},mt=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},yt=function(e){return"[object Null]"===Object.prototype.toString.call(e)},St=function(e){return ht(e)&&/https?:\/\//.test(e)},Ct=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},At=function(e){return _t(e)&&Object.prototype.hasOwnProperty.call(w,e)},Nt=function(e){return _t(e)&&Object.prototype.hasOwnProperty.call(ie,e)},Ot=function(e){var t=!1;return ht(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Mt=function(e){return Object.values(e.type).includes(e.value)},Ut=function(e){return Et({minLength:1,maxLength:64})(e)},Lt=function(e){return Et({minLength:1,maxLength:64})(e)&&/^[a-zA-Z0-9+=\-_|:]*$/.test(e)},bt=function(e){return _t(e)&&Object.prototype.hasOwnProperty.call(V,e)},Pt=function(e){var t=!1,n=!1,r=!1;if(Tt(e)){var i=Object.keys(e).length;for(var o in t=i>20,e)if(n||(n=ht(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!r){var s=e[o];r=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:r}},wt=function(e){if(!Tt(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)},Dt=function(e,t,n){var r=null==n?void 0:n.isReverse;Tt(e)&&function(){for(var n in e)t(e[n],n,e)}(),(gt(e)||ht(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()},Vt=function(e,t){return Dt(e,(function(n,r){e[r]=t(n,r)})),e},Gt=function(e){return JSON.parse(JSON.stringify(e))},kt=function(){return"undefined"!=typeof RCCppEngine},Ft=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(Ft(e[n]));else for(var n in t={},e)t[n]=Ft(e[n]);else t=e;return t},Bt=function(e){var t;try{t=Ft(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},xt=function(e){return{isRead:(e&fe.READ)===fe.READ,isListened:(e&fe.LISTENED)===fe.LISTENED,isDownload:(e&fe.DOWNLOADED)===fe.DOWNLOADED,isRetrieved:(e&fe.RETRIEVED)===fe.RETRIEVED}},Ht=function(e){var t=fe.UNREAD;return(null==e?void 0:e.isRead)&&(t|=fe.READ),(null==e?void 0:e.isListened)&&(t|=fe.LISTENED),(null==e?void 0:e.isDownload)&&(t|=fe.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=fe.RETRIEVED),t},qt=function(e){return[j.Android,j.iOS,j.Web,j.PC,j.Mini,j.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]}))},Yt=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},Kt=function(e,t,n){return t?1===n?D.TLS:D.RMTP:"http"===e?D.WS:D.WSS},Qt=function(e,t){var n=e.server,r=e.backupServer,i=e.bs,o=e.serverAddr,s=e.protocol,a=e.openTLS;if(o)return he([],de(o.filter((function(e){return e.addr}))),!1);var u=[],c=[];return n&&c.push(n),(r||i||"").split(",").forEach((function(e){c.indexOf(e)<0&&c.push(e)})),c.forEach((function(e,r){e&&u.push({addr:e,protocol:Kt(s,t,a),weight:n.length-r,race:!1})})),he([],de(u),!1)},Wt=function(e){return void 0===e&&(e=[]),e.map((function(e){var t,n,r,i,o,s,a,u,c,l=Xt(e.settingProfile)||{},d=e.extProfile||[],h=e.targetId,p=e.baseInfo,_=e.userInfo;return{groupId:h,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!==(i=l.announcement)&&void 0!==i?i:"",extProfile:Xt(d),joinPermission:~~l.joinPerm,removeMemberPermission:~~l.removePerm,invitePermission:~~l.memInvitePerm,inviteHandlePermission:~~l.invitePerm,groupInfoEditPermission:~~l.profilePerm,memberInfoEditPermission:~~l.memProfilePerm,creatorId:null!==(o=null==p?void 0:p.creatorId)&&void 0!==o?o:"",ownerId:null!==(s=null==p?void 0:p.ownerId)&&void 0!==s?s:"",createTime:(null==p?void 0:p.createTime)?wt(p.createTime):0,membersCount:null!==(a=null==p?void 0:p.memberCount)&&void 0!==a?a:0,remark:null!==(u=null==_?void 0:_.remarkName)&&void 0!==u?u:"",joinedTime:(null==_?void 0:_.joinTime)?wt(_.joinTime):0,role:null!==(c=null==_?void 0:_.role)&&void 0!==c?c:E.UNDEF}}))},jt=function(e){return void 0===e&&(e=[]),e.map((function(e){var t=Xt(e.settingProfile),n=e.extProfile||[],r=e.targetId,i=e.baseInfo,o=e.userInfo;return JSON.parse(JSON.stringify(se(se({groupId:r},zt(t)),{extProfile:n.length>0?Xt(n):void 0,creatorId:null==i?void 0:i.creatorId,ownerId:null==i?void 0:i.ownerId,createTime:(null==i?void 0:i.createTime)?wt(i.createTime):void 0,membersCount:null==i?void 0:i.memberCount,remark:null==o?void 0:o.remarkName})))}))},Jt=function(e){if(void 0!==e){var t=Number(e);return Number.isNaN(t)?void 0:t}},zt=function(e){return JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:Jt(e.joinPerm),removeMemberPermission:Jt(e.removePerm),invitePermission:Jt(e.memInvitePerm),inviteHandlePermission:Jt(e.invitePerm),groupInfoEditPermission:Jt(e.profilePerm),memberInfoEditPermission:Jt(e.memProfilePerm)}))},Zt=function(e){void 0===e&&(e=[]);var t=e.map((function(e){var t=e||{},n=t.ext,r=t.userId,i=t.name,o=t.portraitUrl,s=n||{},a=s.role,u=s.joinTime,c=s.channelNickName,l=s.additional;return{userId:r,name:i||"",portraitUri:o||"",nickname:c||"",role:a||E.UNDEF,joinedTime:wt(u)||0,extra:l||""}}));return t},Xt=function(e){var t={};return e&&0!==e.length?(e.forEach((function(e){t[e.key]=e.value})),t):t},$t=function(e){return e.map((function(e){var t=e.targetId,n=e.joinUserInfo,r=e.inviterInfo,i=e.status,o=e.directionType,s=e.detail,a=e.joinType,u=e.processInfo,c=e.processTime;return se(se(se(se({groupId:t},n&&{joinMemberInfo:Zt([n])[0]}),r&&{inviterInfo:Zt([r])[0]}),u&&{operatorInfo:Zt([u])[0]}),{status:i,direction:o,type:a,operationTime:wt(c),reason:s})}))},en=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 tn(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 nn,rn=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=$e.gen(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s=".".concat(a[a.length-1])}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(o).concat(r).concat(s)},on=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},sn=function(e){var t=e.length;return t<=4096&&t>=1},an=(nn=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,8)-1)),n=e+nn.toString(2).padStart(11,"0")+t.toString(2).padStart(8,"0");return nn=2047&++nn,parseInt(n,2)}),un=function(){var e=Xe.getInfo(),t="electron";for(var n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-next"].includes(n)?n:"electron");return t},cn=function(e,t,n){return ue(void 0,void 0,void 0,(function(){var r,i;return ce(this,(function(o){switch(o.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(t),"AES-CBC",!0,["decrypt"])];case 1:return r=o.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},r,tn(e))];case 2:return i=o.sent(),[2,(new TextDecoder).decode(i)]}}))}))};function ln(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 dn,hn,pn,_n=function(e,t){if(!e)return"";var n=e.ossConfig,i=void 0===n?"":n,o="";try{var s=JSON.parse(i);if(s.length>0){var a=s.find((function(e){return e.minio}));a&&(o=a.minio)}}catch(e){t.warn(r.L_PARSE_JSON_E,JSON.stringify({ossConfig:i,error:e}))}return o};function fn(e){var t=e.method||Ce.GET,n=e.timeout||Me,r=e.headers,i=e.query,o=e.body,s=e.onProgress,a=en(e.url,i),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 ot((function(i){e.onreadystatechange=function(){4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},r&&(e.upload.onprogress=function(e){return r(e)}),0!==t&&setTimeout((function(){e.abort(),i({status:e.status})}),t),e.send(n)}),(function(t){e.abort(),t({status:-1})}))}(u,n,o,s)}!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(dn||(dn={})),function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA",e[e.SG_A=4]="SG_A",e[e.SG_B=4]="SG_B",e[e.SA=5]="SA"}(pn||(pn={}));var gn=((hn={})[pn.BJ]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5yb25nLWVkZ2UuY29t"]},hn[pn.SG]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1saWdodC1lZGdlLmNvbQ=="]},hn[pn.NA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy51cy1saWdodC1lZGdlLmNvbQ=="]},hn[pn.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1iLWxpZ2h0LWVkZ2UuY29t"]},hn[pn.SA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:D.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zYXUtbGlnaHQtZWRnZS5jb20="]},hn);function En(e){return pn[e]?e:pn.BJ}var In,vn=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||{},i=r.areaCode,o=r.navigators,s=(n=i,void 0===n&&(n=pn.BJ),gn[En(n)].naviUrlBase64).map((function(e){return dt(e)})),a=[],u=de(e.split("@"),2)[1];t&&(a=u?u.split(";"):[]);var c=o&&o.length>0?he(he([],de(a),!1),de(o),!1):he(he([],de(a),!1),de(s),!1);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return ln(e)}))},e.prototype.getLogUrlPolicyList=function(e,t){var n,i=e||{},o=i.log,s=i.logPolicy,a=this.initOption||{},u=a.areaCode,c=a.logServerUrl,l=(n=u,void 0===n&&(n=pn.BJ),gn[En(n)].logUrlBase64).map((function(e){return se(se({},e),{addr:dt(e.addr)})})),d=[],h={level:1,itv:6,times:5};if(o)d.push.apply(d,he([],de(o.addrs),!1)),Object.assign(h,o.policy);else if(s)try{var p=JSON.parse(s);d.push({addr:p.url,protocol:D.HTTPS,weight:1}),h.level=p.level,h.itv=p.itv,h.times=p.times}catch(n){t.warn(r.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var _=c?he([{addr:c,protocol:D.HTTPS,weight:101}],de(d),!1):he(he([],de(d),!1),de(l),!1);return{policy:h,addrs:_.filter((function(e,t){return _.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return se(se({},e),{addr:ln(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=pn.BJ),gn[En(t)].miniCmpBase64).map((function(e){return dt(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=pn.BJ),gn[En(t)].staticConfigUrlBase64).map((function(e){return dt(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=pn.BJ),gn[En(n)].cloudControllerUrlBase64).map((function(e){return dt(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:pn.BJ},e.prototype.setAreaCode=function(e){return!(!e||!pn[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)},e.prototype.getStatsUrlList=function(e){var t,n,r=(e||{}).active,i=(null==r?void 0:r.addrs)||[],o=(n=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===n&&(n=pn.BJ),gn[En(n)].statsUrlBase64).map((function(e){return dt(e)}));return 0===i.length?o:he(he([],de(i.sort((function(e,t){return t.weight-e.weight})).map((function(e){return ln(e.addr,e.protocol)}))),!1),de(o),!1)},e}(),Tn=new vn,Rn=function(){function e(e,t){this.appkey=e,this.logger=t,this.staticUrls=[]}return e.prototype.getStaticConfig=function(){var e;return ue(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:if(!(t=this.getCache()))return[3,6];l.label=1;case 1:return l.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 i=l.sent(),(o=i.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:o.map((function(e){return ln(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return s=l.sent(),this.logger.error(r.L_GET_STATIC_CONF_E,JSON.stringify({error:null==s?void 0:s.stack})),[3,5];case 5:this.clearCache(),l.label=6;case 6:return[4,this._requestHandle()];case 7:return(a=l.sent())?[4,this.decryptData(a)]:[2];case 8:return(null==(u=l.sent())?void 0:u.areaCode)!==Tn.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:a})),this.staticUrls=(null==u?void 0:u.bootstrap)||[],(c=null===(e=null==u?void 0:u.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:c.map((function(e){return ln(e.addr,e.protocol)}))||[]}])}}))}))},e.prototype._requestHandle=function(){return ue(this,void 0,void 0,(function(){var e,t,n,i,o,s,a,u,c,l,d;return ce(this,(function(h){switch(h.label){case 0:e=(e=he(he([],de(this.staticUrls),!1),de(Tn.getStaticConfigUrl()),!1).map((function(e){return ln(e)}))).filter((function(t,n){return e.indexOf(t)===n})),h.label=1;case 1:h.trys.push([1,6,7,8]),t=le(e),n=t.next(),h.label=2;case 2:return n.done?[3,5]:(i=n.value,this.logger.info(r.L_GET_STATIC_CONF_T,JSON.stringify({url:i})),o=Date.now(),[4,this.sendRequest("".concat(i,"/").concat(this.appkey))]);case 3:if(s=h.sent(),a=s.code,u=s.data,200===a)return this.logger.info(r.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:a,duration:Date.now()-o})),[2,u];this.logger.warn(r.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:a,duration:Date.now()-o})),h.label=4;case 4:return n=t.next(),[3,2];case 5:return[3,8];case 6:return c=h.sent(),l={error:c},[3,8];case 7:try{n&&!n.done&&(d=t.return)&&d.call(t)}finally{if(l)throw l.error}return[7];case 8:return[2]}}))}))},e}();!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD",e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(In||(In={}));var mn,yn=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=In.WARN,this.debug=this._log.bind(this,In.DEBUG),this.info=this._log.bind(this,In.INFO),this.warn=this._log.bind(this,In.WARN),this.error=this._log.bind(this,In.ERROR),this.__statistics=this._log.bind(this,In.STATISTICS),this.record=this.__statistics}return e.prototype._write=function(e){var t=e.tag,n=e.level,r=e.content,i=e.traceId;/^[\w-]+$/.test(t)?n!==In.DEBUG&&this._handleWrite(e):console.error("".concat((new Date).toISOString(),"[").concat(this._id,"]['ERROR']: ").concat(t," | ").concat(r," | ").concat(i))},e.prototype.createTraceId=function(){return"".concat(++e._traceIdCount)},e.prototype.getSessionId=function(){return et},e.prototype._stdout=function(e){var t=e.time,n=e.tag,r=e.content,i=e.traceId,o=e.level,s=e.loggerId;if(console&&!(o<=In.FATAL||o>this.outputLevel)){var a=["error","warn","info","debug"][o-1],u="".concat(new Date(t).toISOString(),"[").concat(null!=s?s:this._id,"][").concat((a||"stat").toUpperCase(),"]: ").concat(n," | ").concat(r," | ").concat(i);console[a||"warn"](u)}},e.prototype.setOutputLevel=function(e){(function(e){return[In.DEBUG,In.INFO,In.WARN,In.ERROR].some((function(t){return t===e}))})(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,r){var i={time:Date.now(),level:e,tag:t,content:n,traceId:r,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(i),this._write(i)},e.prototype.summary=function(e,t,n,r,i,o){var s,a;void 0===r&&(r={}),t.isOk?this.info(e,null!==(s=null==i?void 0:i())&&void 0!==s?s:JSON.stringify(se({isOk:!0},r)),n):this.warn(e,null!==(a=null==o?void 0:o())&&void 0!==a?a:JSON.stringify(se({code:t.code,msg:t.msg},r)),n)},e._traceIdCount=0,e}(),Sn=function(){function e(e,t,n,r,i,o){void 0===o&&(o=!1),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=r,this.logger=i,this.disableLogReport=o,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 ue(this,void 0,void 0,(function(){var n,r,i;return ce(this,(function(o){return this.started?[2]:(this.userId=e.userId,!e.logSwitch||this.disableLogReport||(n=Tn.getLogUrlPolicyList(e,this.logger),r=n.policy,i=n.addrs,this.started=!0,this.itvByNavi=r.itv,this.timesByNavi=r.times,i.length>0&&this.realtimeReport(i[0].addr,r.level,r.itv,t)),[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,i){return ue(this,void 0,void 0,(function(){var o,s,a,u,c,l,d,h,p,_;return ce(this,(function(f){switch(f.label){case 0:return this.logger.debug(r.L_REALTIME_LOG_O,"compress logs: ".concat(e.length)),[4,this.compressLogs(e)];case 1:return o=f.sent(),s=o.success,a=o.data,s?(this.logger.debug(r.L_REALTIME_LOG_O,"compress done",t),u=St(n)?n:"https://".concat(n),u+="?version=".concat("5.20.0-c-unikit.1","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:u,body:a,method:"POST"})]):(this.logger.warn(r.L_REALTIME_LOG_R,"compress failed",t),[2,{isOk:!1,itv:i}]);case 2:if(c=f.sent(),l=c.status,d=c.data,this.logger.debug(r.L_REALTIME_LOG_R,JSON.stringify({status:l,data:d}),t),200!==l)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(i+=i),this.reportFailedNumber++,[2,{isOk:!1,itv:i}];if(this.reportFailedNumber=0,d)try{(_=JSON.parse(d)).nextTime&&(i=_.nextTime),h=_.level,p=_.logSwitch}catch(e){this.logger.warn(r.L_PARSE_JSON_E,JSON.stringify({error:null==e?void 0:e.stack}),t)}return[2,{isOk:!0,itv:i,level:h,logSwitch:p}]}}))}))},e.prototype.realtimeReport=function(e,t,n,i){return ue(this,void 0,void 0,(function(){var o,s,a,u,c,l,d,h,p,_,f,g,E=this;return ce(this,(function(I){switch(I.label){case 0:return o=Date.now(),s=this.logDB.getTimestamp4RealtimeLog()||nt,a=Math.max(o-3e4,s+1),u=this.logger.createTraceId(),this.logger.debug(r.L_REALTIME_LOG_T,JSON.stringify({startTime:s,endTime:a,level:t,itv:n}),u),[4,this.logDB.getLogs(s,a,t,!0,i)];case 1:return c=I.sent(),l=c.dbReady,d=c.logs,l?[3,2]:(this.logger.warn(r.L_REALTIME_LOG_R,"get logs failed",u),[3,5]);case 2:return 0!==d.length?[3,3]:(this.logger.debug(r.L_REALTIME_LOG_R,"no logs",u),[3,5]);case 3:return d.length>0?[4,this._sendLogs2Realtime(d,u,e,n)]:[3,5];case 4:h=I.sent(),p=h.itv,_=h.level,f=h.logSwitch,h.isOk&&(g=Math.max.apply(Math,he([],de(d.map((function(e){return e.time}))),!1)),this.logDB.setTimestamp4RealtimeLog(g+1),0===f&&(this.started=!1),void 0!==_&&(t=_)),n=p,I.label=5;case 5:return this.started&&(n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return E.realtimeReport(e,t,n,i)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,o,s,a){return void 0===a&&(a=!1),ue(this,void 0,void 0,(function(){var u,c,l,d,h,p,_,f,g,E;return ce(this,(function(I){switch(I.label){case 0:return"web"!==n.toLowerCase()||this.disableLogReport?[2]:(u=this.logger.createTraceId(),this.logger.info(r.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:o,messageUId:s,isCloudControl:a}),u),[4,this.logDB.getLogs(e,t,In.DEBUG,!1)]);case 1:return c=I.sent(),l=c.dbReady,d=c.logs,this.logger.info(r.L_REPORT_FULL_LOG_O,JSON.stringify({count:d.length}),u),h=St(i)?i:"https://".concat(i),h+="?version=".concat("5.20.0-c-unikit.1","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(o),l?d.length>0?[4,this.compressLogs(d)]:[3,3]:[3,5];case 2:return _=I.sent(),f=_.success,g=_.data,p=f?g:"compress failed",[3,4];case 3:p="no data",I.label=4;case 4:return[3,6];case 5:p="no database",I.label=6;case 6:return this.logger.debug(r.L_REPORT_FULL_LOG_O,"compress done",u),a&&(h+="&source=cloud"),[4,this.send({url:h,body:p,method:"POST"})];case 7:return E=I.sent().status,this.logger.info(r.L_REPORT_FULL_LOG_R,JSON.stringify({status:E}),u),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Cn=function(e){var t=e.sessionId,n=e.level,r=e.loggerId,i=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content;ht(u)||(u=JSON.stringify(u));var c=n<0?u||"":JSON.stringify({content:u,traceId:i,from:r});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").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"}(mn||(mn={}));var An=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,i,o=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!==(i=e.uri)&&void 0!==i?i:"";e.logId!==this.logId&&""!==c&&(this.logId=e.logId,this.reporter.report(s,a,u,c,e.logId,"",!0).finally((function(){o.taskLock=!0,o.uploadTask.length>0&&o.enqueueTask()})))},e.prototype.enqueueTask=function(){if(this.taskLock){var e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}},e}();var Nn,On,Mn,Un,Ln=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 An(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===k.LOG_COMMAND&&t.uploadTaskManage.uploadLogCmdTask(e)}))},e.prototype.dataHandle=function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,Ct(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 ue(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,h,p;return ce(this,(function(_){switch(_.label){case 0:return!this.isEable&&t===mn.init&&this.isExire()?(this.logger.info(r.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===mn.newWorkChange&&this.isOverclock()?(this.logger.info(r.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(i=ln(e),this.lastRequestTime=(new Date).getTime(),o="".concat(i,"/v1/config"),s={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(s["RC-Token"]=n),a={platform:"web",version:"5.20.0-c-unikit.1",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,Ce.POST,s,a)]);case 1:return u=_.sent(),c=u.code,l=u.data,this.logger.record(re.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:l})),c===P.CLOUD_DATA_CENTER_INVALID&&l&&l.targetRegion?(d=l.targetRegion,this.changeAreaCode===d?[2,this.timestamp]:(h=Tn.setAreaCode(d),this.logger.info(r.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:h,originAreaCode:Tn.getAreaCode(),newAreaCode:d})),this.changeAreaCode=d,(p=Tn.getCloudControllerUrl(d))[0]?[2,this.request(p[0],mn.other)]:(this.logger.info(r.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:o,msg:"appkey region error"})),[2,this.timestamp]))):(l&&this.dataHandle(l),[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}(),bn=function(e){return e===P.RC_CONN_REDIRECTED},Pn=function(e){function n(t,n,r){var i=e.call(this)||this;return i.appkey=t,i.navi=n,i.logger=r,Nn.add(i),i.token="",i.curCmpUrl="",i.retryCount=0,i.uuid="",Un.set(i,0),i._doConnectReason=0,i._network={status:!0,type:Se.UNKONWN},i._checkAliveTimer=null,i._crtConnectionStatus=X.DISCONNECTED,i._crtUserId="",i._openCallPlus=!1,i._crtConnectionTask=null,i.reconnectTimer=null,i._failedCount=0,i.ALLOW_FAILED_TIMES=2,i}return t(n,e),n.prototype.getToken=function(){return this.token},Object.defineProperty(n.prototype,"cid",{get:function(){return"".concat(this.uuid,"_").concat(this.retryCount)},enumerable:!1,configurable:!0}),n.prototype.getCurrentUserId=function(){return this._crtUserId},n.prototype.setConnectionStatus=function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus===X.DISCONNECTED&&e===X.CONNECTING&&(this._doConnectReason=Re.CONNECT,pe(this,Nn,"m",Mn).call(this)),this._crtConnectionStatus===X.CONNECTED&&e===X.SUSPENDED&&(t===P.RC_PING_EXCEED_LIMIT?this._doConnectReason=Re.TIMEOUT:t===P.RC_CONN_REDIRECTED?this._doConnectReason=Re.REDIRECTED:this._doConnectReason=Re.RECONNECT),this._crtConnectionStatus===X.CONNECTED){var n={bid:un(),cod:t,net:this.getNetwork().type,dur:Date.now()-pe(this,Un,"f"),cid:this.cid};this.logger.record(re.IM_CONNECTION_DURATION,JSON.stringify(n)),e===X.SUSPENDED&&pe(this,Nn,"m",Mn).call(this)}switch(this._crtConnectionStatus=e,e){case X.CONNECTED:this.logger.info(r.L_CONNECT_S,"status: ".concat(e)),this.checkAlive(),pe(this,Nn,"m",On).call(this).emit("onConnected");break;case X.CONNECTING:this.logger.warn(r.L_CONNECT_S,"status: ".concat(e)),pe(this,Nn,"m",On).call(this).emit("onConnecting");break;case X.SUSPENDED:this.logger.warn(r.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),bn(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),pe(this,Nn,"m",On).call(this).emit("onSuspend",t);break;default:this.logger.warn(r.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),pe(this,Nn,"m",On).call(this).emit("onDisconnected",t)}}},n.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},n.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},n.prototype.getNetwork=function(){return this._network},n.prototype.connect=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s;return ce(this,(function(a){switch(a.label){case 0:return this._crtConnectionStatus===X.CONNECTED?[2,at(this._crtUserId)]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.token=e,this.setConnectionStatus(X.CONNECTING),[4,this.try2Connect(e,t,!1,r,!0)]);case 1:return i=a.sent(),o=i.code,s=i.data,o!==P.SUCCESS?(this.setConnectionStatus(X.DISCONNECTED,o),[2,ut(o)]):(this.setConnectionStatus(X.CONNECTED),[2,at(s)])}}))}))},n.prototype.try2Connect=function(e,t,n,r,i){return ue(this,void 0,void 0,(function(){var o;return ce(this,(function(s){switch(s.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,r,i),[4,this._crtConnectionTask]);case 1:return o=s.sent(),this._crtConnectionTask=null,[2,o]}}))}))},n.prototype.createConnectionTask=function(e,t,n,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c,l,d,h,p,_,f;return ce(this,(function(g){switch(g.label){case 0:return s={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(s)),a={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},[4,this.navi.request(e,n,!1,i,a)];case 1:return u=g.sent(),c=u.code,l=u.data,c!==P.SUCCESS?[2,ut(c)]:1===(d=l).type?[2,ut(P.PACKAGE_ENVIRONMENT_ERROR)]:(this.logger.info(r.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),i),[4,this.connectWithToken(e.replace(/@.+$/,"@"),d,t,i)]);case 2:return h=g.sent(),p=h.code,_=h.data,o||p===P.SUCCESS||(this.retryCount+=1),bn(p)?(this.logger.warn(r.L_CONNECT_R,"redirect code: ".concat(p),i),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,i,o)]):[P.RC_TCP_RESET,P.RC_CONN_ACK_TIMEOUT,P.RC_TCP_DISCONNECTED_NO_RMTP].includes(p)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),f=this.cmpWeightCache.every((function(e){return e.failed})),o&&f?(this.logger.warn(r.L_CONNECT_R,"cpp code:".concat(p,",reture code:").concat(P.SERVER_UNAVAILABLE),i),[2,ut(P.SERVER_UNAVAILABLE)]):(this.logger.warn(r.L_CONNECT_R,"cmp ack timeout, code: ".concat(p),i),this.setConnectionStatus(X.SUSPENDED,p),this.setConnectionStatus(X.CONNECTING),[2,this.createConnectionTask(e,t,!1,i,o)])):p!==P.SUCCESS?(this.logger.warn(r.L_CONNECT_R,"code: ".concat(p),i),[2,ut(p)]):(this.logger.info(r.L_CONNECT_R,"userId: ".concat(_),i),_e(this,Un,Date.now(),"f"),this._crtUserId=_,[2,at(_)])}}))}))},n.prototype.try2Reconnect=function(e,t){return ue(this,void 0,void 0,(function(){var n,i,o=this;return ce(this,(function(s){return n=this.logger.createTraceId(),this.logger.debug(r.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),i=function(){return ue(o,void 0,void 0,(function(){var r;return ce(this,(function(o){switch(o.label){case 0:return this._crtConnectionStatus!==X.SUSPENDED?[2]:(this.setConnectionStatus(X.CONNECTING,t),[4,this.try2Connect(this.token,!0,e,n,!1)]);case 1:return r=o.sent().code,this.reconnectTimer=null,r===P.SUCCESS?(this.setConnectionStatus(X.CONNECTED),[2]):[P.SERVER_UNAVAILABLE,P.TIMEOUT,P.RC_SOCKET_DISCONNECTED,P.RC_SOCKET_NOT_CREATED,P.RC_CONN_ACK_TIMEOUT,P.RC_TCP_RESET,P.RC_NAVI_REQ_FAILED,P.RC_NETWORK_DOWN,P.RC_TCP_DISCONNECTED_NO_RMTP].includes(r)?(this._crtConnectionStatus!==X.CONNECTING||(this.setConnectionStatus(X.SUSPENDED,r),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus(X.DISCONNECTED,r),[2])}}))}))},i(),[2]}))}))},n.prototype.onDisconnectByServer=function(e,t){var n=this;return bn(e)?(this.setConnectionStatus(X.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===P.RC_UDP_DISCONNECTED?(this.setConnectionStatus(X.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(X.DISCONNECTED,e)},n.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(X.SUSPENDED,e),this.try2Reconnect(!1,e)},n.prototype.checkAlive=function(){return ue(this,void 0,void 0,(function(){var e,t,n=this;return ce(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==X.CONNECTED?(this._failedCount=0,this.logger.debug(r.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.debug(r.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=i.sent())===P.SUCCESS?(this.logger.debug(r.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==X.CONNECTED?[2]:(this._failedCount+=1,this.logger.debug(r.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(r.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),[4,this.close(!0)]));case 2:return i.sent(),this.setConnectionStatus(X.SUSPENDED,P.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,P.RC_PING_EXCEED_LIMIT),[2]}}))}))},n.prototype.disconnect=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){switch(n.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:n.sent(),n.label=2;case 2:return this.setConnectionStatus(X.DISCONNECTED,P.ACTIVE_DISCONNECT),[2,this.close(!1,e,t)]}}))}))},n.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},n.prototype.getCmpList=function(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return he([],de(this.cmpWeightCache),!1);var n=Qt(e,t);return this.cmpWeightCache=he([],de(n),!1),he([],de(n),!1)},n.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 i=Math.max.apply(Math,he([],de(this.cmpWeightCache.map((function(e){return e.weight}))),!1));r.weight!==i&&(r.weight=i+1)}else{var o=Math.min.apply(Math,he([],de(this.cmpWeightCache.map((function(e){return e.weight}))),!1));r.weight!==o&&(r.weight=o-1),r.failed=!0}}},n.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},n.prototype.reconnect=function(e,t,n,r){this.token=e,this._openCallPlus=n,this.onDisconenctUnusual(r)},n}(it);Un=new WeakMap,Nn=new WeakSet,On=function(){return this},Mn=function(){this.uuid=$e.gen(),this.retryCount=0};var wn,Dn,Vn,Gn=function(e){return e.replace(/@.+$/,"@")},kn=function(){function e(e,t,n,r,i){void 0===r&&(r=!0),void 0===i&&(i=!0),this.appkey=e,this.logger=t,this.staticConfigManager=n,this.isRequestProfile=r,this.isUseDynamicNaviUrl=i,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,i){return ue(this,void 0,void 0,(function(){var o;return ce(this,(function(s){switch(s.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,r,i),[4,this.crtRequest]);case 1:return o=s.sent(),this.crtRequest=null,[2,o]}}))}))},e.prototype.sendRequest=function(e,t,n,i,o){var s;return ue(this,void 0,void 0,(function(){var a,u,c,l,d,h,p,_,f,g,E,I,v,T,R,m,y;return ce(this,(function(S){switch(S.label){case 0:return a=Gn(e),u=this.getNaviCache(a),!t&&u&&(c=u.timestamp,l=u.naviInfo,n||Date.now()-c<Oe)?(this.logger.info(r.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:l}),i),o&&(d=o.uuid,h=o.retryCount,p=o.reason,_={bid:un(),ptc:Ee.NAVI,cod:P.SUCCESS,net:o.type,dur:0,spr:0,pr:null!==(s=l.type)&&void 0!==s?s:0,hos:"",cache:Ie.LOCAL,v:ve.CURRENT,rsn:p,cid:"".concat(d,"_").concat(h),count:h},this.logger.record(re.IM_NAVI,JSON.stringify(_),i)),[2,at(l)]):(f=Tn.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(r.L_GET_NAVI_T,JSON.stringify({token:e,uris:f}),i),[4,this.requestHandler(f,e,i,o)]);case 1:return g=S.sent(),E=g.code,I=g.data,E===P.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(v=S.sent())?void 0:v.navi)&&(null==v?void 0:v.navi.length)>0?(T=v.navi,[4,this.requestHandler(T,e,i,o)]):[3,4];case 3:R=S.sent(),E=R.code,I=R.data,S.label=4;case 4:return E!==P.SUCCESS?(this.logger.warn(r.L_GET_NAVI_R,E,i),[2,ut(E)]):(m=I).code&&200!==m.code?(this.logger.warn(r.L_GET_NAVI_R,m.code,i),[2,ut(this.transHttpCode(m.code))]):Qt(m).length>0?(this.logger.info(r.L_GET_NAVI_R,JSON.stringify({naviInfo:m}),i),this.setNaviCache(a,m),[2,at(m)]):(y={server:m.server,backupServer:m.backupServer,serverAddr:m.serverAddr,bs:m.bs},this.logger.warn(r.L_GET_NAVI_R,"navi server address invalid: ".concat(JSON.stringify(y)),i),[2,ut(P.SERVER_UNAVAILABLE)])}}))}))},e.prototype.requestHandler=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,h;return ce(this,(function(p){switch(p.label){case 0:i=0,o=e.length,p.label=1;case 1:return i<o?(s=i===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,e[i],this.appkey,t,n,s)]):[3,4];case 2:if(c=p.sent(),l=c.code,d=c.data,h={bid:un(),ptc:Ee.NAVI,cod:l,net:null==r?void 0:r.type,dur:Date.now()-u,spr:0,pr:(null==d?void 0:d.type)||0,hos:e[i],cache:Ie.REQUEST,v:ve.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(h),n),[P.SUCCESS,P.RC_CONN_TOKEN_INCORRECT,P.RC_LICENSE_EXPIRED].includes(l))return[2,l===P.SUCCESS?at(d):ut(l)];p.label=3;case 3:return i+=1,[3,1];case 4:return[2,ut(P.RC_NAVI_REQ_FAILED)]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return P.RC_CONN_TOKEN_INCORRECT;case 416:return P.RC_LICENSE_EXPIRED;default:return P.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(Gn(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(Gn(e),se(se({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,r=e.token,i=e.platform,o=e.protocol,s=e.mac;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var a="token=".concat(encodeURIComponent(r),"&version=").concat("5.20.0-c-unikit.1","&platfrom=").concat(i);return s&&(a+="&m=".concat(s)),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(o,";rtc=4;log=2;iptype=v4,v6")},body:a,url:t,timeout:1e4}},e.prototype.useV2Navi=function(){return!0},e}(),Fn=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))},Bn=function(){function e(e){wn.add(this),Dn.set(this,void 0),_e(this,Dn,e,"f"),this._logger=e.logger}return e.prototype.open=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return e=e.sort((function(e,t){return t.weight-e.weight})),[2,pe(this,wn,"m",Vn).call(this,e,pe(this,Dn,"f"))]}))}))},e}();Dn=new WeakMap,wn=new WeakSet,Vn=function e(t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s=this;return ce(this,(function(a){switch(a.label){case 0:return 0===t.length?[2,ut(P.STREAM_MESSAGE_REQUEST_FAIL,"All addrs failed")]:(r=t.shift(),i=ln(r.addr,r.protocol),i="".concat(i,"/v3/message/get_stream.json?sdkVersion=").concat("5.20.0-c-unikit.1","&platform=").concat(this._platform,"&messageUID=").concat(n.msgUId),[4,this._openHandler(i,n)]);case 1:return[2,(o=a.sent()).or((function(r){return ue(s,void 0,void 0,(function(){return ce(this,(function(i){return-1===r?[2,pe(this,wn,"m",e).call(this,t,n)]:[2,o]}))}))}))]}}))}))};var xn=Fn();var Hn=null,qn=function(e){return ue(void 0,void 0,void 0,(function(){var t;return ce(this,(function(n){switch(n.label){case 0:return[4,Kn.getNetworkType()];case 1:return t=n.sent(),Hn({status:"online"===e.type,type:t}),[2]}}))}))};var Yn=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 ue(this,void 0,void 0,(function(){var n=this;return ce(this,(function(i){return[2,new Promise((function(i){n._logger.debug(r.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(r.L_REQ_STREAM_MSG_CONTENT_E,"timeout -> ".concat(e)),i(ut(-1,"timeout"))},o.onreadystatechange=function(s){if(o.readyState===XMLHttpRequest.HEADERS_RECEIVED){var a=o.getResponseHeader("Content-Type"),u=null==a?void 0:a.startsWith("text/event-stream");if(200===o.status&&u){i(at());var c=0;o.onprogress=function(e){var n=o.response.slice(c);c=o.response.length,t.onRawContent(n)},o.onerror=function(i){n._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,"network error in transit -> ".concat(e)),o.onprogress=null,o.abort(),t.onNetworkError(P.STREAM_MESSAGE_REQUEST_FAIL)}}else o.onloadend=function(){var e=JSON.parse(o.response);i(ut(e.code,e.message))}}},o.onerror=function(t){n._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,"req fail -> ".concat(e)),i(ut(-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}(Bn),Kn={tag:"browser",httpReq:function(e){return fn(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:xn,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:Se.UNKONWN},t=e.type,n=e.effectiveType,r=t||n||Se.UNKONWN;return Promise.resolve(r)},setNetworkStatusListener:function(e){Hn=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",qn),window.addEventListener("online",qn))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",qn),window.removeEventListener("online",qn)),Hn=null},createSSEClient:function(e){return at(new Yn(e))},getApiVer:function(){var e=Kn.runtimeInfo,t=e.type,n=e.version;return"|".concat(t,"|").concat(n)},get runtimeInfo(){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 i in r)if(r.hasOwnProperty(i)){var o=n.match(r[i]);if(o){t=i,e=o[1]||o[2];break}}return{type:t||"Unknown",version:e||"Unknown"}}},Qn=Fn(),Wn=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,he([],de(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}},jn={setItem:Wn("setStorageSync"),getItem:Wn("getStorageSync"),removeItem:Wn("removeStorageSync"),clear:Wn("clearStorageSync")},Jn=null,zn=function(e){var t=e.isConnected,n=e.networkType;Jn({status:t,type:n})};var Zn={tag:"wechat",httpReq:function(e){var t=e.method||Ce.GET,n=e.timeout||Me,r=e.headers,i=e.query,o=e.body,s=en(e.url,i);return new Promise((function(e){wx.request({url:s,method:t,header:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:P.RC_HTTP_REQ_FAIL})}})}))},localStorage:jn,sessionStorage:jn,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Qn,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(Se.UNKONWN)}})}))},setNetworkStatusListener:function(e){Jn=e,wx.onNetworkStatusChange(zn)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(zn),Jn=null},createSSEClient:function(e){return ut(P.NOT_SUPPORT)},get runtimeInfo(){return{type:Zn.tag,version:"Unknown"}}},Xn=Fn(),$n=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){}}},er={setItem:$n("setStorageSync"),getItem:$n("getStorageSync"),removeItem:$n("removeStorageSync"),clear:$n("clearStorageSync")},tr=null,nr=function(e){var t=e.isConnected,n=e.networkType;tr({status:t,type:n})};var rr={tag:"alipay",httpReq:function(e){var t=e.method||Ce.GET,n=e.timeout||Me,r=e.headers,i=e.query,o=e.body,s=en(e.url,i),a=e.dataType||"json";return new Promise((function(e){my.request({url:s,method:t,headers:r,timeout:n,data:o,dataType:a,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:P.RC_HTTP_REQ_FAIL})}})}))},localStorage:er,sessionStorage:er,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Xn,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(Se.UNKONWN)}})}))},setNetworkStatusListener:function(e){tr=e,my.onNetworkStatusChange(nr)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(nr),tr=null},createSSEClient:function(e){return ut(P.NOT_SUPPORT,"Not supported yet")},get runtimeInfo(){return{type:rr.tag,version:"Unknown"}}},ir=Fn(),or=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,he([],de(t),!1))}catch(e){}}},sr={setItem:or("setStorageSync"),getItem:or("getStorageSync"),removeItem:or("removeStorageSync"),clear:or("clearStorageSync")},ar=null,ur=function(e){var t=e.isConnected,n=e.networkType;ar({status:t,type:n})};var cr={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:ir,localStorage:sr,sessionStorage:sr,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:P.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(Se.UNKONWN)}})}))},setNetworkStatusListener:function(e){ar=e,tt.onNetworkStatusChange(ur)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(ur),ar=null},createSSEClient:function(e){return ut(P.NOT_SUPPORT)},get runtimeInfo(){return{type:cr.tag,version:"Unknown"}}},lr=Fn(),dr=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,he([],de(t),!1))}catch(e){}}},hr={setItem:dr("setStorageSync"),getItem:dr("getStorageSync"),removeItem:dr("removeStorageSync"),clear:dr("clearStorageSync")},pr=null,_r=function(e){var t=e.isConnected,n=e.networkType;pr({status:t,type:n})};var fr={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:lr,localStorage:hr,sessionStorage:hr,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:P.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 ue(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(Se.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){pr=e,swan.onNetworkStatusChange(_r)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(_r),pr=null},createSSEClient:function(e){return ut(P.NOT_SUPPORT)},get runtimeInfo(){return{type:fr.tag,version:"Unknown"}}},gr=Fn(),Er=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,he([],de(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}},Ir={setItem:Er("setStorageSync"),getItem:Er("getStorageSync"),removeItem:Er("removeStorageSync"),clear:Er("clearStorageSync")},vr=null,Tr=function(e){var t=e.isConnected,n=e.networkType;vr({status:t,type:n})};var Rr={tag:"jingdong",httpReq:function(e){var t=e.method||Ce.GET,n=e.timeout||Me,r=e.headers,i=e.query,o=e.body,s=en(e.url,i);return new Promise((function(e){jd.request({url:s,method:t,header:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:P.RC_HTTP_REQ_FAIL})}})}))},localStorage:Ir,sessionStorage:Ir,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:gr,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(Se.UNKONWN)}})}))},setNetworkStatusListener:function(e){vr=e,jd.onNetworkStatusChange(Tr)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(Tr),vr=null},createSSEClient:function(e){return ut(P.NOT_SUPPORT)},get runtimeInfo(){return{type:Rr.tag,version:"Unknown"}}},mr=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,he([],de(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}},yr={setItem:mr("setStorageSync"),getItem:mr("getStorageSync"),removeItem:mr("removeStorageSync"),clear:mr("clearStorageSync")},Sr=null,Cr=function(e){var t=e.isConnected,n=e.networkType;Sr({status:t,type:n})};var Ar,Nr,Or={tag:"uniapp",httpReq:function(e){var t=e.method||Ce.GET,n=e.timeout||Me,r=e.headers,i=e.query,o=e.body,s=en(e.url,i);return new Promise((function(e){uni.request({url:s,method:t,header:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:P.RC_HTTP_REQ_FAIL})}})}))},localStorage:yr,sessionStorage:yr,useNavi:!0,get connectPlatform(){var e=uni.getSystemInfoSync(),t=e.uniPlatform,n=e.osName;return["app","app-plus"].includes(t)&&n||""},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(Se.UNKONWN)}})}))},setNetworkStatusListener:function(e){Sr=e,uni.onNetworkStatusChange(Cr)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(Cr),Sr=null},createSSEClient:function(e){return ut(P.NOT_SUPPORT)},getApiVer:function(){var e=uni.getSystemInfoSync(),t=e.osAndroidAPILevel,n=e.deviceModel,r=e.deviceBrand,i=e.osVersion,o="android"===e.osName?t:i;return"".concat(r||"","|").concat(n||"","|").concat(o||"","|||uniapp").replace(/-/g,"_")},get runtimeInfo(){return{type:Or.tag,version:"Unknown"}}},Mr=function(e){return e&&e.request&&e.getSystemInfo},Ur="undefined"!=typeof uni&&Mr(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":case"app":return Or;case"mp-jd":return Rr;case"mp-baidu":return fr;case"mp-toutiao":return cr;case"mp-alipay":return rr;case"mp-weixin":return Zn;default:return Kn}}():"undefined"!=typeof jd&&Mr(jd)?Rr:"undefined"!=typeof my&&Mr(my)?rr:"undefined"!=typeof tt&&Mr(tt)?cr:"undefined"!=typeof swan&&Mr(swan)?fr:"undefined"!=typeof wx&&Mr(wx)?Zn:Kn;function Lr(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=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),o&&(u[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?f:_;if(t){if(e<0)return f;if(e>=d)return T}else{if(-h>=e)return R;if(e+1>=h)return v}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,u,l,d,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((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return o(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),d=parseInt(e.substring(u,u+l),n),l<8?(h=r(c(n,l)),a=a.mul(h).add(r(d))):a=(a=a.mul(s)).add(r(d));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}var a,u,c,l,d,h,p,_,f,g,E,I,v,T,R,m;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,c=Math.pow,e.fromString=o,e.fromValue=s,h=(d=(l=4294967296)*l)/2,p=n(16777216),_=n(0),e.ZERO=_,f=n(0,!0),e.UZERO=f,g=n(1),e.ONE=g,E=n(1,!0),e.UONE=E,I=n(-1),e.NEG_ONE=I,v=i(-1,2147483647,!1),e.MAX_VALUE=v,T=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=T,R=i(0,-2147483648,!1),e.MIN_VALUE=R,(m=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},m.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},m.toString=function(e){var t,n,i,o,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),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(o=r(c(e,6),this.unsigned),s=this,a="";;){if(u=s.div(o),l=(s.sub(u.mul(o)).toInt()>>>0).toString(e),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},m.getHighBits=function(){return this.high},m.getHighBitsUnsigned=function(){return this.high>>>0},m.getLowBits=function(){return this.low},m.getLowBitsUnsigned=function(){return this.low>>>0},m.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},m.isZero=function(){return 0===this.high&&0===this.low},m.isNegative=function(){return!this.unsigned&&this.high<0},m.isPositive=function(){return this.unsigned||this.high>=0},m.isOdd=function(){return!(1&~this.low)},m.isEven=function(){return!(1&this.low)},m.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)},m.eq=m.equals,m.notEquals=function(e){return!this.eq(e)},m.neq=m.notEquals,m.lessThan=function(e){return this.comp(e)<0},m.lt=m.lessThan,m.lessThanOrEqual=function(e){return this.comp(e)<=0},m.lte=m.lessThanOrEqual,m.greaterThan=function(e){return this.comp(e)>0},m.gt=m.greaterThan,m.greaterThanOrEqual=function(e){return this.comp(e)>=0},m.gte=m.greaterThanOrEqual,m.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},m.comp=m.compare,m.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(g)},m.neg=m.negate,m.add=function(e){var n,r,o,a,u,c,l,d,h,p,_;return t(e)||(e=s(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,d=0,h=0,p=0,_=0,p+=(_+=a+(65535&e.low))>>>16,h+=(p+=o+l)>>>16,d+=(h+=r+c)>>>16,d+=n+u,i((p&=65535)<<16|(_&=65535),(d&=65535)<<16|(h&=65535),this.unsigned)},m.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},m.sub=m.subtract,m.multiply=function(e){var n,o,a,u,c,l,d,h,f,g,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(p)&&e.lt(p)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,d=e.low>>>16,f=0,g=0,E=0,I=0,E+=(I+=u*(h=65535&e.low))>>>16,g+=(E+=a*h)>>>16,E&=65535,g+=(E+=u*d)>>>16,f+=(g+=o*h)>>>16,g&=65535,f+=(g+=a*d)>>>16,g&=65535,f+=(g+=u*l)>>>16,f+=n*h+o*d+a*l+u*c,i((E&=65535)<<16|(I&=65535),(f&=65535)<<16|(g&=65535),this.unsigned)))},m.mul=m.multiply,m.divide=function(e){var n,i,o,a,u,l,d;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:_;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return E;o=f}else{if(this.eq(R))return e.eq(g)||e.eq(I)?R:e.eq(R)?g:(n=this.shr(1).div(e).shl(1)).eq(_)?e.isNegative()?g:I:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(R))return this.unsigned?f:_;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=_}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),d=(l=r(n)).mul(e);d.isNegative()||d.gt(i);)d=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=g),o=o.add(l),i=i.sub(d)}return o},m.div=m.divide,m.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},m.mod=m.modulo,m.not=function(){return i(~this.low,~this.high,this.unsigned)},m.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},m.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},m.xor=function(e){return t(e)||(e=s(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},m.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(0,this.low<<e-32,this.unsigned)},m.shl=m.shiftLeft,m.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},m.shr=m.shiftRight,m.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0===(e&=63)?this:(n=this.high,e<32?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},m.shru=m.shiftRightUnsigned,m.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},m.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},m.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},m.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]},m.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,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+d],d+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,d=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,_=r?1:-1,f=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+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(s++,u/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*u-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=_,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=255&s,p+=_,s/=256,c-=8);e[n+p-_]|=128*f}var o,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,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__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 i,o,s,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,s=0,a=e.length;a>s;++s)l.isByteBuffer(e[s])||(e[s]=l.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new l(0,n,r);for(c=new l(i,n,r),s=0;a>s;)(o=(u=e[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=o);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var i,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(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(0,n,r),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new l(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((i=new l(e.length,n,r)).limit=e.length,s=0;s<e.length;++s)i.view[s]=e[s]}return i},o.writeBitSet=function(e,t){var n,r,i,o,s,a,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,o=(i=e.length)>>3,s=0,t+=this.writeVarint32(i,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(i>s){for(a=0,n=0;i>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,i,o,s,a,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;i--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(r>o)for(a=0,t=this.readByte(e++);r>o;)s[o++]=!!(1&t>>a++);return u&&(this.offset=e),s},o.readBytes=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return!(128&~(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,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!1),o&&(this.offset+=8),i},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!0),o&&(this.offset+=8),i},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,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)},o.writeVarint32=function(e,t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=r=l.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(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=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var r,i,o,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),i=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return u?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,i,o,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,i=0,o=0,s=0,r=127&(s=this.view[t++]),128&s&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(i=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|o<<24,!1),u?(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=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=c.calculateUTF16asUTF8(t(e))[1],n+=i+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):i},o.readCString=function(e){var t,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,i=-1,c.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),o?(this.offset=e,r()):{string:r(),length:e-t}},o.writeIString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=c.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,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return s?(this.offset=n,this):n-i},o.readIString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=n,r=c.calculateUTF16asUTF8(t(e))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-i},o.writeString=o.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,o.readUTF8String=function(e,t,r){var i,o,s,a,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=r,t===l.METRICS_CHARS){if(o=n(),c.decodeUTF8(function(){return e>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++s,c.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-a}}if(t===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),o=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return i?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,i,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+r,n+=this.writeVarint32(r,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},o.append=function(e,t,n){var r,i,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new 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},o.compact=function(e,t){var n,r,i;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0===(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).set(this.view.subarray(e,t)),this.buffer=r,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new 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},o.copyTo=function(e,t,n,r){var i,o,s;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=r-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var r,i,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((o=i-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?s:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},u=function(){var e,t,n={},r=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[];for(e=0,t=r.length;t>e;++e)i[r[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(r[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(r[63&(i|3&n>>6)]),t(r[63&n])):(t(r[63&i]),t(61))):(t(r[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,o,s;null!==(r=e());)if(void 0===(o=i[r])&&n(r),null!==(r=e())&&(void 0===(s=i[r])&&n(r),t(o<<2>>>0|(48&s)>>4),null!==(r=e()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(s=i[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},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)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new l(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}i+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return e?s:i},l.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new l(0|(o+1)/3,t,n),a=0,u=0,c=!1,d=!1,h=!1,p=!1,_=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(d||h||p){_=!0;break}d=h=p=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(d||p){_=!0;break}d=p=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(d||h){_=!0;break}d=h=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(d){_=!0;break}d=!0}s.offset=u,c=!1;break;case"]":if(!n){if(p||h){_=!0;break}p=h=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(p){_=!0;break}p=!0}s.limit=u,c=!1;break;case"'":if(!n){if(h){_=!0;break}h=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){_=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=i,c=!0}if(_)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!d||!p)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+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(e,t,n){var r,i,o,s,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(i=e.length,o=new l(0|i/2,t),s=0,a=0;i>s;s+=2){if(r=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},c=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,r,i,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(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===(i=e()))&&s([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}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{c.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return c.encodeUTF16toUTF8(t(e),(function(e){i.view[o++]=e})),i.limit=o,i},l}(t),r=function(t,n){var r,i,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,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|i*r,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,r,i,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(o=this.source.substring(this.index,this.index=i))||"'"===o)&&(this._stringOpen=o),o},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,o=function(e){this.tn=new u(e),this.proto3=!1},(s=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()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var r,i=this.tn.next(),o=!1;if("("===i&&(o=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,o&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},s._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,r,i="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.response_stream=!0,o=this.tn.next()),r.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},s._parseMessage=function(e,r){var i=!!r,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(s.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,r,i){var o,s,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,r,i,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,i=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var r,i={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(i.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(i);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},s._parseExtensionRanges=function(){var t,n,i,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":i=e.ID_MIN;break;case"max":i=e.ID_MAX;break;default:i=r(t)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(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 i(t,n){var r=n.readVarint32(),o=7&r,s=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:i(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+": "+o)}return!0}var o,s,a,u,c,l,d,h,p,_,f,g,E,I,v,T,R={},m=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},y=m.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=m,o=function(e,t,n,r,i){m.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(s=o.prototype=Object.create(m.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,i=this,o=0;if(""===r[o]){for(;null!==i.parent;)i=i.parent;o++}do{do{if(!(i instanceof R.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof R.T&&(!t||n instanceof R.Namespace))){i=null;break}i=n,o++}while(o<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},s.qn=function(e){var t,n,r=[],i=e;do{r.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof R.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof o&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var e,t,n,r,i={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],r=this.options[o[e]],i[n]=r;return i},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},R.Namespace=o,a=function(t,n,r,i){if(this.type=t,this.resolvedType=n,this.isMapKey=r,this.syntax=i,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 i,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case 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(i=this.resolvedType.getChildren(e.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==r)return i[s].id;if(i[s].id==r)return i[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 o={},r)r.hasOwnProperty(s)&&(o[s]=r[s]);r=o}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 i;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 i=r.calculateUTF8Bytes(n),r.calculateVarint32(i)+i;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 i=this.resolvedType.calculate(n),r.calculateVarint32(i)+i;case e.TYPES.group:return(i=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,i){var o,s;if(null===n)return i;switch(this.type){case e.TYPES.int32:n<0?i.writeVarint64(n):i.writeVarint32(n);break;case e.TYPES.uint32:i.writeVarint32(n);break;case e.TYPES.sint32:i.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:i.writeUint32(n);break;case e.TYPES.sfixed32:i.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:i.writeVarint64(n);break;case e.TYPES.sint64:i.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:i.writeUint64(n);break;case e.TYPES.sfixed64:i.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?i.writeVarint32("false"===n.toLowerCase()?0:!!n):i.writeVarint32(n?1:0);break;case e.TYPES.enum:i.writeVarint32(n);break;case e.TYPES.float:i.writeFloat32(n);break;case e.TYPES.double:i.writeFloat64(n);break;case e.TYPES.string:i.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,i.writeVarint32(n.remaining()),i.append(n),n.offset=o;break;case e.TYPES.message:s=(new r).LE(),this.resolvedType.encode(n,s),i.writeVarint32(s.offset),i.append(s.flip());break;case e.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i},u.decode=function(t,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,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(i=t.clone()).limit=i.offset+o,t.offset+=o,i;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")},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,i,s){o.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=c.prototype=Object.create(o.prototype)).build=function(n){var i,o,s,a;if(this.clazz&&!n)return this.clazz;for(i=function(e,n){function i(t,n,o,s){var a,u,c,l,d,h,p;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 o?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return u=[],t.forEach((function(e,t){u[t]=i(e,n,o,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])]=i(l.value[1],n,o,t.valueElem.resolvedType);return u}for(p in d=t.$type,h=void 0,t)t.hasOwnProperty(p)&&(u[p]=d&&(h=d.getChild(p))?i(t[p],n,o,h.resolvedType):i(t[p],n,o));return u}var o,s,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var i,o,s,l;for(e.Builder.Message.call(this),i=0,o=u.length;o>i;++i)this[u[i].name]=null;for(i=0,o=a.length;o>i;++i)this[(s=a[i]).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(i=0,o=arguments.length;o>i;++i)void 0!==(l=arguments[i])&&this.$set(a[i].name,l);else this.$set(t)},l=c.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,r,i){var o=n._fieldsByName[t];if(!i){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},l.$add=l.add,l.set=function(t,r,i){var o,s,a;if(t&&"object"==typeof t){for(o in i=r,t)t.hasOwnProperty(o)&&void 0!==(r=t[o])&&this.$set(o,r,i);return this}if(s=n._fieldsByName[t],i)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 i=n._fieldsByName[t];if(!(i&&i instanceof e.Reflect.Message.Field))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));return this[i.name]},l.$get=l.get,o=0;o<a.length;o++)(s=a[o])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,r,i,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),r=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===n.getChild("set"+o)&&(l["set"+o]=r),null===n.getChild("set_"+t)&&(l["set_"+t]=r),null===n.getChild("get"+o)&&(l["get"+o]=i),null===n.getChild("get_"+t)&&(l["get_"+t]=i)}(s);return l.encode=function(e,r){var i,o;"boolean"==typeof e&&(r=e,e=void 0),i=!1,e||(e=new t,i=!0),o=e.littleEndian;try{return n.encode(this,e.LE(),r),(i?e.flip():e).LE(o)}catch(t){throw e.LE(o),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,i=!1;return e||(e=new r,i=!0),t=(new r).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.decode=function(e,t){var i,o;"string"==typeof e&&(e=r.wrap(e,t||"base64")),i=(e=r.isByteBuffer(e)?e:r.wrap(e)).littleEndian;try{return o=n.decode(e.LE()),e.LE(i),o}catch(t){throw e.LE(i),t}},c.decodeDelimited=function(e,t){var i,o,s;if("string"==typeof e&&(e=r.wrap(e,t||"base64")),(e=r.isByteBuffer(e)?e:r.wrap(e)).remaining()<1)return null;if(i=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=n.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,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((o=this.children[s])instanceof f||o instanceof c||o instanceof I){if(i.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");i[o.name]=o.build()}else if(o instanceof c.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof c.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,o,s,a,u=null;for(o=0,s=this._fields.length;s>o;++o)i=e[(r=this._fields[o]).name],r.required&&null===i?null===u&&(u=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,r=0,i=0,o=this._fields.length;o>i;++i){if(n=e[(t=this._fields[i]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},l.decode=function(t,n,r){var o,s,a,u,c,l,d,h,p,_,f,g;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=(o=t.readVarint32())>>>3,(s=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(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(s,t)):u.map?(h=u.decode(s,t),l[u.name].set(h[0],h[1])):(l[u.name]=u.decode(s,t),u.oneof&&(null!==(p=l[u.oneof.name])&&p!==u.name&&(l[p]=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:d=t.readVarint32(),t.offset+=d;break;case e.WIRE_TYPES.STARTGROUP:for(;i(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(_=0,f=this._fields.length;f>_;++_)if(null===l[(u=this._fields[_]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(g=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,g;e.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},R.Message=c,d=function(t,n,r,i,o,s,a,u,l,d){m.call(this,t,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=a,this.options=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=d||"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))},(h=d.prototype=Object.create(m.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,i,o;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===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=[],i=0;i<t.length;i++)o.push(this.element.verifyValue(t[i]));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,i){var o,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,o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],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(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,i){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+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,i,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,i)&&(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 i,o,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;i=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s=0,o=0;o<t.length;o++)s+=this.element.calculateLength(this.id,t[o]);i+=r.calculateVarint32(s),i+=s}else for(o=0;o<t.length;o++)i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=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);i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i+=r.calculateVarint32(o),i+=o}),this):this.hasWirePresence(t,n)&&(i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return i},h.decode=function(t,n,r){var i,o,s,u,c,l,d;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,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(u=a.defaultFieldValue(this.keyType),i=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+o,n.offset+=o;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(d=l>>>3))u=this.keyElement.decode(c,t,d);else{if(2!==d)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,t,d)}return[u,i]}return this.element.decode(n,t,this.id)},R.Message.Field=d,p=function(e,t,n,r,i,o,s){d.call(this,e,t,n,null,r,i,o,s),this.extension},p.prototype=Object.create(d.prototype),R.Message.ExtensionField=p,_=function(e,t,n){m.call(this,e,t,n),this.fields=[]},R.Message.OneOf=_,f=function(e,t,n,r,i){o.call(this,e,t,n,r,i),this.className="Enum",this.object=null},f.getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(t){var n,r,i,o;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,i=0,o=(r=this.getChildren(f.Value)).length;o>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},R.Enum=f,g=function(e,t,n,r){m.call(this,e,t,n),this.className="Enum.Value",this.id=r},g.prototype=Object.create(m.prototype),R.Enum.Value=g,E=function(e,t,n,r){m.call(this,e,t,n),this.field=r},E.prototype=Object.create(m.prototype),R.Extension=E,I=function(e,t,n,r){o.call(this,e,t,n,r),this.className="Service",this.clazz=null},(I.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,i=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=i.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(e){o[e.name]=function(n,i){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 i(null,r):void i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:i[e.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),i}(e,this)},R.Service=I,v=function(e,t,n,r){m.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(v.prototype=Object.create(m.prototype)).buildOpt=s.buildOpt,R.Service.Method=v,T=function(e,t,n,r,i,o,s,a){v.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},T.prototype=Object.create(v.prototype),R.Service.RPCMethod=T,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 i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var r,o,s,a,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(o=t.shift(),i.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),u=[],o.enums&&o.enums.forEach((function(e){u.push(e)})),o.messages&&o.messages.forEach((function(e){u.push(e)})),o.services&&o.services.forEach((function(e){u.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.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(i.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(i.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,i,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i,o,s,a,u,c,l,d,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(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(h="\\"),o=i+h+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(h="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),h="\\"):s=".":s=null,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+h+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),d=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){d.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=d),t.enums&&(this.create(t.enums),this.ptr=d),t.services&&(this.create(t.services),this.ptr=d),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"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(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,i,o,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(r=Object.keys(n),i=0;i<r.length;i++)o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,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)},i=e,o.loadProto(i,void 0,"").build("Modules").probuf}(n,t);return r}var br=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()}))},Pr=function(){function e(e,t){this.nestedMap=t,Ar.add(this),this.pbModules=Lr(e)}return e.prototype._encode=function(e,t,n){var r=this,i=new this.pbModules[e];if(t)try{Object.keys(t).forEach((function(n){var o=t[n];if(void 0!==o){var s=r.nestedMap.get("".concat(e,"_").concat(n));if(s){var a=o instanceof Array?o.map((function(e){return r._encode(s,e,!0)})):r._encode(s,o,!0);i["set".concat(br(n,0,1))](a)}else i["set".concat(br(n,0,1))](o)}}))}catch(t){var o="name: ".concat(e,", stack: ").concat(t.stack);null===console||void 0===console||console.error("pb encode error!",o)}return n?i:i.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 pe(this,Ar,"m",Nr).call(this,n)},e.prototype.getModule=function(e){return new this.pbModules[e]},e}();Ar=new WeakSet,Nr=function e(t){var n,r=this;if(t instanceof Array)return t.map((function(t){return pe(r,Ar,"m",e).call(r,t)}));if(n=t,"[object Object]"!==Object.prototype.toString.call(n))return t;if(t.buffer instanceof ArrayBuffer&&"number"==typeof t.offset&&"number"==typeof t.limit){var i=t.buffer,o=t.offset,s=t.limit;return i.slice(o,s)}if(void 0!==t.low&&void 0!==t.high&&Object.prototype.hasOwnProperty.call(t,"unsigned")){var a=t.low;return a<0&&(a+=4294967296),a=a.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(a.length,"}$")),a),16)}var u=t;return Object.keys(t).forEach((function(n){u[n]=pe(r,Ar,"m",e).call(r,t[n])})),u};var wr,Dr,Vr,Gr,kr="NotifyMsg",Fr="SyncRequestMsg",Br="UpStreamMessage",xr="PushExtra",Hr="DownStreamMessages",qr="DownStreamMessage",Yr="GetQNupTokenInput",Kr="GetDownloadUrlInput",Qr="GetQNupTokenOutput",Wr="GetDownloadUrlOutput",jr="ChrmInput",Jr="ChrmOutput",zr="ChrmPullMsg",Zr="RelationQryInput",Xr="RelationsInput",$r="RelationsOutput",ei="QryRemindListReq",ti="QryRemindListResp",ni="CleanHisMsgInput",ri="CleanMsgBatchReq",ii="QueryChatRoomInfoInput",oi="QueryChatRoomInfoOutput",si="HistoryMsgInput",ai="HistoryMsgOuput",ui="SessionsAttQryInput",ci="SessionsAttOutput",li="SessionMsgReadInput",di="DeleteSessionsInput",hi="SessionInfo",pi="QuerySessionsInput",_i="QuerySessionsOutPut",fi="RelationDelBatchReq",gi="RelationOpInput",Ei="DeleteMsgInput",Ii="SetChrmKV",vi="SetChrmKVS",Ti="ChrmKVOutput",Ri="ChrmKVSOutput",mi="QueryChrmKV",yi="SetUserSettingOutput",Si="PullUserSettingInput",Ci="PullUserSettingOutput",Ai="SessionReq",Ni="SessionStates",Oi="SessionState",Mi="SessionStateItem",Ui="SessionStateModifyReq",Li="GroupUnpushQuery",bi="GroupUnpushSet",Pi="GroupUnpushResult",wi="SessionStateModifyResp",Di="TypeUnpushInput",Vi="TypeUnpushOutput",Gi="GrpReadReceiptMsg",ki="GrpReadReceiptQryResp",Fi="SessionTagAddInput",Bi="SessionTagItem",xi="SessionTagDelInput",Hi="SessionDisTagReq",qi="UserSettingNotification",Yi="ReportSDKInput",Ki="UltraGrpPullSes",Qi="UltraGrpPullMsg",Wi="MsgChangeReq",ji="QueryMsgChange",Ji="EventChangeList",zi="MsgChangeList",Zi="MsgQuery",Xi="MsgQueryAck",$i="OperateStatus",eo="OperateStatusNotify",to="SetRtcRoomIdInput",no="CallInfoUpStream",ro="CallInfoDownStream",io="KvInput",oo="KvOutput",so="ReadReceiptMsg",ao="ReceiptQryReq",uo="QueryReceiptResp",co="ReceiptCntQryReq",lo="ReceiptCntQryResp",ho="UpdateUserSubReq",po="UserSubDetail",_o="UpdateUserSubResp",fo="PullUserSubReq",go="PUllUserSubResp",Eo="PullSubDataReq",Io="PullSubDataResp",vo="SubDataDetail",To="QrySubDataReq",Ro="UserProfile",mo="ProfileInfo",yo="SetUserProfileResp",So="PullUserProfileReq",Co="UserProfiles",Ao="UserProfileInput",No="UserProfilePermission",Oo="SearchUserProfile",Mo="ChannelsInput",Uo="ChannelsOutput",Lo="MultiChannels",bo="ModifyChannelsInput",Po="QuitChannelsSetting",wo="ChannelsQueryInput",Do="ChannelsPageParam",Vo="ChannelsListResult",Go="ChannelsMemberUpdateInput",ko="ChannelsMemberResponseInput",Fo="ChannelsMembersInput",Bo="FriendInput",xo="FriendsInput",Ho="FriendsCheckOutput",qo="FriendProfileInput",Yo="FriendProfileOutput",Ko="FriendQueryInput",Qo="FriendsListInput",Wo="FriendLevelSet",jo="FriendUserInfos",Jo="AddUnpushPeriodInput",zo="DeleteUnpushPeriodInput",Zo="QueryUnpushPeriodInput",Xo="QueryUnpushPeriodOutput",$o=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"}(wr||(wr={})),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"}(Dr||(Dr={})),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"}(Gr||(Gr={}));var es,ts,ns,rs,is,os,ss,as,us,cs=new Pr("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 optional int64 endTime = 8;\n optional bool compressioEnabled = 9;\n }\n message UpStreamMessage {\n required int32 sessionId = 1;\n required string classname = 2;\n required string 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 optional int64 systemTime = 5;\n optional int64 credibleStartTime = 6;\n optional int64 credibleEndTime = 7;\n optional bool compressioEnabled = 8;\n optional bytes compressedData = 9;\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 string 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 optional int32 pullMsgType = 3;\n optional bool compressioEnabled = 4;\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 optional bool isEraseMsgContent = 5;\n optional int64 endTime = 6;\n optional bool compressioEnabled = 7;\n optional int32 qryType = 8;\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 optional int64 pullTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\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 optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6; \n optional bytes compressedData = 7;\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 optional bool compressioEnabled = 6;\n }\n\n message HistoryMsgOuput {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6;\n optional bytes compressedData = 7;\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 optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\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 optional bool compressioEnabled = 2;\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 optional bool compressioEnabled = 2;\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",$o);!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.STATISTICS=6]="STATISTICS",e[e.NONE=1e3]="NONE"}(es||(es={})),function(e){e.IM="IM",e.RTC="RTC"}(ts||(ts={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.USER_LOGOUT=19]="USER_LOGOUT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(ns||(ns={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(rs||(rs={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(is||(is={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(os||(os={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(ss||(ss={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(as||(as={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(us||(us={}));var ls=null;function ds(e,t,n,r){void 0===n&&(n={});var i=["error","warn","info","debug"][3-e];if(ls&&e<es.FATAL)try{var o=JSON.stringify(n);ls[i](t,o)}catch(e){console.error(e)}}var hs,ps,_s=ds.bind(null,es.DEBUG),fs={init:function(e){ls=e},info:ds.bind(null,es.INFO),debug:_s,warn:ds.bind(null,es.WARN),error:ds.bind(null,es.ERROR),fatal:ds.bind(null,es.FATAL)},gs=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map[e];if(r)for(var i=r.length-1;i>=0;i-=1){var o=r[i],s=o.target,a=o.once,u=o.listener;a&&r.splice(i,1);try{u.call.apply(u,he([s],de(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}(),Es=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=Lr(t)}return e.prototype.getModule=function(e){return new this.pbModules[e]},e.prototype.encode=function(e,t,n){var i=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((function(e){var n=t[e];void 0!==n&&i["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(r.L_PB_ENCODE_E,o):null===console||void 0===console||console.error(r.L_PB_ENCODE_E,o)}return n?i:i.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(!Tt(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"}(ps||(ps={}));var Is,vs=((hs={})[ps.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],hs[ps.RtcUserListOutput]=["users","token","sessionId","roomInfo"],hs[ps.SetUserStatusInput]=["status"],hs[ps.RtcSetDataInput]=["interior","target","key","value","objectName","content"],hs[ps.RtcUserSetDataInput]=["valueInfo","objectName","content"],hs[ps.RtcDataInput]=["interior","target","key","objectName","content"],hs[ps.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],hs[ps.MCFollowInput]=["state"],hs[ps.RtcTokenOutput]=["rtcToken"],hs[ps.RtcQryOutput]=["outInfo"],hs[ps.RtcQryUserOutDataInput]=["userId"],hs[ps.RtcUserOutDataOutput]=["user"],hs[ps.RtcQueryListInput]=["order"],hs[ps.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],hs[ps.RtcValueInfo]=["key","value"],hs[ps.RtcKeyDeleteInput]=["key"],hs[ps.RtcNotifyMsg]=["type","time","roomId"],hs[ps.RtcPullKV]=["timestamp","roomId"],hs[ps.RtcKVOutput]=["entries","bFullUpdate","syncTime"],hs[ps.RtcQueryUserJoinedInput]=["userId"],hs[ps.RtcQueryUserJoinedOutput]=["info"],hs[ps.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],hs[ps.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],hs[ps.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],hs[ps.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],hs),Ts="\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(ps.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(ps.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(ps.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(ps.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(ps.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(ps.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(ps.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(ps.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(ps.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(ps.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(ps.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(ps.RtcQryOutput,"{\n repeated ").concat(ps.RtcValueInfo," outInfo=1;\n }\n message ").concat(ps.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(ps.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(ps.RtcUserSetDataInput," {\n repeated ").concat(ps.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(ps.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(ps.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(ps.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(ps.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(ps.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(ps.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(ps.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(ps.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(ps.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(ps.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(ps.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(ps.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(ps.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(ps.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(ps.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(ps.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"),Rs=function(e,t,n,r,i,o){var s=i?Object.keys(i).map((function(t){return e.encode(ps.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0,a=o?Object.keys(o).map((function(t){return e.encode(ps.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(ps.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:s,outerDatas:a})},ms=function(e,t){var n=e.decode(ps.RtcUserListOutput,t),r=n.users,i=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return Dt(r,(function(e){var t=e.userId,n=e.userData,r={};Dt(n,(function(e){var t=e.key,n=e.value;r[t]=n})),c[t]=r})),{users:c,token:i,sessionId:o,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"}(Is||(Is={}));var ys,Ss,Cs,As=function(e){var t=Is[e];return t},Ns=function(e){return Is[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"}(ys||(ys={})),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"}(Ss||(Ss={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Cs||(Cs={}));var Os,Ms,Us,Ls,bs,Ps,ws,Ds,Vs,Gs,ks,Fs="rtcRJoin_data",Bs="rtcRExit",xs="rtcRInfo",Hs="rtcUData",qs="rtcUPut",Ys="rtcUDel",Ks="rtcSetData",Qs="userSetData",Ws="rtcQryData",js="rtcDelData",Js="rtcToken",zs="rtcUserState",Zs="rtcUList",Xs="viewerJoinR",$s="viewerExitR",ea="rtcPullKv",ta="rtcIdentityChange",na="rtcInvite",ra="rtcCancelInvite",ia="rtcInviteAnswer",oa="rtcEndInvite",sa="rtcQueryJoined",aa=0,ua=1,ca=2,la=3,da=4,ha=5,pa=6,_a=7,fa=8,ga=9,Ea=10,Ia=11,va=12,Ta=13,Ra=14,ma=15,ya=16,Sa=17,Ca=18,Aa=19,Na=20,Oa=1,Ma=2,Ua=4,La=5,ba=6,Pa=7,wa=8,Da=9,Va=function(){function e(){}return e.writeUTF=function(e,t){for(var n=this._getBackAndByteSize(e),r=n.back,i=n.byteSize,o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return t?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},e._getBackAndByteSize=function(e){var t=[],n=0;if("string"==typeof e)for(var r=0,i=e.length;r<i;r++){var o=e.charCodeAt(r);o>=0&&o<=127?(n+=1,t.push(o)):o>=128&&o<=2047?(n+=2,t.push(192|31&o>>6),t.push(128|63&o)):o>=2048&&o<=65535&&(n+=3,t.push(224|15&o>>12),t.push(128|63&o>>6),t.push(128|63&o))}return{byteSize:n,back:t}},e.readUTF=function(e){for(var t,n,r=[],i=-1,o=e,s="";++i<o.length;){var a=Number(o[i]);if(a===(127&a)||(240&~a?224&~a?192&~a||(a=(a^=192)<<6|128^o[++i]):a=(a=(a^=224)<<6|128^o[++i])<<6|128^o[++i]:a=(a=(a=(a^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]),!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)),(i+1===o.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},e}(),Ga=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 Va.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),ka=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(he([],de(new Int8Array(e)),!1))},e.prototype.writeArr=function(e){this._pool=this._pool.concat(e)},e.prototype.writeUTF=function(e){var t=Va.writeUTF(e);this._pool=this._pool.concat(t)},e.prototype.getBytesArray=function(){return this._pool},e}(),Fa=function(){function e(e,t,n,r,i){void 0===t&&(t=ys.AT_LEAST_ONCE),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),this.command=e,this.qos=t,this._retain=n,this._dup=r,this.syncMsg=i}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}(),Ba=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}(),xa=function(){function e(e){this.messageId=0,this._header=new Fa(e,ys.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 ka;this.write(e);var t=e.getBytesArray();return new Int8Array(t).buffer},e}(),Ha=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===Cs.V4){var i=e.readByte();1&i&&(this.userId=e.readUTF()),2&i&&(this.sessionId=e.readUTF()),4&i&&(this.timestamp=e.readLong()),8&i&&(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}(Ba),qa=function(e){function n(t){var n=e.call(this,Ss.DISCONNECT)||this;return n.status=t,n}return t(n,e),n.prototype.writeMessage=function(e){e.writeArr([0,this.status])},n}(xa),Ya=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}(Ba),Ka=function(e){function n(){return e.call(this,Ss.PING)||this}return t(n,e),n.prototype.writeMessage=function(e){},n}(xa),Qa=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(Ba),Wa=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}(Ba),ja=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}(xa),Ja=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}(Wa),za=function(e){function n(t,n,r,i){var o=e.call(this,t)||this;return o.targetId=r,o.pbData=i,o.topic="string"==typeof n?n:Ns(n),o}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}(ja),Za=function(e){function n(t,n,r){return e.call(this,Ss.QUERY,t,r,n)||this}return t(n,e),n}(za),Xa=function(e){function n(t,n,r){return e.call(this,Ss.PUBLISH,t,r,n)||this}return t(n,e),n}(za),$a=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}(Wa),eu=function(e){function n(t){var n=e.call(this,Ss.PUB_ACK)||this;return n.messageId=t,n}return t(n,e),n}(ja),tu=function(e){function n(t){var n=e.call(this,Ss.QUERY_CONFIRM)||this;return n.messageId=t,n}return t(n,e),n}(ja),nu=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}(Wa),ru=function(e,t){var n=new Uint8Array(e),r=new Ga(n),i=r.readByte(),o=function(e){var t,n=e.command;switch(n){case Ss.CONN_ACK:t=new Ha(e);break;case Ss.PUBLISH:t=new Ja(e);break;case Ss.PUB_ACK:t=new $a(e);break;case Ss.QUERY_ACK:t=new nu(e);break;case Ss.PONG:t=new Qa(e);break;case Ss.DISCONNECT:t=new Ya(e);break;default:console.error("No support for deserializing ".concat(n," messages"))}return t}(Fa.parse(i));return o&&o.read(r,n.length-1,t),o},iu=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return ue(this,void 0,void 0,(function(){var e,t,n,r,i,o,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 i=a.sent(),o=i.code,s=i.data,o===P.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}(),ou=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 iu(this)}return e.prototype.registerRTCSignalingListener=function(e){this._rtcSignalingListener=e},e.prototype.getInnerLogger=function(){return this.logger},e.prototype.pullRTCRoomEntry=function(e,t){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode(ps.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,ea,!0,t)];case 1:return n=u.sent(),r=n.code,i=n.buffer,r!==P.SUCCESS?[2,{code:r}]:(o=this.rtcCodec.decode(ps.RtcKVOutput,i),s=o.entries,a=o.syncTime,s=(s||[]).map((function(e){return se(se({},e),{timestamp:wt(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(ps.RtcNotifyMsg,e),n=t.time,r=t.type,i=t.roomId;1===r&&this._rtcKVManager.pullEntry(i,wt(n))}},e.prototype.destroy=function(){},e}();!function(e){e.INIT="INIT",e.DATA="DATA",e.END="END"}(Os||(Os={}));var su=function(e){function n(t,n){var r=e.call(this)||this;return Ms.add(r),Us.set(r,void 0),Ls.set(r,new Map),bs.set(r,void 0),_e(r,Us,t,"f"),_e(r,bs,n,"f"),r}return t(n,e),n.prototype.requestStreamMessageContent=function(e){return ue(this,void 0,void 0,(function(){var t,n,i=this;return ce(this,(function(o){switch(o.label){case 0:return t=pe(this,Ms,"a",Ps).createTraceId(),pe(this,Ms,"a",Ps).info(r.L_REQ_STREAM_MSG_CONTENT_T,"messageUId: ".concat(e),t),[4,ct.create("requestStreamMessageContent").isLimitedString("messageUId",e,1,64,!0).fail(P.INVALID_PARAMETER_MESSAGE_UID,"messageUId is invalid.").result().tryTrans(pe(this,Us,"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)?at(e.streamServer.addrs):ut(P.STREAM_MESSAGE_DISABLE)})).next((function(t){return pe(i,Ms,"m",ks).call(i,e,t)}))];case 1:return n=o.sent(),pe(this,Ms,"a",Ps).summary(r.L_REQ_STREAM_MSG_CONTENT_R,n,t,{messageUId:e}),[2,n.wipe()]}}))}))},n}(it);Us=new WeakMap,Ls=new WeakMap,bs=new WeakMap,Ms=new WeakSet,Ps=function(){return pe(this,Us,"f").logger},ws=function(e,t,n){var r=pe(this,Ls,"f").get(e);r&&(pe(this,Ls,"f").delete(e),pe(this,Ms,"m",Ds).call(this,e,Os.END,t,r.msg))},Ds=function(e,t,n,r,i){this.emit("message",{code:n,messageUId:e,type:t,chunk:i,message:r})},Vs=function(e,t){e.content=se(se({},e.content),t),pe(this,Us,"f").setMessageContent(e.messageId,e.content,e.messageType)},Gs=function(e,t,n){var r,i,o=pe(this,Ls,"f").get(t);switch(e){case"init":o.msg&&pe(this,Ms,"m",Vs).call(this,o.msg,{content:"",stopReason:0,completeReason:0,isSynced:!1}),pe(this,Ms,"m",Ds).call(this,t,Os.INIT,P.SUCCESS,o.msg);break;case"complete":i=(r=n.length?JSON.parse(n):{}).complete||!1,o.msg&&pe(this,Ms,"m",Vs).call(this,o.msg,{stopReason:r.stopReason||0,completeReason:r.completeReason||0,complete:i,isSynced:i}),pe(this,Ms,"m",ws).call(this,t,r.stopReason||0,i);break;default:r=JSON.parse(n),o.cached+=r.content,o.msg&&pe(this,Ms,"m",Vs).call(this,o.msg,{content:o.cached}),pe(this,Ms,"m",Ds).call(this,t,Os.DATA,P.SUCCESS,o.msg,{content:r.content,fullContent:o.cached})}},ks=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c=this;return ce(this,(function(l){switch(l.label){case 0:return pe(this,Ls,"f").has(e)?[2,ut(P.STREAM_MESSAGE_REQUEST_IN_PROCESS,"Request in process, msgUId: ".concat(e))]:pe(this,Ls,"f").size>=3?[2,ut(P.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED,"The request queue is full")]:(n=Ur.createSSEClient({logger:pe(this,Ms,"a",Ps),msgUId:e,appkey:pe(this,Us,"f").appkey,token:pe(this,Us,"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:",""),i=t.slice(n+1+5);pe(c,Ms,"m",Gs).call(c,r,e,i.trim())}}))},onNetworkError:function(t){pe(c,Ms,"m",ws).call(c,e,t,!1)}}),n.isOk?(r=n.data,i={client:r,cached:"",msg:void 0},pe(this,Ls,"f").set(e,i),pe(this,bs,"f")?[4,pe(this,Us,"f").getLocalMessage(e)]:[3,2]):[2,n.wipe()]);case 1:if(o=l.sent(),s=o.code,!(a=o.data))return pe(this,Ls,"f").delete(e),[2,ut(s,"message not found, msgUId: ".concat(e))];if(a.content.isSynced)return pe(this,Ls,"f").delete(e),[2,ut(P.STREAM_MESSAGE_SYNCED,"synced")];i.msg=a,l.label=2;case 2:return[4,r.open(t.slice())];case 3:return(u=l.sent()).isOk||pe(this,Ls,"f").delete(e),[2,u.wipe()]}}))}))};var au,uu,cu=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.createCodec=function(e,t){return new Es(e,t)},e.prototype.createPBCodec=function(e,t){return new Pr(e,t)},e.prototype.refetchNaviInfo=function(){return ue(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.20.0-c-unikit.1"},e.prototype.getAPIVersion=function(){return"5.20.0-c-unikit.1"},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getUserToken=function(){return this._context.token},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.setPushConfig=function(e){this._context.setPushConfig(e)},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.prototype.getStatsUrlList=function(){return this._context.getStatsUrlList()},e}(),lu=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.joinRTCRoom=function(e,t,n,r,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return s=Rs(this._context.rtcCodec,t,n,r,i,o),[4,this.rtcSignaling(e,Fs,!0,s)];case 1:return a=d.sent(),u=a.code,c=a.buffer,u===P.SUCCESS&&c&&(l=ms(this._context.rtcCodec,c)),[2,{code:u,data:l}]}}))}))},n.prototype.quitRTCRoom=function(e){return ue(this,void 0,void 0,(function(){var t;return ce(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(ps.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Bs,!0,t)];case 1:return[2,n.sent().code]}}))}))},n.prototype.rtcPing=function(e,t,n){return ue(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 ue(this,void 0,void 0,(function(){var t,n,r,i,o;return ce(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(ps.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,xs,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===P.SUCCESS&&i&&(o=this._context.rtcCodec.decode(ps.RtcRoomInfoOutput,i)),[2,{code:r,data:o}]}}))}))},n.prototype.getRTCUserInfoList=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(ps.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Hs,!0,t)];case 1:return n=a.sent(),r=n.code,i=n.buffer,r===P.SUCCESS&&i&&(s=ms(this._context.rtcCodec,i),o={users:s.users}),[2,{code:r,data:o}]}}))}))},n.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},n.prototype.setRTCUserInfo=function(e,t,n){return ue(this,void 0,void 0,(function(){var r;return ce(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(ps.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,qs,!0,r)];case 1:return[2,i.sent().code]}}))}))},n.prototype.removeRTCUserInfo=function(e,t){return ue(this,void 0,void 0,(function(){var n;return ce(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(ps.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,Ys,!1,n)];case 1:return[2,r.sent().code]}}))}))},n.prototype.setRTCData=function(e,t,n,r,i,o){return ue(this,void 0,void 0,(function(){var s;return ce(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(ps.RtcSetDataInput,{interior:r,target:i,key:t,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(e,Ks,!1,s)];case 1:return[2,a.sent().code]}}))}))},n.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),ue(this,void 0,void 0,(function(){var o,s;return ce(this,(function(a){switch(a.label){case 0:return o={objectName:r,content:this._context.rtcCodec.encode(ps.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(ps.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(ps.RtcValueInfo,{key:"mcu_uris",value:i},!0)]},s=this._context.rtcCodec.encode(ps.RtcUserSetDataInput,o),[4,this.rtcSignaling(e,Qs,!0,s)];case 1:return[2,a.sent().code]}}))}))},n.prototype.setRTCCDNUris=function(e,t,n){return ue(this,void 0,void 0,(function(){var r;return ce(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(ps.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(ps.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,Qs,!0,r)];case 1:return[2,i.sent().code]}}))}))},n.prototype.getRTCData=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return i=this._context.rtcCodec.encode(ps.RtcDataInput,{interior:n,target:r,key:t}),[4,this.rtcSignaling(e,Ws,!0,i)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===P.SUCCESS&&a?(u=this._context.rtcCodec.decode(ps.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,i){return ue(this,void 0,void 0,(function(){var o;return ce(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(ps.RtcDataInput,{interior:n,target:r,key:t,objectName:null==i?void 0:i.name,content:null==i?void 0:i.content}),[4,this.rtcSignaling(e,js,!1,o)];case 1:return[2,s.sent().code]}}))}))},n.prototype.setRTCOutData=function(e,t,n,r){return ue(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 ue(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 ue(this,void 0,void 0,(function(){var r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return r=Rs(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Js,!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,o===P.SUCCESS&&s?(a=this._context.rtcCodec.decode(ps.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},n.prototype.setRTCState=function(e,t){return ue(this,void 0,void 0,(function(){var n;return ce(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(ps.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,zs,!0,n)];case 1:return[2,r.sent().code]}}))}))},n.prototype.getRTCUserList=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o;return ce(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(ps.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Zs,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===P.SUCCESS&&i?(o=ms(this._context.rtcCodec,i),[2,{code:r,data:o}]):[2,{code:r}]}}))}))},n.prototype.joinLivingRoomAsAudience=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return r=Rs(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Xs,!0,r)];case 1:return i=l.sent(),o=i.code,s=i.buffer,o===P.SUCCESS&&s?(a=this._context.rtcCodec.decode(ps.RtcViewerJoinedOutput,s),u=a.rtcToken,c=a.entries,[2,{code:o,data:{token:u,kvEntries:c}}]):[2,{code:o}]}}))}))},n.prototype.quitLivingRoomAsAudience=function(e){return ue(this,void 0,void 0,(function(){var t;return ce(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(ps.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,$s,!0,t)];case 1:return[2,n.sent().code]}}))}))},n.prototype.rtcIdentityChange=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return r=this._context.rtcCodec.encode(ps.RtcInput,{roomType:rs.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,ta,!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,o===P.SUCCESS&&s?(a=ms(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},n.prototype.requestRoomPK=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=e.roomId,a=this._context.rtcCodec.encode(ps.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,timeoutTime:i,inviteInfo:o}),[4,this.rtcSignaling(s,na,!0,a)];case 1:return[2,u.sent().code]}}))}))},n.prototype.cancelRoomPK=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=e.roomId,s=this._context.rtcCodec.encode(ps.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteInfo:i}),[4,this.rtcSignaling(o,ra,!0,s)];case 1:return[2,a.sent().code]}}))}))},n.prototype.responseRoomPK=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree,u=e.roomId,c=this._context.rtcCodec.encode(ps.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:r,content:i,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,ia,!0,c)];case 1:return[2,l.sent().code]}}))}))},n.prototype.endRoomPK=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=e.roomId,s=this._context.rtcCodec.encode(ps.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:r,inviteRoomKeys:i}),[4,this.rtcSignaling(o,oa,!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 ue(this,void 0,void 0,(function(){var t,n,r,i,o;return ce(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(ps.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",sa,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===P.SUCCESS&&i?(o=this._context.rtcCodec.decode(ps.RtcQueryUserJoinedOutput,i).info||[],[2,{code:r,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:e.joinTime}}))}]):[2,{code:r}]}}))}))},n}(cu),du={"set.proxy":P.INVALID_PARAMETER_PROXY,"test.proxy":P.INVALID_PARAMETER_TESTHOST,"test.proxy.socksHost":P.INVALID_PARAMETER_TESTHOST,"test.proxy.socksPort":P.INVALID_PARAMETER_TESTHOST,channelId:P.INVALID_PARAMETER_CHANNEL_ID,count:P.INVALID_PARAMETER_COUNT,startTime:P.INVALID_PARAMETER_START_TIME,endTime:P.INVALID_PARAMETER_END_TIME,offset:P.INVALID_PARAMETER_OFFSET,limit:P.INVALID_PARAMETER_LIMIT,keyword:P.INVALID_PARAMETER_KEYWORD,messageTypes:P.INVALID_PARAMETER_MESSAGE_TYPE,messageType:P.INVALID_PARAMETER_MESSAGE_TYPE,typingContentType:P.INVALID_PARAMETER_MESSAGE_TYPE,conversation:P.INVALID_PARAMETER_CONVERSATION,conversationType:P.INVALID_PARAMETER_CONVERSATION_TYPE,targetId:P.INVALID_PARAMETER_TARGET_ID,targetIds:P.INVALID_PARAMETER_TARGET_ID,userId:P.INVALID_PARAMETER_USER_ID,senderUserId:P.INVALID_PARAMETER_USER_ID,timestamp:P.INVALID_PARAMETER_TIMESTAMP,order:P.INVALID_PARAMETER_ORDER,messageId:P.INVALID_PARAMETER_MESSAGE_ID,receivedStatus:P.INVALID_PARAMETER_RECEIVED_STATUS,receivedStatusInfo:P.INVALID_PARAMETER_RECEIVED_STATUS,sentStatus:P.INVALID_PARAMETER_SENT_STATUS,content:P.INVALID_PARAMETER_MESSAGE_CONTENT,messageIds:P.INVALID_PARAMETER_MESSAGE_ARRAY,cleanSpace:P.INVALID_PARAMETER_CLEAN_SPACE,messageDirection:P.INVALID_MESSAGE_DIRECTION,canIncludeExpansion:P.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION,expansion:P.INVALID_PARAMETER_MESSAGE_EXPANSION,disableNotification:P.INVALID_PARAMETER_DISABLE_NOTIFICATION,messages:P.MSG_LIMIT_ERROR,checkDuplicate:P.INVALID_PARAMETER_CHECK_DUPLICATE,messageUId:P.INVALID_PARAMETER_MESSAGE_UID,key:P.INVALID_PARAMETER_KEY,keys:P.INVALID_PARAMETER_KEYS,value:P.INVALID_PARAMETER_VALUE,isAutoDelete:P.INVALID_PARAMETER_IS_AUTO_DELETE,isSendNotification:P.INVALID_PARAMETER_IS_SEND_NOTIFICATION,notificationExtra:P.INVALID_PARAMETER_NOTIFICATION_EXTRA,entries:P.INVALID_PARAMETER_ENTRIES,isForce:P.INVALID_PARAMETER_IS_FORCE,rtcRoomId:P.INVALID_PARAMETER_RTCROOMID,token:P.RC_CONN_TOKEN_INCORRECT,conversations:P.INVALID_PARAMETER_CONVERSATIONS,draft:P.INVALID_PARAMETER_DRAFT,conversationTypes:P.INVALID_PARAMETER_CONVERSATION_TYPE_LIST,levels:P.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevel:P.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevels:P.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationStatus:P.INVALID_PARAMETER_NOTIFICATION_LEVEL,isTop:P.INVALID_PARAMETER_IS_TOP,isUpdateTime:P.INVALID_PARAMETER_IS_UPDATE_TIME,message:P.INVALID_PARAMETER_MESSAGE,mentionedUserIdList:P.INVALID_PARAMETER_USERIDLIST,directionalUserIdList:P.INVALID_PARAMETER_USERIDLIST,directedUserIds:P.INVALID_PARAMETER_USERIDLIST,isStatusMessage:P.INVALID_PARAMETER_IS_STATUS_MESSAGE,pushContent:P.INVALID_PARAMETER_PUSH_CONTENT,pushData:P.INVALID_PARAMETER_PUSH_DATA,isMentioned:P.INVALID_PARAMETER_IS_MENTIONED,mentionedType:P.INVALID_PARAMETER_MENTIONED_TYPE,isVoipPush:P.INVALID_PARAMETER_IS_VOIP_PUSH,pushConfig:P.INVALID_PARAMETER_PUSH_CONFIG,startMsgUId:P.INVALID_PARAMETER_START_MESSAGE_UID,endMsgUId:P.INVALID_PARAMETER_END_MESSAGE_UID,sentTime:P.INVALID_PARAMETER_TIMESTAMP,clearMessageOption:P.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,searchContent:P.SEARCH_PROPS_LIMIT_ERROR,tagId:P.INVALID_PARAMETER_TAG_ID,tagIds:P.INVALID_PARAMETER_TAG_ID,tagName:P.INVALID_PARAMETER_TAG_NAME,containMuted:P.INVALID_PARAMETER_CONTAIN_MUTED,channelType:P.INVALID_PARAMETER_CHANNEL_TYPE,file:P.MEDIA_EXCEPTION,fileType:P.INVALID_PARAMETER_MEDIA_TYPE,contentDisposition:P.INVALID_PARAMETER_CONTENT_DISPOSITION,mediaUrl:P.INVALID_PARAMETER_MEDIA_URL,filename:P.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME,saveName:P.INVALID_PARAMETER_SAVE_NAME,serverType:P.INVALID_PARAMETER_SERVER_TYPE,subscribeType:P.INVALID_PARAMETER_SUBSCRIBE_TYPE,expiry:P.INVALID_PARAMETER_SUBSCRIBE_EXPIRY,subscribeUserIds:P.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS,subscribePageSize:P.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE,beforeCount:P.INVALID_PARAMETER_BEFORE,afterCount:P.INVALID_PARAMETER_AFTER,conversationList:P.INVALID_PARAMETER_CONVERSATION_LIST,conversationTypeNotSupport:P.CONVERSATION_TYPE_NOT_SUPPORT,profile:P.INVALID_PARAMETER_USER_PROFILE,userProfileVisibility:P.INVALID_PARAMETER_USER_PROFILE_VISIBILITY,uniqueId:P.INVALID_PARAMETER_UNIQUE_ID,extra:P.INVALID_PARAMETER_EXTRA,disableUpdateLastMessage:P.INVALID_DISABLE_UPDATE_LAST_MESSAGE};!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK",e[e.CHANNEL_ID=7]="CHANNEL_ID",e[e.CONVERSATION=8]="CONVERSATION",e[e.CONVERSATION_TYPE=9]="CONVERSATION_TYPE"}(uu||(uu={}));var hu,pu=((au={})[uu.STRING]=It,au[uu.ONLY_STRING]=ht,au[uu.NUMBER]=_t,au[uu.BOOLEAN]=function(e){return"boolean"==typeof e},au[uu.OBJECT]=Tt,au[uu.ARRAY]=gt,au[uu.CALLBACK]=function(e){var t=!0;return Tt(e)||(t=!1),(e=e||{}).onSuccess&&!Rt(e.onSuccess)&&(t=!1),e.onError&&!Rt(e.onError)&&(t=!1),t},au[uu.CHANNEL_ID]=Ot,au[uu.CONVERSATION]=function(e){var t=!0;return Tt(e)||(t=!1),ht(e.targetId)||(t=!1),At(e.conversationType)||(t=!1),mt(e.channelId)||Ot(e.channelId)||(t=!1),t},au[uu.CONVERSATION_TYPE]=At,au),_u=function(e){function n(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return t(n,e),n}(Error),fu=function(e,t,n,r){if(void 0===r&&(r=!1),!gu(e,t,n,r))throw new _u("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},gu=function(e,t,n,r){void 0===r&&(r=!1),n=pu[n]||n;var i=r?n(t):mt(t)||null==t||n(t);return i||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),i},Eu=function(){function e(e,t){var n,r;this._logTagT=e,this._logTagR=t,this.verificationFaileList=[],this.context=Gp.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,i){if(void 0===r&&(r=!1),this.verificationFaileList.length>0)return this;n=pu[n]||n;var o=r?n(t):mt(t)||null==t||n(t);if("object"==typeof o){var s=o.valid,a=o.errorKey;return!s&&a&&this.verificationFaileList.push({key:a,value:t,isValid:!1,message:i,code:du[a]}),this}return o||this.verificationFaileList.push({key:e,value:t,isValid:o,message:i,code:du[e]}),this},e.prototype.validateParameters=function(e,t,n,r,i,o){if(void 0===i&&(i=!1),this.verificationFaileList.length>0)return this;n=pu[n]||n;var s=i?n(t):mt(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:o,isValid:!1}),this}return s||this.verificationFaileList.push({key:e,value:t,code:r,message:o,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:P.BIZ_ERROR_CLIENT_NOT_INIT});var n=this._getValidationResult();if(n){var r=n.code,i=n.value,o=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(o||JSON.stringify(i))})}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:P.BIZ_ERROR_CLIENT_NOT_INIT};var n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);var r=n.code,i=n.value,o=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(o||i)}},e}(),Iu=function(e){return function(t){if(!gt(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}},vu=function(e,t){var n;return Tt(e)?(t&&!t.includes(e.conversationType)&&(n="conversationTypeNotSupport"),Ut(e.targetId)||(n="targetId"),At(e.conversationType)||(n="conversationType"),mt(e.channelId)||Ot(e.channelId)||(n="channelId"),mt(n)?{valid:!0}:{valid:mt(n),errorKey:n}):{valid:!1,errorKey:"conversation"}},Tu=function(){return hu||(hu={set:function(e,t){Ur.localStorage.setItem(e,JSON.stringify(t))},get:function(e){var t;try{t=JSON.parse(Ur.localStorage.getItem(e))}catch(e){t=null}return t},remove:function(e){return Ur.localStorage.removeItem(e)},getKeys:function(){var e=[];for(var t in Ur.localStorage)e.push(t);return e}}),hu},Ru=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}(),mu=function(){function e(e){var t;this._rootStorage=Tu();var n=this._rootStorage.get(e)||{};this._cache=new Ru(((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}(),yu="",Su=function(){var e="";if(yu)return yu;if("browser"===Ur.tag)return et;var t="RCDeviceId",n=Tu(),r=n.get(t);return r?e=r:(e=$e.genWithLen(22),n.set(t,e)),e},Cu=function(){return $e.gen()},Au=function(){return $e.genWithLen(22)},Nu="",Ou=function(){return Nu};function Mu(e){return Boolean(1&((null==e?void 0:e.sessionMode)||0))}var Uu=function(){function e(){}return e.enable=function(){return!0},e}(),Lu=48,bu=64,Pu=80,wu=96,Du="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Vu=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 i=[],o=[],s=function(){if(o.length>0){var e=o.join("");if(o=[],e.length>26){var t=ku(e.length),n=String.fromCharCode(Pu|t.length);i.push(n+t)}else{var r=String.fromCharCode(wu|e.length);i.push(r)}i.push(e)}},a=0;a<e.length;){var u=Gu(t,e,a);if(u.length<2)o.push(e.charAt(a++));else if(u.length<4)o.push(e.substr(a,u.length)),a+=u.length;else{var c=ku(a-u.offset),l=ku(u.length);if(c.length+l.length>=u.length)o.push(e.substr(a,u.length)),a+=u.length;else{s();var d=String.fromCharCode(bu|c.length<<2|l.length);i.push(d+c+l),a+=u.length}}}s();var h=ku(e.length),p=String.fromCharCode(Lu|h.length);return i.push(p+h),i.join("")},Gu=function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return r;for(var o=t.length-n,s=0,a=i.length;s<a;s++){var u=i[s],c=n-u;if(!(c>238327)){var l=Math.min(o,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var d=2,h=d;h<l&&t.charAt(u+h)===t.charAt(n+h);h++)d++;d>=r.length&&(r.length=d,r.offset=u)}}}return r},ku=function(e){var t=[],n=0;do{n=e%62,t.push(Du.charAt(n)),e=(e-n)/62}while(e>0);return t.join("")},Fu=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 ue(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 ue(this,void 0,void 0,(function(){var t,n,r;return ce(this,(function(i){switch(i.label){case 0:return t=e.task,n=this.getVersion(),[4,t(n)];case 1:return(r=i.sent()).code===P.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,[4,this._triggerPull(n)]):[3,3];case 2:return i.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:P.RC_NET_UNAVAILABLE})})),this._callerQueue=[]},e}(),Bu="converStatusChanged",xu=function(e){function n(t,n,r){var i=e.call(this)||this;return i._eventEmitter=new gs,i._pullQueue=[],i._isPulling=!1,i._pullPromise=null,i._storagePullTimeKey="con-s-".concat(n,"-").concat(r),i._oldStorage=Tu(),i._storage=new mu(ke(n,r)),i._engine=t,i.adaptOldStatus(),i}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(r.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},n.prototype._set=function(e){var t=this;if(!mt(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var o=e.updatedTime||0;n=o>n?o:n,t._eventEmitter.emit(Bu,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n),this._pullQueue=this._pullQueue.filter((function(e){return e>n}))}},n.prototype._startPull=function(){return ue(this,void 0,void 0,(function(){var e,t,n,r;return ce(this,(function(i){switch(i.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=i.sent(),n=t.code,r=t.data,this._isPulling=!1,this._pullPromise=null,n===P.SUCCESS&&this._set(r),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},n.prototype._startCall=function(){return ue(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 ue(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(Bu,(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}(Fu),Hu={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}},qu={};for(var Yu in Hu){var Ku=Hu[Yu].keyName;qu[Ku]=Yu}var Qu=function(){function e(e,t,n){this._currentUserId=t,this.logger=n,this.storage=new mu(Fe(e,t)),this._localStore=new mu(Be(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(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:w.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var r=this,i=e.conversationType,o=e.messageType,s=e.isMentioned,a=e.senderUserId;s&&i===w.GROUP&&((n.userIdList||[]).forEach((function(e){e===r._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===G.ALL&&t.indexOf(a)<0&&t.push(a));if(o===k.RECALL&&i===w.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,i=e.channelId,o=e.senderUserId,s=r.mentionedInfo;if(s&&o!==this._currentUserId){var a=this._getStoreKey(t,n,i),u=this._localStore.get(a)||{},c=qu.mentionedInfo,l=qu.hasMentioned,d=u[c]||{},h=d.userIdList||[];s={userIdList:h=this._updateMentionedUserList(e,h,s),type:(null==s?void 0:s.type)||d.type},0!==h.length?(u[c]=s,u[l]=!0):(delete u[c],delete u[l]),Ct(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 i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=qu[s],u=n[s];if(!mt(a)&&!mt(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===Hu[a].defaultVal||"tags"===s&&!Ct(u)?delete o[a]:o[a]=this._setLocal(s,u),o.c||(delete o.t,delete o.fut,delete o.fuid,delete o.hm,delete o.m,delete o.mc)}var c=Object.keys(o);1===c.length&&c.includes("st")&&delete o.st,Ct(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in Hu){var a=Hu[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Gt(c)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),o={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},s=t[r];for(var a in s)if(Hu[a]){var u=Hu[a],c=u.keyName,l=u.defaultVal;o[c]=s[a]||Gt(l)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,o=r.targetId,s={},a=e[n];for(var u in a){var c=Hu[u],l=c.keyName,d=c.defaultVal;s[l]=a[u]||Gt(d)}for(var h in s.tags){mt(t[h])&&(t[h]=[]);var p=se(se({},s),{conversationType:i,targetId:o});delete p.tags,t[h].push(p)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}this.storage.clear()}catch(e){this.logger.error(r.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}(),Wu=[w.PRIVATE,w.GROUP,w.SYSTEM,w.PUBLIC_SERVICE,w.APP_PUBLIC_SERVICE],ju="conversationChanged",Ju="conTagStatusChanged",zu=function(){function e(e,t,n,r,i,o){var s=this;this.isEnableRealtimeSession=o,this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new gs,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new Qu(t,n,e.getInnerLogger()),this._statusManager=new xu(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;s.addStatus(t,n)})),this._eventEmitter.on(ju,(function(e){r(e)})),this._eventEmitter.on(Ju,(function(){i()}));var a=this._store.getValue();a.length>1e3&&(a=a.sort((function(e,t){var n=e.lastMessageSentTime,r=void 0===n?0:n,i=t.lastMessageSentTime;return(void 0===i?0:i)-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 i=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===r.sentTime})),o=t>=r.sentTime;return n&&(o=n<r.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:i}},e.prototype._calcUnreadCount=function(e,t){if(this.isEnableRealtimeSession)return{hasChanged:!1,localConversation:t,updateItems:{}};var n=e.content,r=e.messageType,i=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,u=e.messageUId,c=s===te.SEND&&a===this._loginUserId,l=r===k.RECALL,d=Tt(n),h=!1,p={},_=t.lastUnreadTime,f=t.lastReadTime,g=t.unreadMessageCount;if(_>i||c)return{hasChanged:h,localConversation:t,updateItems:p};if(o&&(0===t.unreadMessageCount&&(t.firstUnreadMessageUid=u,t.firstUnreadTime=i),t.unreadMessageCount=g+1,t.lastUnreadTime=i,h=!0),l&&d){var E=this._handleRecall2UnreadCount(e,_,f,g,h),I=E.unreadMessageCount,v=E.hasChanged;t.unreadMessageCount=I,h=v,0===t.unreadMessageCount&&(t.firstUnreadMessageUid="",t.firstUnreadTime=0)}return h&&(p.unreadMessageCount={val:t.unreadMessageCount||0,time:i}),{hasChanged:h,localConversation:t,updateItems:p}},e.prototype._handleRecall2UnreadCount=function(e,t,n,r,i){var o="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),s=this._calcMsg(o,t,n,e.content),a=s.isNotRead,u=s.isNotRepeadRecallSendTime;return a&&r&&u?(this._recallMsgTimeMap[o]||(this._recallMsgTimeMap[o]=[]),this._recallMsgTimeMap[o].push(e.content.sentTime),{unreadMessageCount:r-1,hasChanged:!0}):{unreadMessageCount:r,hasChanged:i}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=e.messageDirection,i=e.isMentioned,o=e.sentTime,s=r===te.SEND,a=Tt(n),u=!1,c={};return!s&&i&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:o},c.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===te.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===G.ALL||(a||[]).includes(this._loginUserId)){i=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:i,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(Tt(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),o=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,r){var i=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var o in i)if(!n[o]||!!i[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,o=e.notificationStatus,s=e.notificationLevel,a=e.isTop,u=e.tags,c=e.channelId,l={},d={};if(n!==w.ULTRA_GROUP){mt(s)||(d.notificationLevel={time:i,val:s},d.notificationStatus={time:i,val:Ne(s)}),mt(a)||(d.isTop={time:i,val:a}),mt(u)||(d.tags={time:i,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,l,c);var h=this._store.get(n,r,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,r,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:h},c),r&&(this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:d,channelId:c}),t&&this._notifyConversationChanged())}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(ju,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Ju),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId,a=e.sentTime,u=e.disableUpdateLastMessage;if(Wu.indexOf(r)>=0){var c=!1,l=this._store.get(r,o,s),d={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,l),i=r.hasChanged,o=r.localConversation,s=r.updateItems;c=c||i,d=se(se({},d),s),l=Gt(o)})),this._store.set(r,o,l,s),this._store.updateMentionedData(e),i&&!u){var h=this._store.get(r,o,s);h.updatedItems=se({latestMessage:{time:e.sentTime,val:e}},d),h.latestMessage=e;var p=Object.assign(h,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(p)}(c||i&&!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(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;r=r||0,(n||void 0!==s&&s<=0||void 0===s&&o!==oe.OPEN)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),i},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(r){var o=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))&&(i+=(n?c:o)||0)})),i},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,i=e.notificationStatus,o=e.notificationLevel;(t||1!==i||-1===o||0===o)&&(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,i){void 0===i&&(i=!0);var o=this._store.get(e,t,n);o.lastReadTime=o.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var s=o.unreadMessageCount,a=o.hasMentioned,u={};if(s&&(o.unreadMessageCount=0,u.unreadMessageCount={val:0,time:r}),a&&(o.hasMentioned=!1,o.unreadMentionedCount=0,o.mentionedInfo=void 0,u.hasMentioned={val:!1,time:r},u.mentionedInfo={val:void 0,time:r}),this._store.set(e,t,o,n),i&&0!==Object.keys(u).length){var c=Object.assign(o,{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 i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=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 i=this._store.get(e,t,r),o=i.tags;o=Object.assign(o,n);var s=i.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:o,lastMessageSentTime:s},r)},e.prototype.deleteTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;n.forEach((function(e){delete i[e]})),this._store.set(e,t,{tags:i},r)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===oe.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)&&(mt(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}(),Zu=function(){function e(e,t){this._localStore=new mu(xe(e,t))}return e.prototype.set=function(e,t,n,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=$u[s],u=n[s];if(!mt(a)&&!mt(u))u===Xu[a].defaultVal?delete o[a]:o[a]=u}Ct(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in Xu){var a=Xu[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Gt(c)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Xu={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},$u={};for(var ec in Xu){var tc=Xu[ec].keyName;$u[tc]=ec}var nc=function(){function e(e,t){this._store=new Zu(e,t)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.notificationLevel,o=e.channelId;t===w.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:r,notificationLevel:i},o)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),rc={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},ic=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,i=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=r===N.DELETE,u=s===o,c=!this._isExisted(n),l=a?this._remove:this._add;(t||i||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}(),oc=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return ue(this,void 0,void 0,(function(){var e,t,n,r,i,o,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=rc.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,this._isPulling=!1,o===P.SUCCESS?(rc.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){rc.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];Ct(r)||(r=new ic(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}(),sc=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}(),ac=function(e){function n(t,n,r,i){var o=e.call(this)||this;return o._tagKey="tags",o._versionKey="version",o._pullQueue=[],o._isPulling=!1,o._pullPromise=null,o._storageKey=Qe(n,r),o._storage=new mu(o._storageKey),o._engine=t,o._tagWatcherFunc=i,o}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 ue(this,void 0,void 0,(function(){var e,t,n,r,i,o,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!==P.SUCCESS||mt(r)||(o=(i=r).settings,s=i.version,a=o.Tag,mt(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 ue(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 ue(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}(Fu),uc={};function cc(){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:Tn.getMiniCmpUrlList().join(",")}}var lc=function(e){function n(t,n,r,i){void 0===i&&(i="default");var o=e.call(this,t,n,r,Ur.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),Ur.useNavi)||this;return o._environment=i,o}return t(n,e),n.prototype.httpRequest=function(e,t,n,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return s="".concat(e,"/navi.js?appId=").concat(t,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(be,"&r=").concat(Date.now(),"&env=").concat(this._environment),this.logger.debug(r.L_REQUEST_T,"req navi => ".concat(s),i),[4,Ur.httpReq({url:s,timeout:1e4,dataType:"text"})];case 1:if(200!==(a=l.sent()).status)return this.logger.debug(r.L_REQUEST_R,"request navi failed: ".concat(a.status),i),!Ur.useNavi&&o?[2,at(cc())]:[2,ut(this.transHttpCode(a.status))];try{return 0===(u=a.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(u=JSON.parse('"'.concat(u,'"'))),(c=JSON.parse(u)).protocol=/^https/.test(s)?"https":"http",c.code&&200!==c.code?[2,ut(this.transHttpCode(c.code))]:(Ur.useNavi||(c.server="",c.backupServer=Tn.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,at(c)])}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,i)}return[2,ut(P.RC_NAVI_REQ_FAILED)]}}))}))},n.prototype.httpRequestV2=function(e,t,n,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return s=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:Ur.tag,protocol:(/^https/.test(e)?D.WSS:D.WS).toString()}),this.logger.debug(r.L_REQUEST_T,"req navi => ".concat(s.url),i),[4,Ur.httpReq(s)];case 1:if(200!==(a=d.sent()).status)return this.logger.debug(r.L_REQUEST_R,"request navi failed: ".concat(a.status),i),!Ur.useNavi&&o?[2,at(cc())]:[2,ut(this.transHttpCode(a.status))];try{return u=a.data,(c="object"!=typeof u?JSON.parse(u):u).protocol=/^https/.test(s.url)?"https":"http",Ur.useNavi||(c.logSwitch=0,l=Tn.getMiniCmpUrlList(),c.serverAddr=l.map((function(e,t){return{addr:e,protocol:/^https/.test(s.url)?D.WSS:D.WS,weight:l.length-t}}))),[2,at(c)]}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,i)}return[2,ut(P.RC_NAVI_REQ_FAILED)]}}))}))},n.prototype.getNaviCache=function(e){var t=this,n=this.getCatchKey(e);if(uc[n])return uc[n];var r,i=Ge(this.appkey),o=Ur.localStorage;try{var s=o.getItem(i);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 uc[n]=a,a},n.prototype.setNaviCache=function(e,t){var n,r=this,i=Ge(this.appkey),o=Ur.localStorage;try{var s=o.getItem(i);n=s?JSON.parse(s):[]}catch(e){n=[]}var a=Date.now();n.length>0&&(n=n.filter((function(t){return a-t.timestamp<Oe&&(e!==t.token||r._environment!==t.environment)})));var u={timestamp:a,naviInfo:t,token:e,environment:this._environment};n.push(u),o.setItem(i,JSON.stringify(n)),uc[this.getCatchKey(e)]=u},n}(kn),dc=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=qe(this._appkey,t);Ur.localStorage.setItem(r,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=qe(this._appkey,e);t.inboxTime=parseInt(Ur.localStorage.getItem(n),10)||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||mt(e))){n.broadcastSyncTime=e;var r=Ye(this._appkey,t);Ur.localStorage.setItem(r,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=Ye(this._appkey,e);t.broadcastSyncTime=parseInt(Ur.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=He(this._appkey,t);Ur.localStorage.setItem(r,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=He(this._appkey,e);t.outboxTime=parseInt(Ur.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),hc=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=Ur.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,Ur.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]})),Ur.localStorage.setItem(t,JSON.stringify(n))},e}(),pc=function(){function e(e){var t;this._delayTime=e,this.subscribeData=((t={})[J.ONLINE_STATUS]={},t[J.USER_PROFILE]={},t),this._ownProfile=null}return e.prototype.clearSubscribeRelation=function(){var e;this.subscribeData=((e={})[J.ONLINE_STATUS]={},e[J.USER_PROFILE]={},e)},e.prototype.clearSubscribeStatusData=function(e){var t=this;e===J.ONLINE_STATUS?Object.keys(this.subscribeData[e]).forEach((function(n){t.subscribeData[e][n].statusMap={}})):e===J.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?se({},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 he([],de(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=se(se({},e),{extraProfile:se({},e.extraProfile)})},e.prototype.getOwnProfile=function(){return this._ownProfile?se(se({},this._ownProfile),{extraProfile:se({},this._ownProfile.extraProfile)}):null},e}(),_c=function(){function e(e){this._delayTime=e,this._relationshipStatusVersion=0,this._subUserStatusVersion=0,this._ownProfileVersion=0,this._subStore=new pc(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=[],i=[],o=[];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===z.UNSUBSCRIBE)return n._subStore.removeSubscribeUserData(c,a),void o.push(e);var d=n._subStore.getSubscribeUserData(c,a);if(!(d&&d.subscribeTime>=u)){if(c===J.ONLINE_STATUS){r.push(a);var h=(null===(t=d)||void 0===t?void 0:t.statusMap)||{};n._subStore.updateSubscribeUserData(c,a,{subscribeTime:u,expiry:l,userId:a,subscribeType:c,statusMap:h})}else{i.push(a);var p=null===(s=d)||void 0===s?void 0:s.profile;n._subStore.updateSubscribeUserData(c,a,{subscribeTime:u,expiry:l,userId:a,subscribeType:c,profile:p,isSubscribed:!0})}o.push(e)}})),{newSubscribeOnlineStatusList:r,newSubscribeUserProfileList:i,subscribeUserChangeList:o}},e.prototype.clearSubscribeStatus=function(){this._subStore.clearSubscribeStatusData(J.ONLINE_STATUS),this._subStore.clearSubscribeStatusData(J.USER_PROFILE)},e.prototype.updateSubscribeUserOnlineStatus=function(e){var t=this,n=[];return e.forEach((function(e){var r=e.subUserId,i=e.data,o=t._subStore.getSubscribeUserData(J.ONLINE_STATUS,r);if(o){var s=[],a=se({},o.statusMap);i.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(se(se({},n),{platform:e.platformInfo}))}})),t._subStore.updateSubscribeUserData(J.ONLINE_STATUS,r,{subscribeTime:o.subscribeTime,expiry:o.expiry,userId:r,subscribeType:J.ONLINE_STATUS,statusMap:a}),n.push({userId:r,subscribeType:J.ONLINE_STATUS,subscribeTime:o.subscribeTime,expiry:o.expiry,details:s})}})),n},e.prototype.updateSubscribeUserProfile=function(e){var t=this,n=[];return e.forEach((function(e){var r=e.userId,i=e.version,o=e.userProfile,s=e.userExtProfile,a=t._subStore.getSubscribeUserData(J.USER_PROFILE,r),u=Yt(r,o,s);a?a.profile&&a.profile.version>=i||(t._subStore.updateSubscribeUserData(J.USER_PROFILE,r,{subscribeTime:a.subscribeTime,expiry:a.expiry,userId:r,subscribeType:J.USER_PROFILE,profile:{info:u,version:i},isSubscribed:a.isSubscribed}),a.isSubscribed&&n.push({userId:r,subscribeType:J.USER_PROFILE,subscribeTime:a.subscribeTime,expiry:a.expiry,userProfile:se({},u)})):t._subStore.updateSubscribeUserData(J.USER_PROFILE,r,{subscribeTime:0,expiry:0,userId:r,subscribeType:J.USER_PROFILE,profile:{info:u,version:i},isSubscribed:!1})})),n},e.prototype.getSubscribeUserStatus=function(e,t){var n=this,r=[];return t.forEach((function(t){var i=n._subStore.getSubscribeUserData(e,t);if(!i||i.expiry<(Date.now()+n._delayTime-i.subscribeTime)/1e3)n._subStore.removeSubscribeUserData(e,t);else{var o={subscribeTime:i.subscribeTime,expiry:i.expiry,userId:i.userId,subscribeType:i.subscribeType};if(e===J.ONLINE_STATUS){var s=i.statusMap,a=Object.keys(s).map((function(e){return se({platform:~~e},s[~~e])}));o.details=qt(a)}else if(e===J.USER_PROFILE&&!i.isSubscribed)return;r.push(o)}})),r},e.prototype.getUserProfiles=function(e){var t=this,n=[],r=[];return e.forEach((function(e){var i=t._subStore.getSubscribeUserData(J.USER_PROFILE,e);if(i&&i.profile){var o=i.profile,s=o.version,a=o.info;if(i.isSubscribed)return t._delayTime+Date.now()-s>6048e5?void r.push(e):void n.push(se(se({},a),{extraProfile:se({},a.extraProfile)}));t._delayTime+Date.now()-s>6e5?r.push(e):n.push(se(se({},a),{extraProfile:se({},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===J.ONLINE_STATUS){var r=Object.keys(t.statusMap).map((function(e){return se({platform:~~e},t.statusMap[~~e])}));n.details=qt(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}(),fc=function(){function e(e,t,n,r,i,o,s){this._connectManager=e,this._event=t,this._currentUserId=n,this._delayTime=r,this._logger=i,this._isOpenUserProfile=o,this._subDriven=s,this._isPullingRelationship=!1,this._pullRelationshipQueue=[],this._pullRelationshipFailTime=0,this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue=[],this._pullSubUserStatusFailTime=0,this._subscribeService=new _c(r)}return e.prototype.syncData=function(){return ue(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(J.ONLINE_STATUS),2&this._subDriven&&this._event.syncSubscribeUserStatusFinished(J.USER_PROFILE),3&this._subDriven&&this._event.syncSubscribeUserStatusFinished(J.FRIEND_ONLINE_STATUS),4&this._subDriven&&this._event.syncSubscribeUserStatusFinished(J.FRIEND_USER_PROFILE),[2]}}))}))},e.prototype.startSyncSubscribeRelationship=function(e){return ue(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),ue(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=""),ue(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,d,h,p,_,f,g,E;return ce(this,(function(I){switch(I.label){case 0:return n=this._subscribeService.getRelationshipStatusVersion(),i=this._logger.createTraceId(),this._logger.info(r.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:n,_pageToken:t}),i),o=this._connectManager.codec.encodePullUserSubReq({version:n,pageToken:t}),s=new Za(Is.pullUserSub,o,this._currentUserId),[4,this._connectManager.send(s,go)];case 1:return a=I.sent(),u=a.code,c=a.data,u===P.SUCCESS&&c?(this._pullRelationshipFailTime=0,l=c.list,d=c.version,h=c.hasNext,p=c.pageToken,d=wt(d),l.forEach((function(e){e.subTime=wt(e.subTime)})),this._logger.info(r.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:u,data:c}),i),e?(_=this._subscribeService.updateSubscribeRelation(l),f=_.newSubscribeOnlineStatusList,g=_.newSubscribeUserProfileList,(E=_.subscribeUserChangeList).length>0&&this._event.subscribeRelationChanged(E),f.length>0&&this._queryAndUpdateUserOnlineStatus(f),g.length>0&&this._queryAndUpdateUserProfile(g)):this._subscribeService.updateSubscribeRelation(l,!t),this._subscribeService.updateRelationshipStatusVersion(d),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((function(e){return e>d})),h?[4,this._pullSubscribeRelationship(e,p)]:[3,3]):(this._logger.error(r.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:u,failTime:this._pullRelationshipFailTime}),i),this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?(this._pullRelationshipFailTime=0,[2]):[2,this._pullSubscribeRelationship(e,t)]);case 2:I.sent(),I.label=3;case 3:return[2]}}))}))},e.prototype.startsyncSubscribeUserStatus=function(e){return ue(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),ue(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=""),ue(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,d,h,p,_,f,g;return ce(this,(function(E){switch(E.label){case 0:return n=this._subscribeService.getSubscribeUserStatusVersion(),i=this._logger.createTraceId(),this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:n,_pageToken:t,needAllData:e}),i),o=this._connectManager.codec.encodePullSubDataReq({version:n,needAllData:e,pageToken:t}),s=new Za(Is.pullSubData,o,this._currentUserId),[4,this._connectManager.send(s,Io)];case 1:return a=E.sent(),u=a.code,c=a.data,u===P.SUCCESS&&c?(this._pullSubUserStatusFailTime=0,l=c.list,d=c.versionTime,h=c.hasNext,p=c.pageToken,_=c.isFull,d=wt(d),this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:u,data:c}),i),l.forEach((function(e){e.data.forEach((function(e){e.versionTime=wt(e.versionTime)}))})),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((function(e){return e>d})),this._subscribeService.updateSubscribeUserStatusVersion(d),f=[],g=[],l.forEach((function(e){e.subType===J.ONLINE_STATUS?f.push(e):e.subType===J.USER_PROFILE&&g.push(e.subUserId)})),_&&""===t&&this._subscribeService.clearSubscribeStatus(),f.length>0&&this._updateUserOnlineStatus(f,!_),g.length>0?[4,this._queryAndUpdateUserProfile(g,!_)]:[3,3]):(this._logger.warn(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:u,failTime:this._pullSubUserStatusFailTime}),i),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?(this._pullSubUserStatusFailTime=0,[2]):[2,this._pullSubscribeUserStatus(e,t)]);case 2:E.sent(),E.label=3;case 3:return h?[4,this._pullSubscribeUserStatus(e,p)]:[3,5];case 4:E.sent(),E.label=5;case 5:return[2]}}))}))},e.prototype._queryAndUpdateUserOnlineStatus=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this._logger.createTraceId(),this._logger.info(r.L_QUERY_SUBSCRIBE_DATA_T,JSON.stringify(e),t),n=this._connectManager.codec.encodeQrySubDataReq(J.ONLINE_STATUS,e),i=new Za(Is.qrySubData,n,this._currentUserId),[4,this._connectManager.send(i,Io)];case 1:return o=u.sent(),s=o.code,a=o.data,this._logger.info(r.L_QUERY_SUBSCRIBE_DATA_R,JSON.stringify({code:s,data:a}),t),s===P.SUCCESS&&a?(this._updateUserOnlineStatus(a.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=wt(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),ue(this,void 0,void 0,(function(){var n,i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return n=this._logger.createTraceId(),this._logger.info(r.L_PULL_USER_PROFILE_T,JSON.stringify(e),n),i=this._connectManager.codec.encodePullUserProfileReq(e),o=new Za(Is.pullUserProfile,i,this._currentUserId),[4,this._connectManager.send(o,Co)];case 1:return s=l.sent(),a=s.code,u=s.data,this._logger.info(r.L_PULL_USER_PROFILE_R,JSON.stringify({code:a,data:u}),n),a===P.SUCCESS&&u?(u.UserProfile.forEach((function(e){e.version=wt(e.version)})),c=this._subscribeService.updateSubscribeUserProfile(u.UserProfile),t&&c.length>0&&this._event.subscribeUserStatusChanged(c),[2,{code:a,data:u.UserProfile}]):[2,{code:a}]}}))}))},e.prototype.updateUserStatus=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i;return ce(this,(function(o){switch(o.label){case 0:return(t=this._connectManager.codec.decodeByPBName(e.pbData,vo)).subType!==J.ONLINE_STATUS?[3,1]:(this._updateUserOnlineStatus([t]),[3,5]);case 1:return t.subType!==J.USER_PROFILE?[3,2]:(this._queryAndUpdateUserProfile([t.subUserId]),[3,5]);case 2:return t.subType!==J.FRIEND_ONLINE_STATUS?[3,3]:(n=t.data.map((function(e){return{changeTime:wt(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!==J.FRIEND_USER_PROFILE?[3,5]:[4,this._queryAndUpdateUserProfile([t.subUserId])];case 4:r=o.sent(),(i=r.data)&&this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,userProfile:Yt(t.subUserId,i[0].userProfile,i[0].userExtProfile)}]),o.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),ue(this,void 0,void 0,(function(){var i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return i=this._connectManager.codec.encodeUpdateUserSubReq(t,e,n,r),o=new Za(Is.updUserSub,i,this._currentUserId),[4,this._connectManager.send(o,_o)];case 1:return s=l.sent(),a=s.code,u=s.data,a===P.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT&&u?[2,{code:a,data:u.subUsers.map((function(e){return e.subUserId}))}]:a===P.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===z.SUBSCRIBE&&(t===J.ONLINE_STATUS?this._queryAndUpdateUserOnlineStatus(e):t===J.USER_PROFILE&&this._queryAndUpdateUserProfile(e,!1)),[2,{code:a}]):[2,{code:a}]}}))}))},e.prototype.getUserProfiles=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,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:P.SUCCESS,data:r})]:[4,this._queryAndUpdateUserProfile(n,!1)];case 1:return i=u.sent(),o=i.code,s=i.data,o===P.SUCCESS&&s?(a=s.map((function(e){return Yt(e.userId,e.userProfile,e.userExtProfile)})),[2,{code:o,data:he(he([],de(r),!1),de(a),!1)}]):[2,{code:o,data:he([],de(r),!1)}]}}))}))},e.prototype.syncOwnProfile=function(e){return void 0===e&&(e=!1),ue(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,d,h,p;return ce(this,(function(_){switch(_.label){case 0:return this._isOpenUserProfile?(t=this._logger.createTraceId(),this._logger.info(r.L_PULL_OWN_PROFILE_T,"",t),n=this._connectManager.codec.encodeUserProfileInput(),i=new Za(Is.pullOwnProfile,n,this._currentUserId),[4,this._connectManager.send(i,Ro)]):[2,Promise.resolve({code:P.RC_USER_PROFILE_SERVICE_UNAVAILABLE})];case 1:return o=_.sent(),s=o.code,a=o.data,this._logger.info(r.L_PULL_OWN_PROFILE_R,JSON.stringify({code:s,data:a}),t),s===P.SUCCESS&&a?(u=a.userExtProfile,c=a.userProfile,l=a.version,d=a.userId,h=wt(l),p=Yt(d,c,u),this._subscribeService.updateOwnProfile(p,h),e&&this._event.ownUserProfileChanged(p),[2,{code:s,data:p}]):[2,{code:s}]}}))}))},e.prototype.getOwnProfile=function(){return ue(this,void 0,void 0,(function(){var e;return ce(this,(function(t){return(e=this._subscribeService.getOwnProfile())?[2,{code:P.SUCCESS,data:e}]:[2,this.syncOwnProfile()]}))}))},e.prototype.updateOwnProfile=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return this._subscribeService.updateOwnProfile(e,t),[2]}))}))},e}(),gc=function(){function e(e,t,n){this._storage=new mu(Je(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),i={};try{for(var o=le(r),s=o.next();!s.done;s=o.next()){var a=s.value;i[a.key]=a.value}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i},e.prototype.insert=function(e,t,n,r,i){var o;if(!(r<Date.now()-this._delayTime-Ve)){var s=this._getConversationKey(e),a=this._storage.get(s)||{};if(!a[t]){var u={t:r,d:n};i&&(u.sId=i);var c=se(se({},a),((o={})[t]=u,o));Object.keys(c).length>30&&(c=this._removeExcessData(c)),this._storage.set(s,c)}}},e.prototype.addReadedUser=function(e,t,n){var r,i=this._getConversationKey(e),o=this._storage.get(i)||{},s=o[t];if(s){if(s.us){if(s.us.includes(n))return}else s.us=[];s.us.push(n),this._storage.set(i,se(se({},o),((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 i in n){var o=n[i];o.d===te.RECEIVE&&(r[o.sId]||(r[o.sId]=[]),r[o.sId].push(i))}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],i={};for(var o in r){var s=r[o];Date.now()-this._delayTime-s.t<Ve&&(i[o]=s)}Object.keys(i).length&&(t[n]=i)}this._storage.update(t)},e}(),Ec=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=We(t),r}return t(n,e),n.prototype.getCache=function(){return Ur.localStorage.getItem(this._storageKey)},n.prototype.setCache=function(e){Ur.localStorage.setItem(this._storageKey,e)},n.prototype.clearCache=function(){Ur.localStorage.removeItem(this._storageKey)},n.prototype.sendRequest=function(e){return ue(this,void 0,void 0,(function(){var t,n,r;return ce(this,(function(i){switch(i.label){case 0:return[4,Ur.httpReq({url:e})];case 1:return t=i.sent(),n=t.status,r=t.data,[2,{code:n,data:r}]}}))}))},n.prototype.decryptData=function(e){return ue(this,void 0,void 0,(function(){var t,n;return ce(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,cn(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91")];case 1:return t=i.sent(),[2,JSON.parse(t)];case 2:return n=i.sent(),this.logger.error(r.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},n}(Rn),Ic=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 ue(this,void 0,void 0,(function(){var e,t,n,r,i,o,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!==P.SUCCESS||mt(n)||(this.pullDataHandler(n),i=this.getVersion(),o=this._pullQueue.filter((function(e){return e>i})),this._pullQueue.length=0,(s=this._pullQueue).push.apply(s,he([],de(o),!1))),r?(this.startPull(),[2]):(this._pullQueue.length>0&&(this._pullQueue.length=0,this.startPull()),[2])}}))}))},n.prototype._triggerPull=function(e){return ue(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}(Fu),vc=function(e){function n(t,n,r,i,o){var s=e.call(this)||this;return s._connectManager=t,s._currentUserId=n,s._logger=r,s._appkey=i,s._callBack=o,s._lastPullingChangeMessageTime=0,s._lastPullingChangeMessageTimeLocal=(new Date).getTime(),s._duration=18e4,s._pullEventChangeIntervalTimer=-1,s._localStorageKey=ze(i,n),s._storage=new mu(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()===X.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:P.CONNECTION_TIMEOUT});this._logger.info(r.L_PULL_EVENT_CHANGE_T,"PullEventChange time: ".concat(this._lastPullingChangeMessageTime));var e=this._connectManager.codec.encodeQueryMsgChange(this._lastPullingChangeMessageTime),t=new Za(Is.pullEventChange,e,this._currentUserId);return t.setHeaderQos(ys.AT_LEAST_ONCE),this._connectManager.send(t,Ji)},n.prototype.pullDataHandler=function(e){this._logger.info(r.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 ue(this,void 0,void 0,(function(){return ce(this,(function(e){return this._isConnected?(this.startPullEventChange(this._lastPullingChangeMessageTime,!0),this._startPullEventChangeInterval(),this._logger.info(r.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S,"PullEventChange notify online"),[2]):[2]}))}))},n}(Ic);function Tc(e){let t=e.length;for(;--t>=0;)e[t]=0}const Rc=256,mc=286,yc=30,Sc=15,Cc=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Ac=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Nc=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Oc=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mc=new Array(576);Tc(Mc);const Uc=new Array(60);Tc(Uc);const Lc=new Array(512);Tc(Lc);const bc=new Array(256);Tc(bc);const Pc=new Array(29);Tc(Pc);const wc=new Array(yc);function Dc(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let Vc,Gc,kc;function Fc(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Tc(wc);const Bc=e=>e<256?Lc[e]:Lc[256+(e>>>7)],xc=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Hc=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,xc(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},qc=(e,t,n)=>{Hc(e,n[2*t],n[2*t+1])},Yc=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},Kc=(e,t,n)=>{const r=new Array(16);let i,o,s=0;for(i=1;i<=Sc;i++)s=s+n[i-1]<<1,r[i]=s;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=Yc(r[t]++,t))}},Qc=e=>{let t;for(t=0;t<mc;t++)e.dyn_ltree[2*t]=0;for(t=0;t<yc;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Wc=e=>{e.bi_valid>8?xc(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},jc=(e,t,n,r)=>{const i=2*t,o=2*n;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]},Jc=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&jc(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!jc(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},zc=(e,t,n)=>{let r,i,o,s,a=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+a++],r+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],0===r?qc(e,i,t):(o=bc[i],qc(e,o+Rc+1,t),s=Cc[o],0!==s&&(i-=Pc[o],Hc(e,i,s)),r--,o=Bc(r),qc(e,o,n),s=Ac[o],0!==s&&(r-=wc[o],Hc(e,r,s)))}while(a<e.sym_next);qc(e,256,t)},Zc=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let s,a,u,c=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<o;s++)0!==n[2*s]?(e.heap[++e.heap_len]=c=s,e.depth[s]=0):n[2*s+1]=0;for(;e.heap_len<2;)u=e.heap[++e.heap_len]=c<2?++c:0,n[2*u]=1,e.depth[u]=0,e.opt_len--,i&&(e.static_len-=r[2*u+1]);for(t.max_code=c,s=e.heap_len>>1;s>=1;s--)Jc(e,n,s);u=o;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Jc(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,n[2*u]=n[2*s]+n[2*a],e.depth[u]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,n[2*s+1]=n[2*a+1]=u,e.heap[1]=u++,Jc(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,u=t.stat_desc.max_length;let c,l,d,h,p,_,f=0;for(h=0;h<=Sc;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,c=e.heap_max+1;c<573;c++)l=e.heap[c],h=n[2*n[2*l+1]+1]+1,h>u&&(h=u,f++),n[2*l+1]=h,l>r||(e.bl_count[h]++,p=0,l>=a&&(p=s[l-a]),_=n[2*l],e.opt_len+=_*(h+p),o&&(e.static_len+=_*(i[2*l+1]+p)));if(0!==f){do{for(h=u-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[u]--,f-=2}while(f>0);for(h=u;0!==h;h--)for(l=e.bl_count[h];0!==l;)d=e.heap[--c],d>r||(n[2*d+1]!==h&&(e.opt_len+=(h-n[2*d+1])*n[2*d],n[2*d+1]=h),l--)}})(e,t),Kc(n,c,e.bl_count)},Xc=(e,t,n)=>{let r,i,o=-1,s=t[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=s,s=t[2*(r+1)+1],++a<u&&i===s||(a<c?e.bl_tree[2*i]+=a:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=i,0===s?(u=138,c=3):i===s?(u=6,c=3):(u=7,c=4))},$c=(e,t,n)=>{let r,i,o=-1,s=t[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),r=0;r<=n;r++)if(i=s,s=t[2*(r+1)+1],!(++a<u&&i===s)){if(a<c)do{qc(e,i,e.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(qc(e,i,e.bl_tree),a--),qc(e,16,e.bl_tree),Hc(e,a-3,2)):a<=10?(qc(e,17,e.bl_tree),Hc(e,a-3,3)):(qc(e,18,e.bl_tree),Hc(e,a-11,7));a=0,o=i,0===s?(u=138,c=3):i===s?(u=6,c=3):(u=7,c=4)}};let el=!1;const tl=(e,t,n,r)=>{Hc(e,0+(r?1:0),3),Wc(e),xc(e,n),xc(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var nl=(e,t,n,r)=>{let i,o,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Rc;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Zc(e,e.l_desc),Zc(e,e.d_desc),s=(e=>{let t;for(Xc(e,e.dyn_ltree,e.l_desc.max_code),Xc(e,e.dyn_dtree,e.d_desc.max_code),Zc(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Oc[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==t?tl(e,t,n,r):4===e.strategy||o===i?(Hc(e,2+(r?1:0),3),zc(e,Mc,Uc)):(Hc(e,4+(r?1:0),3),((e,t,n,r)=>{let i;for(Hc(e,t-257,5),Hc(e,n-1,5),Hc(e,r-4,4),i=0;i<r;i++)Hc(e,e.bl_tree[2*Oc[i]+1],3);$c(e,e.dyn_ltree,t-1),$c(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),zc(e,e.dyn_ltree,e.dyn_dtree)),Qc(e),r&&Wc(e)},rl={_tr_init:e=>{el||((()=>{let e,t,n,r,i;const o=new Array(16);for(n=0,r=0;r<28;r++)for(Pc[r]=n,e=0;e<1<<Cc[r];e++)bc[n++]=r;for(bc[n-1]=r,i=0,r=0;r<16;r++)for(wc[r]=i,e=0;e<1<<Ac[r];e++)Lc[i++]=r;for(i>>=7;r<yc;r++)for(wc[r]=i<<7,e=0;e<1<<Ac[r]-7;e++)Lc[256+i++]=r;for(t=0;t<=Sc;t++)o[t]=0;for(e=0;e<=143;)Mc[2*e+1]=8,e++,o[8]++;for(;e<=255;)Mc[2*e+1]=9,e++,o[9]++;for(;e<=279;)Mc[2*e+1]=7,e++,o[7]++;for(;e<=287;)Mc[2*e+1]=8,e++,o[8]++;for(Kc(Mc,287,o),e=0;e<yc;e++)Uc[2*e+1]=5,Uc[2*e]=Yc(e,5);Vc=new Dc(Mc,Cc,257,mc,Sc),Gc=new Dc(Uc,Ac,0,yc,Sc),kc=new Dc(new Array(0),Nc,0,19,7)})(),el=!0),e.l_desc=new Fc(e.dyn_ltree,Vc),e.d_desc=new Fc(e.dyn_dtree,Gc),e.bl_desc=new Fc(e.bl_tree,kc),e.bi_buf=0,e.bi_valid=0,Qc(e)},_tr_stored_block:tl,_tr_flush_block:nl,_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(bc[n]+Rc+1)]++,e.dyn_dtree[2*Bc(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Hc(e,2,3),qc(e,256,Mc),(e=>{16===e.bi_valid?(xc(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var il=(e,t,n,r)=>{let i=65535&e,o=e>>>16&65535,s=0;for(;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+t[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16};const ol=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var sl=(e,t,n,r)=>{const i=ol,o=r+n;e^=-1;for(let n=r;n<o;n++)e=e>>>8^i[255&(e^t[n])];return~e},al={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ul={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:cl,_tr_stored_block:ll,_tr_flush_block:dl,_tr_tally:hl,_tr_align:pl}=rl,{Z_NO_FLUSH:_l,Z_PARTIAL_FLUSH:fl,Z_FULL_FLUSH:gl,Z_FINISH:El,Z_BLOCK:Il,Z_OK:vl,Z_STREAM_END:Tl,Z_STREAM_ERROR:Rl,Z_DATA_ERROR:ml,Z_BUF_ERROR:yl,Z_DEFAULT_COMPRESSION:Sl,Z_FILTERED:Cl,Z_HUFFMAN_ONLY:Al,Z_RLE:Nl,Z_FIXED:Ol,Z_DEFAULT_STRATEGY:Ml,Z_UNKNOWN:Ul,Z_DEFLATED:Ll}=ul,bl=258,Pl=262,wl=42,Dl=113,Vl=666,Gl=(e,t)=>(e.msg=al[t],t),kl=e=>2*e-(e>4?9:0),Fl=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Bl=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do{n=e.head[--r],e.head[r]=n>=i?n-i:0}while(--t);t=i,r=t;do{n=e.prev[--r],e.prev[r]=n>=i?n-i:0}while(--t)};let xl=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Hl=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},ql=(e,t)=>{dl(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Hl(e.strm)},Yl=(e,t)=>{e.pending_buf[e.pending++]=t},Kl=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Ql=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),1===e.state.wrap?e.adler=il(e.adler,t,i,n):2===e.state.wrap&&(e.adler=sl(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Wl=(e,t)=>{let n,r,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match;const u=e.strstart>e.w_size-Pl?e.strstart-(e.w_size-Pl):0,c=e.window,l=e.w_mask,d=e.prev,h=e.strstart+bl;let p=c[o+s-1],_=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(n=t,c[n+s]===_&&c[n+s-1]===p&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&o<h);if(r=bl-(h-o),o=h-bl,r>s){if(e.match_start=t,s=r,r>=a)break;p=c[o+s-1],_=c[o+s]}}}while((t=d[t&l])>u&&0!=--i);return s<=e.lookahead?s:e.lookahead},jl=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Pl)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Bl(e),r+=t),0===e.strm.avail_in)break;if(n=Ql(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=xl(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=xl(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Pl&&0!==e.strm.avail_in)},Jl=(e,t)=>{let n,r,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,a=e.strm.avail_in;do{if(n=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,r=e.strstart-e.block_start,n>r+e.strm.avail_in&&(n=r+e.strm.avail_in),n>i&&(n=i),n<o&&(0===n&&t!==El||t===_l||n!==r+e.strm.avail_in))break;s=t===El&&n===r+e.strm.avail_in?1:0,ll(e,0,0,s),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Hl(e.strm),r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(Ql(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===s);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==_l&&t!==El&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(Ql(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=o||(r||t===El)&&t!==_l&&0===e.strm.avail_in&&r<=i)&&(n=r>i?i:r,s=t===El&&0===e.strm.avail_in&&n===r?1:0,ll(e,e.block_start,n,s),e.block_start+=n,Hl(e.strm)),s?3:1)},zl=(e,t)=>{let n,r;for(;;){if(e.lookahead<Pl){if(jl(e),e.lookahead<Pl&&t===_l)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=xl(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-Pl&&(e.match_length=Wl(e,n)),e.match_length>=3)if(r=hl(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=xl(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=xl(e,e.ins_h,e.window[e.strstart+1]);else r=hl(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(ql(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===El?(ql(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ql(e,!1),0===e.strm.avail_out)?1:2},Zl=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<Pl){if(jl(e),e.lookahead<Pl&&t===_l)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=xl(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Pl&&(e.match_length=Wl(e,n),e.match_length<=5&&(e.strategy===Cl||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=hl(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=xl(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(ql(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=hl(e,0,e.window[e.strstart-1]),r&&ql(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=hl(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===El?(ql(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ql(e,!1),0===e.strm.avail_out)?1:2};function Xl(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const $l=[new Xl(0,0,0,0,Jl),new Xl(4,4,8,4,zl),new Xl(4,5,16,8,zl),new Xl(4,6,32,32,zl),new Xl(4,4,16,16,Zl),new Xl(8,16,32,32,Zl),new Xl(8,16,128,128,Zl),new Xl(8,32,128,256,Zl),new Xl(32,128,258,1024,Zl),new Xl(32,258,258,4096,Zl)];function ed(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ll,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Fl(this.dyn_ltree),Fl(this.dyn_dtree),Fl(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Fl(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Fl(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const td=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==wl&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Dl&&t.status!==Vl?1:0},nd=e=>{if(td(e))return Gl(e,Rl);e.total_in=e.total_out=0,e.data_type=Ul;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?wl:Dl,e.adler=2===t.wrap?0:1,t.last_flush=-2,cl(t),vl},rd=e=>{const t=nd(e);var n;return t===vl&&((n=e.state).window_size=2*n.w_size,Fl(n.head),n.max_lazy_match=$l[n.level].max_lazy,n.good_match=$l[n.level].good_length,n.nice_match=$l[n.level].nice_length,n.max_chain_length=$l[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},id=(e,t,n,r,i,o)=>{if(!e)return Rl;let s=1;if(t===Sl&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>9||n!==Ll||r<8||r>15||t<0||t>9||o<0||o>Ol||8===r&&1!==s)return Gl(e,Rl);8===r&&(r=9);const a=new ed;return e.state=a,a.strm=e,a.status=wl,a.wrap=s,a.gzhead=null,a.w_bits=r,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=o,a.method=n,rd(e)};var od={deflateInit:(e,t)=>id(e,t,Ll,15,8,Ml),deflateInit2:id,deflateReset:rd,deflateResetKeep:nd,deflateSetHeader:(e,t)=>td(e)||2!==e.state.wrap?Rl:(e.state.gzhead=t,vl),deflate:(e,t)=>{if(td(e)||t>Il||t<0)return e?Gl(e,Rl):Rl;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===Vl&&t!==El)return Gl(e,0===e.avail_out?yl:Rl);const r=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Hl(e),0===e.avail_out)return n.last_flush=-1,vl}else if(0===e.avail_in&&kl(t)<=kl(r)&&t!==El)return Gl(e,yl);if(n.status===Vl&&0!==e.avail_in)return Gl(e,yl);if(n.status===wl&&0===n.wrap&&(n.status=Dl),n.status===wl){let t=Ll+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=Al||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=r<<6,0!==n.strstart&&(t|=32),t+=31-t%31,Kl(n,t),0!==n.strstart&&(Kl(n,e.adler>>>16),Kl(n,65535&e.adler)),e.adler=1,n.status=Dl,Hl(e),0!==n.pending)return n.last_flush=-1,vl}if(57===n.status)if(e.adler=0,Yl(n,31),Yl(n,139),Yl(n,8),n.gzhead)Yl(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Yl(n,255&n.gzhead.time),Yl(n,n.gzhead.time>>8&255),Yl(n,n.gzhead.time>>16&255),Yl(n,n.gzhead.time>>24&255),Yl(n,9===n.level?2:n.strategy>=Al||n.level<2?4:0),Yl(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Yl(n,255&n.gzhead.extra.length),Yl(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=sl(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Yl(n,0),Yl(n,0),Yl(n,0),Yl(n,0),Yl(n,0),Yl(n,9===n.level?2:n.strategy>=Al||n.level<2?4:0),Yl(n,3),n.status=Dl,Hl(e),0!==n.pending)return n.last_flush=-1,vl;if(69===n.status){if(n.gzhead.extra){let t=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=sl(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Hl(e),0!==n.pending)return n.last_flush=-1,vl;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=sl(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=sl(e.adler,n.pending_buf,n.pending-r,r)),Hl(e),0!==n.pending)return n.last_flush=-1,vl;r=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Yl(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=sl(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=sl(e.adler,n.pending_buf,n.pending-r,r)),Hl(e),0!==n.pending)return n.last_flush=-1,vl;r=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Yl(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=sl(e.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Hl(e),0!==n.pending))return n.last_flush=-1,vl;Yl(n,255&e.adler),Yl(n,e.adler>>8&255),e.adler=0}if(n.status=Dl,Hl(e),0!==n.pending)return n.last_flush=-1,vl}if(0!==e.avail_in||0!==n.lookahead||t!==_l&&n.status!==Vl){let r=0===n.level?Jl(n,t):n.strategy===Al?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(jl(e),0===e.lookahead)){if(t===_l)return 1;break}if(e.match_length=0,n=hl(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(ql(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===El?(ql(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ql(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===Nl?((e,t)=>{let n,r,i,o;const s=e.window;for(;;){if(e.lookahead<=bl){if(jl(e),e.lookahead<=bl&&t===_l)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){o=e.strstart+bl;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<o);e.match_length=bl-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=hl(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=hl(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(ql(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===El?(ql(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ql(e,!1),0===e.strm.avail_out)?1:2})(n,t):$l[n.level].func(n,t);if(3!==r&&4!==r||(n.status=Vl),1===r||3===r)return 0===e.avail_out&&(n.last_flush=-1),vl;if(2===r&&(t===fl?pl(n):t!==Il&&(ll(n,0,0,!1),t===gl&&(Fl(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Hl(e),0===e.avail_out))return n.last_flush=-1,vl}return t!==El?vl:n.wrap<=0?Tl:(2===n.wrap?(Yl(n,255&e.adler),Yl(n,e.adler>>8&255),Yl(n,e.adler>>16&255),Yl(n,e.adler>>24&255),Yl(n,255&e.total_in),Yl(n,e.total_in>>8&255),Yl(n,e.total_in>>16&255),Yl(n,e.total_in>>24&255)):(Kl(n,e.adler>>>16),Kl(n,65535&e.adler)),Hl(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?vl:Tl)},deflateEnd:e=>{if(td(e))return Rl;const t=e.state.status;return e.state=null,t===Dl?Gl(e,ml):vl},deflateSetDictionary:(e,t)=>{let n=t.length;if(td(e))return Rl;const r=e.state,i=r.wrap;if(2===i||1===i&&r.status!==wl||r.lookahead)return Rl;if(1===i&&(e.adler=il(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){0===i&&(Fl(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}const o=e.avail_in,s=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,jl(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=xl(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,jl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=a,e.avail_in=o,r.wrap=i,vl},deflateInfo:"pako deflate (from Nodeca project)"};const sd=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var ad={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)sd(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n}};let ud=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){ud=!1}const cd=new Uint8Array(256);for(let e=0;e<256;e++)cd[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;cd[254]=cd[254]=1;var ld={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,r,i,o,s=e.length,a=0;for(i=0;i<s;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<s&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<s&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},buf2string:(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,i;const o=new Array(2*n);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){o[i++]=t;continue}let s=cd[t];if(s>4)o[i++]=65533,r+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&r<n;)t=t<<6|63&e[r++],s--;s>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&ud)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n})(o,i)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+cd[e[n]]>t?n:t}};var dd=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const hd=Object.prototype.toString,{Z_NO_FLUSH:pd,Z_SYNC_FLUSH:_d,Z_FULL_FLUSH:fd,Z_FINISH:gd,Z_OK:Ed,Z_STREAM_END:Id,Z_DEFAULT_COMPRESSION:vd,Z_DEFAULT_STRATEGY:Td,Z_DEFLATED:Rd}=ul;function md(e){this.options=ad.assign({level:vd,method:Rd,chunkSize:16384,windowBits:15,memLevel:8,strategy:Td},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dd,this.strm.avail_out=0;let n=od.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Ed)throw new Error(al[n]);if(t.header&&od.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ld.string2buf(t.dictionary):"[object ArrayBuffer]"===hd.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=od.deflateSetDictionary(this.strm,e),n!==Ed)throw new Error(al[n]);this._dict_set=!0}}md.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?gd:pd,"string"==typeof e?n.input=ld.string2buf(e):"[object ArrayBuffer]"===hd.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===_d||o===fd)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=od.deflate(n,o),i===Id)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=od.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Ed;if(0!==n.avail_out){if(o>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},md.prototype.onData=function(e){this.chunks.push(e)},md.prototype.onEnd=function(e){e===Ed&&(this.result=ad.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const yd=16209;var Sd=function(e,t){let n,r,i,o,s,a,u,c,l,d,h,p,_,f,g,E,I,v,T,R,m,y,S,C;const A=e.state;n=e.next_in,S=e.input,r=n+(e.avail_in-5),i=e.next_out,C=e.output,o=i-(t-e.avail_out),s=i+(e.avail_out-257),a=A.dmax,u=A.wsize,c=A.whave,l=A.wnext,d=A.window,h=A.hold,p=A.bits,_=A.lencode,f=A.distcode,g=(1<<A.lenbits)-1,E=(1<<A.distbits)-1;e:do{p<15&&(h+=S[n++]<<p,p+=8,h+=S[n++]<<p,p+=8),I=_[h&g];t:for(;;){if(v=I>>>24,h>>>=v,p-=v,v=I>>>16&255,0===v)C[i++]=65535&I;else{if(!(16&v)){if(64&v){if(32&v){A.mode=16191;break e}e.msg="invalid literal/length code",A.mode=yd;break e}I=_[(65535&I)+(h&(1<<v)-1)];continue t}for(T=65535&I,v&=15,v&&(p<v&&(h+=S[n++]<<p,p+=8),T+=h&(1<<v)-1,h>>>=v,p-=v),p<15&&(h+=S[n++]<<p,p+=8,h+=S[n++]<<p,p+=8),I=f[h&E];;){if(v=I>>>24,h>>>=v,p-=v,v=I>>>16&255,16&v){if(R=65535&I,v&=15,p<v&&(h+=S[n++]<<p,p+=8,p<v&&(h+=S[n++]<<p,p+=8)),R+=h&(1<<v)-1,R>a){e.msg="invalid distance too far back",A.mode=yd;break e}if(h>>>=v,p-=v,v=i-o,R>v){if(v=R-v,v>c&&A.sane){e.msg="invalid distance too far back",A.mode=yd;break e}if(m=0,y=d,0===l){if(m+=u-v,v<T){T-=v;do{C[i++]=d[m++]}while(--v);m=i-R,y=C}}else if(l<v){if(m+=u+l-v,v-=l,v<T){T-=v;do{C[i++]=d[m++]}while(--v);if(m=0,l<T){v=l,T-=v;do{C[i++]=d[m++]}while(--v);m=i-R,y=C}}}else if(m+=l-v,v<T){T-=v;do{C[i++]=d[m++]}while(--v);m=i-R,y=C}for(;T>2;)C[i++]=y[m++],C[i++]=y[m++],C[i++]=y[m++],T-=3;T&&(C[i++]=y[m++],T>1&&(C[i++]=y[m++]))}else{m=i-R;do{C[i++]=C[m++],C[i++]=C[m++],C[i++]=C[m++],T-=3}while(T>2);T&&(C[i++]=C[m++],T>1&&(C[i++]=C[m++]))}break}if(64&v){e.msg="invalid distance code",A.mode=yd;break e}I=f[(65535&I)+(h&(1<<v)-1)]}}break}}while(n<r&&i<s);T=p>>3,n-=T,p-=T<<3,h&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?r-n+5:5-(n-r),e.avail_out=i<s?s-i+257:257-(i-s),A.hold=h,A.bits=p};const Cd=15,Ad=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Nd=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Od=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Md=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Ud=(e,t,n,r,i,o,s,a)=>{const u=a.bits;let c,l,d,h,p,_,f=0,g=0,E=0,I=0,v=0,T=0,R=0,m=0,y=0,S=0,C=null;const A=new Uint16Array(16),N=new Uint16Array(16);let O,M,U,L=null;for(f=0;f<=Cd;f++)A[f]=0;for(g=0;g<r;g++)A[t[n+g]]++;for(v=u,I=Cd;I>=1&&0===A[I];I--);if(v>I&&(v=I),0===I)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(E=1;E<I&&0===A[E];E++);for(v<E&&(v=E),m=1,f=1;f<=Cd;f++)if(m<<=1,m-=A[f],m<0)return-1;if(m>0&&(0===e||1!==I))return-1;for(N[1]=0,f=1;f<Cd;f++)N[f+1]=N[f]+A[f];for(g=0;g<r;g++)0!==t[n+g]&&(s[N[t[n+g]]++]=g);if(0===e?(C=L=s,_=20):1===e?(C=Ad,L=Nd,_=257):(C=Od,L=Md,_=0),S=0,g=0,f=E,p=o,T=v,R=0,d=-1,y=1<<v,h=y-1,1===e&&y>852||2===e&&y>592)return 1;for(;;){O=f-R,s[g]+1<_?(M=0,U=s[g]):s[g]>=_?(M=L[s[g]-_],U=C[s[g]-_]):(M=96,U=0),c=1<<f-R,l=1<<T,E=l;do{l-=c,i[p+(S>>R)+l]=O<<24|M<<16|U}while(0!==l);for(c=1<<f-1;S&c;)c>>=1;if(0!==c?(S&=c-1,S+=c):S=0,g++,0==--A[f]){if(f===I)break;f=t[n+s[g]]}if(f>v&&(S&h)!==d){for(0===R&&(R=v),p+=E,T=f-R,m=1<<T;T+R<I&&(m-=A[T+R],!(m<=0));)T++,m<<=1;if(y+=1<<T,1===e&&y>852||2===e&&y>592)return 1;d=S&h,i[d]=v<<24|T<<16|p-o}}return 0!==S&&(i[p+S]=f-R<<24|64<<16),a.bits=v,0};const{Z_FINISH:Ld,Z_BLOCK:bd,Z_TREES:Pd,Z_OK:wd,Z_STREAM_END:Dd,Z_NEED_DICT:Vd,Z_STREAM_ERROR:Gd,Z_DATA_ERROR:kd,Z_MEM_ERROR:Fd,Z_BUF_ERROR:Bd,Z_DEFLATED:xd}=ul,Hd=16180,qd=16190,Yd=16191,Kd=16192,Qd=16194,Wd=16199,Jd=16200,zd=16206,Zd=16209,Xd=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function $d(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const eh=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Hd||t.mode>16211?1:0},th=e=>{if(eh(e))return Gd;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Hd,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,wd},nh=e=>{if(eh(e))return Gd;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,th(e)},rh=(e,t)=>{let n;if(eh(e))return Gd;const r=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Gd:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,nh(e))},ih=(e,t)=>{if(!e)return Gd;const n=new $d;e.state=n,n.strm=e,n.window=null,n.mode=Hd;const r=rh(e,t);return r!==wd&&(e.state=null),r};let oh,sh,ah=!0;const uh=e=>{if(ah){oh=new Int32Array(512),sh=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Ud(1,e.lens,0,288,oh,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ud(2,e.lens,0,32,sh,0,e.work,{bits:5}),ah=!1}e.lencode=oh,e.lenbits=9,e.distcode=sh,e.distbits=5},ch=(e,t,n,r)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var lh={inflateReset:nh,inflateReset2:rh,inflateResetKeep:th,inflateInit:e=>ih(e,15),inflateInit2:ih,inflate:(e,t)=>{let n,r,i,o,s,a,u,c,l,d,h,p,_,f,g,E,I,v,T,R,m,y,S=0;const C=new Uint8Array(4);let A,N;const O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(eh(e)||!e.output||!e.input&&0!==e.avail_in)return Gd;n=e.state,n.mode===Yd&&(n.mode=Kd),s=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,l=n.bits,d=a,h=u,y=wd;e:for(;;)switch(n.mode){case Hd:if(0===n.wrap){n.mode=Kd;break}for(;l<16;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(2&n.wrap&&35615===c){0===n.wbits&&(n.wbits=15),n.check=0,C[0]=255&c,C[1]=c>>>8&255,n.check=sl(n.check,C,2,0),c=0,l=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Zd;break}if((15&c)!==xd){e.msg="unknown compression method",n.mode=Zd;break}if(c>>>=4,l-=4,m=8+(15&c),0===n.wbits&&(n.wbits=m),m>15||m>n.wbits){e.msg="invalid window size",n.mode=Zd;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&c?16189:Yd,c=0,l=0;break;case 16181:for(;l<16;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(n.flags=c,(255&n.flags)!==xd){e.msg="unknown compression method",n.mode=Zd;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=Zd;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&4&n.wrap&&(C[0]=255&c,C[1]=c>>>8&255,n.check=sl(n.check,C,2,0)),c=0,l=0,n.mode=16182;case 16182:for(;l<32;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}n.head&&(n.head.time=c),512&n.flags&&4&n.wrap&&(C[0]=255&c,C[1]=c>>>8&255,C[2]=c>>>16&255,C[3]=c>>>24&255,n.check=sl(n.check,C,4,0)),c=0,l=0,n.mode=16183;case 16183:for(;l<16;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&4&n.wrap&&(C[0]=255&c,C[1]=c>>>8&255,n.check=sl(n.check,C,2,0)),c=0,l=0,n.mode=16184;case 16184:if(1024&n.flags){for(;l<16;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&4&n.wrap&&(C[0]=255&c,C[1]=c>>>8&255,n.check=sl(n.check,C,2,0)),c=0,l=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(p=n.length,p>a&&(p=a),p&&(n.head&&(m=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+p),m)),512&n.flags&&4&n.wrap&&(n.check=sl(n.check,r,p,o)),a-=p,o+=p,n.length-=p),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break e;p=0;do{m=r[o+p++],n.head&&m&&n.length<65536&&(n.head.name+=String.fromCharCode(m))}while(m&&p<a);if(512&n.flags&&4&n.wrap&&(n.check=sl(n.check,r,p,o)),a-=p,o+=p,m)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===a)break e;p=0;do{m=r[o+p++],n.head&&m&&n.length<65536&&(n.head.comment+=String.fromCharCode(m))}while(m&&p<a);if(512&n.flags&&4&n.wrap&&(n.check=sl(n.check,r,p,o)),a-=p,o+=p,m)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;l<16;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(4&n.wrap&&c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=Zd;break}c=0,l=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Yd;break;case 16189:for(;l<32;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}e.adler=n.check=Xd(c),c=0,l=0,n.mode=qd;case qd:if(0===n.havedict)return e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=l,Vd;e.adler=n.check=1,n.mode=Yd;case Yd:if(t===bd||t===Pd)break e;case Kd:if(n.last){c>>>=7&l,l-=7&l,n.mode=zd;break}for(;l<3;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}switch(n.last=1&c,c>>>=1,l-=1,3&c){case 0:n.mode=16193;break;case 1:if(uh(n),n.mode=Wd,t===Pd){c>>>=2,l-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=Zd}c>>>=2,l-=2;break;case 16193:for(c>>>=7&l,l-=7&l;l<32;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Zd;break}if(n.length=65535&c,c=0,l=0,n.mode=Qd,t===Pd)break e;case Qd:n.mode=16195;case 16195:if(p=n.length,p){if(p>a&&(p=a),p>u&&(p=u),0===p)break e;i.set(r.subarray(o,o+p),s),a-=p,o+=p,u-=p,s+=p,n.length-=p;break}n.mode=Yd;break;case 16196:for(;l<14;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(n.nlen=257+(31&c),c>>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Zd;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;l<3;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}n.lens[O[n.have++]]=7&c,c>>>=3,l-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},y=Ud(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,y){e.msg="invalid code lengths set",n.mode=Zd;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;S=n.lencode[c&(1<<n.lenbits)-1],g=S>>>24,E=S>>>16&255,I=65535&S,!(g<=l);){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(I<16)c>>>=g,l-=g,n.lens[n.have++]=I;else{if(16===I){for(N=g+2;l<N;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(c>>>=g,l-=g,0===n.have){e.msg="invalid bit length repeat",n.mode=Zd;break}m=n.lens[n.have-1],p=3+(3&c),c>>>=2,l-=2}else if(17===I){for(N=g+3;l<N;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}c>>>=g,l-=g,m=0,p=3+(7&c),c>>>=3,l-=3}else{for(N=g+7;l<N;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}c>>>=g,l-=g,m=0,p=11+(127&c),c>>>=7,l-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Zd;break}for(;p--;)n.lens[n.have++]=m}}if(n.mode===Zd)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Zd;break}if(n.lenbits=9,A={bits:n.lenbits},y=Ud(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,y){e.msg="invalid literal/lengths set",n.mode=Zd;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},y=Ud(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,y){e.msg="invalid distances set",n.mode=Zd;break}if(n.mode=Wd,t===Pd)break e;case Wd:n.mode=Jd;case Jd:if(a>=6&&u>=258){e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=l,Sd(e,h),s=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,l=n.bits,n.mode===Yd&&(n.back=-1);break}for(n.back=0;S=n.lencode[c&(1<<n.lenbits)-1],g=S>>>24,E=S>>>16&255,I=65535&S,!(g<=l);){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(E&&!(240&E)){for(v=g,T=E,R=I;S=n.lencode[R+((c&(1<<v+T)-1)>>v)],g=S>>>24,E=S>>>16&255,I=65535&S,!(v+g<=l);){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=g,l-=g,n.back+=g,n.length=I,0===E){n.mode=16205;break}if(32&E){n.back=-1,n.mode=Yd;break}if(64&E){e.msg="invalid literal/length code",n.mode=Zd;break}n.extra=15&E,n.mode=16201;case 16201:if(n.extra){for(N=n.extra;l<N;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;S=n.distcode[c&(1<<n.distbits)-1],g=S>>>24,E=S>>>16&255,I=65535&S,!(g<=l);){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(!(240&E)){for(v=g,T=E,R=I;S=n.distcode[R+((c&(1<<v+T)-1)>>v)],g=S>>>24,E=S>>>16&255,I=65535&S,!(v+g<=l);){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=g,l-=g,n.back+=g,64&E){e.msg="invalid distance code",n.mode=Zd;break}n.offset=I,n.extra=15&E,n.mode=16203;case 16203:if(n.extra){for(N=n.extra;l<N;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Zd;break}n.mode=16204;case 16204:if(0===u)break e;if(p=h-u,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Zd;break}p>n.wnext?(p-=n.wnext,_=n.wsize-p):_=n.wnext-p,p>n.length&&(p=n.length),f=n.window}else f=i,_=s-n.offset,p=n.length;p>u&&(p=u),u-=p,n.length-=p;do{i[s++]=f[_++]}while(--p);0===n.length&&(n.mode=Jd);break;case 16205:if(0===u)break e;i[s++]=n.length,u--,n.mode=Jd;break;case zd:if(n.wrap){for(;l<32;){if(0===a)break e;a--,c|=r[o++]<<l,l+=8}if(h-=u,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?sl(n.check,i,h,s-h):il(n.check,i,h,s-h)),h=u,4&n.wrap&&(n.flags?c:Xd(c))!==n.check){e.msg="incorrect data check",n.mode=Zd;break}c=0,l=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;l<32;){if(0===a)break e;a--,c+=r[o++]<<l,l+=8}if(4&n.wrap&&c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=Zd;break}c=0,l=0}n.mode=16208;case 16208:y=Dd;break e;case Zd:y=kd;break e;case 16210:return Fd;default:return Gd}return e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=l,(n.wsize||h!==e.avail_out&&n.mode<Zd&&(n.mode<zd||t!==Ld))&&ch(e,e.output,e.next_out,h-e.avail_out),d-=e.avail_in,h-=e.avail_out,e.total_in+=d,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?sl(n.check,i,h,e.next_out-h):il(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Yd?128:0)+(n.mode===Wd||n.mode===Qd?256:0),(0===d&&0===h||t===Ld)&&y===wd&&(y=Bd),y},inflateEnd:e=>{if(eh(e))return Gd;let t=e.state;return t.window&&(t.window=null),e.state=null,wd},inflateGetHeader:(e,t)=>{if(eh(e))return Gd;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,wd):Gd},inflateSetDictionary:(e,t)=>{const n=t.length;let r,i,o;return eh(e)?Gd:(r=e.state,0!==r.wrap&&r.mode!==qd?Gd:r.mode===qd&&(i=1,i=il(i,t,n,0),i!==r.check)?kd:(o=ch(e,t,n,n),o?(r.mode=16210,Fd):(r.havedict=1,wd)))},inflateInfo:"pako inflate (from Nodeca project)"};var dh=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const hh=Object.prototype.toString,{Z_NO_FLUSH:ph,Z_FINISH:_h,Z_OK:fh,Z_STREAM_END:gh,Z_NEED_DICT:Eh,Z_STREAM_ERROR:Ih,Z_DATA_ERROR:vh,Z_MEM_ERROR:Th}=ul;function Rh(e){this.options=ad.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dd,this.strm.avail_out=0;let n=lh.inflateInit2(this.strm,t.windowBits);if(n!==fh)throw new Error(al[n]);if(this.header=new dh,lh.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ld.string2buf(t.dictionary):"[object ArrayBuffer]"===hh.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=lh.inflateSetDictionary(this.strm,t.dictionary),n!==fh)))throw new Error(al[n])}function mh(e,t){const n=new Rh(t);if(n.push(e),n.err)throw n.msg||al[n.err];return n.result}Rh.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=t===~~t?t:!0===t?_h:ph,"[object ArrayBuffer]"===hh.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=lh.inflate(n,s),o===Eh&&i&&(o=lh.inflateSetDictionary(n,i),o===fh?o=lh.inflate(n,s):o===vh&&(o=Eh));n.avail_in>0&&o===gh&&n.state.wrap>0&&0!==e[n.next_in];)lh.inflateReset(n),o=lh.inflate(n,s);switch(o){case Ih:case vh:case Eh:case Th:return this.onEnd(o),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||o===gh))if("string"===this.options.to){let e=ld.utf8border(n.output,n.next_out),t=n.next_out-e,i=ld.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(o!==fh||0!==a){if(o===gh)return o=lh.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Rh.prototype.onData=function(e){this.chunks.push(e)},Rh.prototype.onEnd=function(e){e===fh&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ad.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var yh={Inflate:Rh,inflate:mh,inflateRaw:function(e,t){return(t=t||{}).raw=!0,mh(e,t)},ungzip:mh,constants:ul};const{Inflate:Sh,inflate:Ch,inflateRaw:Ah,ungzip:Nh}=yh;var Oh,Mh,Uh,Lh,bh=Nh,Ph=((Oh={})[Oa]=P.RC_DISCONN_KICK,Oh[Ma]=P.RC_DISCONN_EXCEPTION,Oh[La]=P.RC_DISCONN_EXCEPTION,Oh[ba]=P.RC_CONN_REDIRECTED,Oh[Pa]=P.RC_CONN_TOKEN_EXPIRED,Oh[wa]=P.RC_CONN_PROTO_VERSION_ERROR,Oh[Da]=P.RC_ACCOUNT_CANCELLATION,Oh),wh=((Mh={})[aa]=P.SUCCESS,Mh[ua]=P.RC_CONN_PROTO_VERSION_ERROR,Mh[ca]=P.RC_CONN_IDENTIFIER_REJECTED,Mh[la]=P.RC_CONN_SERVER_UNAVAILABLE,Mh[da]=P.RC_CONN_TOKEN_INCORRECT,Mh[ha]=P.RC_CONN_NOT_AUTHRORIZED,Mh[pa]=P.RC_CONN_REDIRECTED,Mh[_a]=P.RC_CONN_PACKAGE_NAME_INVALID,Mh[fa]=P.RC_CONN_APP_BLOCKED_OR_DELETED,Mh[ga]=P.RC_CONN_USER_BLOCKED,Mh[Ea]=P.RC_CONN_TOKEN_EXPIRED,Mh[Ia]=P.RC_CONN_DEVICE_ERROR,Mh[va]=P.RC_CONN_HOSTNAME_ERROR,Mh[Ta]=P.RC_DISCONN_SAME_CLIENT_ON_LINE,Mh[Ra]=P.RC_LISCENSE_COUNT_OUT_OF_LIMIT,Mh[ma]=P.RC_CONN_WRONG_CLUSTER,Mh[ya]=P.RC_APP_AUTH_NOT_PASS,Mh[Sa]=P.RC_OTP_USED,Mh[Ca]=P.RC_PLATFORM_ERROR,Mh[Aa]=P.RC_ACCOUNT_CANCELLATION,Mh[Na]=P.RC_LICENSE_EXPIRED,Mh),Dh=function(e){return[Is.ppMsgS,Is.pgMsgS,Is.chatMsgS].includes(As(e))},Vh=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};function Gh(e){return Object.keys(e).map((function(t){var n=e[t];return"string"!=typeof n&&(n="".concat(n)),{key:t,value:n}}))}function kh(e,t,n,r){return cs.encode(Mo,{targetId:e,type:w.GROUP,users:r,extProfile:n?Gh(n):void 0,settingProfile:Gh(t)})}var Fh,Bh=((Uh={})[Ns(Is.ppMsgP)]=w.PRIVATE,Uh[Ns(Is.pgMsgP)]=w.GROUP,Uh[Ns(Is.chatMsg)]=w.CHATROOM,Uh[Ns(Is.pcMsgP)]=w.CUSTOMER_SERVICE,Uh[Ns(Is.pbMsgP)]=w.SYSTEM,Uh),xh=3,Hh={1:"ChannelsUserInfos",2:"ChannelsInviteStatusInfos",3:"ChannelsJoinedInfos",11:"FriendUserInfos",12:"FriendInviteInfos"},qh=((Lh={})[S.GROUP_OPERATION]=function(e){return"ChannelEventData"},Lh[S.GROUP_PROFILE_CHANGE]=function(e){return"ChannelEventData"},Lh[S.GROUP_APPLICATION_INVITATION]=function(e){return"ChannelApplyInfo"},Lh[l.FRIEND_APPLICATION]=function(e){return{0:"FriendApplyEvent",1:"FriendApplyEvent",2:"FriendUserInfo",3:"FriendsInput",5:"FriendTypeChangeEvent",6:"FriendUpdateEvent"}[e]},Lh),Yh=function(){function e(e){this.logger=e}return e.prototype.decodeByPBName=function(e,t,n){var i,o=this,s=e,a=((i={})[Hr]=o._formatSyncMessages,i[qr]=o._formatReceivedMessage,i[Br]=o._formatSentMessage,i[ai]=o._formatHistoryMessages,i[$r]=o._formatConversationList,i[oi]=o._formatChatRoomInfos,i[Ti]=o._formatChatRoomKVList,i[Ci]=o._formatUserSetting,i[ki]=o._formatGrpReadReceiptQryResp,i[uo]=o._formatQueryReceiptResp,i[yi]=o._formatSetUserSettingOutput,i[qi]=o._formatUserSettingNotification,i[Ji]=o._formatEventChangeList,i[zi]=o._formatUltraMsgChangeList,i[eo]=o._formatUltraOperateStatusNotifyList,i[Xi]=o._formatUltraMsgList,i[ti]=o._formatUltraGroupUnreadMentionedList,i[Jr]=o._formatChrmKVVersion,i[oo]=o._formatCallKVInfo,i[ro]=o._fromatCallInfoDownStream,i[li]=o._formateSessionMsgReadInput,i[Vo]=o._formateChannelsListResult,i)[t];try{s=e.length>0&&cs.decode(t,e),Rt(a)&&(s=a.call(this,s,n))}catch(e){this.logger.error(r.L_PB_DECODE_E,t)}return s},e.prototype._readBytes=function(e){var t,n=e.offset,i=e.buffer,o=e.limit;if(n)try{var s=(t=i,"[object ArrayBuffer]"===Object.prototype.toString.call(t)?new Uint8Array(i):i);return Va.readUTF(s.subarray(n,o))}catch(e){this.logger.error(r.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(r.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list;e.syncTime;var i=e.finished,o=e.compressioEnabled,s=e.compressedData;if(o){var a=bh(s),u=cs.decode(Hr,a);return this._formatSyncMessages(u,t)}return(mt(i)||null===i)&&(e.finished=!0),e.list=Vt(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,i=n||r;i&&(e.user.portrait=e.user.portraitUri=i)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return Dt(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,i=e.pushExt,o=e.configFlag,s={};return i&&(s=function(e,t,n){var i={},o={notificationId:n||""},s={};if(!t)return{iOSConfig:i,androidConfig:o,harmonyOSConfig:s};try{var a=JSON.parse(t);null==a||a.forEach((function(e){var t,n,r,a,u,c,l,d,h,p,_,f,g=Object.keys(e);if(0!==g.length){var E=g[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===(r=e[E])||void 0===r?void 0:r.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===(d=e[E])||void 0===d?void 0:d.category);case"APNS":return i.threadId=e[E]["thread-id"],i.apnsCollapseId=e[E]["apns-collapse-id"],i.category=e[E].category,i.richMediaUri=e[E].richMediaUri,void(i.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===(h=e[E])||void 0===h?void 0:h.importance,void(o.imageUrlHonor=null===(p=e[E])||void 0===p?void 0:p.image);case"OHOS":s.category=null===(_=e[E])||void 0===_?void 0:_.category,s.image=null===(f=e[E])||void 0===f?void 0:f.image}}}))}catch(n){e.error(r.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:i,androidConfig:o,harmonyOSConfig:s}}(t,i.pushConfigs,i.pushId)),se(se({},s),{pushTitle:null==i?void 0:i.title,pushContent:n,pushData:"",disablePushTitle:!!o&&Boolean(4&o),forceShowDetailContent:!!o&&Boolean(8&o),templateId:null==i?void 0:i.templateId})},e.prototype._formatReceivedMessage=function(e,t){var n;if(!e)return e;var r=this,i=t||{},o=i.currentUserId,s=i.connectedTime,a=i.afterDecode,u=i.customMessageTypes,c=void 0===u?{}:u,l=e.content,d=e.fromUserId,h=e.type,p=e.groupId,_=e.status,f=e.dataTime,g=e.extraContent,E=e.extStatus,I=e.clientUniqueId,v=e.busChannel,T=e.msgId,R=e.classname,m=e.toUserIds,y=e.optionBits,S=e.direction||te.RECEIVE,C=function(e){var t=fe.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?fe.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(_),A=C.isPersited,N=C.isCounted,O=C.isMentioned,M=C.disableNotification,U=C.receivedStatus,L=C.canIncludeExpansion,b=!!(2&(E||0)),P=!!(4&(E||0)),D=!!(8&(E||0))?F.PRIVATE:F.PUBLIC,V=[w.GROUP,w.CHATROOM,w.RTC_ROOM,w.ULTRA_GROUP].indexOf(h)>-1?p:d,G=d,k=te.RECEIVE;S===te.SEND&&(G=o,k=te.SEND);var B=wt(f),x=B<s,H=h===w.CHATROOM,q=r._setExpansion(g),Y=r._formatBytes(l);Y=r._getUtfContent(Y);var Q=r._setPushConfig(e,this.logger);H&&d===o&&(k=te.SEND);var W={conversationType:h,targetId:V,senderUserId:G,messageType:R,messageUId:T,isPersited:A,isCounted:N,isMentioned:O,sentTime:B,messageDirection:k,receivedTime:Date.now(),disableNotification:M,receivedStatus:U,receivedStatusInfo:xt(U),canIncludeExpansion:L,content:Y,expansion:q,pushConfig:Q,channelId:v||"",isInterrupt:b,isModifyMessage:P,messageId:wt(I)||0,sentStatus:K.SENT,isOffLineMessage:x,channelType:D,isStatusMessage:(null===(n=c[R])||void 0===n?void 0:n.isStatusMessage)||!1,readReceiptInfo:void 0,directedUserIds:m,disableUpdateLastMessage:!!(1&(y||0))};return(null==a?void 0:a(W))||W},e.prototype._formatSentMessage=function(e,t){var n=this,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,d=e.extStatus,h=e.clientUniqueId,p=e.systemId,_=e.toUserIds,f=e.optionBits,g=t.signal,E=t.currentUserId,I=g.date,v=g.topic,T=g.targetId,R=!!(2&(d||0)),m=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e),isMentioned:!!(4&e)}}(o),y=m.isPersited,S=m.isCounted,C=m.disableNotification,A=m.canIncludeExpansion,N=m.isMentioned,O=Bh[v]||w.PRIVATE,M=Dh(v),U=n._formatBytes(r),L=p||T;i===k.RECALL&&(O=U.conversationType||O,L=U.targetId||T);var b=n._setExpansion(a),P=n._setPushConfig(e,this.logger),D=se(se({},P),{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:L,messageType:i,messageUId:s,isPersited:y,isCounted:S,isStatusMessage:M,senderUserId:E,content:n._formatBytes(r),sentTime:1e3*I,receivedTime:Date.now(),messageDirection:te.SEND,isOffLineMessage:!1,disableNotification:C,canIncludeExpansion:A,expansion:b,pushConfig:D,channelId:e.busChannel||"",isInterrupt:R,messageId:wt(h)||0,receivedStatus:fe.UNREAD,receivedStatusInfo:xt(fe.UNREAD),isMentioned:N,directedUserIds:_,disableUpdateLastMessage:!!(1&(f||0))}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=e.list,i=e.hasMsg,o=e.compressedData;if(e.compressioEnabled){var s=bh(o),a=cs.decode(ai,s);return this._formatHistoryMessages(a,t)}var u=t.conversation||{},c=u.targetId,l=wt(e.syncTime),d=[];return Dt(r,(function(e){var r=n._formatReceivedMessage(e,t);u.conversationType===w.ULTRA_GROUP?r.targetId=e.groupId||u.targetId:r.targetId=c,d.push(r)}),{isReverse:!0}),{syncTime:l,list:d,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,i=e.changeType,o=e.msgUID,s=e.msgTime,a=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId,d=e.subChangeType,h=e.userGroupIds,p=e.busChannelType,_=e.remindType;return{targetId:t,conversationType:n,changeType:i,messageUId:o,changeTime:wt(r),sendTime:wt(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:d,userGroupIds:h,busChannelType:p,mentionedType:_}})),hasNext:r}},e.prototype._formatEventChangeList=function(e){var t=this,n=e.list,r=e.syncTime,i=e.hasNext;return{syncTime:r,list:n&&n.map((function(e){var n,r=e.businessId,i=e.type,o=e.time,s=e.changeType,a=e.originalId,u=e.originalTime,c=e.secondaryId,l=e.isAdmin,d=e.additionalMark,h=e.operatorId,p=e.subChangeType,_=e.secondaryType,f=e.remindType,g=e.isRemindMe,E=e.extIds,I=e.eventData;return I&&(n=t._formatEventData(I,s,p)),{businessId:r,conversationType:i,changeType:s,originalId:a,time:wt(o),originalTime:wt(u),secondaryId:c||"",isAdmin:l,additionalMark:d,operatorId:h,subChangeType:p,userGroupIds:E,secondaryType:_,remindType:f,isRemindMe:g,eventData:n}})),hasNext:i}},e.prototype._formatEventData=function(e,t,n){var r={};return e&&qh[t]&&qh[t](n)&&(r=cs.decode(qh[t](n),e)||{}),r},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,r=e.info,i=e.summary,o=[],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,i=e.opType,s=e.optime,a=wt(s);o.push({targetId:t,channelId:n,userId:r,operationType:i,operationTime:a})})),a&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,i=e.opType;s.push({targetId:t,channelId:n,count:r,operationType:i})})),{conversationType:t,info:o,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:wt(e.msgTime),mentionedType:e.remindType,messageType:e.className||""}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,r=t.unreadCount,i=t.remindCount,o=t.busChannelType,s=t.msgInfo,a=t.remindMeCount;return e.versionTime=wt(n)||0,e.unreadMessageCount=this._getUnreadCount(wt(r)||0),e.unreadMentionedCount=this._getUnreadCount(wt(i)||0),e.unreadMentionedMeCount=this._getUnreadCount(wt(a)||0),e.channelType=o||F.PUBLIC,e.lastReadTime=0,s&&(e.firstUnreadMessage={sentTime:wt(s.msgTime)},e.lastReadTime=wt(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,i=e.info,o=e.compressedData;if(e.compressioEnabled){var s=bh(o),a=cs.decode($r,s);return this._formatConversationList(a,t)}var u=t.afterDecode,c={list:(i=Vt(i,(function(e){var i=e.msg,o=e.userId,s=e.type,a=e.unreadCount,c=e.busChannel,l=e.versionTime,d=null;i&&((d=r._formatReceivedMessage(i,t)).targetId=o);var h={targetId:o,conversationType:s,unreadMessageCount:wt(a)||0,latestMessage:d,channelId:c||"",operationTime:wt(l)||0};return s===w.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==u?void 0:u(h))||h})))||[]};return((null==t?void 0:t.conversationType)||w.NONE)===w.ULTRA_GROUP&&(c.isFinished=e.isFinished),c},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:Vt(n,(function(e){var t=e.id,n=e.time;return{id:t,time:wt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime,i=e.compressedData;if(e.compressioEnabled){var o=bh(i),s=cs.decode(Ti,o);return this._formatChatRoomKVList(s)}return t=Vt(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,o=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?N.DELETE:N.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:wt(i),version:wt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return Dt(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=wt(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=wt(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=wt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatQueryReceiptResp=function(e){var t=e.list,n=void 0===t?[]:t,r=e.num,i=e.readCnt;return{list:n.map((function(e){return{readTime:wt(e.receiptTime),userId:e.userId}})),totalCount:r,readCount:i}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){var t=e.joinTime,n=e.createTime,r=e.memberCount,i=e.chatroomBanState;return{joinTime:t,createTime:n||0,memberCount:r||0,isAllChatroomBanned:!!(1&i),isCurrentUserBanned:!!(2&i),isCurrentChatroomBanned:!!(4&i),isCurrentChatroomInWhitelist:!!(1&e.whiteListState)}},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:wt(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:cs.decode(Hh[t],n)||[],page:r}:{listType:t,result:{list:[]},page:r}},e.prototype.encodeSessionAttInput=function(){var e=cs.getModule(ui);return e.setNothing(1),e.toArrayBuffer()},e.prototype._calculateFlag=function(e){var t=e.isFilerWhiteBlacklist,n=e.isVoipPush,r=e.pushConfig||{},i=0;return i|=n?1:0,i|=t?2:0,i|=r.disablePushTitle?4:0,i|=r.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,r=e.androidConfig,i=e.templateId,o=void 0===i?"":i,s=e.harmonyOSConfig,a=cs.getModule(xr);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,i=t.channelIdHW,o=t.channelIdOPPO,s=t.typeVivo,a=t.importanceHW,u=t.categoryHW,c=t.imageUrlHW,l=t.categoryVivo,d=t.importanceHonor,h=t.imageUrlHonor,p=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,r=e.apnsCollapseId,i=e.category,o=e.richMediaUri,s=e.interruptionLevel,a=t.googleConfig,u={};u["thread-id"]=n||"",u["apns-collapse-id"]=r||"",u.category=i||"",u.richMediaUri=o||"",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:i||"",importance:a||"NORMAL",image:c||"",category:u||""}},{MI:{channelId:r||""}},{OPPO:{channelId:o||""}},{VIVO:{classification:s||"",category:l||""}},{APNS:p.APNS},{FCM:p.FCM},{HONOR:{importance:d||ne.NORMAL,image:h||""}},{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(o),a},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,r=t.content,i=t.directionalUserIdList,o=t.canIncludeExpansion,s=t.expansion,a=t.pushConfig,u=t.channelId,c=t.pushData,l=void 0===c?"":c,d=t.pushContent,h=void 0===d?"":d,p=t.messageId,_=void 0===p?0:p,f=t.disableUpdateLastMessage,g=void 0!==f&&f,E=t.isPersited,I=e.conversationType,v=e.targetId,T=cs.getModule(Br),R=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),m=a||{},y=m.pushContent,S=void 0===y?h:y,C=m.pushData,A=void 0===C?l:C;T.setSessionId(R),S&&T.setPushText(S),A&&T.setAppData(A),i&&T.setToUserIds(i);var N=this._calculateFlag(t);if(T.setConfigFlag(N),T.setClassname(n),r.user&&r.user.portraitUri&&(r.user.portrait=r.user.portraitUri),T.setContent(JSON.stringify(r)),o&&s){var O={};Dt(s,(function(e,t){O[t]={v:e}})),T.setExtraContent(JSON.stringify(O))}if(a){var M=this._getPushExtraModule(a);T.setPushExt(M)}T.setClientUniqueId(_),mt(u)||T.setBusChannel(u),I===w.SYSTEM&&T.setSystemId(v);var U=0;return E&&g&&(U|=1),T.setOptionBits(U),T},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,i=t.timestamp,o=t.channelId,s=cs.getModule(si);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.setBusChannel(o||""),s.setCompressioEnabled(Uu.enable()),s.toArrayBuffer()},e.prototype.encodeSuperSyncMsg=function(e){return cs.encode(Qi,{syncTime:e,compressioEnabled:Uu.enable()})},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,r=e.startTime,i=e.order;t=t||0,r=r||0,i=i||0;var o=cs.getModule(Zr);return o.setType(n),o.setCount(t),o.setStartTime(r),o.setOrder(i),o.setCompressioEnabled(Uu.enable()),o.toArrayBuffer()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,r=cs.getModule(Xr);return r.setType(t),n&&r.setBusChannel([n]),r.toArrayBuffer()},e.prototype.encodeBatchDeleteConversation=function(e){var t=cs.getModule(fi),n=[];return e.forEach((function(e){var t=e.conversationType,r=e.targetId,i=e.channelId,o=cs.getModule(gi);o.setConversationType(t),o.setConversationId(r),o.setBusChannel(i||""),n.push(o)})),t.setRelation(n),t.toArrayBuffer()},e.prototype._encodeSessions=function(e){return e.map((function(e){var t=e.conversationType,n=e.targetId,r=cs.getModule(hi);return r.setType(t),r.setChannelId(n),r}))},e.prototype.encodeRemoveConversationList=function(e){var t=cs.getModule(di);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()},e.prototype.encodeDeleteMessages=function(e,t,n,r){var i=cs.getModule(Ei),o=[];return Dt(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(o),i.setBusChannel(r),i.toArrayBuffer()},e.prototype.encodeClearMessages=function(e,t,n,r){var i=cs.getModule(ni);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(r),i.toArrayBuffer()},e.prototype.encodeBatchClearRemoteMessages=function(e){var t=cs.getModule(ri),n=e.map((function(e){var t=cs.getModule(ni);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,i=e.channelId,o=t.timestamp,s=cs.getModule(li);return o=o||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(o),s.setBusChannel(i),s.toArrayBuffer()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.keys,u={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},c=cs.getModule(Wi);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.toArrayBuffer()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.content,u=cs.getModule(Wi);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.toArrayBuffer()},e.prototype.encodeQueryMsgChange=function(e){var t=cs.getModule(ji);return t.setSyncTime(e),t.toArrayBuffer()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,r=e.messages,i=cs.getModule(Zi),o=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return i.setTargetId(t),i.setType(n),i.setQuery(o),i.toArrayBuffer()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,r=e.sentTime,i=e.count,o=cs.getModule(ei);return o.setGroupId(t),o.setBusChannel(n),o.setMsgTime(r),o.setSize(i),o.toArrayBuffer()},e.prototype.encodeOperateStatus=function(e,t,n,r){var i=cs.getModule($i);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.toArrayBuffer()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=cs.getModule(ii);return n.setCount(e),n.setOrder(t),n.toArrayBuffer()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=cs.getModule(bi);return n.setUnpushLevel(e),n.setBusChannel(t),n.toArrayBuffer()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=cs.getModule(Li);return t.setBusChannel(e),t.toArrayBuffer()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var r=cs.getModule(Ii),i=t.key,o=t.value,s=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||N.UPDATE,d=Vh(t,l),h={key:i,value:o||"",uid:n,version:c};if(mt(d)||(h.status=d),r.setEntry(h),a){var p={conversationType:w.CHATROOM,targetId:e},_={key:i,value:o,extra:s,type:l},f=this._getUpMsgModule(p,{messageType:k.CHRM_KV_NOTIFY,content:_,isPersited:!1,isCounted:!1});r.setNotification(f),r.setBNotify(!0),r.setType(w.CHATROOM)}return r.toArrayBuffer()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var r=cs.getModule(vi),i=t.entries,o=t.type||N.UPDATE,s=Vh(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};mt(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.toArrayBuffer()},e.prototype.encodePullChatRoomKV=function(e){return cs.encode(mi,{timestamp:e,compressioEnabled:Uu.enable()})},e.prototype.encodeSetConversationStatus=function(e,t){var n=Date.now();return cs.encode(Ui,{version:t,state:e.map((function(e){var t={type:e.conversationType,channelId:e.targetId,busChannel:e.channelId,time:n,stateItem:[]};return void 0!==e.notificationLevel&&(t.stateItem=[{sessionStateType:Gr.IsSilent,value:e.notificationLevel.toString()}]),void 0!==e.isTop&&(t.stateItem=[{sessionStateType:Gr.IsTop,value:e.isTop?"1":"0"}]),t}))})},e.prototype.encodeSetConversationTypeLevel=function(e,t,n){var r=cs.getModule(Di);return r.setType(e),r.setVersion(t),r.setUnpushLevel(n),r.toArrayBuffer()},e.prototype.encodeReadReceipt=function(e,t){var n=cs.getModule(Gi);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()},e.prototype.encodeCreateTag=function(e,t){var n=cs.getModule(Fi),r=[];return e.forEach((function(e){var t=cs.getModule(Bi);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=cs.getModule(Gi);return n.setMsgId(e),t&&n.setChannelId(t),n.toArrayBuffer()},e.prototype.encodeReadReceiptMsg=function(e,t,n){var r=cs.getModule(so),i=e.conversationType,o=e.targetId,s=e.channelId,a=void 0===s?"":s;return r.setType(i),r.setTargetId(o),r.setBusChannel(a),r.setStartMsgId(t),r.setEndMsgId(n),r.toArrayBuffer()},e.prototype.encodeReceiptQryReq=function(e,t){var n=cs.getModule(ao),r=e.targetId,i=e.channelId,o=void 0===i?"":i;return n.setTargetId(r),n.setBusChannel(o),n.setMsgId(t),n.toArrayBuffer()},e.prototype.encodeReceiptCntQryReq=function(e,t){var n=cs.getModule(co),r=e.targetId,i=e.conversationType,o=e.channelId,s=void 0===o?"":o;return n.setChannelId(r),n.setBusChannel(s),n.setType(i),n.setMsgId(t),n.toArrayBuffer()},e.prototype.encodeSessionMsgReadInput=function(e,t){var n=cs.getModule(li),r=e.conversationType,i=e.targetId,o=e.channelId,s=void 0===o?"":o;return n.setType(r),n.setChannelId(i),n.setBusChannel(s),n.setMsgTime(t),n.toArrayBuffer()},e.prototype.encodeRemoveTag=function(e,t){var n=cs.getModule(xi),r=[];return e.forEach((function(e){var t=cs.getModule(Bi);t.setTagId(e),r.push(t)})),n.setTags(r),n.setVersion(t),n.toArrayBuffer()},e.prototype.encodeDisConversationTag=function(e){var t=cs.getModule(Hi);return t.setTagId(e),t.toArrayBuffer()},e.prototype.encodeUpdateConversationTag=function(e,t,n){var r=cs.getModule(Ui),i=[];return t.forEach((function(t){var n=cs.getModule(Oi),r=cs.getModule(Mi),o=[];e.forEach((function(e){var t=cs.getModule(Bi);t.setTagId(e.tagId),mt(e.isTop)||t.setIsTop(e.isTop),o.push(t)})),r.setSessionStateType(xh),r.setValue(JSON.stringify(o)),r.setTags(o),n.setType(t.conversationType),n.setChannelId(t.targetId),n.setTime(Date.now()),n.setStateItem([r]),i.push(n)})),r.setState(i),r.setVersion(n),r.toArrayBuffer()},e.prototype.encodeReportSDKInfo=function(e){var t=cs.getModule(Yi);return t.setSdkInfo(e),t.toArrayBuffer()},e.prototype.encodeUltraGroup=function(e,t){var n=cs.getModule(Ki);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.toArrayBuffer()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=cs.getModule(to);return t.setRtcRoomId(e.rtcRoomId),t.toArrayBuffer()},e.prototype.encodeSetCallInfo=function(e,t){var n=cs.getModule(no);return n.setKey(e),n.setDataContent(t),n.toArrayBuffer()},e.prototype.encodePullKVMsg=function(e){var t=cs.getModule(io);return t.setSyncTime(e),t.toArrayBuffer()},e.prototype.encodeUpdateUserSubReq=function(e,t,n,r){var i=cs.getModule(ho);i.setSubType(e),i.setOpType(n),i.setExpiry(r);var o=[];return t.forEach((function(e){var t=cs.getModule(po);t.setSubUserId(e),o.push(t)})),i.setSubUsers(o),i.toArrayBuffer()},e.prototype.encodePullUserSubReq=function(e){var t=e.version,n=e.pageToken,r=cs.getModule(fo);return r.setVersion(t),r.setPageToken(n),r.toArrayBuffer()},e.prototype.encodePullSubDataReq=function(e){var t=e.version,n=e.needAllData,r=e.pageToken,i=cs.getModule(Eo);return i.setVersionTime(t),i.setNeedAllData(n),i.setPageToken(r),i.toArrayBuffer()},e.prototype.encodeQrySubDataReq=function(e,t){var n=cs.getModule(To);n.setSubType(e);var r=[];return t.forEach((function(e){var t=cs.getModule(po);t.setSubUserId(e),r.push(t)})),n.setSubUsers(r),n.toArrayBuffer()},e.prototype.encodePullUserProfileReq=function(e){var t=cs.getModule(So);return t.setUserId(e),t.toArrayBuffer()},e.prototype.encodeUserProfileInput=function(){var e=cs.getModule(Ao);return e.setNothing(1),e.toArrayBuffer()},e.prototype.encodeUserProfilePermission=function(e){var t=cs.getModule(No);return t.setPermission(e),t.toArrayBuffer()},e.prototype.encodeSearchUserProfile=function(e){var t=cs.getModule(Oo);return t.setUniqueId(e),t.toArrayBuffer()},e.prototype.encodeUserProfile=function(e){var t=cs.getModule(Ro),n=[],r=[];return Object.keys(e).forEach((function(t){if("extraProfile"!==t){var i=e[t],o=cs.getModule(mo);o.setKey(t),o.setValue((null==i?void 0:i.toString())||""),n.push(o)}else if(e.extraProfile){var s=e.extraProfile;Object.keys(s).forEach((function(e){var t=s[e],n=cs.getModule(mo);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=cs.getModule(Lo),n=[];return e.forEach((function(e){var t=cs.getModule(Mo);t.setTargetId(e),n.push(t)})),t.setType(w.GROUP),t.setList(n),t.toArrayBuffer()},e.prototype.encodeQuitGroup=function(e,t,n,r,i){void 0===n&&(n=[]),void 0===r&&(r=!0);var o=cs.getModule(bo);if(o.setTargetId(t),o.setType(w.GROUP),"dismiss"!==e&&i){var s=this.encodeQuitChannelsSetting(i,r);o.setSettingInfo(s)}return"quit"!==e&&"dismiss"!==e&&o.setUsers(n),o.toArrayBuffer()},e.prototype.encodeQuitChannelsSetting=function(e,t){var n=cs.getModule(Po);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=cs.getModule(bo);return r.setTargetId(t),r.setType(w.GROUP),r.setUsers(n),r.setOperateType(e),r.toArrayBuffer()},e.prototype.encodeChannelsQueryInput=function(e){var t=e.type,n=e.groupId,r=e.option,i=e.ids,o=cs.getModule(wo);if(n&&o.setTargetId(n),o.setType(w.GROUP),["getGroupMembersByRole","getGroupApplications","getJoinedGroupsByRole"].includes(t)&&r){var s=this.encodePagingQuery(r);o.setPage(s)}return["getGroupMembers","getJoinedGroups"].includes(t)&&o.setIds(null!=i?i:[]),e.roleType&&o.setRoleType(e.roleType),o.toArrayBuffer()},e.prototype.encodePagingQuery=function(e){var t=cs.getModule(Do),n=e.count,r=e.order,i=e.pageToken;return t.setSize(n),t.setOrder(r?0:1),t.setPageToken(i),t},e.prototype.encodeJoinGroup=function(e,t,n){void 0===n&&(n=[]);var r=cs.getModule(Fo);return r.setTargetId(t),r.setType(w.GROUP),"invite"===e&&r.setUserIds(n),r.toArrayBuffer()},e.prototype.encodeMemberResponseInput=function(e){var t=e.groupId,n=e.inviterId,r=e.optType,i=e.optResult,o=e.joinUserId,s=e.reason,a=cs.getModule(ko);return a.setTargetId(t),a.setType(w.GROUP),a.setOptType(r),a.setOptResult(i),a.setInviterId(n),r===y.MANAGER&&a.setJoinUserId(o),i||a.setDetail(null!=s?s:""),a.toArrayBuffer()},e.prototype.encodeSetGroupRemark=function(e,t){var n=cs.getModule(Go),r=T.ADD;return n.setTargetId(e),n.setType(w.GROUP),t||(r=T.REMOVE),n.setOperateType(r),n.setChannelNickName(t),n.toArrayBuffer()},e.prototype.encodeSetGroupFollows=function(e,t,n){var r=cs.getModule(bo);return r.setTargetId(t),r.setType(w.GROUP),r.setUsers(n),r.setOperateType(e),r.toArrayBuffer()},e.prototype.encodeFriendInput=function(e){var t=cs.getModule(Bo);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 cs.encode(xo,{targetId:e,type:t})},e.prototype.encodeFriendQueryInput=function(e,t,n){var r=null!=t?t:{},i=r.count,o=void 0===i?200:i,s=r.pageToken,a=void 0===s?"":s,u=r.order,c=void 0!==u&&u,l=cs.getModule(Ko);l.setQueryType(e),11===e&&l.setFriendType(n);var d=cs.getModule(Do);return d.setSize(o),d.setOrder(c?0:1),d.setPageToken(a),l.setPage(d),l.toArrayBuffer()},e.prototype.encodeFriendsListInput=function(e,t){return cs.encode(Qo,{targetId:e,type:t})},e.prototype.encodeFriendLevelSet=function(e){return cs.encode(Wo,{level:e})},e.prototype.encodeQuerySessionsInput=function(e){var t=cs.getModule(pi);return t.setSessions(this._encodeSessions(e)),t.toArrayBuffer()},e}(),Kh=function(e){function n(t,n,r){var i=e.call(this,t,n,r)||this;return 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 Yh(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,i){return ue(this,void 0,void 0,(function(){var n,o,s,a,u,c,l,d,h,p;return ce(this,(function(_){switch(_.label){case 0:if(n=t.openAnti,o=t.type,s=t.baggageEnabled,a=this.getCmpList(t),this.logger.debug(r.L_NAVI_CMP_R,JSON.stringify(a),i),0===(u=a.filter((function(e,t){return a.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(r.L_NAVI_CONF_E,"no service available",i),[2,ut(P.SERVER_UNAVAILABLE)];c=1===n?Cs.V4:Cs.V3,l=function(t){var n,r,a,l,h,p,_,f,g,E,I;return ce(this,(function(v){switch(v.label){case 0:return n=u[t],r=n.protocol,a=n.addr,l=n.weight,h=function(e,t,n,r,i,o,s,a){var u,c=s?"&protocolVer=".concat(s):"",l=Su(),d=Ou();return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(be,"&pid=").concat(o,"&deviceId=").concat(encodeURIComponent(l)).concat(1===a?"&baggage=".concat(encodeURIComponent("cid=".concat(i))):"","&apiVer=").concat(encodeURIComponent((null===(u=Ur.getApiVer)||void 0===u?void 0:u.call(Ur))||"||")).concat(Ur.connectPlatform?"&platform=".concat(Ur.connectPlatform):"").concat(c).concat(Ur.isFromUniapp?"&appIdentifier=".concat(encodeURIComponent(d)):"")}(r===D.WS?"ws":"wss",a,d.appkey,e,d.cid,"",c,s),p=Date.now(),[4,d.connectWebSocket(h,c,i)];case 1:return _=v.sent(),f=_.code,g=_.data,E=d.cmpWeightCache.findIndex((function(e){return e.addr===a})),I={bid:un(),ptc:Ee.WS,cod:f,net:d.getNetwork().type,dur:Date.now()-p,spr:0,pr:o||0,hos:a,idx:E,rct:d.retryCount?Te.RECONNECT:Te.CONNECT,cid:d.cid,v:ve.CURRENT,rsn:d._doConnectReason,count:d.retryCount,weight:l,ssid:d._serverSessionId},d.logger.record(re.IM_WEBSOCKET,JSON.stringify(I),i),f===P.RC_SOCKET_DISCONNECTED||f===P.TIMEOUT?[2,"continue"]:f!==P.SUCCESS?[2,{value:ut(f)}]:(d._localConnectedTime=Math.floor((Date.now()+p)/2),d._socket=g.socket,d.updateCmpWeight(u[t].addr,!0),d.curCmpUrl=u[t].addr,[2,{value:at(g.userId)}])}}))},d=this,h=0,_.label=1;case 1:return h<u.length?[5,l(h)]:[3,4];case 2:if("object"==typeof(p=_.sent()))return[2,p.value];_.label=3;case 3:return h+=1,[3,1];case 4:return[2,ut(P.SERVER_UNAVAILABLE)]}}))}))},n.prototype.connectWebSocket=function(e,t,n){return ue(this,void 0,void 0,(function(){var i=this;return ce(this,(function(o){return this.logger.info(r.T,"connect start: ".concat(e),n),[2,new Promise((function(o){var s=Ur.createWebSocket(e);i._socketIndex=s.id;var a=setTimeout((function(){i.logger.info(r.T,"connect timeout: ".concat(e),n),o(ut(P.TIMEOUT)),s&&s.close()}),5e3);s.onOpen((function(){clearTimeout(a),i.logger.info(r.T,"socket open",n)})),s.onMessage((function(e){if(i._socketIndex===s.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var a=ru(e,t);if(a){if(a instanceof Ha){var u=a.status;if(u!==aa)return i.logger.info(r.T,"connect failed: ".concat(u),n),void o(ut((p=u,wh[p])));i.logger.info(r.T,"connect success",n);var c=a.timestamp,l=a.userId,d=a.messageId,h=a.sessionId;return i._serverSessionId=h,i._connectedTime=c,i._idCount=d,void o(at({userId:l,socket:s}))}var p;if(a instanceof Ya){var _=a.status;return i.logger.info(r.T,"recv disconnect signal -> status: ".concat(_)),void i.onRecvDisconnect(_,s)}i._onReceiveSignal(a)}}}else i.logger.warn(r.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:s.id}))})),s.onClose((function(){i.logger.info(r.T,"socket close",n);var e=P.RC_SOCKET_DISCONNECTED;o(ut(e)),i.onSocketEnd(s,e)})),s.onError((function(e){i.logger.info(r.T,"socket error",n);var t=P.RC_SOCKET_DISCONNECTED;o(ut(t)),i.onSocketEnd(s,t)}))}))]}))}))},n.prototype._qosNeedAck=function(e){e.header.qos!==ys.AT_MOST_ONCE&&(e instanceof Ja&&!e.syncMsg&&(this.logger.debug(r.O,"send pubAck -> ".concat(e.messageId," ").concat(e.topic)),this.sendOnly(new eu(e.messageId))),e instanceof nu&&(this.logger.debug(r.O,"send queryCon -> ".concat(e.messageId)),this.sendOnly(new tu(e.messageId))))},n.prototype._publishReader=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o,s=this;return ce(this,(function(a){switch(a.label){case 0:return t=e.syncMsg,n=e.topic,i=e.messageId,this.logger.debug(r.O,"recv PublishReader -> messageId: ".concat(i," ").concat(n)),n===Qs?[2]:!t||Dh(n)?(this.emit("signal",e),[2]):[4,new Promise((function(e){s._syncMessageIds[i]=e}))];case 1:return o=a.sent(),delete this._syncMessageIds[i],this.emit("signal",e,o),[2]}}))}))},n.prototype._onReceiveSignal=function(e){return ue(this,void 0,void 0,(function(){var t,n,i;return ce(this,(function(o){switch(o.label){case 0:return e instanceof Qa&&this._pingResolve?(this._pingResolve(P.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(e),(e instanceof $a||e instanceof nu)&&(t=e.messageId,this.logger.debug(r.O,"recv ack -> messageId: ".concat(t)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(i=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],i(e))),e instanceof Ja?[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 Ph[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(P.RC_SOCKET_DISCONNECTED)}},n.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n(P.TIMEOUT)}),e),t.sendOnly(new Ka)}))},n.prototype.sendOnly=function(e){this._socket&&((e instanceof Xa||e instanceof Za)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getArrayBuffer()))},n.prototype._sendHandler=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o=this;return ce(this,(function(s){switch(s.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(P.TIMEOUT)}),3e4)}))]):[2,ut(P.RC_NET_CHANNEL_INVALID)];case 1:return n=s.sent(),(i="number"==typeof n?n:n.status)!==P.SUCCESS&&this.logger.warn(r.O,"send rmtp fail -> messageId: ".concat(t,", code: ").concat(i,", topic: ").concat(e.topic)),"number"==typeof n?[2,ut(n)]:[2,i===P.SUCCESS?at(n):ut(i,"",n)]}}))}))},n.prototype.query=function(e,t,n,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c,l,d,h,p;return ce(this,(function(_){switch(_.label){case 0:return s=this.logger.createTraceId(),this.logger.debug(r.O,"send query -> topic: ".concat(Ns(e),", targetId: ").concat(t),s),a=new Za(e,n,t),o&&a.setHeaderQos(o),[4,this._sendHandler(a)];case 1:return u=_.sent(),c=u.code,l=u.data,d=u.isOk,h=u.msg,p=l&&i?cs.decode(i,l.pbData):void 0,d?(this.logger.info(r.O,"send query success",s),[2,at(p)]):(this.logger.warn(r.O,"send query fail -> ".concat(c),s),[2,ut(c,h,p)])}}))}))},n.prototype.send=function(e,t,n){return ue(this,void 0,void 0,(function(){var i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return[4,this._sendHandler(e)];case 1:return(i=u.sent()).data?i.data instanceof $a?[2,i]:(o=i.data,s=t&&o.pbData&&[P.SUCCESS,P.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,P.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT,P.RC_USER_PROFILE_KEY_NOT_EXIST,P.RC_USER_PROFILE_EXT_KEY_NOT_EXIST,P.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS,P.RC_USER_PROFILE_VALUE_EXCEED_RANGE,P.RC_GROUP_PARAMETER_FORMAT_ERROR].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.pbData,t,n):o,0!==o.status?(this.logger.warn(r.O,"send failed -> messageId: ".concat(o.messageId,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,ut(o.status,void 0,t&&o.pbData?a:null)]):[2,at(a)]):[2,i.wipe()]}}))}))},n.prototype.close=function(e,t,n){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){switch(e.label){case 0:return n?[4,this.sendOnly(new qa(Ua))]:[3,2];case 1:e.sent(),e.label=2;case 2:return this._socket&&(this._socket.close(),this._socket=null),this.clearResolves(),[2]}}))}))},n}(Pn),Qh=function(e){this.conn=e},Wh=function(e){function n(t,n,r){var i=e.call(this,n,t,r)||this;i._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};var o=Ur.runtimeInfo,s=o.type,a=o.version;return i.deviceId=Su(),i.model="Web|".concat(s,"|").concat(a),i.init(),i}return t(n,e),n.prototype.httpRequest=function(e,t,n,i){return ue(this,void 0,void 0,(function(){var o,s,a,u,c,l,d,h;return ce(this,(function(p){switch(p.label){case 0:return(o=i).deviceId=this.deviceId,o.model=this.model,s={url:e,method:t,headers:n,body:JSON.stringify(o)},this.logger.info(r.L_REQUEST_T,JSON.stringify(s)),[4,Ur.httpReq(s)];case 1:a=p.sent(),u=a.status,c=a.data,l=void 0===c?"":c,this.logger.info(r.L_REQUEST_R,JSON.stringify({status:u,data:l}));try{return d=JSON.parse(l),h=d.data,[2,{code:parseInt(d.code,10),data:h}]}catch(e){return this.logger.warn(r.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:u,data:l,error:e})),[2,{code:u,msg:e}]}return[2]}}))}))},n.prototype.setCloudControllerCache=function(e){var t=je(this.appkey);Ur.localStorage.setItem(t,JSON.stringify(e)),this.logger.info(r.L_CLOUD_SET_CACHE_O,JSON.stringify(e))},n.prototype.getLocalCloudControllerCache=function(){var e=je(this.appkey),t=Ur.localStorage.getItem(e);return this.logger.info(r.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:e,data:t})),t},n.prototype.setMRTRConfig=function(e){this.logger.info(r.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e},n.prototype.getMRTRConfig=function(){return this._mrtr},n}(Ln),jh=null,Jh="RC_LOGS",zh="RC_STATISTICS",Zh="RC_CONF",Xh=((Fh={})[Jh]=["level","time"],Fh[Zh]=["key"],Fh[zh]=["level","time"],Fh),$h=function(e,t,n){return new Promise((function(r){var i=e.transaction(t,"readwrite").objectStore(t).index("time"),o=IDBKeyRange.upperBound(Date.now()-n),s=i.openCursor(o);s.onsuccess=function(e){var t=e.target.result;t?(t.delete(),t.continue()):r()},s.onerror=function(){r()}}))},ep=null,tp=function(e){return ue(void 0,void 0,void 0,(function(){var t,n;return ce(this,(function(r){switch(r.label){case 0:return[4,jh];case 1:return(t=r.sent())?(n=t.db,[4,$h(n,Jh,e)]):[2];case 2:return r.sent(),[4,$h(n,zh,e)];case 3:return r.sent(),ep=setTimeout((function(){return tp(e)}),6e5),[2]}}))}))},np=function(e,t,n){void 0===n&&(n=168),jh||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Ur.runtimeInfo.type?jh=new Promise((function(i){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 s="RC_LOGS_".concat(e),a=o.open(s,2);a.onerror=function(e){t.error(r.L_LOGDB_OPEN_FAILED_E,e.target.error),i(null)},a.onsuccess=function(o){var s=o.target.result;s?(s.onclose=function(e){jh=null,t.warn(r.L_LOGDB_CLOSED_S)},s.onerror=function(e){jh=null,t.error(r.L_LOGDB_ERROR_E,e.target.error)},s.onabort=function(e){t.info(r.L_LOGDB_ABORT_S,e.target.error)},tp(3600*Math.max(24,Math.min(168,n))*1e3),i({appkey:e,db:s})):i(null)},a.onupgradeneeded=function(e){var t=e.target.result;Object.keys(Xh).forEach((function(e){t.objectStoreNames.contains(e)&&t.deleteObjectStore(e);var n=e===Zh?{keyPath:"key"}:{autoIncrement:!0},r=t.createObjectStore(e,n);Xh[e].forEach((function(e){return r.createIndex(e,e,{unique:!1})}))}))}})):t.warn(r.L_UNSUPPORT_INDEXDB_O))},rp=[],ip=function(e,t,n){return new Promise((function(r){var i=e.transaction(t,"readwrite");i.oncomplete=r,i.onabort=r;var o=i.objectStore(t);n.forEach((function(e){try{o.add(e)}catch(t){null===console||void 0===console||console.error("write failed ->",e,t)}}))}))},op=[],sp=!1,ap=function(e){return ue(void 0,void 0,void 0,(function(){var t,n;return ce(this,(function(r){switch(r.label){case 0:return sp||0===op.length?[2]:(sp=!0,t=op.filter((function(e){return e.level<In.FATAL})),n=op.filter((function(e){return e.level>=In.FATAL})),op.length=0,[4,ip(e,Jh,n)]);case 1:return r.sent(),[4,ip(e,zh,t)];case 2:return r.sent(),sp=!1,0===op.length&&rp.length>0&&(rp.forEach((function(e){return e.close()})),rp.length=0),setTimeout((function(){return ap(e)})),[2]}}))}))};function up(e){return ue(this,void 0,void 0,(function(){var t;return ce(this,(function(n){switch(n.label){case 0:return[4,jh];case 1:return(t=n.sent())?[2,new Promise((function(n){var r=t.db.transaction(Zh,"readonly").objectStore(Zh).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 cp=nt,lp=function(){return{setTimestamp4RealtimeLog:function(e){cp=e},getTimestamp4RealtimeLog:function(){return cp},getLogs:function(e,t,n,r,i){return void 0===i&&(i=Jh),ue(this,void 0,void 0,(function(){var o;return ce(this,(function(s){switch(s.label){case 0:return[4,jh];case 1:return(o=s.sent())?[2,new Promise((function(s){var a=o.db.transaction(i,"readonly").objectStore(i),u=[],c=IDBKeyRange.bound(e,t),l=a.index("time").openCursor(c);l.onsuccess=function(e){var t=e.target.result;if(t){var i=t.value;i.level<=n&&(r?i.sessionId===et:i.level>=0)&&u.push(i),t.continue()}else s({dbReady:!0,logs:u})},l.onerror=function(e){s({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},dp="REPORT_SESSION",hp=function(e,t){return ue(void 0,void 0,void 0,(function(){var n,r,i,o;return ce(this,(function(s){switch(s.label){case 0:return n="".concat(dp,"_").concat(e),[4,up("".concat(dp,"_").concat(e))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(t===(null==o?void 0:o.sessionId)||function(e,t){ue(this,void 0,void 0,(function(){var n,r;return ce(this,(function(i){switch(i.label){case 0:return[4,jh];case 1:return(n=i.sent())?(r=n.db,r.transaction(Zh,"readwrite").objectStore(Zh).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},pp=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype._handleWrite=function(e){!function(e){ue(void 0,void 0,void 0,(function(){var t;return ce(this,(function(n){switch(n.label){case 0:return[4,jh];case 1:if(!(t=n.sent()))return[2];if(e.content&&ht(e.content))try{e.content=JSON.parse(e.content)}catch(e){}return op.push(e),ap(t.db),[2]}}))}))}(e)},n}(yn),_p=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(e,t,n){return void 0===t&&(t=Date.now()-_p),void 0===n&&(n=Date.now()),ue(this,void 0,void 0,(function(){var i,o;return ce(this,(function(s){switch(s.label){case 0:return t=t<0?Date.now()+t:t,(n=n<=0?Date.now():n)-t>_p&&(t=n-_p),(i=new pp(e,"RC-IM","IM")).debug(r.T,"get logs: startTime ".concat(t," endTime ").concat(n)),np(e,i),[4,lp().getLogs(t,n,In.DEBUG,!1)];case 1:return o=s.sent().logs,i.debug(r.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,i=e.level,o=e.tag,s=e.traceId,a=e.loggerId,u=e.content;return"".concat(t,",").concat(n,",").concat(r,",").concat(i,",").concat(o,",").concat(s,",").concat(a,',"').concat(u,'"\n')})),r=new Blob(n,{type:"text/csv"}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download="".concat(e,".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}("".concat(e,"-").concat(t,"-").concat(n),o),[2]}}))}))}}}}var fp,gp,Ep=function(e){function n(t,n,r){var i=this,o=Su(),s=Ur.runtimeInfo,a=s.type,u=s.version,c="".concat(a,"|").concat(u,"|").concat(n.getSessionId());return(i=e.call(this,t,o,c,lp(),n)||this).tableName=r,i}return t(n,e),n.prototype.send=function(e){return Ur.httpReq(e)},n.prototype.checkStart=function(t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){switch(n.label){case 0:return[4,hp(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 ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,{success:!0,data:Vu(e.map(Cn).join(""))}]}))}))},n.prototype.realtimeReport=function(t,n,r){return ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,e.prototype.realtimeReport.call(this,t,n,r,this.tableName)]}))}))},n}(Sn),Ip=function(e){function n(t,n){return e.call(this,t,n,Jh)||this}return t(n,e),n.prototype.isReporter=function(){return ue(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(),ue(void 0,void 0,void 0,(function(){var e,r,i;return ce(this,(function(o){switch(o.label){case 0:return[4,up("".concat(dp,"_").concat(t))];case 1:return e=o.sent(),r=e.success,i=e.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},n.prototype.report=function(t,n,r,i,o,s,a){return void 0===a&&(a=!1),ue(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,i,o,s,a)]}}))}))},n}(Ep),vp=function(e){function n(t,n){return e.call(this,t,n,zh)||this}return t(n,e),n}(Ep),Tp=function(e){this.conn=e},Rp=function(e){this.conn=e},mp=((fp={})[w.PRIVATE]=Is.qryPMsg,fp[w.GROUP]=Is.qryGMsg,fp[w.CHATROOM]=Is.qryCHMsg,fp[w.CUSTOMER_SERVICE]=Is.qryCMsg,fp[w.SYSTEM]=Is.qrySMsg,fp[w.APP_PUBLIC_SERVICE]=Is.qryMCMsg,fp[w.PUBLIC_SERVICE]=Is.qryMPMsg,fp),yp=((gp={})[w.PRIVATE]=Is.cleanPMsg,gp[w.GROUP]=Is.cleanGMsg,gp[w.ULTRA_GROUP]=Is.cleanGMsg,gp[w.CUSTOMER_SERVICE]=Is.cleanCMsg,gp[w.SYSTEM]=Is.cleanSMsg,gp[w.APP_PUBLIC_SERVICE]=Is.cleanMCMsg,gp[w.PUBLIC_SERVICE]=Is.cleanMPMsg,gp),Sp=function(e,t,n,r,i,o,s){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:te.SEND,isCounted:!!n.isCounted,isMentioned:!!n.isMentioned,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:!!n.isPersited,messageUId:r,sentTime:i,receivedTime:0,disableNotification:!!n.disableNotification,isStatusMessage:!!n.isStatusMessage,canIncludeExpansion:!!n.canIncludeExpansion,expansion:n.canIncludeExpansion?n.expansion:null,receivedStatus:fe.UNREAD,receivedStatusInfo:xt(fe.UNREAD),pushConfig:n.pushConfig,channelId:n.channelId,isInterrupt:n.isInterrupt,messageId:s||0,sentStatus:K.SENT,directedUserIds:n.directionalUserIdList,disableUpdateLastMessage:n.disableUpdateLastMessage}},Cp=function(e){return e.sort((function(e,t){var n,r,i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i})),e},Ap=[S.GROUP_OPERATION,S.GROUP_PROFILE_CHANGE,S.GROUP_APPLICATION_INVITATION,S.GROUP_FOLLOW_USER_CHANGE],Np=[l.FRIEND_APPLICATION],Op=["RC:TypSts","RC:InterceptMsg","RC:RL"];function Mp(){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 ue(this,void 0,void 0,(function(){return ce(this,(function(t){return this._isConnected?[2,r.apply(this,e)]:[2,Promise.resolve({code:P.RC_NET_UNAVAILABLE})]}))}))},n}}function Up(){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 ue(this,void 0,void 0,(function(){return ce(this,(function(t){return this._isConnected?[2,r.apply(this,e)]:[2,Promise.resolve(ut(P.RC_NET_UNAVAILABLE))]}))}))},n}}function Lp(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:wt(e.relationTime),inBlackList:!!e.flag}})):[]}function bp(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:wt(e.operateTime),extra:e.info||"",friendType:e.friendType}})):[]}var Pp=function(e){function i(t,n,r){var i=e.call(this,t,n,r,new pp(r.appkey,"IMLib","IM"))||this;o.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===k.SYNC_READ_STATUS&&function(e){return[w.GROUP,w.DISCUSSION,w.ULTRA_GROUP,w.PUBLIC_SERVICE,w.APP_PUBLIC_SERVICE].includes(e)}(e)&&Object.assign(n,{directionalUserIdList:[i.currentUserId]}),o===k.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=r.appkey,a=r.logOutputLevel,u=r.logExpireTime,c=r.navigators,l=r.areaCode,d=r.logServerUrl,h=r.miniCMPProxy,p=r.environment;i._environment=p||"default",i.logger.setOutputLevel(a),Tn.init({areaCode:l,navigators:c,logServerUrl:d,miniCMPProxy:h}),np(s,i.logger,u),i.reporter=new Ip(s,i.logger),i.navi=new lc(s,i.logger,new Ec(s,i.logger),i._environment),i.reporterStatistic=new vp(s,i.logger),i._letterbox=new dc(s),i._sendMessageStore=new hc(s),i._chrmEntryHandler=new oc(i);var _=i._connMgr=new Kh(s,i.navi,i.logger);return"browser"===Ur.tag&&i._initCloudController(),i._chatroom=new Qh(_),i._chat=new Tp(_),i._dataHosting=new Rp(_),_.on("signal",i._signalHandler,i),_.on("onConnected",i.onConnected,i),_.on("onDisconnected",i.onDisconnected,i),_.on("onConnecting",i._watcher.onConnecting,i._watcher),_.on("onSuspend",i.onSuspend,i),i}var o,s;return t(i,e),Object.defineProperty(i.prototype,"chatroom",{get:function(){return this._chatroom},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"chat",{get:function(){return this._chat},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dataHosting",{get:function(){return this._dataHosting},enumerable:!1,configurable:!0}),i.prototype._initCloudController=function(){var e;e=de(Tn.getCloudControllerUrl(),1),this.cloudControllerUri=e[0],this.cloudController=new Wh(this._appkey,this.logger,this.reporter),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,mn.init)},i.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 vc(this._connMgr,this.currentUserId,this.logger,this._appkey,this._handleEventChangeList.bind(this))),this._joinedChrmManager||(this._joinedChrmManager=new sc(t.joinMChrm)),this._conversationManager||(this._conversationManager=new zu(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag,Mu(t))),this._ultraGroupManager||(this._ultraGroupManager=new nc(this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new ac(this,this._appkey,this.currentUserId,this._watcher.tag)),this._readReceiptManager||(this._readReceiptManager=new gc(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)},i.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)},i.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)},i.prototype._initSubscribeManager=function(e){var t=this;(e.subDriven||e.userProfile)&&(this._subscribeManager||(this._subscribeManager=new fc(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())},i.prototype.createLogger=function(e,t){return new pp(this._appkey,e,t)},i.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},i.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},i.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},i.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},i.prototype.connect=function(e,t,n,r){return ue(this,void 0,void 0,(function(){return ce(this,(function(i){return this._openCallPlus=n,[2,this._connMgr.connect(e,t,n,r)]}))}))},i.prototype._signalHandler=function(e,t){var n,i=e.syncMsg,o=e.topic;if(i)this._receiveSyncMsg(e,t);else{var s=this.logger.createTraceId();this.logger.debug(r.L_RECV_RMTP_O,o,s);var a=As(o);if(a)switch(a){case Is.s_ntf:this._pullMsg(e);break;case Is.s_msg:this._receiveMsg(e);break;case Is.s_cmd:this._receiveStateNotify(e);break;case Is.s_us:this._receiveSettingNotify(e);break;case Is.rtc_ntf:this._receiveRtcKv(e.pbData);break;case Is.s_opNtf:this._pullOperateStatusNotify(e);break;case Is.s_pubCall:this._pubCallInfo(e);break;case Is.s_stat:null===(n=this._subscribeManager)||void 0===n||n.updateUserStatus(e)}else this.logger.error(r.L_RECV_RMTP_E,o,s)}},i.prototype._receiveStateNotify=function(e){var t,n,r,i=this._connMgr.codec.decodeByPBName(e.pbData,kr),o=i.time,s=i.type,a=i.chrmId;switch(s){case 2:if(!this._chrmsQueue[a])return;this._chrmEntryHandler.pullEntry(a,o);break;case 3:this._conversationManager.startPullConversationStatus(o);break;case 4:this._chrmEntryHandler.reset(a),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(o),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(o),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime);break;case 8:null===(t=this._subscribeManager)||void 0===t||t.startsyncSubscribeUserStatus(o);break;case 9:null===(n=this._subscribeManager)||void 0===n||n.startSyncSubscribeRelationship(o);break;case 10:null===(r=this._subscribeManager)||void 0===r||r.syncOwnProfile(!0);break;case 11:this._EventChangeManager.startPullEventChange(o)}},i.prototype._receiveSettingNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,qi).version;this._userSettingManager.pullUserSettings(t)},i.prototype._receiveMessageExpansion=function(e){var t=e.content,n=e.channelId,r=void 0===n?"":n,i=e.conversationType,o=e.targetId,s=t.put,a=t.del,u=t.mid;s&&this._watcher.expansion({updatedExpansion:{messageUId:u,expansion:s,channelId:r,conversationType:i,targetId:o}}),a&&this._watcher.expansion({deletedExpansion:{messageUId:u,deletedKeys:a,channelId:r,conversationType:i,targetId:o}})},i.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.pbData,li),r=n.targetId,i=n.channelId,o=n.timestamp,s=this._ultraGroupMap["".concat(i,"_").concat(r)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(Bt([s]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},i.prototype._receiveSyncMsg=function(e,t){var n,i=this,o=As(e.topic),s=((n={})[Is.ugMsg]=function(){i._ultraGroupTimeQue.push(t.timestamp),i._syncUltraMsg(i._lastSyncUltraMsgTimeStamp)},n[Is.updRTime]=function(){i._receivesyncReadStatus(e)},n[Is.updUgRTime]=function(){i._clearUltraGroupUnreadCount(e,t)},n[Is.updUserSub]=function(){var e;null===(e=i._subscribeManager)||void 0===e||e.startSyncSubscribeRelationship(t.timestamp)},n);if(s[o])s[o]();else if([Is.recallMsg,Is.ppMsgS,Is.pgMsgS,Is.ppMsgP,Is.pgMsgP,Is.chatMsg,Is.pcMsgP,Is.prMsgS,Is.pbMsgP].includes(o)){var a=this._connMgr.codec.decodeByPBName(e.pbData,Br,{currentUserId:this.currentUserId,signal:e});((a=this._handleMsgProperties(a)).conversationType!==w.CHATROOM||this._chrmsQueue[a.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||a.sentTime):(t&&(a.sentTime=t.timestamp,a.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(r.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:a.messageUId,messgeId:a.messageId,sentTime:a.sentTime})),a.messageType!==k.EXPANSION_NOTIFY?((a.messageType===k.SYNC_READ_STATUS||a.messageType===k.READ_RECEIPT&&a.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(a.conversationType,a.targetId,a.channelId,a.sentTime),a.messageType===k.READ_RECEIPT_REQUEST&&this._processRRReqMsg(a),a.messageType===k.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(a),this._conversationManager.setConversationCacheByMessage(a,!0),this._batchMessage([a])):this._receiveMessageExpansion(a)))}},i.prototype._batchMessage=function(e){for(var t=this,n=[],r=[],i=[],o=e.length-1;o>=0;o-=1){var s=e[o];s.messageType===k.LOG_COMMAND&&s.senderUserId===De?r.unshift(s):s.messageType===k.CLOUD_CONTROL&&s.senderUserId===De?i.push(s):n.unshift(s)}this._watcher.batchMessage(n),r.forEach((function(e){var n=e.content,r=n.startTime,i=n.endTime,o=n.platform,s=n.logId,a=n.uri;t.reporter.report(parseInt(r,10),parseInt(i,10),o,a,s,e.messageUId)})),i.length>0&&this._ccMsgHandler(i)},i.prototype._ccMsgHandler=function(e){var t;return ue(this,void 0,void 0,(function(){var n,r,i;return ce(this,(function(o){switch(o.label){case 0:return e.shift()?(n=this._connMgr.getToken(),[4,null===(t=this.cloudController)||void 0===t?void 0:t.request(this.cloudControllerUri,mn.other,n)]):[3,2];case 1:r=o.sent()||0,(i=e.filter((function(e){return e.sentTime>r}))).length>0&&this._ccMsgHandler(i),o.label=2;case 2:return[2]}}))}))},i.prototype._pubCallInfo=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,ro),n=t.key,r=t.dataContent,i=t.maxTime;this._latestPullKVMsgTimestamp=i,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:r}]}))},i.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,kr),n=t.type,i=t.chrmId,o=t.time;if(this.logger.info(r.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(o)),2===n){var s=this._chrmsQueue[i];if(!s)return;s.queue.push(o),this._pullChrmMsg(i)}else this._pullQueue.push(o),this._syncMsg()},i.prototype._receivesyncReadStatus=function(e){var t=this._connMgr.codec.decodeByPBName(e.pbData,li),n=t.conversationType,r=t.targetId,i=t.channelId,o=t.timestamp,s=t.sentTime;this._conversationManager.clearUnreadCount(n,r,i,s),this._watcher.syncReadStatus({conversationType:n,targetId:r,channelId:i,timestamp:o})},i.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()},i.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},i.prototype._syncCallPullKVMsg=function(){return ue(this,void 0,void 0,(function(){var e,t,n,r,i;return ce(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new Za(Is.pullKvMsg,e,this.currentUserId),[4,this._connMgr.send(t,oo)]):[2];case 1:return n=o.sent(),r=n.code,i=n.data,r===P.SUCCESS&&i?(this._latestPullKVMsgTimestamp=i.maxTime,this._watcher.callInfo(JSON.stringify({list:i.info})),[2]):[2]}}))}))},Object.defineProperty(i.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===X.CONNECTED},enumerable:!1,configurable:!0}),i.prototype._filterMessage=function(e){var t=e.messageType;return t===k.DELIVERED||t===k.DELIVERED_MSG||t===k.SYNC_READ_STATUS&&!this._processSRSMsg(e)},i.prototype._messageProcessor=function(e){var t=this,n=0,r=[],i=[],o=[],s=[],a=[];return e.forEach((function(e){var u=e.conversationType,c=e.targetId,l=e.channelId,d=e.messageDirection,h=e.messageUId,p=e.messageType,_=e.sentTime,f=e.senderUserId,g=e.content;if(r.push(h),d===te.SEND){n=Math.max(_,n);var E=t._sendMessageStore.getSendMessageMap(),I=p===k.RECALL?"Cmd:".concat(g.messageUId):h;if(E[I])return void t._sendMessageStore.removeByUID(I)}if(!t._filterMessage(e))if(p!==k.EXPANSION_NOTIFY)if(_>=t._connMgr.getConnectedTime()&&t._writeMessagesLog(u,h)&&a.push(h),p===k.READ_RECEIPT&&f===t.currentUserId&&t._conversationManager.clearUnreadCount(u,c,l,_),p!==k.READ_STATE){p===k.READ_RECEIPT_REQUEST&&t._processRRReqMsg(e),p===k.READ_RECEIPT_RESPONSE&&t._processRRRspMsg(e);var v=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(v,!0),i.push(v)}else s.push(e);else o.push(e)})),{newOutboxTime:n,messageUIds:r,messages:i,messageExpansionList:o,RSMsgList:s,msgUIds2Statistic:a}},i.prototype._processSRSMsg=function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=e.content,o=e.senderUserId,s=e.sentTime;if(o!==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:i.lastMessageSendTime}),!1)},i.prototype._processRSMsg=function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=e.content,o={conversationType:t,targetId:n,channelId:r};this._watcher.messageReadReceipt(t===w.PRIVATE?{privateReadReceipt:se(se({},o),{endMsgTime:i.endMsgTime})}:{groupReadReceipt:se(se({},o),{totalCount:i.tmn,readedCount:i.rrn,messageUId:i.msgId})})},i.prototype._processRRReqMsg=function(e){var t,n=e.conversationType,r=e.channelId,i=e.targetId,o=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:i},o.messageUId,a,s,u)},i.prototype._processRRRspMsg=function(e){var t,n,r,i=this,o=e.conversationType,s=e.channelId,a=e.targetId,u=e.content,c=e.senderUserId,l=u.receiptMessageDic,d=void 0===l?{}:l;if(c===this.currentUserId)for(var h in d){var p=d[h];try{for(var _=(t=void 0,le(p)),f=_.next();!f.done;f=_.next()){var g=f.value;null===(r=this._readReceiptManager)||void 0===r||r.remove({conversationType:o,channelId:s,targetId:a},g)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=_.return)&&n.call(_)}finally{if(t)throw t.error}}}else(d[this.currentUserId]||[]).forEach((function(e){var t;null===(t=i._readReceiptManager)||void 0===t||t.addReadedUser({conversationType:o,channelId:s,targetId:a},e,c)}))},i.prototype._syncMsg=function(){return ue(this,void 0,void 0,(function(){var e,t,n,i,o,s,a,u,c,l,d,h,p,_,f,g,E,I,v,T,R,m,y,S=this;return ce(this,(function(C){switch(C.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),i=cs.encode(Fr,{ispolling:!1,isPullSend:!0,sendBoxSyncTime:e,syncTime:t,broadcastSyncTime:n,compressioEnabled:Uu.enable()}),o=new Za(Is.pullMsg,i,this.currentUserId),s=this.logger.createTraceId(),this.logger.info(r.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),s),[4,this._connMgr.send(o,Hr,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId,customMessageTypes:this._customMessageType})]):(this._pullingMsg=!1,[2]);case 1:if(a=C.sent(),u=a.code,c=a.data,this._latestSyncTimestamp=Date.now(),this._pullingMsg=!1,u!==P.SUCCESS||!c||mt(c.finished)||mt(c.list)||mt(c.syncTime))return this.logger.warn(r.L_PULL_MSG_R,JSON.stringify({code:u,timestamp:this._latestSyncTimestamp}),s),[2];l=c.list,d=c.finished,h=c.syncTime,p=c.broadcastSyncTime,_=void 0===p?1:p,this.logger.info(r.L_PULL_MSG_R,JSON.stringify({syncTime:h,finished:d,messages:l.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),s);try{if(f=this._messageProcessor(l),g=f.newOutboxTime,E=f.messageUIds,I=f.messages,v=f.messageExpansionList,T=f.RSMsgList,(R=f.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:R.join(",")})),this._batchMessage(I),v.forEach((function(e){S._receiveMessageExpansion(e)})),T.forEach((function(e){S._processRSMsg(e)})),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(g,this.currentUserId),this._letterbox.setBroadcastSyncTime(_,this.currentUserId),this._sendMessageStore.removeByTimestamp(g),m=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(y=this._pullQueue).push.apply(y,he([],de(m),!1)),d&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(r.L_PULL_MSG_R,JSON.stringify({code:u,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!d,tmpPullQueue:m}),s),!d)return this._syncMsg(),[2];this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg())}catch(e){this.logger.error(r.L_PULL_MSG_E,null==e?void 0:e.stack,s)}return[2]}}))}))},i.prototype._receiveMsg=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.pbData,qr,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()}),n=(t=this._handleMsgProperties(t)).conversationType,i=t.messageType,o=t.senderUserId,s=t.messageUId,a=t.sentTime,u=t.isStatusMessage;if(this.logger.info(r.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),this._writeMessagesLog(n,s)&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:s})),n!==w.RTC_ROOM&&i!==k.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}o===this.currentUserId&&this._sendMessageStore.setMessage(s,a),u||o===this.currentUserId||this._letterbox.setInboxTime(a,this.currentUserId),this._handleNotNotifyMsg(t)||(i===k.READ_RECEIPT_REQUEST&&this._processRRReqMsg(t),i===k.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(t),this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t]))}},i.prototype._handleNotNotifyMsg=function(e){var t=e.messageType,n=e.senderUserId;return t===k.DELIVERED||(t===k.DELIVERED_MSG||(t===k.EXPANSION_NOTIFY?(this._receiveMessageExpansion(e),!0):t===k.SYNC_READ_STATUS&&n!==this.currentUserId||t===k.READ_STATE&&(this._processRSMsg(e),!0)))},i.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,r=e.messageType,i=e.isStatusMessage,o=e.isCounted,s=void 0!==o&&o,a=e.isPersited,u=void 0!==a&&a,c=r in Le,l=r in this._customMessageType;if(n=c?se(se({},Le[r]),{isStatusMessage:Op.includes(r)}):l?this._customMessageType[r]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(e,n),t&&!mt(i)&&(e.isStatusMessage=i),!t){var d=e.content.user;if(d){var h=d.portrait,p=d.portraitUri,_=h||p;_&&(d.portrait=d.portraitUri=_)}}return e},i.prototype._fixDownstreamData=function(e,t,n){return e&&2===t.list.length&&(t.hasMore=!0,0===n?t.list.shift():t.list.pop()),t},i.prototype.getHistoryMessage=function(e,t,n,i,o,s,a,u){var c;return void 0===s&&(s=""),ue(this,void 0,void 0,(function(){var a,l,d,h,p,_,f,g,E,I,v,T=this;return ce(this,(function(R){switch(R.label){case 0:return l=(a=this).currentUserId,d=a._connMgr,h=mp[e]||Is.qryPMsg,p=1===i&&0===n,d?(_=d.codec.encodeGetHistoryMsg(t,{timestamp:n,count:p?2:i,order:o,channelId:s}),this.logger.info(r.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:s,timestamp:n,count:i,order:o}),u),[4,d.send(new Za(h,_,l),ai,{currentUserId:l,connectedTime:d.getConnectedTime(),conversation:{targetId:t},afterDecode:function(n){var r,i=null===(r=T._readReceiptManager)||void 0===r?void 0:r.getReadReceiptInfo({conversationType:e,channelId:s,targetId:t},n.messageUId);if(i){var o=i.users;n.readReceiptInfo={isReceiptRequestMessage:!0,readerList:o}}return n}})]):[3,2];case 1:return f=R.sent(),g=f.code,E=f.data,g===P.SUCCESS&&E?(I=this._fixDownstreamData(p,E,o),v=[],null===(c=I.list)||void 0===c||c.forEach((function(e){e&&v.push(e.messageUId)})),this.logger.info(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:g,messageUIds:v.join(",")}),u),[2,{code:g,data:{list:I.list,hasMore:I.hasMore}}]):(this.logger.warn(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:g,messageUIds:""}),u),[2,{code:g}]);case 2:return[2,{code:P.RC_NET_CHANNEL_INVALID}]}}))}))},i.prototype.getMessages=function(e,t,n,r,i,o,s){return this.getHistoryMessage(e,t,n,r,i,o,s)},i.prototype.reportSDKInfo=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,o=this.logger.createTraceId(),s=JSON.stringify(e),this.logger.debug(r.L_VER_REPORT_T,s,o),a=i.codec.encodeReportSDKInfo(s),u=new Za(Is[Is.reportsdk],a,n),[4,i.send(u)]):[2];case 1:return(c=l.sent().code)!==P.SUCCESS&&this.logger.warn(r.L_VER_REPORT_R,c,o),[2]}}))}))},i.prototype.deleteRemoteMessage=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeDeleteMessages(e,t,n,r),u=Is.delMsg,e===w.ULTRA_GROUP&&(u=Is.delUgMsg),c=new Za(u,a,o),[4,s.send(c)]):[2,P.RC_NET_UNAVAILABLE];case 1:return l=d.sent(),[2,l.code]}}))}))},i.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeClearMessages(t,n,r,e),u=yp[e],c=new Za(u,a,o),[4,s.send(c)]):[2,P.RC_NET_UNAVAILABLE];case 1:return l=d.sent(),[2,l.code]}}))}))},i.prototype.batchClearRemoteHistoryMessages=function(e,t){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,i=r.codec.encodeBatchClearRemoteMessages(e),o=new Za(Is.cleanMsgBatch,i,n),[4,r.send(o)]):[2,P.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},i.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),ue(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,h=this;return ce(this,(function(p){switch(p.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,t=t||w.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),u=new Za(Is.qryRelationR,a,o),[4,s.send(u,$r,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=h._conversationManager.get(t,n,r);Object.assign(e,i);var o=h._conversationManager.getDraft(t,n,r);return e.draft=o,e}})]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return c=p.sent(),l=c.code,d=c.data,l!==P.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==d?void 0:d.list}]}}))}))},i.prototype.removeConversation=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o;return ce(this,(function(s){switch(s.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new Za(Is.delRelation,i,t),[4,r.send(o)]):[2,P.RC_NET_UNAVAILABLE];case 1:return[2,s.sent().code]}}))}))},i.prototype.batchRemoveConversation=function(e){return ue(this,void 0,void 0,(function(){var t,n,r;return ce(this,(function(i){switch(i.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeBatchDeleteConversation(e),r=new Za(Is.delRelationBatch,n,this.getCurrentUserId()),[4,t.send(r)]):[2,P.RC_NET_UNAVAILABLE];case 1:return[2,i.sent().code]}}))}))},i.prototype.getConversation=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return e!==w.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:P.CONVER_GET_ERROR}];case 1:return(i=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:P.CONVER_GET_ERROR}];case 2:if(o=l.sent(),s=o.code,a=o.data,s!==P.SUCCESS)return[2,{code:P.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:i.unreadMessageCount||0,latestMessage:c,notificationStatus:i.notificationStatus||oe.CLOSE,notificationLevel:i.notificationLevel||ie.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0,draft:u},l.label=3;case 3:return[2,{code:P.SUCCESS,data:r}]}}))}))},i.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:P.SUCCESS,data:r})},i.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var r=0;if(e.includes(w.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:P.METHOD_NOT_AVAILABLE});for(var i in this._ultraGroupMap){var o=this._ultraGroupMap[i];(0===t.length||t.includes(o.notificationLevel))&&(r+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return r+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:P.SUCCESS,data:r})},i.prototype.getConversationUnreadCount=function(e,t,n){var r,i;return e===w.ULTRA_GROUP?(i=(null===(r=this._ultraGroupMap["".concat(n,"_").concat(t)])||void 0===r?void 0:r.unreadMessageCount)||0,i=this._getUnreadCount(i)):i=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:P.SUCCESS,data:i})},i.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,this.getServerTime(),!1),Promise.resolve(P.SUCCESS)},i.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(P.SUCCESS)},i.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},i.prototype.getFirstUnreadMessageInfo=function(e,t,n){var r=this._conversationManager.get(e,t,n),i=r.firstUnreadMessageUid,o=r.firstUnreadTime;return Promise.resolve({code:P.SUCCESS,data:o&&i?{messageUId:i,sentTime:o}:null})},i.prototype.saveConversationMessageDraft=function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(P.SUCCESS)},i.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:P.SUCCESS,data:r})},i.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(P.SUCCESS)},i.prototype.pullConversationStatus=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o,s,a=this;return ce(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=(t=this)._connMgr,i=t.currentUserId,o=cs.encode(Ai,{time:e}),[4,n.query(Is.pullSeAtts,i,o,Ni)]):[2,ut(P.RC_NET_UNAVAILABLE)];case 1:return s=u.sent(),this.logger.info(r.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:i,resp:s})),[2,s.trans((function(e){var t=e.state;e.version;var n=[];return t.forEach((function(e){var t=e.stateItem,r=e.channelId,i=e.type,o=e.busChannel,s=e.time,u={conversationType:i,targetId:r,channelId:o,updatedTime:s};null==t||t.forEach((function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Gr.IsSilent:u.notificationLevel=Number(n)||ie.NOT_SET,u.notificationStatus=u.notificationLevel?oe.OPEN:oe.CLOSE;break;case Gr.IsTop:u.isTop="1"===n;break;case Gr.Tags:u.tags=r}u.updatedTime=s})),s&&a._conversationManager.setConversationUpdatedTime(s),i===w.ULTRA_GROUP?a._setUltraConversationStatus(u):n.push(u)})),n}))]}}))}))},i.prototype._setUltraConversationStatus=function(e){var t=e.targetId,n=e.notificationLevel,r=e.channelId,i=e.isTop,o=e.conversationType;if(""!==t||void 0===n){var s=this._ultraGroupMap["".concat(r,"_").concat(t)];return s&&void 0!==n&&(s.notificationLevel=n,s.notificationStatus=Ae(n),this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==i&&(s.isTop=i),s}this._ultraGroupManager.addUltraGroupStatus({conversationType:o,targetId:"",channelId:"",notificationLevel:n,notificationStatus:Ae(n)})},i.prototype.batchSetConversationStatus=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i=this;return ce(this,(function(o){switch(o.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,[4,this._conversationManager.pushTask((function(t){return ue(i,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,h=this;return ce(this,(function(p){switch(p.label){case 0:return i=r.codec.encodeSetConversationStatus(e,t),o=new Za(Is.setSeAtt,i,n),[4,r.send(o,wi)];case 1:return s=p.sent(),a=s.code,u=s.data,a!==P.SUCCESS?[2,{code:a}]:(c=u,this._conversationManager.setConversationUpdatedTime(c.version),l=[],e.forEach((function(e){if(e.conversationType!==w.ULTRA_GROUP)h._conversationManager.addStatus(se(se({},e),{updatedTime:c.version}),!0);else{var t=h._setUltraConversationStatus(e);t&&l.push(t)}})),l.length>0&&(d=Bt(l),d=Cp(d),this._watcher.conversation(d)),[2,{code:a}])}}))}))}))]):[2,P.RC_NET_UNAVAILABLE];case 1:return[2,o.sent().code]}}))}))},i.prototype.setConversationToTop=function(e,t,n,r,i){return ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,isTop:n,channelId:r}])]}))}))},i.prototype.batchSetConversationToTop=function(e,t,n){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return se(se({},e),{isTop:t})})))]}))}))},i.prototype.setConversationNotificationLevel=function(e,t,n,r){return void 0===r&&(r=""),ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,notificationLevel:n,channelId:r}])]}))}))},i.prototype.batchSetConversationNotificationLevel=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return se(se({},e),{notificationLevel:t})})))]}))}))},i.prototype._joinChrm=function(e,t,n,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c,l,d,h,p,_,f,g,E,I,v,T,R;return ce(this,(function(m){switch(m.label){case 0:return this._isConnected?(s=this._connMgr,a=cs.encode(jr,{nothing:1,extra:i}),u=n?Is.joinChrmR:Is.joinChrm,c=new Za(u,a,e),this.logger.info(r.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:Is[u]}),o),[4,s.send(c,Jr)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return l=m.sent(),d=l.code,h=l.data,p=d===P.SUCCESS?"info":"warn",this.logger[p](r.L_JOIN_CHATROOM_R,JSON.stringify({code:d,timestamp:(new Date).getTime()}),o),d===P.SUCCESS?(f=(_=h).joinTime,g=_.createTime,E=_.memberCount,I=_.isAllChatroomBanned,v=_.isCurrentUserBanned,T=_.isCurrentChatroomBanned,R=_.isCurrentChatroomInWhitelist,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,f),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t,i),this._startSyncIntervalForChrmPull(),[2,{code:d,data:{joinTime:f,createTime:g,memberCount:E,isAllChatroomBanned:I,isCurrentUserBanned:v,isCurrentChatroomBanned:T,isCurrentChatroomInWhitelist:R}}]):[2,{code:d}]}}))}))},i.prototype._rejoinChrm=function(){return ue(this,void 0,void 0,(function(){var e,t,n,i,o,s,a,u,c,l,d,h,p,_;return ce(this,(function(f){switch(f.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,f.label=1;case 1:return i<t.length?(o=t[i],s=e[o],a=s.count,u=void 0===a?10:a,c=s.extra,this.logger.info(r.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:o,count:u,extra:c})),l=this.logger.createTraceId(),[4,this._joinChrm(o,u,!0,c,l)]):[3,4];case 2:if(d=f.sent(),h=d.code,p=d.data,_=h===P.SUCCESS?"info":"warn",this.logger[_](r.L_REJOIN_CHATROOM_R,JSON.stringify({code:h,timestamp:(new Date).getTime()}),l),h===P.SUCCESS)return this._watcher.chatroom({rejoinedRoom:se({chatroomId:o,count:u},p)}),[2];h===P.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(o),delete this._chrmsQueue[o]),this._watcher.chatroom({rejoinedRoom:{chatroomId:o,errorCode:h}}),f.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},i.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),ue(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,d,h,p,_,f,g,E,I,v=this;return ce(this,(function(T){switch(T.label){case 0:return this._isConnected?(i=this._chrmsQueue[e],o=i.pulling,s=i.timestamp,o?[2]:(i.pulling=!0,a=n?0:s,u=cs.encode(zr,{count:t,syncTime:a,compressioEnabled:Uu.enable()}),this.logger.info(r.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,syncTime:a})),c=new Za(Is[Is.chrmPull],u,e),[4,this._connMgr.send(c,Hr,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return l=T.sent(),d=l.code,h=l.data,i.pulling=!1,d===P.SUCCESS&&h?(p=h.list,_=h.syncTime,f=h.finished,i.timestamp=n?Math.max(_,n):_,i.queue=i.queue.filter((function(e){return e>_})),g=[],E=[],I=[],p.forEach((function(e){e.sentTime<s||(e.sentTime>=v._connMgr.getConnectedTime()&&v._writeMessagesLog(w.CHATROOM,e.messageUId)&&E.push(e.messageUId),g.push(e.messageUId),I.push(e))})),this._batchMessage(I),this.logger.info(r.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:d,timestamp:s,messageUIds:g.join(",")})),E.length>0&&this.logger.record(re.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:E.join(",")})),f?(i.queue.length>0&&(i.queue.length=0,this._pullChrmMsg(e)),[2]):(this._pullChrmMsg(e),[2])):(this.logger.warn(r.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:d,timestamp:s,messageUIds:""})),[2])}}))}))},i.prototype.joinChatroom=function(e,t,n,r){return ue(this,void 0,void 0,(function(){return ce(this,(function(i){switch(i.label){case 0:return[4,this._joinChrm(e,t,!1,n,r)];case 1:return[2,i.sent().code]}}))}))},i.prototype.joinExistChatroom=function(e,t,n,r){return ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,this._joinChrm(e,t,!0,n,r)]}))}))},i.prototype.quitChatroom=function(e){return ue(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=cs.encode(jr,{nothing:1}),[4,t.query(Is.exitChrm,e,n)]):[2,P.RC_NET_UNAVAILABLE];case 1:return[2,r.sent().code]}}))}))},i.prototype.getChatroomInfo=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a,u;return ce(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeGetChatRoomInfo(t,n),o=new Za(Is[Is.queryChrmI],i,e),[4,r.send(o,oi)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==P.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},i.prototype.getChatroomHistoryMessages=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new Za(Is.qryCHMsg,o,e),[4,i.send(s,ai,{conversation:{targetId:e}})]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==P.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},i.prototype._modifyChatroomKV=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=r.codec.encodeModifyChatRoomKV(e,t,i),a=t.type===N.UPDATE?Is.setKV:Is.delKV,u=new Za(a,s,e),[4,r.send(u,Jr)]):[2,P.RC_NET_UNAVAILABLE];case 1:return c=d.sent(),(l=c.code)===P.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},i),[2,l]):[2,l]}}))}))},i.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},i.prototype._modifyChatroomKVS=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,d,h,p,_=this;return ce(this,(function(f){switch(f.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,t.entries.forEach((function(t){var n=_._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?_.getServerTime():n})),o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===N.UPDATE?Is.setKVS:Is.delKVS,a=new Za(s,o,e),[4,r.send(a,Ri)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return u=f.sent(),c=u.code,-1!==[P.SUCCESS,P.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(d=[],delete(h=se({},t)).entries,t.entries.forEach((function(e){d.push(se(se({},e),h))})),c===P.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(p=u.data,l=p.errorKeys,d=this._chatroomKVStoreNotAllSuccess(d,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:d,syncTime:(new Date).getTime()},i)),[2,{code:c,data:l}]}}))}))},i.prototype.setChatroomEntry=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return t.type=N.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},i.prototype.setChatroomEntries=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return t.type=N.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},i.prototype.forceSetChatroomEntry=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return t.type=N.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},i.prototype.removeChatroomEntry=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return t.type=N.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},i.prototype.removeChatroomEntries=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return t.type=N.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},i.prototype.forceRemoveChatroomEntry=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){return t.type=N.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},i.prototype.getChatroomEntry=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return ce(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:P.SUCCESS,data:n}]:this._isConnected?(r=this._connMgr,i=r.codec.encodePullChatRoomKV(0),o=new Za(Is[Is.pullKV],i,e),[4,r.send(o,Ti)]):[2,{code:P.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:P.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:P.CHATROOM_KEY_NOT_EXIST}]}}))}))},i.prototype.getAllChatroomEntry=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:P.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},r=n.codec.encodePullChatRoomKV(0),i=new Za(Is[Is.pullKV],r,e),[4,n.send(i,Ti)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return o=a.sent(),(s=o.data)&&s.kvEntries&&s.kvEntries.length&&s.kvEntries.forEach((function(e){e.key&&(t[e.key]=e.value||"")})),[2,{code:P.SUCCESS,data:t}]}}))}))},i.prototype.pullChatroomEntry=function(e,t){return ue(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,d,h,p,_=this;return ce(this,(function(f){switch(f.label){case 0:return this._isConnected?(i=(n=this)._connMgr,o=n.currentUserId,this._chrmsQueue[e]?(s=i.codec.encodePullChatRoomKV(t),a=new Za(Is[Is.pullKV],s,e),this.logger.info(r.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,i.send(a,Ti)]):[2,{code:P.RC_CHATROOM_NOT_EXIST}]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return u=f.sent(),c=u.code,l=u.data,this._chrmsQueue[e]?(d=c===P.SUCCESS?"info":"warn",this.logger[d](r.L_PULL_CHATROOM_KV_R,JSON.stringify({code:c,timestamp:t})),c===P.SUCCESS&&l?(h=l.kvEntries,p=[],h.length>0&&(h.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp,s=t.userId;_._chrmEntryHandler.getValue(e,n)===r&&s===_.getCurrentUserId()||p.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,l,o),p.length>0&&this._watcher.chatroom({updatedEntries:p})),[2,{code:c,data:l}]):[2,{code:c}]):[2,{code:P.RC_CHATROOM_NOT_EXIST}]}}))}))},i.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)},i.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},i.prototype.removeChatroomFromCatch=function(e){var t;null===(t=this._joinedChrmManager)||void 0===t||t.remove(e)},i.prototype._writeMessagesLog=function(e,t){var n,r=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!r)return!1;var i=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),o=0;switch(e){case w.PRIVATE:o=r.private;break;case w.GROUP:o=r.group;break;case w.CHATROOM:o=r.chatroom;break;case w.ULTRA_GROUP:o=r.ultraGroup}return!!o&&i%(1/o)==0},i.prototype.sendMessage=function(e,t,n,i,o){var s;return ue(this,void 0,void 0,(function(){var a,u,c,l,d,h,p,_,f,g,E,I;return ce(this,(function(v){switch(v.label){case 0:return n=this._handleInnerMsgOptions(e,t,n),n=this._handleMsgProperties(n,!0),a=!1,[w.PRIVATE,w.GROUP].includes(e)&&(n.isStatusMessage||(null===(s=this._customMessageType[n.messageType])||void 0===s?void 0:s.isStatusMessage))&&(a=!0),u=a?function(e){var t;return(t={},t[w.PRIVATE]=Is.ppMsgS,t[w.GROUP]=Is.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[w.PRIVATE]=Is.ppMsgP,t[w.GROUP]=Is.pgMsgP,t[w.CHATROOM]=Is.chatMsg,t[w.CUSTOMER_SERVICE]=Is.pcMsgP,t[w.RTC_ROOM]=Is.prMsgS,t[w.SYSTEM]=Is.pbMsgP,t)[e]}(e)||Is.ppMsgP,a&&(n.isPersited=!1,n.isCounted=!1),c=n.messageId?n.messageId:an(),n.messageId=c,l=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(d=new Xa(Is[u],l,e===w.SYSTEM?this.currentUserId:t)).setHeaderQos(ys.AT_LEAST_ONCE),a?(this._connMgr.sendOnly(d),[2,{code:P.SUCCESS,data:Sp(e,t,se({},n),"",0,this.currentUserId,c)}]):(h=this._connMgr.getCrtServerTime(),p=Sp(e,t,se(se({},n),{isStatusMessage:a}),"",h,this.currentUserId,c),null==i||i(c),this.logger.info(r.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),o),_=Date.now(),[4,this._connMgr.send(d)]);case 1:return f=v.sent(),g=f.code,E=f.data,g!==P.SUCCESS?(this.logger.warn(r.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:p.messageUId,messageId:p.messageId}),o),this._writeMessagesLog(e)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({channel:e,start_ts:_,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:g})),p.sentStatus=K.FAILED,[2,{code:g,data:p}]):(this.logger.info(r.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:null==E?void 0:E.messageUId,messageId:null==E?void 0:E.messageId}),o),I=E,this._sendMessageSuccessHandle(p,I),this._writeMessagesLog(e,I.messageUId)&&this.logger.record(re.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})),[2,{code:P.SUCCESS,data:p}])}}))}))},i.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 i=e.messageType,o=e.conversationType,s=e.targetId,a=e.channelId,u=e.sentTime,c=e.content,l=e.messageDirection;if(i===k.READ_RECEIPT_REQUEST){var d=c.messageUId;null===(n=this._readReceiptManager)||void 0===n||n.insert({conversationType:o,targetId:s,channelId:a},d,l,u)}if(i===k.READ_RECEIPT_RESPONSE){var h=c.receiptMessageDic;if(!h)return;for(var p in h)h[p].forEach((function(e){var t;null===(t=r._readReceiptManager)||void 0===t||t.remove({conversationType:o,targetId:s,channelId:a},e)}))}},i.prototype.recallMsg=function(e,t){var n;return ue(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,d,h,p,_,f,g,E,I,v,T;return ce(this,(function(R){switch(R.label){case 0:return r=e.targetId,i=e.conversationType,o=e.channelId||"",s=t.user,a=t.extra,u=t.isDelete,c=t.directionalUserIdList,l=t.disableUpdateLastMessage,d=t.messageUId,h=t.sentTime,p={conversationType:i,targetId:r,messageUId:d,sentTime:h,channelId:o,isDelete:u||!1,isAdmin:t.isAdmin},s&&(p.user=s),a&&(p.extra=a),_={content:p,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:o,disableUpdateLastMessage:l},[w.GROUP,w.ULTRA_GROUP].includes(i)&&c&&(_.directionalUserIdList=c),f=this._connMgr.codec.encodeUpMsg({conversationType:i,targetId:r},_),(g=new Xa(Is.recallMsg,f,this.currentUserId)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(g)];case 1:return(E=R.sent()).isOk?(I=E.data,i!==w.ULTRA_GROUP&&(v="Cmd:".concat(d),I.messageUId=v),T=Sp(i,r,se(se({},_),{isPersited:!0}),I.messageUId,I.timestamp,this.currentUserId),i===w.ULTRA_GROUP?(this._ultraMsgMap[I.messageUId]=I.timestamp,this._updateUltraGroupWhenRecallMsg(r,o,d)):(this._sendMessageStore.setMessage(I.messageUId,I.timestamp),this._conversationManager.setConversationCacheByMessage(T,!0)),[2,at(T)]):[2,E.wipe()]}}))}))},i.prototype.sendReadReceiptMessage=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i;return ce(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeReadReceipt(t,n),i=new Za(Is[Is.rrMsg],r,e),[2,this._connMgr.send(i)]):[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.getMessageReader=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i;return ce(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeMessageReader(t,n),i=new Za(Is[Is.rrList],r,e),[2,this._connMgr.send(i,ki)]):[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.sendReadReceiptMessageV4=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i;return ce(this,(function(o){return r=this._connMgr.codec.encodeReadReceiptMsg(e,t,n),i=new Xa(Is[Is.sendMsgRead],r,e.targetId),[2,this._connMgr.send(i)]}))}))},i.prototype.getMessageReadReceiptV4=function(e,t){return ue(this,void 0,void 0,(function(){var n,r;return ce(this,(function(i){return n=this._connMgr.codec.encodeReceiptQryReq(e,t),r=new Za(Is[Is.qryMsgRead],n,e.targetId),[2,this._connMgr.send(r,uo)]}))}))},i.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeReceiptCntQryReq(e,t),r=new Za(Is[Is.qryMsgReadCntBatch],n,e.targetId),[4,this._connMgr.send(r,lo)];case 1:return i=u.sent(),o=i.code,s=i.data,a=(s||{result:[]}).result,o===P.SUCCESS&&a?[2,{code:o,data:a.map((function(t){return se({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)}))}]:[2,{code:o}]}}))}))},i.prototype.updateConversationReadTime=function(e,t){return ue(this,void 0,void 0,(function(){var n,r;return ce(this,(function(i){return n=this._connMgr.codec.encodeSessionMsgReadInput(e,t),r=new Xa(Is[Is.updRTime],n,this.currentUserId),[2,this._connMgr.send(r)]}))}))},i.prototype.pullUserSettings=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this.getNaviInfoFromCache(),n=cs.encode(Si,{version:e,ipType:t.ipType||0}),r=new Za(Is.pullUS,n,this.currentUserId),[4,this._connMgr.send(r,Ci)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),o=i.code,s=i.data,o===P.SUCCESS&&this._naviChangeHandler(s),[2,{code:o,data:s}]}}))}))},i.prototype._naviChangeHandler=function(e){var t;if(e){var n=e.settings,i=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(i){var o=this._connMgr.getToken();this.navi.updateVoipCallInfo(o,i);var s=this.navi.getNaviInfoFromCache(o);this._watcher.onNaviDataChange(se({},s))}}else this.logger.warn(r.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},i.prototype.getFileToken=function(e,t,n,r,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return this._isConnected?(s=r&&"uploads"!==r?t||"":rn(e,t),a=this.getNaviInfoFromCache(),u=_n(a,this.logger),c="",u||(c=JSON.stringify({uploadDomain:u})),l=cs.encode(Yr,{type:e,key:s,httpMethod:n||"",queryString:r||"",url:i||"",ext:c,size:o?Math.ceil(o):0,ipType:a.ipType||0}),[4,this._connMgr.query(Is.qnTkn,this.currentUserId,l,Qr)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return[2,d.sent().trans((function(e){return se(se({},e),{fileName:s,downloadAuthInfo:e.downloadAuthInfo?JSON.parse(e.downloadAuthInfo):null})}))]}}))}))},i.prototype.getFileUrl=function(e,t,r,i){return ue(this,void 0,void 0,(function(){var o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=this.getNaviInfoFromCache(),a="",u="",t===n.QINIU?s=Is.qnUrl:t===n.AWS?s=Is.s3Url:t===n.STC?s=Is.stcUrl:t===n.MINIO?(s=Is.minioUrl,a=_n(o,this.logger),u=JSON.stringify({url:a})):s=Is.aliUrl,c=cs.encode(Kr,{type:e,key:r,fileName:i,ext:u,size:-1,ipType:o.ipType||0}),[4,this._connMgr.query(s,this.currentUserId,c,Wr)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return[2,l.sent().trans((function(e){return{downloadUrl:e.downloadUrl}}))]}}))}))},i.prototype.disconnect=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(n){switch(n.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect(e,t)];case 1:return n.sent(),this._resetMemoryState(),[2]}}))}))},i.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={}},i.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},i.prototype.registerMessageType=function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}},i.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},i.prototype.getCurrentUserId=function(){return this.currentUserId},i.prototype.createTag=function(e){return ue(this,void 0,void 0,(function(){var t=this;return ce(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return ue(t,void 0,void 0,(function(){var t,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),r=new Za(Is[Is.addSeTag],t,this.currentUserId),[4,this._connMgr.send(r,yi)];case 1:return i=u.sent(),o=i.code,s=i.data,o===P.SUCCESS&&s&&(a=s.version,this._userSettingManager.addTag([se(se({},e),{createdTime:a})],a)),[2,{code:o}]}}))}))}))]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.removeTag=function(e){return ue(this,void 0,void 0,(function(){var t=this;return ce(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return ue(t,void 0,void 0,(function(){var t,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeRemoveTag([e],n),r=new Za(Is[Is.delSeTag],t,this.currentUserId),[4,this._connMgr.send(r,yi)];case 1:return i=u.sent(),o=i.code,s=i.data,o===P.SUCCESS&&s&&(a=s.version,this._userSettingManager.deleteTag([e],a)),[2,{code:o}]}}))}))}))]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.updateTag=function(e){return ue(this,void 0,void 0,(function(){var t=this;return ce(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return ue(t,void 0,void 0,(function(){var t,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),r=new Za(Is[Is.addSeTag],t,this.currentUserId),[4,this._connMgr.send(r,yi)];case 1:return i=u.sent(),o=i.code,s=i.data,o===P.SUCCESS&&(a=s.version,this._userSettingManager.addTag([e],a)),[2,{code:o}]}}))}))}))]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.getTagList=function(){return ue(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:P.SUCCESS,data:e}]}))}))},i.prototype.addTagForConversations=function(e,t){return ue(this,void 0,void 0,(function(){var n=this;return ce(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return ue(n,void 0,void 0,(function(){var n,i,o,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),i=new Za(Is[Is.addTag],n,this.currentUserId),[4,this._connMgr.send(i,wi)]):[2,{code:P.TAG_NOT_EXIST}];case 1:return o=l.sent(),s=o.code,a=o.data,s===P.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:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.removeTagForConversations=function(e,t){return ue(this,void 0,void 0,(function(){var n=this;return ce(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return ue(n,void 0,void 0,(function(){var n,i,o,s,a,u=this;return ce(this,(function(c){switch(c.label){case 0:return n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,r),i=new Za(Is[Is.delTag],n,this.currentUserId),[4,this._connMgr.send(i,wi)];case 1:return o=c.sent(),s=o.code,a=o.data,s===P.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:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.removeTagsForConversation=function(e,t){return ue(this,void 0,void 0,(function(){var n=this;return ce(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return ue(n,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,d;return ce(this,(function(h){switch(h.label){case 0:return n=e.conversationType,i=e.targetId,o=e.channelId,s=t.map((function(e){return{tagId:e}})),a=this._connMgr.codec.encodeUpdateConversationTag(s,[e],r),u=new Za(Is[Is.delTag],a,this.currentUserId),[4,this._connMgr.send(u,wi)];case 1:return c=h.sent(),l=c.code,d=c.data,l===P.SUCCESS&&d&&(this._conversationManager.deleteTagStatus(n,i,t,o),this._conversationManager.setConversationUpdatedTime(d.version)),[2,{code:l}]}}))}))}))]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.getConversationListByTag=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,d;return ce(this,(function(h){switch(h.label){case 0:return this._isConnected?(i=(r=this).currentUserId,o=r._connMgr,s=o.codec.encodeOldConversationList({count:n,type:w.PRIVATE,startTime:t}),a=new Za(Is.qryRelationR,s,i),[4,o.send(a,$r,{currentUserId:i,connectedTime:o.getConnectedTime()})]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return u=h.sent(),c=u.code,l=u.data,c!==P.SUCCESS?[2,{code:c}]:(d=this._conversationHasTagFilter(e,null==l?void 0:l.list),[2,{code:c,data:d}])}}))}))},i.prototype._conversationHasTagFilter=function(e,t){var n=this,r=[],i=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,u=n._conversationManager.get(o,s,a),c=u.hasMentioned,l=u.mentionedInfo,d=u.lastUnreadTime,h=u.notificationStatus,p=u.isTop,_=u.tags,f=u.unreadMessageCount,g=_&&_[e];if(g){var E=se(se({},t),{hasMentioned:c,mentionedInfo:l,lastUnreadTime:d,notificationStatus:h,isTop:p,unreadMessageCount:f});g.isTop?r.push(se(se({},E),{isTopInTag:!0})):i.push(se(se({},E),{isTopInTag:!1}))}})),r.sort(o),i.sort(o),he(he([],de(r),!1),de(i),!1)},i.prototype.getUnreadCountByTag=function(e,t){return ue(this,void 0,void 0,(function(){var n;return ce(this,(function(r){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:P.SUCCESS,data:n}]):[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.setConversationStatusInTag=function(e,t,n){return ue(this,void 0,void 0,(function(){var r=this;return ce(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return ue(r,void 0,void 0,(function(){var r,o,s,a,u,c,l,d,h,p,_,f;return ce(this,(function(g){switch(g.label){case 0:return r=t.targetId,o=t.conversationType,s=t.channelId,a=n.isTop,u=[{tagId:e,isTop:a}],(c=this._conversationManager.get(o,r,s)).tags&&Object.hasOwnProperty.call(c.tags,e)?(l=this._connMgr.codec.encodeUpdateConversationTag(u,[t],i),d=new Za(Is[Is.addTag],l,this.currentUserId),[4,this._connMgr.send(d,wi)]):[2,{code:P.NO_TAG_IN_CONVER}];case 1:return h=g.sent(),p=h.code,_=h.data,p===P.SUCCESS&&_&&((f={})[e]={},a&&(f[e].isTop=!0),this._conversationManager.addTagStatus(o,r,f,s),this._conversationManager.setConversationUpdatedTime(_.version)),[2,{code:p}]}}))}))}))]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.getTagsForConversation=function(e){var t;return ue(this,void 0,void 0,(function(){var n,r,i,o;return ce(this,(function(s){if(!this._isConnected)return[2,{code:P.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(o in n.tags)i.push({tagId:o,tagName:null===(t=r[o])||void 0===t?void 0:t.tagName});return[2,{code:P.SUCCESS,data:i}]}))}))},i.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:P.SUCCESS,data:e})},i.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:P.SUCCESS,data:n})},i.prototype.getUnreadConversationList=function(e){return ue(this,void 0,void 0,(function(){var t;return ce(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:P.SUCCESS,data:t})]}))}))},i.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===w.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:P.SUCCESS,data:n})},i.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:P.SUCCESS,data:e})},i.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===w.ULTRA_GROUP)return Promise.resolve({code:P.METHOD_NOT_AVAILABLE});var r;if(!(r=e===w.ULTRA_GROUP?this._ultraGroupManager.get(w.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:P.SUCCESS,data:ie.NOT_SET});var i=r.notificationLevel;return mt(r.notificationLevel)&&!mt(r.notificationStatus)&&(i=oe.OPEN===r.notificationStatus?1:0),Promise.resolve({code:P.SUCCESS,data:i})},i.prototype.getConversationNotificationStatus=function(e,t,n){var r;return(r=e===w.ULTRA_GROUP?this._ultraGroupManager.get(w.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:P.SUCCESS,data:Ne(r.notificationLevel||ie.NOT_SET)}):Promise.resolve({code:P.SUCCESS,data:oe.CLOSE})},i.prototype.setConversationTypeNotificationLevel=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s=this;return ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(r=(n=this).currentUserId,i=n._connMgr,o=this._conversationManager.getConversationUpdatedTime(),[4,i.query(Is.setTypeUnpush,r,cs.encode(Di,{type:e,unpushLevel:t,version:o}),Vi)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return[2,a.sent().trans((function(n){var r,i=n.version;s._conversationManager.setConversationUpdatedTime(i),e===w.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:i,notificationLevel:t},!0)}))]}}))}))},i.prototype.getConversationTypeNotificationLevel=function(e){if(e===w.ULTRA_GROUP){var t=this._ultraGroupManager.get(e,"","");return Promise.resolve({code:P.SUCCESS,data:t.notificationLevel||0})}var n=this._conversationManager.get(e,"","");return Promise.resolve({code:P.SUCCESS,data:n.notificationLevel||0})},i.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this.getHistoryMessage(e,t,n,r,i,o)},i.prototype.getUltraGroupList=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o=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&&_t(n))}))).map((function(e){var t=e.unreadMessageCount,n=e.unreadMentionedCount,r=e.unreadMentionedMeCount;return t=o._getUnreadCount(t),n=o._getUnreadCount(n),r=o._getUnreadCount(r),se(se({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:r})})),r=Cp(r),i=Bt(r),[2,{code:P.SUCCESS,data:i}]):[2,{code:P.METHOD_NOT_AVAILABLE}]}))}))},i.prototype._getUnreadCount=function(e){return e>999?999:e},i.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:P.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===oe.OPEN||e.notificationLevel>0)&&t.push({conversationType:w.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:P.SUCCESS,data:t})},i.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:P.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:w.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:P.SUCCESS,data:t})},i.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:P.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:P.SUCCESS,data:n})},i.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var r in this._ultraGroupMap){var i=this._ultraGroupMap[r];i.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=i.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:P.SUCCESS,data:n})},i.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:P.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(r){var i=t._ultraGroupMap[r];e.includes(i.targetId)&&n.push({type:i.conversationType,targetId:i.targetId,channelId:i.channelId,unreadMessageCount:t._getUnreadCount(i.unreadMessageCount),mentionedCount:t._getUnreadCount(i.unreadMentionedCount),mentionedMeCount:t._getUnreadCount(i.unreadMentionedMeCount),notificationLevel:i.notificationLevel})})),Promise.resolve({code:P.SUCCESS,data:n})},i.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:P.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:P.SUCCESS,data:t})},i.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),ue(this,void 0,void 0,(function(){var n,r,i,o,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:w.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(i=new Xa(Is[Is.updUgRTime],r,this.currentUserId)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(i)]):[2,P.RC_NET_UNAVAILABLE]:[2,Promise.resolve(P.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===P.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,o]}}))}))},i.prototype._getUltraGroupList=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,d,h,p,_,f=this;return ce(this,(function(g){switch(g.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeUltraGroup(e,false),n=new Za(Is[Is.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,$r,{currentUserId:this.currentUserId,conversationType:w.ULTRA_GROUP})]):[2];case 1:return i=g.sent(),o=i.code,s=i.data,o===P.SUCCESS&&s?(u=s.list,c=s.isFinished,u.forEach((function(e){e.notificationStatus=oe.CLOSE,e.notificationLevel=ie.NOT_SET,e.isTop=!1,f._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,f._ultraGroupManager.addUltraGroupStatus(e)})),!1!==c?[3,2]:(l=u.length>0&&u[u.length-1].versionTime||0,this._getUltraGroupList(l),[3,4])):(this.logger.warn(r.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(o,", try again")),a=setTimeout((function(){f._getUltraGroupList(e),clearTimeout(a)}),3e3),[2]);case 2:return this.logger.info(r.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:d=g.sent(),h=d.code,p=d.data,h!==P.SUCCESS&&this.logger.warn(r.O,"pullConversationStatus fail code: ".concat(h,", data: ").concat(p)),_=Object.values(this._ultraGroupMap),_=Cp(_),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Bt(_)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),g.label=4;case 4:return[2]}}))}))},i.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()},i.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},i.prototype._notificationOnline=function(){return ue(this,void 0,void 0,(function(){var e,t,n,i=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===P.SUCCESS&&n?(this.logger.info(r.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(r.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},i.prototype._fetchUltraMsg=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Za(Is[Is.pullUgMsg],t,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(r.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),i),[4,this._connMgr.send(n,Hr,{currentUserId:this.currentUserId,conversation:{conversationType:w.ULTRA_GROUP}})];case 1:return o=d.sent(),s=o.code,a=o.data,s===P.SUCCESS&&a?(u=a.list,c=a.syncTime,l=u.map((function(e){return e.messageUId})).join(","),this.logger.info(r.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,messageUIds:l,timestamp:e,syncTime:c}),i)):this.logger.warn(r.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,timestamp:e}),i),[2,{code:s,data:a}]}}))}))},i.prototype._getUltraGroup=function(e,t,n){var r,i,o,s=e.targetId,a=e.messageType,u=e.channelId,c=e.isCounted,l=e.channelType,d=e.sentTime,h=e.senderUserId,p=e.content,_=e.isMentioned,f=this._ultraGroupMap["".concat(u,"_").concat(s)],g=f||{conversationType:w.ULTRA_GROUP,targetId:s,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:oe.CLOSE,notificationLevel:ie.NOT_SET,isTop:!1};return c&&h!==this.currentUserId&&a!==k.RECALL&&(g.unreadMessageCount+=1,g.unreadMentionedCount+=t,g.firstUnreadMessage||(g.firstUnreadMessage={sentTime:d}),_&&(null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.type)!==G.ALL&&(null===(o=null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(g.unreadMentionedMeCount+=1)),g.versionTime=n,g.latestMessage=e,g.channelType=l,f||(this._ultraGroupMap["".concat(u,"_").concat(s)]=g),g},i.prototype._syncUltraMsg=function(e){return ue(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,d=this;return ce(this,(function(h){switch(h.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=h.sent(),n=t.code,i=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===P.SUCCESS&&i?(o=i.list,s=i.syncTime,a=i.finished,u={},c=[],o.forEach((function(e){var t,n,r,i=e.targetId,o=e.content,a=e.messageUId,l=e.channelId,h=e.isMentioned;if(d._ultraMsgMap[a])delete d._ultraMsgMap[a];else{var p=0;h&&((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===G.ALL||(null===(r=null===(n=null==o?void 0:o.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(d.currentUserId)))&&(p=1);var _=d._getUltraGroup(e,p,s);u["".concat(l,"_").concat(i)]=_,d._ultraGroupManager.addUltraGroupStatus(_),c.push(e)}})),Object.keys(u).length>0&&(this.logger.debug(r.O,"notice ultragroups"),l=Object.values(u),l=Cp(l),this._watcher.conversation(Bt(l))),this.logger.debug(r.O,"notice ultragroup message"),this._batchMessage(c),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>s})),this._lastSyncUltraMsgTimeStamp=s,a?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(s)),[2]):(this._syncUltraMsg(s),[2])):[2]}}))}))},i.prototype.sendUltraMessage=function(e,t,n,i){return ue(this,void 0,void 0,(function(){var o,s,a,u,c,l,d,h,p,_,f,g;return ce(this,(function(E){switch(E.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(r.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),o=t.messageId?t.messageId:an(),t.messageId=o,s=this._connMgr.codec.encodeUpMsg({conversationType:w.ULTRA_GROUP,targetId:e},t),(a=new Xa(Is[Is.ugMsg],s,e)).setHeaderQos(ys.AT_LEAST_ONCE),u=this._connMgr.getCrtServerTime(),c=Sp(w.ULTRA_GROUP,e,se({},t),"",u,this.currentUserId,o),n&&n(o),this.logger.info(r.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:w.ULTRA_GROUP,targetId:e,channelId:t.channelId}),i),l=Date.now(),[4,this._connMgr.send(a)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return d=E.sent(),h=d.code,p=d.data,h!==P.SUCCESS?(this.logger.warn(r.L_SEND_MSG_R,JSON.stringify({code:h,messageUId:c.messageUId,messageId:c.messageId}),i),this._writeMessagesLog(w.ULTRA_GROUP)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({channel:w.ULTRA_GROUP,start_ts:l,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:h})),c.sentStatus=K.FAILED,[2,{code:h,data:c}]):(this.logger.info(r.L_SEND_MSG_R,JSON.stringify({code:h,messageUId:null==p?void 0:p.messageUId,messageId:null==p?void 0:p.messageId}),i),_=p,this._writeMessagesLog(w.ULTRA_GROUP,_.messageUId)&&this.logger.record(re.IM_MSG_SEND,JSON.stringify({msg_id:_.messageUId,channel:w.ULTRA_GROUP,start_ts:l,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:h})),c.sentTime=_.timestamp,c.messageUId=_.messageUId,this._ultraMsgMap[_.messageUId]=_.timestamp,f=t.channelId||"",(g=this._ultraGroupMap["".concat(f,"_").concat(e)])?(g.latestMessage=c,_t(g.channelType)&&(c.channelType=g.channelType)):(g={conversationType:w.ULTRA_GROUP,targetId:e,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:oe.CLOSE,notificationLevel:ie.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(f,"_").concat(e)]=g,this._ultraGroupManager.addUltraGroupStatus(g)),this._watcher.conversation(Bt([g])),[2,{code:h,data:c}])}}))}))},i.prototype.sendUltraGroupTypingStatus=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=e.conversationType,r=e.channelId,i=e.targetId,o=this._connMgr.codec.encodeOperateStatus(i,n,r||"",t||0),(s=new Xa(Is[Is.operate],o,i)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==P.SUCCESS?[2,{code:a,msg:P[a]}]:[2,{code:a}]}}))}))},i.prototype.getUltraGroupMessageListByMessageUId=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,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:P.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(r=new Za(Is[Is.qryMsg],n,this.currentUserId)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(r,Xi,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==P.SUCCESS?[2,{code:o,msg:P[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(e){var n=e.messageUId;t[n]=e})),[2,{code:0,data:t}])}}))}))},i.prototype._pullOperateStatusNotify=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.pbData,eo),n=t.conversationType,i=t.info,o=t.summary;this.logger.debug(r.O,"s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(o)),this._watcher.operateStatus(t)}},i.prototype.expandUltraMessage=function(e){return ue(this,void 0,void 0,(function(){var t,n,r;return ce(this,(function(i){switch(i.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Za(Is[Is.upMsgEx],t,e.targetId)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return(r=i.sent().code)!==P.SUCCESS?[2,{code:r,msg:P[r]}]:[2,{code:r}]}}))}))},i.prototype.modifyMessage=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new Za(Is[Is.modifyMsg],t,e.targetId)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==P.SUCCESS?[2,{code:i,msg:P[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},i.prototype._handleEventChangeList=function(e){var t={Group:{map:{},types:Ap},Friend:{map:{},types:Np}},n=function(e,t,n){e[t]||(e[t]=[]),e[t].push(n)};e.forEach((function(e){var r=e.changeType;for(var i in t)if(t[i].types.includes(r)){n(t[i].map,r,e);break}}));var r={Group:this._processChangeMapGroup.bind(this),Friend:this._processChangeMapFriend.bind(this)};for(var i in t)Object.keys(t[i].map).length>0&&r[i](t[i].map)},i.prototype._pullUltraChangeMessageList=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new Za(Is[Is.qryMsgChange],t,this.currentUserId)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(n,zi)]):[2];case 1:return r=d.sent(),i=r.code,o=r.data,this._isPullingUltraChangeMessage=!1,i===P.SUCCESS&&o?(s=o.hasNext,a=o.list,u=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(l=this._pullUltraChangeMessageQue).push.apply(l,he([],de(c),!1)),s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]):[2]}}))}))},i.prototype._handleUltraChangeList=function(e){var t={};e.forEach((function(e){var n=e.changeType;t[n]||(t[n]=[]),t[n].push(e)}));var n=x.CHANNEL_CHANGE,r=x.MSG_RECALL,i=x.MSG_EXPANSION,o=x.MSG_MODIFY,s=x.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[r]&&this._handleMsgRecall(t[r]),t[i]&&this._handleMsgUpdate(t[i]),t[o]&&this._handleMsgUpdate(t[o]),t[s]&&this._handleUserGroupStatus(t[s])},i.prototype._processChangeMapGroup=function(e){var t=S.GROUP_OPERATION,n=S.GROUP_PROFILE_CHANGE,r=S.GROUP_APPLICATION_INVITATION,i=S.GROUP_FOLLOW_USER_CHANGE;e[t]&&this._handleGroupOperation(e[t]),e[n]&&this._handleGroupProfileChange(e[n]),e[r]&&this._handleApplication(e[r]),e[i]&&this._handleFollowUserChange(e[i])},i.prototype._processChangeMapFriend=function(e){var t=this;(e[l.FRIEND_APPLICATION]||[]).forEach((function(e){var n,r,i,o,s,a,u,l,h,p,_=e.subChangeType,f=e.businessId,g=e.time,E=e.eventData,I=d.FRIEND_APPLY,v=d.FRIEND_REFUSE,T=d.FRIEND_USER_INFO,R=d.FRIENDS_INPUT,m=d.FRIEND_CLEAR,y=d.FRIEND_INFO_CHANGE,S=d.FRIEND_INFO_CHANGE_SYNC;switch(_){case I:case v:var C=_===I?c.UNHANDLED:c.REFUSED;null===(r=(n=t._watcher).friendApplicationStatusChanged)||void 0===r||r.call(n,{userId:f,applicationType:E.applyType,applicationStatus:C,directionType:E.friendType,operationTime:g,extra:E.info||""});break;case T:null===(o=(i=t._watcher).friendAdd)||void 0===o||o.call(i,{userId:f,name:E.name,portraitUri:E.portraitUrl,directionType:E.friendType,operationTime:g});break;case R:null===(a=(s=t._watcher).friendDelete)||void 0===a||a.call(s,{userIds:E.targetId,directionType:E.type,operationTime:g});break;case m:null===(l=(u=t._watcher).friendCleared)||void 0===l||l.call(u,g);break;case y:break;case S:null===(p=(h=t._watcher).friendInfoChangedSync)||void 0===p||p.call(h,{userId:f,remark:E.remarkname,extProfile:E.extProfile,operationTime:g})}}))},i.prototype._handleGroupOperation=function(e){var t=this;e.forEach((function(e){var n,r,i,o,s=e.subChangeType,a=e.businessId,u=e.time,c=e.eventData,l=c.optUserInfo,d=c.channelInfo,h=c.userInfos,p={groupId:a,operation:s,operationTime:u};l&&(n=de(Zt([l]),1),p.operatorInfo=n[0]),s===I.CREATE&&(r=de(Wt([d]),1),p.groupInfo=r[0]),[I.CREATE,I.DISMISS].includes(s)||(p.memberInfos=Zt(h)),null===(o=(i=t._watcher).groupOperation)||void 0===o||o.call(i,p)}))},i.prototype._handleGroupProfileChange=function(e){var t=this;e.forEach((function(e){var n,r,i,o,s,a,u=e.businessId,c=e.time,l=e.eventData,d=e.subChangeType,h=e.secondaryId;switch(d){case v.GROUP_INFO_CHANGE:var p=de(Zt([l.optUserInfo]),1)[0],_=de(jt([l.channelInfo]),1)[0],f=de(l.channelFullInfo?jt([l.channelFullInfo]):[void 0],1)[0];null===(r=(n=t._watcher).groupInfoChanged)||void 0===r||r.call(n,{operatorInfo:p,groupInfo:_,changedGroupInfo:_,operationTime:c,fullGroupInfo:f});break;case v.MEMBER_PROFILE_CHANGE:p=de(Zt([l.optUserInfo]),1)[0];var g=Zt(l.userInfos)[0];null===(o=(i=t._watcher).groupMemberInfoChanged)||void 0===o||o.call(i,{groupId:u,operatorInfo:p,memberInfo:g,operationTime:c});break;case v.GROUP_REMARK_DELETE:case v.GROUP_REMARK_SET:var E=d===v.GROUP_REMARK_SET?T.ADD:T.REMOVE;null===(a=(s=t._watcher).groupRemarkChangedSync)||void 0===a||a.call(s,{groupId:u,operationType:E,operationTime:c,groupRemark:h})}}))},i.prototype._handleApplication=function(e){var t=this;e.forEach((function(e){var n=e.eventData.statusInfo;$t(n).forEach((function(e){var n,r;null===(r=(n=t._watcher).groupApplicationEvent)||void 0===r||r.call(n,e)}))}))},i.prototype._handleFollowUserChange=function(e){var t=this;e.forEach((function(e){var n,r,i=e.subChangeType,o=e.businessId,s=e.time,a=e.userGroupIds,u=1===i?T.ADD:T.REMOVE;null===(r=(n=t._watcher).groupFollowsChangedSync)||void 0===r||r.call(n,{groupId:o,operationType:u,operationTime:s,userIds:a})}))},i.prototype._handleUltraChannelChange=function(e){var t=this,n=[],r=[],i=[];e.forEach((function(e){var o=e.subChangeType,s=e.targetId,a=e.channelId,u=e.sendTime,c=e.operatorId,l="".concat(a,"_").concat(s),d=t._ultraGroupMap[l];if(d){var h=H.PUBLIC_TO_PRIVATE,p=H.PRIVATE_TO_PUBLIC,_=H.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=H.CHANNEL_DELETE,g=H.CHANNEL_USER_KICKED;switch(o){case p:d.channelType=F.PUBLIC,n.push({targetId:s,channelId:a,changeType:B.PRIVATE_TO_PUBLIC,channelType:d.channelType});break;case h:d.channelType=F.PRIVATE,n.push({targetId:s,channelId:a,changeType:B.PUBLIC_TO_PRIVATE,channelType:d.channelType});break;case _:n.push({targetId:s,channelId:a,changeType:B.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:d.channelType}),delete t._ultraGroupMap[l];break;case f:r.push({targetId:s,channelId:a,channelType:d.channelType,deleteTime:u}),delete t._ultraGroupMap[l];break;case g:i.push({targetId:s,channelId:a,userId:c,channelType:F.PRIVATE}),c===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),r.length>0&&this._watcher.ultraGroupChannelDelete(r),i.length>0&&this._watcher.ultraGroupChannelUserKicked(i)},i.prototype._handleMsgRecall=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.conversationType,u=e.operatorId,c=e.mentionedType;t._updateUltraGroupWhenRecallMsg(r,i,o,s,c),n.push({targetId:r,conversationType:a,sentTime:s,messageUId:o,senderUserId:u,channelId:i,content:{conversationType:a,targetId:r,messageUId:o,channelId:i},messageDirection:1,messageType:k.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:fe.UNREAD,receivedStatusInfo:xt(fe.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(n)},i.prototype._handleMsgUpdate=function(e){var t={};for(var n in e.forEach((function(e){var n=e.targetId,r=e.conversationType,i=e.sendTime,o=e.messageUId,s=e.channelId,a="".concat(r,"_").concat(n);t[a]||(t[a]=[]),t[a].push({messageUId:o,channelId:s,sendTime:i})})),t){var r=n.split("_"),i=r.shift(),o=r.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:o,conversationType:Number(i),messages:he([],de(t[n]),!1)})}},i.prototype._pullUltraMessageList=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,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 Za(Is[Is.qryMsg],n,this.currentUserId)).setHeaderQos(ys.AT_LEAST_ONCE),[4,this._connMgr.send(r,Xi,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return i=l.sent(),o=i.code,s=i.data,o!==P.SUCCESS?[2,{code:o,msg:P[o]}]:(a=(s||{}).list,u=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=c._ultraGroupMap["".concat(n,"_").concat(t)];i&&i.latestMessage.messageUId===r&&(i.latestMessage=e),u.push(e)})),e===x.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===x.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},i.prototype._handleUserGroupStatus=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,d;return ce(this,(function(h){return t=q.REMOVE_USER_GROUP,n=q.JOIN_USER_GROUP,r=q.EXIT_USER_GROUP,i=q.CHANNEL_BIND_USER_GROUP,o=q.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],l=[],e.forEach((function(e){var d=e.conversationType,h=e.targetId,p=e.userGroupIds,_=e.busChannelType,f=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:d,targetId:h},userGroupIds:p});break;case n:a.push({conversation:{conversationType:d,targetId:h},userGroupIds:p});break;case r:u.push({conversation:{conversationType:d,targetId:h},userGroupIds:p});break;case i:c.push({conversation:{conversationType:d,targetId:h,channelId:f},channelType:_,userGroupIds:p});break;case o:l.push({conversation:{conversationType:d,targetId:h,channelId:f},channelType:_,userGroupIds:p})}})),d={},s.length>0&&(d.userGroupDisband=s),a.length>0&&(d.userAdded=a),u.length>0&&(d.userRemoved=u),c.length>0&&(d.userGroupBindChannel=c),l.length>0&&(d.userGroupUnBindChannel=l),this._watcher.userGroupStatus(d),[2]}))}))},i.prototype.getUltraHistoryMsg=function(e,t,n){var i;return ue(this,void 0,void 0,(function(){var o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return this._isConnected?(o=this._connMgr.codec.encodeGetHistoryMsg(e,t),s=new Za(Is[Is.qryUgMsg],o,this.currentUserId),this.logger.info(r.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:w.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count}),n),[4,this._connMgr.send(s,ai,{currentUserId:this.currentUserId,conversation:{conversationType:w.ULTRA_GROUP,targetId:e}})]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return a=d.sent(),u=a.code,c=a.data,u===P.SUCCESS&&c?(l=[],null===(i=c.list)||void 0===i||i.forEach((function(e){e&&l.push(e.messageUId)})),this.logger.info(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:u,messageUIds:l.join(",")}),n),[2,{code:u,data:c}]):(this.logger.warn(r.L_GET_HISTORY_MSG_R,JSON.stringify({code:u,messageUIds:""}),n),[2,{code:u}])}}))}))},i.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(r=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),i=new Za(Is[Is.ugUnpushSet],r,e),[4,this._connMgr.send(i)]):[2,{code:P.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:P.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,P.SUCCESS,[2,{code:s}]}}))}))},i.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,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),i=new Za(Is[Is.ugUnpushQuery],r,e),[4,n.send(i,Pi)]):[2,{code:P.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:P.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===P.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[2,{code:s}]}}))}))},i.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n,r,i){var o="".concat(t,"_").concat(e);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,u=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),r&&u<r&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(i===Y.ALL||i===Y.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,i===Y.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(Bt([s])))}},i.prototype.getAllConversationState=function(){return Promise.resolve({code:P.SUCCESS,data:this._conversationManager.getAllConversationState()})},i.prototype.getUltraGroupUnreadMentionedMessages=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o;return ce(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Za(Is[Is.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,ti)]):[2,Promise.resolve({code:P.METHOD_NOT_AVAILABLE})]:[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===P.SUCCESS&&o?[2,{code:i,data:o}]:[2,{code:i}]}}))}))},i.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i;return ce(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,r=this._ultraGroupMap["".concat(n,"_").concat(t)]||{},i=r.firstUnreadMessage||null,[2,{code:P.SUCCESS,data:i}]):[2,Promise.resolve({code:P.METHOD_NOT_AVAILABLE})]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.subscribeUser=function(e,t,n){return ue(this,void 0,void 0,(function(){return ce(this,(function(r){return this._isConnected?[2,this._subscribeManager.updateSubscribeRelation(e,t,z.SUBSCRIBE,n)]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.unSubscribeUser=function(e,t){return ue(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,z.UNSUBSCRIBE)]:[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return[2,{code:n.sent().code}]}}))}))},i.prototype.getSubscribeUserList=function(e,t,n){var r;return ue(this,void 0,void 0,(function(){var i;return ce(this,(function(o){return this._isConnected?(i=null===(r=this._subscribeManager)||void 0===r?void 0:r.getSubscribeUserList(e,t,n),[2,Promise.resolve({code:P.SUCCESS,data:i})]):[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.getSubscribeUserStatus=function(e,t){var n;return ue(this,void 0,void 0,(function(){var r;return ce(this,(function(i){return this._isConnected?(r=null===(n=this._subscribeManager)||void 0===n?void 0:n.getSubscribeUserStatus(e,t),[2,Promise.resolve({code:P.SUCCESS,data:r})]):[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.updateMyUserProfile=function(e){var t;return ue(this,void 0,void 0,(function(){var n,r,i,a;return ce(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=cs.encode(Ro,pe(this,o,"m",s).call(this,e)),[4,this._connMgr.query(Is.updUserProfile,this.currentUserId,n,yo)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return(r=u.sent()).isOk?(i=r.data.version,null===(t=this._subscribeManager)||void 0===t||t.updateOwnProfile(e,i),[2,r.wipe()]):(a=r.data.censorFailedFields,[2,ut(r.code,"",a&&0!==a.length?{errorKeys:a,errorKey:a[0]}:void 0)])}}))}))},i.prototype.getMyUserProfile=function(){return this._isConnected?this._subscribeManager.getOwnProfile():Promise.resolve({code:P.RC_NET_UNAVAILABLE})},i.prototype.getUserProfiles=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return this._isConnected?[2,this._subscribeManager.getUserProfiles(e)]:[2,{code:P.RC_NET_UNAVAILABLE}]}))}))},i.prototype.updateMyUserProfileVisibility=function(e){return ue(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 Za(Is[Is.updProfilePermiss],t,this.currentUserId),[4,this._connMgr.send(n)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return[2,{code:r.sent().code}]}}))}))},i.prototype.getMyUserProfileVisibility=function(){return ue(this,void 0,void 0,(function(){var e,t,n,r,i;return ce(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodeUserProfileInput(),t=new Za(Is[Is.qProfilePermiss],e,this.currentUserId),[4,this._connMgr.send(t,No)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return n=o.sent(),r=n.code,i=n.data,r!==P.SUCCESS?[2,{code:r}]:[2,{code:r,data:null==i?void 0:i.permission}]}}))}))},i.prototype.searchUserProfileByUniqueId=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeSearchUserProfile(e),n=new Za(Is[Is.searchUserProfile],t,this.currentUserId),[4,this._connMgr.send(n,Ro)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),i=r.code,o=r.data,i===P.SUCCESS&&o?(s=Yt(o.userId,o.userProfile,o.userExtProfile),[2,{code:i,data:s}]):[2,{code:i}]}}))}))},i.prototype.bindRTCRoomForChatroom=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i;return ce(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),r=new Za(Is[Is.setRtcRoomId],n,t),[4,this._connMgr.send(r)]):[2,P.RC_NET_UNAVAILABLE];case 1:return i=o.sent(),[2,i.code]}}))}))},i.prototype.rtcSignaling=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return this._isConnected?(i=n?new Za(t,r,e):new Xa(t,r,e),[4,this._connMgr.send(i)]):[2,{code:P.RC_NET_UNAVAILABLE}];case 1:return o=u.sent(),s=o.code,a=o.data,[2,{code:s,buffer:a instanceof $a||null==a?void 0:a.pbData}]}}))}))},i.prototype.rtcPing=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return r=Rs(this.rtcCodec,t,n),[4,this.rtcSignaling(e,Is[Is.rtcPing],!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,o!==P.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(ps.RtcOutput,s)).version=wt(a.version),[2,{code:o,data:a}])}}))}))},i.prototype.getDeviceId=function(){return Su()},i.prototype.setPushConfig=function(e){var t,n;(t=e.deviceId)&&(yu=t),n=e.packageName,Nu=n},i.prototype.getOSInfo=function(){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,{code:P.NOT_SUPPORT}]}))}))},i.prototype.getProcessInfo=function(){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,{code:P.NOT_SUPPORT}]}))}))},i.prototype.getMainProcessInfo=function(){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,{code:P.NOT_SUPPORT}]}))}))},i.prototype.destroy=function(){ue(void 0,void 0,void 0,(function(){var e,t;return ce(this,(function(n){switch(n.label){case 0:return jh?(ep&&(clearTimeout(ep),ep=null),[4,jh]):[2];case 1:return(e=n.sent())&&(t=e.db,rp.push(t)),jh=null,[2]}}))}))},i.prototype.callExtra=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Promise.resolve({code:P.NOT_SUPPORT})},i.prototype.setProxy=function(e){return Promise.resolve({code:P.NOT_SUPPORT})},i.prototype.getProxy=function(){return Promise.resolve({code:P.NOT_SUPPORT})},i.prototype.testProxy=function(e,t){return Promise.resolve({status:P.NOT_SUPPORT})},i.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,mn.newWorkChange,r)}},i.prototype.createGroup=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s;return ce(this,(function(a){switch(a.label){case 0:return i=kh(e,t,n,r),[4,this._connMgr.query(Is.channelCreate,e,i,Uo)];case 1:return(o=a.sent()).data?(s={errorKeys:o.data.censorFailedFields,processCode:o.data.processCode||0},[2,o.isOk?at():ut(o.code,o.msg,s)]):[2,o.wipe()]}}))}))},i.prototype.updateGroupInfo=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i;return ce(this,(function(o){switch(o.label){case 0:return r=kh(e,t,n),[4,this._connMgr.query(Is.upChannelInfo,e,r,Uo)];case 1:return(i=o.sent()).data?[2,i.isOk?at():ut(i.code,i.msg,{errorKeys:i.data.censorFailedFields})]:[2,i.wipe()]}}))}))},i.prototype.getGroupsInfo=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeMultiChannels(e),n=new Za(Is[Is.qChannelInfo],t,e[0]),[4,this._connMgr.send(n,Vo)];case 1:return r=u.sent(),i=r.code,o=r.data,i===P.SUCCESS&&o?(s=o.result.list,a=Wt(void 0===s?[]:s),[2,{code:i,data:a}]):[2,{code:i}]}}))}))},i.prototype.kickGroupMembers=function(e,t,n){var r;return ue(this,void 0,void 0,(function(){var i,o,s,a,u;return ce(this,(function(c){switch(c.label){case 0:return i=this._connMgr.codec.encodeQuitGroup("kick",e,t,!0,n),o=new Za(Is[Is.channelMemKick],i,e),[4,this._connMgr.send(o,Uo)];case 1:return s=c.sent(),a=s.code,u=s.data,a!==P.SUCCESS?[2,{code:a,msg:null!==(r=null==u?void 0:u.msg)&&void 0!==r?r:""}]:[2,{code:a}]}}))}))},i.prototype.quitGroup=function(e,t){var n;return ue(this,void 0,void 0,(function(){var r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return r=this._connMgr.codec.encodeQuitGroup("quit",e,[],!0,t),i=new Za(Is[Is.channelMemQuit],r,e),[4,this._connMgr.send(i,Uo)];case 1:return o=u.sent(),s=o.code,a=o.data,s!==P.SUCCESS?[2,{code:s,msg:null!==(n=null==a?void 0:a.msg)&&void 0!==n?n:""}]:[2,{code:s}]}}))}))},i.prototype.dismissGroup=function(e){var t;return ue(this,void 0,void 0,(function(){var n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return n=this._connMgr.codec.encodeQuitGroup("dismiss",e),r=new Za(Is[Is.channelDismiss],n,e),[4,this._connMgr.send(r,Uo)];case 1:return i=a.sent(),o=i.code,s=i.data,o!==P.SUCCESS?[2,{code:o,msg:null!==(t=null==s?void 0:s.msg)&&void 0!==t?t:""}]:[2,{code:o}]}}))}))},i.prototype.transferGroupOwner=function(e,t,n,r){var i;return ue(this,void 0,void 0,(function(){var o,s,a,u,c;return ce(this,(function(l){switch(l.label){case 0:return o=this._connMgr.codec.encodeQuitGroup("transfer",e,[t],n,r),s=new Za(Is[Is.channelTransfer],o,e),[4,this._connMgr.send(s,Uo)];case 1:return a=l.sent(),u=a.code,c=a.data,u!==P.SUCCESS?[2,{code:u,msg:null!==(i=null==c?void 0:c.msg)&&void 0!==i?i:""}]:[2,{code:u}]}}))}))},i.prototype.setGroupManagers=function(e,t,n){var r;return ue(this,void 0,void 0,(function(){var i,o,s,a,u;return ce(this,(function(c){switch(c.label){case 0:return i=this._connMgr.codec.encodeModifyChannelsInput(e,t,n),o=new Za(Is[Is.upChannelManager],i,t),[4,this._connMgr.send(o,Uo)];case 1:return s=c.sent(),a=s.code,u=s.data,a!==P.SUCCESS?[2,{code:a,msg:null!==(r=null==u?void 0:u.msg)&&void 0!==r?r:""}]:[2,{code:a}]}}))}))},i.prototype.getGroupMembersByRole=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,d,h,p;return ce(this,(function(_){switch(_.label){case 0:return r=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupMembersByRole",groupId:e,option:n,roleType:t}),i=new Za(Is[Is.qChannelMem],r,e),[4,this._connMgr.send(i,Vo)];case 1:return o=_.sent(),s=o.code,a=o.data,s===P.SUCCESS&&a?(u=a.result,c=a.page,d=(l=c||{}).pageToken,h=l.hasNext,[],p=Zt(u.list),[2,{code:s,data:{data:p,pageToken:h&&d?d:""}}]):[2,{code:s}]}}))}))},i.prototype.getGroupMembers=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,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 Za(Is[Is.qChannelSpeMem],n,e),[4,this._connMgr.send(r,Vo)];case 1:return i=c.sent(),o=i.code,s=i.data,o!==P.SUCCESS?[2,{code:o}]:s?(a=s.result,[],u=Zt(a.list),[2,{code:o,data:u}]):[2,{code:o,data:[]}]}}))}))},i.prototype.setGroupMemberInfo=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o;return ce(this,(function(s){switch(s.label){case 0:return i=cs.encode(Go,{targetId:e,type:w.GROUP,userId:t,channelNickName:n,additional:r}),[4,this._connMgr.query(Is.upChannelMem,e,i,Uo)];case 1:return(o=s.sent()).data?[2,o.isOk?at():ut(o.code,o.msg,{errorKeys:o.data.censorFailedFields})]:[2,o.wipe()]}}))}))},i.prototype.searchGroupMembers=function(e,t,n){return Promise.resolve({code:P.NOT_SUPPORT})},i.prototype.joinGroup=function(e){var t;return ue(this,void 0,void 0,(function(){var n,r,i,o,s;return ce(this,(function(a){switch(a.label){case 0:return n=this._connMgr.codec.encodeJoinGroup("join",e),r=new Za(Is[Is.channelMemJoin],n,e),[4,this._connMgr.send(r,Uo)];case 1:return i=a.sent(),o=i.code,s=i.data,[2,{code:o,data:{processCode:null!==(t=null==s?void 0:s.processCode)&&void 0!==t?t:0}}]}}))}))},i.prototype.inviteUsersToGroup=function(e,t){var n,r;return ue(this,void 0,void 0,(function(){var i,o,s,a,u;return ce(this,(function(c){switch(c.label){case 0:return i=this._connMgr.codec.encodeJoinGroup("invite",e,t),o=new Za(Is[Is.channelMemInvite],i,e),[4,this._connMgr.send(o,Uo)];case 1:return s=c.sent(),a=s.code,u=s.data,a!==P.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}}]}}))}))},i.prototype.memberInviteResponse=function(e){var t,n;return ue(this,void 0,void 0,(function(){var r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return r=this._connMgr.codec.encodeMemberResponseInput(e),i=new Za(Is[Is.channelApplyResp],r,e.groupId),[4,this._connMgr.send(i,Uo)];case 1:return o=u.sent(),s=o.code,a=o.data,s!==P.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}}]}}))}))},i.prototype.getGroupApplications=function(e,t,n){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,d;return ce(this,(function(h){switch(h.label){case 0:return t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupApplications",option:e}),n=new Za(Is[Is.qChannelApplyList],t,this.currentUserId),[4,this._connMgr.send(n,Vo)];case 1:return r=h.sent(),i=r.code,o=r.data,i===P.SUCCESS&&o?(s=o.result,a=o.page,c=(u=a||{}).pageToken,l=u.hasNext,d=$t(null==s?void 0:s.list)||[],[2,{code:i,data:{data:d,pageToken:l&&c?c:""}}]):[2,{code:i}]}}))}))},i.prototype.getJoinedGroupsByRole=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,d,h;return ce(this,(function(p){switch(p.label){case 0:return n=this._connMgr.codec.encodeChannelsQueryInput({type:"getJoinedGroupsByRole",option:t,roleType:e}),r=new Za(Is[Is.qChannelMemJoin],n,this.currentUserId),[4,this._connMgr.send(r,Vo)];case 1:return i=p.sent(),o=i.code,s=i.data,o===P.SUCCESS&&s?(a=s.result,u=s.page,l=(c=u||{}).pageToken,d=c.hasNext,h=Wt(a.list),[2,{code:o,data:{data:h,pageToken:d&&l?l:""}}]):[2,{code:o}]}}))}))},i.prototype.searchJoinedGroups=function(e,t){return Promise.resolve({code:P.NOT_SUPPORT})},i.prototype.getJoinedGroups=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeChannelsQueryInput({type:"getJoinedGroups",ids:e}),n=new Za(Is[Is.qChannelMemSpeJoin],t,this.currentUserId),[4,this._connMgr.send(n,Vo)];case 1:return r=u.sent(),i=r.code,o=r.data,i===P.SUCCESS&&o?(s=o.result.list,a=Wt(s),[2,{code:i,data:a}]):[2,{code:i}]}}))}))},i.prototype.setGroupRemark=function(e,t){return ue(this,void 0,void 0,(function(){var n,r;return ce(this,(function(i){switch(i.label){case 0:return n=this._connMgr.codec.encodeSetGroupRemark(e,t),r=new Za(Is[Is.upChannelRemark],n,e),[4,this._connMgr.send(r)];case 1:return[2,{code:i.sent().code}]}}))}))},i.prototype.setGroupFollows=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i;return ce(this,(function(o){switch(o.label){case 0:return r=this._connMgr.codec.encodeSetGroupFollows(e,t,n),i=new Za(Is[Is.upChannelFollow],r,t),[4,this._connMgr.send(i)];case 1:return[2,{code:o.sent().code}]}}))}))},i.prototype.getGroupFollows=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeChannelsQueryInput({type:"getGroupFollows",groupId:e}),n=new Za(Is[Is.qChannelFollow],t,this.currentUserId),[4,this._connMgr.send(n,Vo)];case 1:return r=u.sent(),i=r.code,o=r.data,i===P.SUCCESS&&o?(s=o.result,c=s.list,a=c.map((function(e){var t=e.userId,n=e.opTime;return{userId:t,time:wt(n)}})),[2,{code:i,data:a}]):[2,{code:i}]}var c}))}))},i.prototype.addFriend=function(e,t,n){var r;return ue(this,void 0,void 0,(function(){var i,o,s,a,u;return ce(this,(function(c){switch(c.label){case 0:return i=this._connMgr.codec.encodeFriendInput({targetId:e,type:t,info:n}),o=new Za(Is[Is.friendAdd],i,this.currentUserId),[4,this._connMgr.send(o,Uo)];case 1:return s=c.sent(),a=s.code,u=s.data,a===P.SUCCESS&&u?[2,{code:a,data:{processCode:null!==(r=null==u?void 0:u.processCode)&&void 0!==r?r:0}}]:[2,{code:a}]}}))}))},i.prototype.deleteFriends=function(e,t){return ue(this,void 0,void 0,(function(){var n,r;return ce(this,(function(i){switch(i.label){case 0:return n=this._connMgr.codec.encodeFriendsInput(e,t),r=new Za(Is[Is.friendDel],n,this.currentUserId),[4,this._connMgr.send(r)];case 1:return[2,{code:i.sent().code}]}}))}))},i.prototype.acceptFriendApplication=function(e){return ue(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 Za(Is[Is.friendHandle],t,this.currentUserId),[4,this._connMgr.send(n)];case 1:return[2,{code:r.sent().code}]}}))}))},i.prototype.refuseFriendApplication=function(e,t){return ue(this,void 0,void 0,(function(){var n,r;return ce(this,(function(i){switch(i.label){case 0:return n=this._connMgr.codec.encodeFriendInput({targetId:e,type:2,info:t}),r=new Za(Is[Is.friendHandle],n,this.currentUserId),[4,this._connMgr.send(r)];case 1:return[2,{code:i.sent().code}]}}))}))},i.prototype.setFriendInfo=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i;return ce(this,(function(o){switch(o.label){case 0:return r=cs.encode(qo,{targetId:e,remarkName:t,extProfile:Gh(n)}),[4,this._connMgr.query(Is.friendSetPf,this.currentUserId,r,Yo)];case 1:return(i=o.sent()).isOk?[2,i.wipe()]:[2,ut(i.code,"",{errorKeys:i.data.censorFailedFields})]}}))}))},i.prototype.checkFriends=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeFriendsInput(e,t),r=new Za(Is[Is.friendCheck],n,this.currentUserId),[4,this._connMgr.send(r,Ho)];case 1:return i=u.sent(),o=i.code,s=i.data,o!==P.SUCCESS?[2,{code:o}]:s?(a=s.list.map((function(e){return{userId:e.targetId,relationType:e.status}})),[2,{code:o,data:a}]):[2,{code:o,data:[]}]}}))}))},i.prototype.getFriends=function(e,t){return ue(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,d;return ce(this,(function(h){switch(h.label){case 0:return n=this._connMgr.codec.encodeFriendQueryInput(11,t,e),r=new Za(Is[Is.friendsQuery],n,this.currentUserId),[4,this._connMgr.send(r,Vo)];case 1:return i=h.sent(),o=i.code,s=i.data,o===P.SUCCESS&&s?(a=s.result,u=s.page,l=(c=u||{}).pageToken,d=c.hasNext,a&&a.list?[2,{code:o,data:{data:Lp(a.list),pageToken:d&&l?l:""}}]:[2,{code:o,data:{data:[],pageToken:d&&l?l:""}}]):[2,{code:o}]}}))}))},i.prototype.getFriendApplications=function(e,t,n){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return t=this._connMgr.codec.encodeFriendQueryInput(12,e),n=new Za(Is[Is.friendsQuery],t,this.currentUserId),[4,this._connMgr.send(n,Vo)];case 1:return r=d.sent(),i=r.code,o=r.data,i!==P.SUCCESS?[2,{code:i}]:o?(s=o.result,a=o.page,c=(u=a||{}).pageToken,l=u.hasNext,[2,{code:i,data:{data:bp(s),pageToken:l&&c?c:""}}]):[2,{code:i,data:{data:[],pageToken:""}}]}}))}))},i.prototype.deleteFriendApplication=function(e,t){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,{code:P.NOT_SUPPORT}]}))}))},i.prototype.getFriendsInfo=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o;return ce(this,(function(s){switch(s.label){case 0:return t=this._connMgr.codec.encodeFriendsListInput(e),n=new Za(Is[Is.friendsInfoQry],t,this.currentUserId),[4,this._connMgr.send(n,jo)];case 1:return r=s.sent(),i=r.code,o=r.data,i!==P.SUCCESS?[2,{code:i}]:o?[2,{code:i,data:Lp(o.list)}]:[2,{code:i,data:[]}]}}))}))},i.prototype.searchFriendsInfo=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,Promise.resolve({code:P.NOT_SUPPORT})]}))}))},i.prototype.setFriendAddPermission=function(e){return ue(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 Za(Is[Is.friendAuthSet],t,this.currentUserId),[4,this._connMgr.send(n)];case 1:return[2,{code:r.sent().code}]}}))}))},i.prototype.getFriendAddPermission=function(){return ue(this,void 0,void 0,(function(){var e,t,n,r,i;return ce(this,(function(o){switch(o.label){case 0:return e=this._connMgr.codec.encodeFriendInput({targetId:this.currentUserId}),t=new Za(Is.friendAuthGet,e,this.currentUserId),[4,this._connMgr.send(t,Wo)];case 1:return n=o.sent(),r=n.code,i=n.data,r===P.SUCCESS&&i?[2,{code:r,data:i}]:[2,{code:r}]}}))}))},i.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},i.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},i.prototype.getConversationsByPage=function(e,t,n,r,i){throw new Error("Method not implemented.")},i.prototype.getContinuousMessages=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},i.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,o,s){throw new Error("Method not implemented.")},i.prototype.clearConversations=function(){throw new Error("Method not implemented.")},i.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},i.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},i.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},i.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},i.prototype.addToBlacklist=function(e){return Promise.resolve(P.NOT_SUPPORT)},i.prototype.removeFromBlacklist=function(e){return Promise.resolve(P.NOT_SUPPORT)},i.prototype.getBlacklist=function(){return Promise.resolve({code:P.NOT_SUPPORT})},i.prototype.getBlacklistStatus=function(e){return Promise.resolve({code:P.NOT_SUPPORT})},i.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},i.prototype.batchInsertMessage=function(e,t){throw new Error("Method not implemented.")},i.prototype.getMessageCount=function(e,t,n){throw new Error("Method not implemented.")},i.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},i.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){throw new Error("Method not implemented.")},i.prototype.batchClearMessagesByTimestamp=function(e){throw new Error("Method not implemented.")},i.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},i.prototype.getMessage=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,ut(P.NOT_SUPPORT,"Not support")]}))}))},i.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},i.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},i.prototype.searchConversationByContent=function(e,t,n,r){throw new Error("Method not implemented.")},i.prototype.searchConversationByContentWithAllChannel=function(e,t,n){throw new Error("Method not implemented.")},i.prototype.searchMessageByContent=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},i.prototype.searchMessageByContentAndMessageType=function(e,t,n,r,i,o,s){throw new Error("Method not implemented.")},i.prototype.searchMessagesByUser=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},i.prototype.getMessagesByTimestamp=function(e,t,n,r){throw new Error("Method not implemented.")},i.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){throw new Error("Method not implemented.")},i.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,o,s){throw new Error("Method not implemented.")},i.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},i.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},i.prototype.updateMessageReceiptStatus=function(e,t,n,r){throw new Error("Method not implemented.")},i.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},i.prototype.clearData=function(){throw new Error("Method not implemented.")},i.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){throw new Error("Method not implemented.")},i.prototype.setCallInfo=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return(r=this._connMgr)?(i=r.codec.encodeSetCallInfo(t,n),[4,r.send(new Za(Is.reqCall,i,e),no)]):[3,2];case 1:return o=u.sent(),s=o.code,a=o.data,s===P.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:P.RC_NET_CHANNEL_INVALID})]}}))}))},i.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},i.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},i.prototype.setCheckDuplicateMessage=function(e){throw new Error("Method not implemented.")},i.prototype.setCheckChatRoomDuplicateMessage=function(e){throw new Error("Method not implemented.")},i.prototype.getConversations=function(e){throw new Error("Method not implemented.")},i.prototype.getRealtimeConversations=function(e,t,n){return ue(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,d,h=this;return ce(this,(function(p){switch(p.label){case 0:return i=(r=this).currentUserId,o=r._connMgr,s=w.PRIVATE,a=o.codec.encodeOldConversationList({count:e,type:s,startTime:t,order:n}),u=new Za(Is.qrySessions,a,i),[4,o.send(u,$r,{currentUserId:i,connectedTime:o.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=e.unreadMessageCount,o=h._conversationManager.get(t,n,r);Object.assign(e,o,{unreadMessageCount:i});var s=h._conversationManager.getDraft(t,n,r);return e.draft=s,e}})];case 1:return c=p.sent(),l=c.code,d=c.data,l!==P.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==d?void 0:d.list.sort((function(e,t){var r,i,o=(null===(r=e.latestMessage)||void 0===r?void 0:r.sentTime)||0,s=(null===(i=t.latestMessage)||void 0===i?void 0:i.sentTime)||0;return 0===n?s-o:o-s}))}]}}))}))},i.prototype.getRealtimeConTotalUnreadCount=function(){return ue(this,void 0,void 0,(function(){var e,t,n,r,i;return ce(this,(function(o){switch(o.label){case 0:return e=this._connMgr.codec.encodeSessionAttInput(),t=new Za(Is.qrySessionsAtt,e,this.getCurrentUserId()),[4,this._connMgr.send(t,ci)];case 1:return n=o.sent(),r=n.code,i=n.data,[2,{code:r,data:(null==i?void 0:i.totalUnreadCount)||0}]}}))}))},i.prototype.clearRealtimeConUnreadCount=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i;return ce(this,(function(o){switch(o.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()),i=new Xa(Is[Is.updRRTime],r,this.currentUserId),[4,this._connMgr.send(i)];case 1:return[2,{code:o.sent().code}]}}))}))},i.prototype.removeRealtimeConversations=function(e){return ue(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 Za(Is.delSessions,t.codec.encodeRemoveConversationList(e),this.getCurrentUserId()),[4,t.send(n)];case 1:return[2,{code:r.sent().code}]}}))}))},i.prototype.getRealtimeConUnreadCounts=function(e){var t,n;return ue(this,void 0,void 0,(function(){var r,i,o;return ce(this,(function(s){switch(s.label){case 0:return r=this._connMgr.codec.encodeQuerySessionsInput(e),i=new Za(Is[Is.qrySessionsUnread],r,this.currentUserId),[4,this._connMgr.send(i,_i)];case 1:return(o=s.sent()).code===P.SUCCESS&&o.data?[2,{code:o.code,data:null===(n=null===(t=o.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:wt(e.unreadCount)}}))}]:[2,{code:o.code}]}}))}))},i.prototype.setNotificationQuietHoursWithSetting=function(e){return ue(this,void 0,void 0,(function(){var t;return ce(this,(function(n){switch(n.label){case 0:return t=cs.encode(Jo,e),[4,this._connMgr.query(Is.addUnpush,this.currentUserId,t)];case 1:return[2,n.sent().wipe()]}}))}))},i.prototype.removeNotificationQuietHoursSetting=function(){return ue(this,void 0,void 0,(function(){var e;return ce(this,(function(t){switch(t.label){case 0:return e=cs.encode(zo,{nothing:0}),[4,this._connMgr.query(Is.delUnpush,this.currentUserId,e)];case 1:return[2,t.sent().wipe()]}}))}))},i.prototype.getNotificationQuietHoursSetting=function(){return ue(this,void 0,void 0,(function(){var e;return ce(this,(function(t){switch(t.label){case 0:return e=cs.encode(Zo,{nothing:0}),[4,this._connMgr.query(Is.qryUnpush,this.currentUserId,e,Xo)];case 1:return[2,t.sent().trans((function(e){var t=e.isUnpush,n=e.spanMinutes,r=e.startTime,i=e.level,o=e.timezone;return t?{spanMinutes:n,startTime:r,level:i,timezone:o}:{spanMinutes:0,startTime:"",level:ye.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT}}))]}}))}))},i.prototype.getStatsUrlList=function(){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,at(Tn.getStatsUrlList(this.getNaviInfoFromCache()))]}))}))},o=new WeakSet,s=function(e){var t={},n=e.extraProfile;return n&&(delete e.extraProfile,t.userExtProfile=Gh(n)),t.userProfile=Gh(e),t},ae([Mp()],i.prototype,"createGroup",null),ae([Mp()],i.prototype,"updateGroupInfo",null),ae([Mp()],i.prototype,"getGroupsInfo",null),ae([Mp()],i.prototype,"kickGroupMembers",null),ae([Mp()],i.prototype,"quitGroup",null),ae([Mp()],i.prototype,"dismissGroup",null),ae([Mp()],i.prototype,"transferGroupOwner",null),ae([Mp()],i.prototype,"setGroupManagers",null),ae([Mp()],i.prototype,"getGroupMembersByRole",null),ae([Mp()],i.prototype,"getGroupMembers",null),ae([Mp()],i.prototype,"setGroupMemberInfo",null),ae([Mp()],i.prototype,"joinGroup",null),ae([Mp()],i.prototype,"inviteUsersToGroup",null),ae([Mp()],i.prototype,"memberInviteResponse",null),ae([Mp()],i.prototype,"getGroupApplications",null),ae([Mp()],i.prototype,"getJoinedGroupsByRole",null),ae([Mp()],i.prototype,"getJoinedGroups",null),ae([Mp()],i.prototype,"setGroupRemark",null),ae([Mp()],i.prototype,"setGroupFollows",null),ae([Mp()],i.prototype,"getGroupFollows",null),ae([Mp()],i.prototype,"addFriend",null),ae([Mp()],i.prototype,"deleteFriends",null),ae([Mp()],i.prototype,"acceptFriendApplication",null),ae([Mp()],i.prototype,"refuseFriendApplication",null),ae([Mp()],i.prototype,"setFriendInfo",null),ae([Mp()],i.prototype,"checkFriends",null),ae([Mp()],i.prototype,"getFriends",null),ae([Mp()],i.prototype,"getFriendApplications",null),ae([Mp()],i.prototype,"deleteFriendApplication",null),ae([Mp()],i.prototype,"getFriendsInfo",null),ae([Mp()],i.prototype,"searchFriendsInfo",null),ae([Mp()],i.prototype,"setFriendAddPermission",null),ae([Mp()],i.prototype,"getFriendAddPermission",null),ae([Mp()],i.prototype,"getRealtimeConversations",null),ae([Mp()],i.prototype,"getRealtimeConTotalUnreadCount",null),ae([Mp()],i.prototype,"clearRealtimeConUnreadCount",null),ae([Mp()],i.prototype,"removeRealtimeConversations",null),ae([Mp()],i.prototype,"getRealtimeConUnreadCounts",null),ae([Up()],i.prototype,"setNotificationQuietHoursWithSetting",null),ae([Up()],i.prototype,"removeNotificationQuietHoursSetting",null),ae([Up()],i.prototype,"getNotificationQuietHoursSetting",null),i}(ou);function wp(e){return se({},e)}function Dp(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:P.RC_USER_PROFILE_SERVICE_UNAVAILABLE}):r.call.apply(r,he([this],de(t),!1))}}function Vp(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Mu(this.getNaviInfoFromCache())?r.call.apply(r,he([this],de(e),!1)):Promise.resolve({code:P.RC_REAL_TIME_CONVERSATION_UNAVAILABLE})}}var Gp=function(){function e(e){var t,n;this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((t={})[k.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),t[k.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),t[k.INTERCEPT]=this._processInterceptMessage.bind(this),t[k.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),t[k.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),t[k.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),t),this._messageProccessor=((n={})[k.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),n[k.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),n[k.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=se({},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,X.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,X.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,X.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,X.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 Es(vs,Ts);var i=kt();this._engine=i?new RCCppEngine(this.rtcCodec,r,this._options):new Pp(this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.sse=new su(this,i)}return e.init=function(t){if(this._context)return this._context.logger.warn(r.A_INIT_REPEAT_O),this._context;this._context=new e(t),this._context.logger.info(r.L_INIT_O,JSON.stringify({appkey:t.appkey,navigators:t.navigators,typingExpireTime:t.typingExpireTime})),this._context.logger.warn(r.L_IMSDK_VER_O,JSON.stringify({commitId:"84bac54b241256653eda029c588a914ff4013c86",version:"5.20.0-c-unikit.1"}));var n=this._context._engine;return Ur.setNetworkStatusListener(n.setNetwork.bind(n)),this._context},e.getContext=function(){return this._context},e.prototype.getOptions=function(){return this._options},e.destroy=function(){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(r.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}),Object.defineProperty(e.prototype,"chat",{get:function(){return this._engine.chat},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataHosting",{get:function(){return this._engine.dataHosting},enumerable:!1,configurable:!0}),e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(r.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(r.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var i="RCRTC"===e.tag?new lu(this):new cu(this),o=null;try{if(!e.verify(Ur))return null;o=e.setup(i,Ur,t)}catch(e){this.logger.error(r.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(i),this._pluginInstanseMap[e.tag]=o),o},e.prototype._onConnectionStatusChange=function(e,t){var n,i;this.logger.warn(r.A_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),null===(i=(n=this._watcher).connection)||void 0===i||i.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,i=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:i,userList:n}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo(wp(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===w.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===ee.MSG_EXPANSION||n===ee.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(r.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===b.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 i,o,s,a,u=this;if(!(null===(o=(i=this._compatibleMessageProccessor)[e.messageType])||void 0===o?void 0:o.call(i,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(wp(e))}catch(e){return u.logger.error(r.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(a=(s=this._watcher).message)||void 0===a||a.call(s,wp(e),t,n),e},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,o=[],s=[],a=[k.READ_RECEIPT,k.READ_RECEIPT_REQUEST,k.READ_RECEIPT_RESPONSE];e.forEach((function(e){var r=i._messageReceiver(e,t,n);r&&a.includes(r.messageType)?s.push(r):r&&o.push(r)})),o.length&&this._watcher.batchMessage&&(this.logger.debug(r.L_BATCH_MESSAGE_O,o.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(o)),s.length&&s.forEach((function(e){i._messageProccessor[e.messageType]&&i._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(r.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(r.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(r.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(r.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(r.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(r.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]=Rt(r)||Tt(r)?r:void 0}}))},e.prototype._resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,o=e.channelId,s=i.typingContentType,a=o||"",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.setPushConfig=function(e){return this._engine.setPushConfig(e)},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()===X.CONNECTED?at(e._engine.getNaviInfoFromCache()):ut(P.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 ue(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,i;return ue(this,void 0,void 0,(function(){var o,s,a,u,c,l;return ce(this,(function(d){switch(d.label){case 0:return this._token=e,[4,Ur.getNetworkType()];case 1:return o=d.sent(),this._engine.setNetwork({status:!0,type:o},!0),s=!!this._pluginInstanseMap.RCCallPlus,[4,this._engine.connect(e,t,s,n)];case 2:return a=d.sent(),u=a.code,c=a.data,u!==P.SUCCESS?[2,{code:u}]:(1!==this._engine.getNaviInfoFromCache().type&&(l=Xe.getInfo(),null===(i=(r=this._engine).reportSDKInfo)||void 0===i||i.call(r,l)),[2,{code:u,userId:c}])}}))}))},e.prototype.disconnect=function(e,t){return ue(this,void 0,void 0,(function(){var n=this;return ce(this,(function(i){switch(i.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e,t)];case 1:return i.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){n.logger.error(r.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!==w.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,i){void 0===r&&(r=[]),void 0===i&&(i=!1),gt(r)&&r.length>0&&(this._registerMessageSearchPropsMapping[e]=r),this._engine.registerMessageType(e,t,n,r,i)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],r={};return n&&Tt(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var i=t[e];_t(i)&&(i>-Math.pow(2,64)&&i<Math.pow(2,64)&&Number.isInteger(i)||(r[e]=i))}})),Object.keys(r).length>0?{msg:JSON.stringify(r),code:P.SEARCH_PROPS_LIMIT_ERROR}:{code:P.SUCCESS}},e.prototype._handleExpansioResult=function(e,t){if(t){var n=Pt(e),r=n.isIllgalEx,i=n.isExKeyOrValLengthExceedLimit;return n.isExceedLimit||i?P.EXPANSION_LIMIT_EXCEET:r?P.INVALID_PARAMETER_MESSAGE_EXPANSION:void 0}},e.prototype.sendMessage=function(e,t,n,r,i){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==P.SUCCESS)return Promise.resolve({code:s,msg:a});if(e===w.SYSTEM&&n.messageType!==k.SYNC_READ_STATUS)return Promise.resolve({code:P.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(n.messageType===k.STREAM_MESSAGE)return Promise.resolve({code:P.MESSAGE_NOT_SUPPORT_SENDING});var u=n.canIncludeExpansion,c=void 0!==u&&u,l=n.expansion,d=this._handleExpansioResult(l,c);if(d)return Promise.resolve({code:d});var h=n.isMentioned,p=n.mentionedUserIdList,_=n.mentionedType;h&&[w.GROUP,w.ULTRA_GROUP].includes(e)?n.content.mentionedInfo=function(e,t,n){var r,i,o;return{userIdList:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.userIdList)||t,type:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.type)||n||G.ALL,mentionedContent:(null===(o=e.mentionedInfo)||void 0===o?void 0:o.mentionedContent)||""}}(n.content,p,_):delete n.content.mentionedInfo;var f=JSON.stringify(n.content);if(function(e){for(var t,n=0,r=0,i=e.length;r<i;r++)n+=(t=e.charCodeAt(r))<127?1:t<=2047?2:t<=65535?3:4;return n}(f)>Ue)return Promise.resolve({code:P.RC_MSG_CONTENT_EXCEED_LIMIT});if(e===w.ULTRA_GROUP)return n.channelId=this._channelIdConvert(e,n.channelId),this._engine.sendUltraMessage(t,n,r,i);var g=this.getNaviInfoFromCache();return(null==g?void 0:g.grpRRVer)&&n.messageType===k.READ_RECEIPT_RESPONSE?Promise.resolve({code:P.READ_RECEIPT_ERROR}):this._engine.sendMessage(e,t,n,r,i)},e.prototype.sendExpansionMessage=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,d,h;return ce(this,(function(p){switch(p.label){case 0:return t=e.channelId,n=e.conversationType,r=e.targetId,i=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,u=e.canIncludeExpansion,e.messageType===k.STREAM_MESSAGE&&((null==o?void 0:o.includes("RC_Ext_StreamMsgSummary"))||(null==s?void 0:s.RC_Ext_StreamMsgSummary))?[2,{code:P.STREAM_MESSAGE_EXPANSION_KEY_ERROR}]:u?(c=Pt(s),l=c.isIllgalEx,d=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||d?[2,Promise.resolve({code:P.EXPANSION_LIMIT_EXCEET})]:l?[2,Promise.resolve({code:P.INVALID_PARAMETER_MESSAGE_EXPANSION})]:(h={mid:i},s&&(h.put=s),o&&(h.del=o),a&&(h.removeAll=1),[4,this._engine.sendMessage(n,r,{content:h,messageType:k.EXPANSION_NOTIFY,channelId:t})])):[2,{code:P.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:p.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return ue(this,void 0,void 0,(function(){var r;return ce(this,(function(i){return r=this.getNaviInfoFromCache(),1!==((null==r?void 0:r.grpRRVer)||0)?[2,{code:P.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 ue(this,void 0,void 0,(function(){var r;return ce(this,(function(i){return r=this.getNaviInfoFromCache(),1!==((null==r?void 0:r.grpRRVer)||0)?[2,{code:P.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n||"")]}))}))},e.prototype.sendReadReceiptMessageV4=function(e,t,n){return ue(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 ue(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 ue(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 ue(this,void 0,void 0,(function(){return ce(this,(function(n){return[2,this._engine.updateConversationReadTime(e,t)]}))}))},e.prototype._destroy=function(){return ue(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(),Ur.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(r.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,r,i,o,s,a){var u={timestamp:n||0,count:r||20,order:i||0,channelId:o||""};if(e===w.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,i,o,s){var a={timestamp:n||0,count:r||20,order:i||0,channelId:o||""};if(e===w.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,i,o){return void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),this._engine.getContinuousMessages(e,t,n,r,i,o)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,r,i,o,s)},e.prototype.getConversationList=function(e,t,n,r,i){if(t===w.ULTRA_GROUP){var o=P.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:P[o]})}return this._engine.getConversationList(e||300,t,n,r,i||"")},e.prototype.getConversationsByPage=function(e,t,n,r,i){return this._engine.getConversationsByPage(e,t,n,r,i)},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===w.ULTRA_GROUP?Promise.resolve(P.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===w.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(w.ULTRA_GROUP)){var r=P.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:P[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[w.PRIVATE,w.GROUP,w.SYSTEM,w.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 ue(this,void 0,void 0,(function(){var i;return ce(this,(function(o){return i=this._channelIdConvert(e,r),[2,this._engine.setConversationNotificationLevel(e,t,n,i||"")]}))}))},e.prototype.batchSetConversationNotificationLevel=function(e,t){return this._engine.batchSetConversationNotificationLevel(e,t)},e.prototype.setConversationStatus=function(e,t,n,r,i,o){if(void 0===o&&(o=!0),e===w.ULTRA_GROUP&&void 0!==n)return Promise.resolve(P.METHOD_NOT_SUPPORT);var s=this._channelIdConvert(e,i),a=[{conversationType:e,targetId:t,isTop:n,notificationLevel:r?Ae(r):void 0,channelId:s||"",isUpdateTime:o}];return this._engine.batchSetConversationStatus(a)},e.prototype.setConversationToTop=function(e,t,n,r,i){return this._engine.setConversationToTop(e,t,n,r,i)},e.prototype.batchSetConversationToTop=function(e,t,n){return this._engine.batchSetConversationToTop(e,t,!!n)},e.prototype.saveConversationMessageDraft=function(e,t,n,r){var i=this._channelIdConvert(e,r);return this._engine.saveConversationMessageDraft(e,t,n,i||"")},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 ue(this,void 0,void 0,(function(){var n,i,o,s,a,u;return ce(this,(function(c){switch(c.label){case 0:return n=function(e,t){return ct.create(e).isObject("conversatino",t,!0).fail(P.INVALID_PARAMETER_CONVERSATION).isValueOf("conversationType",t.conversationType,w,!0).fail(P.INVALID_PARAMETER_CONVERSATION_TYPE).validate("targetId",t.targetId,Ut,!0).fail(P.INVALID_PARAMETER_TARGET_ID).validate("channelId",t.channelId,Ot).fail(P.INVALID_PARAMETER_CHANNEL_ID)}("recallMessage",e).isString("messageUId",t.messageUId,!0).fail(P.INVALID_PARAMETER_MESSAGE_UID).isInteger("sentTime",t.sentTime,!1).fail(P.INVALID_PARAMETER_TIMESTAMP).isBoolean("disableNotification",t.disableNotification).fail(P.INVALID_PARAMETER_DISABLE_NOTIFICATION).isObject("pushConfig",t.pushConfig).fail(P.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("disableUpdateLastMessage",t.disableUpdateLastMessage).fail(P.INVALID_DISABLE_UPDATE_LAST_MESSAGE).isLimitedTypedArray("directionalUserIdList",t.directionalUserIdList,300,Ut,!1,1).fail(P.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validatorConnected),n.isOk?(i=t.messageUId,o=this.logger.createTraceId(),this.logger.info(r.A_RECALL_MESSAGE_T,JSON.stringify({messageUId:i}),o),s=e.conversationType,a=e.channelId,e.channelId=this._channelIdConvert(s,a)||"",[4,this._engine.recallMsg(e,t)]):(this.logger.warn(r.A_RECALL_MESSAGE_E,n.errmsg()),[2,n.wipe()]);case 1:return u=c.sent(),this.logger.summary(r.A_RECALL_MESSAGE_R,u,o,{messageUId:i}),[2,u]}}))}))},e.prototype.deleteRemoteMessage=function(e,t,n,r){if(e===w.ULTRA_GROUP&&kt())return Promise.resolve(P.METHOD_NOT_SUPPORT);var i=this._channelIdConvert(e,r);return this._engine.deleteRemoteMessage(e,t,n,i||"")},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){var i=this._channelIdConvert(e,r);return this._engine.deleteRemoteMessageByTimestamp(e,t,n,i||"")},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 on(n)?sn(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(P.INVALID_PARAMETER_VALUE):Promise.resolve(P.INVALID_PARAMETER_KEY)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,o=r.value;if(!on(i))return Promise.resolve({code:P.INVALID_PARAMETER_KEY});if(!sn(o))return Promise.resolve({code:P.INVALID_PARAMETER_VALUE})}var s=se(se({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return on(n)?sn(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(P.INVALID_PARAMETER_VALUE):Promise.resolve(P.INVALID_PARAMETER_KEY)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return on(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(P.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(!on(r))return Promise.resolve({code:P.INVALID_PARAMETER_KEY})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return on(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(P.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,i,o){return ue(this,void 0,void 0,(function(){var s,a,u,c,l,d;return ce(this,(function(h){switch(h.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,i,o)];case 1:return c=h.sent(),l=c.code,d=c.data,l===P.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{qiniu:a,ossConfig:d.ossConfig||u}))]:[2,Promise.reject(l)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r){return ue(this,void 0,void 0,(function(){var i,o,s;return ce(this,(function(a){switch(a.label){case 0:return[4,this._engine.getFileUrl(e,n,t,r)];case 1:return i=a.sent(),o=i.code,s=i.data,o===P.SUCCESS?[2,Promise.resolve(s)]:[2,Promise.reject(o)]}}))}))},e.prototype.createTag=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return ue(this,void 0,void 0,(function(){var n,r=this;return ce(this,(function(i){return t.length>1e3?[2,Promise.resolve({code:P.CONVER_OUT_LIMIT_ERROR})]:(n=t.map((function(e){var t=e.conversationType,n=e.targetId,i=e.channelId;return{conversationType:t,targetId:n,channelId:r._channelIdConvert(t,i)}})),[2,this._engine.addTagForConversations(e,n)])}))}))},e.prototype.removeTagForConversations=function(e,t){return ue(this,void 0,void 0,(function(){var n,r=this;return ce(this,(function(i){return n=t.map((function(e){var t=e.conversationType,n=e.targetId,i=e.channelId;return{conversationType:t,targetId:n,channelId:r._channelIdConvert(t,i)}})),[2,this._engine.removeTagForConversations(e,n)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return ue(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 ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return ue(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 ue(this,void 0,void 0,(function(){var r;return ce(this,(function(i){return r=this._channelIdConvert(t.conversationType,t.channelId),t.channelId=r,[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return ue(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=[w.PRIVATE,w.CHATROOM,w.GROUP,w.SYSTEM,w.APP_PUBLIC_SERVICE,w.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t||"")},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[w.PRIVATE,w.CHATROOM,w.GROUP,w.SYSTEM,w.APP_PUBLIC_SERVICE,w.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!==w.ULTRA_GROUP){var t=P.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:t,msg:P[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,i=n.messageUId,o=n.channelId;return{sendTime:r,messageUId:i,channelId:t._channelIdConvert(e.conversationType,o)}}));return e.messages=n,this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return ue(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return ce(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,r=e.canIncludeExpansion,t!==w.ULTRA_GROUP?[2,{code:i=P.CONVERSATION_TYPE_NOT_SUPPORT,msg:P[i]}]:r?(o=Pt(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:P.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:P.INVALID_PARAMETER_MESSAGE_EXPANSION}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:P.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return ue(this,void 0,void 0,(function(){var t;return ce(this,(function(n){switch(n.label){case 0:return e.conversationType!==w.ULTRA_GROUP?[2,{code:t=P.CONVERSATION_TYPE_NOT_SUPPORT,msg:P[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(w.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupUnreadMentionedMessages(e)},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){var t=this._channelIdConvert(w.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,he([e],de(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 J.ONLINE_STATUS:return 1&n;case J.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:P.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.unSubscribeUser=function(e,t){return this._isEnableSubDriven(t)?this._engine.unSubscribeUser(e,t):Promise.resolve({code:P.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:P.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.getSubscribeUserStatus=function(e,t){return this._isEnableSubDriven(e)?this._engine.getSubscribeUserStatus(e,t):Promise.resolve({code:P.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 ue(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(r.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return ue(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return ue(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 ue(this,void 0,void 0,(function(){var r,i,o;return ce(this,(function(s){return r=this.checkSearchPropsMsg(n.messageType,n.content),i=r.code,o=r.msg,i!==P.SUCCESS?[2,Promise.resolve({code:i,msg:o})]:[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=""),ue(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 ue(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,i){return void 0===i&&(i=""),ue(this,void 0,void 0,(function(){return ce(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,!!r,i)]}))}))},e.prototype.batchClearMessagesByTimestamp=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.batchClearMessagesByTimestamp(e)]}))}))},e.prototype.batchClearRemoteHistoryMessages=function(e,t){return ue(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=""),ue(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 ue(this,void 0,void 0,(function(){var t,n,i,o=this;return ce(this,(function(s){switch(s.label){case 0:return t=ct.create("getLocalMessage").validate("messageId",e,(function(){return ht(e)||_t(e)}),!0).fail(P.INVALID_PARAMETER_MESSAGE_ID).result(),n=this.logger.createTraceId(),this.logger.info(r.A_GET_LOCAL_MESSAGE_T,JSON.stringify({messageId:e}),n),[4,t.next((function(){return o._engine.getMessage(e)}))];case 1:return i=s.sent(),this.logger.summary(r.A_GET_LOCAL_MESSAGE_R,i,n,{messageId:e}),[2,i]}}))}))},e.prototype.setMessageContent=function(e,t,n){return ue(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 ue(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 ue(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 ue(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 ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,this._engine.updateMessageReceiptStatus(e,t,n,r)]}))}))},e.prototype.setUserStatus=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return ue(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return ue(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=[]),ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n||"",r)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),ue(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,i,o,s){return void 0===s&&(s=""),ue(this,void 0,void 0,(function(){return ce(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,r,i,o,s)]}))}))},e.prototype.searchMessageByContentAndMessageType=function(e,t,n,r,i,o,s){return ue(this,void 0,void 0,(function(){return ce(this,(function(a){return[2,this._engine.searchMessageByContentAndMessageType(e,t,n,r,i,o,s)]}))}))},e.prototype.searchMessagesByUser=function(e,t,n,r,i,o){return void 0===i&&(i=5),void 0===o&&(o=""),ue(this,void 0,void 0,(function(){return ce(this,(function(s){return[2,this._engine.searchMessagesByUser(e,t,n,r,i,o)]}))}))},e.prototype.getMessagesByTimestamp=function(e,t,n,r){return ue(this,void 0,void 0,(function(){return ce(this,(function(i){return[2,this._engine.getMessagesByTimestamp(e,t,n,r)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){return ue(this,void 0,void 0,(function(){return ce(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,r,i)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,o,s){return ue(this,void 0,void 0,(function(){return ce(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,r,i,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(e,t,n,r)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){var n=this._channelIdConvert(w.ULTRA_GROUP,t);return this._engine.getUltraGroupDefaultNotificationLevel(e,n||"")},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){var r=this._channelIdConvert(w.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,i,o){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return ue(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:m.ACCEPT})},e.prototype.refuseGroupInvite=function(e,t,n){return this._engine.memberInviteResponse({groupId:e,inviterId:t,optType:0,optResult:m.REFUSE,reason:n})},e.prototype.acceptGroupApplication=function(e,t,n){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:m.ACCEPT})},e.prototype.refuseGroupApplication=function(e,t,n,r){return this._engine.memberInviteResponse({groupId:e,joinUserId:t,inviterId:n,optType:1,optResult:m.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(T.ADD,e,t)},e.prototype.removeGroupFollows=function(e,t){return this._engine.setGroupFollows(T.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 ct.create("setNotificationQuietHoursWithSetting").isObject("opts",e,!0).isString("timezone",e.timezone).fail(P.BIZ_ERROR_INVALID_PARAMETER).validate("startTime",e.startTime,(function(e){return/^\d{2}(:\d{2}){2}$/.test(e)}),!0).fail(P.INVALID_PARAMETER_TIMESTRING).isLimitedNumber("spanMinutes",e.spanMinutes,1,1439,!0).fail(P.INVALID_PARAMETER_SPAN_MINUTES).isValueOf("level",e.level,ye,!0).fail(P.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()},e.prototype.getStatsUrlList=function(){return this._engine.getStatsUrlList()},ae([Dp],e.prototype,"updateMyUserProfile",null),ae([Dp],e.prototype,"getUserProfiles",null),ae([Dp],e.prototype,"getMyUserProfile",null),ae([Dp],e.prototype,"updateMyUserProfileVisibility",null),ae([Dp],e.prototype,"getMyUserProfileVisibility",null),ae([Dp],e.prototype,"searchUserProfileByUniqueId",null),ae([Dp],e.prototype,"createGroup",null),ae([Dp],e.prototype,"updateGroupInfo",null),ae([Dp],e.prototype,"getGroupsInfo",null),ae([Dp],e.prototype,"kickGroupMembers",null),ae([Dp],e.prototype,"quitGroup",null),ae([Dp],e.prototype,"dismissGroup",null),ae([Dp],e.prototype,"transferGroupOwner",null),ae([Dp],e.prototype,"setGroupManagers",null),ae([Dp],e.prototype,"getGroupMembersByRole",null),ae([Dp],e.prototype,"getGroupMembers",null),ae([Dp],e.prototype,"setGroupMemberInfo",null),ae([Dp],e.prototype,"searchGroupMembers",null),ae([Dp],e.prototype,"joinGroup",null),ae([Dp],e.prototype,"inviteUsersToGroup",null),ae([Dp],e.prototype,"acceptGroupInvite",null),ae([Dp],e.prototype,"refuseGroupInvite",null),ae([Dp],e.prototype,"acceptGroupApplication",null),ae([Dp],e.prototype,"refuseGroupApplication",null),ae([Dp],e.prototype,"getGroupApplications",null),ae([Dp],e.prototype,"getJoinedGroupsByRole",null),ae([Dp],e.prototype,"searchJoinedGroups",null),ae([Dp],e.prototype,"getJoinedGroups",null),ae([Dp],e.prototype,"setGroupRemark",null),ae([Dp],e.prototype,"addGroupFollows",null),ae([Dp],e.prototype,"removeGroupFollows",null),ae([Dp],e.prototype,"getGroupFollows",null),ae([Dp],e.prototype,"addFriend",null),ae([Dp],e.prototype,"deleteFriends",null),ae([Dp],e.prototype,"acceptFriendApplication",null),ae([Dp],e.prototype,"refuseFriendApplication",null),ae([Dp],e.prototype,"setFriendInfo",null),ae([Dp],e.prototype,"checkFriends",null),ae([Dp],e.prototype,"getFriends",null),ae([Dp],e.prototype,"getFriendApplications",null),ae([Dp],e.prototype,"getFriendsInfo",null),ae([Dp],e.prototype,"searchFriendsInfo",null),ae([Dp],e.prototype,"setFriendAddPermission",null),ae([Dp],e.prototype,"getFriendAddPermission",null),ae([Vp],e.prototype,"getRealtimeConversations",null),ae([Vp],e.prototype,"getRealtimeConTotalUnreadCount",null),ae([Vp],e.prototype,"clearRealtimeConUnreadCount",null),ae([Vp],e.prototype,"removeRealtimeConversations",null),ae([Vp],e.prototype,"getRealtimeConUnreadCounts",null),e}();export{Gp as APIContext,mu as AppStorage,pn as AreaCode,uu as AssertRules,ou as BasicEngine,yn as BasicLogger,N as ChatroomEntryType,M as ChatroomSyncStatusReason,U as ChatroomUserChangeType,L as ChrmMemBanType,b as ChrmMemOperateType,O as ChrmSyncStatus,Es as Codec,ns as ConnectionStatus,w as ConversationType,i as DirectionType,P as ErrorCode,gs as EventEmitter,V as FileType,s as FriendAddPermission,c as FriendApplicationStatus,u as FriendApplicationType,a as FriendRelationType,A as GroupApplicationDirection,R as GroupApplicationStatus,C as GroupApplicationType,f as GroupInviteHandlePermission,h as GroupJoinPermission,_ as GroupMemberInfoEditPermission,E as GroupMemberRole,I as GroupOperation,p as GroupOperationPermission,y as GroupOperationRole,m as GroupOperationStatus,T as GroupOperationType,Ce as HttpMethod,me as InterruptionLevel,In as LogL,es as LogLevel,ts as LogSource,r as LogTagId,Ue as MAX_MESSAGE_CONTENT_BYTES,Pe as MAX_UPLOAD_FILE_SIZE,G as MentionedType,ee as MessageBlockSourceType,$ as MessageBlockType,te as MessageDirection,k as MessageType,ie as NotificationLevel,oe as NotificationStatus,W as OnlineStatus,Q as OperateStatus,Pr as PBCodec,j as PlatformInfo,cu as PluginContext,ne as PushImportanceHonor,ye as PushNotificationQuietHoursLevel,o as QueryFriendsDirectionType,X as RCConnectionStatus,st as RCResult,ss as RTCApiType,us as RTCJoinType,rs as RTCMode,lu as RTCPluginContext,fe as ReceivedStatus,Le as SEND_MESSAGE_TYPE_OPTION,K as SentStatus,Os as StreamMessageResponseEventType,z as SubscribeOperationType,J as SubscribeType,ot as SuspendablePromise,we as UPLOAD_FILE_CHUNK_SIZE,$e as UUId,B as UltraGroupChannelChangeType,F as UltraGroupChannelType,n as UploadMethod,Z as UserProfileVisibility,ct as Validator,Eu as ValidatorManage,Xe as VersionManage,fu as assert,ut as fail,ln as fixUrlProtocol,Dt as forEach,Cu as getUUID,Au as getUUID22,fn as httpRequest,gt as isArray,pt as isBoolean,Rt as isFunction,St as isHttpUrl,ft as isInteger,Iu as isLimitedArray,Et as isLimitedString,yt as isNull,_t as isNumber,Tt as isObject,ht as isString,mt as isUndefined,vu as isValidConversation,At as isValidConversationType,Mt as isValidEnum,bt as isValidFileType,Lt as isValidGroupId,Nt as isValidNotificationLevel,Ut as isValidTargetId,fs as logger,Vt as map,vt as notEmptyArray,Ct as notEmptyObject,It as notEmptyString,at as ok,Ur as runtime,Ne as transformNotificationLevel,Ae as transformNotificationStatus,Ht as transformReceivedStatusFlag,xt as transformReceivedStatusInfo,kt as usingCppEngine,gu as validate};
|