@rongcloud/engine 5.9.3 → 5.9.4

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.esm.js CHANGED
@@ -1 +1 @@
1
- var t;!function(t){t[t.READ=1]="READ",t[t.LISTENED=2]="LISTENED",t[t.DOWNLOADED=4]="DOWNLOADED",t[t.RETRIEVED=8]="RETRIEVED",t[t.UNREAD=0]="UNREAD"}(t||(t={}));var e,n=t,i=function(t){return e||(e={set:function(e,n){t.localStorage.setItem(e,JSON.stringify(n))},get:function(e){var n;try{n=JSON.parse(t.localStorage.getItem(e))}catch(t){n=null}return n},remove:function(e){return t.localStorage.removeItem(e)},getKeys:function(){var e=[];for(var n in t.localStorage)e.push(n);return e}}),e},r=function(){function t(t){this._caches={},t&&(this._caches=t)}return t.prototype.set=function(t,e){this._caches[t]=e},t.prototype.remove=function(t){var e=this.get(t);return delete this._caches[t],e},t.prototype.get=function(t){return this._caches[t]},t.prototype.getKeys=function(){var t=[];for(var e in this._caches)t.push(e);return t},t}(),o=function(){function t(t,e){var n;this._rootStorage=i(t);var o=this._rootStorage.get(e)||{};this._cache=new r(((n={})[e]=o,n)),this._storageKey=e}return t.prototype._get=function(){var t=this._storageKey;return this._cache.get(t)||{}},t.prototype._set=function(t){var e=this._storageKey;t=t||{},this._cache.set(e,t),this._rootStorage.set(e,t)},t.prototype.set=function(t,e){var n=this._get();n[t]=e,this._set(n)},t.prototype.remove=function(t){var e=this._get();delete e[t],this._set(e)},t.prototype.clear=function(){var t=this._storageKey;this._rootStorage.remove(t),this._cache.remove(t)},t.prototype.get=function(t){return this._get()[t]},t.prototype.getKeys=function(){var t=this._get(),e=[];for(var n in t)e.push(n);return e},t.prototype.getValues=function(){return this._get()||{}},t.prototype.update=function(t){void 0===t&&(t={});var e=this._storageKey;this._cache.set(e,t),this._rootStorage.set(e,t)},t}(),s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},s(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var c=function(){return c=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},c.apply(this,arguments)};function u(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))}function l(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var d,p=function(t){function e(e){return t.call(this,"TODO => ".concat(e))||this}return a(e,t),e}(Error),f=function(t){return new p(t)},_=function(t){for(var e=0,n=0,i=t.length;n<i;n++)e+=t.charCodeAt(n)<=65535?2:4;return e},E=function(t){for(var e,n=0,i=0,r=t.length;i<r;i++)n+=(e=t.charCodeAt(i))<127?1:e<=2047?2:e<=65535?3:4;return n},v=function(t,e){if(t=t.replace(/\?$/,""),!e)return t;var n=Object.keys(e).map((function(t){return"".concat(t,"=").concat(e[t])})).filter((function(t){return!!t}));return n.length?[t,n.join("&")].join("?"):t},T=72e5,C=6e4,m=1e4,y=5e3,I=3e4,R=15e3,S=15e3,O=2e3,N=131072,M=18e4,L=32,U=4096,A="cd4936151214ce45dc1d12673a59d94c",b="51ad078e5eb17a91",w={"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},"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:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC: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: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}},P={"RC:DizNtf":{isCounted:!1,isPersited:!1}},D=["RC:TypSts","RC:InterceptMsg","RC:RL"],V=20971520,G=1e5,B=3e3,k=1e3,x="5.9.3",F=x.replace(/-.+$/,""),H=5368709120,q=10485760,K=18e5,Y="rongcloudsystem",j={NAVI_KEY:function(t){return"navi_".concat(t)},CONVER_STATE_PULL_TIME_KEY:function(t,e){return"RCV4-con-s-".concat(t,"-").concat(e)},OLD_CONVER_STATE_KEY:function(t,e){return"RCV4-con-".concat(t,"-").concat(e)},CONVER_STATE_KEY:function(t,e){return"RCV4-CONVER-".concat(t,"-").concat(e)},ULTRA_GROUP_STATE_KEY:function(t,e){return"RCV4-ultragroupconversation-".concat(t,"-").concat(e)},OUTBOX_TIME_KEY:function(t,e){return"outbox_".concat(t,"_").concat(e)},INBOX_TIME_KEY:function(t,e){return"inbox_".concat(t,"_").concat(e)},BROADCASTBOX_TIME_KEY:function(t,e){return"broadcastbox_".concat(t,"_").concat(e)},SEND_MSG_KEY:function(t,e){return"send_msg_".concat(t,"_").concat(e)},USER_SETTING_TIME_KEY:function(t,e){return"us-s-".concat(t,"-").concat(e)},TAG_STATE_KEY:function(t,e){return"tag-".concat(t,"-").concat(e)},USER_SETTING_KEY:function(t,e){return"RC-us-".concat(t,"-").concat(e)},STATIC_CONFIG_KEY:function(t){return"rc-static-config-".concat(t)},CLOUD_CONTROL_KEY:function(t){return"cloud-control-".concat(t)}};!function(t){t[t.IMAGE=1]="IMAGE",t[t.AUDIO=2]="AUDIO",t[t.VIDEO=3]="VIDEO",t[t.FILE=4]="FILE",t[t.SIGHT=5]="SIGHT",t[t.COMBINE_HTML=6]="COMBINE_HTML"}(d||(d={}));var W,Q=d;!function(t){t[t.SEND=1]="SEND",t[t.RECEIVE=2]="RECEIVE"}(W||(W={}));var J,X=W;!function(t){t[t.TIMEOUT=-1]="TIMEOUT",t[t.SUCCESS=0]="SUCCESS",t[t.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",t[t.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",t[t.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",t[t.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",t[t.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",t[t.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",t[t.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",t[t.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",t[t.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",t[t.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",t[t.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",t[t.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",t[t.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",t[t.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",t[t.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",t[t.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",t[t.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",t[t.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",t[t.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",t[t.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",t[t.NOT_IN_GROUP=22406]="NOT_IN_GROUP",t[t.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",t[t.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",t[t.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",t[t.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",t[t.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",t[t.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",t[t.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",t[t.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",t[t.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",t[t.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",t[t.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",t[t.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",t[t.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",t[t.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",t[t.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",t[t.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",t[t.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",t[t.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",t[t.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",t[t.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",t[t.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",t[t.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",t[t.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",t[t.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",t[t.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",t[t.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",t[t.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",t[t.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",t[t.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",t[t.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",t[t.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",t[t.RECALL_MESSAGE=25101]="RECALL_MESSAGE",t[t.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",t[t.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",t[t.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",t[t.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",t[t.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",t[t.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",t[t.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",t[t.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",t[t.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",t[t.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",t[t.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",t[t.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",t[t.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",t[t.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",t[t.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",t[t.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",t[t.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",t[t.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",t[t.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",t[t.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",t[t.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",t[t.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",t[t.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",t[t.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",t[t.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",t[t.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",t[t.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",t[t.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",t[t.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",t[t.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",t[t.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",t[t.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",t[t.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",t[t.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",t[t.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",t[t.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",t[t.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",t[t.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",t[t.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",t[t.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",t[t.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",t[t.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",t[t.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",t[t.RC_OTP_USED=31027]="RC_OTP_USED",t[t.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",t[t.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",t[t.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",t[t.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",t[t.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",t[t.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",t[t.RC_TCP_RESET=32054]="RC_TCP_RESET",t[t.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",t[t.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",t[t.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",t[t.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",t[t.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",t[t.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",t[t.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",t[t.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",t[t.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",t[t.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",t[t.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",t[t.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",t[t.TAG_EXISTS=33101]="TAG_EXISTS",t[t.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",t[t.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",t[t.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",t[t.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",t[t.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",t[t.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",t[t.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",t[t.UPLOAD_FAIL=34011]="UPLOAD_FAIL",t[t.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",t[t.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",t[t.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",t[t.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",t[t.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",t[t.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",t[t.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",t[t.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",t[t.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",t[t.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",t[t.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",t[t.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",t[t.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",t[t.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",t[t.READ_RECEIPT_V4_NOT_SUPPORT=34292]="READ_RECEIPT_V4_NOT_SUPPORT",t[t.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34293]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",t[t.NOT_SUPPORT=35004]="NOT_SUPPORT",t[t.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",t[t.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",t[t.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",t[t.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",t[t.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",t[t.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",t[t.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",t[t.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",t[t.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",t[t.UNKNOWN=-2]="UNKNOWN",t[t.PARAMETER_ERROR=-3]="PARAMETER_ERROR",t[t.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",t[t.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",t[t.CANCEL=1]="CANCEL",t[t.REJECT=2]="REJECT",t[t.HANGUP=3]="HANGUP",t[t.BUSYLINE=4]="BUSYLINE",t[t.NO_RESPONSE=5]="NO_RESPONSE",t[t.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",t[t.NETWORK_ERROR=7]="NETWORK_ERROR",t[t.REMOTE_CANCEL=11]="REMOTE_CANCEL",t[t.REMOTE_REJECT=12]="REMOTE_REJECT",t[t.REMOTE_HANGUP=13]="REMOTE_HANGUP",t[t.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",t[t.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",t[t.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",t[t.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",t[t.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",t[t.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",t[t.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",t[t.INVITE_DICUSSION=21409]="INVITE_DICUSSION",t[t.HAVNODEVICEID=24001]="HAVNODEVICEID",t[t.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",t[t.FEILD=24009]="FEILD",t[t.VOIPISNULL=24013]="VOIPISNULL",t[t.NOENGINETYPE=24010]="NOENGINETYPE",t[t.NULLCHANNELNAME=24011]="NULLCHANNELNAME",t[t.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",t[t.NOVOIP=24014]="NOVOIP",t[t.INTERNALERRROR=24015]="INTERNALERRROR",t[t.VOIPCLOSE=24016]="VOIPCLOSE",t[t.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",t[t.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",t[t.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",t[t.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",t[t.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",t[t.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",t[t.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",t[t.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",t[t.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",t[t.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",t[t.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",t[t.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",t[t.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",t[t.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",t[t.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",t[t.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",t[t.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",t[t.COOKIE_ENABLE=51001]="COOKIE_ENABLE",t[t.SUB_PROCESS_EXIT=34289]="SUB_PROCESS_EXIT",t[t.ADDON_NOT_EXIST=34290]="ADDON_NOT_EXIST"}(J||(J={}));var Z,z=J;!function(t){t[t.NONE=0]="NONE",t[t.PRIVATE=1]="PRIVATE",t[t.DISCUSSION=2]="DISCUSSION",t[t.GROUP=3]="GROUP",t[t.CHATROOM=4]="CHATROOM",t[t.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",t[t.SYSTEM=6]="SYSTEM",t[t.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",t[t.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",t[t.ULTRA_GROUP=10]="ULTRA_GROUP",t[t.RTC_ROOM=12]="RTC_ROOM"}(Z||(Z={}));var $,tt=Z;!function(t){t[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",t[t.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",t[t.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",t[t.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",t[t.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",t[t.BLOCKED=9]="BLOCKED",t[t.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",t[t.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",t[t.REDIRECT=14]="REDIRECT",t[t.USER_LOGOUT=19]="USER_LOGOUT",t[t.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",t[t.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",t[t.ULTRALIMIT=1101]="ULTRALIMIT",t[t.REQUEST_NAVI=201]="REQUEST_NAVI",t[t.RESPONSE_NAVI=202]="RESPONSE_NAVI",t[t.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",t[t.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",t[t.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",t[t.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}($||($={}));var et,nt=$;!function(t){t.TextMessage="RC:TxtMsg",t.VOICE="RC:VcMsg",t.HQ_VOICE="RC:HQVCMsg",t.IMAGE="RC:ImgMsg",t.GIF="RC:GIFMsg",t.RICH_CONTENT="RC:ImgTextMsg",t.LOCATION="RC:LBSMsg",t.FILE="RC:FileMsg",t.SIGHT="RC:SightMsg",t.COMBINE="RC:CombineMsg",t.COMBINE_V2="RC:CombineV2Msg",t.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",t.LOG_COMMAND="RC:LogCmdMsg",t.EXPANSION_NOTIFY="RC:MsgExMsg",t.REFERENCE="RC:ReferenceMsg",t.RECALL="RC:RcCmd",t.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",t.READ_RECEIPT="RC:ReadNtf",t.READ_RECEIPT_REQUEST="RC:RRReqMsg",t.READ_RECEIPT_RESPONSE="RC:RRRspMsg",t.SYNC_READ_STATUS="RC:SRSMsg",t.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",t.READ_STATE="RC:RSMsg",t.DELIVERED="RC:Delivered",t.DELIVERED_MSG="RC:DRMsg",t.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",t.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",t.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",t.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",t.TYPING_STATUS="RC:TypSts",t.INTERCEPT="RC:InterceptMsg",t.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg"}(et||(et={}));var it,rt=et;!function(t){t[t.OPEN=1]="OPEN",t[t.CLOSE=2]="CLOSE"}(it||(it={}));var ot,st=it;!function(t){t[t.ALL_MESSAGE=-1]="ALL_MESSAGE",t[t.NOT_SET=0]="NOT_SET",t[t.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",t[t.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",t[t.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",t[t.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(ot||(ot={}));var at,ct=ot;!function(t){t[t.ALL=1]="ALL",t[t.SINGAL=2]="SINGAL"}(at||(at={}));var ut,lt=at;!function(t){t[t.QINIU=1]="QINIU",t[t.ALI=2]="ALI",t[t.AWS=3]="AWS",t[t.STC=4]="STC",t[t.MINIO=5]="MINIO"}(ut||(ut={}));var ht,dt=ut;!function(t){t[t.UPDATE=1]="UPDATE",t[t.DELETE=2]="DELETE"}(ht||(ht={}));var pt,gt,ft,_t,Et,vt=ht;!function(t){t[t.LOG=0]="LOG",t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR",t[t.FATAL=4]="FATAL",t[t.STATISTICS=6]="STATISTICS",t[t.NONE=1e3]="NONE"}(pt||(pt={})),function(t){t.IM="IM",t.RTC="RTC"}(gt||(gt={})),function(t){t.L_IMSDK_VER_O="L-imsdk_ver-O",t.A_INIT_O="A-init-O",t.A_INIT_REPEAT_O="A_INIT_REPEAT_O",t.L_INIT_O="L-init-O",t.A_DESTROY_O="A_DESTROY_O",t.L_DESTROY_O="L_DESTROY_O",t.A_CONNECT_T="A-connect-T",t.A_CONNECT_R="A-connect-R",t.A_CONNECT_S="A-connect-S",t.A_DISCONNECT_O="A-disconnect-O",t.A_RECONNECT_T="A-reconnect-T",t.A_RECONNECT_R="A_RECONNECT_R",t.L_CONNECT_T="L-connect-T",t.L_CONNECT_R="L-connect-R",t.L_CONNECT_S="L-connect-S",t.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",t.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",t.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",t.A_MSG_LISTENER_E="A-MSG_LISTENER-E",t.O="L-original-O",t.T="L-TEST-O",t.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",t.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",t.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",t.A_SEND_MSG_T="A-send_msg-T",t.A_SEND_MSG_R="A-send_msg-R",t.L_SEND_MSG_T="L-send_msg-T",t.L_SEND_MSG_R="L-send_msg-R",t.L_PULL_MSG_T="L-pull_msg-T",t.L_PULL_MSG_R="L-pull_msg-R",t.L_PULL_MSG_O="L-pull_msg-O",t.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",t.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",t.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",t.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",t.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",t.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",t.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",t.L_RECV_S_MSG_O="L-recv_s_msg-O",t.A_DELETE_MESSAGES_S="A-delete_messages-S",t.P_DELETE_MSG_S="P-delete_msg-S",t.L_PULL_CONVERSATION_S="L-pull_conversation-S",t.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",t.A_REGTYP_O="A-regtyp-O",t.P_REGTYP_E="P-regtype-E",t.L_GET_NAVI_T="L-get_navi-T",t.L_GET_NAVI_R="L-get_navi-R",t.L_REQUEST_T="L-request-T",t.L_REQUEST_R="L-request-R",t.L_PARSE_NAVI_E="L-parse_navi-E",t.L_ENV_S="L-Env-S",t.L_GET_INDEX_NAVI_S="L-get_index_navi-S",t.A_JOIN_CHATROOM_T="A-join_chatroom-T",t.A_JOIN_CHATROOM_R="A-join_chatroom-R",t.L_JOIN_CHATROOM_T="L-join_chatroom-T",t.L_JOIN_CHATROOM_R="L-join_chatroom-R",t.A_QUIT_CHATROOM_T="A-quit_chatroom-T",t.A_QUIT_CHATROOM_R="A-quit_chatroom-R",t.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",t.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",t.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",t.L_MEDIA_S="L-media-S",t.L_MEDIA_UPLOAD_T="L-media_upload-T",t.L_MEDIA_UPLOAD_R="L-media_upload-R",t.G_UPLOAD_LOG_S="G-upload_log-S",t.G_REPORT_LOG_S="G-report_log-S",t.G_UPLOAD_LOG_E="G-upload_log-E",t.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",t.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",t.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",t.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",t.A_GET_HISTORY_MSG_T="A-get_history_msg-T",t.A_GET_HISTORY_MSG_R="A-get_history_msg-R",t.L_GET_HISTORY_MSG_T="L-get_history_msg-T",t.L_GET_HISTORY_MSG_R="L-get_history_msg-R",t.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",t.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",t.A_CALLBACK_O="A-callback-O",t.A_CALLBACK_E="A-callback-E",t.L_CALLBACK_E="L-callback-E",t.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",t.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",t.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",t.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",t.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",t.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",t.A_SYNC_READ_STATUS_T="A-sync_read_status-T",t.A_SYNC_READ_STATUS_R="A-sync_read_status-R",t.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",t.L_PB_ENCODE_E="L-pb-encode-E",t.L_PB_DECODE_E="L-pb-decode-E",t.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",t.L_REPORT_FULL_LOG_O="L-report_full_log-O",t.L_REPORT_FULL_LOG_T="L-report_full_log-T",t.L_REPORT_FULL_LOG_R="L-report_full_log-R",t.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",t.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",t.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",t.L_LOGDB_CLOSED_S="L-logDB_closed-S",t.L_LOGDB_ERROR_E="L-logDB_error-S",t.L_LOGDB_ABORT_S="L-logDB_abort-S",t.L_REALTIME_LOG_R="L_REALTIME_LOG_R",t.L_REALTIME_LOG_O="L_REALTIME_LOG_O",t.L_REALTIME_LOG_T="L_REALTIME_LOG_T",t.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",t.L_RECV_RMTP_O="L_RECV_RMTP_O",t.L_RECV_RMTP_E="L_RECV_RMTP_E",t.L_RECV_S_NTF_O="L-recv_s_ntf_O",t.L_VER_REPORT_T="L-VER_REPORT-T",t.L_VER_REPORT_R="L-VER_REPORT-R",t.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",t.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",t.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",t.A_REMOVE_PROXY_O="A-remove_proxy-O",t.A_SET_PROXY_O="A-set_proxy-O",t.A_TEST_PROXY_O="A-test_proxy-O",t.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",t.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",t.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",t.L_GET_STATIC_CONF_T="L-get_static_conf-T",t.L_GET_STATIC_CONF_R="L-get_static_conf-R",t.L_GET_STATIC_CONF_E="L-get_static_conf-E",t.L_CLOUD_DISABLED="L-cloud_disabled",t.L_CLOUD_EXPIRE="L-cloud_expire",t.L_CLOUD_OVERCLOCK="L-cloud_overclock",t.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",t.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",t.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",t.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",t.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",t.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",t.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O"}(ft||(ft={})),function(t){t.IM_NAVI="IM-stats_navi-S",t.IM_WEBSOCKET="IM-stats_websocket-S",t.IM_CONNECTION_DURATION="IM-stats_con_dur-S",t.IM_CMP="IM-stats_cmp-S",t.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",t.IM_STATS_CS="IM-stats_cs-S",t.IM_NETWORK_CHANGE="IM-stats_network_change-S",t.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",t.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",t.IM_MSG_SEND="IM-msg_send-S",t.IM_MSG_RECEIVE="IM-msg_receive-S"}(_t||(_t={})),function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(Et||(Et={}));var Tt,Ct,mt=Et;!function(t){t[t.GLOBAL=1]="GLOBAL",t[t.CUSTOM=2]="CUSTOM",t[t.THIRD_PARTY=3]="THIRD_PARTY"}(Tt||(Tt={})),function(t){t[t.MSG_ORIGINAL=0]="MSG_ORIGINAL",t[t.MSG_EXPANSION=1]="MSG_EXPANSION",t[t.MSG_MODIFY=2]="MSG_MODIFY"}(Ct||(Ct={}));var yt,It=Tt;!function(t){t[t.typing=0]="typing"}(yt||(yt={}));var Rt,St,Ot=yt;!function(t){t[t.SENDING=10]="SENDING",t[t.FAILED=20]="FAILED",t[t.SENT=30]="SENT",t[t.RECEIVED=40]="RECEIVED",t[t.READ=50]="READ",t[t.DESTROYED=60]="DESTROYED"}(Rt||(Rt={})),function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(St||(St={}));var Nt,Mt=St;!function(t){t[t.Deblock=0]="Deblock",t[t.Blocked=1]="Blocked"}(Nt||(Nt={}));var Lt,Ut=Nt;!function(t){t[t.UnmuteUsers=0]="UnmuteUsers",t[t.MuteUsers=1]="MuteUsers",t[t.UnmuteAll=2]="UnmuteAll",t[t.MuteAll=3]="MuteAll",t[t.RemoveWhitelist=4]="RemoveWhitelist",t[t.AddWhitelist=5]="AddWhitelist",t[t.UnmuteGloble=6]="UnmuteGloble",t[t.MuteGloble=7]="MuteGloble"}(Lt||(Lt={}));var At,bt=Lt;!function(t){t[t.LeaveOnMyOwn=0]="LeaveOnMyOwn",t[t.OtherDeviceLogin=1]="OtherDeviceLogin"}(At||(At={}));var wt,Pt,Dt,Vt,Gt,Bt,kt,xt,Ft,Ht,qt,Kt,Yt,jt,Wt,Qt,Jt,Xt,Zt,zt=At;!function(t){t[t.RMTP=1]="RMTP",t[t.TLS=2]="TLS",t[t.RPP=3]="RPP",t[t.QUIC=4]="QUIC",t[t.WS=5]="WS",t[t.WSS=6]="WSS",t[t.HTTP=11]="HTTP",t[t.HTTPS=12]="HTTPS"}(wt||(wt={})),function(t){t.PASSIVE="passive",t.ACTIVE="active",t.TIME_SENSITIVE="time-sensitive",t.CRITICAL="critical"}(Pt||(Pt={})),function(t){t.NORMAL="NORMAL",t.LOW="LOW"}(Dt||(Dt={})),function(t){t.NAVI="rc-navi",t.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(Vt||(Vt={})),function(t){t[t.PUBLIC=0]="PUBLIC",t[t.PRIVATE=1]="PRIVATE"}(Gt||(Gt={})),function(t){t[t.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",t[t.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",t[t.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Bt||(Bt={})),function(t){t[t.MSG_EXPANSION=1]="MSG_EXPANSION",t[t.MSG_MODIFY=2]="MSG_MODIFY",t[t.MSG_RECALL=3]="MSG_RECALL",t[t.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",t[t.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}(kt||(kt={})),function(t){t[t.CHANNEL_DELETE=1]="CHANNEL_DELETE",t[t.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",t[t.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",t[t.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",t[t.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",t[t.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(xt||(xt={})),function(t){t[t.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",t[t.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",t[t.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",t[t.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",t[t.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(Ft||(Ft={})),function(t){t[t.NOT_MENTIONED=0]="NOT_MENTIONED",t[t.ALL=1]="ALL",t[t.ME=2]="ME"}(Ht||(Ht={})),function(t){t[t.PRIVATE=1]="PRIVATE",t[t.OPEN=0]="OPEN"}(qt||(qt={})),function(t){t[t.NAVI=1]="NAVI",t[t.TCP=2]="TCP",t[t.WS=3]="WS"}(Kt||(Kt={})),function(t){t[t.REQUEST=0]="REQUEST",t[t.LOCAL=1]="LOCAL"}(Yt||(Yt={})),function(t){t[t.CURRENT=2]="CURRENT"}(jt||(jt={})),function(t){t[t.CONNECT=0]="CONNECT",t[t.RECONNECT=1]="RECONNECT"}(Wt||(Wt={})),function(t){t[t.CONNECT=0]="CONNECT",t[t.RECONNECT=1]="RECONNECT",t[t.REDIRECTED=3]="REDIRECTED",t[t.TIMEOUT=4]="TIMEOUT"}(Qt||(Qt={})),function(t){t[t.RTC=0]="RTC",t[t.LIVE=2]="LIVE",t[t.SIP=4]="SIP",t[t.CALL=5]="CALL",t[t.MEETING=6]="MEETING",t[t.CROSS_MUTI=7]="CROSS_MUTI",t[t.CROSS_LIVE=8]="CROSS_LIVE"}(Jt||(Jt={})),function(t){t[t.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",t[t.AUDIO=1]="AUDIO"}(Xt||(Xt={})),function(t){t[t.ANCHOR=1]="ANCHOR",t[t.AUDIENCE=2]="AUDIENCE"}(Zt||(Zt={}));var $t,te,ee,ne={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};!function(t){t[t.ROOM=1]="ROOM",t[t.PERSON=2]="PERSON"}($t||($t={})),function(t){t[t.AnchorToViewer=1]="AnchorToViewer",t[t.ViewerToAnchor=2]="ViewerToAnchor"}(te||(te={})),function(t){t[t.KICK=0]="KICK",t[t.REFUSE=1]="REFUSE",t[t.COEXIST=2]="COEXIST"}(ee||(ee={}));var ie=function(t){return"string"==typeof t},re=function(t){return"boolean"==typeof t},oe=function(t){return"number"==typeof t&&!Number.isNaN(t)},se=function(t){return-1!==Object.prototype.toString.call(t).indexOf("Array")},ae=function(t){return"[object ArrayBuffer]"===Object.prototype.toString.call(t)},ce=function(t){return ie(t)&&t.length>0},ue=function(t){return se(t)&&t.length>0},le=function(t){return"[object Object]"===Object.prototype.toString.call(t)},he=function(t){return"[object Function]"===Object.prototype.toString.call(t)},de=function(t){return void 0===t||"[object Undefined]"===Object.prototype.toString.call(t)},pe=function(t){return"[object Null]"===Object.prototype.toString.call(t)},ge=function(t){return ie(t)&&/https?:\/\//.test(t)},fe=function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1},_e=function(t){return oe(t)&&Object.prototype.hasOwnProperty.call(tt,t)},Ee=function(t){return oe(t)&&Object.prototype.hasOwnProperty.call(ct,t)},ve=function(t){var e=!1;return ie(t)&&!/_/g.test(t)&&t.length<=20&&(e=!0),e},Te=function(t){return[tt.PRIVATE,tt.GROUP,tt.SYSTEM,tt.PUBLIC_SERVICE,tt.APP_PUBLIC_SERVICE].includes(t)},Ce=function(t){return oe(t)&&Object.prototype.hasOwnProperty.call(Q,t)},me=function(t){var e=!1,n=!1,i=!1;if(le(t)){var r=Object.keys(t).length;for(var o in e=r>20,t)if(n||(n=ie(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!i){var s=t[o];i=o.length>32||s.length>4096}}return{isExceedLimit:e,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}},ye=function(){function t(){this._map={}}return t.prototype.on=function(t,e,n){var i=this._map[t]||(this._map[t]=[]);i.some((function(t){return t.listener===e&&t.target===n}))||i.push({listener:e,target:n})},t.prototype.once=function(t,e,n){var i=this._map[t]||(this._map[t]=[]);i.some((function(t){return t.listener===e&&t.target===n}))||i.push({listener:e,target:n,once:!0})},t.prototype.off=function(t,e,n){var i=this._map[t];i&&((i=i.filter((function(t){return t.listener!==e||t.target!==n}))).length?this._map[t]=i:delete this._map[t])},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=this._map[t];if(i)for(var r=i.length-1;r>=0;r-=1){var o=i[r],s=o.target,a=o.once,c=o.listener;a&&i.splice(r,1);try{c.call.apply(c,h([s],e,!1))}catch(t){null===console||void 0===console||console.error(t)}}},t.prototype.removeAll=function(t){delete this._map[t]},t.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},t}(),Ie="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Ie.engine="5.9.3";var Re=function(){function t(){}return t.add=function(t,e){Ie[t]=e},t.validEngine=function(t){var e=t.match(/\d+\.\d+\.\d+/);if(!e)return!1;var n=e[0].split(".").map((function(t){return t.padStart(3,"0")})).join("");return Ie.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(t){return t.padStart(3,"0")})).join("")>=n},t.getInfo=function(){return Ie},t}();function Se(){return!0}var Oe=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},Ne=function(){var t=Oe();if(t="".concat(t.replace(/-/g,""),"a"),t=function(t){var e="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=e.length+1,i=+t,r=[];do{var o=i%n;i=(i-o)/n,r.unshift(e[o])}while(i);return r.join("")}(t=parseInt(t,16)),t.length>22&&(t=t.slice(0,22)),t.length<22)for(var e=22-t.length,n=0;n<e;n++)t+="0";return t},Me=function(t){var e="RCDeviceId",n=i(t),r="",o=n.get(e);return o?r=o:(r=Ne(),n.set(e,r)),r},Le=null;function Ue(t,e,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-t];if(Le&&t<pt.FATAL)try{var o=JSON.stringify(n);Le[r](e,o)}catch(t){console.error(t)}}var Ae,be,we=Ue.bind(null,pt.DEBUG),Pe=Ue.bind(null,pt.INFO),De=Ue.bind(null,pt.WARN),Ve=Ue.bind(null,pt.ERROR),Ge=Ue.bind(null,pt.FATAL),Be=Object.freeze({__proto__:null,init:function(t){Le=t},log:Ue,debug:we,info:Pe,warn:De,error:Ve,fatal:Ge}),ke=function(){function t(t,e){var n=this;this._promise=new Promise((function(e){n._resolve=e,t(n._onResolve.bind(n))})),this._onCancel=e}return t.prototype._onResolve=function(t){this._resolve(t)},t.prototype.result=function(){return this._promise},t.prototype.abort=function(){this._onCancel(this._onResolve.bind(this))},t}();!function(t){t[t.STRING=0]="STRING",t[t.ONLY_STRING=1]="ONLY_STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.OBJECT=4]="OBJECT",t[t.ARRAY=5]="ARRAY",t[t.CALLBACK=6]="CALLBACK",t[t.CHANNEL_ID=7]="CHANNEL_ID",t[t.CONVERSATION=8]="CONVERSATION"}(be||(be={}));var xe=((Ae={})[be.STRING]=ce,Ae[be.ONLY_STRING]=ie,Ae[be.NUMBER]=oe,Ae[be.BOOLEAN]=function(t){return"boolean"==typeof t},Ae[be.OBJECT]=le,Ae[be.ARRAY]=se,Ae[be.CALLBACK]=function(t){var e=!0;return le(t)||(e=!1),(t=t||{}).onSuccess&&!he(t.onSuccess)&&(e=!1),t.onError&&!he(t.onError)&&(e=!1),e},Ae[be.CHANNEL_ID]=ve,Ae[be.CONVERSATION]=function(t){var e=!0;return le(t)||(e=!1),ie(t.targetId)||(e=!1),_e(t.conversationType)||(e=!1),de(t.channelId)||ve(t.channelId)||(e=!1),e},Ae),Fe=function(t){function e(e){var n=t.call(this,e)||this;return n.name="RCAssertError",n}return a(e,t),e}(Error),He=function(t,e,n,i){if(void 0===i&&(i=!1),!qe(t,e,n,i))throw new Fe("'".concat(t,"' is invalid: ").concat(JSON.stringify(e)))},qe=function(t,e,n,i){void 0===i&&(i=!1),n=xe[n]||n;var r=i?n(e):de(e)||null==e||n(e);return r||null===console||void 0===console||console.error("'".concat(t,"' is invalid: ").concat(JSON.stringify(e))),r},Ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Ye(t){var e,n,i,r,o,s,a="",c=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");c<t.length;)e=Ke.indexOf(t.charAt(c++))<<2|(r=Ke.indexOf(t.charAt(c++)))>>4,n=(15&r)<<4|(o=Ke.indexOf(t.charAt(c++)))>>2,i=(3&o)<<6|(s=Ke.indexOf(t.charAt(c++))),a+=String.fromCharCode(e),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a}function je(t){for(var e=null===window||void 0===window?void 0:window.atob(t),n=new Uint8Array(e.length),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n.buffer}var We,Qe,Je,Xe,Ze=function(t){if(!le(t)||void 0===t.low||void 0===t.high)return t;var e=t.low;return e<0&&(e+=4294967296),e=e.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(e.length,"}$")),e),16)},ze=function(t,e){var n=Math.floor(1e3*Math.random()%1e4),i=Oe(),r=function(t){t=t||"-";var e=new Date,n=e.getFullYear(),i=e.getMonth()+1,r=e.getDate();return"".concat(n).concat(t).concat(i).concat(t).concat(r)}(),o=(new Date).getTime(),s="";if(e){var a=e.split(".");s=".".concat(a[a.length-1])}return"".concat(t,"__RC-").concat(r,"_").concat(n,"_").concat(o).concat(i).concat(s)},$e=function(t){var e="application/octet-stream";switch(t){case Q.IMAGE:e="image/jpeg";break;case Q.AUDIO:e="audio/amr";break;case Q.VIDEO:e="video/3gpp";break;case Q.SIGHT:e="video/mpeg4";break;case Q.COMBINE_HTML:e="text/html"}return e},tn=function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=t.threadId,i=t.apnsCollapseId,r=t.category,o=t.richMediaUri,s=t.interruptionLevel,a=e.channelIdMi,c=e.channelIdHW,u=e.channelIdOPPO,l=e.typeVivo,h=e.googleConfig,d=e.miLargeIconUrl,p=e.importanceHW,g=e.categoryHW,f=e.imageUrlHW,_=e.categoryVivo,E=e.importanceHonor,v=e.imageUrlHonor,T={};T["thread-id"]=n||"",T["apns-collapse-id"]=i||"",T.category=r||"",T.richMediaUri=o||"",T["interruption-level"]=s||"active";var C={};C.collapse_key=null==h?void 0:h.collapseKey,C.imageUrl=null==h?void 0:h.imageUrl;var m=null==h?void 0:h.priority;m&&!["high","normal"].includes(m)&&(m="normal"),C.priority=m;var y=[{HW:{channelId:c||"",importance:p||"NORMAL",image:f||"",category:g||""}},{MI:{channelId:a||"",large_icon_uri:d||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:l||"",category:_||""}},{APNS:T},{FCM:C},{HONOR:{importance:E||Dt.NORMAL,image:v||""}}];return JSON.stringify(y)},en=function(t,e,n){var i={},r={notificationId:n||""};if(!e)return{iOSConfig:i,androidConfig:r};try{var o=JSON.parse(e);null==o||o.forEach((function(t){var e,n,o,s,a,c,u,l,h,d,p,g=Object.keys(t);if(0!==g.length){var f=g[0];switch(f){case"HW":return r.channelIdHW=null===(e=t[f])||void 0===e?void 0:e.channelId,r.importanceHW=null===(n=t[f])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(o=t[f])||void 0===o?void 0:o.image,void(r.categoryHW=null===(s=t[f])||void 0===s?void 0:s.category);case"MI":return r.channelIdMi=null===(a=t[f])||void 0===a?void 0:a.channelId,void(r.miLargeIconUrl=null===(c=t[f])||void 0===c?void 0:c.large_icon_uri);case"OPPO":return void(r.channelIdOPPO=null===(u=t[f])||void 0===u?void 0:u.channelId);case"VIVO":return r.typeVivo=null===(l=t[f])||void 0===l?void 0:l.classification,void(r.categoryVivo=null===(h=t[f])||void 0===h?void 0:h.category);case"APNS":return i.threadId=t[f]["thread-id"],i.apnsCollapseId=t[f]["apns-collapse-id"],i.category=t[f].category,i.richMediaUri=t[f].richMediaUri,void(i.interruptionLevel=t[f]["interruption-level"]);case"FCM":return void(r.googleConfig={collapseKey:t[f].collapse_key||"",imageUrl:t[f].imageUrl||"",priority:t[f].priority||""});case"HONOR":r.importanceHonor=null===(d=t[f])||void 0===d?void 0:d.importance,r.imageUrlHonor=null===(p=t[f])||void 0===p?void 0:p.image}}}))}catch(n){t.error(ft.O,"Wrong format for pushConfigs field! content: ".concat(e))}return{iOSConfig:i,androidConfig:r}},nn=function(t){var e=/^[A-Za-z0-9_=+-]+$/.test(t),n=t.length;return e&&(n<=128&&n>=1)},rn=function(t){var e=t.length;return e<=4096&&e>=1},on=(We=0,function(){var t=((4294967295&Date.now())>>>0).toString(2),e=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=t+We.toString(2).padStart(11,"0")+e.toString(2).padStart(20,"0");return We=2047&++We,parseInt(n,2)}),sn=function(){var t=Re.getInfo(),e="electron";for(var n in t)"engine"!==n&&(e=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return e},an=function(t,e,n){return u(void 0,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(e),"AES-CBC",!0,["decrypt"])];case 1:return i=o.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},i,je(t))];case 2:return r=o.sent(),[2,(new TextDecoder).decode(r)]}}))}))};function cn(t,e){var n;if(!t)return"";var i="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(t)?i?t.replace(/^https?:\/\//i,"https://"):t:e!==wt.HTTP||i?"https://".concat(t):"http://".concat(t)}function un(t){var e=0;if(0===t.length)return e;for(var n=0;n<t.length;n++){e=(e<<5)-e+t.charCodeAt(n),e|=0}return Math.abs(e)}!function(t){t.GET="GET",t.POST="POST",t.PUT="PUT"}(Qe||(Qe={})),function(t){t.WIFI="wifi",t.FOUR_G="4g",t.THREE_G="3g",t.TWO_G="2g",t.FIVE_G="2g",t.THREE_GENT="3gnet",t.UNKONWN="unknown"}(Je||(Je={})),function(t){t[t.add=1]="add",t[t.update=2]="update",t[t.delete=3]="delete"}(Xe||(Xe={}));var ln=function(){var t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;return"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")};function hn(t){var e=t.method||Qe.GET,n=t.timeout||C,i=t.headers,r=t.query,o=t.body,s=t.onProgress,a=v(t.url,r),c=ln(),u="[object XDomainRequest]"===Object.prototype.toString.call(c);if(c.open(e,a),i&&c.setRequestHeader)for(var l in i)c.setRequestHeader(l,i[l]);return u?function(t,e,n){return new ke((function(i){0!==e&&(t.timeout=e),t.onload=function(){i({data:t.responseText,status:t.status||200})},t.onerror=function(){i({status:t.status})},t.ontimeout=function(){i({status:t.status})};var r="object"==typeof n?JSON.stringify(n):n;t.send(r)}),(function(e){t.abort(),e({status:-1})}))}(c,n,o):function(t,e,n,i){return new ke((function(r){t.onreadystatechange=function(){4===t.readyState&&r({data:t.responseText,status:t.status,xhr:t})},t.onerror=function(){r({status:t.status})},i&&(t.upload.onprogress=function(t){return i(t)}),0!==e&&setTimeout((function(){t.abort(),r({status:t.status})}),e),t.send(n)}),(function(e){t.abort(),e({status:-1})}))}(c,n,o,s)}var dn,pn,gn=function(t,e,n){var i=null==n?void 0:n.isReverse;le(t)&&function(){for(var n in t)e(t[n],n,t)}(),(se(t)||ie(t))&&function(){if(i)for(var n=t.length-1;n>=0;n--)e(t[n],n);else for(var r=0,o=t.length;r<o;r++)e(t[r],r)}()},fn=function(t,e){return gn(t,(function(n,i){t[i]=e(n,i)})),t},_n=function(t,e){if(t.indexOf)return t.indexOf(e);var n=-1;return gn(t,(function(t,i){e===t&&(n=i)})),n},En=function(t,e){return-1!==_n(t,e)},vn=function(t,e){var n=[];return gn(t,(function(t){n.push(t)})),-1!==_n(n,e)},Tn=function(t){return JSON.parse(JSON.stringify(t))},Cn=function(){return"undefined"!=typeof RCCppEngine},mn=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},yn=function(t){var e;if("object"==typeof t&&null!==t)if(Array.isArray(t))for(var n in e=[],t)e.push(yn(t[n]));else for(var n in e={},t)e[n]=yn(t[n]);else e=t;return e},In=function(t){var e;try{e=yn(t)}catch(n){e=JSON.parse(JSON.stringify(t))}return e},Rn=function(t){return{isRead:(t&n.READ)===n.READ,isListened:(t&n.LISTENED)===n.LISTENED,isDownload:(t&n.DOWNLOADED)===n.DOWNLOADED,isRetrieved:(t&n.RETRIEVED)===n.RETRIEVED}},Sn=function(t){var e=n.UNREAD;return(null==t?void 0:t.isRead)&&(e|=n.READ),(null==t?void 0:t.isListened)&&(e|=n.LISTENED),(null==t?void 0:t.isDownload)&&(e|=n.DOWNLOADED),(null==t?void 0:t.isRetrieved)&&(e|=n.RETRIEVED),e},On={_delayTime:0,setTime:function(t){var e=(new Date).getTime();On._delayTime=e-t},getTime:function(){var t=On._delayTime;return(new Date).getTime()-t}},Nn=function(t,e){var n=0;return t.isAutoDelete&&(n|=1),t.isOverwrite&&(n|=2),2===e&&(n|=4),n},Mn=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}return t.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var t,e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.roomId,n=t.timestamp,(i=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(e,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,o===z.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},t.prototype.pullEntry=function(t,e){this._pullQueue.push({roomId:t,timestamp:e}),this._startPull()},t.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},t}(),Ln="rtcRJoin_data",Un="rtcRExit",An="rtcRInfo",bn="rtcUData",wn="rtcUPut",Pn="rtcUDel",Dn="rtcSetData",Vn="userSetData",Gn="rtcQryData",Bn="rtcDelData",kn="rtcToken",xn="rtcUserState",Fn="rtcUList",Hn="viewerJoinR",qn="viewerExitR",Kn="rtcPullKv",Yn="rtcIdentityChange",jn="rtcInvite",Wn="rtcCancelInvite",Qn="rtcInviteAnswer",Jn="rtcEndInvite",Xn="rtcQueryJoined";!function(t){t.RtcInput="RtcInput",t.RtcUserListOutput="RtcUserListOutput",t.SetUserStatusInput="SetUserStatusInput",t.RtcSetDataInput="RtcSetDataInput",t.RtcUserSetDataInput="RtcUserSetDataInput",t.RtcDataInput="RtcDataInput",t.RtcSetOutDataInput="RtcSetOutDataInput",t.MCFollowInput="MCFollowInput",t.RtcTokenOutput="RtcTokenOutput",t.RtcQryOutput="RtcQryOutput",t.RtcQryUserOutDataInput="RtcQryUserOutDataInput",t.RtcUserOutDataOutput="RtcUserOutDataOutput",t.RtcQueryListInput="RtcQueryListInput",t.RtcRoomInfoOutput="RtcRoomInfoOutput",t.RtcValueInfo="RtcValueInfo",t.RtcKeyDeleteInput="RtcKeyDeleteInput",t.RtcNotifyMsg="RtcNotifyMsg",t.RtcPullKV="RtcPullKV",t.RtcKVOutput="RtcKVOutput",t.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",t.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",t.RtcViewerJoinedOutput="RtcViewerJoinedOutput",t.RtcInviteInput="RtcInviteInput",t.RtcCancelInviteInput="RtcCancelInviteInput",t.RtcInviteAnswerInput="RtcInviteAnswerInput",t.RtcEndInviteInput="RtcEndInviteInput",t.RtcOutput="RtcOutput"}(pn||(pn={}));var Zn=((dn={})[pn.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],dn[pn.RtcUserListOutput]=["users","token","sessionId","roomInfo"],dn[pn.SetUserStatusInput]=["status"],dn[pn.RtcSetDataInput]=["interior","target","key","value","objectName","content"],dn[pn.RtcUserSetDataInput]=["valueInfo","objectName","content"],dn[pn.RtcDataInput]=["interior","target","key","objectName","content"],dn[pn.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],dn[pn.MCFollowInput]=["state"],dn[pn.RtcTokenOutput]=["rtcToken"],dn[pn.RtcQryOutput]=["outInfo"],dn[pn.RtcQryUserOutDataInput]=["userId"],dn[pn.RtcUserOutDataOutput]=["user"],dn[pn.RtcQueryListInput]=["order"],dn[pn.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],dn[pn.RtcValueInfo]=["key","value"],dn[pn.RtcKeyDeleteInput]=["key"],dn[pn.RtcNotifyMsg]=["type","time","roomId"],dn[pn.RtcPullKV]=["timestamp","roomId"],dn[pn.RtcKVOutput]=["entries","bFullUpdate","syncTime"],dn[pn.RtcQueryUserJoinedInput]=["userId"],dn[pn.RtcQueryUserJoinedOutput]=["info"],dn[pn.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],dn[pn.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],dn[pn.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],dn[pn.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],dn),zn="\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(pn.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(pn.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(pn.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(pn.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(pn.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(pn.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(pn.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(pn.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(pn.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(pn.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(pn.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(pn.RtcQryOutput,"{\n repeated ").concat(pn.RtcValueInfo," outInfo=1;\n }\n message ").concat(pn.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(pn.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(pn.RtcUserSetDataInput," {\n repeated ").concat(pn.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(pn.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(pn.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(pn.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(pn.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(pn.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(pn.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(pn.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(pn.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(pn.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(pn.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(pn.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(pn.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(pn.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(pn.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(pn.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(pn.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"),$n=function(){function t(t,e,n,i,r,o){this.runtime=t,this.rtcCodec=e,this._watcher=n,this._options=i,this.logger=r,this.statisticLog=o,this._appkey=this._options.appkey,this._rtcKVManager=new Mn(this)}return t.prototype.registerRTCSignalingListener=function(t){this._rtcSignalingListener=t},t.prototype.getInnerLogger=function(){return this.logger},t.prototype.getInnerStatisticLog=function(){return this.statisticLog},t.prototype.pullRTCRoomEntry=function(t,e){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=this.rtcCodec.encode(pn.RtcPullKV,{timestamp:0,roomId:t}),[4,this.rtcSignaling(t,Kn,!0,e)];case 1:return n=u.sent(),i=n.code,r=n.buffer,i!==z.SUCCESS?[2,{code:i}]:(o=this.rtcCodec.decode(pn.RtcKVOutput,r),s=o.entries,a=o.syncTime,s=(s||[]).map((function(t){return c(c({},t),{timestamp:Ze(t.timestamp)})})),this._watcher.onRTCDataChange(s,t),[2,{code:i,data:{kvEntries:s,syncTime:Ze(a)}}])}}))}))},t.prototype._receiveRtcKv=function(t){if(this._rtcSignalingListener)this._rtcSignalingListener(t);else{var e=this.rtcCodec.decode(pn.RtcNotifyMsg,t),n=e.time,i=e.type,r=e.roomId;1===i&&this._rtcKVManager.pullEntry(r,Ze(n))}},t.prototype.destroy=function(){},t}();function ti(t){var e=function(){function t(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function e(t){return!0===(t&&t.__isLong__)}function n(t,e){var n,i,o;return e?(o=(t>>>=0)>=0&&t<256)&&(i=c[t])?i:(n=r(t,(0|t)<0?-1:0,!0),o&&(c[t]=n),n):(o=(t|=0)>=-128&&t<128)&&(i=a[t])?i:(n=r(t,t<0?-1:0,!1),o&&(a[t]=n),n)}function i(t,e){if(isNaN(t)||!isFinite(t))return e?f:g;if(e){if(t<0)return f;if(t>=h)return C}else{if(-d>=t)return m;if(t+1>=d)return T}return t<0?i(-t,e).neg():r(0|t%l,0|t/l,e)}function r(e,n,i){return new t(e,n,i)}function o(t,e,n){var r,s,a,c,l,h,d;if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return g;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||n>36)throw RangeError("radix");if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(t.substring(1),e,n).neg();for(s=i(u(n,8)),a=g,c=0;c<t.length;c+=8)l=Math.min(8,t.length-c),h=parseInt(t.substring(c,c+l),n),l<8?(d=i(u(n,l)),a=a.mul(d).add(i(h))):a=(a=a.mul(s)).add(i(h));return a.unsigned=e,a}function s(e){return e instanceof t?e:"number"==typeof e?i(e):"string"==typeof e?o(e):r(e.low,e.high,e.unsigned)}var a,c,u,l,h,d,p,g,f,_,E,v,T,C,m,y;return t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),t.isLong=e,a={},c={},t.fromInt=n,t.fromNumber=i,t.fromBits=r,u=Math.pow,t.fromString=o,t.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),t.ZERO=g,f=n(0,!0),t.UZERO=f,_=n(1),t.ONE=_,E=n(1,!0),t.UONE=E,v=n(-1),t.NEG_ONE=v,T=r(-1,2147483647,!1),t.MAX_VALUE=T,C=r(-1,-1,!0),t.MAX_UNSIGNED_VALUE=C,m=r(0,-2147483648,!1),t.MIN_VALUE=m,(y=t.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},y.toString=function(t){var e,n,r,o,s,a,c,l;if((t=t||10)<2||t>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(m)?(e=i(t),r=(n=this.div(e)).mul(e).sub(this),n.toString(t)+r.toInt().toString(t)):"-"+this.neg().toString(t);for(o=i(u(t,6),this.unsigned),s=this,a="";;){if(c=s.div(o),l=(s.sub(c.mul(o)).toInt()>>>0).toString(t),(s=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){var t,e;if(this.isNegative())return this.eq(m)?64:this.neg().getNumBitsAbs();for(t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},y.isZero=function(){return 0===this.high&&0===this.low},y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.equals=function(t){return e(t)||(t=s(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},y.eq=y.equals,y.notEquals=function(t){return!this.eq(t)},y.neq=y.notEquals,y.lessThan=function(t){return this.comp(t)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(t){return this.comp(t)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(t){return this.comp(t)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(t){return this.comp(t)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(t){if(e(t)||(t=s(t)),this.eq(t))return 0;var n=this.isNegative(),i=t.isNegative();return n&&!i?-1:!n&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(m)?m:this.not().add(_)},y.neg=y.negate,y.add=function(t){var n,i,o,a,c,u,l,h,d,p,g;return e(t)||(t=s(t)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,c=t.high>>>16,u=65535&t.high,l=t.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&t.low))>>>16,d+=(p+=o+l)>>>16,h+=(d+=i+u)>>>16,h+=n+c,r((p&=65535)<<16|(g&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},y.subtract=function(t){return e(t)||(t=s(t)),this.add(t.neg())},y.sub=y.subtract,y.multiply=function(t){var n,o,a,c,u,l,h,d,f,_,E,v;return this.isZero()?g:(e(t)||(t=s(t)),t.isZero()?g:this.eq(m)?t.isOdd()?m:g:t.eq(m)?this.isOdd()?m:g:this.isNegative()?t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg():t.isNegative()?this.mul(t.neg()).neg():this.lt(p)&&t.lt(p)?i(this.toNumber()*t.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=t.high>>>16,l=65535&t.high,h=t.low>>>16,f=0,_=0,E=0,v=0,E+=(v+=c*(d=65535&t.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=c*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=c*l)>>>16,f+=n*d+o*h+a*l+c*u,r((E&=65535)<<16|(v&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},y.mul=y.multiply,y.divide=function(t){var n,r,o,a,c,l,h;if(e(t)||(t=s(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:g;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return f;if(t.gt(this.shru(1)))return E;o=f}else{if(this.eq(m))return t.eq(_)||t.eq(v)?m:t.eq(m)?_:(n=this.shr(1).div(t).shl(1)).eq(g)?t.isNegative()?_:v:(r=this.sub(t.mul(n)),o=n.add(r.div(t)));if(t.eq(m))return this.unsigned?f:g;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=g}for(r=this;r.gte(t);){for(n=Math.max(1,Math.floor(r.toNumber()/t.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),h=(l=i(n)).mul(t);h.isNegative()||h.gt(r);)h=(l=i(n-=c,this.unsigned)).mul(t);l.isZero()&&(l=_),o=o.add(l),r=r.sub(h)}return o},y.div=y.divide,y.modulo=function(t){return e(t)||(t=s(t)),this.sub(this.div(t).mul(t))},y.mod=y.modulo,y.not=function(){return r(~this.low,~this.high,this.unsigned)},y.and=function(t){return e(t)||(t=s(t)),r(this.low&t.low,this.high&t.high,this.unsigned)},y.or=function(t){return e(t)||(t=s(t)),r(this.low|t.low,this.high|t.high,this.unsigned)},y.xor=function(t){return e(t)||(t=s(t)),r(this.low^t.low,this.high^t.high,this.unsigned)},y.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):r(0,this.low<<t-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):r(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(t){var n;return e(t)&&(t=t.toInt()),0===(t&=63)?this:(n=this.high,t<32?r(this.low>>>t|n<<32-t,n>>>t,this.unsigned):r(32===t?n:n>>>t-32,0,this.unsigned))},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},y.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,255&e>>>8,255&e>>>16,255&e>>>24,255&t,255&t>>>8,255&t>>>16,255&t>>>24]},y.toBytesBE=function(){var t=this.high,e=this.low;return[255&t>>>24,255&t>>>16,255&t>>>8,255&t,255&e>>>24,255&e>>>16,255&e>>>8,255&e]},t}(),n=function(t){function e(t){var e=0;return function(){return e<t.length?t.charCodeAt(e++):null}}function n(){var t=[],e=[];return function(){return 0===arguments.length?e.join("")+a.apply(String,t):(t.length+arguments.length>1024&&(e.push(a.apply(String,t)),t.length=0),void Array.prototype.push.apply(t,arguments))}}function i(t,e,n,i,r){var o,s,a=8*r-i-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?r-1:0,d=n?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=u}return(p?-1:1)*s*Math.pow(2,o-i)}function r(t,e,n,i,r,o){var s,a,c,u=8*o-r-1,l=(1<<u)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,g=i?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*c-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[n+p]=255&a,p+=g,a/=256,r-=8);for(s=s<<r|a,u+=r;u>0;t[n+p]=255&s,p+=g,s/=256,u-=8);t[n+p-g]|=128*f}var o,s,a,c,u,l=function(t,e,n){if(void 0===t&&(t=l.DEFAULT_CAPACITY),void 0===e&&(e=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((t|=0)<0)throw RangeError("Illegal capacity");e=!!e,n=!!n}this.buffer=0===t?s:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e,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=t||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(t,e,n){return new l(t,e,n)},l.concat=function(t,e,n,i){var r,o,s,a,c,u;for(("boolean"==typeof e||"string"!=typeof e)&&(i=n,n=e,e=void 0),r=0,s=0,a=t.length;a>s;++s)l.isByteBuffer(t[s])||(t[s]=l.wrap(t[s],e)),(o=t[s].limit-t[s].offset)>0&&(r+=o);if(0===r)return new l(0,n,i);for(u=new l(r,n,i),s=0;a>s;)(o=(c=t[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},l.isByteBuffer=function(t){return!0===(t&&t.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(t,e,n,i){var r,s;if("string"!=typeof e&&(i=n,n=e,e=void 0),"string"==typeof t)switch(void 0===e&&(e="utf8"),e){case"base64":return l.fromBase64(t,n);case"hex":return l.fromHex(t,n);case"binary":return l.fromBinary(t,n);case"utf8":return l.fromUTF8(t,n);case"debug":return l.fromDebug(t,n);default:throw Error("Unsupported encoding: "+e)}if(null===t||"object"!=typeof t)throw TypeError("Illegal buffer");if(l.isByteBuffer(t))return(r=o.clone.call(t)).markedOffset=-1,r;if(t instanceof Uint8Array)r=new l(0,n,i),t.length>0&&(r.buffer=t.buffer,r.offset=t.byteOffset,r.limit=t.byteOffset+t.byteLength,r.view=new Uint8Array(t.buffer));else if(t instanceof ArrayBuffer)r=new l(0,n,i),t.byteLength>0&&(r.buffer=t,r.offset=0,r.limit=t.byteLength,r.view=t.byteLength>0?new Uint8Array(t):null);else{if("[object Array]"!==Object.prototype.toString.call(t))throw TypeError("Illegal buffer");for((r=new l(t.length,n,i)).limit=t.length,s=0;s<t.length;++s)r.view[s]=t[s]}return r},o.writeBitSet=function(t,e){var n,i,r,o,s,a,c=void 0===e;if(c&&(e=this.offset),!this.noAssert){if(!(t instanceof Array))throw TypeError("Illegal BitSet: Not an array");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)}for(i=e,o=(r=t.length)>>3,s=0,e+=this.writeVarint32(r,e);o--;)n=1&!!t[s++]|(1&!!t[s++])<<1|(1&!!t[s++])<<2|(1&!!t[s++])<<3|(1&!!t[s++])<<4|(1&!!t[s++])<<5|(1&!!t[s++])<<6|(1&!!t[s++])<<7,this.writeByte(n,e++);if(r>s){for(a=0,n=0;r>s;)n|=(1&!!t[s++])<<a++;this.writeByte(n,e++)}return c?(this.offset=e,this):e-i},o.readBitSet=function(t){var e,n,i,r,o,s,a,c=void 0===t;for(c&&(t=this.offset),r=(i=(n=this.readVarint32(t)).value)>>3,o=0,s=[],t+=n.length;r--;)e=this.readByte(t++),s[o++]=!!(1&e),s[o++]=!!(2&e),s[o++]=!!(4&e),s[o++]=!!(8&e),s[o++]=!!(16&e),s[o++]=!!(32&e),s[o++]=!!(64&e),s[o++]=!!(128&e);if(i>o)for(a=0,e=this.readByte(t++);i>o;)s[o++]=!!(1&e>>a++);return c&&(this.offset=t),s},o.readBytes=function(t,e){var n,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+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+"+t+") <= "+this.buffer.byteLength)}return n=this.slice(e,e+t),i&&(this.offset+=t),n},o.writeBytes=o.append,o.writeInt8=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=1,this.view[e]=t,i&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(t){var e,n=void 0===t;if(n&&(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)}return 128==(128&(e=this.view[t]))&&(e=-(255-e+1)),n&&(this.offset+=1),e},o.readByte=o.readInt8,o.writeUint8=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=1,this.view[e]=t,i&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(t){var e,n=void 0===t;if(n&&(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)}return e=this.view[t],n&&(this.offset+=1),e},o.readUInt8=o.readUint8,o.writeInt16=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),i&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(t){var e,n=void 0===t;if(n&&(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+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t],e|=this.view[t+1]<<8):(e=this.view[t]<<8,e|=this.view[t+1]),32768==(32768&e)&&(e=-(65535-e+1)),n&&(this.offset+=2),e},o.readShort=o.readInt16,o.writeUint16=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),i&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(t){var e,n=void 0===t;if(n&&(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+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t],e|=this.view[t+1]<<8):(e=this.view[t]<<8,e|=this.view[t+1]),n&&(this.offset+=2),e},o.readUInt16=o.readUint16,o.writeInt32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,this.littleEndian?(this.view[e+3]=255&t>>>24,this.view[e+2]=255&t>>>16,this.view[e+1]=255&t>>>8,this.view[e]=255&t):(this.view[e]=255&t>>>24,this.view[e+1]=255&t>>>16,this.view[e+2]=255&t>>>8,this.view[e+3]=255&t),i&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t+2]<<16,e|=this.view[t+1]<<8,e|=this.view[t],e+=this.view[t+3]<<24>>>0):(e=this.view[t+1]<<16,e|=this.view[t+2]<<8,e|=this.view[t+3],e+=this.view[t]<<24>>>0),e|=0,n&&(this.offset+=4),e},o.readInt=o.readInt32,o.writeUint32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,this.littleEndian?(this.view[e+3]=255&t>>>24,this.view[e+2]=255&t>>>16,this.view[e+1]=255&t>>>8,this.view[e]=255&t):(this.view[e]=255&t>>>24,this.view[e+1]=255&t>>>16,this.view[e+2]=255&t>>>8,this.view[e+3]=255&t),i&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t+2]<<16,e|=this.view[t+1]<<8,e|=this.view[t],e+=this.view[t+3]<<24>>>0):(e=this.view[t+1]<<16,e|=this.view[t+2]<<8,e|=this.view[t+3],e+=this.view[t]<<24>>>0),n&&(this.offset+=4),e},o.readUInt32=o.readUint32,t&&(o.writeInt64=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=e.low,o=e.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0,e+=4,i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0,e+=4,n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),r=new t(n,i,!1),o&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=e.low,o=e.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0,e+=4,i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0,e+=4,n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),r=new t(n,i,!0),o&&(this.offset+=8),r},o.readUInt64=o.readUint64),o.writeFloat32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,r(this.view,t,e,this.littleEndian,23,4),i&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=i(this.view,t,this.littleEndian,23,4),n&&(this.offset+=4),e},o.readFloat=o.readFloat32,o.writeFloat64=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");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(e+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=8,r(this.view,t,e,this.littleEndian,52,8),i&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(t){var e,n=void 0===t;if(n&&(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 e=i(this.view,t,this.littleEndian,52,8),n&&(this.offset+=8),e},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(t){return(t>>>=0)<128?1:t<16384?2:1<<21>t?3:1<<28>t?4:5},l.zigZagEncode32=function(t){return((t|=0)<<1^t>>31)>>>0},l.zigZagDecode32=function(t){return 0|t>>>1^-(1&t)},o.writeVarint32=function(t,e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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)}for((e+=i=l.calculateVarint32(t))>(r=this.buffer.byteLength)&&this.resize((r*=2)>e?r:e),e-=i,t>>>=0;t>=128;)n=128|127&t,this.view[e++]=n,t>>>=7;return this.view[e++]=t,o?(this.offset=e,this):i},o.writeVarint32ZigZag=function(t,e){return this.writeVarint32(l.zigZagEncode32(t),e)},o.readVarint32=function(t){var e,n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}n=0,i=0;do{if(!this.noAssert&&t>this.limit)throw(r=Error("Truncated")).truncated=!0,r;e=this.view[t++],n<5&&(i|=(127&e)<<7*n),++n}while(0!=(128&e));return i|=0,o?(this.offset=t,i):{value:i,length:n}},o.readVarint32ZigZag=function(t){var e=this.readVarint32(t);return"object"==typeof e?e.value=l.zigZagDecode32(e.value):e=l.zigZagDecode32(e),e},t&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(e){"number"==typeof e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e));var n=e.toInt()>>>0,i=e.shiftRightUnsigned(28).toInt()>>>0,r=e.shiftRightUnsigned(56).toInt()>>>0;return 0==r?0==i?n<16384?n<128?1:2:1<<21>n?3:4:i<16384?i<128?5:6:1<<21>i?7:8:r<128?9:10},l.zigZagEncode64=function(e){return"number"==typeof e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),e.shiftLeft(1).xor(e.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(e){return"number"==typeof e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),e.shiftRightUnsigned(1).xor(e.and(t.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(e,n){var i,r,o,s,a,c=void 0===n;if(c&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),i=l.calculateVarint64(e),r=e.toInt()>>>0,o=e.shiftRightUnsigned(28).toInt()>>>0,s=e.shiftRightUnsigned(56).toInt()>>>0,(n+=i)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=i,i){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==i?128|s:127&s;case 8:this.view[n+7]=8!==i?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==i?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==i?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==i?128|o:127&o;case 4:this.view[n+3]=4!==i?128|r>>>21:127&r>>>21;case 3:this.view[n+2]=3!==i?128|r>>>14:127&r>>>14;case 2:this.view[n+1]=2!==i?128|r>>>7:127&r>>>7;case 1:this.view[n]=1!==i?128|r:127&r}return c?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(t,e){return this.writeVarint64(l.zigZagEncode64(t),e)},o.readVarint64=function(e){var n,i,r,o,s,a,c=void 0===e;if(c&&(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)}if(n=e,i=0,r=0,o=0,s=0,i=127&(s=this.view[e++]),128&s&&(i|=(127&(s=this.view[e++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[e++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[e++]))<<21,(128&s||this.noAssert&&void 0===s)&&(r=127&(s=this.view[e++]),(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[e++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[e++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=t.fromBits(i|r<<28,r>>>4|o<<24,!1),c?(this.offset=e,a):{value:a,length:e-n}},o.readVarint64ZigZag=function(e){var n=this.readVarint64(e);return n&&n.value instanceof t?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),r=t.length,!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");for(i=0;r>i;++i)if(0===t.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=u.calculateUTF16asUTF8(e(t))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):r},o.readCString=function(t){var e,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return e=t,r=-1,u.decodeUTF8toUTF16(function(){if(0===r)return null;if(t>=this.limit)throw RangeError("Illegal range: Truncated data, "+t+" < "+this.limit);return 0===(r=this.view[t++])?null:r}.bind(this),i=n(),!0),o?(this.offset=t,i()):{string:i(),length:t-e}},o.writeIString=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(r=n,i=u.calculateUTF16asUTF8(e(t),this.noAssert)[1],n+=4+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+i,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i):(this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),n+=4,u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==r+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return s?(this.offset=n,this):n-r},o.readIString=function(t){var e,n,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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=t,n=this.readUint32(t),i=this.readUTF8String(n,l.METRICS_BYTES,t+=4),t+=i.length,r?(this.offset=t,i.string):{string:i.string,length:t-e}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=n,i=u.calculateUTF16asUTF8(e(t))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),s?(this.offset=n,this):n-r},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(t){return u.calculateUTF16asUTF8(e(t))[0]},l.calculateUTF8Bytes=function(t){return u.calculateUTF16asUTF8(e(t))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(t,e,i){var r,o,s,a,c;if("number"==typeof e&&(i=e,e=void 0),(r=void 0===i)&&(i=this.offset),void 0===e&&(e=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal length: "+t+" (not an integer)");if(t|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=i,e===l.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return t>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(t){++s,u.UTF8toUTF16(t,o)})),s!==t)throw RangeError("Illegal range: Truncated data, "+s+" == "+t);return r?(this.offset=i,o()):{string:o(),length:i-a}}if(e===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+t+") <= "+this.buffer.byteLength)}if(c=i+t,u.decodeUTF8toUTF16(function(){return c>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==c)throw RangeError("Illegal range: Truncated data, "+i+" == "+c);return r?(this.offset=i,o()):{string:o(),length:i-a}}throw TypeError("Unsupported metrics: "+e)},o.readString=o.readUTF8String,o.writeVString=function(t,n){var i,r,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,i=u.calculateUTF16asUTF8(e(t),this.noAssert)[1],r=l.calculateVarint32(i),n+=r+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+i,n+=this.writeVarint32(i,n),u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==o+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-o},o.readVString=function(t){var e,n,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+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return e=t,n=this.readVarint32(t),i=this.readUTF8String(n.value,l.METRICS_BYTES,t+=n.length),t+=i.length,r?(this.offset=t,i.string):{string:i.string,length:t-e}},o.append=function(t,e,n){var i,r,o;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return t instanceof l||(t=l.wrap(t,e)),(r=t.limit-t.offset)<=0||((n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,this.view.set(t.view.subarray(t.offset,t.limit),n),t.offset+=r,i&&(this.offset+=r)),this},o.appendTo=function(t,e){return t.append(this,e),this},o.assert=function(t){return this.noAssert=!t,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(t){var e=new l(0,this.littleEndian,this.noAssert);return t?(e.buffer=new ArrayBuffer(this.buffer.byteLength),e.view=new Uint8Array(e.buffer)):(e.buffer=this.buffer,e.view=this.view),e.offset=this.offset,e.markedOffset=this.markedOffset,e.limit=this.limit,e},o.compact=function(t,e){var n,i,r;if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}return 0===t&&e===this.buffer.byteLength?this:0===(n=e-t)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=t),this.offset=0,this.limit=0,this):(i=new ArrayBuffer(n),(r=new Uint8Array(i)).set(this.view.subarray(t,e)),this.buffer=i,this.view=r,this.markedOffset>=0&&(this.markedOffset-=t),this.offset=0,this.limit=n,this)},o.copy=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}if(t===e)return new l(0,this.littleEndian,this.noAssert);var n=e-t,i=new l(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=t),this.copyTo(i,0,t,e),i},o.copyTo=function(t,e,n,i){var r,o,s;if(!this.noAssert&&!l.isByteBuffer(t))throw TypeError("Illegal target: Not a ByteBuffer");if(e=(o=void 0===e)?t.offset:0|e,n=(r=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,e<0||e>t.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+e+" <= "+t.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=i-n)?t:(t.ensureCapacity(e+s),t.view.set(this.view.subarray(n,i),e),r&&(this.offset+=s),o&&(t.offset+=s),this)},o.ensureCapacity=function(t){var e=this.buffer.byteLength;return t>e?this.resize((e*=2)>t?e:t):this},o.fill=function(t,e,n){var i=void 0===e;if(i&&(e=this.offset),"string"==typeof t&&t.length>0&&(t=t.charCodeAt(0)),void 0===e&&(e=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,e<0||e>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+n+" <= "+this.buffer.byteLength)}if(e>=n)return this;for(;n>e;)this.view[e++]=t;return i&&(this.offset=e),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(t){if(t=void 0===t?this.offset:t,!this.noAssert){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 this.markedOffset=t,this},o.order=function(t){if(!this.noAssert&&"boolean"!=typeof t)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!t,this},o.LE=function(t){return this.littleEndian=void 0===t||!!t,this},o.BE=function(t){return this.littleEndian=void 0!==t&&!t,this},o.prepend=function(t,e,n){var i,r,o,s,a;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return t instanceof l||(t=l.wrap(t,e)),(r=t.limit-t.offset)<=0||((o=r-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(t.view.subarray(t.offset,t.limit),n-r),t.offset=t.limit,i&&(this.offset-=r)),this},o.prependTo=function(t,e){return t.prepend(this,e),this},o.printDebug=function(t){"function"!=typeof t&&(t=console.log.bind(console)),t(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(t){var e,n;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal capacity: "+t+" (not an integer)");if((t|=0)<0)throw RangeError("Illegal capacity: 0 <= "+t)}return this.buffer.byteLength<t&&(e=new ArrayBuffer(t),(n=new Uint8Array(e)).set(this.view),this.buffer=e,this.view=n),this},o.reverse=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}return t===e||Array.prototype.reverse.call(this.view.subarray(t,e)),this},o.skip=function(t){if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal length: "+t+" (not an integer)");t|=0}var e=this.offset+t;if(!this.noAssert&&(e<0||e>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+t+" <= "+this.buffer.byteLength);return this.offset=e,this},o.slice=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=t,n.limit=e,n},o.toBuffer=function(t){var e,n=this.offset,i=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal limit: Not an integer");if(i>>>=0,n<0||n>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+i+" <= "+this.buffer.byteLength)}return t||0!==n||i!==this.buffer.byteLength?n===i?s:(e=new ArrayBuffer(i-n),new Uint8Array(e).set(new Uint8Array(this.buffer).subarray(n,i),0),e):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(t,e,n){if(void 0===t)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof t&&(n=e=t="utf8"),t){case"utf8":return this.toUTF8(e,n);case"base64":return this.toBase64(e,n);case"hex":return this.toHex(e,n);case"binary":return this.toBinary(e,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+t)}},c=function(){var t,e,n={},i=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[];for(t=0,e=i.length;e>t;++t)r[i[t]]=t;return n.encode=function(t,e){for(var n,r;null!==(n=t());)e(i[63&n>>2]),r=(3&n)<<4,null!==(n=t())?(e(i[63&((r|=15&n>>4)|15&n>>4)]),r=(15&n)<<2,null!==(n=t())?(e(i[63&(r|3&n>>6)]),e(i[63&n])):(e(i[63&r]),e(61))):(e(i[63&r]),e(61),e(61))},n.decode=function(t,e){function n(t){throw Error("Illegal character code: "+t)}for(var i,o,s;null!==(i=t());)if(void 0===(o=r[i])&&n(i),null!==(i=t())&&(void 0===(s=r[i])&&n(i),e(o<<2>>>0|(48&s)>>4),null!==(i=t()))){if(void 0===(o=r[i])){if(61===i)break;n(i)}if(e((15&s)<<4>>>0|(60&o)>>2),null!==(i=t())){if(void 0===(s=r[i])){if(61===i)break;n(i)}e((3&o)<<6>>>0|s)}}},n.test=function(t){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(t)},n}(),o.toBase64=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity||t>e)throw RangeError("begin, end");var i;return c.encode(function(){return e>t?this.view[t++]:null}.bind(this),i=n()),i()},l.fromBase64=function(t,n){if("string"!=typeof t)throw TypeError("str");var i=new l(t.length/4*3,n),r=0;return c.decode(e(t),(function(t){i.view[r++]=t})),i.limit=r,i},l.btoa=function(t){return l.fromBinary(t).toBase64()},l.atob=function(t){return l.fromBase64(t).toBinary()},o.toBinary=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity()||t>e)throw RangeError("begin, end");if(t===e)return"";for(var n=[],i=[];e>t;)n.push(this.view[t++]),n.length>=1024&&(i.push(String.fromCharCode.apply(String,n)),n=[]);return i.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(t,e){if("string"!=typeof t)throw TypeError("str");for(var n,i=0,r=t.length,o=new l(r,e);r>i;){if((n=t.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);o.view[i++]=n}return o.limit=r,o},o.toDebug=function(t){for(var e,n=-1,i=this.buffer.byteLength,r="",o="",s="";i>n;){if(-1!==n&&(r+=(e=this.view[n])<16?"0"+e.toString(16).toUpperCase():e.toString(16).toUpperCase(),t&&(o+=e>32&&e<127?String.fromCharCode(e):".")),++n,t&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";s+=r+o+"\n",r=o=""}r+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":t||0!==n&&n!==i?" ":""}if(t&&" "!==r){for(;r.length<51;)r+=" ";s+=r+o+"\n"}return t?s:r},l.fromDebug=function(t,e,n){for(var i,r,o=t.length,s=new l(0|(o+1)/3,e,n),a=0,c=0,u=!1,h=!1,d=!1,p=!1,g=!1;o>a;){switch(i=t.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}s.offset=c,u=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}s.limit=c,u=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){g=!0;break}if(r=parseInt(i+t.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=r,u=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return s},o.toHex=function(t,e){if(t=void 0===t?this.offset:t,e=void 0===e?this.limit:e,!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}for(var n,i=new Array(e-t);e>t;)(n=this.view[t++])<16?i.push("0",n.toString(16)):i.push(n.toString(16));return i.join("")},l.fromHex=function(t,e,n){var i,r,o,s,a;if(!n){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if(t.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(r=t.length,o=new l(0|r/2,e),s=0,a=0;r>s;s+=2){if(i=parseInt(t.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=i}return o.limit=a,o},u=function(){var t={MAX_CODEPOINT:1114111,encodeUTF8:function(t,e){var n=null;for("number"==typeof t&&(n=t,t=function(){return null});null!==n||null!==(n=t());)n<128?e(127&n):n<2048?(e(192|31&n>>6),e(128|63&n)):n<65536?(e(224|15&n>>12),e(128|63&n>>6),e(128|63&n)):(e(240|7&n>>18),e(128|63&n>>12),e(128|63&n>>6),e(128|63&n)),n=null},decodeUTF8:function(t,e){for(var n,i,r,o,s=function(t){t=t.slice(0,t.indexOf(null));var e=Error(t.toString());throw e.name="TruncatedError",e.bytes=t,e};null!==(n=t());)if(0==(128&n))e(n);else if(192==(224&n))null===(i=t())&&s([n,i]),e((31&n)<<6|63&i);else if(224==(240&n))(null===(i=t())||null===(r=t()))&&s([n,i,r]),e((15&n)<<12|(63&i)<<6|63&r);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(i=t())||null===(r=t())||null===(o=t()))&&s([n,i,r,o]),e((7&n)<<18|(63&i)<<12|(63&r)<<6|63&o)}},UTF16toUTF8:function(t,e){for(var n,i=null;null!==(n=null!==i?i:t());)n>=55296&&n<=57343&&null!==(i=t())&&i>=56320&&i<=57343?(e(1024*(n-55296)+i-56320+65536),i=null):e(n);null!==i&&e(i)},UTF8toUTF16:function(t,e){var n=null;for("number"==typeof t&&(n=t,t=function(){return null});null!==n||null!==(n=t());)n<=65535?e(n):(e(55296+((n-=65536)>>10)),e(n%1024+56320)),n=null},encodeUTF16toUTF8:function(e,n){t.UTF16toUTF8(e,(function(e){t.encodeUTF8(e,n)}))},decodeUTF8toUTF16:function(e,n){t.decodeUTF8(e,(function(e){t.UTF8toUTF16(e,n)}))},calculateCodePoint:function(t){return t<128?1:t<2048?2:t<65536?3:4},calculateUTF8:function(t){for(var e,n=0;null!==(e=t());)n+=e<128?1:e<2048?2:e<65536?3:4;return n},calculateUTF16asUTF8:function(e){var n=0,i=0;return t.UTF16toUTF8(e,(function(t){++n,i+=t<128?1:t<2048?2:t<65536?3:4})),[n,i]}};return t}(),o.toUTF8=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}var i;try{u.decodeUTF8toUTF16(function(){return e>t?this.view[t++]:null}.bind(this),i=n())}catch(n){if(t!==e)throw RangeError("Illegal range: Truncated data, "+t+" != "+e)}return i()},l.fromUTF8=function(t,n,i){if(!i&&"string"!=typeof t)throw TypeError("Illegal str: Not a string");var r=new l(u.calculateUTF16asUTF8(e(t),!0)[1],n,i),o=0;return u.encodeUTF16toUTF8(e(t),(function(t){r.view[o++]=t})),r.limit=o,r},l}(e),i=function(e,n){var i,r,o={};return o.ByteBuffer=e,o.c=e,i=e,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 t={};return t.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),t.XHR=function(){var t,e=[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(t=0;t<e.length;t++){try{n=e[t]()}catch(t){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},t.fetch=function(e,n){if(n&&"function"!=typeof n&&(n=null),t.IS_NODE)if(n)g.readFile(e,(function(t,e){n(t?null:""+e)}));else try{return g.readFileSync(e)}catch(t){return null}else{var i=t.XHR();if(i.open("GET",e,!!n),i.setRequestHeader("Accept","text/plain"),"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/plain"),!n)return i.send(null),200==i.status||0==i.status&&"string"==typeof i.responseText?i.responseText:null;if(i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0==i.status&&"string"==typeof i.responseText?n(i.responseText):n(null))},4==i.readyState)return;i.send(null)}},t.toCamelCase=function(t){return t.replace(/_([a-zA-Z])/g,(function(t,e){return e.toUpperCase()}))},t}(),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(t,e){function n(t,n){var i=-1,r=1;if("-"==t.charAt(0)&&(r=-1,t=t.substring(1)),e.NUMBER_DEC.test(t))i=parseInt(t);else if(e.NUMBER_HEX.test(t))i=parseInt(t.substring(2),16);else{if(!e.NUMBER_OCT.test(t))throw Error("illegal id value: "+(r<0?"-":"")+t);i=parseInt(t.substring(1),8)}if(i=0|r*i,!n&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+t);return i}function i(t){var n=1;if("-"==t.charAt(0)&&(n=-1,t=t.substring(1)),e.NUMBER_DEC.test(t))return n*parseInt(t,10);if(e.NUMBER_HEX.test(t))return n*parseInt(t.substring(2),16);if(e.NUMBER_OCT.test(t))return n*parseInt(t.substring(1),8);if("inf"===t)return 1/0*n;if("nan"===t)return NaN;if(e.NUMBER_FLT.test(t))return n*parseFloat(t);throw Error("illegal number value: "+(n<0?"-":"")+t)}function r(t,e,n){void 0===t[e]?t[e]=n:(Array.isArray(t[e])||(t[e]=[t[e]]),t[e].push(n))}var o,s,a={},c=function(t){this.source=t+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._readString=function(){var t,n='"'===this._stringOpen?e.STRING_DQ:e.STRING_SQ;if(n.lastIndex=this.index-1,!(t=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,t[1]},u.next=function(){var t,n,i,r,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(t=!1;e.WHITESPACE.test(i=this.source.charAt(this.index));)if("\n"===i&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,t=!0}else{if("*"!==(i=this.source.charAt(this.index)))return"/";do{if("\n"===i&&++this.line,++this.index===this.source.length)return null;n=i,i=this.source.charAt(this.index)}while("*"!==n||"/"!==i);++this.index,t=!0}}while(t);if(this.index===this.source.length)return null;if(r=this.index,e.DELIM.lastIndex=0,!e.DELIM.test(this.source.charAt(r++)))for(;r<this.source.length&&!e.DELIM.test(this.source.charAt(r));)++r;return('"'===(o=this.source.substring(this.index,this.index=r))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var t=this.next();if(null===t)return null;this.stack.push(t)}return this.stack[0]},u.skip=function(t){var e=this.next();if(e!==t)throw Error("illegal '"+e+"', '"+t+"' expected")},u.omit=function(t){return this.peek()===t&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,o=function(t){this.tn=new c(t),this.proto3=!1},(s=o.prototype).parse=function(){var t,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;t=this.tn.next();)switch(t){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(t=this.tn.next(),!e.TYPEREF.test(t))throw Error("illegal package name: "+t);this.tn.skip(";"),n.package=t;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(t=this.tn.peek())&&this.tn.next(),t=this._readString(),this.tn.skip(";"),n.imports.push(t);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),i=!1;break;case"enum":this._parseEnum(n),i=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+t+"'")}}catch(t){throw t.message="Parse error at line "+this.tn.line+": "+t.message,t}return delete n.name,n},o.parse=function(t){return new o(t).parse()},s._readString=function(){var t,e,n="";do{if("'"!==(e=this.tn.next())&&'"'!==e)throw Error("illegal string delimiter: "+e);n+=this.tn.next(),this.tn.skip(e),t=this.tn.peek()}while('"'===t||'"'===t);return n},s._readValue=function(t){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),e.NUMBER.test(n))return i(n);if(e.BOOL.test(n))return"true"===n.toLowerCase();if(t&&e.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(t,n){var i,r=this.tn.next(),o=!1;if("("===r&&(o=!0,r=this.tn.next()),!e.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,o&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),e.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(t,i),n||this.tn.skip(";")},s._parseOptionValue=function(t,n){var i=this.tn.peek();if("{"!==i)r(t.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!e.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(t.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(t,n+"."+i)}},s._parseService=function(t){var n,i=this.tn.next();if(!e.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);for(n={name:i,rpc:{},options:{}},this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(n);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(n)}this.tn.omit(";"),t.services.push(n)},s._parseServiceRPC=function(t){var n,i,r="rpc",o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.request_stream=!0,o=this.tn.next()),!e.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(i.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.response_stream=!0,o=this.tn.next()),i.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===t[r]&&(t[r]={}),t[r][n]=i},s._parseMessage=function(t,i){var r=!!i,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!e.NAME.test(o))throw Error("illegal "+(r?"group":"message")+" name: "+o);for(s.name=o,r&&(this.tn.skip("="),i.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(o=this.tn.next());)if(e.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(!e.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(";"),t.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(t,i,r){var o,s,a;if(!e.RULE.test(i))throw Error("illegal message field rule: "+i);if(o={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!e.TYPE.test(s)&&!e.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!e.TYPE.test(s)&&!e.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!e.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(t,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(!e.TYPE.test(r)&&!e.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(o.type=r,s=this.tn.next(),!e.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 t.fields.push(o),o},s._parseMessageOneOf=function(t){var n,i,r,o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal oneof name: "+o);for(i=o,r=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(t,"optional",o)).oneof=i,r.push(n.id);this.tn.omit(";"),t.oneofs[i]=r},s._parseFieldOptions=function(t){this.tn.skip("[");for(var e=!0;"]"!==this.tn.peek();)e||this.tn.skip(","),this._parseOption(t,!0),e=!1;this.tn.next()},s._parseEnum=function(t){var i,r={name:"",values:[],options:{}},o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal name: "+o);for(r.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(r);else{if(!e.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),i={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),t.enums.push(r)},s._parseExtensionRanges=function(){var e,n,r,o=[];do{for(n=[];;){switch(e=this.tn.next()){case"min":r=t.ID_MIN;break;case"max":r=t.ID_MAX;break;default:r=i(e)}if(n.push(r),2===n.length)break;if("to"!==this.tn.peek()){n.push(r);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(t){var n,i=this.tn.next();if(!e.TYPEREF.test(i))throw Error("illegal extend reference: "+i);for(n={ref:i,fields:[]},this.tn.skip("{");"}"!==(i=this.tn.next());)if(e.RULE.test(i))this._parseMessageField(n,i);else{if(!e.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(n,"optional",i)}return this.tn.omit(";"),t.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(t){function n(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function r(e,n){var i=n.readVarint32(),o=7&i,s=i>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(128==(128&i));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:i=n.readVarint32(),n.offset+=i;break;case t.WIRE_TYPES.STARTGROUP:r(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,c,u,l,h,d,p,g,f,_,E,v,T,C,m={},y=function(t,e,n){this.builder=t,this.parent=e,this.name=n,this.className},I=y.prototype;return I.fqn=function(){for(var t=this.name,e=this;null!=(e=e.parent);)t=e.name+"."+t;return t},I.toString=function(t){return(t?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},m.T=y,o=function(t,e,n,i,r){y.call(this,t,e,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(y.prototype)).getChildren=function(t){var e,n,i;if(null==(t=t||null))return this.children.slice();for(e=[],n=0,i=this.children.length;i>n;++n)this.children[n]instanceof t&&e.push(this.children[n]);return e},s.addChild=function(t){var e;if(e=this.getChild(t.name))if(e instanceof u.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName))e.name=e.originalName;else{if(!(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+t.name);t.name=t.originalName}this.children.push(t)},s.getChild=function(t){var e,n,i="number"==typeof t?"id":"name";for(e=0,n=this.children.length;n>e;++e)if(this.children[e][i]===t)return this.children[e];return null},s.resolve=function(t,e){var n,i="string"==typeof t?t.split("."):t,r=this,o=0;if(""===i[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof m.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof m.T&&(!e||n instanceof m.Namespace))){r=null;break}r=n,o++}while(o<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(t,e)}while(null!=r);return r},s.qn=function(t){var e,n,i=[],r=t;do{i.unshift(r.name),r=r.parent}while(null!==r);for(e=1;e<=i.length;e++)if(n=i.slice(i.length-e),t===this.resolve(n,t instanceof m.Namespace))return n.join(".");return t.fqn()},s.build=function(){var t,e,n,i={},r=this.children;for(e=0,n=r.length;n>e;++e)(t=r[e])instanceof o&&(i[t.name]=t.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},s.buildOpt=function(){var t,e,n,i,r={},o=Object.keys(this.options);for(t=0,e=o.length;e>t;++t)n=o[t],i=this.options[o[t]],r[n]=i;return r},s.getOption=function(t){return void 0===t?this.options:void 0!==this.options[t]?this.options[t]:null},m.Namespace=o,a=function(e,n,i,r){if(this.type=e,this.resolvedType=n,this.isMapKey=i,this.syntax=r,i&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},c=a.prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new i(0):e.defaultValue},c.verifyValue=function(i){var r,o,s,a=function(t,e){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+t+" ("+e+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i>4294967295?0|i:i;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i<0?i>>>0:i;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return n(i,!1)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return n(i,!0)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof i&&a(typeof i,"not a boolean"),i;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof i&&a(typeof i,"not a number"),i;case t.TYPES.string:return"string"==typeof i||i&&i instanceof String||a(typeof i,"not a string"),""+i;case t.TYPES.bytes:return e.isByteBuffer(i)?i:e.wrap(i);case t.TYPES.enum:for(r=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<r.length;s++){if(r[s].name==i)return r[s].id;if(r[s].id==i)return r[s].id}if("proto3"===this.syntax)return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),(i>4294967295||i<0)&&a(typeof i,"not in range for uint32"),i;a(i,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(i&&"object"==typeof i||a(typeof i,"object expected"),i instanceof this.resolvedType.clazz)return i;if(i instanceof t.Builder.Message){for(s in o={},i)i.hasOwnProperty(s)&&(o[s]=i[s]);i=o}return new this.resolvedType.clazz(i)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+i+" (undefined type "+this.type+")")},c.calculateLength=function(e,n){if(null===n)return 0;var r;switch(this.type){case t.TYPES.int32:return n<0?i.calculateVarint64(n):i.calculateVarint32(n);case t.TYPES.uint32:return i.calculateVarint32(n);case t.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(n));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return i.calculateVarint64(n);case t.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(n));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return i.calculateVarint32(n);case t.TYPES.double:return 8;case t.TYPES.string:return r=i.calculateUTF8Bytes(n),i.calculateVarint32(r)+r;case t.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return i.calculateVarint32(n.remaining())+n.remaining();case t.TYPES.message:return r=this.resolvedType.calculate(n),i.calculateVarint32(r)+r;case t.TYPES.group:return(r=this.resolvedType.calculate(n))+i.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},c.encodeValue=function(e,n,r){var o,s;if(null===n)return r;switch(this.type){case t.TYPES.int32:n<0?r.writeVarint64(n):r.writeVarint32(n);break;case t.TYPES.uint32:r.writeVarint32(n);break;case t.TYPES.sint32:r.writeVarint32ZigZag(n);break;case t.TYPES.fixed32:r.writeUint32(n);break;case t.TYPES.sfixed32:r.writeInt32(n);break;case t.TYPES.int64:case t.TYPES.uint64:r.writeVarint64(n);break;case t.TYPES.sint64:r.writeVarint64ZigZag(n);break;case t.TYPES.fixed64:r.writeUint64(n);break;case t.TYPES.sfixed64:r.writeInt64(n);break;case t.TYPES.bool:"string"==typeof n?r.writeVarint32("false"===n.toLowerCase()?0:!!n):r.writeVarint32(n?1:0);break;case t.TYPES.enum:r.writeVarint32(n);break;case t.TYPES.float:r.writeFloat32(n);break;case t.TYPES.double:r.writeFloat64(n);break;case t.TYPES.string:r.writeVString(n);break;case t.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,r.writeVarint32(n.remaining()),r.append(n),n.offset=o;break;case t.TYPES.message:s=(new i).LE(),this.resolvedType.encode(n,s),r.writeVarint32(s.offset),r.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(n,r),r.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return r},c.decode=function(e,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(r=e.clone()).limit=r.offset+o,e.offset+=o,r;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,i)}throw Error("[INTERNAL] Illegal decode type")},c.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return i.fromBinary(e)}},c.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},m.Element=a,u=function(t,e,n,i,r,s){o.call(this,t,e,n,i,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!r,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=u.prototype=Object.create(o.prototype)).build=function(n){var r,o,s,a;if(this.clazz&&!n)return this.clazz;for(r=function(t,n){function r(e,n,o,s){var a,c,u,l,h,d,p;if(null===e||"object"!=typeof e)return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(i.isByteBuffer(e))return n?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(t,e){c[e]=r(t,n,o,s)})),c;if(c={},e instanceof t.Map){for(l=(u=e.entries()).next();!l.done;l=u.next())c[e.keyElem.valueToString(l.value[0])]=r(l.value[1],n,o,e.valueElem.resolvedType);return c}for(p in h=e.$type,d=void 0,e)e.hasOwnProperty(p)&&(c[p]=h&&(d=h.getChild(p))?r(e[p],n,o,d.resolvedType):r(e[p],n,o));return c}var o,s,a=n.getChildren(t.Reflect.Message.Field),c=n.getChildren(t.Reflect.Message.OneOf),u=function(e){var r,o,s,l;for(t.Builder.Message.call(this),r=0,o=c.length;o>r;++r)this[c[r].name]=null;for(r=0,o=a.length;o>r;++r)this[(s=a[r]).name]=s.repeated?[]:s.map?new t.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof u)||Array.isArray(e)||e instanceof t.Map||i.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(r=0,o=arguments.length;o>r;++r)void 0!==(l=arguments[r])&&this.$set(a[r].name,l);else this.$set(e)},l=u.prototype=Object.create(t.Builder.Message.prototype);for(l.add=function(e,i,r){var o=n._fieldsByName[e];if(!r){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");i=o.verifyValue(i,!0)}return null===this[e]&&(this[e]=[]),this[e].push(i),this},l.$add=l.add,l.set=function(e,i,r){var o,s,a;if(e&&"object"==typeof e){for(o in r=i,e)e.hasOwnProperty(o)&&void 0!==(i=e[o])&&this.$set(o,i,r);return this}if(s=n._fieldsByName[e],r)this[e]=i;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=i=s.verifyValue(i)}return s&&s.oneof&&(a=this[s.oneof.name],null!==i?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(e,i){if(i)return this[e];var r=n._fieldsByName[e];if(!(r&&r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));return this[r.name]},l.$get=l.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(t){var e,i,r,o=t.originalName.replace(/(_[a-zA-Z])/g,(function(t){return t.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),e=t.originalName.replace(/([A-Z])/g,(function(t){return"_"+t})),i=function(e,n){return this[t.name]=n?e:t.verifyValue(e),this},r=function(){return this[t.name]},null===n.getChild("set"+o)&&(l["set"+o]=i),null===n.getChild("set_"+e)&&(l["set_"+e]=i),null===n.getChild("get"+o)&&(l["get"+o]=r),null===n.getChild("get_"+e)&&(l["get_"+e]=r)}(s);return l.encode=function(t,i){var r,o;"boolean"==typeof t&&(i=t,t=void 0),r=!1,t||(t=new e,r=!0),o=t.littleEndian;try{return n.encode(this,t.LE(),i),(r?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},u.encode=function(t,e,n){return new u(t).encode(e,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(t){var e,r=!1;return t||(t=new i,r=!0),e=(new i).LE(),n.encode(this,e).flip(),t.writeVarint32(e.remaining()),t.append(e),r?t.flip():t},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toArrayBuffer()),t}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toBuffer()),t}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toBase64()),t}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toHex()),t}},l.toHex=l.encodeHex,l.toRaw=function(t,e){return r(this,!!t,!!e,this.$type)},l.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},u.decode=function(t,e){var r,o;"string"==typeof t&&(t=i.wrap(t,e||"base64")),r=(t=i.isByteBuffer(t)?t:i.wrap(t)).littleEndian;try{return o=n.decode(t.LE()),t.LE(r),o}catch(e){throw t.LE(r),e}},u.decodeDelimited=function(t,e){var r,o,s;if("string"==typeof t&&(t=i.wrap(t,e||"base64")),(t=i.isByteBuffer(t)?t:i.wrap(t)).remaining()<1)return null;if(r=t.offset,o=t.readVarint32(),t.remaining()<o)return t.offset=r,null;try{return s=n.decode(t.slice(t.offset,t.offset+o).LE()),t.offset+=o,s}catch(e){throw t.offset+=o,e}},u.decode64=function(t){return u.decode(t,"base64")},u.decodeHex=function(t){return u.decode(t,"hex")},u.decodeJSON=function(t){return new u(JSON.parse(t))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),u}(t,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 u||o instanceof v){if(r.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");r[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},l.encode=function(t,e,n){var i,r,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)r=t[(i=this._fields[o]).name],i.required&&null===r?null===c&&(c=i):i.encode(n?r:i.verifyValue(r),e,t);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=e,a;return e},l.calculate=function(t){for(var e,n,i=0,r=0,o=this._fields.length;o>r;++r){if(n=t[(e=this._fields[r]).name],e.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+e);i+=e.calculate(n,t)}return i},l.decode=function(e,n,i){var o,s,a,c,u,l,h,d,p,g,f,_;for(n="number"==typeof n?n:-1,u=e.offset,l=new this.clazz;e.offset<u+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.WIRE_TYPES.ENDGROUP){if(a!==i)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(i?i+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?l[c.name].push(c.decode(s,e)):c.map?(d=c.decode(s,e),l[c.name].set(d[0],d[1])):(l[c.name]=c.decode(s,e),c.oneof&&(null!==(p=l[c.oneof.name])&&p!==c.name&&(l[p]=null),l[c.oneof.name]=c.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:h=e.readVarint32(),e.offset+=h;break;case t.WIRE_TYPES.STARTGROUP:for(;r(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(g=0,f=this._fields.length;f>g;++g)if(null===l[(c=this._fields[g]).name])if("proto3"===this.syntax)l[c.name]=c.defaultValue;else{if(c.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=l,_;t.populateDefaults&&null!==c.defaultValue&&(l[c.name]=c.defaultValue)}return l},m.Message=u,h=function(e,n,i,r,o,s,a,c,l,h){y.call(this,e,n,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(y.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},d.verifyValue=function(e,n){var i,r,o;if(n=n||!1,i=function(t,e){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+t+" ("+e+")")}.bind(this),null===e)return this.required&&i(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&i(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],r=0;r<e.length;r++)o.push(this.element.verifyValue(e[r]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||i(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&i(typeof e,"no array expected"),this.element.verifyValue(e))},d.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},d.encode=function(e,n,r){var o,s,a,c,u;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return n;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],n);a=n.offset-s,(c=i.calculateVarint32(a))>1&&(u=n.slice(s,n.offset),s+=c-1,n.offset=s,n.append(u)),n.writeVarint32(a,s-c)}else for(o=0;o<e.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],n);else this.map?e.forEach((function(e,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);n.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),n.writeVarint32(o),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,n)}),this):this.hasWirePresence(e,r)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,n))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return n},d.calculate=function(e,n){var r,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;r=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=i.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);r+=i.calculateVarint32(s),r+=s}else for(o=0;o<e.length;o++)r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r+=i.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r+=i.calculateVarint32(o),r+=o}),this):this.hasWirePresence(e,n)&&(r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},d.decode=function(e,n,i){var r,o,s,c,u,l,h;if(!(!this.map&&e==this.type.wireType||!i&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!i){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(c=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(e=7&(l=u.readVarint32()),1===(h=l>>>3))c=this.keyElement.decode(u,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(u,e,h)}return[c,r]}return this.element.decode(n,e,this.id)},m.Message.Field=h,p=function(t,e,n,i,r,o,s){h.call(this,t,e,n,null,i,r,o,s),this.extension},p.prototype=Object.create(h.prototype),m.Message.ExtensionField=p,g=function(t,e,n){y.call(this,t,e,n),this.fields=[]},m.Message.OneOf=g,f=function(t,e,n,i,r){o.call(this,t,e,n,i,r),this.className="Enum",this.object=null},f.getName=function(t,e){var n,i,r=Object.keys(t);for(i=0;i<r.length;++i)if(t[n=r[i]]===e)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(e){var n,i,r,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,r=0,o=(i=this.getChildren(f.Value)).length;o>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},m.Enum=f,_=function(t,e,n,i){y.call(this,t,e,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(y.prototype),m.Enum.Value=_,E=function(t,e,n,i){y.call(this,t,e,n),this.field=i},E.prototype=Object.create(y.prototype),m.Extension=E,v=function(t,e,n,i){o.call(this,t,e,n,i),this.className="Service",this.clazz=null},(v.prototype=Object.create(o.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(t,e){var n,r=function(e){t.Builder.Service.call(this),this.rpcImpl=e||function(t,e,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=r.prototype=Object.create(t.Builder.Service.prototype),s=e.getChildren(t.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(t){o[t.name]=function(n,r){try{try{n=t.resolvedRequestType.clazz.decode(i.wrap(n))}catch(t){if(!(t instanceof TypeError))throw t}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof t.resolvedRequestType.clazz||(n=new t.resolvedRequestType.clazz(n)),this.rpcImpl(t.fqn(),n,(function(n,i){if(!n){try{i=t.resolvedResponseType.clazz.decode(i)}catch(t){}return i&&i instanceof t.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+e.name+"#"+t.name))}r(n)}))}catch(t){setTimeout(r.bind(this,t),0)}},r[t.name]=function(e,n,i){new r(e)[t.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[t.name],"$options",{value:t.buildOpt()}),Object.defineProperty(o[t.name],"$options",{value:r[t.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:e.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:e}),Object.defineProperty(o,"$type",{value:e})),r}(t,this)},m.Service=v,T=function(t,e,n,i){y.call(this,t,e,n),this.className="Service.Method",this.options=i||{}},(T.prototype=Object.create(y.prototype)).buildOpt=s.buildOpt,m.Service.Method=T,C=function(t,e,n,i,r,o,s,a){T.call(this,t,e,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},C.prototype=Object.create(T.prototype),m.Service.RPCMethod=C,m}(o),o.Builder=function(t,e,n){function i(t){t.messages&&t.messages.forEach((function(e){e.syntax=t.syntax,i(e)})),t.enums&&t.enums.forEach((function(e){e.syntax=t.syntax}))}var r=function(t){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=t||{}},o=r.prototype;return r.isMessage=function(t){return"string"==typeof t.name&&(void 0===t.values&&void 0===t.rpc)},r.isMessageField=function(t){return"string"==typeof t.rule&&"string"==typeof t.name&&"string"==typeof t.type&&void 0!==t.id},r.isEnum=function(t){return"string"==typeof t.name&&!(void 0===t.values||!Array.isArray(t.values)||0===t.values.length)},r.isService=function(t){return!("string"!=typeof t.name||"object"!=typeof t.rpc||!t.rpc)},r.isExtend=function(t){return"string"==typeof t.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(t){if("string"!=typeof t||!e.TYPEREF.test(t))throw Error("illegal namespace: "+t);return t.split(".").forEach((function(t){var e=this.ptr.getChild(t);null===e&&this.ptr.addChild(e=new n.Namespace(this,this.ptr,t)),this.ptr=e}),this),this},o.create=function(e){var i,o,s,a,c;if(!e)return this;if(Array.isArray(e)){if(0===e.length)return this;e=e.slice()}else e=[e];for(i=[e];i.length>0;){if(e=i.pop(),!Array.isArray(e))throw Error("not a valid namespace: "+JSON.stringify(e));for(;e.length>0;){if(o=e.shift(),r.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(t){s.addChild(a[t]=new n.Message.OneOf(this,s,t))}),this),o.fields&&o.fields.forEach((function(t){if(null!==s.getChild(0|t.id))throw Error("duplicate or invalid field id in "+s.name+": "+t.id);if(t.options&&"object"!=typeof t.options)throw Error("illegal field options in "+s.name+"#"+t.name);var e=null;if("string"==typeof t.oneof&&!(e=a[t.oneof]))throw Error("illegal oneof in "+s.name+"#"+t.name+": "+t.oneof);t=new n.Message.Field(this,s,t.rule,t.keytype,t.type,t.name,t.id,t.options,e,o.syntax),e&&e.fields.push(t),s.addChild(t)}),this),c=[],o.enums&&o.enums.forEach((function(t){c.push(t)})),o.messages&&o.messages.forEach((function(t){c.push(t)})),o.services&&o.services.forEach((function(t){c.push(t)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){i.push(e),e=c,c=null,this.ptr=s,s=null;continue}c=null}else if(r.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(t){s.addChild(new n.Enum.Value(this,s,t.name,t.id))}),this),this.ptr.addChild(s);else if(r.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(t){var e=o.rpc[t];s.addChild(new n.Service.RPCMethod(this,s,t,e.request,e.response,!!e.request_stream,!!e.response_stream,e.options))}),this),this.ptr.addChild(s);else{if(!r.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(e){var i,r,o,a;if(null!==s.getChild(0|e.id))throw Error("duplicate extended field id in "+s.name+": "+e.id);if(s.extensions&&(i=!1,s.extensions.forEach((function(t){e.id>=t[0]&&e.id<=t[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+s.name+": "+e.id+" (not within valid ranges)");r=e.name,this.options.convertFieldsToCamelCase&&(r=t.Util.toCamelCase(r)),o=new n.Message.ExtensionField(this,s,e.rule,e.type,this.ptr.fqn()+"."+r,e.id,e.options),a=new n.Extension(this,this.ptr,e.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}e=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(e,n){var r,o,s,a,c,u,l,h,d="/";if("string"==typeof n){if(t.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(r=n.root,t.Util.IS_NODE,(r.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=r+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(e.imports&&e.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,c=0;c<e.imports.length;c++)if("string"==typeof e.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=e.imports[c]))continue;if(u=s+d+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!t.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(l=t.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(l+""),u):this.import(t.DotProto.Parser.parse(l),u)}else n?/\.(\w+)$/.test(n)?this.import(e.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(t,e,n){return e+"_import"+c+"."+n}))):this.import(e.imports[c],n+"_import"+c):this.import(e.imports[c]);a&&(this.importRoot=null)}return e.package&&this.define(e.package),e.syntax&&i(e),h=this.ptr,e.options&&Object.keys(e.options).forEach((function(t){h.options[t]=e.options[t]})),e.messages&&(this.create(e.messages),this.ptr=h),e.enums&&(this.create(e.enums),this.ptr=h),e.services&&(this.create(e.services),this.ptr=h),e.extends&&this.create(e.extends),this.reset()},o.resolveAll=function(){var i;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(t){this.ptr=t,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(e.TYPE.test(this.ptr.type))this.ptr.type=t.TYPES[this.ptr.type];else{if(!e.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(i=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=i,i instanceof n.Enum){if(this.ptr.type=t.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==i.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(i instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=i.isGroup?t.TYPES.group:t.TYPES.message}}if(this.ptr.map){if(!e.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=t.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof t.Reflect.Service.Method){if(!(this.ptr instanceof t.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((i=this.ptr.parent.resolve(this.ptr.requestName,!0))&&i instanceof t.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=i,!((i=this.ptr.parent.resolve(this.ptr.responseName,!0))&&i instanceof t.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}else if(!(this.ptr instanceof t.Reflect.Message.OneOf||this.ptr instanceof t.Reflect.Extension||this.ptr instanceof t.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(t){var e,n,i;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!t)return this.result;for(e="string"==typeof t?t.split("."):t,n=this.result,i=0;i<e.length;i++){if(!n[e[i]]){n=null;break}n=n[e[i]]}return n},o.lookup=function(t,e){return t?this.ns.resolve(t,e):this.ns},o.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(o,o.Lang,o.Reflect),o.Map=function(t,e){function n(t){var e=0;return{next:function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}}var i=function(t,n){var i,r,o,s;if(!t.map)throw Error("field is not a map");if(this.field=t,this.keyElem=new e.Element(t.keyType,null,!0,t.syntax),this.valueElem=new e.Element(t.type,t.resolvedType,!1,t.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(i=Object.keys(n),r=0;r<i.length;r++)o=this.keyElem.valueFromString(i[r]),s=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t)),n=e in this.map;return delete this.map[e],n},r.entries=function(){var t,e,i=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)i.push([(t=this.map[r[e]]).key,t.value]);return n(i)},r.keys=function(){var t,e=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)e.push(this.map[i[t]].key);return n(e)},r.values=function(){var t,e=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)e.push(this.map[i[t]].value);return n(e)},r.forEach=function(t,e){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)t.call(e,(n=this.map[r[i]]).value,n.key,this)},r.set=function(t,e){var n=this.keyElem.verifyValue(t),i=this.valueElem.verifyValue(e);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t));return e in this.map?this.map[e].value:void 0},r.has=function(t){return this.keyElem.valueToString(this.keyElem.verifyValue(t))in this.map},i}(0,o.Reflect),o.loadProto=function(t,e,n){return("string"==typeof e||e&&"string"==typeof e.file&&"string"==typeof e.root)&&(n=e,e=void 0),o.loadJson(o.DotProto.Parser.parse(t),e,n)},o.protoFromString=o.loadProto,o.loadProtoFile=function(t,e,n){if(e&&"object"==typeof e?(n=e,e=null):e&&"function"==typeof e||(e=null),e)return o.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,(function(i){if(null!==i)try{e(null,o.loadProto(i,n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===i?null:o.loadProto(i,n,t)},o.protoFromFile=o.loadProtoFile,o.newBuilder=function(t){return void 0===(t=t||{}).convertFieldsToCamelCase&&(t.convertFieldsToCamelCase=o.convertFieldsToCamelCase),void 0===t.populateAccessors&&(t.populateAccessors=o.populateAccessors),new o.Builder(t)},o.loadJson=function(t,e,n){return("string"==typeof e||e&&"string"==typeof e.file&&"string"==typeof e.root)&&(n=e,e=null),e&&"object"==typeof e||(e=o.newBuilder()),"string"==typeof t&&(t=JSON.parse(t)),e.import(t,n),e.resolveAll(),e},o.loadJsonFile=function(t,e,n){if(e&&"object"==typeof e?(n=e,e=null):e&&"function"==typeof e||(e=null),e)return o.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,(function(i){if(null!==i)try{e(null,o.loadJson(JSON.parse(i),n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===i?null:o.loadJson(JSON.parse(i),n,t)},r=t,o.loadProto(r,void 0,"").build("Modules").probuf}(n,e);return i}var ei,ni,ii=function(){function t(t,e,n){this.pbmaps=t,this.logger=n,this.pbModules=ti(e)}return t.prototype.getModule=function(t){return new this.pbModules[t]},t.prototype.encode=function(t,e,n){var i=new this.pbModules[t];if(e)try{this.pbmaps[t].forEach((function(t){var n=e[t];void 0!==n&&i["set".concat(function(t,e,n){if(void 0===e||void 0===n)return t.toUpperCase();var i=t.slice(e,n);return t.replace(i,(function(t){return t.toUpperCase()}))}(t,0,1))](n)}))}catch(e){var r="pbname: ".concat(t,", stack: ").concat(e.stack);this.logger?this.logger.error(ft.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(ft.L_PB_ENCODE_E,r)}return n?i:i.toArrayBuffer()},t.prototype.decode=function(t,e){var n=this.pbModules[t].decode(e);return this.fixInt64Values(n)},t.prototype.fixInt64Values=function(t){var e=this;if(t instanceof Array)return t.map((function(t){return e.fixInt64Values(t)}));if(!le(t))return t;if(void 0!==t.low&&void 0!==t.high&&Object.prototype.hasOwnProperty.call(t,"unsigned")){var n=t.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var i in t)t[i]=this.fixInt64Values(t[i]);return t},t}();!function(t){t[t.BJ=1]="BJ",t[t.SG=2]="SG",t[t.NA=3]="NA",t[t.SG_A=4]="SG_A",t[t.SG_B=4]="SG_B",t[t.SA=5]="SA"}(ni||(ni={}));var ri=((ei={})[ni.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnJvbmctZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},ei[ni.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1saWdodC1lZGdlLmNvbQ==",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},ei[ni.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi51cy1saWdodC1lZGdlLmNvbQ==",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnVzLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},ei[ni.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctYi1saWdodC1lZGdlLmNvbQ==","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWItbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},ei[ni.SA]={naviUrlBase64:["bmF2LnNhdS1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zYXUtbGlnaHQtZWRnZS5jb20=",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2F1LWxpZ2h0LWVkZ2UuY29t","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNhdS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]},ei);function oi(t){return ni[t]?t:ni.BJ}var si=function(){function t(){this.initOption={}}return t.prototype.init=function(t){this.initOption=t},t.prototype.getNaviUrlList=function(t,e){var n,i=this.initOption||{},r=i.areaCode,o=i.navigators,s=(n=r,void 0===n&&(n=ni.BJ),ri[oi(n)].naviUrlBase64).map((function(t){return Ye(t)})),a=[],c=t.split("@")[1];e&&(a=c?c.split(";"):[]);var u=o&&o.length>0?h(h([],a,!0),o,!0):h(h([],a,!0),s,!0);return u.filter((function(t,e){return u.indexOf(t)===e})).map((function(t){return cn(t)}))},t.prototype.getLogUrlPolicyList=function(t,e){var n,i=t||{},r=i.log,o=i.logPolicy,s=this.initOption||{},a=s.areaCode,u=s.logServerUrl,l=(n=a,void 0===n&&(n=ni.BJ),ri[oi(n)].logUrlBase64).map((function(t){return c(c({},t),{addr:Ye(t.addr)})})),d=[],p={level:1,itv:6,times:5};if(r)d.push.apply(d,r.addrs),Object.assign(p,r.policy);else if(o)try{var g=JSON.parse(o);d.push({addr:g.url,protocol:wt.HTTPS,weight:1}),p.level=g.level,p.itv=g.itv,p.times=g.times}catch(n){e.warn(ft.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:t.logPolicy}))}var f=u?h([{addr:u,protocol:wt.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:p,addrs:f.filter((function(t,e){return f.findIndex((function(e){return e.addr===t.addr&&e.protocol===t.protocol}))===e})).map((function(t){return c(c({},t),{addr:cn(t.addr,t.protocol)})})).sort((function(t,e){return e.weight-t.weight}))}},t.prototype.getMiniCmpUrlList=function(){var t,e,n=(e=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===e&&(e=ni.BJ),ri[oi(e)].miniCmpBase64).map((function(t){return Ye(t)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i:n},t.prototype.getStaticConfigUrl=function(){var t,e;return(e=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===e&&(e=ni.BJ),ri[oi(e)].staticConfigUrlBase64).map((function(t){return Ye(t)}))},t.prototype.getCloudControllerUrl=function(t){var e,n,i=null!=t?t:null===(e=this.initOption)||void 0===e?void 0:e.areaCode;return(n=i,void 0===n&&(n=ni.BJ),ri[oi(n)].cloudControllerUrlBase64).map((function(t){return Ye(t)}))},t.prototype.getAreaCode=function(){var t,e;return null!==(e=null===(t=this.initOption)||void 0===t?void 0:t.areaCode)&&void 0!==e?e:ni.BJ},t.prototype.setAreaCode=function(t){return!(!t||!ni[t]||t===this.initOption.areaCode)&&(this.initOption.areaCode=t,!0)},t}(),ai=new si,ci=function(){function t(t,e){this.appkey=t,this.logger=e,this.staticUrls=[]}return t.prototype.getStaticConfig=function(){var t;return u(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:if(!(e=this.getCache()))return[3,6];s.label=1;case 1:return s.trys.push([1,4,,5]),n=JSON.parse(e),Date.now()-(null==n?void 0:n.time)<K?[4,this.decryptData(n.val)]:[3,3];case 2:return[2,{navi:s.sent().resources.navi.sort((function(t,e){return e.weight-t.weight})).map((function(t){return cn(t.addr,t.protocol)}))||[]}];case 3:return[3,5];case 4:return i=s.sent(),this.logger.error(ft.L_GET_STATIC_CONF_E,JSON.stringify({error:null==i?void 0:i.stack})),[3,5];case 5:this.clearCache(),s.label=6;case 6:return[4,this._requestHandle()];case 7:return(r=s.sent())?[4,this.decryptData(r)]:[2];case 8:return(null==(o=s.sent())?void 0:o.areaCode)!==ai.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:r})),this.staticUrls=(null==o?void 0:o.bootstrap)||[],[2,{navi:(null===(t=null==o?void 0:o.resources)||void 0===t?void 0:t.navi.sort((function(t,e){return e.weight-t.weight})).map((function(t){return cn(t.addr,t.protocol)})))||[]}])}}))}))},t.prototype._requestHandle=function(){return u(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:t=(t=h(h([],this.staticUrls,!0),ai.getStaticConfigUrl(),!0).map((function(t){return cn(t)}))).filter((function(e,n){return t.indexOf(e)===n})),e=0,n=t,c.label=1;case 1:return e<n.length?(i=n[e],this.logger.info(ft.L_GET_STATIC_CONF_T,JSON.stringify({url:i})),r=Date.now(),[4,this.sendRequest("".concat(i,"/").concat(this.appkey))]):[3,4];case 2:if(o=c.sent(),s=o.code,a=o.data,200===s)return this.logger.info(ft.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),[2,a];this.logger.warn(ft.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),c.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t}(),ui=Ne(),li=Date.now(),hi=null,di="RC_LOGS",pi="RC_CONF",gi=null,fi=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,hi];case 1:return(e=n.sent())?[4,new Promise((function(n){var i=e.db.transaction(di,"readwrite").objectStore(di),r=IDBKeyRange.lowerBound(Date.now()-t),o=i.getAllKeys(r);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var r=i.delete(IDBKeyRange.bound(t[0],t[e-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),gi=setTimeout((function(){return fi(t)}),6e5),[2]}}))}))},_i=function(t,e,n,i){void 0===i&&(i=168),hi||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==mn(n).type?hi=new Promise((function(n){var r=window.indexedDB;r.databases&&r.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(t),s=r.open(o,1);s.onerror=function(t){e.error(ft.L_LOGDB_OPEN_FAILED_E,t.target.error),n(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(t){e.warn(ft.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(ft.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(ft.L_LOGDB_ABORT_S,t.target.error)},fi(3600*Math.max(24,Math.min(168,i))*1e3),n({appkey:t,db:o})):n(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(di)&&e.deleteObjectStore(di);var n=e.createObjectStore(di,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(pi,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(ft.L_UNSUPPORT_INDEXDB_O))},Ei=[],vi=function(){return u(void 0,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return hi?(gi&&(clearTimeout(gi),gi=null),[4,hi]):[2];case 1:return(t=n.sent())&&(e=t.db,Ei.push(e)),hi=null,[2]}}))}))},Ti=[],Ci=!1,mi=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return Ci||0===Ti.length?[2]:(Ci=!0,e=Ti.splice(0),[4,new Promise((function(n){var i=t.transaction(di,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(di);e.forEach((function(t){try{r.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),Ci=!1,0===Ti.length&&Ei.length>0&&(Ei.forEach((function(t){return t.close()})),Ei.length=0),setTimeout((function(){return mi(t)})),[2]}}))}))};function yi(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,hi];case 1:return(e=n.sent())?[2,new Promise((function(n){var i=e.db.transaction(pi,"readonly").objectStore(pi).get(t);i.onsuccess=function(t){var e;n({value:null===(e=i.result)||void 0===e?void 0:e.value,success:!0})},i.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Ii,Ri=0,Si=function(){return{setTimestamp4RealtimeLog:function(t){Ri=t},getTimestamp4RealtimeLog:function(){return Ri},getLogs:function(t,e,n,i){return u(this,void 0,void 0,(function(){var r;return l(this,(function(o){switch(o.label){case 0:return[4,hi];case 1:return(r=o.sent())?[2,new Promise((function(o){var s=r.db.transaction(di,"readonly").objectStore(di),a=[],c=IDBKeyRange.bound(t,e),u=s.index("time").openCursor(c);u.onsuccess=function(t){var e=t.target.result;if(e){var r=e.value;r.level<=n&&(i?r.sessionId===ui:r.level>=0)&&a.push(r),e.continue()}else o({dbReady:!0,logs:a})},u.onerror=function(t){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Oi="REPORT_SESSION",Ni=function(t,e){return u(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Oi,"_").concat(t),[4,yi("".concat(Oi,"_").concat(t))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(e===(null==o?void 0:o.sessionId)||function(t,e){u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,hi];case 1:return(n=r.sent())?(i=n.db,i.transaction(pi,"readwrite").objectStore(pi).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))};!function(t){t[t.STATISTICS=-2]="STATISTICS",t[t.RECORD=-1]="RECORD",t[t.FATAL=0]="FATAL",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"}(Ii||(Ii={}));var Mi=function(t){return[Ii.DEBUG,Ii.INFO,Ii.WARN,Ii.ERROR].some((function(e){return e===t}))},Li=0,Ui=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.outputLevel=Ii.WARN,this.debug=this._log.bind(this,Ii.DEBUG),this.info=this._log.bind(this,Ii.INFO),this.warn=this._log.bind(this,Ii.WARN),this.error=this._log.bind(this,Ii.ERROR),this.__statistics=this._log.bind(this,Ii.STATISTICS)}return t.prototype._stdout=function(t,e,n,i,r){if(!(t<=Ii.FATAL)&&console&&!(t>this.outputLevel)){var o=["error","warn","info","debug"][t-1];null===console||void 0===console||console[o]("".concat(n,"[").concat(this._id,"][").concat(o.toUpperCase(),"]: ").concat(e," | ").concat(i," | ").concat(r))}},t.prototype.setOutputLevel=function(t){Mi(t)&&(this.outputLevel=t)},t.prototype._log=function(t,e,n,i){var r=new Date;/^[\w-]+$/.test(e)?(this._stdout(t,e,r.toISOString(),n,i),t!==Ii.DEBUG&&this.flush({time:+r,sessionId:ui,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:i})):this._stdout(Ii.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),e,i)},t.prototype.createTraceId=function(){return"".concat(++Li)},t.prototype.getSessionId=function(){return ui},t}(),Ai=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){!function(t){u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,hi];case 1:return(e=n.sent())?(Ti.push(t),mi(e.db),[2]):[2]}}))}))}(t)},e}(Ui),bi=function(){function t(t,e,n,i,r){this.appkey=t,this.deviceId=e,this.deviceInfo=n,this.logDB=i,this.logger=r,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return t.prototype.checkStart=function(t){return u(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=ai.getLogUrlPolicyList(t,this.logger),n=e.policy,i=e.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},t.prototype.realtimeReport=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||li,o=Math.max(i-5e3,r),s=this.logger.createTraceId(),this.logger.debug(ft.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:e,itv:n}),s),[4,this.logDB.getLogs(r,o,e,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(ft.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return u.length>0?(this.logger.debug(ft.L_REALTIME_LOG_O,JSON.stringify({count:u.length}),s),[4,this.compressLogs(u)]):[3,5];case 3:return h=l.sent(),d=h.success,p=h.data,d||this.logger.warn(ft.L_REALTIME_LOG_O,"compress failed",s),this.logger.debug(ft.L_REALTIME_LOG_O,"compress done",s),g=ge(t)?t:"https://".concat(t),g+="?version=".concat("5.9.3","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:p,method:"POST"})];case 4:f=l.sent().status,this.logger.debug(ft.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(u[u.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++),l.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return _.realtimeReport(t,e,n)}),1e3*n)),[2]}}))}))},t.prototype.report=function(t,e,n,i,r,o,s){return void 0===s&&(s=!1),u(this,void 0,void 0,(function(){var a,c,u,h,d,p,g,f,_,E;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(a=this.logger.createTraceId(),this.logger.info(ft.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:r,messageUId:o,isCloudControl:s}),a),[4,this.logDB.getLogs(t,e,Ii.DEBUG,!1)]);case 1:return c=l.sent(),u=c.dbReady,h=c.logs,this.logger.info(ft.L_REPORT_FULL_LOG_O,JSON.stringify({count:h.length}),a),d=ge(i)?i:"https://".concat(i),d+="?version=".concat("5.9.3","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?h.length>0?[4,this.compressLogs(h)]:[3,3]:[3,5];case 2:return g=l.sent(),f=g.success,_=g.data,p=f?_:"compress failed",[3,4];case 3:p="no data",l.label=4;case 4:return[3,6];case 5:p="no database",l.label=6;case 6:return this.logger.debug(ft.L_REPORT_FULL_LOG_O,"compress done",a),s&&(d+="&source=cloud"),[4,this.send({url:d,body:p,method:"POST"})];case 7:return E=l.sent().status,this.logger.info(ft.L_REPORT_FULL_LOG_R,JSON.stringify({status:E}),a),[2]}}))}))},t.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},t}(),wi=48,Pi=64,Di=80,Vi=96,Gi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Bi=Gi.length,ki=function(t){for(var e={},n=0;n<t.length-1;n++){var i=t.charAt(n)+t.charAt(n+1);e.hasOwnProperty(i)?e[i].push(n):e[i]=[n]}for(var r=[],o=[],s=function(){if(o.length>0){var t=o.join("");if(o=[],t.length>26){var e=Fi(t.length),n=String.fromCharCode(Di|e.length);r.push(n+e)}else{var i=String.fromCharCode(Vi|t.length);r.push(i)}r.push(t)}},a=0;a<t.length;){var c=xi(e,t,a);if(c.length<2)o.push(t.charAt(a++));else if(c.length<4)o.push(t.substr(a,c.length)),a+=c.length;else{var u=Fi(a-c.offset),l=Fi(c.length);if(u.length+l.length>=c.length)o.push(t.substr(a,c.length)),a+=c.length;else{s();var h=String.fromCharCode(Pi|u.length<<2|l.length);r.push(h+u+l),a+=c.length}}}s();var d=Fi(t.length),p=String.fromCharCode(wi|d.length);return r.push(p+d),r.join("")},xi=function(t,e,n){var i={length:0,offset:-1};if(e.length,n>=e.length-1)return i;var r=t[e.charAt(n)+e.charAt(n+1)];if(r[0]===n)return i;for(var o=e.length-n,s=0,a=r.length;s<a;s++){var c=r[s],u=n-c;if(!(u>238327)){var l=Math.min(o,u);if(l<=i.length)break;if(!(i.length>2&&e.charAt(c+i.length-1)!==e.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&e.charAt(c+d)===e.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=c)}}}return i},Fi=function(t){var e=[],n=0;do{n=t%Bi,e.push(Gi.charAt(n)),t=(t-n)/Bi}while(t>0);return e.join("")},Hi=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},qi=function(t){var e=t.sessionId,n=t.level,i=t.loggerId,r=t.traceId,o=t.time,s=t.tag,a=t.type,c=t.content,u=n<0?c||"":JSON.stringify({content:c,traceId:r,from:i});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},Ki=function(t){function e(e,n,i,r){var o=this,s=Me(n),a=Hi(n),c="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=t.call(this,e,s,c,Si(),i)||this).runtime=n,o.clientReportLevel=r,Mi(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return a(e,t),e.prototype.send=function(t){return this.runtime.httpReq(t)},e.prototype.checkStart=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Ni(e.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressLogs=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:ki(t.map(qi).join(""))}]}))}))},e.prototype.isReporter=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,(e=this.userId,n=this.logger.getSessionId(),u(void 0,void 0,void 0,(function(){var t,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,yi("".concat(Oi,"_").concat(e))];case 1:return t=o.sent(),i=t.success,r=t.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,i,r,o,s,a){return void 0===a&&(a=!1),u(this,void 0,void 0,(function(){var c;return l(this,(function(u){switch(u.label){case 0:return[4,this.isReporter()];case 1:return c=u.sent(),this.userId&&!c?[2]:[2,t.prototype.report.call(this,e,n,i,r,o,s,a)]}}))}))},e.prototype.realtimeReport=function(e,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,t.prototype.realtimeReport.call(this,e,n,i)]}))}))},e}(bi),Yi=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(t,e,n){return void 0===e&&(e=Date.now()-Yi),void 0===n&&(n=Date.now()),u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return e=e<0?Date.now()+e:e,(n=n<=0?Date.now():n)-e>Yi&&(e=n-Yi),(i=new Ai(t,"RC-IM","IM")).debug(ft.T,"get logs: startTime ".concat(e," endTime ").concat(n)),_i(t,i,{tag:"browser"}),[4,Si().getLogs(e,n,Ii.DEBUG,!1)];case 1:return r=o.sent().logs,i.debug(ft.T,"get logs ".concat(r.length)),function(t,e){var n=e.map((function(t){var e=t.sessionId,n=t.time,i=t.type,r=t.level,o=t.tag,s=t.traceId,a=t.loggerId,c=t.content;return"".concat(e,",").concat(n,",").concat(i,",").concat(r,",").concat(o,",").concat(s,",").concat(a,',"').concat(c,'"\n')})),i=new Blob(n,{type:"text/csv"}),r=URL.createObjectURL(i),o=document.createElement("a");o.href=r,o.download="".concat(t,".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}("".concat(t,"-").concat(e,"-").concat(n),r),[2]}}))}))}}}}var ji,Wi,Qi,Ji,Xi,Zi,zi,$i=function(){function t(t){this._context=t}return t.prototype.__getContext=function(){return this._context},t.prototype.createCodec=function(t,e){return this._context.createCodec(t,e)},t.prototype.refetchNaviInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._context.refetchNaviInfo()]}))}))},t.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},t.prototype.getCoreVersion=function(){return"5.9.3"},t.prototype.getAPIVersion=function(){return"5.9.3"},t.prototype.getAppkey=function(){return this._context.appkey},t.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},t.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},t.prototype.getDeviceId=function(){return this._context.getDeviceId()},t.prototype.sendMessage=function(t,e,n){return this._context.sendMessage(t,e,n)},t.prototype.registerMessageType=function(t,e,n,i){void 0===i&&(i=[]),this._context.registerMessageType(t,e,n,i)},t.prototype.getServerTime=function(){return this._context.getServerTime()},t.prototype.getOSInfo=function(){return this._context.getOSInfo()},t.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},t.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},t.prototype.setCallInfo=function(t,e,n){return this._context.setCallInfo(t,e,n)},t.prototype.createLogger=function(t,e){return this._context.createLogger(t,e)},t.prototype.createStatisticLogger=function(t,e){return this._context.createStatisticLogger(t,e)},t}(),tr="pgMsgP",er="chatMsg",nr="pcMsgP",ir="pbMsgP",rr={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},or="delMsg",sr="joinChrm",ar="joinChrmR",cr="exitChrm",ur="setKV",lr="delKV",hr="setKVS",dr="delKVS",pr="qryRelationR",gr="delRelation",fr="delRelationBatch",_r="setSeAtt",Er={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},vr="cleanMsgBatch",Tr="reqCall",Cr="pullKvMsg",mr="qryPMsg",yr="qryGMsg",Ir="qryCHMsg",Rr="qryCMsg",Sr="qrySMsg",Or=((ji={})["ppMsgP"]=tt.PRIVATE,ji[tr]=tt.GROUP,ji[er]=tt.CHATROOM,ji[nr]=tt.CUSTOMER_SERVICE,ji[ir]=tt.SYSTEM,ji),Nr=((Wi={})[tt.PRIVATE]=mr,Wi[tt.GROUP]=yr,Wi[tt.CHATROOM]=Ir,Wi[tt.CUSTOMER_SERVICE]=Rr,Wi[tt.SYSTEM]=Sr,Wi),Mr=((Qi={})[tt.PRIVATE]=Er.PRIVATE,Qi[tt.GROUP]=Er.GROUP,Qi[tt.ULTRA_GROUP]=Er.ULTRA_GROUP,Qi[tt.CUSTOMER_SERVICE]=Er.CUSTOMER_SERVICE,Qi[tt.SYSTEM]=Er.SYSTEM,Qi),Lr="1",Ur="0",Ar=1,br=2,wr=3;!function(t){t[t.AT_MOST_ONCE=0]="AT_MOST_ONCE",t[t.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",t[t.EXACTLY_ONCE=2]="EXACTLY_ONCE",t[t.DEFAULT=3]="DEFAULT"}(Ji||(Ji={})),function(t){t[t.SYMMETRIC=0]="SYMMETRIC",t[t.CONNECT=1]="CONNECT",t[t.CONN_ACK=2]="CONN_ACK",t[t.PUBLISH=3]="PUBLISH",t[t.PUB_ACK=4]="PUB_ACK",t[t.QUERY=5]="QUERY",t[t.QUERY_ACK=6]="QUERY_ACK",t[t.QUERY_CONFIRM=7]="QUERY_CONFIRM",t[t.SUBSCRIBE=8]="SUBSCRIBE",t[t.SUB_ACK=9]="SUB_ACK",t[t.UNSUBSCRIBE=10]="UNSUBSCRIBE",t[t.UNSUB_ACK=11]="UNSUB_ACK",t[t.PING_REQ=12]="PING_REQ",t[t.PING_RESP=13]="PING_RESP",t[t.DISCONNECT=14]="DISCONNECT",t[t.RESERVER2=15]="RESERVER2"}(Xi||(Xi={})),function(t){t.PUB="pub",t.QUERY="qry"}(Zi||(Zi={})),function(t){t[t.V4=4]="V4",t[t.V3=3]="V3"}(zi||(zi={}));var Pr,Dr=function(){function t(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=Ji.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Ji.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1,t&&t>0&&1===arguments.length?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=8==(8&t)):(this.type=t,this._retain=e,this.qos=n,this._dup=i)}return t.prototype.encode=function(){var t=this.type<<4;return t|=this._retain?1:0,t|=this.qos<<1,t|=this._dup?8:0},t}(),Vr=function(){function t(){}return t.writeUTF=function(t,e){for(var n=this._getBackAndByteSize(t),i=n.back,r=n.byteSize,o=0,s=i.length;o<s;o++)i[o]>255&&(i[o]&=255);return e?i:r<=255?[0,r].concat(i):[r>>8,255&r].concat(i)},t._getBackAndByteSize=function(t){var e=[],n=0;if(ie(t))for(var i=0,r=t.length;i<r;i++){var o=t.charCodeAt(i);o>=0&&o<=127?(n+=1,e.push(o)):o>=128&&o<=2047?(n+=2,e.push(192|31&o>>6),e.push(128|63&o)):o>=2048&&o<=65535&&(n+=3,e.push(224|15&o>>12),e.push(128|63&o>>6),e.push(128|63&o))}return{byteSize:n,back:e}},t.readUTF=function(t){for(var e,n,i=[],r=-1,o=t,s="";++r<o.length;){var a=Number(o[r]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++r])<<6|128^o[++r])<<6|128^o[++r]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++r])<<6|128^o[++r]:192==(192&a)&&(a=(a^=192)<<6|128^o[++r])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?i.push(a):(e=(a-=65536)>>10|55296,n=a%1024|56320,i.push(e,n)),(r+1===o.length||i.length>16384)&&(s+=String.fromCharCode.apply(null,i),i.length=0)}return s},t}(),Gr=function(){function t(t){this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return t.prototype.check=function(){return this._position>=this._pool.length},t.prototype.read2Byte=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<2;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i.toString()}return parseInt(e,16)},t.prototype.readInt=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<4;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i.toString()}return parseInt(e,16)},t.prototype.readLong=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<8;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i}return parseInt(e,16)},t.prototype.readByte=function(){if(this.check())return-1;var t=this._pool[this._position++];return t>255&&(t&=255),t},t.prototype.readUTF=function(){if(this.check())return"";var t=this.readByte()<<8|this.readByte(),e=this._position;this._position+=t;var n=this._pool.subarray(e,this._position);return Vr.readUTF(n)},t.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},t}(),Br=function(){function t(){this._pool=[],this._position=0,this._writen=0}return t.prototype.write=function(t){return-1!==Object.prototype.toString.call(t).indexOf("Array")?this._pool=this._pool.concat(t):t>=0&&(t>255&&(t&=255),this._pool.push(t),this._writen++),t},t.prototype.writeArr=function(t){return this._pool=this._pool.concat(t),t},t.prototype.writeUTF=function(t){var e=Vr.writeUTF(t);this._pool=this._pool.concat(e),this._writen+=e.length},t.prototype.getBytesArray=function(){return this._pool},t}(),kr=function(t,e){return t&&e?"".concat(e,"_").concat(t):t||Date.now()},xr=function(){function t(t){this.header=t,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return t.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return kr(t,e)},t.prototype.read=function(t,e,n,i){this.readMessage(t,e,n,i)},t.prototype.readMessage=function(t,e,n,i){return{stream:e,length:n}},t}(),Fr=function(){function t(t){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Dr(t,!1,Ji.AT_MOST_ONCE,!1)}return t.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return kr(t,e)},t.prototype.write=function(t){var e=this.getHeaderFlag();t.write(e),this.writeMessage(t)},t.prototype.setHeaderQos=function(t){this._header.qos=t},t.prototype.getHeaderFlag=function(){return this._header.encode()},t.prototype.getLengthSize=function(){return this.lengthSize},t.prototype.getBufferData=function(){var t=new Br;this.write(t);var e=t.getBytesArray();return new Int8Array(e)},t}(),Hr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=null,e.userId=null,e.timestamp=0,e}return a(e,t),e.prototype.readMessage=function(t,n,i,r){if(n.readByte(),this.status=+n.readByte(),i<=e.MESSAGE_LENGTH)return{stream:n,length:i};if(r===zi.V4){var o=n.readByte();1&o&&(this.userId=n.readUTF()),2&o&&n.readUTF(),4&o&&(this.timestamp=n.readLong()),8&o&&(this.messageId=n.read2Byte())}else{this.userId=n.readUTF();var s=n.readUTF();t.debug(ft.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:i}},e.MESSAGE_LENGTH=2,e}(xr),qr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e}return a(e,t),e.prototype.readMessage=function(t,e,n){return e.readByte(),this.status=+e.readByte(),{stream:e,length:n}},e.MESSAGE_LENGTH=2,e}(xr),Kr=function(t){function e(){return t.call(this,Xi.PING_REQ)||this}return a(e,t),e.prototype.writeMessage=function(t){},e}(Fr),Yr=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e}(xr),jr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.messageId=0,e}return a(e,t),e.prototype.readMessage=function(t,e,n){var i=256*e.readByte()+e.readByte();return this.messageId=parseInt(i.toString(),10),{stream:e,length:n}},e}(xr),Wr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.writeMessage=function(t){var e=this.messageId,n=255&e,i=(65280&e)>>8;t.write(i),t.write(n)},e}(Fr),Qr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=Zi.PUB,e}return a(e,t),e.prototype.readMessage=function(e,n,i){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),t.prototype.readMessage.call(this,e,n,i),this.data=n.readAll(),{stream:n,length:i}},e}(jr),Jr=function(t){function e(e,n,i){var r=t.call(this,Xi.PUBLISH)||this;return r.syncMsg=!1,r.identifier=Zi.PUB,r.topic=e,r.data=ie(n)?Vr.writeUTF(n):n,r.targetId=i,r}return a(e,t),e.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),t.prototype.writeMessage.call(this,e),e.write(this.data)},e}(Wr),Xr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=Zi.PUB,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,i){return t.prototype.readMessage.call(this,e,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.millisecond=256*n.readByte()+n.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=n.readUTF(),{stream:n,length:i}},e}(jr),Zr=function(t){function e(e){var n=t.call(this,Xi.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=e,n}return a(e,t),e.prototype.writeMessage=function(e){t.prototype.writeMessage.call(this,e)},e}(Wr),zr=function(t){function e(e,n,i){var r=t.call(this,Xi.QUERY)||this;return r.identifier=Zi.QUERY,r.topic=e,r.data=ie(n)?Vr.writeUTF(n):n,r.targetId=i,r}return a(e,t),e.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),t.prototype.writeMessage.call(this,e),e.write(this.data)},e}(Wr),$r=function(t){function e(e){var n=t.call(this,Xi.QUERY_CONFIRM)||this;return n.messageId=e,n}return a(e,t),e}(Wr),to=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e.identifier=Zi.QUERY,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,i){return t.prototype.readMessage.call(this,e,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:i}},e}(jr),eo=function(t,e,n){var i=new Uint8Array(e),r=new Gr(i),o=r.readByte(),s=function(t,e){var n,i=t.type;switch(i){case Xi.CONN_ACK:n=new Hr(t);break;case Xi.PUBLISH:(n=new Qr(t)).syncMsg=t.syncMsg;break;case Xi.PUB_ACK:n=new Xr(t);break;case Xi.QUERY_ACK:n=new to(t);break;case Xi.SUB_ACK:case Xi.UNSUB_ACK:case Xi.PING_RESP:n=new Yr(t);break;case Xi.DISCONNECT:n=new qr(t);break;default:n=new xr(t),e.error(ft.O,"No support for deserializing ".concat(i," messages"))}return n}(new Dr(o),t);return s.read(t,r,i.length-1,n),s};!function(t){t[t.ppMsgP=1]="ppMsgP",t[t.ppMsgN=2]="ppMsgN",t[t.ppMsgS=3]="ppMsgS",t[t.pgMsgP=4]="pgMsgP",t[t.chatMsg=5]="chatMsg",t[t.pcMsgP=6]="pcMsgP",t[t.qryPMsg=7]="qryPMsg",t[t.qryGMsg=8]="qryGMsg",t[t.qryCHMsg=9]="qryCHMsg",t[t.qryCMsg=10]="qryCMsg",t[t.qrySMsg=11]="qrySMsg",t[t.recallMsg=12]="recallMsg",t[t.prMsgS=13]="prMsgS",t[t.pbMsgP=14]="pbMsgP",t[t.rrMsg=15]="rrMsg",t[t.rrList=16]="rrList",t[t.s_ntf=17]="s_ntf",t[t.s_msg=18]="s_msg",t[t.s_stat=19]="s_stat",t[t.s_cmd=20]="s_cmd",t[t.s_us=21]="s_us",t[t.pullUS=22]="pullUS",t[t.sendMsgRead=23]="sendMsgRead",t[t.qryMsgRead=24]="qryMsgRead",t[t.qryMsgReadCntBatch=25]="qryMsgReadCntBatch",t[t.updRTime=26]="updRTime",t[t.pgMsgS=27]="pgMsgS",t[t.chatMsgS=28]="chatMsgS",t[t.qrySessionsAtt=29]="qrySessionsAtt",t[t.pullMsg=30]="pullMsg",t[t.qrySessions=31]="qrySessions",t[t.delSessions=32]="delSessions",t[t.delMsg=33]="delMsg",t[t.updRRTime=34]="updRRTime",t[t.chrmPull=35]="chrmPull",t[t.joinChrm=36]="joinChrm",t[t.joinChrmR=37]="joinChrmR",t[t.exitChrm=38]="exitChrm",t[t.queryChrmI=39]="queryChrmI",t[t.setKV=40]="setKV",t[t.delKV=41]="delKV",t[t.pullKV=42]="pullKV",t[t.qryRelation=43]="qryRelation",t[t.delRelation=44]="delRelation",t[t.pullSeAtts=45]="pullSeAtts",t[t.setSeAtt=46]="setSeAtt",t[t.qnTkn=47]="qnTkn",t[t.qnUrl=48]="qnUrl",t[t.aliUrl=49]="aliUrl",t[t.s3Url=50]="s3Url",t[t.stcUrl=51]="stcUrl",t[t.minioUrl=52]="minioUrl",t[t.cleanPMsg=53]="cleanPMsg",t[t.cleanGMsg=54]="cleanGMsg",t[t.cleanCMsg=55]="cleanCMsg",t[t.cleanSMsg=56]="cleanSMsg",t[t.rtcPing=57]="rtcPing",t[t.rtc_ntf=58]="rtc_ntf",t[t.rtcSetOutData=59]="rtcSetOutData",t[t.rtcQryUserOutData=60]="rtcQryUserOutData",t[t.addSeTag=61]="addSeTag",t[t.delSeTag=62]="delSeTag",t[t.addTag=63]="addTag",t[t.delTag=64]="delTag",t[t.disTag=65]="disTag",t[t.reportsdk=66]="reportsdk",t[t.pullUgSes=67]="pullUgSes",t[t.pullUgMsg=68]="pullUgMsg",t[t.ugMsg=69]="ugMsg",t[t.qryUgMsg=70]="qryUgMsg",t[t.updUgRTime=71]="updUgRTime",t[t.upMsgEx=72]="upMsgEx",t[t.modifyMsg=73]="modifyMsg",t[t.qryMsgChange=74]="qryMsgChange",t[t.qryMsg=75]="qryMsg",t[t.operate=76]="operate",t[t.s_opNtf=77]="s_opNtf",t[t.ugUnpushQuery=78]="ugUnpushQuery",t[t.ugUnpushSet=79]="ugUnpushSet",t[t.setRtcRoomId=80]="setRtcRoomId",t[t.qryUgUal=81]="qryUgUal",t[t.s_pubCall=82]="s_pubCall"}(Pr||(Pr={}));var no=Pr,io=function(){function t(t,e){this._runtime=t,this._appkey=e,this._users={}}return t.prototype._getMemData=function(t){return this._users[t]=this._users[t]||{inboxTime:0,outboxTime:0,broadcastSyncTime:0},this._users[t]},t.prototype.setInboxTime=function(t,e){var n=this._getMemData(e);if(!(n.inboxTime>t)){n.inboxTime=t;var i=j.INBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getInboxTime=function(t){var e=this._getMemData(t);if(0===e.inboxTime){var n=j.INBOX_TIME_KEY(this._appkey,t);e.inboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return e.inboxTime},t.prototype.setBroadcastSyncTime=function(t,e){var n=this._getMemData(e);if(!(n.broadcastSyncTime>=t||de(t))){n.broadcastSyncTime=t;var i=j.BROADCASTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getBroadcastSyncTime=function(t){var e=this._getMemData(t);if(!e||0===e.broadcastSyncTime){var n=j.BROADCASTBOX_TIME_KEY(this._appkey,t);e.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n),10)||1}return e.broadcastSyncTime},t.prototype.setOutboxTime=function(t,e){var n=this._getMemData(e);if(!(n.outboxTime>=t)){n.outboxTime=t;var i=j.OUTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getOutboxTime=function(t){var e=this._getMemData(t);if(0===e.outboxTime){var n=j.OUTBOX_TIME_KEY(this._appkey,t);e.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return e.outboxTime},t}(),ro={_caches:{},set:function(t,e){this._caches[t]=e},get:function(t){return this._caches[t]||0},clear:function(t){this._caches[t]=0}},oo=function(){function t(t,e,n){this.logger=t,this._kvCaches={},this._chatroomId=e,this._currentUserId=n}return t.prototype._add=function(t){var e=t.key;t.isDeleted=!1,this._kvCaches[e]=t},t.prototype._remove=function(t){var e=t.key,n=this._kvCaches[e];n&&(n.isDeleted=!0,this._kvCaches[e]=n)},t.prototype._setEntry=function(t,e){var n=t.key,i=t.type,r=t.isOverwrite,o=t.userId,s=this._getSetUserId(n),a=i===vt.DELETE,c=s===o,u=!this._isExisted(n),l=a?this._remove:this._add;(e||r||c||u)&&l.call(this,t)},t.prototype.getValue=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.value},t.prototype.getVersion=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.version},t.prototype.getAllValue=function(){var t={};for(var e in this._kvCaches)this._kvCaches[e].isDeleted||(t[e]=this._kvCaches[e].value);return t},t.prototype._getSetUserId=function(t){return(this._kvCaches[t]||{}).userId},t.prototype._isExisted=function(t){var e=this._kvCaches[t]||{},n=e.value,i=e.isDeleted;return n&&!i},t.prototype.setEntries=function(t){var e=this,n=t.kvEntries,i=t.isFullUpdate;n=n||[],(i=i||!1)&&this.clear(),n.forEach((function(t){e._setEntry(t,i)}))},t.prototype.clear=function(){this._kvCaches={}},t}(),so=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}return t.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var t,e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.chrmId,n=t.timestamp,(i=ro.get(e))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(e,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,this._isPulling=!1,o===z.SUCCESS?(ro.set(e,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},t.prototype.reset=function(t){ro.clear(t);var e=this._storeCaches[t];null==e||e.clear()},t.prototype.pullEntry=function(t,e){this._pullQueue.push({chrmId:t,timestamp:e}),this._startPull()},t.prototype.setLocal=function(t,e,n){var i=this._storeCaches[t];fe(i)||(i=new oo(this._engine.getInnerLogger(),t,n)),i.setEntries(e),this._storeCaches[t]=i},t.prototype.getValue=function(t,e){var n=this._storeCaches[t];return n?n.getValue(e):null},t.prototype.getVersion=function(t,e){var n=this._storeCaches[t];return n?n.getVersion(e):null},t.prototype.getAll=function(t){var e=this._storeCaches[t],n={};return e&&(n=e.getAllValue()),n},t}(),ao=function(){function t(t){this._canJoinMulipleChrm=t,this._joinedChrmsInfo={}}return t.prototype.set=function(t,e){void 0===e&&(e=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[t]=e},t.prototype.get=function(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))},t.prototype.remove=function(t){delete this._joinedChrmsInfo[t]},t.prototype.clear=function(){this._joinedChrmsInfo={}},t}(),co=function(){function t(){this._callerQueue=[],this._isCalling=!1,this._retryCount=0}return t.prototype.pushTask=function(t){var e=this;return new Promise((function(n){e._callerQueue.push({task:t,resolve:n}),e._startCall()}))},t.prototype._startCall=function(){return u(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return this._isCalling||0===this._callerQueue.length?[2]:(this._isCalling=!0,t=this._callerQueue.shift(),[4,this._callHandler(t)]);case 1:return e=n.sent(),t.resolve(e),this._isCalling=!1,this._startCall(),[2]}}))}))},t.prototype._callHandler=function(t){return u(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return e=t.task,n=this.getVersion(),[4,e(n)];case 1:return(i=r.sent()).code===z.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,[4,this._triggerPull(n)]):[3,3];case 2:return r.sent(),[2,this._callHandler(t)];case 3:return this._retryCount=0,[2,i]}}))}))},t.prototype.stopAllTask=function(){this._callerQueue.forEach((function(t){t.resolve({code:z.RC_NET_UNAVAILABLE})})),this._callerQueue=[]},t}(),uo="converStatusChanged",lo=function(t){function e(e,n,r){var s=t.call(this)||this;return s._eventEmitter=new ye,s._pullQueue=[],s._isPulling=!1,s._pullPromise=null,s._storagePullTimeKey="con-s-".concat(n,"-").concat(r),s._oldStorage=i(e.runtime),s._storage=new o(e.runtime,j.CONVER_STATE_PULL_TIME_KEY(n,r)),s._appkey=n,s._currentUserId=r,s._engine=e,s.adaptOldStatus(),s}return a(e,t),e.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var t=this._oldStorage.get(this._storagePullTimeKey)||0;if(!t)return;this._storage.set(this._storagePullTimeKey,t),this._oldStorage.remove(this._storagePullTimeKey)}catch(t){this._engine.getInnerLogger().error(ft.A_CALLBACK_E,"adaptOldStatus error: ".concat(t.message))}},e.prototype._set=function(t){var e=this;if(!de(t)&&Array.isArray(t)){var n=this._storage.get(this._storagePullTimeKey)||0,i=t.length;t.forEach((function(t,r){var o=t.updatedTime||0;n=o>n?o:n,t.conversationType=t.type,e._eventEmitter.emit(uo,{statusItem:t,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n),this._pullQueue=this._pullQueue.filter((function(t){return t>n}))}},e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var t,e,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),t=this.getVersion(),this._pullPromise=this._engine.pullConversationStatus(t),[4,this._pullPromise]);case 1:return e=r.sent(),n=e.code,i=e.data,this._isPulling=!1,this._pullPromise=null,n===z.SUCCESS&&this._set(i),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},e.prototype._startCall=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return this._isPulling||t.prototype._startCall.call(this),[2]}))}))},e.prototype.pull=function(t){var e=this.getVersion();(t>e||0===t)&&(this._pullQueue.push(e),this._startPull())},e.prototype._triggerPull=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._pullQueue.push(t),[4,this._startPull()];case 1:return e.sent(),[2]}}))}))},e.prototype.watch=function(t){this._eventEmitter.on(uo,(function(e){t(e)}))},e.prototype.setConversationUpdatedTime=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;return t&&t>e?(this._storage.set(this._storagePullTimeKey,t),t):e},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(co),ho={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}},po={};for(var go in ho){var fo=ho[go].keyName;po[fo]=go}var _o,Eo=function(){function t(t,e,n,i){this._appkey=e,this._currentUserId=n,this.logger=i,this.storage=new o(t,j.OLD_CONVER_STATE_KEY(e,n)),this._localStore=new o(t,j.CONVER_STATE_KEY(e,n))}return t.prototype._getStoreKey=function(t,e,n){return"".concat(n,"_").concat(t,"_").concat(e)},t.prototype._getConOptionByKey=function(t){var e=(t=t||"").split("_");if(e.length>=2){var n=e.shift(),i=e.shift(),r=e.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:tt.PRIVATE,targetId:"",channelId:""}},t.prototype._updateMentionedUserList=function(t,e,n){var i=this,r=t.conversationType,o=t.messageType,s=t.isMentioned,a=t.senderUserId;s&&r===tt.GROUP&&((n.userIdList||[]).forEach((function(t){t===i._currentUserId&&e.indexOf(a)<0&&e.push(a)})),n.type===lt.ALL&&e.indexOf(a)<0&&e.push(a));if(o===rt.RECALL&&r===tt.GROUP){var c=e.indexOf(a);c>=0&&e.splice(c,1)}return e},t.prototype.updateMentionedData=function(t){var e=t.conversationType,n=t.targetId,i=t.content,r=t.channelId,o=t.senderUserId,s=i.mentionedInfo;if(s&&o!==this._currentUserId){var a=this._getStoreKey(e,n,r),c=this._localStore.get(a)||{},u=po.mentionedInfo,l=po.hasMentioned,h=c[u]||{},d=h.userIdList||[];s={userIdList:d=this._updateMentionedUserList(t,d,s),type:(null==s?void 0:s.type)||h.type},0!==d.length?(c[u]=s,c[l]=!0):(delete c[u],delete c[l]),fe(c)?this._localStore.set(a,c):this._localStore.remove(a)}},t.prototype._setLocal=function(t,e){if("tags"===t)for(var n in e)e[n].isTop||delete e[n].isTop;return e},t.prototype.set=function(t,e,n,i){var r=this._getStoreKey(t,e,i),o=this._localStore.get(r)||{};for(var s in n){var a=po[s],c=n[s];if(!de(a)&&!de(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s)c===ho[a].defaultVal||"tags"===s&&!fe(c)?delete o[a]:o[a]=this._setLocal(s,c),o.c||(delete o.t,delete o.fut,delete o.fuid,delete o.hm,delete o.m,delete o.mc)}var u=Object.keys(o);1===u.length&&u.includes("st")&&delete o.st,fe(o)?this._localStore.set(r,o):this._localStore.remove(r)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var i=this._getStoreKey(t,e,n),r=this._localStore.get(i)||{},o={};for(var s in ho){var a=ho[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||Tn(u)}return o},t.prototype.getValue=function(t){var e=this._localStore.getValues()||{},n=[];for(var i in e){var r=this._getConOptionByKey(i),o={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},s=e[i];for(var a in s)if(ho[a]){var c=ho[a],u=c.keyName,l=c.defaultVal;o[u]=s[a]||Tn(l)}o=t?t(o):o,n.push(o)}return n},t.prototype.getValueForTag=function(){var t=this._localStore.getValues()||{},e={};for(var n in t){var i=this._getConOptionByKey(n),r=i.conversationType,o=i.targetId,s={},a=t[n];for(var u in a){var l=ho[u],h=l.keyName,d=l.defaultVal;s[h]=a[u]||Tn(d)}for(var p in s.tags){de(e[p])&&(e[p]=[]);var g=c(c({},s),{conversationType:r,targetId:o});delete g.tags,e[p].push(g)}}return e},t.prototype.adaptOldStore=function(){try{var t=this.storage.getValues();if(0===Object.keys(t).length)return;for(var e in t){var n="_".concat(e);this._localStore.set(n,t[e])}this.storage.clear()}catch(t){this.logger.error(ft.O,"adaptOldStore error: ".concat(t.message))}},t.prototype.remove=function(t,e,n){var i=this._getStoreKey(t,e,n);this._localStore.remove(i)},t}(),vo=[tt.PRIVATE,tt.GROUP,tt.SYSTEM,tt.PUBLIC_SERVICE,tt.APP_PUBLIC_SERVICE],To={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},Co=1e3,mo=function(){function t(t,e,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new ye,this._draftMap={},this._recallMsgTimeMap={},this._appkey=e,this._loginUserId=n,this._store=new Eo(t.runtime,e,n,t.getInnerLogger()),this._statusManager=new lo(t,e,n),this._statusManager.watch((function(t){var e=t.statusItem,n=t.isLastPull;o.addStatus(e,n)})),this._eventEmitter.on(To.CHANGED,(function(t){i(t)})),this._eventEmitter.on(To.CON_TAG_STATUS_CHANGED,(function(){r()}));var s=this._store.getValue();s.length>Co&&(s=s.sort((function(t,e){var n=t.lastMessageSentTime,i=void 0===n?0:n,r=e.lastMessageSentTime;return(void 0===r?0:r)-i})),s.splice(Co,s.length).forEach((function(t){o._store.remove(t.conversationType,t.targetId,t.channelId)})))}return t.prototype._calcMsg=function(t,e,n,i){var r=!this._recallMsgTimeMap[t]||this._recallMsgTimeMap[t]&&!this._recallMsgTimeMap[t].find((function(t){return t===i.sentTime})),o=e>=i.sentTime;return n&&(o=n<i.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:r}},t.prototype._calcUnreadCount=function(t,e){var n=t.content,i=t.messageType,r=t.sentTime,o=t.isCounted,s=t.messageDirection,a=t.senderUserId,c=t.messageUId,u=s===X.SEND&&a===this._loginUserId,l=i===rt.RECALL,h=le(n),d=!1,p={},g=e.lastUnreadTime,f=e.lastReadTime,_=e.unreadMessageCount;if(g>r||u)return{hasChanged:d,localConversation:e,updateItems:p};if(o&&(0===e.unreadMessageCount&&(e.firstUnreadMessageUid=c,e.firstUnreadTime=r),e.unreadMessageCount=_+1,e.lastUnreadTime=r,d=!0),l&&h){var E="".concat(t.conversationType,"_").concat(t.channelId,"_").concat(t.targetId),v=this._calcMsg(E,g,f,n),T=v.isNotRead,C=v.isNotRepeadRecallSendTime;T&&_&&C&&(this._recallMsgTimeMap[E]||(this._recallMsgTimeMap[E]=[]),this._recallMsgTimeMap[E].push(n.sentTime),e.unreadMessageCount=_-1,d=!0,0===e.unreadMessageCount&&(e.firstUnreadMessageUid="",e.firstUnreadTime=0))}return d&&(p.unreadMessageCount={val:e.unreadMessageCount||0,time:r}),{hasChanged:d,localConversation:e,updateItems:p}},t.prototype._calcMentionedInfo=function(t,e){var n=t.content,i=t.messageDirection,r=t.isMentioned,o=t.sentTime,s=i===X.SEND,a=le(n),c=!1,u={};return!s&&r&&a&&n.mentionedInfo&&(e.hasMentioned=!0,c=!0,u.hasMentioned={val:!0,time:o},u.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:c,localConversation:e,updateItems:u}},t.prototype._calcMentionedCount=function(t,e){var n=t.content,i=t.messageDirection,r=!1;if(t.isMentioned&&i===X.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===lt.ALL||(a||[]).includes(this._loginUserId)){r=!0;var c=e.unreadMentionedCount||0;e.unreadMentionedCount=c+1}if((a||[]).includes(this._loginUserId)){r=!0;c=e.unreadMentionedMeCount||0;e.unreadMentionedCount=c+1}}return{hasChanged:r,localConversation:e}},t.prototype._setUpdatedConversation=function(t){if(le(t)){var e=t.conversationType,n=t.targetId,i=t.channelId,r="".concat(e,"_").concat(n),o=this._store.get(e,n,i)||{};this._updatedConversations[r]=Object.assign(o,t)}},t.prototype._setConTagStatusChanged=function(t,e,n,i){var r=(this._store.get(t,e,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var o in r)if(!n[o]||!!r[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},t.prototype.addStatus=function(t,e){var n=t.conversationType,i=t.targetId,r=t.updatedTime,o=t.notificationStatus,s=t.notificationLevel,a=t.isTop,c=t.tags,u=t.channelId,l={},h={};if(n!==tt.ULTRA_GROUP){de(o)||(h.notificationStatus={time:r,val:o}),de(s)||(h.notificationLevel={time:r,val:s}),de(a)||(h.isTop={time:r,val:a}),de(c)||(h.tags={time:r,val:c},null==c||c.forEach((function(t){l[t.tagId]={isTop:t.isTop}}))),this._setConTagStatusChanged(n,i,l,u);var d=this._store.get(n,i,u).lastMessageSentTime||(new Date).getTime();this._store.set(n,i,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},u),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:u}),e&&this._notifyConversationChanged()}},t.prototype._notifyConversationChanged=function(){var t=[];for(var e in this._updatedConversations)t.push(this._updatedConversations[e]);0!==t.length&&(this._eventEmitter.emit(To.CHANGED,t),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(To.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},t.prototype.setConversationCacheByMessage=function(t,e){var n=this,i=t.conversationType,r=t.isPersited,o=t.targetId,s=t.channelId,a=t.sentTime;if(vo.indexOf(i)>=0){var u=!1,l=this._store.get(i,o,s),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(e){var i=e.call(n,t,l),r=i.hasChanged,o=i.localConversation,s=i.updateItems;u=u||r,h=c(c({},h),s),l=Tn(o)})),this._store.set(i,o,l,s),this._store.updateMentionedData(t),r){var d=this._store.get(i,o,s);d.updatedItems=c({latestMessage:{time:t.sentTime,val:t}},h),d.latestMessage=t;var p=Object.assign(d,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(p)}(u||r)&&this._notifyConversationChanged()}},t.prototype.get=function(t,e,n){return void 0===n&&(n=""),this._store.get(t,e,n)},t.prototype.getAllUnreadCount=function(t,e,n){var i=this._store.getValue(),r=0;return i.forEach((function(t){var i=t.unreadMessageCount,o=t.notificationStatus,s=t.notificationLevel,a=t.conversationType;i=i||0,(n||void 0!==s&&s<=0||void 0===s&&o!==st.OPEN)&&(e.length>0?e.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},t.prototype.getTotalUnreadCountByLevels=function(t,e,n){var i=this._store.getValue(),r=0;return i.forEach((function(i){var o=i.unreadMessageCount,s=i.notificationLevel,a=void 0===s?0:s,c=i.conversationType,u=i.unreadMentionedCount;t.includes(c)&&(0===e.length||e.includes(a))&&(r+=(n?u:o)||0)})),r},t.prototype.getUnreadCountByTag=function(t,e){var n=this._store.getValueForTag()[t]||[],i=0;return n.forEach((function(t){var n=t.unreadMessageCount,r=t.notificationStatus,o=t.notificationLevel;(e||1!==r||-1===o||0===o)&&(n=n||0,i+=Number(n))})),i},t.prototype.getUnreadCount=function(t,e,n){return this._store.get(t,e,n).unreadMessageCount||0},t.prototype.clearUnreadCount=function(t,e,n,i,r){void 0===r&&(r=!0);var o=this._store.get(t,e,n);o.lastReadTime=o.lastUnreadTime,this._recallMsgTimeMap["".concat(t,"_").concat(n,"_").concat(e)]=[];var s=o.unreadMessageCount,a=o.hasMentioned,c={};if(s&&(o.unreadMessageCount=0,c.unreadMessageCount={val:0,time:i}),a&&(o.hasMentioned=!1,o.unreadMentionedCount=0,o.mentionedInfo=void 0,c.hasMentioned={val:!1,time:i},c.mentionedInfo={val:void 0,time:i}),this._store.set(t,e,o,n),r&&0!==Object.keys(c).length){var u=Object.assign(o,{conversationType:t,targetId:e,channelId:n,updatedItems:c});this._setUpdatedConversation(u),this._notifyConversationChanged()}},t.prototype.clearAllUnreadCount=function(){var t=this;this._store.getValue().forEach((function(e){e.unreadMessageCount&&(e.unreadMessageCount=0,e.lastReadTime=e.lastUnreadTime,t._recallMsgTimeMap={},t._store.set(e.conversationType,e.targetId,e,e.channelId))}))},t.prototype.startPullConversationStatus=function(t){this._statusManager.pull(t)},t.prototype.setDraft=function(t,e,n,i){var r="".concat(t,"_").concat(e,"_").concat(i);this._draftMap[r]=n},t.prototype.getDraft=function(t,e,n){var i="".concat(t,"_").concat(e,"_").concat(n);return this._draftMap[i]},t.prototype.clearDraft=function(t,e,n){var i="".concat(t,"_").concat(e,"_").concat(n);delete this._draftMap[i]},t.prototype.addTagStatus=function(t,e,n,i){void 0===i&&(i="");var r=this._store.get(t,e,i),o=r.tags;o=Object.assign(o,n);var s=r.lastMessageSentTime||(new Date).getTime();this._store.set(t,e,{tags:o,lastMessageSentTime:s},i)},t.prototype.deleteTagStatus=function(t,e,n,i){void 0===i&&(i="");var r=this._store.get(t,e,i).tags;n.forEach((function(t){delete r[t]})),this._store.set(t,e,{tags:r},i)},t.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},t.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(t){return t.notificationStatus===st.OPEN||t.notificationLevel&&t.notificationLevel>0})).map((function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,notificationLevel:t.notificationLevel||0,notificationStatus:t.notificationStatus||2}}))},t.prototype.getTopConversationList=function(t,e){var n=this;return(this._store.getValue()||{}).filter((function(n){return t.includes(n.conversationType)&&(de(e)||e===n.channelId)&&n.isTop})).map((function(t){return n._buildConversation(t)}))},t.prototype.adaptOldStore=function(){this._store.adaptOldStore()},t.prototype.getUnreadMentionedCount=function(t,e,n){return void 0===n&&(n=""),this.get(t,e,n).unreadMentionedCount||0},t.prototype.getAllUnreadMentionedCount=function(){var t=this._store.getValue(),e=0;return t.forEach((function(t){var n=t.unreadMentionedCount;n=n||0,e+=Number(n)})),e},t.prototype.getAllConversationState=function(){return this._store.getValue().filter((function(t){return t.unreadMessageCount||t.unreadMentionedCount})).map((function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,unreadCount:t.unreadMessageCount||0,unreadMentionedCount:t.unreadMentionedCount||0}}))},t.prototype.getUnreadConversationList=function(t){var e=this;return(this._store.getValue()||{}).filter((function(e){return t.includes(e.conversationType)&&e.unreadMessageCount&&e.unreadMessageCount>0})).map((function(t){return e._buildConversation(t)}))},t.prototype._buildConversation=function(t){var e=this.getDraft(t.conversationType,t.targetId,t.channelId);return{channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount||0,latestMessage:null,hasMentioned:t.hasMentioned||!1,mentionedInfo:t.mentionedInfo,notificationStatus:t.notificationStatus||0,notificationLevel:t.notificationLevel||0,isTop:t.isTop||!1,lastUnreadTime:t.lastUnreadTime||0,unreadMentionedCount:t.unreadMentionedCount||0,draft:e}},t.prototype.setConversationUpdatedTime=function(t){return this._statusManager.setConversationUpdatedTime(t)},t.prototype.getConversationUpdatedTime=function(){return this._statusManager.getVersion()},t.prototype.pushTask=function(t){return this._statusManager.pushTask(t)},t.prototype.stopAllTask=function(){this._statusManager.stopAllTask()},t}(),yo=function(t){function e(e,n,i,r){var s=t.call(this)||this;return s._tagKey="tags",s._versionKey="version",s._pullQueue=[],s._isPulling=!1,s._pullPromise=null,s._storageKey=j.USER_SETTING_KEY(n,i),s._storage=new o(e.runtime,s._storageKey),s._engine=e,s._tagWatcherFunc=r,s}return a(e,t),e.prototype._updateTag=function(t){var e=t.tags,n={};e.forEach((function(t){n[t.tagId]={tagName:t.tagName,createdTime:t.createdTime}})),this._storage.set(this._tagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(t,e){var n,i=this._storage.get(this._tagKey)||{};t.forEach((function(t){var e,n=(null===(e=i[t.tagId])||void 0===e?void 0:e.createdTime)||t.createdTime||0;i[t.tagId]={tagName:t.tagName,createdTime:n}})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=e,n))},e.prototype.deleteTag=function(t,e){var n,i=this._storage.get(this._tagKey)||{};t.forEach((function(t){delete i[t]})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=e,n))},e.prototype.getTagsInfo=function(){return this._storage.get(this._tagKey)||{}},e.prototype.getTags=function(){var t=this._storage.get(this._tagKey)||{},e=[];for(var n in t)e.push({tagId:n,tagName:t[n].tagName,createdTime:t[n].createdTime,conversationCount:0});return e.sort((function(t,e){return(t.createdTime||0)-(e.createdTime||0)}))},e.prototype.getTagById=function(t){var e=this._storage.get(this._tagKey)||{};return e[t]?{tagId:t,tagName:e[t].tagName,createdTime:e[t].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),t=this.getVersion(),this._pullPromise=this._engine.pullUserSettings(t),[4,this._pullPromise]);case 1:return e=c.sent(),n=e.code,i=e.data,this._isPulling=!1,this._pullPromise=null,n!==z.SUCCESS||de(i)||(o=(r=i).settings,s=r.version,a=o.Tag,de(a)||this._updateTag(a),this._storage.set(this._versionKey,s),this._pullQueue=this._pullQueue.filter((function(t){return t>s}))),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},e.prototype._startCall=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return this._isPulling||t.prototype._startCall.call(this),[2]}))}))},e.prototype.pullUserSettings=function(t){var e=this.getVersion();(t>e||0===t)&&(this._pullQueue.push(e),this._startPull())},e.prototype._triggerPull=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._pullQueue.push(t),[4,this._startPull()];case 1:return e.sent(),[2]}}))}))},e.prototype.getVersion=function(){return this._storage.get(this._versionKey)||0},e.prototype.updateVersion=function(t){this._storage.set(this._versionKey,t)},e}(co),Io=function(t){return t.replace(/@.+$/,"@")},Ro=function(){function t(t,e,n,i,r,o){void 0===r&&(r=!0),void 0===o&&(o=!0),this.appkey=t,this.logger=e,this.statisticLog=n,this.staticConfigManager=i,this.isRequestProfile=r,this.isUseDynamicNaviUrl=o,this.crtRequest=null}return t.prototype.request=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(t,e,n,i,r),[4,this.crtRequest]);case 1:return o=c.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},t.prototype.sendRequest=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,c,u,h,d,p,g,f,_,E,v;return l(this,(function(l){switch(l.label){case 0:return o=Io(t),!e&&(s=this.getNaviCache(o))&&(a=s.timestamp,c=s.naviInfo,n||Date.now()-a<T)?(this.logger.info(ft.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),i),u={bid:sn(),ptc:Kt.NAVI,cod:z.SUCCESS,net:null==r?void 0:r.type,dur:0,spr:0,pr:c.type||0,hos:"",cache:Yt.LOCAL,v:jt.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.statisticLog.record(_t.IM_NAVI,JSON.stringify(u),i),[2,{code:z.SUCCESS,data:c}]):(h=ai.getNaviUrlList(t,this.isUseDynamicNaviUrl),this.logger.info(ft.L_GET_NAVI_T,JSON.stringify({token:t,uris:h}),i),[4,this.requestHandler(h,t,i,r)]);case 1:return d=l.sent(),p=d.code,g=d.data,p===z.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(f=l.sent())?void 0:f.navi)&&(null==f?void 0:f.navi.length)>0?(_=f.navi,[4,this.requestHandler(_,t,i,r)]):[3,4];case 3:E=l.sent(),p=E.code,g=E.data,l.label=4;case 4:return p!==z.SUCCESS?(this.logger.warn(ft.L_GET_NAVI_R,p,i),[2,{code:p}]):(v=g,this.logger.info(ft.L_GET_NAVI_R,JSON.stringify({naviInfo:v}),i),this.setNaviCache(o,v),[2,{code:p,data:v}])}}))}))},t.prototype.requestHandler=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:r=0,o=t.length,l.label=1;case 1:return r<o?(s=r===t.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,c=Date.now(),[4,a.call(this,t[r],this.appkey,e,n,s)]):[3,4];case 2:if(u=l.sent(),h=u.code,d=u.data,p={bid:sn(),ptc:Kt.NAVI,cod:h,net:null==i?void 0:i.type,dur:Date.now()-c,spr:0,pr:(null==d?void 0:d.type)||0,hos:t[r],cache:Yt.REQUEST,v:jt.CURRENT,rsn:null==i?void 0:i.reason,cid:"".concat(null==i?void 0:i.uuid,"_").concat(null==i?void 0:i.retryCount),count:null==i?void 0:i.retryCount},this.statisticLog.record(_t.IM_NAVI,JSON.stringify(p),n),[z.SUCCESS,z.RC_CONN_TOKEN_INCORRECT,z.RC_LICENSE_EXPIRED].includes(h))return[2,{code:h,data:d}];l.label=3;case 3:return r+=1,[3,1];case 4:return[2,{code:z.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.transHttpCode=function(t){switch(t){case 401:case 403:return z.RC_CONN_TOKEN_INCORRECT;case 416:return z.RC_LICENSE_EXPIRED;default:return z.RC_NAVI_REQ_FAILED}},t.prototype.getNaviInfoFromCache=function(t){var e=this.getNaviCache(Io(t));return e?e.naviInfo:null},t.prototype.updateVoipCallInfo=function(t,e){var n=this.getNaviInfoFromCache(t);n&&this.setNaviCache(Io(t),c(c({},n),{voipCallInfo:e}))},t.prototype.getNaviV2RequestOption=function(t){var e,n=t.uri,i=t.token,r=t.platform,o=t.protocol;e="".concat(n,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(i),"&version=").concat("5.9.3","&platfrom=").concat(r);return{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(o,";rtc=4;log=2")},body:s,url:e,timeout:m}},t.prototype.useV2Navi=function(){return!0},t}(),So={},Oo=function(t){function e(e,n,i,r,o){var s=t.call(this,e,n,i,o,r.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),r.useNavi)||this;return s.runtime=r,s}return a(e,t),e.prototype.httpRequest=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return o="".concat(t,"/navi.js?appId=").concat(e,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(F,"&r=").concat(Date.now()),this.logger.debug(ft.L_REQUEST_T,"req navi => ".concat(o),i),[4,this.runtime.httpReq({url:o,timeout:m,dataType:"text"})];case 1:if(200!==(s=u.sent()).status)return this.logger.debug(ft.L_REQUEST_R,"request navi failed: ".concat(s.status),i),!this.runtime.useNavi&&r?(c={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:ai.getMiniCmpUrlList().join(",")},[2,{code:z.SUCCESS,data:c}]):[2,{code:this.transHttpCode(s.status)}];try{return 0===(a=s.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'.concat(a,'"'))),(c=JSON.parse(a)).protocol=/^https/.test(o)?"https":"http",this.runtime.useNavi||(c.server="",c.backupServer=ai.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,{code:z.SUCCESS,data:c}]}catch(t){this.logger.error(ft.L_PARSE_NAVI_E,s.data,i)}return[2,{code:z.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.httpRequestV2=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return r=this.getNaviV2RequestOption({appkey:e,token:n,uri:t,platform:this.runtime.tag,protocol:(/^https/.test(t)?wt.WSS:wt.WS).toString()}),this.logger.debug(ft.L_REQUEST_T,"req navi => ".concat(r.url),i),[4,this.runtime.httpReq(r)];case 1:if(200!==(o=u.sent()).status)return this.logger.debug(ft.L_REQUEST_R,"request navi failed: ".concat(o.status),i),[2,{code:this.transHttpCode(o.status)}];try{return s=o.data,(a="object"!=typeof s?JSON.parse(s):s).protocol=/^https/.test(r.url)?"https":"http",this.runtime.useNavi||(a.logSwitch=0,c=ai.getMiniCmpUrlList(),a.serverAddr=c.map((function(t,e){return{addr:t,protocol:/^https/.test(r.url)?wt.WSS:wt.WS,weight:c.length-e}}))),[2,{code:z.SUCCESS,data:a}]}catch(t){this.logger.error(ft.L_PARSE_NAVI_E,o.data,i)}return[2,{code:z.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.getNaviCache=function(t){if(So[t])return So[t];var e,n=j.NAVI_KEY(this.appkey),i=this.runtime.localStorage;try{var r=i.getItem(n);e=r?JSON.parse(r):[]}catch(t){e=[]}if(0===e.length)return null;var o=e.find((function(e){return e.token===t}))||null;return So[t]=o,o},e.prototype.setNaviCache=function(t,e){var n,i=j.NAVI_KEY(this.appkey),r=this.runtime.localStorage;try{var o=r.getItem(i);n=o?JSON.parse(o):[]}catch(t){n=[]}var s=Date.now();n.length>0&&(n=n.filter((function(e){return s-e.timestamp<T&&t!==e.token})));var a={timestamp:s,naviInfo:e,token:t};n.push(a),r.setItem(i,JSON.stringify(n)),So[t]=a},e}(Ro),No=function(){function t(t,e){this._runtime=t,this._appkey=e,this._sendMessageMap={},this._userId=""}return t.prototype.init=function(t){this._userId=t;var e=j.SEND_MSG_KEY(this._appkey,t);this._sendMessageMap=this._getLocalInfo(e)},t.prototype._getLocalInfo=function(t){var e=this._runtime.localStorage.getItem(t);try{return e?JSON.parse(e):{}}catch(t){return{}}},t.prototype.setMessage=function(t,e){this._sendMessageMap[t]=e;var n=j.SEND_MSG_KEY(this._appkey,this._userId),i=this._getLocalInfo(n);i[t]=e,this._runtime.localStorage.setItem(n,JSON.stringify(i))},t.prototype.getSendMessageMap=function(){return this._sendMessageMap},t.prototype.removeByUID=function(t){delete this._sendMessageMap[t]},t.prototype.removeByTimestamp=function(t){var e=j.SEND_MSG_KEY(this._appkey,this._userId),n=this._getLocalInfo(e);Object.keys(n).forEach((function(e){n[e]<t&&delete n[e]})),this._runtime.localStorage.setItem(e,JSON.stringify(n))},t}();(_o={})[tt.PRIVATE]=no.qryPMsg,_o[tt.GROUP]=no.qryGMsg,_o[tt.CHATROOM]=no.qryCHMsg,_o[tt.CUSTOMER_SERVICE]=no.qryCMsg,_o[tt.SYSTEM]=no.qrySMsg;var Mo=[no[no.recallMsg],no[no.ppMsgS],no[no.pgMsgS],no[no.ppMsgP],no[no.pgMsgP],no[no.chatMsg],no[no.pcMsgP],no[no.prMsgS],no[no.updUgRTime],no[no.pbMsgP],no[no.updRTime]],Lo=function(){function t(t,e,n){this._localStore=new o(t,j.ULTRA_GROUP_STATE_KEY(e,n))}return t.prototype.set=function(t,e,n,i){var r=this._getStoreKey(t,e,i),o=this._localStore.get(r)||{};for(var s in n){var a=Ao[s],c=n[s];if(!de(a)&&!de(c))c===Uo[a].defaultVal?delete o[a]:o[a]=c}fe(o)?this._localStore.set(r,o):this._localStore.remove(r)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var i=this._getStoreKey(t,e,n),r=this._localStore.get(i)||{},o={};for(var s in Uo){var a=Uo[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||Tn(u)}return o},t.prototype._getStoreKey=function(t,e,n){return"".concat(n,"_").concat(t,"_").concat(e)},t}(),Uo={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Ao={};for(var bo in Uo){var wo=Uo[bo].keyName;Ao[wo]=bo}var Po,Do=function(){function t(t,e,n){this._store=new Lo(t.runtime,e,n)}return t.prototype.addUltraGroupStatus=function(t){var e=t.conversationType,n=t.targetId,i=t.notificationStatus,r=t.notificationLevel,o=t.channelId;e===tt.ULTRA_GROUP&&this._store.set(e,n,{notificationStatus:i,notificationLevel:r},o)},t.prototype.get=function(t,e,n){return void 0===n&&(n=""),this._store.get(t,e,n)},t}(),Vo="UpStreamMessage",Go="PushExtra",Bo="DownStreamMessage",ko="DownStreamMessages",xo="SessionsAttQryInput",Fo="SessionsAttOutput",Ho="SyncRequestMsg",qo="ChrmPullMsg",Ko="NotifyMsg",Yo="HistoryMsgInput",jo="HistoryMsgOuput",Wo="RelationQryInput",Qo="RelationsOutput",Jo="UnreadMsgInfo",Xo="DeleteSessionsInput",Zo="SessionInfo",zo="DeleteSessionsOutput",$o="RelationDelBatchReq",ts="RelationOpInput",es="RelationsInput",ns="DeleteMsgInput",is="CleanHisMsgInput",rs="CleanMsgBatchReq",os="SessionMsgReadInput",ss="ChrmInput",as="ChrmOutput",cs="QueryChatRoomInfoInput",us="QueryChatRoomInfoOutput",ls="GetQNupTokenInput",hs="GetQNupTokenOutput",ds="GetQNdownloadUrlInput",ps="GetDownloadUrlInput",gs="GetQNdownloadUrlOutput",fs="GetDownloadUrlOutput",_s="ChrmKVEntity",Es="SetChrmKV",vs="SetChrmKVS",Ts="DeleteChrmKVS",Cs="ChrmKVOutput",ms="ChrmKVSOutput",ys="ChrmKVSVersionEntity",Is="ChrmKVSOutputEntity",Rs="QueryChrmKV",Ss="SetUserSettingInput",Os="SetUserSettingOutput",Ns="PullUserSettingInput",Ms="PullUserSettingOutput",Ls="UserSettingNotification",Us="SessionReq",As="SessionStates",bs="SessionState",ws="SessionStateItem",Ps="SessionStateModifyReq",Ds="SessionStateModifyResp",Vs="GroupUnpushQuery",Gs="GroupUnpushSet",Bs="QryRemindListReq",ks="QryRemindListResp",xs="GroupUnpushResult",Fs="GrpReadReceiptMsg",Hs="GrpReadReceiptQryReq",qs="GrpReadReceiptQryResp",Ks="GrpMsgReadUser",Ys="SessionTagAddInput",js="SessionTagItem",Ws="SessionTagDelInput",Qs="SessionDisTagReq",Js="ReportSDKInput",Xs="ReportSDKOutput",Zs="UltraGrpPullSes",zs="UltraGrpPullMsg",$s="MsgChangeReq",ta="QueryMsgChange",ea="MsgChange",na="MsgChangeList",ia="MsgQuery",ra="MessageQueryInfo",oa="MsgQueryAck",sa="OperateStatus",aa="OperateStatusNotify",ca="OperateInfo",ua="OperateSummary",la="SetRtcRoomIdInput",ha="SetRtcRoomIdOutput",da="CallInfoUpStream",pa="CallInfoDownStream",ga="KvInput",fa="KvOutput",_a="ReadReceiptMsg",Ea="ReceiptQryReq",va="QueryReceiptResp",Ta="ReceiptUser",Ca="ReceiptCntQryReq",ma="ReceiptCntQryResp",ya="MsgReadCnt";(Po={})[Vo]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],Po[ko]=["list","syncTime","finished","broadcastSyncTime"],Po[Bo]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Po[Go]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Po[xo]=["nothing"],Po[Fo]=["inboxTime","sendboxTime","totalUnreadCount"],Po[Ho]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Po[qo]=["syncTime","count"],Po[Ko]=["type","time","chrmId"],Po[Yo]=["targetId","time","count","order","busChannel"],Po[jo]=["list","syncTime","hasMsg"],Po[Wo]=["type","count","startTime","order"],Po[Qo]=["info","isFinished"],Po[Jo]=["msgId","msgTime","remindType","className"],Po[Xo]=["sessions"],Po[$o]=["RelationOpInput"],Po[ts]=["conversationId","conversationType","busChannel"],Po[Zo]=["type","channelId","busChannel"],Po[zo]=["nothing"],Po[es]=["type","msg","count","busChannel","startTime","endTime"],Po[ns]=["type","conversationId","msgs","busChannel"],Po[is]=["targetId","dataTime","conversationType","busChannel"],Po[rs]=["CleanHisMsgInput"],Po[os]=["type","msgTime","channelId","busChannel"],Po[ss]=["nothing"],Po[as]=["nothing","sessionId","joinTime"],Po[cs]=["count","order"],Po[us]=["userTotalNums","userInfos"],Po[ls]=["type","key","httpMethod","queryString","url"],Po[ds]=["type","key","fileName"],Po[ps]=["type","key","fileName"],Po[hs]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Po[gs]=["downloadUrl"],Po[fs]=["downloadUrl"],Po[_s]=["key","value","status","timestamp","uid","version"],Po[Es]=["entry","bNotify","notification","type"],Po[vs]=["entry","bNotify","notification","type"],Po[Ts]=["entry","bNotify","notification","type"],Po[Cs]=["entries","bFullUpdate","syncTime"],Po[ms]=["timestamp","errorKeys","keysVersion"],Po[ys]=["version","key"],Po[Is]=["key","errorCode"],Po[Rs]=["timestamp"],Po[Ss]=["version","value"],Po[Os]=["version","reserve"],Po[Ns]=["version","reserve"],Po[Ms]=["items","version"],Po.UserSettingItem=["targetId","type","key","value","version","status","tags"],Po[Us]=["time"],Po[As]=["version","state"],Po[bs]=["type","channelId","time","stateItem","busChannel"],Po[ws]=["sessionStateType","value","tags"],Po[Ps]=["version","state"],Po[Ds]=["version"],Po[Gs]=["busChannel","unpushLevel"],Po[Bs]=["groupId","busChannel","msgTime","size"],Po[Vs]=["busChannel"],Po[xs]=["groupId","busChannel","unpushLevel"],Po[Fs]=["msgId","busChannel"],Po[Hs]=["msgId","busChannel"],Po[qs]=["totalMemberNum","list"],Po[Ks]=["readTime","userId"],Po[Ys]=["version","tags"],Po[js]=["tagId","name","createdTime","isTop"],Po[Ws]=["version","tags"],Po[Qs]=["tagId"],Po[Ls]=["version","reserve"],Po[Js]=["sdkInfo"],Po[Xs]=["nothing"],Po[Zs]=["syncTime","isEraseMsgContent"],Po[zs]=["syncTime"],Po[$s]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Po[ta]=["syncTime"],Po[na]=["list","syncTime","hasNext"],Po[ea]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],Po[ia]=["targetId","type","query"],Po[ra]=["msgTime","msgUID","busChannel"],Po[oa]=["list"],Po[sa]=["targetId","type","opType","busChannel"],Po[aa]=["type","notifyType","info","summary"],Po[ca]=["targetId","busChannel","userId","opType","optime"],Po[ua]=["targetId","busChannel","count","opType"],Po[la]=["rtcRoomId"],Po[ha]=["nothing"],Po[_a]=["targetId","type","busChannel","startMsgId","endMsgId"],Po[Ea]=["msgId","busChannel","targetId"],Po[va]=["num","list"],Po[Ta]=["receiptTime","userId"],Po[Ca]=["type","channelId","busChannel","msgId"],Po[ma]=["result"],Po[ya]=["msgId","cnt","tmn"];var Ia,Ra,Sa,Oa,Na="\npackage Modules;\nmessage probuf {\n message SetUserStatusOutput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusInput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusOutput\n {\n optional string status=1;\n optional string subUserId=2;\n }\n\n message SubUserStatusInput\n {\n repeated string userid =1;\n }\n\n message SubUserStatusOutput\n {\n optional int32 nothing=1;\n }\n message VoipDynamicInput\n {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n\n message VoipDynamicOutput\n {\n required string dynamicKey=1;\n }\n message ".concat(Ko," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Ho," {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message ").concat(Vo," {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string userId = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13; // 该消息所属会话的业务标识\n optional string systemId = 16; // 系统会话消息时需填该字段为 targetId, 其他类型无需传\n }\n message ").concat(Go," {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message ").concat(ko," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(Bo," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n // 消息的扩展标记\n // 第0位,表示送达状态: 0x01 表示已送达;\n // 断档: 0x02 表示是否需要执行断档策略;\n // 消息修改: 0x04 拉取历史消息时表示该消息是否修改过\n // 0x08 每条消息携带的频道类型\n optional int64 extStatus = 20;\n repeated string toUserId = 21; //指定接收者(限定群和讨论组)//增加聊天室定向成员\n optional int32 groupUnpush = 22; //群聊默认免打扰级别\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(Q.IMAGE,";\n audio = ").concat(Q.AUDIO,";\n video = ").concat(Q.VIDEO,";\n file = ").concat(Q.FILE,";\n sight = ").concat(Q.SIGHT,";\n html = ").concat(Q.COMBINE_HTML,";\n }\n message ").concat(ls," {\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; // url, sdk 设置下载地址\n }\n message ").concat(ds," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(ps," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(hs," {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n // 兼容 minio 协议\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; // 下载鉴权信息,格式为 Json 格式\n }\n message ").concat(gs," {\n required string downloadUrl = 1;\n }\n message ").concat(fs," {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n group_success = 0x00;\n group_failure = 0x01;\n }\n message ").concat(ss," {\n required int32 nothing = 1;\n }\n message ").concat(as," {\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 ").concat(qo," {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n\n message ChrmPullMsgNew\n {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message ").concat(Wo,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(es,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(Qo,"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n optional int32 busChannelType = 9; // 0: 公有频道; 1: 私有频道;\n optional ").concat(Jo," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(Jo," //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n optional string className = 4; //消息类型\n }\n message ").concat(Bs," // 新增 查询未读@列表入参\n {\n required string groupId = 1; // 群 ID\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int64 msgTime = 3; // 消息时间戳\n optional int32 size = 4; // 单页长度,默认20,最大20\n }\n message ").concat(ks," //查询未读@列表出参\n {\n repeated ").concat(Jo," msgInfo = 1; //未读@消息摘要列表\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(is,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message ").concat(rs,"\n {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message ").concat(cs,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(us,"\n {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember\n {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput\n {\n required string id = 1;\n }\n\n message MPFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo\n {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput\n {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput\n {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput\n {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput\n {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message ").concat(Yo,"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5; //该消息所属会话的业务标识,限制20字符以内\n }\n\n message ").concat(jo,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(xo,"{\n required int32 nothing = 1;\n }\n message ").concat(Fo,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(os,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Xo,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(Zo,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(zo,"\n {\n optional int32 nothing=1;\n }\n message ").concat($o," \n {\n repeated RelationOpInput relation = 1;\n }\n message ").concat(ts,"\n {\n required string conversationId = 1;//会话ID\n required ChannelType conversationType = 2;//会话类型,比如单聊、群等\n optional string busChannel = 3;//该消息所属会话的业务标识,限制20字符以内\n }\n message ").concat(ns,"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message DeleteMsg\n {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message ").concat(Es," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(vs," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Ts," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Cs," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ").concat(ms," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Is,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Rs," {\n required int64 timestamp = 1;\n }\n message ").concat(Ss," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Os," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Ns," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Ms," {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message ").concat(Us," {\n required int64 time = 1;\n }\n message ").concat(As," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(bs," {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;//该消息所属会话的业务标识\n }\n message ").concat(ws," {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message ").concat(Ps," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Vs," {\n optional string busChannel = 1;\n }\n message ").concat(Gs,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(xs," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(Ds," {\n required int64 version=1;\n }\n message ").concat(Fs," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Hs," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(qs," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Ks," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Ys," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(js," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(Ws," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Qs," {\n repeated string tagId=1;\n }\n message ").concat(Ls," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Js,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Xs,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Zs,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(zs,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat($s,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(ta," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(na," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(ea," //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回,4:频道变更,5:用户组变更)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0, 设为 1 时, IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 消息变更的操作人 Id; subChangeType 为 5 时,operatorId 表示被踢出超级群私有频道白名单的用户\n // subChangeType 的意义由 changeType 的值来决定\n // 当 changeType 为 4 时;\n // 1: 删除频道;\n // 2: 公有频道变为私有频道;\n // 3: 私有频道变为公有频道;\n // 4: 私有频道成员变更-加入, SDK 不通知业务层;\n // 5: 私有频道成员变更-退出;\n // 6: 公有频道变为私有频道,当前用户不在白名单中;\n // 当 changeType 为 5 时;\n // 1: 删除用户组 (通知到 用户组下所有用户)\n // 2: 用户组增加用户 (仅通知到该用户)\n // 3: 用户组删除用户 (仅通知到该用户)\n // 4: 频道绑定用户组 (通知到 用户组下所有用户)\n // 5: 频道解绑用户组 (通知到 用户组下所有用户)\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12; // 0:公有频道; 1:私有频道\n optional bool isRemindMe = 13;// 是否为@我的消息, 消息撤回时, 该字段有意义, 用于客户端计算是否未读数总数-1,未读@消息数-1 -- server 暂未支持\n repeated string userGroupIds = 14; //用户组id列表,用于用户组增删成员或频道绑定解绑用户组的通知中\n optional int32 remindType = 15; // @类型:0非@我消息,1@所有人消息,2@我单人的消息\n }\n message ").concat(ia," //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message ").concat(oa," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(sa," //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message ").concat(aa," //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message ").concat(ca," {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message ").concat(ua," {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n\n message ").concat(la,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(ha,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(da,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat(pa,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(ga,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(fa,"\n {\n required int64 maxTime = 1; //最大时间戳\n repeated KvInfo info = 2; //kv对象\n }\n \n message KvInfo{\n required string key =1; //健名\n required string value =2; //健值\n }\n message ").concat(_a,"\n {\n required string targetId = 1;\n required ChannelType type = 2; //会话类型:单聊1、群聊3\n optional string busChannel = 3; //该消息所属会话的业务标识\n optional string startMsgId = 4; //已读消息ID区间开始(单聊极端场景下,无此属性或为空字符串)\n optional string endMsgId = 5; //已读消息ID区间结束(对应RC:RRMsg 中 endMsgId)\n }\n message ").concat(Ea,"\n {\n required string msgId = 1;//已读 消息ID \n optional string busChannel = 2; //该消息所属会话的业务标识\n required string targetId = 3; //群聊:群id\n }\n message ").concat(va,"\n {\n optional int32 num = 1;// 群总人数\n repeated ReceiptUser list = 2;//已读用户列表(list复类型)\n optional int32 readCnt = 3; //已读人数\n }\n message ").concat(Ta,"\n {\n required int64 receiptTime = 1;//已读 时间。已做归并,SDK 向上层返回应最多只精确到分钟 \n required string userId = 2;//已读 用户id\n }\n message ").concat(Ca,"\n {\n optional ChannelType type = 1; //发送类型如:(GROUP)\n optional string channelId = 2; //会话id\n optional string busChannel = 3; //该消息所属会话的业务标识\n repeated string msgId = 4; //消息id列表\n }\n message ").concat(ma,"\n {\n repeated MsgReadCnt result= 1; //已读状态列表\n }\n\n message ").concat(ya,"\n {\n optional string msgId = 1; //消息id\n optional int32 cnt = 2; //已读人数\n optional int32 tmn = 3; //群人数\n }\n\n}\n"),Ma=function(t,e,n,i,r,o){var s=r?Object.keys(r).map((function(e){return t.encode(pn.RtcValueInfo,{key:e,value:r[e]},!0)})):void 0,a=o?Object.keys(o).map((function(e){return t.encode(pn.RtcValueInfo,{key:e,value:o[e]},!0)})):void 0;return t.encode(pn.RtcInput,{roomType:e,broadcastType:n,joinType:i,innerDatas:s,outerDatas:a})},La=function(t,e){var n=t.decode(pn.RtcUserListOutput,e),i=n.users,r=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,c=n.offlineKickTime,u={};return gn(i,(function(t){var e=t.userId,n=t.userData,i={};gn(n,(function(t){var e=t.key,n=t.value;i[e]=n})),u[e]=i})),{users:u,token:r,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:c}};!function(t){t[t.ACCEPTED=0]="ACCEPTED",t[t.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",t[t.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",t[t.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",t[t.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",t[t.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",t[t.REDIRECT=6]="REDIRECT",t[t.PACKAGE_ERROR=7]="PACKAGE_ERROR",t[t.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",t[t.BLOCK=9]="BLOCK",t[t.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",t[t.DEVICE_ERROR=11]="DEVICE_ERROR",t[t.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",t[t.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",t[t.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",t[t.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",t[t.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",t[t.OTP_USED=17]="OTP_USED",t[t.PLATFORM_ERROR=18]="PLATFORM_ERROR",t[t.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",t[t.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(Ia||(Ia={})),function(t){t[t.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",t[t.BLOCK=2]="BLOCK",t[t.BLOCK_NEW=5]="BLOCK_NEW",t[t.REDIRECT_NEW=6]="REDIRECT_NEW",t[t.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",t[t.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",t[t.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(Ra||(Ra={}));var Ua,Aa=((Sa={})[Ra.OTHER_DEVICE_LOGIN]=z.RC_DISCONN_KICK,Sa[Ra.BLOCK]=z.RC_DISCONN_EXCEPTION,Sa[Ra.BLOCK_NEW]=z.RC_DISCONN_EXCEPTION,Sa[Ra.REDIRECT_NEW]=z.RC_CONN_REDIRECTED,Sa[Ra.TOKEN_EXPIRED]=z.RC_CONN_TOKEN_EXPIRED,Sa[Ra.ILLEGAL_PROTOCOL_VERSION]=z.RC_CONN_PROTO_VERSION_ERROR,Sa[Ra.ACCOUNT_CANCELLATION]=z.RC_ACCOUNT_CANCELLATION,Sa),ba=((Oa={})[Ia.ACCEPTED]=z.SUCCESS,Oa[Ia.UNACCEPTABLE_PROTOCOL_VERSION]=z.RC_CONN_PROTO_VERSION_ERROR,Oa[Ia.IDENTIFIER_REJECTED]=z.RC_CONN_IDENTIFIER_REJECTED,Oa[Ia.SERVER_UNAVAILABLE]=z.RC_CONN_SERVER_UNAVAILABLE,Oa[Ia.TOKEN_INCORRECT]=z.RC_CONN_TOKEN_INCORRECT,Oa[Ia.NOT_AUTHORIZED]=z.RC_CONN_NOT_AUTHRORIZED,Oa[Ia.REDIRECT]=z.RC_CONN_REDIRECTED,Oa[Ia.PACKAGE_ERROR]=z.RC_CONN_PACKAGE_NAME_INVALID,Oa[Ia.APP_BLOCK_OR_DELETE]=z.RC_CONN_APP_BLOCKED_OR_DELETED,Oa[Ia.BLOCK]=z.RC_CONN_USER_BLOCKED,Oa[Ia.TOKEN_EXPIRE]=z.RC_CONN_TOKEN_EXPIRED,Oa[Ia.DEVICE_ERROR]=z.RC_CONN_DEVICE_ERROR,Oa[Ia.HOSTNAME_ERROR]=z.RC_CONN_HOSTNAME_ERROR,Oa[Ia.HASOHTERSAMECLIENTONLINE]=z.RC_DISCONN_SAME_CLIENT_ON_LINE,Oa[Ia.OUT_OF_LIMIT]=z.RC_LISCENSE_COUNT_OUT_OF_LIMIT,Oa[Ia.IN_OTHER_CLUSTER]=z.RC_CONN_WRONG_CLUSTER,Oa[Ia.APP_AUTH_NOT_PASS]=z.RC_APP_AUTH_NOT_PASS,Oa[Ia.OTP_USED]=z.RC_OTP_USED,Oa[Ia.PLATFORM_ERROR]=z.RC_PLATFORM_ERROR,Oa[Ia.ACCOUNT_CANCELLATION]=z.RC_ACCOUNT_CANCELLATION,Oa[Ia.LICENSE_EXPIRED]=z.RC_LICENSE_EXPIRED,Oa),wa=function(t){return t===z.RC_CONN_REDIRECTED},Pa=function(t){return Object.keys(Aa).some((function(e){return Aa[e]===t}))},Da=function(t){return Object.keys(ba).some((function(e){return ba[e]===t}))};!function(t){t[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.SUSPENDED=3]="SUSPENDED"}(Ua||(Ua={}));var Va,Ga=function(){function t(t,e,n,i,r){this.appkey=t,this.navi=e,this.logger=n,this.statisticLog=i,this.listener=r,this.token="",this.curCmpUrl="",this.reconnectKick=!1,this._connectDurSwitch=!1,this.retryCount=0,this.uuid="",this.reason=0,this.connectedTime=0,this._network={status:!0,type:Je.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=Ua.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return t.prototype.getToken=function(){return this.token},t.prototype.getCurrentUserId=function(){return this._crtUserId},t.prototype.setConnectionStatus=function(t,e){if(this._crtConnectionStatus!==t){if(this._crtConnectionStatus=t,this._connectDurSwitch&&t!==Ua.CONNECTED&&t!==Ua.CONNECTING){var n={bid:sn(),cod:e,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.record(_t.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(t){case Ua.CONNECTED:this.logger.info(ft.L_CONNECT_S,t),this.checkAlive(),this.listener.onConnected();break;case Ua.CONNECTING:this.logger.warn(ft.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),this.listener.onConnecting();break;case Ua.SUSPENDED:this.logger.warn(ft.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),wa(e)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(e);break;default:this.logger.warn(ft.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(e)}}},t.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},t.prototype.setNetwork=function(t,e){if(!e){var n={cid:"".concat(this.uuid,"_").concat(this.retryCount),cn:t.type,on:this._network.type};this.statisticLog.record(_t.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=t},t.prototype.getNetwork=function(){return this._network},t.prototype.connect=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._crtConnectionStatus===Ua.CONNECTED?[2,{code:z.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=Oe(),this.token=t,this.reconnectKick=e,this.setConnectionStatus(Ua.CONNECTING),r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:Qt.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.record(_t.IM_STATS_CS,JSON.stringify(r),i),[4,this.try2Connect(t,e,!1,i)]);case 1:return o=c.sent(),s=o.code,a=o.data,s!==z.SUCCESS?(this.setConnectionStatus(Ua.DISCONNECTED,s),[2,{code:s}]):(this.setConnectionStatus(Ua.CONNECTED),[2,{code:s,data:a}])}}))}))},t.prototype.try2Connect=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(t,e,n,i),[4,this._crtConnectionTask]);case 1:return r=a.sent(),o=r.code,s=r.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},t.prototype.createConnectionTask=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return r={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(t,n,!1,i,r)];case 1:return o=l.sent(),s=o.code,a=o.data,s!==z.SUCCESS?[2,{code:s}]:1===(c=a).type?[2,{code:z.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(ft.L_CONNECT_T,JSON.stringify({token:t,reconnectKickEnable:e}),i),[4,this.connectWithToken(t.replace(/@.+$/,"@"),c,e,i)]);case 2:return u=l.sent(),h=u.code,d=u.data,wa(h)?(this.logger.warn(ft.L_CONNECT_R,"redirect code: ".concat(h),i),this.clearCmpWeightCache(),[2,this.createConnectionTask(t,e,!0,i)]):[z.RC_TCP_RESET,z.RC_CONN_ACK_TIMEOUT,z.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(ft.L_CONNECT_R,"cmp ack timeout, code: ".concat(h),i),this.setConnectionStatus(Ua.SUSPENDED,h),this.setConnectionStatus(Ua.CONNECTING),[2,this.createConnectionTask(t,e,!1,i)]):h!==z.SUCCESS?(this.logger.warn(ft.L_CONNECT_R,"code: ".concat(h),i),[2,{code:h}]):(this.logger.info(ft.L_CONNECT_R,"userId: ".concat(d),i),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},t.prototype.setReconnectReason=function(t){switch(t){case z.TIMEOUT:return void(this.reason=Qt.TIMEOUT);case z.RC_CONN_REDIRECTED:return void(this.reason=Qt.REDIRECTED);default:this.reason=Qt.RECONNECT}},t.prototype.try2Reconnect=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r=this;return l(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(ft.T,"try2Reconnect -> ignoreNaviCache: ".concat(t,", reason: ").concat(e),n),this.stopReconnectTimer(),i=function(){return u(r,void 0,void 0,(function(){var r,o;return l(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==Ua.SUSPENDED?[2]:(this.setConnectionStatus(Ua.CONNECTING,e),this.setReconnectReason(e),this.retryCount+=1,r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.record(_t.IM_STATS_CS,JSON.stringify(r)),[4,this.try2Connect(this.token,!0,t,n)]);case 1:return o=s.sent().code,this.reconnectTimer=null,o===z.SUCCESS?(this.setConnectionStatus(Ua.CONNECTED),[2]):[z.SERVER_UNAVAILABLE,z.TIMEOUT,z.RC_SOCKET_DISCONNECTED,z.RC_SOCKET_NOT_CREATED,z.RC_CONN_ACK_TIMEOUT,z.RC_TCP_RESET,z.RC_NAVI_REQ_FAILED,z.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==Ua.CONNECTING||(this.setConnectionStatus(Ua.SUSPENDED,o),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus(Ua.DISCONNECTED,o),[2])}}))}))},i(),[2]}))}))},t.prototype.onDisconnectByServer=function(t,e){var n=this;return wa(t)?(this.setConnectionStatus(Ua.SUSPENDED,t),void this.try2Reconnect(!0,t)):t===z.RC_UDP_DISCONNECTED?(this.setConnectionStatus(Ua.SUSPENDED,t),void setTimeout((function(){n.try2Reconnect(!0,t)}),1e3*(e||0))):void this.setConnectionStatus(Ua.DISCONNECTED,t)},t.prototype.onDisconenctUnusual=function(t){this.setConnectionStatus(Ua.SUSPENDED,t),this.try2Reconnect(!1,t)},t.prototype.checkAlive=function(){return u(this,void 0,void 0,(function(){var t,e,n=this;return l(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==Ua.CONNECTED?(this._failedCount=0,this.logger.debug(ft.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(t=this.logger.createTraceId(),this.logger.info(ft.L_CHECK_ALIVE_IM_T,null,t),[4,this.sendPing(15e3)]);case 1:return(e=i.sent())===z.SUCCESS?(this.logger.info(ft.L_CHECK_ALIVE_IM_R,e,t),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==Ua.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(ft.L_CHECK_ALIVE_IM_R,"code: ".concat(e,", count: ").concat(this._failedCount),t),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(ft.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(Ua.SUSPENDED,z.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,z.RC_PING_EXCEED_LIMIT),[2]))}}))}))},t.prototype.disconnect=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.setConnectionStatus(Ua.DISCONNECTED,z.ACTIVE_DISCONNECT),this.close(!1,t),[2]}}))}))},t.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},t.prototype.getCmpList=function(t,e){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return h([],this.cmpWeightCache,!0);var n=t.server,i=t.backupServer,r=t.serverAddr,o=t.protocol,s=t.openTLS;if(r)return this.cmpWeightCache=h([],r,!0),h([],r,!0);var a=[],c=[];return n&&c.push(n),null==i||i.split(",").forEach((function(t){c.indexOf(t)<0&&c.push(t)})),c.forEach((function(t,i){var r;r=e?1===s?wt.TLS:wt.RMTP:"http"===o?wt.WS:wt.WSS,a.push({addr:t,protocol:r,weight:n.length-i,race:!1})})),this.cmpWeightCache=a,h([],a,!0)},t.prototype.updateCmpWeight=function(t,e,n){if(this.cmpWeightCache){var i=this.cmpWeightCache.find((function(e){return n?e.addr===t&&e.protocol===wt.QUIC:e.addr===t}));if(i)if(e){var r=Math.max.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));i.weight!==r&&(i.weight=r+1)}else{var o=Math.min.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));i.weight!==o&&(i.weight=o-1)}}},t.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},t}(),Ba=function(){function t(e){this.logger=e,this._codec=t.createPBCodec()}return t.createPBCodec=function(){var t=ti(Na);return t.getModule=function(e){var n=new t[e];return n.getArrayData=function(){var t=n.toArrayBuffer();return t=ae(t)?[].slice.call(new Int8Array(t)):t},n},t},t.prototype.decodeByPBName=function(t,e,n){var i,r=this,o=t,s=((i={})[ko]=r._formatSyncMessages,i[Bo]=r._formatReceivedMessage,i[Vo]=r._formatSentMessage,i[jo]=r._formatHistoryMessages,i[Qo]=r._formatConversationList,i[us]=r._formatChatRoomInfos,i[Cs]=r._formatChatRoomKVList,i[Ms]=r._formatUserSetting,i[As]=r._formatConversationStatus,i[qs]=r._formatGrpReadReceiptQryResp,i[va]=r._formatQueryReceiptResp,i[Os]=r._formatSetUserSettingOutput,i[Ls]=r._formatUserSettingNotification,i[na]=r._formatUltraMsgChangeList,i[aa]=r._formatUltraOperateStatusNotifyList,i[oa]=r._formatUltraMsgList,i[ks]=r._formatUltraGroupUnreadMentionedList,i[as]=r._formatChrmKVVersion,i[fa]=r._formatCallKVInfo,i[pa]=r._fromatCallInfoDownStream,i[os]=r._formateSessionMsgReadInput,i)[e];try{o=t.length>0&&r._codec[e].decode(t),le(o)&&(o=function(t){for(var e in t)le(t[e])&&(t[e]=Ze(t[e]));return t}(o)),he(s)&&(o=s.call(this,o,n))}catch(t){this.logger.error(ft.L_PB_DECODE_E,e)}return o},t.prototype._readBytes=function(t){var e=t.offset,n=t.buffer,i=t.limit;if(e)try{var r=ae(n)?new Uint8Array(n):n;return Vr.readUTF(r.subarray(e,i))}catch(t){this.logger.error(ft.O,null==t?void 0:t.stack)}return t},t.prototype._formatBytes=function(t){if(!t)return t;var e=this._readBytes(t);try{e=e?JSON.parse(e):e}catch(t){this.logger.error(ft.O,null==t?void 0:t.stack)}return e||t},t.prototype._formatSyncMessages=function(t,e){e=e||{};var n=this,i=t.list,r=t.syncTime,o=t.finished;return(de(o)||null===o)&&(t.finished=!0),t.syncTime=Ze(r),t.list=fn(i,(function(t){return n._formatReceivedMessage(t,e)})),t},t.prototype._getUtfContent=function(t){if(t.user){var e=t.user,n=e.portrait,i=e.portraitUri,r=n||i;r&&(t.user.portrait=t.user.portraitUri=r)}return t},t.prototype._setExpansion=function(t){var e;return t&&(e=function(t){var e={},n=JSON.parse(t);return gn(n,(function(t,n){e[n]=t.v})),e}(t)),e},t.prototype._setPushConfig=function(t,e){var n=t.pushContent,i=t.pushExt,r=t.configFlag,o={};return i&&(o=en(e,i.pushConfigs,i.pushId)),c(c({},o),{pushTitle:null==i?void 0:i.title,pushContent:n,pushData:"",disablePushTitle:!!r&&Boolean(4&r),forceShowDetailContent:!!r&&Boolean(8&r),templateId:null==i?void 0:i.templateId})},t.prototype._formatReceivedMessage=function(t,e){if(!t)return t;var i=this,r=e||{},o=r.currentUserId,s=r.connectedTime,a=t.content,c=t.fromUserId,u=t.type,l=t.groupId,h=t.status,d=t.dataTime,p=t.extraContent,g=t.configFlag,f=t.extStatus,_=t.clientUniqueId,E=t.busChannel,v=t.msgId,T=t.classname,C=t.direction||X.RECEIVE,m=function(t){var e=n.READ;return{isPersited:!!(16&t),isCounted:!!(32&t),isMentioned:!!(64&t),disableNotification:!!(512&t),receivedStatus:e=2&t?n.RETRIEVED:e,canIncludeExpansion:!!(1024&t)}}(h),y=m.isPersited,I=m.isCounted,R=m.isMentioned,S=m.disableNotification,O=m.receivedStatus,N=m.canIncludeExpansion,M=!!(2&(f||0)),L=!!(4&(f||0)),U=!!(8&(f||0))?Gt.PRIVATE:Gt.PUBLIC,A=[tt.GROUP,tt.CHATROOM,tt.RTC_ROOM,tt.ULTRA_GROUP].indexOf(u)>-1?l:c,b=c,w=X.RECEIVE;C===X.SEND&&(b=o,w=X.SEND);var P=Ze(d),D=P<s,V=u===tt.CHATROOM,G=i._setExpansion(p),B=i._formatBytes(a);B=i._getUtfContent(B);var k=i._setPushConfig(t,this.logger);V&&c===o&&(w=X.SEND);var x={conversationType:u,targetId:A,senderUserId:b,messageType:T,messageUId:v,isPersited:y,isCounted:I,isMentioned:R,sentTime:P,messageDirection:w,receivedTime:On.getTime(),disableNotification:S,receivedStatus:O,receivedStatusInfo:Rn(O),canIncludeExpansion:N,content:B,expansion:G,configFlag:g,pushConfig:k,channelId:E||"",isInterrupt:M,isModifyMessage:L,messageId:Ze(_)||0,sentStatus:Rt.SENT};return u!==tt.ULTRA_GROUP?(x.isOffLineMessage=D,x):(x.channelType=U,x)},t.prototype._formatSentMessage=function(t,e){var n=this,i=t.content,r=t.classname,o=t.sessionId,s=t.msgId,a=t.extraContent,u=t.pushExt,l=t.pushContent,h=t.configFlag,d=t.extStatus,p=t.clientUniqueId,g=t.systemId,f=e.signal,_=e.currentUserId,E=f.date,v=f.topic,T=f.targetId,C=!!(2&(d||0)),m=function(t){return{isPersited:!!(1&t),isCounted:!!(2&t),disableNotification:!!(32&t),canIncludeExpansion:!!(64&t)}}(o),y=m.isPersited,I=m.isCounted,R=m.disableNotification,S=m.canIncludeExpansion,O=Or[v]||tt.PRIVATE,N=vn(rr,v),M=n._formatBytes(i),L=g||T;r===rt.RECALL&&(O=M.conversationType||O,L=M.targetId||T);var U=n._setExpansion(a),A=n._setPushConfig(t,this.logger),b=c(c({},A),{pushTitle:null==u?void 0:u.title,pushContent:l,pushData:l,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==u?void 0:u.templateId});return{conversationType:O,targetId:L,messageType:r,messageUId:s,isPersited:y,isCounted:I,isStatusMessage:N,senderUserId:_,content:n._formatBytes(i),sentTime:1e3*E,receivedTime:On.getTime(),messageDirection:X.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:S,expansion:U,pushConfig:b,channelId:t.busChannel||"",isInterrupt:C,messageId:Ze(p)||0}},t.prototype._formatHistoryMessages=function(t,e){var n=this,i=e.conversation||{},r=t.list,o=t.hasMsg,s=i.targetId,a=Ze(t.syncTime),c=[];return gn(r,(function(t){var r=n._formatReceivedMessage(t,e);i.conversationType===tt.ULTRA_GROUP?r.targetId=t.groupId||i.targetId:r.targetId=s,c.push(r)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},t.prototype._formatUltraMsgChangeList=function(t){var e=t.list,n=t.syncTime,i=t.hasNext;return{syncTime:n,list:e&&e.map((function(t){var e=t.targetId,n=t.type,i=t.time,r=t.changeType,o=t.msgUID,s=t.msgTime,a=t.busChannel,c=t.isAdmin,u=t.isDel,l=t.operatorId,h=t.subChangeType,d=t.userGroupIds,p=t.busChannelType,g=t.remindType;return{targetId:e,conversationType:n,changeType:r,messageUId:o,changeTime:Ze(i),sendTime:Ze(s),channelId:a||"",isAdmin:c,isDel:u,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p,mentionedType:g}})),hasNext:i}},t.prototype._formatUltraOperateStatusNotifyList=function(t){var e=t.type,n=t.notifyType,i=t.info,r=t.summary,o=[],s=[],a=2==(2&n),c=1==(1&n);return c&&Array.isArray(i)&&i.forEach((function(t){var e=t.targetId,n=t.busChannel,i=t.userId,r=t.opType,s=t.optime,a=Ze(s);o.push({targetId:e,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(t){var e=t.targetId,n=t.busChannel,i=t.count,r=t.opType;s.push({targetId:e,channelId:n,count:i,operationType:r})})),{conversationType:e,info:o,summary:s,hasInfo:c,hasSummary:a}},t.prototype._formatUltraMsgList=function(t,e){var n=this,i=t.list;return{list:i&&i.map((function(t){return n._formatReceivedMessage(t,e)}))}},t.prototype._formatUltraGroupUnreadMentionedList=function(t){var e=t.msgInfo;return(void 0===e?[]:e).map((function(t){return{messageUId:t.msgId,sentTime:Ze(t.msgTime),mentionedType:t.remindType,messageType:t.className||""}}))},t.prototype._getUltraGroupConversationInfo=function(t,e){var n=e.versionTime,i=e.unreadCount,r=e.remindCount,o=e.busChannelType,s=e.msgInfo,a=e.remindMeCount;return t.versionTime=Ze(n)||0,t.unreadMessageCount=this._getUnreadCount(Ze(i)||0),t.unreadMentionedCount=this._getUnreadCount(Ze(r)||0),t.unreadMentionedMeCount=this._getUnreadCount(Ze(a)||0),t.channelType=o||Gt.PUBLIC,t.lastReadTime=0,s&&(t.firstUnreadMessage={sentTime:Ze(s.msgTime)},t.lastReadTime=Ze(s.msgTime)-1),t},t.prototype._getUnreadCount=function(t){return t>999?999:t},t.prototype._formatConversationList=function(t,e){var n=this,i=this,r=t.info,o=e.afterDecode,s={list:(r=fn(r,(function(t){var r=t.msg,s=t.userId,a=t.type,c=t.unreadCount,u=t.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,e)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:Ze(c)||0,latestMessage:l,channelId:u||""};return a===tt.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,t)),(null==o?void 0:o(h))||h})))||[]};return((null==e?void 0:e.conversationType)||tt.NONE)===tt.ULTRA_GROUP&&(s.isFinished=t.isFinished),s},t.prototype._formatSetUserSettingOutput=function(t){return t},t.prototype._formatChatRoomInfos=function(t){var e=t.userTotalNums,n=t.userInfos;return{userCount:e,userInfos:fn(n,(function(t){var e=t.id,n=t.time;return{id:e,time:Ze(n)}}))}},t.prototype._formatChatRoomKVList=function(t){var e=t.entries,n=t.bFullUpdate,i=t.syncTime;return e=fn(e=e||[],(function(t){var e=t.key,n=t.value,i=t.status,r=t.timestamp,o=t.uid,s=t.version,a=function(t){return{isAutoDelete:!!(1&t),isOverwrite:!!(2&t),type:4&t?vt.DELETE:vt.UPDATE}}(i);return{key:e,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:Ze(r),version:Ze(s)}})),{kvEntries:e,isFullUpdate:n,syncTime:i}},t.prototype._formatUserSetting=function(t){var e=this,n=t.items,i=t.version,r={};return gn(n||[],(function(t){var n=t.key,i=t.version,o=t.value;t.version=Ze(i),t.value=e._readBytes(o),"Tag"===n&&t.tags.forEach((function(t){t.createdTime=Ze(t.createdTime),t.tagName=t.name})),r[n]=t})),{settings:r,version:i}},t.prototype._formatConversationStatus=function(t){var e=t.state,n=[];return gn(e,(function(t){var e=t.type,i=t.channelId,r=t.time,o=t.stateItem,s=t.busChannel,a=st.CLOSE,c=ct.NOT_SET,u=!1,l=[];gn(o,(function(t){var e=t.sessionStateType,n=t.value,i=t.tags;switch(e){case Ar:a=n===Lr?st.OPEN:st.CLOSE,c=Number(n)||ct.NOT_SET;break;case br:u=n===Lr;break;case wr:l=i}})),n.push({conversationType:e,type:e,targetId:i,notificationStatus:a,notificationLevel:c,isTop:u,updatedTime:Ze(r),tags:l,channelId:s||""})})),n},t.prototype._formatGrpReadReceiptQryResp=function(t){var e=t.totalMemberNum,n=t.list;return n.forEach((function(t){t.readTime=Ze(t.readTime)})),{totalMemberCount:e,list:n}},t.prototype._formatQueryReceiptResp=function(t){var e=t.list,n=void 0===e?[]:e,i=t.num,r=t.readCnt;return{list:n.map((function(t){return{readTime:Ze(t.receiptTime),userId:t.userId}})),totalCount:i,readCount:r}},t.prototype._formatUserSettingNotification=function(t){return t},t.prototype._formatChrmKVVersion=function(t){var e=t.joinTime,n=t.createTime,i=t.memberCount,r=t.chatroomBanState;return{joinTime:e,createTime:n||0,memberCount:i||0,isAllChatroomBanned:!!(1&r),isCurrentUserBanned:!!(2&r),isCurrentChatroomBanned:!!(4&r),isCurrentChatroomInWhitelist:!!(1&t.whiteListState)}},t.prototype._formatRTCJoinedUserInfo=function(t){return(t.info||[]).map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:Ze(t.joinTime)}}))},t.prototype._formatCallKVInfo=function(t){return t},t.prototype._fromatCallInfoDownStream=function(t){return t},t.prototype._formateSessionMsgReadInput=function(t){var e=t.busChannel,n=t.channelId,i=t.msgTime;return{conversationType:t.type,targetId:n,channelId:e||"",timestamp:i}},t.prototype.encodeServerConfParams=function(){var t=this._codec.getModule(xo);return t.setNothing(1),t.getArrayData()},t.prototype._updateMentionedInfo=function(t,e,n){var i,r,o;return{userIdList:(null===(i=t.mentionedInfo)||void 0===i?void 0:i.userIdList)||e,type:(null===(r=t.mentionedInfo)||void 0===r?void 0:r.type)||n||lt.ALL,mentionedContent:(null===(o=t.mentionedInfo)||void 0===o?void 0:o.mentionedContent)||""}},t.prototype._calculateFlag=function(t){var e=t.isFilerWhiteBlacklist,n=t.isVoipPush,i=t.pushConfig||{},r=0;return r|=n?1:0,r|=e?2:0,r|=i.disablePushTitle?4:0,r|=i.forceShowDetailContent?8:0},t.prototype._getPushExtraModule=function(t){var e=t.pushTitle,n=t.iOSConfig,i=t.androidConfig,r=t.templateId,o=void 0===r?"":r,s=this._codec.getModule(Go);if(e&&s.setTitle(e),n||i){var a=tn(n,i);s.setPushConfigs(a)}return(null==i?void 0:i.notificationId)&&s.setPushId(null==i?void 0:i.notificationId),s.setTemplateId(o),s},t.prototype._getUpMsgModule=function(t,e){var n=e.messageType,i=e.isMentioned,r=e.mentionedType,o=e.content,s=e.directionalUserIdList,a=e.canIncludeExpansion,c=e.expansion,u=e.pushConfig,l=e.channelId,h=e.pushData,d=void 0===h?"":h,p=e.mentionedUserIdList,g=void 0===p?[]:p,f=e.pushContent,_=void 0===f?"":f,E=e.messageId,v=void 0===E?0:E,T=t.conversationType,C=t.targetId,m=this._codec.getModule(Vo),y=function(t){var e=t.isStatusMessage,n=t.isPersited,i=t.isCounted;e&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),t.isMentioned&&(r|=4),t.disableNotification&&(r|=32),t.canIncludeExpansion&&(r|=64),r}(e),I=u||{},R=I.pushContent,S=void 0===R?_:R,O=I.pushData,N=void 0===O?d:O;m.setSessionId(y),i&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,g,r)),S&&m.setPushText(S),N&&m.setAppData(N),s&&m.setUserId(s);var M=this._calculateFlag(e);if(m.setConfigFlag(M),m.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),m.setContent(JSON.stringify(o)),a&&c){var L={};gn(c,(function(t,e){L[e]={v:t}})),m.setExtraContent(JSON.stringify(L))}if(u){var U=this._getPushExtraModule(u);m.setPushExt(U)}return m.setClientUniqueId(v),de(l)||m.setBusChannel(l),T===tt.SYSTEM&&m.setSystemId(C),m},t.prototype.encodeUpMsg=function(t,e){return this._getUpMsgModule(t,e).getArrayData()},t.prototype.encodeSyncMsg=function(t){var e=t.sendboxTime,n=t.inboxTime,i=t.broadcastSyncTime,r=this._codec.getModule(Ho);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(e),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},t.prototype.encodeChrmSyncMsg=function(t,e){t=t||0,e=e||0;var n=this._codec.getModule(qo);return n.setCount(e),n.setSyncTime(t),n.getArrayData()},t.prototype.encodeGetHistoryMsg=function(t,e){var n=e.count,i=e.order,r=e.timestamp,o=e.channelId,s=this._codec.getModule(Yo);return s.setTargetId(t),s.setTime(r),s.setCount(n),s.setOrder(i),s.setBusChannel(o||""),s.getArrayData()},t.prototype.encodeSuperSyncMsg=function(t){var e=this._codec.getModule(zs);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeOldConversationList=function(t){var e=(t=t||{}).count,n=t.type,i=t.startTime,r=t.order;e=e||0,i=i||0,r=r||0;var o=this._codec.getModule(Wo);return o.setType(n),o.setCount(e),o.setStartTime(i),o.setOrder(r),o.getArrayData()},t.prototype.encodeRemoveOldConversationList=function(t){var e=(t=t||{}).conversationType,n=t.channelId,i=this._codec.getModule(es);return i.setType(e),n&&i.setBusChannel([n]),i.getArrayData()},t.prototype.encodeBatchDeleteConversation=function(t){var e=this,n=this._codec.getModule($o),i=[];return t.forEach((function(t){var n=t.conversationType,r=t.targetId,o=t.channelId,s=e._codec.getModule(ts);s.setConversationType(n),s.setConversationId(r),s.setBusChannel(o||""),i.push(s)})),n.setRelation(i),n.getArrayData()},t.prototype.encodeDeleteMessages=function(t,e,n,i){var r=this._codec.getModule(ns),o=[];return gn(n,(function(t){o.push({msgId:t.messageUId,msgDataTime:t.sentTime,direct:t.messageDirection})})),r.setType(t),r.setConversationId(e),r.setMsgs(o),r.setBusChannel(i),r.getArrayData()},t.prototype.encodeClearMessages=function(t,e,n,i){var r=this._codec.getModule(is);return e=e||(new Date).getTime(),r.setDataTime(e),r.setTargetId(t),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},t.prototype.encodeBatchClearRemoteMessages=function(t){var e=this,n=this._codec.getModule(rs),i=t.map((function(t){var n=e._codec.getModule(is);return n.setTargetId(t.targetId),n.setConversationType(t.conversationType),n.setBusChannel(t.channelId),n.setDataTime(t.timestamp),n}));return n.setInput(i),n.getArrayData()},t.prototype.encodeClearUnreadCount=function(t,e){var n=t.conversationType,i=t.targetId,r=t.channelId,o=e.timestamp,s=this._codec.getModule(os);return o=o||+new Date,s.setType(n),s.setChannelId(i),s.setMsgTime(o),s.setBusChannel(r),s.getArrayData()},t.prototype.encodeExpandUltraMessage=function(t,e){var n=t.targetId,i=t.conversationType,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.keys,c={mid:o,put:t.expansion,del:a,clear:t.removeAll?1:0},u=this._codec.getModule($s);return u.setFromUserId(e),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(c)),u.getArrayData()},t.prototype.encodemodifyMessage=function(t,e){var n=t.targetId,i=t.conversationType,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.content,c=this._codec.getModule($s);return c.setFromUserId(e),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(a)),c.getArrayData()},t.prototype.encodeQueryMsgChange=function(t){var e=this._codec.getModule(ta);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeMsgQuery=function(t){var e=t.targetId,n=t.conversationType,i=t.messages,r=this._codec.getModule(ia),o=i.map((function(t){return{msgTime:t.sendTime,msgUID:t.messageUId,busChannel:t.channelId}}));return r.setTargetId(e),r.setType(n),r.setQuery(o),r.getArrayData()},t.prototype.encodeUnreadMentionedMsgQuery=function(t){var e=t.targetId,n=t.channelId,i=t.sentTime,r=t.count,o=this._codec.getModule(Bs);return o.setGroupId(e),o.setBusChannel(n),o.setMsgTime(i),o.setSize(r),o.getArrayData()},t.prototype.encodeOperateStatus=function(t,e,n,i){var r=this._codec.getModule(sa);return r.setTargetId(t),r.setType(e),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},t.prototype.encodeJoinOrQuitChatRoom=function(){var t=this._codec.getModule(ss);return t.setNothing(1),t.getArrayData()},t.prototype.encodeGetChatRoomInfo=function(t,e){var n=this._codec.getModule(cs);return n.setCount(t),n.setOrder(e),n.getArrayData()},t.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(t,e){var n=this._codec.getModule(Gs);return n.setUnpushLevel(t),n.setBusChannel(e),n.getArrayData()},t.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(t){var e=this._codec.getModule(Vs);return e.setBusChannel(t),e.getArrayData()},t.prototype.encodeGetFileToken=function(t,e,n,i,r){var o=this._codec.getModule(ls);return o.setType(t),o.setKey(e),o.setHttpMethod(n),o.setQueryString(i),o.setUrl(r),o.getArrayData()},t.prototype.encodeGetFileUrl=function(t,e,n,i){var r=this._codec.getModule(t);return r.setType(e),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},t.prototype.encodeModifyChatRoomKV=function(t,e,n){var i=this._codec.getModule(Es),r=e.key,o=e.value,s=e.notificationExtra,a=e.isSendNotification,c=e.type,u=e.timestamp,l=c||vt.UPDATE,h=Nn(e,l),d={key:r,value:o||"",uid:n,version:u};if(de(h)||(d.status=h),i.setEntry(d),a){var p={conversationType:tt.CHATROOM,targetId:t},g={key:r,value:o,extra:s,type:l},f=this._getUpMsgModule(p,{messageType:rt.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});i.setNotification(f),i.setBNotify(!0),i.setType(tt.CHATROOM)}return i.getArrayData()},t.prototype.encodeModifyChatRoomKVS=function(t,e,n){var i=this._codec.getModule(vs),r=e.entries,o=e.type||vt.UPDATE,s=Nn(e,o),a=[];return r.forEach((function(t){var e={key:t.key,value:t.value||"",uid:n,version:t.timestamp};de(s)||(e.status=s),a.push(e)})),i.setEntry(a),i.getArrayData()},t.prototype.encodePullChatRoomKV=function(t){var e=this._codec.getModule(Rs);return e.setTimestamp(t),e.getArrayData()},t.prototype.encodePullUserSetting=function(t){var e=this._codec.getModule(Ns);return e.setVersion(t),e.getArrayData()},t.prototype.encodeGetConversationStatus=function(t){var e=this._codec.getModule(Us);return e.setTime(t),e.getArrayData()},t.prototype.encodeSetConversationStatus=function(t,e){var n=this,i=this._codec.getModule(Ps),r=On.getTime(),o=[];return gn(t,(function(t){var e=n._codec.getModule(bs),i=t.conversationType,s=t.targetId,a=t.notificationStatus,c=t.isTop,u=t.channelId,l=t.notificationLevel,h=[];e.setType(i),e.setChannelId(s),e.setTime(r),e.setBusChannel(u);var d=a===st.OPEN,p={};de(a)||(p[Ar]=d),de(l)||(p[Ar]=l),de(c)||(p[br]=c),gn(p,(function(t,e){if(!de(t)){var i=n._codec.getModule(ws);t=t?Lr:Ur,de(l)||Number(e)!==Ar||(t=String(l)),i.setSessionStateType(Number(e)),i.setValue(t),h.push(i)}})),e.setStateItem(h),o.push(e)})),i.setVersion(e||r),i.setState(o),i.getArrayData()},t.prototype.encodeReadReceipt=function(t,e){var n=this._codec.getModule(Fs);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeCreateTag=function(t,e){var n=this,i=this._codec.getModule(Ys),r=[];return t.forEach((function(t){var e=n._codec.getModule(js);e.setTagId(t.tagId),e.setName(t.tagName),r.push(e)})),i.setTags(r),i.setVersion(e),i.getArrayData()},t.prototype.encodeMessageReader=function(t,e){var n=this._codec.getModule(Fs);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeReadReceiptMsg=function(t,e,n){var i=this._codec.getModule(_a),r=t.conversationType,o=t.targetId,s=t.channelId,a=void 0===s?"":s;return i.setType(r),i.setTargetId(o),i.setBusChannel(a),i.setStartMsgId(e),i.setEndMsgId(n),i.getArrayData()},t.prototype.encodeReceiptQryReq=function(t,e){var n=this._codec.getModule(Ea),i=t.targetId,r=t.channelId,o=void 0===r?"":r;return n.setTargetId(i),n.setBusChannel(o),n.setMsgId(e),n.getArrayData()},t.prototype.encodeReceiptCntQryReq=function(t,e){var n=this._codec.getModule(Ca),i=t.targetId,r=t.conversationType,o=t.channelId,s=void 0===o?"":o;return n.setChannelId(i),n.setBusChannel(s),n.setType(r),n.setMsgId(e),n.getArrayData()},t.prototype.encodeSessionMsgReadInput=function(t,e){var n=this._codec.getModule(os),i=t.conversationType,r=t.targetId,o=t.channelId,s=void 0===o?"":o;return n.setType(i),n.setChannelId(r),n.setBusChannel(s),n.setMsgTime(e),n.getArrayData()},t.prototype.encodeRemoveTag=function(t,e){var n=this,i=this._codec.getModule(Ws),r=[];return t.forEach((function(t){var e=n._codec.getModule(js);e.setTagId(t),r.push(e)})),i.setTags(r),i.setVersion(e),i.getArrayData()},t.prototype.encodeDisConversationTag=function(t){var e=this._codec.getModule(Qs);return e.setTagId(t),e.getArrayData()},t.prototype.encodeUpdateConversationTag=function(t,e,n){var i=this,r=this._codec.getModule(Ps),o=[];return e.forEach((function(e){var n=i._codec.getModule(bs),r=i._codec.getModule(ws),s=[];t.forEach((function(t){var e=i._codec.getModule(js);e.setTagId(t.tagId),de(t.isTop)||e.setIsTop(t.isTop),s.push(e)})),r.setSessionStateType(wr),r.setValue(JSON.stringify(s)),r.setTags(s),n.setType(e.conversationType),n.setChannelId(e.targetId),n.setTime(Date.now()),n.setStateItem([r]),o.push(n)})),r.setState(o),r.setVersion(n),r.getArrayData()},t.prototype.encodeReportSDKInfo=function(t){var e=this._codec.getModule(Js);return e.setSdkInfo(t),e.getArrayData()},t.prototype.encodeUltraGroup=function(t,e){var n=this._codec.getModule(Zs);return n.setSyncTime(t),n.setIsEraseMsgContent(e),n.getArrayData()},t.prototype.encodebindRTCRoomForChatroom=function(t){var e=this._codec.getModule(la);return e.setRtcRoomId(t.rtcRoomId),e.getArrayData()},t.prototype.encodeSetCallInfo=function(t,e){var n=this._codec.getModule(da);return n.setKey(t),n.setDataContent(e),n.getArrayData()},t.prototype.encodePullKVMsg=function(t){var e=this._codec.getModule(ga);return e.setSyncTime(t),e.getArrayData()},t}(),ka=function(t){function e(e,n,i,r,o,s){var a=t.call(this,e,n,i,r,s)||this;return a.runtime=o,a.wsListener=s,a._socket=null,a._connectedTime=0,a._socketIndex=0,a._localConnectedTime=0,a._idCount=0,a._generateMessageId=function(){return a._idCount>=65535&&(a._idCount=0),++a._idCount},a._messageIds={},a._syncMessageIds={},a.codec=new Ba(a.logger),a}return a(e,t),e.prototype.getConnectedTime=function(){return this._connectedTime},e.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},e.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},e.prototype.connectWithToken=function(t,e,n,i){return u(this,void 0,void 0,(function(){var n,r,o,s,a,c,u,h,d;return l(this,(function(p){switch(p.label){case 0:if(n=e.openAnti,r=e.type,o=this.getCmpList(e),0===(s=o.filter((function(t,e){return o.findIndex((function(e){return e.addr===t.addr}))===e})).sort((function(t,e){return t.weight>e.weight?-1:1}))).length)return this.logger.error(ft.L_NAVI_CONF_E,"no service available",i),[2,{code:z.SERVER_UNAVAILABLE}];a=1===n?zi.V4:zi.V3,c=function(e){var n,o,c,h,d,p,g,f,_,E,v;return l(this,(function(l){switch(l.label){case 0:return n=s[e],o=n.protocol,c=n.addr,h=n.weight,d=function(t,e,n,i,r,o,s){var a=Hi(r),c=a.type,u=a.version,l="browser"===r.tag?"|".concat(c,"|").concat(u):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(t,"://").concat(e,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(F,"&pid=").concat(o,"&apiVer=").concat(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l)).concat(r.connectPlatform?"&platform=".concat(r.connectPlatform):"").concat(h)}(o===wt.WS?"ws":"wss",c,u.appkey,t,u.runtime,"",a),p=Date.now(),[4,u.connectWebSocket(d,a,i)];case 1:return g=l.sent(),f=g.code,_=g.data,E=u.cmpWeightCache.findIndex((function(t){return t.addr===c})),v={bid:sn(),ptc:Kt.WS,cod:f,net:u.getNetwork().type,dur:Date.now()-p,spr:0,pr:r||0,hos:c,idx:E,rct:u.retryCount?Wt.RECONNECT:Wt.CONNECT,cid:"".concat(u.uuid,"_").concat(u.retryCount),v:jt.CURRENT,rsn:u.reason,count:u.retryCount,weight:h},u.statisticLog.record(_t.IM_WEBSOCKET,JSON.stringify(v),i),f===z.RC_SOCKET_DISCONNECTED||f===z.TIMEOUT?[2,"continue"]:f!==z.SUCCESS?[2,{value:{code:f}}]:(u._localConnectedTime=Math.floor((Date.now()+p)/2),u._socket=_.socket,u.updateCmpWeight(s[e].addr,!0),u.curCmpUrl=s[e].addr,[2,{value:{code:f,data:_.userId}}])}}))},u=this,h=0,p.label=1;case 1:return h<s.length?[5,c(h)]:[3,4];case 2:if("object"==typeof(d=p.sent()))return[2,d.value];p.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:z.SERVER_UNAVAILABLE}]}}))}))},e.prototype.connectWebSocket=function(t,e,n){return u(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this.logger.info(ft.T,"connect start: ".concat(t),n),[2,new Promise((function(r){var o=i.runtime.createWebSocket(t);i._socketIndex=o.id;var s=setTimeout((function(){i.logger.info(ft.T,"connect timeout: ".concat(t),n),r({code:z.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),i.logger.info(ft.T,"socket open",n)})),o.onMessage((function(t){if(i._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var s,a=eo(i.logger,t,e);if(a instanceof Hr){var c=a.status;if(c!==Ia.ACCEPTED)return i.logger.info(ft.T,"connect failed: ".concat(c),n),void r({code:(s=c,ba[s])});i.logger.info(ft.T,"connect success",n);var u=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=u,i._idCount=h,void r({code:z.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof qr){var d=a.status;return i.logger.info(ft.T,"recv disconnect signal -> status: ".concat(d)),void i.onRecvDisconnect(d,o)}i._onReceiveSignal(a)}}else i.logger.warn(ft.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:o.id}))})),o.onClose((function(){i.logger.info(ft.T,"socket close",n);var t=z.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(o,t)})),o.onError((function(t){i.logger.info(ft.T,"socket error",n);var e=z.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(o,e)}))}))]}))}))},e.prototype._qosNeedAck=function(t,e){t.header&&t.header.qos!==Ji.AT_MOST_ONCE&&(t instanceof Qr&&!t.syncMsg&&(this.logger.debug(ft.O,"send pubAck -> ".concat(e," ").concat(t.topic)),this.sendOnly(new Zr(e))),t instanceof to&&(this.logger.debug(ft.O,"send queryCon -> ".concat(e," ").concat(t.topic)),this.sendOnly(new $r(e))))},e.prototype._publishReader=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o=this;return l(this,(function(s){switch(s.label){case 0:return n=t.syncMsg,i=t.topic,this.logger.debug(ft.O,"recv PublishReader -> messageId: ".concat(e," ").concat(i)),i===Vn?[2]:!n||function(t){return[no.ppMsgS,no.pgMsgS,no.chatMsgS].map((function(t){return no[t]})).indexOf(t)>=0}(i)?(this.wsListener.signal(t),[2]):[4,new Promise((function(t){o._syncMessageIds[e]=t}))];case 1:return r=s.sent(),delete this._syncMessageIds[e],this.wsListener.signal(t,r),[2]}}))}))},e.prototype._onReceiveSignal=function(t){return u(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return e=t.messageId,t instanceof Yr&&this._pingResolve?(this._pingResolve(z.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(t,e),e>0&&(t instanceof Xr||t instanceof to)&&(this.logger.debug(ft.O,"recv ack -> messageId: ".concat(e," ").concat(t.topic)),(n=this._messageIds[e])&&(n(t),delete this._messageIds[e]),(i=this._syncMessageIds[e])&&(delete this._syncMessageIds[e],i(t))),t instanceof Qr?[4,this._publishReader(t,e)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.onRecvDisconnect=function(t,e){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(t){return Aa[t]}(t)))},e.prototype.onSocketEnd=function(t,e){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(e),this._pingResolve&&(this._pingResolve(e),this._pingResolve=void 0))},e.prototype.clearResolves=function(){for(var t in this._messageIds){var e=this._messageIds[t];delete this._messageIds[t],e(z.RC_SOCKET_DISCONNECTED)}},e.prototype.sendPing=function(t){var e=this;return new Promise((function(n){e._pingResolve=n,setTimeout((function(){return n(z.TIMEOUT)}),t),e.sendOnly(new Kr)}))},e.prototype.sendOnly=function(t){this._socket&&((t instanceof Jr||t instanceof zr)&&(t.messageId=this._generateMessageId()),this._socket.send(t.getBufferData().buffer))},e.prototype.send=function(t,e,n,i){return void 0===i&&(i=3e4),u(this,void 0,void 0,(function(){var r,o,s,a,c=this;return l(this,(function(u){switch(u.label){case 0:return this._socket?(r=this._generateMessageId(),t.messageId=r,this._socket.send(t.getBufferData().buffer),[4,new Promise((function(t){c._messageIds[r]=t,setTimeout((function(){c._messageIds[r]&&delete c._messageIds[r],t()}),i)}))]):[2,{code:z.RC_NET_CHANNEL_INVALID}];case 1:return(o=u.sent())?o instanceof to||o instanceof Xr?(s=e&&o.data&&[z.SUCCESS,z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,e,n):o,0!==o.status?(this.logger.warn(ft.O,"send failed -> message: ".concat(r,", respPBName: ").concat(e,", status: ").concat(o.status)),[2,{code:o.status,data:e&&o.data?a:null}]):[2,{code:z.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(ft.O,"send timeout -> message: ".concat(r,", respPBName: ").concat(e,", timeout: ").concat(i)),[2,{code:z.TIMEOUT}])}}))}))},e.prototype.close=function(t){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},e}(Ga);!function(t){t[t.STATISTICS=-2]="STATISTICS",t[t.RECORD=-1]="RECORD"}(Va||(Va={}));var xa=null,Fa="RC_CONF",Ha="RC_STATISTICS",qa=null,Ka=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,xa];case 1:return(e=n.sent())?[4,new Promise((function(n){var i=e.db.transaction(Ha,"readwrite").objectStore(Ha),r=IDBKeyRange.lowerBound(Date.now()-t),o=i.getAllKeys(r);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var r=i.delete(IDBKeyRange.bound(t[0],t[e-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),qa=setTimeout((function(){return Ka(t)}),6e5),[2]}}))}))},Ya=function(t,e,n){void 0===n&&(n=168),xa||("undefined"!=typeof window&&window&&window.indexedDB?xa=new Promise((function(i){var r=window.indexedDB;r.databases&&r.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_STATISTIC_".concat(t),s=r.open(o,2);s.onerror=function(t){e.error(ft.L_LOGDB_OPEN_FAILED_E,t.target.error),i(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(t){e.warn(ft.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(ft.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(ft.L_LOGDB_ABORT_S,t.target.error)},Ka(3600*Math.max(24,Math.min(168,n))*1e3),i({appkey:t,db:o})):i(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(Ha)&&e.deleteObjectStore(Ha);var n=e.createObjectStore(Ha,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(Fa,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(ft.L_UNSUPPORT_INDEXDB_O))},ja=[],Wa=function(){return u(void 0,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return xa?(qa&&(clearTimeout(qa),qa=null),[4,xa]):[2];case 1:return(t=n.sent())&&(e=t.db,ja.push(e)),xa=null,[2]}}))}))};function Qa(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,xa];case 1:return(e=n.sent())?[2,new Promise((function(n){var i=e.db.transaction(Fa,"readonly").objectStore(Fa).get(t);i.onsuccess=function(t){var e;n({value:null===(e=i.result)||void 0===e?void 0:e.value,success:!0})},i.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Ja,Xa="REPORT_SESSION",Za=function(t,e){return u(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Xa,"_").concat(t),[4,Qa("".concat(Xa,"_").concat(t))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(e===(null==o?void 0:o.sessionId)||function(t,e){u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,xa];case 1:return(n=r.sent())?(i=n.db,i.transaction(Fa,"readwrite").objectStore(Fa).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))},za=function(){return xa},$a=function(t){var e=t.sessionId,n=t.level,i=t.loggerId,r=t.traceId,o=t.time,s=t.tag,a=t.type,c=t.content,u=n<0?c||"":JSON.stringify({content:c,traceId:r,from:i});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},tc=Ne(),ec=Date.now(),nc=0,ic=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.record=this._writer.bind(this,Va.STATISTICS)}return t.prototype._writer=function(t,e,n,i){var r=new Date;/^[\w-]+$/.test(e)&&this.flush({time:+r,sessionId:tc,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:i})},t.prototype.createTraceId=function(){return"".concat(tc,"-").concat(++nc)},t.prototype.getSessionId=function(){return tc},t}(),rc=function(){function t(t,e,n,i,r,o){void 0===o&&(o=r),this.appkey=t,this.deviceId=e,this.deviceInfo=n,this.statisticDB=i,this.logger=r,this.reportClass=o,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return t.prototype.checkStart=function(t){return u(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=ai.getLogUrlPolicyList(t,this.logger),n=e.policy,i=e.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},t.prototype.realtimeReport=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||ec,o=Math.max(i-5e3,r),s=this.reportClass.createTraceId(),this.logger.debug(ft.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:e}),s),[4,this.statisticDB.getStatistics(r,o,e,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(ft.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return u.length>0?(this.logger.debug(ft.L_REALTIME_LOG_O,JSON.stringify({count:u.length}),s),[4,this.compressStatistics(u)]):[3,5];case 3:return h=l.sent(),d=h.success,p=h.data,d||this.logger.warn(ft.L_REALTIME_LOG_O,"compress failed",s),this.logger.debug(ft.L_REALTIME_LOG_O,"compress done",s),g=ge(t)?t:"https://".concat(t),g+="?version=".concat("5.9.3","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:p,method:"POST"})];case 4:f=l.sent().status,this.logger.debug(ft.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(u[u.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++),l.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return _.realtimeReport(t,e,n)}),1e3*n)),[2]}}))}))},t.prototype.report=function(t,e,n,i,r,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(ft.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:r,messageUId:o}),s),[4,this.statisticDB.getStatistics(t,e,Va.STATISTICS,!1)]);case 1:return a=l.sent(),c=a.dbReady,u=a.logs,this.logger.info(ft.L_REPORT_FULL_LOG_O,JSON.stringify({count:u.length}),s),h=ge(i)?i:"https://".concat(i),h+="?version=".concat("5.9.3","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),c?u.length>0?[4,this.compressStatistics(u)]:[3,3]:[3,5];case 2:return p=l.sent(),g=p.success,f=p.data,d=g?f:"compress failed",[3,4];case 3:d="no data",l.label=4;case 4:return[3,6];case 5:d="no database",l.label=6;case 6:return this.logger.debug(ft.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:h,body:d,method:"POST"})];case 7:return _=l.sent().status,this.logger.info(ft.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},t.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},t}(),oc="RC_STATISTICS",sc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){lc(t)},e}(ic),ac=!1,cc=[],uc=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return ac||0===cc.length?[2]:(ac=!0,e=cc.splice(0),[4,new Promise((function(n){var i=t.transaction(oc,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(oc);e.forEach((function(t){try{r.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),ac=!1,0===cc.length&&ja.length>0&&(ja.forEach((function(t){return t.close()})),ja.length=0),setTimeout((function(){return uc(t)})),[2]}}))}))},lc=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,za()];case 1:return(e=n.sent())?(cc.push(t),uc(e.db),[2]):[2]}}))}))},hc=0,dc=function(){return{setTimestamp4RealtimeLog:function(t){hc=t},getTimestamp4RealtimeLog:function(){return hc},getStatistics:function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return[4,za()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(oc,"readonly").objectStore(oc),o=[],s=IDBKeyRange.bound(t,e),a=r.index("time").openCursor(s);a.onsuccess=function(t){var e=t.target.result;if(e){var n=e.value;o.push(n),e.continue()}else i({dbReady:!0,logs:o})},a.onerror=function(t){i({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},pc=function(t){function e(e,n,i,r){var o=this,s=Me(n),a=Hi(n),c="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=t.call(this,e,s,c,dc(),i,r)||this).runtime=n,o}return a(e,t),e.prototype.send=function(t){return this.runtime.httpReq(t)},e.prototype.checkStart=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Za(e.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressStatistics=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:ki(t.map($a).join(""))}]}))}))},e.prototype.isReporter=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,(e=this.userId,n=this.reportClass.getSessionId(),u(void 0,void 0,void 0,(function(){var t,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,Qa("".concat(Xa,"_").concat(e))];case 1:return t=o.sent(),i=t.success,r=t.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,i,r,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){switch(a.label){case 0:return[4,this.isReporter()];case 1:return a.sent()?[2,t.prototype.report.call(this,e,n,i,r,o,s)]:[2]}}))}))},e.prototype.realtimeReport=function(e,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,t.prototype.realtimeReport.call(this,e,n,i)]}))}))},e}(rc),gc=function(t){function e(e,n,i){var r=t.call(this,e,n)||this;return r.appkey=e,r.logger=n,r.runtime=i,r._storageKey="",r._storageKey=j.STATIC_CONFIG_KEY(e),r}return a(e,t),e.prototype.getCache=function(){return this.runtime.localStorage.getItem(this._storageKey)},e.prototype.setCache=function(t){this.runtime.localStorage.setItem(this._storageKey,t)},e.prototype.clearCache=function(){this.runtime.localStorage.removeItem(this._storageKey)},e.prototype.sendRequest=function(t){return u(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return[4,this.runtime.httpReq({url:t})];case 1:return e=r.sent(),n=e.status,i=e.data,[2,{code:n,data:i}]}}))}))},e.prototype.decryptData=function(t){return u(this,void 0,void 0,(function(){var e,n;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,an(t,A,b)];case 1:return e=i.sent(),[2,JSON.parse(e)];case 2:return n=i.sent(),this.logger.error(ft.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},e}(ci),fc=function(){function t(t){this.reporter=t,this.logId="",this.uploadTask=[],this.taskLock=!0}return t.prototype.uploadLogCmdTask=function(t){this.uploadTask.push(t),this.enqueueTask()},t.prototype.reportLogCmdTask=function(t){var e,n,i,r,o=this;this.taskLock=!1;var s=null!==(e=t.startTime)&&void 0!==e?e:0,a=null!==(n=t.endTime)&&void 0!==n?n:0,c=null!==(i=t.platform)&&void 0!==i?i:"",u=null!==(r=t.uri)&&void 0!==r?r:"";t.logId!==this.logId&&""!==u&&(this.logId=t.logId,this.reporter.report(s,a,c,u,t.logId,"",!0).finally((function(){o.taskLock=!0,o.uploadTask.length>0&&o.enqueueTask()})))},t.prototype.enqueueTask=function(){if(this.taskLock){var t=this.uploadTask.shift();t&&this.reportLogCmdTask(t)}},t}();!function(t){t[t.init=1]="init",t[t.newWorkChange=2]="newWorkChange",t[t.other=3]="other"}(Ja||(Ja={}));var _c={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}};function Ec(){return _c}var vc=function(){function t(t,e,n,i){this.logger=t,this.appkey=e,this.reporter=n,this.statisticLog=i,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new fc(n)}return t.prototype.init=function(){try{var t=this.getLocalCloudControllerCache();this._cache=t?JSON.parse(t):Ec()}catch(t){this._cache=Ec()}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)))},t.prototype.isExire=function(){return(new Date).getTime()-this.timestamp<this.expire},t.prototype.isOverclock=function(){return(new Date).getTime()-this.lastRequestTime<this.interval},t.prototype.logCmdMsgTasks=function(t){var e=this;t.uploadLog&&t.uploadLog.tasks.forEach((function(t){t.objectName===rt.LOG_COMMAND&&e.uploadTaskManage.uploadLogCmdTask(t)}))},t.prototype.dataHandle=function(t){var e=this._cache;e.lastRequestTime=this.lastRequestTime,fe(t)&&(e.timestamp=t.timestamp,t.uploadLog&&!t.uploadLog.temporary&&(e.uploadLog=t.uploadLog),t.cc&&!t.cc.temporary&&(e.cc=t.cc),t.mrtr&&!t.mrtr.temporary&&(e.mrtr=this._handleMrtrData(t.mrtr)),t.mrtr&&this.setMRTRConfig(this._handleMrtrData(t.mrtr))),this.setCloudControllerCache(e),this.expire=e.cc.expire,this.interval=e.cc.interval,this.timestamp=e.timestamp,this.logCmdMsgTasks(t)},t.prototype.request=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return!this.isEable&&e===Ja.init&&this.isExire()?(this.logger.info(ft.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&e===Ja.newWorkChange&&this.isOverclock()?(this.logger.info(ft.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(i=cn(t),this.lastRequestTime=(new Date).getTime(),r="".concat(i,"/v1/config"),o={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(o["RC-Token"]=n),s={platform:"web",version:"5.9.3",timestamp:this.timestamp},this.statisticLog.record(_t.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!n,uri:r})),[4,this.httpRequest(r,Qe.POST,o,s)]);case 1:if(a=l.sent(),c=a.code,u=a.data,this.statisticLog.record(_t.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:u})),c===z.CLOUD_DATA_CENTER_INVALID&&u){if(h=u.targetRegion,this.changeAreaCode===h)return[2,this.timestamp];if(h)return d=ai.setAreaCode(h),this.logger.info(ft.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:d,originAreaCode:ai.getAreaCode(),newAreaCode:h})),this.changeAreaCode=h,(p=ai.getCloudControllerUrl(h))[0]?[2,this.request(p[0],Ja.other)]:(this.logger.info(ft.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:r,msg:"appkey region error"})),[2,this.timestamp])}return u&&this.dataHandle(u),[2,this.timestamp||this.lastRequestTime]}}))}))},t.prototype._handleMrtrData=function(t){return{chatroom:(null==t?void 0:t.chatroom)||0,group:(null==t?void 0:t.group)||0,private:(null==t?void 0:t.private)||0,ultraGroup:(null==t?void 0:t.ultraGroup)||0,temporary:!!(null==t?void 0:t.temporary)}},t}(),Tc=function(t){function e(e,n,i,r,o){var s=t.call(this,i,e,r,o)||this;s.runtime=n,s._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};var a=mn(n);return s.deviceId=Me(n),s.model="Web|".concat(a.type,"|").concat(a.version),s.init(),s}return a(e,t),e.prototype.httpRequest=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return(r=i).deviceId=this.deviceId,r.model=this.model,o={url:t,method:e,headers:n,body:JSON.stringify(r)},this.logger.info(ft.L_REQUEST_T,JSON.stringify(o)),[4,this.runtime.httpReq(o)];case 1:s=l.sent(),a=s.status,c=s.data,u=void 0===c?"":c,this.logger.info(ft.L_REQUEST_R,JSON.stringify({status:a,data:u}));try{return h=JSON.parse(u),d=h.data,[2,{code:parseInt(h.code,10),data:d}]}catch(t){return this.logger.warn(ft.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:u,error:t})),[2,{code:a,msg:t}]}return[2]}}))}))},e.prototype.setCloudControllerCache=function(t){var e=j.CLOUD_CONTROL_KEY(this.appkey);this.runtime.localStorage.setItem(e,JSON.stringify(t)),this.logger.info(ft.L_CLOUD_SET_CACHE_O,JSON.stringify(t))},e.prototype.getLocalCloudControllerCache=function(){var t=j.CLOUD_CONTROL_KEY(this.appkey),e=this.runtime.localStorage.getItem(t);return this.logger.info(ft.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:t,data:e})),e},e.prototype.setMRTRConfig=function(t){this.logger.info(ft.L_CLOUD_SET_MRTR_O,JSON.stringify(t)),this._mrtr=t},e.prototype.getMRTRConfig=function(){return this._mrtr},e}(vc),Cc=function(t,e,i,r,o,s,a){return{conversationType:t,targetId:e,senderUserId:s,messageDirection:X.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:Rn(n.UNREAD),pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:Rt.SENT}},mc=function(t){return t.sort((function(t,e){var n,i,r=(null===(n=t.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r})),t},yc=function(t){function e(e,n,i,r){var o=t.call(this,e,n,i,r,new Ai(r.appkey,"RC-E","IM"),new sc(r.appkey,"RC-E","IM"))||this;o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o.currentUserId="",o._openCallPlus=!1,o.cloudControllerUri="",o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,o._latestPullKVMsgTimestamp=0,o._intervalTimerForChrmPull=-1,o._lastSyncUltraMsgTimeStamp=0,o._lastSyncUltraMsgLocalTimeStamp=0,o._ultraGroupTimer=-1,o._isUltraPulling=!1,o._ultraGroupTimeQue=[],o._isUltraGroupListExist=!1,o._ultraGroupMap={},o._ultraMsgMap={},o._pullUltraChangeMessageQue=[],o._isPullingUltraChangeMessage=!1,o._lastPullingUltraChangeMessageTime=0;var s=r.appkey,a=r.logOutputLevel,c=r.logExpireTime,u=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy;return o.logger.setOutputLevel(a),ai.init({areaCode:l,navigators:u,logServerUrl:h,miniCMPProxy:d}),_i(s,o.logger,e,c),o.reporter=new Ki(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new Oo(s,o.logger,o.statisticLog,e,new gc(s,o.logger,e)),Ya(s,o.logger,c),o.reporterStatistic=new pc(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new io(e,s),o._sendMessageStore=new No(e,s),o._chrmEntryHandler=new so(o),o._connMgr=new ka(s,o.navi,o.logger,o.statisticLog,o.runtime,{signal:o._signalHandler.bind(o),onConnected:o.onConnected.bind(o),onDisconnected:o.onDisconnected.bind(o),onConnecting:o._watcher.onConnecting,onSuspend:o.onSuspend.bind(o)}),"browser"===o.runtime.tag&&o._initCloudController(),o}return a(e,t),e.prototype._initCloudController=function(){var t=ai.getCloudControllerUrl();this.cloudControllerUri=t[0],this.cloudController=new Tc(this._appkey,this.runtime,this.logger,this.reporter,this.statisticLog),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,Ja.init)},e.prototype.onConnected=function(){var t=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),e=this._connMgr.getCurrentUserId();this.currentUserId=e,this._pullOfflineFinished=!1,this._joinedChrmManager||(this._joinedChrmManager=new ao(t.joinMChrm)),this._conversationManager||(this._conversationManager=new mo(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new Do(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new yo(this,this._appkey,this.currentUserId,this._watcher.tag)),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(),this._watcher.onConnected(),this.reporter.checkStart(t),this.reporterStatistic.checkStart(t)},e.prototype.onDisconnected=function(t){var e,n;this._resetMemoryState(),null===(e=this._userSettingManager)||void 0===e||e.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onDisconnected(t)},e.prototype.onSuspend=function(t){var e,n;null===(e=this._userSettingManager)||void 0===e||e.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onSuspend(t)},e.prototype.createLogger=function(t,e){return new Ai(this._appkey,t,e)},e.prototype.createStatisticLogger=function(t,e){return new sc(this._appkey,t,e)},e.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},e.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},e.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},e.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},e.prototype.connect=function(t,e,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return this._openCallPlus=n,[2,this._connMgr.connect(t,e,n,i)]}))}))},e.prototype._signalHandler=function(t,e){var n=t.syncMsg,i=t.topic;if(n)this._receiveSyncMsg(t,e);else{var r=this.logger.createTraceId();this.logger.debug(ft.L_RECV_RMTP_O,i,r);var o=no[i];if(o)switch(o){case no.s_ntf:this._pullMsg(t);break;case no.s_msg:this._receiveMsg(t);break;case no.s_cmd:this._receiveStateNotify(t);break;case no.s_us:this._receiveSettingNotify(t);break;case no.rtc_ntf:this._receiveRtcKv(t.data);break;case no.s_opNtf:this._pullOperateStatusNotify(t);break;case no.s_pubCall:this._pubCallInfo(t)}else this.logger.error(ft.L_RECV_RMTP_E,i,r)}},e.prototype._receiveStateNotify=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,Ko),n=e.time,i=e.type,r=e.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(r,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(r),this._watcher.chatroom({chatroomDestroyed:t.targetId});break;case 6:this._ultraGroupTimeQue.push(n),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(n),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},e.prototype._receiveSettingNotify=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,Ls).version;this._userSettingManager.pullUserSettings(e)},e.prototype._receiveMessageExpansion=function(t){var e=t.content,n=t.channelId,i=void 0===n?"":n,r=t.conversationType,o=t.targetId,s=e.put,a=e.del,c=e.mid;s&&this._watcher.expansion({updatedExpansion:{messageUId:c,expansion:s,channelId:i,conversationType:r,targetId:o}}),a&&this._watcher.expansion({deletedExpansion:{messageUId:c,deletedKeys:a,channelId:i,conversationType:r,targetId:o}})},e.prototype._clearUltraGroupUnreadCount=function(t,e){var n=this._connMgr.codec.decodeByPBName(t.data,os),i=n.targetId,r=n.channelId,o=n.timestamp,s=this._ultraGroupMap["".concat(r,"_").concat(i)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(In([s]))),e&&(this._ultraMsgMap[e.messageUId]=e.timestamp)},e.prototype._receiveSyncMsg=function(t,e){if(Mo.includes(t.topic))if(t.topic!==no[no.updRTime])if(t.topic!==no[no.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(t.data,Vo,{currentUserId:this.currentUserId,signal:t});((n=this._handleMsgProperties(n)).conversationType!==tt.CHATROOM||this._chrmsQueue[n.targetId])&&(this._pullingMsg?this._pullQueue.push((null==e?void 0:e.timestamp)||n.sentTime):(e&&(n.sentTime=e.timestamp,n.messageUId=e.messageUId,this._sendMessageStore.setMessage(e.messageUId,e.timestamp)),this.logger.info(ft.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==rt.EXPANSION_NOTIFY?((n.messageType===rt.SYNC_READ_STATUS||n.messageType===rt.READ_RECEIPT&&n.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(n.conversationType,n.targetId,n.channelId,n.sentTime),this._conversationManager.setConversationCacheByMessage(n,!0),this._batchMessage([n])):this._receiveMessageExpansion(n)))}else this._clearUltraGroupUnreadCount(t,e);else this._receivesyncReadStatus(t)},e.prototype._batchMessage=function(t){for(var e=this,n=[],i=[],r=[],o=t.length-1;o>=0;o-=1){var s=t[o];s.messageType===rt.LOG_COMMAND&&s.senderUserId===Y?i.unshift(s):s.messageType===rt.CLOUD_CONTROL&&s.senderUserId===Y?r.push(s):n.unshift(s)}this._watcher.batchMessage(n),i.forEach((function(t){var n=t.content,i=n.startTime,r=n.endTime,o=n.platform,s=n.logId,a=n.uri;e.reporter.report(parseInt(i,10),parseInt(r,10),o,a,s,t.messageUId)})),r.length>0&&this._ccMsgHandler(r)},e.prototype._ccMsgHandler=function(t){var e;return u(this,void 0,void 0,(function(){var n,i,r;return l(this,(function(o){switch(o.label){case 0:return t.shift()?(n=this._connMgr.getToken(),[4,null===(e=this.cloudController)||void 0===e?void 0:e.request(this.cloudControllerUri,Ja.other,n)]):[3,2];case 1:i=o.sent()||0,(r=t.filter((function(t){return t.sentTime>i}))).length>0&&this._ccMsgHandler(r),o.label=2;case 2:return[2]}}))}))},e.prototype._pubCallInfo=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,pa),n=e.key,i=e.dataContent,r=e.maxTime;this._latestPullKVMsgTimestamp=r,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:i}]}))},e.prototype._pullMsg=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,Ko),n=e.type,i=e.chrmId,r=e.time;if(this.logger.info(ft.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(r)),2===n){var o=this._chrmsQueue[i];if(!o)return;o.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()},e.prototype._receivesyncReadStatus=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,os),n=e.conversationType,i=e.targetId,r=e.channelId,o=e.timestamp,s=e.sentTime;this._conversationManager.clearUnreadCount(n,i,r,s),this._watcher.syncReadStatus({conversationType:n,targetId:i,channelId:r,timestamp:o})},e.prototype._startSyncInterval=function(){var t=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-t._latestSyncTimestamp>=18e4&&t._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},e.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},e.prototype._syncCallPullKVMsg=function(){return u(this,void 0,void 0,(function(){var t,e,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),e=new zr(Cr,t,this.currentUserId),[4,this._connMgr.send(e,fa)]):[2];case 1:return n=o.sent(),i=n.code,r=n.data,i===z.SUCCESS&&r?(this._latestPullKVMsgTimestamp=r.maxTime,this._watcher.callInfo(JSON.stringify({list:r.info})),[2]):[2]}}))}))},Object.defineProperty(e.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===Ua.CONNECTED},enumerable:!1,configurable:!0}),e.prototype._messageProcessor=function(t){var e=this,n=0,i=[],r=[],o=[],s=[],a=[];return t.forEach((function(t){var c=t.conversationType,u=t.targetId,l=t.channelId,h=t.messageDirection,d=t.messageUId,p=t.messageType,g=t.sentTime,f=t.senderUserId;if((t.content,i.push(d),h===X.SEND)&&(n=Math.max(g,n),e._sendMessageStore.getSendMessageMap()[d]))return void e._sendMessageStore.removeByUID(d);if(p!==rt.DELIVERED&&p!==rt.DELIVERED_MSG)if(p!==rt.EXPANSION_NOTIFY){if(g>=e._connMgr.getConnectedTime()&&e._writeMessagesLog(d,c)&&a.push(d),p===rt.READ_RECEIPT&&f===e.currentUserId&&e._conversationManager.clearUnreadCount(c,u,l,g),p!==rt.SYNC_READ_STATUS||e._processSRSMsg(t))if(p!==rt.READ_STATE){var _=e._handleMsgProperties(t);e._conversationManager.setConversationCacheByMessage(_,!0),r.push(_)}else s.push(t)}else o.push(t)})),{newOutboxTime:n,messageUIds:i,messages:r,messageExpansionList:o,RSMsgList:s,msgUIds2Statistic:a}},e.prototype._processSRSMsg=function(t){var e=t.conversationType,n=t.targetId,i=t.channelId,r=t.content,o=t.senderUserId,s=t.sentTime;if(o!==this.currentUserId)return!1;var a=this.getNaviInfoFromCache();return this._conversationManager.clearUnreadCount(e,n,i,s),1!==a.sesDriven||(s>this.getConnectedTime()||this._watcher.syncReadStatus({conversationType:e,targetId:n,channelId:i,timestamp:r.lastMessageSendTime}),!1)},e.prototype._processRSMsg=function(t){var e=t.conversationType,n=t.targetId,i=t.channelId,r=t.content,o={conversationType:e,targetId:n,channelId:i};this._watcher.messageReadReceipt(e===tt.PRIVATE?{privateReadReceipt:c(c({},o),{endMsgTime:r.endMsgTime})}:{groupReadReceipt:c(c({},o),{totalCount:r.tmn,readedCount:r.rrn,messageUId:r.msgId})})},e.prototype._syncMsg=function(){return u(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a,c,u,h,d,p,g,f,_,E,v,T,C,m,y,I,R=this;return l(this,(function(l){switch(l.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,t=this._letterbox.getOutboxTime(this.currentUserId),e=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),i=this._connMgr.codec.encodeSyncMsg({sendboxTime:t,inboxTime:e,broadcastSyncTime:n}),r=new zr(no[no.pullMsg],i,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(ft.L_PULL_MSG_T,JSON.stringify({outboxTime:t,inboxTime:e,broadcastSyncTime:n}),o),[4,this._connMgr.send(r,ko,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=l.sent(),a=s.code,c=s.data,this._latestSyncTimestamp=Date.now(),a!==z.SUCCESS||!c||de(c.finished)||de(c.list)||de(c.syncTime)?(this.logger.warn(ft.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(u=c.list,h=c.finished,d=c.syncTime,p=c.broadcastSyncTime,g=void 0===p?1:p,this.logger.info(ft.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:u.map((function(t){return{messageUId:t.messageUId,messageId:t.messageId,sentTime:t.sentTime}}))}),o),f=this._messageProcessor(u),_=f.newOutboxTime,E=f.messageUIds,v=f.messages,T=f.messageExpansionList,C=f.RSMsgList,(m=f.msgUIds2Statistic).length>0&&this.statisticLog.record(_t.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:m.join(",")})),this._batchMessage(v),T.forEach((function(t){R._receiveMessageExpansion(t)})),C.forEach((function(t){R._processRSMsg(t)})),this._letterbox.setInboxTime(d,this.currentUserId),this._letterbox.setOutboxTime(_,this.currentUserId),this._letterbox.setBroadcastSyncTime(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(_),this._pullingMsg=!1,y=this._pullQueue.filter((function(t){return t>d})),this._pullQueue.length=0,(I=this._pullQueue).push.apply(I,y),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(ft.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:y}),o),h?(this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg()),[2]):(this._syncMsg(),[2]))}}))}))},e.prototype._receiveMsg=function(t){if(this._isConnected){var e=this._connMgr.codec.decodeByPBName(t.data,Bo,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()}),n=(e=this._handleMsgProperties(e)).conversationType;e.targetId,e.channelId,e.content;var i=e.messageType,r=e.senderUserId,o=e.messageUId,s=e.sentTime,a=e.isStatusMessage;if(this.logger.info(ft.L_RECV_S_MSG_O,JSON.stringify({messageUId:e.messageUId,messgeId:e.messageId,sentTime:e.sentTime})),this._writeMessagesLog(o,n)&&this.statisticLog.record(_t.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:o})),i!==rt.DELIVERED&&i!==rt.DELIVERED_MSG){if(n!==tt.RTC_ROOM&&i!==rt.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}r===this.currentUserId&&this._sendMessageStore.setMessage(o,s),a||r===this.currentUserId||this._letterbox.setInboxTime(s,this.currentUserId),i!==rt.EXPANSION_NOTIFY?i===rt.SYNC_READ_STATUS&&r!==this.currentUserId||(i!==rt.READ_STATE?(this._conversationManager.setConversationCacheByMessage(e,!0),this._batchMessage([e])):this._processRSMsg(e)):this._receiveMessageExpansion(e)}}},e.prototype._handleMsgProperties=function(t,e){void 0===e&&(e=!1);var n,i=t.messageType,r=t.isStatusMessage,o=t.isCounted,s=void 0!==o&&o,a=t.isPersited,u=void 0!==a&&a,l=i in w,h=i in this._customMessageType;if(n=l?c(c({},w[i]),{isStatusMessage:D.includes(i)}):h?this._customMessageType[i]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(t,n),e&&!de(r)&&(t.isStatusMessage=r),!e){var d=t.content.user;if(d){var p=d.portrait,g=d.portraitUri,f=p||g;f&&(d.portrait=d.portraitUri=f)}}return t},e.prototype._fixDownstreamData=function(t,e,n){return t&&2===e.list.length&&(e.hasMore=!0,0===n?e.list.shift():e.list.pop()),e},e.prototype.getHistoryMessage=function(t,e,n,i,r,o,s,a){var c;return void 0===o&&(o=""),u(this,void 0,void 0,(function(){var s,u,h,d,p,g,f,_,E,v;return l(this,(function(l){switch(l.label){case 0:return u=(s=this).currentUserId,h=s._connMgr,d=Nr[t]||mr,p=1===i&&0===n,h?(g=h.codec.encodeGetHistoryMsg(e,{timestamp:n,count:p?2:i,order:r,channelId:o}),this.logger.info(ft.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:t,channelId:o,timestamp:n,count:i,order:r}),a),[4,h.send(new zr(d,g,u),jo,{currentUserId:u,connectedTime:h.getConnectedTime(),conversation:{targetId:e}})]):[3,2];case 1:return f=l.sent(),(_=f.code)===z.SUCCESS&&g?(E=f.data,E=this._fixDownstreamData(p,E,r),v=[],null===(c=E.list)||void 0===c||c.forEach((function(t){t&&v.push(t.messageUId)})),this.logger.info(ft.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:v.join(",")}),a),[2,{code:_,data:{list:E.list,hasMore:E.hasMore}}]):(this.logger.warn(ft.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:""}),a),[2,{code:_}]);case 2:return[2,{code:z.RC_NET_CHANNEL_INVALID}]}}))}))},e.prototype.getMessages=function(t,e,n,i,r,o,s){return this.getHistoryMessage(t,e,n,i,r,o,s)},e.prototype.reportSDKInfo=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=(e=this).currentUserId,i=e._connMgr,r=this.logger.createTraceId(),o=JSON.stringify(t),this.logger.debug(ft.L_VER_REPORT_T,o,r),s=i.codec.encodeReportSDKInfo(o),a=new zr(no[no.reportsdk],s,n),[4,i.send(a)]):[2];case 1:return(c=u.sent().code)!==z.SUCCESS&&this.logger.warn(ft.L_VER_REPORT_R,c,r),[2]}}))}))},e.prototype.deleteRemoteMessage=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeDeleteMessages(t,e,n,i),c=new zr(or,a,o),[4,s.send(c)]):[2,z.RC_NET_UNAVAILABLE];case 1:return u=l.sent(),[2,u.code]}}))}))},e.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeClearMessages(e,n,i,t),c=Mr[t],u=new zr(c,a,o),[4,s.send(u)]):[2,z.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},e.prototype.batchClearRemoteHistoryMessages=function(t,e){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(n=(e=this).currentUserId,i=e._connMgr,r=i.codec.encodeBatchClearRemoteMessages(t),o=new zr(vr,r,n),[4,i.send(o)]):[2,z.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},e.prototype.getConversationList=function(t,e,n,i,r){return void 0===t&&(t=300),u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,e=e||tt.PRIVATE,a=s.codec.encodeOldConversationList({count:t,type:e,startTime:n,order:i}),c=new zr(pr,a,o),[4,s.send(c,Qo,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(t){var e=t.conversationType,n=t.targetId,i=t.channelId,r=p._conversationManager.get(e,n,i);Object.assign(t,r);var o=p._conversationManager.getDraft(e,n,i);return t.draft=o,t}})]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,h!==z.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},e.prototype.removeConversation=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeRemoveOldConversationList({conversationType:t,channelId:n,targetId:e}),o=new zr(gr,r,e),[4,i.send(o)]):[2,z.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},e.prototype.batchRemoveConversation=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=this._connMgr,n=e.codec.encodeBatchDeleteConversation(t),i=new zr(fr,n,this.getCurrentUserId()),[4,e.send(i)]):[2,z.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},e.prototype.getConversation=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return t!==tt.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap["".concat(n,"_").concat(e)])?[3,3]:[2,{code:z.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(t,e,n))?[4,this.getHistoryMessage(t,e,0,1,0)]:[2,{code:z.CONVER_GET_ERROR}];case 2:if(o=l.sent(),s=o.code,a=o.data,s!==z.SUCCESS)return[2,{code:z.CONVER_GET_ERROR}];c=this._conversationManager.getDraft(t,e,n),u=(null==a?void 0:a.list[0])||null,i={conversationType:t,targetId:e,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:u,notificationStatus:r.notificationStatus||st.CLOSE,notificationLevel:r.notificationLevel||ct.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0,draft:c},l.label=3;case 3:return[2,{code:z.SUCCESS,data:i}]}}))}))},e.prototype.getAllConversationUnreadCount=function(t,e,n){var i=this._conversationManager.getAllUnreadCount(t,e,n);return Promise.resolve({code:z.SUCCESS,data:i})},e.prototype.getTotalUnreadCountByLevels=function(t,e,n){void 0===n&&(n=!1);var i=0;if(t.includes(tt.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:z.METHOD_NOT_AVAILABLE});for(var r in this._ultraGroupMap){var o=this._ultraGroupMap[r];(0===e.length||e.includes(o.notificationLevel))&&(i+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return i+=this._conversationManager.getTotalUnreadCountByLevels(t,e,n),Promise.resolve({code:z.SUCCESS,data:i})},e.prototype.getConversationUnreadCount=function(t,e,n){var i,r;return t===tt.ULTRA_GROUP?(r=(null===(i=this._ultraGroupMap["".concat(n,"_").concat(e)])||void 0===i?void 0:i.unreadMessageCount)||0,r=this._getUnreadCount(r)):r=this._conversationManager.getUnreadCount(t,e,n),Promise.resolve({code:z.SUCCESS,data:r})},e.prototype.clearConversationUnreadCount=function(t,e,n){return this._conversationManager.clearUnreadCount(t,e,n,this.getServerTime(),!1),Promise.resolve(z.SUCCESS)},e.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(z.SUCCESS)},e.prototype.getFirstUnreadMessage=function(t,e){throw new Error("Method not implemented.")},e.prototype.getFirstUnreadMessageInfo=function(t,e,n){var i=this._conversationManager.get(t,e,n),r=i.firstUnreadMessageUid,o=i.firstUnreadTime;return Promise.resolve({code:z.SUCCESS,data:o&&r?{messageUId:r,sentTime:o}:null})},e.prototype.saveConversationMessageDraft=function(t,e,n,i){return this._conversationManager.setDraft(t,e,n,i),Promise.resolve(z.SUCCESS)},e.prototype.getConversationMessageDraft=function(t,e,n){var i=this._conversationManager.getDraft(t,e,n);return Promise.resolve({code:z.SUCCESS,data:i})},e.prototype.clearConversationMessageDraft=function(t,e,n){return this._conversationManager.clearDraft(t,e,n),Promise.resolve(z.SUCCESS)},e.prototype.pullConversationStatus=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(e=this)._connMgr,i=e.currentUserId,r=n.codec.encodeGetConversationStatus(t),o=new zr(no[no.pullSeAtts],r,i),[4,n.send(o,As)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,this.logger.info(ft.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:t,userId:i})),a!==z.SUCCESS?[2,{code:a}]:(u=[],Array.isArray(c)&&c.forEach((function(t){var e=t.conversationType,n=t.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),e===tt.ULTRA_GROUP?h._setUltraConversationStatus(t):u.push(t)})),[2,{code:a,data:u}])}}))}))},e.prototype._setUltraConversationStatus=function(t){var e=t.targetId,n=t.notificationStatus,i=t.notificationLevel,r=t.channelId,o=t.isTop,s=this._ultraGroupMap["".concat(r,"_").concat(e)];return s&&void 0!==i&&(s.notificationLevel=i,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==n&&(s.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==o&&(s.isTop=o),s},e.prototype.batchSetConversationStatus=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r=this;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(n=(e=this).currentUserId,i=e._connMgr,[4,this._conversationManager.pushTask((function(e){return u(r,void 0,void 0,(function(){var r,o,s,a,u,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return r=i.codec.encodeSetConversationStatus(t,e),o=new zr(_r,r,n),[4,i.send(o,Ds)];case 1:return s=l.sent(),a=s.code,u=s.data,a!==z.SUCCESS?[2,{code:a}]:(h=u,this._conversationManager.setConversationUpdatedTime(h.version),d=[],t.forEach((function(t){if(t.conversationType!==tt.ULTRA_GROUP)g._conversationManager.addStatus(c(c({},t),{updatedTime:h.version}),!0);else{var e=g._setUltraConversationStatus(t);e&&d.push(e)}})),d.length>0&&(p=In(d),p=mc(p),this._watcher.conversation(p)),[2,{code:a}])}}))}))}))]):[2,z.RC_NET_UNAVAILABLE];case 1:return[2,o.sent().code]}}))}))},e.prototype.batchSetConversationToTop=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(t.map((function(t){return c(c({},t),{isTop:e})})))]}))}))},e.prototype.setConversationNotificationLevel=function(t,e,n,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this.batchSetConversationStatus([{conversationType:t,targetId:e,notificationLevel:n,channelId:i}])]}))}))},e.prototype.batchSetConversationNotificationLevel=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(t.map((function(t){return c(c({},t),{notificationLevel:e})})))]}))}))},e.prototype._joinChrm=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p,g,f,_,E,v,T,C;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeJoinOrQuitChatRoom(),a=new zr(s=n?ar:sr,o,t),this.logger.info(ft.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:t,count:e,topic:s}),i),[4,r.send(a,as)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,d=u===z.SUCCESS?"info":"warn",this.logger[d](ft.L_JOIN_CHATROOM_R,JSON.stringify({code:u,timestamp:(new Date).getTime()}),i),u===z.SUCCESS?(g=(p=h).joinTime,f=p.createTime,_=p.memberCount,E=p.isAllChatroomBanned,v=p.isCurrentUserBanned,T=p.isCurrentChatroomBanned,C=p.isCurrentChatroomInWhitelist,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,e,g),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,e),this._startSyncIntervalForChrmPull(),[2,{code:u,data:{createTime:f,memberCount:_,isAllChatroomBanned:E,isCurrentUserBanned:v,isCurrentChatroomBanned:T,isCurrentChatroomInWhitelist:C}}]):[2,{code:u}]}}))}))},e.prototype._rejoinChrm=function(){return u(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a,u,h;return l(this,(function(l){switch(l.label){case 0:for(n in t=this._joinedChrmManager.get(),e=[],t)e.push(n);i=0,l.label=1;case 1:return i<e.length?(r=e[i],this.logger.info(ft.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:t[r]||10,topic:ar})),o=this.logger.createTraceId(),[4,this._joinChrm(r,t[r]||10,!0,o)]):[3,4];case 2:if(s=l.sent(),a=s.code,u=s.data,h=a===z.SUCCESS?"info":"warn",this.logger[h](ft.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),o),a===z.SUCCESS)return this._watcher.chatroom({rejoinedRoom:c({chatroomId:r,count:t[r]},u)}),[2];a===z.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(r),delete this._chrmsQueue[r]),this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:a}}),l.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},e.prototype._pullChrmMsg=function(t,e,n){return void 0===e&&(e=10),void 0===n&&(n=0),u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d,p,g,f,_,E,v=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._chrmsQueue[t],r=i.pulling,o=i.timestamp,r?[2]:(i.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,e),a=new zr(no[no.chrmPull],s,t),this.logger.info(ft.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:t,timestamp:o})),[4,this._connMgr.send(a,ko,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return c=l.sent(),u=c.code,h=c.data,i.pulling=!1,u===z.SUCCESS&&h?(d=h.list,p=h.syncTime,g=h.finished,i.timestamp=n?Math.max(p,n):p,i.queue=i.queue.filter((function(t){return t>p})),f=[],_=[],E=[],d.forEach((function(t){t.sentTime<o||(t.sentTime>=v._connMgr.getConnectedTime()&&v._writeMessagesLog(t.messageUId,tt.CHATROOM)&&_.push(t.messageUId),f.push(t.messageUId),E.push(t))})),this._batchMessage(E),this.logger.info(ft.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:f.join(",")})),_.length>0&&this.statisticLog.record(_t.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:_.join(",")})),(!g||i.queue.length>0)&&this._pullChrmMsg(t),[2]):(this.logger.warn(ft.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:""})),[2])}}))}))},e.prototype.joinChatroom=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._joinChrm(t,e,!1,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.joinExistChatroom=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._joinChrm(t,e,!0,n)]}))}))},e.prototype.quitChatroom=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr,n=e.codec.encodeJoinOrQuitChatRoom(),i=new zr(cr,n,t),[4,e.send(i)]):[2,z.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),(o=r.code)===z.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),[2,o]}}))}))},e.prototype.getChatroomInfo=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(e,n),o=new zr(no[no.queryChrmI],r,t),[4,i.send(o,us)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==z.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},e.prototype.getChatroomHistoryMessages=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeGetHistoryMsg(t,{timestamp:e,count:n,order:i}),s=new zr(Ir,o,t),[4,r.send(s,jo,{conversation:{targetId:t}})]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,c!==z.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},e.prototype._modifyChatroomKV=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=this._chrmEntryHandler.getVersion(t,e.key),e.version=null==o?this.getServerTime():o,s=i.codec.encodeModifyChatRoomKV(t,e,r),a=e.type===vt.UPDATE?ur:lr,c=new zr(a,s,t),[4,i.send(c,as)]):[2,z.RC_NET_UNAVAILABLE];case 1:return u=l.sent(),(h=u.code)===z.SUCCESS?(this._chrmEntryHandler.setLocal(t,{kvEntries:[e],syncTime:this.getServerTime()},r),[2,h]):[2,h]}}))}))},e.prototype._chatroomKVStoreNotAllSuccess=function(t,e){var n=e.data,i=t;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(t){var e=i.findIndex((function(e){return t.key===e.key}));-1!==e&&i.splice(e,1)})),i},e.prototype._modifyChatroomKVS=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,e.entries.forEach((function(e){var n=_._chrmEntryHandler.getVersion(t,e.key);e.version=null==n?_.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(t,e,r),s=e.type===vt.UPDATE?hr:dr,a=new zr(s,o,t),[4,i.send(a,ms)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,-1!==[z.SUCCESS,z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(p=[],delete(g=c({},e)).entries,e.entries.forEach((function(t){p.push(c(c({},t),g))})),h===z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=u.data,d=f.errorKeys,p=this._chatroomKVStoreNotAllSuccess(p,u)),this._chrmEntryHandler.setLocal(t,{kvEntries:p,syncTime:(new Date).getTime()},r)),[2,{code:h,data:d}]}}))}))},e.prototype.setChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=vt.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.setChatroomEntries=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=vt.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceSetChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=vt.UPDATE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=vt.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntries=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=vt.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceRemoveChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=vt.DELETE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.getChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(t,e))?[2,{code:z.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),o=new zr(no[no.pullKV],r,t),[4,i.send(o,Cs)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(c=a.kvEntries.find((function(t){return t.key===e})),void 0!==c)?[2,{code:z.SUCCESS,data:null==c?void 0:c.value}]:[2,{code:z.CHATROOM_KEY_NOT_EXIST}]}}))}))},e.prototype.getAllChatroomEntry=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return(e=this._chrmEntryHandler.getAll(t))&&Object.keys(e).length?[2,{code:z.SUCCESS,data:e}]:this._isConnected?(n=this._connMgr,e={},i=n.codec.encodePullChatRoomKV(0),r=new zr(no[no.pullKV],i,t),[4,n.send(r,Cs)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return o=a.sent(),(s=o.data)&&s.kvEntries&&s.kvEntries.length&&s.kvEntries.forEach((function(t){t.key&&(e[t.key]=t.value||"")})),[2,{code:z.SUCCESS,data:e}]}}))}))},e.prototype.pullChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=i.codec.encodePullChatRoomKV(e),s=new zr(no[no.pullKV],o,t),this.logger.info(ft.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:t,timestamp:e})),[4,i.send(s,Cs)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,h=c===z.SUCCESS?"info":"warn",this.logger[h](ft.L_PULL_CHATROOM_KV_R,JSON.stringify({code:c,timestamp:e})),c===z.SUCCESS&&u?(d=u.kvEntries,p=[],d.length>0&&(d.forEach((function(e){var n=e.key,i=e.value,r=e.type,o=e.timestamp,s=e.userId;g._chrmEntryHandler.getValue(t,n)===i&&s===g.getCurrentUserId()||p.push({key:n,value:i,type:r,timestamp:o,chatroomId:t})})),this._chrmEntryHandler.setLocal(t,u,r),p.length>0&&this._watcher.chatroom({updatedEntries:p})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},e.prototype._startSyncIntervalForChrmPull=function(){var t=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var e=Object.keys(t._chrmsQueue);0!==e.length&&t._isConnected?e.forEach((function(e){t._pullChrmMsg(e),t.getNaviInfoFromCache().kvStorage&&t._chrmEntryHandler.pullEntry(e,0)})):t._stopSyncIntervalForChrmPull()}),M)},e.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},e.prototype._writeMessagesLog=function(t,e){var n,i=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!i)return!1;var r=un(t),o=0;switch(e){case tt.PRIVATE:o=i.private;break;case tt.GROUP:o=i.group;break;case tt.CHATROOM:o=i.chatroom;break;case tt.ULTRA_GROUP:o=i.ultraGroup}return!!o&&r%(1/o)==0},e.prototype.sendMessage=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,u,h,d,p,g,f,_,E,v;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=function(t,e){var n=t.messageType;if("RC:SRSMsg"===n&&Object.assign(t,{directionalUserIdList:[e]}),n===rt.READ_RECEIPT_RESPONSE&&t.content.receiptMessageDic)for(var i in t.directionalUserIdList=[],t.content.receiptMessageDic)t.directionalUserIdList.push(i);return t}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![tt.PRIVATE,tt.GROUP].includes(t)&&n.isStatusMessage,s=o?function(t){var e;return(e={},e[tt.PRIVATE]=no.ppMsgS,e[tt.GROUP]=no.pgMsgS,e)[t]}(t):function(t){var e;return(e={},e[tt.PRIVATE]=no.ppMsgP,e[tt.GROUP]=no.pgMsgP,e[tt.CHATROOM]=no.chatMsg,e[tt.CUSTOMER_SERVICE]=no.pcMsgP,e[tt.RTC_ROOM]=no.prMsgS,e[tt.SYSTEM]=no.pbMsgP,e)[t]}(t)||no.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:on(),n.messageId=a,u=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},n),(h=new Jr(no[s],u,t===tt.SYSTEM?this.currentUserId:e)).setHeaderQos(Ji.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(h),[2,{code:z.SUCCESS,data:Cc(t,e,c({},n),"",0,this.currentUserId,a)}]):(d=this._connMgr.getCrtServerTime(),p=Cc(t,e,c({},n),"",d,this.currentUserId,a),null==i||i(a),this.logger.info(ft.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:t,targetId:e,channelId:n.channelId}),r),g=Date.now(),[4,this._connMgr.send(h)])):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return f=l.sent(),_=f.code,E=f.data,_!==z.SUCCESS?(this.logger.warn(ft.L_SEND_MSG_R,JSON.stringify({code:_,messageUId:p.messageUId,messageId:p.messageId}),r),this.statisticLog.record(_t.IM_MSG_SEND,JSON.stringify({channel:t,start_ts:g,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:_})),p.sentStatus=Rt.FAILED,[2,{code:_,data:p}]):(this.logger.info(ft.L_SEND_MSG_R,JSON.stringify({code:_,messageUId:null==E?void 0:E.messageUId,messageId:null==E?void 0:E.messageId}),r),v=E,this._writeMessagesLog(v.messageUId,t)&&this.statisticLog.record(_t.IM_MSG_SEND,JSON.stringify({msg_id:v.messageUId,channel:t,start_ts:g,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:_})),this._sendMessageStore.setMessage(v.messageUId,v.timestamp),p.sentTime=v.timestamp,p.messageUId=v.messageUId,this._conversationManager.setConversationCacheByMessage(p,!0),[2,{code:z.SUCCESS,data:p}])}}))}))},e.prototype.recallMsg=function(t,e,n,i,r){var o;return u(this,void 0,void 0,(function(){var s,a,u,h,d,p,g,f,_,E,v,T,C;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=r.user,a=r.extra,u=r.isDelete,h={conversationType:t,targetId:e,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:u||!1},s&&(h.user=s),a&&(h.extra=a),d={content:h,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(o=r.pushConfig)||void 0===o?void 0:o.pushContent)||r.pushContent||"",channelId:r.channelId},p=no[no.recallMsg],g=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},d),(f=new Jr(p,g,this.currentUserId)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return _=l.sent(),E=_.code,v=_.data,t===tt.ULTRA_GROUP&&this.logger.debug(ft.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:E,conversationType:t,targetId:e,channelId:r.channelId})),E!==z.SUCCESS?[2,{code:E}]:(T=v,t===tt.ULTRA_GROUP?(this._ultraMsgMap[T.messageUId]=T.timestamp,this._updateUltraGroupWhenRecallMsg(e,r.channelId||"",n),[2,{code:z.SUCCESS}]):(this._sendMessageStore.setMessage(T.messageUId,T.timestamp),C=Cc(t,e,c(c({},d),{isPersited:!0}),T.messageUId,T.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(C,!0),[2,{code:z.SUCCESS,data:C}]))}}))}))},e.prototype.sendReadReceiptMessage=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(e,n),r=new zr(no[no.rrMsg],i,t),[2,this._connMgr.send(r)]):[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.getMessageReader=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(e,n),r=new zr(no[no.rrList],i,t),[2,this._connMgr.send(r,qs)]):[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.sendReadReceiptMessageV4=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return i=this._connMgr.codec.encodeReadReceiptMsg(t,e,n),r=new Jr(no[no.sendMsgRead],i,t.targetId),[2,this._connMgr.send(r)]}))}))},e.prototype.getMessageReadReceiptV4=function(t,e){return u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeReceiptQryReq(t,e),i=new zr(no[no.qryMsgRead],n,t.targetId),[2,this._connMgr.send(i,va)]}))}))},e.prototype.batchGetMessageReadReceiptInfoV4=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeReceiptCntQryReq(t,e),i=new zr(no[no.qryMsgReadCntBatch],n,t.targetId),[4,this._connMgr.send(i,ma)];case 1:return r=u.sent(),o=r.code,s=r.data,a=(s||{result:[]}).result,o===z.SUCCESS&&a?[2,{code:o,data:a.map((function(e){return c({messageUId:e.msgId,readedCount:e.cnt,totalCount:e.tmn},t)}))}]:[2,{code:o}]}}))}))},e.prototype.updateConversationReadTime=function(t,e){return u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeSessionMsgReadInput(t,e),i=new Jr(no[no.updRTime],n,this.currentUserId),[2,this._connMgr.send(i)]}))}))},e.prototype.pullUserSettings=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullUserSetting(t),n=new zr(no[no.pullUS],e,this.currentUserId),[4,this._connMgr.send(n,Ms)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===z.SUCCESS&&this._naviChangeHandler(o),[2,{code:r,data:o}]}}))}))},e.prototype._naviChangeHandler=function(t){var e;if(t){var n=t.settings,i=null===(e=null==n?void 0:n.VoipInfo)||void 0===e?void 0:e.value;if(i){var r=this._connMgr.getToken();this.navi.updateVoipCallInfo(r,i);var o=this.navi.getNaviInfoFromCache(r);this._watcher.onNaviDataChange(c({},o))}}else this.logger.warn(ft.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:t}))},e.prototype.getFileToken=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=i&&"uploads"!==i?e||"":ze(t,e),s=this._connMgr.codec.encodeGetFileToken(t,o,n||"",i||"",r||""),a=new zr(no[no.qnTkn],s,this.currentUserId),[4,this._connMgr.send(a,hs)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,h!==z.SUCCESS?[2,{code:h}]:(p=c(c({},d),{fileName:o,downloadAuthInfo:d.downloadAuthInfo?JSON.parse(d.downloadAuthInfo):null}),[2,{code:h,data:p}])}}))}))},e.prototype.getFileUrl=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r="",o="",s="",e===dt.QINIU?(o=ds,s=gs):(o=ps,s=fs),r=e===dt.QINIU?no[no.qnUrl]:e===dt.AWS?no[no.s3Url]:e===dt.STC?no[no.stcUrl]:e===dt.MINIO?no[no.minioUrl]:no[no.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,t,n,i),c=new zr(r,a,this.currentUserId),[4,this._connMgr.send(c,s)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,p=d,h===z.SUCCESS?[2,{code:h,data:p}]:[2,{code:h}]}}))}))},e.prototype.disconnect=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return t.sent(),this._resetMemoryState(),[2]}}))}))},e.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._chrmsQueue={}},e.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},e.prototype.registerMessageType=function(t,e,n,i,r){this._customMessageType[t]={isPersited:e,isCounted:n,isStatusMessage:r}},e.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},e.prototype.getCurrentUserId=function(){return this.currentUserId},e.prototype.createTag=function(t){return u(this,void 0,void 0,(function(){var e=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return u(e,void 0,void 0,(function(){var e,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=this._connMgr.codec.encodeCreateTag([t],n),i=new zr(no[no.addSeTag],e,this.currentUserId),[4,this._connMgr.send(i,Os)];case 1:return r=u.sent(),o=r.code,s=r.data,o===z.SUCCESS&&s&&(a=s.version,this._userSettingManager.addTag([c(c({},t),{createdTime:a})],a)),[2,{code:o}]}}))}))}))]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.removeTag=function(t){return u(this,void 0,void 0,(function(){var e=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return u(e,void 0,void 0,(function(){var e,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=this._connMgr.codec.encodeRemoveTag([t],n),i=new zr(no[no.delSeTag],e,this.currentUserId),[4,this._connMgr.send(i,Os)];case 1:return r=c.sent(),o=r.code,s=r.data,o===z.SUCCESS&&s&&(a=s.version,this._userSettingManager.deleteTag([t],a)),[2,{code:o}]}}))}))}))]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.updateTag=function(t){return u(this,void 0,void 0,(function(){var e=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return u(e,void 0,void 0,(function(){var e,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=this._connMgr.codec.encodeCreateTag([t],n),i=new zr(no[no.addSeTag],e,this.currentUserId),[4,this._connMgr.send(i,Os)];case 1:return r=c.sent(),o=r.code,s=r.data,o===z.SUCCESS&&(a=s.version,this._userSettingManager.addTag([t],a)),[2,{code:o}]}}))}))}))]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.getTagList=function(){return u(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){return t=this._userSettingManager.getTags(),e=this._conversationManager.getConversationListForTag(),t.forEach((function(t){t.conversationCount=e[t.tagId]?e[t.tagId].length:0})),[2,{code:z.SUCCESS,data:t}]}))}))},e.prototype.addTagForConversations=function(t,e){return u(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return u(n,void 0,void 0,(function(){var n,r,o,s,a,c,u=this;return l(this,(function(l){switch(l.label){case 0:return this._userSettingManager.getTagById(t)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:t}],e,i),r=new zr(no[no.addTag],n,this.currentUserId),[4,this._connMgr.send(r,Ds)]):[2,{code:z.TAG_NOT_EXIST}];case 1:return o=l.sent(),s=o.code,a=o.data,s===z.SUCCESS&&a&&((c={})[t]={},e.forEach((function(t){u._conversationManager.addTagStatus(t.conversationType,t.targetId,c,t.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:s}]}}))}))}))]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.removeTagForConversations=function(t,e){return u(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return u(n,void 0,void 0,(function(){var n,r,o,s,a,c=this;return l(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:t}],e,i),r=new zr(no[no.delTag],n,this.currentUserId),[4,this._connMgr.send(r,Ds)];case 1:return o=u.sent(),s=o.code,a=o.data,s===z.SUCCESS&&a&&(e.forEach((function(e){c._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:s}]}}))}))}))]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.removeTagsForConversation=function(t,e){return u(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return u(n,void 0,void 0,(function(){var n,r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return n=t.conversationType,r=t.targetId,o=t.channelId,s=e.map((function(t){return{tagId:t}})),a=this._connMgr.codec.encodeUpdateConversationTag(s,[t],i),c=new zr(no[no.delTag],a,this.currentUserId),[4,this._connMgr.send(c,Ds)];case 1:return u=l.sent(),h=u.code,d=u.data,h===z.SUCCESS&&d&&(this._conversationManager.deleteTagStatus(n,r,e,o),this._conversationManager.setConversationUpdatedTime(d.version)),[2,{code:h}]}}))}))}))]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.getConversationListByTag=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(i=this).currentUserId,o=i._connMgr,s=o.codec.encodeOldConversationList({count:n,type:tt.PRIVATE,startTime:e}),a=new zr(pr,s,r),[4,o.send(a,Qo,{currentUserId:r,connectedTime:o.getConnectedTime()})]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,u!==z.SUCCESS?[2,{code:u}]:(d=this._conversationHasTagFilter(t,null==h?void 0:h.list),[2,{code:u,data:d}])}}))}))},e.prototype._conversationHasTagFilter=function(t,e){var n=this,i=[],r=[];function o(t,e){return t.latestMessage&&e.latestMessage?t.latestMessage.sentTime-e.latestMessage.sentTime:0}return e.forEach((function(e){var o=e.conversationType,s=e.targetId,a=e.channelId,u=n._conversationManager.get(o,s,a),l=u.hasMentioned,h=u.mentionedInfo,d=u.lastUnreadTime,p=u.notificationStatus,g=u.isTop,f=u.tags,_=u.unreadMessageCount,E=f&&f[t];if(E){var v=c(c({},e),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:p,isTop:g,unreadMessageCount:_});E.isTop?i.push(c(c({},v),{isTopInTag:!0})):r.push(c(c({},v),{isTopInTag:!1}))}})),i.sort(o),r.sort(o),h(h([],i,!0),r,!0)},e.prototype.getUnreadCountByTag=function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(t,e),[2,{code:z.SUCCESS,data:n}]):[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.setConversationStatusInTag=function(t,e,n){return u(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return u(i,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return i=e.targetId,o=e.conversationType,s=e.channelId,a=n.isTop,c=[{tagId:t,isTop:a}],(u=this._conversationManager.get(o,i,s)).tags&&Object.hasOwnProperty.call(u.tags,t)?(h=this._connMgr.codec.encodeUpdateConversationTag(c,[e],r),d=new zr(no[no.addTag],h,this.currentUserId),[4,this._connMgr.send(d,Ds)]):[2,{code:z.NO_TAG_IN_CONVER}];case 1:return p=l.sent(),g=p.code,f=p.data,g===z.SUCCESS&&f&&((_={})[t]={},a&&(_[t].isTop=!0),this._conversationManager.addTagStatus(o,i,_,s),this._conversationManager.setConversationUpdatedTime(f.version)),[2,{code:g}]}}))}))}))]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.getTagsForConversation=function(t){var e;return u(this,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){if(!this._isConnected)return[2,{code:z.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(o in n.tags)r.push({tagId:o,tagName:null===(e=i[o])||void 0===e?void 0:e.tagName});return[2,{code:z.SUCCESS,data:r}]}))}))},e.prototype.getBlockConversationList=function(){var t=this._conversationManager.getBlockConversationList();return Promise.resolve({code:z.SUCCESS,data:t})},e.prototype.getTopConversationList=function(t,e){var n=this._conversationManager.getTopConversationList(t,e);return Promise.resolve({code:z.SUCCESS,data:n})},e.prototype.getUnreadConversationList=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){return e=this._conversationManager.getUnreadConversationList(t),[2,Promise.resolve({code:z.SUCCESS,data:e})]}))}))},e.prototype.getUnreadMentionedCount=function(t){var e,n;return n=t.conversationType===tt.ULTRA_GROUP?(null===(e=this._ultraGroupMap["".concat(t.channelId,"_").concat(t.targetId)])||void 0===e?void 0:e.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(t.conversationType,t.targetId,t.channelId),n=this._getUnreadCount(n),Promise.resolve({code:z.SUCCESS,data:n})},e.prototype.getAllUnreadMentionedCount=function(){var t=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:z.SUCCESS,data:t})},e.prototype.getConversationNotificationLevel=function(t,e,n){if(!this._isUltraGroupListExist&&t===tt.ULTRA_GROUP)return Promise.resolve({code:z.METHOD_NOT_AVAILABLE});var i;if(!(i=t===tt.ULTRA_GROUP?this._ultraGroupManager.get(tt.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n)))return Promise.resolve({code:z.SUCCESS,data:ct.NOT_SET});var r=i.notificationLevel;return de(i.notificationLevel)&&!de(i.notificationStatus)&&(r=st.OPEN===i.notificationStatus?1:0),Promise.resolve({code:z.SUCCESS,data:r})},e.prototype.getConversationNotificationStatus=function(t,e,n){var i;return(i=t===tt.ULTRA_GROUP?this._ultraGroupManager.get(tt.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n))?Promise.resolve({code:z.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:z.SUCCESS,data:st.CLOSE})},e.prototype.getRemoteHistoryMessages=function(t,e,n,i,r,o){return this.getHistoryMessage(t,e,n,i,r,o)},e.prototype.getUltraGroupList=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o=this;return l(this,(function(s){return e=t.targetId,n=t.channelType,this._isUltraGroupListExist?(i=(i=Object.values(this._ultraGroupMap).filter((function(t){return!(t.targetId!==e&&e||t.channelType!==n&&oe(n))}))).map((function(t){var e=t.unreadMessageCount,n=t.unreadMentionedCount,i=t.unreadMentionedMeCount;return e=o._getUnreadCount(e),n=o._getUnreadCount(n),i=o._getUnreadCount(i),c(c({},t),{unreadMessageCount:e,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=mc(i),r=In(i),[2,{code:z.SUCCESS,data:r}]):[2,{code:z.METHOD_NOT_AVAILABLE}]}))}))},e.prototype._getUnreadCount=function(t){return t>999?999:t},e.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:z.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){(t.notificationStatus===st.OPEN||t.notificationLevel>0)&&e.push({conversationType:tt.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:z.SUCCESS,data:e})},e.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:z.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){!0===t.isTop&&e.push({conversationType:tt.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:z.SUCCESS,data:e})},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t,e){if(!this._isUltraGroupListExist)return Promise.resolve({code:z.METHOD_NOT_AVAILABLE});var n=0;for(var i in this._ultraGroupMap){i.match(/_.*/g)[0].substring(1)!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[i].notificationLevel)||(n+=this._ultraGroupMap[i].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:z.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadCountByTargetId=function(t,e){var n=0;for(var i in this._ultraGroupMap){var r=this._ultraGroupMap[i];r.targetId!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[i].notificationLevel)||(n+=r.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:z.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadInfoList=function(t){var e=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:z.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(i){var r=e._ultraGroupMap[i];t.includes(r.targetId)&&n.push({type:r.conversationType,targetId:r.targetId,channelId:r.channelId,unreadMessageCount:e._getUnreadCount(r.unreadMessageCount),mentionedCount:e._getUnreadCount(r.unreadMentionedCount),mentionedMeCount:e._getUnreadCount(r.unreadMentionedMeCount),notificationLevel:r.notificationLevel})})),Promise.resolve({code:z.SUCCESS,data:n})},e.prototype.getAllUltraGroupUnreadCount=function(t){if(void 0===t&&(t=!1),!this._isUltraGroupListExist)return Promise.resolve({code:z.METHOD_NOT_AVAILABLE});var e=0;for(var n in this._ultraGroupMap)e+=t?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return e=this._getUnreadCount(e),Promise.resolve({code:z.SUCCESS,data:e})},e.prototype.clearUltraUnreadcount=function(t,e){return void 0===e&&(e=""),u(this,void 0,void 0,(function(){var n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:tt.ULTRA_GROUP,targetId:t,channelId:e},{timestamp:n}),(r=new Jr(no[no.updUgRTime],i,this.currentUserId)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,z.RC_NET_UNAVAILABLE]:[2,Promise.resolve(z.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===z.SUCCESS&&((s=this._ultraGroupMap["".concat(e,"_").concat(t)])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=n),s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,o]}}))}))},e.prototype._getUltraGroupList=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u,h,d,p,g,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(!1,e=this._connMgr.codec.encodeUltraGroup(t,false),n=new zr(no[no.pullUgSes],e,this.currentUserId),[4,this._connMgr.send(n,Qo,{currentUserId:this.currentUserId,conversationType:tt.ULTRA_GROUP})]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,r===z.SUCCESS&&o?(a=o.list,c=o.isFinished,a.forEach((function(t){t.notificationStatus=st.CLOSE,t.notificationLevel=ct.NOT_SET,t.isTop=!1,f._ultraGroupMap["".concat(t.channelId,"_").concat(t.targetId)]=t,f._ultraGroupManager.addUltraGroupStatus(t)})),!1!==c?[3,2]:(u=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(u),[3,4])):(this.logger.warn(ft.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(r,", try again")),s=setTimeout((function(){f._getUltraGroupList(t),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(ft.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,p=h.data,d!==z.SUCCESS&&this.logger.warn(ft.O,"pullConversationStatus fail code: ".concat(d,", data: ").concat(p)),g=Object.values(this._ultraGroupMap),g=mc(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(In(g)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),l.label=4;case 4:return[2]}}))}))},e.prototype._startUltraSyncInterval=function(){var t=this,e=function(){t._ultraGroupTimer=setTimeout((function(){Date.now()-t._lastSyncUltraMsgLocalTimeStamp>=18e4&&t._syncUltraMsg(t._lastSyncUltraMsgTimeStamp),t._stopUltraSyncInterval(),e()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),e()},e.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},e.prototype._notificationOnline=function(){return u(this,void 0,void 0,(function(){var t,e,n,i=this;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return t=r.sent(),e=t.code,n=t.data,e===z.SUCCESS&&n?(this.logger.info(ft.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(ft.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},e.prototype._fetchUltraMsg=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return e=this._connMgr.codec.encodeSuperSyncMsg(t),n=new zr(no[no.pullUgMsg],e,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(ft.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:t}),i),[4,this._connMgr.send(n,ko,{currentUserId:this.currentUserId,conversation:{conversationType:tt.ULTRA_GROUP}})];case 1:return r=l.sent(),o=r.code,s=r.data,o===z.SUCCESS&&s?(a=s.list,c=s.syncTime,u=a.map((function(t){return t.messageUId})).join(","),this.logger.info(ft.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:u,timestamp:t,syncTime:c}),i)):this.logger.warn(ft.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:t}),i),[2,{code:o,data:s}]}}))}))},e.prototype._getUltraGroup=function(t,e,n){var i,r,o,s=t.targetId,a=t.messageType,c=t.channelId,u=t.isCounted,l=t.channelType,h=t.sentTime,d=t.senderUserId,p=t.content,g=t.isMentioned,f=this._ultraGroupMap["".concat(c,"_").concat(s)],_=f||{conversationType:tt.ULTRA_GROUP,targetId:s,channelId:c,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:st.CLOSE,notificationLevel:ct.NOT_SET,isTop:!1};return u&&d!==this.currentUserId&&a!==rt.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=e,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),g&&(null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.type)!==lt.ALL&&(null===(o=null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(_.unreadMentionedMeCount+=1)),_.versionTime=n,_.latestMessage=t,_.channelType=l,f||(this._ultraGroupMap["".concat(c,"_").concat(s)]=_),_},e.prototype._syncUltraMsg=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u,h=this;return l(this,(function(l){switch(l.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(t)]);case 1:return e=l.sent(),n=e.code,i=e.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===z.SUCCESS&&i?(r=i.list,o=i.syncTime,s=i.finished,a={},c=[],r.forEach((function(t){var e,n,i,r=t.targetId,s=t.content,u=t.messageUId,l=t.channelId,d=t.isMentioned;if(h._ultraMsgMap[u])delete h._ultraMsgMap[u];else{var p=0;d&&((null===(e=null==s?void 0:s.mentionedInfo)||void 0===e?void 0:e.type)===lt.ALL||(null===(i=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===i?void 0:i.includes(h.currentUserId)))&&(p=1);var g=h._getUltraGroup(t,p,o);a["".concat(l,"_").concat(r)]=g,h._ultraGroupManager.addUltraGroupStatus(g),c.push(t)}})),Object.keys(a).length>0&&(this.logger.debug(ft.O,"notice ultragroups"),u=Object.values(a),u=mc(u),this._watcher.conversation(In(u))),this.logger.debug(ft.O,"notice ultragroup message"),this._batchMessage(c),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(t){return t>o})),this._lastSyncUltraMsgTimeStamp=o,s?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(o)),[2]):(this._syncUltraMsg(o),[2])):[2]}}))}))},e.prototype.sendUltraMessage=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,u,h,d,p,g,f,_,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===e.messageType&&this.logger.warn(ft.O,"ultra group -> direction message convert to message"),e=this._handleMsgProperties(e,!0),r=e.messageId?e.messageId:on(),e.messageId=r,o=this._connMgr.codec.encodeUpMsg({conversationType:tt.ULTRA_GROUP,targetId:t},e),(s=new Jr(no[no.ugMsg],o,t)).setHeaderQos(Ji.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=Cc(tt.ULTRA_GROUP,t,c({},e),"",a,this.currentUserId,r),n&&n(r),this.logger.info(ft.L_SEND_MSG_T,JSON.stringify({messageType:e.messageType,conversationType:tt.ULTRA_GROUP,targetId:t,channelId:e.channelId}),i),h=Date.now(),[4,this._connMgr.send(s)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return d=l.sent(),p=d.code,g=d.data,p!==z.SUCCESS?(this.logger.warn(ft.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:u.messageUId,messageId:u.messageId}),i),this.statisticLog.record(_t.IM_MSG_SEND,JSON.stringify({channel:tt.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),u.sentStatus=Rt.FAILED,[2,{code:p,data:u}]):(this.logger.info(ft.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),f=g,this._writeMessagesLog(f.messageUId,tt.ULTRA_GROUP)&&this.statisticLog.record(_t.IM_MSG_SEND,JSON.stringify({msg_id:f.messageUId,channel:tt.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),u.sentTime=f.timestamp,u.messageUId=f.messageUId,this._ultraMsgMap[f.messageUId]=f.timestamp,_=e.channelId||"",(E=this._ultraGroupMap["".concat(_,"_").concat(t)])?(E.latestMessage=u,oe(E.channelType)&&(u.channelType=E.channelType)):(E={conversationType:tt.ULTRA_GROUP,targetId:t,channelId:_,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:st.CLOSE,notificationLevel:ct.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(_,"_").concat(t)]=E,this._ultraGroupManager.addUltraGroupStatus(E)),this._watcher.conversation(In([E])),[2,{code:p,data:u}])}}))}))},e.prototype.sendUltraGroupTypingStatus=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=t.conversationType,i=t.channelId,r=t.targetId,o=this._connMgr.codec.encodeOperateStatus(r,n,i||"",e||0),(s=new Jr(no[no.operate],o,r)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return(a=c.sent().code)!==z.SUCCESS?[2,{code:a,msg:z[a]}]:[2,{code:a}]}}))}))},e.prototype.getUltraGroupMessageListByMessageUId=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?t.messages&&t.messages.length<1||t.messages&&t.messages.length>20?[2,{code:z.MSG_LIMIT_ERROR}]:(e={},t.messages.forEach((function(t){e[t.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(t),(i=new zr(no[no.qryMsg],n,this.currentUserId)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(i,oa,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==z.SUCCESS?[2,{code:o,msg:z[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(t){var n=t.messageUId;e[n]=t})),[2,{code:0,data:e}])}}))}))},e.prototype._pullOperateStatusNotify=function(t){if(this._isConnected){var e=this._connMgr.codec.decodeByPBName(t.data,aa),n=e.conversationType,i=e.info,r=e.summary;this.logger.debug(ft.O,"s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(e)}},e.prototype.expandUltraMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodeExpandUltraMessage(t,this.currentUserId),(n=new zr(no[no.upMsgEx],e,t.targetId)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==z.SUCCESS?[2,{code:i,msg:z[i]}]:[2,{code:i}]}}))}))},e.prototype.modifyMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodemodifyMessage(t,this.currentUserId),(n=new zr(no[no.modifyMsg],e,t.targetId)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==z.SUCCESS?[2,{code:r,msg:z[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},e.prototype._pullUltraChangeMessageList=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,e=this._connMgr.codec.encodeQueryMsgChange(t),(n=new zr(no[no.qryMsgChange],e,this.currentUserId)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(n,na)]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r===z.SUCCESS&&o?(s=o.hasNext,a=o.list,c=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),u=this._pullUltraChangeMessageQue.filter((function(t){return t>c})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,u),s?this._pullUltraChangeMessageList(c):this._lastPullingUltraChangeMessageTime=c,[2]):[2]}}))}))},e.prototype._handleUltraChangeList=function(t){var e={};t.forEach((function(t){var n=t.changeType;e[n]||(e[n]=[]),e[n].push(t)}));var n=kt.CHANNEL_CHANGE,i=kt.MSG_RECALL,r=kt.MSG_EXPANSION,o=kt.MSG_MODIFY,s=kt.USER_GROUP_CHANGE;e[n]&&this._handleUltraChannelChange(e[n]),e[i]&&this._handleMsgRecall(e[i]),e[r]&&this._handleMsgUpdate(e[r]),e[o]&&this._handleMsgUpdate(e[o]),e[s]&&this._handleUserGroupStatus(e[s])},e.prototype._handleUltraChannelChange=function(t){var e=this,n=[],i=[],r=[];t.forEach((function(t){var o=t.subChangeType,s=t.targetId,a=t.channelId,c=t.sendTime,u=t.operatorId,l="".concat(a,"_").concat(s),h=e._ultraGroupMap[l];if(h){var d=xt.PUBLIC_TO_PRIVATE,p=xt.PRIVATE_TO_PUBLIC,g=xt.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=xt.CHANNEL_DELETE,_=xt.CHANNEL_USER_KICKED;switch(o){case p:h.channelType=Gt.PUBLIC,n.push({targetId:s,channelId:a,changeType:Bt.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Gt.PRIVATE,n.push({targetId:s,channelId:a,changeType:Bt.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:s,channelId:a,changeType:Bt.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete e._ultraGroupMap[l];break;case f:i.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:c}),delete e._ultraGroupMap[l];break;case _:r.push({targetId:s,channelId:a,userId:u,channelType:Gt.PRIVATE}),u===e.currentUserId&&delete e._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),i.length>0&&this._watcher.ultraGroupChannelDelete(i),r.length>0&&this._watcher.ultraGroupChannelUserKicked(r)},e.prototype._handleMsgRecall=function(t){var e=this,i=[];t.forEach((function(t){var r=t.targetId,o=t.channelId,s=t.messageUId,a=t.sendTime,c=t.conversationType,u=t.operatorId,l=t.mentionedType;e._updateUltraGroupWhenRecallMsg(r,o,s,a,l),i.push({targetId:r,conversationType:c,sentTime:a,messageUId:s,senderUserId:u,channelId:o,content:{conversationType:c,targetId:r,messageUId:s,channelId:o},messageDirection:1,messageType:rt.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:Rn(n.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(i)},e.prototype._handleMsgUpdate=function(t){var e={};for(var n in t.forEach((function(t){var n=t.targetId,i=t.conversationType,r=t.sendTime,o=t.messageUId,s=t.channelId,a="".concat(i,"_").concat(n);e[a]||(e[a]=[]),e[a].push({messageUId:o,channelId:s,sendTime:r})})),e){var i=n.split("_"),r=i.shift(),o=i.join("_");this._pullUltraMessageList(t[0].changeType,{targetId:o,conversationType:Number(r),messages:h([],e[n],!0)})}},e.prototype._pullUltraMessageList=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(e),(i=new zr(no[no.qryMsg],n,this.currentUserId)).setHeaderQos(Ji.AT_LEAST_ONCE),[4,this._connMgr.send(i,oa,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),o=r.code,s=r.data,o!==z.SUCCESS?[2,{code:o,msg:z[o]}]:(a=(s||{}).list,c=[],Array.isArray(a)&&a.forEach((function(t){var e=t.targetId,n=t.channelId,i=t.messageUId,r=u._ultraGroupMap["".concat(n,"_").concat(e)];r&&r.latestMessage.messageUId===i&&(r.latestMessage=t),c.push(t)})),t===kt.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(c),t===kt.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(c),[2])}}))}))},e.prototype._handleUserGroupStatus=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u,h,d;return l(this,(function(l){return e=Ft.REMOVE_USER_GROUP,n=Ft.JOIN_USER_GROUP,i=Ft.EXIT_USER_GROUP,r=Ft.CHANNEL_BIND_USER_GROUP,o=Ft.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],c=[],u=[],h=[],t.forEach((function(t){var l=t.conversationType,d=t.targetId,p=t.userGroupIds,g=t.busChannelType,f=t.channelId;switch(t.subChangeType){case e:s.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case i:c.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case r:u.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p});break;case o:h.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p})}})),d={},s.length>0&&(d.userGroupDisband=s),a.length>0&&(d.userAdded=a),c.length>0&&(d.userRemoved=c),u.length>0&&(d.userGroupBindChannel=u),h.length>0&&(d.userGroupUnBindChannel=h),this._watcher.userGroupStatus(d),[2]}))}))},e.prototype.getUltraHistoryMsg=function(t,e,n){var i;return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(t,e),o=new zr(no[no.qryUgMsg],r,this.currentUserId),this.logger.info(ft.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:tt.ULTRA_GROUP,channelId:e.channelId,timestamp:null==e?void 0:e.timestamp,count:null==e?void 0:e.count}),n),[4,this._connMgr.send(o,jo,{currentUserId:this.currentUserId,conversation:{conversationType:tt.ULTRA_GROUP,targetId:t}})]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,a===z.SUCCESS&&c?(u=[],null===(i=c.list)||void 0===i||i.forEach((function(t){t&&u.push(t.messageUId)})),this.logger.info(ft.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:u.join(",")}),n),[2,{code:a,data:c}]):(this.logger.warn(ft.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},e.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(e,n),r=new zr(no[no.ugUnpushSet],i,t),[4,this._connMgr.send(r)]):[2,{code:z.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:z.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,z.SUCCESS,[2,{code:s}]}}))}))},e.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(e),r=new zr(no[no.ugUnpushQuery],i,t),[4,n.send(r,xs)]):[2,{code:z.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:z.METHOD_NOT_AVAILABLE})];case 1:return o=u.sent(),s=o.code,a=o.data,s===z.SUCCESS&&a?(c=a.unpushLevel,[2,{code:s,data:c}]):[2,{code:s}]}}))}))},e.prototype._updateUltraGroupWhenRecallMsg=function(t,e,n,i,r){var o="".concat(e,"_").concat(t);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,c=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),i&&c<i&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(r===Ht.ALL||r===Ht.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,r===Ht.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(In([s])))}},e.prototype.getAllConversationState=function(){return Promise.resolve({code:z.SUCCESS,data:this._conversationManager.getAllConversationState()})},e.prototype.getUltraGroupUnreadMentionedMessages=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(e=this._connMgr.codec.encodeUnreadMentionedMsgQuery(t),n=new zr(no[no.qryUgUal],e,this.currentUserId),[4,this._connMgr.send(n,ks)]):[2,Promise.resolve({code:z.METHOD_NOT_AVAILABLE})]:[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===z.SUCCESS&&o?[2,{code:r,data:o}]:[2,{code:r}]}}))}))},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(e=t.targetId,n=t.channelId,i=this._ultraGroupMap["".concat(n,"_").concat(e)]||{},r=i.firstUnreadMessage||null,[2,{code:z.SUCCESS,data:r}]):[2,Promise.resolve({code:z.METHOD_NOT_AVAILABLE})]:[2,{code:z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.bindRTCRoomForChatroom=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=t.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(t),i=new zr(no[no.setRtcRoomId],n,e),[4,this._connMgr.send(i)]):[2,z.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},e.prototype.rtcSignaling=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(r=i instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(i)):i,o=n?new zr(e,r,t):new Jr(e,r,t),[4,this._connMgr.send(o)]):[2,{code:z.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,[2,{code:a,buffer:null==c?void 0:c.data}]}}))}))},e.prototype.rtcPing=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return i=Ma(this.rtcCodec,e,n),[4,this.rtcSignaling(t,no[no.rtcPing],!0,i)];case 1:return r=c.sent(),o=r.code,s=r.buffer,o!==z.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(pn.RtcOutput,s)).version=Ze(a.version),[2,{code:o,data:a}])}}))}))},e.prototype.getDeviceId=function(){return Me(this.runtime)},e.prototype.getOSInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:z.NOT_SUPPORT}]}))}))},e.prototype.getProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:z.NOT_SUPPORT}]}))}))},e.prototype.getMainProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:z.NOT_SUPPORT}]}))}))},e.prototype.destroy=function(){vi(),Wa()},e.prototype.callExtra=function(t){return Promise.resolve({code:z.NOT_SUPPORT})},e.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},e.prototype.getConversationListWithAllChannelByPage=function(t,e){throw new Error("Method not implemented.")},e.prototype.getConversationsByPage=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.getHistoryMessagesByObjectNames=function(t,e,n,i,r,o,s){throw new Error("Method not implemented.")},e.prototype.clearConversations=function(){throw new Error("Method not implemented.")},e.prototype.setUserStatusListener=function(t,e){throw new Error("Method not implemented.")},e.prototype.setUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.subscribeUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.getUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.addToBlacklist=function(t){return Promise.resolve(z.NOT_SUPPORT)},e.prototype.removeFromBlacklist=function(t){return Promise.resolve(z.NOT_SUPPORT)},e.prototype.getBlacklist=function(){return Promise.resolve({code:z.NOT_SUPPORT})},e.prototype.getBlacklistStatus=function(t){return Promise.resolve({code:z.NOT_SUPPORT})},e.prototype.insertMessage=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.batchInsertMessage=function(t,e){throw new Error("Method not implemented.")},e.prototype.getMessageCount=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.deleteMessages=function(t){throw new Error("Method not implemented.")},e.prototype.deleteMessagesByTimestamp=function(t,e,n,i,r){throw new Error("Method not implemented.")},e.prototype.batchClearMessagesByTimestamp=function(t){throw new Error("Method not implemented.")},e.prototype.clearMessages=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.getMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setMessageContent=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.setMessageSearchField=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.searchConversationByContent=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.searchConversationByContentWithAllChannel=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.searchMessageByContent=function(t,e,n,i,r,o){throw new Error("Method not implemented.")},e.prototype.searchMessagesByUser=function(t,e,n,i,r,o){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentWithAllChannel=function(t,e,n,i,r){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,i,r,o,s){throw new Error("Method not implemented.")},e.prototype.getUnreadMentionedMessages=function(t,e){throw new Error("Method not implemented.")},e.prototype.setMessageSentStatus=function(t,e){throw new Error("Method not implemented.")},e.prototype.updateMessageReceiptStatus=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.setMessageReceivedStatus=function(t,e){throw new Error("Method not implemented.")},e.prototype.clearData=function(){throw new Error("Method not implemented.")},e.prototype.clearUnreadCountByTimestamp=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.setCallInfo=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(e,n),[4,i.send(new zr(Tr,r,t),da)]):[3,2];case 1:return o=c.sent(),s=o.code,a=o.data,s===z.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:z.RC_NET_CHANNEL_INVALID})]}}))}))},e.prototype.getGroupMessageDeliverList=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.getPrivateMessageDeliverTime=function(t,e){throw new Error("Method not implemented.")},e.prototype.setCheckDuplicateMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setProxy=function(t){return Promise.resolve({code:z.NOT_SUPPORT})},e.prototype.getProxy=function(){return Promise.resolve({code:z.NOT_SUPPORT})},e.prototype.testProxy=function(t,e){return Promise.resolve({status:z.NOT_SUPPORT})},e.prototype.setNetwork=function(t,e){var n;if(this._connMgr.setNetwork(t,e),t.status&&this.cloudControllerUri){var i=this._connMgr.getToken();null===(n=this.cloudController)||void 0===n||n.request(this.cloudControllerUri,Ja.newWorkChange,i)}},e}($n),Ic=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.joinRTCRoom=function(t,e,n,i,r,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return s=Ma(this._context.rtcCodec,e,n,i,r,o),[4,this.rtcSignaling(t,Ln,!0,s)];case 1:return a=l.sent(),c=a.code,u=a.buffer,c===z.SUCCESS&&u&&(h=La(this._context.rtcCodec,u)),[2,{code:c,data:h}]}}))}))},e.prototype.quitRTCRoom=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return e=this._context.rtcCodec.encode(pn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,Un,!0,e)];case 1:return[2,n.sent().code]}}))}))},e.prototype.rtcPing=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._context.rtcPing(t,e,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.rtcPingResVersion=function(t,e,n){return this._context.rtcPing(t,e,n)},e.prototype.getRTCRoomInfo=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(pn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,An,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===z.SUCCESS&&r&&(o=this._context.rtcCodec.decode(pn.RtcRoomInfoOutput,r)),[2,{code:i,data:o}]}}))}))},e.prototype.getRTCUserInfoList=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return e=this._context.rtcCodec.encode(pn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,bn,!0,e)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===z.SUCCESS&&r&&(s=La(this._context.rtcCodec,r),o={users:s.users}),[2,{code:i,data:o}]}}))}))},e.prototype.getRTCUserInfo=function(t){throw new Error("Method not implemented.")},e.prototype.setRTCUserInfo=function(t,e,n){return u(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(pn.RtcValueInfo,{key:e,value:n}),[4,this.rtcSignaling(t,wn,!0,i)];case 1:return[2,r.sent().code]}}))}))},e.prototype.removeRTCUserInfo=function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(pn.RtcKeyDeleteInput,{key:e}),[4,this.rtcSignaling(t,Pn,!1,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.setRTCData=function(t,e,n,i,r,o){return u(this,void 0,void 0,(function(){var s;return l(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(pn.RtcSetDataInput,{interior:i,target:r,key:e,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(t,Dn,!1,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCTotalRes=function(t,e,n,i,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){var o,s;return l(this,(function(a){switch(a.label){case 0:return o={objectName:i,content:this._context.rtcCodec.encode(pn.RtcValueInfo,{key:e.name,value:e.content},!0),valueInfo:[this._context.rtcCodec.encode(pn.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(pn.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},s=this._context.rtcCodec.encode(pn.RtcUserSetDataInput,o),[4,this.rtcSignaling(t,Vn,!0,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCCDNUris=function(t,e,n){return u(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(pn.RtcUserSetDataInput,{objectName:e,valueInfo:this._context.rtcCodec.encode(pn.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(t,Vn,!0,i)];case 1:return[2,r.sent().code]}}))}))},e.prototype.getRTCData=function(t,e,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(pn.RtcDataInput,{interior:n,target:i,key:e}),[4,this.rtcSignaling(t,Gn,!0,r)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===z.SUCCESS&&a?(c=this._context.rtcCodec.decode(pn.RtcQryOutput,a).outInfo,u={},c.forEach((function(t){u[t.key]=t.value})),[2,{code:s,data:u}]):[2,{code:s}]}}))}))},e.prototype.removeRTCData=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){var o;return l(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(pn.RtcDataInput,{interior:n,target:i,key:e,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),[4,this.rtcSignaling(t,Bn,!1,o)];case 1:return[2,s.sent().code]}}))}))},e.prototype.setRTCOutData=function(t,e,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(t){throw new Error("JSEngine's method not implemented.")}))}))},e.prototype.getRTCOutData=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(t){throw new Error("JSEngine's method not implemented.")}))}))},e.prototype.getRTCToken=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return i=Ma(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,kn,!0,i)];case 1:return r=c.sent(),o=r.code,s=r.buffer,o===z.SUCCESS&&s?(a=this._context.rtcCodec.decode(pn.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},e.prototype.setRTCState=function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(pn.MCFollowInput,{state:e}),[4,this.rtcSignaling(t,xn,!0,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.getRTCUserList=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(pn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,Fn,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===z.SUCCESS&&r?(o=La(this._context.rtcCodec,r),[2,{code:i,data:o}]):[2,{code:i}]}}))}))},e.prototype.joinLivingRoomAsAudience=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return i=Ma(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,Hn,!0,i)];case 1:return r=l.sent(),o=r.code,s=r.buffer,o===z.SUCCESS&&s?(a=this._context.rtcCodec.decode(pn.RtcViewerJoinedOutput,s),c=a.rtcToken,u=a.entries,[2,{code:o,data:{token:c,kvEntries:u}}]):[2,{code:o}]}}))}))},e.prototype.quitLivingRoomAsAudience=function(t){return u(this,void 0,void 0,(function(){var e,n;return l(this,(function(i){switch(i.label){case 0:return e=this._context.rtcCodec.encode(pn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,qn,!0,e)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},e.prototype.rtcIdentityChange=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return i=this._context.rtcCodec.encode(pn.RtcInput,{roomType:Jt.LIVE,broadcastType:n,identityChangeType:e,needSysChatroom:!1}),[4,this.rtcSignaling(t,Yn,!0,i)];case 1:return r=c.sent(),o=r.code,s=r.buffer,o===z.SUCCESS&&s?(a=La(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},e.prototype.requestRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,i=t.inviteSessionId,r=t.inviteTimeout,o=t.inviteInfo,s=t.roomId,a=this._context.rtcCodec.encode(pn.RtcInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:o}),[4,this.rtcSignaling(s,jn,!0,a)];case 1:return c=u.sent().code,this._context.rtcKVManager.reset(),[2,c]}}))}))},e.prototype.cancelRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,i=t.inviteSessionId,r=t.inviteInfo,o=t.roomId,s=this._context.rtcCodec.encode(pn.RtcCancelInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(o,Wn,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.responseRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return e=t.inviteUserId,n=t.inviteRoomId,i=t.inviteSessionId,r=t.content,o=t.key,s=t.value,a=t.agree,c=t.roomId,u=this._context.rtcCodec.encode(pn.RtcInviteAnswerInput,{inviteUserId:e,inviteRoomId:n,inviteSessionId:i,content:r,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(c,Qn,!0,u)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},e.prototype.endRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=t.endRoomId,n=t.sessionId,i=t.content,r=t.keys,o=t.roomId,s=this._context.rtcCodec.encode(pn.RtcEndInviteInput,{inviteRoomId:e,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(o,Jn,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.registerRTCSignalListener=function(t){this._context.registerRTCSignalingListener(t)},e.prototype.rtcSignaling=function(t,e,n,i){return this._context.rtcSignaling(t,e,n,i)},e.prototype.getRTCJoinedUserInfo=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(pn.RtcQueryUserJoinedInput,{userId:t}),[4,this.rtcSignaling("",Xn,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===z.SUCCESS&&r?(o=this._context.rtcCodec.decode(pn.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:o.map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:Ze(t.joinTime)}}))}]):[2,{code:i}]}}))}))},e}($i);function Rc(t){return c({},t)}var Sc=function(){function t(t,e){var n,i;this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[rt.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[rt.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[rt.INTERCEPT]=this._processInterceptMessage.bind(this),n[rt.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[rt.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[rt.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[rt.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[rt.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[rt.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),i),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},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=c({},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(t){return t.replace(/\/$/g,"")}));var r={onConnected:this._onConnectionStatusChange.bind(this,Ua.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,Ua.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,Ua.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,Ua.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)};this.rtcCodec=this.createCodec(Zn,zn),this._engine=Cn()?new RCCppEngine(t,this.rtcCodec,r,this._options):new yc(t,this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new Mn(this._engine)}return t.init=function(e,n){if(this._context)return this._context.logger.warn(ft.A_INIT_REPEAT_O),this._context;this._context=new t(e,n),this._context.logger.info(ft.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(ft.L_IMSDK_VER_O,JSON.stringify({commitId:"07a89ff9743fa073e6c3c19b3ae6544c36110fde",version:"5.9.3"}));var i=this._context._engine;return e.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},t.destroy=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._context?(this._context.logger.info(ft.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return t.sent(),this._context=void 0,[2]}}))}))},t.prototype.createCodec=function(t,e){return new ii(t,e)},t.prototype.install=function(t,e){var n=this.logger.createTraceId();if(this.logger.info(ft.L_INSTALL_PLUGIN_T,JSON.stringify({tag:t.tag}),n),this._pluginInstanseMap[t.tag])return this.logger.warn(ft.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[t.tag];var i="RCRTC"===t.tag?new Ic(this):new $i(this),r=null;try{if(!t.verify(this._runtime))return null;r=t.setup(i,this._runtime,e)}catch(t){this.logger.error(ft.L_INSTALL_PLUGIN_R,null==t?void 0:t.stack,n)}return["RCRTC","RCCall"].includes(t.tag)&&t.version&&t.name&&(this._versionInfo[t.name]=t.version),r&&(this._pluginContextQueue.push(i),this._pluginInstanseMap[t.tag]=r),r},t.prototype._onConnectionStatusChange=function(t,e){var n,i;this.logger.warn(ft.A_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),null===(i=(n=this._watcher).connection)||void 0===i||i.call(n,t,e),this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onconnectionstatechange)||void 0===i||i.call(n,t,e)}))},t.prototype._processChrmMemChangeMessage=function(t){if("function"==typeof this._watcher.chatroomState){var e={},n=t.content.memberCount,i=void 0===n?0:n;Array.isArray(t.content.userList)&&t.content.userList.forEach((function(t){e[t.userId]=t.status})),this._watcher.chatroomState({userChange:{users:e,chatroomId:t.targetId,memberCount:i}})}return!0},t.prototype._processTypingStatusMessage=function(t){if(this._addTypingInfo(Rc(t)),this._watcher.typingState)return!0},t.prototype._processInterceptMessage=function(t){var e={conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId||"",blockType:t.content.interceptType,blockedMessageUId:t.content.msgUId,extra:t.content.extra};if(t.conversationType===tt.ULTRA_GROUP){var n=t.content.sourceType;if(e.sourceType=n,(n===Ct.MSG_EXPANSION||n===Ct.MSG_MODIFY)&&t.content.sourceContent)try{e.sourceContent=JSON.parse(t.content.sourceContent)}catch(t){this.logger.warn(ft.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:t.message}))}}return this._MessageBlockedListener(e),!0},t.prototype._processChrmSyncMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:t.content.chatroomId,status:t.content.status,reason:t.content.reason,time:t.content.time,extra:t.content.extra||null}}),!0},t.prototype._processChrmMemBlockMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:t.content.chatroomId,operateType:t.content.operateType,durationTime:t.content.durationTime,operateTime:t.content.operateTime,userIdList:t.content.userList,extra:t.content.extra||null}}),!0},t.prototype._processChrmMemBanMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:t.content.chatroomId,banType:t.content.operateType,durationTime:t.content.durationTime,operateTime:t.content.operateTime,userIdList:t.content.userList,extra:t.content.extra||null}}),!0},t.prototype._processReadReceiptMessage=function(t){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.content.lastMessageSendTime,t.senderUserId)},t.prototype._processReadReceiptRequestMessage=function(t){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.senderUserId)},t.prototype._processReadReceiptResponseMessage=function(t){var e,n=null===(e=t.content)||void 0===e?void 0:e.receiptMessageDic,i=this._engine.getCurrentUserId();n&&Array.isArray(n[i])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.senderUserId,n[i])},t.prototype._messageReceiver=function(t,e,n){var i,r,o,s,a=this;if(!(null===(r=(i=this._compatibleMessageProccessor)[t.messageType])||void 0===r?void 0:r.call(i,t))&&!this._pluginContextQueue.some((function(e){if(!e.onmessage)return!1;try{return e.onmessage(Rc(t))}catch(t){return a.logger.error(ft.A_MSG_LISTENER_E,null==t?void 0:t.stack),!1}})))return null===(s=(o=this._watcher).message)||void 0===s||s.call(o,Rc(t),e,n),t},t.prototype._batchMessageReceiver=function(t,e,n){var i=this,r=[],o=[],s=[rt.READ_RECEIPT,rt.READ_RECEIPT_REQUEST,rt.READ_RECEIPT_RESPONSE];t.forEach((function(t){var a=i._messageReceiver(t,e,n);a&&s.includes(a.messageType)?o.push(a):a&&r.push(a)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(ft.L_BATCH_MESSAGE_O,r.map((function(t){return t.messageUId})).join(",")),this._watcher.batchMessage(r)),o.length&&o.forEach((function(t){i._messageProccessor[t.messageType]&&i._messageProccessor[t.messageType](t)}))},t.prototype._chatroomInfoListener=function(t){var e,n;null===(n=(e=this._watcher).chatroomState)||void 0===n||n.call(e,t)},t.prototype._conversationInfoListener=function(t){var e,n;null===(n=(e=this._watcher).conversationState)||void 0===n||n.call(e,t)},t.prototype._expansionInfoListener=function(t){var e,n;null===(n=(e=this._watcher).expansion)||void 0===n||n.call(e,t)},t.prototype._tagListener=function(){var t,e;null===(e=(t=this._watcher).tag)||void 0===e||e.call(t)},t.prototype._conversationTagListener=function(){var t,e;null===(e=(t=this._watcher).conversationTagChanged)||void 0===e||e.call(t)},t.prototype._typingStatusListener=function(t){var e,n;null===(n=(e=this._watcher).typingState)||void 0===n||n.call(e,t)},t.prototype._pullFinishedListener=function(){var t,e;null===(e=(t=this._watcher).pullFinished)||void 0===e||e.call(t)},t.prototype._MessageBlockedListener=function(t){var e,n;null===(n=(e=this._watcher).messageBlocked)||void 0===n||n.call(e,t)},t.prototype._messageDeliveredListerer=function(t){var e,n;null===(n=(e=this._watcher).messageDelivered)||void 0===n||n.call(e,t)},t.prototype._groupMessageDeliveredStatusListerer=function(t){var e,n;null===(n=(e=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(e,t)},t.prototype._callInfoListener=function(t){var e=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(t)}catch(t){e.logger.warn(ft.L_CALLBACK_E,null==t?void 0:t.stack)}}))},t.prototype._ultraGroupEnableListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupEnable)||void 0===n||n.call(e,t)},t.prototype._operateStatusListener=function(t){var e,n;null===(n=(e=this._watcher).operateStatus)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageExpansionUpdatedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageModifiedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageRecalledListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelChangeTypeListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelUserKickedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelDeleteListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(e,t)},t.prototype._userGroupStatusListener=function(t){var e,n;null===(n=(e=this._watcher).userGroupStatus)||void 0===n||n.call(e,t)},t.prototype._messageReadReceipt=function(t){var e,n;null===(n=(e=this._watcher).messageReadReceipt)||void 0===n||n.call(e,t)},t.prototype._syncReadStatus=function(t){var e,n;null===(n=(e=this._watcher).syncReadStatus)||void 0===n||n.call(e,t)},t.prototype._rtcDataChange=function(t,e){this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onrtcdatachange)||void 0===i||i.call(n,t,e)}))},t.prototype._naviDataChange=function(t){this._pluginContextQueue.forEach((function(e){var n;null===(n=e.onnavidatachange)||void 0===n||n.call(e,t)}))},t.prototype.assignWatcher=function(t){var e=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];e._watcher[n]=he(i)||le(i)?i:void 0}}))},t.prototype._resetWatcher=function(){var t=this;Object.keys(this._watcher).forEach((function(e){t._watcher[e]=void 0}))},t.prototype._addTypingInfo=function(t){var e=t.senderUserId,n=t.conversationType,i=t.targetId,r=t.content,o=t.channelId,s=r.typingContentType,a=o||"",c="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[c]||(this._typingInfo[c]=[]);var u=this._typingInfo[c].findIndex((function(t){return t.userId===e}));u>=0&&this._typingInfo[c][u].messageType===s?this._typingInfo[c][u].timestamp=Date.now():(u>=0&&this._typingInfo[c].splice(u,1),this._typingInfo[c].push({userId:e,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(c)||this._typingChangedList.push(c),this._startCheckTypingInfo())},t.prototype._startCheckTypingInfo=function(){var t=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var e in t._typingInfo){var n=t._typingInfo[e].length;t._typingInfo[e]=t._typingInfo[e].filter((function(e){return Date.now()-e.timestamp<t._typingExpireTime})),t._typingInfo[e].length===n||t._typingChangedList.includes(e)||t._typingChangedList.push(e),0===t._typingInfo[e].length&&delete t._typingInfo[e]}t._notifyTypingChanged()}),500))},t.prototype._notifyTypingChanged=function(){var t=this;if(this._typingChangedList.length>0){var e=this._typingChangedList.map((function(e){return{conversationType:Number(e.split("#")[0]),targetId:e.split("#")[1],channelId:e.split("#")[2],list:t._typingInfo[e]||[]}}));this._typingStatusListener(e),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},t.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},t.prototype.getServerTime=function(){return this._engine.getServerTime()},t.prototype.getDeviceId=function(){return this._engine.getDeviceId()},t.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},t.prototype.getConnectionStatus=function(){return this._engine.getConnectionStatus()},Object.defineProperty(t.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),t.prototype.refetchNaviInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.refetchNaviInfo()]}))}))},t.prototype.connect=function(t,e,n){var i,r;return u(this,void 0,void 0,(function(){var o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._token=t,[4,this._runtime.getNetworkType()];case 1:return o=l.sent(),this._engine.setNetwork({status:!0,type:o},!0),s=!!this._pluginInstanseMap.RCCallPlus,[4,this._engine.connect(t,e,s,n)];case 2:return a=l.sent(),c=a.code,u=a.data,c!==z.SUCCESS?[2,{code:c}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=Re.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,h)),[2,{code:c,userId:u}])}}))}))},t.prototype.disconnect=function(t){return u(this,void 0,void 0,(function(){var e=this;return l(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(t)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondisconnect)try{t.ondisconnect()}catch(t){e.logger.error(ft.L_CALLBACK_E,null==t?void 0:t.stack)}})),[2,Promise.resolve()]}}))}))},t.prototype.reconnect=function(t){return this.connect(this.token,!!t,this.logger.createTraceId())},t.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},t.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},t.prototype.registerMessageType=function(t,e,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),se(i)&&i.length>0&&(this._registerMessageSearchPropsMapping[t]=i),this._engine.registerMessageType(t,e,n,i,r)},t.prototype.registerRTCSignalingListener=function(t){this._engine.registerRTCSignalingListener(t)},t.prototype.checkSearchPropsMsg=function(t,e){var n=this._registerMessageSearchPropsMapping[t],i={};return n&&le(e)&&Object.keys(e).forEach((function(t){if(n.includes(t)){var r=e[t];oe(r)&&(r>-Math.pow(2,64)&&r<Math.pow(2,64)&&Number.isInteger(r)||(i[t]=r))}})),Object.keys(i).length>0?{msg:JSON.stringify(i),code:z.SEARCH_PROPS_LIMIT_ERROR}:{code:z.SUCCESS}},t.prototype.sendMessage=function(t,e,n,i,r){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==z.SUCCESS)return Promise.resolve({code:s,msg:a});if(t===tt.SYSTEM&&n.messageType!==rt.SYNC_READ_STATUS)return Promise.resolve({code:z.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(t!==tt.ULTRA_GROUP){var c=this.getNaviInfoFromCache();if(0!==((null==c?void 0:c.grpRRVer)||0)&&n.messageType===rt.READ_RECEIPT_RESPONSE)return Promise.resolve({code:z.READ_RECEIPT_ERROR})}var u=n.canIncludeExpansion,l=void 0!==u&&u,h=n.expansion;if(l){var d=me(h),p=d.isIllgalEx,g=d.isExKeyOrValLengthExceedLimit;if(d.isExceedLimit||g)return Promise.resolve({code:z.EXPANSION_LIMIT_EXCEET});if(p)return Promise.resolve({code:z.BIZ_ERROR_INVALID_PARAMETER})}var f,v,T=JSON.stringify(n.content);return f=T,void 0===v&&(v="utf-8"),("utf-16"===v?_(f):E(f))>N?Promise.resolve({code:z.RC_MSG_CONTENT_EXCEED_LIMIT}):t===tt.ULTRA_GROUP?this._engine.sendUltraMessage(e,n,i,r):this._engine.sendMessage(t,e,n,i,r)},t.prototype.sendExpansionMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return e=t.channelId,n=t.conversationType,i=t.targetId,r=t.messageUId,o=t.keys,s=t.expansion,a=t.removeAll,t.canIncludeExpansion?(c=me(s),u=c.isIllgalEx,h=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||h?[2,Promise.resolve({code:z.EXPANSION_LIMIT_EXCEET})]:u?[2,Promise.resolve({code:z.BIZ_ERROR_INVALID_PARAMETER})]:(d={mid:r},s&&(d.put=s),o&&(d.del=o),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,i,{content:d,messageType:rt.EXPANSION_NOTIFY,channelId:e})])):[2,{code:z.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},t.prototype.sendReadReceiptMessage=function(t,e,n){return u(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:z.READ_RECEIPT_ERROR,msg:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(t,e,n)]}))}))},t.prototype.getMessageReader=function(t,e,n){return u(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:z.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(t,e,n||"")]}))}))},t.prototype.sendReadReceiptMessageV4=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.sendReadReceiptMessageV4(t,e,n)]}))}))},t.prototype.getMessageReadReceiptV4=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getMessageReadReceiptV4(t,e)]}))}))},t.prototype.batchGetMessageReadReceiptInfoV4=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchGetMessageReadReceiptInfoV4(t,e)]}))}))},t.prototype.updateConversationReadTime=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.updateConversationReadTime(t,e)]}))}))},t.prototype._destroy=function(){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(e){switch(e.label){case 0:return this._resetWatcher(),this._engine.destroy(),this._runtime.removeNetworkStatusListener(),[4,this.disconnect()];case 1:return e.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){t.logger.error(ft.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},t.prototype.getHistoryMessage=function(t,e,n,i,r,o,s,a){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),void 0===s&&(s=""),t===tt.ULTRA_GROUP){var c={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(e,c,a)}return this._engine.getHistoryMessage(t,e,n,i,r,o,s||"",a)},t.prototype.getMessages=function(t,e,n,i,r,o,s){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),t===tt.ULTRA_GROUP){var a={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(e,a,s)}return this._engine.getMessages(t,e,n,i,r,o,s)},t.prototype.getHistoryMessagesByObjectNames=function(t,e,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(t,e,n,i,r,o,s)},t.prototype.getConversationList=function(t,e,n,i,r){if(e===tt.ULTRA_GROUP){var o=z.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:z[o]})}return this._engine.getConversationList(t||300,e,n,i,r||"")},t.prototype.getConversationsByPage=function(t,e,n,i){return this._engine.getConversationsByPage(t,e,n,i)},t.prototype.getConversation=function(t,e,n){return this._engine.getConversation(t,e,n)},t.prototype.removeConversation=function(t,e,n){return void 0===n&&(n=""),t===tt.ULTRA_GROUP?Promise.resolve(z.METHOD_NOT_SUPPORT):this._engine.removeConversation(t,e,n)},t.prototype.batchRemoveConversation=function(t){return this._engine.batchRemoveConversation(t)},t.prototype.getUltraGroupList=function(t){return this._engine.getUltraGroupList(t)},t.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},t.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},t.prototype.clearUnreadCount=function(t,e,n){return void 0===n&&(n=""),t===tt.ULTRA_GROUP?this._engine.clearUltraUnreadcount(e,n):this._engine.clearConversationUnreadCount(t,e,n)},t.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},t.prototype.getUnreadCount=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(t,e,n)},t.prototype.getTotalUnreadCount=function(t,e,n){if(e&&e.includes(tt.ULTRA_GROUP)){var i=z.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:z[i]})}return this._engine.getAllConversationUnreadCount(t,e&&e.length>0?e:[tt.PRIVATE,tt.GROUP,tt.SYSTEM,tt.PUBLIC_SERVICE],!!n)},t.prototype.getTotalUnreadCountByLevels=function(t,e,n){return this._engine.getTotalUnreadCountByLevels(t,e,n)},t.prototype.getFirstUnreadMessage=function(t,e,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(t,e,n)},t.prototype.getFirstUnreadMessageInfo=function(t,e,n){return this._engine.getFirstUnreadMessageInfo(t,e,n)},t.prototype.setConversationNotificationLevel=function(t,e,n,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setConversationNotificationLevel(t,e,n,i)]}))}))},t.prototype.batchSetConversationNotificationLevel=function(t,e){return this._engine.batchSetConversationNotificationLevel(t,e)},t.prototype.setConversationStatus=function(t,e,n,i,r){if(void 0===r&&(r=""),t===tt.ULTRA_GROUP&&void 0!==n)return Promise.resolve(z.METHOD_NOT_SUPPORT);var o=[{conversationType:t,targetId:e,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},t.prototype.batchSetConversationToTop=function(t,e,n){return this._engine.batchSetConversationToTop(t,e,!!n)},t.prototype.saveConversationMessageDraft=function(t,e,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(t,e,n,i)},t.prototype.getConversationMessageDraft=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(t,e,n)},t.prototype.clearConversationMessageDraft=function(t,e,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(t,e,n)},t.prototype.recallMessage=function(t,e,n,i,r){return this._engine.recallMsg(t,e,n,i,r)},t.prototype.deleteRemoteMessage=function(t,e,n,i){return void 0===i&&(i=""),t===tt.ULTRA_GROUP?Promise.resolve(z.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(t,e,n,i)},t.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(t,e,n,i)},t.prototype.joinChatroom=function(t,e,n){return void 0===e&&(e=10),this._engine.joinChatroom(t,e,n)},t.prototype.joinExistChatroom=function(t,e,n){return void 0===e&&(e=10),this._engine.joinExistChatroom(t,e,n)},t.prototype.quitChatroom=function(t){return this._engine.quitChatroom(t)},t.prototype.getChatroomInfo=function(t,e,n){return this._engine.getChatroomInfo(t,e||0,n||0)},t.prototype.setChatroomEntry=function(t,e){var n=e.key,i=e.value;return nn(n)&&rn(i)?this._engine.setChatroomEntry(t,e):Promise.resolve(z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.setChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var i=e.entries[n],r=i.key,o=i.value;if(!nn(r)||!rn(o))return Promise.resolve({code:z.BIZ_ERROR_INVALID_PARAMETER})}var s=c(c({},e),{isOverwrite:e.isForce});return this._engine.setChatroomEntries(t,s)},t.prototype.forceSetChatroomEntry=function(t,e){var n=e.key,i=e.value;return nn(n)&&rn(i)?this._engine.forceSetChatroomEntry(t,e):Promise.resolve(z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntry=function(t,e){var n=e.key;return nn(n)?this._engine.removeChatroomEntry(t,e):Promise.resolve(z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var i=e.entries[n].key;if(!nn(i))return Promise.resolve({code:z.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(t,e)},t.prototype.forceRemoveChatroomEntry=function(t,e){var n=e.key;return nn(n)?this._engine.forceRemoveChatroomEntry(t,e):Promise.resolve(z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.getChatroomEntry=function(t,e){return this._engine.getChatroomEntry(t,e)},t.prototype.getAllChatroomEntries=function(t){return this._engine.getAllChatroomEntry(t)},t.prototype.getChatroomHistoryMessages=function(t,e,n,i){return this._engine.getChatroomHistoryMessages(t,i||0,e||20,n||0)},t.prototype.getFileToken=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return o=this.getNaviInfoFromCache(),s=(null==o?void 0:o.bosAddr)||"",a=(null==o?void 0:o.uploadServer)||"",c=(null==o?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(t,e,n,i,r)];case 1:return u=l.sent(),h=u.code,d=u.data,h===z.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:s,qiniu:a,ossConfig:c}))]:[2,Promise.reject(h)]}}))}))},t.prototype.getFileUrl=function(t,e,n,i,r){return void 0===r&&(r=dt.QINIU),u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return(null==i?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(t,r,e,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===z.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},t.prototype.createTag=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.createTag(t)]}))}))},t.prototype.removeTag=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeTag(t)]}))}))},t.prototype.updateTag=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.updateTag(t)]}))}))},t.prototype.getTagList=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getTagList()]}))}))},t.prototype.addTagForConversations=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.length>1e3?[2,Promise.resolve({code:z.CONVER_OUT_LIMIT_ERROR})]:[2,this._engine.addTagForConversations(t,e)]}))}))},t.prototype.removeTagForConversations=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagForConversations(t,e)]}))}))},t.prototype.removeTagsForConversation=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagsForConversation(t,e)]}))}))},t.prototype.getConversationListByTag=function(t,e,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getConversationListByTag(t,e,n,i)]}))}))},t.prototype.getUnreadCountByTag=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getUnreadCountByTag(t,e)]}))}))},t.prototype.setConversationStatusInTag=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setConversationStatusInTag(t,e,n)]}))}))},t.prototype.getTagsForConversation=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getTagsForConversation(t)]}))}))},t.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},t.prototype.getTopConversationList=function(t,e){return t&&0!==t.length||(t=[tt.PRIVATE,tt.CHATROOM,tt.GROUP,tt.SYSTEM,tt.APP_PUBLIC_SERVICE,tt.PUBLIC_SERVICE]),this._engine.getTopConversationList(t,e||"")},t.prototype.getUnreadConversationList=function(t){return t&&0!==t.length||(t=[tt.PRIVATE,tt.CHATROOM,tt.GROUP,tt.SYSTEM,tt.APP_PUBLIC_SERVICE,tt.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(t)},t.prototype.getUnreadMentionedCount=function(t){return this._engine.getUnreadMentionedCount(t)},t.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},t.prototype.sendUltraGroupTypingStatus=function(t){if(t.conversationType!==tt.ULTRA_GROUP){var e=z.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:e,msg:z[e]})}return this._engine.sendUltraGroupTypingStatus(t)},t.prototype.getUltraGroupMessageListByMessageUId=function(t){return this._engine.getUltraGroupMessageListByMessageUId(t)},t.prototype.expandUltraMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=t.conversationType,n=t.expansion,i=t.canIncludeExpansion,e!==tt.ULTRA_GROUP?[2,{code:r=z.CONVERSATION_TYPE_NOT_SUPPORT,msg:z[r]}]:i?(o=me(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:z.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:z.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(t)]):[2,{code:z.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:c.sent().code}]}}))}))},t.prototype.modifyMessage=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return t.conversationType!==tt.ULTRA_GROUP?[2,{code:e=z.CONVERSATION_TYPE_NOT_SUPPORT,msg:z[e]}]:[4,this._engine.modifyMessage(t)];case 1:return[2,{code:n.sent().code}]}}))}))},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t,e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(t,e)},t.prototype.getUltraGroupUnreadCountByTargetId=function(t,e){return this._engine.getUltraGroupUnreadCountByTargetId(t,e)},t.prototype.getAllUltraGroupUnreadCount=function(t){return void 0===t&&(t=!1),this._engine.getAllUltraGroupUnreadCount(t)},t.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},t.prototype.getUltraGroupUnreadMentionedMessages=function(t){return this._engine.getUltraGroupUnreadMentionedMessages(t)},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(t){return this._engine.getUltraGroupFirstUnreadMessageTimestamp(t)},t.prototype.getUltraGroupUnreadInfoList=function(t){return this._engine.getUltraGroupUnreadInfoList(t)},t.prototype.callExtra=function(t){for(var e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(e=this._engine).callExtra.apply(e,h([t],n,!1))},t.prototype.getOSInfo=function(){return this._engine.getOSInfo()},t.prototype.getProcessInfo=function(){return this._engine.getProcessInfo()},t.prototype.getMainProcessInfo=function(){return this._engine.getMainProcessInfo()},t.prototype.setCallInfo=function(t,e,n){return this._engine.setCallInfo(t,e,n)},t.prototype.getGroupMessageDeliverList=function(t,e,n){return void 0===n&&(n=""),this._engine.getGroupMessageDeliverList(t,e,n)},t.prototype.getPrivateMessageDeliverTime=function(t,e){return void 0===e&&(e=""),this._engine.getPrivateMessageDeliverTime(t,e)},t.prototype.clearConversations=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.clearConversations(t,e)]}))}))},t.prototype.setUserStatusListener=function(t,e){var n=this;return this._engine.setUserStatusListener(t,(function(t){try{e(t)}catch(t){n.logger.error(ft.L_CALLBACK_E,null==t?void 0:t.stack)}}))},t.prototype.addToBlacklist=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.addToBlacklist(t)]}))}))},t.prototype.removeFromBlacklist=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeFromBlacklist(t)]}))}))},t.prototype.getBlacklist=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklist()]}))}))},t.prototype.getBlacklistStatus=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getBlacklistStatus(t)]}))}))},t.prototype.insertMessage=function(t,e,n){return u(this,void 0,void 0,(function(){var i,r,o;return l(this,(function(s){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,o=i.msg,r!==z.SUCCESS?[2,Promise.resolve({code:r,msg:o})]:[2,this._engine.insertMessage(t,e,n)]}))}))},t.prototype.batchInsertMessage=function(t,e){return this._engine.batchInsertMessage(t,e)},t.prototype.getMessageCount=function(t,e,n){return void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getMessageCount(t,e,n)]}))}))},t.prototype.deleteMessages=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.deleteMessages(t)]}))}))},t.prototype.deleteMessagesByTimestamp=function(t,e,n,i,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(t,e,n,!!i,r)]}))}))},t.prototype.batchClearMessagesByTimestamp=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.batchClearMessagesByTimestamp(t)]}))}))},t.prototype.batchClearRemoteHistoryMessages=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchClearRemoteHistoryMessages(t,e)]}))}))},t.prototype.clearMessages=function(t,e,n){return void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.clearMessages(t,e,n)]}))}))},t.prototype.getMessage=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getMessage(t)]}))}))},t.prototype.setMessageContent=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageContent(t,e,n)]}))}))},t.prototype.setMessageSearchField=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageSearchField(t,e,n)]}))}))},t.prototype.setMessageSentStatus=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageSentStatus(t,e)]}))}))},t.prototype.setMessageReceivedStatus=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageReceivedStatus(t,e)]}))}))},t.prototype.setMessageStatusToRead=function(t,e,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(t,e,n,i)]}))}))},t.prototype.setUserStatus=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.setUserStatus(t)]}))}))},t.prototype.subscribeUserStatus=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.subscribeUserStatus(t)]}))}))},t.prototype.getUserStatus=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getUserStatus(t)]}))}))},t.prototype.searchConversationByContent=function(t,e,n,i){return void 0===e&&(e=[]),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContent(t,e,n||"",i)]}))}))},t.prototype.searchConversationByContentWithAllChannel=function(t,e,n){return void 0===e&&(e=[]),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContentWithAllChannel(t,e,n)]}))}))},t.prototype.searchMessageByContent=function(t,e,n,i,r,o,s){return void 0===s&&(s=""),u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(t,e,n,i,r,o,s)]}))}))},t.prototype.searchMessagesByUser=function(t,e,n,i,r,o){return void 0===r&&(r=5),void 0===o&&(o=""),u(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessagesByUser(t,e,n,i,r,o)]}))}))},t.prototype.searchMessageByContentWithAllChannel=function(t,e,n,i,r){return u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(t,e,n,i,r)]}))}))},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,i,r,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(t,e,n,i,r,o,s)]}))}))},t.prototype.getUnreadMentionedMessages=function(t,e,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(t,e,n)},t.prototype.clearUnreadCountByTimestamp=function(t,e,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(t,e,n,i)},t.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return void 0===e&&(e=""),this._engine.getUltraGroupDefaultNotificationLevel(t,e)},t.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,n){return void 0===n&&(n=""),this._engine.setUltraGroupDefaultNotificationLevel(t,e,n)},t.prototype.getConversationNotificationLevel=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationNotificationLevel(t,e,n)},t.prototype.getConversationNotificationStatus=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(t,e,n)},t.prototype.getRemoteHistoryMessages=function(t,e,n,i,r,o){return this._engine.getRemoteHistoryMessages(t,e,n,i,r,o)},t.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},t.prototype.getConversationListWithAllChannelByPage=function(t,e){return this._engine.getConversationListWithAllChannelByPage(t,e)},t.prototype.clearData=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.clearData()]}))}))},t.prototype.createLogger=function(t,e){return this._engine.createLogger(t,e)},t.prototype.createStatisticLogger=function(t,e){return this._engine.createStatisticLogger(t,e)},t.prototype.setCheckDuplicateMessage=function(t){return this._engine.setCheckDuplicateMessage(t)},t.prototype.rtcSignaling=function(t,e,n,i){return this._engine.rtcSignaling(t,e,n,i)},t.prototype.rtcPing=function(t,e,n){return this._engine.rtcPing(t,e,n)},t.prototype.bindRTCRoomForChatroom=function(t){return this._engine.bindRTCRoomForChatroom(t)},t.prototype.setProxy=function(t){return this._engine.setProxy(t)},t.prototype.getProxy=function(){return this._engine.getProxy()},t.prototype.testProxy=function(t,e){return this._engine.testProxy(t,e)},t}(),Oc=x;export{Ga as AConnectionMgr,$n as AEngine,Sc as APIContext,o as AppStorage,ni as AreaCode,be as AssertRules,vc as BaseCloudController,Ui as BasicLogger,Ro as BasicNavi,bi as BasicReporter,ci as BasicStaticConfigManager,ic as BasicStatistic,rc as BasicStatisticReporter,P as CPP_PROTOCAL_MSGTYPE_OPTION,ne as CallLibMsgType,vt as ChatroomEntryType,zt as ChatroomSyncStatusReason,mt as ChatroomUserChangeType,bt as ChrmMemBanType,Ut as ChrmMemOperateType,Mt as ChrmSyncStatus,ii as Codec,Qt as ConnectReason,Wt as ConnectType,nt as ConnectionStatus,tt as ConversationType,B as DB_LOG_FLUSH_FREQUENCY,G as DB_LOG_MAX_SIZE,On as DelayTimer,wt as EConnectProtocol,qt as EnterpriseType,z as ErrorCode,ye as EventEmitter,F as FORMATED_VERSION,Q as FileType,C as HTTP_TIMEOUT,Qe as HttpMethod,M as IM_CHATROOM_PULL_INTERVAL_TIME,R as IM_PING_INTERVAL_TIME,O as IM_PING_MIN_TIMEOUT,S as IM_PING_TIMEOUT,I as IM_SIGNAL_TIMEOUT,Ai as IndexDBLogger,Ki as IndexDBReporter,sc as IndexDBStatistic,pc as IndexDBStatisticReporter,Pt as InterruptionLevel,Ja as InvokerType,j as LOCAL_STORAGE_KEYS,Zt as LiveRole,Xt as LiveType,Ii as LogL,pt as LogLevel,gt as LogSource,ft as LogTagId,N as MAX_MESSAGE_CONTENT_BYTES,L as MAX_MESSAGE_EXPANSION_KEY_LENGTH,U as MAX_MESSAGE_EXPANSION_VAL_LENGTH,H as MAX_UPLOAD_FILE_SIZE,lt as MentionedType,Ct as MessageBlockSourceType,It as MessageBlockType,X as MessageDirection,rt as MessageType,T as NAVI_CACHE_DURATION,m as NAVI_REQ_TIMEOUT,Yt as NaviCacheType,Je as NetworkType,ct as NotificationLevel,st as NotificationStatus,k as ONE_LOG_SIZE_MAX,Ot as OperateStatus,$i as PluginContext,Kt as ProtocalType,Dt as PushImportanceHonor,Fe as RCAssertError,Ua as RCConnectionStatus,Y as RC_DEFAULT_USER,V as REAT_TIME_LOG_SIZE,$t as RTCApiType,te as RTCIdentityChangeType,ee as RTCJoinType,Jt as RTCMode,Ic as RTCPluginContext,n as ReceivedStatus,w as SEND_MESSAGE_TYPE_OPTION,K as STATIC_CONFIG_CACHE_TIME,b as STATIC_CONFIG_IV,A as STATIC_CONFIG_KEY,D as STATUS_MESSAGE,Rt as SentStatus,Va as StatisticL,_t as StatisticsTag,jt as StatisticsVersion,Vt as StoreKeys,ke as SuspendablePromise,Xe as TagChangeType,q as UPLOAD_FILE_CHUNK_SIZE,Bt as UltraGroupChannelChangeType,Gt as UltraGroupChannelType,Ht as UltraMentionedType,kt as UltraMsgChangeType,xt as UltraMsgSubChangeType,dt as UploadMethod,Ft as UserGroupChangeType,x as VERSION,Re as VersionManage,y as WEB_SOCKET_TIMEOUT,Oo as WebSocketNavi,v as appendUrl,He as assert,In as clone,Tn as cloneByJSON,vi as deInitLogDB,an as decryptCBC,cn as fixUrlProtocol,gn as forEach,mn as getBrowser,on as getClientMessageId,Me as getDeviceId,un as getMessageUIdHash,$e as getMimeKey,Oe as getUUID,Ne as getUUID22,ze as getUploadFileName,sn as getbundleId,hn as httpRequest,_n as indexOf,_i as initLogDB,Ya as initStatisticDB,se as isArray,ae as isArrayBuffer,re as isBoolean,Da as isConnnectAck,Pa as isDisconnectedByServer,he as isFunction,ge as isHttpUrl,vn as isInObject,En as isInclude,pe as isNull,oe as isNumber,le as isObject,Se as isStartCloudController,ie as isString,Te as isTypeInConversationList,de as isUndefined,ve as isValidChannelId,nn as isValidChrmEntryKey,rn as isValidChrmEntryValue,_e as isValidConversationType,me as isValidExpansion,Ce as isValidFileType,Ee as isValidNotificationLevel,Be as logger,fn as map,ue as notEmptyArray,fe as notEmptyObject,ce as notEmptyString,tn as pushConfigsToJSON,en as pushJSONToConfigs,$a as statisticTranscsv,f as todo,qi as transcsv,Sn as transformReceivedStatusFlag,Rn as transformReceivedStatusInfo,Wa as unInitStatisticDB,ai as urlCenter,Cn as usingCppEngine,qe as validate,Oc as version};
1
+ var e;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(e||(e={}));var t,n=e,i=function(e){return t||(t={set:function(t,n){e.localStorage.setItem(t,JSON.stringify(n))},get:function(t){var n;try{n=JSON.parse(e.localStorage.getItem(t))}catch(e){n=null}return n},remove:function(t){return e.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var n in e.localStorage)t.push(n);return t}}),t},r=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}(),o=function(){function e(e,t){var n;this._rootStorage=i(e);var o=this._rootStorage.get(t)||{};this._cache=new r(((n={})[t]=o,n)),this._storageKey=t}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}(),s=function(e,t){return s=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])},s(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return c=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)};function u(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}function l(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var d,p=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return a(t,e),t}(Error),f=function(e){return new p(e)},_=function(e){for(var t=0,n=0,i=e.length;n<i;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},E=function(e){for(var t,n=0,i=0,r=e.length;i<r;i++)n+=(t=e.charCodeAt(i))<127?1:t<=2047?2:t<=65535?3:4;return n},v=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},T=72e5,C=6e4,m=1e4,y=5e3,I=3e4,R=15e3,S=15e3,O=2e3,N=131072,M=18e4,L=32,U=4096,A="cd4936151214ce45dc1d12673a59d94c",b="51ad078e5eb17a91",w={"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},"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:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC: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: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}},P={"RC:DizNtf":{isCounted:!1,isPersited:!1}},D=["RC:TypSts","RC:InterceptMsg","RC:RL"],V=20971520,G=1e5,B=3e3,k=1e3,x="5.9.4",F=x.replace(/-.+$/,""),H=5368709120,q=10485760,K=18e5,Y="rongcloudsystem",j=864e5,W={NAVI_KEY:function(e){return"navi_".concat(e)},CONVER_STATE_PULL_TIME_KEY:function(e,t){return"RCV4-con-s-".concat(e,"-").concat(t)},OLD_CONVER_STATE_KEY:function(e,t){return"RCV4-con-".concat(e,"-").concat(t)},CONVER_STATE_KEY:function(e,t){return"RCV4-CONVER-".concat(e,"-").concat(t)},ULTRA_GROUP_STATE_KEY:function(e,t){return"RCV4-ultragroupconversation-".concat(e,"-").concat(t)},OUTBOX_TIME_KEY:function(e,t){return"outbox_".concat(e,"_").concat(t)},INBOX_TIME_KEY:function(e,t){return"inbox_".concat(e,"_").concat(t)},BROADCASTBOX_TIME_KEY:function(e,t){return"broadcastbox_".concat(e,"_").concat(t)},SEND_MSG_KEY:function(e,t){return"send_msg_".concat(e,"_").concat(t)},USER_SETTING_TIME_KEY:function(e,t){return"us-s-".concat(e,"-").concat(t)},TAG_STATE_KEY:function(e,t){return"tag-".concat(e,"-").concat(t)},USER_SETTING_KEY:function(e,t){return"RC-us-".concat(e,"-").concat(t)},STATIC_CONFIG_KEY:function(e){return"rc-static-config-".concat(e)},CLOUD_CONTROL_KEY:function(e){return"RC-cc-".concat(e)},READ_RECEIPT_KEY:function(e,t){return"RC-RR-".concat(e,"-").concat(t)}};!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"}(d||(d={}));var Q,J=d;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(Q||(Q={}));var X,Z=Q;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",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.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",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.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.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.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",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_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.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.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.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",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.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34292]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34293]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",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.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",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_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",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.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.SUB_PROCESS_EXIT=34289]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34290]="ADDON_NOT_EXIST"}(X||(X={}));var z,$=X;!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"}(z||(z={}));var ee,te=z;!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"}(ee||(ee={}));var ne,ie=ee;!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"}(ne||(ne={}));var re,oe=ne;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(re||(re={}));var se,ae=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"}(se||(se={}));var ce,ue=se;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(ce||(ce={}));var le,he=ce;!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"}(le||(le={}));var de,pe=le;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(de||(de={}));var ge,fe,_e,Ee,ve,Te=de;!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"}(ge||(ge={})),function(e){e.IM="IM",e.RTC="RTC"}(fe||(fe={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_O="A-init-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_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.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_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.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",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_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_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||(_e={})),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"}(Ee||(Ee={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ve||(ve={}));var Ce,me,ye=ve;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Ce||(Ce={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(me||(me={}));var Ie,Re=Ce;!function(e){e[e.typing=0]="typing"}(Ie||(Ie={}));var Se,Oe,Ne=Ie;!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"}(Se||(Se={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Oe||(Oe={}));var Me,Le=Oe;!function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(Me||(Me={}));var Ue,Ae=Me;!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"}(Ue||(Ue={}));var be,we=Ue;!function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(be||(be={}));var Pe,De,Ve,Ge,Be,ke,xe,Fe,He,qe,Ke,Ye,je,We,Qe,Je,Xe,Ze,ze,$e=be;!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"}(Pe||(Pe={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(De||(De={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(Ve||(Ve={})),function(e){e.NAVI="rc-navi",e.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(Ge||(Ge={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(Be||(Be={})),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"}(ke||(ke={})),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"}(xe||(xe={})),function(e){e[e.CHANNEL_DELETE=1]="CHANNEL_DELETE",e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",e[e.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Fe||(Fe={})),function(e){e[e.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"}(He||(He={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(qe||(qe={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Ke||(Ke={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Ye||(Ye={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(je||(je={})),function(e){e[e.CURRENT=2]="CURRENT"}(We||(We={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(Qe||(Qe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Je||(Je={})),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"}(Xe||(Xe={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Ze||(Ze={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(ze||(ze={}));var et,tt,nt,it={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(et||(et={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(tt||(tt={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(nt||(nt={}));var rt=function(e){return"string"==typeof e},ot=function(e){return"boolean"==typeof e},st=function(e){return"number"==typeof e&&!Number.isNaN(e)},at=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},ct=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},ut=function(e){return rt(e)&&e.length>0},lt=function(e){return at(e)&&e.length>0},ht=function(e){return"[object Object]"===Object.prototype.toString.call(e)},dt=function(e){return"[object Function]"===Object.prototype.toString.call(e)},pt=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},gt=function(e){return"[object Null]"===Object.prototype.toString.call(e)},ft=function(e){return rt(e)&&/https?:\/\//.test(e)},_t=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},Et=function(e){return st(e)&&Object.prototype.hasOwnProperty.call(te,e)},vt=function(e){return st(e)&&Object.prototype.hasOwnProperty.call(ue,e)},Tt=function(e){var t=!1;return rt(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Ct=function(e){return[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE,te.APP_PUBLIC_SERVICE].includes(e)},mt=function(e){return st(e)&&Object.prototype.hasOwnProperty.call(J,e)},yt=function(e){var t=!1,n=!1,i=!1;if(ht(e)){var r=Object.keys(e).length;for(var o in t=r>20,e)if(n||(n=rt(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!i){var s=e[o];i=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}},It=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var i=this._map[e];i&&((i=i.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=i:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=this._map[e];if(i)for(var r=i.length-1;r>=0;r-=1){var o=i[r],s=o.target,a=o.once,c=o.listener;a&&i.splice(r,1);try{c.call.apply(c,h([s],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}(),Rt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Rt.engine="5.9.4";var St=function(){function e(){}return e.add=function(e,t){Rt[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 Rt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Rt},e}();function Ot(){return!0}var Nt=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},Mt=function(){var e=Nt();if(e="".concat(e.replace(/-/g,""),"a"),e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,i=+e,r=[];do{var o=i%n;i=(i-o)/n,r.unshift(t[o])}while(i);return r.join("")}(e=parseInt(e,16)),e.length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n<t;n++)e+="0";return e},Lt=function(e){var t="RCDeviceId",n=i(e),r="",o=n.get(t);return o?r=o:(r=Mt(),n.set(t,r)),r},Ut=null;function At(e,t,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-e];if(Ut&&e<ge.FATAL)try{var o=JSON.stringify(n);Ut[r](t,o)}catch(e){console.error(e)}}var bt,wt,Pt=At.bind(null,ge.DEBUG),Dt=At.bind(null,ge.INFO),Vt=At.bind(null,ge.WARN),Gt=At.bind(null,ge.ERROR),Bt=At.bind(null,ge.FATAL),kt=Object.freeze({__proto__:null,init:function(e){Ut=e},log:At,debug:Pt,info:Dt,warn:Vt,error:Gt,fatal:Bt}),xt=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}();!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"}(wt||(wt={}));var Ft=((bt={})[wt.STRING]=ut,bt[wt.ONLY_STRING]=rt,bt[wt.NUMBER]=st,bt[wt.BOOLEAN]=function(e){return"boolean"==typeof e},bt[wt.OBJECT]=ht,bt[wt.ARRAY]=at,bt[wt.CALLBACK]=function(e){var t=!0;return ht(e)||(t=!1),(e=e||{}).onSuccess&&!dt(e.onSuccess)&&(t=!1),e.onError&&!dt(e.onError)&&(t=!1),t},bt[wt.CHANNEL_ID]=Tt,bt[wt.CONVERSATION]=function(e){var t=!0;return ht(e)||(t=!1),rt(e.targetId)||(t=!1),Et(e.conversationType)||(t=!1),pt(e.channelId)||Tt(e.channelId)||(t=!1),t},bt),Ht=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return a(t,e),t}(Error),qt=function(e,t,n,i){if(void 0===i&&(i=!1),!Kt(e,t,n,i))throw new Ht("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},Kt=function(e,t,n,i){void 0===i&&(i=!1),n=Ft[n]||n;var r=i?n(t):pt(t)||null==t||n(t);return r||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),r},Yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function jt(e){var t,n,i,r,o,s,a="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)t=Yt.indexOf(e.charAt(c++))<<2|(r=Yt.indexOf(e.charAt(c++)))>>4,n=(15&r)<<4|(o=Yt.indexOf(e.charAt(c++)))>>2,i=(3&o)<<6|(s=Yt.indexOf(e.charAt(c++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a}function Wt(e){for(var t=null===window||void 0===window?void 0:window.atob(e),n=new Uint8Array(t.length),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}var Qt,Jt,Xt,Zt,zt=function(e){if(!ht(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(t.length,"}$")),t),16)},$t=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),i=Nt(),r=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),i=t.getMonth()+1,r=t.getDate();return"".concat(n).concat(e).concat(i).concat(e).concat(r)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s=".".concat(a[a.length-1])}return"".concat(e,"__RC-").concat(r,"_").concat(n,"_").concat(o).concat(i).concat(s)},en=function(e){var t="application/octet-stream";switch(e){case J.IMAGE:t="image/jpeg";break;case J.AUDIO:t="audio/amr";break;case J.VIDEO:t="video/3gpp";break;case J.SIGHT:t="video/mpeg4";break;case J.COMBINE_HTML:t="text/html"}return t},tn=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=t.channelIdMi,i=t.channelIdHW,r=t.channelIdOPPO,o=t.typeVivo,s=t.importanceHW,a=t.categoryHW,c=t.imageUrlHW,u=t.categoryVivo,l=t.importanceHonor,h=t.imageUrlHonor,d=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,o=e.richMediaUri,s=e.interruptionLevel,a=t.googleConfig,c={};c["thread-id"]=n||"",c["apns-collapse-id"]=i||"",c.category=r||"",c.richMediaUri=o||"",c["interruption-level"]=s||"active";var u={};u.collapse_key=null==a?void 0:a.collapseKey,u.imageUrl=null==a?void 0:a.imageUrl;var l=null==a?void 0:a.priority;return l&&!["high","normal"].includes(l)&&(l="normal"),u.priority=l,{APNS:c,FCM:u}}(e,t),p=[{HW:{channelId:i||"",importance:s||"NORMAL",image:c||"",category:a||""}},{MI:{channelId:n||""}},{OPPO:{channelId:r||""}},{VIVO:{classification:o||"",category:u||""}},{APNS:d.APNS},{FCM:d.FCM},{HONOR:{importance:l||Ve.NORMAL,image:h||""}}];return JSON.stringify(p)},nn=function(e,t,n){var i={},r={notificationId:n||""};if(!t)return{iOSConfig:i,androidConfig:r};try{var o=JSON.parse(t);null==o||o.forEach((function(e){var t,n,o,s,a,c,u,l,h,d,p=Object.keys(e);if(0!==p.length){var g=p[0];switch(g){case"HW":return r.channelIdHW=null===(t=e[g])||void 0===t?void 0:t.channelId,r.importanceHW=null===(n=e[g])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(o=e[g])||void 0===o?void 0:o.image,void(r.categoryHW=null===(s=e[g])||void 0===s?void 0:s.category);case"MI":return void(r.channelIdMi=null===(a=e[g])||void 0===a?void 0:a.channelId);case"OPPO":return void(r.channelIdOPPO=null===(c=e[g])||void 0===c?void 0:c.channelId);case"VIVO":return r.typeVivo=null===(u=e[g])||void 0===u?void 0:u.classification,void(r.categoryVivo=null===(l=e[g])||void 0===l?void 0:l.category);case"APNS":return i.threadId=e[g]["thread-id"],i.apnsCollapseId=e[g]["apns-collapse-id"],i.category=e[g].category,i.richMediaUri=e[g].richMediaUri,void(i.interruptionLevel=e[g]["interruption-level"]);case"FCM":return void(r.googleConfig={collapseKey:e[g].collapse_key||"",imageUrl:e[g].imageUrl||"",priority:e[g].priority||""});case"HONOR":r.importanceHonor=null===(h=e[g])||void 0===h?void 0:h.importance,r.imageUrlHonor=null===(d=e[g])||void 0===d?void 0:d.image}}}))}catch(n){e.error(_e.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:i,androidConfig:r}},rn=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},on=function(e){var t=e.length;return t<=4096&&t>=1},sn=(Qt=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+Qt.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return Qt=2047&++Qt,parseInt(n,2)}),an=function(){var e=St.getInfo(),t="electron";for(var n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return t},cn=function(e,t,n){return u(void 0,void 0,void 0,(function(){var i,r;return l(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 i=o.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},i,Wt(e))];case 2:return r=o.sent(),[2,(new TextDecoder).decode(r)]}}))}))};function un(e,t){var n;if(!e)return"";var i="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)?i?e.replace(/^https?:\/\//i,"https://"):e:t!==Pe.HTTP||i?"https://".concat(e):"http://".concat(e)}function ln(e){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)}!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Jt||(Jt={})),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"}(Xt||(Xt={})),function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Zt||(Zt={}));var hn=function(){var e="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;return"undefined"!=typeof XMLHttpRequest&&e?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")};function dn(e){var t=e.method||Jt.GET,n=e.timeout||C,i=e.headers,r=e.query,o=e.body,s=e.onProgress,a=v(e.url,r),c=hn(),u="[object XDomainRequest]"===Object.prototype.toString.call(c);if(c.open(t,a),i&&c.setRequestHeader)for(var l in i)c.setRequestHeader(l,i[l]);return u?function(e,t,n){return new xt((function(i){0!==t&&(e.timeout=t),e.onload=function(){i({data:e.responseText,status:e.status||200})},e.onerror=function(){i({status:e.status})},e.ontimeout=function(){i({status:e.status})};var r="object"==typeof n?JSON.stringify(n):n;e.send(r)}),(function(t){e.abort(),t({status:-1})}))}(c,n,o):function(e,t,n,i){return new xt((function(r){e.onreadystatechange=function(){4===e.readyState&&r({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){r({status:e.status})},i&&(e.upload.onprogress=function(e){return i(e)}),0!==t&&setTimeout((function(){e.abort(),r({status:e.status})}),t),e.send(n)}),(function(t){e.abort(),t({status:-1})}))}(c,n,o,s)}var pn,gn,fn=function(e,t,n){var i=null==n?void 0:n.isReverse;ht(e)&&function(){for(var n in e)t(e[n],n,e)}(),(at(e)||rt(e))&&function(){if(i)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var r=0,o=e.length;r<o;r++)t(e[r],r)}()},_n=function(e,t){return fn(e,(function(n,i){e[i]=t(n,i)})),e},En=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return fn(e,(function(e,i){t===e&&(n=i)})),n},vn=function(e,t){return-1!==En(e,t)},Tn=function(e,t){var n=[];return fn(e,(function(e){n.push(e)})),-1!==En(n,t)},Cn=function(e){return JSON.parse(JSON.stringify(e))},mn=function(){return"undefined"!=typeof RCCppEngine},yn=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},In=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(In(e[n]));else for(var n in t={},e)t[n]=In(e[n]);else t=e;return t},Rn=function(e){var t;try{t=In(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},Sn=function(e){return{isRead:(e&n.READ)===n.READ,isListened:(e&n.LISTENED)===n.LISTENED,isDownload:(e&n.DOWNLOADED)===n.DOWNLOADED,isRetrieved:(e&n.RETRIEVED)===n.RETRIEVED}},On=function(e){var t=n.UNREAD;return(null==e?void 0:e.isRead)&&(t|=n.READ),(null==e?void 0:e.isListened)&&(t|=n.LISTENED),(null==e?void 0:e.isDownload)&&(t|=n.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=n.RETRIEVED),t},Nn={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Nn._delayTime=t-e},getTime:function(){var e=Nn._delayTime;return(new Date).getTime()-e}},Mn=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},Ln=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(i=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,o===$.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},e.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},e}(),Un="rtcRJoin_data",An="rtcRExit",bn="rtcRInfo",wn="rtcUData",Pn="rtcUPut",Dn="rtcUDel",Vn="rtcSetData",Gn="userSetData",Bn="rtcQryData",kn="rtcDelData",xn="rtcToken",Fn="rtcUserState",Hn="rtcUList",qn="viewerJoinR",Kn="viewerExitR",Yn="rtcPullKv",jn="rtcIdentityChange",Wn="rtcInvite",Qn="rtcCancelInvite",Jn="rtcInviteAnswer",Xn="rtcEndInvite",Zn="rtcQueryJoined";!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"}(gn||(gn={}));var zn=((pn={})[gn.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],pn[gn.RtcUserListOutput]=["users","token","sessionId","roomInfo"],pn[gn.SetUserStatusInput]=["status"],pn[gn.RtcSetDataInput]=["interior","target","key","value","objectName","content"],pn[gn.RtcUserSetDataInput]=["valueInfo","objectName","content"],pn[gn.RtcDataInput]=["interior","target","key","objectName","content"],pn[gn.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],pn[gn.MCFollowInput]=["state"],pn[gn.RtcTokenOutput]=["rtcToken"],pn[gn.RtcQryOutput]=["outInfo"],pn[gn.RtcQryUserOutDataInput]=["userId"],pn[gn.RtcUserOutDataOutput]=["user"],pn[gn.RtcQueryListInput]=["order"],pn[gn.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],pn[gn.RtcValueInfo]=["key","value"],pn[gn.RtcKeyDeleteInput]=["key"],pn[gn.RtcNotifyMsg]=["type","time","roomId"],pn[gn.RtcPullKV]=["timestamp","roomId"],pn[gn.RtcKVOutput]=["entries","bFullUpdate","syncTime"],pn[gn.RtcQueryUserJoinedInput]=["userId"],pn[gn.RtcQueryUserJoinedOutput]=["info"],pn[gn.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],pn[gn.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],pn[gn.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],pn[gn.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],pn),$n="\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(gn.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(gn.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(gn.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(gn.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(gn.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(gn.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(gn.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(gn.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(gn.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(gn.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(gn.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(gn.RtcQryOutput,"{\n repeated ").concat(gn.RtcValueInfo," outInfo=1;\n }\n message ").concat(gn.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(gn.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(gn.RtcUserSetDataInput," {\n repeated ").concat(gn.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(gn.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(gn.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(gn.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(gn.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(gn.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(gn.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(gn.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(gn.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(gn.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(gn.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(gn.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(gn.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(gn.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(gn.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(gn.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(gn.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"),ei=function(){function e(e,t,n,i,r,o){this.runtime=e,this.rtcCodec=t,this._watcher=n,this._options=i,this.logger=r,this.statisticLog=o,this._appkey=this._options.appkey,this._rtcKVManager=new Ln(this)}return e.prototype.registerRTCSignalingListener=function(e){this._rtcSignalingListener=e},e.prototype.getInnerLogger=function(){return this.logger},e.prototype.getInnerStatisticLog=function(){return this.statisticLog},e.prototype.pullRTCRoomEntry=function(e,t){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode(gn.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,Yn,!0,t)];case 1:return n=u.sent(),i=n.code,r=n.buffer,i!==$.SUCCESS?[2,{code:i}]:(o=this.rtcCodec.decode(gn.RtcKVOutput,r),s=o.entries,a=o.syncTime,s=(s||[]).map((function(e){return c(c({},e),{timestamp:zt(e.timestamp)})})),this._watcher.onRTCDataChange(s,e),[2,{code:i,data:{kvEntries:s,syncTime:zt(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(gn.RtcNotifyMsg,e),n=t.time,i=t.type,r=t.roomId;1===i&&this._rtcKVManager.pullEntry(r,zt(n))}},e.prototype.destroy=function(){},e}();function ti(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,i,o;return t?(o=(e>>>=0)>=0&&e<256)&&(i=c[e])?i:(n=r(e,(0|e)<0?-1:0,!0),o&&(c[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(i=a[e])?i:(n=r(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function i(e,t){if(isNaN(e)||!isFinite(e))return t?f:g;if(t){if(e<0)return f;if(e>=h)return C}else{if(-d>=e)return m;if(e+1>=d)return T}return e<0?i(-e,t).neg():r(0|e%l,0|e/l,t)}function r(t,n,i){return new e(t,n,i)}function o(e,t,n){var r,s,a,c,l,h,d;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((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(e.substring(1),t,n).neg();for(s=i(u(n,8)),a=g,c=0;c<e.length;c+=8)l=Math.min(8,e.length-c),h=parseInt(e.substring(c,c+l),n),l<8?(d=i(u(n,l)),a=a.mul(d).add(i(h))):a=(a=a.mul(s)).add(i(h));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?i(t):"string"==typeof t?o(t):r(t.low,t.high,t.unsigned)}var a,c,u,l,h,d,p,g,f,_,E,v,T,C,m,y;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},c={},e.fromInt=n,e.fromNumber=i,e.fromBits=r,u=Math.pow,e.fromString=o,e.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),e.ZERO=g,f=n(0,!0),e.UZERO=f,_=n(1),e.ONE=_,E=n(1,!0),e.UONE=E,v=n(-1),e.NEG_ONE=v,T=r(-1,2147483647,!1),e.MAX_VALUE=T,C=r(-1,-1,!0),e.MAX_UNSIGNED_VALUE=C,m=r(0,-2147483648,!1),e.MIN_VALUE=m,(y=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},y.toString=function(e){var t,n,r,o,s,a,c,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(m)?(t=i(e),r=(n=this.div(t)).mul(t).sub(this),n.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(o=i(u(e,6),this.unsigned),s=this,a="";;){if(c=s.div(o),l=(s.sub(c.mul(o)).toInt()>>>0).toString(e),(s=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.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&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},y.isZero=function(){return 0===this.high&&0===this.low},y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.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)},y.eq=y.equals,y.notEquals=function(e){return!this.eq(e)},y.neq=y.notEquals,y.lessThan=function(e){return this.comp(e)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(e){return this.comp(e)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(e){return this.comp(e)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(e){return this.comp(e)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),i=e.isNegative();return n&&!i?-1:!n&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(m)?m:this.not().add(_)},y.neg=y.negate,y.add=function(e){var n,i,o,a,c,u,l,h,d,p,g;return t(e)||(e=s(e)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,c=e.high>>>16,u=65535&e.high,l=e.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&e.low))>>>16,d+=(p+=o+l)>>>16,h+=(d+=i+u)>>>16,h+=n+c,r((p&=65535)<<16|(g&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},y.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},y.sub=y.subtract,y.multiply=function(e){var n,o,a,c,u,l,h,d,f,_,E,v;return this.isZero()?g:(t(e)||(e=s(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(p)&&e.lt(p)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,f=0,_=0,E=0,v=0,E+=(v+=c*(d=65535&e.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=c*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=c*l)>>>16,f+=n*d+o*h+a*l+c*u,r((E&=65535)<<16|(v&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},y.mul=y.multiply,y.divide=function(e){var n,r,o,a,c,l,h;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:g;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(m))return e.eq(_)||e.eq(v)?m:e.eq(m)?_:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?_:v:(r=this.sub(e.mul(n)),o=n.add(r.div(e)));if(e.eq(m))return this.unsigned?f:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=g}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),h=(l=i(n)).mul(e);h.isNegative()||h.gt(r);)h=(l=i(n-=c,this.unsigned)).mul(e);l.isZero()&&(l=_),o=o.add(l),r=r.sub(h)}return o},y.div=y.divide,y.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},y.mod=y.modulo,y.not=function(){return r(~this.low,~this.high,this.unsigned)},y.and=function(e){return t(e)||(e=s(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},y.or=function(e){return t(e)||(e=s(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},y.xor=function(e){return t(e)||(e=s(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},y.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):r(0,this.low<<e-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):r(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0===(e&=63)?this:(n=this.high,e<32?r(this.low>>>e|n<<32-e,n>>>e,this.unsigned):r(32===e?n:n>>>e-32,0,this.unsigned))},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},y.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},y.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]},y.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 i(e,t,n,i,r){var o,s,a=8*r-i-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?r-1:0,d=n?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=u}return(p?-1:1)*s*Math.pow(2,o-i)}function r(e,t,n,i,r,o){var s,a,c,u=8*o-r-1,l=(1<<u)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,g=i?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*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,r),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;e[n+p]=255&a,p+=g,a/=256,r-=8);for(s=s<<r|a,u+=r;u>0;e[n+p]=255&s,p+=g,s/=256,u-=8);e[n+p-g]|=128*f}var o,s,a,c,u,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,i){var r,o,s,a,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(i=n,n=t,t=void 0),r=0,s=0,a=e.length;a>s;++s)l.isByteBuffer(e[s])||(e[s]=l.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(r+=o);if(0===r)return new l(0,n,i);for(u=new l(r,n,i),s=0;a>s;)(o=(c=e[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,i){var r,s;if("string"!=typeof t&&(i=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return 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(r=o.clone.call(e)).markedOffset=-1,r;if(e instanceof Uint8Array)r=new l(0,n,i),e.length>0&&(r.buffer=e.buffer,r.offset=e.byteOffset,r.limit=e.byteOffset+e.byteLength,r.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)r=new l(0,n,i),e.byteLength>0&&(r.buffer=e,r.offset=0,r.limit=e.byteLength,r.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((r=new l(e.length,n,i)).limit=e.length,s=0;s<e.length;++s)r.view[s]=e[s]}return r},o.writeBitSet=function(e,t){var n,i,r,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(i=t,o=(r=e.length)>>3,s=0,t+=this.writeVarint32(r,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(r>s){for(a=0,n=0;r>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return c?(this.offset=t,this):t-i},o.readBitSet=function(e){var t,n,i,r,o,s,a,c=void 0===e;for(c&&(e=this.offset),r=(i=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;r--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(i>o)for(a=0,t=this.readByte(e++);i>o;)s[o++]=!!(1&t>>a++);return c&&(this.offset=e),s},o.readBytes=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),i&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),i&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),i&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),i&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),i&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!1),o&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!0),o&&(this.offset+=8),r},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,r(this.view,e,t,this.littleEndian,23,4),i&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=i(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,r(this.view,e,t,this.littleEndian,52,8),i&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=i(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=i=l.calculateVarint32(e))>(r=this.buffer.byteLength)&&this.resize((r*=2)>t?r:t),t-=i,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):i},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,i=0;do{if(!this.noAssert&&e>this.limit)throw(r=Error("Truncated")).truncated=!0,r;t=this.view[e++],n<5&&(i|=(127&t)<<7*n),++n}while(0!=(128&t));return i|=0,o?(this.offset=e,i):{value:i,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=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,i=t.shiftRightUnsigned(28).toInt()>>>0,r=t.shiftRightUnsigned(56).toInt()>>>0;return 0==r?0==i?n<16384?n<128?1:2:1<<21>n?3:4:i<16384?i<128?5:6:1<<21>i?7:8:r<128?9:10},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 i,r,o,s,a,c=void 0===n;if(c&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),i=l.calculateVarint64(t),r=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=i)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=i,i){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==i?128|s:127&s;case 8:this.view[n+7]=8!==i?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==i?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==i?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==i?128|o:127&o;case 4:this.view[n+3]=4!==i?128|r>>>21:127&r>>>21;case 3:this.view[n+2]=3!==i?128|r>>>14:127&r>>>14;case 2:this.view[n+1]=2!==i?128|r>>>7:127&r>>>7;case 1:this.view[n]=1!==i?128|r:127&r}return c?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,i,r,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,i=0,r=0,o=0,s=0,i=127&(s=this.view[t++]),128&s&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(r=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(i|r<<28,r>>>4|o<<24,!1),c?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),r=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;r>i;++i)if(0===e.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=u.calculateUTF16asUTF8(t(e))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):r},o.readCString=function(e){var t,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,r=-1,u.decodeUTF8toUTF16(function(){if(0===r)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(r=this.view[e++])?null:r}.bind(this),i=n(),!0),o?(this.offset=e,i()):{string:i(),length:e-t}},o.writeIString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(r=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+i,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i):(this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),n+=4,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==r+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return s?(this.offset=n,this):n-r},o.readIString=function(e){var t,n,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),i=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=n,i=u.calculateUTF16asUTF8(t(e))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-r},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(e,t,i){var r,o,s,a,c;if("number"==typeof t&&(i=t,t=void 0),(r=void 0===i)&&(i=this.offset),void 0===t&&(t=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 i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=i,t===l.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++s,u.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return r?(this.offset=i,o()):{string:o(),length:i-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}if(c=i+e,u.decodeUTF8toUTF16(function(){return c>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==c)throw RangeError("Illegal range: Truncated data, "+i+" == "+c);return r?(this.offset=i,o()):{string:o(),length:i-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var i,r,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],r=l.calculateVarint32(i),n+=r+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+i,n+=this.writeVarint32(i,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,i,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),i=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},o.append=function(e,t,n){var i,r,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(r=e.limit-e.offset)<=0||((n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=r,i&&(this.offset+=r)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new 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,i,r;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0===(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(i=new ArrayBuffer(n),(r=new Uint8Array(i)).set(this.view.subarray(e,t)),this.buffer=i,this.view=r,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new l(0,this.littleEndian,this.noAssert);var n=t-e,i=new l(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=e),this.copyTo(i,0,e,t),i},o.copyTo=function(e,t,n,i){var r,o,s;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(r=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=i-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,i),t),r&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var i=void 0===t;if(i&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return i&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var i,r,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(r=e.limit-e.offset)<=0||((o=r-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-r),e.offset=e.limit,i&&(this.offset-=r)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,i=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal limit: Not an integer");if(i>>>=0,n<0||n>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+i+" <= "+this.buffer.byteLength)}return e||0!==n||i!==this.buffer.byteLength?n===i?s:(t=new ArrayBuffer(i-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,i),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},c=function(){var e,t,n={},i=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[];for(e=0,t=i.length;t>e;++e)r[i[e]]=e;return n.encode=function(e,t){for(var n,r;null!==(n=e());)t(i[63&n>>2]),r=(3&n)<<4,null!==(n=e())?(t(i[63&((r|=15&n>>4)|15&n>>4)]),r=(15&n)<<2,null!==(n=e())?(t(i[63&(r|3&n>>6)]),t(i[63&n])):(t(i[63&r]),t(61))):(t(i[63&r]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var i,o,s;null!==(i=e());)if(void 0===(o=r[i])&&n(i),null!==(i=e())&&(void 0===(s=r[i])&&n(i),t(o<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(o=r[i])){if(61===i)break;n(i)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(i=e())){if(void 0===(s=r[i])){if(61===i)break;n(i)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var i;return c.encode(function(){return t>e?this.view[e++]:null}.bind(this),i=n()),i()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var i=new l(e.length/4*3,n),r=0;return c.decode(t(e),(function(e){i.view[r++]=e})),i.limit=r,i},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=[],i=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(i.push(String.fromCharCode.apply(String,n)),n=[]);return i.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,i=0,r=e.length,o=new l(r,t);r>i;){if((n=e.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);o.view[i++]=n}return o.limit=r,o},o.toDebug=function(e){for(var t,n=-1,i=this.buffer.byteLength,r="",o="",s="";i>n;){if(-1!==n&&(r+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";s+=r+o+"\n",r=o=""}r+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==i?" ":""}if(e&&" "!==r){for(;r.length<51;)r+=" ";s+=r+o+"\n"}return e?s:r},l.fromDebug=function(e,t,n){for(var i,r,o=e.length,s=new l(0|(o+1)/3,t,n),a=0,c=0,u=!1,h=!1,d=!1,p=!1,g=!1;o>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}s.offset=c,u=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}s.limit=c,u=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){g=!0;break}if(r=parseInt(i+e.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=r,u=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,i=new Array(t-e);t>e;)(n=this.view[e++])<16?i.push("0",n.toString(16)):i.push(n.toString(16));return i.join("")},l.fromHex=function(e,t,n){var i,r,o,s,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(r=e.length,o=new l(0|r/2,t),s=0,a=0;r>s;s+=2){if(i=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=i}return o.limit=a,o},u=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,i,r,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(i=e())&&s([n,i]),t((31&n)<<6|63&i);else if(224==(240&n))(null===(i=e())||null===(r=e()))&&s([n,i,r]),t((15&n)<<12|(63&i)<<6|63&r);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(i=e())||null===(r=e())||null===(o=e()))&&s([n,i,r,o]),t((7&n)<<18|(63&i)<<12|(63&r)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,i=null;null!==(n=null!==i?i:e());)n>=55296&&n<=57343&&null!==(i=e())&&i>=56320&&i<=57343?(t(1024*(n-55296)+i-56320+65536),i=null):t(n);null!==i&&t(i)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,i=0;return e.UTF16toUTF8(t,(function(e){++n,i+=e<128?1:e<2048?2:e<65536?3:4})),[n,i]}};return e}(),o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var i;try{u.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),i=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return i()},l.fromUTF8=function(e,n,i){if(!i&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var r=new l(u.calculateUTF16asUTF8(t(e),!0)[1],n,i),o=0;return u.encodeUTF16toUTF8(t(e),(function(e){r.view[o++]=e})),r.limit=o,r},l}(t),i=function(t,n){var i,r,o={};return o.ByteBuffer=t,o.c=t,i=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 i=e.XHR();if(i.open("GET",t,!!n),i.setRequestHeader("Accept","text/plain"),"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/plain"),!n)return i.send(null),200==i.status||0==i.status&&"string"==typeof i.responseText?i.responseText:null;if(i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0==i.status&&"string"==typeof i.responseText?n(i.responseText):n(null))},4==i.readyState)return;i.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),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 i=-1,r=1;if("-"==e.charAt(0)&&(r=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))i=parseInt(e);else if(t.NUMBER_HEX.test(e))i=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(r<0?"-":"")+e);i=parseInt(e.substring(1),8)}if(i=0|r*i,!n&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+e);return i}function i(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function r(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},c=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},u.next=function(){var e,n,i,r,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(i=this.source.charAt(this.index));)if("\n"===i&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(i=this.source.charAt(this.index)))return"/";do{if("\n"===i&&++this.line,++this.index===this.source.length)return null;n=i,i=this.source.charAt(this.index)}while("*"!==n||"/"!==i);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(r=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(r++)))for(;r<this.source.length&&!t.DELIM.test(this.source.charAt(r));)++r;return('"'===(o=this.source.substring(this.index,this.index=r))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},u.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},u.omit=function(e){return this.peek()===e&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,o=function(e){this.tn=new c(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),i=!1;break;case"enum":this._parseEnum(n),i=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return i(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var i,r=this.tn.next(),o=!1;if("("===r&&(o=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,o&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,i),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var i=this.tn.peek();if("{"!==i)r(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!t.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(e.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(e,n+"."+i)}},s._parseService=function(e){var n,i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);for(n={name:i,rpc:{},options:{}},this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(n);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,i,r="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(i.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.response_stream=!0,o=this.tn.next()),i.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[r]&&(e[r]={}),e[r][n]=i},s._parseMessage=function(e,i){var r=!!i,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(r?"group":"message")+" name: "+o);for(s.name=o,r&&(this.tn.skip("="),i.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,i,r){var o,s,a;if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);if(o={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(r)&&!t.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(o.type=r,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,i,r,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(i=o,r=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=i,r.push(n.id);this.tn.omit(";"),e.oneofs[i]=r},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var i,r={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(r.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(r);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),i={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),e.enums.push(r)},s._parseExtensionRanges=function(){var t,n,r,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":r=e.ID_MIN;break;case"max":r=e.ID_MAX;break;default:r=i(t)}if(n.push(r),2===n.length)break;if("to"!==this.tn.peek()){n.push(r);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);for(n={ref:i,fields:[]},this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(n,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(n,"optional",i)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(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 r(t,n){var i=n.readVarint32(),o=7&i,s=i>>>3;switch(o){case e.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(128==(128&i));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:i=n.readVarint32(),n.offset+=i;break;case e.WIRE_TYPES.STARTGROUP:r(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,c,u,l,h,d,p,g,f,_,E,v,T,C,m={},y=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},I=y.prototype;return I.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},I.toString=function(e){return(e?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},m.T=y,o=function(e,t,n,i,r){y.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(y.prototype)).getChildren=function(e){var t,n,i;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,i=this.children.length;i>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,i="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][i]===e)return this.children[t];return null},s.resolve=function(e,t){var n,i="string"==typeof e?e.split("."):e,r=this,o=0;if(""===i[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof m.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof m.T&&(!t||n instanceof m.Namespace))){r=null;break}r=n,o++}while(o<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},s.qn=function(e){var t,n,i=[],r=e;do{i.unshift(r.name),r=r.parent}while(null!==r);for(t=1;t<=i.length;t++)if(n=i.slice(i.length-t),e===this.resolve(n,e instanceof m.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,i={},r=this.children;for(t=0,n=r.length;n>t;++t)(e=r[t])instanceof o&&(i[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},s.buildOpt=function(){var e,t,n,i,r={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],i=this.options[o[e]],r[n]=i;return r},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},m.Namespace=o,a=function(t,n,i,r){if(this.type=t,this.resolvedType=n,this.isMapKey=i,this.syntax=r,i&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},c=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 i(0):t.defaultValue},c.verifyValue=function(i){var r,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i>4294967295?0|i:i;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i<0?i>>>0:i;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(i,!1)}catch(e){a(typeof i,e.message)}else a(typeof i,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(i,!0)}catch(e){a(typeof i,e.message)}else a(typeof i,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof i&&a(typeof i,"not a boolean"),i;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof i&&a(typeof i,"not a number"),i;case e.TYPES.string:return"string"==typeof i||i&&i instanceof String||a(typeof i,"not a string"),""+i;case e.TYPES.bytes:return t.isByteBuffer(i)?i:t.wrap(i);case e.TYPES.enum:for(r=this.resolvedType.getChildren(e.Reflect.Enum.Value),s=0;s<r.length;s++){if(r[s].name==i)return r[s].id;if(r[s].id==i)return r[s].id}if("proto3"===this.syntax)return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),(i>4294967295||i<0)&&a(typeof i,"not in range for uint32"),i;a(i,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(i&&"object"==typeof i||a(typeof i,"object expected"),i instanceof this.resolvedType.clazz)return i;if(i instanceof e.Builder.Message){for(s in o={},i)i.hasOwnProperty(s)&&(o[s]=i[s]);i=o}return new this.resolvedType.clazz(i)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+i+" (undefined type "+this.type+")")},c.calculateLength=function(t,n){if(null===n)return 0;var r;switch(this.type){case e.TYPES.int32:return n<0?i.calculateVarint64(n):i.calculateVarint32(n);case e.TYPES.uint32:return i.calculateVarint32(n);case e.TYPES.sint32:return i.calculateVarint32(i.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 i.calculateVarint64(n);case e.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return i.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return r=i.calculateUTF8Bytes(n),i.calculateVarint32(r)+r;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return i.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return r=this.resolvedType.calculate(n),i.calculateVarint32(r)+r;case e.TYPES.group:return(r=this.resolvedType.calculate(n))+i.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},c.encodeValue=function(t,n,r){var o,s;if(null===n)return r;switch(this.type){case e.TYPES.int32:n<0?r.writeVarint64(n):r.writeVarint32(n);break;case e.TYPES.uint32:r.writeVarint32(n);break;case e.TYPES.sint32:r.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:r.writeUint32(n);break;case e.TYPES.sfixed32:r.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:r.writeVarint64(n);break;case e.TYPES.sint64:r.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:r.writeUint64(n);break;case e.TYPES.sfixed64:r.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?r.writeVarint32("false"===n.toLowerCase()?0:!!n):r.writeVarint32(n?1:0);break;case e.TYPES.enum:r.writeVarint32(n);break;case e.TYPES.float:r.writeFloat32(n);break;case e.TYPES.double:r.writeFloat64(n);break;case e.TYPES.string:r.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,r.writeVarint32(n.remaining()),r.append(n),n.offset=o;break;case e.TYPES.message:s=(new i).LE(),this.resolvedType.encode(n,s),r.writeVarint32(s.offset),r.append(s.flip());break;case e.TYPES.group:this.resolvedType.encode(n,r),r.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return r},c.decode=function(t,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,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(r=t.clone()).limit=r.offset+o,t.offset+=o,r;case e.TYPES.message:return o=t.readVarint32(),this.resolvedType.decode(t,o);case e.TYPES.group:return this.resolvedType.decode(t,-1,i)}throw Error("[INTERNAL] Illegal decode type")},c.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 i.fromBinary(t)}},c.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,i,r,s){o.call(this,e,t,n,i,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!r,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=u.prototype=Object.create(o.prototype)).build=function(n){var r,o,s,a;if(this.clazz&&!n)return this.clazz;for(r=function(e,n){function r(t,n,o,s){var a,c,u,l,h,d,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(i.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 c=[],t.forEach((function(e,t){c[t]=r(e,n,o,s)})),c;if(c={},t instanceof e.Map){for(l=(u=t.entries()).next();!l.done;l=u.next())c[t.keyElem.valueToString(l.value[0])]=r(l.value[1],n,o,t.valueElem.resolvedType);return c}for(p in h=t.$type,d=void 0,t)t.hasOwnProperty(p)&&(c[p]=h&&(d=h.getChild(p))?r(t[p],n,o,d.resolvedType):r(t[p],n,o));return c}var o,s,a=n.getChildren(e.Reflect.Message.Field),c=n.getChildren(e.Reflect.Message.OneOf),u=function(t){var r,o,s,l;for(e.Builder.Message.call(this),r=0,o=c.length;o>r;++r)this[c[r].name]=null;for(r=0,o=a.length;o>r;++r)this[(s=a[r]).name]=s.repeated?[]:s.map?new 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 u)||Array.isArray(t)||t instanceof e.Map||i.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(r=0,o=arguments.length;o>r;++r)void 0!==(l=arguments[r])&&this.$set(a[r].name,l);else this.$set(t)},l=u.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,i,r){var o=n._fieldsByName[t];if(!r){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");i=o.verifyValue(i,!0)}return null===this[t]&&(this[t]=[]),this[t].push(i),this},l.$add=l.add,l.set=function(t,i,r){var o,s,a;if(t&&"object"==typeof t){for(o in r=i,t)t.hasOwnProperty(o)&&void 0!==(i=t[o])&&this.$set(o,i,r);return this}if(s=n._fieldsByName[t],r)this[t]=i;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]=i=s.verifyValue(i)}return s&&s.oneof&&(a=this[s.oneof.name],null!==i?(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,i){if(i)return this[t];var r=n._fieldsByName[t];if(!(r&&r instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(r instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+r.toString(!0));return this[r.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,i,r,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),i=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},r=function(){return this[e.name]},null===n.getChild("set"+o)&&(l["set"+o]=i),null===n.getChild("set_"+t)&&(l["set_"+t]=i),null===n.getChild("get"+o)&&(l["get"+o]=r),null===n.getChild("get_"+t)&&(l["get_"+t]=r)}(s);return l.encode=function(e,i){var r,o;"boolean"==typeof e&&(i=e,e=void 0),r=!1,e||(e=new t,r=!0),o=e.littleEndian;try{return n.encode(this,e.LE(),i),(r?e.flip():e).LE(o)}catch(t){throw e.LE(o),t}},u.encode=function(e,t,n){return new u(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,r=!1;return e||(e=new i,r=!0),t=(new i).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),r?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 r(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},u.decode=function(e,t){var r,o;"string"==typeof e&&(e=i.wrap(e,t||"base64")),r=(e=i.isByteBuffer(e)?e:i.wrap(e)).littleEndian;try{return o=n.decode(e.LE()),e.LE(r),o}catch(t){throw e.LE(r),t}},u.decodeDelimited=function(e,t){var r,o,s;if("string"==typeof e&&(e=i.wrap(e,t||"base64")),(e=i.isByteBuffer(e)?e:i.wrap(e)).remaining()<1)return null;if(r=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=r,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}},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))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),u}(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 u||o instanceof v){if(r.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");r[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},l.encode=function(e,t,n){var i,r,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)r=e[(i=this._fields[o]).name],i.required&&null===r?null===c&&(c=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,i=0,r=0,o=this._fields.length;o>r;++r){if(n=e[(t=this._fields[r]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);i+=t.calculate(n,e)}return i},l.decode=function(t,n,i){var o,s,a,c,u,l,h,d,p,g,f,_;for(n="number"==typeof n?n:-1,u=t.offset,l=new this.clazz;t.offset<u+n||-1===n&&t.remaining()>0;){if(a=(o=t.readVarint32())>>>3,(s=7&o)===e.WIRE_TYPES.ENDGROUP){if(a!==i)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(i?i+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?l[c.name].push(c.decode(s,t)):c.map?(d=c.decode(s,t),l[c.name].set(d[0],d[1])):(l[c.name]=c.decode(s,t),c.oneof&&(null!==(p=l[c.oneof.name])&&p!==c.name&&(l[p]=null),l[c.oneof.name]=c.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:h=t.readVarint32(),t.offset+=h;break;case e.WIRE_TYPES.STARTGROUP:for(;r(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(g=0,f=this._fields.length;f>g;++g)if(null===l[(c=this._fields[g]).name])if("proto3"===this.syntax)l[c.name]=c.defaultValue;else{if(c.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=l,_;e.populateDefaults&&null!==c.defaultValue&&(l[c.name]=c.defaultValue)}return l},m.Message=u,h=function(t,n,i,r,o,s,a,c,l,h){y.call(this,t,n,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"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))},(d=h.prototype=Object.create(y.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},d.verifyValue=function(t,n){var i,r,o;if(n=n||!1,i=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===t)return this.required&&i(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&i(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),o=[],r=0;r<t.length;r++)o.push(this.element.verifyValue(t[r]));return o}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||i(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&i(typeof t,"no array expected"),this.element.verifyValue(t))},d.hasWirePresence=function(t,n){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},d.encode=function(t,n,r){var o,s,a,c,u;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===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,(c=i.calculateVarint32(a))>1&&(u=n.slice(s,n.offset),s+=c-1,n.offset=s,n.append(u)),n.writeVarint32(a,s-c)}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,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.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,r,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,r)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},d.calculate=function(t,n){var r,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;r=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s=0,o=0;o<t.length;o++)s+=this.element.calculateLength(this.id,t[o]);r+=i.calculateVarint32(s),r+=s}else for(o=0;o<t.length;o++)r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t[o]);else this.map?t.forEach((function(t,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);r+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r+=i.calculateVarint32(o),r+=o}),this):this.hasWirePresence(t,n)&&(r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return r},d.decode=function(t,n,i){var r,o,s,c,u,l,h;if(!(!this.map&&t==this.type.wireType||!i&&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&&!i){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(c=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(t=7&(l=u.readVarint32()),1===(h=l>>>3))c=this.keyElement.decode(u,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(u,t,h)}return[c,r]}return this.element.decode(n,t,this.id)},m.Message.Field=h,p=function(e,t,n,i,r,o,s){h.call(this,e,t,n,null,i,r,o,s),this.extension},p.prototype=Object.create(h.prototype),m.Message.ExtensionField=p,g=function(e,t,n){y.call(this,e,t,n),this.fields=[]},m.Message.OneOf=g,f=function(e,t,n,i,r){o.call(this,e,t,n,i,r),this.className="Enum",this.object=null},f.getName=function(e,t){var n,i,r=Object.keys(e);for(i=0;i<r.length;++i)if(e[n=r[i]]===t)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(t){var n,i,r,o;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,r=0,o=(i=this.getChildren(f.Value)).length;o>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},m.Enum=f,_=function(e,t,n,i){y.call(this,e,t,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(y.prototype),m.Enum.Value=_,E=function(e,t,n,i){y.call(this,e,t,n),this.field=i},E.prototype=Object.create(y.prototype),m.Extension=E,v=function(e,t,n,i){o.call(this,e,t,n,i),this.className="Service",this.clazz=null},(v.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,r=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=r.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(e){o[e.name]=function(n,r){try{try{n=e.resolvedRequestType.clazz.decode(i.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,i){if(!n){try{i=e.resolvedResponseType.clazz.decode(i)}catch(e){}return i&&i instanceof e.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+t.name+"#"+e.name))}r(n)}))}catch(e){setTimeout(r.bind(this,e),0)}},r[e.name]=function(t,n,i){new r(t)[e.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:r[e.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),r}(e,this)},m.Service=v,T=function(e,t,n,i){y.call(this,e,t,n),this.className="Service.Method",this.options=i||{}},(T.prototype=Object.create(y.prototype)).buildOpt=s.buildOpt,m.Service.Method=T,C=function(e,t,n,i,r,o,s,a){T.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},C.prototype=Object.create(T.prototype),m.Service.RPCMethod=C,m}(o),o.Builder=function(e,t,n){function i(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,i(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var r=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=r.prototype;return r.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},r.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},r.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},r.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},r.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var i,o,s,a,c;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(i=[t];i.length>0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),r.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),c=[],o.enums&&o.enums.forEach((function(e){c.push(e)})),o.messages&&o.messages.forEach((function(e){c.push(e)})),o.services&&o.services.forEach((function(e){c.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){i.push(t),t=c,c=null,this.ptr=s,s=null;continue}c=null}else if(r.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(r.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!r.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var i,r,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(i=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");r=t.name,this.options.convertFieldsToCamelCase&&(r=e.Util.toCamelCase(r)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+r,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var r,o,s,a,c,u,l,h,d="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(r=n.root,e.Util.IS_NODE,(r.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=r+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[c]))continue;if(u=s+d+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(l+""),u):this.import(e.DotProto.Parser.parse(l),u)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+c+"."+n}))):this.import(t.imports[c],n+"_import"+c):this.import(t.imports[c]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&i(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var i;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(i=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=i,i instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==i.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(i instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=i.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((i=this.ptr.parent.resolve(this.ptr.requestName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=i,!((i=this.ptr.parent.resolve(this.ptr.responseName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,i;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,i=0;i<t.length;i++){if(!n[t[i]]){n=null;break}n=n[t[i]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(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 i=function(e,n){var i,r,o,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(i=Object.keys(n),r=0;r<i.length;r++)o=this.keyElem.valueFromString(i[r]),s=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},r.entries=function(){var e,t,i=[],r=Object.keys(this.map);for(t=0;t<r.length;t++)i.push([(e=this.map[r[t]]).key,e.value]);return n(i)},r.keys=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].key);return n(t)},r.values=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].value);return n(t)},r.forEach=function(e,t){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)e.call(t,(n=this.map[r[i]]).value,n.key,this)},r.set=function(e,t){var n=this.keyElem.verifyValue(e),i=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},r.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,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(i){if(null!==i)try{t(null,o.loadProto(i,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:o.loadProto(i,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(i){if(null!==i)try{t(null,o.loadJson(JSON.parse(i),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:o.loadJson(JSON.parse(i),n,e)},r=e,o.loadProto(r,void 0,"").build("Modules").probuf}(n,t);return i}var ni,ii,ri=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=ti(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 i=e.slice(t,n);return e.replace(i,(function(e){return e.toUpperCase()}))}(e,0,1))](n)}))}catch(t){var r="pbname: ".concat(e,", stack: ").concat(t.stack);this.logger?this.logger.error(_e.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(_e.L_PB_ENCODE_E,r)}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(!ht(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){var n=e.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var i in e)e[i]=this.fixInt64Values(e[i]);return e},e}();!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"}(ii||(ii={}));var oi=((ni={})[ii.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:Pe.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnJvbmctZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},ni[ii.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1saWdodC1lZGdlLmNvbQ==",protocol:Pe.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},ni[ii.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi51cy1saWdodC1lZGdlLmNvbQ==",protocol:Pe.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnVzLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},ni[ii.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:Pe.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctYi1saWdodC1lZGdlLmNvbQ==","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWItbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},ni[ii.SA]={naviUrlBase64:["bmF2LnNhdS1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zYXUtbGlnaHQtZWRnZS5jb20=",protocol:Pe.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2F1LWxpZ2h0LWVkZ2UuY29t","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNhdS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]},ni);function si(e){return ii[e]?e:ii.BJ}var ai=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e,t){var n,i=this.initOption||{},r=i.areaCode,o=i.navigators,s=(n=r,void 0===n&&(n=ii.BJ),oi[si(n)].naviUrlBase64).map((function(e){return jt(e)})),a=[],c=e.split("@")[1];t&&(a=c?c.split(";"):[]);var u=o&&o.length>0?h(h([],a,!0),o,!0):h(h([],a,!0),s,!0);return u.filter((function(e,t){return u.indexOf(e)===t})).map((function(e){return un(e)}))},e.prototype.getLogUrlPolicyList=function(e,t){var n,i=e||{},r=i.log,o=i.logPolicy,s=this.initOption||{},a=s.areaCode,u=s.logServerUrl,l=(n=a,void 0===n&&(n=ii.BJ),oi[si(n)].logUrlBase64).map((function(e){return c(c({},e),{addr:jt(e.addr)})})),d=[],p={level:1,itv:6,times:5};if(r)d.push.apply(d,r.addrs),Object.assign(p,r.policy);else if(o)try{var g=JSON.parse(o);d.push({addr:g.url,protocol:Pe.HTTPS,weight:1}),p.level=g.level,p.itv=g.itv,p.times=g.times}catch(n){t.warn(_e.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var f=u?h([{addr:u,protocol:Pe.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:p,addrs:f.filter((function(e,t){return f.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return c(c({},e),{addr:un(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=ii.BJ),oi[si(t)].miniCmpBase64).map((function(e){return jt(e)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i: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=ii.BJ),oi[si(t)].staticConfigUrlBase64).map((function(e){return jt(e)}))},e.prototype.getCloudControllerUrl=function(e){var t,n,i=null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode;return(n=i,void 0===n&&(n=ii.BJ),oi[si(n)].cloudControllerUrlBase64).map((function(e){return jt(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:ii.BJ},e.prototype.setAreaCode=function(e){return!(!e||!ii[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)},e}(),ci=new ai,ui=function(){function e(e,t){this.appkey=e,this.logger=t,this.staticUrls=[]}return e.prototype.getStaticConfig=function(){var e;return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:if(!(t=this.getCache()))return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),n=JSON.parse(t),Date.now()-(null==n?void 0:n.time)<K?[4,this.decryptData(n.val)]:[3,3];case 2:return i=u.sent(),(r=i.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:r.map((function(e){return un(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return o=u.sent(),this.logger.error(_e.L_GET_STATIC_CONF_E,JSON.stringify({error:null==o?void 0:o.stack})),[3,5];case 5:this.clearCache(),u.label=6;case 6:return[4,this._requestHandle()];case 7:return(s=u.sent())?[4,this.decryptData(s)]:[2];case 8:return(null==(a=u.sent())?void 0:a.areaCode)!==ci.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:s})),this.staticUrls=(null==a?void 0:a.bootstrap)||[],(c=null===(e=null==a?void 0:a.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:c.map((function(e){return un(e.addr,e.protocol)}))||[]}])}}))}))},e.prototype._requestHandle=function(){return u(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:e=(e=h(h([],this.staticUrls,!0),ci.getStaticConfigUrl(),!0).map((function(e){return un(e)}))).filter((function(t,n){return e.indexOf(t)===n})),t=0,n=e,c.label=1;case 1:return t<n.length?(i=n[t],this.logger.info(_e.L_GET_STATIC_CONF_T,JSON.stringify({url:i})),r=Date.now(),[4,this.sendRequest("".concat(i,"/").concat(this.appkey))]):[3,4];case 2:if(o=c.sent(),s=o.code,a=o.data,200===s)return this.logger.info(_e.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),[2,a];this.logger.warn(_e.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),c.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},e}(),li=Mt(),hi=Date.now(),di=null,pi="RC_LOGS",gi="RC_CONF",fi=null,_i=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,di];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(pi,"readwrite").objectStore(pi),r=IDBKeyRange.lowerBound(Date.now()-e),o=i.getAllKeys(r);o.onsuccess=function(){var e=o.result,t=e.length;if(t>0){var r=i.delete(IDBKeyRange.bound(e[0],e[t-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),fi=setTimeout((function(){return _i(e)}),6e5),[2]}}))}))},Ei=function(e,t,n,i){void 0===i&&(i=168),di||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==yn(n).type?di=new Promise((function(n){var r=window.indexedDB;r.databases&&r.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(e),s=r.open(o,1);s.onerror=function(e){t.error(_e.L_LOGDB_OPEN_FAILED_E,e.target.error),n(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(e){t.warn(_e.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(_e.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(_e.L_LOGDB_ABORT_S,e.target.error)},_i(3600*Math.max(24,Math.min(168,i))*1e3),n({appkey:e,db:o})):n(null)},s.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(pi)&&t.deleteObjectStore(pi);var n=t.createObjectStore(pi,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(gi,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(_e.L_UNSUPPORT_INDEXDB_O))},vi=[],Ti=function(){return u(void 0,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return di?(fi&&(clearTimeout(fi),fi=null),[4,di]):[2];case 1:return(e=n.sent())&&(t=e.db,vi.push(t)),di=null,[2]}}))}))},Ci=[],mi=!1,yi=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return mi||0===Ci.length?[2]:(mi=!0,t=Ci.splice(0),[4,new Promise((function(n){var i=e.transaction(pi,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(pi);t.forEach((function(e){try{r.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),mi=!1,0===Ci.length&&vi.length>0&&(vi.forEach((function(e){return e.close()})),vi.length=0),setTimeout((function(){return yi(e)})),[2]}}))}))};function Ii(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,di];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(gi,"readonly").objectStore(gi).get(e);i.onsuccess=function(e){var t;n({value:null===(t=i.result)||void 0===t?void 0:t.value,success:!0})},i.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Ri,Si=0,Oi=function(){return{setTimestamp4RealtimeLog:function(e){Si=e},getTimestamp4RealtimeLog:function(){return Si},getLogs:function(e,t,n,i){return u(this,void 0,void 0,(function(){var r;return l(this,(function(o){switch(o.label){case 0:return[4,di];case 1:return(r=o.sent())?[2,new Promise((function(o){var s=r.db.transaction(pi,"readonly").objectStore(pi),a=[],c=IDBKeyRange.bound(e,t),u=s.index("time").openCursor(c);u.onsuccess=function(e){var t=e.target.result;if(t){var r=t.value;r.level<=n&&(i?r.sessionId===li:r.level>=0)&&a.push(r),t.continue()}else o({dbReady:!0,logs:a})},u.onerror=function(e){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ni="REPORT_SESSION",Mi=function(e,t){return u(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Ni,"_").concat(e),[4,Ii("".concat(Ni,"_").concat(e))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(t===(null==o?void 0:o.sessionId)||function(e,t){u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,di];case 1:return(n=r.sent())?(i=n.db,i.transaction(gi,"readwrite").objectStore(gi).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))};!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"}(Ri||(Ri={}));var Li=function(e){return[Ri.DEBUG,Ri.INFO,Ri.WARN,Ri.ERROR].some((function(t){return t===e}))},Ui=0,Ai=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=Ri.WARN,this.debug=this._log.bind(this,Ri.DEBUG),this.info=this._log.bind(this,Ri.INFO),this.warn=this._log.bind(this,Ri.WARN),this.error=this._log.bind(this,Ri.ERROR),this.__statistics=this._log.bind(this,Ri.STATISTICS)}return e.prototype._stdout=function(e,t,n,i,r){if(!(e<=Ri.FATAL)&&console&&!(e>this.outputLevel)){var o=["error","warn","info","debug"][e-1];null===console||void 0===console||console[o]("".concat(n,"[").concat(this._id,"][").concat(o.toUpperCase(),"]: ").concat(t," | ").concat(i," | ").concat(r))}},e.prototype.setOutputLevel=function(e){Li(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,i){var r=new Date;/^[\w-]+$/.test(t)?(this._stdout(e,t,r.toISOString(),n,i),e!==Ri.DEBUG&&this.flush({time:+r,sessionId:li,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})):this._stdout(Ri.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),t,i)},e.prototype.createTraceId=function(){return"".concat(++Ui)},e.prototype.getSessionId=function(){return li},e}(),bi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){!function(e){u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,di];case 1:return(t=n.sent())?(Ci.push(e),yi(t.db),[2]):[2]}}))}))}(e)},t}(Ai),wi=function(){function e(e,t,n,i,r){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=i,this.logger=r,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return u(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=ci.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this.logger.debug(_e.L_REALTIME_LOG_O,JSON.stringify({count:e.length}),t),r=i,[4,this.compressLogs(e)];case 1:return o=l.sent(),s=o.success,a=o.data,s||this.logger.warn(_e.L_REALTIME_LOG_O,"compress failed",t),this.logger.debug(_e.L_REALTIME_LOG_O,"compress done",t),c=ft(n)?n:"https://".concat(n),c+="?version=".concat("5.9.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:c,body:a,method:"POST"})];case 2:return u=l.sent().status,this.logger.debug(_e.L_REALTIME_LOG_R,JSON.stringify({status:u}),t),200===u?(this.reportFailedNumber=0,r=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(e[e.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++),[2,r]}}))}))},e.prototype.realtimeReport=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||hi,o=Math.max(i-5e3,r),s=this.logger.createTraceId(),this.logger.debug(_e.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:t,itv:n}),s),[4,this.logDB.getLogs(r,o,t,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(_e.L_REALTIME_LOG_R,"db error",s),[3,4]);case 2:return u.length>0?[4,this._sendLogs2Realtime(u,s,e,n)]:[3,4];case 3:h=l.sent(),n=h,l.label=4;case 4:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return d.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,o,s){return void 0===s&&(s=!1),u(this,void 0,void 0,(function(){var a,c,u,h,d,p,g,f,_,E;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(a=this.logger.createTraceId(),this.logger.info(_e.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:o,isCloudControl:s}),a),[4,this.logDB.getLogs(e,t,Ri.DEBUG,!1)]);case 1:return c=l.sent(),u=c.dbReady,h=c.logs,this.logger.info(_e.L_REPORT_FULL_LOG_O,JSON.stringify({count:h.length}),a),d=ft(i)?i:"https://".concat(i),d+="?version=".concat("5.9.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?h.length>0?[4,this.compressLogs(h)]:[3,3]:[3,5];case 2:return g=l.sent(),f=g.success,_=g.data,p=f?_:"compress failed",[3,4];case 3:p="no data",l.label=4;case 4:return[3,6];case 5:p="no database",l.label=6;case 6:return this.logger.debug(_e.L_REPORT_FULL_LOG_O,"compress done",a),s&&(d+="&source=cloud"),[4,this.send({url:d,body:p,method:"POST"})];case 7:return E=l.sent().status,this.logger.info(_e.L_REPORT_FULL_LOG_R,JSON.stringify({status:E}),a),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Pi=48,Di=64,Vi=80,Gi=96,Bi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ki=Bi.length,xi=function(e){for(var t={},n=0;n<e.length-1;n++){var i=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(i)?t[i].push(n):t[i]=[n]}for(var r=[],o=[],s=function(){if(o.length>0){var e=o.join("");if(o=[],e.length>26){var t=Hi(e.length),n=String.fromCharCode(Vi|t.length);r.push(n+t)}else{var i=String.fromCharCode(Gi|e.length);r.push(i)}r.push(e)}},a=0;a<e.length;){var c=Fi(t,e,a);if(c.length<2)o.push(e.charAt(a++));else if(c.length<4)o.push(e.substr(a,c.length)),a+=c.length;else{var u=Hi(a-c.offset),l=Hi(c.length);if(u.length+l.length>=c.length)o.push(e.substr(a,c.length)),a+=c.length;else{s();var h=String.fromCharCode(Di|u.length<<2|l.length);r.push(h+u+l),a+=c.length}}}s();var d=Hi(e.length),p=String.fromCharCode(Pi|d.length);return r.push(p+d),r.join("")},Fi=function(e,t,n){var i={length:0,offset:-1};if(t.length,n>=t.length-1)return i;var r=e[t.charAt(n)+t.charAt(n+1)];if(r[0]===n)return i;for(var o=t.length-n,s=0,a=r.length;s<a;s++){var c=r[s],u=n-c;if(!(u>238327)){var l=Math.min(o,u);if(l<=i.length)break;if(!(i.length>2&&t.charAt(c+i.length-1)!==t.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&t.charAt(c+d)===t.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=c)}}}return i},Hi=function(e){var t=[],n=0;do{n=e%ki,t.push(Bi.charAt(n)),e=(e-n)/ki}while(e>0);return t.join("")},qi=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Ki=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,o=e.time,s=e.tag,a=e.type,c=e.content,u=n<0?c||"":JSON.stringify({content:c,traceId:r,from:i});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},Yi=function(e){function t(t,n,i,r){var o=this,s=Lt(n),a=qi(n),c="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=e.call(this,t,s,c,Oi(),i)||this).runtime=n,o.clientReportLevel=r,Li(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Mi(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:xi(e.map(Ki).join(""))}]}))}))},t.prototype.isReporter=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),u(void 0,void 0,void 0,(function(){var e,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,Ii("".concat(Ni,"_").concat(t))];case 1:return e=o.sent(),i=e.success,r=e.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,i,r,o,s,a){return void 0===a&&(a=!1),u(this,void 0,void 0,(function(){var c;return l(this,(function(u){switch(u.label){case 0:return[4,this.isReporter()];case 1:return c=u.sent(),this.userId&&!c?[2]:[2,e.prototype.report.call(this,t,n,i,r,o,s,a)]}}))}))},t.prototype.realtimeReport=function(t,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(wi),ji=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(e,t,n){return void 0===t&&(t=Date.now()-ji),void 0===n&&(n=Date.now()),u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return t=t<0?Date.now()+t:t,(n=n<=0?Date.now():n)-t>ji&&(t=n-ji),(i=new bi(e,"RC-IM","IM")).debug(_e.T,"get logs: startTime ".concat(t," endTime ").concat(n)),Ei(e,i,{tag:"browser"}),[4,Oi().getLogs(t,n,Ri.DEBUG,!1)];case 1:return r=o.sent().logs,i.debug(_e.T,"get logs ".concat(r.length)),function(e,t){var n=t.map((function(e){var t=e.sessionId,n=e.time,i=e.type,r=e.level,o=e.tag,s=e.traceId,a=e.loggerId,c=e.content;return"".concat(t,",").concat(n,",").concat(i,",").concat(r,",").concat(o,",").concat(s,",").concat(a,',"').concat(c,'"\n')})),i=new Blob(n,{type:"text/csv"}),r=URL.createObjectURL(i),o=document.createElement("a");o.href=r,o.download="".concat(e,".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}("".concat(e,"-").concat(t,"-").concat(n),r),[2]}}))}))}}}}var Wi,Qi,Ji,Xi,Zi,zi,$i,er=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.createCodec=function(e,t){return this._context.createCodec(e,t)},e.prototype.refetchNaviInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.9.4"},e.prototype.getAPIVersion=function(){return"5.9.4"},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,i){void 0===i&&(i=[]),this._context.registerMessageType(e,t,n,i)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.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.createStatisticLogger=function(e,t){return this._context.createStatisticLogger(e,t)},e}(),tr="pgMsgP",nr="chatMsg",ir="pcMsgP",rr="pbMsgP",or={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},sr="delMsg",ar="delUgMsg",cr="joinChrm",ur="joinChrmR",lr="exitChrm",hr="setKV",dr="delKV",pr="setKVS",gr="delKVS",fr="qryRelationR",_r="delRelation",Er="delRelationBatch",vr="setSeAtt",Tr={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg",APP_PUBLIC_SERVICE:"cleanMCMsg",PUBLIC_SERVICE:"cleanMPMsg"},Cr="cleanMsgBatch",mr="reqCall",yr="pullKvMsg",Ir="qryPMsg",Rr="qryGMsg",Sr="qryCHMsg",Or="qryCMsg",Nr="qrySMsg",Mr="qryMCMsg",Lr="qryMPMsg",Ur=((Wi={})["ppMsgP"]=te.PRIVATE,Wi[tr]=te.GROUP,Wi[nr]=te.CHATROOM,Wi[ir]=te.CUSTOMER_SERVICE,Wi[rr]=te.SYSTEM,Wi),Ar=((Qi={})[te.PRIVATE]=Ir,Qi[te.GROUP]=Rr,Qi[te.CHATROOM]=Sr,Qi[te.CUSTOMER_SERVICE]=Or,Qi[te.SYSTEM]=Nr,Qi[te.APP_PUBLIC_SERVICE]=Mr,Qi[te.PUBLIC_SERVICE]=Lr,Qi),br=((Ji={})[te.PRIVATE]=Tr.PRIVATE,Ji[te.GROUP]=Tr.GROUP,Ji[te.ULTRA_GROUP]=Tr.ULTRA_GROUP,Ji[te.CUSTOMER_SERVICE]=Tr.CUSTOMER_SERVICE,Ji[te.SYSTEM]=Tr.SYSTEM,Ji[te.APP_PUBLIC_SERVICE]=Tr.APP_PUBLIC_SERVICE,Ji[te.PUBLIC_SERVICE]=Tr.PUBLIC_SERVICE,Ji),wr="1",Pr="0",Dr=1,Vr=2,Gr=3;!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"}(Xi||(Xi={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(Zi||(Zi={})),function(e){e.PUB="pub",e.QUERY="qry"}(zi||(zi={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}($i||($i={}));var Br,kr=function(){function e(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=Xi.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Xi.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1,e&&e>0&&1===arguments.length?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=8==(8&e)):(this.type=e,this._retain=t,this.qos=n,this._dup=i)}return e.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0},e}(),xr=function(){function e(){}return e.writeUTF=function(e,t){for(var n=this._getBackAndByteSize(e),i=n.back,r=n.byteSize,o=0,s=i.length;o<s;o++)i[o]>255&&(i[o]&=255);return t?i:r<=255?[0,r].concat(i):[r>>8,255&r].concat(i)},e._getBackAndByteSize=function(e){var t=[],n=0;if(rt(e))for(var i=0,r=e.length;i<r;i++){var o=e.charCodeAt(i);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,i=[],r=-1,o=e,s="";++r<o.length;){var a=Number(o[r]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++r])<<6|128^o[++r])<<6|128^o[++r]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++r])<<6|128^o[++r]:192==(192&a)&&(a=(a^=192)<<6|128^o[++r])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?i.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,i.push(t,n)),(r+1===o.length||i.length>16384)&&(s+=String.fromCharCode.apply(null,i),i.length=0)}return s},e}(),Fr=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0".concat(i)),t+=i.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0".concat(i)),t+=i.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0".concat(i)),t+=i}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;var n=this._pool.subarray(t,this._position);return xr.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),Hr=function(){function e(){this._pool=[],this._position=0,this._writen=0}return e.prototype.write=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},e.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},e.prototype.writeUTF=function(e){var t=xr.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),qr=function(e,t){return e&&t?"".concat(t,"_").concat(e):e||Date.now()},Kr=function(){function e(e){this.header=e,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return qr(e,t)},e.prototype.read=function(e,t,n,i){this.readMessage(e,t,n,i)},e.prototype.readMessage=function(e,t,n,i){return{stream:t,length:n}},e}(),Yr=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new kr(e,!1,Xi.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return qr(e,t)},e.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getLengthSize=function(){return this.lengthSize},e.prototype.getBufferData=function(){var e=new Hr;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),jr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=null,t.userId=null,t.timestamp=0,t}return a(t,e),t.prototype.readMessage=function(e,n,i,r){if(n.readByte(),this.status=+n.readByte(),i<=t.MESSAGE_LENGTH)return{stream:n,length:i};if(r===$i.V4){var o=n.readByte();1&o&&(this.userId=n.readUTF()),2&o&&n.readUTF(),4&o&&(this.timestamp=n.readLong()),8&o&&(this.messageId=n.read2Byte())}else{this.userId=n.readUTF();var s=n.readUTF();e.debug(_e.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:i}},t.MESSAGE_LENGTH=2,t}(Kr),Wr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){return t.readByte(),this.status=+t.readByte(),{stream:t,length:n}},t.MESSAGE_LENGTH=2,t}(Kr),Qr=function(e){function t(){return e.call(this,Zi.PING_REQ)||this}return a(t,e),t.prototype.writeMessage=function(e){},t}(Yr),Jr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t}(Kr),Xr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){var i=256*t.readByte()+t.readByte();return this.messageId=parseInt(i.toString(),10),{stream:t,length:n}},t}(Kr),Zr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,i=(65280&t)>>8;e.write(i),e.write(n)},t}(Yr),zr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=zi.PUB,t}return a(t,e),t.prototype.readMessage=function(t,n,i){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),e.prototype.readMessage.call(this,t,n,i),this.data=n.readAll(),{stream:n,length:i}},t}(Xr),$r=function(e){function t(t,n,i){var r=e.call(this,Zi.PUBLISH)||this;return r.syncMsg=!1,r.identifier=zi.PUB,r.topic=t,r.data=rt(n)?xr.writeUTF(n):n,r.targetId=i,r}return a(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Zr),eo=function(e){function t(){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.identifier=zi.PUB,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,i){return e.prototype.readMessage.call(this,t,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.millisecond=256*n.readByte()+n.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=n.readUTF(),{stream:n,length:i}},t}(Xr),to=function(e){function t(t){var n=e.call(this,Zi.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return a(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Zr),no=function(e){function t(t,n,i){var r=e.call(this,Zi.QUERY)||this;return r.identifier=zi.QUERY,r.topic=t,r.data=rt(n)?xr.writeUTF(n):n,r.targetId=i,r}return a(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Zr),io=function(e){function t(t){var n=e.call(this,Zi.QUERY_CONFIRM)||this;return n.messageId=t,n}return a(t,e),t}(Zr),ro=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=zi.QUERY,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,i){return e.prototype.readMessage.call(this,t,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:i}},t}(Xr),oo=function(e,t,n){var i=new Uint8Array(t),r=new Fr(i),o=r.readByte(),s=function(e,t){var n,i=e.type;switch(i){case Zi.CONN_ACK:n=new jr(e);break;case Zi.PUBLISH:(n=new zr(e)).syncMsg=e.syncMsg;break;case Zi.PUB_ACK:n=new eo(e);break;case Zi.QUERY_ACK:n=new ro(e);break;case Zi.SUB_ACK:case Zi.UNSUB_ACK:case Zi.PING_RESP:n=new Jr(e);break;case Zi.DISCONNECT:n=new Wr(e);break;default:n=new Kr(e),t.error(_e.O,"No support for deserializing ".concat(i," messages"))}return n}(new kr(o),e);return s.read(e,r,i.length-1,n),s};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.pbMsgP=14]="pbMsgP",e[e.rrMsg=15]="rrMsg",e[e.rrList=16]="rrList",e[e.s_ntf=17]="s_ntf",e[e.s_msg=18]="s_msg",e[e.s_stat=19]="s_stat",e[e.s_cmd=20]="s_cmd",e[e.s_us=21]="s_us",e[e.pullUS=22]="pullUS",e[e.sendMsgRead=23]="sendMsgRead",e[e.qryMsgRead=24]="qryMsgRead",e[e.qryMsgReadCntBatch=25]="qryMsgReadCntBatch",e[e.updRTime=26]="updRTime",e[e.pgMsgS=27]="pgMsgS",e[e.chatMsgS=28]="chatMsgS",e[e.qrySessionsAtt=29]="qrySessionsAtt",e[e.pullMsg=30]="pullMsg",e[e.qrySessions=31]="qrySessions",e[e.delSessions=32]="delSessions",e[e.delMsg=33]="delMsg",e[e.updRRTime=34]="updRRTime",e[e.chrmPull=35]="chrmPull",e[e.joinChrm=36]="joinChrm",e[e.joinChrmR=37]="joinChrmR",e[e.exitChrm=38]="exitChrm",e[e.queryChrmI=39]="queryChrmI",e[e.setKV=40]="setKV",e[e.delKV=41]="delKV",e[e.pullKV=42]="pullKV",e[e.qryRelation=43]="qryRelation",e[e.delRelation=44]="delRelation",e[e.pullSeAtts=45]="pullSeAtts",e[e.setSeAtt=46]="setSeAtt",e[e.qnTkn=47]="qnTkn",e[e.qnUrl=48]="qnUrl",e[e.aliUrl=49]="aliUrl",e[e.s3Url=50]="s3Url",e[e.stcUrl=51]="stcUrl",e[e.minioUrl=52]="minioUrl",e[e.cleanPMsg=53]="cleanPMsg",e[e.cleanGMsg=54]="cleanGMsg",e[e.cleanCMsg=55]="cleanCMsg",e[e.cleanSMsg=56]="cleanSMsg",e[e.rtcPing=57]="rtcPing",e[e.rtc_ntf=58]="rtc_ntf",e[e.rtcSetOutData=59]="rtcSetOutData",e[e.rtcQryUserOutData=60]="rtcQryUserOutData",e[e.addSeTag=61]="addSeTag",e[e.delSeTag=62]="delSeTag",e[e.addTag=63]="addTag",e[e.delTag=64]="delTag",e[e.disTag=65]="disTag",e[e.reportsdk=66]="reportsdk",e[e.pullUgSes=67]="pullUgSes",e[e.pullUgMsg=68]="pullUgMsg",e[e.ugMsg=69]="ugMsg",e[e.qryUgMsg=70]="qryUgMsg",e[e.updUgRTime=71]="updUgRTime",e[e.upMsgEx=72]="upMsgEx",e[e.modifyMsg=73]="modifyMsg",e[e.qryMsgChange=74]="qryMsgChange",e[e.qryMsg=75]="qryMsg",e[e.operate=76]="operate",e[e.s_opNtf=77]="s_opNtf",e[e.ugUnpushQuery=78]="ugUnpushQuery",e[e.ugUnpushSet=79]="ugUnpushSet",e[e.setRtcRoomId=80]="setRtcRoomId",e[e.qryUgUal=81]="qryUgUal",e[e.s_pubCall=82]="s_pubCall"}(Br||(Br={}));var so=Br,ao=function(){function e(e,t){this._runtime=e,this._appkey=t,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]=this._users[e]||{inboxTime:0,outboxTime:0,broadcastSyncTime:0},this._users[e]},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var i=W.INBOX_TIME_KEY(this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=W.INBOX_TIME_KEY(this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||pt(e))){n.broadcastSyncTime=e;var i=W.BROADCASTBOX_TIME_KEY(this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=W.BROADCASTBOX_TIME_KEY(this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.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 i=W.OUTBOX_TIME_KEY(this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=W.OUTBOX_TIME_KEY(this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),co={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},uo=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,i=e.type,r=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=i===Te.DELETE,c=s===o,u=!this._isExisted(n),l=a?this._remove:this._add;(t||r||c||u)&&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,i=t.isDeleted;return n&&!i},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,i=e.isFullUpdate;n=n||[],(i=i||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,i)}))},e.prototype.clear=function(){this._kvCaches={}},e}(),lo=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(i=co.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,this._isPulling=!1,o===$.SUCCESS?(co.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){co.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 i=this._storeCaches[e];_t(i)||(i=new uo(this._engine.getInnerLogger(),e,n)),i.setEntries(t),this._storeCaches[e]=i},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getVersion=function(e,t){var n=this._storeCaches[e];return n?n.getVersion(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),ho=function(){function e(e){this._canJoinMulipleChrm=e,this._joinedChrmsInfo={}}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t},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}(),po=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 u(this,void 0,void 0,(function(){var e,t;return l(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 u(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return t=e.task,n=this.getVersion(),[4,t(n)];case 1:return(i=r.sent()).code===$.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,[4,this._triggerPull(n)]):[3,3];case 2:return r.sent(),[2,this._callHandler(e)];case 3:return this._retryCount=0,[2,i]}}))}))},e.prototype.stopAllTask=function(){this._callerQueue.forEach((function(e){e.resolve({code:$.RC_NET_UNAVAILABLE})})),this._callerQueue=[]},e}(),go="converStatusChanged",fo=function(e){function t(t,n,r){var s=e.call(this)||this;return s._eventEmitter=new It,s._pullQueue=[],s._isPulling=!1,s._pullPromise=null,s._storagePullTimeKey="con-s-".concat(n,"-").concat(r),s._oldStorage=i(t.runtime),s._storage=new o(t.runtime,W.CONVER_STATE_PULL_TIME_KEY(n,r)),s._appkey=n,s._currentUserId=r,s._engine=t,s.adaptOldStatus(),s}return a(t,e),t.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(_e.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},t.prototype._set=function(e){var t=this;if(!pt(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach((function(e,r){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(go,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n),this._pullQueue=this._pullQueue.filter((function(e){return e>n}))}},t.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,i;return l(this,(function(r){switch(r.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=r.sent(),n=t.code,i=t.data,this._isPulling=!1,this._pullPromise=null,n===$.SUCCESS&&this._set(i),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},t.prototype._startCall=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},t.prototype.pull=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},t.prototype._triggerPull=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},t.prototype.watch=function(e){this._eventEmitter.on(go,(function(t){e(t)}))},t.prototype.setConversationUpdatedTime=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t},t.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},t}(po),_o={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},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}},Eo={};for(var vo in _o){var To=_o[vo].keyName;Eo[To]=vo}var Co,mo=function(){function e(e,t,n,i){this._appkey=t,this._currentUserId=n,this.logger=i,this.storage=new o(e,W.OLD_CONVER_STATE_KEY(t,n)),this._localStore=new o(e,W.CONVER_STATE_KEY(t,n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),i=t.shift(),r=t.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:te.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var i=this,r=e.conversationType,o=e.messageType,s=e.isMentioned,a=e.senderUserId;s&&r===te.GROUP&&((n.userIdList||[]).forEach((function(e){e===i._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===he.ALL&&t.indexOf(a)<0&&t.push(a));if(o===oe.RECALL&&r===te.GROUP){var c=t.indexOf(a);c>=0&&t.splice(c,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,i=e.content,r=e.channelId,o=e.senderUserId,s=i.mentionedInfo;if(s&&o!==this._currentUserId){var a=this._getStoreKey(t,n,r),c=this._localStore.get(a)||{},u=Eo.mentionedInfo,l=Eo.hasMentioned,h=c[u]||{},d=h.userIdList||[];s={userIdList:d=this._updateMentionedUserList(e,d,s),type:(null==s?void 0:s.type)||h.type},0!==d.length?(c[u]=s,c[l]=!0):(delete c[u],delete c[l]),_t(c)?this._localStore.set(a,c):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,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=Eo[s],c=n[s];if(!pt(a)&&!pt(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s)c===_o[a].defaultVal||"tags"===s&&!_t(c)?delete o[a]:o[a]=this._setLocal(s,c),o.c||(delete o.t,delete o.fut,delete o.fuid,delete o.hm,delete o.m,delete o.mc)}var u=Object.keys(o);1===u.length&&u.includes("st")&&delete o.st,_t(o)?this._localStore.set(r,o):this._localStore.remove(r)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var i=this._getStoreKey(e,t,n),r=this._localStore.get(i)||{},o={};for(var s in _o){var a=_o[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||Cn(u)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var i in t){var r=this._getConOptionByKey(i),o={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},s=t[i];for(var a in s)if(_o[a]){var c=_o[a],u=c.keyName,l=c.defaultVal;o[u]=s[a]||Cn(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 i=this._getConOptionByKey(n),r=i.conversationType,o=i.targetId,s={},a=e[n];for(var u in a){var l=_o[u],h=l.keyName,d=l.defaultVal;s[h]=a[u]||Cn(d)}for(var p in s.tags){pt(t[p])&&(t[p]=[]);var g=c(c({},s),{conversationType:r,targetId:o});delete g.tags,t[p].push(g)}}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(_e.O,"adaptOldStore error: ".concat(e.message))}},e.prototype.remove=function(e,t,n){var i=this._getStoreKey(e,t,n);this._localStore.remove(i)},e}(),yo=[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE,te.APP_PUBLIC_SERVICE],Io={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},Ro=1e3,So=function(){function e(e,t,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new It,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new mo(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new fo(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Io.CHANGED,(function(e){i(e)})),this._eventEmitter.on(Io.CON_TAG_STATUS_CHANGED,(function(){r()}));var s=this._store.getValue();s.length>Ro&&(s=s.sort((function(e,t){var n=e.lastMessageSentTime,i=void 0===n?0:n,r=t.lastMessageSentTime;return(void 0===r?0:r)-i})),s.splice(Ro,s.length).forEach((function(e){o._store.remove(e.conversationType,e.targetId,e.channelId)})))}return e.prototype._calcMsg=function(e,t,n,i){var r=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===i.sentTime})),o=t>=i.sentTime;return n&&(o=n<i.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:r}},e.prototype._calcUnreadCount=function(e,t){var n=e.content,i=e.messageType,r=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,c=e.messageUId,u=s===Z.SEND&&a===this._loginUserId,l=i===oe.RECALL,h=ht(n),d=!1,p={},g=t.lastUnreadTime,f=t.lastReadTime,_=t.unreadMessageCount;if(g>r||u)return{hasChanged:d,localConversation:t,updateItems:p};if(o&&(0===t.unreadMessageCount&&(t.firstUnreadMessageUid=c,t.firstUnreadTime=r),t.unreadMessageCount=_+1,t.lastUnreadTime=r,d=!0),l&&h){var E=this._handleRecall2UnreadCount(e,g,f,_,d),v=E.unreadMessageCount,T=E.hasChanged;t.unreadMessageCount=v,d=T,0===t.unreadMessageCount&&(t.firstUnreadMessageUid="",t.firstUnreadTime=0)}return d&&(p.unreadMessageCount={val:t.unreadMessageCount||0,time:r}),{hasChanged:d,localConversation:t,updateItems:p}},e.prototype._handleRecall2UnreadCount=function(e,t,n,i,r){var o="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),s=this._calcMsg(o,t,n,e.content),a=s.isNotRead,c=s.isNotRepeadRecallSendTime;return a&&i&&c?(this._recallMsgTimeMap[o]||(this._recallMsgTimeMap[o]=[]),this._recallMsgTimeMap[o].push(e.content.sentTime),{unreadMessageCount:i-1,hasChanged:!0}):{unreadMessageCount:i,hasChanged:r}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,i=e.messageDirection,r=e.isMentioned,o=e.sentTime,s=i===Z.SEND,a=ht(n),c=!1,u={};return!s&&r&&a&&n.mentionedInfo&&(t.hasMentioned=!0,c=!0,u.hasMentioned={val:!0,time:o},u.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:c,localConversation:t,updateItems:u}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,i=e.messageDirection,r=!1;if(e.isMentioned&&i===Z.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===he.ALL||(a||[]).includes(this._loginUserId)){r=!0;var c=t.unreadMentionedCount||0;t.unreadMentionedCount=c+1}if((a||[]).includes(this._loginUserId)){r=!0;c=t.unreadMentionedMeCount||0;t.unreadMentionedCount=c+1}}return{hasChanged:r,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(ht(e)){var t=e.conversationType,n=e.targetId,i=e.channelId,r="".concat(t,"_").concat(n),o=this._store.get(t,n,i)||{};this._updatedConversations[r]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,i){var r=(this._store.get(e,t,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var o in r)if(!n[o]||!!r[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,i=e.targetId,r=e.updatedTime,o=e.notificationStatus,s=e.notificationLevel,a=e.isTop,c=e.tags,u=e.channelId,l={},h={};if(n!==te.ULTRA_GROUP){pt(o)||(h.notificationStatus={time:r,val:o}),pt(s)||(h.notificationLevel={time:r,val:s}),pt(a)||(h.isTop={time:r,val:a}),pt(c)||(h.tags={time:r,val:c},null==c||c.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,i,l,u);var d=this._store.get(n,i,u).lastMessageSentTime||(new Date).getTime();this._store.set(n,i,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},u),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:u}),t&&this._notifyConversationChanged()}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(Io.CHANGED,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Io.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,i=e.conversationType,r=e.isPersited,o=e.targetId,s=e.channelId,a=e.sentTime;if(yo.indexOf(i)>=0){var u=!1,l=this._store.get(i,o,s),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,l),r=i.hasChanged,o=i.localConversation,s=i.updateItems;u=u||r,h=c(c({},h),s),l=Cn(o)})),this._store.set(i,o,l,s),this._store.updateMentionedData(e),r){var d=this._store.get(i,o,s);d.updatedItems=c({latestMessage:{time:e.sentTime,val:e}},h),d.latestMessage=e;var p=Object.assign(d,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(p)}(u||r)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var i=this._store.getValue(),r=0;return i.forEach((function(e){var i=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;i=i||0,(n||void 0!==s&&s<=0||void 0===s&&o!==ae.OPEN)&&(t.length>0?t.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var i=this._store.getValue(),r=0;return i.forEach((function(i){var o=i.unreadMessageCount,s=i.notificationLevel,a=void 0===s?0:s,c=i.conversationType,u=i.unreadMentionedCount;e.includes(c)&&(0===t.length||t.includes(a))&&(r+=(n?u:o)||0)})),r},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],i=0;return n.forEach((function(e){var n=e.unreadMessageCount,r=e.notificationStatus,o=e.notificationLevel;(t||1!==r||-1===o||0===o)&&(n=n||0,i+=Number(n))})),i},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,i,r){void 0===r&&(r=!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,c={};if(s&&(o.unreadMessageCount=0,c.unreadMessageCount={val:0,time:i}),a&&(o.hasMentioned=!1,o.unreadMentionedCount=0,o.mentionedInfo=void 0,c.hasMentioned={val:!1,time:i},c.mentionedInfo={val:void 0,time:i}),this._store.set(e,t,o,n),r&&0!==Object.keys(c).length){var u=Object.assign(o,{conversationType:e,targetId:t,channelId:n,updatedItems:c});this._setUpdatedConversation(u),this._notifyConversationChanged()}},e.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,t.lastReadTime=t.lastUnreadTime,e._recallMsgTimeMap={},e._store.set(t.conversationType,t.targetId,t,t.channelId))}))},e.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},e.prototype.setDraft=function(e,t,n,i){var r="".concat(e,"_").concat(t,"_").concat(i);this._draftMap[r]=n},e.prototype.getDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[i]},e.prototype.clearDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[i]},e.prototype.addTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i),o=r.tags;o=Object.assign(o,n);var s=r.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:o,lastMessageSentTime:s},i)},e.prototype.deleteTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i).tags;n.forEach((function(e){delete r[e]})),this._store.set(e,t,{tags:r},i)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===ae.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)&&(pt(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}(),Oo=function(e){function t(t,n,i,r){var s=e.call(this)||this;return s._tagKey="tags",s._versionKey="version",s._pullQueue=[],s._isPulling=!1,s._pullPromise=null,s._storageKey=W.USER_SETTING_KEY(n,i),s._storage=new o(t.runtime,s._storageKey),s._engine=t,s._tagWatcherFunc=r,s}return a(t,e),t.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()},t.prototype.addTag=function(e,t){var n,i=this._storage.get(this._tagKey)||{};e.forEach((function(e){var t,n=(null===(t=i[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;i[e.tagId]={tagName:e.tagName,createdTime:n}})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=t,n))},t.prototype.deleteTag=function(e,t){var n,i=this._storage.get(this._tagKey)||{};e.forEach((function(e){delete i[e]})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=t,n))},t.prototype.getTagsInfo=function(){return this._storage.get(this._tagKey)||{}},t.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)}))},t.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},t.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return l(this,(function(c){switch(c.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=c.sent(),n=t.code,i=t.data,this._isPulling=!1,this._pullPromise=null,n!==$.SUCCESS||pt(i)||(o=(r=i).settings,s=r.version,a=o.Tag,pt(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]}}))}))},t.prototype._startCall=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},t.prototype.pullUserSettings=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},t.prototype._triggerPull=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},t.prototype.getVersion=function(){return this._storage.get(this._versionKey)||0},t.prototype.updateVersion=function(e){this._storage.set(this._versionKey,e)},t}(po),No=function(e){return e.replace(/@.+$/,"@")},Mo=function(){function e(e,t,n,i,r,o){void 0===r&&(r=!0),void 0===o&&(o=!0),this.appkey=e,this.logger=t,this.statisticLog=n,this.staticConfigManager=i,this.isRequestProfile=r,this.isUseDynamicNaviUrl=o,this.crtRequest=null}return e.prototype.request=function(e,t,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,i,r),[4,this.crtRequest]);case 1:return o=c.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},e.prototype.sendRequest=function(e,t,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,c,u,h,d,p,g,f,_,E,v;return l(this,(function(l){switch(l.label){case 0:return o=No(e),!t&&(s=this.getNaviCache(o))&&(a=s.timestamp,c=s.naviInfo,n||Date.now()-a<T)?(this.logger.info(_e.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),i),u={bid:an(),ptc:Ye.NAVI,cod:$.SUCCESS,net:null==r?void 0:r.type,dur:0,spr:0,pr:c.type||0,hos:"",cache:je.LOCAL,v:We.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.statisticLog.record(Ee.IM_NAVI,JSON.stringify(u),i),[2,{code:$.SUCCESS,data:c}]):(h=ci.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(_e.L_GET_NAVI_T,JSON.stringify({token:e,uris:h}),i),[4,this.requestHandler(h,e,i,r)]);case 1:return d=l.sent(),p=d.code,g=d.data,p===$.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(f=l.sent())?void 0:f.navi)&&(null==f?void 0:f.navi.length)>0?(_=f.navi,[4,this.requestHandler(_,e,i,r)]):[3,4];case 3:E=l.sent(),p=E.code,g=E.data,l.label=4;case 4:return p!==$.SUCCESS?(this.logger.warn(_e.L_GET_NAVI_R,p,i),[2,{code:p}]):(v=g,this.logger.info(_e.L_GET_NAVI_R,JSON.stringify({naviInfo:v}),i),this.setNaviCache(o,v),[2,{code:p,data:v}])}}))}))},e.prototype.requestHandler=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:r=0,o=e.length,l.label=1;case 1:return r<o?(s=r===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,c=Date.now(),[4,a.call(this,e[r],this.appkey,t,n,s)]):[3,4];case 2:if(u=l.sent(),h=u.code,d=u.data,p={bid:an(),ptc:Ye.NAVI,cod:h,net:null==i?void 0:i.type,dur:Date.now()-c,spr:0,pr:(null==d?void 0:d.type)||0,hos:e[r],cache:je.REQUEST,v:We.CURRENT,rsn:null==i?void 0:i.reason,cid:"".concat(null==i?void 0:i.uuid,"_").concat(null==i?void 0:i.retryCount),count:null==i?void 0:i.retryCount},this.statisticLog.record(Ee.IM_NAVI,JSON.stringify(p),n),[$.SUCCESS,$.RC_CONN_TOKEN_INCORRECT,$.RC_LICENSE_EXPIRED].includes(h))return[2,{code:h,data:d}];l.label=3;case 3:return r+=1,[3,1];case 4:return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return $.RC_CONN_TOKEN_INCORRECT;case 416:return $.RC_LICENSE_EXPIRED;default:return $.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(No(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(No(e),c(c({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,i=e.token,r=e.platform,o=e.protocol;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(i),"&v=").concat("5.9.4","&p=").concat(r);return{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(o,";rtc=4;log=2")},body:s,url:t,timeout:m}},e.prototype.useV2Navi=function(){return!0},e}(),Lo={},Uo=function(e){function t(t,n,i,r,o){var s=e.call(this,t,n,i,o,r.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),r.useNavi)||this;return s.runtime=r,s}return a(t,e),t.prototype.httpRequest=function(e,t,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return o="".concat(e,"/navi.js?appId=").concat(t,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(F,"&r=").concat(Date.now()),this.logger.debug(_e.L_REQUEST_T,"req navi => ".concat(o),i),[4,this.runtime.httpReq({url:o,timeout:m,dataType:"text"})];case 1:if(200!==(s=u.sent()).status)return this.logger.debug(_e.L_REQUEST_R,"request navi failed: ".concat(s.status),i),!this.runtime.useNavi&&r?(c={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:ci.getMiniCmpUrlList().join(",")},[2,{code:$.SUCCESS,data:c}]):[2,{code:this.transHttpCode(s.status)}];try{return 0===(a=s.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'.concat(a,'"'))),(c=JSON.parse(a)).protocol=/^https/.test(o)?"https":"http",this.runtime.useNavi||(c.server="",c.backupServer=ci.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,{code:$.SUCCESS,data:c}]}catch(e){this.logger.error(_e.L_PARSE_NAVI_E,s.data,i)}return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.httpRequestV2=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return r=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:this.runtime.tag,protocol:(/^https/.test(e)?Pe.WSS:Pe.WS).toString()}),this.logger.debug(_e.L_REQUEST_T,"req navi => ".concat(r.url),i),[4,this.runtime.httpReq(r)];case 1:if(200!==(o=u.sent()).status)return this.logger.debug(_e.L_REQUEST_R,"request navi failed: ".concat(o.status),i),[2,{code:this.transHttpCode(o.status)}];try{return s=o.data,(a="object"!=typeof s?JSON.parse(s):s).protocol=/^https/.test(r.url)?"https":"http",this.runtime.useNavi||(a.logSwitch=0,c=ci.getMiniCmpUrlList(),a.serverAddr=c.map((function(e,t){return{addr:e,protocol:/^https/.test(r.url)?Pe.WSS:Pe.WS,weight:c.length-t}}))),[2,{code:$.SUCCESS,data:a}]}catch(e){this.logger.error(_e.L_PARSE_NAVI_E,o.data,i)}return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){if(Lo[e])return Lo[e];var t,n=W.NAVI_KEY(this.appkey),i=this.runtime.localStorage;try{var r=i.getItem(n);t=r?JSON.parse(r):[]}catch(e){t=[]}if(0===t.length)return null;var o=t.find((function(t){return t.token===e}))||null;return Lo[e]=o,o},t.prototype.setNaviCache=function(e,t){var n,i=W.NAVI_KEY(this.appkey),r=this.runtime.localStorage;try{var o=r.getItem(i);n=o?JSON.parse(o):[]}catch(e){n=[]}var s=Date.now();n.length>0&&(n=n.filter((function(t){return s-t.timestamp<T&&e!==t.token})));var a={timestamp:s,naviInfo:t,token:e};n.push(a),r.setItem(i,JSON.stringify(n)),Lo[e]=a},t}(Mo),Ao=function(){function e(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=W.SEND_MSG_KEY(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=W.SEND_MSG_KEY(this._appkey,this._userId),i=this._getLocalInfo(n);i[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(i))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=W.SEND_MSG_KEY(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),this._runtime.localStorage.setItem(t,JSON.stringify(n))},e}();(Co={})[te.PRIVATE]=so.qryPMsg,Co[te.GROUP]=so.qryGMsg,Co[te.CHATROOM]=so.qryCHMsg,Co[te.CUSTOMER_SERVICE]=so.qryCMsg,Co[te.SYSTEM]=so.qrySMsg;var bo=[so[so.recallMsg],so[so.ppMsgS],so[so.pgMsgS],so[so.ppMsgP],so[so.pgMsgP],so[so.chatMsg],so[so.pcMsgP],so[so.prMsgS],so[so.updUgRTime],so[so.pbMsgP],so[so.updRTime]],wo=function(){function e(e,t,n){this._localStore=new o(e,W.ULTRA_GROUP_STATE_KEY(t,n))}return e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=Do[s],c=n[s];if(!pt(a)&&!pt(c))c===Po[a].defaultVal?delete o[a]:o[a]=c}_t(o)?this._localStore.set(r,o):this._localStore.remove(r)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var i=this._getStoreKey(e,t,n),r=this._localStore.get(i)||{},o={};for(var s in Po){var a=Po[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||Cn(u)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Po={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Do={};for(var Vo in Po){var Go=Po[Vo].keyName;Do[Go]=Vo}var Bo,ko=function(){function e(e,t,n){this._store=new wo(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,o=e.channelId;t===te.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:i,notificationLevel:r},o)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),xo="UpStreamMessage",Fo="PushExtra",Ho="DownStreamMessage",qo="DownStreamMessages",Ko="SessionsAttQryInput",Yo="SessionsAttOutput",jo="SyncRequestMsg",Wo="ChrmPullMsg",Qo="NotifyMsg",Jo="HistoryMsgInput",Xo="HistoryMsgOuput",Zo="RelationQryInput",zo="RelationsOutput",$o="UnreadMsgInfo",es="DeleteSessionsInput",ts="SessionInfo",ns="DeleteSessionsOutput",is="RelationDelBatchReq",rs="RelationOpInput",os="RelationsInput",ss="DeleteMsgInput",as="CleanHisMsgInput",cs="CleanMsgBatchReq",us="SessionMsgReadInput",ls="ChrmInput",hs="ChrmOutput",ds="QueryChatRoomInfoInput",ps="QueryChatRoomInfoOutput",gs="GetQNupTokenInput",fs="GetQNupTokenOutput",_s="GetQNdownloadUrlInput",Es="GetDownloadUrlInput",vs="GetQNdownloadUrlOutput",Ts="GetDownloadUrlOutput",Cs="ChrmKVEntity",ms="SetChrmKV",ys="SetChrmKVS",Is="DeleteChrmKVS",Rs="ChrmKVOutput",Ss="ChrmKVSOutput",Os="ChrmKVSVersionEntity",Ns="ChrmKVSOutputEntity",Ms="QueryChrmKV",Ls="SetUserSettingInput",Us="SetUserSettingOutput",As="PullUserSettingInput",bs="PullUserSettingOutput",ws="UserSettingNotification",Ps="SessionReq",Ds="SessionStates",Vs="SessionState",Gs="SessionStateItem",Bs="SessionStateModifyReq",ks="SessionStateModifyResp",xs="GroupUnpushQuery",Fs="GroupUnpushSet",Hs="QryRemindListReq",qs="QryRemindListResp",Ks="GroupUnpushResult",Ys="GrpReadReceiptMsg",js="GrpReadReceiptQryReq",Ws="GrpReadReceiptQryResp",Qs="GrpMsgReadUser",Js="SessionTagAddInput",Xs="SessionTagItem",Zs="SessionTagDelInput",zs="SessionDisTagReq",$s="ReportSDKInput",ea="ReportSDKOutput",ta="UltraGrpPullSes",na="UltraGrpPullMsg",ia="MsgChangeReq",ra="QueryMsgChange",oa="MsgChange",sa="MsgChangeList",aa="MsgQuery",ca="MessageQueryInfo",ua="MsgQueryAck",la="OperateStatus",ha="OperateStatusNotify",da="OperateInfo",pa="OperateSummary",ga="SetRtcRoomIdInput",fa="SetRtcRoomIdOutput",_a="CallInfoUpStream",Ea="CallInfoDownStream",va="KvInput",Ta="KvOutput",Ca="ReadReceiptMsg",ma="ReceiptQryReq",ya="QueryReceiptResp",Ia="ReceiptUser",Ra="ReceiptCntQryReq",Sa="ReceiptCntQryResp",Oa="MsgReadCnt";(Bo={})[xo]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],Bo[qo]=["list","syncTime","finished","broadcastSyncTime"],Bo[Ho]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Bo[Fo]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Bo[Ko]=["nothing"],Bo[Yo]=["inboxTime","sendboxTime","totalUnreadCount"],Bo[jo]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Bo[Wo]=["syncTime","count"],Bo[Qo]=["type","time","chrmId"],Bo[Jo]=["targetId","time","count","order","busChannel"],Bo[Xo]=["list","syncTime","hasMsg"],Bo[Zo]=["type","count","startTime","order"],Bo[zo]=["info","isFinished"],Bo[$o]=["msgId","msgTime","remindType","className"],Bo[es]=["sessions"],Bo[is]=["RelationOpInput"],Bo[rs]=["conversationId","conversationType","busChannel"],Bo[ts]=["type","channelId","busChannel"],Bo[ns]=["nothing"],Bo[os]=["type","msg","count","busChannel","startTime","endTime"],Bo[ss]=["type","conversationId","msgs","busChannel"],Bo[as]=["targetId","dataTime","conversationType","busChannel"],Bo[cs]=["CleanHisMsgInput"],Bo[us]=["type","msgTime","channelId","busChannel"],Bo[ls]=["nothing"],Bo[hs]=["nothing","sessionId","joinTime"],Bo[ds]=["count","order"],Bo[ps]=["userTotalNums","userInfos"],Bo[gs]=["type","key","httpMethod","queryString","url"],Bo[_s]=["type","key","fileName"],Bo[Es]=["type","key","fileName"],Bo[fs]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Bo[vs]=["downloadUrl"],Bo[Ts]=["downloadUrl"],Bo[Cs]=["key","value","status","timestamp","uid","version"],Bo[ms]=["entry","bNotify","notification","type"],Bo[ys]=["entry","bNotify","notification","type"],Bo[Is]=["entry","bNotify","notification","type"],Bo[Rs]=["entries","bFullUpdate","syncTime"],Bo[Ss]=["timestamp","errorKeys","keysVersion"],Bo[Os]=["version","key"],Bo[Ns]=["key","errorCode"],Bo[Ms]=["timestamp"],Bo[Ls]=["version","value"],Bo[Us]=["version","reserve"],Bo[As]=["version","reserve"],Bo[bs]=["items","version"],Bo.UserSettingItem=["targetId","type","key","value","version","status","tags"],Bo[Ps]=["time"],Bo[Ds]=["version","state"],Bo[Vs]=["type","channelId","time","stateItem","busChannel"],Bo[Gs]=["sessionStateType","value","tags"],Bo[Bs]=["version","state"],Bo[ks]=["version"],Bo[Fs]=["busChannel","unpushLevel"],Bo[Hs]=["groupId","busChannel","msgTime","size"],Bo[xs]=["busChannel"],Bo[Ks]=["groupId","busChannel","unpushLevel"],Bo[Ys]=["msgId","busChannel"],Bo[js]=["msgId","busChannel"],Bo[Ws]=["totalMemberNum","list"],Bo[Qs]=["readTime","userId"],Bo[Js]=["version","tags"],Bo[Xs]=["tagId","name","createdTime","isTop"],Bo[Zs]=["version","tags"],Bo[zs]=["tagId"],Bo[ws]=["version","reserve"],Bo[$s]=["sdkInfo"],Bo[ea]=["nothing"],Bo[ta]=["syncTime","isEraseMsgContent"],Bo[na]=["syncTime"],Bo[ia]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Bo[ra]=["syncTime"],Bo[sa]=["list","syncTime","hasNext"],Bo[oa]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],Bo[aa]=["targetId","type","query"],Bo[ca]=["msgTime","msgUID","busChannel"],Bo[ua]=["list"],Bo[la]=["targetId","type","opType","busChannel"],Bo[ha]=["type","notifyType","info","summary"],Bo[da]=["targetId","busChannel","userId","opType","optime"],Bo[pa]=["targetId","busChannel","count","opType"],Bo[ga]=["rtcRoomId"],Bo[fa]=["nothing"],Bo[Ca]=["targetId","type","busChannel","startMsgId","endMsgId"],Bo[ma]=["msgId","busChannel","targetId"],Bo[ya]=["num","list"],Bo[Ia]=["receiptTime","userId"],Bo[Ra]=["type","channelId","busChannel","msgId"],Bo[Sa]=["result"],Bo[Oa]=["msgId","cnt","tmn"];var Na,Ma,La,Ua,Aa="\npackage Modules;\nmessage probuf {\n message SetUserStatusOutput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusInput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusOutput\n {\n optional string status=1;\n optional string subUserId=2;\n }\n\n message SubUserStatusInput\n {\n repeated string userid =1;\n }\n\n message SubUserStatusOutput\n {\n optional int32 nothing=1;\n }\n message VoipDynamicInput\n {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n\n message VoipDynamicOutput\n {\n required string dynamicKey=1;\n }\n message ".concat(Qo," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(jo," {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message ").concat(xo," {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string userId = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13; // 该消息所属会话的业务标识\n optional string systemId = 16; // 系统会话消息时需填该字段为 targetId, 其他类型无需传\n }\n message ").concat(Fo," {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message ").concat(qo," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(Ho," {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n // 消息的扩展标记\n // 第0位,表示送达状态: 0x01 表示已送达;\n // 断档: 0x02 表示是否需要执行断档策略;\n // 消息修改: 0x04 拉取历史消息时表示该消息是否修改过\n // 0x08 每条消息携带的频道类型\n optional int64 extStatus = 20;\n repeated string toUserId = 21; //指定接收者(限定群和讨论组)//增加聊天室定向成员\n optional int32 groupUnpush = 22; //群聊默认免打扰级别\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = ").concat(J.IMAGE,";\n audio = ").concat(J.AUDIO,";\n video = ").concat(J.VIDEO,";\n file = ").concat(J.FILE,";\n sight = ").concat(J.SIGHT,";\n html = ").concat(J.COMBINE_HTML,";\n }\n message ").concat(gs," {\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; // url, sdk 设置下载地址\n }\n message ").concat(_s," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Es," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(fs," {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n // 兼容 minio 协议\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; // 下载鉴权信息,格式为 Json 格式\n }\n message ").concat(vs," {\n required string downloadUrl = 1;\n }\n message ").concat(Ts," {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n group_success = 0x00;\n group_failure = 0x01;\n }\n message ").concat(ls," {\n required int32 nothing = 1;\n }\n message ").concat(hs," {\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 ").concat(Wo," {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n\n message ChrmPullMsgNew\n {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message ").concat(Zo,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(os,"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message ").concat(zo,"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n optional int32 busChannelType = 9; // 0: 公有频道; 1: 私有频道;\n optional ").concat($o," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat($o," //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n optional string className = 4; //消息类型\n }\n message ").concat(Hs," // 新增 查询未读@列表入参\n {\n required string groupId = 1; // 群 ID\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int64 msgTime = 3; // 消息时间戳\n optional int32 size = 4; // 单页长度,默认20,最大20\n }\n message ").concat(qs," //查询未读@列表出参\n {\n repeated ").concat($o," msgInfo = 1; //未读@消息摘要列表\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(as,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message ").concat(cs,"\n {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message ").concat(ds,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(ps,"\n {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember\n {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput\n {\n required string id = 1;\n }\n\n message MPFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo\n {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput\n {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput\n {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput\n {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput\n {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message ").concat(Jo,"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5; //该消息所属会话的业务标识,限制20字符以内\n }\n\n message ").concat(Xo,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Ko,"{\n required int32 nothing = 1;\n }\n message ").concat(Yo,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(us,"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(es,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(ts,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(ns,"\n {\n optional int32 nothing=1;\n }\n message ").concat(is," \n {\n repeated RelationOpInput relation = 1;\n }\n message ").concat(rs,"\n {\n required string conversationId = 1;//会话ID\n required ChannelType conversationType = 2;//会话类型,比如单聊、群等\n optional string busChannel = 3;//该消息所属会话的业务标识,限制20字符以内\n }\n message ").concat(ss,"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message DeleteMsg\n {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message ").concat(ms," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(ys," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Is," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Rs," {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ").concat(Ss," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Ns,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Ms," {\n required int64 timestamp = 1;\n }\n message ").concat(Ls," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Us," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(As," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(bs," {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message ").concat(Ps," {\n required int64 time = 1;\n }\n message ").concat(Ds," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Vs," {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;//该消息所属会话的业务标识\n }\n message ").concat(Gs," {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message ").concat(Bs," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(xs," {\n optional string busChannel = 1;\n }\n message ").concat(Fs,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(Ks," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(ks," {\n required int64 version=1;\n }\n message ").concat(Ys," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(js," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Ws," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Qs," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Js," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Xs," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(Zs," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(zs," {\n repeated string tagId=1;\n }\n message ").concat(ws," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat($s,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(ea,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(ta,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(na,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(ia,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(ra," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(sa," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(oa," //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回,4:频道变更,5:用户组变更)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0, 设为 1 时, IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 消息变更的操作人 Id; subChangeType 为 5 时,operatorId 表示被踢出超级群私有频道白名单的用户\n // subChangeType 的意义由 changeType 的值来决定\n // 当 changeType 为 4 时;\n // 1: 删除频道;\n // 2: 公有频道变为私有频道;\n // 3: 私有频道变为公有频道;\n // 4: 私有频道成员变更-加入, SDK 不通知业务层;\n // 5: 私有频道成员变更-退出;\n // 6: 公有频道变为私有频道,当前用户不在白名单中;\n // 当 changeType 为 5 时;\n // 1: 删除用户组 (通知到 用户组下所有用户)\n // 2: 用户组增加用户 (仅通知到该用户)\n // 3: 用户组删除用户 (仅通知到该用户)\n // 4: 频道绑定用户组 (通知到 用户组下所有用户)\n // 5: 频道解绑用户组 (通知到 用户组下所有用户)\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12; // 0:公有频道; 1:私有频道\n optional bool isRemindMe = 13;// 是否为@我的消息, 消息撤回时, 该字段有意义, 用于客户端计算是否未读数总数-1,未读@消息数-1 -- server 暂未支持\n repeated string userGroupIds = 14; //用户组id列表,用于用户组增删成员或频道绑定解绑用户组的通知中\n optional int32 remindType = 15; // @类型:0非@我消息,1@所有人消息,2@我单人的消息\n }\n message ").concat(aa," //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message ").concat(ua," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(la," //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message ").concat(ha," //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message ").concat(da," {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message ").concat(pa," {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n\n message ").concat(ga,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(fa,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(_a,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat(Ea,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(va,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(Ta,"\n {\n required int64 maxTime = 1; //最大时间戳\n repeated KvInfo info = 2; //kv对象\n }\n \n message KvInfo{\n required string key =1; //健名\n required string value =2; //健值\n }\n message ").concat(Ca,"\n {\n required string targetId = 1;\n required ChannelType type = 2; //会话类型:单聊1、群聊3\n optional string busChannel = 3; //该消息所属会话的业务标识\n optional string startMsgId = 4; //已读消息ID区间开始(单聊极端场景下,无此属性或为空字符串)\n optional string endMsgId = 5; //已读消息ID区间结束(对应RC:RRMsg 中 endMsgId)\n }\n message ").concat(ma,"\n {\n required string msgId = 1;//已读 消息ID \n optional string busChannel = 2; //该消息所属会话的业务标识\n required string targetId = 3; //群聊:群id\n }\n message ").concat(ya,"\n {\n optional int32 num = 1;// 群总人数\n repeated ReceiptUser list = 2;//已读用户列表(list复类型)\n optional int32 readCnt = 3; //已读人数\n }\n message ").concat(Ia,"\n {\n required int64 receiptTime = 1;//已读 时间。已做归并,SDK 向上层返回应最多只精确到分钟 \n required string userId = 2;//已读 用户id\n }\n message ").concat(Ra,"\n {\n optional ChannelType type = 1; //发送类型如:(GROUP)\n optional string channelId = 2; //会话id\n optional string busChannel = 3; //该消息所属会话的业务标识\n repeated string msgId = 4; //消息id列表\n }\n message ").concat(Sa,"\n {\n repeated MsgReadCnt result= 1; //已读状态列表\n }\n\n message ").concat(Oa,"\n {\n optional string msgId = 1; //消息id\n optional int32 cnt = 2; //已读人数\n optional int32 tmn = 3; //群人数\n }\n\n}\n"),ba=function(e,t,n,i,r,o){var s=r?Object.keys(r).map((function(t){return e.encode(gn.RtcValueInfo,{key:t,value:r[t]},!0)})):void 0,a=o?Object.keys(o).map((function(t){return e.encode(gn.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(gn.RtcInput,{roomType:t,broadcastType:n,joinType:i,innerDatas:s,outerDatas:a})},wa=function(e,t){var n=e.decode(gn.RtcUserListOutput,t),i=n.users,r=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,c=n.offlineKickTime,u={};return fn(i,(function(e){var t=e.userId,n=e.userData,i={};fn(n,(function(e){var t=e.key,n=e.value;i[t]=n})),u[t]=i})),{users:u,token:r,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:c}};!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"}(Na||(Na={})),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"}(Ma||(Ma={}));var Pa,Da=((La={})[Ma.OTHER_DEVICE_LOGIN]=$.RC_DISCONN_KICK,La[Ma.BLOCK]=$.RC_DISCONN_EXCEPTION,La[Ma.BLOCK_NEW]=$.RC_DISCONN_EXCEPTION,La[Ma.REDIRECT_NEW]=$.RC_CONN_REDIRECTED,La[Ma.TOKEN_EXPIRED]=$.RC_CONN_TOKEN_EXPIRED,La[Ma.ILLEGAL_PROTOCOL_VERSION]=$.RC_CONN_PROTO_VERSION_ERROR,La[Ma.ACCOUNT_CANCELLATION]=$.RC_ACCOUNT_CANCELLATION,La),Va=((Ua={})[Na.ACCEPTED]=$.SUCCESS,Ua[Na.UNACCEPTABLE_PROTOCOL_VERSION]=$.RC_CONN_PROTO_VERSION_ERROR,Ua[Na.IDENTIFIER_REJECTED]=$.RC_CONN_IDENTIFIER_REJECTED,Ua[Na.SERVER_UNAVAILABLE]=$.RC_CONN_SERVER_UNAVAILABLE,Ua[Na.TOKEN_INCORRECT]=$.RC_CONN_TOKEN_INCORRECT,Ua[Na.NOT_AUTHORIZED]=$.RC_CONN_NOT_AUTHRORIZED,Ua[Na.REDIRECT]=$.RC_CONN_REDIRECTED,Ua[Na.PACKAGE_ERROR]=$.RC_CONN_PACKAGE_NAME_INVALID,Ua[Na.APP_BLOCK_OR_DELETE]=$.RC_CONN_APP_BLOCKED_OR_DELETED,Ua[Na.BLOCK]=$.RC_CONN_USER_BLOCKED,Ua[Na.TOKEN_EXPIRE]=$.RC_CONN_TOKEN_EXPIRED,Ua[Na.DEVICE_ERROR]=$.RC_CONN_DEVICE_ERROR,Ua[Na.HOSTNAME_ERROR]=$.RC_CONN_HOSTNAME_ERROR,Ua[Na.HASOHTERSAMECLIENTONLINE]=$.RC_DISCONN_SAME_CLIENT_ON_LINE,Ua[Na.OUT_OF_LIMIT]=$.RC_LISCENSE_COUNT_OUT_OF_LIMIT,Ua[Na.IN_OTHER_CLUSTER]=$.RC_CONN_WRONG_CLUSTER,Ua[Na.APP_AUTH_NOT_PASS]=$.RC_APP_AUTH_NOT_PASS,Ua[Na.OTP_USED]=$.RC_OTP_USED,Ua[Na.PLATFORM_ERROR]=$.RC_PLATFORM_ERROR,Ua[Na.ACCOUNT_CANCELLATION]=$.RC_ACCOUNT_CANCELLATION,Ua[Na.LICENSE_EXPIRED]=$.RC_LICENSE_EXPIRED,Ua),Ga=function(e){return e===$.RC_CONN_REDIRECTED},Ba=function(e){return Object.keys(Da).some((function(t){return Da[t]===e}))},ka=function(e){return Object.keys(Va).some((function(t){return Va[t]===e}))};!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(Pa||(Pa={}));var xa,Fa=function(){function e(e,t,n,i,r){this.appkey=e,this.navi=t,this.logger=n,this.statisticLog=i,this.listener=r,this.token="",this.curCmpUrl="",this.reconnectKick=!1,this._connectDurSwitch=!1,this.retryCount=0,this.uuid="",this.reason=0,this.connectedTime=0,this._network={status:!0,type:Xt.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=Pa.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return e.prototype.getToken=function(){return this.token},e.prototype.getCurrentUserId=function(){return this._crtUserId},e.prototype.setConnectionStatus=function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus=e,this._connectDurSwitch&&e!==Pa.CONNECTED&&e!==Pa.CONNECTING){var n={bid:an(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.record(Ee.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case Pa.CONNECTED:this.logger.info(_e.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case Pa.CONNECTING:this.logger.warn(_e.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onConnecting();break;case Pa.SUSPENDED:this.logger.warn(_e.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),Ga(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(_e.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(t)}}},e.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},e.prototype.setNetwork=function(e,t){if(!t){var n={cid:"".concat(this.uuid,"_").concat(this.retryCount),cn:e.type,on:this._network.type};this.statisticLog.record(Ee.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._crtConnectionStatus===Pa.CONNECTED?[2,{code:$.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=Nt(),this.token=e,this.reconnectKick=t,this.setConnectionStatus(Pa.CONNECTING),r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:Je.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.record(Ee.IM_STATS_CS,JSON.stringify(r),i),[4,this.try2Connect(e,t,!1,i)]);case 1:return o=c.sent(),s=o.code,a=o.data,s!==$.SUCCESS?(this.setConnectionStatus(Pa.DISCONNECTED,s),[2,{code:s}]):(this.setConnectionStatus(Pa.CONNECTED),[2,{code:s,data:a}])}}))}))},e.prototype.try2Connect=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,i),[4,this._crtConnectionTask]);case 1:return r=a.sent(),o=r.code,s=r.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},e.prototype.createConnectionTask=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return r={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(e,n,!1,i,r)];case 1:return o=l.sent(),s=o.code,a=o.data,s!==$.SUCCESS?[2,{code:s}]:1===(c=a).type?[2,{code:$.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(_e.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),i),[4,this.connectWithToken(e.replace(/@.+$/,"@"),c,t,i)]);case 2:return u=l.sent(),h=u.code,d=u.data,Ga(h)?(this.logger.warn(_e.L_CONNECT_R,"redirect code: ".concat(h),i),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,i)]):[$.RC_TCP_RESET,$.RC_CONN_ACK_TIMEOUT,$.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(_e.L_CONNECT_R,"cmp ack timeout, code: ".concat(h),i),this.setConnectionStatus(Pa.SUSPENDED,h),this.setConnectionStatus(Pa.CONNECTING),[2,this.createConnectionTask(e,t,!1,i)]):h!==$.SUCCESS?(this.logger.warn(_e.L_CONNECT_R,"code: ".concat(h),i),[2,{code:h}]):(this.logger.info(_e.L_CONNECT_R,"userId: ".concat(d),i),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case $.TIMEOUT:return void(this.reason=Je.TIMEOUT);case $.RC_CONN_REDIRECTED:return void(this.reason=Je.REDIRECTED);default:this.reason=Je.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r=this;return l(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(_e.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),i=function(){return u(r,void 0,void 0,(function(){var r,o;return l(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==Pa.SUSPENDED?[2]:(this.setConnectionStatus(Pa.CONNECTING,t),this.setReconnectReason(t),this.retryCount+=1,r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.record(Ee.IM_STATS_CS,JSON.stringify(r)),[4,this.try2Connect(this.token,!0,e,n)]);case 1:return o=s.sent().code,this.reconnectTimer=null,o===$.SUCCESS?(this.setConnectionStatus(Pa.CONNECTED),[2]):[$.SERVER_UNAVAILABLE,$.TIMEOUT,$.RC_SOCKET_DISCONNECTED,$.RC_SOCKET_NOT_CREATED,$.RC_CONN_ACK_TIMEOUT,$.RC_TCP_RESET,$.RC_NAVI_REQ_FAILED,$.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==Pa.CONNECTING||(this.setConnectionStatus(Pa.SUSPENDED,o),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus(Pa.DISCONNECTED,o),[2])}}))}))},i(),[2]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return Ga(e)?(this.setConnectionStatus(Pa.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===$.RC_UDP_DISCONNECTED?(this.setConnectionStatus(Pa.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(Pa.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(Pa.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return u(this,void 0,void 0,(function(){var e,t,n=this;return l(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==Pa.CONNECTED?(this._failedCount=0,this.logger.debug(_e.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(_e.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=i.sent())===$.SUCCESS?(this.logger.info(_e.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==Pa.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(_e.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(_e.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(Pa.SUSPENDED,$.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,$.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus(Pa.DISCONNECTED,$.ACTIVE_DISCONNECT),this.close(!1,e),[2]}}))}))},e.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},e.prototype.getCmpList=function(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return h([],this.cmpWeightCache,!0);var n=e.server,i=e.backupServer,r=e.serverAddr,o=e.protocol,s=e.openTLS;if(r)return this.cmpWeightCache=h([],r,!0),h([],r,!0);var a=[],c=[];return n&&c.push(n),null==i||i.split(",").forEach((function(e){c.indexOf(e)<0&&c.push(e)})),c.forEach((function(e,i){var r;r=t?1===s?Pe.TLS:Pe.RMTP:"http"===o?Pe.WS:Pe.WSS,a.push({addr:e,protocol:r,weight:n.length-i,race:!1})})),this.cmpWeightCache=a,h([],a,!0)},e.prototype.updateCmpWeight=function(e,t,n){if(this.cmpWeightCache){var i=this.cmpWeightCache.find((function(t){return n?t.addr===e&&t.protocol===Pe.QUIC:t.addr===e}));if(i)if(t){var r=Math.max.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));i.weight!==r&&(i.weight=r+1)}else{var o=Math.min.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));i.weight!==o&&(i.weight=o-1)}}},e.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},e}(),Ha=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=ti(Aa);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=ct(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var i,r=this,o=e,s=((i={})[qo]=r._formatSyncMessages,i[Ho]=r._formatReceivedMessage,i[xo]=r._formatSentMessage,i[Xo]=r._formatHistoryMessages,i[zo]=r._formatConversationList,i[ps]=r._formatChatRoomInfos,i[Rs]=r._formatChatRoomKVList,i[bs]=r._formatUserSetting,i[Ds]=r._formatConversationStatus,i[Ws]=r._formatGrpReadReceiptQryResp,i[ya]=r._formatQueryReceiptResp,i[Us]=r._formatSetUserSettingOutput,i[ws]=r._formatUserSettingNotification,i[sa]=r._formatUltraMsgChangeList,i[ha]=r._formatUltraOperateStatusNotifyList,i[ua]=r._formatUltraMsgList,i[qs]=r._formatUltraGroupUnreadMentionedList,i[hs]=r._formatChrmKVVersion,i[Ta]=r._formatCallKVInfo,i[Ea]=r._fromatCallInfoDownStream,i[us]=r._formateSessionMsgReadInput,i)[t];try{o=e.length>0&&r._codec[t].decode(e),ht(o)&&(o=function(e){for(var t in e)ht(e[t])&&(e[t]=zt(e[t]));return e}(o)),dt(s)&&(o=s.call(this,o,n))}catch(e){this.logger.error(_e.L_PB_DECODE_E,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,i=e.limit;if(t)try{var r=ct(n)?new Uint8Array(n):n;return xr.readUTF(r.subarray(t,i))}catch(e){this.logger.error(_e.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(_e.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,i=e.list,r=e.syncTime,o=e.finished;return(pt(o)||null===o)&&(e.finished=!0),e.syncTime=zt(r),e.list=_n(i,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._getUtfContent=function(e){if(e.user){var t=e.user,n=t.portrait,i=t.portraitUri,r=n||i;r&&(e.user.portrait=e.user.portraitUri=r)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return fn(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,i=e.pushExt,r=e.configFlag,o={};return i&&(o=nn(t,i.pushConfigs,i.pushId)),c(c({},o),{pushTitle:null==i?void 0:i.title,pushContent:n,pushData:"",disablePushTitle:!!r&&Boolean(4&r),forceShowDetailContent:!!r&&Boolean(8&r),templateId:null==i?void 0:i.templateId})},e.prototype._formatReceivedMessage=function(e,t){var i;if(!e)return e;var r=this,o=t||{},s=o.currentUserId,a=o.connectedTime,c=o.afterDecode,u=o.customMessageTypes,l=void 0===u?{}:u,h=e.content,d=e.fromUserId,p=e.type,g=e.groupId,f=e.status,_=e.dataTime,E=e.extraContent,v=e.extStatus,T=e.clientUniqueId,C=e.busChannel,m=e.msgId,y=e.classname,I=e.direction||Z.RECEIVE,R=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(f),S=R.isPersited,O=R.isCounted,N=R.isMentioned,M=R.disableNotification,L=R.receivedStatus,U=R.canIncludeExpansion,A=!!(2&(v||0)),b=!!(4&(v||0)),w=!!(8&(v||0))?Be.PRIVATE:Be.PUBLIC,P=[te.GROUP,te.CHATROOM,te.RTC_ROOM,te.ULTRA_GROUP].indexOf(p)>-1?g:d,D=d,V=Z.RECEIVE;I===Z.SEND&&(D=s,V=Z.SEND);var G=zt(_),B=G<a,k=p===te.CHATROOM,x=r._setExpansion(E),F=r._formatBytes(h);F=r._getUtfContent(F);var H=r._setPushConfig(e,this.logger);k&&d===s&&(V=Z.SEND);var q={conversationType:p,targetId:P,senderUserId:D,messageType:y,messageUId:m,isPersited:S,isCounted:O,isMentioned:N,sentTime:G,messageDirection:V,receivedTime:Nn.getTime(),disableNotification:M,receivedStatus:L,receivedStatusInfo:Sn(L),canIncludeExpansion:U,content:F,expansion:x,pushConfig:H,channelId:C||"",isInterrupt:A,isModifyMessage:b,messageId:zt(T)||0,sentStatus:Se.SENT,isOffLineMessage:B,channelType:w,isStatusMessage:(null===(i=l[y])||void 0===i?void 0:i.isStatusMessage)||!1,readReceiptInfo:void 0};return(null==c?void 0:c(q))||q},e.prototype._formatSentMessage=function(e,t){var i=this,r=e.content,o=e.classname,s=e.sessionId,a=e.msgId,u=e.extraContent,l=e.pushExt,h=e.pushContent,d=e.configFlag,p=e.extStatus,g=e.clientUniqueId,f=e.systemId,_=t.signal,E=t.currentUserId,v=_.date,T=_.topic,C=_.targetId,m=!!(2&(p||0)),y=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e),isMentioned:!!(4&e)}}(s),I=y.isPersited,R=y.isCounted,S=y.disableNotification,O=y.canIncludeExpansion,N=y.isMentioned,M=Ur[T]||te.PRIVATE,L=Tn(or,T),U=i._formatBytes(r),A=f||C;o===oe.RECALL&&(M=U.conversationType||M,A=U.targetId||C);var b=i._setExpansion(u),w=i._setPushConfig(e,this.logger),P=c(c({},w),{pushTitle:null==l?void 0:l.title,pushContent:h,pushData:h,disablePushTitle:!!d&&Boolean(4&d),forceShowDetailContent:!!d&&Boolean(8&d),templateId:null==l?void 0:l.templateId});return{conversationType:M,targetId:A,messageType:o,messageUId:a,isPersited:I,isCounted:R,isStatusMessage:L,senderUserId:E,content:i._formatBytes(r),sentTime:1e3*v,receivedTime:Nn.getTime(),messageDirection:Z.SEND,isOffLineMessage:!1,disableNotification:S,canIncludeExpansion:O,expansion:b,pushConfig:P,channelId:e.busChannel||"",isInterrupt:m,messageId:zt(g)||0,receivedStatus:n.UNREAD,receivedStatusInfo:Sn(n.UNREAD),isMentioned:N}},e.prototype._formatHistoryMessages=function(e,t){var n=this,i=t.conversation||{},r=e.list,o=e.hasMsg,s=i.targetId,a=zt(e.syncTime),c=[];return fn(r,(function(e){var r=n._formatReceivedMessage(e,t);i.conversationType===te.ULTRA_GROUP?r.targetId=e.groupId||i.targetId:r.targetId=s,c.push(r)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,i=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,i=e.time,r=e.changeType,o=e.msgUID,s=e.msgTime,a=e.busChannel,c=e.isAdmin,u=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,p=e.busChannelType,g=e.remindType;return{targetId:t,conversationType:n,changeType:r,messageUId:o,changeTime:zt(i),sendTime:zt(s),channelId:a||"",isAdmin:c,isDel:u,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p,mentionedType:g}})),hasNext:i}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,i=e.info,r=e.summary,o=[],s=[],a=2==(2&n),c=1==(1&n);return c&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.userId,r=e.opType,s=e.optime,a=zt(s);o.push({targetId:t,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.count,r=e.opType;s.push({targetId:t,channelId:n,count:i,operationType:r})})),{conversationType:t,info:o,summary:s,hasInfo:c,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,i=e.list;return{list:i&&i.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatUltraGroupUnreadMentionedList=function(e){var t=e.msgInfo;return(void 0===t?[]:t).map((function(e){return{messageUId:e.msgId,sentTime:zt(e.msgTime),mentionedType:e.remindType,messageType:e.className||""}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,i=t.unreadCount,r=t.remindCount,o=t.busChannelType,s=t.msgInfo,a=t.remindMeCount;return e.versionTime=zt(n)||0,e.unreadMessageCount=this._getUnreadCount(zt(i)||0),e.unreadMentionedCount=this._getUnreadCount(zt(r)||0),e.unreadMentionedMeCount=this._getUnreadCount(zt(a)||0),e.channelType=o||Be.PUBLIC,e.lastReadTime=0,s&&(e.firstUnreadMessage={sentTime:zt(s.msgTime)},e.lastReadTime=zt(s.msgTime)-1),e},e.prototype._getUnreadCount=function(e){return e>999?999:e},e.prototype._formatConversationList=function(e,t){var n=this,i=this,r=e.info,o=t.afterDecode,s={list:(r=_n(r,(function(e){var r=e.msg,s=e.userId,a=e.type,c=e.unreadCount,u=e.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,t)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:zt(c)||0,latestMessage:l,channelId:u||""};return a===te.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==o?void 0:o(h))||h})))||[]};return((null==t?void 0:t.conversationType)||te.NONE)===te.ULTRA_GROUP&&(s.isFinished=e.isFinished),s},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:_n(n,(function(e){var t=e.id,n=e.time;return{id:t,time:zt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return t=_n(t=t||[],(function(e){var t=e.key,n=e.value,i=e.status,r=e.timestamp,o=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?Te.DELETE:Te.UPDATE}}(i);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:zt(r),version:zt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:i}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,i=e.version,r={};return fn(n||[],(function(e){var n=e.key,i=e.version,o=e.value;e.version=zt(i),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=zt(e.createdTime),e.tagName=e.name})),r[n]=e})),{settings:r,version:i}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return fn(t,(function(e){var t=e.type,i=e.channelId,r=e.time,o=e.stateItem,s=e.busChannel,a=ae.CLOSE,c=ue.NOT_SET,u=!1,l=[];fn(o,(function(e){var t=e.sessionStateType,n=e.value,i=e.tags;switch(t){case Dr:a=n===wr?ae.OPEN:ae.CLOSE,c=Number(n)||ue.NOT_SET;break;case Vr:u=n===wr;break;case Gr:l=i}})),n.push({conversationType:t,type:t,targetId:i,notificationStatus:a,notificationLevel:c,isTop:u,updatedTime:zt(r),tags:l,channelId:s||""})})),n},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=zt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatQueryReceiptResp=function(e){var t=e.list,n=void 0===t?[]:t,i=e.num,r=e.readCnt;return{list:n.map((function(e){return{readTime:zt(e.receiptTime),userId:e.userId}})),totalCount:i,readCount:r}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){var t=e.joinTime,n=e.createTime,i=e.memberCount,r=e.chatroomBanState;return{joinTime:t,createTime:n||0,memberCount:i||0,isAllChatroomBanned:!!(1&r),isCurrentUserBanned:!!(2&r),isCurrentChatroomBanned:!!(4&r),isCurrentChatroomInWhitelist:!!(1&e.whiteListState)}},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:zt(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,i=e.msgTime;return{conversationType:e.type,targetId:n,channelId:t||"",timestamp:i}},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Ko);return e.setNothing(1),e.getArrayData()},e.prototype._updateMentionedInfo=function(e,t,n){var i,r,o;return{userIdList:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.userIdList)||t,type:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.type)||n||he.ALL,mentionedContent:(null===(o=e.mentionedInfo)||void 0===o?void 0:o.mentionedContent)||""}},e.prototype._calculateFlag=function(e){var t=e.isFilerWhiteBlacklist,n=e.isVoipPush,i=e.pushConfig||{},r=0;return r|=n?1:0,r|=t?2:0,r|=i.disablePushTitle?4:0,r|=i.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,i=e.androidConfig,r=e.templateId,o=void 0===r?"":r,s=this._codec.getModule(Fo);if(t&&s.setTitle(t),n||i){var a=tn(n,i);s.setPushConfigs(a)}return(null==i?void 0:i.notificationId)&&s.setPushId(null==i?void 0:i.notificationId),s.setTemplateId(o),s},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,i=t.isMentioned,r=t.mentionedType,o=t.content,s=t.directionalUserIdList,a=t.canIncludeExpansion,c=t.expansion,u=t.pushConfig,l=t.channelId,h=t.pushData,d=void 0===h?"":h,p=t.mentionedUserIdList,g=void 0===p?[]:p,f=t.pushContent,_=void 0===f?"":f,E=t.messageId,v=void 0===E?0:E,T=e.conversationType,C=e.targetId,m=this._codec.getModule(xo),y=function(e){var t=e.isStatusMessage,n=e.isPersited,i=e.isCounted;t&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),e.isMentioned&&(r|=4),e.disableNotification&&(r|=32),e.canIncludeExpansion&&(r|=64),r}(t),I=u||{},R=I.pushContent,S=void 0===R?_:R,O=I.pushData,N=void 0===O?d:O;m.setSessionId(y),i&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,g,r)),S&&m.setPushText(S),N&&m.setAppData(N),s&&m.setUserId(s);var M=this._calculateFlag(t);if(m.setConfigFlag(M),m.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),m.setContent(JSON.stringify(o)),a&&c){var L={};fn(c,(function(e,t){L[t]={v:e}})),m.setExtraContent(JSON.stringify(L))}if(u){var U=this._getPushExtraModule(u);m.setPushExt(U)}return m.setClientUniqueId(v),pt(l)||m.setBusChannel(l),T===te.SYSTEM&&m.setSystemId(C),m},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,i=e.broadcastSyncTime,r=this._codec.getModule(jo);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Wo);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,i=t.order,r=t.timestamp,o=t.channelId,s=this._codec.getModule(Jo);return s.setTargetId(e),s.setTime(r),s.setCount(n),s.setOrder(i),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(na);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,i=e.startTime,r=e.order;t=t||0,i=i||0,r=r||0;var o=this._codec.getModule(Zo);return o.setType(n),o.setCount(t),o.setStartTime(i),o.setOrder(r),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,i=this._codec.getModule(os);return i.setType(t),n&&i.setBusChannel([n]),i.getArrayData()},e.prototype.encodeBatchDeleteConversation=function(e){var t=this,n=this._codec.getModule(is),i=[];return e.forEach((function(e){var n=e.conversationType,r=e.targetId,o=e.channelId,s=t._codec.getModule(rs);s.setConversationType(n),s.setConversationId(r),s.setBusChannel(o||""),i.push(s)})),n.setRelation(i),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,i){var r=this._codec.getModule(ss),o=[];return fn(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(o),r.setBusChannel(i),r.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,i){var r=this._codec.getModule(as);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},e.prototype.encodeBatchClearRemoteMessages=function(e){var t=this,n=this._codec.getModule(cs),i=e.map((function(e){var n=t._codec.getModule(as);return n.setTargetId(e.targetId),n.setConversationType(e.conversationType),n.setBusChannel(e.channelId),n.setDataTime(e.timestamp),n}));return n.setInput(i),n.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,i=e.targetId,r=e.channelId,o=t.timestamp,s=this._codec.getModule(us);return o=o||+new Date,s.setType(n),s.setChannelId(i),s.setMsgTime(o),s.setBusChannel(r),s.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.keys,c={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},u=this._codec.getModule(ia);return u.setFromUserId(t),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(c)),u.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.content,c=this._codec.getModule(ia);return c.setFromUserId(t),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(a)),c.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(ra);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,i=e.messages,r=this._codec.getModule(aa),o=i.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return r.setTargetId(t),r.setType(n),r.setQuery(o),r.getArrayData()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,i=e.sentTime,r=e.count,o=this._codec.getModule(Hs);return o.setGroupId(t),o.setBusChannel(n),o.setMsgTime(i),o.setSize(r),o.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,i){var r=this._codec.getModule(la);return r.setTargetId(e),r.setType(t),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(ls);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(ds);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(Fs);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(xs);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,i,r){var o=this._codec.getModule(gs);return o.setType(e),o.setKey(t),o.setHttpMethod(n),o.setQueryString(i),o.setUrl(r),o.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,i){var r=this._codec.getModule(e);return r.setType(t),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var i=this._codec.getModule(ms),r=t.key,o=t.value,s=t.notificationExtra,a=t.isSendNotification,c=t.type,u=t.timestamp,l=c||Te.UPDATE,h=Mn(t,l),d={key:r,value:o||"",uid:n,version:u};if(pt(h)||(d.status=h),i.setEntry(d),a){var p={conversationType:te.CHATROOM,targetId:e},g={key:r,value:o,extra:s,type:l},f=this._getUpMsgModule(p,{messageType:oe.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});i.setNotification(f),i.setBNotify(!0),i.setType(te.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var i=this._codec.getModule(ys),r=t.entries,o=t.type||Te.UPDATE,s=Mn(t,o),a=[];return r.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};pt(s)||(t.status=s),a.push(t)})),i.setEntry(a),i.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Ms);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(As);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Ps);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,i=this._codec.getModule(Bs),r=Nn.getTime(),o=[];return fn(e,(function(e){var t=n._codec.getModule(Vs),i=e.conversationType,s=e.targetId,a=e.notificationStatus,c=e.isTop,u=e.channelId,l=e.notificationLevel,h=[];t.setType(i),t.setChannelId(s),t.setTime(r),t.setBusChannel(u);var d=a===ae.OPEN,p={};pt(a)||(p[Dr]=d),pt(l)||(p[Dr]=l),pt(c)||(p[Vr]=c),fn(p,(function(e,t){if(!pt(e)){var i=n._codec.getModule(Gs);e=e?wr:Pr,pt(l)||Number(t)!==Dr||(e=String(l)),i.setSessionStateType(Number(t)),i.setValue(e),h.push(i)}})),t.setStateItem(h),o.push(t)})),i.setVersion(t||r),i.setState(o),i.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(Ys);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,i=this._codec.getModule(Js),r=[];return e.forEach((function(e){var t=n._codec.getModule(Xs);t.setTagId(e.tagId),t.setName(e.tagName),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(Ys);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeReadReceiptMsg=function(e,t,n){var i=this._codec.getModule(Ca),r=e.conversationType,o=e.targetId,s=e.channelId,a=void 0===s?"":s;return i.setType(r),i.setTargetId(o),i.setBusChannel(a),i.setStartMsgId(t),i.setEndMsgId(n),i.getArrayData()},e.prototype.encodeReceiptQryReq=function(e,t){var n=this._codec.getModule(ma),i=e.targetId,r=e.channelId,o=void 0===r?"":r;return n.setTargetId(i),n.setBusChannel(o),n.setMsgId(t),n.getArrayData()},e.prototype.encodeReceiptCntQryReq=function(e,t){var n=this._codec.getModule(Ra),i=e.targetId,r=e.conversationType,o=e.channelId,s=void 0===o?"":o;return n.setChannelId(i),n.setBusChannel(s),n.setType(r),n.setMsgId(t),n.getArrayData()},e.prototype.encodeSessionMsgReadInput=function(e,t){var n=this._codec.getModule(us),i=e.conversationType,r=e.targetId,o=e.channelId,s=void 0===o?"":o;return n.setType(i),n.setChannelId(r),n.setBusChannel(s),n.setMsgTime(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,i=this._codec.getModule(Zs),r=[];return e.forEach((function(e){var t=n._codec.getModule(Xs);t.setTagId(e),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(zs);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t,n){var i=this,r=this._codec.getModule(Bs),o=[];return t.forEach((function(t){var n=i._codec.getModule(Vs),r=i._codec.getModule(Gs),s=[];e.forEach((function(e){var t=i._codec.getModule(Xs);t.setTagId(e.tagId),pt(e.isTop)||t.setIsTop(e.isTop),s.push(t)})),r.setSessionStateType(Gr),r.setValue(JSON.stringify(s)),r.setTags(s),n.setType(t.conversationType),n.setChannelId(t.targetId),n.setTime(Date.now()),n.setStateItem([r]),o.push(n)})),r.setState(o),r.setVersion(n),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule($s);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(ta);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(ga);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e.prototype.encodeSetCallInfo=function(e,t){var n=this._codec.getModule(_a);return n.setKey(e),n.setDataContent(t),n.getArrayData()},e.prototype.encodePullKVMsg=function(e){var t=this._codec.getModule(va);return t.setSyncTime(e),t.getArrayData()},e}(),qa=function(e){function t(t,n,i,r,o,s){var a=e.call(this,t,n,i,r,s)||this;return a.runtime=o,a.wsListener=s,a._socket=null,a._connectedTime=0,a._socketIndex=0,a._localConnectedTime=0,a._idCount=0,a._generateMessageId=function(){return a._idCount>=65535&&(a._idCount=0),++a._idCount},a._messageIds={},a._syncMessageIds={},a.codec=new Ha(a.logger),a}return a(t,e),t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},t.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getDelayTime=function(){return this._localConnectedTime-this._connectedTime},t.prototype.connectWithToken=function(e,t,n,i){return u(this,void 0,void 0,(function(){var n,r,o,s,a,c,u,h,d;return l(this,(function(p){switch(p.label){case 0:if(n=t.openAnti,r=t.type,o=this.getCmpList(t),0===(s=o.filter((function(e,t){return o.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(_e.L_NAVI_CONF_E,"no service available",i),[2,{code:$.SERVER_UNAVAILABLE}];a=1===n?$i.V4:$i.V3,c=function(t){var n,o,c,h,d,p,g,f,_,E,v;return l(this,(function(l){switch(l.label){case 0:return n=s[t],o=n.protocol,c=n.addr,h=n.weight,d=function(e,t,n,i,r,o,s){var a=qi(r),c=a.type,u=a.version,l="browser"===r.tag?"|".concat(c,"|").concat(u):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(F,"&pid=").concat(o,"&apiVer=").concat(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l)).concat(r.connectPlatform?"&platform=".concat(r.connectPlatform):"").concat(h)}(o===Pe.WS?"ws":"wss",c,u.appkey,e,u.runtime,"",a),p=Date.now(),[4,u.connectWebSocket(d,a,i)];case 1:return g=l.sent(),f=g.code,_=g.data,E=u.cmpWeightCache.findIndex((function(e){return e.addr===c})),v={bid:an(),ptc:Ye.WS,cod:f,net:u.getNetwork().type,dur:Date.now()-p,spr:0,pr:r||0,hos:c,idx:E,rct:u.retryCount?Qe.RECONNECT:Qe.CONNECT,cid:"".concat(u.uuid,"_").concat(u.retryCount),v:We.CURRENT,rsn:u.reason,count:u.retryCount,weight:h},u.statisticLog.record(Ee.IM_WEBSOCKET,JSON.stringify(v),i),f===$.RC_SOCKET_DISCONNECTED||f===$.TIMEOUT?[2,"continue"]:f!==$.SUCCESS?[2,{value:{code:f}}]:(u._localConnectedTime=Math.floor((Date.now()+p)/2),u._socket=_.socket,u.updateCmpWeight(s[t].addr,!0),u.curCmpUrl=s[t].addr,[2,{value:{code:f,data:_.userId}}])}}))},u=this,h=0,p.label=1;case 1:return h<s.length?[5,c(h)]:[3,4];case 2:if("object"==typeof(d=p.sent()))return[2,d.value];p.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:$.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return u(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this.logger.info(_e.T,"connect start: ".concat(e),n),[2,new Promise((function(r){var o=i.runtime.createWebSocket(e);i._socketIndex=o.id;var s=setTimeout((function(){i.logger.info(_e.T,"connect timeout: ".concat(e),n),r({code:$.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),i.logger.info(_e.T,"socket open",n)})),o.onMessage((function(e){if(i._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var s,a=oo(i.logger,e,t);if(a instanceof jr){var c=a.status;if(c!==Na.ACCEPTED)return i.logger.info(_e.T,"connect failed: ".concat(c),n),void r({code:(s=c,Va[s])});i.logger.info(_e.T,"connect success",n);var u=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=u,i._idCount=h,void r({code:$.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof Wr){var d=a.status;return i.logger.info(_e.T,"recv disconnect signal -> status: ".concat(d)),void i.onRecvDisconnect(d,o)}i._onReceiveSignal(a)}}else i.logger.warn(_e.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:o.id}))})),o.onClose((function(){i.logger.info(_e.T,"socket close",n);var e=$.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(o,e)})),o.onError((function(e){i.logger.info(_e.T,"socket error",n);var t=$.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(o,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==Xi.AT_MOST_ONCE&&(e instanceof zr&&!e.syncMsg&&(this.logger.debug(_e.O,"send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new to(t))),e instanceof ro&&(this.logger.debug(_e.O,"send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new io(t))))},t.prototype._publishReader=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o=this;return l(this,(function(s){switch(s.label){case 0:return n=e.syncMsg,i=e.topic,this.logger.debug(_e.O,"recv PublishReader -> messageId: ".concat(t," ").concat(i)),i===Gn?[2]:!n||function(e){return[so.ppMsgS,so.pgMsgS,so.chatMsgS].map((function(e){return so[e]})).indexOf(e)>=0}(i)?(this.wsListener.signal(e),[2]):[4,new Promise((function(e){o._syncMessageIds[t]=e}))];case 1:return r=s.sent(),delete this._syncMessageIds[t],this.wsListener.signal(e,r),[2]}}))}))},t.prototype._onReceiveSignal=function(e){return u(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return t=e.messageId,e instanceof Jr&&this._pingResolve?(this._pingResolve($.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(e,t),t>0&&(e instanceof eo||e instanceof ro)&&(this.logger.debug(_e.O,"recv ack -> messageId: ".concat(t," ").concat(e.topic)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(i=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],i(e))),e instanceof zr?[4,this._publishReader(e,t)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.onRecvDisconnect=function(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(e){return Da[e]}(e)))},t.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))},t.prototype.clearResolves=function(){for(var e in this._messageIds){var t=this._messageIds[e];delete this._messageIds[e],t($.RC_SOCKET_DISCONNECTED)}},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n($.TIMEOUT)}),e),t.sendOnly(new Qr)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof $r||e instanceof no)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),u(this,void 0,void 0,(function(){var r,o,s,a,c=this;return l(this,(function(u){switch(u.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){c._messageIds[r]=e,setTimeout((function(){c._messageIds[r]&&delete c._messageIds[r],e()}),i)}))]):[2,{code:$.RC_NET_CHANNEL_INVALID}];case 1:return(o=u.sent())?o instanceof ro||o instanceof eo?(s=t&&o.data&&[$.SUCCESS,$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(this.logger.warn(_e.O,"send failed -> message: ".concat(r,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:$.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(_e.O,"send timeout -> message: ".concat(r,", respPBName: ").concat(t,", timeout: ").concat(i)),[2,{code:$.TIMEOUT}])}}))}))},t.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},t}(Fa);!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD"}(xa||(xa={}));var Ka=null,Ya="RC_CONF",ja="RC_STATISTICS",Wa=null,Qa=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,Ka];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(ja,"readwrite").objectStore(ja),r=IDBKeyRange.lowerBound(Date.now()-e),o=i.getAllKeys(r);o.onsuccess=function(){var e=o.result,t=e.length;if(t>0){var r=i.delete(IDBKeyRange.bound(e[0],e[t-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),Wa=setTimeout((function(){return Qa(e)}),6e5),[2]}}))}))},Ja=function(e,t,n){void 0===n&&(n=168),Ka||("undefined"!=typeof window&&window&&window.indexedDB?Ka=new Promise((function(i){var r=window.indexedDB;r.databases&&r.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_STATISTIC_".concat(e),s=r.open(o,2);s.onerror=function(e){t.error(_e.L_LOGDB_OPEN_FAILED_E,e.target.error),i(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(e){t.warn(_e.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(_e.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(_e.L_LOGDB_ABORT_S,e.target.error)},Qa(3600*Math.max(24,Math.min(168,n))*1e3),i({appkey:e,db:o})):i(null)},s.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(ja)&&t.deleteObjectStore(ja);var n=t.createObjectStore(ja,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Ya,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(_e.L_UNSUPPORT_INDEXDB_O))},Xa=[],Za=function(){return u(void 0,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return Ka?(Wa&&(clearTimeout(Wa),Wa=null),[4,Ka]):[2];case 1:return(e=n.sent())&&(t=e.db,Xa.push(t)),Ka=null,[2]}}))}))};function za(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,Ka];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(Ya,"readonly").objectStore(Ya).get(e);i.onsuccess=function(e){var t;n({value:null===(t=i.result)||void 0===t?void 0:t.value,success:!0})},i.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var $a,ec="REPORT_SESSION",tc=function(e,t){return u(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(ec,"_").concat(e),[4,za("".concat(ec,"_").concat(e))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(t===(null==o?void 0:o.sessionId)||function(e,t){u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,Ka];case 1:return(n=r.sent())?(i=n.db,i.transaction(Ya,"readwrite").objectStore(Ya).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},nc=function(){return Ka},ic=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,o=e.time,s=e.tag,a=e.type,c=e.content,u=n<0?c||"":JSON.stringify({content:c,traceId:r,from:i});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},rc=Mt(),oc=Date.now(),sc=0,ac=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.record=this._writer.bind(this,xa.STATISTICS)}return e.prototype._writer=function(e,t,n,i){var r=new Date;/^[\w-]+$/.test(t)&&this.flush({time:+r,sessionId:rc,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})},e.prototype.createTraceId=function(){return"".concat(rc,"-").concat(++sc)},e.prototype.getSessionId=function(){return rc},e}(),cc=function(){function e(e,t,n,i,r,o){void 0===o&&(o=r),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.statisticDB=i,this.logger=r,this.reportClass=o,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return u(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=ci.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this.logger.debug(_e.L_REALTIME_LOG_O,JSON.stringify({count:e.length}),t),r=i,[4,this.compressStatistics(e)];case 1:return o=l.sent(),s=o.success,a=o.data,s||this.logger.warn(_e.L_REALTIME_LOG_O,"compress failed",t),this.logger.debug(_e.L_REALTIME_LOG_O,"compress done",t),c=ft(n)?n:"https://".concat(n),c+="?version=".concat("5.9.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:c,body:a,method:"POST"})];case 2:return u=l.sent().status,this.logger.debug(_e.L_REALTIME_LOG_R,JSON.stringify({status:u}),t),200===u?(this.reportFailedNumber=0,r=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(e[e.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++),[2,r]}}))}))},e.prototype.realtimeReport=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||oc,o=Math.max(i-5e3,r),s=this.reportClass.createTraceId(),this.logger.debug(_e.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:t}),s),[4,this.statisticDB.getStatistics(r,o,t,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(_e.L_REALTIME_LOG_R,"db error",s),[3,4]);case 2:return u.length>0?[4,this._sendLogs2Realtime(u,s,e,n)]:[3,4];case 3:h=l.sent(),n=h,l.label=4;case 4:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return d.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(_e.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:o}),s),[4,this.statisticDB.getStatistics(e,t,xa.STATISTICS,!1)]);case 1:return a=l.sent(),c=a.dbReady,u=a.logs,this.logger.info(_e.L_REPORT_FULL_LOG_O,JSON.stringify({count:u.length}),s),h=ft(i)?i:"https://".concat(i),h+="?version=".concat("5.9.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),c?u.length>0?[4,this.compressStatistics(u)]:[3,3]:[3,5];case 2:return p=l.sent(),g=p.success,f=p.data,d=g?f:"compress failed",[3,4];case 3:d="no data",l.label=4;case 4:return[3,6];case 5:d="no database",l.label=6;case 6:return this.logger.debug(_e.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:h,body:d,method:"POST"})];case 7:return _=l.sent().status,this.logger.info(_e.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),uc="RC_STATISTICS",lc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){gc(e)},t}(ac),hc=!1,dc=[],pc=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return hc||0===dc.length?[2]:(hc=!0,t=dc.splice(0),[4,new Promise((function(n){var i=e.transaction(uc,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(uc);t.forEach((function(e){try{r.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),hc=!1,0===dc.length&&Xa.length>0&&(Xa.forEach((function(e){return e.close()})),Xa.length=0),setTimeout((function(){return pc(e)})),[2]}}))}))},gc=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,nc()];case 1:return(t=n.sent())?(dc.push(e),pc(t.db),[2]):[2]}}))}))},fc=0,_c=function(){return{setTimestamp4RealtimeLog:function(e){fc=e},getTimestamp4RealtimeLog:function(){return fc},getStatistics:function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return[4,nc()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(uc,"readonly").objectStore(uc),o=[],s=IDBKeyRange.bound(e,t),a=r.index("time").openCursor(s);a.onsuccess=function(e){var t=e.target.result;if(t){var n=t.value;o.push(n),t.continue()}else i({dbReady:!0,logs:o})},a.onerror=function(e){i({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ec=function(e){function t(t,n,i,r){var o=this,s=Lt(n),a=qi(n),c="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=e.call(this,t,s,c,_c(),i,r)||this).runtime=n,o}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,tc(t.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressStatistics=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:xi(e.map(ic).join(""))}]}))}))},t.prototype.isReporter=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.reportClass.getSessionId(),u(void 0,void 0,void 0,(function(){var e,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,za("".concat(ec,"_").concat(t))];case 1:return e=o.sent(),i=e.success,r=e.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,i,r,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){switch(a.label){case 0:return[4,this.isReporter()];case 1:return a.sent()?[2,e.prototype.report.call(this,t,n,i,r,o,s)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(cc),vc=function(e){function t(t,n,i){var r=e.call(this,t,n)||this;return r.appkey=t,r.logger=n,r.runtime=i,r._storageKey="",r._storageKey=W.STATIC_CONFIG_KEY(t),r}return a(t,e),t.prototype.getCache=function(){return this.runtime.localStorage.getItem(this._storageKey)},t.prototype.setCache=function(e){this.runtime.localStorage.setItem(this._storageKey,e)},t.prototype.clearCache=function(){this.runtime.localStorage.removeItem(this._storageKey)},t.prototype.sendRequest=function(e){return u(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return[4,this.runtime.httpReq({url:e})];case 1:return t=r.sent(),n=t.status,i=t.data,[2,{code:n,data:i}]}}))}))},t.prototype.decryptData=function(e){return u(this,void 0,void 0,(function(){var t,n;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,cn(e,A,b)];case 1:return t=i.sent(),[2,JSON.parse(t)];case 2:return n=i.sent(),this.logger.error(_e.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},t}(ui),Tc=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,i,r,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,c=null!==(i=e.platform)&&void 0!==i?i:"",u=null!==(r=e.uri)&&void 0!==r?r:"";e.logId!==this.logId&&""!==u&&(this.logId=e.logId,this.reporter.report(s,a,c,u,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}();!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}($a||($a={}));var Cc={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}};function mc(){return Cc}var yc=function(){function e(e,t,n,i){this.logger=e,this.appkey=t,this.reporter=n,this.statisticLog=i,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new Tc(n)}return e.prototype.init=function(){try{var e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):mc()}catch(e){this._cache=mc()}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===oe.LOG_COMMAND&&t.uploadTaskManage.uploadLogCmdTask(e)}))},e.prototype.dataHandle=function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,_t(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 u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return!this.isEable&&t===$a.init&&this.isExire()?(this.logger.info(_e.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===$a.newWorkChange&&this.isOverclock()?(this.logger.info(_e.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(i=un(e),this.lastRequestTime=(new Date).getTime(),r="".concat(i,"/v1/config"),o={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(o["RC-Token"]=n),s={platform:"web",version:"5.9.4",timestamp:this.timestamp},this.statisticLog.record(Ee.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!n,uri:r})),[4,this.httpRequest(r,Jt.POST,o,s)]);case 1:return a=l.sent(),c=a.code,u=a.data,this.statisticLog.record(Ee.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:u})),c===$.CLOUD_DATA_CENTER_INVALID&&u&&u.targetRegion?(h=u.targetRegion,this.changeAreaCode===h?[2,this.timestamp]:(d=ci.setAreaCode(h),this.logger.info(_e.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:d,originAreaCode:ci.getAreaCode(),newAreaCode:h})),this.changeAreaCode=h,(p=ci.getCloudControllerUrl(h))[0]?[2,this.request(p[0],$a.other)]:(this.logger.info(_e.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:r,msg:"appkey region error"})),[2,this.timestamp]))):(u&&this.dataHandle(u),[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}(),Ic=function(e){function t(t,n,i,r,o){var s=e.call(this,i,t,r,o)||this;s.runtime=n,s._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};var a=yn(n);return s.deviceId=Lt(n),s.model="Web|".concat(a.type,"|").concat(a.version),s.init(),s}return a(t,e),t.prototype.httpRequest=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return(r=i).deviceId=this.deviceId,r.model=this.model,o={url:e,method:t,headers:n,body:JSON.stringify(r)},this.logger.info(_e.L_REQUEST_T,JSON.stringify(o)),[4,this.runtime.httpReq(o)];case 1:s=l.sent(),a=s.status,c=s.data,u=void 0===c?"":c,this.logger.info(_e.L_REQUEST_R,JSON.stringify({status:a,data:u}));try{return h=JSON.parse(u),d=h.data,[2,{code:parseInt(h.code,10),data:d}]}catch(e){return this.logger.warn(_e.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:u,error:e})),[2,{code:a,msg:e}]}return[2]}}))}))},t.prototype.setCloudControllerCache=function(e){var t=W.CLOUD_CONTROL_KEY(this.appkey);this.runtime.localStorage.setItem(t,JSON.stringify(e)),this.logger.info(_e.L_CLOUD_SET_CACHE_O,JSON.stringify(e))},t.prototype.getLocalCloudControllerCache=function(){var e=W.CLOUD_CONTROL_KEY(this.appkey),t=this.runtime.localStorage.getItem(e);return this.logger.info(_e.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:e,data:t})),t},t.prototype.setMRTRConfig=function(e){this.logger.info(_e.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e},t.prototype.getMRTRConfig=function(){return this._mrtr},t}(yc),Rc=function(){function e(e,t,n,i){this._storage=new o(e,W.READ_RECEIPT_KEY(t,n)),this._delayTime=i,this.clear()}return e.prototype._getConversationKey=function(e){return"".concat(e.targetId,"_").concat(e.channelId)},e.prototype._removeExcessData=function(e){for(var t=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),n={},i=0,r=t;i<r.length;i++){var o=r[i];n[o.key]=o.value}return n},e.prototype.insert=function(e,t,n,i,r){var o;if(!(i<Date.now()-this._delayTime-j)){var s=this._getConversationKey(e),a=this._storage.get(s)||{};if(!a[t]){var u={t:i,d:n};r&&(u.sId=r);var l=c(c({},a),((o={})[t]=u,o));Object.keys(l).length>30&&(l=this._removeExcessData(l)),this._storage.set(s,l)}}},e.prototype.addReadedUser=function(e,t,n){var i,r=this._getConversationKey(e),o=this._storage.get(r)||{},s=o[t];if(s){if(s.us){if(s.us.includes(n))return}else s.us=[];s.us.push(n),this._storage.set(r,c(c({},o),((i={})[t]=s,i)))}},e.prototype.getReadReceiptInfo=function(e,t){var n=this._getConversationKey(e),i=(this._storage.get(n)||{})[t];return i?{time:i.t,direction:i.d,users:i.us||[],senderId:i.sId}:null},e.prototype.getReceiptMessageDic=function(e){var t=this._getConversationKey(e),n=this._storage.get(t)||{},i={};for(var r in n){var o=n[r];o.d===Z.RECEIVE&&(i[o.sId]||(i[o.sId]=[]),i[o.sId].push(r))}return i},e.prototype.remove=function(e,t){var n=this._getConversationKey(e),i=this._storage.get(n)||{};i[t]&&(delete i[t],0===Object.keys(i).length?this._storage.remove(n):this._storage.set(n,i))},e.prototype.clear=function(){var e=this._storage.getValues(),t={};for(var n in e){var i=e[n],r={};for(var o in i){var s=i[o];Date.now()-this._delayTime-s.t<j&&(r[o]=s)}Object.keys(r).length&&(t[n]=r)}this._storage.update(t)},e}(),Sc=function(e,t,i,r,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:Z.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:Sn(n.UNREAD),pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:Se.SENT}},Oc=function(e){return e.sort((function(e,t){var n,i,r=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=t.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r})),e},Nc=function(e){function t(t,n,i,r){var o=e.call(this,t,n,i,r,new bi(r.appkey,"RC-E","IM"),new lc(r.appkey,"RC-E","IM"))||this;o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o.currentUserId="",o._openCallPlus=!1,o.cloudControllerUri="",o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,o._latestPullKVMsgTimestamp=0,o._intervalTimerForChrmPull=-1,o._handleInnerMsgOptions=function(e,t,n){var i,r=n.messageType;if("RC:SRSMsg"===r&&Object.assign(n,{directionalUserIdList:[o.currentUserId]}),r===oe.READ_RECEIPT_RESPONSE){if(!n.content.receiptMessageDic||0===Object.keys(n.content.receiptMessageDic).length){var s=null===(i=o._readReceiptManager)||void 0===i?void 0:i.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},o._lastSyncUltraMsgTimeStamp=0,o._lastSyncUltraMsgLocalTimeStamp=0,o._ultraGroupTimer=-1,o._isUltraPulling=!1,o._ultraGroupTimeQue=[],o._isUltraGroupListExist=!1,o._ultraGroupMap={},o._ultraMsgMap={},o._pullUltraChangeMessageQue=[],o._isPullingUltraChangeMessage=!1,o._lastPullingUltraChangeMessageTime=0;var s=r.appkey,a=r.logOutputLevel,c=r.logExpireTime,u=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy;return o.logger.setOutputLevel(a),ci.init({areaCode:l,navigators:u,logServerUrl:h,miniCMPProxy:d}),Ei(s,o.logger,t,c),o.reporter=new Yi(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new Uo(s,o.logger,o.statisticLog,t,new vc(s,o.logger,t)),Ja(s,o.logger,c),o.reporterStatistic=new Ec(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new ao(t,s),o._sendMessageStore=new Ao(t,s),o._chrmEntryHandler=new lo(o),o._connMgr=new qa(s,o.navi,o.logger,o.statisticLog,o.runtime,{signal:o._signalHandler.bind(o),onConnected:o.onConnected.bind(o),onDisconnected:o.onDisconnected.bind(o),onConnecting:o._watcher.onConnecting,onSuspend:o.onSuspend.bind(o)}),"browser"===o.runtime.tag&&o._initCloudController(),o}return a(t,e),t.prototype._initCloudController=function(){var e=ci.getCloudControllerUrl();this.cloudControllerUri=e[0],this.cloudController=new Ic(this._appkey,this.runtime,this.logger,this.reporter,this.statisticLog),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,$a.init)},t.prototype.onConnected=function(){var e=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),t=this._connMgr.getCurrentUserId();this.currentUserId=t,this._pullOfflineFinished=!1,this._joinedChrmManager||(this._joinedChrmManager=new ho(e.joinMChrm)),this._conversationManager||(this._conversationManager=new So(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new ko(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new Oo(this,this._appkey,this.currentUserId,this._watcher.tag)),this._readReceiptManager||(this._readReceiptManager=new Rc(this.runtime,this._appkey,this.currentUserId,this._connMgr.getDelayTime())),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===e.ugMsg&&this._notificationOnline(),this._watcher.onConnected(),this.reporter.checkStart(e),this.reporterStatistic.checkStart(e)},t.prototype.onDisconnected=function(e){var t,n;this._resetMemoryState(),null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onDisconnected(e)},t.prototype.onSuspend=function(e){var t,n;null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onSuspend(e)},t.prototype.createLogger=function(e,t){return new bi(this._appkey,e,t)},t.prototype.createStatisticLogger=function(e,t){return new lc(this._appkey,e,t)},t.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},t.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},t.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},t.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},t.prototype.connect=function(e,t,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return this._openCallPlus=n,[2,this._connMgr.connect(e,t,n,i)]}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,i=e.topic;if(n)this._receiveSyncMsg(e,t);else{var r=this.logger.createTraceId();this.logger.debug(_e.L_RECV_RMTP_O,i,r);var o=so[i];if(o)switch(o){case so.s_ntf:this._pullMsg(e);break;case so.s_msg:this._receiveMsg(e);break;case so.s_cmd:this._receiveStateNotify(e);break;case so.s_us:this._receiveSettingNotify(e);break;case so.rtc_ntf:this._receiveRtcKv(e.data);break;case so.s_opNtf:this._pullOperateStatusNotify(e);break;case so.s_pubCall:this._pubCallInfo(e)}else this.logger.error(_e.L_RECV_RMTP_E,i,r)}},t.prototype._receiveStateNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Qo),n=t.time,i=t.type,r=t.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(r,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(r),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(n),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(n),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,ws).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=e.channelId,i=void 0===n?"":n,r=e.conversationType,o=e.targetId,s=t.put,a=t.del,c=t.mid;s&&this._watcher.expansion({updatedExpansion:{messageUId:c,expansion:s,channelId:i,conversationType:r,targetId:o}}),a&&this._watcher.expansion({deletedExpansion:{messageUId:c,deletedKeys:a,channelId:i,conversationType:r,targetId:o}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,us),i=n.targetId,r=n.channelId,o=n.timestamp,s=this._ultraGroupMap["".concat(r,"_").concat(i)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(Rn([s]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},t.prototype._receiveSyncMsg=function(e,t){if(bo.includes(e.topic))if(e.topic!==so[so.updRTime])if(e.topic!==so[so.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(e.data,xo,{currentUserId:this.currentUserId,signal:e});((n=this._handleMsgProperties(n)).conversationType!==te.CHATROOM||this._chrmsQueue[n.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||n.sentTime):(t&&(n.sentTime=t.timestamp,n.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(_e.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==oe.EXPANSION_NOTIFY?((n.messageType===oe.SYNC_READ_STATUS||n.messageType===oe.READ_RECEIPT&&n.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(n.conversationType,n.targetId,n.channelId,n.sentTime),n.messageType===oe.READ_RECEIPT_REQUEST&&this._processRRReqMsg(n),n.messageType===oe.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(n),this._conversationManager.setConversationCacheByMessage(n,!0),this._batchMessage([n])):this._receiveMessageExpansion(n)))}else this._clearUltraGroupUnreadCount(e,t);else this._receivesyncReadStatus(e)},t.prototype._batchMessage=function(e){for(var t=this,n=[],i=[],r=[],o=e.length-1;o>=0;o-=1){var s=e[o];s.messageType===oe.LOG_COMMAND&&s.senderUserId===Y?i.unshift(s):s.messageType===oe.CLOUD_CONTROL&&s.senderUserId===Y?r.push(s):n.unshift(s)}this._watcher.batchMessage(n),i.forEach((function(e){var n=e.content,i=n.startTime,r=n.endTime,o=n.platform,s=n.logId,a=n.uri;t.reporter.report(parseInt(i,10),parseInt(r,10),o,a,s,e.messageUId)})),r.length>0&&this._ccMsgHandler(r)},t.prototype._ccMsgHandler=function(e){var t;return u(this,void 0,void 0,(function(){var n,i,r;return l(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,$a.other,n)]):[3,2];case 1:i=o.sent()||0,(r=e.filter((function(e){return e.sentTime>i}))).length>0&&this._ccMsgHandler(r),o.label=2;case 2:return[2]}}))}))},t.prototype._pubCallInfo=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Ea),n=t.key,i=t.dataContent,r=t.maxTime;this._latestPullKVMsgTimestamp=r,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:i}]}))},t.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Qo),n=t.type,i=t.chrmId,r=t.time;if(this.logger.info(_e.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(r)),2===n){var o=this._chrmsQueue[i];if(!o)return;o.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()},t.prototype._receivesyncReadStatus=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,us),n=t.conversationType,i=t.targetId,r=t.channelId,o=t.timestamp,s=t.sentTime;this._conversationManager.clearUnreadCount(n,i,r,s),this._watcher.syncReadStatus({conversationType:n,targetId:i,channelId:r,timestamp:o})},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncCallPullKVMsg=function(){return u(this,void 0,void 0,(function(){var e,t,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new no(yr,e,this.currentUserId),[4,this._connMgr.send(t,Ta)]):[2];case 1:return n=o.sent(),i=n.code,r=n.data,i===$.SUCCESS&&r?(this._latestPullKVMsgTimestamp=r.maxTime,this._watcher.callInfo(JSON.stringify({list:r.info})),[2]):[2]}}))}))},Object.defineProperty(t.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===Pa.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._messageProcessor=function(e){var t=this,n=0,i=[],r=[],o=[],s=[],a=[];return e.forEach((function(e){var c=e.conversationType,u=e.targetId,l=e.channelId,h=e.messageDirection,d=e.messageUId,p=e.messageType,g=e.sentTime,f=e.senderUserId;if((i.push(d),h===Z.SEND)&&(n=Math.max(g,n),t._sendMessageStore.getSendMessageMap()[d]))return void t._sendMessageStore.removeByUID(d);if(p!==oe.DELIVERED&&p!==oe.DELIVERED_MSG)if(p!==oe.EXPANSION_NOTIFY){if(g>=t._connMgr.getConnectedTime()&&t._writeMessagesLog(d,c)&&a.push(d),p===oe.READ_RECEIPT&&f===t.currentUserId&&t._conversationManager.clearUnreadCount(c,u,l,g),p!==oe.SYNC_READ_STATUS||t._processSRSMsg(e))if(p!==oe.READ_STATE){p===oe.READ_RECEIPT_REQUEST&&t._processRRReqMsg(e),p===oe.READ_RECEIPT_RESPONSE&&t._processRRRspMsg(e);var _=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(_,!0),r.push(_)}else s.push(e)}else o.push(e)})),{newOutboxTime:n,messageUIds:i,messages:r,messageExpansionList:o,RSMsgList:s,msgUIds2Statistic:a}},t.prototype._processSRSMsg=function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=e.content,o=e.senderUserId,s=e.sentTime;if(o!==this.currentUserId)return!1;var a=this.getNaviInfoFromCache();return this._conversationManager.clearUnreadCount(t,n,i,s),1!==a.sesDriven||(s>this.getConnectedTime()||this._watcher.syncReadStatus({conversationType:t,targetId:n,channelId:i,timestamp:r.lastMessageSendTime}),!1)},t.prototype._processRSMsg=function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=e.content,o={conversationType:t,targetId:n,channelId:i};this._watcher.messageReadReceipt(t===te.PRIVATE?{privateReadReceipt:c(c({},o),{endMsgTime:r.endMsgTime})}:{groupReadReceipt:c(c({},o),{totalCount:r.tmn,readedCount:r.rrn,messageUId:r.msgId})})},t.prototype._processRRReqMsg=function(e){var t,n=e.conversationType,i=e.channelId,r=e.targetId,o=e.content,s=e.sentTime,a=e.messageDirection,c=e.senderUserId;null===(t=this._readReceiptManager)||void 0===t||t.insert({conversationType:n,channelId:i,targetId:r},o.messageUId,a,s,c)},t.prototype._processRRRspMsg=function(e){var t,n=this,i=e.conversationType,r=e.channelId,o=e.targetId,s=e.content,a=e.senderUserId,c=s.receiptMessageDic,u=void 0===c?{}:c;if(a===this.currentUserId)for(var l in u)for(var h=0,d=u[l];h<d.length;h++){var p=d[h];null===(t=this._readReceiptManager)||void 0===t||t.remove({conversationType:i,channelId:r,targetId:o},p)}else(u[this.currentUserId]||[]).forEach((function(e){var t;null===(t=n._readReceiptManager)||void 0===t||t.addReadedUser({conversationType:i,channelId:r,targetId:o},e,a)}))},t.prototype._syncMsg=function(){return u(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,c,u,h,d,p,g,f,_,E,v,T,C,m,y,I,R=this;return l(this,(function(l){switch(l.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=this._connMgr.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),r=new no(so[so.pullMsg],i,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(_e.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o),[4,this._connMgr.send(r,qo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId,customMessageTypes:this._customMessageType})]):(this._pullingMsg=!1,[2]);case 1:return s=l.sent(),a=s.code,c=s.data,this._latestSyncTimestamp=Date.now(),a!==$.SUCCESS||!c||pt(c.finished)||pt(c.list)||pt(c.syncTime)?(this.logger.warn(_e.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(u=c.list,h=c.finished,d=c.syncTime,p=c.broadcastSyncTime,g=void 0===p?1:p,this.logger.info(_e.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:u.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),o),f=this._messageProcessor(u),_=f.newOutboxTime,E=f.messageUIds,v=f.messages,T=f.messageExpansionList,C=f.RSMsgList,(m=f.msgUIds2Statistic).length>0&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:m.join(",")})),this._batchMessage(v),T.forEach((function(e){R._receiveMessageExpansion(e)})),C.forEach((function(e){R._processRSMsg(e)})),this._letterbox.setInboxTime(d,this.currentUserId),this._letterbox.setOutboxTime(_,this.currentUserId),this._letterbox.setBroadcastSyncTime(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(_),this._pullingMsg=!1,y=this._pullQueue.filter((function(e){return e>d})),this._pullQueue.length=0,(I=this._pullQueue).push.apply(I,y),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(_e.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:y}),o),h?(this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg()),[2]):(this._syncMsg(),[2]))}}))}))},t.prototype._receiveMsg=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,Ho,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()}),n=(t=this._handleMsgProperties(t)).conversationType,i=t.messageType,r=t.senderUserId,o=t.messageUId,s=t.sentTime,a=t.isStatusMessage;if(this.logger.info(_e.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),this._writeMessagesLog(o,n)&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:o})),n!==te.RTC_ROOM&&i!==oe.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}r===this.currentUserId&&this._sendMessageStore.setMessage(o,s),a||r===this.currentUserId||this._letterbox.setInboxTime(s,this.currentUserId),this._handleNotNotifyMsg(t)||(i===oe.READ_RECEIPT_REQUEST&&this._processRRReqMsg(t),i===oe.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(t),this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t]))}},t.prototype._handleNotNotifyMsg=function(e){var t=e.messageType,n=e.senderUserId;return t===oe.DELIVERED||(t===oe.DELIVERED_MSG||(t===oe.EXPANSION_NOTIFY?(this._receiveMessageExpansion(e),!0):t===oe.SYNC_READ_STATUS&&n!==this.currentUserId||t===oe.READ_STATE&&(this._processRSMsg(e),!0)))},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,i=e.messageType,r=e.isStatusMessage,o=e.isCounted,s=void 0!==o&&o,a=e.isPersited,u=void 0!==a&&a,l=i in w,h=i in this._customMessageType;if(n=l?c(c({},w[i]),{isStatusMessage:D.includes(i)}):h?this._customMessageType[i]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(e,n),t&&!pt(r)&&(e.isStatusMessage=r),!t){var d=e.content.user;if(d){var p=d.portrait,g=d.portraitUri,f=p||g;f&&(d.portrait=d.portraitUri=f)}}return e},t.prototype._fixDownstreamData=function(e,t,n){return e&&2===t.list.length&&(t.hasMore=!0,0===n?t.list.shift():t.list.pop()),t},t.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){var c;return void 0===o&&(o=""),u(this,void 0,void 0,(function(){var s,u,h,d,p,g,f,_,E,v,T,C=this;return l(this,(function(l){switch(l.label){case 0:return u=(s=this).currentUserId,h=s._connMgr,d=Ar[e]||Ir,p=1===i&&0===n,h?(g=h.codec.encodeGetHistoryMsg(t,{timestamp:n,count:p?2:i,order:r,channelId:o}),this.logger.info(_e.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:o,timestamp:n,count:i,order:r}),a),[4,h.send(new no(d,g,u),Xo,{currentUserId:u,connectedTime:h.getConnectedTime(),conversation:{targetId:t},afterDecode:function(n){var i,r=null===(i=C._readReceiptManager)||void 0===i?void 0:i.getReadReceiptInfo({conversationType:e,channelId:o,targetId:t},n.messageUId);if(r){var s=r.users;n.readReceiptInfo={isReceiptRequestMessage:!0,readerList:s}}return n}})]):[3,2];case 1:return f=l.sent(),_=f.code,E=f.data,_===$.SUCCESS&&E?(v=this._fixDownstreamData(p,E,r),T=[],null===(c=v.list)||void 0===c||c.forEach((function(e){e&&T.push(e.messageUId)})),this.logger.info(_e.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:T.join(",")}),a),[2,{code:_,data:{list:v.list,hasMore:v.hasMore}}]):(this.logger.warn(_e.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:""}),a),[2,{code:_}]);case 2:return[2,{code:$.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getMessages=function(e,t,n,i,r,o,s){return this.getHistoryMessage(e,t,n,i,r,o,s)},t.prototype.reportSDKInfo=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=this.logger.createTraceId(),o=JSON.stringify(e),this.logger.debug(_e.L_VER_REPORT_T,o,r),s=i.codec.encodeReportSDKInfo(o),a=new no(so[so.reportsdk],s,n),[4,i.send(a)]):[2];case 1:return(c=u.sent().code)!==$.SUCCESS&&this.logger.warn(_e.L_VER_REPORT_R,c,r),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeDeleteMessages(e,t,n,i),c=sr,e===te.ULTRA_GROUP&&(c=ar),u=new no(c,a,o),[4,s.send(u)]):[2,$.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeClearMessages(t,n,i,e),c=br[e],u=new no(c,a,o),[4,s.send(u)]):[2,$.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},t.prototype.batchClearRemoteHistoryMessages=function(e,t){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=i.codec.encodeBatchClearRemoteMessages(e),o=new no(Cr,r,n),[4,i.send(o)]):[2,$.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,t=t||te.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),c=new no(fr,a,o),[4,s.send(c,zo,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=p._conversationManager.get(t,n,i);Object.assign(e,r);var o=p._conversationManager.getDraft(t,n,i);return e.draft=o,e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,h!==$.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},t.prototype.removeConversation=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new no(_r,r,t),[4,i.send(o)]):[2,$.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},t.prototype.batchRemoveConversation=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeBatchDeleteConversation(e),i=new no(Er,n,this.getCurrentUserId()),[4,t.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},t.prototype.getConversation=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return e!==te.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:$.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:$.CONVER_GET_ERROR}];case 2:if(o=l.sent(),s=o.code,a=o.data,s!==$.SUCCESS)return[2,{code:$.CONVER_GET_ERROR}];c=this._conversationManager.getDraft(e,t,n),u=(null==a?void 0:a.list[0])||null,i={conversationType:e,targetId:t,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:u,notificationStatus:r.notificationStatus||ae.CLOSE,notificationLevel:r.notificationLevel||ue.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0,draft:c},l.label=3;case 3:return[2,{code:$.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var i=0;if(e.includes(te.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});for(var r in this._ultraGroupMap){var o=this._ultraGroupMap[r];(0===t.length||t.includes(o.notificationLevel))&&(i+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return i+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return e===te.ULTRA_GROUP?(r=(null===(i=this._ultraGroupMap["".concat(n,"_").concat(t)])||void 0===i?void 0:i.unreadMessageCount)||0,r=this._getUnreadCount(r)):r=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:$.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,this.getServerTime(),!1),Promise.resolve($.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve($.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getFirstUnreadMessageInfo=function(e,t,n){var i=this._conversationManager.get(e,t,n),r=i.firstUnreadMessageUid,o=i.firstUnreadTime;return Promise.resolve({code:$.SUCCESS,data:o&&r?{messageUId:r,sentTime:o}:null})},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve($.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve($.SUCCESS)},t.prototype.pullConversationStatus=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(t=this)._connMgr,i=t.currentUserId,r=n.codec.encodeGetConversationStatus(e),o=new no(so[so.pullSeAtts],r,i),[4,n.send(o,Ds)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,this.logger.info(_e.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:i})),a!==$.SUCCESS?[2,{code:a}]:(u=[],Array.isArray(c)&&c.forEach((function(e){var t=e.conversationType,n=e.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),t===te.ULTRA_GROUP?h._setUltraConversationStatus(e):u.push(e)})),[2,{code:a,data:u}])}}))}))},t.prototype._setUltraConversationStatus=function(e){var t=e.targetId,n=e.notificationStatus,i=e.notificationLevel,r=e.channelId,o=e.isTop,s=this._ultraGroupMap["".concat(r,"_").concat(t)];return s&&void 0!==i&&(s.notificationLevel=i,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==n&&(s.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==o&&(s.isTop=o),s},t.prototype.batchSetConversationStatus=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r=this;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,[4,this._conversationManager.pushTask((function(t){return u(r,void 0,void 0,(function(){var r,o,s,a,u,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return r=i.codec.encodeSetConversationStatus(e,t),o=new no(vr,r,n),[4,i.send(o,ks)];case 1:return s=l.sent(),a=s.code,u=s.data,a!==$.SUCCESS?[2,{code:a}]:(h=u,this._conversationManager.setConversationUpdatedTime(h.version),d=[],e.forEach((function(e){if(e.conversationType!==te.ULTRA_GROUP)g._conversationManager.addStatus(c(c({},e),{updatedTime:h.version}),!0);else{var t=g._setUltraConversationStatus(e);t&&d.push(t)}})),d.length>0&&(p=Rn(d),p=Oc(p),this._watcher.conversation(p)),[2,{code:a}])}}))}))}))]):[2,$.RC_NET_UNAVAILABLE];case 1:return[2,o.sent().code]}}))}))},t.prototype.batchSetConversationToTop=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return c(c({},e),{isTop:t})})))]}))}))},t.prototype.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,notificationLevel:n,channelId:i}])]}))}))},t.prototype.batchSetConversationNotificationLevel=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return c(c({},e),{notificationLevel:t})})))]}))}))},t.prototype._joinChrm=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p,g,f,_,E,v,T,C;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeJoinOrQuitChatRoom(),a=new no(s=n?ur:cr,o,e),this.logger.info(_e.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:s}),i),[4,r.send(a,hs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,d=u===$.SUCCESS?"info":"warn",this.logger[d](_e.L_JOIN_CHATROOM_R,JSON.stringify({code:u,timestamp:(new Date).getTime()}),i),u===$.SUCCESS?(g=(p=h).joinTime,f=p.createTime,_=p.memberCount,E=p.isAllChatroomBanned,v=p.isCurrentUserBanned,T=p.isCurrentChatroomBanned,C=p.isCurrentChatroomInWhitelist,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,g),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull(),[2,{code:u,data:{createTime:f,memberCount:_,isAllChatroomBanned:E,isCurrentUserBanned:v,isCurrentChatroomBanned:T,isCurrentChatroomInWhitelist:C}}]):[2,{code:u}]}}))}))},t.prototype._rejoinChrm=function(){return u(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,u,h;return l(this,(function(l){switch(l.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,l.label=1;case 1:return i<t.length?(r=t[i],this.logger.info(_e.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:e[r]||10,topic:ur})),o=this.logger.createTraceId(),[4,this._joinChrm(r,e[r]||10,!0,o)]):[3,4];case 2:if(s=l.sent(),a=s.code,u=s.data,h=a===$.SUCCESS?"info":"warn",this.logger[h](_e.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),o),a===$.SUCCESS)return this._watcher.chatroom({rejoinedRoom:c({chatroomId:r,count:e[r]},u)}),[2];a===$.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(r),delete this._chrmsQueue[r]),this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:a}}),l.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d,p,g,f,_,E,v=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._chrmsQueue[e],r=i.pulling,o=i.timestamp,r?[2]:(i.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,t),a=new no(so[so.chrmPull],s,e),this.logger.info(_e.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,timestamp:o})),[4,this._connMgr.send(a,qo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return c=l.sent(),u=c.code,h=c.data,i.pulling=!1,u===$.SUCCESS&&h?(d=h.list,p=h.syncTime,g=h.finished,i.timestamp=n?Math.max(p,n):p,i.queue=i.queue.filter((function(e){return e>p})),f=[],_=[],E=[],d.forEach((function(e){e.sentTime<o||(e.sentTime>=v._connMgr.getConnectedTime()&&v._writeMessagesLog(e.messageUId,te.CHATROOM)&&_.push(e.messageUId),f.push(e.messageUId),E.push(e))})),this._batchMessage(E),this.logger.info(_e.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:f.join(",")})),_.length>0&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:_.join(",")})),(!g||i.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(_e.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._joinChrm(e,t,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.joinExistChatroom=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),i=new no(lr,n,e),[4,t.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),(o=r.code)===$.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(t,n),o=new no(so[so.queryChrmI],r,e),[4,i.send(o,ps)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==$.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:i}),s=new no(Sr,o,e),[4,r.send(s,Xo,{conversation:{targetId:e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,c!==$.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=i.codec.encodeModifyChatRoomKV(e,t,r),a=t.type===Te.UPDATE?hr:dr,c=new no(a,s,e),[4,i.send(c,hs)]):[2,$.RC_NET_UNAVAILABLE];case 1:return u=l.sent(),(h=u.code)===$.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},r),[2,h]):[2,h]}}))}))},t.prototype._chatroomKVStoreNotAllSuccess=function(e,t){var n=t.data,i=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(e){var t=i.findIndex((function(t){return e.key===t.key}));-1!==t&&i.splice(t,1)})),i},t.prototype._modifyChatroomKVS=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,t.entries.forEach((function(t){var n=_._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?_.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(e,t,r),s=t.type===Te.UPDATE?pr:gr,a=new no(s,o,e),[4,i.send(a,Ss)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,-1!==[$.SUCCESS,$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(p=[],delete(g=c({},t)).entries,t.entries.forEach((function(e){p.push(c(c({},e),g))})),h===$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=u.data,d=f.errorKeys,p=this._chatroomKVStoreNotAllSuccess(p,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:p,syncTime:(new Date).getTime()},r)),[2,{code:h,data:d}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Te.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Te.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Te.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Te.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Te.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Te.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:$.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),o=new no(so[so.pullKV],r,e),[4,i.send(o,Rs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(c=a.kvEntries.find((function(e){return e.key===t})),void 0!==c)?[2,{code:$.SUCCESS,data:null==c?void 0:c.value}]:[2,{code:$.CHATROOM_KEY_NOT_EXIST}]}}))}))},t.prototype.getAllChatroomEntry=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:$.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},i=n.codec.encodePullChatRoomKV(0),r=new no(so[so.pullKV],i,e),[4,n.send(r,Rs)]):[2,{code:$.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:$.SUCCESS,data:t}]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=i.codec.encodePullChatRoomKV(t),s=new no(so[so.pullKV],o,e),this.logger.info(_e.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,i.send(s,Rs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,h=c===$.SUCCESS?"info":"warn",this.logger[h](_e.L_PULL_CHATROOM_KV_R,JSON.stringify({code:c,timestamp:t})),c===$.SUCCESS&&u?(d=u.kvEntries,p=[],d.length>0&&(d.forEach((function(t){var n=t.key,i=t.value,r=t.type,o=t.timestamp,s=t.userId;g._chrmEntryHandler.getValue(e,n)===i&&s===g.getCurrentUserId()||p.push({key:n,value:i,type:r,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,u,r),p.length>0&&this._watcher.chatroom({updatedEntries:p})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._isConnected?t.forEach((function(t){e._pullChrmMsg(t),e.getNaviInfoFromCache().kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),M)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype._writeMessagesLog=function(e,t){var n,i=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!i)return!1;var r=ln(e),o=0;switch(t){case te.PRIVATE:o=i.private;break;case te.GROUP:o=i.group;break;case te.CHATROOM:o=i.chatroom;break;case te.ULTRA_GROUP:o=i.ultraGroup}return!!o&&r%(1/o)==0},t.prototype.sendMessage=function(e,t,n,i,r){var o;return u(this,void 0,void 0,(function(){var s,a,u,h,d,p,g,f,_,E,v,T;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._handleInnerMsgOptions(e,t,n),n=this._handleMsgProperties(n,!0),s=!1,[te.PRIVATE,te.GROUP].includes(e)&&(n.isStatusMessage||(null===(o=this._customMessageType[n.messageType])||void 0===o?void 0:o.isStatusMessage))&&(s=!0),a=s?function(e){var t;return(t={},t[te.PRIVATE]=so.ppMsgS,t[te.GROUP]=so.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[te.PRIVATE]=so.ppMsgP,t[te.GROUP]=so.pgMsgP,t[te.CHATROOM]=so.chatMsg,t[te.CUSTOMER_SERVICE]=so.pcMsgP,t[te.RTC_ROOM]=so.prMsgS,t[te.SYSTEM]=so.pbMsgP,t)[e]}(e)||so.ppMsgP,s&&(n.isPersited=!1,n.isCounted=!1),u=n.messageId?n.messageId:sn(),n.messageId=u,h=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(d=new $r(so[a],h,e===te.SYSTEM?this.currentUserId:t)).setHeaderQos(Xi.AT_LEAST_ONCE),s?(this._connMgr.sendOnly(d),[2,{code:$.SUCCESS,data:Sc(e,t,c({},n),"",0,this.currentUserId,u)}]):(p=this._connMgr.getCrtServerTime(),g=Sc(e,t,c(c({},n),{isStatusMessage:s}),"",p,this.currentUserId,u),null==i||i(u),this.logger.info(_e.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),r),f=Date.now(),[4,this._connMgr.send(d)])):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return _=l.sent(),E=_.code,v=_.data,E!==$.SUCCESS?(this.logger.warn(_e.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:g.messageUId,messageId:g.messageId}),r),this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({channel:e,start_ts:f,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),g.sentStatus=Se.FAILED,[2,{code:E,data:g}]):(this.logger.info(_e.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:null==v?void 0:v.messageUId,messageId:null==v?void 0:v.messageId}),r),T=v,this._sendMessageSuccessHandle(g,T),this._writeMessagesLog(T.messageUId,e)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({msg_id:T.messageUId,channel:e,start_ts:f,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),[2,{code:$.SUCCESS,data:g}])}}))}))},t.prototype._sendMessageSuccessHandle=function(e,t){var n,i=this;this._sendMessageStore.setMessage(t.messageUId,t.timestamp),e.sentTime=t.timestamp,e.messageUId=t.messageUId,this._conversationManager.setConversationCacheByMessage(e,!0);var r=e.messageType,o=e.conversationType,s=e.targetId,a=e.channelId,c=e.sentTime,u=e.content,l=e.messageDirection;if(r===oe.READ_RECEIPT_REQUEST){var h=u.messageUId;null===(n=this._readReceiptManager)||void 0===n||n.insert({conversationType:o,targetId:s,channelId:a},h,l,c)}if(r===oe.READ_RECEIPT_RESPONSE){var d=u.receiptMessageDic;if(!d)return;for(var p in d)d[p].forEach((function(e){var t;null===(t=i._readReceiptManager)||void 0===t||t.remove({conversationType:o,targetId:s,channelId:a},e)}))}},t.prototype.recallMsg=function(e,t,n,i,r){var o;return u(this,void 0,void 0,(function(){var s,a,u,h,d,p,g,f,_,E,v,T,C;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=r.user,a=r.extra,u=r.isDelete,h={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:u||!1},s&&(h.user=s),a&&(h.extra=a),d={content:h,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(o=r.pushConfig)||void 0===o?void 0:o.pushContent)||r.pushContent||"",channelId:r.channelId},p=so[so.recallMsg],g=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},d),(f=new $r(p,g,this.currentUserId)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return _=l.sent(),E=_.code,v=_.data,e===te.ULTRA_GROUP&&this.logger.debug(_e.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:E,conversationType:e,targetId:t,channelId:r.channelId})),E!==$.SUCCESS?[2,{code:E}]:(T=v,e===te.ULTRA_GROUP?(this._ultraMsgMap[T.messageUId]=T.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:$.SUCCESS}]):(this._sendMessageStore.setMessage(T.messageUId,T.timestamp),C=Sc(e,t,c(c({},d),{isPersited:!0}),T.messageUId,T.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(C,!0),[2,{code:$.SUCCESS,data:C}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(t,n),r=new no(so[so.rrMsg],i,e),[2,this._connMgr.send(r)]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(t,n),r=new no(so[so.rrList],i,e),[2,this._connMgr.send(r,Ws)]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.sendReadReceiptMessageV4=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return i=this._connMgr.codec.encodeReadReceiptMsg(e,t,n),r=new $r(so[so.sendMsgRead],i,e.targetId),[2,this._connMgr.send(r)]}))}))},t.prototype.getMessageReadReceiptV4=function(e,t){return u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeReceiptQryReq(e,t),i=new no(so[so.qryMsgRead],n,e.targetId),[2,this._connMgr.send(i,ya)]}))}))},t.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeReceiptCntQryReq(e,t),i=new no(so[so.qryMsgReadCntBatch],n,e.targetId),[4,this._connMgr.send(i,Sa)];case 1:return r=u.sent(),o=r.code,s=r.data,a=(s||{result:[]}).result,o===$.SUCCESS&&a?[2,{code:o,data:a.map((function(t){return c({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)}))}]:[2,{code:o}]}}))}))},t.prototype.updateConversationReadTime=function(e,t){return u(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeSessionMsgReadInput(e,t),i=new $r(so[so.updRTime],n,this.currentUserId),[2,this._connMgr.send(i)]}))}))},t.prototype.pullUserSettings=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new no(so[so.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,bs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===$.SUCCESS&&this._naviChangeHandler(o),[2,{code:r,data:o}]}}))}))},t.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 r=this._connMgr.getToken();this.navi.updateVoipCallInfo(r,i);var o=this.navi.getNaviInfoFromCache(r);this._watcher.onNaviDataChange(c({},o))}}else this.logger.warn(_e.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=i&&"uploads"!==i?t||"":$t(e,t),s=this._connMgr.codec.encodeGetFileToken(e,o,n||"",i||"",r||""),a=new no(so[so.qnTkn],s,this.currentUserId),[4,this._connMgr.send(a,fs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,h!==$.SUCCESS?[2,{code:h}]:(p=c(c({},d),{fileName:o,downloadAuthInfo:d.downloadAuthInfo?JSON.parse(d.downloadAuthInfo):null}),[2,{code:h,data:p}])}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r="",o="",s="",t===pe.QINIU?(o=_s,s=vs):(o=Es,s=Ts),r=t===pe.QINIU?so[so.qnUrl]:t===pe.AWS?so[so.s3Url]:t===pe.STC?so[so.stcUrl]:t===pe.MINIO?so[so.minioUrl]:so[so.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,e,n,i),c=new no(r,a,this.currentUserId),[4,this._connMgr.send(c,s)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,p=d,h===$.SUCCESS?[2,{code:h,data:p}]:[2,{code:h}]}}))}))},t.prototype.disconnect=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return e.sent(),this._resetMemoryState(),[2]}}))}))},t.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._chrmsQueue={}},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.registerMessageType=function(e,t,n,i,r){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:r}},t.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return u(t,void 0,void 0,(function(){var t,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),i=new no(so[so.addSeTag],t,this.currentUserId),[4,this._connMgr.send(i,Us)];case 1:return r=u.sent(),o=r.code,s=r.data,o===$.SUCCESS&&s&&(a=s.version,this._userSettingManager.addTag([c(c({},e),{createdTime:a})],a)),[2,{code:o}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTag=function(e){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return u(t,void 0,void 0,(function(){var t,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=this._connMgr.codec.encodeRemoveTag([e],n),i=new no(so[so.delSeTag],t,this.currentUserId),[4,this._connMgr.send(i,Us)];case 1:return r=c.sent(),o=r.code,s=r.data,o===$.SUCCESS&&s&&(a=s.version,this._userSettingManager.deleteTag([e],a)),[2,{code:o}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.updateTag=function(e){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return u(t,void 0,void 0,(function(){var t,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),i=new no(so[so.addSeTag],t,this.currentUserId),[4,this._connMgr.send(i,Us)];case 1:return r=c.sent(),o=r.code,s=r.data,o===$.SUCCESS&&(a=s.version,this._userSettingManager.addTag([e],a)),[2,{code:o}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getTagList=function(){return u(this,void 0,void 0,(function(){var e,t;return l(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:$.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return u(n,void 0,void 0,(function(){var n,r,o,s,a,c,u=this;return l(this,(function(l){switch(l.label){case 0:return this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,i),r=new no(so[so.addTag],n,this.currentUserId),[4,this._connMgr.send(r,ks)]):[2,{code:$.TAG_NOT_EXIST}];case 1:return o=l.sent(),s=o.code,a=o.data,s===$.SUCCESS&&a&&((c={})[e]={},t.forEach((function(e){u._conversationManager.addTagStatus(e.conversationType,e.targetId,c,e.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return u(n,void 0,void 0,(function(){var n,r,o,s,a,c=this;return l(this,(function(u){switch(u.label){case 0:return n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,i),r=new no(so[so.delTag],n,this.currentUserId),[4,this._connMgr.send(r,ks)];case 1:return o=u.sent(),s=o.code,a=o.data,s===$.SUCCESS&&a&&(t.forEach((function(t){c._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTagsForConversation=function(e,t){return u(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return u(n,void 0,void 0,(function(){var n,r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return n=e.conversationType,r=e.targetId,o=e.channelId,s=t.map((function(e){return{tagId:e}})),a=this._connMgr.codec.encodeUpdateConversationTag(s,[e],i),c=new no(so[so.delTag],a,this.currentUserId),[4,this._connMgr.send(c,ks)];case 1:return u=l.sent(),h=u.code,d=u.data,h===$.SUCCESS&&d&&(this._conversationManager.deleteTagStatus(n,r,t,o),this._conversationManager.setConversationUpdatedTime(d.version)),[2,{code:h}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getConversationListByTag=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(i=this).currentUserId,o=i._connMgr,s=o.codec.encodeOldConversationList({count:n,type:te.PRIVATE,startTime:t}),a=new no(fr,s,r),[4,o.send(a,zo,{currentUserId:r,connectedTime:o.getConnectedTime()})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,u!==$.SUCCESS?[2,{code:u}]:(d=this._conversationHasTagFilter(e,null==h?void 0:h.list),[2,{code:u,data:d}])}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,i=[],r=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,u=n._conversationManager.get(o,s,a),l=u.hasMentioned,h=u.mentionedInfo,d=u.lastUnreadTime,p=u.notificationStatus,g=u.isTop,f=u.tags,_=u.unreadMessageCount,E=f&&f[e];if(E){var v=c(c({},t),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:p,isTop:g,unreadMessageCount:_});E.isTop?i.push(c(c({},v),{isTopInTag:!0})):r.push(c(c({},v),{isTopInTag:!1}))}})),i.sort(o),r.sort(o),h(h([],i,!0),r,!0)},t.prototype.getUnreadCountByTag=function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:$.SUCCESS,data:n}]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return u(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return u(i,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return i=t.targetId,o=t.conversationType,s=t.channelId,a=n.isTop,c=[{tagId:e,isTop:a}],(u=this._conversationManager.get(o,i,s)).tags&&Object.hasOwnProperty.call(u.tags,e)?(h=this._connMgr.codec.encodeUpdateConversationTag(c,[t],r),d=new no(so[so.addTag],h,this.currentUserId),[4,this._connMgr.send(d,ks)]):[2,{code:$.NO_TAG_IN_CONVER}];case 1:return p=l.sent(),g=p.code,f=p.data,g===$.SUCCESS&&f&&((_={})[e]={},a&&(_[e].isTop=!0),this._conversationManager.addTagStatus(o,i,_,s),this._conversationManager.setConversationUpdatedTime(f.version)),[2,{code:g}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getTagsForConversation=function(e){var t;return u(this,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){if(!this._isConnected)return[2,{code:$.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(o in n.tags)r.push({tagId:o,tagName:null===(t=i[o])||void 0===t?void 0:t.tagName});return[2,{code:$.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:$.SUCCESS,data:e})},t.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUnreadConversationList=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:$.SUCCESS,data:t})]}))}))},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===te.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:$.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:$.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===te.ULTRA_GROUP)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var i;if(!(i=e===te.ULTRA_GROUP?this._ultraGroupManager.get(te.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:$.SUCCESS,data:ue.NOT_SET});var r=i.notificationLevel;return pt(i.notificationLevel)&&!pt(i.notificationStatus)&&(r=ae.OPEN===i.notificationStatus?1:0),Promise.resolve({code:$.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===te.ULTRA_GROUP?this._ultraGroupManager.get(te.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:$.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:$.SUCCESS,data:ae.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,o){return this.getHistoryMessage(e,t,n,i,r,o)},t.prototype.getUltraGroupList=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o=this;return l(this,(function(s){return t=e.targetId,n=e.channelType,this._isUltraGroupListExist?(i=(i=Object.values(this._ultraGroupMap).filter((function(e){return!(e.targetId!==t&&t||e.channelType!==n&&st(n))}))).map((function(e){var t=e.unreadMessageCount,n=e.unreadMentionedCount,i=e.unreadMentionedMeCount;return t=o._getUnreadCount(t),n=o._getUnreadCount(n),i=o._getUnreadCount(i),c(c({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=Oc(i),r=Rn(i),[2,{code:$.SUCCESS,data:r}]):[2,{code:$.METHOD_NOT_AVAILABLE}]}))}))},t.prototype._getUnreadCount=function(e){return e>999?999:e},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===ae.OPEN||e.notificationLevel>0)&&t.push({conversationType:te.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:te.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var n=0;for(var i in this._ultraGroupMap){i.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[i].notificationLevel)||(n+=this._ultraGroupMap[i].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var i in this._ultraGroupMap){var r=this._ultraGroupMap[i];r.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[i].notificationLevel)||(n+=r.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(i){var r=t._ultraGroupMap[i];e.includes(r.targetId)&&n.push({type:r.conversationType,targetId:r.targetId,channelId:r.channelId,unreadMessageCount:t._getUnreadCount(r.unreadMessageCount),mentionedCount:t._getUnreadCount(r.unreadMentionedCount),mentionedMeCount:t._getUnreadCount(r.unreadMentionedMeCount),notificationLevel:r.notificationLevel})})),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:$.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:$.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),u(this,void 0,void 0,(function(){var n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:te.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new $r(so[so.updUgRTime],i,this.currentUserId)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,$.RC_NET_UNAVAILABLE]:[2,Promise.resolve($.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===$.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]}}))}))},t.prototype._getUltraGroupList=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,d,p,g,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new no(so[so.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,zo,{currentUserId:this.currentUserId,conversationType:te.ULTRA_GROUP})]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,r===$.SUCCESS&&o?(a=o.list,c=o.isFinished,a.forEach((function(e){e.notificationStatus=ae.CLOSE,e.notificationLevel=ue.NOT_SET,e.isTop=!1,f._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,f._ultraGroupManager.addUltraGroupStatus(e)})),!1!==c?[3,2]:(u=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(u),[3,4])):(this.logger.warn(_e.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(r,", try again")),s=setTimeout((function(){f._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(_e.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,p=h.data,d!==$.SUCCESS&&this.logger.warn(_e.O,"pullConversationStatus fail code: ".concat(d,", data: ").concat(p)),g=Object.values(this._ultraGroupMap),g=Oc(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Rn(g)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),l.label=4;case 4:return[2]}}))}))},t.prototype._startUltraSyncInterval=function(){var e=this,t=function(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._notificationOnline=function(){return u(this,void 0,void 0,(function(){var e,t,n,i=this;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return e=r.sent(),t=e.code,n=e.data,t===$.SUCCESS&&n?(this.logger.info(_e.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(_e.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new no(so[so.pullUgMsg],t,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(_e.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),i),[4,this._connMgr.send(n,qo,{currentUserId:this.currentUserId,conversation:{conversationType:te.ULTRA_GROUP}})];case 1:return r=l.sent(),o=r.code,s=r.data,o===$.SUCCESS&&s?(a=s.list,c=s.syncTime,u=a.map((function(e){return e.messageUId})).join(","),this.logger.info(_e.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:u,timestamp:e,syncTime:c}),i)):this.logger.warn(_e.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:e}),i),[2,{code:o,data:s}]}}))}))},t.prototype._getUltraGroup=function(e,t,n){var i,r,o,s=e.targetId,a=e.messageType,c=e.channelId,u=e.isCounted,l=e.channelType,h=e.sentTime,d=e.senderUserId,p=e.content,g=e.isMentioned,f=this._ultraGroupMap["".concat(c,"_").concat(s)],_=f||{conversationType:te.ULTRA_GROUP,targetId:s,channelId:c,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:ae.CLOSE,notificationLevel:ue.NOT_SET,isTop:!1};return u&&d!==this.currentUserId&&a!==oe.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=t,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),g&&(null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.type)!==he.ALL&&(null===(o=null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(_.unreadMentionedMeCount+=1)),_.versionTime=n,_.latestMessage=e,_.channelType=l,f||(this._ultraGroupMap["".concat(c,"_").concat(s)]=_),_},t.prototype._syncUltraMsg=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h=this;return l(this,(function(l){switch(l.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=l.sent(),n=t.code,i=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===$.SUCCESS&&i?(r=i.list,o=i.syncTime,s=i.finished,a={},c=[],r.forEach((function(e){var t,n,i,r=e.targetId,s=e.content,u=e.messageUId,l=e.channelId,d=e.isMentioned;if(h._ultraMsgMap[u])delete h._ultraMsgMap[u];else{var p=0;d&&((null===(t=null==s?void 0:s.mentionedInfo)||void 0===t?void 0:t.type)===he.ALL||(null===(i=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===i?void 0:i.includes(h.currentUserId)))&&(p=1);var g=h._getUltraGroup(e,p,o);a["".concat(l,"_").concat(r)]=g,h._ultraGroupManager.addUltraGroupStatus(g),c.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(_e.O,"notice ultragroups"),u=Object.values(a),u=Oc(u),this._watcher.conversation(Rn(u))),this.logger.debug(_e.O,"notice ultragroup message"),this._batchMessage(c),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>o})),this._lastSyncUltraMsgTimeStamp=o,s?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(o)),[2]):(this._syncUltraMsg(o),[2])):[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,u,h,d,p,g,f,_,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(_e.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),r=t.messageId?t.messageId:sn(),t.messageId=r,o=this._connMgr.codec.encodeUpMsg({conversationType:te.ULTRA_GROUP,targetId:e},t),(s=new $r(so[so.ugMsg],o,e)).setHeaderQos(Xi.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=Sc(te.ULTRA_GROUP,e,c({},t),"",a,this.currentUserId,r),n&&n(r),this.logger.info(_e.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:te.ULTRA_GROUP,targetId:e,channelId:t.channelId}),i),h=Date.now(),[4,this._connMgr.send(s)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return d=l.sent(),p=d.code,g=d.data,p!==$.SUCCESS?(this.logger.warn(_e.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:u.messageUId,messageId:u.messageId}),i),this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({channel:te.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),u.sentStatus=Se.FAILED,[2,{code:p,data:u}]):(this.logger.info(_e.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),f=g,this._writeMessagesLog(f.messageUId,te.ULTRA_GROUP)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({msg_id:f.messageUId,channel:te.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),u.sentTime=f.timestamp,u.messageUId=f.messageUId,this._ultraMsgMap[f.messageUId]=f.timestamp,_=t.channelId||"",(E=this._ultraGroupMap["".concat(_,"_").concat(e)])?(E.latestMessage=u,st(E.channelType)&&(u.channelType=E.channelType)):(E={conversationType:te.ULTRA_GROUP,targetId:e,channelId:_,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:ae.CLOSE,notificationLevel:ue.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(_,"_").concat(e)]=E,this._ultraGroupManager.addUltraGroupStatus(E)),this._watcher.conversation(Rn([E])),[2,{code:p,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=e.conversationType,i=e.channelId,r=e.targetId,o=this._connMgr.codec.encodeOperateStatus(r,n,i||"",t||0),(s=new $r(so[so.operate],o,r)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return(a=c.sent().code)!==$.SUCCESS?[2,{code:a,msg:$[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:$.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(i=new no(so[so.qryMsg],n,this.currentUserId)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(i,ua,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==$.SUCCESS?[2,{code:o,msg:$[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(e){var n=e.messageUId;t[n]=e})),[2,{code:0,data:t}])}}))}))},t.prototype._pullOperateStatusNotify=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,ha),n=t.conversationType,i=t.info,r=t.summary;this.logger.debug(_e.O,"s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new no(so[so.upMsgEx],t,e.targetId)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==$.SUCCESS?[2,{code:i,msg:$[i]}]:[2,{code:i}]}}))}))},t.prototype.modifyMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new no(so[so.modifyMsg],t,e.targetId)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==$.SUCCESS?[2,{code:r,msg:$[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new no(so[so.qryMsgChange],t,this.currentUserId)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(n,sa)]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r===$.SUCCESS&&o?(s=o.hasNext,a=o.list,c=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),u=this._pullUltraChangeMessageQue.filter((function(e){return e>c})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,u),s?this._pullUltraChangeMessageList(c):this._lastPullingUltraChangeMessageTime=c,[2]):[2]}}))}))},t.prototype._handleUltraChangeList=function(e){var t={};e.forEach((function(e){var n=e.changeType;t[n]||(t[n]=[]),t[n].push(e)}));var n=xe.CHANNEL_CHANGE,i=xe.MSG_RECALL,r=xe.MSG_EXPANSION,o=xe.MSG_MODIFY,s=xe.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[i]&&this._handleMsgRecall(t[i]),t[r]&&this._handleMsgUpdate(t[r]),t[o]&&this._handleMsgUpdate(t[o]),t[s]&&this._handleUserGroupStatus(t[s])},t.prototype._handleUltraChannelChange=function(e){var t=this,n=[],i=[],r=[];e.forEach((function(e){var o=e.subChangeType,s=e.targetId,a=e.channelId,c=e.sendTime,u=e.operatorId,l="".concat(a,"_").concat(s),h=t._ultraGroupMap[l];if(h){var d=Fe.PUBLIC_TO_PRIVATE,p=Fe.PRIVATE_TO_PUBLIC,g=Fe.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=Fe.CHANNEL_DELETE,_=Fe.CHANNEL_USER_KICKED;switch(o){case p:h.channelType=Be.PUBLIC,n.push({targetId:s,channelId:a,changeType:ke.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Be.PRIVATE,n.push({targetId:s,channelId:a,changeType:ke.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:s,channelId:a,changeType:ke.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete t._ultraGroupMap[l];break;case f:i.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:c}),delete t._ultraGroupMap[l];break;case _:r.push({targetId:s,channelId:a,userId:u,channelType:Be.PRIVATE}),u===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),i.length>0&&this._watcher.ultraGroupChannelDelete(i),r.length>0&&this._watcher.ultraGroupChannelUserKicked(r)},t.prototype._handleMsgRecall=function(e){var t=this,i=[];e.forEach((function(e){var r=e.targetId,o=e.channelId,s=e.messageUId,a=e.sendTime,c=e.conversationType,u=e.operatorId,l=e.mentionedType;t._updateUltraGroupWhenRecallMsg(r,o,s,a,l),i.push({targetId:r,conversationType:c,sentTime:a,messageUId:s,senderUserId:u,channelId:o,content:{conversationType:c,targetId:r,messageUId:s,channelId:o},messageDirection:1,messageType:oe.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:Sn(n.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(i)},t.prototype._handleMsgUpdate=function(e){var t={};for(var n in e.forEach((function(e){var n=e.targetId,i=e.conversationType,r=e.sendTime,o=e.messageUId,s=e.channelId,a="".concat(i,"_").concat(n);t[a]||(t[a]=[]),t[a].push({messageUId:o,channelId:s,sendTime:r})})),t){var i=n.split("_"),r=i.shift(),o=i.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:o,conversationType:Number(r),messages:h([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(i=new no(so[so.qryMsg],n,this.currentUserId)).setHeaderQos(Xi.AT_LEAST_ONCE),[4,this._connMgr.send(i,ua,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),o=r.code,s=r.data,o!==$.SUCCESS?[2,{code:o,msg:$[o]}]:(a=(s||{}).list,c=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=u._ultraGroupMap["".concat(n,"_").concat(t)];r&&r.latestMessage.messageUId===i&&(r.latestMessage=e),c.push(e)})),e===xe.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(c),e===xe.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(c),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,d;return l(this,(function(l){return t=He.REMOVE_USER_GROUP,n=He.JOIN_USER_GROUP,i=He.EXIT_USER_GROUP,r=He.CHANNEL_BIND_USER_GROUP,o=He.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],c=[],u=[],h=[],e.forEach((function(e){var l=e.conversationType,d=e.targetId,p=e.userGroupIds,g=e.busChannelType,f=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case i:c.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case r:u.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p});break;case o:h.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p})}})),d={},s.length>0&&(d.userGroupDisband=s),a.length>0&&(d.userAdded=a),c.length>0&&(d.userRemoved=c),u.length>0&&(d.userGroupBindChannel=u),h.length>0&&(d.userGroupUnBindChannel=h),this._watcher.userGroupStatus(d),[2]}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){var i;return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(e,t),o=new no(so[so.qryUgMsg],r,this.currentUserId),this.logger.info(_e.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:te.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count}),n),[4,this._connMgr.send(o,Xo,{currentUserId:this.currentUserId,conversation:{conversationType:te.ULTRA_GROUP,targetId:e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,a===$.SUCCESS&&c?(u=[],null===(i=c.list)||void 0===i||i.forEach((function(e){e&&u.push(e.messageUId)})),this.logger.info(_e.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:u.join(",")}),n),[2,{code:a,data:c}]):(this.logger.warn(_e.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),r=new no(so[so.ugUnpushSet],i,e),[4,this._connMgr.send(r)]):[2,{code:$.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,$.SUCCESS,[2,{code:s}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return u(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new no(so[so.ugUnpushQuery],i,e),[4,n.send(r,Ks)]):[2,{code:$.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})];case 1:return o=u.sent(),s=o.code,a=o.data,s===$.SUCCESS&&a?(c=a.unpushLevel,[2,{code:s,data:c}]):[2,{code:s}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n,i,r){var o="".concat(t,"_").concat(e);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,c=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),i&&c<i&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(r===qe.ALL||r===qe.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,r===qe.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(Rn([s])))}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:$.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new no(so[so.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,qs)]):[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})]:[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===$.SUCCESS&&o?[2,{code:r,data:o}]:[2,{code:r}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,i=this._ultraGroupMap["".concat(n,"_").concat(t)]||{},r=i.firstUnreadMessage||null,[2,{code:$.SUCCESS,data:r}]):[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),i=new no(so[so.setRtcRoomId],n,t),[4,this._connMgr.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(r=i instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(i)):i,o=n?new no(t,r,e):new $r(t,r,e),[4,this._connMgr.send(o)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,[2,{code:a,buffer:null==c?void 0:c.data}]}}))}))},t.prototype.rtcPing=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return i=ba(this.rtcCodec,t,n),[4,this.rtcSignaling(e,so[so.rtcPing],!0,i)];case 1:return r=c.sent(),o=r.code,s=r.buffer,o!==$.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(gn.RtcOutput,s)).version=zt(a.version),[2,{code:o,data:a}])}}))}))},t.prototype.getDeviceId=function(){return Lt(this.runtime)},t.prototype.getOSInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){Ti(),Za()},t.prototype.callExtra=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getConversationsByPage=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){return Promise.resolve($.NOT_SUPPORT)},t.prototype.removeFromBlacklist=function(e){return Promise.resolve($.NOT_SUPPORT)},t.prototype.getBlacklist=function(){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getBlacklistStatus=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.batchInsertMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getMessageCount=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.batchClearMessagesByTimestamp=function(e){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.searchConversationByContentWithAllChannel=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,i,r,o){throw new Error("Method not implemented.")},t.prototype.searchMessagesByUser=function(e,t,n,i,r,o){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,o,s){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.updateMessageReceiptStatus=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearData=function(){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setCallInfo=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(t,n),[4,i.send(new no(mr,r,e),_a)]):[3,2];case 1:return o=c.sent(),s=o.code,a=o.data,s===$.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:$.RC_NET_CHANNEL_INVALID})]}}))}))},t.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},t.prototype.setCheckDuplicateMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setProxy=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getProxy=function(){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.testProxy=function(e,t){return Promise.resolve({status:$.NOT_SUPPORT})},t.prototype.setNetwork=function(e,t){var n;if(this._connMgr.setNetwork(e,t),e.status&&this.cloudControllerUri){var i=this._connMgr.getToken();null===(n=this.cloudController)||void 0===n||n.request(this.cloudControllerUri,$a.newWorkChange,i)}},t}(ei),Mc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return s=ba(this._context.rtcCodec,t,n,i,r,o),[4,this.rtcSignaling(e,Un,!0,s)];case 1:return a=l.sent(),c=a.code,u=a.buffer,c===$.SUCCESS&&u&&(h=wa(this._context.rtcCodec,u)),[2,{code:c,data:h}]}}))}))},t.prototype.quitRTCRoom=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(gn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,An,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._context.rtcPing(e,t,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.rtcPingResVersion=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(gn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,bn,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r&&(o=this._context.rtcCodec.decode(gn.RtcRoomInfoOutput,r)),[2,{code:i,data:o}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(gn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,wn,!0,t)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r&&(s=wa(this._context.rtcCodec,r),o={users:s.users}),[2,{code:i,data:o}]}}))}))},t.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},t.prototype.setRTCUserInfo=function(e,t,n){return u(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(gn.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,Pn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(gn.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,Dn,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,o){return u(this,void 0,void 0,(function(){var s;return l(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(gn.RtcSetDataInput,{interior:i,target:r,key:t,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(e,Vn,!1,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){var o,s;return l(this,(function(a){switch(a.label){case 0:return o={objectName:i,content:this._context.rtcCodec.encode(gn.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(gn.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(gn.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},s=this._context.rtcCodec.encode(gn.RtcUserSetDataInput,o),[4,this.rtcSignaling(e,Gn,!0,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return u(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(gn.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(gn.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,Gn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){return u(this,void 0,void 0,(function(){var r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(gn.RtcDataInput,{interior:n,target:i,key:t}),[4,this.rtcSignaling(e,Bn,!0,r)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===$.SUCCESS&&a?(c=this._context.rtcCodec.decode(gn.RtcQryOutput,a).outInfo,u={},c.forEach((function(e){u[e.key]=e.value})),[2,{code:s,data:u}]):[2,{code:s}]}}))}))},t.prototype.removeRTCData=function(e,t,n,i,r){return u(this,void 0,void 0,(function(){var o;return l(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(gn.RtcDataInput,{interior:n,target:i,key:t,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),[4,this.rtcSignaling(e,kn,!1,o)];case 1:return[2,s.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return i=ba(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,xn,!0,i)];case 1:return r=c.sent(),o=r.code,s=r.buffer,o===$.SUCCESS&&s?(a=this._context.rtcCodec.decode(gn.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},t.prototype.setRTCState=function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(gn.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,Fn,!0,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(gn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Hn,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r?(o=wa(this._context.rtcCodec,r),[2,{code:i,data:o}]):[2,{code:i}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return i=ba(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,qn,!0,i)];case 1:return r=l.sent(),o=r.code,s=r.buffer,o===$.SUCCESS&&s?(a=this._context.rtcCodec.decode(gn.RtcViewerJoinedOutput,s),c=a.rtcToken,u=a.entries,[2,{code:o,data:{token:c,kvEntries:u}}]):[2,{code:o}]}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return u(this,void 0,void 0,(function(){var t,n;return l(this,(function(i){switch(i.label){case 0:return t=this._context.rtcCodec.encode(gn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Kn,!0,t)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return i=this._context.rtcCodec.encode(gn.RtcInput,{roomType:Xe.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,jn,!0,i)];case 1:return r=c.sent(),o=r.code,s=r.buffer,o===$.SUCCESS&&s?(a=wa(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},t.prototype.requestRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteTimeout,o=e.inviteInfo,s=e.roomId,a=this._context.rtcCodec.encode(gn.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:o}),[4,this.rtcSignaling(s,Wn,!0,a)];case 1:return c=u.sent().code,this._context.rtcKVManager.reset(),[2,c]}}))}))},t.prototype.cancelRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteInfo,o=e.roomId,s=this._context.rtcCodec.encode(gn.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(o,Qn,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,i=e.inviteSessionId,r=e.content,o=e.key,s=e.value,a=e.agree,c=e.roomId,u=this._context.rtcCodec.encode(gn.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:i,content:r,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(c,Jn,!0,u)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},t.prototype.endRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=e.endRoomId,n=e.sessionId,i=e.content,r=e.keys,o=e.roomId,s=this._context.rtcCodec.encode(gn.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(o,Xn,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.registerRTCSignalListener=function(e){this._context.registerRTCSignalingListener(e)},t.prototype.rtcSignaling=function(e,t,n,i){return this._context.rtcSignaling(e,t,n,i)},t.prototype.getRTCJoinedUserInfo=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(gn.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",Zn,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r?(o=this._context.rtcCodec.decode(gn.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:zt(e.joinTime)}}))}]):[2,{code:i}]}}))}))},t}(er);function Lc(e){return c({},e)}var Uc=function(){function e(e,t){var n,i;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[oe.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[oe.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[oe.INTERCEPT]=this._processInterceptMessage.bind(this),n[oe.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[oe.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[oe.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[oe.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[oe.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[oe.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),i),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},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=c({},t),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,Pa.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,Pa.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,Pa.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,Pa.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)};this.rtcCodec=this.createCodec(zn,$n),this._engine=mn()?new RCCppEngine(e,this.rtcCodec,r,this._options):new Nc(e,this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new Ln(this._engine)}return e.init=function(t,n){if(this._context)return this._context.logger.warn(_e.A_INIT_REPEAT_O),this._context;this._context=new e(t,n),this._context.logger.info(_e.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(_e.L_IMSDK_VER_O,JSON.stringify({commitId:"267d8dd82233d8b74c1aab41f78edef365fd3be3",version:"5.9.4"}));var i=this._context._engine;return t.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},e.destroy=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(_e.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return e.sent(),this._context=void 0,[2]}}))}))},e.prototype.createCodec=function(e,t){return new ri(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(_e.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(_e.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var i="RCRTC"===e.tag?new Mc(this):new er(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(i,this._runtime,t)}catch(e){this.logger.error(_e.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),r&&(this._pluginContextQueue.push(i),this._pluginInstanseMap[e.tag]=r),r},e.prototype._onConnectionStatusChange=function(e,t){var n,i;this.logger.warn(_e.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 i;null===(i=n.onconnectionstatechange)||void 0===i||i.call(n,e,t)}))},e.prototype._processChrmMemChangeMessage=function(e){if("function"==typeof this._watcher.chatroomState){var t={},n=e.content.memberCount,i=void 0===n?0:n;Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){t[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:t,chatroomId:e.targetId,memberCount:i}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo(Lc(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===te.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===me.MSG_EXPANSION||n===me.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(_e.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){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:e.content.chatroomId,operateType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.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,i=this._engine.getCurrentUserId();n&&Array.isArray(n[i])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[i])},e.prototype._messageReceiver=function(e,t,n){var i,r,o,s,a=this;if(!(null===(r=(i=this._compatibleMessageProccessor)[e.messageType])||void 0===r?void 0:r.call(i,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Lc(e))}catch(e){return a.logger.error(_e.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(s=(o=this._watcher).message)||void 0===s||s.call(o,Lc(e),t,n),e},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[],o=[],s=[oe.READ_RECEIPT,oe.READ_RECEIPT_REQUEST,oe.READ_RECEIPT_RESPONSE];e.forEach((function(e){var a=i._messageReceiver(e,t,n);a&&s.includes(a.messageType)?o.push(a):a&&r.push(a)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(_e.L_BATCH_MESSAGE_O,r.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(r)),o.length&&o.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(_e.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._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onrtcdatachange)||void 0===i||i.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.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];t._watcher[n]=dt(i)||ht(i)?i:void 0}}))},e.prototype._resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,i=e.targetId,r=e.content,o=e.channelId,s=r.typingContentType,a=o||"",c="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[c]||(this._typingInfo[c]=[]);var u=this._typingInfo[c].findIndex((function(e){return e.userId===t}));u>=0&&this._typingInfo[c][u].messageType===s?this._typingInfo[c][u].timestamp=Date.now():(u>=0&&this._typingInfo[c].splice(u,1),this._typingInfo[c].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(c)||this._typingChangedList.push(c),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._engine.getConnectionStatus()},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.refetchNaviInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var i,r;return u(this,void 0,void 0,(function(){var o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._token=e,[4,this._runtime.getNetworkType()];case 1:return o=l.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=l.sent(),c=a.code,u=a.data,c!==$.SUCCESS?[2,{code:c}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=St.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,h)),[2,{code:c,userId:u}])}}))}))},e.prototype.disconnect=function(e){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){t.logger.error(_e.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.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),at(i)&&i.length>0&&(this._registerMessageSearchPropsMapping[e]=i),this._engine.registerMessageType(e,t,n,i,r)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],i={};return n&&ht(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var r=t[e];st(r)&&(r>-Math.pow(2,64)&&r<Math.pow(2,64)&&Number.isInteger(r)||(i[e]=r))}})),Object.keys(i).length>0?{msg:JSON.stringify(i),code:$.SEARCH_PROPS_LIMIT_ERROR}:{code:$.SUCCESS}},e.prototype._handleExpansioResult=function(e){var t=yt(e),n=t.isIllgalEx,i=t.isExKeyOrValLengthExceedLimit;return t.isExceedLimit||i?$.EXPANSION_LIMIT_EXCEET:n?$.BIZ_ERROR_INVALID_PARAMETER:void 0},e.prototype.sendMessage=function(e,t,n,i,r){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==$.SUCCESS)return Promise.resolve({code:s,msg:a});if(e===te.SYSTEM&&n.messageType!==oe.SYNC_READ_STATUS)return Promise.resolve({code:$.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(e!==te.ULTRA_GROUP){var c=this.getNaviInfoFromCache();if(0!==((null==c?void 0:c.grpRRVer)||0)&&n.messageType===oe.READ_RECEIPT_RESPONSE)return Promise.resolve({code:$.READ_RECEIPT_ERROR})}var u=n.canIncludeExpansion,l=void 0!==u&&u,h=n.expansion;if(l){var d=this._handleExpansioResult(h);if(d)return Promise.resolve({code:d})}var p,g,f=JSON.stringify(n.content);return p=f,void 0===g&&(g="utf-8"),("utf-16"===g?_(p):E(p))>N?Promise.resolve({code:$.RC_MSG_CONTENT_EXCEED_LIMIT}):e===te.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,i,r):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(c=yt(s),u=c.isIllgalEx,h=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||h?[2,Promise.resolve({code:$.EXPANSION_LIMIT_EXCEET})]:u?[2,Promise.resolve({code:$.BIZ_ERROR_INVALID_PARAMETER})]:(d={mid:r},s&&(d.put=s),o&&(d.del=o),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,i,{content:d,messageType:oe.EXPANSION_NOTIFY,channelId:t})])):[2,{code:$.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return u(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:$.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 u(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:$.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n||"")]}))}))},e.prototype.sendReadReceiptMessageV4=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.sendReadReceiptMessageV4(e,t,n)]}))}))},e.prototype.getMessageReadReceiptV4=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getMessageReadReceiptV4(e,t)]}))}))},e.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchGetMessageReadReceiptInfoV4(e,t)]}))}))},e.prototype.updateConversationReadTime=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.updateConversationReadTime(e,t)]}))}))},e.prototype._destroy=function(){return u(this,void 0,void 0,(function(){var e=this;return l(this,(function(t){switch(t.label){case 0:return this._resetWatcher(),this._engine.destroy(),this._runtime.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(_e.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),void 0===s&&(s=""),e===te.ULTRA_GROUP){var c={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(t,c,a)}return this._engine.getHistoryMessage(e,t,n,i,r,o,s||"",a)},e.prototype.getMessages=function(e,t,n,i,r,o,s){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),e===te.ULTRA_GROUP){var a={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(t,a,s)}return this._engine.getMessages(e,t,n,i,r,o,s)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,i,r,o,s)},e.prototype.getConversationList=function(e,t,n,i,r){if(t===te.ULTRA_GROUP){var o=$.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:$[o]})}return this._engine.getConversationList(e||300,t,n,i,r||"")},e.prototype.getConversationsByPage=function(e,t,n,i,r){return this._engine.getConversationsByPage(e,t,n,i,r)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===te.ULTRA_GROUP?Promise.resolve($.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){return void 0===n&&(n=""),e===te.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(e,t,n)},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(te.ULTRA_GROUP)){var i=$.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:$[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[te.PRIVATE,te.GROUP,te.SYSTEM,te.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 void 0===n&&(n=""),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,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[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,i,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!0),e===te.ULTRA_GROUP&&void 0!==n)return Promise.resolve($.METHOD_NOT_SUPPORT);var s=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:r,isUpdateTime:o}];return this._engine.batchSetConversationStatus(s)},e.prototype.batchSetConversationToTop=function(e,t,n){return this._engine.batchSetConversationToTop(e,t,!!n)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(e,t,n,i)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,i,r){return this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){return void 0===i&&(i=""),e===te.ULTRA_GROUP&&mn()?Promise.resolve($.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,i)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,i)},e.prototype.joinChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,n)},e.prototype.joinExistChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return this._engine.getChatroomInfo(e,t||0,n||0)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return rn(n)&&on(i)?this._engine.setChatroomEntry(e,t):Promise.resolve($.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n],r=i.key,o=i.value;if(!rn(r)||!on(o))return Promise.resolve({code:$.BIZ_ERROR_INVALID_PARAMETER})}var s=c(c({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,i=t.value;return rn(n)&&on(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve($.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return rn(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve($.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n].key;if(!rn(i))return Promise.resolve({code:$.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return rn(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve($.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,i){return this._engine.getChatroomHistoryMessages(e,i||0,t||20,n||0)},e.prototype.getFileToken=function(e,t,n,i,r){return u(this,void 0,void 0,(function(){var o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return o=this.getNaviInfoFromCache(),s=(null==o?void 0:o.bosAddr)||"",a=(null==o?void 0:o.uploadServer)||"",c=(null==o?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,i,r)];case 1:return u=l.sent(),h=u.code,d=u.data,h===$.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:s,qiniu:a,ossConfig:c}))]:[2,Promise.reject(h)]}}))}))},e.prototype.getFileUrl=function(e,t,n,i,r){return void 0===r&&(r=pe.QINIU),u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return(null==i?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(e,r,t,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===$.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.length>1e3?[2,Promise.resolve({code:$.CONVER_OUT_LIMIT_ERROR})]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[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=[te.PRIVATE,te.CHATROOM,te.GROUP,te.SYSTEM,te.APP_PUBLIC_SERVICE,te.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t||"")},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[te.PRIVATE,te.CHATROOM,te.GROUP,te.SYSTEM,te.APP_PUBLIC_SERVICE,te.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(e)},e.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==te.ULTRA_GROUP){var t=$.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:t,msg:$[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==te.ULTRA_GROUP?[2,{code:r=$.CONVERSATION_TYPE_NOT_SUPPORT,msg:$[r]}]:i?(o=yt(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:$.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:$.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:$.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:c.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return e.conversationType!==te.ULTRA_GROUP?[2,{code:t=$.CONVERSATION_TYPE_NOT_SUPPORT,msg:$[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){return this._engine.getUltraGroupUnreadMentionedMessages(e)},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return this._engine.getUltraGroupFirstUnreadMessageTimestamp(e)},e.prototype.getUltraGroupUnreadInfoList=function(e){return this._engine.getUltraGroupUnreadInfoList(e)},e.prototype.callExtra=function(e){for(var t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,h([e],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.clearConversations=function(e,t){return u(this,void 0,void 0,(function(){return l(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(_e.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return u(this,void 0,void 0,(function(){var i,r,o;return l(this,(function(s){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,o=i.msg,r!==$.SUCCESS?[2,Promise.resolve({code:r,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=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,!!i,r)]}))}))},e.prototype.batchClearMessagesByTimestamp=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.batchClearMessagesByTimestamp(e)]}))}))},e.prototype.batchClearRemoteHistoryMessages=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchClearRemoteHistoryMessages(e,t)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,i){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(e,t,n,i)]}))}))},e.prototype.setUserStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,i){return void 0===t&&(t=[]),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContent(e,t,n||"",i)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,i,r,o,s){return void 0===s&&(s=""),u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,i,r,o,s)]}))}))},e.prototype.searchMessagesByUser=function(e,t,n,i,r,o){return void 0===r&&(r=5),void 0===o&&(o=""),u(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessagesByUser(e,t,n,i,r,o)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){return u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,i,r)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,i,r,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(e,t,n,i)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return void 0===t&&(t=""),this._engine.getUltraGroupDefaultNotificationLevel(e,t)},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.setUltraGroupDefaultNotificationLevel(e,t,n)},e.prototype.getConversationNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationLevel(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(e,t,n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,o){return this._engine.getRemoteHistoryMessages(e,t,n,i,r,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.createLogger=function(e,t){return this._engine.createLogger(e,t)},e.prototype.createStatisticLogger=function(e,t){return this._engine.createStatisticLogger(e,t)},e.prototype.setCheckDuplicateMessage=function(e){return this._engine.setCheckDuplicateMessage(e)},e.prototype.rtcSignaling=function(e,t,n,i){return this._engine.rtcSignaling(e,t,n,i)},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}(),Ac=x;export{Fa as AConnectionMgr,ei as AEngine,Uc as APIContext,o as AppStorage,ii as AreaCode,wt as AssertRules,yc as BaseCloudController,Ai as BasicLogger,Mo as BasicNavi,wi as BasicReporter,ui as BasicStaticConfigManager,ac as BasicStatistic,cc as BasicStatisticReporter,P as CPP_PROTOCAL_MSGTYPE_OPTION,it as CallLibMsgType,Te as ChatroomEntryType,$e as ChatroomSyncStatusReason,ye as ChatroomUserChangeType,we as ChrmMemBanType,Ae as ChrmMemOperateType,Le as ChrmSyncStatus,ri as Codec,Je as ConnectReason,Qe as ConnectType,ie as ConnectionStatus,te as ConversationType,B as DB_LOG_FLUSH_FREQUENCY,G as DB_LOG_MAX_SIZE,Nn as DelayTimer,Pe as EConnectProtocol,Ke as EnterpriseType,$ as ErrorCode,It as EventEmitter,F as FORMATED_VERSION,J as FileType,C as HTTP_TIMEOUT,Jt as HttpMethod,M as IM_CHATROOM_PULL_INTERVAL_TIME,R as IM_PING_INTERVAL_TIME,O as IM_PING_MIN_TIMEOUT,S as IM_PING_TIMEOUT,I as IM_SIGNAL_TIMEOUT,bi as IndexDBLogger,Yi as IndexDBReporter,lc as IndexDBStatistic,Ec as IndexDBStatisticReporter,De as InterruptionLevel,$a as InvokerType,W as LOCAL_STORAGE_KEYS,ze as LiveRole,Ze as LiveType,Ri as LogL,ge as LogLevel,fe as LogSource,_e as LogTagId,N as MAX_MESSAGE_CONTENT_BYTES,L as MAX_MESSAGE_EXPANSION_KEY_LENGTH,U as MAX_MESSAGE_EXPANSION_VAL_LENGTH,H as MAX_UPLOAD_FILE_SIZE,he as MentionedType,me as MessageBlockSourceType,Re as MessageBlockType,Z as MessageDirection,oe as MessageType,T as NAVI_CACHE_DURATION,m as NAVI_REQ_TIMEOUT,je as NaviCacheType,Xt as NetworkType,ue as NotificationLevel,ae as NotificationStatus,k as ONE_LOG_SIZE_MAX,Ne as OperateStatus,er as PluginContext,Ye as ProtocalType,Ve as PushImportanceHonor,Ht as RCAssertError,Pa as RCConnectionStatus,Y as RC_DEFAULT_USER,j as READ_RECEIPT_CATCH_TIME,V as REAT_TIME_LOG_SIZE,et as RTCApiType,tt as RTCIdentityChangeType,nt as RTCJoinType,Xe as RTCMode,Mc as RTCPluginContext,n as ReceivedStatus,w as SEND_MESSAGE_TYPE_OPTION,K as STATIC_CONFIG_CACHE_TIME,b as STATIC_CONFIG_IV,A as STATIC_CONFIG_KEY,D as STATUS_MESSAGE,Se as SentStatus,xa as StatisticL,Ee as StatisticsTag,We as StatisticsVersion,Ge as StoreKeys,xt as SuspendablePromise,Zt as TagChangeType,q as UPLOAD_FILE_CHUNK_SIZE,ke as UltraGroupChannelChangeType,Be as UltraGroupChannelType,qe as UltraMentionedType,xe as UltraMsgChangeType,Fe as UltraMsgSubChangeType,pe as UploadMethod,He as UserGroupChangeType,x as VERSION,St as VersionManage,y as WEB_SOCKET_TIMEOUT,Uo as WebSocketNavi,v as appendUrl,qt as assert,Rn as clone,Cn as cloneByJSON,Ti as deInitLogDB,cn as decryptCBC,un as fixUrlProtocol,fn as forEach,yn as getBrowser,sn as getClientMessageId,Lt as getDeviceId,ln as getMessageUIdHash,en as getMimeKey,Nt as getUUID,Mt as getUUID22,$t as getUploadFileName,an as getbundleId,dn as httpRequest,En as indexOf,Ei as initLogDB,Ja as initStatisticDB,at as isArray,ct as isArrayBuffer,ot as isBoolean,ka as isConnnectAck,Ba as isDisconnectedByServer,dt as isFunction,ft as isHttpUrl,Tn as isInObject,vn as isInclude,gt as isNull,st as isNumber,ht as isObject,Ot as isStartCloudController,rt as isString,Ct as isTypeInConversationList,pt as isUndefined,Tt as isValidChannelId,rn as isValidChrmEntryKey,on as isValidChrmEntryValue,Et as isValidConversationType,yt as isValidExpansion,mt as isValidFileType,vt as isValidNotificationLevel,kt as logger,_n as map,lt as notEmptyArray,_t as notEmptyObject,ut as notEmptyString,tn as pushConfigsToJSON,nn as pushJSONToConfigs,ic as statisticTranscsv,f as todo,Ki as transcsv,On as transformReceivedStatusFlag,Sn as transformReceivedStatusInfo,Za as unInitStatisticDB,ci as urlCenter,mn as usingCppEngine,Kt as validate,Ac as version};