@rongcloud/engine 5.8.1 → 5.8.2

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 e;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(e||(e={}));var t,n=e,i=72e5,r=6e4,o=1e4,s=5e3,a=3e4,u=15e3,c=15e3,l=2e3,h=131072,d=18e4,p="RCV4-",f=32,_=4096,E={"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: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: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}},T={"RC:DizNtf":{isCounted:!1,isPersited:!1}},I=["RC:TypSts","RC:InterceptMsg","RC:RL"],C=20971520,v=1e5,R=3e3,y=1e3,m="5.8.1",S=m.replace(/-.+$/,""),O=5368709120,N=10485760,M=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},A=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}(),L=function(){function e(e,t){var n,i=t?"".concat(p).concat(t):p;this._rootStorage=M(e);var r=this._rootStorage.get(i)||{};this._cache=new A(((n={})[i]=r,n)),this._storageKey=i}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e}(),U=function(e,t){return U=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])},U(e,t)};function P(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}U(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var w=function(){return w=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},w.apply(this,arguments)};function b(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((i=i.apply(e,t||[])).next())}))}function D(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(u){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,u])}}}function V(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var G,B=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return P(t,e),t}(Error),k=function(e){return new B(e)},x=function(e){for(var t=0,n=0,i=e.length;n<i;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},F=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},H=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e};!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"}(G||(G={}));var K,Y=G;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(K||(K={}));var q,j=K;!function(e){e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.MESSAGE_SENT_OVER_FREQUENCY=20604]="MESSAGE_SENT_OVER_FREQUENCY",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.MESSAGE_BLOCKED_BY_SENSITIVE_WORD=21501]="MESSAGE_BLOCKED_BY_SENSITIVE_WORD",e[e.MESSAGE_SENSITIVE_WORD_REPLACED=21502]="MESSAGE_SENSITIVE_WORD_REPLACED",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_USER_INFO_ERROR=23407]="GET_USER_INFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.KICKED_FROM_CHATROOM=23409]="KICKED_FROM_CHATROOM",e[e.CHATROOM_NOT_EXIST=23410]="CHATROOM_NOT_EXIST",e[e.CHATROOM_IS_FULL=23411]="CHATROOM_IS_FULL",e[e.CHATROOM_PARAMETER_INVALID=23412]="CHATROOM_PARAMETER_INVALID",e[e.CHATROOM_GET_HISTORY_MESSAGE_ERROR=23413]="CHATROOM_GET_HISTORY_MESSAGE_ERROR",e[e.CHATROOM_ROAMING_SERVICE_UNAVAILABLE=23414]="CHATROOM_ROAMING_SERVICE_UNAVAILABLE",e[e.CHATROOM_PROPERTY_OVERSIZE=23423]="CHATROOM_PROPERTY_OVERSIZE",e[e.CHATROOM_PROPERTY_EXISTED=23424]="CHATROOM_PROPERTY_EXISTED",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_PROPERTY_SERVICE_UNAVAILABLE=23426]="CHATROOM_PROPERTY_SERVICE_UNAVAILABLE",e[e.CHATROOM_PROPERTY_NOT_EXIST=23427]="CHATROOM_PROPERTY_NOT_EXIST",e[e.CHATROOM_PROPERTY_NOT_ALL_SET=23428]="CHATROOM_PROPERTY_NOT_ALL_SET",e[e.CHATROOM_PROPERTY_BATCH_SET_OVERSIZE=23429]="CHATROOM_PROPERTY_BATCH_SET_OVERSIZE",e[e.CHATROOM_PROPERTY_SET_CONCURRENT_ERROR=23431]="CHATROOM_PROPERTY_SET_CONCURRENT_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.NOT_IN_ULTRA_GROUP_PRIVATE_CHANNEL=24416]="NOT_IN_ULTRA_GROUP_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE_PARAMETER_INVALID=25101]="RECALL_MESSAGE_PARAMETER_INVALID",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.CONNECTION_RELEASED=30001]="CONNECTION_RELEASED",e[e.CONNECTION_UNAVAILABLE=30002]="CONNECTION_UNAVAILABLE",e[e.MESSAGE_RESPONSE_TIMEOUT=30003]="MESSAGE_RESPONSE_TIMEOUT",e[e.NAVIGATION_REQUEST_ERROR=30004]="NAVIGATION_REQUEST_ERROR",e[e.NAVIGATION_REQUEST_TIMEOUT=30005]="NAVIGATION_REQUEST_TIMEOUT",e[e.NAVIGATION_RESPONSE_ERROR=30006]="NAVIGATION_RESPONSE_ERROR",e[e.NAVIGATION_RESOURCE_ERROR=30007]="NAVIGATION_RESOURCE_ERROR",e[e.NAVIGATION_FORMAT_ERROR=30008]="NAVIGATION_FORMAT_ERROR",e[e.DOMAIN_NOT_FOUND=30009]="DOMAIN_NOT_FOUND",e[e.CONNECTION_CREATED_ERROR=30010]="CONNECTION_CREATED_ERROR",e[e.CONNECTION_DISCONNECTED=30011]="CONNECTION_DISCONNECTED",e[e.PING_SENT_ERROR=30012]="PING_SENT_ERROR",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.SIGNAL_SENT_ERROR=30014]="SIGNAL_SENT_ERROR",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.MESSAGE_OVERSIZE=30016]="MESSAGE_OVERSIZE",e[e.NETWORK_UNAVAILABLE=30019]="NETWORK_UNAVAILABLE",e[e.RMTP_CONNECTED_ERROR=30021]="RMTP_CONNECTED_ERROR",e[e.CONNECTION_ACK_TIMEOUT=31e3]="CONNECTION_ACK_TIMEOUT",e[e.PROTOCOL_VERSION_ERROR=31001]="PROTOCOL_VERSION_ERROR",e[e.IDENTIFIER_REJECTED=31002]="IDENTIFIER_REJECTED",e[e.SERVER_UNAVAILABLE=31003]="SERVER_UNAVAILABLE",e[e.TOKEN_INCORRECT=31004]="TOKEN_INCORRECT",e[e.APP_NOT_AUTHORIZED=31005]="APP_NOT_AUTHORIZED",e[e.CONNECTION_REDIRECTED=31006]="CONNECTION_REDIRECTED",e[e.PACKAGE_NAME_INVALID=31007]="PACKAGE_NAME_INVALID",e[e.APP_BLOCKED_OR_DELETED=31008]="APP_BLOCKED_OR_DELETED",e[e.USER_BLOCKED=31009]="USER_BLOCKED",e[e.DISCONNECTED_BY_KICK=31010]="DISCONNECTED_BY_KICK",e[e.DISCONNECTED_BY_BLOCK=31011]="DISCONNECTED_BY_BLOCK",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.TOKEN_EXPIRED=31020]="TOKEN_EXPIRED",e[e.TOKEN_DEVICE_ID_INCONSISTENT=31021]="TOKEN_DEVICE_ID_INCONSISTENT",e[e.HOST_NAME_INCORRECT=31022]="HOST_NAME_INCORRECT",e[e.CONNECTION_REJECTED_BY_SAME_ONLINE_DEVICE=31023]="CONNECTION_REJECTED_BY_SAME_ONLINE_DEVICE",e[e.CONCURRENT_OVER_FREQUENCY=31024]="CONCURRENT_OVER_FREQUENCY",e[e.CONNECTION_REJECTED_BY_WRONG_CLUSTER=31025]="CONNECTION_REJECTED_BY_WRONG_CLUSTER",e[e.CONNECTION_AUTHORIZED_ERROR_BY_APP_SERVER=31026]="CONNECTION_AUTHORIZED_ERROR_BY_APP_SERVER",e[e.USED_ONE_TIME_TOKEN=31027]="USED_ONE_TIME_TOKEN",e[e.TOKEN_INCORRECT_CAUSE_WRONG_PLATFORM=31028]="TOKEN_INCORRECT_CAUSE_WRONG_PLATFORM",e[e.USER_CANCELLATION=31029]="USER_CANCELLATION",e[e.APP_LICENSE_EXPIRED=31030]="APP_LICENSE_EXPIRED",e[e.QUERY_ACK_NO_DATA=32001]="QUERY_ACK_NO_DATA",e[e.MESSAGE_DATA_INCOMPLETE=32002]="MESSAGE_DATA_INCOMPLETE",e[e.CONNECTION_RESET_BY_PEER=32054]="CONNECTION_RESET_BY_PEER",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.PROTOCOL_UNINITIALIZED=33001]="PROTOCOL_UNINITIALIZED",e[e.PROTOCOL_DATABASE_ERROR=33002]="PROTOCOL_DATABASE_ERROR",e[e.PROTOCOL_PARAMETER_INVALID=33003]="PROTOCOL_PARAMETER_INVALID",e[e.PROTOCOL_MESSAGE_STORAGE_SERVICE_UNAVAILABLE=33007]="PROTOCOL_MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.PROTOCOL_MESSAGE_INSERTED_ERROR=33008]="PROTOCOL_MESSAGE_INSERTED_ERROR",e[e.CHATROOM_RELEASED=33009]="CHATROOM_RELEASED",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_ALREADY_EXISTS=33101]="TAG_ALREADY_EXISTS",e[e.TAG_NOT_IN_CONVERSATION=33102]="TAG_NOT_IN_CONVERSATION",e[e.CONNECTION_EXIST=34001]="CONNECTION_EXIST",e[e.ENVIRONMENT_ERROR=34005]="ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_NOT_EXPANDABLE=34008]="MESSAGE_NOT_EXPANDABLE",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.MESSAGE_EXPANSION_OVERSIZE=34010]="MESSAGE_EXPANSION_OVERSIZE",e[e.FILE_UPLOAD_ERROR=34011]="FILE_UPLOAD_ERROR",e[e.TAG_CONVERSATION_OUT_OF_LIMIT=34013]="TAG_CONVERSATION_OUT_OF_LIMIT",e[e.UNSUPPORTED_GROUP_READ_RECEIPT_VERSION=34014]="UNSUPPORTED_GROUP_READ_RECEIPT_VERSION",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.NOT_SUPPORT_ULTRA_GROUP=34022]="NOT_SUPPORT_ULTRA_GROUP",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.PROXY_INVALID=34238]="PROXY_INVALID",e[e.TEST_HOST_INVALID=34239]="TEST_HOST_INVALID",e[e.CONNECT_TEST_HOST_ERROR=34240]="CONNECT_TEST_HOST_ERROR"}(q||(q={}));var Q,W=q;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",e[e.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",e[e.SUCCESS=0]="SUCCESS",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_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.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_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.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.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONNECTION_EXIST=34001]="CONNECTION_EXIST",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_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=35028]="RC_CONN_PROXY_UNAVAILABLE",e[e.PROXY_UNAVAILABLE=17]="PROXY_UNAVAILABLE"}(Q||(Q={}));var J,X=Q;!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"}(J||(J={}));var Z,z=J;!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"}(Z||(Z={}));var $,ee=Z;!function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.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.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.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"}($||($={}));var te,ne=$;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(te||(te={}));var ie,re=te;!function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(ie||(ie={}));var oe,se=ie;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(oe||(oe={}));var ae,ue=oe;!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"}(ae||(ae={}));var ce,le=ae;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(ce||(ce={}));var he,de,ge,pe,fe,_e=ce;!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"}(he||(he={})),function(e){e.IM="IM",e.RTC="RTC"}(de||(de={})),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_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"}(ge||(ge={})),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"}(pe||(pe={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(fe||(fe={}));var Ee,Te,Ie=fe;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Ee||(Ee={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(Te||(Te={}));var Ce,ve=Ee;!function(e){e[e.typing=0]="typing"}(Ce||(Ce={}));var Re,ye,me=Ce;!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"}(Re||(Re={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ye||(ye={}));var Se,Oe=ye;!function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(Se||(Se={}));var Ne,Me=Se;!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"}(Ne||(Ne={}));var Ae,Le=Ne;!function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(Ae||(Ae={}));var Ue,Pe,we,be,De,Ve,Ge,Be,ke,xe,Fe,He,Ke,Ye,qe,je,Qe=Ae;!function(e){e.NAVI="rc-navi",e.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(Ue||(Ue={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(Pe||(Pe={})),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"}(we||(we={})),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"}(be||(be={})),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"}(De||(De={})),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"}(Ve||(Ve={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(Ge||(Ge={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Be||(Be={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(ke||(ke={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(xe||(xe={})),function(e){e[e.CURRENT=2]="CURRENT"}(Fe||(Fe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(He||(He={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Ke||(Ke={})),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"}(Ye||(Ye={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(qe||(qe={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(je||(je={}));var We,Je,Xe,Ze={"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"}(We||(We={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Je||(Je={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Xe||(Xe={}));var ze=function(e){return"string"==typeof e},$e=function(e){return"boolean"==typeof e},et=function(e){return"number"==typeof e&&!Number.isNaN(e)},tt=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},nt=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},it=function(e){return ze(e)&&e.length>0},rt=function(e){return tt(e)&&e.length>0},ot=function(e){return"[object Object]"===Object.prototype.toString.call(e)},st=function(e){return"[object Function]"===Object.prototype.toString.call(e)},at=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},ut=function(e){return"[object Null]"===Object.prototype.toString.call(e)},ct=function(e){return ze(e)&&/https?:\/\//.test(e)},lt=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},ht=function(e){return et(e)&&Object.prototype.hasOwnProperty.call(z,e)},dt=function(e){return et(e)&&Object.prototype.hasOwnProperty.call(se,e)},gt=function(e){var t=!1;return ze(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},pt=function(e){return[z.PRIVATE,z.GROUP,z.SYSTEM,z.PUBLIC_SERVICE,z.APP_PUBLIC_SERVICE].includes(e)},ft=function(e){return et(e)&&Object.prototype.hasOwnProperty.call(Y,e)},_t=function(e){var t=!1,n=!1,i=!1;if(ot(e)){var r=Object.keys(e).length;for(var o in t=r>20,e)if(n||(n=ze(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}},Et=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,u=o.listener;a&&i.splice(r,1);try{u.call.apply(u,V([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}(),Tt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Tt.engine="5.8.1";var It=function(){function e(){}return e.add=function(e,t){Tt[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 Tt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Tt},e}(),Ct=null;function vt(e,t,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-e];if(Ct&&e<he.FATAL)try{var o=JSON.stringify(n);Ct[r](t,o)}catch(e){console.error(e)}}var Rt,yt,mt=vt.bind(null,he.DEBUG),St=vt.bind(null,he.INFO),Ot=vt.bind(null,he.WARN),Nt=vt.bind(null,he.ERROR),Mt=vt.bind(null,he.FATAL),At=Object.freeze({__proto__:null,init:function(e){Ct=e},log:vt,debug:mt,info:St,warn:Ot,error:Nt,fatal:Mt}),Lt=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)}))},Ut=function(){var e=Lt();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};!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"}(yt||(yt={}));var Pt,wt,bt,Dt=((Rt={})[yt.STRING]=it,Rt[yt.ONLY_STRING]=ze,Rt[yt.NUMBER]=et,Rt[yt.BOOLEAN]=function(e){return"boolean"==typeof e},Rt[yt.OBJECT]=ot,Rt[yt.ARRAY]=tt,Rt[yt.CALLBACK]=function(e){var t=!0;return ot(e)||(t=!1),(e=e||{}).onSuccess&&!st(e.onSuccess)&&(t=!1),e.onError&&!st(e.onError)&&(t=!1),t},Rt[yt.CHANNEL_ID]=gt,Rt[yt.CONVERSATION]=function(e){var t=!0;return ot(e)||(t=!1),ze(e.targetId)||(t=!1),ht(e.conversationType)||(t=!1),at(e.channelId)||gt(e.channelId)||(t=!1),t},Rt),Vt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return P(t,e),t}(Error),Gt=function(e,t,n,i){if(void 0===i&&(i=!1),!Bt(e,t,n,i))throw new Vt("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},Bt=function(e,t,n,i){void 0===i&&(i=!1),n=Dt[n]||n;var r=i?n(t):at(t)||null==t||n(t);return r||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),r},kt=function(e){if(!ot(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)},xt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),i=Lt(),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)},Ft=function(e){var t="application/octet-stream";switch(e){case Y.IMAGE:t="image/jpeg";break;case Y.AUDIO:t="audio/amr";break;case Y.VIDEO:t="video/3gpp";break;case Y.SIGHT:t="video/mpeg4";break;case Y.COMBINE_HTML:t="text/html"}return t},Ht=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h=t.miLargeIconUrl,d=t.importanceHW,g=t.categoryHW,p=t.imageUrlHW,f=t.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=i||"",_.category=r||"",_.richMediaUri=o||"";var E={};E.collapse_key=null==l?void 0:l.collapseKey,E.imageUrl=null==l?void 0:l.imageUrl;var T=null==l?void 0:l.priority;T&&!["high","normal"].includes(T)&&(T="normal"),E.priority=T;var I=[{HW:{channelId:a||"",importance:d||"NORMAL",image:p||"",category:g||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||"",category:f||""}},{APNS:_},{FCM:E}];return JSON.stringify(I)},Kt=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,u,c,l,h,d=Object.keys(e);if(0!==d.length){var g=d[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 r.channelIdMi=null===(a=e[g])||void 0===a?void 0:a.channelId,void(r.miLargeIconUrl=null===(u=e[g])||void 0===u?void 0:u.large_icon_uri);case"OPPO":return void(r.channelIdOPPO=null===(c=e[g])||void 0===c?void 0:c.channelId);case"VIVO":return r.typeVivo=null===(l=e[g])||void 0===l?void 0:l.classification,void(r.categoryVivo=null===(h=e[g])||void 0===h?void 0:h.category);case"APNS":return i.threadId=e[g]["thread-id"],i.apnsCollapseId=e[g]["apns-collapse-id"],i.category=e[g].category,void(i.richMediaUri=e[g].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[g].collapse_key||"",imageUrl:e[g].imageUrl||"",priority:e[g].priority||""}}}}))}catch(n){e.error(ge.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:i,androidConfig:r}},Yt=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},qt=function(e){var t=e.length;return t<=4096&&t>=1},jt=(Pt=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+Pt.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return Pt=2047&++Pt,parseInt(n,2)}),Qt=function(){var e=It.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},Wt=function(e,t,n){var i=null==n?void 0:n.isReverse;ot(e)&&function(){for(var n in e)t(e[n],n,e)}(),(tt(e)||ze(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)}()},Jt=function(e,t){return Wt(e,(function(n,i){e[i]=t(n,i)})),e},Xt=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return Wt(e,(function(e,i){t===e&&(n=i)})),n},Zt=function(e,t){return-1!==Xt(e,t)},zt=function(e,t){var n=[];return Wt(e,(function(e){n.push(e)})),-1!==Xt(n,t)},$t=function(e){return JSON.parse(JSON.stringify(e))},en=function(){return"undefined"!=typeof RCCppEngine},tn=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"}},nn=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(nn(e[n]));else for(var n in t={},e)t[n]=nn(e[n]);else t=e;return t},rn=function(e){var t;try{t=nn(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},on={_delayTime:0,setTime:function(e){var t=(new Date).getTime();on._delayTime=t-e},getTime:function(){var e=on._delayTime;return(new Date).getTime()-e}},sn=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},an=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return b(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return D(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===X.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",cn="rtcRExit",ln="rtcRInfo",hn="rtcUData",dn="rtcUPut",gn="rtcUDel",pn="rtcSetData",fn="userSetData",_n="rtcQryData",En="rtcDelData",Tn="rtcToken",In="rtcUserState",Cn="rtcUList",vn="viewerJoinR",Rn="viewerExitR",yn="rtcPullKv",mn="rtcIdentityChange",Sn="rtcInvite",On="rtcCancelInvite",Nn="rtcInviteAnswer",Mn="rtcEndInvite",An="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"}(bt||(bt={}));var Ln=((wt={})[bt.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],wt[bt.RtcUserListOutput]=["users","token","sessionId","roomInfo"],wt[bt.SetUserStatusInput]=["status"],wt[bt.RtcSetDataInput]=["interior","target","key","value","objectName","content"],wt[bt.RtcUserSetDataInput]=["valueInfo","objectName","content"],wt[bt.RtcDataInput]=["interior","target","key","objectName","content"],wt[bt.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],wt[bt.MCFollowInput]=["state"],wt[bt.RtcTokenOutput]=["rtcToken"],wt[bt.RtcQryOutput]=["outInfo"],wt[bt.RtcQryUserOutDataInput]=["userId"],wt[bt.RtcUserOutDataOutput]=["user"],wt[bt.RtcQueryListInput]=["order"],wt[bt.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],wt[bt.RtcValueInfo]=["key","value"],wt[bt.RtcKeyDeleteInput]=["key"],wt[bt.RtcNotifyMsg]=["type","time","roomId"],wt[bt.RtcPullKV]=["timestamp","roomId"],wt[bt.RtcKVOutput]=["entries","bFullUpdate","syncTime"],wt[bt.RtcQueryUserJoinedInput]=["userId"],wt[bt.RtcQueryUserJoinedOutput]=["info"],wt[bt.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],wt[bt.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],wt[bt.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],wt[bt.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],wt),Un="\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(bt.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(bt.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(bt.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(bt.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(bt.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(bt.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(bt.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(bt.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(bt.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(bt.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(bt.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(bt.RtcQryOutput,"{\n repeated ").concat(bt.RtcValueInfo," outInfo=1;\n }\n message ").concat(bt.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(bt.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(bt.RtcUserSetDataInput," {\n repeated ").concat(bt.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(bt.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(bt.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(bt.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(bt.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(bt.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(bt.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(bt.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(bt.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(bt.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(bt.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(bt.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(bt.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(bt.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(bt.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(bt.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(bt.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"),Pn=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 an(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 b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode(bt.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!==X.SUCCESS?[2,{code:i}]:(o=this.rtcCodec.decode(bt.RtcKVOutput,r),s=o.entries,a=o.syncTime,s=(s||[]).map((function(e){return w(w({},e),{timestamp:kt(e.timestamp)})})),this._watcher.onRTCDataChange(s,e),[2,{code:i,data:{kvEntries:s,syncTime:kt(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(bt.RtcNotifyMsg,e),n=t.time,i=t.type,r=t.roomId;1===i&&this._rtcKVManager.pullEntry(r,kt(n))}},e.prototype.destroy=function(){},e}();function wn(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=u[e])?i:(n=r(e,(0|e)<0?-1:0,!0),o&&(u[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:p;if(t){if(e<0)return f;if(e>=h)return C}else{if(-d>=e)return v;if(e+1>=d)return I}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,u,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(e.substring(1),t,n).neg();for(s=i(c(n,8)),a=p,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(d=i(c(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,u,c,l,h,d,g,p,f,_,E,T,I,C,v,R;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=i,e.fromBits=r,c=Math.pow,e.fromString=o,e.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,g=n(16777216),p=n(0),e.ZERO=p,f=n(0,!0),e.UZERO=f,_=n(1),e.ONE=_,E=n(1,!0),e.UONE=E,T=n(-1),e.NEG_ONE=T,I=r(-1,2147483647,!1),e.MAX_VALUE=I,C=r(-1,-1,!0),e.MAX_UNSIGNED_VALUE=C,v=r(0,-2147483648,!1),e.MIN_VALUE=v,(R=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},R.toString=function(e){var t,n,r,o,s,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(v)?(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(c(e,6),this.unsigned),s=this,a="";;){if(u=s.div(o),l=(s.sub(u.mul(o)).toInt()>>>0).toString(e),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(v)?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},R.isZero=function(){return 0===this.high&&0===this.low},R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return 1==(1&this.low)},R.isEven=function(){return 0==(1&this.low)},R.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)},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.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},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(v)?v:this.not().add(_)},R.neg=R.negate,R.add=function(e){var n,i,o,a,u,c,l,h,d,g,p;return t(e)||(e=s(e)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,d=0,g=0,p=0,g+=(p+=a+(65535&e.low))>>>16,d+=(g+=o+l)>>>16,h+=(d+=i+c)>>>16,h+=n+u,r((g&=65535)<<16|(p&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},R.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){var n,o,a,u,c,l,h,d,f,_,E,T;return this.isZero()?p:(t(e)||(e=s(e)),e.isZero()?p:this.eq(v)?e.isOdd()?v:p:e.eq(v)?this.isOdd()?v:p:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(g)&&e.lt(g)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,f=0,_=0,E=0,T=0,E+=(T+=u*(d=65535&e.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=u*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=u*l)>>>16,f+=n*d+o*h+a*l+u*c,r((E&=65535)<<16|(T&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},R.mul=R.multiply,R.divide=function(e){var n,r,o,a,u,l,h;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:p;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(v))return e.eq(_)||e.eq(T)?v:e.eq(v)?_:(n=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?_:T:(r=this.sub(e.mul(n)),o=n.add(r.div(e)));if(e.eq(v))return this.unsigned?f:p;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=p}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=i(n)).mul(e);h.isNegative()||h.gt(r);)h=(l=i(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=_),o=o.add(l),r=r.sub(h)}return o},R.div=R.divide,R.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.not=function(){return r(~this.low,~this.high,this.unsigned)},R.and=function(e){return t(e)||(e=s(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return t(e)||(e=s(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return t(e)||(e=s(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},R.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)},R.shl=R.shiftLeft,R.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)},R.shr=R.shiftRight,R.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))},R.shru=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.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]},R.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,u=(1<<a)-1,c=u>>1,l=-7,h=n?r-1:0,d=n?-1:1,g=e[t+h];for(h+=d,o=g&(1<<-l)-1,g>>=-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-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,i),o-=c}return(g?-1:1)*s*Math.pow(2,o-i)}function r(e,t,n,i,r,o){var s,a,u,c=8*o-r-1,l=(1<<c)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,p=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,r),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;e[n+g]=255&a,g+=p,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;e[n+g]=255&s,g+=p,s/=256,c-=8);e[n+g-p]|=128*f}var o,s,a,u,c,l=function(e,t,n){if(void 0===e&&(e=l.DEFAULT_CAPACITY),void 0===t&&(t=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,i){var r,o,s,a,u,c;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(c=new l(r,n,i),s=0;a>s;)(o=(u=e[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=o);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,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,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(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 u?(this.offset=t,this):t-i},o.readBitSet=function(e){var t,n,i,r,o,s,a,u=void 0===e;for(u&&(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 u&&(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,u=void 0===n;if(u&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),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 u?(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,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,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),u?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var 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=c.calculateUTF16asUTF8(t(e))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,c.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,c.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=c.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,c.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=c.calculateUTF16asUTF8(t(e))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,c.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 c.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(e,t,i){var r,o,s,a,u;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(),c.decodeUTF8(function(){return e>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++s,c.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(u=i+e,c.decodeUTF8toUTF16(function(){return u>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);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=c.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),c.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)}},u=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 u.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 u.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,u=0,c=!1,h=!1,d=!1,g=!1,p=!1;o>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(h||d||g){p=!0;break}h=d=g=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(h||g){p=!0;break}h=g=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(h||d){p=!0;break}h=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(h){p=!0;break}h=!0}s.offset=u,c=!1;break;case"]":if(!n){if(g||d){p=!0;break}g=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(g){p=!0;break}g=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){p=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){p=!0;break}if(r=parseInt(i+e.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=r,c=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!g)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,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},c=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,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{c.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(c.calculateUTF16asUTF8(t(e),!0)[1],n,i),o=0;return c.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={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,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},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,o=function(e){this.tn=new u(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},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,u,c,l,h,d,g,p,f,_,E,T,I,C,v={},R=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},y=R.prototype;return y.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},y.toString=function(e){return(e?this.className+" ":"")+this.fqn()},y.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},v.T=R,o=function(e,t,n,i,r){R.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(R.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 c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,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 v.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof v.T&&(!t||n instanceof v.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 v.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},v.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)},u=a.prototype,a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new i(0):t.defaultValue},u.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+")")},u.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)")},u.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},u.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")},u.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return i.fromBinary(t)}},u.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},v.Element=a,c=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=c.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,u,c,l,h,d,g;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 u=[],t.forEach((function(e,t){u[t]=r(e,n,o,s)})),u;if(u={},t instanceof e.Map){for(l=(c=t.entries()).next();!l.done;l=c.next())u[t.keyElem.valueToString(l.value[0])]=r(l.value[1],n,o,t.valueElem.resolvedType);return u}for(g in h=t.$type,d=void 0,t)t.hasOwnProperty(g)&&(u[g]=h&&(d=h.getChild(g))?r(t[g],n,o,d.resolvedType):r(t[g],n,o));return u}var o,s,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var r,o,s,l;for(e.Builder.Message.call(this),r=0,o=u.length;o>r;++r)this[u[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 c)||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=c.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}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,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))},c.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}},c.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}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),c}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof f||o instanceof c||o instanceof T){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 c.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof c.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},l.encode=function(e,t,n){var i,r,o,s,a,u=null;for(o=0,s=this._fields.length;s>o;++o)r=e[(i=this._fields[o]).name],i.required&&null===r?null===u&&(u=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,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,u,c,l,h,d,g,p,f,_;for(n="number"==typeof n?n:-1,c=t.offset,l=new this.clazz;t.offset<c+n||-1===n&&t.remaining()>0;){if(a=(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(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(s,t)):u.map?(d=u.decode(s,t),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(s,t),u.oneof&&(null!==(g=l[u.oneof.name])&&g!==u.name&&(l[g]=null),l[u.oneof.name]=u.name));else switch(s){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM: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(p=0,f=this._fields.length;f>p;++p)if(null===l[(u=this._fields[p]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,_;e.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},v.Message=c,h=function(t,n,i,r,o,s,a,u,l,h){R.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=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(R.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,u,c;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],n);a=n.offset-s,(u=i.calculateVarint32(a))>1&&(c=n.slice(s,n.offset),s+=u-1,n.offset=s,n.append(c)),n.writeVarint32(a,s-u)}else for(o=0;o<t.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[o],n);else this.map?t.forEach((function(t,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,u,c,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(u=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((c=n.clone()).limit=c.offset+o,n.offset+=o;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(c,t,h)}return[u,r]}return this.element.decode(n,t,this.id)},v.Message.Field=h,g=function(e,t,n,i,r,o,s){h.call(this,e,t,n,null,i,r,o,s),this.extension},g.prototype=Object.create(h.prototype),v.Message.ExtensionField=g,p=function(e,t,n){R.call(this,e,t,n),this.fields=[]},v.Message.OneOf=p,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},v.Enum=f,_=function(e,t,n,i){R.call(this,e,t,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(R.prototype),v.Enum.Value=_,E=function(e,t,n,i){R.call(this,e,t,n),this.field=i},E.prototype=Object.create(R.prototype),v.Extension=E,T=function(e,t,n,i){o.call(this,e,t,n,i),this.className="Service",this.clazz=null},(T.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,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)},v.Service=T,I=function(e,t,n,i){R.call(this,e,t,n),this.className="Service.Method",this.options=i||{}},(I.prototype=Object.create(R.prototype)).buildOpt=s.buildOpt,v.Service.Method=I,C=function(e,t,n,i,r,o,s,a){I.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(I.prototype),v.Service.RPCMethod=C,v}(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,u;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),u=[],o.enums&&o.enums.forEach((function(e){u.push(e)})),o.messages&&o.messages.forEach((function(e){u.push(e)})),o.services&&o.services.forEach((function(e){u.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),u.length>0){i.push(t),t=u,u=null,this.ptr=s,s=null;continue}u=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,u,c,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,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=s+d+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&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 bn,Dn,Vn,Gn=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=wn(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(ge.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(ge.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(!ot(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.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"}(bn||(bn={})),function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA"}(Vn||(Vn={}));var Bn=((Dn={})[Vn.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:bn.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"]},Dn[Vn.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:bn.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="]},Dn[Vn.NA]={naviUrlBase64:["bmF2LXVzLnJvbmdodWIuY29t"],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:bn.HTTPS,weight:-1}],miniCmpBase64:["d3MtdXMucm9uZ2h1Yi5jb20="]},Dn);function kn(e){return e>=Vn.BJ&&e<=3?e:Vn.BJ}bn.HTTPS;var xn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Fn(e){var t,n,i,r,o,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=xn.indexOf(e.charAt(u++))<<2|(r=xn.indexOf(e.charAt(u++)))>>4,n=(15&r)<<4|(o=xn.indexOf(e.charAt(u++)))>>2,i=(3&o)<<6|(s=xn.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a}function Hn(e,t){return/^https?:/.test(e)?e:t===bn.HTTP?"http://".concat(e):"https://".concat(e)}var Kn,Yn,qn,jn,Qn,Wn,Jn,Xn=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e){var t,n=this.initOption||{},i=n.areaCode,r=n.navigators,o=(t=i,void 0===t&&(t=Vn.BJ),Bn[kn(t)].naviUrlBase64).map((function(e){return Fn(e)})),s=e.split("@")[1],a=s?s.split(";"):[],u=r&&r.length>0?V(V([],a,!0),r,!0):V(V([],a,!0),o,!0);return u.filter((function(e,t){return u.indexOf(e)===t})).map((function(e){return Hn(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,c=(n=a,void 0===n&&(n=Vn.BJ),Bn[kn(n)].logUrlBase64).map((function(e){return w(w({},e),{addr:Fn(e.addr)})})),l=[],h={level:1,itv:6,times:5};if(r)l.push.apply(l,r.addrs),Object.assign(h,r.policy);else if(o)try{var d=JSON.parse(o);l.push({addr:d.url,protocol:bn.HTTPS,weight:1}),h.level=d.level,h.itv=d.itv,h.times=d.times}catch(n){t.warn(ge.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var g=u?V([{addr:u,protocol:bn.HTTPS,weight:101}],l,!0):V(V([],l,!0),c,!0);return{policy:h,addrs:g.filter((function(e,t){return g.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return w(w({},e),{addr:Hn(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=Vn.BJ),Bn[kn(t)].miniCmpBase64).map((function(e){return Fn(e)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i:n},e}(),Zn=new Xn,zn=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 b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.8.1"},e.prototype.getAPIVersion=function(){return"5.8.1"},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}(),$n="pgMsgP",ei="chatMsg",ti="pcMsgP",ni={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},ii="delMsg",ri="joinChrm",oi="joinChrmR",si="exitChrm",ai="setKV",ui="delKV",ci="setKVS",li="delKVS",hi="qryRelationR",di="delRelation",gi="setSeAtt",pi={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},fi="reqCall",_i="qryPMsg",Ei="qryGMsg",Ti="qryCHMsg",Ii="qryCMsg",Ci="qrySMsg",vi=((Kn={})["ppMsgP"]=z.PRIVATE,Kn[$n]=z.GROUP,Kn[ei]=z.CHATROOM,Kn[ti]=z.CUSTOMER_SERVICE,Kn),Ri=((Yn={})[z.PRIVATE]=_i,Yn[z.GROUP]=Ei,Yn[z.CHATROOM]=Ti,Yn[z.CUSTOMER_SERVICE]=Ii,Yn[z.SYSTEM]=Ci,Yn),yi=((qn={})[z.PRIVATE]=pi.PRIVATE,qn[z.GROUP]=pi.GROUP,qn[z.ULTRA_GROUP]=pi.ULTRA_GROUP,qn[z.CUSTOMER_SERVICE]=pi.CUSTOMER_SERVICE,qn[z.SYSTEM]=pi.SYSTEM,qn),mi="1",Si="0",Oi=1,Ni=2,Mi=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"}(jn||(jn={})),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"}(Qn||(Qn={})),function(e){e.PUB="pub",e.QUERY="qry"}(Wn||(Wn={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Jn||(Jn={}));var Ai,Li=function(){function e(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=jn.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=jn.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}(),Ui=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(ze(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}(),Pi=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 Ui.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),wi=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=Ui.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),bi=function(e,t){return e&&t?"".concat(t,"_").concat(e):e||Date.now()},Di=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 bi(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}(),Vi=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Li(e,!1,jn.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return bi(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 wi;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),Gi=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 P(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===Jn.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(ge.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:i}},t.MESSAGE_LENGTH=2,t}(Di),Bi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return P(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}(Di),ki=function(e){function t(){return e.call(this,Qn.PING_REQ)||this}return P(t,e),t.prototype.writeMessage=function(e){},t}(Vi),xi=function(e){function t(t){return e.call(this,t)||this}return P(t,e),t}(Di),Fi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return P(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}(Di),Hi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return P(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}(Vi),Ki=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Wn.PUB,t}return P(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}(Fi),Yi=function(e){function t(t,n,i){var r=e.call(this,Qn.PUBLISH)||this;return r.syncMsg=!1,r.identifier=Wn.PUB,r.topic=t,r.data=ze(n)?Ui.writeUTF(n):n,r.targetId=i,r}return P(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}(Hi),qi=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=Wn.PUB,t.topic="",t.targetId="",t}return P(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}(Fi),ji=function(e){function t(t){var n=e.call(this,Qn.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return P(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Hi),Qi=function(e){function t(t,n,i){var r=e.call(this,Qn.QUERY)||this;return r.identifier=Wn.QUERY,r.topic=t,r.data=ze(n)?Ui.writeUTF(n):n,r.targetId=i,r}return P(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}(Hi),Wi=function(e){function t(t){var n=e.call(this,Qn.QUERY_CONFIRM)||this;return n.messageId=t,n}return P(t,e),t}(Hi),Ji=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=Wn.QUERY,t.topic="",t.targetId="",t}return P(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}(Fi),Xi=function(e,t,n){var i=new Uint8Array(t),r=new Pi(i),o=r.readByte(),s=function(e,t){var n,i=e.type;switch(i){case Qn.CONN_ACK:n=new Gi(e);break;case Qn.PUBLISH:(n=new Ki(e)).syncMsg=e.syncMsg;break;case Qn.PUB_ACK:n=new qi(e);break;case Qn.QUERY_ACK:n=new Ji(e);break;case Qn.SUB_ACK:case Qn.UNSUB_ACK:case Qn.PING_RESP:n=new xi(e);break;case Qn.DISCONNECT:n=new Bi(e);break;default:n=new Di(e),t.error(ge.O,"No support for deserializing ".concat(i," messages"))}return n}(new Li(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.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.minioUrl=47]="minioUrl",e[e.cleanPMsg=48]="cleanPMsg",e[e.cleanGMsg=49]="cleanGMsg",e[e.cleanCMsg=50]="cleanCMsg",e[e.cleanSMsg=51]="cleanSMsg",e[e.rtcPing=52]="rtcPing",e[e.rtc_ntf=53]="rtc_ntf",e[e.rtcSetOutData=54]="rtcSetOutData",e[e.rtcQryUserOutData=55]="rtcQryUserOutData",e[e.addSeTag=56]="addSeTag",e[e.delSeTag=57]="delSeTag",e[e.addTag=58]="addTag",e[e.delTag=59]="delTag",e[e.disTag=60]="disTag",e[e.reportsdk=61]="reportsdk",e[e.pullUgSes=62]="pullUgSes",e[e.pullUgMsg=63]="pullUgMsg",e[e.ugMsg=64]="ugMsg",e[e.qryUgMsg=65]="qryUgMsg",e[e.updUgRTime=66]="updUgRTime",e[e.upMsgEx=67]="upMsgEx",e[e.modifyMsg=68]="modifyMsg",e[e.qryMsgChange=69]="qryMsgChange",e[e.qryMsg=70]="qryMsg",e[e.operate=71]="operate",e[e.s_opNtf=72]="s_opNtf",e[e.ugUnpushQuery=73]="ugUnpushQuery",e[e.ugUnpushSet=74]="ugUnpushSet",e[e.setRtcRoomId=75]="setRtcRoomId",e[e.qryUgUal=76]="qryUgUal",e[e.s_pubCall=77]="s_pubCall"}(Ai||(Ai={}));var Zi=Ai,zi="outbox",$i="inbox",er="broadcastbox",tr=function(e,t,n){return[e,t,n].join("_")},nr=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=tr($i,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=tr($i,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||at(e))){n.broadcastSyncTime=e;var i=tr(er,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=tr(er,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=tr(zi,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=tr(zi,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),ir={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},rr=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===_e.DELETE,u=s===o,c=!this._isExisted(n),l=a?this._remove:this._add;(t||r||u||c)&&l.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,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}(),or=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return b(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return D(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=ir.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===X.SUCCESS?(ir.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){ir.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];lt(i)||(i=new rr(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}(),sr=function(){function e(e,t,n,i,r){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=i,this.logger=r,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){this.logger.error(ge.O,"parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],lt(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},e.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},e}(),ar="converStatusChanged",ur=function(){function e(e,t,n){this._eventEmitter=new Et,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n),this._oldStorage=M(e.runtime),this._storage=new L(e.runtime,this._storagePullTimeKey),this._appkey=t,this._currentUserId=n,this._engine=e,this.adaptOldStatus()}return e.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(ge.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},e.prototype._set=function(e){var t=this;if(!at(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(ar,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return b(this,void 0,void 0,(function(){var e,t,n,i;return D(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=r.sent(),n=t.code,i=t.data,n===X.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(ar,(function(t){e(t)}))},e.prototype.setConversationUpdatedTime=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t},e.prototype.getConversationUpdatedTime=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),cr={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},lr={};for(var hr in cr){var dr=cr[hr].keyName;lr[dr]=hr}var gr,pr=function(){function e(e,t,n,i){this._appkey=t,this._currentUserId=n,this.logger=i;var r="con-".concat(t,"-").concat(n);this.storage=new L(e,r),this._localStore=new L(e,"CONVER-".concat(t,"-").concat(n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),i=t.shift(),r=t.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:z.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===z.GROUP&&((n.userIdList||[]).forEach((function(e){e===i._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===ue.ALL&&t.indexOf(a)<0&&t.push(a));if(o===ne.RECALL&&r===z.GROUP){var u=t.indexOf(a);u>=0&&t.splice(u,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,i=e.content,r=e.channelId,o=i.mentionedInfo;if(o){var s=this._getStoreKey(t,n,r),a=this._localStore.get(s)||{},u=lr.mentionedInfo,c=lr.hasMentioned,l=a[u]||{},h=l.userIdList||[];o={userIdList:h=this._updateMentionedUserList(e,h,o),type:(null==o?void 0:o.type)||l.type},0!==h.length?(a[u]=o,a[c]=!0):(delete a[u],delete a[c]),lt(a)?this._localStore.set(s,a):this._localStore.remove(s)}},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=lr[s],u=n[s];if(!at(a)&&!at(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===cr[a].defaultVal||"tags"===s&&!lt(u)?delete o[a]:o[a]=this._setLocal(s,u),o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}var c=Object.keys(o);1===c.length&&c.includes("st")&&delete o.st,lt(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 cr){var a=cr[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||$t(c)}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(cr[a]){var u=cr[a],c=u.keyName,l=u.defaultVal;o[c]=s[a]||$t(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 c=cr[u],l=c.keyName,h=c.defaultVal;s[l]=a[u]||$t(h)}for(var d in s.tags){at(t[d])&&(t[d]=[]);var g=w(w({},s),{conversationType:r,targetId:o});delete g.tags,t[d].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(ge.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}(),fr=[z.PRIVATE,z.GROUP,z.SYSTEM,z.PUBLIC_SERVICE,z.APP_PUBLIC_SERVICE],_r={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},Er=1e3,Tr=function(){function e(e,t,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Et,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new pr(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new ur(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(_r.CHANGED,(function(e){i(e)})),this._eventEmitter.on(_r.CON_TAG_STATUS_CHANGED,(function(){r()}));var s=this._store.getValue();s.length>Er&&(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(Er,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,u=s===j.SEND&&a===this._loginUserId,c=i===ne.RECALL,l=ot(n),h=!1,d={},g=t.lastUnreadTime,p=t.lastReadTime,f=t.unreadMessageCount;if(g>r||u)return{hasChanged:h,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=f+1,t.lastUnreadTime=r,h=!0),c&&l){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),E=this._calcMsg(_,g,p,n),T=E.isNotRead,I=E.isNotRepeadRecallSendTime;T&&f&&I&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:t.unreadMessageCount||0,time:r}),{hasChanged:h,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,i=e.messageDirection,r=e.isMentioned,o=e.sentTime,s=i===j.SEND,a=ot(n),u=!1,c={};return!s&&r&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:o},c.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,i=e.messageDirection,r=!1;if(e.isMentioned&&i===j.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===ue.ALL||(a||[]).includes(this._loginUserId)){r=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}if((a||[]).includes(this._loginUserId)){r=!0;u=t.unreadMentionedMeCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:r,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(ot(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,u=e.tags,c=e.channelId,l={},h={};if(n!==z.ULTRA_GROUP){at(o)||(h.notificationStatus={time:r,val:o}),at(s)||(h.notificationLevel={time:r,val:s}),at(a)||(h.isTop={time:r,val:a}),at(u)||(h.tags={time:r,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,i,l,c);var d=this._store.get(n,i,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,i,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},c),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:c}),t&&this._notifyConversationChanged()}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(_r.CHANGED,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(_r.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(fr.indexOf(i)>=0){var u=!1,c=this._store.get(i,o,s),l={};if(c.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,c),r=i.hasChanged,o=i.localConversation,s=i.updateItems;u=u||r,l=w(w({},l),s),c=$t(o)})),this._store.set(i,o,c,s),this._store.updateMentionedData(e),r){var h=this._store.get(i,o,s);h.updatedItems=w({latestMessage:{time:e.sentTime,val:e}},l),h.latestMessage=e;var d=Object.assign(h,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(d)}(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!==re.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,u=i.conversationType,c=i.unreadMentionedCount;e.includes(u)&&(0===t.length||t.includes(a))&&(r+=(n?c: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){void 0===i&&(i=!0);var r=this._store.get(e,t,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=r.unreadMessageCount,s=r.hasMentioned,a={};if(o&&(r.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,r,n),i&&0!==Object.keys(a).length){var u=Object.assign(r,{conversationType:e,targetId:t,channelId:n,updatedItems:a});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===re.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){return(this._store.getValue()||{}).filter((function(n){return e.includes(n.conversationType)&&(at(t)||t===n.channelId)&&n.isTop})).map((function(e){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,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},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){return(this._store.getValue()||{}).filter((function(t){return e.includes(t.conversationType)&&t.unreadMessageCount&&t.unreadMessageCount>0})).map((function(e){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,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e.prototype.setConversationUpdatedTime=function(e){return this._statusManager.setConversationUpdatedTime(e)},e.prototype.getConversationUpdatedTime=function(){return this._statusManager.getConversationUpdatedTime()},e}(),Ir=function(){function e(e,t,n,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(t,"-").concat(n),this._storagePullTimeKey="us-s-".concat(t,"-").concat(n),this._storage=M(e.runtime),this._engine=e,this._tagWatcherFunc=i}return e.prototype._updateTag=function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,i=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:i}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.deleteTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))},e.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return b(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=u.sent(),n=t.code,i=t.data,n!==X.SUCCESS||at(i)?(this._isPulling=!1,this._startPull()):(o=(r=i).settings,s=r.version,a=o.Tag,at(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),Cr=function(e){return e.replace(/@.+$/,"@")},vr=function(){function e(e,t,n){this.appkey=e,this.logger=t,this.statisticLog=n,this.crtRequest=null}return e.prototype.request=function(e,t,n,i,r){return b(this,void 0,void 0,(function(){var o,s,a;return D(this,(function(u){switch(u.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=u.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},e.prototype.sendRequest=function(e,t,n,r,o){return b(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return s=Cr(e),!t&&(a=this.getNaviCache(s))&&(u=a.timestamp,c=a.naviInfo,n||Date.now()-u<i)?(this.logger.info(ge.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),r),l={bid:Qt(),ptc:ke.NAVI,cod:X.SUCCESS,net:null==o?void 0:o.type,dur:0,spr:0,pr:c.type||0,hos:"",cache:xe.LOCAL,v:Fe.CURRENT,rsn:null==o?void 0:o.reason,cid:"".concat(null==o?void 0:o.uuid,"_").concat(null==o?void 0:o.retryCount),count:null==o?void 0:o.retryCount},this.statisticLog.__statistics(pe.IM_NAVI,JSON.stringify(l),r),[2,{code:X.SUCCESS,data:c}]):(h=Zn.getNaviUrlList(e),this.logger.info(ge.L_GET_NAVI_T,JSON.stringify({token:e,uris:h}),r),[4,this.requestHandler(h,e,r,o)]);case 1:return d=_.sent(),g=d.code,p=d.data,g!==X.SUCCESS?(this.logger.warn(ge.L_GET_NAVI_R,g,r),[2,{code:g}]):(f=p,this.logger.info(ge.L_GET_NAVI_R,JSON.stringify({naviInfo:f}),r),this.setNaviCache(s,f),[2,{code:g,data:f}])}}))}))},e.prototype.requestHandler=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:r=0,o=e.length,g.label=1;case 1:return r<o?(s=r===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,e[r],this.appkey,t,n,s)]):[3,4];case 2:if(c=g.sent(),l=c.code,h=c.data,d={bid:Qt(),ptc:ke.NAVI,cod:l,net:null==i?void 0:i.type,dur:Date.now()-u,spr:0,pr:(null==h?void 0:h.type)||0,hos:e[r],cache:xe.REQUEST,v:Fe.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.__statistics(pe.IM_NAVI,JSON.stringify(d),n),l===X.SUCCESS)return[2,{code:l,data:h}];g.label=3;case 3:return r+=1,[3,1];case 4:return[2,{code:X.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return X.RC_CONN_TOKEN_INCORRECT;case 416:return X.RC_LICENSE_EXPIRED;default:return X.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(Cr(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(Cr(e),w(w({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,i=e.token,r=e.platform,s=e.protocol;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var a="token=".concat(encodeURIComponent(i),"&version=").concat("5.8.1","&platfrom=").concat(r);return{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(s,";rtc=4;log=2")},body:a,url:t,timeout:o}},e.prototype.useV2Navi=function(){return!0},e}(),Rr=function(e){return["navi",e].join("_")},yr={},mr=function(e){function t(t,n,i,r){var o=e.call(this,t,n,i)||this;return o.runtime=r,o}return P(t,e),t.prototype.httpRequest=function(e,t,n,i,r){return b(this,void 0,void 0,(function(){var s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return s="".concat(e,"/navi.js?appId=").concat(t,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(S,"&r=").concat(Date.now()),this.logger.debug(ge.L_REQUEST_T,"req navi => ".concat(s),i),[4,this.runtime.httpReq({url:s,timeout:o,dataType:"text"})];case 1:if(200!==(a=l.sent()).status)return this.logger.debug(ge.L_REQUEST_R,"request navi failed: ".concat(a.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:Zn.getMiniCmpUrlList().join(",")},[2,{code:X.SUCCESS,data:c}]):[2,{code:this.transHttpCode(a.status)}];try{return 0===(u=a.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(u=JSON.parse('"'.concat(u,'"'))),(c=JSON.parse(u)).protocol=/^https/.test(s)?"https":"http",this.runtime.useNavi||(c.server="",c.backupServer=Zn.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,{code:X.SUCCESS,data:c}]}catch(e){this.logger.error(ge.L_PARSE_NAVI_E,a.data,i)}return[2,{code:X.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.httpRequestV2=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return r=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:this.runtime.tag,protocol:(/^https/.test(e)?bn.WSS:bn.WS).toString()}),this.logger.debug(ge.L_REQUEST_T,"req navi => ".concat(r.url),i),[4,this.runtime.httpReq(r)];case 1:if(200!==(o=c.sent()).status)return this.logger.debug(ge.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,u=Zn.getMiniCmpUrlList(),a.serverAddr=u.map((function(e,t){return{addr:e,protocol:/^https/.test(r.url)?bn.WSS:bn.WS,weight:u.length-t}}))),[2,{code:X.SUCCESS,data:a}]}catch(e){this.logger.error(ge.L_PARSE_NAVI_E,o.data,i)}return[2,{code:X.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){if(yr[e])return yr[e];var t,n=Rr(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 yr[e]=o,o},t.prototype.setNaviCache=function(e,t){var n,r=Rr(this.appkey),o=this.runtime.localStorage;try{var s=o.getItem(r);n=s?JSON.parse(s):[]}catch(e){n=[]}var a=Date.now();n.length>0&&(n=n.filter((function(t){return a-t.timestamp<i&&e!==t.token})));var u={timestamp:a,naviInfo:t,token:e};n.push(u),o.setItem(r,JSON.stringify(n)),yr[e]=u},t}(vr),Sr=function(e,t){return["send_msg",e,t].join("_")},Or=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=Sr(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=Sr(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=Sr(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}(),Nr=function(e){var t="RCDeviceId",n=M(e),i="",r=n.get(t);return r?i=r:(i=Ut(),n.set(t,i)),i};(gr={})[z.PRIVATE]=Zi.qryPMsg,gr[z.GROUP]=Zi.qryGMsg,gr[z.CHATROOM]=Zi.qryCHMsg,gr[z.CUSTOMER_SERVICE]=Zi.qryCMsg,gr[z.SYSTEM]=Zi.qrySMsg;var Mr=[Zi[Zi.recallMsg],Zi[Zi.ppMsgS],Zi[Zi.pgMsgS],Zi[Zi.ppMsgP],Zi[Zi.pgMsgP],Zi[Zi.chatMsg],Zi[Zi.pcMsgP],Zi[Zi.prMsgS],Zi[Zi.updUgRTime]],Ar=function(){function e(e,t,n){this.ULTRA_GROUP_CONVERSATION="ultragroupconversation";var i="".concat(this.ULTRA_GROUP_CONVERSATION,"-").concat(t,"-").concat(n);this._localStore=new L(e,i)}return e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=Ur[s],u=n[s];if(!at(a)&&!at(u))u===Lr[a].defaultVal?delete o[a]:o[a]=u}lt(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 Lr){var a=Lr[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||$t(c)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Lr={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Ur={};for(var Pr in Lr){var wr=Lr[Pr].keyName;Ur[wr]=Pr}var br,Dr=function(){function e(e,t,n){this._store=new Ar(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===z.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}(),Vr="UpStreamMessage",Gr="PushExtra",Br="DownStreamMessage",kr="DownStreamMessages",xr="SessionsAttQryInput",Fr="SessionsAttOutput",Hr="SyncRequestMsg",Kr="ChrmPullMsg",Yr="NotifyMsg",qr="HistoryMsgInput",jr="HistoryMsgOuput",Qr="RelationQryInput",Wr="RelationsOutput",Jr="UnreadMsgInfo",Xr="DeleteSessionsInput",Zr="SessionInfo",zr="DeleteSessionsOutput",$r="RelationsInput",eo="DeleteMsgInput",to="CleanHisMsgInput",no="SessionMsgReadInput",io="ChrmInput",ro="ChrmOutput",oo="QueryChatRoomInfoInput",so="QueryChatRoomInfoOutput",ao="GetQNupTokenInput",uo="GetQNupTokenOutput",co="GetQNdownloadUrlInput",lo="GetDownloadUrlInput",ho="GetQNdownloadUrlOutput",go="GetDownloadUrlOutput",po="ChrmKVEntity",fo="SetChrmKV",_o="SetChrmKVS",Eo="DeleteChrmKVS",To="ChrmKVOutput",Io="ChrmKVSOutput",Co="ChrmKVSVersionEntity",vo="ChrmKVSOutputEntity",Ro="QueryChrmKV",yo="SetUserSettingInput",mo="SetUserSettingOutput",So="PullUserSettingInput",Oo="PullUserSettingOutput",No="UserSettingNotification",Mo="SessionReq",Ao="SessionStates",Lo="SessionState",Uo="SessionStateItem",Po="SessionStateModifyReq",wo="SessionStateModifyResp",bo="GroupUnpushQuery",Do="GroupUnpushSet",Vo="QryRemindListReq",Go="QryRemindListResp",Bo="GroupUnpushResult",ko="GrpReadReceiptMsg",xo="GrpReadReceiptQryReq",Fo="GrpReadReceiptQryResp",Ho="GrpMsgReadUser",Ko="SessionTagAddInput",Yo="SessionTagItem",qo="SessionTagDelInput",jo="SessionDisTagReq",Qo="ReportSDKInput",Wo="ReportSDKOutput",Jo="UltraGrpPullSes",Xo="UltraGrpPullMsg",Zo="MsgChangeReq",zo="QueryMsgChange",$o="MsgChange",es="MsgChangeList",ts="MsgQuery",ns="MessageQueryInfo",is="MsgQueryAck",rs="OperateStatus",os="OperateStatusNotify",ss="OperateInfo",as="OperateSummary",us="SetRtcRoomIdInput",cs="SetRtcRoomIdOutput",ls="CallInfoUpStream",hs="CallInfoDownStream",ds="KvInput",gs="KvOutput";(br={})[Vr]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],br[kr]=["list","syncTime","finished","broadcastSyncTime"],br[Br]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],br[Gr]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],br[xr]=["nothing"],br[Fr]=["inboxTime","sendboxTime","totalUnreadCount"],br[Hr]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],br[Kr]=["syncTime","count"],br[Yr]=["type","time","chrmId"],br[qr]=["targetId","time","count","order","busChannel"],br[jr]=["list","syncTime","hasMsg"],br[Qr]=["type","count","startTime","order"],br[Wr]=["info","isFinished"],br[Jr]=["msgId","msgTime","remindType","className"],br[Xr]=["sessions"],br[Zr]=["type","channelId","busChannel"],br[zr]=["nothing"],br[$r]=["type","msg","count","busChannel","startTime","endTime"],br[eo]=["type","conversationId","msgs","busChannel"],br[to]=["targetId","dataTime","conversationType","busChannel"],br[no]=["type","msgTime","channelId","busChannel"],br[io]=["nothing"],br[ro]=["nothing","sessionId","joinTime"],br[oo]=["count","order"],br[so]=["userTotalNums","userInfos"],br[ao]=["type","key","httpMethod","queryString"],br[co]=["type","key","fileName"],br[lo]=["type","key","fileName"],br[uo]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],br[ho]=["downloadUrl"],br[go]=["downloadUrl"],br[po]=["key","value","status","timestamp","uid","version"],br[fo]=["entry","bNotify","notification","type"],br[_o]=["entry","bNotify","notification","type"],br[Eo]=["entry","bNotify","notification","type"],br[To]=["entries","bFullUpdate","syncTime"],br[Io]=["timestamp","errorKeys","keysVersion"],br[Co]=["version","key"],br[vo]=["key","errorCode"],br[Ro]=["timestamp"],br[yo]=["version","value"],br[mo]=["version","reserve"],br[So]=["version","reserve"],br[Oo]=["items","version"],br.UserSettingItem=["targetId","type","key","value","version","status","tags"],br[Mo]=["time"],br[Ao]=["version","state"],br[Lo]=["type","channelId","time","stateItem","busChannel"],br[Uo]=["sessionStateType","value","tags"],br[Po]=["version","state"],br[wo]=["version"],br[Do]=["busChannel","unpushLevel"],br[Vo]=["groupId","busChannel","msgTime","size"],br[bo]=["busChannel"],br[Bo]=["groupId","busChannel","unpushLevel"],br[ko]=["msgId","busChannel"],br[xo]=["msgId","busChannel"],br[Fo]=["totalMemberNum","list"],br[Ho]=["readTime","userId"],br[Ko]=["version","tags"],br[Yo]=["tagId","name","createdTime","isTop"],br[qo]=["version","tags"],br[jo]=["tagId"],br[No]=["version","reserve"],br[Qo]=["sdkInfo"],br[Wo]=["nothing"],br[Jo]=["syncTime","isEraseMsgContent"],br[Xo]=["syncTime"],br[Zo]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],br[zo]=["syncTime"],br[es]=["list","syncTime","hasNext"],br[$o]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],br[ts]=["targetId","type","query"],br[ns]=["msgTime","msgUID","busChannel"],br[is]=["list"],br[rs]=["targetId","type","opType","busChannel"],br[os]=["type","notifyType","info","summary"],br[ss]=["targetId","busChannel","userId","opType","optime"],br[as]=["targetId","busChannel","count","opType"],br[us]=["rtcRoomId"],br[cs]=["nothing"];var ps,fs="\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(Yr," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Hr," {\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(Vr," {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string userId = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13; // 该消息所属会话的业务标识\n }\n message ").concat(Gr," {\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(kr," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(Br," {\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(Y.IMAGE,";\n audio = ").concat(Y.AUDIO,";\n video = ").concat(Y.VIDEO,";\n file = ").concat(Y.FILE,";\n sight = ").concat(Y.SIGHT,";\n html = ").concat(Y.COMBINE_HTML,";\n }\n message ").concat(ao," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(co," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(lo," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(uo," {\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 message ").concat(ho," {\n required string downloadUrl = 1;\n }\n message ").concat(go," {\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(io," {\n required int32 nothing = 1;\n }\n message ").concat(ro," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(Kr," {\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(Qr,"\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($r,"\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(Wr,"\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(Jr," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(Jr," //未读消息摘要信息\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(Vo," // 新增 查询未读@列表入参\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(Go," //查询未读@列表出参\n {\n repeated ").concat(Jr," 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(to,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message ").concat(oo,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(so,"\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(qr,"\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(jr,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(xr,"{\n required int32 nothing = 1;\n }\n message ").concat(Fr,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(no,"\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(Xr,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(Zr,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(zr,"\n {\n optional int32 nothing=1;\n }\n message ").concat(eo,"\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(fo," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(_o," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Eo," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(To," {\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(Io," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(vo,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Ro," {\n required int64 timestamp = 1;\n }\n message ").concat(yo," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(mo," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(So," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Oo," {\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(Mo," {\n required int64 time = 1;\n }\n message ").concat(Ao," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Lo," {\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(Uo," {\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(Po," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(bo," {\n optional string busChannel = 1;\n }\n message ").concat(Do,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(Bo," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(wo," {\n required int64 version=1;\n }\n message ").concat(ko," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(xo," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Fo," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Ho," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Ko," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Yo," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(qo," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(jo," {\n repeated string tagId=1;\n }\n message ").concat(No," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Qo,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Wo,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Jo,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Xo,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Zo,"\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(zo," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(es," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat($o," //变更详情\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(ts," //请求\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(is," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(rs," //客户端发送\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(os," //服务端发送\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(ss," {\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(as," {\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(us,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(cs,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(ls,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat(hs,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(ds,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(gs,"\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}\n"),_s=function(e,t,n,i,r,o){var s=r?Object.keys(r).map((function(t){return e.encode(bt.RtcValueInfo,{key:t,value:r[t]},!0)})):void 0,a=o?Object.keys(o).map((function(t){return e.encode(bt.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(bt.RtcInput,{roomType:t,broadcastType:n,joinType:i,innerDatas:s,outerDatas:a})},Es=function(e,t){var n=e.decode(bt.RtcUserListOutput,t),i=n.users,r=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return Wt(i,(function(e){var t=e.userId,n=e.userData,i={};Wt(n,(function(e){var t=e.key,n=e.value;i[t]=n})),c[t]=i})),{users:c,token:r,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:u}};!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"}(ps||(ps={}));var Ts=function(e){return[ps.DEBUG,ps.INFO,ps.WARN,ps.ERROR].some((function(t){return t===e}))},Is=Ut(),Cs=Date.now(),vs=0,Rs=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=ps.WARN,this.debug=this._log.bind(this,ps.DEBUG),this.info=this._log.bind(this,ps.INFO),this.warn=this._log.bind(this,ps.WARN),this.error=this._log.bind(this,ps.ERROR),this.__statistics=this._log.bind(this,ps.STATISTICS)}return e.prototype._stdout=function(e,t,n,i,r){if(!(e<=ps.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){Ts(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!==ps.DEBUG&&this.flush({time:+r,sessionId:Is,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})):this._stdout(ps.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),t,i)},e.prototype.createTraceId=function(){return"".concat(Is,"-").concat(++vs)},e.prototype.getSessionId=function(){return Is},e}(),ys=null,ms="RC_LOGS",Ss="RC_CONF",Os=null,Ns=function(e){return b(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,ys];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(ms,"readwrite").objectStore(ms),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(),Os=setTimeout((function(){return Ns(e)}),6e5),[2]}}))}))},Ms=function(e,t,n,i){void 0===i&&(i=168),ys||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==tn(n).type?ys=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(ge.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(ge.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(ge.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(ge.L_LOGDB_ABORT_S,e.target.error)},Ns(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(ms)&&t.deleteObjectStore(ms);var n=t.createObjectStore(ms,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Ss,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(ge.L_UNSUPPORT_INDEXDB_O))},As=function(){return b(void 0,void 0,void 0,(function(){var e;return D(this,(function(t){switch(t.label){case 0:return ys?(Os&&(clearTimeout(Os),Os=null),[4,ys]):[2];case 1:return(e=t.sent())&&e.db.close(),ys=null,[2]}}))}))},Ls=[],Us=!1,Ps=function(e){return b(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return Us||0===Ls.length?[2]:(Us=!0,t=Ls.splice(0),[4,new Promise((function(n){var i=e.transaction(ms,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(ms);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(),Us=!1,setTimeout((function(){return Ps(e)})),[2]}}))}))};function ws(e){return b(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,ys];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(Ss,"readonly").objectStore(Ss).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 bs,Ds,Vs,Gs,Bs,ks,xs,Fs=0,Hs=function(){return{setTimestamp4RealtimeLog:function(e){Fs=e},getTimestamp4RealtimeLog:function(){return Fs},getLogs:function(e,t,n,i){return b(this,void 0,void 0,(function(){var r;return D(this,(function(o){switch(o.label){case 0:return[4,ys];case 1:return(r=o.sent())?[2,new Promise((function(o){var s=r.db.transaction(ms,"readonly").objectStore(ms),a=[],u=IDBKeyRange.bound(e,t),c=s.index("time").openCursor(u);c.onsuccess=function(e){var t=e.target.result;if(t){var r=t.value;r.level<=n&&(i?r.sessionId===Is:r.level>=0)&&a.push(r),t.continue()}else o({dbReady:!0,logs:a})},c.onerror=function(e){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ks="REPORT_SESSION",Ys=function(e,t){return b(void 0,void 0,void 0,(function(){var n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return n="".concat(Ks,"_").concat(e),[4,ws("".concat(Ks,"_").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){b(this,void 0,void 0,(function(){var n,i;return D(this,(function(r){switch(r.label){case 0:return[4,ys];case 1:return(n=r.sent())?(i=n.db,i.transaction(Ss,"readwrite").objectStore(Ss).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},qs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return P(t,e),t.prototype.flush=function(e){!function(e){b(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,ys];case 1:return(t=n.sent())?(Ls.push(e),Ps(t.db),[2]):[2]}}))}))}(e)},t}(Rs),js=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}return e.prototype.checkStart=function(e){return b(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=Zn.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype.realtimeReport=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d,g,p,f=this;return D(this,(function(_){switch(_.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||Cs,o=Math.max(i-5e3,r),s=this.logger.createTraceId(),this.logger.debug(ge.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:t}),s),[4,this.logDB.getLogs(r,o,t,!0)];case 1:return a=_.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(ge.L_REALTIME_LOG_R,"db error",s),[3,6]);case 2:return 0!==c.length?[3,3]:[3,6];case 3:return this.logger.info(ge.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressLogs(c)];case 4:return l=_.sent(),h=l.success,d=l.data,h||this.logger.warn(ge.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(ge.L_REALTIME_LOG_O,"compress done",s),g=ct(e)?e:"https://".concat(e),g+="?version=".concat("5.8.1","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:d,method:"POST"})];case 5:p=_.sent().status,this.logger.info(ge.L_REALTIME_LOG_R,JSON.stringify({status:p}),s),200===p&&this.logDB.setTimestamp4RealtimeLog(c[c.length-1].time+1),_.label=6;case 6:return this.started&&(this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){return f.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,o){return b(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.logger.createTraceId(),this.logger.info(ge.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:o}),s),[4,this.logDB.getLogs(e,t,ps.DEBUG,!1)]);case 1:return a=_.sent(),u=a.dbReady,c=a.logs,this.logger.info(ge.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),l=ct(i)?i:"https://".concat(i),l+="?version=".concat("5.8.1","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressLogs(c)]:[3,3]:[3,5];case 2:return d=_.sent(),g=d.success,p=d.data,h=g?p:"compress failed",[3,4];case 3:h="no data",_.label=4;case 4:return[3,6];case 5:h="no database",_.label=6;case 6:return this.logger.debug(ge.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:l,body:h,method:"POST"})];case 7:return f=_.sent().status,this.logger.info(ge.L_REPORT_FULL_LOG_R,JSON.stringify({status:f}),s),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Qs=48,Ws=64,Js=80,Xs=96,Zs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",zs=Zs.length,$s=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=ta(e.length),n=String.fromCharCode(Js|t.length);r.push(n+t)}else{var i=String.fromCharCode(Xs|e.length);r.push(i)}r.push(e)}},a=0;a<e.length;){var u=ea(t,e,a);if(u.length<2)o.push(e.charAt(a++));else if(u.length<4)o.push(e.substr(a,u.length)),a+=u.length;else{var c=ta(a-u.offset),l=ta(u.length);if(c.length+l.length>=u.length)o.push(e.substr(a,u.length)),a+=u.length;else{s();var h=String.fromCharCode(Ws|c.length<<2|l.length);r.push(h+c+l),a+=u.length}}}s();var d=ta(e.length),g=String.fromCharCode(Qs|d.length);return r.push(g+d),r.join("")},ea=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 u=r[s],c=n-u;if(!(c>238327)){var l=Math.min(o,c);if(l<=i.length)break;if(!(i.length>2&&t.charAt(u+i.length-1)!==t.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&t.charAt(u+d)===t.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=u)}}}return i},ta=function(e){var t=[],n=0;do{n=e%zs,t.push(Zs.charAt(n)),e=(e-n)/zs}while(e>0);return t.join("")},na=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"}},ia=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},ra=function(e){function t(t,n,i,r){var o=this,s=Nr(n),a=na(n),u="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=e.call(this,t,s,u,Hs(),i)||this).runtime=n,o.clientReportLevel=r,Ts(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return P(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return b(this,void 0,void 0,(function(){return D(this,(function(n){switch(n.label){case 0:return[4,Ys(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,{success:!0,data:$s(e.map(ia).join(""))}]}))}))},t.prototype.isReporter=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),b(void 0,void 0,void 0,(function(){var e,i,r;return D(this,(function(o){switch(o.label){case 0:return[4,ws("".concat(Ks,"_").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 b(this,void 0,void 0,(function(){return D(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 b(this,void 0,void 0,(function(){return D(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(js);!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(bs||(bs={})),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"}(Ds||(Ds={})),function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Vs||(Vs={})),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"}(Gs||(Gs={})),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"}(Bs||(Bs={}));var oa,sa=((ks={})[Bs.OTHER_DEVICE_LOGIN]=X.RC_DISCONN_KICK,ks[Bs.BLOCK]=X.RC_DISCONN_EXCEPTION,ks[Bs.BLOCK_NEW]=X.RC_DISCONN_EXCEPTION,ks[Bs.REDIRECT_NEW]=X.RC_CONN_REDIRECTED,ks[Bs.TOKEN_EXPIRED]=X.RC_CONN_TOKEN_EXPIRED,ks[Bs.ILLEGAL_PROTOCOL_VERSION]=X.RC_CONN_PROTO_VERSION_ERROR,ks[Bs.ACCOUNT_CANCELLATION]=X.RC_ACCOUNT_CANCELLATION,ks),aa=((xs={})[Gs.ACCEPTED]=X.SUCCESS,xs[Gs.UNACCEPTABLE_PROTOCOL_VERSION]=X.RC_CONN_PROTO_VERSION_ERROR,xs[Gs.IDENTIFIER_REJECTED]=X.RC_CONN_IDENTIFIER_REJECTED,xs[Gs.SERVER_UNAVAILABLE]=X.RC_CONN_SERVER_UNAVAILABLE,xs[Gs.TOKEN_INCORRECT]=X.RC_CONN_TOKEN_INCORRECT,xs[Gs.NOT_AUTHORIZED]=X.RC_CONN_NOT_AUTHRORIZED,xs[Gs.REDIRECT]=X.RC_CONN_REDIRECTED,xs[Gs.PACKAGE_ERROR]=X.RC_CONN_PACKAGE_NAME_INVALID,xs[Gs.APP_BLOCK_OR_DELETE]=X.RC_CONN_APP_BLOCKED_OR_DELETED,xs[Gs.BLOCK]=X.RC_CONN_USER_BLOCKED,xs[Gs.TOKEN_EXPIRE]=X.RC_CONN_TOKEN_EXPIRED,xs[Gs.DEVICE_ERROR]=X.RC_CONN_DEVICE_ERROR,xs[Gs.HOSTNAME_ERROR]=X.RC_CONN_HOSTNAME_ERROR,xs[Gs.HASOHTERSAMECLIENTONLINE]=X.RC_DISCONN_SAME_CLIENT_ON_LINE,xs[Gs.OUT_OF_LIMIT]=X.RC_LISCENSE_COUNT_OUT_OF_LIMIT,xs[Gs.IN_OTHER_CLUSTER]=X.RC_CONN_WRONG_CLUSTER,xs[Gs.APP_AUTH_NOT_PASS]=X.RC_APP_AUTH_NOT_PASS,xs[Gs.OTP_USED]=X.RC_OTP_USED,xs[Gs.PLATFORM_ERROR]=X.RC_PLATFORM_ERROR,xs[Gs.ACCOUNT_CANCELLATION]=X.RC_ACCOUNT_CANCELLATION,xs[Gs.LICENSE_EXPIRED]=X.RC_LICENSE_EXPIRED,xs),ua=function(e){return e===X.RC_CONN_REDIRECTED},ca=function(e){return Object.keys(sa).some((function(t){return sa[t]===e}))},la=function(e){return Object.keys(aa).some((function(t){return aa[t]===e}))};!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(oa||(oa={}));var ha,da=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:Ds.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=oa.DISCONNECTED,this._crtUserId="",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!==oa.CONNECTED&&e!==oa.CONNECTING){var n={bid:Qt(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.__statistics(pe.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case oa.CONNECTED:this.logger.info(ge.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case oa.CONNECTING:this.logger.warn(ge.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onConnecting();break;case oa.SUSPENDED:this.logger.warn(ge.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),ua(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(ge.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.__statistics(pe.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return this._crtConnectionStatus===oa.CONNECTED?[2,{code:X.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this.retryCount=0,this.uuid=Lt(),this.token=e,this.reconnectKick=t,this.setConnectionStatus(oa.CONNECTING),i={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:Ke.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(pe.IM_STATS_CS,JSON.stringify(i),n),[4,this.try2Connect(e,t,!1,n)]);case 1:return r=a.sent(),o=r.code,s=r.data,o!==X.SUCCESS?(this.setConnectionStatus(oa.DISCONNECTED,o),[2,{code:o}]):(this.setConnectionStatus(oa.CONNECTED),[2,{code:o,data:s}])}}))}))},e.prototype.try2Connect=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s;return D(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 b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.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=d.sent(),s=o.code,a=o.data,s!==X.SUCCESS?[2,{code:s}]:1===(u=a).type?[2,{code:X.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(ge.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),i),[4,this.connectWithToken(e.replace(/@.+$/,"@"),u,t,i)]);case 2:return c=d.sent(),l=c.code,h=c.data,ua(l)?(this.logger.warn(ge.L_CONNECT_R,"redirect code: ".concat(l),i),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,i)]):[X.RC_TCP_RESET,X.RC_CONN_ACK_TIMEOUT,X.RC_TCP_DISCONNECTED_NO_RMTP].includes(l)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(ge.L_CONNECT_R,"cmp ack timeout, code: ".concat(l),i),this.setConnectionStatus(oa.SUSPENDED,l),this.setConnectionStatus(oa.CONNECTING),[2,this.createConnectionTask(e,t,!1,i)]):l!==X.SUCCESS?(this.logger.warn(ge.L_CONNECT_R,"code: ".concat(l),i),[2,{code:l}]):(this.logger.info(ge.L_CONNECT_R,"userId: ".concat(h),i),this._connectDurSwitch=!0,this._crtUserId=h,[2,{code:l,data:h}])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case X.TIMEOUT:return void(this.reason=Ke.TIMEOUT);case X.RC_CONN_REDIRECTED:return void(this.reason=Ke.REDIRECTED);default:this.reason=Ke.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r=this;return D(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(ge.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),i=function(){return b(r,void 0,void 0,(function(){var r,o;return D(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==oa.SUSPENDED?[2]:(this.setConnectionStatus(oa.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.__statistics(pe.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===X.SUCCESS?(this.setConnectionStatus(oa.CONNECTED),[2]):[X.SERVER_UNAVAILABLE,X.TIMEOUT,X.RC_SOCKET_DISCONNECTED,X.RC_SOCKET_NOT_CREATED,X.RC_CONN_ACK_TIMEOUT,X.RC_TCP_RESET,X.RC_NAVI_REQ_FAILED,X.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==oa.CONNECTING||(this.setConnectionStatus(oa.SUSPENDED,o),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus(oa.DISCONNECTED,o),[2])}}))}))},i(),[2]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return ua(e)?(this.setConnectionStatus(oa.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===X.RC_UDP_DISCONNECTED?(this.setConnectionStatus(oa.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(oa.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(oa.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return b(this,void 0,void 0,(function(){var e,t,n=this;return D(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==oa.CONNECTED?(this._failedCount=0,this.logger.debug(ge.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(ge.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=i.sent())===X.SUCCESS?(this.logger.info(ge.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==oa.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(ge.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(ge.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(oa.SUSPENDED,X.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,X.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return b(this,void 0,void 0,(function(){return D(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(oa.DISCONNECTED,2),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)return V([],this.cmpWeightCache,!0);var n=e.server,i=e.backupServer,r=e.serverAddr,o=e.protocol,s=e.openTLS;if(r)return this.cmpWeightCache=V([],r,!0),V([],r,!0);var a=[],u=[];return n&&u.push(n),null==i||i.split(",").forEach((function(e){u.indexOf(e)<0&&u.push(e)})),u.forEach((function(e,i){var r;r=t?1===s?bn.TLS:bn.RMTP:"http"===o?bn.WS:bn.WSS,a.push({addr:e,protocol:r,weight:n.length-i,race:!1})})),this.cmpWeightCache=a,V([],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===bn.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}(),ga=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=wn(fs);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=nt(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var i,r=this,o=e,s=((i={})[kr]=r._formatSyncMessages,i[Br]=r._formatReceivedMessage,i[Vr]=r._formatSentMessage,i[jr]=r._formatHistoryMessages,i[Wr]=r._formatConversationList,i[so]=r._formatChatRoomInfos,i[To]=r._formatChatRoomKVList,i[Oo]=r._formatUserSetting,i[Ao]=r._formatConversationStatus,i[Fo]=r._formatGrpReadReceiptQryResp,i[mo]=r._formatSetUserSettingOutput,i[No]=r._formatUserSettingNotification,i[es]=r._formatUltraMsgChangeList,i[os]=r._formatUltraOperateStatusNotifyList,i[is]=r._formatUltraMsgList,i[Go]=r._formatUltraGroupUnreadMentionedList,i[ro]=r._formatChrmKVVersion,i[gs]=r._formatCallKVInfo,i[hs]=r._fromatCallInfoDownStream,i)[t];try{o=e.length>0&&r._codec[t].decode(e),ot(o)&&(o=function(e){for(var t in e)ot(e[t])&&(e[t]=kt(e[t]));return e}(o)),st(s)&&(o=s.call(this,o,n))}catch(e){this.logger.error(ge.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=nt(n)?new Uint8Array(n):n;return Ui.readUTF(r.subarray(t,i))}catch(e){this.logger.error(ge.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(ge.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(at(o)||null===o)&&(e.finished=!0),e.syncTime=kt(r),e.list=Jt(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 Wt(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=Kt(t,i.pushConfigs,i.pushId)),w(w({},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){if(!e)return e;var i=this,r=t||{},o=r.currentUserId,s=r.connectedTime,a=e.content,u=e.fromUserId,c=e.type,l=e.groupId,h=e.status,d=e.dataTime,g=e.extraContent,p=e.configFlag,f=e.extStatus,_=e.clientUniqueId,E=e.busChannel,T=e.msgId,I=e.classname,C=e.direction||j.RECEIVE,v=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)}}(h),R=v.isPersited,y=v.isCounted,m=v.isMentioned,S=v.disableNotification,O=v.receivedStatus,N=v.canIncludeExpansion,M=!!(2&(f||0)),A=!!(4&(f||0)),L=!!(8&(f||0))?Pe.PRIVATE:Pe.PUBLIC,U=[z.GROUP,z.CHATROOM,z.RTC_ROOM,z.ULTRA_GROUP].indexOf(c)>-1?l:u,P=u,w=j.RECEIVE;C===j.SEND&&(P=o,w=j.SEND);var b=kt(d),D=b<s,V=c===z.CHATROOM,G=i._setExpansion(g),B=i._formatBytes(a);B=i._getUtfContent(B);var k=i._setPushConfig(e,this.logger);V&&u===o&&(w=j.SEND);var x={conversationType:c,targetId:U,senderUserId:P,messageType:I,messageUId:T,isPersited:R,isCounted:y,isMentioned:m,sentTime:b,messageDirection:w,receivedTime:on.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:N,content:B,expansion:G,configFlag:p,pushConfig:k,channelId:E||"",isInterrupt:M,isModifyMessage:A,messageId:kt(_)||0,sentStatus:Re.SENT};return c!==z.ULTRA_GROUP?(x.isOffLineMessage=D,x):(x.channelType=L,x)},e.prototype._formatSentMessage=function(e,t){var n=this,i=e.content,r=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=e.extStatus,d=e.clientUniqueId,g=t.signal,p=t.currentUserId,f=g.date,_=g.topic,E=g.targetId,T=!!(2&(h||0)),I=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),C=I.isPersited,v=I.isCounted,R=I.disableNotification,y=I.canIncludeExpansion,m=vi[_]||z.PRIVATE,S=zt(ni,_),O=n._formatBytes(i),N=E;r===ne.RECALL&&(m=O.conversationType||m,N=O.targetId||E);var M=n._setExpansion(a),A=n._setPushConfig(e,this.logger),L=w(w({},A),{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==u?void 0:u.templateId});return{conversationType:m,targetId:N,messageType:r,messageUId:s,isPersited:C,isCounted:v,isStatusMessage:S,senderUserId:p,content:n._formatBytes(i),sentTime:1e3*f,receivedTime:on.getTime(),messageDirection:j.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:y,expansion:M,pushConfig:L,channelId:e.busChannel||"",isInterrupt:T,messageId:kt(d)||0}},e.prototype._formatHistoryMessages=function(e,t){var n=this,i=t.conversation||{},r=e.list,o=e.hasMsg,s=i.targetId,a=kt(e.syncTime),u=[];return Wt(r,(function(e){var r=n._formatReceivedMessage(e,t);i.conversationType===z.ULTRA_GROUP?r.targetId=e.groupId||i.targetId:r.targetId=s,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,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,u=e.isAdmin,c=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,g=e.busChannelType,p=e.remindType;return{targetId:t,conversationType:n,changeType:r,messageUId:o,changeTime:kt(i),sendTime:kt(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:g,mentionedType:p}})),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),u=1==(1&n);return u&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.userId,r=e.opType,s=e.optime,a=kt(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:u,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:kt(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=kt(n)||0,e.unreadMessageCount=this._getUnreadCount(kt(i)||0),e.unreadMentionedCount=this._getUnreadCount(kt(r)||0),e.unreadMentionedMeCount=this._getUnreadCount(kt(a)||0),e.channelType=o||Pe.PUBLIC,e.lastReadTime=0,s&&(e.firstUnreadMessage={sentTime:kt(s.msgTime)},e.lastReadTime=kt(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=Jt(r,(function(e){var r=e.msg,s=e.userId,a=e.type,u=e.unreadCount,c=e.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,t)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:kt(u)||0,latestMessage:l||{},channelId:c||""};return a===z.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==o?void 0:o(h))||h})))||[]};return((null==t?void 0:t.conversationType)||z.NONE)===z.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:Jt(n,(function(e){var t=e.id,n=e.time;return{id:t,time:kt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return t=Jt(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?_e.DELETE:_e.UPDATE}}(i);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:kt(r),version:kt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:i}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,i=e.version,r={};return Wt(n||[],(function(e){var n=e.key,i=e.version,o=e.value;e.version=kt(i),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=kt(e.createdTime),e.tagName=e.name})),r[n]=e})),{settings:r,version:i}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return Wt(t,(function(e){var t=e.type,i=e.channelId,r=e.time,o=e.stateItem,s=e.busChannel,a=re.CLOSE,u=se.NOT_SET,c=!1,l=[];Wt(o,(function(e){var t=e.sessionStateType,n=e.value,i=e.tags;switch(t){case Oi:a=n===mi?re.OPEN:re.CLOSE,u=Number(n)||se.NOT_SET;break;case Ni:c=n===mi;break;case Mi:l=i}})),n.push({conversationType:t,type:t,targetId:i,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:kt(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=kt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:kt(e.joinTime)}}))},e.prototype._formatCallKVInfo=function(e){return e},e.prototype._fromatCallInfoDownStream=function(e){return e},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(xr);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||ue.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(Gr);if(t&&s.setTitle(t),n||i){var a=Ht(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,u=t.expansion,c=t.pushConfig,l=t.channelId,h=t.pushData,d=void 0===h?"":h,g=t.mentionedUserIdList,p=void 0===g?[]:g,f=t.pushContent,_=void 0===f?"":f,E=t.messageId,T=void 0===E?0:E,I=this._codec.getModule(Vr),C=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),v=c||{},R=v.pushContent,y=void 0===R?_:R,m=v.pushData,S=void 0===m?d:m;I.setSessionId(C),i&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,p,r)),y&&I.setPushText(y),S&&I.setAppData(S),s&&I.setUserId(s);var O=this._calculateFlag(t);if(I.setConfigFlag(O),I.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),I.setContent(JSON.stringify(o)),a&&u){var N={};Wt(u,(function(e,t){N[t]={v:e}})),I.setExtraContent(JSON.stringify(N))}if(c){var M=this._getPushExtraModule(c);I.setPushExt(M)}return I.setClientUniqueId(T),at(l)||I.setBusChannel(l),I},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(Hr);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(Kr);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(qr);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(Xo);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,i=this._codec.getModule(Qr);return i.setType(1),i.setCount(t),i.setStartTime(n),i.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,i=e.startTime,r=e.order;t=t||0,i=i||0,r=r||0;var o=this._codec.getModule(Qr);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($r);return i.setType(t),n&&i.setBusChannel([n]),i.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(Xr),i=[];return Wt(e,(function(e){var n=e.conversationType,r=e.targetId,o=t._codec.getModule(Zr);o.setType(n),o.setChannelId(r),i.push(o)})),n.setSessions(i),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,i){var r=this._codec.getModule(eo),o=[];return Wt(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(to);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,i=e.targetId,r=e.channelId,o=t.timestamp,s=this._codec.getModule(no);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,u={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},c=this._codec.getModule(Zo);return c.setFromUserId(t),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.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,u=this._codec.getModule(Zo);return u.setFromUserId(t),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(zo);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(ts),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(Vo);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(rs);return r.setTargetId(e),r.setType(t),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(io);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(oo);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(Do);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(bo);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,i){var r=this._codec.getModule(ao);return r.setType(e),r.setKey(t),r.setHttpMethod(n),r.setQueryString(i),r.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,i){var r=this._codec.getModule(e);return r.setType(t),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var i=this._codec.getModule(fo),r=t.key,o=t.value,s=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||_e.UPDATE,h=sn(t,l),d={key:r,value:o||"",uid:n,version:c};if(at(h)||(d.status=h),i.setEntry(d),a){var g={conversationType:z.CHATROOM,targetId:e},p={key:r,value:o,extra:s,type:l},f=this._getUpMsgModule(g,{messageType:ne.CHRM_KV_NOTIFY,content:p,isPersited:!1,isCounted:!1});i.setNotification(f),i.setBNotify(!0),i.setType(z.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var i=this._codec.getModule(_o),r=t.entries,o=t.type||_e.UPDATE,s=sn(t,o),a=[];return r.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};at(s)||(t.status=s),a.push(t)})),i.setEntry(a),i.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Ro);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(So);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Mo);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,i=this._codec.getModule(Po),r=on.getTime(),o=[];return Wt(e,(function(e){var t=n._codec.getModule(Lo),i=e.conversationType,s=e.targetId,a=e.notificationStatus,u=e.isTop,c=e.channelId,l=e.notificationLevel,h=[];t.setType(i),t.setChannelId(s),t.setTime(r),t.setBusChannel(c);var d=a===re.OPEN,g={};at(a)||(g[Oi]=d),at(l)||(g[Oi]=l),at(u)||(g[Ni]=u),Wt(g,(function(e,t){if(!at(e)){var i=n._codec.getModule(Uo);e=e?mi:Si,at(l)||Number(t)!==Oi||(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(ko);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,i=this._codec.getModule(Ko),r=[];return e.forEach((function(e){var t=n._codec.getModule(Yo);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(ko);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,i=this._codec.getModule(qo),r=[];return e.forEach((function(e){var t=n._codec.getModule(Yo);t.setTagId(e),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(jo);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,i=this._codec.getModule(Po),r=[];return t.forEach((function(t){var i=n._codec.getModule(Lo),o=n._codec.getModule(Uo),s=[];e.forEach((function(e){var t=n._codec.getModule(Yo);t.setTagId(e.tagId),at(e.isTop)||t.setIsTop(e.isTop),s.push(t)})),o.setSessionStateType(Mi),o.setValue(JSON.stringify(s)),o.setTags(s),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([o]),r.push(i)})),i.setState(r),i.setVersion(on.getTime()),i.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Qo);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(Jo);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(us);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e.prototype.encodeSetCallInfo=function(e,t){var n=this._codec.getModule(ls);return n.setKey(e),n.setDataContent(t),n.getArrayData()},e.prototype.encodePullKVMsg=function(e){var t=this._codec.getModule(ds);return t.setSyncTime(e),t.getArrayData()},e}(),pa=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 ga(a.logger),a}return P(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.connectWithToken=function(e,t,n,i){return b(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.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(ge.L_NAVI_CONF_E,"no service available",i),[2,{code:X.SERVER_UNAVAILABLE}];a=1===n?Jn.V4:Jn.V3,u=function(t){var n,o,u,l,h,d,g,p,f,_,E;return D(this,(function(T){switch(T.label){case 0:return n=s[t],o=n.protocol,u=n.addr,l=n.weight,h=function(e,t,n,i,r,o,s){var a=na(r),u=a.type,c=a.version,l="browser"===r.tag?"|".concat(u,"|").concat(c):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(S,"&pid=").concat(o,"&apiVer=").concat(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l)).concat(r.connectPlatform?"&platform=".concat(r.connectPlatform):"").concat(h)}(o===bn.WS?"ws":"wss",u,c.appkey,e,c.runtime,"",a),d=Date.now(),[4,c.connectWebSocket(h,a,i)];case 1:return g=T.sent(),p=g.code,f=g.data,_=c.cmpWeightCache.findIndex((function(e){return e.addr===u})),E={bid:Qt(),ptc:ke.WS,cod:p,net:c.getNetwork().type,dur:Date.now()-d,spr:0,pr:r||0,hos:u,idx:_,rct:c.retryCount?He.RECONNECT:He.CONNECT,cid:"".concat(c.uuid,"_").concat(c.retryCount),v:Fe.CURRENT,rsn:c.reason,count:c.retryCount,weight:l},c.statisticLog.__statistics(pe.IM_WEBSOCKET,JSON.stringify(E),i),p===X.RC_SOCKET_DISCONNECTED||p===X.TIMEOUT?[2,"continue"]:p!==X.SUCCESS?[2,{value:{code:p}}]:(c._localConnectedTime=Math.floor((Date.now()+d)/2),c._socket=f.socket,c.updateCmpWeight(s[t].addr,!0),c.curCmpUrl=s[t].addr,[2,{value:{code:p,data:f.userId}}])}}))},c=this,l=0,d.label=1;case 1:return l<s.length?[5,u(l)]:[3,4];case 2:if("object"==typeof(h=d.sent()))return[2,h.value];d.label=3;case 3:return l+=1,[3,1];case 4:return[2,{code:X.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return b(this,void 0,void 0,(function(){var i=this;return D(this,(function(r){return this.logger.info(ge.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(ge.T,"connect timeout: ".concat(e),n),r({code:X.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),i.logger.info(ge.T,"socket open",n)})),o.onMessage((function(e){if(i._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var s,a=Xi(i.logger,e,t);if(a instanceof Gi){var u=a.status;if(u!==Gs.ACCEPTED)return i.logger.info(ge.T,"connect failed: ".concat(u),n),void r({code:(s=u,aa[s])});i.logger.info(ge.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=c,i._idCount=h,void r({code:X.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof Bi){var d=a.status;return i.logger.info(ge.T,"recv disconnect signal -> status: ".concat(d)),void i.onRecvDisconnect(d,o)}if(a instanceof xi&&i._pingResolve)return i._pingResolve(X.SUCCESS),void(i._pingResolve=void 0);i._onReceiveSignal(a)}}else i.logger.warn(ge.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:o.id}))})),o.onClose((function(){i.logger.info(ge.T,"socket close",n);var e=X.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(o,e)})),o.onError((function(e){i.logger.info(ge.T,"socket error",n);var t=X.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(o,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==jn.AT_MOST_ONCE&&(e instanceof Ki&&!e.syncMsg&&(this.logger.debug(ge.O,"send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new ji(t))),e instanceof Ji&&(this.logger.debug(ge.O,"send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Wi(t))))},t.prototype._publishReader=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o=this;return D(this,(function(s){switch(s.label){case 0:return n=e.syncMsg,i=e.topic,this.logger.debug(ge.O,"recv PublishReader -> messageId: ".concat(t," ").concat(i)),i===fn?[2]:!n||function(e){return[Zi.ppMsgS,Zi.pgMsgS,Zi.chatMsgS].map((function(e){return Zi[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 b(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){switch(r.label){case 0:return t=e.messageId,this._qosNeedAck(e,t),t>0&&(e instanceof qi||e instanceof Ji)&&(this.logger.debug(ge.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 Ki?[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 sa[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(X.RC_SOCKET_DISCONNECTED)}},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n(X.TIMEOUT)}),e),t.sendOnly(new ki)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof Yi||e instanceof Qi)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),b(this,void 0,void 0,(function(){var r,o,s,a,u=this;return D(this,(function(c){switch(c.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){u._messageIds[r]=e,setTimeout((function(){u._messageIds[r]&&delete u._messageIds[r],e()}),i)}))]):[2,{code:X.RC_NET_CHANNEL_INVALID}];case 1:return(o=c.sent())?o instanceof Ji||o instanceof qi?(s=t&&o.data&&[X.SUCCESS,X.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(ge.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:X.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(ge.O,"send timeout -> message: ".concat(r,", respPBName: ").concat(t,", timeout: ").concat(i)),[2,{code:X.TIMEOUT}])}}))}))},t.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},t}(da);!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD"}(ha||(ha={}));var fa=null,_a="RC_CONF",Ea="RC_STATISTICS",Ta=null,Ia=function(e){return b(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,fa];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(Ea,"readwrite").objectStore(Ea),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(),Ta=setTimeout((function(){return Ia(e)}),6e5),[2]}}))}))},Ca=function(e,t,n){void 0===n&&(n=168),fa||("undefined"!=typeof window&&window&&window.indexedDB?fa=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(ge.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(ge.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(ge.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(ge.L_LOGDB_ABORT_S,e.target.error)},Ia(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(Ea)&&t.deleteObjectStore(Ea);var n=t.createObjectStore(Ea,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(_a,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(ge.L_UNSUPPORT_INDEXDB_O))},va=function(){return b(void 0,void 0,void 0,(function(){var e,t;return D(this,(function(n){switch(n.label){case 0:return fa?(Ta&&(clearTimeout(Ta),Ta=null),[4,fa]):[2];case 1:return(e=n.sent())&&(t=e.db,e.appkey,t.close()),fa=null,[2]}}))}))};function Ra(e){return b(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,fa];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(_a,"readonly").objectStore(_a).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 ya="REPORT_SESSION",ma=function(e,t){return b(void 0,void 0,void 0,(function(){var n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return n="".concat(ya,"_").concat(e),[4,Ra("".concat(ya,"_").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){b(this,void 0,void 0,(function(){var n,i;return D(this,(function(r){switch(r.label){case 0:return[4,fa];case 1:return(n=r.sent())?(i=n.db,i.transaction(_a,"readwrite").objectStore(_a).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},Sa=function(){return fa},Oa=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Na=Ut(),Ma=Date.now(),Aa=0,La=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.__statistics=this._writer.bind(this,ha.STATISTICS)}return e.prototype._writer=function(e,t,n,i){var r=new Date;/^[\w-_]+$/.test(t)&&this.flush({time:+r,sessionId:Na,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})},e.prototype.createTraceId=function(){return"".concat(Na,"-").concat(++Aa)},e.prototype.getSessionId=function(){return Na},e}(),Ua=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}return e.prototype.checkStart=function(e){return b(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=Zn.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype.realtimeReport=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d,g,p,f=this;return D(this,(function(_){switch(_.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||Ma,o=Math.max(i-5e3,r),s=this.reportClass.createTraceId(),this.logger.debug(ge.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=_.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(ge.L_REALTIME_LOG_R,"db error",s),[3,6]);case 2:return 0!==c.length?[3,3]:[3,6];case 3:return this.logger.info(ge.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressStatistics(c)];case 4:return l=_.sent(),h=l.success,d=l.data,h||this.logger.warn(ge.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(ge.L_REALTIME_LOG_O,"compress done",s),g=ct(e)?e:"https://".concat(e),g+="?version=".concat("5.8.1","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:d,method:"POST"})];case 5:p=_.sent().status,this.logger.info(ge.L_REALTIME_LOG_R,JSON.stringify({status:p}),s),200===p&&this.statisticDB.setTimestamp4RealtimeLog(c[c.length-1].time+1),_.label=6;case 6:return this.started&&(this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){return f.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,o){return b(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(ge.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:o}),s),[4,this.statisticDB.getStatistics(e,t,ha.STATISTICS,!1)]);case 1:return a=_.sent(),u=a.dbReady,c=a.logs,this.logger.info(ge.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),l=ct(i)?i:"https://".concat(i),l+="?version=".concat("5.8.1","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressStatistics(c)]:[3,3]:[3,5];case 2:return d=_.sent(),g=d.success,p=d.data,h=g?p:"compress failed",[3,4];case 3:h="no data",_.label=4;case 4:return[3,6];case 5:h="no database",_.label=6;case 6:return this.logger.debug(ge.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:l,body:h,method:"POST"})];case 7:return f=_.sent().status,this.logger.info(ge.L_REPORT_FULL_LOG_R,JSON.stringify({status:f}),s),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Pa="RC_STATISTICS",wa=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return P(t,e),t.prototype.flush=function(e){Ga(e)},t}(La),ba=!1,Da=[],Va=function(e){return b(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return ba||0===Da.length?[2]:(ba=!0,t=Da.splice(0),[4,new Promise((function(n){var i=e.transaction(Pa,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(Pa);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(),ba=!1,setTimeout((function(){return Va(e)})),[2]}}))}))},Ga=function(e){return b(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,Sa()];case 1:return(t=n.sent())?(Da.push(e),Va(t.db),[2]):[2]}}))}))},Ba=0,ka=function(){return{setTimestamp4RealtimeLog:function(e){Ba=e},getTimestamp4RealtimeLog:function(){return Ba},getStatistics:function(e,t){return b(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:return[4,Sa()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(Pa,"readonly").objectStore(Pa),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:[]}]}}))}))}}},xa=function(e){function t(t,n,i,r){var o=this,s=Nr(n),a=na(n),u="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=e.call(this,t,s,u,ka(),i,r)||this).runtime=n,o}return P(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return b(this,void 0,void 0,(function(){return D(this,(function(n){switch(n.label){case 0:return[4,ma(t.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressStatistics=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,{success:!0,data:$s(e.map(Oa).join(""))}]}))}))},t.prototype.isReporter=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.reportClass.getSessionId(),b(void 0,void 0,void 0,(function(){var e,i,r;return D(this,(function(o){switch(o.label){case 0:return[4,Ra("".concat(ya,"_").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 b(this,void 0,void 0,(function(){return D(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 b(this,void 0,void 0,(function(){return D(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(Ua),Fa=function(e,t,i,r,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:j.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:Re.SENT}},Ha=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},Ka=function(e){function t(t,n,i,r){var o=e.call(this,t,n,i,r,new qs(r.appkey,"RC-E","IM"),new wa(r.appkey,"RC-E","IM"))||this;o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o.currentUserId="",o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,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,u=r.logExpireTime,c=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy;return o.logger.setOutputLevel(a),Ms(s,o.logger,t,u),o.reporter=new ra(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new mr(s,o.logger,o.statisticLog,t),Ca(s,o.logger,u),o.reporterStatistic=new xa(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new nr(t,s),o._sendMessageStore=new Or(t,s),o._chrmEntryHandler=new or(o),o._connMgr=new pa(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._watcher.onSuspend}),Zn.init({areaCode:l,navigators:c,logServerUrl:h,miniCMPProxy:d}),o}return P(t,e),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 sr(this.runtime,this._appkey,this.currentUserId,e.joinMChrm,this.logger)),this._conversationManager||(this._conversationManager=new Tr(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new Dr(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new Ir(this,this._appkey,this.currentUserId,this._watcher.tag)),this._watcher.onConnected(),this._conversationManager.startPullConversationStatus(0),this._conversationManager.adaptOldStore(),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._rejoinChrm(),this._startSyncInterval(),1===e.ugMsg&&this._notificationOnline(),this.reporter.checkStart(e),this.reporterStatistic.checkStart(e)},t.prototype.onDisconnected=function(e){this._resetMemoryState(),this._watcher.onDisconnected(e)},t.prototype.createLogger=function(e,t){return new qs(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){return b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._connMgr.connect(e,t,n)]}))}))},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(ge.L_RECV_RMTP_O,i,r);var o=Zi[i];if(o)switch(o){case Zi.s_ntf:this._pullMsg(e);break;case Zi.s_msg:this._receiveMsg(e);break;case Zi.s_cmd:this._receiveStateNotify(e);break;case Zi.s_us:this._receiveSettingNotify(e);break;case Zi.rtc_ntf:this._receiveRtcKv(e.data);break;case Zi.s_opNtf:this._pullOperateStatusNotify(e)}else this.logger.error(ge.L_RECV_RMTP_E,i,r)}},t.prototype._receiveStateNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Yr),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,No).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,i=t.del,r=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:r,expansion:n}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:r,deletedKeys:i}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,no),i=n.channelId,r=n.busChannel,o=n.msgTime,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(Mr.includes(e.topic))if(e.topic!==Zi[Zi.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(e.data,Vr,{currentUserId:this.currentUserId,signal:e});((n=this._handleMsgProperties(n)).conversationType!==z.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(ge.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==ne.EXPANSION_NOTIFY?((n.messageType===ne.SYNC_READ_STATUS||n.messageType===ne.READ_RECEIPT&&n.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(n.conversationType,n.targetId,n.channelId),this._conversationManager.setConversationCacheByMessage(n,!0),this._batchMessage([n])):this._receiveMessageExpansion(n)))}else this._clearUltraGroupUnreadCount(e,t)},t.prototype._batchMessage=function(e){for(var t=this,n=[],i=[],r=e.length-1;r>=0;r-=1){var o=e[r];o.messageType!==ne.LOG_COMMAND||"rongcloudsystem"!==o.senderUserId?n.unshift(o):i.unshift(o)}this._watcher.batchMessage(n),0!==i.length&&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)}))},t.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Yr),n=t.type,i=t.chrmId,r=t.time;if(this.logger.info(ge.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._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)},Object.defineProperty(t.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===oa.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._messageProcessor=function(e){var t=this,n=0,i=[],r=[];return e.forEach((function(e){if((i.push(e.messageUId),e.messageDirection===j.SEND)&&(n=Math.max(e.sentTime,n),t._sendMessageStore.getSendMessageMap()[e.messageUId]))return void t._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==ne.DELIVERED&&e.messageType!==ne.DELIVERED_MSG)if(e.messageType!==ne.EXPANSION_NOTIFY){if(e.messageType===ne.SYNC_READ_STATUS){if(e.senderUserId!==t.currentUserId)return;t._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var o=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(o,!0),r.push(o)}else t._receiveMessageExpansion(e)})),{newOutboxTime:n,messageUIds:i,messages:r}},t.prototype._syncMsg=function(){return b(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,u,c,l,h,d,g,p,f,_,E,T,I;return D(this,(function(C){switch(C.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),i=this._connMgr.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),r=new Qi(Zi[Zi.pullMsg],i,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(ge.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o),[4,this._connMgr.send(r,kr,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=C.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),a!==X.SUCCESS||!u||at(u.finished)||at(u.list)||at(u.syncTime)?(this.logger.warn(ge.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(c=u.list,l=u.finished,h=u.syncTime,d=u.broadcastSyncTime,g=void 0===d?1:d,this.logger.info(ge.L_PULL_MSG_R,JSON.stringify({syncTime:h,finished:l,messages:c.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),o),p=this._messageProcessor(c),f=p.newOutboxTime,_=p.messageUIds,E=p.messages,this._batchMessage(E),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._letterbox.setBroadcastSyncTime(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,T=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(I=this._pullQueue).push.apply(I,T),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(ge.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:_.join(","),timestamp:this._latestSyncTimestamp,hasmore:!l,tmpPullQueue:T}),o),l?(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,Br,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});if(t=this._handleMsgProperties(t),this.logger.info(ge.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),t.messageType!==ne.DELIVERED&&t.messageType!==ne.DELIVERED_MSG){if(t.conversationType!==z.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}t.senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(t.messageUId,t.sentTime),t.isStatusMessage||t.senderUserId===this.currentUserId||this._letterbox.setInboxTime(t.sentTime,this.currentUserId),t.messageType!==ne.EXPANSION_NOTIFY?t.messageType===ne.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t])):this._receiveMessageExpansion(t)}}},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,c=i in E,l=i in this._customMessageType;if(n=c?w(w({},E[i]),{isStatusMessage:I.includes(i)}):l?this._customMessageType[i]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(e,n),t&&!at(r)&&(e.isStatusMessage=r),!t){var h=e.content.user;if(h){var d=h.portrait,g=h.portraitUri,p=d||g;p&&(h.portrait=h.portraitUri=p)}}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 u;return void 0===o&&(o=""),b(this,void 0,void 0,(function(){var s,c,l,h,d,g,p,f,_,E;return D(this,(function(T){switch(T.label){case 0:return c=(s=this).currentUserId,l=s._connMgr,h=Ri[e]||_i,d=1===i&&0===n,l?(g=l.codec.encodeGetHistoryMsg(t,{timestamp:n,count:d?2:i,order:r,channelId:o}),this.logger.info(ge.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:o,timestamp:n,count:i,order:r}),a),[4,l.send(new Qi(h,g,c),jr,{currentUserId:c,connectedTime:l.getConnectedTime(),conversation:{targetId:t}})]):[3,2];case 1:return p=T.sent(),(f=p.code)===X.SUCCESS&&g?(_=p.data,_=this._fixDownstreamData(d,_,r),E=[],null===(u=_.list)||void 0===u||u.forEach((function(e){e&&E.push(e.messageUId)})),this.logger.info(ge.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:E.join(",")}),a),[2,{code:f,data:{list:_.list,hasMore:_.hasMore}}]):(this.logger.warn(ge.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:""}),a),[2,{code:f}]);case 2:return[2,{code:X.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=this.logger.createTraceId(),o=JSON.stringify(e),this.logger.debug(ge.L_VER_REPORT_T,o,r),s=i.codec.encodeReportSDKInfo(o),a=new Qi(Zi[Zi.reportsdk],s,n),[4,i.send(a)]):[2];case 1:return(u=c.sent().code)!==X.SUCCESS&&this.logger.warn(ge.L_VER_REPORT_R,u,r),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(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),u=new Qi(ii,a,o),[4,s.send(u)]):[2,X.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),[2,c.code]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeClearMessages(t,n,i,e),u=yi[e],c=new Qi(u,a,o),[4,s.send(c)]):[2,X.RC_NET_UNAVAILABLE];case 1:return l=h.sent(),[2,l.code]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d=this;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,t=t||z.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),u=new Qi(hi,a,o),[4,s.send(u,Wr,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=d._conversationManager.get(t,n,i);return Object.assign(e,r),e}})]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return c=g.sent(),l=c.code,h=c.data,l!==X.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==h?void 0:h.list}]}}))}))},t.prototype.removeConversation=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s;return D(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 Qi(di,r,t),[4,i.send(o)]):[2,X.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},t.prototype.getConversation=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return e!==z.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:X.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:X.CONVER_GET_ERROR}];case 2:if(o=c.sent(),s=o.code,a=o.data,s!==X.SUCCESS)return[2,{code:X.CONVER_GET_ERROR}];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||re.CLOSE,notificationLevel:r.notificationLevel||se.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:X.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:X.SUCCESS,data:i})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var i=0;if(e.includes(z.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:X.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:X.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return e===z.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:X.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(X.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(X.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve(X.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:X.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(X.SUCCESS)},t.prototype.pullConversationStatus=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l=this;return D(this,(function(h){switch(h.label){case 0:return this._isConnected?(n=(t=this)._connMgr,i=t.currentUserId,r=n.codec.encodeGetConversationStatus(e),o=new Qi(Zi[Zi.pullSeAtts],r,i),[4,n.send(o,Ao)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return s=h.sent(),a=s.code,u=s.data,this.logger.info(ge.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:i})),a!==X.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.updatedTime;n&&l._conversationManager.setConversationUpdatedTime(n),t===z.ULTRA_GROUP?l._setUltraConversationStatus(e):c.push(e)})),[2,{code:a,data:c}])}}))}))},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 b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h,d,g=this;return D(this,(function(p){switch(p.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=this._conversationManager.getConversationUpdatedTime(),o=i.codec.encodeSetConversationStatus(e,r),s=new Qi(gi,o,n),[4,i.send(s,wo)]):[2,X.RC_NET_UNAVAILABLE];case 1:return a=p.sent(),u=a.code,c=a.data,u!==X.SUCCESS?[2,u]:(l=c,this._conversationManager.setConversationUpdatedTime(l.version),h=[],e.forEach((function(e){if(e.conversationType!==z.ULTRA_GROUP)g._conversationManager.addStatus(w(w({},e),{updatedTime:l.version}),!0);else{var t=g._setUltraConversationStatus(e);t&&h.push(t)}})),h.length>0&&(d=rn(h),d=Ha(d),this._watcher.conversation(d)),[2,u])}}))}))},t.prototype._joinChrm=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeJoinOrQuitChatRoom(),a=new Qi(s=n?oi:ri,o,e),this.logger.info(ge.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:s}),i),[4,r.send(a,ro)]):[2,X.RC_NET_UNAVAILABLE];case 1:return u=g.sent(),c=u.code,l=u.data,h=c===X.SUCCESS?"info":"warn",this.logger[h](ge.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),i),c===X.SUCCESS&&(d=l.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,d),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull()),[2,c]}}))}))},t.prototype._rejoinChrm=function(){return b(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,u.label=1;case 1:return i<t.length?(r=t[i],this.logger.info(ge.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:e[r]||10,topic:oi})),o=this.logger.createTraceId(),[4,this._joinChrm(r,e[r]||10,!0,o)]):[3,4];case 2:if(s=u.sent(),a=s===X.SUCCESS?"info":"warn",this.logger[a](ge.L_REJOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),o),s===X.SUCCESS)return this._watcher.chatroom({rejoinedRoom:{chatroomId:r,count:e[r]}}),[2];s===X.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(r),delete this._chrmsQueue[r]),this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:s}}),u.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),b(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.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 Qi(Zi[Zi.chrmPull],s,e),this.logger.info(ge.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,timestamp:o})),[4,this._connMgr.send(a,kr,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return u=_.sent(),c=u.code,l=u.data,i.pulling=!1,c===X.SUCCESS&&l?(h=l.list,d=l.syncTime,g=l.finished,i.timestamp=n?Math.max(d,n):d,i.queue=i.queue.filter((function(e){return e>d})),p=[],f=[],h.forEach((function(e){e.sentTime<o||(p.push(e.messageUId),f.push(e))})),this._batchMessage(f),this.logger.info(ge.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:p.join(",")})),(!g||i.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(ge.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),i=new Qi(si,n,e),[4,t.send(i)]):[2,X.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),(o=r.code)===X.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(t,n),o=new Qi(Zi[Zi.queryChrmI],r,e),[4,i.send(o,so)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==X.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(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 Qi(Ti,o,e),[4,r.send(s,jr,{conversation:{targetId:e}})]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==X.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,l;return D(this,(function(h){switch(h.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===_e.UPDATE?ai:ui,u=new Qi(a,s,e),[4,i.send(u,ro)]):[2,X.RC_NET_UNAVAILABLE];case 1:return c=h.sent(),(l=c.code)===X.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},r),[2,l]):[2,l]}}))}))},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 b(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,l,h,d,g,p=this;return D(this,(function(f){switch(f.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,t.entries.forEach((function(t){var n=p._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?p.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(e,t,r),s=t.type===_e.UPDATE?ci:li,a=new Qi(s,o,e),[4,i.send(a,Io)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return u=f.sent(),c=u.code,-1!==[X.SUCCESS,X.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(h=[],delete(d=w({},t)).entries,t.entries.forEach((function(e){h.push(w(w({},e),d))})),c===X.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(g=u.data,l=g.errorKeys,h=this._chatroomKVStoreNotAllSuccess(h,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:h,syncTime:(new Date).getTime()},r)),[2,{code:c,data:l}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=_e.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=_e.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=_e.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=_e.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=_e.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=_e.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:X.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),o=new Qi(Zi[Zi.pullKV],r,e),[4,i.send(o,To)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(u=a.kvEntries.find((function(e){return e.key===t})),void 0!==u)?[2,{code:X.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:X.CHATROOM_KEY_NOT_EXIST}]}}))}))},t.prototype.getAllChatroomEntry=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:X.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},i=n.codec.encodePullChatRoomKV(0),r=new Qi(Zi[Zi.pullKV],i,e),[4,n.send(r,To)]):[2,{code:X.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:X.SUCCESS,data:t}]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,l,h,d,g=this;return D(this,(function(p){switch(p.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=i.codec.encodePullChatRoomKV(t),s=new Qi(Zi[Zi.pullKV],o,e),this.logger.info(ge.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,i.send(s,To)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return a=p.sent(),u=a.code,c=a.data,l=u===X.SUCCESS?"info":"warn",this.logger[l](ge.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:t})),u===X.SUCCESS&&c?(h=c.kvEntries,d=[],h.length>0&&(h.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()||d.push({key:n,value:i,type:r,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,c,r),d.length>0&&this._watcher.chatroom({updatedEntries:d})),[2,{code:u,data:c}]):[2,{code:u}]}}))}))},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()}),d)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,i,r){return b(this,void 0,void 0,(function(){var o,s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return this._isConnected?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![z.PRIVATE,z.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[z.PRIVATE]=Zi.ppMsgS,t[z.GROUP]=Zi.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[z.PRIVATE]=Zi.ppMsgP,t[z.GROUP]=Zi.pgMsgP,t[z.CHATROOM]=Zi.chatMsg,t[z.CUSTOMER_SERVICE]=Zi.pcMsgP,t[z.RTC_ROOM]=Zi.prMsgS,t)[e]}(e)||Zi.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:jt(),n.messageId=a,u=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(c=new Yi(Zi[s],u,t)).setHeaderQos(jn.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(c),[2,{code:X.SUCCESS,data:Fa(e,t,w({},n),"",0,this.currentUserId,a)}]):(l=this._connMgr.getCrtServerTime(),h=Fa(e,t,w({},n),"",l,this.currentUserId,a),null==i||i(a),this.logger.info(ge.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),r),[4,this._connMgr.send(c)])):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return d=_.sent(),g=d.code,p=d.data,g!==X.SUCCESS?(this.logger.warn(ge.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:h.messageUId,messageId:h.messageId}),r),h.sentStatus=Re.FAILED,[2,{code:g,data:h}]):(this.logger.info(ge.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:null==p?void 0:p.messageUId,messageId:null==p?void 0:p.messageId}),r),f=p,this._sendMessageStore.setMessage(f.messageUId,f.timestamp),h.sentTime=f.timestamp,h.messageUId=f.messageUId,this._conversationManager.setConversationCacheByMessage(h,!0),[2,{code:X.SUCCESS,data:h}])}}))}))},t.prototype.recallMsg=function(e,t,n,i,r){var o;return b(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f,_,E,T;return D(this,(function(I){switch(I.label){case 0:return this._isConnected?(s=r.user,a=r.extra,u=r.isDelete,c={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:u||!1},s&&(c.user=s),a&&(c.extra=a),l={content:c,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},h=Zi[Zi.recallMsg],d=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},l),(g=new Yi(h,d,this.currentUserId)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(g)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return p=I.sent(),f=p.code,_=p.data,e===z.ULTRA_GROUP&&this.logger.debug(ge.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:f,conversationType:e,targetId:t,channelId:r.channelId})),f!==X.SUCCESS?[2,{code:f}]:(E=_,e===z.ULTRA_GROUP?(this._ultraMsgMap[E.messageUId]=E.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:X.SUCCESS}]):(this._sendMessageStore.setMessage(E.messageUId,E.timestamp),T=Fa(e,t,w(w({},l),{isPersited:!0}),E.messageUId,E.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(T,!0),[2,{code:X.SUCCESS,data:T}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r;return D(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(t,n),r=new Qi(Zi[Zi.rrMsg],i,e),[2,this._connMgr.send(r)]):[2,{code:X.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r;return D(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(t,n),r=new Qi(Zi[Zi.rrList],i,e),[2,this._connMgr.send(r,Fo)]):[2,{code:X.RC_NET_UNAVAILABLE}]}))}))},t.prototype.pullUserSettings=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new Qi(Zi[Zi.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,Oo)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===X.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(w({},o))}}else this.logger.warn(ge.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=i&&"uploads"!==i?t||"":xt(e,t),o=this._connMgr.codec.encodeGetFileToken(e,r,n||"",i||""),s=new Qi(Zi[Zi.qnTkn],o,this.currentUserId),[4,this._connMgr.send(s,uo)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,c=Object.assign(c,{fileName:r}),u===X.SUCCESS?[2,{code:u,data:c}]:[2,{code:u}]}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(r="",o="",s="",t===le.QINIU?(o=co,s=ho):(o=lo,s=go),r=t===le.QINIU?Zi[Zi.qnUrl]:t===le.AWS?Zi[Zi.s3Url]:t===le.STC?Zi[Zi.stcUrl]:t===le.MINIO?Zi[Zi.minioUrl]:Zi[Zi.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,e,n,i),u=new Qi(r,a,this.currentUserId),[4,this._connMgr.send(u,s)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return c=g.sent(),l=c.code,h=c.data,d=h,l===X.SUCCESS?[2,{code:l,data:d}]:[2,{code:l}]}}))}))},t.prototype.disconnect=function(){return b(this,void 0,void 0,(function(){return D(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._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 b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),i=new Qi(Zi[Zi.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,mo)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==X.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([w(w({},e),{createdTime:a})],a),[2,{code:X.SUCCESS}])}}))}))},t.prototype.removeTag=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([e],t),i=new Qi(Zi[Zi.delSeTag],n,this.currentUserId),[4,this._connMgr.send(i,mo)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==X.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:X.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),i=new Qi(Zi[Zi.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,mo)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==X.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:X.SUCCESS}])}}))}))},t.prototype.getTagList=function(){return b(this,void 0,void 0,(function(){var e,t;return D(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:X.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s=this;return D(this,(function(a){switch(a.label){case 0:return this._isConnected?this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Qi(Zi[Zi.addTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:X.TAG_NOT_EXIST}]:[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return(r=a.sent().code)!==X.SUCCESS?[2,{code:r}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:X.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o=this;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Qi(Zi[Zi.delTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return(r=s.sent().code)!==X.SUCCESS?[2,{code:r}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:X.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=e.conversationType,i=e.targetId,r=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[e]),a=new Qi(Zi[Zi.delTag],s,this.currentUserId),[4,this._connMgr.send(a)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return(u=c.sent().code)!==X.SUCCESS?[2,{code:u}]:(this._conversationManager.deleteTagStatus(n,i,t,r),[2,{code:X.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.label){case 0:return this._isConnected?(r=(i=this).currentUserId,o=i._connMgr,s=o.codec.encodeOldConversationList({count:n,type:z.PRIVATE,startTime:t}),a=new Qi(hi,s,r),[4,o.send(a,Wr,{currentUserId:r,connectedTime:o.getConnectedTime()})]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return u=d.sent(),c=u.code,l=u.data,c!==X.SUCCESS?[2,{code:c}]:(h=this._conversationHasTagFilter(e,null==l?void 0:l.list),[2,{code:c,data:h}])}}))}))},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),c=u.hasMentioned,l=u.mentionedInfo,h=u.lastUnreadTime,d=u.notificationStatus,g=u.isTop,p=u.tags,f=u.unreadMessageCount,_=p&&p[e];if(_){var E=w(w({},t),{hasMentioned:c,mentionedInfo:l,lastUnreadTime:h,notificationStatus:d,isTop:g,unreadMessageCount:f});_.isTop?i.push(w(w({},E),{isTopInTag:!0})):r.push(w(w({},E),{isTopInTag:!1}))}})),i.sort(o),r.sort(o),V(V([],i,!0),r,!0)},t.prototype.getUnreadCountByTag=function(e,t){return b(this,void 0,void 0,(function(){var n;return D(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:X.SUCCESS,data:n}]):[2,{code:X.RC_NET_UNAVAILABLE}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(i=t.targetId,r=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(u=this._conversationManager.get(r,i,o)).tags&&Object.hasOwnProperty.call(u.tags,e)?(c=this._connMgr.codec.encodeUpdateConversationTag(a,[t]),l=new Qi(Zi[Zi.addTag],c,this.currentUserId),[4,this._connMgr.send(l)]):[2,{code:X.NO_TAG_IN_CONVER}]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return(h=g.sent().code)!==X.SUCCESS?[2,{code:h}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(r,i,d,o),[2,{code:X.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return b(this,void 0,void 0,(function(){var n,i,r,o;return D(this,(function(s){if(!this._isConnected)return[2,{code:X.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:X.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:X.SUCCESS,data:e})},t.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:X.SUCCESS,data:n})},t.prototype.getUnreadConversationList=function(e){return b(this,void 0,void 0,(function(){var t;return D(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:X.SUCCESS,data:t})]}))}))},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===z.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:X.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:X.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===z.ULTRA_GROUP)return Promise.resolve({code:X.METHOD_NOT_AVAILABLE});var i;if(!(i=e===z.ULTRA_GROUP?this._ultraGroupManager.get(z.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:X.SUCCESS,data:se.NOT_SET});var r=i.notificationLevel;return at(i.notificationLevel)&&!at(i.notificationStatus)&&(r=re.OPEN===i.notificationStatus?1:0),Promise.resolve({code:X.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===z.ULTRA_GROUP?this._ultraGroupManager.get(z.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:X.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:X.SUCCESS,data:re.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 b(this,void 0,void 0,(function(){var t,n,i,r,o=this;return D(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&&et(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),w(w({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=Ha(i),r=rn(i),[2,{code:X.SUCCESS,data:r}]):[2,{code:X.METHOD_NOT_AVAILABLE}]}))}))},t.prototype._getUnreadCount=function(e){return e>999?999:e},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:X.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===re.OPEN||e.notificationLevel>0)&&t.push({conversationType:z.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:X.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:X.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:z.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:X.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:X.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:X.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:X.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:X.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:X.SUCCESS,data:n})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:X.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:X.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),b(this,void 0,void 0,(function(){var n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:z.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new Yi(Zi[Zi.updUgRTime],i,this.currentUserId)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,X.RC_NET_UNAVAILABLE]:[2,Promise.resolve(X.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===X.SUCCESS&&((s=this._ultraGroupMap["".concat(t,"_").concat(e)])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=n),s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h,d,g,p=this;return D(this,(function(f){switch(f.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new Qi(Zi[Zi.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,Wr,{currentUserId:this.currentUserId,conversationType:z.ULTRA_GROUP})]):[2];case 1:return i=f.sent(),r=i.code,o=i.data,r===X.SUCCESS&&o?(a=o.list,u=o.isFinished,a.forEach((function(e){e.notificationStatus=re.CLOSE,e.notificationLevel=se.NOT_SET,e.isTop=!1,p._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,p._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(ge.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(r,", try again")),s=setTimeout((function(){p._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(ge.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:l=f.sent(),h=l.code,d=l.data,h!==X.SUCCESS&&this.logger.warn(ge.O,"pullConversationStatus fail code: ".concat(h,", data: ").concat(d)),g=Object.values(this._ultraGroupMap),g=Ha(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(rn(g)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),f.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 b(this,void 0,void 0,(function(){var e,t,n,i=this;return D(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===X.SUCCESS&&n?(this.logger.info(ge.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(ge.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Qi(Zi[Zi.pullUgMsg],t,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(ge.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),i),[4,this._connMgr.send(n,kr,{currentUserId:this.currentUserId,conversation:{conversationType:z.ULTRA_GROUP}})];case 1:return r=l.sent(),o=r.code,s=r.data,o===X.SUCCESS&&s?(a=s.list,u=s.syncTime,c=a.map((function(e){return e.messageUId})).join(","),this.logger.info(ge.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:c,timestamp:e,syncTime:u}),i)):this.logger.warn(ge.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,u=e.channelId,c=e.isCounted,l=e.channelType,h=e.sentTime,d=e.senderUserId,g=e.content,p=e.isMentioned,f=this._ultraGroupMap["".concat(u,"_").concat(s)],_=f||{conversationType:z.ULTRA_GROUP,targetId:s,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:re.CLOSE,notificationLevel:se.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==ne.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=t,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),p&&(null===(i=null==g?void 0:g.mentionedInfo)||void 0===i?void 0:i.type)!==ue.ALL&&(null===(o=null===(r=null==g?void 0:g.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(u,"_").concat(s)]=_),_},t.prototype._syncUltraMsg=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l=this;return D(this,(function(h){switch(h.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=h.sent(),n=t.code,i=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===X.SUCCESS&&i?(r=i.list,o=i.syncTime,s=i.finished,a={},u=[],r.forEach((function(e){var t,n,i,r=e.targetId,s=e.content,c=e.messageUId,h=e.channelId,d=e.isMentioned;if(l._ultraMsgMap[c])delete l._ultraMsgMap[c];else{var g=0;d&&((null===(t=null==s?void 0:s.mentionedInfo)||void 0===t?void 0:t.type)===ue.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(l.currentUserId)))&&(g=1);var p=l._getUltraGroup(e,g,o);a["".concat(h,"_").concat(r)]=p,l._ultraGroupManager.addUltraGroupStatus(p),u.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(ge.O,"notice ultragroups"),c=Object.values(a),c=Ha(c),this._watcher.conversation(rn(c))),this.logger.debug(ge.O,"notice ultragroup message"),this._batchMessage(u),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 b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d,g,p;return D(this,(function(f){switch(f.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(ge.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),r=t.messageId?t.messageId:jt(),t.messageId=r,o=this._connMgr.codec.encodeUpMsg({conversationType:z.ULTRA_GROUP,targetId:e},t),(s=new Yi(Zi[Zi.ugMsg],o,e)).setHeaderQos(jn.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=Fa(z.ULTRA_GROUP,e,w({},t),"",a,this.currentUserId,r),n&&n(r),this.logger.info(ge.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:z.ULTRA_GROUP,targetId:e,channelId:t.channelId}),i),[4,this._connMgr.send(s)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return c=f.sent(),l=c.code,h=c.data,l!==X.SUCCESS?(this.logger.warn(ge.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:u.messageUId,messageId:u.messageId}),i),u.sentStatus=Re.FAILED,[2,{code:l,data:u}]):(this.logger.info(ge.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:null==h?void 0:h.messageUId,messageId:null==h?void 0:h.messageId}),i),d=h,u.sentTime=d.timestamp,u.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,g=t.channelId||"",(p=this._ultraGroupMap["".concat(g,"_").concat(e)])?(p.latestMessage=u,et(p.channelType)&&(u.channelType=p.channelType)):(p={conversationType:z.ULTRA_GROUP,targetId:e,channelId:g,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:re.CLOSE,notificationLevel:se.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(g,"_").concat(e)]=p,this._ultraGroupManager.addUltraGroupStatus(p)),this._watcher.conversation(rn([p])),[2,{code:l,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s,a;return D(this,(function(u){switch(u.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 Yi(Zi[Zi.operate],o,r)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==X.SUCCESS?[2,{code:a,msg:X[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:X.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(i=new Qi(Zi[Zi.qryMsg],n,this.currentUserId)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(i,is,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==X.SUCCESS?[2,{code:o,msg:X[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,os),n=t.conversationType,i=t.info,r=t.summary;this.logger.debug(ge.O,"s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return b(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){switch(r.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Qi(Zi[Zi.upMsgEx],t,e.targetId)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==X.SUCCESS?[2,{code:i,msg:X[i]}]:[2,{code:i}]}}))}))},t.prototype.modifyMessage=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new Qi(Zi[Zi.modifyMsg],t,e.targetId)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==X.SUCCESS?[2,{code:r,msg:X[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new Qi(Zi[Zi.qryMsgChange],t,this.currentUserId)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(n,es)]):[2];case 1:return i=h.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r===X.SUCCESS&&o?(s=o.hasNext,a=o.list,u=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(l=this._pullUltraChangeMessageQue).push.apply(l,c),s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[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=be.CHANNEL_CHANGE,i=be.MSG_RECALL,r=be.MSG_EXPANSION,o=be.MSG_MODIFY,s=be.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,u=e.sendTime,c=e.operatorId,l="".concat(a,"_").concat(s),h=t._ultraGroupMap[l];if(h){var d=De.PUBLIC_TO_PRIVATE,g=De.PRIVATE_TO_PUBLIC,p=De.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=De.CHANNEL_DELETE,_=De.CHANNEL_USER_KICKED;switch(o){case g:h.channelType=Pe.PUBLIC,n.push({targetId:s,channelId:a,changeType:we.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Pe.PRIVATE,n.push({targetId:s,channelId:a,changeType:we.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case p:n.push({targetId:s,channelId:a,changeType:we.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:u}),delete t._ultraGroupMap[l];break;case _:r.push({targetId:s,channelId:a,userId:c,channelType:Pe.PRIVATE}),c===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,n=[];e.forEach((function(e){var i=e.targetId,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.conversationType,u=e.operatorId,c=e.mentionedType;t._updateUltraGroupWhenRecallMsg(i,r,o,s,c),n.push({targetId:i,conversationType:a,sentTime:s,messageUId:o,senderUserId:u,channelId:r,content:{conversationType:a,targetId:i,messageUId:o,channelId:r},messageDirection:1,messageType:ne.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:0})})),this._watcher.ultraGroupMessageRecalled(n)},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:V([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c=this;return D(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(i=new Qi(Zi[Zi.qryMsg],n,this.currentUserId)).setHeaderQos(jn.AT_LEAST_ONCE),[4,this._connMgr.send(i,is,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),o=r.code,s=r.data,o!==X.SUCCESS?[2,{code:o,msg:X[o]}]:(a=(s||{}).list,u=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=c._ultraGroupMap["".concat(n,"_").concat(t)];r&&r.latestMessage.messageUId===i&&(r.latestMessage=e),u.push(e)})),e===be.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===be.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h;return D(this,(function(d){return t=Ve.REMOVE_USER_GROUP,n=Ve.JOIN_USER_GROUP,i=Ve.EXIT_USER_GROUP,r=Ve.CHANNEL_BIND_USER_GROUP,o=Ve.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],l=[],e.forEach((function(e){var h=e.conversationType,d=e.targetId,g=e.userGroupIds,p=e.busChannelType,f=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:h,targetId:d},userGroupIds:g});break;case n:a.push({conversation:{conversationType:h,targetId:d},userGroupIds:g});break;case i:u.push({conversation:{conversationType:h,targetId:d},userGroupIds:g});break;case r:c.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:p,userGroupIds:g});break;case o:l.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:p,userGroupIds:g})}})),h={},s.length>0&&(h.userGroupDisband=s),a.length>0&&(h.userAdded=a),u.length>0&&(h.userRemoved=u),c.length>0&&(h.userGroupBindChannel=c),l.length>0&&(h.userGroupUnBindChannel=l),this._watcher.userGroupStatus(h),[2]}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){var i;return b(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(e,t),o=new Qi(Zi[Zi.qryUgMsg],r,this.currentUserId),this.logger.info(ge.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:z.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,jr,{currentUserId:this.currentUserId,conversation:{conversationType:z.ULTRA_GROUP,targetId:e}})]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,a===X.SUCCESS&&u?(c=[],null===(i=u.list)||void 0===i||i.forEach((function(e){e&&c.push(e.messageUId)})),this.logger.info(ge.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(ge.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),r=new Qi(Zi[Zi.ugUnpushSet],i,e),[4,this._connMgr.send(r)]):[2,{code:X.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:X.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,X.SUCCESS,[2,{code:s}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return b(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new Qi(Zi[Zi.ugUnpushQuery],i,e),[4,n.send(r,Bo)]):[2,{code:X.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:X.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===X.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[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,u=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),i&&u<i&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(r===Ge.ALL||r===Ge.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,r===Ge.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(rn([s])))}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:X.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Qi(Zi[Zi.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,Go)]):[2,Promise.resolve({code:X.METHOD_NOT_AVAILABLE})]:[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===X.SUCCESS&&o?[2,{code:r,data:o}]:[2,{code:r}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r;return D(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:X.SUCCESS,data:r}]):[2,Promise.resolve({code:X.METHOD_NOT_AVAILABLE})]:[2,{code:X.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r;return D(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),i=new Qi(Zi[Zi.setRtcRoomId],n,t),[4,this._connMgr.send(i)]):[2,X.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=i instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(i)):i,o=n?new Qi(t,r,e):new Yi(t,r,e),[4,this._connMgr.send(o)]):[2,{code:X.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,[2,{code:a,buffer:null==u?void 0:u.data}]}}))}))},t.prototype.rtcPing=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return i=_s(this.rtcCodec,t,n),[4,this.rtcSignaling(e,Zi[Zi.rtcPing],!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o!==X.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(bt.RtcOutput,s)).version=kt(a.version),[2,{code:o,data:a}])}}))}))},t.prototype.getDeviceId=function(){return Nr(this.runtime)},t.prototype.getOSInfo=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,{code:X.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,{code:X.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,{code:X.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){As(),va()},t.prototype.callExtra=function(e){return Promise.resolve({code:X.EXTRA_METHOD_UNDEFINED})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getConversationsByPage=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){return new Promise((function(e){e(X.NOT_SUPPORT)}))},t.prototype.removeFromBlacklist=function(e){return new Promise((function(e){e(X.NOT_SUPPORT)}))},t.prototype.getBlacklist=function(){return new Promise((function(e){e({code:X.NOT_SUPPORT})}))},t.prototype.getBlacklistStatus=function(e){return new Promise((function(e){e({code:X.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.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 b(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(t,n),[4,i.send(new Qi(fi,r,e),ls)]):[3,2];case 1:return o=u.sent(),s=o.code,a=o.data,s===X.SUCCESS&&a?[2,new Promise((function(e){e({code:s,data:{key:a.key,value:a.dataContent}})}))]:[2,new Promise((function(e){e({code:s})}))];case 2:return[2,new Promise((function(e){e({code:X.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:X.NOT_SUPPORT})},t.prototype.getProxy=function(){return Promise.resolve({code:X.NOT_SUPPORT})},t.prototype.testProxy=function(e,t){return Promise.resolve({status:X.NOT_SUPPORT})},t.prototype.setNetwork=function(e,t){this._connMgr.setNetwork(e,t)},t}(Pn),Ya=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return P(t,e),t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return b(this,void 0,void 0,(function(){var s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return s=_s(this._context.rtcCodec,t,n,i,r,o),[4,this.rtcSignaling(e,un,!0,s)];case 1:return a=h.sent(),u=a.code,c=a.buffer,u===X.SUCCESS&&c&&(l=Es(this._context.rtcCodec,c)),[2,{code:u,data:l}]}}))}))},t.prototype.quitRTCRoom=function(e){return b(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(bt.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,cn,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return b(this,void 0,void 0,(function(){return D(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 b(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,ln,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===X.SUCCESS&&r&&(o=this._context.rtcCodec.decode(bt.RtcRoomInfoOutput,r)),[2,{code:i,data:o}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,hn,!0,t)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===X.SUCCESS&&r&&(s=Es(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 b(this,void 0,void 0,(function(){var i;return D(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(bt.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,dn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return b(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(bt.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,gn,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,o){return b(this,void 0,void 0,(function(){var s;return D(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(bt.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,pn,!1,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return void 0===r&&(r=""),b(this,void 0,void 0,(function(){var o,s;return D(this,(function(a){switch(a.label){case 0:return o={objectName:i,content:this._context.rtcCodec.encode(bt.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(bt.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(bt.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},s=this._context.rtcCodec.encode(bt.RtcUserSetDataInput,o),[4,this.rtcSignaling(e,fn,!0,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return b(this,void 0,void 0,(function(){var i;return D(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(bt.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(bt.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,fn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(bt.RtcDataInput,{interior:n,target:i,key:t}),[4,this.rtcSignaling(e,_n,!0,r)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===X.SUCCESS&&a?(u=this._context.rtcCodec.decode(bt.RtcQryOutput,a).outInfo,c={},u.forEach((function(e){c[e.key]=e.value})),[2,{code:s,data:c}]):[2,{code:s}]}}))}))},t.prototype.removeRTCData=function(e,t,n,i,r){return b(this,void 0,void 0,(function(){var o;return D(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(bt.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,En,!1,o)];case 1:return[2,s.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){return b(this,void 0,void 0,(function(){return D(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return i=_s(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Tn,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===X.SUCCESS&&s?(a=this._context.rtcCodec.decode(bt.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},t.prototype.setRTCState=function(e,t){return b(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(bt.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,In,!0,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Cn,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===X.SUCCESS&&r?(o=Es(this._context.rtcCodec,r),[2,{code:i,data:o}]):[2,{code:i}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return i=_s(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,vn,!0,i)];case 1:return r=l.sent(),o=r.code,s=r.buffer,o===X.SUCCESS&&s?(a=this._context.rtcCodec.decode(bt.RtcViewerJoinedOutput,s),u=a.rtcToken,c=a.entries,[2,{code:o,data:{token:u,kvEntries:c}}]):[2,{code:o}]}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return b(this,void 0,void 0,(function(){var t,n;return D(this,(function(i){switch(i.label){case 0:return t=this._context.rtcCodec.encode(bt.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Rn,!0,t)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return i=this._context.rtcCodec.encode(bt.RtcInput,{roomType:Ye.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,mn,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===X.SUCCESS&&s?(a=Es(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},t.prototype.requestRoomPK=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u;return D(this,(function(c){switch(c.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(bt.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:o}),[4,this.rtcSignaling(s,Sn,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},t.prototype.cancelRoomPK=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteInfo,o=e.roomId,s=this._context.rtcCodec.encode(bt.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(o,On,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l;return D(this,(function(h){switch(h.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,u=e.roomId,c=this._context.rtcCodec.encode(bt.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:i,content:r,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,Nn,!0,c)];case 1:return l=h.sent().code,this._context.rtcKVManager.reset(),[2,l]}}))}))},t.prototype.endRoomPK=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=e.endRoomId,n=e.sessionId,i=e.content,r=e.keys,o=e.roomId,s=this._context.rtcCodec.encode(bt.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(o,Mn,!0,s)];case 1:return a=u.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 b(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",An,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===X.SUCCESS&&r?(o=this._context.rtcCodec.decode(bt.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:kt(e.joinTime)}}))}]):[2,{code:i}]}}))}))},t}(zn);function qa(e){return w({},e)}var ja=function(){function e(e,t){var n,i;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[ne.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[ne.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[ne.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[ne.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[ne.INTERCEPT]=this._processInterceptMessage.bind(this),n[ne.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[ne.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[ne.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[ne.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[ne.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[ne.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},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=w({},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,oa.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,oa.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,oa.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,oa.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)};this.rtcCodec=this.createCodec(Ln,Un),this._engine=en()?new RCCppEngine(e,this.rtcCodec,r,this._options):new Ka(e,this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new an(this._engine)}return e.init=function(t,n){if(this._context)return this._context.logger.warn(ge.A_INIT_REPEAT_O),this._context;this._context=new e(t,n),this._context.logger.info(ge.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(ge.L_IMSDK_VER_O,JSON.stringify({commitId:"a39f4a305f2a6c4efb62e78819ed677f5146e79c",version:"5.8.1"}));var i=this._context._engine;return t.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},e.destroy=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(ge.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 Gn(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(ge.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(ge.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var i="RCRTC"===e.tag?new Ya(this):new zn(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(i,this._runtime,t)}catch(e){this.logger.error(ge.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(ge.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._processChatrormMessage=function(e){var t;if("function"==typeof this._watcher.chatroomState)return this._watcher.chatroomState({userChange:{users:(t={},t[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?Ie.QUIT:Ie.JOIN,t),chatroomId:e.targetId}}),!0},e.prototype._processChrmMemChangeMessage=function(e){if("function"==typeof this._watcher.chatroomState){var t={};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}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo(qa(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===z.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===Te.MSG_EXPANSION||n===Te.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(ge.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.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(qa(e))}catch(e){return a.logger.error(ge.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,qa(e),t,n),!this._messageProccessor[e.messageType])return e;this._messageProccessor[e.messageType](e)}},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[];e.forEach((function(e){var o=i._messageReceiver(e,t,n);o&&r.push(o)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(ge.L_BATCH_MESSAGE_O,r.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(r))},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(ge.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._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]=st(i)||ot(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||"",u="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===s?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._engine.getConnectionStatus()},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.refetchNaviInfo=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var i,r;return b(this,void 0,void 0,(function(){var o,s,a,u,c;return D(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),[4,this._engine.connect(e,t,n)];case 2:return s=l.sent(),a=s.code,u=s.data,a!==X.SUCCESS?[2,{code:a}]:(1!==this._engine.getNaviInfoFromCache().type&&(c=It.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,c)),[2,{code:a,userId:u}])}}))}))},e.prototype.disconnect=function(e){return b(this,void 0,void 0,(function(){var t=this;return D(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(ge.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),tt(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&&ot(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var r=t[e];et(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:X.SEARCH_PROPS_LIMIT_ERROR}:{code:X.SUCCESS}},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!==X.SUCCESS)return Promise.resolve({code:s,msg:a});if(e!==z.ULTRA_GROUP){var u=this.getNaviInfoFromCache();if(1===((null==u?void 0:u.grpRRVer)||0)&&n.messageType===ne.READ_RECEIPT_RESPONSE)return Promise.resolve({code:X.READ_RECEIPT_ERROR})}var c=n.canIncludeExpansion,l=void 0!==c&&c,d=n.expansion;if(l){var g=_t(d),p=g.isIllgalEx,f=g.isExKeyOrValLengthExceedLimit;if(g.isExceedLimit||f)return Promise.resolve({code:X.EXPANSION_LIMIT_EXCEET});if(p)return Promise.resolve({code:X.BIZ_ERROR_INVALID_PARAMETER})}var _,E,T=JSON.stringify(n.content);return _=T,void 0===E&&(E="utf-8"),("utf-16"===E?x(_):F(_))>h?Promise.resolve({code:X.RC_MSG_CONTENT_EXCEED_LIMIT}):e===z.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,i,r):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(u=_t(s),c=u.isIllgalEx,l=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||l?[2,Promise.resolve({code:X.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:X.BIZ_ERROR_INVALID_PARAMETER})]:(h={mid:r},s&&(h.put=s),o&&(h.del=o),a&&(h.removeAll=1),[4,this._engine.sendMessage(n,i,{content:h,messageType:ne.EXPANSION_NOTIFY,channelId:t})])):[2,{code:X.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return b(this,void 0,void 0,(function(){var i;return D(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:X.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 b(this,void 0,void 0,(function(){var i;return D(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:X.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){return b(this,void 0,void 0,(function(){var e=this;return D(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(ge.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===z.ULTRA_GROUP){var u={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(t,u,a)}return this._engine.getHistoryMessage(e,t,n,i,r,o,s||"",a)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,i,r,o,s)},e.prototype.getConversationList=function(e,t,n,i,r){if(void 0===e&&(e=300),void 0===r&&(r=""),t===z.ULTRA_GROUP){var o=X.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:X[o]})}return this._engine.getConversationList(e,t,n,i,r)},e.prototype.getConversationsByPage=function(e,t,n,i){return this._engine.getConversationsByPage(e,t,n,i)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===z.ULTRA_GROUP?Promise.resolve(X.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)},e.prototype.getUltraGroupList=function(e){return this._engine.getUltraGroupList(e)},e.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},e.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),e===z.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(z.ULTRA_GROUP)){var i=X.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:X[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[z.PRIVATE,z.GROUP,z.SYSTEM,z.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.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),b(this,void 0,void 0,(function(){var r;return D(this,(function(o){return r=[{conversationType:e,targetId:t,notificationLevel:n,channelId:i}],[2,this._engine.batchSetConversationStatus(r)]}))}))},e.prototype.setConversationStatus=function(e,t,n,i,r){if(void 0===r&&(r=""),e===z.ULTRA_GROUP&&void 0!==n)return Promise.resolve(X.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(e,t,n,i)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,i,r){return this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){return void 0===i&&(i=""),e===z.ULTRA_GROUP?Promise.resolve(X.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,i)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,i)},e.prototype.joinChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,n)},e.prototype.joinExistChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return Yt(n)&&qt(i)?this._engine.setChatroomEntry(e,t):Promise.resolve(X.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(!Yt(r)||!qt(o))return Promise.resolve({code:X.BIZ_ERROR_INVALID_PARAMETER})}var s=w(w({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,i=t.value;return Yt(n)&&qt(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(X.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return Yt(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(X.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(!Yt(i))return Promise.resolve({code:X.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return Yt(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(X.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,i){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===i&&(i=0),this._engine.getChatroomHistoryMessages(e,i,t,n)},e.prototype.getFileToken=function(e,t,n,i){return b(this,void 0,void 0,(function(){var r,o,s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return r=this.getNaviInfoFromCache(),o=(null==r?void 0:r.bosAddr)||"",s=(null==r?void 0:r.uploadServer)||"",a=(null==r?void 0:r.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,i)];case 1:return u=h.sent(),c=u.code,l=u.data,c===X.SUCCESS&&l?[2,Promise.resolve(Object.assign(l,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(c)]}}))}))},e.prototype.getFileUrl=function(e,t,n,i,r){return void 0===r&&(r=le.QINIU),b(this,void 0,void 0,(function(){var o,s,a;return D(this,(function(u){switch(u.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=u.sent(),s=o.code,a=o.data,s===X.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return t.length>1e3?[2,Promise.reject(X.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return b(this,void 0,void 0,(function(){return D(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return b(this,void 0,void 0,(function(){return D(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=[z.PRIVATE,z.CHATROOM,z.GROUP,z.SYSTEM,z.APP_PUBLIC_SERVICE,z.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t)},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[z.PRIVATE,z.CHATROOM,z.GROUP,z.SYSTEM,z.APP_PUBLIC_SERVICE,z.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!==z.ULTRA_GROUP){var t=X.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:X[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return b(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==z.ULTRA_GROUP?[2,{code:r=X.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:X[r]}]:i?(o=_t(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:X.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:X.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:X.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return b(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return e.conversationType!==z.ULTRA_GROUP?[2,{code:t=X.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:X[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,V([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 b(this,void 0,void 0,(function(){return D(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(ge.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return b(this,void 0,void 0,(function(){var i,r,o;return D(this,(function(s){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,o=i.msg,r!==X.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=""),b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){return void 0===r&&(r=""),b(this,void 0,void 0,(function(){return D(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,i,r)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return b(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return b(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,i){return b(this,void 0,void 0,(function(){return D(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(e,t,n,i)]}))}))},e.prototype.setUserStatus=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return b(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,i){return void 0===t&&(t=[]),void 0===n&&(n=""),b(this,void 0,void 0,(function(){return D(this,(function(r){return[2,this._engine.searchConversationByContent(e,t,n,i)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),b(this,void 0,void 0,(function(){return D(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=""),b(this,void 0,void 0,(function(){return D(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=""),b(this,void 0,void 0,(function(){return D(this,(function(s){return[2,this._engine.searchMessagesByUser(e,t,n,i,r,o)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){return b(this,void 0,void 0,(function(){return D(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 b(this,void 0,void 0,(function(){return D(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 b(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.createLogger=function(e,t){return this._engine.createLogger(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}(),Qa=m;export{da as AConnectionMgr,Pn as AEngine,ja as APIContext,L as AppStorage,Vn as AreaCode,yt as AssertRules,Rs as BasicLogger,vr as BasicNavi,js as BasicReporter,La as BasicStatistic,Ua as BasicStatisticReporter,T as CPP_PROTOCAL_MSGTYPE_OPTION,Ze as CallLibMsgType,_e as ChatroomEntryType,Qe as ChatroomSyncStatusReason,Ie as ChatroomUserChangeType,Le as ChrmMemBanType,Me as ChrmMemOperateType,Oe as ChrmSyncStatus,Gn as Codec,Ke as ConnectReason,He as ConnectType,ee as ConnectionStatus,z as ConversationType,R as DB_LOG_FLUSH_FREQUENCY,v as DB_LOG_MAX_SIZE,on as DelayTimer,Be as EnterpriseType,X as ErrorCode,W as ErrorCodes,Et as EventEmitter,S as FORMATED_VERSION,Y as FileType,r as HTTP_TIMEOUT,bs as HttpMethod,d as IM_CHATROOM_PULL_INTERVAL_TIME,u as IM_PING_INTERVAL_TIME,l as IM_PING_MIN_TIMEOUT,c as IM_PING_TIMEOUT,a as IM_SIGNAL_TIMEOUT,qs as IndexDBLogger,ra as IndexDBReporter,wa as IndexDBStatistic,xa as IndexDBStatisticReporter,je as LiveRole,qe as LiveType,ps as LogL,he as LogLevel,de as LogSource,ge as LogTagId,h as MAX_MESSAGE_CONTENT_BYTES,f as MAX_MESSAGE_EXPANSION_KEY_LENGTH,_ as MAX_MESSAGE_EXPANSION_VAL_LENGTH,O as MAX_UPLOAD_FILE_SIZE,ue as MentionedType,Te as MessageBlockSourceType,ve as MessageBlockType,j as MessageDirection,ne as MessageType,i as NAVI_CACHE_DURATION,o as NAVI_REQ_TIMEOUT,xe as NaviCacheType,Ds as NetworkType,se as NotificationLevel,re as NotificationStatus,y as ONE_LOG_SIZE_MAX,me as OperateStatus,zn as PluginContext,ke as ProtocalType,Vt as RCAssertError,oa as RCConnectionStatus,C as REAT_TIME_LOG_SIZE,We as RTCApiType,Je as RTCIdentityChangeType,Xe as RTCJoinType,Ye as RTCMode,Ya as RTCPluginContext,n as ReceivedStatus,E as SEND_MESSAGE_TYPE_OPTION,I as STATUS_MESSAGE,p as STORAGE_ROOT_KEY,Re as SentStatus,ha as StatisticL,pe as StatisticsTag,Fe as StatisticsVersion,Ue as StoreKeys,Vs as TagChangeType,N as UPLOAD_FILE_CHUNK_SIZE,we as UltraGroupChannelChangeType,Pe as UltraGroupChannelType,Ge as UltraMentionedType,be as UltraMsgChangeType,De as UltraMsgSubChangeType,le as UploadMethod,Ve as UserGroupChangeType,m as VERSION,It as VersionManage,s as WEB_SOCKET_TIMEOUT,mr as WebSocketNavi,H as appendUrl,Gt as assert,rn as clone,$t as cloneByJSON,As as deInitLogDB,Wt as forEach,tn as getBrowser,jt as getClientMessageId,Ft as getMimeKey,Lt as getUUID,Ut as getUUID22,xt as getUploadFileName,Qt as getbundleId,Xt as indexOf,Ms as initLogDB,Ca as initStatisticDB,tt as isArray,nt as isArrayBuffer,$e as isBoolean,la as isConnnectAck,ca as isDisconnectedByServer,st as isFunction,ct as isHttpUrl,zt as isInObject,Zt as isInclude,ut as isNull,et as isNumber,ot as isObject,ze as isString,pt as isTypeInConversationList,at as isUndefined,gt as isValidChannelId,Yt as isValidChrmEntryKey,qt as isValidChrmEntryValue,ht as isValidConversationType,_t as isValidExpansion,ft as isValidFileType,dt as isValidNotificationLevel,At as logger,Jt as map,rt as notEmptyArray,lt as notEmptyObject,it as notEmptyString,Ht as pushConfigsToJSON,Kt as pushJSONToConfigs,Oa as statisticTranscsv,k as todo,ia as transcsv,va as unInitStatisticDB,Zn as urlCenter,en as usingCppEngine,Bt as validate,Qa as version};
1
+ var e;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(e||(e={}));var t,n=e,i=72e5,r=6e4,o=1e4,s=5e3,a=3e4,u=15e3,c=15e3,l=2e3,h=131072,d=18e4,p="RCV4-",f=32,_=4096,E={"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: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: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}},v={"RC:DizNtf":{isCounted:!1,isPersited:!1}},T=["RC:TypSts","RC:InterceptMsg","RC:RL"],y=20971520,m=1e5,C=3e3,I=1e3,R="5.8.2",S=R.replace(/-.+$/,""),O=5368709120,M=10485760,N=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},L=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}(),U=function(){function e(e,t){var n,i=t?"".concat(p).concat(t):p;this._rootStorage=N(e);var r=this._rootStorage.get(i)||{};this._cache=new L(((n={})[i]=r,n)),this._storageKey=i}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e}(),A=function(e,t){return A=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])},A(e,t)};function w(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}A(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var b=function(){return b=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},b.apply(this,arguments)};function P(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((i=i.apply(e,t||[])).next())}))}function D(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(u){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,u])}}}function V(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var G,k=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return w(t,e),t}(Error),B=function(e){return new k(e)},x=function(e){for(var t=0,n=0,i=e.length;n<i;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},F=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},H=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e};!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"}(G||(G={}));var q,K=G;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(q||(q={}));var Y,j=q;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",e[e.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",e[e.SUCCESS=0]="SUCCESS",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_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.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_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.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.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_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=35028]="RC_CONN_PROXY_UNAVAILABLE",e[e.PROXY_UNAVAILABLE=17]="PROXY_UNAVAILABLE"}(Y||(Y={}));var Q,W=Y;!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"}(Q||(Q={}));var J,X=Q;!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"}(J||(J={}));var Z,z=J;!function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.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.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.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"}(Z||(Z={}));var $,ee=Z;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}($||($={}));var te,ne=$;!function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(te||(te={}));var ie,re=te;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(ie||(ie={}));var oe,se=ie;!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"}(oe||(oe={}));var ae,ue=oe;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(ae||(ae={}));var ce,le,he,de,ge,pe=ae;!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"}(ce||(ce={})),function(e){e.IM="IM",e.RTC="RTC"}(le||(le={})),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_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"}(he||(he={})),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"}(de||(de={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ge||(ge={}));var fe,_e,Ee=ge;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(fe||(fe={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(_e||(_e={}));var ve,Te=fe;!function(e){e[e.typing=0]="typing"}(ve||(ve={}));var ye,me,Ce=ve;!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"}(ye||(ye={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(me||(me={}));var Ie,Re=me;!function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(Ie||(Ie={}));var Se,Oe=Ie;!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"}(Se||(Se={}));var Me,Ne=Se;!function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(Me||(Me={}));var Le,Ue,Ae,we,be,Pe,De,Ve,Ge,ke,Be,xe,Fe,He,qe,Ke,Ye=Me;!function(e){e.NAVI="rc-navi",e.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(Le||(Le={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(Ue||(Ue={})),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"}(Ae||(Ae={})),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"}(we||(we={})),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"}(be||(be={})),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"}(Pe||(Pe={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(De||(De={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Ve||(Ve={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Ge||(Ge={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(ke||(ke={})),function(e){e[e.CURRENT=2]="CURRENT"}(Be||(Be={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(xe||(xe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Fe||(Fe={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(He||(He={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(qe||(qe={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Ke||(Ke={}));var je,Qe,We,Je={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(je||(je={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Qe||(Qe={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(We||(We={}));var Xe=function(e){return"string"==typeof e},Ze=function(e){return"boolean"==typeof e},ze=function(e){return"number"==typeof e&&!Number.isNaN(e)},$e=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},et=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},tt=function(e){return Xe(e)&&e.length>0},nt=function(e){return $e(e)&&e.length>0},it=function(e){return"[object Object]"===Object.prototype.toString.call(e)},rt=function(e){return"[object Function]"===Object.prototype.toString.call(e)},ot=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},st=function(e){return"[object Null]"===Object.prototype.toString.call(e)},at=function(e){return Xe(e)&&/https?:\/\//.test(e)},ut=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},ct=function(e){return ze(e)&&Object.prototype.hasOwnProperty.call(X,e)},lt=function(e){return ze(e)&&Object.prototype.hasOwnProperty.call(re,e)},ht=function(e){var t=!1;return Xe(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},dt=function(e){return[X.PRIVATE,X.GROUP,X.SYSTEM,X.PUBLIC_SERVICE,X.APP_PUBLIC_SERVICE].includes(e)},gt=function(e){return ze(e)&&Object.prototype.hasOwnProperty.call(K,e)},pt=function(e){var t=!1,n=!1,i=!1;if(it(e)){var r=Object.keys(e).length;for(var o in t=r>20,e)if(n||(n=Xe(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}},ft=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,u=o.listener;a&&i.splice(r,1);try{u.call.apply(u,V([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}(),_t="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};_t.engine="5.8.2";var Et=function(){function e(){}return e.add=function(e,t){_t[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 _t.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return _t},e}(),vt=null;function Tt(e,t,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-e];if(vt&&e<ce.FATAL)try{var o=JSON.stringify(n);vt[r](t,o)}catch(e){console.error(e)}}var yt,mt,Ct=Tt.bind(null,ce.DEBUG),It=Tt.bind(null,ce.INFO),Rt=Tt.bind(null,ce.WARN),St=Tt.bind(null,ce.ERROR),Ot=Tt.bind(null,ce.FATAL),Mt=Object.freeze({__proto__:null,init:function(e){vt=e},log:Tt,debug:Ct,info:It,warn:Rt,error:St,fatal:Ot}),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)}))},Lt=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};!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"}(mt||(mt={}));var Ut,At,wt,bt,Pt=((yt={})[mt.STRING]=tt,yt[mt.ONLY_STRING]=Xe,yt[mt.NUMBER]=ze,yt[mt.BOOLEAN]=function(e){return"boolean"==typeof e},yt[mt.OBJECT]=it,yt[mt.ARRAY]=$e,yt[mt.CALLBACK]=function(e){var t=!0;return it(e)||(t=!1),(e=e||{}).onSuccess&&!rt(e.onSuccess)&&(t=!1),e.onError&&!rt(e.onError)&&(t=!1),t},yt[mt.CHANNEL_ID]=ht,yt[mt.CONVERSATION]=function(e){var t=!0;return it(e)||(t=!1),Xe(e.targetId)||(t=!1),ct(e.conversationType)||(t=!1),ot(e.channelId)||ht(e.channelId)||(t=!1),t},yt),Dt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return w(t,e),t}(Error),Vt=function(e,t,n,i){if(void 0===i&&(i=!1),!Gt(e,t,n,i))throw new Dt("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},Gt=function(e,t,n,i){void 0===i&&(i=!1),n=Pt[n]||n;var r=i?n(t):ot(t)||null==t||n(t);return r||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),r},kt=function(e){if(!it(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)},Bt=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)},xt=function(e){var t="application/octet-stream";switch(e){case K.IMAGE:t="image/jpeg";break;case K.AUDIO:t="audio/amr";break;case K.VIDEO:t="video/3gpp";break;case K.SIGHT:t="video/mpeg4";break;case K.COMBINE_HTML:t="text/html"}return t},Ft=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h=t.miLargeIconUrl,d=t.importanceHW,g=t.categoryHW,p=t.imageUrlHW,f=t.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=i||"",_.category=r||"",_.richMediaUri=o||"";var E={};E.collapse_key=null==l?void 0:l.collapseKey,E.imageUrl=null==l?void 0:l.imageUrl;var v=null==l?void 0:l.priority;v&&!["high","normal"].includes(v)&&(v="normal"),E.priority=v;var T=[{HW:{channelId:a||"",importance:d||"NORMAL",image:p||"",category:g||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||"",category:f||""}},{APNS:_},{FCM:E}];return JSON.stringify(T)},Ht=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,u,c,l,h,d=Object.keys(e);if(0!==d.length){var g=d[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 r.channelIdMi=null===(a=e[g])||void 0===a?void 0:a.channelId,void(r.miLargeIconUrl=null===(u=e[g])||void 0===u?void 0:u.large_icon_uri);case"OPPO":return void(r.channelIdOPPO=null===(c=e[g])||void 0===c?void 0:c.channelId);case"VIVO":return r.typeVivo=null===(l=e[g])||void 0===l?void 0:l.classification,void(r.categoryVivo=null===(h=e[g])||void 0===h?void 0:h.category);case"APNS":return i.threadId=e[g]["thread-id"],i.apnsCollapseId=e[g]["apns-collapse-id"],i.category=e[g].category,void(i.richMediaUri=e[g].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[g].collapse_key||"",imageUrl:e[g].imageUrl||"",priority:e[g].priority||""}}}}))}catch(n){e.error(he.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:i,androidConfig:r}},qt=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Kt=function(e){var t=e.length;return t<=4096&&t>=1},Yt=(Ut=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+Ut.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return Ut=2047&++Ut,parseInt(n,2)}),jt=function(){var e=Et.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};!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(At||(At={})),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"}(wt||(wt={})),function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(bt||(bt={}));var Qt=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 Wt(e){var t=e.method||At.GET,n=e.timeout||r,i=e.headers,o=e.query,s=e.body,a=e.onProgress,u=H(e.url,o),c=Qt(),l="[object XDomainRequest]"===Object.prototype.toString.call(c);if(c.open(t,u),i&&c.setRequestHeader)for(var h in i)c.setRequestHeader(h,i[h]);return l?function(e,t,n){return new Promise((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)}))}(c,n,s):function(e,t,n,i){return new Promise((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)}))}(c,n,s,a)}var Jt,Xt,Zt=function(e,t,n){var i=null==n?void 0:n.isReverse;it(e)&&function(){for(var n in e)t(e[n],n,e)}(),($e(e)||Xe(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)}()},zt=function(e,t){return Zt(e,(function(n,i){e[i]=t(n,i)})),e},$t=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return Zt(e,(function(e,i){t===e&&(n=i)})),n},en=function(e,t){return-1!==$t(e,t)},tn=function(e,t){var n=[];return Zt(e,(function(e){n.push(e)})),-1!==$t(n,t)},nn=function(e){return JSON.parse(JSON.stringify(e))},rn=function(){return"undefined"!=typeof RCCppEngine},on=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},sn=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(sn(e[n]));else for(var n in t={},e)t[n]=sn(e[n]);else t=e;return t},an=function(e){var t;try{t=sn(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},un={_delayTime:0,setTime:function(e){var t=(new Date).getTime();un._delayTime=t-e},getTime:function(){var e=un._delayTime;return(new Date).getTime()-e}},cn=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 P(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return D(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===W.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}(),hn="rtcRJoin_data",dn="rtcRExit",gn="rtcRInfo",pn="rtcUData",fn="rtcUPut",_n="rtcUDel",En="rtcSetData",vn="userSetData",Tn="rtcQryData",yn="rtcDelData",mn="rtcToken",Cn="rtcUserState",In="rtcUList",Rn="viewerJoinR",Sn="viewerExitR",On="rtcPullKv",Mn="rtcIdentityChange",Nn="rtcInvite",Ln="rtcCancelInvite",Un="rtcInviteAnswer",An="rtcEndInvite",wn="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"}(Xt||(Xt={}));var bn=((Jt={})[Xt.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],Jt[Xt.RtcUserListOutput]=["users","token","sessionId","roomInfo"],Jt[Xt.SetUserStatusInput]=["status"],Jt[Xt.RtcSetDataInput]=["interior","target","key","value","objectName","content"],Jt[Xt.RtcUserSetDataInput]=["valueInfo","objectName","content"],Jt[Xt.RtcDataInput]=["interior","target","key","objectName","content"],Jt[Xt.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],Jt[Xt.MCFollowInput]=["state"],Jt[Xt.RtcTokenOutput]=["rtcToken"],Jt[Xt.RtcQryOutput]=["outInfo"],Jt[Xt.RtcQryUserOutDataInput]=["userId"],Jt[Xt.RtcUserOutDataOutput]=["user"],Jt[Xt.RtcQueryListInput]=["order"],Jt[Xt.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],Jt[Xt.RtcValueInfo]=["key","value"],Jt[Xt.RtcKeyDeleteInput]=["key"],Jt[Xt.RtcNotifyMsg]=["type","time","roomId"],Jt[Xt.RtcPullKV]=["timestamp","roomId"],Jt[Xt.RtcKVOutput]=["entries","bFullUpdate","syncTime"],Jt[Xt.RtcQueryUserJoinedInput]=["userId"],Jt[Xt.RtcQueryUserJoinedOutput]=["info"],Jt[Xt.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Jt[Xt.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Jt[Xt.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Jt[Xt.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Jt),Pn="\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(Xt.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(Xt.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(Xt.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(Xt.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(Xt.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Xt.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(Xt.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(Xt.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Xt.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(Xt.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Xt.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(Xt.RtcQryOutput,"{\n repeated ").concat(Xt.RtcValueInfo," outInfo=1;\n }\n message ").concat(Xt.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(Xt.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(Xt.RtcUserSetDataInput," {\n repeated ").concat(Xt.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Xt.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(Xt.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(Xt.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(Xt.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Xt.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(Xt.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Xt.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(Xt.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(Xt.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(Xt.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(Xt.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(Xt.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Xt.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(Xt.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(Xt.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(Xt.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"),Dn=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 P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode(Xt.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,On,!0,t)];case 1:return n=u.sent(),i=n.code,r=n.buffer,i!==W.SUCCESS?[2,{code:i}]:(o=this.rtcCodec.decode(Xt.RtcKVOutput,r),s=o.entries,a=o.syncTime,s=(s||[]).map((function(e){return b(b({},e),{timestamp:kt(e.timestamp)})})),this._watcher.onRTCDataChange(s,e),[2,{code:i,data:{kvEntries:s,syncTime:kt(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(Xt.RtcNotifyMsg,e),n=t.time,i=t.type,r=t.roomId;1===i&&this._rtcKVManager.pullEntry(r,kt(n))}},e.prototype.destroy=function(){},e}();function Vn(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=u[e])?i:(n=r(e,(0|e)<0?-1:0,!0),o&&(u[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:p;if(t){if(e<0)return f;if(e>=h)return y}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,u,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(e.substring(1),t,n).neg();for(s=i(c(n,8)),a=p,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(d=i(c(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,u,c,l,h,d,g,p,f,_,E,v,T,y,m,C;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=i,e.fromBits=r,c=Math.pow,e.fromString=o,e.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,g=n(16777216),p=n(0),e.ZERO=p,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,y=r(-1,-1,!0),e.MAX_UNSIGNED_VALUE=y,m=r(0,-2147483648,!1),e.MIN_VALUE=m,(C=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},C.toString=function(e){var t,n,r,o,s,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(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(c(e,6),this.unsigned),s=this,a="";;){if(u=s.div(o),l=(s.sub(u.mul(o)).toInt()>>>0).toString(e),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.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},C.isZero=function(){return 0===this.high&&0===this.low},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return 1==(1&this.low)},C.isEven=function(){return 0==(1&this.low)},C.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)},C.eq=C.equals,C.notEquals=function(e){return!this.eq(e)},C.neq=C.notEquals,C.lessThan=function(e){return this.comp(e)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(e){return this.comp(e)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(e){return this.comp(e)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(e){return this.comp(e)>=0},C.gte=C.greaterThanOrEqual,C.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},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(m)?m:this.not().add(_)},C.neg=C.negate,C.add=function(e){var n,i,o,a,u,c,l,h,d,g,p;return t(e)||(e=s(e)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,d=0,g=0,p=0,g+=(p+=a+(65535&e.low))>>>16,d+=(g+=o+l)>>>16,h+=(d+=i+c)>>>16,h+=n+u,r((g&=65535)<<16|(p&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},C.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},C.sub=C.subtract,C.multiply=function(e){var n,o,a,u,c,l,h,d,f,_,E,v;return this.isZero()?p:(t(e)||(e=s(e)),e.isZero()?p:this.eq(m)?e.isOdd()?m:p:e.eq(m)?this.isOdd()?m:p:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(g)&&e.lt(g)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,f=0,_=0,E=0,v=0,E+=(v+=u*(d=65535&e.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=u*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=u*l)>>>16,f+=n*d+o*h+a*l+u*c,r((E&=65535)<<16|(v&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},C.mul=C.multiply,C.divide=function(e){var n,r,o,a,u,l,h;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:p;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(p)?e.isNegative()?_:v:(r=this.sub(e.mul(n)),o=n.add(r.div(e)));if(e.eq(m))return this.unsigned?f:p;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=p}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=i(n)).mul(e);h.isNegative()||h.gt(r);)h=(l=i(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=_),o=o.add(l),r=r.sub(h)}return o},C.div=C.divide,C.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},C.mod=C.modulo,C.not=function(){return r(~this.low,~this.high,this.unsigned)},C.and=function(e){return t(e)||(e=s(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return t(e)||(e=s(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return t(e)||(e=s(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},C.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)},C.shl=C.shiftLeft,C.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)},C.shr=C.shiftRight,C.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))},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},C.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},C.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]},C.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,u=(1<<a)-1,c=u>>1,l=-7,h=n?r-1:0,d=n?-1:1,g=e[t+h];for(h+=d,o=g&(1<<-l)-1,g>>=-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-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,i),o-=c}return(g?-1:1)*s*Math.pow(2,o-i)}function r(e,t,n,i,r,o){var s,a,u,c=8*o-r-1,l=(1<<c)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,p=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,r),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;e[n+g]=255&a,g+=p,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;e[n+g]=255&s,g+=p,s/=256,c-=8);e[n+g-p]|=128*f}var o,s,a,u,c,l=function(e,t,n){if(void 0===e&&(e=l.DEFAULT_CAPACITY),void 0===t&&(t=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,i){var r,o,s,a,u,c;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(c=new l(r,n,i),s=0;a>s;)(o=(u=e[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=o);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,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,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(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 u?(this.offset=t,this):t-i},o.readBitSet=function(e){var t,n,i,r,o,s,a,u=void 0===e;for(u&&(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 u&&(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,u=void 0===n;if(u&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),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 u?(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,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,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),u?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var 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=c.calculateUTF16asUTF8(t(e))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,c.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,c.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=c.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,c.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=c.calculateUTF16asUTF8(t(e))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,c.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 c.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(e,t,i){var r,o,s,a,u;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(),c.decodeUTF8(function(){return e>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++s,c.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(u=i+e,c.decodeUTF8toUTF16(function(){return u>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);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=c.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),c.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)}},u=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 u.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 u.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,u=0,c=!1,h=!1,d=!1,g=!1,p=!1;o>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(h||d||g){p=!0;break}h=d=g=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(h||g){p=!0;break}h=g=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(h||d){p=!0;break}h=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(h){p=!0;break}h=!0}s.offset=u,c=!1;break;case"]":if(!n){if(g||d){p=!0;break}g=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(g){p=!0;break}g=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){p=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){p=!0;break}if(r=parseInt(i+e.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=r,c=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!g)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,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},c=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,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{c.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(c.calculateUTF16asUTF8(t(e),!0)[1],n,i),o=0;return c.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={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,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},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,o=function(e){this.tn=new u(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},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,u,c,l,h,d,g,p,f,_,E,v,T,y,m={},C=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},I=C.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=C,o=function(e,t,n,i,r){C.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(C.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 c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,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)},u=a.prototype,a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new i(0):t.defaultValue},u.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+")")},u.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)")},u.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},u.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")},u.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return i.fromBinary(t)}},u.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},m.Element=a,c=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=c.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,u,c,l,h,d,g;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 u=[],t.forEach((function(e,t){u[t]=r(e,n,o,s)})),u;if(u={},t instanceof e.Map){for(l=(c=t.entries()).next();!l.done;l=c.next())u[t.keyElem.valueToString(l.value[0])]=r(l.value[1],n,o,t.valueElem.resolvedType);return u}for(g in h=t.$type,d=void 0,t)t.hasOwnProperty(g)&&(u[g]=h&&(d=h.getChild(g))?r(t[g],n,o,d.resolvedType):r(t[g],n,o));return u}var o,s,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var r,o,s,l;for(e.Builder.Message.call(this),r=0,o=u.length;o>r;++r)this[u[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 c)||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=c.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}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,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))},c.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}},c.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}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),c}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof f||o instanceof c||o instanceof 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 c.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof c.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},l.encode=function(e,t,n){var i,r,o,s,a,u=null;for(o=0,s=this._fields.length;s>o;++o)r=e[(i=this._fields[o]).name],i.required&&null===r?null===u&&(u=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,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,u,c,l,h,d,g,p,f,_;for(n="number"==typeof n?n:-1,c=t.offset,l=new this.clazz;t.offset<c+n||-1===n&&t.remaining()>0;){if(a=(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(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(s,t)):u.map?(d=u.decode(s,t),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(s,t),u.oneof&&(null!==(g=l[u.oneof.name])&&g!==u.name&&(l[g]=null),l[u.oneof.name]=u.name));else switch(s){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM: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(p=0,f=this._fields.length;f>p;++p)if(null===l[(u=this._fields[p]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,_;e.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},m.Message=c,h=function(t,n,i,r,o,s,a,u,l,h){C.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=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(C.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,u,c;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],n);a=n.offset-s,(u=i.calculateVarint32(a))>1&&(c=n.slice(s,n.offset),s+=u-1,n.offset=s,n.append(c)),n.writeVarint32(a,s-u)}else for(o=0;o<t.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[o],n);else this.map?t.forEach((function(t,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,u,c,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(u=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((c=n.clone()).limit=c.offset+o,n.offset+=o;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(c,t,h)}return[u,r]}return this.element.decode(n,t,this.id)},m.Message.Field=h,g=function(e,t,n,i,r,o,s){h.call(this,e,t,n,null,i,r,o,s),this.extension},g.prototype=Object.create(h.prototype),m.Message.ExtensionField=g,p=function(e,t,n){C.call(this,e,t,n),this.fields=[]},m.Message.OneOf=p,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){C.call(this,e,t,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(C.prototype),m.Enum.Value=_,E=function(e,t,n,i){C.call(this,e,t,n),this.field=i},E.prototype=Object.create(C.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){C.call(this,e,t,n),this.className="Service.Method",this.options=i||{}},(T.prototype=Object.create(C.prototype)).buildOpt=s.buildOpt,m.Service.Method=T,y=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},y.prototype=Object.create(T.prototype),m.Service.RPCMethod=y,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,u;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),u=[],o.enums&&o.enums.forEach((function(e){u.push(e)})),o.messages&&o.messages.forEach((function(e){u.push(e)})),o.services&&o.services.forEach((function(e){u.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),u.length>0){i.push(t),t=u,u=null,this.ptr=s,s=null;continue}u=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,u,c,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,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=s+d+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&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 Gn,kn,Bn,xn=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=Vn(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(he.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(he.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(!it(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.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"}(Gn||(Gn={})),function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA"}(Bn||(Bn={}));var Fn=((kn={})[Bn.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:Gn.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"]},kn[Bn.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:Gn.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="]},kn[Bn.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:Gn.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="]},kn);function Hn(e){return e>=Bn.BJ&&e<=3?e:Bn.BJ}Gn.HTTPS;var qn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Kn(e){var t,n,i,r,o,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=qn.indexOf(e.charAt(u++))<<2|(r=qn.indexOf(e.charAt(u++)))>>4,n=(15&r)<<4|(o=qn.indexOf(e.charAt(u++)))>>2,i=(3&o)<<6|(s=qn.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a}function Yn(e,t){return/^https?:/.test(e)?e:t===Gn.HTTP?"http://".concat(e):"https://".concat(e)}var jn=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e){var t,n=this.initOption||{},i=n.areaCode,r=n.navigators,o=(t=i,void 0===t&&(t=Bn.BJ),Fn[Hn(t)].naviUrlBase64).map((function(e){return Kn(e)})),s=e.split("@")[1],a=s?s.split(";"):[],u=r&&r.length>0?V(V([],a,!0),r,!0):V(V([],a,!0),o,!0);return u.filter((function(e,t){return u.indexOf(e)===t})).map((function(e){return Yn(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,c=(n=a,void 0===n&&(n=Bn.BJ),Fn[Hn(n)].logUrlBase64).map((function(e){return b(b({},e),{addr:Kn(e.addr)})})),l=[],h={level:1,itv:6,times:5};if(r)l.push.apply(l,r.addrs),Object.assign(h,r.policy);else if(o)try{var d=JSON.parse(o);l.push({addr:d.url,protocol:Gn.HTTPS,weight:1}),h.level=d.level,h.itv=d.itv,h.times=d.times}catch(n){t.warn(he.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var g=u?V([{addr:u,protocol:Gn.HTTPS,weight:101}],l,!0):V(V([],l,!0),c,!0);return{policy:h,addrs:g.filter((function(e,t){return g.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return b(b({},e),{addr:Yn(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=Bn.BJ),Fn[Hn(t)].miniCmpBase64).map((function(e){return Kn(e)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i:n},e}(),Qn=new jn,Wn=Lt(),Jn=Date.now(),Xn=null,Zn="RC_LOGS",zn="RC_CONF",$n=null,ei=function(e){return P(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,Xn];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(Zn,"readwrite").objectStore(Zn),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(),$n=setTimeout((function(){return ei(e)}),6e5),[2]}}))}))},ti=function(e,t,n,i){void 0===i&&(i=168),Xn||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==on(n).type?Xn=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(he.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(he.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(he.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(he.L_LOGDB_ABORT_S,e.target.error)},ei(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(Zn)&&t.deleteObjectStore(Zn);var n=t.createObjectStore(Zn,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(zn,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(he.L_UNSUPPORT_INDEXDB_O))},ni=function(){return P(void 0,void 0,void 0,(function(){var e;return D(this,(function(t){switch(t.label){case 0:return Xn?($n&&(clearTimeout($n),$n=null),[4,Xn]):[2];case 1:return(e=t.sent())&&e.db.close(),Xn=null,[2]}}))}))},ii=[],ri=!1,oi=function(e){return P(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return ri||0===ii.length?[2]:(ri=!0,t=ii.splice(0),[4,new Promise((function(n){var i=e.transaction(Zn,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(Zn);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(),ri=!1,setTimeout((function(){return oi(e)})),[2]}}))}))};function si(e){return P(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,Xn];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(zn,"readonly").objectStore(zn).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 ai,ui=0,ci=function(){return{setTimestamp4RealtimeLog:function(e){ui=e},getTimestamp4RealtimeLog:function(){return ui},getLogs:function(e,t,n,i){return P(this,void 0,void 0,(function(){var r;return D(this,(function(o){switch(o.label){case 0:return[4,Xn];case 1:return(r=o.sent())?[2,new Promise((function(o){var s=r.db.transaction(Zn,"readonly").objectStore(Zn),a=[],u=IDBKeyRange.bound(e,t),c=s.index("time").openCursor(u);c.onsuccess=function(e){var t=e.target.result;if(t){var r=t.value;r.level<=n&&(i?r.sessionId===Wn:r.level>=0)&&a.push(r),t.continue()}else o({dbReady:!0,logs:a})},c.onerror=function(e){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},li="REPORT_SESSION",hi=function(e,t){return P(void 0,void 0,void 0,(function(){var n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return n="".concat(li,"_").concat(e),[4,si("".concat(li,"_").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){P(this,void 0,void 0,(function(){var n,i;return D(this,(function(r){switch(r.label){case 0:return[4,Xn];case 1:return(n=r.sent())?(i=n.db,i.transaction(zn,"readwrite").objectStore(zn).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"}(ai||(ai={}));var di=function(e){return[ai.DEBUG,ai.INFO,ai.WARN,ai.ERROR].some((function(t){return t===e}))},gi=0,pi=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=ai.WARN,this.debug=this._log.bind(this,ai.DEBUG),this.info=this._log.bind(this,ai.INFO),this.warn=this._log.bind(this,ai.WARN),this.error=this._log.bind(this,ai.ERROR),this.__statistics=this._log.bind(this,ai.STATISTICS)}return e.prototype._stdout=function(e,t,n,i,r){if(!(e<=ai.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){di(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!==ai.DEBUG&&this.flush({time:+r,sessionId:Wn,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})):this._stdout(ai.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),t,i)},e.prototype.createTraceId=function(){return"".concat(++gi)},e.prototype.getSessionId=function(){return Wn},e}(),fi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t.prototype.flush=function(e){!function(e){P(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,Xn];case 1:return(t=n.sent())?(ii.push(e),oi(t.db),[2]):[2]}}))}))}(e)},t}(pi),_i=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}return e.prototype.checkStart=function(e){return P(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=Qn.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype.realtimeReport=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d,g,p,f=this;return D(this,(function(_){switch(_.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||Jn,o=Math.max(i-5e3,r),s=this.logger.createTraceId(),this.logger.debug(he.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:t}),s),[4,this.logDB.getLogs(r,o,t,!0)];case 1:return a=_.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(he.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return c.length>0?(this.logger.info(he.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressLogs(c)]):[3,5];case 3:return l=_.sent(),h=l.success,d=l.data,h||this.logger.warn(he.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(he.L_REALTIME_LOG_O,"compress done",s),g=at(e)?e:"https://".concat(e),g+="?version=".concat("5.8.2","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:d,method:"POST"})];case 4:p=_.sent().status,this.logger.info(he.L_REALTIME_LOG_R,JSON.stringify({status:p}),s),200===p&&this.logDB.setTimestamp4RealtimeLog(c[c.length-1].time+1),_.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){return f.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,o){return P(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.logger.createTraceId(),this.logger.info(he.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:o}),s),[4,this.logDB.getLogs(e,t,ai.DEBUG,!1)]);case 1:return a=_.sent(),u=a.dbReady,c=a.logs,this.logger.info(he.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),l=at(i)?i:"https://".concat(i),l+="?version=".concat("5.8.2","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressLogs(c)]:[3,3]:[3,5];case 2:return d=_.sent(),g=d.success,p=d.data,h=g?p:"compress failed",[3,4];case 3:h="no data",_.label=4;case 4:return[3,6];case 5:h="no database",_.label=6;case 6:return this.logger.debug(he.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:l,body:h,method:"POST"})];case 7:return f=_.sent().status,this.logger.info(he.L_REPORT_FULL_LOG_R,JSON.stringify({status:f}),s),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Ei=48,vi=64,Ti=80,yi=96,mi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ci=mi.length,Ii=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=Si(e.length),n=String.fromCharCode(Ti|t.length);r.push(n+t)}else{var i=String.fromCharCode(yi|e.length);r.push(i)}r.push(e)}},a=0;a<e.length;){var u=Ri(t,e,a);if(u.length<2)o.push(e.charAt(a++));else if(u.length<4)o.push(e.substr(a,u.length)),a+=u.length;else{var c=Si(a-u.offset),l=Si(u.length);if(c.length+l.length>=u.length)o.push(e.substr(a,u.length)),a+=u.length;else{s();var h=String.fromCharCode(vi|c.length<<2|l.length);r.push(h+c+l),a+=u.length}}}s();var d=Si(e.length),g=String.fromCharCode(Ei|d.length);return r.push(g+d),r.join("")},Ri=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 u=r[s],c=n-u;if(!(c>238327)){var l=Math.min(o,c);if(l<=i.length)break;if(!(i.length>2&&t.charAt(u+i.length-1)!==t.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&t.charAt(u+d)===t.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=u)}}}return i},Si=function(e){var t=[],n=0;do{n=e%Ci,t.push(mi.charAt(n)),e=(e-n)/Ci}while(e>0);return t.join("")},Oi=function(e){var t="RCDeviceId",n=N(e),i="",r=n.get(t);return r?i=r:(i=Lt(),n.set(t,i)),i},Mi=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"}},Ni=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Li=function(e){function t(t,n,i,r){var o=this,s=Oi(n),a=Mi(n),u="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=e.call(this,t,s,u,ci(),i)||this).runtime=n,o.clientReportLevel=r,di(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return w(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return P(this,void 0,void 0,(function(){return D(this,(function(n){switch(n.label){case 0:return[4,hi(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,{success:!0,data:Ii(e.map(Ni).join(""))}]}))}))},t.prototype.isReporter=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),P(void 0,void 0,void 0,(function(){var e,i,r;return D(this,(function(o){switch(o.label){case 0:return[4,si("".concat(li,"_").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 P(this,void 0,void 0,(function(){return D(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 P(this,void 0,void 0,(function(){return D(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(_i),Ui=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(e,t,n){return void 0===t&&(t=Date.now()-Ui),void 0===n&&(n=Date.now()),P(this,void 0,void 0,(function(){var i,r;return D(this,(function(o){switch(o.label){case 0:return t=t<0?Date.now()+t:t,(n=n<=0?Date.now():n)-t>Ui&&(t=n-Ui),(i=new fi(e,"RC-IM","IM")).debug(he.T,"get logs: startTime ".concat(t," endTime ").concat(n)),ti(e,i,{tag:"browser"}),[4,ci().getLogs(t,n,ai.DEBUG,!1)];case 1:return r=o.sent().logs,i.debug(he.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,u=e.content;return"".concat(t,",").concat(n,",").concat(i,",").concat(r,",").concat(o,",").concat(s,",").concat(a,',"').concat(u,'"\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 Ai,wi,bi,Pi,Di,Vi,Gi,ki=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 P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.8.2"},e.prototype.getAPIVersion=function(){return"5.8.2"},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}(),Bi="pgMsgP",xi="chatMsg",Fi="pcMsgP",Hi="pbMsgP",qi={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Ki="delMsg",Yi="joinChrm",ji="joinChrmR",Qi="exitChrm",Wi="setKV",Ji="delKV",Xi="setKVS",Zi="delKVS",zi="qryRelationR",$i="delRelation",er="setSeAtt",tr={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},nr="reqCall",ir="pullKvMsg",rr="qryPMsg",or="qryGMsg",sr="qryCHMsg",ar="qryCMsg",ur="qrySMsg",cr=((Ai={})["ppMsgP"]=X.PRIVATE,Ai[Bi]=X.GROUP,Ai[xi]=X.CHATROOM,Ai[Fi]=X.CUSTOMER_SERVICE,Ai[Hi]=X.SYSTEM,Ai),lr=((wi={})[X.PRIVATE]=rr,wi[X.GROUP]=or,wi[X.CHATROOM]=sr,wi[X.CUSTOMER_SERVICE]=ar,wi[X.SYSTEM]=ur,wi),hr=((bi={})[X.PRIVATE]=tr.PRIVATE,bi[X.GROUP]=tr.GROUP,bi[X.ULTRA_GROUP]=tr.ULTRA_GROUP,bi[X.CUSTOMER_SERVICE]=tr.CUSTOMER_SERVICE,bi[X.SYSTEM]=tr.SYSTEM,bi),dr="1",gr="0",pr=1,fr=2,_r=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"}(Pi||(Pi={})),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"}(Di||(Di={})),function(e){e.PUB="pub",e.QUERY="qry"}(Vi||(Vi={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Gi||(Gi={}));var Er,vr=function(){function e(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=Pi.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Pi.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}(),Tr=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(Xe(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}(),yr=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 Tr.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),mr=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=Tr.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),Cr=function(e,t){return e&&t?"".concat(t,"_").concat(e):e||Date.now()},Ir=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 Cr(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}(),Rr=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new vr(e,!1,Pi.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Cr(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 mr;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),Sr=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 w(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===Gi.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(he.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:i}},t.MESSAGE_LENGTH=2,t}(Ir),Or=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return w(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}(Ir),Mr=function(e){function t(){return e.call(this,Di.PING_REQ)||this}return w(t,e),t.prototype.writeMessage=function(e){},t}(Rr),Nr=function(e){function t(t){return e.call(this,t)||this}return w(t,e),t}(Ir),Lr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return w(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}(Ir),Ur=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(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}(Rr),Ar=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Vi.PUB,t}return w(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}(Lr),wr=function(e){function t(t,n,i){var r=e.call(this,Di.PUBLISH)||this;return r.syncMsg=!1,r.identifier=Vi.PUB,r.topic=t,r.data=Xe(n)?Tr.writeUTF(n):n,r.targetId=i,r}return w(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}(Ur),br=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=Vi.PUB,t.topic="",t.targetId="",t}return w(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}(Lr),Pr=function(e){function t(t){var n=e.call(this,Di.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return w(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Ur),Dr=function(e){function t(t,n,i){var r=e.call(this,Di.QUERY)||this;return r.identifier=Vi.QUERY,r.topic=t,r.data=Xe(n)?Tr.writeUTF(n):n,r.targetId=i,r}return w(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}(Ur),Vr=function(e){function t(t){var n=e.call(this,Di.QUERY_CONFIRM)||this;return n.messageId=t,n}return w(t,e),t}(Ur),Gr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=Vi.QUERY,t.topic="",t.targetId="",t}return w(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}(Lr),kr=function(e,t,n){var i=new Uint8Array(t),r=new yr(i),o=r.readByte(),s=function(e,t){var n,i=e.type;switch(i){case Di.CONN_ACK:n=new Sr(e);break;case Di.PUBLISH:(n=new Ar(e)).syncMsg=e.syncMsg;break;case Di.PUB_ACK:n=new br(e);break;case Di.QUERY_ACK:n=new Gr(e);break;case Di.SUB_ACK:case Di.UNSUB_ACK:case Di.PING_RESP:n=new Nr(e);break;case Di.DISCONNECT:n=new Or(e);break;default:n=new Ir(e),t.error(he.O,"No support for deserializing ".concat(i," messages"))}return n}(new vr(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.pgMsgS=23]="pgMsgS",e[e.chatMsgS=24]="chatMsgS",e[e.qrySessionsAtt=25]="qrySessionsAtt",e[e.pullMsg=26]="pullMsg",e[e.qrySessions=27]="qrySessions",e[e.delSessions=28]="delSessions",e[e.delMsg=29]="delMsg",e[e.updRRTime=30]="updRRTime",e[e.chrmPull=31]="chrmPull",e[e.joinChrm=32]="joinChrm",e[e.joinChrmR=33]="joinChrmR",e[e.exitChrm=34]="exitChrm",e[e.queryChrmI=35]="queryChrmI",e[e.setKV=36]="setKV",e[e.delKV=37]="delKV",e[e.pullKV=38]="pullKV",e[e.qryRelation=39]="qryRelation",e[e.delRelation=40]="delRelation",e[e.pullSeAtts=41]="pullSeAtts",e[e.setSeAtt=42]="setSeAtt",e[e.qnTkn=43]="qnTkn",e[e.qnUrl=44]="qnUrl",e[e.aliUrl=45]="aliUrl",e[e.s3Url=46]="s3Url",e[e.stcUrl=47]="stcUrl",e[e.minioUrl=48]="minioUrl",e[e.cleanPMsg=49]="cleanPMsg",e[e.cleanGMsg=50]="cleanGMsg",e[e.cleanCMsg=51]="cleanCMsg",e[e.cleanSMsg=52]="cleanSMsg",e[e.rtcPing=53]="rtcPing",e[e.rtc_ntf=54]="rtc_ntf",e[e.rtcSetOutData=55]="rtcSetOutData",e[e.rtcQryUserOutData=56]="rtcQryUserOutData",e[e.addSeTag=57]="addSeTag",e[e.delSeTag=58]="delSeTag",e[e.addTag=59]="addTag",e[e.delTag=60]="delTag",e[e.disTag=61]="disTag",e[e.reportsdk=62]="reportsdk",e[e.pullUgSes=63]="pullUgSes",e[e.pullUgMsg=64]="pullUgMsg",e[e.ugMsg=65]="ugMsg",e[e.qryUgMsg=66]="qryUgMsg",e[e.updUgRTime=67]="updUgRTime",e[e.upMsgEx=68]="upMsgEx",e[e.modifyMsg=69]="modifyMsg",e[e.qryMsgChange=70]="qryMsgChange",e[e.qryMsg=71]="qryMsg",e[e.operate=72]="operate",e[e.s_opNtf=73]="s_opNtf",e[e.ugUnpushQuery=74]="ugUnpushQuery",e[e.ugUnpushSet=75]="ugUnpushSet",e[e.setRtcRoomId=76]="setRtcRoomId",e[e.qryUgUal=77]="qryUgUal",e[e.s_pubCall=78]="s_pubCall"}(Er||(Er={}));var Br=Er,xr="outbox",Fr="inbox",Hr="broadcastbox",qr=function(e,t,n){return[e,t,n].join("_")},Kr=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=qr(Fr,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=qr(Fr,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||ot(e))){n.broadcastSyncTime=e;var i=qr(Hr,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=qr(Hr,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=qr(xr,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=qr(xr,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),Yr={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},jr=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===pe.DELETE,u=s===o,c=!this._isExisted(n),l=a?this._remove:this._add;(t||r||u||c)&&l.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,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}(),Qr=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return P(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return D(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=Yr.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===W.SUCCESS?(Yr.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Yr.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];ut(i)||(i=new jr(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}(),Wr=function(){function e(e,t,n,i,r){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=i,this.logger=r,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){this.logger.error(he.O,"parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],ut(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},e.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},e}(),Jr="converStatusChanged",Xr=function(){function e(e,t,n){this._eventEmitter=new ft,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n),this._oldStorage=N(e.runtime),this._storage=new U(e.runtime,this._storagePullTimeKey),this._appkey=t,this._currentUserId=n,this._engine=e,this.adaptOldStatus()}return e.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(he.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},e.prototype._set=function(e){var t=this;if(!ot(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(Jr,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return P(this,void 0,void 0,(function(){var e,t,n,i;return D(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=r.sent(),n=t.code,i=t.data,n===W.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(Jr,(function(t){e(t)}))},e.prototype.setConversationUpdatedTime=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t},e.prototype.getConversationUpdatedTime=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),Zr={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},zr={};for(var $r in Zr){var eo=Zr[$r].keyName;zr[eo]=$r}var to,no=function(){function e(e,t,n,i){this._appkey=t,this._currentUserId=n,this.logger=i;var r="con-".concat(t,"-").concat(n);this.storage=new U(e,r),this._localStore=new U(e,"CONVER-".concat(t,"-").concat(n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),i=t.shift(),r=t.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:X.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===X.GROUP&&((n.userIdList||[]).forEach((function(e){e===i._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===se.ALL&&t.indexOf(a)<0&&t.push(a));if(o===ee.RECALL&&r===X.GROUP){var u=t.indexOf(a);u>=0&&t.splice(u,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,i=e.content,r=e.channelId,o=i.mentionedInfo;if(o){var s=this._getStoreKey(t,n,r),a=this._localStore.get(s)||{},u=zr.mentionedInfo,c=zr.hasMentioned,l=a[u]||{},h=l.userIdList||[];o={userIdList:h=this._updateMentionedUserList(e,h,o),type:(null==o?void 0:o.type)||l.type},0!==h.length?(a[u]=o,a[c]=!0):(delete a[u],delete a[c]),ut(a)?this._localStore.set(s,a):this._localStore.remove(s)}},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=zr[s],u=n[s];if(!ot(a)&&!ot(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===Zr[a].defaultVal||"tags"===s&&!ut(u)?delete o[a]:o[a]=this._setLocal(s,u),o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}var c=Object.keys(o);1===c.length&&c.includes("st")&&delete o.st,ut(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 Zr){var a=Zr[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||nn(c)}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(Zr[a]){var u=Zr[a],c=u.keyName,l=u.defaultVal;o[c]=s[a]||nn(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 c=Zr[u],l=c.keyName,h=c.defaultVal;s[l]=a[u]||nn(h)}for(var d in s.tags){ot(t[d])&&(t[d]=[]);var g=b(b({},s),{conversationType:r,targetId:o});delete g.tags,t[d].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(he.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}(),io=[X.PRIVATE,X.GROUP,X.SYSTEM,X.PUBLIC_SERVICE,X.APP_PUBLIC_SERVICE],ro={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},oo=1e3,so=function(){function e(e,t,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new ft,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new no(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new Xr(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(ro.CHANGED,(function(e){i(e)})),this._eventEmitter.on(ro.CON_TAG_STATUS_CHANGED,(function(){r()}));var s=this._store.getValue();s.length>oo&&(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(oo,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,u=s===j.SEND&&a===this._loginUserId,c=i===ee.RECALL,l=it(n),h=!1,d={},g=t.lastUnreadTime,p=t.lastReadTime,f=t.unreadMessageCount;if(g>r||u)return{hasChanged:h,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=f+1,t.lastUnreadTime=r,h=!0),c&&l){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),E=this._calcMsg(_,g,p,n),v=E.isNotRead,T=E.isNotRepeadRecallSendTime;v&&f&&T&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:t.unreadMessageCount||0,time:r}),{hasChanged:h,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,i=e.messageDirection,r=e.isMentioned,o=e.sentTime,s=i===j.SEND,a=it(n),u=!1,c={};return!s&&r&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:o},c.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,i=e.messageDirection,r=!1;if(e.isMentioned&&i===j.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===se.ALL||(a||[]).includes(this._loginUserId)){r=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}if((a||[]).includes(this._loginUserId)){r=!0;u=t.unreadMentionedMeCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:r,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(it(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,u=e.tags,c=e.channelId,l={},h={};if(n!==X.ULTRA_GROUP){ot(o)||(h.notificationStatus={time:r,val:o}),ot(s)||(h.notificationLevel={time:r,val:s}),ot(a)||(h.isTop={time:r,val:a}),ot(u)||(h.tags={time:r,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,i,l,c);var d=this._store.get(n,i,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,i,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},c),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:c}),t&&this._notifyConversationChanged()}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(ro.CHANGED,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(ro.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(io.indexOf(i)>=0){var u=!1,c=this._store.get(i,o,s),l={};if(c.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,c),r=i.hasChanged,o=i.localConversation,s=i.updateItems;u=u||r,l=b(b({},l),s),c=nn(o)})),this._store.set(i,o,c,s),this._store.updateMentionedData(e),r){var h=this._store.get(i,o,s);h.updatedItems=b({latestMessage:{time:e.sentTime,val:e}},l),h.latestMessage=e;var d=Object.assign(h,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(d)}(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!==ne.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,u=i.conversationType,c=i.unreadMentionedCount;e.includes(u)&&(0===t.length||t.includes(a))&&(r+=(n?c: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){void 0===i&&(i=!0);var r=this._store.get(e,t,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=r.unreadMessageCount,s=r.hasMentioned,a={};if(o&&(r.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,r,n),i&&0!==Object.keys(a).length){var u=Object.assign(r,{conversationType:e,targetId:t,channelId:n,updatedItems:a});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===ne.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){return(this._store.getValue()||{}).filter((function(n){return e.includes(n.conversationType)&&(ot(t)||t===n.channelId)&&n.isTop})).map((function(e){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,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},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){return(this._store.getValue()||{}).filter((function(t){return e.includes(t.conversationType)&&t.unreadMessageCount&&t.unreadMessageCount>0})).map((function(e){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,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e.prototype.setConversationUpdatedTime=function(e){return this._statusManager.setConversationUpdatedTime(e)},e.prototype.getConversationUpdatedTime=function(){return this._statusManager.getConversationUpdatedTime()},e}(),ao=function(){function e(e,t,n,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(t,"-").concat(n),this._storagePullTimeKey="us-s-".concat(t,"-").concat(n),this._storage=N(e.runtime),this._engine=e,this._tagWatcherFunc=i}return e.prototype._updateTag=function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,i=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:i}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.deleteTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))},e.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return P(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=u.sent(),n=t.code,i=t.data,n!==W.SUCCESS||ot(i)?(this._isPulling=!1,this._startPull()):(o=(r=i).settings,s=r.version,a=o.Tag,ot(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),uo=function(e){return e.replace(/@.+$/,"@")},co=function(){function e(e,t,n){this.appkey=e,this.logger=t,this.statisticLog=n,this.crtRequest=null}return e.prototype.request=function(e,t,n,i,r){return P(this,void 0,void 0,(function(){var o,s,a;return D(this,(function(u){switch(u.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=u.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},e.prototype.sendRequest=function(e,t,n,r,o){return P(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return s=uo(e),!t&&(a=this.getNaviCache(s))&&(u=a.timestamp,c=a.naviInfo,n||Date.now()-u<i)?(this.logger.info(he.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),r),l={bid:jt(),ptc:Ge.NAVI,cod:W.SUCCESS,net:null==o?void 0:o.type,dur:0,spr:0,pr:c.type||0,hos:"",cache:ke.LOCAL,v:Be.CURRENT,rsn:null==o?void 0:o.reason,cid:"".concat(null==o?void 0:o.uuid,"_").concat(null==o?void 0:o.retryCount),count:null==o?void 0:o.retryCount},this.statisticLog.__statistics(de.IM_NAVI,JSON.stringify(l),r),[2,{code:W.SUCCESS,data:c}]):(h=Qn.getNaviUrlList(e),this.logger.info(he.L_GET_NAVI_T,JSON.stringify({token:e,uris:h}),r),[4,this.requestHandler(h,e,r,o)]);case 1:return d=_.sent(),g=d.code,p=d.data,g!==W.SUCCESS?(this.logger.warn(he.L_GET_NAVI_R,g,r),[2,{code:g}]):(f=p,this.logger.info(he.L_GET_NAVI_R,JSON.stringify({naviInfo:f}),r),this.setNaviCache(s,f),[2,{code:g,data:f}])}}))}))},e.prototype.requestHandler=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:r=0,o=e.length,g.label=1;case 1:return r<o?(s=r===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,e[r],this.appkey,t,n,s)]):[3,4];case 2:if(c=g.sent(),l=c.code,h=c.data,d={bid:jt(),ptc:Ge.NAVI,cod:l,net:null==i?void 0:i.type,dur:Date.now()-u,spr:0,pr:(null==h?void 0:h.type)||0,hos:e[r],cache:ke.REQUEST,v:Be.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.__statistics(de.IM_NAVI,JSON.stringify(d),n),l===W.SUCCESS)return[2,{code:l,data:h}];g.label=3;case 3:return r+=1,[3,1];case 4:return[2,{code:W.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return W.RC_CONN_TOKEN_INCORRECT;case 416:return W.RC_LICENSE_EXPIRED;default:return W.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(uo(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(uo(e),b(b({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,i=e.token,r=e.platform,s=e.protocol;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var a="token=".concat(encodeURIComponent(i),"&version=").concat("5.8.2","&platfrom=").concat(r);return{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(s,";rtc=4;log=2")},body:a,url:t,timeout:o}},e.prototype.useV2Navi=function(){return!0},e}(),lo=function(e){return["navi",e].join("_")},ho={},go=function(e){function t(t,n,i,r){var o=e.call(this,t,n,i)||this;return o.runtime=r,o}return w(t,e),t.prototype.httpRequest=function(e,t,n,i,r){return P(this,void 0,void 0,(function(){var s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return s="".concat(e,"/navi.js?appId=").concat(t,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(S,"&r=").concat(Date.now()),this.logger.debug(he.L_REQUEST_T,"req navi => ".concat(s),i),[4,this.runtime.httpReq({url:s,timeout:o,dataType:"text"})];case 1:if(200!==(a=l.sent()).status)return this.logger.debug(he.L_REQUEST_R,"request navi failed: ".concat(a.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:Qn.getMiniCmpUrlList().join(",")},[2,{code:W.SUCCESS,data:c}]):[2,{code:this.transHttpCode(a.status)}];try{return 0===(u=a.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(u=JSON.parse('"'.concat(u,'"'))),(c=JSON.parse(u)).protocol=/^https/.test(s)?"https":"http",this.runtime.useNavi||(c.server="",c.backupServer=Qn.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,{code:W.SUCCESS,data:c}]}catch(e){this.logger.error(he.L_PARSE_NAVI_E,a.data,i)}return[2,{code:W.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.httpRequestV2=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return r=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:this.runtime.tag,protocol:(/^https/.test(e)?Gn.WSS:Gn.WS).toString()}),this.logger.debug(he.L_REQUEST_T,"req navi => ".concat(r.url),i),[4,this.runtime.httpReq(r)];case 1:if(200!==(o=c.sent()).status)return this.logger.debug(he.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,u=Qn.getMiniCmpUrlList(),a.serverAddr=u.map((function(e,t){return{addr:e,protocol:/^https/.test(r.url)?Gn.WSS:Gn.WS,weight:u.length-t}}))),[2,{code:W.SUCCESS,data:a}]}catch(e){this.logger.error(he.L_PARSE_NAVI_E,o.data,i)}return[2,{code:W.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){if(ho[e])return ho[e];var t,n=lo(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 ho[e]=o,o},t.prototype.setNaviCache=function(e,t){var n,r=lo(this.appkey),o=this.runtime.localStorage;try{var s=o.getItem(r);n=s?JSON.parse(s):[]}catch(e){n=[]}var a=Date.now();n.length>0&&(n=n.filter((function(t){return a-t.timestamp<i&&e!==t.token})));var u={timestamp:a,naviInfo:t,token:e};n.push(u),o.setItem(r,JSON.stringify(n)),ho[e]=u},t}(co),po=function(e,t){return["send_msg",e,t].join("_")},fo=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=po(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=po(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=po(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}();(to={})[X.PRIVATE]=Br.qryPMsg,to[X.GROUP]=Br.qryGMsg,to[X.CHATROOM]=Br.qryCHMsg,to[X.CUSTOMER_SERVICE]=Br.qryCMsg,to[X.SYSTEM]=Br.qrySMsg;var _o=[Br[Br.recallMsg],Br[Br.ppMsgS],Br[Br.pgMsgS],Br[Br.ppMsgP],Br[Br.pgMsgP],Br[Br.chatMsg],Br[Br.pcMsgP],Br[Br.prMsgS],Br[Br.updUgRTime],Br[Br.pbMsgP]],Eo=function(){function e(e,t,n){this.ULTRA_GROUP_CONVERSATION="ultragroupconversation";var i="".concat(this.ULTRA_GROUP_CONVERSATION,"-").concat(t,"-").concat(n);this._localStore=new U(e,i)}return e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=To[s],u=n[s];if(!ot(a)&&!ot(u))u===vo[a].defaultVal?delete o[a]:o[a]=u}ut(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 vo){var a=vo[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||nn(c)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),vo={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},To={};for(var yo in vo){var mo=vo[yo].keyName;To[mo]=yo}var Co,Io=function(){function e(e,t,n){this._store=new Eo(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===X.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}(),Ro="UpStreamMessage",So="PushExtra",Oo="DownStreamMessage",Mo="DownStreamMessages",No="SessionsAttQryInput",Lo="SessionsAttOutput",Uo="SyncRequestMsg",Ao="ChrmPullMsg",wo="NotifyMsg",bo="HistoryMsgInput",Po="HistoryMsgOuput",Do="RelationQryInput",Vo="RelationsOutput",Go="UnreadMsgInfo",ko="DeleteSessionsInput",Bo="SessionInfo",xo="DeleteSessionsOutput",Fo="RelationsInput",Ho="DeleteMsgInput",qo="CleanHisMsgInput",Ko="SessionMsgReadInput",Yo="ChrmInput",jo="ChrmOutput",Qo="QueryChatRoomInfoInput",Wo="QueryChatRoomInfoOutput",Jo="GetQNupTokenInput",Xo="GetQNupTokenOutput",Zo="GetQNdownloadUrlInput",zo="GetDownloadUrlInput",$o="GetQNdownloadUrlOutput",es="GetDownloadUrlOutput",ts="ChrmKVEntity",ns="SetChrmKV",is="SetChrmKVS",rs="DeleteChrmKVS",os="ChrmKVOutput",ss="ChrmKVSOutput",as="ChrmKVSVersionEntity",us="ChrmKVSOutputEntity",cs="QueryChrmKV",ls="SetUserSettingInput",hs="SetUserSettingOutput",ds="PullUserSettingInput",gs="PullUserSettingOutput",ps="UserSettingNotification",fs="SessionReq",_s="SessionStates",Es="SessionState",vs="SessionStateItem",Ts="SessionStateModifyReq",ys="SessionStateModifyResp",ms="GroupUnpushQuery",Cs="GroupUnpushSet",Is="QryRemindListReq",Rs="QryRemindListResp",Ss="GroupUnpushResult",Os="GrpReadReceiptMsg",Ms="GrpReadReceiptQryReq",Ns="GrpReadReceiptQryResp",Ls="GrpMsgReadUser",Us="SessionTagAddInput",As="SessionTagItem",ws="SessionTagDelInput",bs="SessionDisTagReq",Ps="ReportSDKInput",Ds="ReportSDKOutput",Vs="UltraGrpPullSes",Gs="UltraGrpPullMsg",ks="MsgChangeReq",Bs="QueryMsgChange",xs="MsgChange",Fs="MsgChangeList",Hs="MsgQuery",qs="MessageQueryInfo",Ks="MsgQueryAck",Ys="OperateStatus",js="OperateStatusNotify",Qs="OperateInfo",Ws="OperateSummary",Js="SetRtcRoomIdInput",Xs="SetRtcRoomIdOutput",Zs="CallInfoUpStream",zs="CallInfoDownStream",$s="KvInput",ea="KvOutput";(Co={})[Ro]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],Co[Mo]=["list","syncTime","finished","broadcastSyncTime"],Co[Oo]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Co[So]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Co[No]=["nothing"],Co[Lo]=["inboxTime","sendboxTime","totalUnreadCount"],Co[Uo]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Co[Ao]=["syncTime","count"],Co[wo]=["type","time","chrmId"],Co[bo]=["targetId","time","count","order","busChannel"],Co[Po]=["list","syncTime","hasMsg"],Co[Do]=["type","count","startTime","order"],Co[Vo]=["info","isFinished"],Co[Go]=["msgId","msgTime","remindType","className"],Co[ko]=["sessions"],Co[Bo]=["type","channelId","busChannel"],Co[xo]=["nothing"],Co[Fo]=["type","msg","count","busChannel","startTime","endTime"],Co[Ho]=["type","conversationId","msgs","busChannel"],Co[qo]=["targetId","dataTime","conversationType","busChannel"],Co[Ko]=["type","msgTime","channelId","busChannel"],Co[Yo]=["nothing"],Co[jo]=["nothing","sessionId","joinTime"],Co[Qo]=["count","order"],Co[Wo]=["userTotalNums","userInfos"],Co[Jo]=["type","key","httpMethod","queryString"],Co[Zo]=["type","key","fileName"],Co[zo]=["type","key","fileName"],Co[Xo]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Co[$o]=["downloadUrl"],Co[es]=["downloadUrl"],Co[ts]=["key","value","status","timestamp","uid","version"],Co[ns]=["entry","bNotify","notification","type"],Co[is]=["entry","bNotify","notification","type"],Co[rs]=["entry","bNotify","notification","type"],Co[os]=["entries","bFullUpdate","syncTime"],Co[ss]=["timestamp","errorKeys","keysVersion"],Co[as]=["version","key"],Co[us]=["key","errorCode"],Co[cs]=["timestamp"],Co[ls]=["version","value"],Co[hs]=["version","reserve"],Co[ds]=["version","reserve"],Co[gs]=["items","version"],Co.UserSettingItem=["targetId","type","key","value","version","status","tags"],Co[fs]=["time"],Co[_s]=["version","state"],Co[Es]=["type","channelId","time","stateItem","busChannel"],Co[vs]=["sessionStateType","value","tags"],Co[Ts]=["version","state"],Co[ys]=["version"],Co[Cs]=["busChannel","unpushLevel"],Co[Is]=["groupId","busChannel","msgTime","size"],Co[ms]=["busChannel"],Co[Ss]=["groupId","busChannel","unpushLevel"],Co[Os]=["msgId","busChannel"],Co[Ms]=["msgId","busChannel"],Co[Ns]=["totalMemberNum","list"],Co[Ls]=["readTime","userId"],Co[Us]=["version","tags"],Co[As]=["tagId","name","createdTime","isTop"],Co[ws]=["version","tags"],Co[bs]=["tagId"],Co[ps]=["version","reserve"],Co[Ps]=["sdkInfo"],Co[Ds]=["nothing"],Co[Vs]=["syncTime","isEraseMsgContent"],Co[Gs]=["syncTime"],Co[ks]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Co[Bs]=["syncTime"],Co[Fs]=["list","syncTime","hasNext"],Co[xs]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],Co[Hs]=["targetId","type","query"],Co[qs]=["msgTime","msgUID","busChannel"],Co[Ks]=["list"],Co[Ys]=["targetId","type","opType","busChannel"],Co[js]=["type","notifyType","info","summary"],Co[Qs]=["targetId","busChannel","userId","opType","optime"],Co[Ws]=["targetId","busChannel","count","opType"],Co[Js]=["rtcRoomId"],Co[Xs]=["nothing"];var ta,na,ia,ra,oa="\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(wo," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Uo," {\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(Ro," {\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(So," {\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(Mo," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(Oo," {\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(K.IMAGE,";\n audio = ").concat(K.AUDIO,";\n video = ").concat(K.VIDEO,";\n file = ").concat(K.FILE,";\n sight = ").concat(K.SIGHT,";\n html = ").concat(K.COMBINE_HTML,";\n }\n message ").concat(Jo," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(Zo," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(zo," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Xo," {\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 message ").concat($o," {\n required string downloadUrl = 1;\n }\n message ").concat(es," {\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(Yo," {\n required int32 nothing = 1;\n }\n message ").concat(jo," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(Ao," {\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(Do,"\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(Fo,"\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(Vo,"\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(Go," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(Go," //未读消息摘要信息\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(Is," // 新增 查询未读@列表入参\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(Rs," //查询未读@列表出参\n {\n repeated ").concat(Go," 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(qo,"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message ").concat(Qo,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Wo,"\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(bo,"\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(Po,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(No,"{\n required int32 nothing = 1;\n }\n message ").concat(Lo,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Ko,"\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(ko,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(Bo,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(xo,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Ho,"\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(ns," {\n required 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 entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(os," {\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(us,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(cs," {\n required int64 timestamp = 1;\n }\n message ").concat(ls," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(hs," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(ds," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(gs," {\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(fs," {\n required int64 time = 1;\n }\n message ").concat(_s," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Es," {\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(vs," {\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(Ts," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(ms," {\n optional string busChannel = 1;\n }\n message ").concat(Cs,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(Ss," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(ys," {\n required int64 version=1;\n }\n message ").concat(Os," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Ms," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Ns," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Ls," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Us," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(As," {\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(bs," {\n repeated string tagId=1;\n }\n message ").concat(ps," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Ps,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Ds,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Vs,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Gs,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(ks,"\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(Bs," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Fs," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(xs," //变更详情\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(Hs," //请求\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(Ks," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(Ys," //客户端发送\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(js," //服务端发送\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(Qs," {\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(Ws," {\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(Js,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(Xs,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(Zs,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat(zs,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat($s,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(ea,"\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}\n"),sa=function(e,t,n,i,r,o){var s=r?Object.keys(r).map((function(t){return e.encode(Xt.RtcValueInfo,{key:t,value:r[t]},!0)})):void 0,a=o?Object.keys(o).map((function(t){return e.encode(Xt.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(Xt.RtcInput,{roomType:t,broadcastType:n,joinType:i,innerDatas:s,outerDatas:a})},aa=function(e,t){var n=e.decode(Xt.RtcUserListOutput,t),i=n.users,r=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return Zt(i,(function(e){var t=e.userId,n=e.userData,i={};Zt(n,(function(e){var t=e.key,n=e.value;i[t]=n})),c[t]=i})),{users:c,token:r,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:u}};!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"}(ta||(ta={})),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"}(na||(na={}));var ua,ca=((ia={})[na.OTHER_DEVICE_LOGIN]=W.RC_DISCONN_KICK,ia[na.BLOCK]=W.RC_DISCONN_EXCEPTION,ia[na.BLOCK_NEW]=W.RC_DISCONN_EXCEPTION,ia[na.REDIRECT_NEW]=W.RC_CONN_REDIRECTED,ia[na.TOKEN_EXPIRED]=W.RC_CONN_TOKEN_EXPIRED,ia[na.ILLEGAL_PROTOCOL_VERSION]=W.RC_CONN_PROTO_VERSION_ERROR,ia[na.ACCOUNT_CANCELLATION]=W.RC_ACCOUNT_CANCELLATION,ia),la=((ra={})[ta.ACCEPTED]=W.SUCCESS,ra[ta.UNACCEPTABLE_PROTOCOL_VERSION]=W.RC_CONN_PROTO_VERSION_ERROR,ra[ta.IDENTIFIER_REJECTED]=W.RC_CONN_IDENTIFIER_REJECTED,ra[ta.SERVER_UNAVAILABLE]=W.RC_CONN_SERVER_UNAVAILABLE,ra[ta.TOKEN_INCORRECT]=W.RC_CONN_TOKEN_INCORRECT,ra[ta.NOT_AUTHORIZED]=W.RC_CONN_NOT_AUTHRORIZED,ra[ta.REDIRECT]=W.RC_CONN_REDIRECTED,ra[ta.PACKAGE_ERROR]=W.RC_CONN_PACKAGE_NAME_INVALID,ra[ta.APP_BLOCK_OR_DELETE]=W.RC_CONN_APP_BLOCKED_OR_DELETED,ra[ta.BLOCK]=W.RC_CONN_USER_BLOCKED,ra[ta.TOKEN_EXPIRE]=W.RC_CONN_TOKEN_EXPIRED,ra[ta.DEVICE_ERROR]=W.RC_CONN_DEVICE_ERROR,ra[ta.HOSTNAME_ERROR]=W.RC_CONN_HOSTNAME_ERROR,ra[ta.HASOHTERSAMECLIENTONLINE]=W.RC_DISCONN_SAME_CLIENT_ON_LINE,ra[ta.OUT_OF_LIMIT]=W.RC_LISCENSE_COUNT_OUT_OF_LIMIT,ra[ta.IN_OTHER_CLUSTER]=W.RC_CONN_WRONG_CLUSTER,ra[ta.APP_AUTH_NOT_PASS]=W.RC_APP_AUTH_NOT_PASS,ra[ta.OTP_USED]=W.RC_OTP_USED,ra[ta.PLATFORM_ERROR]=W.RC_PLATFORM_ERROR,ra[ta.ACCOUNT_CANCELLATION]=W.RC_ACCOUNT_CANCELLATION,ra[ta.LICENSE_EXPIRED]=W.RC_LICENSE_EXPIRED,ra),ha=function(e){return e===W.RC_CONN_REDIRECTED},da=function(e){return Object.keys(ca).some((function(t){return ca[t]===e}))},ga=function(e){return Object.keys(la).some((function(t){return la[t]===e}))};!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ua||(ua={}));var pa,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:wt.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 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!==ua.CONNECTED&&e!==ua.CONNECTING){var n={bid:jt(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.__statistics(de.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case ua.CONNECTED:this.logger.info(he.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case ua.CONNECTING:this.logger.warn(he.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onConnecting();break;case ua.SUSPENDED:this.logger.warn(he.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),ha(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(he.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.__statistics(de.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 P(this,void 0,void 0,(function(){var r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._crtConnectionStatus===ua.CONNECTED?[2,{code:W.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(ua.CONNECTING),r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:Fe.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(de.IM_STATS_CS,JSON.stringify(r),i),[4,this.try2Connect(e,t,!1,i)]);case 1:return o=u.sent(),s=o.code,a=o.data,s!==W.SUCCESS?(this.setConnectionStatus(ua.DISCONNECTED,s),[2,{code:s}]):(this.setConnectionStatus(ua.CONNECTED),[2,{code:s,data:a}])}}))}))},e.prototype.try2Connect=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s;return D(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 P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.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=d.sent(),s=o.code,a=o.data,s!==W.SUCCESS?[2,{code:s}]:1===(u=a).type?[2,{code:W.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(he.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),i),[4,this.connectWithToken(e.replace(/@.+$/,"@"),u,t,i)]);case 2:return c=d.sent(),l=c.code,h=c.data,ha(l)?(this.logger.warn(he.L_CONNECT_R,"redirect code: ".concat(l),i),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,i)]):[W.RC_TCP_RESET,W.RC_CONN_ACK_TIMEOUT,W.RC_TCP_DISCONNECTED_NO_RMTP].includes(l)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(he.L_CONNECT_R,"cmp ack timeout, code: ".concat(l),i),this.setConnectionStatus(ua.SUSPENDED,l),this.setConnectionStatus(ua.CONNECTING),[2,this.createConnectionTask(e,t,!1,i)]):l!==W.SUCCESS?(this.logger.warn(he.L_CONNECT_R,"code: ".concat(l),i),[2,{code:l}]):(this.logger.info(he.L_CONNECT_R,"userId: ".concat(h),i),this._connectDurSwitch=!0,this._crtUserId=h,[2,{code:l,data:h}])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case W.TIMEOUT:return void(this.reason=Fe.TIMEOUT);case W.RC_CONN_REDIRECTED:return void(this.reason=Fe.REDIRECTED);default:this.reason=Fe.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r=this;return D(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(he.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),i=function(){return P(r,void 0,void 0,(function(){var r,o;return D(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==ua.SUSPENDED?[2]:(this.setConnectionStatus(ua.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.__statistics(de.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===W.SUCCESS?(this.setConnectionStatus(ua.CONNECTED),[2]):[W.SERVER_UNAVAILABLE,W.TIMEOUT,W.RC_SOCKET_DISCONNECTED,W.RC_SOCKET_NOT_CREATED,W.RC_CONN_ACK_TIMEOUT,W.RC_TCP_RESET,W.RC_NAVI_REQ_FAILED,W.RC_NETWORK_DOWN].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]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return ha(e)?(this.setConnectionStatus(ua.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===W.RC_UDP_DISCONNECTED?(this.setConnectionStatus(ua.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(ua.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(ua.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return P(this,void 0,void 0,(function(){var e,t,n=this;return D(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==ua.CONNECTED?(this._failedCount=0,this.logger.debug(he.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(he.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=i.sent())===W.SUCCESS?(this.logger.info(he.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==ua.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(he.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(he.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(ua.SUSPENDED,W.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,W.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return P(this,void 0,void 0,(function(){return D(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(ua.DISCONNECTED,2),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 V([],this.cmpWeightCache,!0);var n=e.server,i=e.backupServer,r=e.serverAddr,o=e.protocol,s=e.openTLS;if(r)return this.cmpWeightCache=V([],r,!0),V([],r,!0);var a=[],u=[];return n&&u.push(n),null==i||i.split(",").forEach((function(e){u.indexOf(e)<0&&u.push(e)})),u.forEach((function(e,i){var r;r=t?1===s?Gn.TLS:Gn.RMTP:"http"===o?Gn.WS:Gn.WSS,a.push({addr:e,protocol:r,weight:n.length-i,race:!1})})),this.cmpWeightCache=a,V([],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===Gn.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}(),_a=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=Vn(oa);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=et(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var i,r=this,o=e,s=((i={})[Mo]=r._formatSyncMessages,i[Oo]=r._formatReceivedMessage,i[Ro]=r._formatSentMessage,i[Po]=r._formatHistoryMessages,i[Vo]=r._formatConversationList,i[Wo]=r._formatChatRoomInfos,i[os]=r._formatChatRoomKVList,i[gs]=r._formatUserSetting,i[_s]=r._formatConversationStatus,i[Ns]=r._formatGrpReadReceiptQryResp,i[hs]=r._formatSetUserSettingOutput,i[ps]=r._formatUserSettingNotification,i[Fs]=r._formatUltraMsgChangeList,i[js]=r._formatUltraOperateStatusNotifyList,i[Ks]=r._formatUltraMsgList,i[Rs]=r._formatUltraGroupUnreadMentionedList,i[jo]=r._formatChrmKVVersion,i[ea]=r._formatCallKVInfo,i[zs]=r._fromatCallInfoDownStream,i)[t];try{o=e.length>0&&r._codec[t].decode(e),it(o)&&(o=function(e){for(var t in e)it(e[t])&&(e[t]=kt(e[t]));return e}(o)),rt(s)&&(o=s.call(this,o,n))}catch(e){this.logger.error(he.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=et(n)?new Uint8Array(n):n;return Tr.readUTF(r.subarray(t,i))}catch(e){this.logger.error(he.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(he.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(ot(o)||null===o)&&(e.finished=!0),e.syncTime=kt(r),e.list=zt(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 Zt(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=Ht(t,i.pushConfigs,i.pushId)),b(b({},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){if(!e)return e;var i=this,r=t||{},o=r.currentUserId,s=r.connectedTime,a=e.content,u=e.fromUserId,c=e.type,l=e.groupId,h=e.status,d=e.dataTime,g=e.extraContent,p=e.configFlag,f=e.extStatus,_=e.clientUniqueId,E=e.busChannel,v=e.msgId,T=e.classname,y=e.direction||j.RECEIVE,m=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)}}(h),C=m.isPersited,I=m.isCounted,R=m.isMentioned,S=m.disableNotification,O=m.receivedStatus,M=m.canIncludeExpansion,N=!!(2&(f||0)),L=!!(4&(f||0)),U=!!(8&(f||0))?Ue.PRIVATE:Ue.PUBLIC,A=[X.GROUP,X.CHATROOM,X.RTC_ROOM,X.ULTRA_GROUP].indexOf(c)>-1?l:u,w=u,b=j.RECEIVE;y===j.SEND&&(w=o,b=j.SEND);var P=kt(d),D=P<s,V=c===X.CHATROOM,G=i._setExpansion(g),k=i._formatBytes(a);k=i._getUtfContent(k);var B=i._setPushConfig(e,this.logger);V&&u===o&&(b=j.SEND);var x={conversationType:c,targetId:A,senderUserId:w,messageType:T,messageUId:v,isPersited:C,isCounted:I,isMentioned:R,sentTime:P,messageDirection:b,receivedTime:un.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:M,content:k,expansion:G,configFlag:p,pushConfig:B,channelId:E||"",isInterrupt:N,isModifyMessage:L,messageId:kt(_)||0,sentStatus:ye.SENT};return c!==X.ULTRA_GROUP?(x.isOffLineMessage=D,x):(x.channelType=U,x)},e.prototype._formatSentMessage=function(e,t){var n=this,i=e.content,r=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=e.extStatus,d=e.clientUniqueId,g=e.systemId,p=t.signal,f=t.currentUserId,_=p.date,E=p.topic,v=p.targetId,T=!!(2&(h||0)),y=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),m=y.isPersited,C=y.isCounted,I=y.disableNotification,R=y.canIncludeExpansion,S=cr[E]||X.PRIVATE,O=tn(qi,E),M=n._formatBytes(i),N=g||v;r===ee.RECALL&&(S=M.conversationType||S,N=M.targetId||v);var L=n._setExpansion(a),U=n._setPushConfig(e,this.logger),A=b(b({},U),{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!l&&Boolean(4&l),forceShowDetailContent:!!l&&Boolean(8&l),templateId:null==u?void 0:u.templateId});return{conversationType:S,targetId:N,messageType:r,messageUId:s,isPersited:m,isCounted:C,isStatusMessage:O,senderUserId:f,content:n._formatBytes(i),sentTime:1e3*_,receivedTime:un.getTime(),messageDirection:j.SEND,isOffLineMessage:!1,disableNotification:I,canIncludeExpansion:R,expansion:L,pushConfig:A,channelId:e.busChannel||"",isInterrupt:T,messageId:kt(d)||0}},e.prototype._formatHistoryMessages=function(e,t){var n=this,i=t.conversation||{},r=e.list,o=e.hasMsg,s=i.targetId,a=kt(e.syncTime),u=[];return Zt(r,(function(e){var r=n._formatReceivedMessage(e,t);i.conversationType===X.ULTRA_GROUP?r.targetId=e.groupId||i.targetId:r.targetId=s,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,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,u=e.isAdmin,c=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,g=e.busChannelType,p=e.remindType;return{targetId:t,conversationType:n,changeType:r,messageUId:o,changeTime:kt(i),sendTime:kt(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:g,mentionedType:p}})),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),u=1==(1&n);return u&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.userId,r=e.opType,s=e.optime,a=kt(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:u,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:kt(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=kt(n)||0,e.unreadMessageCount=this._getUnreadCount(kt(i)||0),e.unreadMentionedCount=this._getUnreadCount(kt(r)||0),e.unreadMentionedMeCount=this._getUnreadCount(kt(a)||0),e.channelType=o||Ue.PUBLIC,e.lastReadTime=0,s&&(e.firstUnreadMessage={sentTime:kt(s.msgTime)},e.lastReadTime=kt(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=zt(r,(function(e){var r=e.msg,s=e.userId,a=e.type,u=e.unreadCount,c=e.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,t)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:kt(u)||0,latestMessage:l||{},channelId:c||""};return a===X.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==o?void 0:o(h))||h})))||[]};return((null==t?void 0:t.conversationType)||X.NONE)===X.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:zt(n,(function(e){var t=e.id,n=e.time;return{id:t,time:kt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return t=zt(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?pe.DELETE:pe.UPDATE}}(i);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:kt(r),version:kt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:i}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,i=e.version,r={};return Zt(n||[],(function(e){var n=e.key,i=e.version,o=e.value;e.version=kt(i),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=kt(e.createdTime),e.tagName=e.name})),r[n]=e})),{settings:r,version:i}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return Zt(t,(function(e){var t=e.type,i=e.channelId,r=e.time,o=e.stateItem,s=e.busChannel,a=ne.CLOSE,u=re.NOT_SET,c=!1,l=[];Zt(o,(function(e){var t=e.sessionStateType,n=e.value,i=e.tags;switch(t){case pr:a=n===dr?ne.OPEN:ne.CLOSE,u=Number(n)||re.NOT_SET;break;case fr:c=n===dr;break;case _r:l=i}})),n.push({conversationType:t,type:t,targetId:i,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:kt(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=kt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:kt(e.joinTime)}}))},e.prototype._formatCallKVInfo=function(e){return e},e.prototype._fromatCallInfoDownStream=function(e){return e},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(No);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||se.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(So);if(t&&s.setTitle(t),n||i){var a=Ft(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,u=t.expansion,c=t.pushConfig,l=t.channelId,h=t.pushData,d=void 0===h?"":h,g=t.mentionedUserIdList,p=void 0===g?[]:g,f=t.pushContent,_=void 0===f?"":f,E=t.messageId,v=void 0===E?0:E,T=e.conversationType,y=e.targetId,m=this._codec.getModule(Ro),C=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=c||{},R=I.pushContent,S=void 0===R?_:R,O=I.pushData,M=void 0===O?d:O;m.setSessionId(C),i&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,p,r)),S&&m.setPushText(S),M&&m.setAppData(M),s&&m.setUserId(s);var N=this._calculateFlag(t);if(m.setConfigFlag(N),m.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),m.setContent(JSON.stringify(o)),a&&u){var L={};Zt(u,(function(e,t){L[t]={v:e}})),m.setExtraContent(JSON.stringify(L))}if(c){var U=this._getPushExtraModule(c);m.setPushExt(U)}return m.setClientUniqueId(v),ot(l)||m.setBusChannel(l),T===X.SYSTEM&&m.setSystemId(y),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(Uo);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(Ao);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(bo);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(Gs);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,i=this._codec.getModule(Do);return i.setType(1),i.setCount(t),i.setStartTime(n),i.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,i=e.startTime,r=e.order;t=t||0,i=i||0,r=r||0;var o=this._codec.getModule(Do);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(Fo);return i.setType(t),n&&i.setBusChannel([n]),i.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(ko),i=[];return Zt(e,(function(e){var n=e.conversationType,r=e.targetId,o=t._codec.getModule(Bo);o.setType(n),o.setChannelId(r),i.push(o)})),n.setSessions(i),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,i){var r=this._codec.getModule(Ho),o=[];return Zt(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(o),r.setBusChannel(i),r.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,i){var r=this._codec.getModule(qo);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,i=e.targetId,r=e.channelId,o=t.timestamp,s=this._codec.getModule(Ko);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,u={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},c=this._codec.getModule(ks);return c.setFromUserId(t),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.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,u=this._codec.getModule(ks);return u.setFromUserId(t),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(Bs);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(Hs),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(Is);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(Ys);return r.setTargetId(e),r.setType(t),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(Yo);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Qo);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(Cs);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(ms);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,i){var r=this._codec.getModule(Jo);return r.setType(e),r.setKey(t),r.setHttpMethod(n),r.setQueryString(i),r.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,i){var r=this._codec.getModule(e);return r.setType(t),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var i=this._codec.getModule(ns),r=t.key,o=t.value,s=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||pe.UPDATE,h=cn(t,l),d={key:r,value:o||"",uid:n,version:c};if(ot(h)||(d.status=h),i.setEntry(d),a){var g={conversationType:X.CHATROOM,targetId:e},p={key:r,value:o,extra:s,type:l},f=this._getUpMsgModule(g,{messageType:ee.CHRM_KV_NOTIFY,content:p,isPersited:!1,isCounted:!1});i.setNotification(f),i.setBNotify(!0),i.setType(X.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var i=this._codec.getModule(is),r=t.entries,o=t.type||pe.UPDATE,s=cn(t,o),a=[];return r.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};ot(s)||(t.status=s),a.push(t)})),i.setEntry(a),i.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(cs);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(ds);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(fs);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,i=this._codec.getModule(Ts),r=un.getTime(),o=[];return Zt(e,(function(e){var t=n._codec.getModule(Es),i=e.conversationType,s=e.targetId,a=e.notificationStatus,u=e.isTop,c=e.channelId,l=e.notificationLevel,h=[];t.setType(i),t.setChannelId(s),t.setTime(r),t.setBusChannel(c);var d=a===ne.OPEN,g={};ot(a)||(g[pr]=d),ot(l)||(g[pr]=l),ot(u)||(g[fr]=u),Zt(g,(function(e,t){if(!ot(e)){var i=n._codec.getModule(vs);e=e?dr:gr,ot(l)||Number(t)!==pr||(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(Os);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,i=this._codec.getModule(Us),r=[];return e.forEach((function(e){var t=n._codec.getModule(As);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(Os);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,i=this._codec.getModule(ws),r=[];return e.forEach((function(e){var t=n._codec.getModule(As);t.setTagId(e),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(bs);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,i=this._codec.getModule(Ts),r=[];return t.forEach((function(t){var i=n._codec.getModule(Es),o=n._codec.getModule(vs),s=[];e.forEach((function(e){var t=n._codec.getModule(As);t.setTagId(e.tagId),ot(e.isTop)||t.setIsTop(e.isTop),s.push(t)})),o.setSessionStateType(_r),o.setValue(JSON.stringify(s)),o.setTags(s),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([o]),r.push(i)})),i.setState(r),i.setVersion(un.getTime()),i.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Ps);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(Vs);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(Js);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e.prototype.encodeSetCallInfo=function(e,t){var n=this._codec.getModule(Zs);return n.setKey(e),n.setDataContent(t),n.getArrayData()},e.prototype.encodePullKVMsg=function(e){var t=this._codec.getModule($s);return t.setSyncTime(e),t.getArrayData()},e}(),Ea=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 _a(a.logger),a}return w(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.connectWithToken=function(e,t,n,i){return P(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.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(he.L_NAVI_CONF_E,"no service available",i),[2,{code:W.SERVER_UNAVAILABLE}];a=1===n?Gi.V4:Gi.V3,u=function(t){var n,o,u,l,h,d,g,p,f,_,E;return D(this,(function(v){switch(v.label){case 0:return n=s[t],o=n.protocol,u=n.addr,l=n.weight,h=function(e,t,n,i,r,o,s){var a=Mi(r),u=a.type,c=a.version,l="browser"===r.tag?"|".concat(u,"|").concat(c):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(S,"&pid=").concat(o,"&apiVer=").concat(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l)).concat(r.connectPlatform?"&platform=".concat(r.connectPlatform):"").concat(h)}(o===Gn.WS?"ws":"wss",u,c.appkey,e,c.runtime,"",a),d=Date.now(),[4,c.connectWebSocket(h,a,i)];case 1:return g=v.sent(),p=g.code,f=g.data,_=c.cmpWeightCache.findIndex((function(e){return e.addr===u})),E={bid:jt(),ptc:Ge.WS,cod:p,net:c.getNetwork().type,dur:Date.now()-d,spr:0,pr:r||0,hos:u,idx:_,rct:c.retryCount?xe.RECONNECT:xe.CONNECT,cid:"".concat(c.uuid,"_").concat(c.retryCount),v:Be.CURRENT,rsn:c.reason,count:c.retryCount,weight:l},c.statisticLog.__statistics(de.IM_WEBSOCKET,JSON.stringify(E),i),p===W.RC_SOCKET_DISCONNECTED||p===W.TIMEOUT?[2,"continue"]:p!==W.SUCCESS?[2,{value:{code:p}}]:(c._localConnectedTime=Math.floor((Date.now()+d)/2),c._socket=f.socket,c.updateCmpWeight(s[t].addr,!0),c.curCmpUrl=s[t].addr,[2,{value:{code:p,data:f.userId}}])}}))},c=this,l=0,d.label=1;case 1:return l<s.length?[5,u(l)]:[3,4];case 2:if("object"==typeof(h=d.sent()))return[2,h.value];d.label=3;case 3:return l+=1,[3,1];case 4:return[2,{code:W.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return P(this,void 0,void 0,(function(){var i=this;return D(this,(function(r){return this.logger.info(he.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(he.T,"connect timeout: ".concat(e),n),r({code:W.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),i.logger.info(he.T,"socket open",n)})),o.onMessage((function(e){if(i._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var s,a=kr(i.logger,e,t);if(a instanceof Sr){var u=a.status;if(u!==ta.ACCEPTED)return i.logger.info(he.T,"connect failed: ".concat(u),n),void r({code:(s=u,la[s])});i.logger.info(he.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=c,i._idCount=h,void r({code:W.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof Or){var d=a.status;return i.logger.info(he.T,"recv disconnect signal -> status: ".concat(d)),void i.onRecvDisconnect(d,o)}i._onReceiveSignal(a)}}else i.logger.warn(he.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:o.id}))})),o.onClose((function(){i.logger.info(he.T,"socket close",n);var e=W.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(o,e)})),o.onError((function(e){i.logger.info(he.T,"socket error",n);var t=W.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(o,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==Pi.AT_MOST_ONCE&&(e instanceof Ar&&!e.syncMsg&&(this.logger.debug(he.O,"send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Pr(t))),e instanceof Gr&&(this.logger.debug(he.O,"send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Vr(t))))},t.prototype._publishReader=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o=this;return D(this,(function(s){switch(s.label){case 0:return n=e.syncMsg,i=e.topic,this.logger.debug(he.O,"recv PublishReader -> messageId: ".concat(t," ").concat(i)),i===vn?[2]:!n||function(e){return[Br.ppMsgS,Br.pgMsgS,Br.chatMsgS].map((function(e){return Br[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 P(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){switch(r.label){case 0:return t=e.messageId,e instanceof Nr&&this._pingResolve?(this._pingResolve(W.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(e,t),t>0&&(e instanceof br||e instanceof Gr)&&(this.logger.debug(he.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 Ar?[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 ca[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(W.RC_SOCKET_DISCONNECTED)}},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n(W.TIMEOUT)}),e),t.sendOnly(new Mr)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof wr||e instanceof Dr)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),P(this,void 0,void 0,(function(){var r,o,s,a,u=this;return D(this,(function(c){switch(c.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){u._messageIds[r]=e,setTimeout((function(){u._messageIds[r]&&delete u._messageIds[r],e()}),i)}))]):[2,{code:W.RC_NET_CHANNEL_INVALID}];case 1:return(o=c.sent())?o instanceof Gr||o instanceof br?(s=t&&o.data&&[W.SUCCESS,W.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(he.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:W.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(he.O,"send timeout -> message: ".concat(r,", respPBName: ").concat(t,", timeout: ").concat(i)),[2,{code:W.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"}(pa||(pa={}));var va=null,Ta="RC_CONF",ya="RC_STATISTICS",ma=null,Ca=function(e){return P(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(ya,"readwrite").objectStore(ya),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(),ma=setTimeout((function(){return Ca(e)}),6e5),[2]}}))}))},Ia=function(e,t,n){void 0===n&&(n=168),va||("undefined"!=typeof window&&window&&window.indexedDB?va=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(he.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(he.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(he.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(he.L_LOGDB_ABORT_S,e.target.error)},Ca(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(ya)&&t.deleteObjectStore(ya);var n=t.createObjectStore(ya,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Ta,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(he.L_UNSUPPORT_INDEXDB_O))},Ra=function(){return P(void 0,void 0,void 0,(function(){var e;return D(this,(function(t){switch(t.label){case 0:return va?(ma&&(clearTimeout(ma),ma=null),[4,va]):[2];case 1:return(e=t.sent())&&e.db.close(),va=null,[2]}}))}))};function Sa(e){return P(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(Ta,"readonly").objectStore(Ta).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 Oa="REPORT_SESSION",Ma=function(e,t){return P(void 0,void 0,void 0,(function(){var n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return n="".concat(Oa,"_").concat(e),[4,Sa("".concat(Oa,"_").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){P(this,void 0,void 0,(function(){var n,i;return D(this,(function(r){switch(r.label){case 0:return[4,va];case 1:return(n=r.sent())?(i=n.db,i.transaction(Ta,"readwrite").objectStore(Ta).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},Na=function(){return va},La=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Ua=Lt(),Aa=Date.now(),wa=0,ba=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.__statistics=this._writer.bind(this,pa.STATISTICS)}return e.prototype._writer=function(e,t,n,i){var r=new Date;/^[\w-]+$/.test(t)&&this.flush({time:+r,sessionId:Ua,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})},e.prototype.createTraceId=function(){return"".concat(Ua,"-").concat(++wa)},e.prototype.getSessionId=function(){return Ua},e}(),Pa=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}return e.prototype.checkStart=function(e){return P(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=Qn.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype.realtimeReport=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d,g,p,f=this;return D(this,(function(_){switch(_.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||Aa,o=Math.max(i-5e3,r),s=this.reportClass.createTraceId(),this.logger.debug(he.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=_.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(he.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return c.length>0?(this.logger.info(he.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressStatistics(c)]):[3,5];case 3:return l=_.sent(),h=l.success,d=l.data,h||this.logger.warn(he.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(he.L_REALTIME_LOG_O,"compress done",s),g=at(e)?e:"https://".concat(e),g+="?version=".concat("5.8.2","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:d,method:"POST"})];case 4:p=_.sent().status,this.logger.info(he.L_REALTIME_LOG_R,JSON.stringify({status:p}),s),200===p&&this.statisticDB.setTimestamp4RealtimeLog(c[c.length-1].time+1),_.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){return f.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,o){return P(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(he.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:o}),s),[4,this.statisticDB.getStatistics(e,t,pa.STATISTICS,!1)]);case 1:return a=_.sent(),u=a.dbReady,c=a.logs,this.logger.info(he.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),l=at(i)?i:"https://".concat(i),l+="?version=".concat("5.8.2","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressStatistics(c)]:[3,3]:[3,5];case 2:return d=_.sent(),g=d.success,p=d.data,h=g?p:"compress failed",[3,4];case 3:h="no data",_.label=4;case 4:return[3,6];case 5:h="no database",_.label=6;case 6:return this.logger.debug(he.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:l,body:h,method:"POST"})];case 7:return f=_.sent().status,this.logger.info(he.L_REPORT_FULL_LOG_R,JSON.stringify({status:f}),s),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Da="RC_STATISTICS",Va=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t.prototype.flush=function(e){xa(e)},t}(ba),Ga=!1,ka=[],Ba=function(e){return P(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return Ga||0===ka.length?[2]:(Ga=!0,t=ka.splice(0),[4,new Promise((function(n){var i=e.transaction(Da,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(Da);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(),Ga=!1,setTimeout((function(){return Ba(e)})),[2]}}))}))},xa=function(e){return P(void 0,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return[4,Na()];case 1:return(t=n.sent())?(ka.push(e),Ba(t.db),[2]):[2]}}))}))},Fa=0,Ha=function(){return{setTimestamp4RealtimeLog:function(e){Fa=e},getTimestamp4RealtimeLog:function(){return Fa},getStatistics:function(e,t){return P(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:return[4,Na()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(Da,"readonly").objectStore(Da),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:[]}]}}))}))}}},qa=function(e){function t(t,n,i,r){var o=this,s=Oi(n),a=Mi(n),u="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=e.call(this,t,s,u,Ha(),i,r)||this).runtime=n,o}return w(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return P(this,void 0,void 0,(function(){return D(this,(function(n){switch(n.label){case 0:return[4,Ma(t.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressStatistics=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,{success:!0,data:Ii(e.map(La).join(""))}]}))}))},t.prototype.isReporter=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.reportClass.getSessionId(),P(void 0,void 0,void 0,(function(){var e,i,r;return D(this,(function(o){switch(o.label){case 0:return[4,Sa("".concat(Oa,"_").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 P(this,void 0,void 0,(function(){return D(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 P(this,void 0,void 0,(function(){return D(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(Pa),Ka=function(e,t,i,r,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:j.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:ye.SENT}},Ya=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},ja=function(e){function t(t,n,i,r){var o=e.call(this,t,n,i,r,new fi(r.appkey,"RC-E","IM"),new Va(r.appkey,"RC-E","IM"))||this;o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o.currentUserId="",o._openCallPlus=!1,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,u=r.logExpireTime,c=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy;return o.logger.setOutputLevel(a),ti(s,o.logger,t,u),o.reporter=new Li(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new go(s,o.logger,o.statisticLog,t),Ia(s,o.logger,u),o.reporterStatistic=new qa(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new Kr(t,s),o._sendMessageStore=new fo(t,s),o._chrmEntryHandler=new Qr(o),o._connMgr=new Ea(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._watcher.onSuspend}),Qn.init({areaCode:l,navigators:c,logServerUrl:h,miniCMPProxy:d}),o}return w(t,e),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 Wr(this.runtime,this._appkey,this.currentUserId,e.joinMChrm,this.logger)),this._conversationManager||(this._conversationManager=new so(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new Io(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new ao(this,this._appkey,this.currentUserId,this._watcher.tag)),this._watcher.onConnected(),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.reporter.checkStart(e),this.reporterStatistic.checkStart(e)},t.prototype.onDisconnected=function(e){this._resetMemoryState(),this._watcher.onDisconnected(e)},t.prototype.createLogger=function(e,t){return new fi(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 P(this,void 0,void 0,(function(){return D(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(he.L_RECV_RMTP_O,i,r);var o=Br[i];if(o)switch(o){case Br.s_ntf:this._pullMsg(e);break;case Br.s_msg:this._receiveMsg(e);break;case Br.s_cmd:this._receiveStateNotify(e);break;case Br.s_us:this._receiveSettingNotify(e);break;case Br.rtc_ntf:this._receiveRtcKv(e.data);break;case Br.s_opNtf:this._pullOperateStatusNotify(e);break;case Br.s_pubCall:this._pubCallInfo(e)}else this.logger.error(he.L_RECV_RMTP_E,i,r)}},t.prototype._receiveStateNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,wo),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,ps).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,i=t.del,r=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:r,expansion:n}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:r,deletedKeys:i}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,Ko),i=n.channelId,r=n.busChannel,o=n.msgTime,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(an([s]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},t.prototype._receiveSyncMsg=function(e,t){if(_o.includes(e.topic))if(e.topic!==Br[Br.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(e.data,Ro,{currentUserId:this.currentUserId,signal:e});((n=this._handleMsgProperties(n)).conversationType!==X.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(he.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==ee.EXPANSION_NOTIFY?((n.messageType===ee.SYNC_READ_STATUS||n.messageType===ee.READ_RECEIPT&&n.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(n.conversationType,n.targetId,n.channelId),this._conversationManager.setConversationCacheByMessage(n,!0),this._batchMessage([n])):this._receiveMessageExpansion(n)))}else this._clearUltraGroupUnreadCount(e,t)},t.prototype._batchMessage=function(e){for(var t=this,n=[],i=[],r=e.length-1;r>=0;r-=1){var o=e[r];o.messageType!==ee.LOG_COMMAND||"rongcloudsystem"!==o.senderUserId?n.unshift(o):i.unshift(o)}this._watcher.batchMessage(n),0!==i.length&&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)}))},t.prototype._pubCallInfo=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,zs),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,wo),n=t.type,i=t.chrmId,r=t.time;if(this.logger.info(he.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._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 P(this,void 0,void 0,(function(){var e,t,n,i,r;return D(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new Dr(ir,e,this.currentUserId),[4,this._connMgr.send(t,ea)]):[2];case 1:return n=o.sent(),i=n.code,r=n.data,i===W.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()===ua.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._messageProcessor=function(e){var t=this,n=0,i=[],r=[];return e.forEach((function(e){if((i.push(e.messageUId),e.messageDirection===j.SEND)&&(n=Math.max(e.sentTime,n),t._sendMessageStore.getSendMessageMap()[e.messageUId]))return void t._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==ee.DELIVERED&&e.messageType!==ee.DELIVERED_MSG)if(e.messageType!==ee.EXPANSION_NOTIFY){if(e.messageType!==ee.SYNC_READ_STATUS||e.senderUserId===t.currentUserId){(e.messageType===ee.SYNC_READ_STATUS||e.messageType===ee.READ_RECEIPT&&e.senderUserId===t.currentUserId)&&t._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId);var o=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(o,!0),r.push(o)}}else t._receiveMessageExpansion(e)})),{newOutboxTime:n,messageUIds:i,messages:r}},t.prototype._syncMsg=function(){return P(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,u,c,l,h,d,g,p,f,_,E,v,T;return D(this,(function(y){switch(y.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 Dr(Br[Br.pullMsg],i,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(he.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o),[4,this._connMgr.send(r,Mo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=y.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),a!==W.SUCCESS||!u||ot(u.finished)||ot(u.list)||ot(u.syncTime)?(this.logger.warn(he.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(c=u.list,l=u.finished,h=u.syncTime,d=u.broadcastSyncTime,g=void 0===d?1:d,this.logger.info(he.L_PULL_MSG_R,JSON.stringify({syncTime:h,finished:l,messages:c.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),o),p=this._messageProcessor(c),f=p.newOutboxTime,_=p.messageUIds,E=p.messages,this._batchMessage(E),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._letterbox.setBroadcastSyncTime(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,v=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(T=this._pullQueue).push.apply(T,v),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(he.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:_.join(","),timestamp:this._latestSyncTimestamp,hasmore:!l,tmpPullQueue:v}),o),l?(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,Oo,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});if(t=this._handleMsgProperties(t),this.logger.info(he.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),t.messageType!==ee.DELIVERED&&t.messageType!==ee.DELIVERED_MSG){if(t.conversationType!==X.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}t.senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(t.messageUId,t.sentTime),t.isStatusMessage||t.senderUserId===this.currentUserId||this._letterbox.setInboxTime(t.sentTime,this.currentUserId),t.messageType!==ee.EXPANSION_NOTIFY?t.messageType===ee.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t])):this._receiveMessageExpansion(t)}}},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,c=i in E,l=i in this._customMessageType;if(n=c?b(b({},E[i]),{isStatusMessage:T.includes(i)}):l?this._customMessageType[i]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(e,n),t&&!ot(r)&&(e.isStatusMessage=r),!t){var h=e.content.user;if(h){var d=h.portrait,g=h.portraitUri,p=d||g;p&&(h.portrait=h.portraitUri=p)}}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 u;return void 0===o&&(o=""),P(this,void 0,void 0,(function(){var s,c,l,h,d,g,p,f,_,E;return D(this,(function(v){switch(v.label){case 0:return c=(s=this).currentUserId,l=s._connMgr,h=lr[e]||rr,d=1===i&&0===n,l?(g=l.codec.encodeGetHistoryMsg(t,{timestamp:n,count:d?2:i,order:r,channelId:o}),this.logger.info(he.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:o,timestamp:n,count:i,order:r}),a),[4,l.send(new Dr(h,g,c),Po,{currentUserId:c,connectedTime:l.getConnectedTime(),conversation:{targetId:t}})]):[3,2];case 1:return p=v.sent(),(f=p.code)===W.SUCCESS&&g?(_=p.data,_=this._fixDownstreamData(d,_,r),E=[],null===(u=_.list)||void 0===u||u.forEach((function(e){e&&E.push(e.messageUId)})),this.logger.info(he.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:E.join(",")}),a),[2,{code:f,data:{list:_.list,hasMore:_.hasMore}}]):(this.logger.warn(he.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:""}),a),[2,{code:f}]);case 2:return[2,{code:W.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=this.logger.createTraceId(),o=JSON.stringify(e),this.logger.debug(he.L_VER_REPORT_T,o,r),s=i.codec.encodeReportSDKInfo(o),a=new Dr(Br[Br.reportsdk],s,n),[4,i.send(a)]):[2];case 1:return(u=c.sent().code)!==W.SUCCESS&&this.logger.warn(he.L_VER_REPORT_R,u,r),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(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),u=new Dr(Ki,a,o),[4,s.send(u)]):[2,W.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),[2,c.code]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeClearMessages(t,n,i,e),u=hr[e],c=new Dr(u,a,o),[4,s.send(c)]):[2,W.RC_NET_UNAVAILABLE];case 1:return l=h.sent(),[2,l.code]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d=this;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,t=t||X.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),u=new Dr(zi,a,o),[4,s.send(u,Vo,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=d._conversationManager.get(t,n,i);return Object.assign(e,r),e}})]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return c=g.sent(),l=c.code,h=c.data,l!==W.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==h?void 0:h.list}]}}))}))},t.prototype.removeConversation=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s;return D(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 Dr($i,r,t),[4,i.send(o)]):[2,W.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},t.prototype.getConversation=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return e!==X.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:W.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:W.CONVER_GET_ERROR}];case 2:if(o=c.sent(),s=o.code,a=o.data,s!==W.SUCCESS)return[2,{code:W.CONVER_GET_ERROR}];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||ne.CLOSE,notificationLevel:r.notificationLevel||re.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:W.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:W.SUCCESS,data:i})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var i=0;if(e.includes(X.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:W.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:W.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return e===X.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:W.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(W.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(W.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve(W.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:W.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(W.SUCCESS)},t.prototype.pullConversationStatus=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l=this;return D(this,(function(h){switch(h.label){case 0:return this._isConnected?(n=(t=this)._connMgr,i=t.currentUserId,r=n.codec.encodeGetConversationStatus(e),o=new Dr(Br[Br.pullSeAtts],r,i),[4,n.send(o,_s)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return s=h.sent(),a=s.code,u=s.data,this.logger.info(he.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:i})),a!==W.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.updatedTime;n&&l._conversationManager.setConversationUpdatedTime(n),t===X.ULTRA_GROUP?l._setUltraConversationStatus(e):c.push(e)})),[2,{code:a,data:c}])}}))}))},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 P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h,d,g=this;return D(this,(function(p){switch(p.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=this._conversationManager.getConversationUpdatedTime(),o=i.codec.encodeSetConversationStatus(e,r),s=new Dr(er,o,n),[4,i.send(s,ys)]):[2,W.RC_NET_UNAVAILABLE];case 1:return a=p.sent(),u=a.code,c=a.data,u!==W.SUCCESS?[2,u]:(l=c,this._conversationManager.setConversationUpdatedTime(l.version),h=[],e.forEach((function(e){if(e.conversationType!==X.ULTRA_GROUP)g._conversationManager.addStatus(b(b({},e),{updatedTime:l.version}),!0);else{var t=g._setUltraConversationStatus(e);t&&h.push(t)}})),h.length>0&&(d=an(h),d=Ya(d),this._watcher.conversation(d)),[2,u])}}))}))},t.prototype._joinChrm=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeJoinOrQuitChatRoom(),a=new Dr(s=n?ji:Yi,o,e),this.logger.info(he.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:s}),i),[4,r.send(a,jo)]):[2,W.RC_NET_UNAVAILABLE];case 1:return u=g.sent(),c=u.code,l=u.data,h=c===W.SUCCESS?"info":"warn",this.logger[h](he.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),i),c===W.SUCCESS&&(d=l.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,d),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull()),[2,c]}}))}))},t.prototype._rejoinChrm=function(){return P(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,u.label=1;case 1:return i<t.length?(r=t[i],this.logger.info(he.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:e[r]||10,topic:ji})),o=this.logger.createTraceId(),[4,this._joinChrm(r,e[r]||10,!0,o)]):[3,4];case 2:if(s=u.sent(),a=s===W.SUCCESS?"info":"warn",this.logger[a](he.L_REJOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),o),s===W.SUCCESS)return this._watcher.chatroom({rejoinedRoom:{chatroomId:r,count:e[r]}}),[2];s===W.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(r),delete this._chrmsQueue[r]),this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:s}}),u.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),P(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.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 Dr(Br[Br.chrmPull],s,e),this.logger.info(he.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,timestamp:o})),[4,this._connMgr.send(a,Mo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return u=_.sent(),c=u.code,l=u.data,i.pulling=!1,c===W.SUCCESS&&l?(h=l.list,d=l.syncTime,g=l.finished,i.timestamp=n?Math.max(d,n):d,i.queue=i.queue.filter((function(e){return e>d})),p=[],f=[],h.forEach((function(e){e.sentTime<o||(p.push(e.messageUId),f.push(e))})),this._batchMessage(f),this.logger.info(he.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:p.join(",")})),(!g||i.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(he.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return P(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return P(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),i=new Dr(Qi,n,e),[4,t.send(i)]):[2,W.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),(o=r.code)===W.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(t,n),o=new Dr(Br[Br.queryChrmI],r,e),[4,i.send(o,Wo)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==W.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(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 Dr(sr,o,e),[4,r.send(s,Po,{conversation:{targetId:e}})]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==W.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,l;return D(this,(function(h){switch(h.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===pe.UPDATE?Wi:Ji,u=new Dr(a,s,e),[4,i.send(u,jo)]):[2,W.RC_NET_UNAVAILABLE];case 1:return c=h.sent(),(l=c.code)===W.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},r),[2,l]):[2,l]}}))}))},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 P(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,l,h,d,g,p=this;return D(this,(function(f){switch(f.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,t.entries.forEach((function(t){var n=p._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?p.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(e,t,r),s=t.type===pe.UPDATE?Xi:Zi,a=new Dr(s,o,e),[4,i.send(a,ss)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return u=f.sent(),c=u.code,-1!==[W.SUCCESS,W.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(h=[],delete(d=b({},t)).entries,t.entries.forEach((function(e){h.push(b(b({},e),d))})),c===W.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(g=u.data,l=g.errorKeys,h=this._chatroomKVStoreNotAllSuccess(h,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:h,syncTime:(new Date).getTime()},r)),[2,{code:c,data:l}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=pe.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=pe.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=pe.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=pe.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=pe.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return t.type=pe.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:W.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),o=new Dr(Br[Br.pullKV],r,e),[4,i.send(o,os)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(u=a.kvEntries.find((function(e){return e.key===t})),void 0!==u)?[2,{code:W.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:W.CHATROOM_KEY_NOT_EXIST}]}}))}))},t.prototype.getAllChatroomEntry=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:W.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},i=n.codec.encodePullChatRoomKV(0),r=new Dr(Br[Br.pullKV],i,e),[4,n.send(r,os)]):[2,{code:W.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:W.SUCCESS,data:t}]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,l,h,d,g=this;return D(this,(function(p){switch(p.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=i.codec.encodePullChatRoomKV(t),s=new Dr(Br[Br.pullKV],o,e),this.logger.info(he.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,i.send(s,os)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return a=p.sent(),u=a.code,c=a.data,l=u===W.SUCCESS?"info":"warn",this.logger[l](he.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:t})),u===W.SUCCESS&&c?(h=c.kvEntries,d=[],h.length>0&&(h.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()||d.push({key:n,value:i,type:r,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,c,r),d.length>0&&this._watcher.chatroom({updatedEntries:d})),[2,{code:u,data:c}]):[2,{code:u}]}}))}))},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()}),d)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,i,r){return P(this,void 0,void 0,(function(){var o,s,a,u,c,l,h,d,g,p,f;return D(this,(function(_){switch(_.label){case 0:return this._isConnected?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![X.PRIVATE,X.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[X.PRIVATE]=Br.ppMsgS,t[X.GROUP]=Br.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[X.PRIVATE]=Br.ppMsgP,t[X.GROUP]=Br.pgMsgP,t[X.CHATROOM]=Br.chatMsg,t[X.CUSTOMER_SERVICE]=Br.pcMsgP,t[X.RTC_ROOM]=Br.prMsgS,t[X.SYSTEM]=Br.pbMsgP,t)[e]}(e)||Br.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:Yt(),n.messageId=a,u=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(c=new wr(Br[s],u,e===X.SYSTEM?this.currentUserId:t)).setHeaderQos(Pi.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(c),[2,{code:W.SUCCESS,data:Ka(e,t,b({},n),"",0,this.currentUserId,a)}]):(l=this._connMgr.getCrtServerTime(),h=Ka(e,t,b({},n),"",l,this.currentUserId,a),null==i||i(a),this.logger.info(he.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),r),[4,this._connMgr.send(c)])):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return d=_.sent(),g=d.code,p=d.data,g!==W.SUCCESS?(this.logger.warn(he.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:h.messageUId,messageId:h.messageId}),r),h.sentStatus=ye.FAILED,[2,{code:g,data:h}]):(this.logger.info(he.L_SEND_MSG_R,JSON.stringify({code:g,messageUId:null==p?void 0:p.messageUId,messageId:null==p?void 0:p.messageId}),r),f=p,this._sendMessageStore.setMessage(f.messageUId,f.timestamp),h.sentTime=f.timestamp,h.messageUId=f.messageUId,this._conversationManager.setConversationCacheByMessage(h,!0),[2,{code:W.SUCCESS,data:h}])}}))}))},t.prototype.recallMsg=function(e,t,n,i,r){var o;return P(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,g,p,f,_,E,v;return D(this,(function(T){switch(T.label){case 0:return this._isConnected?(s=r.user,a=r.extra,u=r.isDelete,c={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:u||!1},s&&(c.user=s),a&&(c.extra=a),l={content:c,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},h=Br[Br.recallMsg],d=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},l),(g=new wr(h,d,this.currentUserId)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(g)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return p=T.sent(),f=p.code,_=p.data,e===X.ULTRA_GROUP&&this.logger.debug(he.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:f,conversationType:e,targetId:t,channelId:r.channelId})),f!==W.SUCCESS?[2,{code:f}]:(E=_,e===X.ULTRA_GROUP?(this._ultraMsgMap[E.messageUId]=E.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:W.SUCCESS}]):(this._sendMessageStore.setMessage(E.messageUId,E.timestamp),v=Ka(e,t,b(b({},l),{isPersited:!0}),E.messageUId,E.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:W.SUCCESS,data:v}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r;return D(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(t,n),r=new Dr(Br[Br.rrMsg],i,e),[2,this._connMgr.send(r)]):[2,{code:W.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r;return D(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(t,n),r=new Dr(Br[Br.rrList],i,e),[2,this._connMgr.send(r,Ns)]):[2,{code:W.RC_NET_UNAVAILABLE}]}))}))},t.prototype.pullUserSettings=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new Dr(Br[Br.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,gs)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===W.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(b({},o))}}else this.logger.warn(he.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=i&&"uploads"!==i?t||"":Bt(e,t),o=this._connMgr.codec.encodeGetFileToken(e,r,n||"",i||""),s=new Dr(Br[Br.qnTkn],o,this.currentUserId),[4,this._connMgr.send(s,Xo)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,c=Object.assign(c,{fileName:r}),u===W.SUCCESS?[2,{code:u,data:c}]:[2,{code:u}]}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(r="",o="",s="",t===ue.QINIU?(o=Zo,s=$o):(o=zo,s=es),r=t===ue.QINIU?Br[Br.qnUrl]:t===ue.AWS?Br[Br.s3Url]:t===ue.STC?Br[Br.stcUrl]:t===ue.MINIO?Br[Br.minioUrl]:Br[Br.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,e,n,i),u=new Dr(r,a,this.currentUserId),[4,this._connMgr.send(u,s)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return c=g.sent(),l=c.code,h=c.data,d=h,l===W.SUCCESS?[2,{code:l,data:d}]:[2,{code:l}]}}))}))},t.prototype.disconnect=function(){return P(this,void 0,void 0,(function(){return D(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._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 P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),i=new Dr(Br[Br.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,hs)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==W.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([b(b({},e),{createdTime:a})],a),[2,{code:W.SUCCESS}])}}))}))},t.prototype.removeTag=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([e],t),i=new Dr(Br[Br.delSeTag],n,this.currentUserId),[4,this._connMgr.send(i,hs)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==W.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:W.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),i=new Dr(Br[Br.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,hs)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==W.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:W.SUCCESS}])}}))}))},t.prototype.getTagList=function(){return P(this,void 0,void 0,(function(){var e,t;return D(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:W.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s=this;return D(this,(function(a){switch(a.label){case 0:return this._isConnected?this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Dr(Br[Br.addTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:W.TAG_NOT_EXIST}]:[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return(r=a.sent().code)!==W.SUCCESS?[2,{code:r}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:W.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o=this;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new Dr(Br[Br.delTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return(r=s.sent().code)!==W.SUCCESS?[2,{code:r}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:W.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=e.conversationType,i=e.targetId,r=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[e]),a=new Dr(Br[Br.delTag],s,this.currentUserId),[4,this._connMgr.send(a)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return(u=c.sent().code)!==W.SUCCESS?[2,{code:u}]:(this._conversationManager.deleteTagStatus(n,i,t,r),[2,{code:W.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.label){case 0:return this._isConnected?(r=(i=this).currentUserId,o=i._connMgr,s=o.codec.encodeOldConversationList({count:n,type:X.PRIVATE,startTime:t}),a=new Dr(zi,s,r),[4,o.send(a,Vo,{currentUserId:r,connectedTime:o.getConnectedTime()})]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return u=d.sent(),c=u.code,l=u.data,c!==W.SUCCESS?[2,{code:c}]:(h=this._conversationHasTagFilter(e,null==l?void 0:l.list),[2,{code:c,data:h}])}}))}))},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),c=u.hasMentioned,l=u.mentionedInfo,h=u.lastUnreadTime,d=u.notificationStatus,g=u.isTop,p=u.tags,f=u.unreadMessageCount,_=p&&p[e];if(_){var E=b(b({},t),{hasMentioned:c,mentionedInfo:l,lastUnreadTime:h,notificationStatus:d,isTop:g,unreadMessageCount:f});_.isTop?i.push(b(b({},E),{isTopInTag:!0})):r.push(b(b({},E),{isTopInTag:!1}))}})),i.sort(o),r.sort(o),V(V([],i,!0),r,!0)},t.prototype.getUnreadCountByTag=function(e,t){return P(this,void 0,void 0,(function(){var n;return D(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:W.SUCCESS,data:n}]):[2,{code:W.RC_NET_UNAVAILABLE}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,l,h,d;return D(this,(function(g){switch(g.label){case 0:return this._isConnected?(i=t.targetId,r=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(u=this._conversationManager.get(r,i,o)).tags&&Object.hasOwnProperty.call(u.tags,e)?(c=this._connMgr.codec.encodeUpdateConversationTag(a,[t]),l=new Dr(Br[Br.addTag],c,this.currentUserId),[4,this._connMgr.send(l)]):[2,{code:W.NO_TAG_IN_CONVER}]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return(h=g.sent().code)!==W.SUCCESS?[2,{code:h}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(r,i,d,o),[2,{code:W.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return P(this,void 0,void 0,(function(){var n,i,r,o;return D(this,(function(s){if(!this._isConnected)return[2,{code:W.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:W.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:W.SUCCESS,data:e})},t.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:W.SUCCESS,data:n})},t.prototype.getUnreadConversationList=function(e){return P(this,void 0,void 0,(function(){var t;return D(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:W.SUCCESS,data:t})]}))}))},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===X.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:W.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:W.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===X.ULTRA_GROUP)return Promise.resolve({code:W.METHOD_NOT_AVAILABLE});var i;if(!(i=e===X.ULTRA_GROUP?this._ultraGroupManager.get(X.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:W.SUCCESS,data:re.NOT_SET});var r=i.notificationLevel;return ot(i.notificationLevel)&&!ot(i.notificationStatus)&&(r=ne.OPEN===i.notificationStatus?1:0),Promise.resolve({code:W.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===X.ULTRA_GROUP?this._ultraGroupManager.get(X.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:W.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:W.SUCCESS,data:ne.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 P(this,void 0,void 0,(function(){var t,n,i,r,o=this;return D(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&&ze(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),b(b({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=Ya(i),r=an(i),[2,{code:W.SUCCESS,data:r}]):[2,{code:W.METHOD_NOT_AVAILABLE}]}))}))},t.prototype._getUnreadCount=function(e){return e>999?999:e},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:W.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===ne.OPEN||e.notificationLevel>0)&&t.push({conversationType:X.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:W.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:W.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:X.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:W.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:W.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:W.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:W.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:W.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:W.SUCCESS,data:n})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:W.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:W.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),P(this,void 0,void 0,(function(){var n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:X.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new wr(Br[Br.updUgRTime],i,this.currentUserId)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,W.RC_NET_UNAVAILABLE]:[2,Promise.resolve(W.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===W.SUCCESS&&((s=this._ultraGroupMap["".concat(t,"_").concat(e)])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=n),s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h,d,g,p=this;return D(this,(function(f){switch(f.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new Dr(Br[Br.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,Vo,{currentUserId:this.currentUserId,conversationType:X.ULTRA_GROUP})]):[2];case 1:return i=f.sent(),r=i.code,o=i.data,r===W.SUCCESS&&o?(a=o.list,u=o.isFinished,a.forEach((function(e){e.notificationStatus=ne.CLOSE,e.notificationLevel=re.NOT_SET,e.isTop=!1,p._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,p._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(he.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(r,", try again")),s=setTimeout((function(){p._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(he.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:l=f.sent(),h=l.code,d=l.data,h!==W.SUCCESS&&this.logger.warn(he.O,"pullConversationStatus fail code: ".concat(h,", data: ").concat(d)),g=Object.values(this._ultraGroupMap),g=Ya(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(an(g)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),f.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 P(this,void 0,void 0,(function(){var e,t,n,i=this;return D(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===W.SUCCESS&&n?(this.logger.info(he.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(he.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Dr(Br[Br.pullUgMsg],t,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(he.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),i),[4,this._connMgr.send(n,Mo,{currentUserId:this.currentUserId,conversation:{conversationType:X.ULTRA_GROUP}})];case 1:return r=l.sent(),o=r.code,s=r.data,o===W.SUCCESS&&s?(a=s.list,u=s.syncTime,c=a.map((function(e){return e.messageUId})).join(","),this.logger.info(he.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:c,timestamp:e,syncTime:u}),i)):this.logger.warn(he.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,u=e.channelId,c=e.isCounted,l=e.channelType,h=e.sentTime,d=e.senderUserId,g=e.content,p=e.isMentioned,f=this._ultraGroupMap["".concat(u,"_").concat(s)],_=f||{conversationType:X.ULTRA_GROUP,targetId:s,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:ne.CLOSE,notificationLevel:re.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==ee.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=t,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),p&&(null===(i=null==g?void 0:g.mentionedInfo)||void 0===i?void 0:i.type)!==se.ALL&&(null===(o=null===(r=null==g?void 0:g.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(u,"_").concat(s)]=_),_},t.prototype._syncUltraMsg=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l=this;return D(this,(function(h){switch(h.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=h.sent(),n=t.code,i=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===W.SUCCESS&&i?(r=i.list,o=i.syncTime,s=i.finished,a={},u=[],r.forEach((function(e){var t,n,i,r=e.targetId,s=e.content,c=e.messageUId,h=e.channelId,d=e.isMentioned;if(l._ultraMsgMap[c])delete l._ultraMsgMap[c];else{var g=0;d&&((null===(t=null==s?void 0:s.mentionedInfo)||void 0===t?void 0:t.type)===se.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(l.currentUserId)))&&(g=1);var p=l._getUltraGroup(e,g,o);a["".concat(h,"_").concat(r)]=p,l._ultraGroupManager.addUltraGroupStatus(p),u.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(he.O,"notice ultragroups"),c=Object.values(a),c=Ya(c),this._watcher.conversation(an(c))),this.logger.debug(he.O,"notice ultragroup message"),this._batchMessage(u),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 P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l,h,d,g,p;return D(this,(function(f){switch(f.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(he.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),r=t.messageId?t.messageId:Yt(),t.messageId=r,o=this._connMgr.codec.encodeUpMsg({conversationType:X.ULTRA_GROUP,targetId:e},t),(s=new wr(Br[Br.ugMsg],o,e)).setHeaderQos(Pi.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=Ka(X.ULTRA_GROUP,e,b({},t),"",a,this.currentUserId,r),n&&n(r),this.logger.info(he.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:X.ULTRA_GROUP,targetId:e,channelId:t.channelId}),i),[4,this._connMgr.send(s)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return c=f.sent(),l=c.code,h=c.data,l!==W.SUCCESS?(this.logger.warn(he.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:u.messageUId,messageId:u.messageId}),i),u.sentStatus=ye.FAILED,[2,{code:l,data:u}]):(this.logger.info(he.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:null==h?void 0:h.messageUId,messageId:null==h?void 0:h.messageId}),i),d=h,u.sentTime=d.timestamp,u.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,g=t.channelId||"",(p=this._ultraGroupMap["".concat(g,"_").concat(e)])?(p.latestMessage=u,ze(p.channelType)&&(u.channelType=p.channelType)):(p={conversationType:X.ULTRA_GROUP,targetId:e,channelId:g,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:ne.CLOSE,notificationLevel:re.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(g,"_").concat(e)]=p,this._ultraGroupManager.addUltraGroupStatus(p)),this._watcher.conversation(an([p])),[2,{code:l,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s,a;return D(this,(function(u){switch(u.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 wr(Br[Br.operate],o,r)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==W.SUCCESS?[2,{code:a,msg:W[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return this._isConnected?e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:W.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(i=new Dr(Br[Br.qryMsg],n,this.currentUserId)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(i,Ks,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==W.SUCCESS?[2,{code:o,msg:W[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,js),n=t.conversationType,i=t.info,r=t.summary;this.logger.debug(he.O,"s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return P(this,void 0,void 0,(function(){var t,n,i;return D(this,(function(r){switch(r.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Dr(Br[Br.upMsgEx],t,e.targetId)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==W.SUCCESS?[2,{code:i,msg:W[i]}]:[2,{code:i}]}}))}))},t.prototype.modifyMessage=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new Dr(Br[Br.modifyMsg],t,e.targetId)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==W.SUCCESS?[2,{code:r,msg:W[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new Dr(Br[Br.qryMsgChange],t,this.currentUserId)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(n,Fs)]):[2];case 1:return i=h.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r===W.SUCCESS&&o?(s=o.hasNext,a=o.list,u=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(l=this._pullUltraChangeMessageQue).push.apply(l,c),s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[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=we.CHANNEL_CHANGE,i=we.MSG_RECALL,r=we.MSG_EXPANSION,o=we.MSG_MODIFY,s=we.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,u=e.sendTime,c=e.operatorId,l="".concat(a,"_").concat(s),h=t._ultraGroupMap[l];if(h){var d=be.PUBLIC_TO_PRIVATE,g=be.PRIVATE_TO_PUBLIC,p=be.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=be.CHANNEL_DELETE,_=be.CHANNEL_USER_KICKED;switch(o){case g:h.channelType=Ue.PUBLIC,n.push({targetId:s,channelId:a,changeType:Ae.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Ue.PRIVATE,n.push({targetId:s,channelId:a,changeType:Ae.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case p:n.push({targetId:s,channelId:a,changeType:Ae.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:u}),delete t._ultraGroupMap[l];break;case _:r.push({targetId:s,channelId:a,userId:c,channelType:Ue.PRIVATE}),c===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,n=[];e.forEach((function(e){var i=e.targetId,r=e.channelId,o=e.messageUId,s=e.sendTime,a=e.conversationType,u=e.operatorId,c=e.mentionedType;t._updateUltraGroupWhenRecallMsg(i,r,o,s,c),n.push({targetId:i,conversationType:a,sentTime:s,messageUId:o,senderUserId:u,channelId:r,content:{conversationType:a,targetId:i,messageUId:o,channelId:r},messageDirection:1,messageType:ee.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:0})})),this._watcher.ultraGroupMessageRecalled(n)},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:V([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c=this;return D(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(i=new Dr(Br[Br.qryMsg],n,this.currentUserId)).setHeaderQos(Pi.AT_LEAST_ONCE),[4,this._connMgr.send(i,Ks,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),o=r.code,s=r.data,o!==W.SUCCESS?[2,{code:o,msg:W[o]}]:(a=(s||{}).list,u=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=c._ultraGroupMap["".concat(n,"_").concat(t)];r&&r.latestMessage.messageUId===i&&(r.latestMessage=e),u.push(e)})),e===we.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===we.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h;return D(this,(function(d){return t=Pe.REMOVE_USER_GROUP,n=Pe.JOIN_USER_GROUP,i=Pe.EXIT_USER_GROUP,r=Pe.CHANNEL_BIND_USER_GROUP,o=Pe.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],l=[],e.forEach((function(e){var h=e.conversationType,d=e.targetId,g=e.userGroupIds,p=e.busChannelType,f=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:h,targetId:d},userGroupIds:g});break;case n:a.push({conversation:{conversationType:h,targetId:d},userGroupIds:g});break;case i:u.push({conversation:{conversationType:h,targetId:d},userGroupIds:g});break;case r:c.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:p,userGroupIds:g});break;case o:l.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:p,userGroupIds:g})}})),h={},s.length>0&&(h.userGroupDisband=s),a.length>0&&(h.userAdded=a),u.length>0&&(h.userRemoved=u),c.length>0&&(h.userGroupBindChannel=c),l.length>0&&(h.userGroupUnBindChannel=l),this._watcher.userGroupStatus(h),[2]}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){var i;return P(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(e,t),o=new Dr(Br[Br.qryUgMsg],r,this.currentUserId),this.logger.info(he.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:X.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,Po,{currentUserId:this.currentUserId,conversation:{conversationType:X.ULTRA_GROUP,targetId:e}})]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,a===W.SUCCESS&&u?(c=[],null===(i=u.list)||void 0===i||i.forEach((function(e){e&&c.push(e.messageUId)})),this.logger.info(he.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(he.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),r=new Dr(Br[Br.ugUnpushSet],i,e),[4,this._connMgr.send(r)]):[2,{code:W.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:W.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,W.SUCCESS,[2,{code:s}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return P(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new Dr(Br[Br.ugUnpushQuery],i,e),[4,n.send(r,Ss)]):[2,{code:W.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:W.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===W.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[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,u=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),i&&u<i&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(r===De.ALL||r===De.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,r===De.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(an([s])))}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:W.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Dr(Br[Br.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,Rs)]):[2,Promise.resolve({code:W.METHOD_NOT_AVAILABLE})]:[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===W.SUCCESS&&o?[2,{code:r,data:o}]:[2,{code:r}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r;return D(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:W.SUCCESS,data:r}]):[2,Promise.resolve({code:W.METHOD_NOT_AVAILABLE})]:[2,{code:W.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r;return D(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),i=new Dr(Br[Br.setRtcRoomId],n,t),[4,this._connMgr.send(i)]):[2,W.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u;return D(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=i instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(i)):i,o=n?new Dr(t,r,e):new wr(t,r,e),[4,this._connMgr.send(o)]):[2,{code:W.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,[2,{code:a,buffer:null==u?void 0:u.data}]}}))}))},t.prototype.rtcPing=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return i=sa(this.rtcCodec,t,n),[4,this.rtcSignaling(e,Br[Br.rtcPing],!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o!==W.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(Xt.RtcOutput,s)).version=kt(a.version),[2,{code:o,data:a}])}}))}))},t.prototype.getDeviceId=function(){return Oi(this.runtime)},t.prototype.getOSInfo=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,{code:W.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,{code:W.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,{code:W.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){ni(),Ra()},t.prototype.callExtra=function(e){return Promise.resolve({code:W.EXTRA_METHOD_UNDEFINED})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getConversationsByPage=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){return Promise.resolve(W.NOT_SUPPORT)},t.prototype.removeFromBlacklist=function(e){return Promise.resolve(W.NOT_SUPPORT)},t.prototype.getBlacklist=function(){return Promise.resolve({code:W.NOT_SUPPORT})},t.prototype.getBlacklistStatus=function(e){return Promise.resolve({code:W.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.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 P(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(t,n),[4,i.send(new Dr(nr,r,e),Zs)]):[3,2];case 1:return o=u.sent(),s=o.code,a=o.data,s===W.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:W.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:W.NOT_SUPPORT})},t.prototype.getProxy=function(){return Promise.resolve({code:W.NOT_SUPPORT})},t.prototype.testProxy=function(e,t){return Promise.resolve({status:W.NOT_SUPPORT})},t.prototype.setNetwork=function(e,t){this._connMgr.setNetwork(e,t)},t}(Dn),Qa=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return P(this,void 0,void 0,(function(){var s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return s=sa(this._context.rtcCodec,t,n,i,r,o),[4,this.rtcSignaling(e,hn,!0,s)];case 1:return a=h.sent(),u=a.code,c=a.buffer,u===W.SUCCESS&&c&&(l=aa(this._context.rtcCodec,c)),[2,{code:u,data:l}]}}))}))},t.prototype.quitRTCRoom=function(e){return P(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(Xt.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,dn,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return P(this,void 0,void 0,(function(){return D(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 P(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(Xt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,gn,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===W.SUCCESS&&r&&(o=this._context.rtcCodec.decode(Xt.RtcRoomInfoOutput,r)),[2,{code:i,data:o}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s;return D(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(Xt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,pn,!0,t)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===W.SUCCESS&&r&&(s=aa(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 P(this,void 0,void 0,(function(){var i;return D(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(Xt.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,fn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return P(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(Xt.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,_n,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,o){return P(this,void 0,void 0,(function(){var s;return D(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(Xt.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,En,!1,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return void 0===r&&(r=""),P(this,void 0,void 0,(function(){var o,s;return D(this,(function(a){switch(a.label){case 0:return o={objectName:i,content:this._context.rtcCodec.encode(Xt.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(Xt.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(Xt.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},s=this._context.rtcCodec.encode(Xt.RtcUserSetDataInput,o),[4,this.rtcSignaling(e,vn,!0,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return P(this,void 0,void 0,(function(){var i;return D(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(Xt.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(Xt.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,vn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(Xt.RtcDataInput,{interior:n,target:i,key:t}),[4,this.rtcSignaling(e,Tn,!0,r)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===W.SUCCESS&&a?(u=this._context.rtcCodec.decode(Xt.RtcQryOutput,a).outInfo,c={},u.forEach((function(e){c[e.key]=e.value})),[2,{code:s,data:c}]):[2,{code:s}]}}))}))},t.prototype.removeRTCData=function(e,t,n,i,r){return P(this,void 0,void 0,(function(){var o;return D(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(Xt.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,yn,!1,o)];case 1:return[2,s.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){return P(this,void 0,void 0,(function(){return D(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return i=sa(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,mn,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===W.SUCCESS&&s?(a=this._context.rtcCodec.decode(Xt.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},t.prototype.setRTCState=function(e,t){return P(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(Xt.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,Cn,!0,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(Xt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,In,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===W.SUCCESS&&r?(o=aa(this._context.rtcCodec,r),[2,{code:i,data:o}]):[2,{code:i}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a,u,c;return D(this,(function(l){switch(l.label){case 0:return i=sa(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Rn,!0,i)];case 1:return r=l.sent(),o=r.code,s=r.buffer,o===W.SUCCESS&&s?(a=this._context.rtcCodec.decode(Xt.RtcViewerJoinedOutput,s),u=a.rtcToken,c=a.entries,[2,{code:o,data:{token:u,kvEntries:c}}]):[2,{code:o}]}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return P(this,void 0,void 0,(function(){var t,n;return D(this,(function(i){switch(i.label){case 0:return t=this._context.rtcCodec.encode(Xt.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Sn,!0,t)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return i=this._context.rtcCodec.encode(Xt.RtcInput,{roomType:He.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,Mn,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===W.SUCCESS&&s?(a=aa(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},t.prototype.requestRoomPK=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u;return D(this,(function(c){switch(c.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(Xt.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:o}),[4,this.rtcSignaling(s,Nn,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},t.prototype.cancelRoomPK=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteInfo,o=e.roomId,s=this._context.rtcCodec.encode(Xt.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(o,Ln,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l;return D(this,(function(h){switch(h.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,u=e.roomId,c=this._context.rtcCodec.encode(Xt.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:i,content:r,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,Un,!0,c)];case 1:return l=h.sent().code,this._context.rtcKVManager.reset(),[2,l]}}))}))},t.prototype.endRoomPK=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=e.endRoomId,n=e.sessionId,i=e.content,r=e.keys,o=e.roomId,s=this._context.rtcCodec.encode(Xt.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(o,An,!0,s)];case 1:return a=u.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 P(this,void 0,void 0,(function(){var t,n,i,r,o;return D(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(Xt.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",wn,!0,t)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===W.SUCCESS&&r?(o=this._context.rtcCodec.decode(Xt.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:kt(e.joinTime)}}))}]):[2,{code:i}]}}))}))},t}(ki);function Wa(e){return b({},e)}var Ja=function(){function e(e,t){var n,i;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[ee.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[ee.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[ee.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[ee.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[ee.INTERCEPT]=this._processInterceptMessage.bind(this),n[ee.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[ee.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[ee.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[ee.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[ee.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[ee.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},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=b({},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,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)};this.rtcCodec=this.createCodec(bn,Pn),this._engine=rn()?new RCCppEngine(e,this.rtcCodec,r,this._options):new ja(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(he.A_INIT_REPEAT_O),this._context;this._context=new e(t,n),this._context.logger.info(he.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(he.L_IMSDK_VER_O,JSON.stringify({commitId:"8abcc96cfe3eaaf7e6f4b6e67a1580a41af234d5",version:"5.8.2"}));var i=this._context._engine;return t.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},e.destroy=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(he.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 xn(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(he.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(he.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var i="RCRTC"===e.tag?new Qa(this):new ki(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(i,this._runtime,t)}catch(e){this.logger.error(he.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(he.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._processChatrormMessage=function(e){var t;if("function"==typeof this._watcher.chatroomState)return this._watcher.chatroomState({userChange:{users:(t={},t[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?Ee.QUIT:Ee.JOIN,t),chatroomId:e.targetId}}),!0},e.prototype._processChrmMemChangeMessage=function(e){if("function"==typeof this._watcher.chatroomState){var t={};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}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo(Wa(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===X.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===_e.MSG_EXPANSION||n===_e.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(he.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.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(Wa(e))}catch(e){return a.logger.error(he.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,Wa(e),t,n),!this._messageProccessor[e.messageType])return e;this._messageProccessor[e.messageType](e)}},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[];e.forEach((function(e){var o=i._messageReceiver(e,t,n);o&&r.push(o)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(he.L_BATCH_MESSAGE_O,r.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(r))},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(he.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._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]=rt(i)||it(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||"",u="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===s?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._engine.getConnectionStatus()},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.refetchNaviInfo=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var i,r;return P(this,void 0,void 0,(function(){var o,s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return this._token=e,[4,this._runtime.getNetworkType()];case 1:return o=h.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=h.sent(),u=a.code,c=a.data,u!==W.SUCCESS?[2,{code:u}]:(1!==this._engine.getNaviInfoFromCache().type&&(l=Et.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,l)),[2,{code:u,userId:c}])}}))}))},e.prototype.disconnect=function(e){return P(this,void 0,void 0,(function(){var t=this;return D(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(he.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),$e(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&&it(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var r=t[e];ze(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:W.SEARCH_PROPS_LIMIT_ERROR}:{code:W.SUCCESS}},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!==W.SUCCESS)return Promise.resolve({code:s,msg:a});if(e===X.SYSTEM&&n.messageType!==ee.SYNC_READ_STATUS)return Promise.resolve({code:W.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(e!==X.ULTRA_GROUP){var u=this.getNaviInfoFromCache();if(1===((null==u?void 0:u.grpRRVer)||0)&&n.messageType===ee.READ_RECEIPT_RESPONSE)return Promise.resolve({code:W.READ_RECEIPT_ERROR})}var c=n.canIncludeExpansion,l=void 0!==c&&c,d=n.expansion;if(l){var g=pt(d),p=g.isIllgalEx,f=g.isExKeyOrValLengthExceedLimit;if(g.isExceedLimit||f)return Promise.resolve({code:W.EXPANSION_LIMIT_EXCEET});if(p)return Promise.resolve({code:W.BIZ_ERROR_INVALID_PARAMETER})}var _,E,v=JSON.stringify(n.content);return _=v,void 0===E&&(E="utf-8"),("utf-16"===E?x(_):F(_))>h?Promise.resolve({code:W.RC_MSG_CONTENT_EXCEED_LIMIT}):e===X.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,i,r):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,u,c,l,h;return D(this,(function(d){switch(d.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(u=pt(s),c=u.isIllgalEx,l=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||l?[2,Promise.resolve({code:W.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:W.BIZ_ERROR_INVALID_PARAMETER})]:(h={mid:r},s&&(h.put=s),o&&(h.del=o),a&&(h.removeAll=1),[4,this._engine.sendMessage(n,i,{content:h,messageType:ee.EXPANSION_NOTIFY,channelId:t})])):[2,{code:W.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return P(this,void 0,void 0,(function(){var i;return D(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:W.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 P(this,void 0,void 0,(function(){var i;return D(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:W.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){return P(this,void 0,void 0,(function(){var e=this;return D(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(he.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===X.ULTRA_GROUP){var u={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(t,u,a)}return this._engine.getHistoryMessage(e,t,n,i,r,o,s||"",a)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,i,r,o,s)},e.prototype.getConversationList=function(e,t,n,i,r){if(void 0===e&&(e=300),void 0===r&&(r=""),t===X.ULTRA_GROUP){var o=W.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:W[o]})}return this._engine.getConversationList(e,t,n,i,r)},e.prototype.getConversationsByPage=function(e,t,n,i){return this._engine.getConversationsByPage(e,t,n,i)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===X.ULTRA_GROUP?Promise.resolve(W.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)},e.prototype.getUltraGroupList=function(e){return this._engine.getUltraGroupList(e)},e.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},e.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),e===X.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(X.ULTRA_GROUP)){var i=W.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:W[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[X.PRIVATE,X.GROUP,X.SYSTEM,X.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.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),P(this,void 0,void 0,(function(){var r;return D(this,(function(o){return r=[{conversationType:e,targetId:t,notificationLevel:n,channelId:i}],[2,this._engine.batchSetConversationStatus(r)]}))}))},e.prototype.setConversationStatus=function(e,t,n,i,r){if(void 0===r&&(r=""),e===X.ULTRA_GROUP&&void 0!==n)return Promise.resolve(W.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(e,t,n,i)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,i,r){return this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){return void 0===i&&(i=""),e===X.ULTRA_GROUP?Promise.resolve(W.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,i)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,i)},e.prototype.joinChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,n)},e.prototype.joinExistChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return qt(n)&&Kt(i)?this._engine.setChatroomEntry(e,t):Promise.resolve(W.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(!qt(r)||!Kt(o))return Promise.resolve({code:W.BIZ_ERROR_INVALID_PARAMETER})}var s=b(b({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,i=t.value;return qt(n)&&Kt(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(W.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return qt(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(W.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(!qt(i))return Promise.resolve({code:W.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return qt(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(W.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,i){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===i&&(i=0),this._engine.getChatroomHistoryMessages(e,i,t,n)},e.prototype.getFileToken=function(e,t,n,i){return P(this,void 0,void 0,(function(){var r,o,s,a,u,c,l;return D(this,(function(h){switch(h.label){case 0:return r=this.getNaviInfoFromCache(),o=(null==r?void 0:r.bosAddr)||"",s=(null==r?void 0:r.uploadServer)||"",a=(null==r?void 0:r.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,i)];case 1:return u=h.sent(),c=u.code,l=u.data,c===W.SUCCESS&&l?[2,Promise.resolve(Object.assign(l,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(c)]}}))}))},e.prototype.getFileUrl=function(e,t,n,i,r){return void 0===r&&(r=ue.QINIU),P(this,void 0,void 0,(function(){var o,s,a;return D(this,(function(u){switch(u.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=u.sent(),s=o.code,a=o.data,s===W.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return t.length>1e3?[2,Promise.reject(W.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return P(this,void 0,void 0,(function(){return D(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return P(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return P(this,void 0,void 0,(function(){return D(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=[X.PRIVATE,X.CHATROOM,X.GROUP,X.SYSTEM,X.APP_PUBLIC_SERVICE,X.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t)},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[X.PRIVATE,X.CHATROOM,X.GROUP,X.SYSTEM,X.APP_PUBLIC_SERVICE,X.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!==X.ULTRA_GROUP){var t=W.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:W[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return P(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return D(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==X.ULTRA_GROUP?[2,{code:r=W.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:W[r]}]:i?(o=pt(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:W.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:W.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:W.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return P(this,void 0,void 0,(function(){var t;return D(this,(function(n){switch(n.label){case 0:return e.conversationType!==X.ULTRA_GROUP?[2,{code:t=W.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:W[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,V([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 P(this,void 0,void 0,(function(){return D(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(he.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return P(this,void 0,void 0,(function(){var i,r,o;return D(this,(function(s){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,o=i.msg,r!==W.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=""),P(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){return void 0===r&&(r=""),P(this,void 0,void 0,(function(){return D(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,i,r)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),P(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return P(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return P(this,void 0,void 0,(function(){return D(this,(function(i){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return P(this,void 0,void 0,(function(){return D(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,i){return P(this,void 0,void 0,(function(){return D(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(e,t,n,i)]}))}))},e.prototype.setUserStatus=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return P(this,void 0,void 0,(function(){return D(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,i){return void 0===t&&(t=[]),void 0===n&&(n=""),P(this,void 0,void 0,(function(){return D(this,(function(r){return[2,this._engine.searchConversationByContent(e,t,n,i)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),P(this,void 0,void 0,(function(){return D(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=""),P(this,void 0,void 0,(function(){return D(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=""),P(this,void 0,void 0,(function(){return D(this,(function(s){return[2,this._engine.searchMessagesByUser(e,t,n,i,r,o)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){return P(this,void 0,void 0,(function(){return D(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 P(this,void 0,void 0,(function(){return D(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 P(this,void 0,void 0,(function(){return D(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.createLogger=function(e,t){return this._engine.createLogger(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}(),Xa=R;export{fa as AConnectionMgr,Dn as AEngine,Ja as APIContext,U as AppStorage,Bn as AreaCode,mt as AssertRules,pi as BasicLogger,co as BasicNavi,_i as BasicReporter,ba as BasicStatistic,Pa as BasicStatisticReporter,v as CPP_PROTOCAL_MSGTYPE_OPTION,Je as CallLibMsgType,pe as ChatroomEntryType,Ye as ChatroomSyncStatusReason,Ee as ChatroomUserChangeType,Ne as ChrmMemBanType,Oe as ChrmMemOperateType,Re as ChrmSyncStatus,xn as Codec,Fe as ConnectReason,xe as ConnectType,z as ConnectionStatus,X as ConversationType,C as DB_LOG_FLUSH_FREQUENCY,m as DB_LOG_MAX_SIZE,un as DelayTimer,Ve as EnterpriseType,W as ErrorCode,ft as EventEmitter,S as FORMATED_VERSION,K as FileType,r as HTTP_TIMEOUT,At as HttpMethod,d as IM_CHATROOM_PULL_INTERVAL_TIME,u as IM_PING_INTERVAL_TIME,l as IM_PING_MIN_TIMEOUT,c as IM_PING_TIMEOUT,a as IM_SIGNAL_TIMEOUT,fi as IndexDBLogger,Li as IndexDBReporter,Va as IndexDBStatistic,qa as IndexDBStatisticReporter,Ke as LiveRole,qe as LiveType,ai as LogL,ce as LogLevel,le as LogSource,he as LogTagId,h as MAX_MESSAGE_CONTENT_BYTES,f as MAX_MESSAGE_EXPANSION_KEY_LENGTH,_ as MAX_MESSAGE_EXPANSION_VAL_LENGTH,O as MAX_UPLOAD_FILE_SIZE,se as MentionedType,_e as MessageBlockSourceType,Te as MessageBlockType,j as MessageDirection,ee as MessageType,i as NAVI_CACHE_DURATION,o as NAVI_REQ_TIMEOUT,ke as NaviCacheType,wt as NetworkType,re as NotificationLevel,ne as NotificationStatus,I as ONE_LOG_SIZE_MAX,Ce as OperateStatus,ki as PluginContext,Ge as ProtocalType,Dt as RCAssertError,ua as RCConnectionStatus,y as REAT_TIME_LOG_SIZE,je as RTCApiType,Qe as RTCIdentityChangeType,We as RTCJoinType,He as RTCMode,Qa as RTCPluginContext,n as ReceivedStatus,E as SEND_MESSAGE_TYPE_OPTION,T as STATUS_MESSAGE,p as STORAGE_ROOT_KEY,ye as SentStatus,pa as StatisticL,de as StatisticsTag,Be as StatisticsVersion,Le as StoreKeys,bt as TagChangeType,M as UPLOAD_FILE_CHUNK_SIZE,Ae as UltraGroupChannelChangeType,Ue as UltraGroupChannelType,De as UltraMentionedType,we as UltraMsgChangeType,be as UltraMsgSubChangeType,ue as UploadMethod,Pe as UserGroupChangeType,R as VERSION,Et as VersionManage,s as WEB_SOCKET_TIMEOUT,go as WebSocketNavi,H as appendUrl,Vt as assert,an as clone,nn as cloneByJSON,ni as deInitLogDB,Zt as forEach,on as getBrowser,Yt as getClientMessageId,xt as getMimeKey,Nt as getUUID,Lt as getUUID22,Bt as getUploadFileName,jt as getbundleId,Wt as httpRequest,$t as indexOf,ti as initLogDB,Ia as initStatisticDB,$e as isArray,et as isArrayBuffer,Ze as isBoolean,ga as isConnnectAck,da as isDisconnectedByServer,rt as isFunction,at as isHttpUrl,tn as isInObject,en as isInclude,st as isNull,ze as isNumber,it as isObject,Xe as isString,dt as isTypeInConversationList,ot as isUndefined,ht as isValidChannelId,qt as isValidChrmEntryKey,Kt as isValidChrmEntryValue,ct as isValidConversationType,pt as isValidExpansion,gt as isValidFileType,lt as isValidNotificationLevel,Mt as logger,zt as map,nt as notEmptyArray,ut as notEmptyObject,tt as notEmptyString,Ft as pushConfigsToJSON,Ht as pushJSONToConfigs,La as statisticTranscsv,B as todo,Ni as transcsv,Ra as unInitStatisticDB,Qn as urlCenter,rn as usingCppEngine,Gt as validate,Xa as version};