@rongcloud/engine 5.7.8 → 5.7.10

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.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),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,r=72e5,i=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],o=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],s="upload.qiniup.com",a="gz.bcebos.com",u=131072,c=18e4,l="RCV4-",h={"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}},d=["RC:TypSts","RC:InterceptMsg","RC:RL"],p={url:"logcollection.ronghub.com",level:1,itv:6,times:5},f="5.7.8",_=f.replace(/-.+$/,""),E=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},T=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}(),y=function(){function e(e,t){var n,r=t?"".concat(l).concat(t):l;this._rootStorage=E(e);var i=this._rootStorage.get(r)||{};this._cache=new T(((n={})[r]=i,n)),this._storageKey=r}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}(),v=function(e,t){return v=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])},v(e,t)};function I(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}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var C=function(){return C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},C.apply(this,arguments)};function m(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function R(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(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,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function S(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var O,M=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return I(t,e),t}(Error),L=function(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},N=function(e){for(var t,n=0,r=0,i=e.length;r<i;r++)n+=(t=e.charCodeAt(r))<127?1:t<=2047?2:t<=65535?3:4;return n};!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"}(O||(O={}));var U,A=O;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(U||(U={}));var w,b=U;!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_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_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.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",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"}(w||(w={}));var P,x=w;!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(P||(P={}));var D,V=P;!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"}(D||(D={}));var G,B=D;!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.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(G||(G={}));var k,F=G;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(k||(k={}));var H,K=k;!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"}(H||(H={}));var q,Y=H;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(q||(q={}));var j,Q=q;!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"}(j||(j={}));var J,W=j;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(J||(J={}));var X,z,Z,$,ee=J;exports.LogLevel=void 0,(X=exports.LogLevel||(exports.LogLevel={}))[X.LOG=0]="LOG",X[X.DEBUG=0]="DEBUG",X[X.INFO=1]="INFO",X[X.WARN=2]="WARN",X[X.ERROR=3]="ERROR",X[X.FATAL=4]="FATAL",X[X.STATISTICS=6]="STATISTICS",X[X.NONE=1e3]="NONE",exports.LogSource=void 0,(z=exports.LogSource||(exports.LogSource={})).IM="IM",z.RTC="RTC",exports.LogTagId=void 0,(Z=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",Z.A_INIT_O="A-init-O",Z.A_INIT_REPEAT_O="A_INIT_REPEAT_O",Z.L_INIT_O="L-init-O",Z.A_DESTROY_O="A_DESTROY_O",Z.L_DESTROY_O="L_DESTROY_O",Z.A_CONNECT_T="A-connect-T",Z.A_CONNECT_R="A-connect-R",Z.A_CONNECT_S="A-connect-S",Z.A_DISCONNECT_O="A-disconnect-O",Z.A_RECONNECT_T="A-reconnect-T",Z.A_RECONNECT_R="A_RECONNECT_R",Z.L_CONNECT_T="L-connect-T",Z.L_CONNECT_R="L-connect-R",Z.L_CONNECT_S="L-connect-S",Z.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",Z.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",Z.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",Z.A_MSG_LISTENER_E="A-MSG_LISTENER-E",Z.O="L-original-O",Z.T="L-TEST-O",Z.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",Z.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",Z.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",Z.A_SEND_MSG_T="A-send_msg-T",Z.A_SEND_MSG_R="A-send_msg-R",Z.L_SEND_MSG_T="L-send_msg-T",Z.L_SEND_MSG_R="L-send_msg-R",Z.L_PULL_MSG_T="L-pull_msg-T",Z.L_PULL_MSG_R="L-pull_msg-R",Z.L_PULL_MSG_O="L-pull_msg-O",Z.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",Z.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",Z.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",Z.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",Z.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",Z.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",Z.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",Z.L_RECV_S_MSG_O="L-recv_s_msg-O",Z.A_DELETE_MESSAGES_S="A-delete_messages-S",Z.P_DELETE_MSG_S="P-delete_msg-S",Z.L_PULL_CONVERSATION_S="L-pull_conversation-S",Z.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",Z.A_REGTYP_O="A-regtyp-O",Z.P_REGTYP_E="P-regtype-E",Z.L_GET_NAVI_T="L-get_navi-T",Z.L_GET_NAVI_R="L-get_navi-R",Z.L_REQUEST_T="L-request-T",Z.L_REQUEST_R="L-request-R",Z.L_PARSE_NAVI_E="L-parse_navi-E",Z.L_ENV_S="L-Env-S",Z.L_GET_INDEX_NAVI_S="L-get_index_navi-S",Z.A_JOIN_CHATROOM_T="A-join_chatroom-T",Z.A_JOIN_CHATROOM_R="A-join_chatroom-R",Z.L_JOIN_CHATROOM_T="L-join_chatroom-T",Z.L_JOIN_CHATROOM_R="L-join_chatroom-R",Z.A_QUIT_CHATROOM_T="A-quit_chatroom-T",Z.A_QUIT_CHATROOM_R="A-quit_chatroom-R",Z.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",Z.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",Z.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",Z.L_MEDIA_S="L-media-S",Z.L_MEDIA_UPLOAD_T="L-media_upload-T",Z.L_MEDIA_UPLOAD_R="L-media_upload-R",Z.G_UPLOAD_LOG_S="G-upload_log-S",Z.G_REPORT_LOG_S="G-report_log-S",Z.G_UPLOAD_LOG_E="G-upload_log-E",Z.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",Z.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",Z.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",Z.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",Z.A_GET_HISTORY_MSG_T="A-get_history_msg-T",Z.A_GET_HISTORY_MSG_R="A-get_history_msg-R",Z.L_GET_HISTORY_MSG_T="L-get_history_msg-T",Z.L_GET_HISTORY_MSG_R="L-get_history_msg-R",Z.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",Z.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",Z.A_CALLBACK_O="A-callback-O",Z.A_CALLBACK_E="A-callback-E",Z.L_CALLBACK_E="L-callback-E",Z.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",Z.L_PB_ENCODE_E="L-pb-encode-E",Z.L_PB_DECODE_E="L-pb-decode-E",Z.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",Z.L_REPORT_FULL_LOG_O="L-report_full_log-O",Z.L_REPORT_FULL_LOG_T="L-report_full_log-T",Z.L_REPORT_FULL_LOG_R="L-report_full_log-R",Z.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",Z.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",Z.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",Z.L_LOGDB_CLOSED_S="L-logDB_closed-S",Z.L_LOGDB_ERROR_E="L-logDB_error-S",Z.L_LOGDB_ABORT_S="L-logDB_abort-S",Z.L_REALTIME_LOG_R="L_REALTIME_LOG_R",Z.L_REALTIME_LOG_O="L_REALTIME_LOG_O",Z.L_REALTIME_LOG_T="L_REALTIME_LOG_T",Z.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",Z.L_RECV_RMTP_O="L_RECV_RMTP_O",Z.L_RECV_RMTP_E="L_RECV_RMTP_E",Z.L_RECV_S_NTF_O="L-recv_s_ntf_O",Z.L_VER_REPORT_T="L-VER_REPORT-T",Z.L_VER_REPORT_R="L-VER_REPORT-R",Z.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",Z.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",Z.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",Z.A_REMOVE_PROXY_O="A-remove_proxy-O",Z.A_SET_PROXY_O="A-set_proxy-O",Z.A_TEST_PROXY_O="A-test_proxy-O",Z.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}($||($={}));var te,ne,re=$;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(te||(te={})),exports.MessageBlockSourceType=void 0,(ne=exports.MessageBlockSourceType||(exports.MessageBlockSourceType={}))[ne.MSG_ORIGINAL=0]="MSG_ORIGINAL",ne[ne.MSG_EXPANSION=1]="MSG_EXPANSION",ne[ne.MSG_MODIFY=2]="MSG_MODIFY";var ie,oe=te;!function(e){e[e.typing=0]="typing"}(ie||(ie={}));var se,ae,ue,ce,le,he,de,pe,ge,fe,_e=ie;exports.SentStatus=void 0,(se=exports.SentStatus||(exports.SentStatus={}))[se.SENDING=10]="SENDING",se[se.FAILED=20]="FAILED",se[se.SENT=30]="SENT",se[se.RECEIVED=40]="RECEIVED",se[se.READ=50]="READ",se[se.DESTROYED=60]="DESTROYED",exports.StoreKeys=void 0,(ae=exports.StoreKeys||(exports.StoreKeys={})).NAVI="rc-navi",ae.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp",exports.UltraGroupChannelType=void 0,(ue=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[ue.PUBLIC=0]="PUBLIC",ue[ue.PRIVATE=1]="PRIVATE",exports.UltraGroupChannelChangeType=void 0,(ce=exports.UltraGroupChannelChangeType||(exports.UltraGroupChannelChangeType={}))[ce.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",ce[ce.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",ce[ce.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UltraMsgChangeType=void 0,(le=exports.UltraMsgChangeType||(exports.UltraMsgChangeType={}))[le.MSG_EXPANSION=1]="MSG_EXPANSION",le[le.MSG_MODIFY=2]="MSG_MODIFY",le[le.MSG_RECALL=3]="MSG_RECALL",le[le.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",le[le.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE",exports.UltraMsgSubChangeType=void 0,(he=exports.UltraMsgSubChangeType||(exports.UltraMsgSubChangeType={}))[he.CHANNEL_DELETE=1]="CHANNEL_DELETE",he[he.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",he[he.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",he[he.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",he[he.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",he[he.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UserGroupChangeType=void 0,(de=exports.UserGroupChangeType||(exports.UserGroupChangeType={}))[de.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",de[de.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",de[de.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",de[de.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",de[de.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP",exports.RTCMode=void 0,(pe=exports.RTCMode||(exports.RTCMode={}))[pe.RTC=0]="RTC",pe[pe.LIVE=2]="LIVE",pe[pe.SIP=4]="SIP",pe[pe.CALL=5]="CALL",pe[pe.MEETING=6]="MEETING",pe[pe.CROSS_MUTI=7]="CROSS_MUTI",pe[pe.CROSS_LIVE=8]="CROSS_LIVE",exports.LiveType=void 0,(ge=exports.LiveType||(exports.LiveType={}))[ge.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",ge[ge.AUDIO=1]="AUDIO",exports.LiveRole=void 0,(fe=exports.LiveRole||(exports.LiveRole={}))[fe.ANCHOR=1]="ANCHOR",fe[fe.AUDIENCE=2]="AUDIENCE";var Ee,Te,ye;exports.RTCApiType=void 0,(Ee=exports.RTCApiType||(exports.RTCApiType={}))[Ee.ROOM=1]="ROOM",Ee[Ee.PERSON=2]="PERSON",exports.RTCIdentityChangeType=void 0,(Te=exports.RTCIdentityChangeType||(exports.RTCIdentityChangeType={}))[Te.AnchorToViewer=1]="AnchorToViewer",Te[Te.ViewerToAnchor=2]="ViewerToAnchor",exports.RTCJoinType=void 0,(ye=exports.RTCJoinType||(exports.RTCJoinType={}))[ye.KICK=0]="KICK",ye[ye.REFUSE=1]="REFUSE",ye[ye.COEXIST=2]="COEXIST";var ve=function(e){return"string"==typeof e},Ie=function(e){return"number"==typeof e&&!Number.isNaN(e)},Ce=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},me=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Re=function(e){return ve(e)&&e.length>0},Se=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Oe=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Me=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Le=function(e){return ve(e)&&/https?:\/\//.test(e)},Ne=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},Ue=function(e){return Ie(e)&&Object.prototype.hasOwnProperty.call(V,e)},Ae=function(e){var t=!1;return ve(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},we=function(e){var t=!1,n=!1,r=!1;if(Se(e)){var i=Object.keys(e).length;for(var o in t=i>20,e)if(n||(n=ve(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!r){var s=e[o];r=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:r}},be=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map[e];if(r)for(var i=r.length-1;i>=0;i-=1){var o=r[i],s=o.target,a=o.once,u=o.listener;a&&r.splice(i,1);try{u.call.apply(u,S([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}(),Pe="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Pe.engine="5.7.8";var xe=function(){function e(){}return e.add=function(e,t){Pe[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 Pe.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Pe},e}(),De=null;function Ve(e,t,n,r){void 0===n&&(n={});var i=["error","warn","info","debug"][3-e];if(De&&e<exports.LogLevel.FATAL)try{var o=JSON.stringify(n);De[i](t,o)}catch(e){console.error(e)}}var Ge,Be,ke=Ve.bind(null,exports.LogLevel.DEBUG),Fe=Ve.bind(null,exports.LogLevel.INFO),He=Ve.bind(null,exports.LogLevel.WARN),Ke=Ve.bind(null,exports.LogLevel.ERROR),qe=Ve.bind(null,exports.LogLevel.FATAL),Ye=Object.freeze({__proto__:null,init:function(e){De=e},log:Ve,debug:ke,info:Fe,warn:He,error:Ke,fatal:qe}),je=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},Qe=function(){var e=je();if(e="".concat(e.replace(/-/g,""),"a"),e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.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};exports.AssertRules=void 0,(Be=exports.AssertRules||(exports.AssertRules={}))[Be.STRING=0]="STRING",Be[Be.ONLY_STRING=1]="ONLY_STRING",Be[Be.NUMBER=2]="NUMBER",Be[Be.BOOLEAN=3]="BOOLEAN",Be[Be.OBJECT=4]="OBJECT",Be[Be.ARRAY=5]="ARRAY",Be[Be.CALLBACK=6]="CALLBACK",Be[Be.CHANNEL_ID=7]="CHANNEL_ID",Be[Be.CONVERSATION=8]="CONVERSATION";var Je,We,Xe,ze=((Ge={})[exports.AssertRules.STRING]=Re,Ge[exports.AssertRules.ONLY_STRING]=ve,Ge[exports.AssertRules.NUMBER]=Ie,Ge[exports.AssertRules.BOOLEAN]=function(e){return"boolean"==typeof e},Ge[exports.AssertRules.OBJECT]=Se,Ge[exports.AssertRules.ARRAY]=Ce,Ge[exports.AssertRules.CALLBACK]=function(e){var t=!0;return Se(e)||(t=!1),(e=e||{}).onSuccess&&!Oe(e.onSuccess)&&(t=!1),e.onError&&!Oe(e.onError)&&(t=!1),t},Ge[exports.AssertRules.CHANNEL_ID]=Ae,Ge[exports.AssertRules.CONVERSATION]=function(e){var t=!0;return Se(e)||(t=!1),ve(e.targetId)||(t=!1),Ue(e.conversationType)||(t=!1),Me(e.channelId)||Ae(e.channelId)||(t=!1),t},Ge),Ze=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return I(t,e),t}(Error),$e=function(e,t,n,r){void 0===r&&(r=!1),n=ze[n]||n;var i=r?n(t):Me(t)||null==t||n(t);return i||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),i},et=function(e){if(!Se(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)},tt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=je(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s=".".concat(a[a.length-1])}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(o).concat(r).concat(s)},nt=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,r=e.apnsCollapseId,i=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h=t.miLargeIconUrl,d=t.importanceHW,p=t.categoryHW,g=t.imageUrlHW,f=t.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=r||"",_.category=i||"",_.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 y=[{HW:{channelId:a||"",importance:d||"NORMAL",image:g||"",category:p||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||"",category:f||""}},{APNS:_},{FCM:E}];return JSON.stringify(y)},rt=function(e,t,n){var r={},i={notificationId:n||""};if(!t)return{iOSConfig:r,androidConfig:i};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 p=d[0];switch(p){case"HW":return i.channelIdHW=null===(t=e[p])||void 0===t?void 0:t.channelId,i.importanceHW=null===(n=e[p])||void 0===n?void 0:n.importance,i.imageUrlHW=null===(o=e[p])||void 0===o?void 0:o.image,void(i.categoryHW=null===(s=e[p])||void 0===s?void 0:s.category);case"MI":return i.channelIdMi=null===(a=e[p])||void 0===a?void 0:a.channelId,void(i.miLargeIconUrl=null===(u=e[p])||void 0===u?void 0:u.large_icon_uri);case"OPPO":return void(i.channelIdOPPO=null===(c=e[p])||void 0===c?void 0:c.channelId);case"VIVO":return i.typeVivo=null===(l=e[p])||void 0===l?void 0:l.classification,void(i.categoryVivo=null===(h=e[p])||void 0===h?void 0:h.category);case"APNS":return r.threadId=e[p]["thread-id"],r.apnsCollapseId=e[p]["apns-collapse-id"],r.category=e[p].category,void(r.richMediaUri=e[p].richMediaUri);case"FCM":i.googleConfig={collapseKey:e[p].collapse_key||"",imageUrl:e[p].imageUrl||"",priority:e[p].priority||""}}}}))}catch(n){e.error(exports.LogTagId.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:r,androidConfig:i}},it=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},ot=function(e){var t=e.length;return t<=4096&&t>=1},st=(Je=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+Je.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return Je=2047&++Je,parseInt(n,2)}),at=function(e,t,n){var r=null==n?void 0:n.isReverse;Se(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Ce(e)||ve(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()},ut=function(e,t){return at(e,(function(n,r){e[r]=t(n,r)})),e},ct=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return at(e,(function(e,r){t===e&&(n=r)})),n},lt=function(e,t){var n=[];return at(e,(function(e){n.push(e)})),-1!==ct(n,t)},ht=function(e){return JSON.parse(JSON.stringify(e))},dt=function(){return"undefined"!=typeof RCCppEngine},pt=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},gt=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(gt(e[n]));else for(var n in t={},e)t[n]=gt(e[n]);else t=e;return t},ft=function(e){var t;try{t=gt(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},_t={_delayTime:0,setTime:function(e){var t=(new Date).getTime();_t._delayTime=t-e},getTime:function(){var e=_t._delayTime;return(new Date).getTime()-e}},Et=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},Tt=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return m(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return R(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(r=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,o===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}(),yt="rtcRJoin_data",vt="rtcRExit",It="rtcRInfo",Ct="rtcUData",mt="rtcUPut",Rt="rtcUDel",St="rtcSetData",Ot="userSetData",Mt="rtcQryData",Lt="rtcDelData",Nt="rtcToken",Ut="rtcUserState",At="rtcUList",wt="viewerJoinR",bt="viewerExitR",Pt="rtcPullKv",xt="rtcIdentityChange",Dt="rtcInvite",Vt="rtcCancelInvite",Gt="rtcInviteAnswer",Bt="rtcEndInvite",kt="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"}(Xe||(Xe={}));var Ft=((We={})[Xe.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],We[Xe.RtcUserListOutput]=["users","token","sessionId","roomInfo"],We[Xe.SetUserStatusInput]=["status"],We[Xe.RtcSetDataInput]=["interior","target","key","value","objectName","content"],We[Xe.RtcUserSetDataInput]=["valueInfo","objectName","content"],We[Xe.RtcDataInput]=["interior","target","key","objectName","content"],We[Xe.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],We[Xe.MCFollowInput]=["state"],We[Xe.RtcTokenOutput]=["rtcToken"],We[Xe.RtcQryOutput]=["outInfo"],We[Xe.RtcQryUserOutDataInput]=["userId"],We[Xe.RtcUserOutDataOutput]=["user"],We[Xe.RtcQueryListInput]=["order"],We[Xe.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],We[Xe.RtcValueInfo]=["key","value"],We[Xe.RtcKeyDeleteInput]=["key"],We[Xe.RtcNotifyMsg]=["type","time","roomId"],We[Xe.RtcPullKV]=["timestamp","roomId"],We[Xe.RtcKVOutput]=["entries","bFullUpdate","syncTime"],We[Xe.RtcQueryUserJoinedInput]=["userId"],We[Xe.RtcQueryUserJoinedOutput]=["info"],We[Xe.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],We[Xe.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],We[Xe.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],We[Xe.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],We),Ht="\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(Xe.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(Xe.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(Xe.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(Xe.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(Xe.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Xe.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(Xe.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(Xe.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Xe.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(Xe.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Xe.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(Xe.RtcQryOutput,"{\n repeated ").concat(Xe.RtcValueInfo," outInfo=1;\n }\n message ").concat(Xe.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(Xe.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(Xe.RtcUserSetDataInput," {\n repeated ").concat(Xe.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Xe.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(Xe.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(Xe.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(Xe.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Xe.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(Xe.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Xe.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(Xe.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(Xe.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(Xe.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(Xe.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(Xe.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Xe.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(Xe.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(Xe.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(Xe.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"),Kt=function(){function e(e,t,n,r,i){this.runtime=e,this.rtcCodec=t,this._watcher=n,this._options=r,this.logger=i,this._appkey=this._options.appkey,this._rtcKVManager=new Tt(this)}return e.prototype.registerRTCSignalingListener=function(e){this._rtcSignalingListener=e},e.prototype.getInnerLogger=function(){return this.logger},e.prototype.pullRTCRoomEntry=function(e,t){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode(Xe.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,Pt,!0,t)];case 1:return n=u.sent(),r=n.code,i=n.buffer,r!==x.SUCCESS?[2,{code:r}]:(o=this.rtcCodec.decode(Xe.RtcKVOutput,i),s=o.entries,a=o.syncTime,s=(s||[]).map((function(e){return C(C({},e),{timestamp:et(e.timestamp)})})),this._watcher.onRTCDataChange(s,e),[2,{code:r,data:{kvEntries:s,syncTime:et(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(Xe.RtcNotifyMsg,e),n=t.time,r=t.type,i=t.roomId;1===r&&this._rtcKVManager.pullEntry(i,et(n))}},e.prototype.destroy=function(){},e}();function qt(e){var t=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,o;return t?(o=(e>>>=0)>=0&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),o&&(u[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?f:g;if(t){if(e<0)return f;if(e>=h)return v}else{if(-d>=e)return I;if(e+1>=d)return y}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,u,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return o(e.substring(1),t,n).neg();for(s=r(c(n,8)),a=g,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=r(c(n,l)),a=a.mul(d).add(r(h))):a=(a=a.mul(s)).add(r(h));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}var a,u,c,l,h,d,p,g,f,_,E,T,y,v,I,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=r,e.fromBits=i,c=Math.pow,e.fromString=o,e.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),e.ZERO=g,f=n(0,!0),e.UZERO=f,_=n(1),e.ONE=_,E=n(1,!0),e.UONE=E,T=n(-1),e.NEG_ONE=T,y=i(-1,2147483647,!1),e.MAX_VALUE=y,v=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=v,I=i(0,-2147483648,!1),e.MIN_VALUE=I,(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,i,o,s,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(I)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(o=r(c(e,6),this.unsigned),s=this,a="";;){if(u=s.div(o),l=(s.sub(u.mul(o)).toInt()>>>0).toString(e),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},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(I)?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(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(_)},C.neg=C.negate,C.add=function(e){var n,r,o,a,u,c,l,h,d,p,g;return t(e)||(e=s(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&e.low))>>>16,d+=(p+=o+l)>>>16,h+=(d+=r+c)>>>16,h+=n+u,i((p&=65535)<<16|(g&=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,T;return this.isZero()?g:(t(e)||(e=s(e)),e.isZero()?g:this.eq(I)?e.isOdd()?I:g:e.eq(I)?this.isOdd()?I:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(p)&&e.lt(p)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,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,i((E&=65535)<<16|(T&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},C.mul=C.multiply,C.divide=function(e){var n,i,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:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return E;o=f}else{if(this.eq(I))return e.eq(_)||e.eq(T)?I:e.eq(I)?_:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?_:T:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(I))return this.unsigned?f:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=r(n)).mul(e);h.isNegative()||h.gt(i);)h=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=_),o=o.add(l),i=i.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 i(~this.low,~this.high,this.unsigned)},C.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return t(e)||(e=s(e)),i(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?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(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?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},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?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:i(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 r(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;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*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,g=r?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+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,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=g,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=255&s,p+=g,s/=256,c-=8);e[n+p-g]|=128*f}var o,s,a,u,c,l=function(e,t,n){if(void 0===e&&(e=l.DEFAULT_CAPACITY),void 0===t&&(t=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,o,s,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,s=0,a=e.length;a>s;++s)l.isByteBuffer(e[s])||(e[s]=l.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new l(0,n,r);for(c=new l(i,n,r),s=0;a>s;)(o=(u=e[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=o);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var i,s;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(0,n,r),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new l(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((i=new l(e.length,n,r)).limit=e.length,s=0;s<e.length;++s)i.view[s]=e[s]}return i},o.writeBitSet=function(e,t){var n,r,i,o,s,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(r=t,o=(i=e.length)>>3,s=0,t+=this.writeVarint32(i,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(i>s){for(a=0,n=0;i>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,i,o,s,a,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;i--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(r>o)for(a=0,t=this.readByte(e++);r>o;)s[o++]=!!(1&t>>a++);return u&&(this.offset=e),s},o.readBytes=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!1),o&&(this.offset+=8),i},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!0),o&&(this.offset+=8),i},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=r=l.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(0!=(128&t));return r|=0,o?(this.offset=e,r):{value:r,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var r,i,o,s,a,u=void 0===n;if(u&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=l.calculateVarint64(t),i=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return u?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,i,o,s,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,r=0,i=0,o=0,s=0,r=127&(s=this.view[t++]),128&s&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(i=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|o<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=c.calculateUTF16asUTF8(t(e))[1],n+=i+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):i},o.readCString=function(e){var t,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,i=-1,c.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),o?(this.offset=e,r()):{string:r(),length:e-t}},o.writeIString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+r,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r):(this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),n+=4,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return s?(this.offset=n,this):n-i},o.readIString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=n,r=c.calculateUTF16asUTF8(t(e))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-i},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(e,t,r){var i,o,s,a,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=r,t===l.METRICS_CHARS){if(o=n(),c.decodeUTF8(function(){return e>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++s,c.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(u=r+e,c.decodeUTF8toUTF16(function(){return u>r?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return i?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,i,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+r,n+=this.writeVarint32(r,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},o.append=function(e,t,n){var r,i,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new l(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,r,i;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0===(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).set(this.view.subarray(e,t)),this.buffer=r,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var i,o,s;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=r-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var r,i,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((o=i-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?s:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},u=function(){var e,t,n={},r=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[];for(e=0,t=r.length;t>e;++e)i[r[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(r[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(r[63&(i|3&n>>6)]),t(r[63&n])):(t(r[63&i]),t(61))):(t(r[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,o,s;null!==(r=e());)if(void 0===(o=i[r])&&n(r),null!==(r=e())&&(void 0===(s=i[r])&&n(r),t(o<<2>>>0|(48&s)>>4),null!==(r=e()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(s=i[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},o.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new l(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}i+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return e?s:i},l.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new l(0|(o+1)/3,t,n),a=0,u=0,c=!1,h=!1,d=!1,p=!1,g=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}s.offset=u,c=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(e,t,n){var r,i,o,s,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(i=e.length,o=new l(0|i/2,t),s=0,a=0;i>s;s+=2){if(r=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},c=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,r,i,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(r=e())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&s([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n);null!==r&&t(r)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,r=0;return e.UTF16toUTF8(t,(function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4})),[n,r]}};return e}(),o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{c.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return c.encodeUTF16toUTF8(t(e),(function(e){i.view[o++]=e})),i.limit=o,i},l}(t),r=function(t,n){var r,i,o={};return o.ByteBuffer=t,o.c=t,r=t,o.Long=n||null,o.VERSION="5.0.1",o.WIRE_TYPES={},o.WIRE_TYPES.VARINT=0,o.WIRE_TYPES.BITS64=1,o.WIRE_TYPES.LDELIM=2,o.WIRE_TYPES.STARTGROUP=3,o.WIRE_TYPES.ENDGROUP=4,o.WIRE_TYPES.BITS32=5,o.PACKABLE_WIRE_TYPES=[o.WIRE_TYPES.VARINT,o.WIRE_TYPES.BITS64,o.WIRE_TYPES.BITS32],o.TYPES={int32:{name:"int32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},uint64:{name:"uint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.UZERO:void 0},sint64:{name:"sint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},bool:{name:"bool",wireType:o.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:o.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:o.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.ZERO:void 0},float:{name:"float",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:o.WIRE_TYPES.STARTGROUP,defaultValue:null}},o.MAP_KEY_TYPES=[o.TYPES.int32,o.TYPES.sint32,o.TYPES.sfixed32,o.TYPES.uint32,o.TYPES.fixed32,o.TYPES.int64,o.TYPES.sint64,o.TYPES.sfixed64,o.TYPES.uint64,o.TYPES.fixed64,o.TYPES.bool,o.TYPES.string,o.TYPES.bytes],o.ID_MIN=1,o.ID_MAX=536870911,o.convertFieldsToCamelCase=!1,o.populateAccessors=!0,o.populateDefaults=!0,o.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),o.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},o.DotProto=function(e,t){function n(e,n){var r=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|i*r,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,r,i,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(o=this.source.substring(this.index,this.index=i))||"'"===o)&&(this._stringOpen=o),o},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,o=function(e){this.tn=new u(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var r,i=this.tn.next(),o=!1;if("("===i&&(o=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,o&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},s._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,r,i="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.response_stream=!0,o=this.tn.next()),r.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},s._parseMessage=function(e,r){var i=!!r,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(s.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,r,i){var o,s,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,r,i,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,i=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var r,i={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(i.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(i);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},s._parseExtensionRanges=function(){var t,n,i,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":i=e.ID_MIN;break;case"max":i=e.ID_MAX;break;default:i=r(t)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(e){function n(t,n){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}function i(t,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case e.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:i(s,n);break;case e.WIRE_TYPES.ENDGROUP:if(s===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+o)}return!0}var o,s,a,u,c,l,h,d,p,g,f,_,E,T,y,v,I={},C=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},m=C.prototype;return m.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},m.toString=function(e){return(e?this.className+" ":"")+this.fqn()},m.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},I.T=C,o=function(e,t,n,r,i){C.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(s=o.prototype=Object.create(C.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},s.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,o=0;if(""===r[o]){for(;null!==i.parent;)i=i.parent;o++}do{do{if(!(i instanceof I.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof I.T&&(!t||n instanceof I.Namespace))){i=null;break}i=n,o++}while(o<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},s.qn=function(e){var t,n,r=[],i=e;do{r.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof I.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof o&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var e,t,n,r,i={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],r=this.options[o[e]],i[n]=r;return i},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},I.Namespace=o,a=function(t,n,r,i){if(this.type=t,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},u=a.prototype,a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new r(0):t.defaultValue},u.verifyValue=function(r){var i,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r>4294967295?0|r:r;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r<0?r>>>0:r;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(r,!1)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(r,!0)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof r&&a(typeof r,"not a boolean"),r;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof r&&a(typeof r,"not a number"),r;case e.TYPES.string:return"string"==typeof r||r&&r instanceof String||a(typeof r,"not a string"),""+r;case e.TYPES.bytes:return t.isByteBuffer(r)?r:t.wrap(r);case e.TYPES.enum:for(i=this.resolvedType.getChildren(e.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==r)return i[s].id;if(i[s].id==r)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),(r>4294967295||r<0)&&a(typeof r,"not in range for uint32"),r;a(r,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(r&&"object"==typeof r||a(typeof r,"object expected"),r instanceof this.resolvedType.clazz)return r;if(r instanceof e.Builder.Message){for(s in o={},r)r.hasOwnProperty(s)&&(o[s]=r[s]);r=o}return new this.resolvedType.clazz(r)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+r+" (undefined type "+this.type+")")},u.calculateLength=function(t,n){if(null===n)return 0;var i;switch(this.type){case e.TYPES.int32:return n<0?r.calculateVarint64(n):r.calculateVarint32(n);case e.TYPES.uint32:return r.calculateVarint32(n);case e.TYPES.sint32:return r.calculateVarint32(r.zigZagEncode32(n));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return r.calculateVarint64(n);case e.TYPES.sint64:return r.calculateVarint64(r.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return r.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return i=r.calculateUTF8Bytes(n),r.calculateVarint32(i)+i;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return r.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return i=this.resolvedType.calculate(n),r.calculateVarint32(i)+i;case e.TYPES.group:return(i=this.resolvedType.calculate(n))+r.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},u.encodeValue=function(t,n,i){var o,s;if(null===n)return i;switch(this.type){case e.TYPES.int32:n<0?i.writeVarint64(n):i.writeVarint32(n);break;case e.TYPES.uint32:i.writeVarint32(n);break;case e.TYPES.sint32:i.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:i.writeUint32(n);break;case e.TYPES.sfixed32:i.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:i.writeVarint64(n);break;case e.TYPES.sint64:i.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:i.writeUint64(n);break;case e.TYPES.sfixed64:i.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?i.writeVarint32("false"===n.toLowerCase()?0:!!n):i.writeVarint32(n?1:0);break;case e.TYPES.enum:i.writeVarint32(n);break;case e.TYPES.float:i.writeFloat32(n);break;case e.TYPES.double:i.writeFloat64(n);break;case e.TYPES.string:i.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,i.writeVarint32(n.remaining()),i.append(n),n.offset=o;break;case e.TYPES.message:s=(new r).LE(),this.resolvedType.encode(n,s),i.writeVarint32(s.offset),i.append(s.flip());break;case e.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i},u.decode=function(t,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(o=t.readVarint32(),t.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+t.remaining());return(i=t.clone()).limit=i.offset+o,t.offset+=o,i;case e.TYPES.message:return o=t.readVarint32(),this.resolvedType.decode(t,o);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return r.fromBinary(t)}},u.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},I.Element=a,c=function(e,t,n,r,i,s){o.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=c.prototype=Object.create(o.prototype)).build=function(n){var i,o,s,a;if(this.clazz&&!n)return this.clazz;for(i=function(e,n){function i(t,n,o,s){var a,u,c,l,h,d,p;if(null===t||"object"!=typeof t)return s&&s instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(s.object,t))?a:t;if(r.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return o?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return u=[],t.forEach((function(e,t){u[t]=i(e,n,o,s)})),u;if(u={},t instanceof e.Map){for(l=(c=t.entries()).next();!l.done;l=c.next())u[t.keyElem.valueToString(l.value[0])]=i(l.value[1],n,o,t.valueElem.resolvedType);return u}for(p in h=t.$type,d=void 0,t)t.hasOwnProperty(p)&&(u[p]=h&&(d=h.getChild(p))?i(t[p],n,o,d.resolvedType):i(t[p],n,o));return u}var o,s,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var i,o,s,l;for(e.Builder.Message.call(this),i=0,o=u.length;o>i;++i)this[u[i].name]=null;for(i=0,o=a.length;o>i;++i)this[(s=a[i]).name]=s.repeated?[]:s.map?new e.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof c)||Array.isArray(t)||t instanceof e.Map||r.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(i=0,o=arguments.length;o>i;++i)void 0!==(l=arguments[i])&&this.$set(a[i].name,l);else this.$set(t)},l=c.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,r,i){var o=n._fieldsByName[t];if(!i){if(!o)throw Error(this+"#"+t+" is undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+t+" is not a repeated field");r=o.verifyValue(r,!0)}return null===this[t]&&(this[t]=[]),this[t].push(r),this},l.$add=l.add,l.set=function(t,r,i){var o,s,a;if(t&&"object"==typeof t){for(o in i=r,t)t.hasOwnProperty(o)&&void 0!==(r=t[o])&&this.$set(o,r,i);return this}if(s=n._fieldsByName[t],i)this[t]=r;else{if(!s)throw Error(this+"#"+t+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));this[s.name]=r=s.verifyValue(r)}return s&&s.oneof&&(a=this[s.oneof.name],null!==r?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===t&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(t,r){if(r)return this[t];var i=n._fieldsByName[t];if(!(i&&i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+i.toString(!0));return this[i.name]},l.$get=l.get,o=0;o<a.length;o++)(s=a[o])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,r,i,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),r=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===n.getChild("set"+o)&&(l["set"+o]=r),null===n.getChild("set_"+t)&&(l["set_"+t]=r),null===n.getChild("get"+o)&&(l["get"+o]=i),null===n.getChild("get_"+t)&&(l["get_"+t]=i)}(s);return l.encode=function(e,r){var i,o;"boolean"==typeof e&&(r=e,e=void 0),i=!1,e||(e=new t,i=!0),o=e.littleEndian;try{return n.encode(this,e.LE(),r),(i?e.flip():e).LE(o)}catch(t){throw e.LE(o),t}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,i=!1;return e||(e=new r,i=!0),t=(new r).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.decode=function(e,t){var i,o;"string"==typeof e&&(e=r.wrap(e,t||"base64")),i=(e=r.isByteBuffer(e)?e:r.wrap(e)).littleEndian;try{return o=n.decode(e.LE()),e.LE(i),o}catch(t){throw e.LE(i),t}},c.decodeDelimited=function(e,t){var i,o,s;if("string"==typeof e&&(e=r.wrap(e,t||"base64")),(e=r.isByteBuffer(e)?e:r.wrap(e)).remaining()<1)return null;if(i=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=n.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),c}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof f||o instanceof c||o instanceof T){if(i.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");i[o.name]=o.build()}else if(o instanceof c.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof c.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,o,s,a,u=null;for(o=0,s=this._fields.length;s>o;++o)i=e[(r=this._fields[o]).name],r.required&&null===i?null===u&&(u=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,r=0,i=0,o=this._fields.length;o>i;++i){if(n=e[(t=this._fields[i]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},l.decode=function(t,n,r){var o,s,a,u,c,l,h,d,p,g,f,_;for(n="number"==typeof n?n:-1,c=t.offset,l=new this.clazz;t.offset<c+n||-1===n&&t.remaining()>0;){if(a=(o=t.readVarint32())>>>3,(s=7&o)===e.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(s,t)):u.map?(d=u.decode(s,t),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(s,t),u.oneof&&(null!==(p=l[u.oneof.name])&&p!==u.name&&(l[p]=null),l[u.oneof.name]=u.name));else switch(s){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:h=t.readVarint32(),t.offset+=h;break;case e.WIRE_TYPES.STARTGROUP:for(;i(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(g=0,f=this._fields.length;f>g;++g)if(null===l[(u=this._fields[g]).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},I.Message=c,h=function(t,n,r,i,o,s,a,u,l,h){C.call(this,t,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=a,this.options=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=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 r,i,o;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),o=[],i=0;i<t.length;i++)o.push(this.element.verifyValue(t[i]));return o}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},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,i){var o,s,a,u,c;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],n);a=n.offset-s,(u=r.calculateVarint32(a))>1&&(c=n.slice(s,n.offset),s+=u-1,n.offset=s,n.append(c)),n.writeVarint32(a,s-u)}else for(o=0;o<t.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[o],n);else this.map?t.forEach((function(t,i){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(o),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,i)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},d.calculate=function(t,n){var i,o,s;if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s=0,o=0;o<t.length;o++)s+=this.element.calculateLength(this.id,t[o]);i+=r.calculateVarint32(s),i+=s}else for(o=0;o<t.length;o++)i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t[o]);else this.map?t.forEach((function(t,n){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i+=r.calculateVarint32(o),i+=o}),this):this.hasWirePresence(t,n)&&(i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return i},d.decode=function(t,n,r){var i,o,s,u,c,l,h;if(!(!this.map&&t==this.type.wireType||!r&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(u=a.defaultFieldValue(this.keyType),i=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+o,n.offset+=o;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,t,h)}return[u,i]}return this.element.decode(n,t,this.id)},I.Message.Field=h,p=function(e,t,n,r,i,o,s){h.call(this,e,t,n,null,r,i,o,s),this.extension},p.prototype=Object.create(h.prototype),I.Message.ExtensionField=p,g=function(e,t,n){C.call(this,e,t,n),this.fields=[]},I.Message.OneOf=g,f=function(e,t,n,r,i){o.call(this,e,t,n,r,i),this.className="Enum",this.object=null},f.getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(t){var n,r,i,o;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,i=0,o=(r=this.getChildren(f.Value)).length;o>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},I.Enum=f,_=function(e,t,n,r){C.call(this,e,t,n),this.className="Enum.Value",this.id=r},_.prototype=Object.create(C.prototype),I.Enum.Value=_,E=function(e,t,n,r){C.call(this,e,t,n),this.field=r},E.prototype=Object.create(C.prototype),I.Extension=E,T=function(e,t,n,r){o.call(this,e,t,n,r),this.className="Service",this.clazz=null},(T.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,i=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=i.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(e){o[e.name]=function(n,i){try{try{n=e.resolvedRequestType.clazz.decode(r.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void i(null,r):void i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:i[e.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),i}(e,this)},I.Service=T,y=function(e,t,n,r){C.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(y.prototype=Object.create(C.prototype)).buildOpt=s.buildOpt,I.Service.Method=y,v=function(e,t,n,r,i,o,s,a){y.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},v.prototype=Object.create(y.prototype),I.Service.RPCMethod=v,I}(o),o.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var r,o,s,a,u;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),i.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),u=[],o.enums&&o.enums.forEach((function(e){u.push(e)})),o.messages&&o.messages.forEach((function(e){u.push(e)})),o.services&&o.services.forEach((function(e){u.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),u.length>0){r.push(t),t=u,u=null,this.ptr=s,s=null;continue}u=null}else if(i.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(i.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,i,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i,o,s,a,u,c,l,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(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=i+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&&r(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 r;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(r=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,r;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(o,o.Lang,o.Reflect),o.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,i,o,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(r=Object.keys(n),i=0;i<r.length;i++)o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,o.Reflect),o.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),o.loadJson(o.DotProto.Parser.parse(e),t,n)},o.protoFromString=o.loadProto,o.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadProto(r,n,e)},o.protoFromFile=o.loadProtoFile,o.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=o.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=o.populateAccessors),new o.Builder(e)},o.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=o.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},o.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadJson(JSON.parse(r),n,e)},i=e,o.loadProto(i,void 0,"").build("Modules").probuf}(n,t);return r}var Yt,jt,Qt,Jt,Wt,Xt,zt,Zt=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=qt(t)}return e.prototype.getModule=function(e){return new this.pbModules[e]},e.prototype.encode=function(e,t,n){var r=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((function(e){var n=t[e];void 0!==n&&r["set".concat(function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e.replace(r,(function(e){return e.toUpperCase()}))}(e,0,1))](n)}))}catch(t){var i="pbname: ".concat(e,", stack: ").concat(t.stack);this.logger?this.logger.error(exports.LogTagId.L_PB_ENCODE_E,i):null===console||void 0===console||console.error(exports.LogTagId.L_PB_ENCODE_E,i)}return n?r:r.toArrayBuffer()},e.prototype.decode=function(e,t){var n=this.pbModules[e].decode(t);return this.fixInt64Values(n)},e.prototype.fixInt64Values=function(e){var t=this;if(e instanceof Array)return e.map((function(e){return t.fixInt64Values(e)}));if(!Se(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){var n=e.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var r in e)e[r]=this.fixInt64Values(e[r]);return e},e}(),$t=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 m(this,void 0,void 0,(function(){return R(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.7.8"},e.prototype.getAPIVersion=function(){return"5.7.8"},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._context.registerMessageType(e,t,n,r)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getOSInfo=function(){return this._context.getOSInfo()},e.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._context.setCallInfo(e,t,n)},e.prototype.createLogger=function(e,t){return this._context.createLogger(e,t)},e}(),en="pgMsgP",tn="chatMsg",nn="pcMsgP",rn={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},on="delMsg",sn="joinChrm",an="joinChrmR",un="exitChrm",cn="setKV",ln="delKV",hn="setKVS",dn="delKVS",pn="qryRelationR",gn="delRelation",fn="setSeAtt",_n={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},En="qryPMsg",Tn="qryGMsg",yn="qryCHMsg",vn="qryCMsg",In="qrySMsg",Cn=((Yt={})["ppMsgP"]=V.PRIVATE,Yt[en]=V.GROUP,Yt[tn]=V.CHATROOM,Yt[nn]=V.CUSTOMER_SERVICE,Yt),mn=((jt={})[V.PRIVATE]=En,jt[V.GROUP]=Tn,jt[V.CHATROOM]=yn,jt[V.CUSTOMER_SERVICE]=vn,jt[V.SYSTEM]=In,jt),Rn=((Qt={})[V.PRIVATE]=_n.PRIVATE,Qt[V.GROUP]=_n.GROUP,Qt[V.ULTRA_GROUP]=_n.ULTRA_GROUP,Qt[V.CUSTOMER_SERVICE]=_n.CUSTOMER_SERVICE,Qt[V.SYSTEM]=_n.SYSTEM,Qt),Sn="1",On="0",Mn=1,Ln=2,Nn=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"}(Jt||(Jt={})),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"}(Wt||(Wt={})),function(e){e.PUB="pub",e.QUERY="qry"}(Xt||(Xt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(zt||(zt={}));var Un,An=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=Jt.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=Jt.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=r)}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}(),wn=function(){function e(){}return e.writeUTF=function(e,t){for(var n=this._getBackAndByteSize(e),r=n.back,i=n.byteSize,o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return t?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},e._getBackAndByteSize=function(e){var t=[],n=0;if(ve(e))for(var r=0,i=e.length;r<i;r++){var o=e.charCodeAt(r);o>=0&&o<=127?(n+=1,t.push(o)):o>=128&&o<=2047?(n+=2,t.push(192|31&o>>6),t.push(128|63&o)):o>=2048&&o<=65535&&(n+=3,t.push(224|15&o>>12),t.push(128|63&o>>6),t.push(128|63&o))}return{byteSize:n,back:t}},e.readUTF=function(e){for(var t,n,r=[],i=-1,o=e,s="";++i<o.length;){var a=Number(o[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++i])<<6|128^o[++i]:192==(192&a)&&(a=(a^=192)<<6|128^o[++i])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===o.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},e}(),bn=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;var n=this._pool.subarray(t,this._position);return wn.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),Pn=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=wn.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),xn=function(e,t){return e&&t?"".concat(t,"_").concat(e):e||Date.now()},Dn=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 xn(e,t)},e.prototype.read=function(e,t,n,r){this.readMessage(e,t,n,r)},e.prototype.readMessage=function(e,t,n,r){return{stream:t,length:n}},e}(),Vn=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new An(e,!1,Jt.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return xn(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 Pn;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),Gn=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 I(t,e),t.prototype.readMessage=function(e,n,r,i){if(n.readByte(),this.status=+n.readByte(),r<=t.MESSAGE_LENGTH)return{stream:n,length:r};if(i===zt.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(exports.LogTagId.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:r}},t.MESSAGE_LENGTH=2,t}(Dn),Bn=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return I(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}(Dn),kn=function(e){function t(){return e.call(this,Wt.PING_REQ)||this}return I(t,e),t.prototype.writeMessage=function(e){},t}(Vn),Fn=function(e){function t(t){return e.call(this,t)||this}return I(t,e),t}(Dn),Hn=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return I(t,e),t.prototype.readMessage=function(e,t,n){var r=256*t.readByte()+t.readByte();return this.messageId=parseInt(r.toString(),10),{stream:t,length:n}},t}(Dn),Kn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return I(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)},t}(Vn),qn=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Xt.PUB,t}return I(t,e),t.prototype.readMessage=function(t,n,r){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),e.prototype.readMessage.call(this,t,n,r),this.data=n.readAll(),{stream:n,length:r}},t}(Hn),Yn=function(e){function t(t,n,r){var i=e.call(this,Wt.PUBLISH)||this;return i.syncMsg=!1,i.identifier=Xt.PUB,i.topic=t,i.data=ve(n)?wn.writeUTF(n):n,i.targetId=r,i}return I(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}(Kn),jn=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=Xt.PUB,t.topic="",t.targetId="",t}return I(t,e),t.prototype.readMessage=function(t,n,r){return e.prototype.readMessage.call(this,t,n,r),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:r}},t}(Hn),Qn=function(e){function t(t){var n=e.call(this,Wt.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return I(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Kn),Jn=function(e){function t(t,n,r){var i=e.call(this,Wt.QUERY)||this;return i.identifier=Xt.QUERY,i.topic=t,i.data=ve(n)?wn.writeUTF(n):n,i.targetId=r,i}return I(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}(Kn),Wn=function(e){function t(t){var n=e.call(this,Wt.QUERY_CONFIRM)||this;return n.messageId=t,n}return I(t,e),t}(Kn),Xn=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=Xt.QUERY,t.topic="",t.targetId="",t}return I(t,e),t.prototype.readMessage=function(t,n,r){return e.prototype.readMessage.call(this,t,n,r),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:r}},t}(Hn),zn=function(e,t,n){var r=new Uint8Array(t),i=new bn(r),o=i.readByte(),s=function(e,t){var n,r=e.type;switch(r){case Wt.CONN_ACK:n=new Gn(e);break;case Wt.PUBLISH:(n=new qn(e)).syncMsg=e.syncMsg;break;case Wt.PUB_ACK:n=new jn(e);break;case Wt.QUERY_ACK:n=new Xn(e);break;case Wt.SUB_ACK:case Wt.UNSUB_ACK:case Wt.PING_RESP:n=new Fn(e);break;case Wt.DISCONNECT:n=new Bn(e);break;default:n=new Dn(e),t.error(exports.LogTagId.O,"No support for deserializing ".concat(r," messages"))}return n}(new An(o),e);return s.read(e,i,r.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"}(Un||(Un={}));var Zn=Un,$n="outbox",er="inbox",tr="broadcastbox",nr=function(e,t,n){return[e,t,n].join("_")},rr=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 r=nr(er,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=nr(er,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||Me(e))){n.broadcastSyncTime=e;var r=nr(tr,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=nr(tr,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 r=nr($n,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=nr($n,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}},or=function(){function e(e,t,n){this.logger=e,this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=r===ee.DELETE,u=s===o,c=!this._isExisted(n),l=a?this._remove:this._add;(t||i||u||c)&&l.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,r=e.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,r)}))},e.prototype.clear=function(){this._kvCaches={}},e}(),sr=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return m(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return R(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(r=ir.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,this._isPulling=!1,o===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 r=this._storeCaches[e];Ne(r)||(r=new or(this._engine.getInnerLogger(),e,n)),r.setEntries(t),this._storeCaches[e]=r},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getVersion=function(e,t){var n=this._storeCaches[e];return n?n.getVersion(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),ar=function(){function e(e,t,n,r,i){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=r,this.logger=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){this.logger.error(exports.LogTagId.O,"parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],Ne(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}(),ur="converStatusChanged",cr=function(){function e(e,t,n){this._eventEmitter=new be,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n),this._oldStorage=E(e.runtime),this._storage=new y(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(exports.LogTagId.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},e.prototype._set=function(e){var t=this;if(!Me(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(ur,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return m(this,void 0,void 0,(function(){var e,t,n,r;return R(this,(function(i){switch(i.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=i.sent(),n=t.code,r=t.data,n===x.SUCCESS?(this._isPulling=!1,this._set(r),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(ur,(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}(),lr={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}},hr={};for(var dr in lr){var pr=lr[dr].keyName;hr[pr]=dr}var gr,fr=function(){function e(e,t,n,r){this._appkey=t,this._currentUserId=n,this.logger=r;var i="con-".concat(t,"-").concat(n);this.storage=new y(e,i),this._localStore=new y(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(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:V.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var r=this,i=e.conversationType,o=e.messageType,s=e.isMentioned,a=e.senderUserId;s&&i===V.GROUP&&((n.userIdList||[]).forEach((function(e){e===r._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===Q.ALL&&t.indexOf(a)<0&&t.push(a));if(o===F.RECALL&&i===V.GROUP){var u=t.indexOf(a);u>=0&&t.splice(u,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,r=e.content,i=e.channelId,o=r.mentionedInfo;if(o){var s=this._getStoreKey(t,n,i),a=this._localStore.get(s)||{},u=hr.mentionedInfo,c=hr.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]),Ne(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,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=hr[s],u=n[s];if(!Me(a)&&!Me(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===lr[a].defaultVal||"tags"===s&&!Ne(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,Ne(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in lr){var a=lr[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||ht(c)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),o={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},s=t[r];for(var a in s)if(lr[a]){var u=lr[a],c=u.keyName,l=u.defaultVal;o[c]=s[a]||ht(l)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,o=r.targetId,s={},a=e[n];for(var u in a){var c=lr[u],l=c.keyName,h=c.defaultVal;s[l]=a[u]||ht(h)}for(var d in s.tags){Me(t[d])&&(t[d]=[]);var p=C(C({},s),{conversationType:i,targetId:o});delete p.tags,t[d].push(p)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}this.storage.clear()}catch(e){this.logger.error(exports.LogTagId.O,"adaptOldStore error: ".concat(e.message))}},e.prototype.remove=function(e,t,n){var r=this._getStoreKey(e,t,n);this._localStore.remove(r)},e}(),_r=[V.PRIVATE,V.GROUP,V.SYSTEM,V.PUBLIC_SERVICE,V.APP_PUBLIC_SERVICE],Er={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},Tr=1e3,yr=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new be,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new fr(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new cr(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Er.CHANGED,(function(e){r(e)})),this._eventEmitter.on(Er.CON_TAG_STATUS_CHANGED,(function(){i()}));var s=this._store.getValue();s.length>Tr&&(s=s.sort((function(e,t){var n=e.lastMessageSentTime,r=void 0===n?0:n,i=t.lastMessageSentTime;return(void 0===i?0:i)-r})),s.splice(Tr,s.length).forEach((function(e){o._store.remove(e.conversationType,e.targetId,e.channelId)})))}return e.prototype._calcMsg=function(e,t,n,r){var i=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===r.sentTime})),o=t>=r.sentTime;return n&&(o=n<r.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:i}},e.prototype._calcUnreadCount=function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,u=s===b.SEND&&a===this._loginUserId,c=r===F.RECALL,l=Se(n),h=!1,d={},p=t.lastUnreadTime,g=t.lastReadTime,f=t.unreadMessageCount;if(p>i||u)return{hasChanged:h,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=f+1,t.lastUnreadTime=i,h=!0),c&&l){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),E=this._calcMsg(_,p,g,n),T=E.isNotRead,y=E.isNotRepeadRecallSendTime;T&&f&&y&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:h,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=e.messageDirection,i=e.isMentioned,o=e.sentTime,s=r===b.SEND,a=Se(n),u=!1,c={};return!s&&i&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:o},c.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===b.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===Q.ALL||(a||[]).includes(this._loginUserId)){i=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:i,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(Se(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),o=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,r){var i=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var o in i)if(!n[o]||!!i[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,o=e.notificationStatus,s=e.notificationLevel,a=e.isTop,u=e.tags,c=e.channelId,l={},h={};if(n!==V.ULTRA_GROUP){Me(o)||(h.notificationStatus={time:i,val:o}),Me(s)||(h.notificationLevel={time:i,val:s}),Me(a)||(h.isTop={time:i,val:a}),Me(u)||(h.tags={time:i,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,l,c);var d=this._store.get(n,r,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,r,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},c),this._setUpdatedConversation({conversationType:n,targetId:r,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(Er.CHANGED,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Er.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId,a=e.sentTime;if(_r.indexOf(r)>=0){var u=!1,c=this._store.get(r,o,s),l={};if(c.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,c),i=r.hasChanged,o=r.localConversation,s=r.updateItems;u=u||i,l=C(C({},l),s),c=ht(o)})),this._store.set(r,o,c,s),this._store.updateMentionedData(e),i){var h=this._store.get(r,o,s);h.updatedItems=C({latestMessage:{time:e.sentTime,val:e}},l),h.latestMessage=e;var d=Object.assign(h,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(d)}(u||i)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;r=r||0,(n||void 0!==s&&s<=0||void 0===s&&o!==K.OPEN)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),i},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(r){var o=r.unreadMessageCount,s=r.notificationLevel,a=void 0===s?0:s,u=r.conversationType,c=r.unreadMentionedCount;e.includes(u)&&(0===t.length||t.includes(a))&&(i+=(n?c:o)||0)})),i},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,i=e.notificationStatus,o=e.notificationLevel;(t||1!==i||-1===o||0===o)&&(n=n||0,r+=Number(n))})),r},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,r){void 0===r&&(r=!0);var i=this._store.get(e,t,n);i.lastReadTime=i.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=i.unreadMessageCount,s=i.hasMentioned,a={};if(o&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(a).length){var u=Object.assign(i,{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,r){var i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=n},e.prototype.getDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]},e.prototype.clearDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]},e.prototype.addTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r),o=i.tags;o=Object.assign(o,n);var s=i.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:o,lastMessageSentTime:s},r)},e.prototype.deleteTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;n.forEach((function(e){delete i[e]})),this._store.set(e,t,{tags:i},r)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===K.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)&&(Me(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}(),vr=function(){function e(e,t,n,r){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(t,"-").concat(n),this._storagePullTimeKey="us-s-".concat(t,"-").concat(n),this._storage=E(e.runtime),this._engine=e,this._tagWatcherFunc=r}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,r=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:r}})),this._storage.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 m(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return R(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,r=t.data,n!==x.SUCCESS||Me(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,Me(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}(),Ir=function(e){return e.replace(/@.+$/,"@")},Cr=function(){function e(e,t,n){this.appkey=e,this.logger=t,this.navigators=n,this.crtRequest=null}return e.prototype.request=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s;return R(this,(function(a){switch(a.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,r),[4,this.crtRequest]);case 1:return i=a.sent(),o=i.code,s=i.data,this.crtRequest=null,[2,{code:o,data:s}]}}))}))},e.prototype.sendRequest=function(e,t,n,o){return m(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,p,g,f,_,E,T,y;return R(this,(function(v){switch(v.label){case 0:return s=Ir(e),!t&&(a=this.getNaviCache(s))&&(u=a.timestamp,c=a.naviInfo,n||Date.now()-u<r)?(this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),o),[2,{code:x.SUCCESS,data:c}]):(l=e.split("@"),h=l[1],d=h?h.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],p=this.navigators&&this.navigators.length>0?this.navigators.filter((function(e){return/^https?:\/\//.test(e)})):[],g=i,this.logger.info(exports.LogTagId.L_GET_NAVI_T,JSON.stringify({token:e,customUris:p,defaultUris:g,dynamicUris:d}),o),f=S(S(S([],p,!0),d,!0),g,!0),[4,this.requestHandler(f,e,o)]);case 1:return _=v.sent(),E=_.code,T=_.data,E!==x.SUCCESS?(this.logger.warn(exports.LogTagId.L_GET_NAVI_R,E,o),[2,{code:E}]):(y=T,this.logger.info(exports.LogTagId.L_GET_NAVI_R,JSON.stringify({naviInfo:y}),o),this.setNaviCache(s,y),[2,{code:E,data:y}])}}))}))},e.prototype.requestHandler=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:r=0,i=e.length,c.label=1;case 1:return r<i?(o=r===e.length-1,[4,this.httpRequest(e[r],this.appkey,t,_,1e4,n,o)]):[3,4];case 2:if(s=c.sent(),a=s.code,u=s.data,a===x.SUCCESS)return[2,{code:a,data:u}];c.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(Ir(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(Ir(e),C(C({},n),{voipCallInfo:t}))},e}(),mr=function(e){return["navi",e].join("_")},Rr={},Sr=function(e){function t(t,n,r,i,s){var a=e.call(this,t,n,s||[])||this;return a.runtime=r,a.miniCmpUris=i,a.miniCmpUris||(a.miniCmpUris=o.join(",")),a}return I(t,e),t.prototype.httpRequest=function(e,t,n,r,i,o,u){return m(this,void 0,void 0,(function(){var c,l,h,d;return R(this,(function(p){switch(p.label){case 0:return c="".concat(e,"/navi.js?appId=").concat(t,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(r,"&r=").concat(Date.now()),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(c),o),[4,this.runtime.httpReq({url:c,timeout:i,dataType:"text"})];case 1:if(200!==(l=p.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(l.status),o),!this.runtime.useNavi&&u?(d={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https:// + ".concat(s),bosAddr:"https:// + ".concat(a),location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this.miniCmpUris},[2,{code:x.SUCCESS,data:d}]):[2,{code:this.transHttpCode(l.status)}];try{return 0===(h=l.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(h=JSON.parse('"'.concat(h,'"'))),(d=JSON.parse(h)).protocol=/^https/.test(c)?"https":"http",this.runtime.useNavi||(d.server="",d.backupServer=this.miniCmpUris,d.logSwitch=0),[2,{code:x.SUCCESS,data:d}]}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,l.data,o)}return[2,{code:x.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){if(Rr[e])return Rr[e];var t,n=mr(this.appkey),r=this.runtime.localStorage;try{var i=r.getItem(n);t=i?JSON.parse(i):[]}catch(e){t=[]}if(0===t.length)return null;var o=t.find((function(t){return t.token===e}))||null;return Rr[e]=o,o},t.prototype.setNaviCache=function(e,t){var n,i=mr(this.appkey),o=this.runtime.localStorage;try{var s=o.getItem(i);n=s?JSON.parse(s):[]}catch(e){n=[]}var a=Date.now();n.length>0&&(n=n.filter((function(t){return a-t.timestamp<r&&e!==t.token})));var u={timestamp:a,naviInfo:t,token:e};n.push(u),o.setItem(i,JSON.stringify(n)),Rr[e]=u},t}(Cr),Or=function(e,t){return["send_msg",e,t].join("_")},Mr=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=Or(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=Or(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=Or(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}(),Lr=function(e){var t="RCDeviceId",n=E(e),r="",i=n.get(t);return i?r=i:(r=Qe(),n.set(t,r)),r};(gr={})[V.PRIVATE]=Zn.qryPMsg,gr[V.GROUP]=Zn.qryGMsg,gr[V.CHATROOM]=Zn.qryCHMsg,gr[V.CUSTOMER_SERVICE]=Zn.qryCMsg,gr[V.SYSTEM]=Zn.qrySMsg;var Nr=[Zn[Zn.recallMsg],Zn[Zn.ppMsgS],Zn[Zn.pgMsgS],Zn[Zn.ppMsgP],Zn[Zn.pgMsgP],Zn[Zn.chatMsg],Zn[Zn.pcMsgP],Zn[Zn.prMsgS],Zn[Zn.updUgRTime]],Ur=function(){function e(e,t,n){this.ULTRA_GROUP_CONVERSATION="ultragroupconversation";var r="".concat(this.ULTRA_GROUP_CONVERSATION,"-").concat(t,"-").concat(n);this._localStore=new y(e,r)}return e.prototype.set=function(e,t,n,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=wr[s],u=n[s];if(!Me(a)&&!Me(u))u===Ar[a].defaultVal?delete o[a]:o[a]=u}Ne(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in Ar){var a=Ar[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||ht(c)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Ar={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},wr={};for(var br in Ar){var Pr=Ar[br].keyName;wr[Pr]=br}var xr,Dr=function(){function e(e,t,n){this._store=new Ur(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.notificationLevel,o=e.channelId;t===V.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:r,notificationLevel:i},o)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),Vr="UpStreamMessage",Gr="PushExtra",Br="DownStreamMessage",kr="DownStreamMessages",Fr="SessionsAttQryInput",Hr="SessionsAttOutput",Kr="SyncRequestMsg",qr="ChrmPullMsg",Yr="NotifyMsg",jr="HistoryMsgInput",Qr="HistoryMsgOuput",Jr="RelationQryInput",Wr="RelationsOutput",Xr="UnreadMsgInfo",zr="DeleteSessionsInput",Zr="SessionInfo",$r="DeleteSessionsOutput",ei="RelationsInput",ti="DeleteMsgInput",ni="CleanHisMsgInput",ri="SessionMsgReadInput",ii="ChrmInput",oi="ChrmOutput",si="QueryChatRoomInfoInput",ai="QueryChatRoomInfoOutput",ui="GetQNupTokenInput",ci="GetQNupTokenOutput",li="GetQNdownloadUrlInput",hi="GetDownloadUrlInput",di="GetQNdownloadUrlOutput",pi="GetDownloadUrlOutput",gi="ChrmKVEntity",fi="SetChrmKV",_i="SetChrmKVS",Ei="DeleteChrmKVS",Ti="ChrmKVOutput",yi="ChrmKVSOutput",vi="ChrmKVSVersionEntity",Ii="ChrmKVSOutputEntity",Ci="QueryChrmKV",mi="SetUserSettingInput",Ri="SetUserSettingOutput",Si="PullUserSettingInput",Oi="PullUserSettingOutput",Mi="UserSettingNotification",Li="SessionReq",Ni="SessionStates",Ui="SessionState",Ai="SessionStateItem",wi="SessionStateModifyReq",bi="SessionStateModifyResp",Pi="GroupUnpushQuery",xi="GroupUnpushSet",Di="QryRemindListReq",Vi="QryRemindListResp",Gi="GroupUnpushResult",Bi="GrpReadReceiptMsg",ki="GrpReadReceiptQryReq",Fi="GrpReadReceiptQryResp",Hi="GrpMsgReadUser",Ki="SessionTagAddInput",qi="SessionTagItem",Yi="SessionTagDelInput",ji="SessionDisTagReq",Qi="ReportSDKInput",Ji="ReportSDKOutput",Wi="UltraGrpPullSes",Xi="UltraGrpPullMsg",zi="MsgChangeReq",Zi="QueryMsgChange",$i="MsgChange",eo="MsgChangeList",to="MsgQuery",no="MessageQueryInfo",ro="MsgQueryAck",io="OperateStatus",oo="OperateStatusNotify",so="OperateInfo",ao="OperateSummary",uo="SetRtcRoomIdInput",co="SetRtcRoomIdOutput";(xr={})[Vr]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],xr[kr]=["list","syncTime","finished","broadcastSyncTime"],xr[Br]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],xr[Gr]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],xr[Fr]=["nothing"],xr[Hr]=["inboxTime","sendboxTime","totalUnreadCount"],xr[Kr]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],xr[qr]=["syncTime","count"],xr[Yr]=["type","time","chrmId"],xr[jr]=["targetId","time","count","order","busChannel"],xr[Qr]=["list","syncTime","hasMsg"],xr[Jr]=["type","count","startTime","order"],xr[Wr]=["info","isFinished"],xr[Xr]=["msgId","msgTime","remindType"],xr[zr]=["sessions"],xr[Zr]=["type","channelId","busChannel"],xr[$r]=["nothing"],xr[ei]=["type","msg","count","busChannel","startTime","endTime"],xr[ti]=["type","conversationId","msgs","busChannel"],xr[ni]=["targetId","dataTime","conversationType","busChannel"],xr[ri]=["type","msgTime","channelId","busChannel"],xr[ii]=["nothing"],xr[oi]=["nothing","sessionId","joinTime"],xr[si]=["count","order"],xr[ai]=["userTotalNums","userInfos"],xr[ui]=["type","key","httpMethod","queryString"],xr[li]=["type","key","fileName"],xr[hi]=["type","key","fileName"],xr[ci]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],xr[di]=["downloadUrl"],xr[pi]=["downloadUrl"],xr[gi]=["key","value","status","timestamp","uid","version"],xr[fi]=["entry","bNotify","notification","type"],xr[_i]=["entry","bNotify","notification","type"],xr[Ei]=["entry","bNotify","notification","type"],xr[Ti]=["entries","bFullUpdate","syncTime"],xr[yi]=["timestamp","errorKeys","keysVersion"],xr[vi]=["version","key"],xr[Ii]=["key","errorCode"],xr[Ci]=["timestamp"],xr[mi]=["version","value"],xr[Ri]=["version","reserve"],xr[Si]=["version","reserve"],xr[Oi]=["items","version"],xr.UserSettingItem=["targetId","type","key","value","version","status","tags"],xr[Li]=["time"],xr[Ni]=["version","state"],xr[Ui]=["type","channelId","time","stateItem","busChannel"],xr[Ai]=["sessionStateType","value","tags"],xr[wi]=["version","state"],xr[bi]=["version"],xr[xi]=["busChannel","unpushLevel"],xr[Di]=["groupId","busChannel","msgTime","size"],xr[Pi]=["busChannel"],xr[Gi]=["groupId","busChannel","unpushLevel"],xr[Bi]=["msgId","busChannel"],xr[ki]=["msgId","busChannel"],xr[Fi]=["totalMemberNum","list"],xr[Hi]=["readTime","userId"],xr[Ki]=["version","tags"],xr[qi]=["tagId","name","createdTime","isTop"],xr[Yi]=["version","tags"],xr[ji]=["tagId"],xr[Mi]=["version","reserve"],xr[Qi]=["sdkInfo"],xr[Ji]=["nothing"],xr[Wi]=["syncTime","isEraseMsgContent"],xr[Xi]=["syncTime"],xr[zi]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],xr[Zi]=["syncTime"],xr[eo]=["list","syncTime","hasNext"],xr[$i]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds"],xr[to]=["targetId","type","query"],xr[no]=["msgTime","msgUID","busChannel"],xr[ro]=["list"],xr[io]=["targetId","type","opType","busChannel"],xr[oo]=["type","notifyType","info","summary"],xr[so]=["targetId","busChannel","userId","opType","optime"],xr[ao]=["targetId","busChannel","count","opType"],xr[uo]=["rtcRoomId"],xr[co]=["nothing"];var lo,ho="\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(Kr," {\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(A.IMAGE,";\n audio = ").concat(A.AUDIO,";\n video = ").concat(A.VIDEO,";\n file = ").concat(A.FILE,";\n }\n message ").concat(ui," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(li," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(hi," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(ci," {\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(di," {\n required string downloadUrl = 1;\n }\n message ").concat(pi," {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n group_success = 0x00;\n group_failure = 0x01;\n }\n message ").concat(ii," {\n required int32 nothing = 1;\n }\n message ").concat(oi," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(qr," {\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(Jr,"\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(ei,"\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(Xr," msgInfo = 10;// 新增 首条未读消息信息,可为空\n }\n message ").concat(Xr," //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n }\n message ").concat(Di," // 新增 查询未读@列表入参\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(Vi," //查询未读@列表出参\n {\n repeated ").concat(Xr," 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(ni,"\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(si,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(ai,"\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(jr,"\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(Qr,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Fr,"{\n required int32 nothing = 1;\n }\n message ").concat(Hr,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(ri,"\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(zr,"\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($r,"\n {\n optional int32 nothing=1;\n }\n message ").concat(ti,"\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(fi," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(_i," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Ei," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Ti," {\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(yi," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Ii,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Ci," {\n required int64 timestamp = 1;\n }\n message ").concat(mi," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Ri," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Si," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Oi," {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message ").concat(Li," {\n required int64 time = 1;\n }\n message ").concat(Ni," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Ui," {\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(Ai," {\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(wi," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Pi," {\n optional string busChannel = 1;\n }\n message ").concat(xi,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(Gi," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(bi," {\n required int64 version=1;\n }\n message ").concat(Bi," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(ki," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Fi," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Hi," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(Ki," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(qi," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(Yi," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(ji," {\n repeated string tagId=1;\n }\n message ").concat(Mi," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Qi,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Ji,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Wi,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Xi,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(zi,"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message ").concat(Zi," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(eo," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat($i," //变更详情\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 }\n message ").concat(to," //请求\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(ro," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(io," //客户端发送\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(oo," //服务端发送\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(so," {\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(ao," {\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(uo,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(co,"\n {\n required int32 nothing = 1; //用于占位\n }\n}\n"),po=function(e,t,n,r,i,o){var s=i?Object.keys(i).map((function(t){return e.encode(Xe.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0,a=o?Object.keys(o).map((function(t){return e.encode(Xe.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(Xe.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:s,outerDatas:a})},go=function(e,t){var n=e.decode(Xe.RtcUserListOutput,t),r=n.users,i=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return at(r,(function(e){var t=e.userId,n=e.userData,r={};at(n,(function(e){var t=e.key,n=e.value;r[t]=n})),c[t]=r})),{users:c,token:i,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:u}};exports.LogL=void 0,(lo=exports.LogL||(exports.LogL={}))[lo.STATISTICS=-2]="STATISTICS",lo[lo.RECORD=-1]="RECORD",lo[lo.FATAL=0]="FATAL",lo[lo.ERROR=1]="ERROR",lo[lo.WARN=2]="WARN",lo[lo.INFO=3]="INFO",lo[lo.DEBUG=4]="DEBUG";var fo=function(e){return[exports.LogL.DEBUG,exports.LogL.INFO,exports.LogL.WARN,exports.LogL.ERROR].some((function(t){return t===e}))},_o=Qe(),Eo=Date.now(),To=0,yo=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=exports.LogL.WARN,this.debug=this._log.bind(this,exports.LogL.DEBUG),this.info=this._log.bind(this,exports.LogL.INFO),this.warn=this._log.bind(this,exports.LogL.WARN),this.error=this._log.bind(this,exports.LogL.ERROR),this.__statistics=this._log.bind(this,exports.LogL.STATISTICS)}return e.prototype._stdout=function(e,t,n,r,i){if(!(e<=exports.LogL.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(r," | ").concat(i))}},e.prototype.setOutputLevel=function(e){fo(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,r){var i=new Date;/^[\w-]+$/.test(t)?(this._stdout(e,t,i.toISOString(),n,r),e!==exports.LogL.DEBUG&&this.flush({time:+i,sessionId:_o,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:r})):this._stdout(exports.LogL.ERROR,"L_LOG_TAG_INVALID_E",i.toISOString(),t,r)},e.prototype.createTraceId=function(){return"".concat(_o,"-").concat(++To)},e.prototype.getSessionId=function(){return _o},e}(),vo=null,Io="RC_LOGS",Co="RC_CONF",mo=null,Ro=function(e){return m(void 0,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return[4,vo];case 1:return(t=n.sent())?[4,new Promise((function(n){var r=t.db.transaction(Io,"readwrite").objectStore(Io),i=IDBKeyRange.lowerBound(Date.now()-e),o=r.getAllKeys(i);o.onsuccess=function(){var e=o.result,t=e.length;if(t>0){var i=r.delete(IDBKeyRange.bound(e[0],e[t-1]));i.onsuccess=n,i.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),mo=setTimeout((function(){return Ro(e)}),6e5),[2]}}))}))},So=function(e,t,n,r){void 0===r&&(r=168),vo||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==pt(n).type?vo=new Promise((function(n){var i=window.indexedDB;i.databases&&i.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&i.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(e),s=i.open(o,1);s.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,e.target.error),n(null)},s.onsuccess=function(i){var o=i.target.result;o?(o.onclose=function(e){t.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(exports.LogTagId.L_LOGDB_ABORT_S,e.target.error)},Ro(3600*Math.max(24,Math.min(168,r))*1e3),n({appkey:e,db:o})):n(null)},s.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(Io)&&t.deleteObjectStore(Io);var n=t.createObjectStore(Io,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Co,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},Oo=function(){return m(void 0,void 0,void 0,(function(){var e;return R(this,(function(t){switch(t.label){case 0:return vo?(mo&&(clearTimeout(mo),mo=null),[4,vo]):[2];case 1:return(e=t.sent())&&e.db.close(),vo=null,[2]}}))}))},Mo=[],Lo=!1,No=function(e){return m(void 0,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return Lo||0===Mo.length?[2]:(Lo=!0,t=Mo.splice(0),[4,new Promise((function(n){var r=e.transaction(Io,"readwrite");r.oncomplete=n,r.onabort=n;var i=r.objectStore(Io);t.forEach((function(e){try{i.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),Lo=!1,setTimeout((function(){return No(e)})),[2]}}))}))};function Uo(e){return m(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return[4,vo];case 1:return(t=n.sent())?[2,new Promise((function(n){var r=t.db.transaction(Co,"readonly").objectStore(Co).get(e);r.onsuccess=function(e){var t;n({value:null===(t=r.result)||void 0===t?void 0:t.value,success:!0})},r.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Ao,wo,bo,Po,xo=0,Do=function(){return{setTimestamp4RealtimeLog:function(e){xo=e},getTimestamp4RealtimeLog:function(){return xo},getLogs:function(e,t,n,r){return m(this,void 0,void 0,(function(){var i;return R(this,(function(o){switch(o.label){case 0:return[4,vo];case 1:return(i=o.sent())?[2,new Promise((function(o){var s=i.db.transaction(Io,"readonly").objectStore(Io),a=[],u=IDBKeyRange.bound(e,t),c=s.index("time").openCursor(u);c.onsuccess=function(e){var t=e.target.result;if(t){var i=t.value;i.level<=n&&(r?i.sessionId===_o:i.level>=0)&&a.push(i),t.continue()}else o({dbReady:!0,logs:a})},c.onerror=function(e){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Vo="REPORT_SESSION",Go=function(e,t){return m(void 0,void 0,void 0,(function(){var n,r,i,o;return R(this,(function(s){switch(s.label){case 0:return n="".concat(Vo,"_").concat(e),[4,Uo("".concat(Vo,"_").concat(e))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(t===(null==o?void 0:o.sessionId)||function(e,t){m(this,void 0,void 0,(function(){var n,r;return R(this,(function(i){switch(i.label){case 0:return[4,vo];case 1:return(n=i.sent())?(r=n.db,r.transaction(Co,"readwrite").objectStore(Co).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},Bo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return I(t,e),t.prototype.flush=function(e){!function(e){m(void 0,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return[4,vo];case 1:return(t=n.sent())?(Mo.push(e),No(t.db),[2]):[2]}}))}))}(e)},t}(yo),ko=function(){function e(e,t,n,r,i){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=r,this.logger=i,this.userId="",this.timer=null,this.started=!1}return e.prototype.checkStart=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i;return R(this,(function(o){if(this.started)return[2];if(this.userId=e.userId,!e.logSwitch)return[2];t=p;try{t=JSON.parse(e.logPolicy)}catch(t){this.logger.warn(exports.LogTagId.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}return this.started=!0,n=t.url,r=t.level,i=t.itv,this.realtimeReport(n,r,i),[2]}))}))},e.prototype.realtimeReport=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h,d,p,g,f=this;return R(this,(function(_){switch(_.label){case 0:return r=Date.now(),i=this.logDB.getTimestamp4RealtimeLog()||Eo,o=Math.max(r-5e3,i),s=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:o,level:t}),s),[4,this.logDB.getLogs(i,o,t,!0)];case 1:return a=_.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"db error",s),[3,6]);case 2:return 0!==c.length?[3,3]:(this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,"no logs",s),[3,6]);case 3:return this.logger.info(exports.LogTagId.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(exports.LogTagId.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,"compress done",s),p=Le(e)?e:"https://".concat(e),p+="?version=".concat("5.7.8","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:p,body:d,method:"POST"})];case 5:g=_.sent().status,this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:g}),s),200===g&&this.logDB.setTimestamp4RealtimeLog(c[c.length-1].time+1),_.label=6;case 6:return this.started&&!this.timer&&(this.timer=setTimeout((function(){return f.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,r,i,o){return m(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,p,g,f;return R(this,(function(_){switch(_.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:i,messageUId:o}),s),[4,this.logDB.getLogs(e,t,exports.LogL.DEBUG,!1)]);case 1:return a=_.sent(),u=a.dbReady,c=a.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),l=Le(r)?r:"https://".concat(r),l+="?version=".concat("5.7.8","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),u?c.length>0?[4,this.compressLogs(c)]:[3,3]:[3,5];case 2:return d=_.sent(),p=d.success,g=d.data,h=p?g:"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(exports.LogTagId.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(exports.LogTagId.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}(),Fo=48,Ho=64,Ko=80,qo=96,Yo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",jo=Yo.length,Qo=function(e){for(var t={},n=0;n<e.length-1;n++){var r=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(r)?t[r].push(n):t[r]=[n]}for(var i=[],o=[],s=function(){if(o.length>0){var e=o.join("");if(o=[],e.length>26){var t=Wo(e.length),n=String.fromCharCode(Ko|t.length);i.push(n+t)}else{var r=String.fromCharCode(qo|e.length);i.push(r)}i.push(e)}},a=0;a<e.length;){var u=Jo(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=Wo(a-u.offset),l=Wo(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(Ho|c.length<<2|l.length);i.push(h+c+l),a+=u.length}}}s();var d=Wo(e.length),p=String.fromCharCode(Fo|d.length);return i.push(p+d),i.join("")},Jo=function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return r;for(var o=t.length-n,s=0,a=i.length;s<a;s++){var u=i[s],c=n-u;if(!(c>238327)){var l=Math.min(o,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var h=2,d=h;d<l&&t.charAt(u+d)===t.charAt(n+d);d++)h++;h>=r.length&&(r.length=h,r.offset=u)}}}return r},Wo=function(e){var t=[],n=0;do{n=e%jo,t.push(Yo.charAt(n)),e=(e-n)/jo}while(e>0);return t.join("")},Xo=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},zo=function(e){var t=e.sessionId,n=e.level,r=e.loggerId,i=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:i,from:r});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Zo=function(e){function t(t,n,r,i){var o=this,s=Lr(n),a=Xo(n),u="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=e.call(this,t,s,u,Do(),r)||this).runtime=n,o.clientReportLevel=i,fo(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return I(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return m(this,void 0,void 0,(function(){return R(this,(function(n){switch(n.label){case 0:return[4,Go(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,{success:!0,data:Qo(e.map(zo).join(""))}]}))}))},t.prototype.isReporter=function(){return m(this,void 0,void 0,(function(){return R(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),m(void 0,void 0,void 0,(function(){var e,r,i;return R(this,(function(o){switch(o.label){case 0:return[4,Uo("".concat(Vo,"_").concat(t))];case 1:return e=o.sent(),r=e.success,i=e.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,r,i,o,s){return m(this,void 0,void 0,(function(){return R(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,r,i,o,s)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,r){return m(this,void 0,void 0,(function(){return R(this,(function(i){return[2,e.prototype.realtimeReport.call(this,t,n,r)]}))}))},t}(ko);!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"}(Ao||(Ao={})),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"}(wo||(wo={}));var $o,es=((bo={})[wo.OTHER_DEVICE_LOGIN]=x.RC_DISCONN_KICK,bo[wo.BLOCK]=x.RC_DISCONN_EXCEPTION,bo[wo.BLOCK_NEW]=x.RC_DISCONN_EXCEPTION,bo[wo.REDIRECT_NEW]=x.RC_CONN_REDIRECTED,bo[wo.TOKEN_EXPIRED]=x.RC_CONN_TOKEN_EXPIRED,bo[wo.ILLEGAL_PROTOCOL_VERSION]=x.RC_CONN_PROTO_VERSION_ERROR,bo[wo.ACCOUNT_CANCELLATION]=x.RC_ACCOUNT_CANCELLATION,bo),ts=((Po={})[Ao.ACCEPTED]=x.SUCCESS,Po[Ao.UNACCEPTABLE_PROTOCOL_VERSION]=x.RC_CONN_PROTO_VERSION_ERROR,Po[Ao.IDENTIFIER_REJECTED]=x.RC_CONN_IDENTIFIER_REJECTED,Po[Ao.SERVER_UNAVAILABLE]=x.RC_CONN_SERVER_UNAVAILABLE,Po[Ao.TOKEN_INCORRECT]=x.RC_CONN_TOKEN_INCORRECT,Po[Ao.NOT_AUTHORIZED]=x.RC_CONN_NOT_AUTHRORIZED,Po[Ao.REDIRECT]=x.RC_CONN_REDIRECTED,Po[Ao.PACKAGE_ERROR]=x.RC_CONN_PACKAGE_NAME_INVALID,Po[Ao.APP_BLOCK_OR_DELETE]=x.RC_CONN_APP_BLOCKED_OR_DELETED,Po[Ao.BLOCK]=x.RC_CONN_USER_BLOCKED,Po[Ao.TOKEN_EXPIRE]=x.RC_CONN_TOKEN_EXPIRED,Po[Ao.DEVICE_ERROR]=x.RC_CONN_DEVICE_ERROR,Po[Ao.HOSTNAME_ERROR]=x.RC_CONN_HOSTNAME_ERROR,Po[Ao.HASOHTERSAMECLIENTONLINE]=x.RC_DISCONN_SAME_CLIENT_ON_LINE,Po[Ao.OUT_OF_LIMIT]=x.RC_LISCENSE_COUNT_OUT_OF_LIMIT,Po[Ao.IN_OTHER_CLUSTER]=x.RC_CONN_WRONG_CLUSTER,Po[Ao.APP_AUTH_NOT_PASS]=x.RC_APP_AUTH_NOT_PASS,Po[Ao.OTP_USED]=x.RC_OTP_USED,Po[Ao.PLATFORM_ERROR]=x.RC_PLATFORM_ERROR,Po[Ao.ACCOUNT_CANCELLATION]=x.RC_ACCOUNT_CANCELLATION,Po[Ao.LICENSE_EXPIRED]=x.RC_LICENSE_EXPIRED,Po),ns=function(e){return e===x.RC_CONN_REDIRECTED};exports.RCConnectionStatus=void 0,($o=exports.RCConnectionStatus||(exports.RCConnectionStatus={}))[$o.CONNECTED=0]="CONNECTED",$o[$o.CONNECTING=1]="CONNECTING",$o[$o.DISCONNECTED=2]="DISCONNECTED",$o[$o.SUSPENDED=3]="SUSPENDED";var rs=function(){function e(e,t,n,r){this.appkey=e,this.navi=t,this.logger=n,this.listener=r,this.token="",this.reconnectKick=!1,this._crtConnectionStatus=exports.RCConnectionStatus.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)switch(this._crtConnectionStatus=e,e){case exports.RCConnectionStatus.CONNECTED:this.logger.info(exports.LogTagId.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case exports.RCConnectionStatus.CONNECTING:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onConnecting();break;case exports.RCConnectionStatus.SUSPENDED:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onSuspend(t);break;default:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onDisconnected(t)}},e.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},e.prototype.connect=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o;return R(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED?[2,{code:x.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this.token=e,this.reconnectKick=t,this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),[4,this.try2Connect(e,t,!1,n)]);case 1:return r=s.sent(),i=r.code,o=r.data,i!==x.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,i),[2,{code:i}]):(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2,{code:i,data:o}])}}))}))},e.prototype.try2Connect=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s;return R(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,r),[4,this._crtConnectionTask]);case 1:return i=a.sent(),o=i.code,s=i.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},e.prototype.createConnectionTask=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return R(this,(function(h){switch(h.label){case 0:return[4,this.navi.request(e,n,!1,r)];case 1:return i=h.sent(),o=i.code,s=i.data,o!==x.SUCCESS?[2,{code:o}]:1===(a=s).type?[2,{code:x.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(exports.LogTagId.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),r),[4,this.connectWithToken(e.replace(/@.+$/,"@"),a,t,r)]);case 2:return u=h.sent(),c=u.code,l=u.data,ns(c)?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"redirect code: ".concat(c),r),[2,this.createConnectionTask(e,t,!0,r)]):c===x.RC_CONN_ACK_TIMEOUT?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"cmp ack timeout, code: ".concat(c),r),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,c),this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),[2,this.createConnectionTask(e,t,!1,r)]):c!==x.SUCCESS?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"code: ".concat(c),r),[2,{code:c}]):(this.logger.info(exports.LogTagId.L_CONNECT_R,"userId: ".concat(l),r),this._crtUserId=l,[2,{code:c,data:l}])}}))}))},e.prototype.try2Reconnect=function(e,t){return m(this,void 0,void 0,(function(){var n,r,i=this;return R(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),r=function(){return m(i,void 0,void 0,(function(){var i;return R(this,(function(o){switch(o.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.SUSPENDED?[2]:(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING,t),[4,this.try2Connect(this.token,!0,e,n)]);case 1:return i=o.sent().code,this.reconnectTimer=null,i===x.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.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].includes(i)?(this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTING||(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,i),this.reconnectTimer=setTimeout(r,5e3)),[2]):(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,i),[2])}}))}))},r(),[2]}))}))},e.prototype.onDisconnectByServer=function(e){if(ns(e))return this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void this.try2Reconnect(!0,e);this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return m(this,void 0,void 0,(function(){var e,t,n=this;return R(this,(function(r){switch(r.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?(this._failedCount=0,this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=r.sent())===x.SUCCESS?(this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_R,"code: ".concat(t,", count: ").concat(this._failedCount),e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(exports.LogTagId.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,x.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,x.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,2),this.close(!1,e),[2]}}))}))},e.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},e}(),is=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=qt(ho);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=me(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,s=((r={})[kr]=i._formatSyncMessages,r[Br]=i._formatReceivedMessage,r[Vr]=i._formatSentMessage,r[Qr]=i._formatHistoryMessages,r[Wr]=i._formatConversationList,r[ai]=i._formatChatRoomInfos,r[Ti]=i._formatChatRoomKVList,r[Oi]=i._formatUserSetting,r[Ni]=i._formatConversationStatus,r[Fi]=i._formatGrpReadReceiptQryResp,r[Ri]=i._formatSetUserSettingOutput,r[Mi]=i._formatUserSettingNotification,r[eo]=i._formatUltraMsgChangeList,r[oo]=i._formatUltraOperateStatusNotifyList,r[ro]=i._formatUltraMsgList,r[Vi]=i._formatUltraGroupUnreadMentionedList,r[oi]=i._formatChrmKVVersion,r)[t];try{o=e.length>0&&i._codec[t].decode(e),Se(o)&&(o=function(e){for(var t in e)Se(e[t])&&(e[t]=et(e[t]));return e}(o)),Oe(s)&&(o=s.call(this,o,n))}catch(e){this.logger.error(exports.LogTagId.L_PB_DECODE_E,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=me(n)?new Uint8Array(n):n;return wn.readUTF(i.subarray(t,r))}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=t?JSON.parse(t):t}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,o=e.finished;return(Me(o)||null===o)&&(e.finished=!0),e.syncTime=et(i),e.list=ut(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._getUtfContent=function(e){if(e.user){var t=e.user,n=t.portrait,r=t.portraitUri,i=n||r;i&&(e.user.portrait=e.user.portraitUri=i)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return at(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,r=e.pushExt,i=e.configFlag,o={};return r&&(o=rt(t,r.pushConfigs,r.pushId)),C(C({},o),{pushTitle:null==r?void 0:r.title,pushContent:n,pushData:n,disablePushTitle:!!i&&Boolean(4&i),forceShowDetailContent:!!i&&Boolean(8&i),templateId:null==r?void 0:r.templateId})},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var r=this,i=t||{},o=i.currentUserId,s=i.connectedTime,a=e.content,u=e.fromUserId,c=e.type,l=e.groupId,h=e.status,d=e.dataTime,p=e.extraContent,g=e.configFlag,f=e.extStatus,_=e.clientUniqueId,E=e.busChannel,T=e.msgId,y=e.classname,v=e.direction||b.RECEIVE,I=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=I.isPersited,m=I.isCounted,R=I.isMentioned,S=I.disableNotification,O=I.receivedStatus,M=I.canIncludeExpansion,L=!!(2&(f||0)),N=!!(4&(f||0)),U=!!(8&(f||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,A=[V.GROUP,V.CHATROOM,V.RTC_ROOM,V.ULTRA_GROUP].indexOf(c)>-1?l:u,w=u,P=b.RECEIVE;v===b.SEND&&(w=o,P=b.SEND);var x=et(d),D=x<s,G=c===V.CHATROOM,B=r._setExpansion(p),k=r._formatBytes(a);k=r._getUtfContent(k);var F=r._setPushConfig(e,this.logger);G&&u===o&&(P=b.SEND);var H={conversationType:c,targetId:A,senderUserId:w,messageType:y,messageUId:T,isPersited:C,isCounted:m,isMentioned:R,sentTime:x,messageDirection:P,receivedTime:_t.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:M,content:k,expansion:B,configFlag:g,pushConfig:F,channelId:E||"",isInterrupt:L,isModifyMessage:N,messageId:et(_)||0,sentStatus:exports.SentStatus.SENT};return c!==V.ULTRA_GROUP?(H.isOffLineMessage=D,H):(H.channelType=U,H)},e.prototype._formatSentMessage=function(e,t){var n=this,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=e.extStatus,d=e.clientUniqueId,p=t.signal,g=t.currentUserId,f=p.date,_=p.topic,E=p.targetId,T=!!(2&(h||0)),y=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),v=y.isPersited,I=y.isCounted,m=y.disableNotification,R=y.canIncludeExpansion,S=Cn[_]||V.PRIVATE,O=lt(rn,_),M=n._formatBytes(r),L=E;i===F.RECALL&&(S=M.conversationType||S,L=M.targetId||E);var N=n._setExpansion(a),U=n._setPushConfig(e,this.logger),A=C(C({},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:L,messageType:i,messageUId:s,isPersited:v,isCounted:I,isStatusMessage:O,senderUserId:g,content:n._formatBytes(r),sentTime:1e3*f,receivedTime:_t.getTime(),messageDirection:b.SEND,isOffLineMessage:!1,disableNotification:m,canIncludeExpansion:R,expansion:N,pushConfig:A,channelId:e.busChannel||"",isInterrupt:T,messageId:et(d)||0}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,s=r.targetId,a=et(e.syncTime),u=[];return at(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===V.ULTRA_GROUP?i.targetId=e.groupId||r.targetId:i.targetId=s,u.push(i)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!o}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,r=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,r=e.time,i=e.changeType,o=e.msgUID,s=e.msgTime,a=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,p=e.busChannelType;return{targetId:t,conversationType:n,changeType:i,messageUId:o,changeTime:et(r),sendTime:et(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p}})),hasNext:r}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,r=e.info,i=e.summary,o=[],s=[],a=2==(2&n),u=1==(1&n);return u&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.userId,i=e.opType,s=e.optime,a=et(s);o.push({targetId:t,channelId:n,userId:r,operationType:i,operationTime:a})})),a&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,i=e.opType;s.push({targetId:t,channelId:n,count:r,operationType:i})})),{conversationType:t,info:o,summary:s,hasInfo:u,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,r=e.list;return{list:r&&r.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatUltraGroupUnreadMentionedList=function(e){var t=e.msgInfo;return(void 0===t?[]:t).map((function(e){return{messageUId:e.msgId,senTtime:et(e.msgTime),mentionedType:e.remindType}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,r=t.remindCount,i=t.busChannelType,o=t.msgInfo;return e.versionTime=et(n)||0,e.unreadMentionedCount=et(r)||0,e.channelType=i||exports.UltraGroupChannelType.PUBLIC,e.lastReadTime=0,o&&(e.firstUnreadMessage={sentTime:et(o.msgTime)},e.lastReadTime=et(o.msgTime)-1),e},e.prototype._formatConversationList=function(e,t){var n=this,r=this,i=e.info,o=t.afterDecode,s={list:(i=ut(i,(function(e){var i=e.msg,s=e.userId,a=e.type,u=e.unreadCount,c=e.busChannel,l=null;i&&((l=r._formatReceivedMessage(i,t)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:et(u)||0,latestMessage:l||{},channelId:c||""};return a===V.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==o?void 0:o(h))||h})))||[]};return((null==t?void 0:t.conversationType)||V.NONE)===V.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:ut(n,(function(e){var t=e.id,n=e.time;return{id:t,time:et(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=ut(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,o=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?ee.DELETE:ee.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:et(i),version:et(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return at(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=et(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=et(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return at(t,(function(e){var t=e.type,r=e.channelId,i=e.time,o=e.stateItem,s=e.busChannel,a=K.CLOSE,u=Y.NOT_SET,c=!1,l=[];at(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Mn:a=n===Sn?K.OPEN:K.CLOSE,u=Number(n)||Y.NOT_SET;break;case Ln:c=n===Sn;break;case Nn:l=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:et(i),tags:l,channelId:s||""})})),n},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=et(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:et(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Fr);return e.setNothing(1),e.getArrayData()},e.prototype._updateMentionedInfo=function(e,t,n){var r,i,o;return{userIdList:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.userIdList)||t,type:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.type)||n||Q.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,r=e.pushConfig||{},i=0;return i|=n?1:0,i|=t?2:0,i|=r.disablePushTitle?4:0,i|=r.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,r=e.androidConfig,i=e.templateId,o=void 0===i?"":i,s=this._codec.getModule(Gr);if(t&&s.setTitle(t),n||r){var a=nt(n,r);s.setPushConfigs(a)}return(null==r?void 0:r.notificationId)&&s.setPushId(null==r?void 0:r.notificationId),s.setTemplateId(o),s},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,r=t.isMentioned,i=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,p=t.mentionedUserIdList,g=void 0===p?[]:p,f=t.pushContent,_=void 0===f?"":f,E=t.messageId,T=void 0===E?0:E,y=this._codec.getModule(Vr),v=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),I=c||{},C=I.pushContent,m=void 0===C?_:C,R=I.pushData,S=void 0===R?d:R;y.setSessionId(v),r&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,g,i)),m&&y.setPushText(m),S&&y.setAppData(S),s&&y.setUserId(s);var O=this._calculateFlag(t);if(y.setConfigFlag(O),y.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),y.setContent(JSON.stringify(o)),a&&u){var M={};at(u,(function(e,t){M[t]={v:e}})),y.setExtraContent(JSON.stringify(M))}if(c){var L=this._getPushExtraModule(c);y.setPushExt(L)}return y.setClientUniqueId(T),Me(l)||y.setBusChannel(l),y},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,r=e.broadcastSyncTime,i=this._codec.getModule(Kr);return i.setIspolling(!1),i.setIsPullSend(!0),i.setSendBoxSyncTime(t),i.setSyncTime(n),i.setBroadcastSyncTime(r),i.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(qr);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,r=t.order,i=t.timestamp,o=t.channelId,s=this._codec.getModule(jr);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(Xi);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(Jr);return r.setType(1),r.setCount(t),r.setStartTime(n),r.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,r=e.startTime,i=e.order;t=t||0,r=r||0,i=i||0;var o=this._codec.getModule(Jr);return o.setType(n),o.setCount(t),o.setStartTime(r),o.setOrder(i),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,r=this._codec.getModule(ei);return r.setType(t),n&&r.setBusChannel([n]),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(zr),r=[];return at(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(Zr);o.setType(n),o.setChannelId(i),r.push(o)})),n.setSessions(r),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,r){var i=this._codec.getModule(ti),o=[];return at(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(o),i.setBusChannel(r),i.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,r){var i=this._codec.getModule(ni);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(r),i.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,r=e.targetId,i=e.channelId,o=t.timestamp,s=this._codec.getModule(ri);return o=o||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(o),s.setBusChannel(i),s.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.keys,u={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},c=this._codec.getModule(zi);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.content,u=this._codec.getModule(zi);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(Zi);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,r=e.messages,i=this._codec.getModule(to),o=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return i.setTargetId(t),i.setType(n),i.setQuery(o),i.getArrayData()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,r=e.sentTime,i=e.count,o=this._codec.getModule(Di);return o.setGroupId(t),o.setBusChannel(n),o.setMsgTime(r),o.setSize(i),o.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,r){var i=this._codec.getModule(io);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(ii);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(si);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(xi);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(Pi);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r){var i=this._codec.getModule(ui);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var r=this._codec.getModule(fi),i=t.key,o=t.value,s=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||ee.UPDATE,h=Et(t,l),d={key:i,value:o||"",uid:n,version:c};if(Me(h)||(d.status=h),r.setEntry(d),a){var p={conversationType:V.CHATROOM,targetId:e},g={key:i,value:o,extra:s,type:l},f=this._getUpMsgModule(p,{messageType:F.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});r.setNotification(f),r.setBNotify(!0),r.setType(V.CHATROOM)}return r.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var r=this._codec.getModule(_i),i=t.entries,o=t.type||ee.UPDATE,s=Et(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};Me(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Ci);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(Si);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Li);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,r=this._codec.getModule(wi),i=_t.getTime(),o=[];return at(e,(function(e){var t=n._codec.getModule(Ui),r=e.conversationType,s=e.targetId,a=e.notificationStatus,u=e.isTop,c=e.channelId,l=e.notificationLevel,h=[];t.setType(r),t.setChannelId(s),t.setTime(i),t.setBusChannel(c);var d=a===K.OPEN,p={};Me(a)||(p[Mn]=d),Me(l)||(p[Mn]=l),Me(u)||(p[Ln]=u),at(p,(function(e,t){if(!Me(e)){var r=n._codec.getModule(Ai);e=e?Sn:On,Me(l)||Number(t)!==Mn||(e=String(l)),r.setSessionStateType(Number(t)),r.setValue(e),h.push(r)}})),t.setStateItem(h),o.push(t)})),r.setVersion(t||i),r.setState(o),r.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(Bi);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,r=this._codec.getModule(Ki),i=[];return e.forEach((function(e){var t=n._codec.getModule(qi);t.setTagId(e.tagId),t.setName(e.tagName),i.push(t)})),r.setTags(i),r.setVersion(t),r.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(Bi);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,r=this._codec.getModule(Yi),i=[];return e.forEach((function(e){var t=n._codec.getModule(qi);t.setTagId(e),i.push(t)})),r.setTags(i),r.setVersion(t),r.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(ji);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r=this._codec.getModule(wi),i=[];return t.forEach((function(t){var r=n._codec.getModule(Ui),o=n._codec.getModule(Ai),s=[];e.forEach((function(e){var t=n._codec.getModule(qi);t.setTagId(e.tagId),Me(e.isTop)||t.setIsTop(e.isTop),s.push(t)})),o.setSessionStateType(Nn),o.setValue(JSON.stringify(s)),o.setTags(s),r.setType(t.conversationType),r.setChannelId(t.targetId),r.setTime(Date.now()),r.setStateItem([o]),i.push(r)})),r.setState(i),r.setVersion(_t.getTime()),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Qi);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(Wi);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(uo);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e}(),os=function(e){function t(t,n,r,i,o){var s=e.call(this,t,n,r,o)||this;return s.runtime=i,s.wsListener=o,s._socket=null,s._connectedTime=0,s._socketIndex=0,s._localConnectedTime=0,s._idCount=0,s._generateMessageId=function(){return s._idCount>=65535&&(s._idCount=0),++s._idCount},s._messageIds={},s._syncMessageIds={},s.codec=new is(s.logger),s}return I(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,r){return m(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,h,d,p,g,f,E;return R(this,(function(T){switch(T.label){case 0:if(n=[],i=t.server,o=t.backupServer,s=t.protocol,a=t.openAnti,i?n.push(i):this.logger.warn(exports.LogTagId.L_NAVI_CONF_E,"`navi.server` invalid",r),null==o||o.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length)return this.logger.error(exports.LogTagId.L_NAVI_CONF_E,"no service available",r),[2,{code:x.SERVER_UNAVAILABLE}];u=s.replace("http","ws"),c=1===a?zt.V4:zt.V3,l=0,T.label=1;case 1:return l<n.length?(h=n[l],d=function(e,t,n,r,i,o,s){var a=Xo(i),u=a.type,c=a.version,l="browser"===i.tag?"|".concat(u,"|").concat(c):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(_,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":i.tag+encodeURIComponent(l)).concat(i.connectPlatform?"&platform=".concat(i.connectPlatform):"").concat(h)}(u,h,this.appkey,e,this.runtime,"",c),p=Date.now(),[4,this.connectWebSocket(d,c,r)]):[3,4];case 2:return g=T.sent(),f=g.code,E=g.data,f===x.RC_SOCKET_DISCONNECTED||f===x.TIMEOUT?[3,3]:f!==x.SUCCESS?[2,{code:f}]:(this._localConnectedTime=Math.floor((Date.now()+p)/2),this._socket=E.socket,[2,{code:f,data:E.userId}]);case 3:return l+=1,[3,1];case 4:return[2,{code:x.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return m(this,void 0,void 0,(function(){var r=this;return R(this,(function(i){return this.logger.info(exports.LogTagId.T,"connect start: ".concat(e),n),[2,new Promise((function(i){var o=r.runtime.createWebSocket(e);r._socketIndex=o.id;var s=setTimeout((function(){r.logger.info(exports.LogTagId.T,"connect timeout: ".concat(e),n),i({code:x.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),r.logger.info(exports.LogTagId.T,"socket open",n)})),o.onMessage((function(e){if(r._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var s,a=zn(r.logger,e,t);if(a instanceof Gn){var u=a.status;if(u!==Ao.ACCEPTED)return r.logger.info(exports.LogTagId.T,"connect failed: ".concat(u),n),void i({code:(s=u,ts[s])});r.logger.info(exports.LogTagId.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return r._connectedTime=c,r._idCount=h,void i({code:x.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof Bn){var d=a.status;return r.logger.info(exports.LogTagId.T,"recv disconnect signal -> status: ".concat(d)),void r.onRecvDisconnect(d,o)}if(a instanceof Fn&&r._pingResolve)return r._pingResolve(x.SUCCESS),void(r._pingResolve=void 0);r._onReceiveSignal(a)}}else r.logger.warn(exports.LogTagId.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:r._socketIndex,curSocketId:o.id}))})),o.onClose((function(){r.logger.info(exports.LogTagId.T,"socket close",n);var e=x.RC_SOCKET_DISCONNECTED;i({code:e}),r.onSocketEnd(o,e)})),o.onError((function(e){r.logger.info(exports.LogTagId.T,"socket error",n);var t=x.RC_SOCKET_DISCONNECTED;i({code:t}),r.onSocketEnd(o,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==Jt.AT_MOST_ONCE&&(e instanceof qn&&!e.syncMsg&&(this.logger.debug(exports.LogTagId.O,"send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Qn(t))),e instanceof Xn&&(this.logger.debug(exports.LogTagId.O,"send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Wn(t))))},t.prototype._publishReader=function(e,t){return m(this,void 0,void 0,(function(){var n,r,i,o=this;return R(this,(function(s){switch(s.label){case 0:return n=e.syncMsg,r=e.topic,this.logger.debug(exports.LogTagId.O,"recv PublishReader -> messageId: ".concat(t," ").concat(r)),r===Ot?[2]:!n||function(e){return[Zn.ppMsgS,Zn.pgMsgS,Zn.chatMsgS].map((function(e){return Zn[e]})).indexOf(e)>=0}(r)?(this.wsListener.signal(e),[2]):[4,new Promise((function(e){o._syncMessageIds[t]=e}))];case 1:return i=s.sent(),delete this._syncMessageIds[t],this.wsListener.signal(e,i),[2]}}))}))},t.prototype._onReceiveSignal=function(e){return m(this,void 0,void 0,(function(){var t,n,r;return R(this,(function(i){switch(i.label){case 0:return t=e.messageId,this._qosNeedAck(e,t),t>0&&(e instanceof jn||e instanceof Xn)&&(this.logger.debug(exports.LogTagId.O,"recv ack -> messageId: ".concat(t," ").concat(e.topic)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(r=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],r(e))),e instanceof qn?[4,this._publishReader(e,t)]:[3,2];case 1:i.sent(),i.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 es[e]}(e)))},t.prototype.onSocketEnd=function(e,t){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t))},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 kn)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof Yn||e instanceof Jn)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),m(this,void 0,void 0,(function(){var i,o,s,a,u=this;return R(this,(function(c){switch(c.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){u._messageIds[i]=e,setTimeout((function(){u._messageIds[i]&&delete u._messageIds[i],e()}),r)}))]):[2,{code:x.RC_NET_CHANNEL_INVALID}];case 1:return(o=c.sent())?o instanceof Xn||o instanceof jn?(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(exports.LogTagId.O,"send failed -> message: ".concat(i,", 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(exports.LogTagId.O,"send timeout -> message: ".concat(i,", respPBName: ").concat(t,", timeout: ").concat(r)),[2,{code:x.TIMEOUT}])}}))}))},t.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},t}(rs),ss=function(e,t,r,i,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:b.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:o,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig,channelId:r.channelId,isInterrupt:r.isInterrupt,messageId:a||0,sentStatus:exports.SentStatus.SENT}},as=function(e){return e.sort((function(e,t){var n,r,i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i})),e},us=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r,i,new Bo(i.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=i.appkey,a=i.logOutputLevel,u=i.logExpireTime,c=i.miniCMPProxy,l=i.navigators;return o.logger.setOutputLevel(a),So(s,o.logger,t,u),o.reporter=new Zo(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new Sr(s,o.logger,t,c.join(","),l),o._letterbox=new rr(t,s),o._sendMessageStore=new Mr(t,s),o._chrmEntryHandler=new sr(o),o._connMgr=new os(s,o.navi,o.logger,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}),o}return I(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 ar(this.runtime,this._appkey,this.currentUserId,e.joinMChrm,this.logger)),this._conversationManager||(this._conversationManager=new yr(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 vr(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)},t.prototype.onDisconnected=function(e){this._resetMemoryState(),this._watcher.onDisconnected(e)},t.prototype.createLogger=function(e,t){return new Bo(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 m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._connMgr.connect(e,t,n)]}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_RECV_RMTP_O,r,i);var o=Zn[r];if(o)switch(o){case Zn.s_ntf:this._pullMsg(e);break;case Zn.s_msg:this._receiveMsg(e);break;case Zn.s_cmd:this._receiveStateNotify(e);break;case Zn.s_us:this._receiveSettingNotify(e);break;case Zn.rtc_ntf:this._receiveRtcKv(e.data);break;case Zn.s_opNtf:this._pullOperateStatusNotify(e)}else this.logger.error(exports.LogTagId.L_RECV_RMTP_E,r,i)}},t.prototype._receiveStateNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Yr),n=t.time,r=t.type,i=t.chrmId;switch(r){case 2:this._chrmEntryHandler.pullEntry(i,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(i),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,Mi).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,r=t.del,i=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:i,expansion:n}}),r&&this._watcher.expansion({deletedExpansion:{messageUId:i,deletedKeys:r}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,ri),r=n.channelId,i=n.busChannel,o=n.msgTime,s=this._ultraGroupMap["".concat(i,"_").concat(r)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(ft([s]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},t.prototype._receiveSyncMsg=function(e,t){if(Nr.includes(e.topic))if(e.topic!==Zn[Zn.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(e.data,Vr,{currentUserId:this.currentUserId,signal:e});((n=this._handleMsgProperties(n)).conversationType!==V.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(exports.LogTagId.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==F.EXPANSION_NOTIFY?((n.messageType===F.SYNC_READ_STATUS||n.messageType===F.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=[],r=[],i=e.length-1;i>=0;i-=1){var o=e[i];o.messageType!==F.LOG_COMMAND||"rongcloudsystem"!==o.senderUserId?n.unshift(o):r.unshift(o)}this._watcher.batchMessage(n),0!==r.length&&r.forEach((function(e){var n=e.content,r=n.startTime,i=n.endTime,o=n.platform,s=n.logId,a=n.uri;t.reporter.report(parseInt(r,10),parseInt(i,10),o,a,s,e.messageUId)}))},t.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Yr),n=t.type,r=t.chrmId,i=t.time;if(this.logger.info(exports.LogTagId.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(i)),2===n){var o=this._chrmsQueue[r];if(!o)return;o.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),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()===exports.RCConnectionStatus.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._messageProcessor=function(e){var t=this,n=0,r=[],i=[];return e.forEach((function(e){if((r.push(e.messageUId),e.messageDirection===b.SEND)&&(n=Math.max(e.sentTime,n),t._sendMessageStore.getSendMessageMap()[e.messageUId]))return void t._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==F.DELIVERED&&e.messageType!==F.DELIVERED_MSG)if(e.messageType!==F.EXPANSION_NOTIFY){if(e.messageType===F.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),i.push(o)}else t._receiveMessageExpansion(e)})),{newOutboxTime:n,messageUIds:r,messages:i}},t.prototype._syncMsg=function(){return m(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,l,h,d,p,g,f,_,E,T,y;return R(this,(function(v){switch(v.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),r=this._connMgr.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),i=new Jn(Zn[Zn.pullMsg],r,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o),[4,this._connMgr.send(i,kr,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=v.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),a!==x.SUCCESS||!u||Me(u.finished)||Me(u.list)||Me(u.syncTime)?(this.logger.warn(exports.LogTagId.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,p=void 0===d?1:d,this.logger.info(exports.LogTagId.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),g=this._messageProcessor(c),f=g.newOutboxTime,_=g.messageUIds,E=g.messages,this._batchMessage(E),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._letterbox.setBroadcastSyncTime(p,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,T=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(y=this._pullQueue).push.apply(y,T),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(exports.LogTagId.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(exports.LogTagId.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),t.messageType!==F.DELIVERED&&t.messageType!==F.DELIVERED_MSG){if(t.conversationType!==V.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!==F.EXPANSION_NOTIFY?t.messageType===F.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,r=e.messageType,i=e.isStatusMessage,o=e.isCounted,s=void 0!==o&&o,a=e.isPersited,u=void 0!==a&&a,c=r in h,l=r in this._customMessageType;if(n=c?C(C({},h[r]),{isStatusMessage:d.includes(r)}):l?this._customMessageType[r]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(e,n),t&&!Me(i)&&(e.isStatusMessage=i),!t){var p=e.content.user;if(p){var g=p.portrait,f=p.portraitUri,_=g||f;_&&(p.portrait=p.portraitUri=_)}}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,r,i,o,s,a){var u;return void 0===o&&(o=""),m(this,void 0,void 0,(function(){var s,c,l,h,d,p,g,f,_,E;return R(this,(function(T){switch(T.label){case 0:return c=(s=this).currentUserId,l=s._connMgr,h=mn[e]||En,d=1===r&&0===n,l?(p=l.codec.encodeGetHistoryMsg(t,{timestamp:n,count:d?2:r,order:i,channelId:o}),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:o,timestamp:n,count:r,order:i}),a),[4,l.send(new Jn(h,p,c),Qr,{currentUserId:c,connectedTime:l.getConnectedTime(),conversation:{targetId:t}})]):[3,2];case 1:return g=T.sent(),(f=g.code)===x.SUCCESS&&p?(_=g.data,_=this._fixDownstreamData(d,_,i),E=[],null===(u=_.list)||void 0===u||u.forEach((function(e){e&&E.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:E.join(",")}),a),[2,{code:f,data:{list:_.list,hasMore:_.hasMore}}]):(this.logger.warn(exports.LogTagId.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 m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,i=this.logger.createTraceId(),o=JSON.stringify(e),this.logger.debug(exports.LogTagId.L_VER_REPORT_T,o,i),s=r.codec.encodeReportSDKInfo(o),a=new Jn(Zn[Zn.reportsdk],s,n),[4,r.send(a)]):[2];case 1:return(u=c.sent().code)!==x.SUCCESS&&this.logger.warn(exports.LogTagId.L_VER_REPORT_R,u,i),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c;return R(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeDeleteMessages(e,t,n,r),u=new Jn(on,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,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return R(this,(function(h){switch(h.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeClearMessages(t,n,r,e),u=Rn[e],c=new Jn(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,r,i){return void 0===e&&(e=300),m(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d=this;return R(this,(function(p){switch(p.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,t=t||V.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),u=new Jn(pn,a,o),[4,s.send(u,Wr,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=d._conversationManager.get(t,n,r);return Object.assign(e,i),e}})]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return c=p.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 m(this,void 0,void 0,(function(){var r,i,o,s;return R(this,(function(a){switch(a.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new Jn(gn,i,t),[4,r.send(o)]):[2,x.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},t.prototype.getConversation=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return e!==V.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:x.CONVER_GET_ERROR}];case 1:return(i=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,r={conversationType:e,targetId:t,channelId:n,unreadMessageCount:i.unreadMessageCount||0,latestMessage:u,notificationStatus:i.notificationStatus||K.CLOSE,notificationLevel:i.notificationLevel||Y.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:x.SUCCESS,data:r}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:x.SUCCESS,data:r})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var r=0;if(e.includes(V.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:x.METHOD_NOT_AVAILABLE});for(var i in this._ultraGroupMap){var o=this._ultraGroupMap[i];(0===t.length||t.includes(o.notificationLevel))&&(r+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return r+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:x.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r,i;return i=e===V.ULTRA_GROUP?(null===(r=this._ultraGroupMap["".concat(n,"_").concat(t)])||void 0===r?void 0:r.unreadMessageCount)||0:this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:x.SUCCESS,data:i})},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,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(x.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:x.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(x.SUCCESS)},t.prototype.pullConversationStatus=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l=this;return R(this,(function(h){switch(h.label){case 0:return this._isConnected?(n=(t=this)._connMgr,r=t.currentUserId,i=n.codec.encodeGetConversationStatus(e),o=new Jn(Zn[Zn.pullSeAtts],i,r),[4,n.send(o,Ni)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return s=h.sent(),a=s.code,u=s.data,this.logger.info(exports.LogTagId.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:r})),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===V.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,r=e.notificationLevel,i=e.channelId,o=e.isTop,s=this._ultraGroupMap["".concat(i,"_").concat(t)];return s&&void 0!==r&&(s.notificationLevel=r,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 m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h,d,p=this;return R(this,(function(g){switch(g.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,i=this._conversationManager.getConversationUpdatedTime(),o=r.codec.encodeSetConversationStatus(e,i),s=new Jn(fn,o,n),[4,r.send(s,bi)]):[2,x.RC_NET_UNAVAILABLE];case 1:return a=g.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!==V.ULTRA_GROUP)p._conversationManager.addStatus(C(C({},e),{updatedTime:l.version}),!0);else{var t=p._setUltraConversationStatus(e);t&&h.push(t)}})),h.length>0&&(d=ft(h),d=as(d),this._watcher.conversation(d)),[2,u])}}))}))},t.prototype._joinChrm=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d;return R(this,(function(p){switch(p.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeJoinOrQuitChatRoom(),a=new Jn(s=n?an:sn,o,e),this.logger.info(exports.LogTagId.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:s}),r),[4,i.send(a,oi)]):[2,x.RC_NET_UNAVAILABLE];case 1:return u=p.sent(),c=u.code,l=u.data,h=c===x.SUCCESS?"info":"warn",this.logger[h](exports.LogTagId.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),r),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 m(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,u.label=1;case 1:return r<t.length?(i=t[r],this.logger.info(exports.LogTagId.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:i,count:e[i]||10,topic:an})),o=this.logger.createTraceId(),[4,this._joinChrm(i,e[i]||10,!0,o)]):[3,4];case 2:if(s=u.sent(),a=s===x.SUCCESS?"info":"warn",this.logger[a](exports.LogTagId.L_REJOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),o),s===x.SUCCESS)return this._watcher.chatroom({rejoinedRoom:{chatroomId:i,count:e[i]}}),[2];s===x.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(i),delete this._chrmsQueue[i]),this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:s}}),u.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),m(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h,d,p,g,f;return R(this,(function(_){switch(_.label){case 0:return this._isConnected?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,t),a=new Jn(Zn[Zn.chrmPull],s,e),this.logger.info(exports.LogTagId.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,r.pulling=!1,c===x.SUCCESS&&l?(h=l.list,d=l.syncTime,p=l.finished,r.timestamp=n?Math.max(d,n):d,r.queue=r.queue.filter((function(e){return e>d})),g=[],f=[],h.forEach((function(e){e.sentTime<o||(g.push(e.messageUId),f.push(e))})),this._batchMessage(f),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:g.join(",")})),(!p||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o;return R(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),r=new Jn(un,n,e),[4,t.send(r)]):[2,x.RC_NET_UNAVAILABLE];case 1:return i=s.sent(),(o=i.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 m(this,void 0,void 0,(function(){var r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeGetChatRoomInfo(t,n),o=new Jn(Zn[Zn.queryChrmI],i,e),[4,r.send(o,ai)]):[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,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c;return R(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new Jn(yn,o,e),[4,i.send(s,Qr,{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 m(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return R(this,(function(h){switch(h.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=r.codec.encodeModifyChatRoomKV(e,t,i),a=t.type===ee.UPDATE?cn:ln,u=new Jn(a,s,e),[4,r.send(u,oi)]):[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()},i),[2,l]):[2,l]}}))}))},t.prototype._chatroomKVStoreNotAllSuccess=function(e,t){var n=t.data,r=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(e){var t=r.findIndex((function(t){return e.key===t.key}));-1!==t&&r.splice(t,1)})),r},t.prototype._modifyChatroomKVS=function(e,t){return m(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,h,d,p,g=this;return R(this,(function(f){switch(f.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,t.entries.forEach((function(t){var n=g._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?g.getServerTime():n})),o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===ee.UPDATE?hn:dn,a=new Jn(s,o,e),[4,r.send(a,yi)]):[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=C({},t)).entries,t.entries.forEach((function(e){h.push(C(C({},e),d))})),c===x.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(p=u.data,l=p.errorKeys,h=this._chatroomKVStoreNotAllSuccess(h,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:h,syncTime:(new Date).getTime()},i)),[2,{code:c,data:l}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return t.type=ee.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return t.type=ee.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return t.type=ee.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return t.type=ee.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return t.type=ee.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return t.type=ee.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return m(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:x.SUCCESS,data:n}]:this._isConnected?(r=this._connMgr,i=r.codec.encodePullChatRoomKV(0),o=new Jn(Zn[Zn.pullKV],i,e),[4,r.send(o,Ti)]):[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 m(this,void 0,void 0,(function(){var t,n,r,i,o,s;return R(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={},r=n.codec.encodePullChatRoomKV(0),i=new Jn(Zn[Zn.pullKV],r,e),[4,n.send(i,Ti)]):[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 m(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,h,d,p=this;return R(this,(function(g){switch(g.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=r.codec.encodePullChatRoomKV(t),s=new Jn(Zn[Zn.pullKV],o,e),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,r.send(s,Ti)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return a=g.sent(),u=a.code,c=a.data,l=u===x.SUCCESS?"info":"warn",this.logger[l](exports.LogTagId.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,r=t.value,i=t.type,o=t.timestamp,s=t.userId;p._chrmEntryHandler.getValue(e,n)===r&&s===p.getCurrentUserId()||d.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,c,i),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()}),c)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,r,i){return m(this,void 0,void 0,(function(){var o,s,a,u,c,l,h,d,p,g,f;return R(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=!![V.PRIVATE,V.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[V.PRIVATE]=Zn.ppMsgS,t[V.GROUP]=Zn.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[V.PRIVATE]=Zn.ppMsgP,t[V.GROUP]=Zn.pgMsgP,t[V.CHATROOM]=Zn.chatMsg,t[V.CUSTOMER_SERVICE]=Zn.pcMsgP,t[V.RTC_ROOM]=Zn.prMsgS,t)[e]}(e)||Zn.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:st(),n.messageId=a,u=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(c=new Yn(Zn[s],u,t)).setHeaderQos(Jt.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(c),[2,{code:x.SUCCESS,data:ss(e,t,C({},n),"",0,this.currentUserId,a)}]):(l=this._connMgr.getCrtServerTime(),h=ss(e,t,C({},n),"",l,this.currentUserId,a),null==r||r(a),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),i),[4,this._connMgr.send(c)])):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return d=_.sent(),p=d.code,g=d.data,p!==x.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:h.messageUId,messageId:h.messageId}),i),h.sentStatus=exports.SentStatus.FAILED,[2,{code:p,data:h}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),f=g,this._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,r,i){var o;return m(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,p,g,f,_,E,T;return R(this,(function(y){switch(y.label){case 0:return this._isConnected?(s=i.user,a=i.extra,u=i.isDelete,c={conversationType:e,targetId:t,messageUId:n,sentTime:r,channelId:i.channelId||"",isDelete:u||!1},s&&(c.user=s),a&&(c.extra=a),l={content:c,messageType:"RC:RcCmd",disableNotification:null==i?void 0:i.disableNotification,pushConfig:null==i?void 0:i.pushConfig,pushContent:(null===(o=i.pushConfig)||void 0===o?void 0:o.pushContent)||i.pushContent||"",channelId:i.channelId},h=Zn[Zn.recallMsg],d=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},l),(p=new Yn(h,d,this.currentUserId)).setHeaderQos(Jt.AT_LEAST_ONCE),[4,this._connMgr.send(p)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return g=y.sent(),f=g.code,_=g.data,e===V.ULTRA_GROUP&&this.logger.debug(exports.LogTagId.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:f,conversationType:e,targetId:t,channelId:i.channelId})),f!==x.SUCCESS?[2,{code:f}]:(E=_,e===V.ULTRA_GROUP?(this._ultraMsgMap[E.messageUId]=E.timestamp,this._updateUltraGroupWhenRecallMsg(t,i.channelId||"",n),[2,{code:x.SUCCESS}]):(this._sendMessageStore.setMessage(E.messageUId,E.timestamp),T=ss(e,t,C(C({},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 m(this,void 0,void 0,(function(){var r,i;return R(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeReadReceipt(t,n),i=new Jn(Zn[Zn.rrMsg],r,e),[2,this._connMgr.send(i)]):[2,{code:x.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i;return R(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeMessageReader(t,n),i=new Jn(Zn[Zn.rrList],r,e),[2,this._connMgr.send(i,Fi)]):[2,{code:x.RC_NET_UNAVAILABLE}]}))}))},t.prototype.pullUserSettings=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o;return R(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new Jn(Zn[Zn.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,Oi)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===x.SUCCESS&&this._naviChangeHandler(o),[2,{code:i,data:o}]}}))}))},t.prototype._naviChangeHandler=function(e){var t;if(e){var n=e.settings,r=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(r){var i=this._connMgr.getToken();this.navi.updateVoipCallInfo(i,r);var o=this.navi.getNaviInfoFromCache(i);this._watcher.onNaviDataChange(C({},o))}}else this.logger.warn(exports.LogTagId.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c;return R(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=r&&"uploads"!==r?t||"":tt(e,t),o=this._connMgr.codec.encodeGetFileToken(e,i,n||"",r||""),s=new Jn(Zn[Zn.qnTkn],o,this.currentUserId),[4,this._connMgr.send(s,ci)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,c=Object.assign(c,{fileName:i}),u===x.SUCCESS?[2,{code:u,data:c}]:[2,{code:u}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d;return R(this,(function(p){switch(p.label){case 0:return this._isConnected?(i="",o="",s="",t===W.QINIU?(o=li,s=di):(o=hi,s=pi),i=t===W.QINIU?Zn[Zn.qnUrl]:t===W.AWS?Zn[Zn.s3Url]:t===W.STC?Zn[Zn.stcUrl]:t===W.MINIO?Zn[Zn.minioUrl]:Zn[Zn.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,e,n,r),u=new Jn(i,a,this.currentUserId),[4,this._connMgr.send(u,s)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return c=p.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 m(this,void 0,void 0,(function(){return R(this,(function(e){switch(e.label){case 0:return this.reporter.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,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}},t.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),r=new Jn(Zn[Zn.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Ri)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==x.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([C(C({},e),{createdTime:a})],a),[2,{code:x.SUCCESS}])}}))}))},t.prototype.removeTag=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([e],t),r=new Jn(Zn[Zn.delSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Ri)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.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 m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),r=new Jn(Zn[Zn.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Ri)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==x.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:x.SUCCESS}])}}))}))},t.prototype.getTagList=function(){return m(this,void 0,void 0,(function(){var e,t;return R(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 m(this,void 0,void 0,(function(){var n,r,i,o,s=this;return R(this,(function(a){switch(a.label){case 0:return this._isConnected?this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Jn(Zn[Zn.addTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:x.TAG_NOT_EXIST}]:[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return(i=a.sent().code)!==x.SUCCESS?[2,{code:i}]:((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 m(this,void 0,void 0,(function(){var n,r,i,o=this;return R(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Jn(Zn[Zn.delTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return(i=s.sent().code)!==x.SUCCESS?[2,{code:i}]:(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 m(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=e.conversationType,r=e.targetId,i=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[e]),a=new Jn(Zn[Zn.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,r,t,i),[2,{code:x.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h;return R(this,(function(d){switch(d.label){case 0:return this._isConnected?(i=(r=this).currentUserId,o=r._connMgr,s=o.codec.encodeOldConversationList({count:n,type:V.PRIVATE,startTime:t}),a=new Jn(pn,s,i),[4,o.send(a,Wr,{currentUserId:i,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,r=[],i=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,u=n._conversationManager.get(o,s,a),c=u.hasMentioned,l=u.mentionedInfo,h=u.lastUnreadTime,d=u.notificationStatus,p=u.isTop,g=u.tags,f=u.unreadMessageCount,_=g&&g[e];if(_){var E=C(C({},t),{hasMentioned:c,mentionedInfo:l,lastUnreadTime:h,notificationStatus:d,isTop:p,unreadMessageCount:f});_.isTop?r.push(C(C({},E),{isTopInTag:!0})):i.push(C(C({},E),{isTopInTag:!1}))}})),r.sort(o),i.sort(o),S(S([],r,!0),i,!0)},t.prototype.getUnreadCountByTag=function(e,t){return m(this,void 0,void 0,(function(){var n;return R(this,(function(r){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 m(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h,d;return R(this,(function(p){switch(p.label){case 0:return this._isConnected?(r=t.targetId,i=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(u=this._conversationManager.get(i,r,o)).tags&&Object.hasOwnProperty.call(u.tags,e)?(c=this._connMgr.codec.encodeUpdateConversationTag(a,[t]),l=new Jn(Zn[Zn.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=p.sent().code)!==x.SUCCESS?[2,{code:h}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(i,r,d,o),[2,{code:x.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return m(this,void 0,void 0,(function(){var n,r,i,o;return R(this,(function(s){if(!this._isConnected)return[2,{code:x.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(o in n.tags)i.push({tagId:o,tagName:null===(t=r[o])||void 0===t?void 0:t.tagName});return[2,{code:x.SUCCESS,data:i}]}))}))},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 m(this,void 0,void 0,(function(){var t;return R(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===V.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),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===V.ULTRA_GROUP)return Promise.resolve({code:x.METHOD_NOT_AVAILABLE});var r;if(!(r=e===V.ULTRA_GROUP?this._ultraGroupManager.get(V.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:x.SUCCESS,data:Y.NOT_SET});var i=r.notificationLevel;return Me(r.notificationLevel)&&!Me(r.notificationStatus)&&(i=K.OPEN===r.notificationStatus?1:0),Promise.resolve({code:x.SUCCESS,data:i})},t.prototype.getConversationNotificationStatus=function(e,t,n){var r;return(r=e===V.ULTRA_GROUP?this._ultraGroupManager.get(V.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:x.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:x.SUCCESS,data:K.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this.getHistoryMessage(e,t,n,r,i,o)},t.prototype.getUltraGroupList=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i;return R(this,(function(o){return t=e.targetId,n=e.channelType,this._isUltraGroupListExist?(r=Object.values(this._ultraGroupMap).filter((function(e){return!(e.targetId!==t&&t||e.channelType!==n&&Ie(n))})),r=as(r),i=ft(r),[2,{code:x.SUCCESS,data:i}]):[2,{code:x.METHOD_NOT_AVAILABLE}]}))}))},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===K.OPEN||e.notificationLevel>0)&&t.push({conversationType:V.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:V.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 r in this._ultraGroupMap){r.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=this._ultraGroupMap[r].unreadMentionedCount)}return Promise.resolve({code:x.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var r in this._ultraGroupMap){var i=this._ultraGroupMap[r];i.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=i.unreadMessageCount||0)}return 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 Promise.resolve({code:x.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),m(this,void 0,void 0,(function(){var n,r,i,o,s;return R(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),r=this._connMgr.codec.encodeClearUnreadCount({conversationType:V.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(i=new Yn(Zn[Zn.updUgRTime],r,this.currentUserId)).setHeaderQos(Jt.AT_LEAST_ONCE),[4,this._connMgr.send(i)]):[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.lastReadTime=n),s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h,d,p,g=this;return R(this,(function(f){switch(f.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new Jn(Zn[Zn.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,Wr,{currentUserId:this.currentUserId,conversationType:V.ULTRA_GROUP})]):[2];case 1:return r=f.sent(),i=r.code,o=r.data,i===x.SUCCESS&&o?(a=o.list,u=o.isFinished,a.forEach((function(e){e.notificationStatus=K.CLOSE,e.notificationLevel=Y.NOT_SET,e.isTop=!1,g._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,g._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(i,", try again")),s=setTimeout((function(){g._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:l=f.sent(),h=l.code,d=l.data,h!==x.SUCCESS&&this.logger.warn(exports.LogTagId.O,"pullConversationStatus fail code: ".concat(h,", data: ").concat(d)),p=Object.values(this._ultraGroupMap),p=as(p),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(ft(p)),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 m(this,void 0,void 0,(function(){var e,t,n,r=this;return R(this,(function(i){switch(i.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return e=i.sent(),t=e.code,n=e.data,t===x.SUCCESS&&n?(this.logger.info(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){r._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c;return R(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Jn(Zn[Zn.pullUgMsg],t,this.currentUserId),r=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),r),[4,this._connMgr.send(n,kr,{currentUserId:this.currentUserId,conversation:{conversationType:V.ULTRA_GROUP}})];case 1:return i=l.sent(),o=i.code,s=i.data,o===x.SUCCESS&&s?(a=s.list,u=s.syncTime,c=a.map((function(e){return e.messageUId})).join(","),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:c,timestamp:e,syncTime:u}),r)):this.logger.warn(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:e}),r),[2,{code:o,data:s}]}}))}))},t.prototype._getUltraGroup=function(e,t,n){var r=e.targetId,i=e.messageType,o=e.channelId,s=e.isCounted,a=e.channelType,u=e.sentTime,c=e.senderUserId,l=this._ultraGroupMap["".concat(o,"_").concat(r)],h=l||{conversationType:V.ULTRA_GROUP,targetId:r,channelId:o,unreadMessageCount:0,unreadMentionedCount:0,notificationStatus:K.CLOSE,notificationLevel:Y.NOT_SET,isTop:!1};return s&&c!==this.currentUserId&&(h.unreadMessageCount>0&&i===F.RECALL&&(h.unreadMessageCount-=1),i!==F.RECALL&&(h.unreadMessageCount+=1,h.unreadMentionedCount+=t,h.firstUnreadMessage||(h.firstUnreadMessage={sentTime:u}))),h.versionTime=n,h.latestMessage=e,h.channelType=a,l||(this._ultraGroupMap["".concat(o,"_").concat(r)]=h),h},t.prototype._syncUltraMsg=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l=this;return R(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,r=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===x.SUCCESS&&r?(i=r.list,o=r.syncTime,s=r.finished,a={},u=[],i.forEach((function(e){var t,n,r,i=e.targetId,s=e.content,c=e.messageUId,h=e.channelId;if(l._ultraMsgMap[c])delete l._ultraMsgMap[c];else{var d=0;((null===(t=null==s?void 0:s.mentionedInfo)||void 0===t?void 0:t.type)===Q.ALL||(null===(r=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(l.currentUserId)))&&(d=1);var p=l._getUltraGroup(e,d,o);a["".concat(h,"_").concat(i)]=p,l._ultraGroupManager.addUltraGroupStatus(p),u.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(exports.LogTagId.O,"notice ultragroups"),c=Object.values(a),c=as(c),this._watcher.conversation(ft(c))),this.logger.debug(exports.LogTagId.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._syncUltraMsg(o),[2]):[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d,p,g;return R(this,(function(f){switch(f.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(exports.LogTagId.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),i=t.messageId?t.messageId:st(),t.messageId=i,o=this._connMgr.codec.encodeUpMsg({conversationType:V.ULTRA_GROUP,targetId:e},t),(s=new Yn(Zn[Zn.ugMsg],o,e)).setHeaderQos(Jt.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=ss(V.ULTRA_GROUP,e,C({},t),"",a,this.currentUserId,i),n&&n(i),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:V.ULTRA_GROUP,targetId:e,channelId:t.channelId}),r),[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(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:u.messageUId,messageId:u.messageId}),r),u.sentStatus=exports.SentStatus.FAILED,[2,{code:l,data:u}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:null==h?void 0:h.messageUId,messageId:null==h?void 0:h.messageId}),r),d=h,u.sentTime=d.timestamp,u.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,p=t.channelId||"",(g=this._ultraGroupMap["".concat(p,"_").concat(e)])?(g.latestMessage=u,Ie(g.channelType)&&(u.channelType=g.channelType)):(g={conversationType:V.ULTRA_GROUP,targetId:e,channelId:p,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:K.CLOSE,notificationLevel:Y.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(p,"_").concat(e)]=g,this._ultraGroupManager.addUltraGroupStatus(g)),this._watcher.conversation(ft([g])),[2,{code:l,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return m(this,void 0,void 0,(function(){var n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=e.conversationType,r=e.channelId,i=e.targetId,o=this._connMgr.codec.encodeOperateStatus(i,n,r||"",t||0),(s=new Yn(Zn[Zn.operate],o,i)).setHeaderQos(Jt.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 m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(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),(r=new Jn(Zn[Zn.qryMsg],n,this.currentUserId)).setHeaderQos(Jt.AT_LEAST_ONCE),[4,this._connMgr.send(r,ro,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.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,oo),n=t.conversationType,r=t.info,i=t.summary;this.logger.debug(exports.LogTagId.O,"s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return m(this,void 0,void 0,(function(){var t,n,r;return R(this,(function(i){switch(i.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Jn(Zn[Zn.upMsgEx],t,e.targetId)).setHeaderQos(Jt.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return(r=i.sent().code)!==x.SUCCESS?[2,{code:r,msg:x[r]}]:[2,{code:r}]}}))}))},t.prototype.modifyMessage=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s;return R(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new Jn(Zn[Zn.modifyMsg],t,e.targetId)).setHeaderQos(Jt.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==x.SUCCESS?[2,{code:i,msg:x[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l;return R(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 Jn(Zn[Zn.qryMsgChange],t,this.currentUserId)).setHeaderQos(Jt.AT_LEAST_ONCE),[4,this._connMgr.send(n,eo)]):[2];case 1:return r=h.sent(),i=r.code,o=r.data,this._isPullingUltraChangeMessage=!1,i===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=exports.UltraMsgChangeType.CHANNEL_CHANGE,r=exports.UltraMsgChangeType.MSG_RECALL,i=exports.UltraMsgChangeType.MSG_EXPANSION,o=exports.UltraMsgChangeType.MSG_MODIFY,s=exports.UltraMsgChangeType.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[r]&&this._handleMsgRecall(t[r]),t[i]&&this._handleMsgUpdate(t[i]),t[o]&&this._handleMsgUpdate(t[o]),t[s]&&this._handleUserGroupStatus(t[s])},t.prototype._handleUltraChannelChange=function(e){var t=this,n=[],r=[],i=[];e.forEach((function(e){var o=e.subChangeType,s=e.targetId,a=e.channelId,u=e.sendTime,c=e.operatorId,l="".concat(a,"_").concat(s),h=t._ultraGroupMap[l];if(h){var d=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE,p=exports.UltraMsgSubChangeType.PRIVATE_TO_PUBLIC,g=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=exports.UltraMsgSubChangeType.CHANNEL_DELETE,_=exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED;switch(o){case p:h.channelType=exports.UltraGroupChannelType.PUBLIC,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=exports.UltraGroupChannelType.PRIVATE,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete t._ultraGroupMap[l];break;case f:r.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:u}),delete t._ultraGroupMap[l];break;case _:i.push({targetId:s,channelId:a,userId:c,channelType:exports.UltraGroupChannelType.PRIVATE}),c===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),r.length>0&&this._watcher.ultraGroupChannelDelete(r),i.length>0&&this._watcher.ultraGroupChannelUserKicked(i)},t.prototype._handleMsgRecall=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.conversationType,u=e.operatorId;t._updateUltraGroupWhenRecallMsg(r,i,o,s),n.push({targetId:r,conversationType:a,sentTime:s,messageUId:o,senderUserId:u,channelId:i,content:{conversationType:a,targetId:r,messageUId:o,channelId:i},messageDirection:1,messageType:F.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,r=e.conversationType,i=e.sendTime,o=e.messageUId,s=e.channelId,a="".concat(r,"_").concat(n);t[a]||(t[a]=[]),t[a].push({messageUId:o,channelId:s,sendTime:i})})),t){var r=n.split("_"),i=r.shift(),o=r.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:o,conversationType:Number(i),messages:S([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return m(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c=this;return R(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(r=new Jn(Zn[Zn.qryMsg],n,this.currentUserId)).setHeaderQos(Jt.AT_LEAST_ONCE),[4,this._connMgr.send(r,ro,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return i=l.sent(),o=i.code,s=i.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,r=e.messageUId,i=c._ultraGroupMap["".concat(n,"_").concat(t)];i&&i.latestMessage.messageUId===r&&(i.latestMessage=e),u.push(e)})),e===exports.UltraMsgChangeType.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===exports.UltraMsgChangeType.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h;return R(this,(function(d){return t=exports.UserGroupChangeType.REMOVE_USER_GROUP,n=exports.UserGroupChangeType.JOIN_USER_GROUP,r=exports.UserGroupChangeType.EXIT_USER_GROUP,i=exports.UserGroupChangeType.CHANNEL_BIND_USER_GROUP,o=exports.UserGroupChangeType.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],l=[],e.forEach((function(e){var h=e.conversationType,d=e.targetId,p=e.userGroupIds,g=e.busChannelType,f=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:h,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:h,targetId:d},userGroupIds:p});break;case r:u.push({conversation:{conversationType:h,targetId:d},userGroupIds:p});break;case i:c.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:g,userGroupIds:p});break;case o:l.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:g,userGroupIds:p})}})),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 r;return m(this,void 0,void 0,(function(){var i,o,s,a,u,c;return R(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr.codec.encodeGetHistoryMsg(e,t),o=new Jn(Zn[Zn.qryUgMsg],i,this.currentUserId),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:V.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,Qr,{currentUserId:this.currentUserId,conversation:{conversationType:V.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===(r=u.list)||void 0===r||r.forEach((function(e){e&&c.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s;return R(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(r=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),i=new Jn(Zn[Zn.ugUnpushSet],r,e),[4,this._connMgr.send(i)]):[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 m(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,r=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),i=new Jn(Zn[Zn.ugUnpushQuery],r,e),[4,n.send(i,Gi)]):[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,r){var i="".concat(t,"_").concat(e);if(this._ultraGroupMap[i]){var o=this._ultraGroupMap[i],s=o.latestMessage;s&&s.messageUId===n&&(o.latestMessage=null)}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:x.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o;return R(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Jn(Zn[Zn.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,Vi)]):[2,Promise.resolve({code:x.METHOD_NOT_AVAILABLE})]:[2,{code:x.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===x.SUCCESS&&o?[2,{code:i,data:o}]:[2,{code:i}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i;return R(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,r=this._ultraGroupMap["".concat(n,"_").concat(t)]||{},i=r.firstUnreadMessage||null,[2,{code:x.SUCCESS,data:i}]):[2,Promise.resolve({code:x.METHOD_NOT_AVAILABLE})]:[2,{code:x.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i;return R(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),r=new Jn(Zn[Zn.setRtcRoomId],n,t),[4,this._connMgr.send(r)]):[2,x.RC_NET_UNAVAILABLE];case 1:return i=o.sent(),[2,i.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=r instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(r)):r,o=n?new Jn(t,i,e):new Yn(t,i,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 m(this,void 0,void 0,(function(){var r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return r=po(this.rtcCodec,t,n),[4,this.rtcSignaling(e,Zn[Zn.rtcPing],!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,(a=s?this.rtcCodec.decode(Xe.RtcOutput,s):null).version=et(a.version),[2,{code:o,data:a}]}}))}))},t.prototype.getDeviceId=function(){return Lr(this.runtime)},t.prototype.getOSInfo=function(){return m(this,void 0,void 0,(function(){return R(this,(function(e){return[2,{code:x.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return m(this,void 0,void 0,(function(){return R(this,(function(e){return[2,{code:x.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return m(this,void 0,void 0,(function(){return R(this,(function(e){return[2,{code:x.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){Oo()},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,r){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,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,r,i){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,r){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,r,i,o){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,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,r){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,r){throw new Error("Method not implemented.")},t.prototype.setCallInfo=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},t.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}(Kt),cs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return I(t,e),t.prototype.joinRTCRoom=function(e,t,n,r,i,o){return m(this,void 0,void 0,(function(){var s,a,u,c,l;return R(this,(function(h){switch(h.label){case 0:return s=po(this._context.rtcCodec,t,n,r,i,o),[4,this.rtcSignaling(e,yt,!0,s)];case 1:return a=h.sent(),u=a.code,c=a.buffer,u===x.SUCCESS&&c&&(l=go(this._context.rtcCodec,c)),[2,{code:u,data:l}]}}))}))},t.prototype.quitRTCRoom=function(e){return m(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(Xe.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,vt,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return m(this,void 0,void 0,(function(){return R(this,(function(r){switch(r.label){case 0:return[4,this._context.rtcPing(e,t,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPingResVersion=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o;return R(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(Xe.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,It,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===x.SUCCESS&&i&&(o=this._context.rtcCodec.decode(Xe.RtcRoomInfoOutput,i)),[2,{code:r,data:o}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s;return R(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(Xe.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Ct,!0,t)];case 1:return n=a.sent(),r=n.code,i=n.buffer,r===x.SUCCESS&&i&&(s=go(this._context.rtcCodec,i),o={users:s.users}),[2,{code:r,data:o}]}}))}))},t.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},t.prototype.setRTCUserInfo=function(e,t,n){return m(this,void 0,void 0,(function(){var r;return R(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(Xe.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,mt,!0,r)];case 1:return[2,i.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return m(this,void 0,void 0,(function(){var n;return R(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(Xe.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,Rt,!1,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return m(this,void 0,void 0,(function(){var s;return R(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(Xe.RtcSetDataInput,{interior:r,target:i,key:t,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(e,St,!1,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),m(this,void 0,void 0,(function(){var o,s;return R(this,(function(a){switch(a.label){case 0:return o={objectName:r,content:this._context.rtcCodec.encode(Xe.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(Xe.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(Xe.RtcValueInfo,{key:"mcu_uris",value:i},!0)]},s=this._context.rtcCodec.encode(Xe.RtcUserSetDataInput,o),[4,this.rtcSignaling(e,Ot,!0,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return m(this,void 0,void 0,(function(){var r;return R(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(Xe.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(Xe.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,Ot,!0,r)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c;return R(this,(function(l){switch(l.label){case 0:return i=this._context.rtcCodec.encode(Xe.RtcDataInput,{interior:n,target:r,key:t}),[4,this.rtcSignaling(e,Mt,!0,i)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===x.SUCCESS&&a?(u=this._context.rtcCodec.decode(Xe.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,r,i){return m(this,void 0,void 0,(function(){var o;return R(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(Xe.RtcDataInput,{interior:n,target:r,key:t,objectName:null==i?void 0:i.name,content:null==i?void 0:i.content}),[4,this.rtcSignaling(e,Lt,!1,o)];case 1:return[2,s.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,r){return m(this,void 0,void 0,(function(){return R(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return r=po(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Nt,!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,o===x.SUCCESS&&s?(a=this._context.rtcCodec.decode(Xe.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},t.prototype.setRTCState=function(e,t){return m(this,void 0,void 0,(function(){var n;return R(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(Xe.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,Ut,!0,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o;return R(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(Xe.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,At,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===x.SUCCESS&&i?(o=go(this._context.rtcCodec,i),[2,{code:r,data:o}]):[2,{code:r}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return R(this,(function(l){switch(l.label){case 0:return r=po(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,wt,!0,r)];case 1:return i=l.sent(),o=i.code,s=i.buffer,o===x.SUCCESS&&s?(a=this._context.rtcCodec.decode(Xe.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 m(this,void 0,void 0,(function(){var t,n;return R(this,(function(r){switch(r.label){case 0:return t=this._context.rtcCodec.encode(Xe.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,bt,!0,t)];case 1:return n=r.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return r=this._context.rtcCodec.encode(Xe.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,xt,!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,o===x.SUCCESS&&s?(a=go(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},t.prototype.requestRoomPK=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=e.roomId,a=this._context.rtcCodec.encode(Xe.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,timeoutTime:i,inviteInfo:o}),[4,this.rtcSignaling(s,Dt,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},t.prototype.cancelRoomPK=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=e.roomId,s=this._context.rtcCodec.encode(Xe.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteInfo:i}),[4,this.rtcSignaling(o,Vt,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l;return R(this,(function(h){switch(h.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree,u=e.roomId,c=this._context.rtcCodec.encode(Xe.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:r,content:i,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,Gt,!0,c)];case 1:return l=h.sent().code,this._context.rtcKVManager.reset(),[2,l]}}))}))},t.prototype.endRoomPK=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=e.roomId,s=this._context.rtcCodec.encode(Xe.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:r,inviteRoomKeys:i}),[4,this.rtcSignaling(o,Bt,!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,r){return this._context.rtcSignaling(e,t,n,r)},t.prototype.getRTCJoinedUserInfo=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o;return R(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(Xe.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",kt,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===x.SUCCESS&&i?(o=this._context.rtcCodec.decode(Xe.RtcQueryUserJoinedOutput,i).info||[],[2,{code:r,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:et(e.joinTime)}}))}]):[2,{code:r}]}}))}))},t}($t);function ls(e){return C({},e)}var hs,ds,ps,gs=function(){function e(e,t){var n,r,o;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[F.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[F.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[F.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[F.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[F.INTERCEPT]=this._processInterceptMessage.bind(this),n),this._messageProccessor=((r={})[F.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),r[F.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),r[F.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),r),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=C({},t),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter((function(e){return/^https?:\/\//.test(e)})),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")})),0===this._options.navigators.length&&(o=this._options.navigators).push.apply(o,i);var s={onConnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.DISCONNECTED),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this),messageDelivered:this._messageDeliveredListerer.bind(this),groupMessageDeliveredStatus:this._groupMessageDeliveredStatusListerer.bind(this),callInfo:this._callInfoListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this)};this.rtcCodec=this.createCodec(Ft,Ht),this._engine=dt()?new RCCppEngine(e,this.rtcCodec,s,this._options):new us(e,this.rtcCodec,s,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new Tt(this._engine)}return e.init=function(t,n){return this._context?(this._context.logger.warn(exports.LogTagId.A_INIT_REPEAT_O),this._context):(this._context=new e(t,n),this._context.logger.info(exports.LogTagId.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(exports.LogTagId.L_IMSDK_VER_O,JSON.stringify({commitId:"a8c6bdefd42b849d4ba9a105ecf5c00403c17522",version:"5.7.8"})),this._context)},e.destroy=function(){return m(this,void 0,void 0,(function(){return R(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(exports.LogTagId.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return e.sent(),this._context=void 0,[2]}}))}))},e.prototype.createCodec=function(e,t){return new Zt(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(exports.LogTagId.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(exports.LogTagId.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var r="RCRTC"===e.tag?new cs(this):new $t(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(r,this._runtime,t)}catch(e){this.logger.error(exports.LogTagId.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,n)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&(this._pluginContextQueue.push(r),this._pluginInstanseMap[e.tag]=i),i},e.prototype._onConnectionStatusChange=function(e,t){var n,r;this.logger.warn(exports.LogTagId.A_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),null===(r=(n=this._watcher).connection)||void 0===r||r.call(n,e,t),this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onconnectionstatechange)||void 0===r||r.call(n,e,t)}))},e.prototype._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?re.QUIT:re.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(ls(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===V.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===exports.MessageBlockSourceType.MSG_EXPANSION||n===exports.MessageBlockSourceType.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(exports.LogTagId.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0},e.prototype._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,r=this._engine.getCurrentUserId();n&&Array.isArray(n[r])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[r])},e.prototype._messageReceiver=function(e,t,n){var r,i,o,s,a=this;if(!(null===(i=(r=this._compatibleMessageProccessor)[e.messageType])||void 0===i?void 0:i.call(r,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(ls(e))}catch(e){return a.logger.error(exports.LogTagId.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,ls(e),t,n),!this._messageProccessor[e.messageType])return e;this._messageProccessor[e.messageType](e)}},e.prototype._batchMessageReceiver=function(e,t,n){var r=this,i=[];e.forEach((function(e){var o=r._messageReceiver(e,t,n);o&&i.push(o)})),i.length&&this._watcher.batchMessage&&(this.logger.debug(exports.LogTagId.L_BATCH_MESSAGE_O,i.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(i))},e.prototype._chatroomInfoListener=function(e){var t,n;null===(n=(t=this._watcher).chatroomState)||void 0===n||n.call(t,e)},e.prototype._conversationInfoListener=function(e){var t,n;null===(n=(t=this._watcher).conversationState)||void 0===n||n.call(t,e)},e.prototype._expansionInfoListener=function(e){var t,n;null===(n=(t=this._watcher).expansion)||void 0===n||n.call(t,e)},e.prototype._tagListener=function(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)},e.prototype._conversationTagListener=function(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)},e.prototype._typingStatusListener=function(e){var t,n;null===(n=(t=this._watcher).typingState)||void 0===n||n.call(t,e)},e.prototype._pullFinishedListener=function(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)},e.prototype._MessageBlockedListener=function(e){var t,n;null===(n=(t=this._watcher).messageBlocked)||void 0===n||n.call(t,e)},e.prototype._messageDeliveredListerer=function(e){var t,n;null===(n=(t=this._watcher).messageDelivered)||void 0===n||n.call(t,e)},e.prototype._groupMessageDeliveredStatusListerer=function(e){var t,n;null===(n=(t=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(t,e)},e.prototype._callInfoListener=function(e){var t=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(e)}catch(e){t.logger.warn(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype._ultraGroupEnableListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupEnable)||void 0===n||n.call(t,e)},e.prototype._operateStatusListener=function(e){var t,n;null===(n=(t=this._watcher).operateStatus)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageModifiedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageRecalledListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelDeleteListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(t,e)},e.prototype._userGroupStatusListener=function(e){var t,n;null===(n=(t=this._watcher).userGroupStatus)||void 0===n||n.call(t,e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onrtcdatachange)||void 0===r||r.call(n,e,t)}))},e.prototype._naviDataChange=function(e){this._pluginContextQueue.forEach((function(t){var n;null===(n=t.onnavidatachange)||void 0===n||n.call(t,e)}))},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t._watcher[n]=Oe(r)||Se(r)?r:void 0}}))},e.prototype._resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,o=e.channelId,s=i.typingContentType,a=o||"",u="".concat(n,"#").concat(r,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===s?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.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 m(this,void 0,void 0,(function(){return R(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var r,i;return m(this,void 0,void 0,(function(){var o,s,a,u;return R(this,(function(c){switch(c.label){case 0:return this._token=e,[4,this._engine.connect(e,t,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s!==x.SUCCESS?[2,{code:s}]:(1!==this._engine.getNaviInfoFromCache().type&&(u=xe.getInfo(),null===(i=(r=this._engine).reportSDKInfo)||void 0===i||i.call(r,u)),[2,{code:s,userId:a}])}}))}))},e.prototype.disconnect=function(e){return m(this,void 0,void 0,(function(){var t=this;return R(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){t.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}})),[2,Promise.resolve()]}}))}))},e.prototype.reconnect=function(e){return this.connect(this.token,!!e,this.logger.createTraceId())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i=!1),Ce(r)&&r.length>0&&(this._registerMessageSearchPropsMapping[e]=r),this._engine.registerMessageType(e,t,n,r,i)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],r={};return n&&Se(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var i=t[e];Ie(i)&&(i>-Math.pow(2,64)&&i<Math.pow(2,64)&&Number.isInteger(i)||(r[e]=i))}})),Object.keys(r).length>0?{msg:JSON.stringify(r),code:x.SEARCH_PROPS_LIMIT_ERROR}:{code:x.SUCCESS}},e.prototype.sendMessage=function(e,t,n,r,i){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==x.SUCCESS)return Promise.resolve({code:s,msg:a});if(e!==V.ULTRA_GROUP){var c=this.getNaviInfoFromCache();if(1===((null==c?void 0:c.grpRRVer)||0)&&n.messageType===F.READ_RECEIPT_RESPONSE)return Promise.resolve({code:x.READ_RECEIPT_ERROR})}var l=n.canIncludeExpansion,h=void 0!==l&&l,d=n.expansion;if(h){var p=we(d),g=p.isIllgalEx,f=p.isExKeyOrValLengthExceedLimit;if(p.isExceedLimit||f)return Promise.resolve({code:x.EXPANSION_LIMIT_EXCEET});if(g)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?L(_):N(_))>u?Promise.resolve({code:x.RC_MSG_CONTENT_EXCEED_LIMIT}):e===V.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,r,i):this._engine.sendMessage(e,t,n,r,i)},e.prototype.sendExpansionMessage=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h;return R(this,(function(d){switch(d.label){case 0:return t=e.channelId,n=e.conversationType,r=e.targetId,i=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(u=we(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:i},s&&(h.put=s),o&&(h.del=o),a&&(h.removeAll=1),[4,this._engine.sendMessage(n,r,{content:h,messageType:F.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 m(this,void 0,void 0,(function(){var r;return R(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.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 m(this,void 0,void 0,(function(){var r;return R(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:x.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){return m(this,void 0,void 0,(function(){var e=this;return R(this,(function(t){switch(t.label){case 0:return this._resetWatcher(),this._engine.destroy(),[4,this.disconnect()];case 1:return t.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondestroy)try{t.ondestroy()}catch(t){e.logger.error(exports.LogTagId.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,r,i,o,s,a){if(void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),void 0===s&&(s=""),e===V.ULTRA_GROUP){var u={timestamp:n,count:r,order:i,channelId:o};return this._engine.getUltraHistoryMsg(t,u,a)}return this._engine.getHistoryMessage(e,t,n,r,i,o,s||"",a)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,r,i,o,s)},e.prototype.getConversationList=function(e,t,n,r,i){if(void 0===e&&(e=300),void 0===i&&(i=""),t===V.ULTRA_GROUP){var o=x.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:x[o]})}return this._engine.getConversationList(e,t,n,r,i)},e.prototype.getConversationsByPage=function(e,t,n,r){return this._engine.getConversationsByPage(e,t,n,r)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===V.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===V.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(V.ULTRA_GROUP)){var r=x.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:x[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[V.PRIVATE,V.GROUP,V.SYSTEM,V.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,r){return void 0===r&&(r=""),m(this,void 0,void 0,(function(){var i;return R(this,(function(o){return i=[{conversationType:e,targetId:t,notificationLevel:n,channelId:r}],[2,this._engine.batchSetConversationStatus(i)]}))}))},e.prototype.setConversationStatus=function(e,t,n,r,i){if(void 0===i&&(i=""),e===V.ULTRA_GROUP&&void 0!==n)return Promise.resolve(x.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,r){return void 0===r&&(r=""),this._engine.saveConversationMessageDraft(e,t,n,r)},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,r,i){return this._engine.recallMsg(e,t,n,r,i)},e.prototype.deleteRemoteMessage=function(e,t,n,r){return void 0===r&&(r=""),e===V.ULTRA_GROUP?Promise.resolve(x.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,r)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)},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,r=t.value;return it(n)&&ot(r)?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 r=t.entries[n],i=r.key,o=r.value;if(!it(i)||!ot(o))return Promise.resolve({code:x.BIZ_ERROR_INVALID_PARAMETER})}var s=C(C({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return it(n)&&ot(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(x.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return it(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 r=t.entries[n].key;if(!it(r))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 it(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,r){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===r&&(r=0),this._engine.getChatroomHistoryMessages(e,r,t,n)},e.prototype.getFileToken=function(e,t,n,r){return m(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return R(this,(function(h){switch(h.label){case 0:return i=this.getNaviInfoFromCache(),o=(null==i?void 0:i.bosAddr)||"",s=(null==i?void 0:i.uploadServer)||"",a=(null==i?void 0:i.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,r)];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,r,i){return void 0===i&&(i=W.QINIU),m(this,void 0,void 0,(function(){var o,s,a;return R(this,(function(u){switch(u.label){case 0:return(null==r?void 0:r.isBosRes)?[2,Promise.resolve(r)]:[4,this._engine.getFileUrl(e,i,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 m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return m(this,void 0,void 0,(function(){return R(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return m(this,void 0,void 0,(function(){return R(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 m(this,void 0,void 0,(function(){return R(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return m(this,void 0,void 0,(function(){return R(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return m(this,void 0,void 0,(function(){return R(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=[V.PRIVATE,V.CHATROOM,V.GROUP,V.SYSTEM,V.APP_PUBLIC_SERVICE,V.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t)},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[V.PRIVATE,V.CHATROOM,V.GROUP,V.SYSTEM,V.APP_PUBLIC_SERVICE,V.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(e)},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!==V.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 m(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return R(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,r=e.canIncludeExpansion,t!==V.ULTRA_GROUP?[2,{code:i=x.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:x[i]}]:r?(o=we(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 m(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return e.conversationType!==V.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.callExtra=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this._engine).callExtra.apply(t,S([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 m(this,void 0,void 0,(function(){return R(this,(function(n){return[2,this._engine.clearConversations(e,t)]}))}))},e.prototype.setUserStatusListener=function(e,t){var n=this;return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){n.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return m(this,void 0,void 0,(function(){return R(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return m(this,void 0,void 0,(function(){var r,i,o;return R(this,(function(s){return r=this.checkSearchPropsMsg(n.messageType,n.content),i=r.code,o=r.msg,i!==x.SUCCESS?[2,Promise.resolve({code:i,msg:o})]:[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.batchInsertMessage=function(e,t){return this._engine.batchInsertMessage(e,t)},e.prototype.getMessageCount=function(e,t,n){return void 0===n&&(n=""),m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),m(this,void 0,void 0,(function(){return R(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,r,i)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return m(this,void 0,void 0,(function(){return R(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,r){return m(this,void 0,void 0,(function(){return R(this,(function(i){return[2,this._engine.updateMessageReceiptStatus(e,t,n,r)]}))}))},e.prototype.setUserStatus=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,r){return void 0===t&&(t=[]),void 0===n&&(n=""),m(this,void 0,void 0,(function(){return R(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),m(this,void 0,void 0,(function(){return R(this,(function(r){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,r,i,o,s){return void 0===s&&(s=""),m(this,void 0,void 0,(function(){return R(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,r,i,o,s)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){return m(this,void 0,void 0,(function(){return R(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,r,i)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,o,s){return m(this,void 0,void 0,(function(){return R(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,r,i,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(e,t,n,r)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){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,r,i,o){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return m(this,void 0,void 0,(function(){return R(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,r){return this._engine.rtcSignaling(e,t,n,r)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e.prototype.setProxy=function(e){return this._engine.setProxy(e)},e.prototype.getProxy=function(){return this._engine.getProxy()},e.prototype.testProxy=function(e,t){return this._engine.testProxy(e,t)},e}();exports.HttpMethod=void 0,(hs=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",hs.POST="POST",exports.NetworkType=void 0,(ds=exports.NetworkType||(exports.NetworkType={})).WIFI="wifi",ds.FOUR_G="4g",ds.THREE_G="3g",ds.TWO_G="2g",ds.FIVE_G="2g",ds.THREE_GENT="3gnet",ds.UNKONWN="unknown",exports.TagChangeType=void 0,(ps=exports.TagChangeType||(exports.TagChangeType={}))[ps.add=1]="add",ps[ps.update=2]="update",ps[ps.delete=3]="delete";var fs=f;exports.AConnectionMgr=rs,exports.AEngine=Kt,exports.APIContext=gs,exports.AppStorage=y,exports.BAIDU_STORAGE_SERVER_URI=a,exports.BasicLogger=yo,exports.BasicNavi=Cr,exports.BasicReporter=ko,exports.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},exports.CallLibMsgType={"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"},exports.ChatroomEntryType=ee,exports.ChatroomUserChangeType=re,exports.Codec=Zt,exports.ConnectionStatus=B,exports.ConversationType=V,exports.DB_LOG_FLUSH_FREQUENCY=3e3,exports.DB_LOG_MAX_SIZE=1e5,exports.DEFAULT_LOG_POLICY=p,exports.DelayTimer=_t,exports.ErrorCode=x,exports.EventEmitter=be,exports.FORMATED_VERSION=_,exports.FileType=A,exports.HTTP_TIMEOUT=6e4,exports.IM_CHATROOM_PULL_INTERVAL_TIME=c,exports.IM_PING_INTERVAL_TIME=15e3,exports.IM_PING_MIN_TIMEOUT=2e3,exports.IM_PING_TIMEOUT=15e3,exports.IM_SIGNAL_TIMEOUT=3e4,exports.IndexDBLogger=Bo,exports.IndexDBReporter=Zo,exports.MAX_MESSAGE_CONTENT_BYTES=u,exports.MAX_MESSAGE_EXPANSION_KEY_LENGTH=32,exports.MAX_MESSAGE_EXPANSION_VAL_LENGTH=4096,exports.MINI_SOCKET_CONNECT_URIS=o,exports.MentionedType=Q,exports.MessageBlockType=oe,exports.MessageDirection=b,exports.MessageType=F,exports.NAVI_CACHE_DURATION=r,exports.NAVI_REQ_TIMEOUT=1e4,exports.NotificationLevel=Y,exports.NotificationStatus=K,exports.ONE_LOG_SIZE_MAX=1e3,exports.OperateStatus=_e,exports.PUBLIC_CLOUD_NAVI_URIS=i,exports.PluginContext=$t,exports.QINIU_STORAGE_SERVER_URI=s,exports.RCAssertError=Ze,exports.REAT_TIME_LOG_SIZE=20971520,exports.RTCPluginContext=cs,exports.ReceivedStatus=n,exports.SEND_MESSAGE_TYPE_OPTION=h,exports.STATUS_MESSAGE=d,exports.STORAGE_ROOT_KEY=l,exports.UploadMethod=W,exports.VERSION=f,exports.VersionManage=xe,exports.WEB_SOCKET_TIMEOUT=5e3,exports.WebSocketNavi=Sr,exports.appendUrl=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},exports.assert=function(e,t,n,r){if(void 0===r&&(r=!1),!$e(e,t,n,r))throw new Ze("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},exports.clone=ft,exports.cloneByJSON=ht,exports.deInitLogDB=Oo,exports.forEach=at,exports.getBrowser=pt,exports.getClientMessageId=st,exports.getMimeKey=function(e){var t="application/octet-stream";switch(e){case A.IMAGE:t="image/jpeg";break;case A.AUDIO:t="audio/amr";break;case A.VIDEO:t="video/3gpp";break;case A.SIGHT:t="video/mpeg4";break;case A.COMBINE_HTML:t="text/html"}return t},exports.getUUID=je,exports.getUUID22=Qe,exports.getUploadFileName=tt,exports.indexOf=ct,exports.initLogDB=So,exports.isArray=Ce,exports.isArrayBuffer=me,exports.isBoolean=function(e){return"boolean"==typeof e},exports.isConnnectAck=function(e){return Object.keys(ts).some((function(t){return ts[t]===e}))},exports.isDisconnectedByServer=function(e){return Object.keys(es).some((function(t){return es[t]===e}))},exports.isFunction=Oe,exports.isHttpUrl=Le,exports.isInObject=lt,exports.isInclude=function(e,t){return-1!==ct(e,t)},exports.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},exports.isNumber=Ie,exports.isObject=Se,exports.isString=ve,exports.isTypeInConversationList=function(e){return[V.PRIVATE,V.GROUP,V.SYSTEM,V.PUBLIC_SERVICE,V.APP_PUBLIC_SERVICE].includes(e)},exports.isUndefined=Me,exports.isValidChannelId=Ae,exports.isValidChrmEntryKey=it,exports.isValidChrmEntryValue=ot,exports.isValidConversationType=Ue,exports.isValidExpansion=we,exports.isValidFileType=function(e){return Ie(e)&&Object.prototype.hasOwnProperty.call(A,e)},exports.isValidNotificationLevel=function(e){return Ie(e)&&Object.prototype.hasOwnProperty.call(Y,e)},exports.logger=Ye,exports.map=ut,exports.notEmptyArray=function(e){return Ce(e)&&e.length>0},exports.notEmptyObject=Ne,exports.notEmptyString=Re,exports.pushConfigsToJSON=nt,exports.pushJSONToConfigs=rt,exports.todo=function(e){return new M(e)},exports.transcsv=zo,exports.usingCppEngine=dt,exports.validate=$e,exports.version=fs;
1
+ "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),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,r=72e5,i=1e4,o=131072,s=18e4,a="RCV4-",u={"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}},c=["RC:TypSts","RC:InterceptMsg","RC:RL"],l="5.7.10",h=l.replace(/-.+$/,""),d=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},p=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}(),f=function(){function e(e,t){var n,r=t?"".concat(a).concat(t):a;this._rootStorage=d(e);var i=this._rootStorage.get(r)||{};this._cache=new p(((n={})[r]=i,n)),this._storageKey=r}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}(),_=function(e,t){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},_(e,t)};function T(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}_(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var E=function(){return E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},E.apply(this,arguments)};function v(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function y(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(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,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function I(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var C,m=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return T(t,e),t}(Error),R=function(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},S=function(e){for(var t,n=0,r=0,i=e.length;r<i;r++)n+=(t=e.charCodeAt(r))<127?1:t<=2047?2:t<=65535?3:4;return n};!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"}(C||(C={}));var O,M=C;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(O||(O={}));var L,N=O;!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_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.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.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"}(L||(L={}));var U,A=L;!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"}(U||(U={}));var w,b=U;!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"}(w||(w={}));var P,x=w;!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"}(P||(P={}));var D,V=P;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(D||(D={}));var G,B=D;!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"}(G||(G={}));var k,F=G;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(k||(k={}));var H,K=k;!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"}(H||(H={}));var q,Y=H;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(q||(q={}));var j,Q,J,W,X,z=q;exports.LogLevel=void 0,(j=exports.LogLevel||(exports.LogLevel={}))[j.LOG=0]="LOG",j[j.DEBUG=0]="DEBUG",j[j.INFO=1]="INFO",j[j.WARN=2]="WARN",j[j.ERROR=3]="ERROR",j[j.FATAL=4]="FATAL",j[j.STATISTICS=6]="STATISTICS",j[j.NONE=1e3]="NONE",exports.LogSource=void 0,(Q=exports.LogSource||(exports.LogSource={})).IM="IM",Q.RTC="RTC",exports.LogTagId=void 0,(J=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",J.A_INIT_O="A-init-O",J.A_INIT_REPEAT_O="A_INIT_REPEAT_O",J.L_INIT_O="L-init-O",J.A_DESTROY_O="A_DESTROY_O",J.L_DESTROY_O="L_DESTROY_O",J.A_CONNECT_T="A-connect-T",J.A_CONNECT_R="A-connect-R",J.A_CONNECT_S="A-connect-S",J.A_DISCONNECT_O="A-disconnect-O",J.A_RECONNECT_T="A-reconnect-T",J.A_RECONNECT_R="A_RECONNECT_R",J.L_CONNECT_T="L-connect-T",J.L_CONNECT_R="L-connect-R",J.L_CONNECT_S="L-connect-S",J.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",J.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",J.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",J.A_MSG_LISTENER_E="A-MSG_LISTENER-E",J.O="L-original-O",J.T="L-TEST-O",J.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",J.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",J.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",J.A_SEND_MSG_T="A-send_msg-T",J.A_SEND_MSG_R="A-send_msg-R",J.L_SEND_MSG_T="L-send_msg-T",J.L_SEND_MSG_R="L-send_msg-R",J.L_PULL_MSG_T="L-pull_msg-T",J.L_PULL_MSG_R="L-pull_msg-R",J.L_PULL_MSG_O="L-pull_msg-O",J.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",J.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",J.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",J.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",J.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",J.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",J.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",J.L_RECV_S_MSG_O="L-recv_s_msg-O",J.A_DELETE_MESSAGES_S="A-delete_messages-S",J.P_DELETE_MSG_S="P-delete_msg-S",J.L_PULL_CONVERSATION_S="L-pull_conversation-S",J.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",J.A_REGTYP_O="A-regtyp-O",J.P_REGTYP_E="P-regtype-E",J.L_GET_NAVI_T="L-get_navi-T",J.L_GET_NAVI_R="L-get_navi-R",J.L_REQUEST_T="L-request-T",J.L_REQUEST_R="L-request-R",J.L_PARSE_NAVI_E="L-parse_navi-E",J.L_ENV_S="L-Env-S",J.L_GET_INDEX_NAVI_S="L-get_index_navi-S",J.A_JOIN_CHATROOM_T="A-join_chatroom-T",J.A_JOIN_CHATROOM_R="A-join_chatroom-R",J.L_JOIN_CHATROOM_T="L-join_chatroom-T",J.L_JOIN_CHATROOM_R="L-join_chatroom-R",J.A_QUIT_CHATROOM_T="A-quit_chatroom-T",J.A_QUIT_CHATROOM_R="A-quit_chatroom-R",J.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",J.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",J.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",J.L_MEDIA_S="L-media-S",J.L_MEDIA_UPLOAD_T="L-media_upload-T",J.L_MEDIA_UPLOAD_R="L-media_upload-R",J.G_UPLOAD_LOG_S="G-upload_log-S",J.G_REPORT_LOG_S="G-report_log-S",J.G_UPLOAD_LOG_E="G-upload_log-E",J.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",J.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",J.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",J.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",J.A_GET_HISTORY_MSG_T="A-get_history_msg-T",J.A_GET_HISTORY_MSG_R="A-get_history_msg-R",J.L_GET_HISTORY_MSG_T="L-get_history_msg-T",J.L_GET_HISTORY_MSG_R="L-get_history_msg-R",J.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",J.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",J.A_CALLBACK_O="A-callback-O",J.A_CALLBACK_E="A-callback-E",J.L_CALLBACK_E="L-callback-E",J.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",J.L_PB_ENCODE_E="L-pb-encode-E",J.L_PB_DECODE_E="L-pb-decode-E",J.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",J.L_REPORT_FULL_LOG_O="L-report_full_log-O",J.L_REPORT_FULL_LOG_T="L-report_full_log-T",J.L_REPORT_FULL_LOG_R="L-report_full_log-R",J.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",J.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",J.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",J.L_LOGDB_CLOSED_S="L-logDB_closed-S",J.L_LOGDB_ERROR_E="L-logDB_error-S",J.L_LOGDB_ABORT_S="L-logDB_abort-S",J.L_REALTIME_LOG_R="L_REALTIME_LOG_R",J.L_REALTIME_LOG_O="L_REALTIME_LOG_O",J.L_REALTIME_LOG_T="L_REALTIME_LOG_T",J.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",J.L_RECV_RMTP_O="L_RECV_RMTP_O",J.L_RECV_RMTP_E="L_RECV_RMTP_E",J.L_RECV_S_NTF_O="L-recv_s_ntf_O",J.L_VER_REPORT_T="L-VER_REPORT-T",J.L_VER_REPORT_R="L-VER_REPORT-R",J.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",J.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",J.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",J.A_REMOVE_PROXY_O="A-remove_proxy-O",J.A_SET_PROXY_O="A-set_proxy-O",J.A_TEST_PROXY_O="A-test_proxy-O",J.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",J.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",J.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",exports.StatisticsTag=void 0,(W=exports.StatisticsTag||(exports.StatisticsTag={})).IM_NAVI="IM-stats_navi-S",W.IM_WEBSOCKET="IM-stats_websocket-S",W.IM_CONNECTION_DURATION="IM-stats_con_dur-S",W.IM_CMP="IM-stats_cmp-S",W.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",W.IM_STATS_CS="IM-stats_cs-S",W.IM_NETWORK_CHANGE="IM-stats_network_change-S",function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(X||(X={}));var Z,$,ee=X;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Z||(Z={})),exports.MessageBlockSourceType=void 0,($=exports.MessageBlockSourceType||(exports.MessageBlockSourceType={}))[$.MSG_ORIGINAL=0]="MSG_ORIGINAL",$[$.MSG_EXPANSION=1]="MSG_EXPANSION",$[$.MSG_MODIFY=2]="MSG_MODIFY";var te,ne=Z;!function(e){e[e.typing=0]="typing"}(te||(te={}));var re,ie,oe=te;exports.SentStatus=void 0,(re=exports.SentStatus||(exports.SentStatus={}))[re.SENDING=10]="SENDING",re[re.FAILED=20]="FAILED",re[re.SENT=30]="SENT",re[re.RECEIVED=40]="RECEIVED",re[re.READ=50]="READ",re[re.DESTROYED=60]="DESTROYED",function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ie||(ie={}));var se,ae=ie;!function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(se||(se={}));var ue,ce=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"}(ue||(ue={}));var le,he=ue;!function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(le||(le={}));var de,pe,ge,fe,_e,Te,Ee,ve,ye,Ie,Ce,me,Re,Se,Oe,Me,Le=le;exports.StoreKeys=void 0,(de=exports.StoreKeys||(exports.StoreKeys={})).NAVI="rc-navi",de.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp",exports.UltraGroupChannelType=void 0,(pe=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[pe.PUBLIC=0]="PUBLIC",pe[pe.PRIVATE=1]="PRIVATE",exports.UltraGroupChannelChangeType=void 0,(ge=exports.UltraGroupChannelChangeType||(exports.UltraGroupChannelChangeType={}))[ge.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",ge[ge.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",ge[ge.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UltraMsgChangeType=void 0,(fe=exports.UltraMsgChangeType||(exports.UltraMsgChangeType={}))[fe.MSG_EXPANSION=1]="MSG_EXPANSION",fe[fe.MSG_MODIFY=2]="MSG_MODIFY",fe[fe.MSG_RECALL=3]="MSG_RECALL",fe[fe.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",fe[fe.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE",exports.UltraMsgSubChangeType=void 0,(_e=exports.UltraMsgSubChangeType||(exports.UltraMsgSubChangeType={}))[_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",exports.UserGroupChangeType=void 0,(Te=exports.UserGroupChangeType||(exports.UserGroupChangeType={}))[Te.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",Te[Te.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",Te[Te.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",Te[Te.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",Te[Te.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP",exports.UltraMentionedType=void 0,(Ee=exports.UltraMentionedType||(exports.UltraMentionedType={}))[Ee.NOT_MENTIONED=0]="NOT_MENTIONED",Ee[Ee.ALL=1]="ALL",Ee[Ee.ME=2]="ME",exports.EnterpriseType=void 0,(ve=exports.EnterpriseType||(exports.EnterpriseType={}))[ve.PRIVATE=1]="PRIVATE",ve[ve.OPEN=0]="OPEN",exports.ProtocalType=void 0,(ye=exports.ProtocalType||(exports.ProtocalType={}))[ye.NAVI=1]="NAVI",ye[ye.TCP=2]="TCP",ye[ye.WS=3]="WS",exports.NaviCacheType=void 0,(Ie=exports.NaviCacheType||(exports.NaviCacheType={}))[Ie.REQUEST=0]="REQUEST",Ie[Ie.LOCAL=1]="LOCAL",exports.StatisticsVersion=void 0,(Ce=exports.StatisticsVersion||(exports.StatisticsVersion={}))[Ce.CURRENT=2]="CURRENT",exports.ConnectType=void 0,(me=exports.ConnectType||(exports.ConnectType={}))[me.CONNECT=0]="CONNECT",me[me.RECONNECT=1]="RECONNECT",exports.ConnectReason=void 0,(Re=exports.ConnectReason||(exports.ConnectReason={}))[Re.CONNECT=0]="CONNECT",Re[Re.RECONNECT=1]="RECONNECT",Re[Re.REDIRECTED=3]="REDIRECTED",Re[Re.TIMEOUT=4]="TIMEOUT",exports.RTCMode=void 0,(Se=exports.RTCMode||(exports.RTCMode={}))[Se.RTC=0]="RTC",Se[Se.LIVE=2]="LIVE",Se[Se.SIP=4]="SIP",Se[Se.CALL=5]="CALL",Se[Se.MEETING=6]="MEETING",Se[Se.CROSS_MUTI=7]="CROSS_MUTI",Se[Se.CROSS_LIVE=8]="CROSS_LIVE",exports.LiveType=void 0,(Oe=exports.LiveType||(exports.LiveType={}))[Oe.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",Oe[Oe.AUDIO=1]="AUDIO",exports.LiveRole=void 0,(Me=exports.LiveRole||(exports.LiveRole={}))[Me.ANCHOR=1]="ANCHOR",Me[Me.AUDIENCE=2]="AUDIENCE";var Ne,Ue,Ae;exports.RTCApiType=void 0,(Ne=exports.RTCApiType||(exports.RTCApiType={}))[Ne.ROOM=1]="ROOM",Ne[Ne.PERSON=2]="PERSON",exports.RTCIdentityChangeType=void 0,(Ue=exports.RTCIdentityChangeType||(exports.RTCIdentityChangeType={}))[Ue.AnchorToViewer=1]="AnchorToViewer",Ue[Ue.ViewerToAnchor=2]="ViewerToAnchor",exports.RTCJoinType=void 0,(Ae=exports.RTCJoinType||(exports.RTCJoinType={}))[Ae.KICK=0]="KICK",Ae[Ae.REFUSE=1]="REFUSE",Ae[Ae.COEXIST=2]="COEXIST";var we=function(e){return"string"==typeof e},be=function(e){return"number"==typeof e&&!Number.isNaN(e)},Pe=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},xe=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},De=function(e){return we(e)&&e.length>0},Ve=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Ge=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Be=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},ke=function(e){return we(e)&&/https?:\/\//.test(e)},Fe=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},He=function(e){return be(e)&&Object.prototype.hasOwnProperty.call(b,e)},Ke=function(e){var t=!1;return we(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},qe=function(e){var t=!1,n=!1,r=!1;if(Ve(e)){var i=Object.keys(e).length;for(var o in t=i>20,e)if(n||(n=we(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!r){var s=e[o];r=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:r}},Ye=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map[e];if(r)for(var i=r.length-1;i>=0;i-=1){var o=r[i],s=o.target,a=o.once,u=o.listener;a&&r.splice(i,1);try{u.call.apply(u,I([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}(),je="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};je.engine="5.7.10";var Qe=function(){function e(){}return e.add=function(e,t){je[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 je.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return je},e}(),Je=null;function We(e,t,n,r){void 0===n&&(n={});var i=["error","warn","info","debug"][3-e];if(Je&&e<exports.LogLevel.FATAL)try{var o=JSON.stringify(n);Je[i](t,o)}catch(e){console.error(e)}}var Xe,ze,Ze=We.bind(null,exports.LogLevel.DEBUG),$e=We.bind(null,exports.LogLevel.INFO),et=We.bind(null,exports.LogLevel.WARN),tt=We.bind(null,exports.LogLevel.ERROR),nt=We.bind(null,exports.LogLevel.FATAL),rt=Object.freeze({__proto__:null,init:function(e){Je=e},log:We,debug:Ze,info:$e,warn:et,error:tt,fatal:nt}),it=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)}))},ot=function(){var e=it();if(e="".concat(e.replace(/-/g,""),"a"),e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.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};exports.AssertRules=void 0,(ze=exports.AssertRules||(exports.AssertRules={}))[ze.STRING=0]="STRING",ze[ze.ONLY_STRING=1]="ONLY_STRING",ze[ze.NUMBER=2]="NUMBER",ze[ze.BOOLEAN=3]="BOOLEAN",ze[ze.OBJECT=4]="OBJECT",ze[ze.ARRAY=5]="ARRAY",ze[ze.CALLBACK=6]="CALLBACK",ze[ze.CHANNEL_ID=7]="CHANNEL_ID",ze[ze.CONVERSATION=8]="CONVERSATION";var st,at,ut,ct=((Xe={})[exports.AssertRules.STRING]=De,Xe[exports.AssertRules.ONLY_STRING]=we,Xe[exports.AssertRules.NUMBER]=be,Xe[exports.AssertRules.BOOLEAN]=function(e){return"boolean"==typeof e},Xe[exports.AssertRules.OBJECT]=Ve,Xe[exports.AssertRules.ARRAY]=Pe,Xe[exports.AssertRules.CALLBACK]=function(e){var t=!0;return Ve(e)||(t=!1),(e=e||{}).onSuccess&&!Ge(e.onSuccess)&&(t=!1),e.onError&&!Ge(e.onError)&&(t=!1),t},Xe[exports.AssertRules.CHANNEL_ID]=Ke,Xe[exports.AssertRules.CONVERSATION]=function(e){var t=!0;return Ve(e)||(t=!1),we(e.targetId)||(t=!1),He(e.conversationType)||(t=!1),Be(e.channelId)||Ke(e.channelId)||(t=!1),t},Xe),lt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return T(t,e),t}(Error),ht=function(e,t,n,r){void 0===r&&(r=!1),n=ct[n]||n;var i=r?n(t):Be(t)||null==t||n(t);return i||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),i},dt=function(e){if(!Ve(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)},pt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=it(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s=".".concat(a[a.length-1])}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(o).concat(r).concat(s)},gt=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,r=e.apnsCollapseId,i=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,u=t.channelIdOPPO,c=t.typeVivo,l=t.googleConfig,h=t.miLargeIconUrl,d=t.importanceHW,p=t.categoryHW,g=t.imageUrlHW,f=t.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=r||"",_.category=i||"",_.richMediaUri=o||"";var T={};T.collapse_key=null==l?void 0:l.collapseKey,T.imageUrl=null==l?void 0:l.imageUrl;var E=null==l?void 0:l.priority;E&&!["high","normal"].includes(E)&&(E="normal"),T.priority=E;var v=[{HW:{channelId:a||"",importance:d||"NORMAL",image:g||"",category:p||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||"",category:f||""}},{APNS:_},{FCM:T}];return JSON.stringify(v)},ft=function(e,t,n){var r={},i={notificationId:n||""};if(!t)return{iOSConfig:r,androidConfig:i};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 p=d[0];switch(p){case"HW":return i.channelIdHW=null===(t=e[p])||void 0===t?void 0:t.channelId,i.importanceHW=null===(n=e[p])||void 0===n?void 0:n.importance,i.imageUrlHW=null===(o=e[p])||void 0===o?void 0:o.image,void(i.categoryHW=null===(s=e[p])||void 0===s?void 0:s.category);case"MI":return i.channelIdMi=null===(a=e[p])||void 0===a?void 0:a.channelId,void(i.miLargeIconUrl=null===(u=e[p])||void 0===u?void 0:u.large_icon_uri);case"OPPO":return void(i.channelIdOPPO=null===(c=e[p])||void 0===c?void 0:c.channelId);case"VIVO":return i.typeVivo=null===(l=e[p])||void 0===l?void 0:l.classification,void(i.categoryVivo=null===(h=e[p])||void 0===h?void 0:h.category);case"APNS":return r.threadId=e[p]["thread-id"],r.apnsCollapseId=e[p]["apns-collapse-id"],r.category=e[p].category,void(r.richMediaUri=e[p].richMediaUri);case"FCM":i.googleConfig={collapseKey:e[p].collapse_key||"",imageUrl:e[p].imageUrl||"",priority:e[p].priority||""}}}}))}catch(n){e.error(exports.LogTagId.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:r,androidConfig:i}},_t=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Tt=function(e){var t=e.length;return t<=4096&&t>=1},Et=(st=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+st.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return st=2047&++st,parseInt(n,2)}),vt=function(){var e=Qe.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},yt=function(e,t,n){var r=null==n?void 0:n.isReverse;Ve(e)&&function(){for(var n in e)t(e[n],n,e)}(),(Pe(e)||we(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()},It=function(e,t){return yt(e,(function(n,r){e[r]=t(n,r)})),e},Ct=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return yt(e,(function(e,r){t===e&&(n=r)})),n},mt=function(e,t){var n=[];return yt(e,(function(e){n.push(e)})),-1!==Ct(n,t)},Rt=function(e){return JSON.parse(JSON.stringify(e))},St=function(){return"undefined"!=typeof RCCppEngine},Ot=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Mt=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(Mt(e[n]));else for(var n in t={},e)t[n]=Mt(e[n]);else t=e;return t},Lt=function(e){var t;try{t=Mt(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},Nt={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Nt._delayTime=t-e},getTime:function(){var e=Nt._delayTime;return(new Date).getTime()-e}},Ut=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},At=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return v(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(r=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,o===A.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}(),wt="rtcRJoin_data",bt="rtcRExit",Pt="rtcRInfo",xt="rtcUData",Dt="rtcUPut",Vt="rtcUDel",Gt="rtcSetData",Bt="userSetData",kt="rtcQryData",Ft="rtcDelData",Ht="rtcToken",Kt="rtcUserState",qt="rtcUList",Yt="viewerJoinR",jt="viewerExitR",Qt="rtcPullKv",Jt="rtcIdentityChange",Wt="rtcInvite",Xt="rtcCancelInvite",zt="rtcInviteAnswer",Zt="rtcEndInvite",$t="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"}(ut||(ut={}));var en=((at={})[ut.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],at[ut.RtcUserListOutput]=["users","token","sessionId","roomInfo"],at[ut.SetUserStatusInput]=["status"],at[ut.RtcSetDataInput]=["interior","target","key","value","objectName","content"],at[ut.RtcUserSetDataInput]=["valueInfo","objectName","content"],at[ut.RtcDataInput]=["interior","target","key","objectName","content"],at[ut.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],at[ut.MCFollowInput]=["state"],at[ut.RtcTokenOutput]=["rtcToken"],at[ut.RtcQryOutput]=["outInfo"],at[ut.RtcQryUserOutDataInput]=["userId"],at[ut.RtcUserOutDataOutput]=["user"],at[ut.RtcQueryListInput]=["order"],at[ut.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],at[ut.RtcValueInfo]=["key","value"],at[ut.RtcKeyDeleteInput]=["key"],at[ut.RtcNotifyMsg]=["type","time","roomId"],at[ut.RtcPullKV]=["timestamp","roomId"],at[ut.RtcKVOutput]=["entries","bFullUpdate","syncTime"],at[ut.RtcQueryUserJoinedInput]=["userId"],at[ut.RtcQueryUserJoinedOutput]=["info"],at[ut.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],at[ut.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],at[ut.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],at[ut.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],at),tn="\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(ut.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(ut.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(ut.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(ut.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(ut.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(ut.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(ut.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(ut.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(ut.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(ut.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(ut.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(ut.RtcQryOutput,"{\n repeated ").concat(ut.RtcValueInfo," outInfo=1;\n }\n message ").concat(ut.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(ut.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(ut.RtcUserSetDataInput," {\n repeated ").concat(ut.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(ut.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(ut.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(ut.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(ut.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(ut.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(ut.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(ut.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(ut.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(ut.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(ut.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(ut.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(ut.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(ut.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(ut.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(ut.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(ut.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"),nn=function(){function e(e,t,n,r,i,o){this.runtime=e,this.rtcCodec=t,this._watcher=n,this._options=r,this.logger=i,this.statisticLog=o,this._appkey=this._options.appkey,this._rtcKVManager=new At(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 v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode(ut.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,Qt,!0,t)];case 1:return n=u.sent(),r=n.code,i=n.buffer,r!==A.SUCCESS?[2,{code:r}]:(o=this.rtcCodec.decode(ut.RtcKVOutput,i),s=o.entries,a=o.syncTime,s=(s||[]).map((function(e){return E(E({},e),{timestamp:dt(e.timestamp)})})),this._watcher.onRTCDataChange(s,e),[2,{code:r,data:{kvEntries:s,syncTime:dt(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(ut.RtcNotifyMsg,e),n=t.time,r=t.type,i=t.roomId;1===r&&this._rtcKVManager.pullEntry(i,dt(n))}},e.prototype.destroy=function(){},e}();function rn(e){var t=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,o;return t?(o=(e>>>=0)>=0&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),o&&(u[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?f:g;if(t){if(e<0)return f;if(e>=h)return y}else{if(-d>=e)return I;if(e+1>=d)return v}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,u,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return o(e.substring(1),t,n).neg();for(s=r(c(n,8)),a=g,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=r(c(n,l)),a=a.mul(d).add(r(h))):a=(a=a.mul(s)).add(r(h));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}var a,u,c,l,h,d,p,g,f,_,T,E,v,y,I,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=r,e.fromBits=i,c=Math.pow,e.fromString=o,e.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),e.ZERO=g,f=n(0,!0),e.UZERO=f,_=n(1),e.ONE=_,T=n(1,!0),e.UONE=T,E=n(-1),e.NEG_ONE=E,v=i(-1,2147483647,!1),e.MAX_VALUE=v,y=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=y,I=i(0,-2147483648,!1),e.MIN_VALUE=I,(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,i,o,s,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(I)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(o=r(c(e,6),this.unsigned),s=this,a="";;){if(u=s.div(o),l=(s.sub(u.mul(o)).toInt()>>>0).toString(e),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},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(I)?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(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(_)},C.neg=C.negate,C.add=function(e){var n,r,o,a,u,c,l,h,d,p,g;return t(e)||(e=s(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&e.low))>>>16,d+=(p+=o+l)>>>16,h+=(d+=r+c)>>>16,h+=n+u,i((p&=65535)<<16|(g&=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,_,T,E;return this.isZero()?g:(t(e)||(e=s(e)),e.isZero()?g:this.eq(I)?e.isOdd()?I:g:e.eq(I)?this.isOdd()?I:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(p)&&e.lt(p)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,f=0,_=0,T=0,E=0,T+=(E+=u*(d=65535&e.low))>>>16,_+=(T+=a*d)>>>16,T&=65535,_+=(T+=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,i((T&=65535)<<16|(E&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},C.mul=C.multiply,C.divide=function(e){var n,i,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:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return T;o=f}else{if(this.eq(I))return e.eq(_)||e.eq(E)?I:e.eq(I)?_:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?_:E:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(I))return this.unsigned?f:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=r(n)).mul(e);h.isNegative()||h.gt(i);)h=(l=r(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=_),o=o.add(l),i=i.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 i(~this.low,~this.high,this.unsigned)},C.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return t(e)||(e=s(e)),i(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?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(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?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},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?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:i(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 r(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;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*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,g=r?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+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,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=g,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=255&s,p+=g,s/=256,c-=8);e[n+p-g]|=128*f}var o,s,a,u,c,l=function(e,t,n){if(void 0===e&&(e=l.DEFAULT_CAPACITY),void 0===t&&(t=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,o,s,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,s=0,a=e.length;a>s;++s)l.isByteBuffer(e[s])||(e[s]=l.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new l(0,n,r);for(c=new l(i,n,r),s=0;a>s;)(o=(u=e[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=o);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var i,s;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(0,n,r),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new l(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((i=new l(e.length,n,r)).limit=e.length,s=0;s<e.length;++s)i.view[s]=e[s]}return i},o.writeBitSet=function(e,t){var n,r,i,o,s,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(r=t,o=(i=e.length)>>3,s=0,t+=this.writeVarint32(i,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(i>s){for(a=0,n=0;i>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,i,o,s,a,u=void 0===e;for(u&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;i--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(r>o)for(a=0,t=this.readByte(e++);r>o;)s[o++]=!!(1&t>>a++);return u&&(this.offset=e),s},o.readBytes=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!1),o&&(this.offset+=8),i},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!0),o&&(this.offset+=8),i},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=r=l.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(0!=(128&t));return r|=0,o?(this.offset=e,r):{value:r,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var r,i,o,s,a,u=void 0===n;if(u&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=l.calculateVarint64(t),i=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return u?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,i,o,s,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,r=0,i=0,o=0,s=0,r=127&(s=this.view[t++]),128&s&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(i=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|o<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=c.calculateUTF16asUTF8(t(e))[1],n+=i+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):i},o.readCString=function(e){var t,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,i=-1,c.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),o?(this.offset=e,r()):{string:r(),length:e-t}},o.writeIString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+r,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r):(this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),n+=4,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return s?(this.offset=n,this):n-i},o.readIString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return i=n,r=c.calculateUTF16asUTF8(t(e))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-i},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(e,t,r){var i,o,s,a,u;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=r,t===l.METRICS_CHARS){if(o=n(),c.decodeUTF8(function(){return e>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++s,c.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(u=r+e,c.decodeUTF8toUTF16(function(){return u>r?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==u)throw RangeError("Illegal range: Truncated data, "+r+" == "+u);return i?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,i,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,r=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+r,n+=this.writeVarint32(r,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},o.append=function(e,t,n){var r,i,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new l(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,r,i;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0===(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).set(this.view.subarray(e,t)),this.buffer=r,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var i,o,s;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=r-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var r,i,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((o=i-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?s:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},u=function(){var e,t,n={},r=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[];for(e=0,t=r.length;t>e;++e)i[r[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(r[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(r[63&(i|3&n>>6)]),t(r[63&n])):(t(r[63&i]),t(61))):(t(r[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,o,s;null!==(r=e());)if(void 0===(o=i[r])&&n(r),null!==(r=e())&&(void 0===(s=i[r])&&n(r),t(o<<2>>>0|(48&s)>>4),null!==(r=e()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(s=i[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},o.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new l(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}i+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return e?s:i},l.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new l(0|(o+1)/3,t,n),a=0,u=0,c=!1,h=!1,d=!1,p=!1,g=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}s.offset=u,c=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=i,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(e,t,n){var r,i,o,s,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(i=e.length,o=new l(0|i/2,t),s=0,a=0;i>s;s+=2){if(r=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},c=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,r,i,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(r=e())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&s([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n);null!==r&&t(r)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,r=0;return e.UTF16toUTF8(t,(function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4})),[n,r]}};return e}(),o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{c.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(c.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return c.encodeUTF16toUTF8(t(e),(function(e){i.view[o++]=e})),i.limit=o,i},l}(t),r=function(t,n){var r,i,o={};return o.ByteBuffer=t,o.c=t,r=t,o.Long=n||null,o.VERSION="5.0.1",o.WIRE_TYPES={},o.WIRE_TYPES.VARINT=0,o.WIRE_TYPES.BITS64=1,o.WIRE_TYPES.LDELIM=2,o.WIRE_TYPES.STARTGROUP=3,o.WIRE_TYPES.ENDGROUP=4,o.WIRE_TYPES.BITS32=5,o.PACKABLE_WIRE_TYPES=[o.WIRE_TYPES.VARINT,o.WIRE_TYPES.BITS64,o.WIRE_TYPES.BITS32],o.TYPES={int32:{name:"int32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},uint64:{name:"uint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.UZERO:void 0},sint64:{name:"sint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},bool:{name:"bool",wireType:o.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:o.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:o.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.ZERO:void 0},float:{name:"float",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:o.WIRE_TYPES.STARTGROUP,defaultValue:null}},o.MAP_KEY_TYPES=[o.TYPES.int32,o.TYPES.sint32,o.TYPES.sfixed32,o.TYPES.uint32,o.TYPES.fixed32,o.TYPES.int64,o.TYPES.sint64,o.TYPES.sfixed64,o.TYPES.uint64,o.TYPES.fixed64,o.TYPES.bool,o.TYPES.string,o.TYPES.bytes],o.ID_MIN=1,o.ID_MAX=536870911,o.convertFieldsToCamelCase=!1,o.populateAccessors=!0,o.populateDefaults=!0,o.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),o.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},o.DotProto=function(e,t){function n(e,n){var r=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|i*r,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},c.next=function(){var e,n,r,i,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(o=this.source.substring(this.index,this.index=i))||"'"===o)&&(this._stringOpen=o),o},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,o=function(e){this.tn=new u(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var r,i=this.tn.next(),o=!1;if("("===i&&(o=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,o&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},s._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,r,i="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.response_stream=!0,o=this.tn.next()),r.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},s._parseMessage=function(e,r){var i=!!r,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(s.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,r,i){var o,s,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,r,i,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,i=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var r,i={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(i.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(i);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},s._parseExtensionRanges=function(){var t,n,i,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":i=e.ID_MIN;break;case"max":i=e.ID_MAX;break;default:i=r(t)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(e){function n(t,n){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}function i(t,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case e.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:i(s,n);break;case e.WIRE_TYPES.ENDGROUP:if(s===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+o)}return!0}var o,s,a,u,c,l,h,d,p,g,f,_,T,E,v,y,I={},C=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},m=C.prototype;return m.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},m.toString=function(e){return(e?this.className+" ":"")+this.fqn()},m.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},I.T=C,o=function(e,t,n,r,i){C.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(s=o.prototype=Object.create(C.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},s.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,o=0;if(""===r[o]){for(;null!==i.parent;)i=i.parent;o++}do{do{if(!(i instanceof I.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof I.T&&(!t||n instanceof I.Namespace))){i=null;break}i=n,o++}while(o<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},s.qn=function(e){var t,n,r=[],i=e;do{r.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof I.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof o&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var e,t,n,r,i={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],r=this.options[o[e]],i[n]=r;return i},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},I.Namespace=o,a=function(t,n,r,i){if(this.type=t,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},u=a.prototype,a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new r(0):t.defaultValue},u.verifyValue=function(r){var i,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r>4294967295?0|r:r;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r<0?r>>>0:r;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(r,!1)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(r,!0)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof r&&a(typeof r,"not a boolean"),r;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof r&&a(typeof r,"not a number"),r;case e.TYPES.string:return"string"==typeof r||r&&r instanceof String||a(typeof r,"not a string"),""+r;case e.TYPES.bytes:return t.isByteBuffer(r)?r:t.wrap(r);case e.TYPES.enum:for(i=this.resolvedType.getChildren(e.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==r)return i[s].id;if(i[s].id==r)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),(r>4294967295||r<0)&&a(typeof r,"not in range for uint32"),r;a(r,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(r&&"object"==typeof r||a(typeof r,"object expected"),r instanceof this.resolvedType.clazz)return r;if(r instanceof e.Builder.Message){for(s in o={},r)r.hasOwnProperty(s)&&(o[s]=r[s]);r=o}return new this.resolvedType.clazz(r)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+r+" (undefined type "+this.type+")")},u.calculateLength=function(t,n){if(null===n)return 0;var i;switch(this.type){case e.TYPES.int32:return n<0?r.calculateVarint64(n):r.calculateVarint32(n);case e.TYPES.uint32:return r.calculateVarint32(n);case e.TYPES.sint32:return r.calculateVarint32(r.zigZagEncode32(n));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return r.calculateVarint64(n);case e.TYPES.sint64:return r.calculateVarint64(r.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return r.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return i=r.calculateUTF8Bytes(n),r.calculateVarint32(i)+i;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return r.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return i=this.resolvedType.calculate(n),r.calculateVarint32(i)+i;case e.TYPES.group:return(i=this.resolvedType.calculate(n))+r.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},u.encodeValue=function(t,n,i){var o,s;if(null===n)return i;switch(this.type){case e.TYPES.int32:n<0?i.writeVarint64(n):i.writeVarint32(n);break;case e.TYPES.uint32:i.writeVarint32(n);break;case e.TYPES.sint32:i.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:i.writeUint32(n);break;case e.TYPES.sfixed32:i.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:i.writeVarint64(n);break;case e.TYPES.sint64:i.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:i.writeUint64(n);break;case e.TYPES.sfixed64:i.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?i.writeVarint32("false"===n.toLowerCase()?0:!!n):i.writeVarint32(n?1:0);break;case e.TYPES.enum:i.writeVarint32(n);break;case e.TYPES.float:i.writeFloat32(n);break;case e.TYPES.double:i.writeFloat64(n);break;case e.TYPES.string:i.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,i.writeVarint32(n.remaining()),i.append(n),n.offset=o;break;case e.TYPES.message:s=(new r).LE(),this.resolvedType.encode(n,s),i.writeVarint32(s.offset),i.append(s.flip());break;case e.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i},u.decode=function(t,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(o=t.readVarint32(),t.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+t.remaining());return(i=t.clone()).limit=i.offset+o,t.offset+=o,i;case e.TYPES.message:return o=t.readVarint32(),this.resolvedType.decode(t,o);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return r.fromBinary(t)}},u.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},I.Element=a,c=function(e,t,n,r,i,s){o.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=c.prototype=Object.create(o.prototype)).build=function(n){var i,o,s,a;if(this.clazz&&!n)return this.clazz;for(i=function(e,n){function i(t,n,o,s){var a,u,c,l,h,d,p;if(null===t||"object"!=typeof t)return s&&s instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(s.object,t))?a:t;if(r.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return o?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return u=[],t.forEach((function(e,t){u[t]=i(e,n,o,s)})),u;if(u={},t instanceof e.Map){for(l=(c=t.entries()).next();!l.done;l=c.next())u[t.keyElem.valueToString(l.value[0])]=i(l.value[1],n,o,t.valueElem.resolvedType);return u}for(p in h=t.$type,d=void 0,t)t.hasOwnProperty(p)&&(u[p]=h&&(d=h.getChild(p))?i(t[p],n,o,d.resolvedType):i(t[p],n,o));return u}var o,s,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var i,o,s,l;for(e.Builder.Message.call(this),i=0,o=u.length;o>i;++i)this[u[i].name]=null;for(i=0,o=a.length;o>i;++i)this[(s=a[i]).name]=s.repeated?[]:s.map?new e.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof c)||Array.isArray(t)||t instanceof e.Map||r.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(i=0,o=arguments.length;o>i;++i)void 0!==(l=arguments[i])&&this.$set(a[i].name,l);else this.$set(t)},l=c.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,r,i){var o=n._fieldsByName[t];if(!i){if(!o)throw Error(this+"#"+t+" is undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+t+" is not a repeated field");r=o.verifyValue(r,!0)}return null===this[t]&&(this[t]=[]),this[t].push(r),this},l.$add=l.add,l.set=function(t,r,i){var o,s,a;if(t&&"object"==typeof t){for(o in i=r,t)t.hasOwnProperty(o)&&void 0!==(r=t[o])&&this.$set(o,r,i);return this}if(s=n._fieldsByName[t],i)this[t]=r;else{if(!s)throw Error(this+"#"+t+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));this[s.name]=r=s.verifyValue(r)}return s&&s.oneof&&(a=this[s.oneof.name],null!==r?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===t&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(t,r){if(r)return this[t];var i=n._fieldsByName[t];if(!(i&&i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+i.toString(!0));return this[i.name]},l.$get=l.get,o=0;o<a.length;o++)(s=a[o])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,r,i,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),r=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===n.getChild("set"+o)&&(l["set"+o]=r),null===n.getChild("set_"+t)&&(l["set_"+t]=r),null===n.getChild("get"+o)&&(l["get"+o]=i),null===n.getChild("get_"+t)&&(l["get_"+t]=i)}(s);return l.encode=function(e,r){var i,o;"boolean"==typeof e&&(r=e,e=void 0),i=!1,e||(e=new t,i=!0),o=e.littleEndian;try{return n.encode(this,e.LE(),r),(i?e.flip():e).LE(o)}catch(t){throw e.LE(o),t}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,i=!1;return e||(e=new r,i=!0),t=(new r).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.decode=function(e,t){var i,o;"string"==typeof e&&(e=r.wrap(e,t||"base64")),i=(e=r.isByteBuffer(e)?e:r.wrap(e)).littleEndian;try{return o=n.decode(e.LE()),e.LE(i),o}catch(t){throw e.LE(i),t}},c.decodeDelimited=function(e,t){var i,o,s;if("string"==typeof e&&(e=r.wrap(e,t||"base64")),(e=r.isByteBuffer(e)?e:r.wrap(e)).remaining()<1)return null;if(i=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=n.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),c}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof f||o instanceof c||o instanceof E){if(i.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");i[o.name]=o.build()}else if(o instanceof c.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof c.OneOf||o instanceof T))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,o,s,a,u=null;for(o=0,s=this._fields.length;s>o;++o)i=e[(r=this._fields[o]).name],r.required&&null===i?null===u&&(u=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,r=0,i=0,o=this._fields.length;o>i;++i){if(n=e[(t=this._fields[i]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},l.decode=function(t,n,r){var o,s,a,u,c,l,h,d,p,g,f,_;for(n="number"==typeof n?n:-1,c=t.offset,l=new this.clazz;t.offset<c+n||-1===n&&t.remaining()>0;){if(a=(o=t.readVarint32())>>>3,(s=7&o)===e.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(s,t)):u.map?(d=u.decode(s,t),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(s,t),u.oneof&&(null!==(p=l[u.oneof.name])&&p!==u.name&&(l[p]=null),l[u.oneof.name]=u.name));else switch(s){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:h=t.readVarint32(),t.offset+=h;break;case e.WIRE_TYPES.STARTGROUP:for(;i(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(g=0,f=this._fields.length;f>g;++g)if(null===l[(u=this._fields[g]).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},I.Message=c,h=function(t,n,r,i,o,s,a,u,l,h){C.call(this,t,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=a,this.options=u||{},this.defaultValue=null,this.oneof=l||null,this.syntax=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 r,i,o;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),o=[],i=0;i<t.length;i++)o.push(this.element.verifyValue(t[i]));return o}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},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,i){var o,s,a,u,c;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],n);a=n.offset-s,(u=r.calculateVarint32(a))>1&&(c=n.slice(s,n.offset),s+=u-1,n.offset=s,n.append(c)),n.writeVarint32(a,s-u)}else for(o=0;o<t.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[o],n);else this.map?t.forEach((function(t,i){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(o),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,i)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},d.calculate=function(t,n){var i,o,s;if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s=0,o=0;o<t.length;o++)s+=this.element.calculateLength(this.id,t[o]);i+=r.calculateVarint32(s),i+=s}else for(o=0;o<t.length;o++)i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t[o]);else this.map?t.forEach((function(t,n){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i+=r.calculateVarint32(o),i+=o}),this):this.hasWirePresence(t,n)&&(i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return i},d.decode=function(t,n,r){var i,o,s,u,c,l,h;if(!(!this.map&&t==this.type.wireType||!r&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(u=a.defaultFieldValue(this.keyType),i=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+o,n.offset+=o;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,t,h)}return[u,i]}return this.element.decode(n,t,this.id)},I.Message.Field=h,p=function(e,t,n,r,i,o,s){h.call(this,e,t,n,null,r,i,o,s),this.extension},p.prototype=Object.create(h.prototype),I.Message.ExtensionField=p,g=function(e,t,n){C.call(this,e,t,n),this.fields=[]},I.Message.OneOf=g,f=function(e,t,n,r,i){o.call(this,e,t,n,r,i),this.className="Enum",this.object=null},f.getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(t){var n,r,i,o;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,i=0,o=(r=this.getChildren(f.Value)).length;o>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},I.Enum=f,_=function(e,t,n,r){C.call(this,e,t,n),this.className="Enum.Value",this.id=r},_.prototype=Object.create(C.prototype),I.Enum.Value=_,T=function(e,t,n,r){C.call(this,e,t,n),this.field=r},T.prototype=Object.create(C.prototype),I.Extension=T,E=function(e,t,n,r){o.call(this,e,t,n,r),this.className="Service",this.clazz=null},(E.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,i=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=i.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(e){o[e.name]=function(n,i){try{try{n=e.resolvedRequestType.clazz.decode(r.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void i(null,r):void i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:i[e.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),i}(e,this)},I.Service=E,v=function(e,t,n,r){C.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(v.prototype=Object.create(C.prototype)).buildOpt=s.buildOpt,I.Service.Method=v,y=function(e,t,n,r,i,o,s,a){v.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},y.prototype=Object.create(v.prototype),I.Service.RPCMethod=y,I}(o),o.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var r,o,s,a,u;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),i.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),u=[],o.enums&&o.enums.forEach((function(e){u.push(e)})),o.messages&&o.messages.forEach((function(e){u.push(e)})),o.services&&o.services.forEach((function(e){u.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),u.length>0){r.push(t),t=u,u=null,this.ptr=s,s=null;continue}u=null}else if(i.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(i.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,i,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i,o,s,a,u,c,l,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(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=i+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&&r(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 r;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(r=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,r;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(o,o.Lang,o.Reflect),o.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,i,o,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(r=Object.keys(n),i=0;i<r.length;i++)o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,o.Reflect),o.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),o.loadJson(o.DotProto.Parser.parse(e),t,n)},o.protoFromString=o.loadProto,o.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadProto(r,n,e)},o.protoFromFile=o.loadProtoFile,o.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=o.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=o.populateAccessors),new o.Builder(e)},o.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=o.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},o.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadJson(JSON.parse(r),n,e)},i=e,o.loadProto(i,void 0,"").build("Modules").probuf}(n,t);return r}var on,sn,an=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=rn(t)}return e.prototype.getModule=function(e){return new this.pbModules[e]},e.prototype.encode=function(e,t,n){var r=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((function(e){var n=t[e];void 0!==n&&r["set".concat(function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e.replace(r,(function(e){return e.toUpperCase()}))}(e,0,1))](n)}))}catch(t){var i="pbname: ".concat(e,", stack: ").concat(t.stack);this.logger?this.logger.error(exports.LogTagId.L_PB_ENCODE_E,i):null===console||void 0===console||console.error(exports.LogTagId.L_PB_ENCODE_E,i)}return n?r:r.toArrayBuffer()},e.prototype.decode=function(e,t){var n=this.pbModules[e].decode(t);return this.fixInt64Values(n)},e.prototype.fixInt64Values=function(e){var t=this;if(e instanceof Array)return e.map((function(e){return t.fixInt64Values(e)}));if(!Ve(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){var n=e.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var r in e)e[r]=this.fixInt64Values(e[r]);return e},e}();exports.AreaCode=void 0,(sn=exports.AreaCode||(exports.AreaCode={}))[sn.BJ=1]="BJ",sn[sn.SG=2]="SG",sn[sn.NA=3]="NA";var un=((on={})[exports.AreaCode.BJ]={naviUrlBase64:["bmF2LmNuLnJvbmdodWIuY29t","bmF2Mi1jbi5yb25naHViLmNvbQ=="],logUrlBase64:["bG9nY29sbGVjdGlvbi5yb25naHViLmNvbQ=="],miniCmpBase64:["d3Nwcm94eS5jbi5yb25naHViLmNvbQ==","d3NhcC1jbi5yb25naHViLmNvbQ=="]},on[exports.AreaCode.SG]={naviUrlBase64:["bmF2c2cwMS1nbGIucm9uZ2h1Yi5jb20="],logUrlBase64:["bG9nY29sbGVjdGlvbi5yb25naHViLmNvbQ=="],miniCmpBase64:["d3Mtc2cucm9uZ2h1Yi5jb20="]},on[exports.AreaCode.NA]={naviUrlBase64:["bmF2LXVzLnJvbmdodWIuY29t"],logUrlBase64:["bG9nY29sbGVjdGlvbi5yb25naHViLmNvbQ=="],miniCmpBase64:["d3MtdXMucm9uZ2h1Yi5jb20="]},on);function cn(e){return e>=exports.AreaCode.BJ&&e<=3?e:exports.AreaCode.BJ}var ln="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function hn(e){var t,n,r,i,o,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=ln.indexOf(e.charAt(u++))<<2|(i=ln.indexOf(e.charAt(u++)))>>4,n=(15&i)<<4|(o=ln.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(s=ln.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(r));return a}function dn(e){return/^https?:/.test(e)?e:"https://".concat(e)}var pn,gn,fn,_n,Tn,En,vn,yn=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e){var t,n=this.initOption||{},r=n.areaCode,i=n.navigators,o=(t=r,void 0===t&&(t=exports.AreaCode.BJ),un[cn(t)].naviUrlBase64).map((function(e){return hn(e)})),s=e.split("@")[1],a=s?s.split(";"):[],u=i&&i.length>0?I(I([],a,!0),i,!0):I(I([],a,!0),o,!0);return u.filter((function(e,t){return u.indexOf(e)===t})).map((function(e){return dn(e)}))},e.prototype.getLogUrlPolicyList=function(e){var t,n=this.initOption||{},r=n.areaCode,i=n.logServerUrl,o=(t=r,void 0===t&&(t=exports.AreaCode.BJ),un[cn(t)].logUrlBase64).map((function(e){return hn(e)})),s=e?[e]:[],a=i?I([i],s,!0):I(I([],s,!0),o,!0);return a.filter((function(e,t){return a.indexOf(e)===t})).map((function(e){return dn(e)}))},e.prototype.getMiniCmpUrlList=function(){var e,t,n=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=exports.AreaCode.BJ),un[cn(t)].miniCmpBase64).map((function(e){return hn(e)})),r=(this.initOption||{}).miniCMPProxy;return r&&r.length>0?r:n},e}(),In=new yn,Cn=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 v(this,void 0,void 0,(function(){return y(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.7.10"},e.prototype.getAPIVersion=function(){return"5.7.10"},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._context.registerMessageType(e,t,n,r)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getOSInfo=function(){return this._context.getOSInfo()},e.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._context.setCallInfo(e,t,n)},e.prototype.createLogger=function(e,t){return this._context.createLogger(e,t)},e}(),mn="pgMsgP",Rn="chatMsg",Sn="pcMsgP",On={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Mn="delMsg",Ln="joinChrm",Nn="joinChrmR",Un="exitChrm",An="setKV",wn="delKV",bn="setKVS",Pn="delKVS",xn="qryRelationR",Dn="delRelation",Vn="setSeAtt",Gn={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Bn="reqCall",kn="qryPMsg",Fn="qryGMsg",Hn="qryCHMsg",Kn="qryCMsg",qn="qrySMsg",Yn=((pn={})["ppMsgP"]=b.PRIVATE,pn[mn]=b.GROUP,pn[Rn]=b.CHATROOM,pn[Sn]=b.CUSTOMER_SERVICE,pn),jn=((gn={})[b.PRIVATE]=kn,gn[b.GROUP]=Fn,gn[b.CHATROOM]=Hn,gn[b.CUSTOMER_SERVICE]=Kn,gn[b.SYSTEM]=qn,gn),Qn=((fn={})[b.PRIVATE]=Gn.PRIVATE,fn[b.GROUP]=Gn.GROUP,fn[b.ULTRA_GROUP]=Gn.ULTRA_GROUP,fn[b.CUSTOMER_SERVICE]=Gn.CUSTOMER_SERVICE,fn[b.SYSTEM]=Gn.SYSTEM,fn),Jn="1",Wn="0",Xn=1,zn=2,Zn=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"}(_n||(_n={})),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"}(Tn||(Tn={})),function(e){e.PUB="pub",e.QUERY="qry"}(En||(En={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(vn||(vn={}));var $n,er=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=_n.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=_n.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=r)}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),r=n.back,i=n.byteSize,o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return t?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},e._getBackAndByteSize=function(e){var t=[],n=0;if(we(e))for(var r=0,i=e.length;r<i;r++){var o=e.charCodeAt(r);o>=0&&o<=127?(n+=1,t.push(o)):o>=128&&o<=2047?(n+=2,t.push(192|31&o>>6),t.push(128|63&o)):o>=2048&&o<=65535&&(n+=3,t.push(224|15&o>>12),t.push(128|63&o>>6),t.push(128|63&o))}return{byteSize:n,back:t}},e.readUTF=function(e){for(var t,n,r=[],i=-1,o=e,s="";++i<o.length;){var a=Number(o[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++i])<<6|128^o[++i]:192==(192&a)&&(a=(a^=192)<<6|128^o[++i])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===o.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},e}(),nr=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;var n=this._pool.subarray(t,this._position);return tr.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),rr=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}(),ir=function(e,t){return e&&t?"".concat(t,"_").concat(e):e||Date.now()},or=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 ir(e,t)},e.prototype.read=function(e,t,n,r){this.readMessage(e,t,n,r)},e.prototype.readMessage=function(e,t,n,r){return{stream:t,length:n}},e}(),sr=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new er(e,!1,_n.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return ir(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 rr;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),ar=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 T(t,e),t.prototype.readMessage=function(e,n,r,i){if(n.readByte(),this.status=+n.readByte(),r<=t.MESSAGE_LENGTH)return{stream:n,length:r};if(i===vn.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(exports.LogTagId.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:r}},t.MESSAGE_LENGTH=2,t}(or),ur=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return T(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}(or),cr=function(e){function t(){return e.call(this,Tn.PING_REQ)||this}return T(t,e),t.prototype.writeMessage=function(e){},t}(sr),lr=function(e){function t(t){return e.call(this,t)||this}return T(t,e),t}(or),hr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return T(t,e),t.prototype.readMessage=function(e,t,n){var r=256*t.readByte()+t.readByte();return this.messageId=parseInt(r.toString(),10),{stream:t,length:n}},t}(or),dr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)},t}(sr),pr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=En.PUB,t}return T(t,e),t.prototype.readMessage=function(t,n,r){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),e.prototype.readMessage.call(this,t,n,r),this.data=n.readAll(),{stream:n,length:r}},t}(hr),gr=function(e){function t(t,n,r){var i=e.call(this,Tn.PUBLISH)||this;return i.syncMsg=!1,i.identifier=En.PUB,i.topic=t,i.data=we(n)?tr.writeUTF(n):n,i.targetId=r,i}return T(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}(dr),fr=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=En.PUB,t.topic="",t.targetId="",t}return T(t,e),t.prototype.readMessage=function(t,n,r){return e.prototype.readMessage.call(this,t,n,r),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:r}},t}(hr),_r=function(e){function t(t){var n=e.call(this,Tn.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return T(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(dr),Tr=function(e){function t(t,n,r){var i=e.call(this,Tn.QUERY)||this;return i.identifier=En.QUERY,i.topic=t,i.data=we(n)?tr.writeUTF(n):n,i.targetId=r,i}return T(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}(dr),Er=function(e){function t(t){var n=e.call(this,Tn.QUERY_CONFIRM)||this;return n.messageId=t,n}return T(t,e),t}(dr),vr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=En.QUERY,t.topic="",t.targetId="",t}return T(t,e),t.prototype.readMessage=function(t,n,r){return e.prototype.readMessage.call(this,t,n,r),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:r}},t}(hr),yr=function(e,t,n){var r=new Uint8Array(t),i=new nr(r),o=i.readByte(),s=function(e,t){var n,r=e.type;switch(r){case Tn.CONN_ACK:n=new ar(e);break;case Tn.PUBLISH:(n=new pr(e)).syncMsg=e.syncMsg;break;case Tn.PUB_ACK:n=new fr(e);break;case Tn.QUERY_ACK:n=new vr(e);break;case Tn.SUB_ACK:case Tn.UNSUB_ACK:case Tn.PING_RESP:n=new lr(e);break;case Tn.DISCONNECT:n=new ur(e);break;default:n=new or(e),t.error(exports.LogTagId.O,"No support for deserializing ".concat(r," messages"))}return n}(new er(o),e);return s.read(e,i,r.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"}($n||($n={}));var Ir=$n,Cr="outbox",mr="inbox",Rr="broadcastbox",Sr=function(e,t,n){return[e,t,n].join("_")},Or=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 r=Sr(mr,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=Sr(mr,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||Be(e))){n.broadcastSyncTime=e;var r=Sr(Rr,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=Sr(Rr,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 r=Sr(Cr,this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=Sr(Cr,this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),Mr={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Lr=function(){function e(e,t,n){this.logger=e,this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=r===z.DELETE,u=s===o,c=!this._isExisted(n),l=a?this._remove:this._add;(t||i||u||c)&&l.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,r=e.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,r)}))},e.prototype.clear=function(){this._kvCaches={}},e}(),Nr=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return v(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(r=Mr.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,this._isPulling=!1,o===A.SUCCESS?(Mr.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Mr.clear(e);var t=this._storeCaches[e];null==t||t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var r=this._storeCaches[e];Fe(r)||(r=new Lr(this._engine.getInnerLogger(),e,n)),r.setEntries(t),this._storeCaches[e]=r},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getVersion=function(e,t){var n=this._storeCaches[e];return n?n.getVersion(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),Ur=function(){function e(e,t,n,r,i){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=r,this.logger=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){this.logger.error(exports.LogTagId.O,"parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],Fe(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",wr=function(){function e(e,t,n){this._eventEmitter=new Ye,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n),this._oldStorage=d(e.runtime),this._storage=new f(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(exports.LogTagId.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},e.prototype._set=function(e){var t=this;if(!Be(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(Ar,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return v(this,void 0,void 0,(function(){var e,t,n,r;return y(this,(function(i){switch(i.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=i.sent(),n=t.code,r=t.data,n===A.SUCCESS?(this._isPulling=!1,this._set(r),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}(),br={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}},Pr={};for(var xr in br){var Dr=br[xr].keyName;Pr[Dr]=xr}var Vr,Gr=function(){function e(e,t,n,r){this._appkey=t,this._currentUserId=n,this.logger=r;var i="con-".concat(t,"-").concat(n);this.storage=new f(e,i),this._localStore=new f(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(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:b.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var r=this,i=e.conversationType,o=e.messageType,s=e.isMentioned,a=e.senderUserId;s&&i===b.GROUP&&((n.userIdList||[]).forEach((function(e){e===r._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===K.ALL&&t.indexOf(a)<0&&t.push(a));if(o===V.RECALL&&i===b.GROUP){var u=t.indexOf(a);u>=0&&t.splice(u,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,r=e.content,i=e.channelId,o=r.mentionedInfo;if(o){var s=this._getStoreKey(t,n,i),a=this._localStore.get(s)||{},u=Pr.mentionedInfo,c=Pr.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]),Fe(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,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=Pr[s],u=n[s];if(!Be(a)&&!Be(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===br[a].defaultVal||"tags"===s&&!Fe(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,Fe(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in br){var a=br[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Rt(c)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),o={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},s=t[r];for(var a in s)if(br[a]){var u=br[a],c=u.keyName,l=u.defaultVal;o[c]=s[a]||Rt(l)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,o=r.targetId,s={},a=e[n];for(var u in a){var c=br[u],l=c.keyName,h=c.defaultVal;s[l]=a[u]||Rt(h)}for(var d in s.tags){Be(t[d])&&(t[d]=[]);var p=E(E({},s),{conversationType:i,targetId:o});delete p.tags,t[d].push(p)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}this.storage.clear()}catch(e){this.logger.error(exports.LogTagId.O,"adaptOldStore error: ".concat(e.message))}},e.prototype.remove=function(e,t,n){var r=this._getStoreKey(e,t,n);this._localStore.remove(r)},e}(),Br=[b.PRIVATE,b.GROUP,b.SYSTEM,b.PUBLIC_SERVICE,b.APP_PUBLIC_SERVICE],kr={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},Fr=1e3,Hr=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Ye,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new Gr(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new wr(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(kr.CHANGED,(function(e){r(e)})),this._eventEmitter.on(kr.CON_TAG_STATUS_CHANGED,(function(){i()}));var s=this._store.getValue();s.length>Fr&&(s=s.sort((function(e,t){var n=e.lastMessageSentTime,r=void 0===n?0:n,i=t.lastMessageSentTime;return(void 0===i?0:i)-r})),s.splice(Fr,s.length).forEach((function(e){o._store.remove(e.conversationType,e.targetId,e.channelId)})))}return e.prototype._calcMsg=function(e,t,n,r){var i=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===r.sentTime})),o=t>=r.sentTime;return n&&(o=n<r.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:i}},e.prototype._calcUnreadCount=function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,u=s===N.SEND&&a===this._loginUserId,c=r===V.RECALL,l=Ve(n),h=!1,d={},p=t.lastUnreadTime,g=t.lastReadTime,f=t.unreadMessageCount;if(p>i||u)return{hasChanged:h,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=f+1,t.lastUnreadTime=i,h=!0),c&&l){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),T=this._calcMsg(_,p,g,n),E=T.isNotRead,v=T.isNotRepeadRecallSendTime;E&&f&&v&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:h,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=e.messageDirection,i=e.isMentioned,o=e.sentTime,s=r===N.SEND,a=Ve(n),u=!1,c={};return!s&&i&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:o},c.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===N.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===K.ALL||(a||[]).includes(this._loginUserId)){i=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}if((a||[]).includes(this._loginUserId)){i=!0;u=t.unreadMentionedMeCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:i,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(Ve(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),o=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,r){var i=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var o in i)if(!n[o]||!!i[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,o=e.notificationStatus,s=e.notificationLevel,a=e.isTop,u=e.tags,c=e.channelId,l={},h={};if(n!==b.ULTRA_GROUP){Be(o)||(h.notificationStatus={time:i,val:o}),Be(s)||(h.notificationLevel={time:i,val:s}),Be(a)||(h.isTop={time:i,val:a}),Be(u)||(h.tags={time:i,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,l,c);var d=this._store.get(n,r,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,r,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},c),this._setUpdatedConversation({conversationType:n,targetId:r,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(kr.CHANGED,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(kr.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId,a=e.sentTime;if(Br.indexOf(r)>=0){var u=!1,c=this._store.get(r,o,s),l={};if(c.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,c),i=r.hasChanged,o=r.localConversation,s=r.updateItems;u=u||i,l=E(E({},l),s),c=Rt(o)})),this._store.set(r,o,c,s),this._store.updateMentionedData(e),i){var h=this._store.get(r,o,s);h.updatedItems=E({latestMessage:{time:e.sentTime,val:e}},l),h.latestMessage=e;var d=Object.assign(h,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(d)}(u||i)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;r=r||0,(n||void 0!==s&&s<=0||void 0===s&&o!==B.OPEN)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),i},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(r){var o=r.unreadMessageCount,s=r.notificationLevel,a=void 0===s?0:s,u=r.conversationType,c=r.unreadMentionedCount;e.includes(u)&&(0===t.length||t.includes(a))&&(i+=(n?c:o)||0)})),i},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,i=e.notificationStatus,o=e.notificationLevel;(t||1!==i||-1===o||0===o)&&(n=n||0,r+=Number(n))})),r},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,r){void 0===r&&(r=!0);var i=this._store.get(e,t,n);i.lastReadTime=i.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=i.unreadMessageCount,s=i.hasMentioned,a={};if(o&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(a).length){var u=Object.assign(i,{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,r){var i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=n},e.prototype.getDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]},e.prototype.clearDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]},e.prototype.addTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r),o=i.tags;o=Object.assign(o,n);var s=i.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:o,lastMessageSentTime:s},r)},e.prototype.deleteTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;n.forEach((function(e){delete i[e]})),this._store.set(e,t,{tags:i},r)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===B.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)&&(Be(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}(),Kr=function(){function e(e,t,n,r){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(t,"-").concat(n),this._storagePullTimeKey="us-s-".concat(t,"-").concat(n),this._storage=d(e.runtime),this._engine=e,this._tagWatcherFunc=r}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,r=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:r}})),this._storage.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 v(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return y(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,r=t.data,n!==A.SUCCESS||Be(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,Be(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}();!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"}(Vr||(Vr={}));var qr,Yr=function(e){return e.replace(/@.+$/,"@")},jr=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,r,i){return v(this,void 0,void 0,(function(){var o,s,a;return y(this,(function(u){switch(u.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,r,i),[4,this.crtRequest]);case 1:return o=u.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},e.prototype.sendRequest=function(e,t,n,i,o){return v(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,p,g,f;return y(this,(function(_){switch(_.label){case 0:return s=Yr(e),!t&&(a=this.getNaviCache(s))&&(u=a.timestamp,c=a.naviInfo,n||Date.now()-u<r)?(this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),i),l={bid:vt(),ptc:exports.ProtocalType.NAVI,cod:A.SUCCESS,net:null==o?void 0:o.type,dur:0,spr:0,pr:c.type||0,hos:"",cache:exports.NaviCacheType.LOCAL,v:exports.StatisticsVersion.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(exports.StatisticsTag.IM_NAVI,JSON.stringify(l),i),[2,{code:A.SUCCESS,data:c}]):(h=In.getNaviUrlList(e),this.logger.info(exports.LogTagId.L_GET_NAVI_T,JSON.stringify({token:e,uris:h}),i),[4,this.requestHandler(h,e,i,o)]);case 1:return d=_.sent(),p=d.code,g=d.data,p!==A.SUCCESS?(this.logger.warn(exports.LogTagId.L_GET_NAVI_R,p,i),[2,{code:p}]):(f=g,this.logger.info(exports.LogTagId.L_GET_NAVI_R,JSON.stringify({naviInfo:f}),i),this.setNaviCache(s,f),[2,{code:p,data:f}])}}))}))},e.prototype.requestHandler=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d;return y(this,(function(p){switch(p.label){case 0:i=0,o=e.length,p.label=1;case 1:return i<o?(s=i===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,e[i],this.appkey,t,n,s)]):[3,4];case 2:if(c=p.sent(),l=c.code,h=c.data,d={bid:vt(),ptc:exports.ProtocalType.NAVI,cod:l,net:null==r?void 0:r.type,dur:Date.now()-u,spr:0,pr:(null==h?void 0:h.type)||0,hos:e[i],cache:exports.NaviCacheType.REQUEST,v:exports.StatisticsVersion.CURRENT,rsn:null==r?void 0:r.reason,cid:"".concat(null==r?void 0:r.uuid,"_").concat(null==r?void 0:r.retryCount),count:null==r?void 0:r.retryCount},this.statisticLog.__statistics(exports.StatisticsTag.IM_NAVI,JSON.stringify(d),n),l===A.SUCCESS)return[2,{code:l,data:h}];p.label=3;case 3:return i+=1,[3,1];case 4:return[2,{code:A.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return A.RC_CONN_TOKEN_INCORRECT;case 416:return A.RC_LICENSE_EXPIRED;default:return A.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(Yr(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(Yr(e),E(E({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,r=e.token,o=e.isTcp,s=e.platform;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var a,u="token=".concat(encodeURIComponent(r),"&version=").concat("5.7.10","&platfrom=").concat(s);return a=o?"".concat(Vr.RMTP,",").concat(Vr.TLS):/^https/.test(n)?Vr.WSS:Vr.WS,{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(a,";rtc=4;log=2")},body:u,url:t,timeout:i}},e.prototype.useV2Navi=function(){return!0},e}(),Qr=function(e){return["navi",e].join("_")},Jr={},Wr=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r)||this;return o.runtime=i,o}return T(t,e),t.prototype.httpRequest=function(e,t,n,r,o){return v(this,void 0,void 0,(function(){var s,a,u,c;return y(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(h,"&r=").concat(Date.now()),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(s),r),[4,this.runtime.httpReq({url:s,timeout:i,dataType:"text"})];case 1:if(200!==(a=l.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(a.status),r),!this.runtime.useNavi&&o?(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:In.getMiniCmpUrlList().join(",")},[2,{code:A.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=In.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,{code:A.SUCCESS,data:c}]}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,a.data,r)}return[2,{code:A.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.httpRequestV2=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return i=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:this.runtime.tag}),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(i.url),r),[4,this.runtime.httpReq(i)];case 1:if(200!==(o=c.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(o.status),r),[2,{code:this.transHttpCode(o.status)}];try{return s=o.data,(a="object"!=typeof s?JSON.parse(s):s).protocol=/^https/.test(i.url)?"https":"http",this.runtime.useNavi||(a.logSwitch=0,u=In.getMiniCmpUrlList(),a.serverAddr=u.map((function(e,t){return{addr:e,protocol:/^https/.test(i.url)?Vr.WSS:Vr.WS,weight:u.length-t}}))),[2,{code:A.SUCCESS,data:a}]}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,o.data,r)}return[2,{code:A.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){if(Jr[e])return Jr[e];var t,n=Qr(this.appkey),r=this.runtime.localStorage;try{var i=r.getItem(n);t=i?JSON.parse(i):[]}catch(e){t=[]}if(0===t.length)return null;var o=t.find((function(t){return t.token===e}))||null;return Jr[e]=o,o},t.prototype.setNaviCache=function(e,t){var n,i=Qr(this.appkey),o=this.runtime.localStorage;try{var s=o.getItem(i);n=s?JSON.parse(s):[]}catch(e){n=[]}var a=Date.now();n.length>0&&(n=n.filter((function(t){return a-t.timestamp<r&&e!==t.token})));var u={timestamp:a,naviInfo:t,token:e};n.push(u),o.setItem(i,JSON.stringify(n)),Jr[e]=u},t}(jr),Xr=function(e,t){return["send_msg",e,t].join("_")},zr=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=Xr(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=Xr(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=Xr(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}(),Zr=function(e){var t="RCDeviceId",n=d(e),r="",i=n.get(t);return i?r=i:(r=ot(),n.set(t,r)),r};(qr={})[b.PRIVATE]=Ir.qryPMsg,qr[b.GROUP]=Ir.qryGMsg,qr[b.CHATROOM]=Ir.qryCHMsg,qr[b.CUSTOMER_SERVICE]=Ir.qryCMsg,qr[b.SYSTEM]=Ir.qrySMsg;var $r=[Ir[Ir.recallMsg],Ir[Ir.ppMsgS],Ir[Ir.pgMsgS],Ir[Ir.ppMsgP],Ir[Ir.pgMsgP],Ir[Ir.chatMsg],Ir[Ir.pcMsgP],Ir[Ir.prMsgS],Ir[Ir.updUgRTime]],ei=function(){function e(e,t,n){this.ULTRA_GROUP_CONVERSATION="ultragroupconversation";var r="".concat(this.ULTRA_GROUP_CONVERSATION,"-").concat(t,"-").concat(n);this._localStore=new f(e,r)}return e.prototype.set=function(e,t,n,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=ni[s],u=n[s];if(!Be(a)&&!Be(u))u===ti[a].defaultVal?delete o[a]:o[a]=u}Fe(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in ti){var a=ti[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Rt(c)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),ti={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},ni={};for(var ri in ti){var ii=ti[ri].keyName;ni[ii]=ri}var oi,si=function(){function e(e,t,n){this._store=new ei(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.notificationLevel,o=e.channelId;t===b.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:r,notificationLevel:i},o)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),ai="UpStreamMessage",ui="PushExtra",ci="DownStreamMessage",li="DownStreamMessages",hi="SessionsAttQryInput",di="SessionsAttOutput",pi="SyncRequestMsg",gi="ChrmPullMsg",fi="NotifyMsg",_i="HistoryMsgInput",Ti="HistoryMsgOuput",Ei="RelationQryInput",vi="RelationsOutput",yi="UnreadMsgInfo",Ii="DeleteSessionsInput",Ci="SessionInfo",mi="DeleteSessionsOutput",Ri="RelationsInput",Si="DeleteMsgInput",Oi="CleanHisMsgInput",Mi="SessionMsgReadInput",Li="ChrmInput",Ni="ChrmOutput",Ui="QueryChatRoomInfoInput",Ai="QueryChatRoomInfoOutput",wi="GetQNupTokenInput",bi="GetQNupTokenOutput",Pi="GetQNdownloadUrlInput",xi="GetDownloadUrlInput",Di="GetQNdownloadUrlOutput",Vi="GetDownloadUrlOutput",Gi="ChrmKVEntity",Bi="SetChrmKV",ki="SetChrmKVS",Fi="DeleteChrmKVS",Hi="ChrmKVOutput",Ki="ChrmKVSOutput",qi="ChrmKVSVersionEntity",Yi="ChrmKVSOutputEntity",ji="QueryChrmKV",Qi="SetUserSettingInput",Ji="SetUserSettingOutput",Wi="PullUserSettingInput",Xi="PullUserSettingOutput",zi="UserSettingNotification",Zi="SessionReq",$i="SessionStates",eo="SessionState",to="SessionStateItem",no="SessionStateModifyReq",ro="SessionStateModifyResp",io="GroupUnpushQuery",oo="GroupUnpushSet",so="QryRemindListReq",ao="QryRemindListResp",uo="GroupUnpushResult",co="GrpReadReceiptMsg",lo="GrpReadReceiptQryReq",ho="GrpReadReceiptQryResp",po="GrpMsgReadUser",go="SessionTagAddInput",fo="SessionTagItem",_o="SessionTagDelInput",To="SessionDisTagReq",Eo="ReportSDKInput",vo="ReportSDKOutput",yo="UltraGrpPullSes",Io="UltraGrpPullMsg",Co="MsgChangeReq",mo="QueryMsgChange",Ro="MsgChange",So="MsgChangeList",Oo="MsgQuery",Mo="MessageQueryInfo",Lo="MsgQueryAck",No="OperateStatus",Uo="OperateStatusNotify",Ao="OperateInfo",wo="OperateSummary",bo="SetRtcRoomIdInput",Po="SetRtcRoomIdOutput",xo="CallInfoUpStream",Do="CallInfoDownStream",Vo="KvInput",Go="KvOutput";(oi={})[ai]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],oi[li]=["list","syncTime","finished","broadcastSyncTime"],oi[ci]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],oi[ui]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],oi[hi]=["nothing"],oi[di]=["inboxTime","sendboxTime","totalUnreadCount"],oi[pi]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],oi[gi]=["syncTime","count"],oi[fi]=["type","time","chrmId"],oi[_i]=["targetId","time","count","order","busChannel"],oi[Ti]=["list","syncTime","hasMsg"],oi[Ei]=["type","count","startTime","order"],oi[vi]=["info","isFinished"],oi[yi]=["msgId","msgTime","remindType"],oi[Ii]=["sessions"],oi[Ci]=["type","channelId","busChannel"],oi[mi]=["nothing"],oi[Ri]=["type","msg","count","busChannel","startTime","endTime"],oi[Si]=["type","conversationId","msgs","busChannel"],oi[Oi]=["targetId","dataTime","conversationType","busChannel"],oi[Mi]=["type","msgTime","channelId","busChannel"],oi[Li]=["nothing"],oi[Ni]=["nothing","sessionId","joinTime"],oi[Ui]=["count","order"],oi[Ai]=["userTotalNums","userInfos"],oi[wi]=["type","key","httpMethod","queryString"],oi[Pi]=["type","key","fileName"],oi[xi]=["type","key","fileName"],oi[bi]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],oi[Di]=["downloadUrl"],oi[Vi]=["downloadUrl"],oi[Gi]=["key","value","status","timestamp","uid","version"],oi[Bi]=["entry","bNotify","notification","type"],oi[ki]=["entry","bNotify","notification","type"],oi[Fi]=["entry","bNotify","notification","type"],oi[Hi]=["entries","bFullUpdate","syncTime"],oi[Ki]=["timestamp","errorKeys","keysVersion"],oi[qi]=["version","key"],oi[Yi]=["key","errorCode"],oi[ji]=["timestamp"],oi[Qi]=["version","value"],oi[Ji]=["version","reserve"],oi[Wi]=["version","reserve"],oi[Xi]=["items","version"],oi.UserSettingItem=["targetId","type","key","value","version","status","tags"],oi[Zi]=["time"],oi[$i]=["version","state"],oi[eo]=["type","channelId","time","stateItem","busChannel"],oi[to]=["sessionStateType","value","tags"],oi[no]=["version","state"],oi[ro]=["version"],oi[oo]=["busChannel","unpushLevel"],oi[so]=["groupId","busChannel","msgTime","size"],oi[io]=["busChannel"],oi[uo]=["groupId","busChannel","unpushLevel"],oi[co]=["msgId","busChannel"],oi[lo]=["msgId","busChannel"],oi[ho]=["totalMemberNum","list"],oi[po]=["readTime","userId"],oi[go]=["version","tags"],oi[fo]=["tagId","name","createdTime","isTop"],oi[_o]=["version","tags"],oi[To]=["tagId"],oi[zi]=["version","reserve"],oi[Eo]=["sdkInfo"],oi[vo]=["nothing"],oi[yo]=["syncTime","isEraseMsgContent"],oi[Io]=["syncTime"],oi[Co]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],oi[mo]=["syncTime"],oi[So]=["list","syncTime","hasNext"],oi[Ro]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],oi[Oo]=["targetId","type","query"],oi[Mo]=["msgTime","msgUID","busChannel"],oi[Lo]=["list"],oi[No]=["targetId","type","opType","busChannel"],oi[Uo]=["type","notifyType","info","summary"],oi[Ao]=["targetId","busChannel","userId","opType","optime"],oi[wo]=["targetId","busChannel","count","opType"],oi[bo]=["rtcRoomId"],oi[Po]=["nothing"];var Bo,ko="\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(fi," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(pi," {\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(ai," {\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(ui," {\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(li," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(ci," {\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(M.IMAGE,";\n audio = ").concat(M.AUDIO,";\n video = ").concat(M.VIDEO,";\n file = ").concat(M.FILE,";\n sight = ").concat(M.SIGHT,";\n html = ").concat(M.COMBINE_HTML,";\n }\n message ").concat(wi," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(Pi," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(xi," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(bi," {\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(Di," {\n required string downloadUrl = 1;\n }\n message ").concat(Vi," {\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(Li," {\n required int32 nothing = 1;\n }\n message ").concat(Ni," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(gi," {\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(Ei,"\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(Ri,"\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(vi,"\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(yi," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(yi," //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n }\n message ").concat(so," // 新增 查询未读@列表入参\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(ao," //查询未读@列表出参\n {\n repeated ").concat(yi," 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(Oi,"\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(Ui,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Ai,"\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(_i,"\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(Ti,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(hi,"{\n required int32 nothing = 1;\n }\n message ").concat(di,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Mi,"\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(Ii,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(Ci,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(mi,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Si,"\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(Bi," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(ki," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Fi," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Hi," {\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(Ki," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Yi,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(ji," {\n required int64 timestamp = 1;\n }\n message ").concat(Qi," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Ji," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Wi," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Xi," {\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(Zi," {\n required int64 time = 1;\n }\n message ").concat($i," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(eo," {\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(to," {\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(no," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(io," {\n optional string busChannel = 1;\n }\n message ").concat(oo,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(uo," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(ro," {\n required int64 version=1;\n }\n message ").concat(co," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(lo," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(ho," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(po," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(go," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(fo," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(_o," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(To," {\n repeated string tagId=1;\n }\n message ").concat(zi," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Eo,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(vo,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(yo,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Io,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Co,"\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(mo," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(So," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(Ro," //变更详情\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(Oo," //请求\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(Lo," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(No," //客户端发送\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(Uo," //服务端发送\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(Ao," {\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(wo," {\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(bo,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(Po,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(xo,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat(Do,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(Vo,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(Go,"\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"),Fo=function(e,t,n,r,i,o){var s=i?Object.keys(i).map((function(t){return e.encode(ut.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0,a=o?Object.keys(o).map((function(t){return e.encode(ut.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(ut.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:s,outerDatas:a})},Ho=function(e,t){var n=e.decode(ut.RtcUserListOutput,t),r=n.users,i=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return yt(r,(function(e){var t=e.userId,n=e.userData,r={};yt(n,(function(e){var t=e.key,n=e.value;r[t]=n})),c[t]=r})),{users:c,token:i,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:u}};exports.LogL=void 0,(Bo=exports.LogL||(exports.LogL={}))[Bo.STATISTICS=-2]="STATISTICS",Bo[Bo.RECORD=-1]="RECORD",Bo[Bo.FATAL=0]="FATAL",Bo[Bo.ERROR=1]="ERROR",Bo[Bo.WARN=2]="WARN",Bo[Bo.INFO=3]="INFO",Bo[Bo.DEBUG=4]="DEBUG";var Ko=function(e){return[exports.LogL.DEBUG,exports.LogL.INFO,exports.LogL.WARN,exports.LogL.ERROR].some((function(t){return t===e}))},qo=ot(),Yo=Date.now(),jo=0,Qo=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=exports.LogL.WARN,this.debug=this._log.bind(this,exports.LogL.DEBUG),this.info=this._log.bind(this,exports.LogL.INFO),this.warn=this._log.bind(this,exports.LogL.WARN),this.error=this._log.bind(this,exports.LogL.ERROR),this.__statistics=this._log.bind(this,exports.LogL.STATISTICS)}return e.prototype._stdout=function(e,t,n,r,i){if(!(e<=exports.LogL.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(r," | ").concat(i))}},e.prototype.setOutputLevel=function(e){Ko(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,r){var i=new Date;/^[\w-]+$/.test(t)?(this._stdout(e,t,i.toISOString(),n,r),e!==exports.LogL.DEBUG&&this.flush({time:+i,sessionId:qo,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:r})):this._stdout(exports.LogL.ERROR,"L_LOG_TAG_INVALID_E",i.toISOString(),t,r)},e.prototype.createTraceId=function(){return"".concat(qo,"-").concat(++jo)},e.prototype.getSessionId=function(){return qo},e}(),Jo=null,Wo="RC_LOGS",Xo="RC_CONF",zo=null,Zo=function(e){return v(void 0,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return[4,Jo];case 1:return(t=n.sent())?[4,new Promise((function(n){var r=t.db.transaction(Wo,"readwrite").objectStore(Wo),i=IDBKeyRange.lowerBound(Date.now()-e),o=r.getAllKeys(i);o.onsuccess=function(){var e=o.result,t=e.length;if(t>0){var i=r.delete(IDBKeyRange.bound(e[0],e[t-1]));i.onsuccess=n,i.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),zo=setTimeout((function(){return Zo(e)}),6e5),[2]}}))}))},$o=function(e,t,n,r){void 0===r&&(r=168),Jo||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Ot(n).type?Jo=new Promise((function(n){var i=window.indexedDB;i.databases&&i.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&i.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(e),s=i.open(o,1);s.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,e.target.error),n(null)},s.onsuccess=function(i){var o=i.target.result;o?(o.onclose=function(e){t.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(exports.LogTagId.L_LOGDB_ABORT_S,e.target.error)},Zo(3600*Math.max(24,Math.min(168,r))*1e3),n({appkey:e,db:o})):n(null)},s.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(Wo)&&t.deleteObjectStore(Wo);var n=t.createObjectStore(Wo,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Xo,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},es=function(){return v(void 0,void 0,void 0,(function(){var e;return y(this,(function(t){switch(t.label){case 0:return Jo?(zo&&(clearTimeout(zo),zo=null),[4,Jo]):[2];case 1:return(e=t.sent())&&e.db.close(),Jo=null,[2]}}))}))},ts=[],ns=!1,rs=function(e){return v(void 0,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return ns||0===ts.length?[2]:(ns=!0,t=ts.splice(0),[4,new Promise((function(n){var r=e.transaction(Wo,"readwrite");r.oncomplete=n,r.onabort=n;var i=r.objectStore(Wo);t.forEach((function(e){try{i.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),ns=!1,setTimeout((function(){return rs(e)})),[2]}}))}))};function is(e){return v(this,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return[4,Jo];case 1:return(t=n.sent())?[2,new Promise((function(n){var r=t.db.transaction(Xo,"readonly").objectStore(Xo).get(e);r.onsuccess=function(e){var t;n({value:null===(t=r.result)||void 0===t?void 0:t.value,success:!0})},r.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var os,ss,as,us,cs,ls,hs,ds=0,ps=function(){return{setTimestamp4RealtimeLog:function(e){ds=e},getTimestamp4RealtimeLog:function(){return ds},getLogs:function(e,t,n,r){return v(this,void 0,void 0,(function(){var i;return y(this,(function(o){switch(o.label){case 0:return[4,Jo];case 1:return(i=o.sent())?[2,new Promise((function(o){var s=i.db.transaction(Wo,"readonly").objectStore(Wo),a=[],u=IDBKeyRange.bound(e,t),c=s.index("time").openCursor(u);c.onsuccess=function(e){var t=e.target.result;if(t){var i=t.value;i.level<=n&&(r?i.sessionId===qo:i.level>=0)&&a.push(i),t.continue()}else o({dbReady:!0,logs:a})},c.onerror=function(e){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},gs="REPORT_SESSION",fs=function(e,t){return v(void 0,void 0,void 0,(function(){var n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return n="".concat(gs,"_").concat(e),[4,is("".concat(gs,"_").concat(e))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(t===(null==o?void 0:o.sessionId)||function(e,t){v(this,void 0,void 0,(function(){var n,r;return y(this,(function(i){switch(i.label){case 0:return[4,Jo];case 1:return(n=i.sent())?(r=n.db,r.transaction(Xo,"readwrite").objectStore(Xo).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},_s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.flush=function(e){!function(e){v(void 0,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return[4,Jo];case 1:return(t=n.sent())?(ts.push(e),rs(t.db),[2]):[2]}}))}))}(e)},t}(Qo),Ts=function(){function e(e,t,n,r,i){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=r,this.logger=i,this.userId="",this.timer=null,this.started=!1}return e.prototype.checkStart=function(e){return v(this,void 0,void 0,(function(){var t,n;return y(this,(function(r){if(this.started)return[2];if(this.userId=e.userId,!e.logSwitch)return[2];t={url:"",level:1,itv:6,times:5};try{t=JSON.parse(e.logPolicy)}catch(t){this.logger.warn(exports.LogTagId.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}return n=In.getLogUrlPolicyList(t.url)[0],this.started=!0,this.realtimeReport(n,t.level,t.itv),[2]}))}))},e.prototype.realtimeReport=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h,d,p,g,f=this;return y(this,(function(_){switch(_.label){case 0:return r=Date.now(),i=this.logDB.getTimestamp4RealtimeLog()||Yo,o=Math.max(r-5e3,i),s=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:o,level:t}),s),[4,this.logDB.getLogs(i,o,t,!0)];case 1:return a=_.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"db error",s),[3,6]);case 2:return 0!==c.length?[3,3]:(this.logger.debug(exports.LogTagId.L_REALTIME_LOG_R,"no logs",s),[3,6]);case 3:return this.logger.info(exports.LogTagId.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(exports.LogTagId.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,"compress done",s),p=ke(e)?e:"https://".concat(e),p+="?version=".concat("5.7.10","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:p,body:d,method:"POST"})];case 5:g=_.sent().status,this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:g}),s),200===g&&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,r,i,o){return v(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,p,g,f;return y(this,(function(_){switch(_.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:i,messageUId:o}),s),[4,this.logDB.getLogs(e,t,exports.LogL.DEBUG,!1)]);case 1:return a=_.sent(),u=a.dbReady,c=a.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),l=ke(r)?r:"https://".concat(r),l+="?version=".concat("5.7.10","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),u?c.length>0?[4,this.compressLogs(c)]:[3,3]:[3,5];case 2:return d=_.sent(),p=d.success,g=d.data,h=p?g:"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(exports.LogTagId.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(exports.LogTagId.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}(),Es=48,vs=64,ys=80,Is=96,Cs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ms=Cs.length,Rs=function(e){for(var t={},n=0;n<e.length-1;n++){var r=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(r)?t[r].push(n):t[r]=[n]}for(var i=[],o=[],s=function(){if(o.length>0){var e=o.join("");if(o=[],e.length>26){var t=Os(e.length),n=String.fromCharCode(ys|t.length);i.push(n+t)}else{var r=String.fromCharCode(Is|e.length);i.push(r)}i.push(e)}},a=0;a<e.length;){var u=Ss(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=Os(a-u.offset),l=Os(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(vs|c.length<<2|l.length);i.push(h+c+l),a+=u.length}}}s();var d=Os(e.length),p=String.fromCharCode(Es|d.length);return i.push(p+d),i.join("")},Ss=function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return r;for(var o=t.length-n,s=0,a=i.length;s<a;s++){var u=i[s],c=n-u;if(!(c>238327)){var l=Math.min(o,c);if(l<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var h=2,d=h;d<l&&t.charAt(u+d)===t.charAt(n+d);d++)h++;h>=r.length&&(r.length=h,r.offset=u)}}}return r},Os=function(e){var t=[],n=0;do{n=e%ms,t.push(Cs.charAt(n)),e=(e-n)/ms}while(e>0);return t.join("")},Ms=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Ls=function(e){var t=e.sessionId,n=e.level,r=e.loggerId,i=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:i,from:r});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Ns=function(e){function t(t,n,r,i){var o=this,s=Zr(n),a=Ms(n),u="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=e.call(this,t,s,u,ps(),r)||this).runtime=n,o.clientReportLevel=i,Ko(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return T(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return v(this,void 0,void 0,(function(){return y(this,(function(n){switch(n.label){case 0:return[4,fs(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,{success:!0,data:Rs(e.map(Ls).join(""))}]}))}))},t.prototype.isReporter=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),v(void 0,void 0,void 0,(function(){var e,r,i;return y(this,(function(o){switch(o.label){case 0:return[4,is("".concat(gs,"_").concat(t))];case 1:return e=o.sent(),r=e.success,i=e.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,r,i,o,s){return v(this,void 0,void 0,(function(){return y(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,r,i,o,s)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,r){return v(this,void 0,void 0,(function(){return y(this,(function(i){return[2,e.prototype.realtimeReport.call(this,t,n,r)]}))}))},t}(Ts);exports.HttpMethod=void 0,(os=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",os.POST="POST",os.PUT="PUT",exports.NetworkType=void 0,(ss=exports.NetworkType||(exports.NetworkType={})).WIFI="wifi",ss.FOUR_G="4g",ss.THREE_G="3g",ss.TWO_G="2g",ss.FIVE_G="2g",ss.THREE_GENT="3gnet",ss.UNKONWN="unknown",exports.TagChangeType=void 0,(as=exports.TagChangeType||(exports.TagChangeType={}))[as.add=1]="add",as[as.update=2]="update",as[as.delete=3]="delete",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"}(us||(us={})),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"}(cs||(cs={}));var Us,As=((ls={})[cs.OTHER_DEVICE_LOGIN]=A.RC_DISCONN_KICK,ls[cs.BLOCK]=A.RC_DISCONN_EXCEPTION,ls[cs.BLOCK_NEW]=A.RC_DISCONN_EXCEPTION,ls[cs.REDIRECT_NEW]=A.RC_CONN_REDIRECTED,ls[cs.TOKEN_EXPIRED]=A.RC_CONN_TOKEN_EXPIRED,ls[cs.ILLEGAL_PROTOCOL_VERSION]=A.RC_CONN_PROTO_VERSION_ERROR,ls[cs.ACCOUNT_CANCELLATION]=A.RC_ACCOUNT_CANCELLATION,ls),ws=((hs={})[us.ACCEPTED]=A.SUCCESS,hs[us.UNACCEPTABLE_PROTOCOL_VERSION]=A.RC_CONN_PROTO_VERSION_ERROR,hs[us.IDENTIFIER_REJECTED]=A.RC_CONN_IDENTIFIER_REJECTED,hs[us.SERVER_UNAVAILABLE]=A.RC_CONN_SERVER_UNAVAILABLE,hs[us.TOKEN_INCORRECT]=A.RC_CONN_TOKEN_INCORRECT,hs[us.NOT_AUTHORIZED]=A.RC_CONN_NOT_AUTHRORIZED,hs[us.REDIRECT]=A.RC_CONN_REDIRECTED,hs[us.PACKAGE_ERROR]=A.RC_CONN_PACKAGE_NAME_INVALID,hs[us.APP_BLOCK_OR_DELETE]=A.RC_CONN_APP_BLOCKED_OR_DELETED,hs[us.BLOCK]=A.RC_CONN_USER_BLOCKED,hs[us.TOKEN_EXPIRE]=A.RC_CONN_TOKEN_EXPIRED,hs[us.DEVICE_ERROR]=A.RC_CONN_DEVICE_ERROR,hs[us.HOSTNAME_ERROR]=A.RC_CONN_HOSTNAME_ERROR,hs[us.HASOHTERSAMECLIENTONLINE]=A.RC_DISCONN_SAME_CLIENT_ON_LINE,hs[us.OUT_OF_LIMIT]=A.RC_LISCENSE_COUNT_OUT_OF_LIMIT,hs[us.IN_OTHER_CLUSTER]=A.RC_CONN_WRONG_CLUSTER,hs[us.APP_AUTH_NOT_PASS]=A.RC_APP_AUTH_NOT_PASS,hs[us.OTP_USED]=A.RC_OTP_USED,hs[us.PLATFORM_ERROR]=A.RC_PLATFORM_ERROR,hs[us.ACCOUNT_CANCELLATION]=A.RC_ACCOUNT_CANCELLATION,hs[us.LICENSE_EXPIRED]=A.RC_LICENSE_EXPIRED,hs),bs=function(e){return e===A.RC_CONN_REDIRECTED};exports.RCConnectionStatus=void 0,(Us=exports.RCConnectionStatus||(exports.RCConnectionStatus={}))[Us.CONNECTED=0]="CONNECTED",Us[Us.CONNECTING=1]="CONNECTING",Us[Us.DISCONNECTED=2]="DISCONNECTED",Us[Us.SUSPENDED=3]="SUSPENDED";var Ps,xs=function(){function e(e,t,n,r,i){this.appkey=e,this.navi=t,this.logger=n,this.statisticLog=r,this.listener=i,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:exports.NetworkType.UNKONWN},this._crtConnectionStatus=exports.RCConnectionStatus.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!==exports.RCConnectionStatus.CONNECTED&&e!==exports.RCConnectionStatus.CONNECTING){var n={bid:vt(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.__statistics(exports.StatisticsTag.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case exports.RCConnectionStatus.CONNECTED:this.logger.info(exports.LogTagId.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case exports.RCConnectionStatus.CONNECTING:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onConnecting();break;case exports.RCConnectionStatus.SUSPENDED:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),bs(t)&&this.clearCmpWeightCache(),this.listener.onSuspend(t);break;default:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),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(exports.StatisticsTag.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED?[2,{code:A.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this.retryCount=0,this.uuid=it(),this.token=e,this.reconnectKick=t,this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:exports.ConnectReason.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(exports.StatisticsTag.IM_STATS_CS,JSON.stringify(r),n),[4,this.try2Connect(e,t,!1,n)]);case 1:return i=a.sent(),o=i.code,s=i.data,o!==A.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,o),[2,{code:o}]):(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2,{code:o,data:s}])}}))}))},e.prototype.try2Connect=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,r),[4,this._crtConnectionTask]);case 1:return i=a.sent(),o=i.code,s=i.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},e.prototype.createConnectionTask=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h;return y(this,(function(d){switch(d.label){case 0:return i={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(e,n,!1,r,i)];case 1:return o=d.sent(),s=o.code,a=o.data,s!==A.SUCCESS?[2,{code:s}]:1===(u=a).type?[2,{code:A.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(exports.LogTagId.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),r),[4,this.connectWithToken(e.replace(/@.+$/,"@"),u,t,r)]);case 2:return c=d.sent(),l=c.code,h=c.data,bs(l)?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"redirect code: ".concat(l),r),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,r)]):[A.RC_TCP_RESET,A.RC_CONN_ACK_TIMEOUT,A.RC_TCP_DISCONNECTED_NO_RMTP].includes(l)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(exports.LogTagId.L_CONNECT_R,"cmp ack timeout, code: ".concat(l),r),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,l),this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),[2,this.createConnectionTask(e,t,!1,r)]):l!==A.SUCCESS?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"code: ".concat(l),r),[2,{code:l}]):(this.logger.info(exports.LogTagId.L_CONNECT_R,"userId: ".concat(h),r),this._connectDurSwitch=!0,this._crtUserId=h,[2,{code:l,data:h}])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case A.TIMEOUT:return void(this.reason=exports.ConnectReason.TIMEOUT);case A.RC_CONN_REDIRECTED:return void(this.reason=exports.ConnectReason.REDIRECTED);default:this.reason=exports.ConnectReason.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i=this;return y(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),r=function(){return v(i,void 0,void 0,(function(){var i,o;return y(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.SUSPENDED?[2]:(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING,t),this.setReconnectReason(t),this.retryCount+=1,i={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(exports.StatisticsTag.IM_STATS_CS,JSON.stringify(i)),[4,this.try2Connect(this.token,!0,e,n)]);case 1:return o=s.sent().code,this.reconnectTimer=null,o===A.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2]):[A.SERVER_UNAVAILABLE,A.TIMEOUT,A.RC_SOCKET_DISCONNECTED,A.RC_SOCKET_NOT_CREATED,A.RC_CONN_ACK_TIMEOUT,A.RC_TCP_RESET,A.RC_NAVI_REQ_FAILED,A.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTING||(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,o),this.reconnectTimer=setTimeout(r,5e3)),[2]):(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,o),[2])}}))}))},r(),[2]}))}))},e.prototype.onDisconnectByServer=function(e){if(bs(e))return this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void this.try2Reconnect(!0,e);this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return v(this,void 0,void 0,(function(){var e,t,n=this;return y(this,(function(r){switch(r.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?(this._failedCount=0,this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=r.sent())===A.SUCCESS?(this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_R,"code: ".concat(t,", count: ").concat(this._failedCount),e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(exports.LogTagId.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,A.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,A.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,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 I([],this.cmpWeightCache,!0);var n=e.server,r=e.backupServer,i=e.serverAddr,o=e.protocol,s=e.openTLS,a=[];if(i)i.forEach((function(e){a.find((function(t){return t.addr===e.addr}))||a.push(e)}));else{var u=[];n&&u.push(n),null==r||r.split(",").forEach((function(e){u.indexOf(e)<0&&u.push(e)})),u.forEach((function(e,r){var i;i=t?1===s?Vr.TLS:Vr.RMTP:"http"===o?Vr.WS:Vr.WSS,a.push({addr:e,protocol:i,weight:n.length-r})}))}return this.cmpWeightCache=a,I([],a,!0)},e.prototype.updateCmpWeight=function(e,t){if(void 0===t&&(t=!0),this.cmpWeightCache){var n=this.cmpWeightCache.find((function(t){return t.addr===e}));if(n)if(t){var r=Math.max.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));n.weight!==r&&(n.weight=r+1)}else{var i=Math.min.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));n.weight!==i&&(n.weight=i-1)}}},e.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},e}(),Ds=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=rn(ko);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=xe(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,s=((r={})[li]=i._formatSyncMessages,r[ci]=i._formatReceivedMessage,r[ai]=i._formatSentMessage,r[Ti]=i._formatHistoryMessages,r[vi]=i._formatConversationList,r[Ai]=i._formatChatRoomInfos,r[Hi]=i._formatChatRoomKVList,r[Xi]=i._formatUserSetting,r[$i]=i._formatConversationStatus,r[ho]=i._formatGrpReadReceiptQryResp,r[Ji]=i._formatSetUserSettingOutput,r[zi]=i._formatUserSettingNotification,r[So]=i._formatUltraMsgChangeList,r[Uo]=i._formatUltraOperateStatusNotifyList,r[Lo]=i._formatUltraMsgList,r[ao]=i._formatUltraGroupUnreadMentionedList,r[Ni]=i._formatChrmKVVersion,r[Go]=i._formatCallKVInfo,r[Do]=i._fromatCallInfoDownStream,r)[t];try{o=e.length>0&&i._codec[t].decode(e),Ve(o)&&(o=function(e){for(var t in e)Ve(e[t])&&(e[t]=dt(e[t]));return e}(o)),Ge(s)&&(o=s.call(this,o,n))}catch(e){this.logger.error(exports.LogTagId.L_PB_DECODE_E,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=xe(n)?new Uint8Array(n):n;return tr.readUTF(i.subarray(t,r))}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=t?JSON.parse(t):t}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,o=e.finished;return(Be(o)||null===o)&&(e.finished=!0),e.syncTime=dt(i),e.list=It(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._getUtfContent=function(e){if(e.user){var t=e.user,n=t.portrait,r=t.portraitUri,i=n||r;i&&(e.user.portrait=e.user.portraitUri=i)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return yt(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,r=e.pushExt,i=e.configFlag,o={};return r&&(o=ft(t,r.pushConfigs,r.pushId)),E(E({},o),{pushTitle:null==r?void 0:r.title,pushContent:n,pushData:n,disablePushTitle:!!i&&Boolean(4&i),forceShowDetailContent:!!i&&Boolean(8&i),templateId:null==r?void 0:r.templateId})},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var r=this,i=t||{},o=i.currentUserId,s=i.connectedTime,a=e.content,u=e.fromUserId,c=e.type,l=e.groupId,h=e.status,d=e.dataTime,p=e.extraContent,g=e.configFlag,f=e.extStatus,_=e.clientUniqueId,T=e.busChannel,E=e.msgId,v=e.classname,y=e.direction||N.RECEIVE,I=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=I.isPersited,m=I.isCounted,R=I.isMentioned,S=I.disableNotification,O=I.receivedStatus,M=I.canIncludeExpansion,L=!!(2&(f||0)),U=!!(4&(f||0)),A=!!(8&(f||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,w=[b.GROUP,b.CHATROOM,b.RTC_ROOM,b.ULTRA_GROUP].indexOf(c)>-1?l:u,P=u,x=N.RECEIVE;y===N.SEND&&(P=o,x=N.SEND);var D=dt(d),V=D<s,G=c===b.CHATROOM,B=r._setExpansion(p),k=r._formatBytes(a);k=r._getUtfContent(k);var F=r._setPushConfig(e,this.logger);G&&u===o&&(x=N.SEND);var H={conversationType:c,targetId:w,senderUserId:P,messageType:v,messageUId:E,isPersited:C,isCounted:m,isMentioned:R,sentTime:D,messageDirection:x,receivedTime:Nt.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:M,content:k,expansion:B,configFlag:g,pushConfig:F,channelId:T||"",isInterrupt:L,isModifyMessage:U,messageId:dt(_)||0,sentStatus:exports.SentStatus.SENT};return c!==b.ULTRA_GROUP?(H.isOffLineMessage=V,H):(H.channelType=A,H)},e.prototype._formatSentMessage=function(e,t){var n=this,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,l=e.configFlag,h=e.extStatus,d=e.clientUniqueId,p=t.signal,g=t.currentUserId,f=p.date,_=p.topic,T=p.targetId,v=!!(2&(h||0)),y=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),I=y.isPersited,C=y.isCounted,m=y.disableNotification,R=y.canIncludeExpansion,S=Yn[_]||b.PRIVATE,O=mt(On,_),M=n._formatBytes(r),L=T;i===V.RECALL&&(S=M.conversationType||S,L=M.targetId||T);var U=n._setExpansion(a),A=n._setPushConfig(e,this.logger),w=E(E({},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:S,targetId:L,messageType:i,messageUId:s,isPersited:I,isCounted:C,isStatusMessage:O,senderUserId:g,content:n._formatBytes(r),sentTime:1e3*f,receivedTime:Nt.getTime(),messageDirection:N.SEND,isOffLineMessage:!1,disableNotification:m,canIncludeExpansion:R,expansion:U,pushConfig:w,channelId:e.busChannel||"",isInterrupt:v,messageId:dt(d)||0}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,s=r.targetId,a=dt(e.syncTime),u=[];return yt(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===b.ULTRA_GROUP?i.targetId=e.groupId||r.targetId:i.targetId=s,u.push(i)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!o}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,r=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,r=e.time,i=e.changeType,o=e.msgUID,s=e.msgTime,a=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,p=e.busChannelType,g=e.remindType;return{targetId:t,conversationType:n,changeType:i,messageUId:o,changeTime:dt(r),sendTime:dt(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p,mentionedType:g}})),hasNext:r}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,r=e.info,i=e.summary,o=[],s=[],a=2==(2&n),u=1==(1&n);return u&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.userId,i=e.opType,s=e.optime,a=dt(s);o.push({targetId:t,channelId:n,userId:r,operationType:i,operationTime:a})})),a&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,i=e.opType;s.push({targetId:t,channelId:n,count:r,operationType:i})})),{conversationType:t,info:o,summary:s,hasInfo:u,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,r=e.list;return{list:r&&r.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatUltraGroupUnreadMentionedList=function(e){var t=e.msgInfo;return(void 0===t?[]:t).map((function(e){return{messageUId:e.msgId,senTtime:dt(e.msgTime),mentionedType:e.remindType}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,r=t.unreadCount,i=t.remindCount,o=t.busChannelType,s=t.msgInfo,a=t.remindMeCount;return e.versionTime=dt(n)||0,e.unreadMessageCount=this._getUnreadCount(dt(r)||0),e.unreadMentionedCount=this._getUnreadCount(dt(i)||0),e.unreadMentionedMeCount=this._getUnreadCount(dt(a)||0),e.channelType=o||exports.UltraGroupChannelType.PUBLIC,e.lastReadTime=0,s&&(e.firstUnreadMessage={sentTime:dt(s.msgTime)},e.lastReadTime=dt(s.msgTime)-1),e},e.prototype._getUnreadCount=function(e){return e>999?999:e},e.prototype._formatConversationList=function(e,t){var n=this,r=this,i=e.info,o=t.afterDecode,s={list:(i=It(i,(function(e){var i=e.msg,s=e.userId,a=e.type,u=e.unreadCount,c=e.busChannel,l=null;i&&((l=r._formatReceivedMessage(i,t)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:dt(u)||0,latestMessage:l||{},channelId:c||""};return a===b.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==o?void 0:o(h))||h})))||[]};return((null==t?void 0:t.conversationType)||b.NONE)===b.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:It(n,(function(e){var t=e.id,n=e.time;return{id:t,time:dt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=It(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,o=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?z.DELETE:z.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:dt(i),version:dt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return yt(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=dt(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=dt(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return yt(t,(function(e){var t=e.type,r=e.channelId,i=e.time,o=e.stateItem,s=e.busChannel,a=B.CLOSE,u=F.NOT_SET,c=!1,l=[];yt(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Xn:a=n===Jn?B.OPEN:B.CLOSE,u=Number(n)||F.NOT_SET;break;case zn:c=n===Jn;break;case Zn:l=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:dt(i),tags:l,channelId:s||""})})),n},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=dt(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:dt(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(hi);return e.setNothing(1),e.getArrayData()},e.prototype._updateMentionedInfo=function(e,t,n){var r,i,o;return{userIdList:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.userIdList)||t,type:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.type)||n||K.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,r=e.pushConfig||{},i=0;return i|=n?1:0,i|=t?2:0,i|=r.disablePushTitle?4:0,i|=r.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,r=e.androidConfig,i=e.templateId,o=void 0===i?"":i,s=this._codec.getModule(ui);if(t&&s.setTitle(t),n||r){var a=gt(n,r);s.setPushConfigs(a)}return(null==r?void 0:r.notificationId)&&s.setPushId(null==r?void 0:r.notificationId),s.setTemplateId(o),s},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,r=t.isMentioned,i=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,p=t.mentionedUserIdList,g=void 0===p?[]:p,f=t.pushContent,_=void 0===f?"":f,T=t.messageId,E=void 0===T?0:T,v=this._codec.getModule(ai),y=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),I=c||{},C=I.pushContent,m=void 0===C?_:C,R=I.pushData,S=void 0===R?d:R;v.setSessionId(y),r&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,g,i)),m&&v.setPushText(m),S&&v.setAppData(S),s&&v.setUserId(s);var O=this._calculateFlag(t);if(v.setConfigFlag(O),v.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),v.setContent(JSON.stringify(o)),a&&u){var M={};yt(u,(function(e,t){M[t]={v:e}})),v.setExtraContent(JSON.stringify(M))}if(c){var L=this._getPushExtraModule(c);v.setPushExt(L)}return v.setClientUniqueId(E),Be(l)||v.setBusChannel(l),v},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,r=e.broadcastSyncTime,i=this._codec.getModule(pi);return i.setIspolling(!1),i.setIsPullSend(!0),i.setSendBoxSyncTime(t),i.setSyncTime(n),i.setBroadcastSyncTime(r),i.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(gi);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,r=t.order,i=t.timestamp,o=t.channelId,s=this._codec.getModule(_i);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(Io);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(Ei);return r.setType(1),r.setCount(t),r.setStartTime(n),r.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,r=e.startTime,i=e.order;t=t||0,r=r||0,i=i||0;var o=this._codec.getModule(Ei);return o.setType(n),o.setCount(t),o.setStartTime(r),o.setOrder(i),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,r=this._codec.getModule(Ri);return r.setType(t),n&&r.setBusChannel([n]),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(Ii),r=[];return yt(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(Ci);o.setType(n),o.setChannelId(i),r.push(o)})),n.setSessions(r),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,r){var i=this._codec.getModule(Si),o=[];return yt(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(o),i.setBusChannel(r),i.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,r){var i=this._codec.getModule(Oi);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(r),i.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,r=e.targetId,i=e.channelId,o=t.timestamp,s=this._codec.getModule(Mi);return o=o||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(o),s.setBusChannel(i),s.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.keys,u={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},c=this._codec.getModule(Co);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.content,u=this._codec.getModule(Co);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(mo);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,r=e.messages,i=this._codec.getModule(Oo),o=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return i.setTargetId(t),i.setType(n),i.setQuery(o),i.getArrayData()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,r=e.sentTime,i=e.count,o=this._codec.getModule(so);return o.setGroupId(t),o.setBusChannel(n),o.setMsgTime(r),o.setSize(i),o.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,r){var i=this._codec.getModule(No);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(Li);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Ui);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(oo);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(io);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r){var i=this._codec.getModule(wi);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var r=this._codec.getModule(Bi),i=t.key,o=t.value,s=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||z.UPDATE,h=Ut(t,l),d={key:i,value:o||"",uid:n,version:c};if(Be(h)||(d.status=h),r.setEntry(d),a){var p={conversationType:b.CHATROOM,targetId:e},g={key:i,value:o,extra:s,type:l},f=this._getUpMsgModule(p,{messageType:V.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});r.setNotification(f),r.setBNotify(!0),r.setType(b.CHATROOM)}return r.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var r=this._codec.getModule(ki),i=t.entries,o=t.type||z.UPDATE,s=Ut(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};Be(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(ji);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(Wi);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Zi);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,r=this._codec.getModule(no),i=Nt.getTime(),o=[];return yt(e,(function(e){var t=n._codec.getModule(eo),r=e.conversationType,s=e.targetId,a=e.notificationStatus,u=e.isTop,c=e.channelId,l=e.notificationLevel,h=[];t.setType(r),t.setChannelId(s),t.setTime(i),t.setBusChannel(c);var d=a===B.OPEN,p={};Be(a)||(p[Xn]=d),Be(l)||(p[Xn]=l),Be(u)||(p[zn]=u),yt(p,(function(e,t){if(!Be(e)){var r=n._codec.getModule(to);e=e?Jn:Wn,Be(l)||Number(t)!==Xn||(e=String(l)),r.setSessionStateType(Number(t)),r.setValue(e),h.push(r)}})),t.setStateItem(h),o.push(t)})),r.setVersion(t||i),r.setState(o),r.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(co);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,r=this._codec.getModule(go),i=[];return e.forEach((function(e){var t=n._codec.getModule(fo);t.setTagId(e.tagId),t.setName(e.tagName),i.push(t)})),r.setTags(i),r.setVersion(t),r.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(co);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,r=this._codec.getModule(_o),i=[];return e.forEach((function(e){var t=n._codec.getModule(fo);t.setTagId(e),i.push(t)})),r.setTags(i),r.setVersion(t),r.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(To);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r=this._codec.getModule(no),i=[];return t.forEach((function(t){var r=n._codec.getModule(eo),o=n._codec.getModule(to),s=[];e.forEach((function(e){var t=n._codec.getModule(fo);t.setTagId(e.tagId),Be(e.isTop)||t.setIsTop(e.isTop),s.push(t)})),o.setSessionStateType(Zn),o.setValue(JSON.stringify(s)),o.setTags(s),r.setType(t.conversationType),r.setChannelId(t.targetId),r.setTime(Date.now()),r.setStateItem([o]),i.push(r)})),r.setState(i),r.setVersion(Nt.getTime()),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Eo);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(yo);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(bo);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e.prototype.encodeSetCallInfo=function(e,t){var n=this._codec.getModule(xo);return n.setKey(e),n.setDataContent(t),n.getArrayData()},e.prototype.encodePullKVMsg=function(e){var t=this._codec.getModule(Vo);return t.setSyncTime(e),t.getArrayData()},e}(),Vs=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t,n,r,i,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 Ds(a.logger),a}return T(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,r){return v(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l;return y(this,(function(d){switch(d.label){case 0:if(n=t.openAnti,i=t.type,0===(o=this.getCmpList(t).sort((function(e,t){return e.weight>t.weight?-1:1}))).length)return this.logger.error(exports.LogTagId.L_NAVI_CONF_E,"no service available",r),[2,{code:A.SERVER_UNAVAILABLE}];s=1===n?vn.V4:vn.V3,a=function(t){var n,a,c,l,d,p,g,f,_,T,E;return y(this,(function(v){switch(v.label){case 0:return n=o[t],a=n.protocol,c=n.addr,l=n.weight,d=function(e,t,n,r,i,o,s){var a=Ms(i),u=a.type,c=a.version,l="browser"===i.tag?"|".concat(u,"|").concat(c):"||",d=s?"&protocolVer=".concat(s):"";return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(h,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":i.tag+encodeURIComponent(l)).concat(i.connectPlatform?"&platform=".concat(i.connectPlatform):"").concat(d)}(a===Vr.WS?"ws":"wss",c,u.appkey,e,u.runtime,"",s),p=Date.now(),[4,u.connectWebSocket(d,s,r)];case 1:return g=v.sent(),f=g.code,_=g.data,T=u.cmpWeightCache.findIndex((function(e){return e.addr===c})),E={bid:vt(),ptc:exports.ProtocalType.WS,cod:f,net:u.getNetwork().type,dur:Date.now()-p,spr:0,pr:i||0,hos:c,idx:T,rct:u.retryCount?exports.ConnectType.RECONNECT:exports.ConnectType.CONNECT,cid:"".concat(u.uuid,"_").concat(u.retryCount),v:exports.StatisticsVersion.CURRENT,rsn:u.reason,count:u.retryCount,weight:l},u.statisticLog.__statistics(exports.StatisticsTag.IM_WEBSOCKET,JSON.stringify(E),r),f===A.RC_SOCKET_DISCONNECTED||f===A.TIMEOUT?[2,"continue"]:f!==A.SUCCESS?[2,{value:{code:f}}]:(u._localConnectedTime=Math.floor((Date.now()+p)/2),u._socket=_.socket,u.updateCmpWeight(o[t].addr),u.curCmpUrl=o[t].addr,[2,{value:{code:f,data:_.userId}}])}}))},u=this,c=0,d.label=1;case 1:return c<o.length?[5,a(c)]:[3,4];case 2:if("object"==typeof(l=d.sent()))return[2,l.value];d.label=3;case 3:return c+=1,[3,1];case 4:return[2,{code:A.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return v(this,void 0,void 0,(function(){var r=this;return y(this,(function(i){return this.logger.info(exports.LogTagId.T,"connect start: ".concat(e),n),[2,new Promise((function(i){var o=r.runtime.createWebSocket(e);r._socketIndex=o.id;var s=setTimeout((function(){r.logger.info(exports.LogTagId.T,"connect timeout: ".concat(e),n),i({code:A.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),r.logger.info(exports.LogTagId.T,"socket open",n)})),o.onMessage((function(e){if(r._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var s,a=yr(r.logger,e,t);if(a instanceof ar){var u=a.status;if(u!==us.ACCEPTED)return r.logger.info(exports.LogTagId.T,"connect failed: ".concat(u),n),void i({code:(s=u,ws[s])});r.logger.info(exports.LogTagId.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return r._connectedTime=c,r._idCount=h,void i({code:A.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof ur){var d=a.status;return r.logger.info(exports.LogTagId.T,"recv disconnect signal -> status: ".concat(d)),void r.onRecvDisconnect(d,o)}if(a instanceof lr&&r._pingResolve)return r._pingResolve(A.SUCCESS),void(r._pingResolve=void 0);r._onReceiveSignal(a)}}else r.logger.warn(exports.LogTagId.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:r._socketIndex,curSocketId:o.id}))})),o.onClose((function(){r.logger.info(exports.LogTagId.T,"socket close",n);var e=A.RC_SOCKET_DISCONNECTED;i({code:e}),r.onSocketEnd(o,e)})),o.onError((function(e){r.logger.info(exports.LogTagId.T,"socket error",n);var t=A.RC_SOCKET_DISCONNECTED;i({code:t}),r.onSocketEnd(o,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==_n.AT_MOST_ONCE&&(e instanceof pr&&!e.syncMsg&&(this.logger.debug(exports.LogTagId.O,"send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new _r(t))),e instanceof vr&&(this.logger.debug(exports.LogTagId.O,"send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new Er(t))))},t.prototype._publishReader=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o=this;return y(this,(function(s){switch(s.label){case 0:return n=e.syncMsg,r=e.topic,this.logger.debug(exports.LogTagId.O,"recv PublishReader -> messageId: ".concat(t," ").concat(r)),r===Bt?[2]:!n||function(e){return[Ir.ppMsgS,Ir.pgMsgS,Ir.chatMsgS].map((function(e){return Ir[e]})).indexOf(e)>=0}(r)?(this.wsListener.signal(e),[2]):[4,new Promise((function(e){o._syncMessageIds[t]=e}))];case 1:return i=s.sent(),delete this._syncMessageIds[t],this.wsListener.signal(e,i),[2]}}))}))},t.prototype._onReceiveSignal=function(e){return v(this,void 0,void 0,(function(){var t,n,r;return y(this,(function(i){switch(i.label){case 0:return t=e.messageId,this._qosNeedAck(e,t),t>0&&(e instanceof fr||e instanceof vr)&&(this.logger.debug(exports.LogTagId.O,"recv ack -> messageId: ".concat(t," ").concat(e.topic)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(r=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],r(e))),e instanceof pr?[4,this._publishReader(e,t)]:[3,2];case 1:i.sent(),i.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 As[e]}(e)))},t.prototype.onSocketEnd=function(e,t){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t))},t.prototype.clearResolves=function(){for(var e in this._messageIds){var t=this._messageIds[e];delete this._messageIds[e],t(A.RC_SOCKET_DISCONNECTED)}},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n(A.TIMEOUT)}),e),t.sendOnly(new cr)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof gr||e instanceof Tr)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),v(this,void 0,void 0,(function(){var i,o,s,a,u=this;return y(this,(function(c){switch(c.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){u._messageIds[i]=e,setTimeout((function(){u._messageIds[i]&&delete u._messageIds[i],e()}),r)}))]):[2,{code:A.RC_NET_CHANNEL_INVALID}];case 1:return(o=c.sent())?o instanceof vr||o instanceof fr?(s=t&&o.data&&[A.SUCCESS,A.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(exports.LogTagId.O,"send failed -> message: ".concat(i,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:A.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(exports.LogTagId.O,"send timeout -> message: ".concat(i,", respPBName: ").concat(t,", timeout: ").concat(r)),[2,{code:A.TIMEOUT}])}}))}))},t.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},t}(xs);exports.StatisticL=void 0,(Ps=exports.StatisticL||(exports.StatisticL={}))[Ps.STATISTICS=-2]="STATISTICS",Ps[Ps.RECORD=-1]="RECORD";var Gs=null,Bs="RC_CONF",ks="RC_STATISTICS",Fs=null,Hs=function(e){return v(void 0,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return[4,Gs];case 1:return(t=n.sent())?[4,new Promise((function(n){var r=t.db.transaction(ks,"readwrite").objectStore(ks),i=IDBKeyRange.lowerBound(Date.now()-e),o=r.getAllKeys(i);o.onsuccess=function(){var e=o.result,t=e.length;if(t>0){var i=r.delete(IDBKeyRange.bound(e[0],e[t-1]));i.onsuccess=n,i.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),Fs=setTimeout((function(){return Hs(e)}),6e5),[2]}}))}))},Ks=function(e,t,n){void 0===n&&(n=168),Gs||("undefined"!=typeof window&&window&&window.indexedDB?Gs=new Promise((function(r){var i=window.indexedDB;i.databases&&i.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&i.deleteDatabase("RC_ENGINE_DB")}));var o="RC_STATISTIC_".concat(e),s=i.open(o,2);s.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,e.target.error),r(null)},s.onsuccess=function(i){var o=i.target.result;o?(o.onclose=function(e){t.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(exports.LogTagId.L_LOGDB_ABORT_S,e.target.error)},Hs(3600*Math.max(24,Math.min(168,n))*1e3),r({appkey:e,db:o})):r(null)},s.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(ks)&&t.deleteObjectStore(ks);var n=t.createObjectStore(ks,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Bs,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},qs=function(){return v(void 0,void 0,void 0,(function(){var e,t;return y(this,(function(n){switch(n.label){case 0:return Gs?(Fs&&(clearTimeout(Fs),Fs=null),[4,Gs]):[2];case 1:return(e=n.sent())&&(t=e.db,e.appkey,t.close()),Gs=null,[2]}}))}))};function Ys(e){return v(this,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return[4,Gs];case 1:return(t=n.sent())?[2,new Promise((function(n){var r=t.db.transaction(Bs,"readonly").objectStore(Bs).get(e);r.onsuccess=function(e){var t;n({value:null===(t=r.result)||void 0===t?void 0:t.value,success:!0})},r.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var js="REPORT_SESSION",Qs=function(e,t){return v(void 0,void 0,void 0,(function(){var n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return n="".concat(js,"_").concat(e),[4,Ys("".concat(js,"_").concat(e))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(t===(null==o?void 0:o.sessionId)||function(e,t){v(this,void 0,void 0,(function(){var n,r;return y(this,(function(i){switch(i.label){case 0:return[4,Gs];case 1:return(n=i.sent())?(r=n.db,r.transaction(Bs,"readwrite").objectStore(Bs).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},Js=function(){return Gs},Ws=function(e){var t=e.sessionId,n=e.level,r=e.loggerId,i=e.traceId,o=e.time,s=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:i,from:r});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Xs=ot(),zs=Date.now(),Zs=0,$s=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.__statistics=this._writer.bind(this,exports.StatisticL.STATISTICS)}return e.prototype._writer=function(e,t,n,r){var i=new Date;/^[\w-_]+$/.test(t)&&this.flush({time:+i,sessionId:Xs,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:r})},e.prototype.createTraceId=function(){return"".concat(Xs,"-").concat(++Zs)},e.prototype.getSessionId=function(){return Xs},e}(),ea=function(){function e(e,t,n,r,i,o){void 0===o&&(o=i),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.statisticDB=r,this.logger=i,this.reportClass=o,this.userId="",this.timer=null,this.started=!1}return e.prototype.checkStart=function(e){return v(this,void 0,void 0,(function(){var t,n;return y(this,(function(r){if(this.started)return[2];if(this.userId=e.userId,!e.logSwitch)return[2];t={url:"",level:1,itv:6,times:5};try{t=JSON.parse(e.logPolicy)}catch(t){this.logger.warn(exports.LogTagId.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}return n=In.getLogUrlPolicyList(t.url)[0],this.started=!0,this.realtimeReport(n,t.level,t.itv),[2]}))}))},e.prototype.realtimeReport=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h,d,p,g,f=this;return y(this,(function(_){switch(_.label){case 0:return r=Date.now(),i=this.statisticDB.getTimestamp4RealtimeLog()||zs,o=Math.max(r-5e3,i),s=this.reportClass.createTraceId(),this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:o,level:t}),s),[4,this.statisticDB.getStatistics(i,o,t,!0)];case 1:return a=_.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"db error",s),[3,6]);case 2:return 0!==c.length?[3,3]:(this.logger.debug(exports.LogTagId.L_REALTIME_LOG_R,"no logs",s),[3,6]);case 3:return this.logger.info(exports.LogTagId.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(exports.LogTagId.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,"compress done",s),p=ke(e)?e:"https://".concat(e),p+="?version=".concat("5.7.10","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:p,body:d,method:"POST"})];case 5:g=_.sent().status,this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:g}),s),200===g&&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,r,i,o){return v(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,p,g,f;return y(this,(function(_){switch(_.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:i,messageUId:o}),s),[4,this.statisticDB.getStatistics(e,t,exports.StatisticL.STATISTICS,!1)]);case 1:return a=_.sent(),u=a.dbReady,c=a.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),l=ke(r)?r:"https://".concat(r),l+="?version=".concat("5.7.10","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),u?c.length>0?[4,this.compressStatistics(c)]:[3,3]:[3,5];case 2:return d=_.sent(),p=d.success,g=d.data,h=p?g:"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(exports.LogTagId.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(exports.LogTagId.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}(),ta="RC_STATISTICS",na=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.flush=function(e){sa(e)},t}($s),ra=!1,ia=[],oa=function(e){return v(void 0,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return ra||0===ia.length?[2]:(ra=!0,t=ia.splice(0),[4,new Promise((function(n){var r=e.transaction(ta,"readwrite");r.oncomplete=n,r.onabort=n;var i=r.objectStore(ta);t.forEach((function(e){try{i.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),ra=!1,setTimeout((function(){return oa(e)})),[2]}}))}))},sa=function(e){return v(void 0,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return[4,Js()];case 1:return(t=n.sent())?(ia.push(e),oa(t.db),[2]):[2]}}))}))},aa=0,ua=function(){return{setTimestamp4RealtimeLog:function(e){aa=e},getTimestamp4RealtimeLog:function(){return aa},getStatistics:function(e,t){return v(this,void 0,void 0,(function(){var n;return y(this,(function(r){switch(r.label){case 0:return[4,Js()];case 1:return(n=r.sent())?[2,new Promise((function(r){var i=n.db.transaction(ta,"readonly").objectStore(ta),o=[],s=IDBKeyRange.bound(e,t),a=i.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 r({dbReady:!0,logs:o})},a.onerror=function(e){r({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},ca=function(e){function t(t,n,r,i){var o=this,s=Zr(n),a=Ms(n),u="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=e.call(this,t,s,u,ua(),r,i)||this).runtime=n,o}return T(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return v(this,void 0,void 0,(function(){return y(this,(function(n){switch(n.label){case 0:return[4,Qs(t.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressStatistics=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,{success:!0,data:Rs(e.map(Ws).join(""))}]}))}))},t.prototype.isReporter=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.reportClass.getSessionId(),v(void 0,void 0,void 0,(function(){var e,r,i;return y(this,(function(o){switch(o.label){case 0:return[4,Ys("".concat(js,"_").concat(t))];case 1:return e=o.sent(),r=e.success,i=e.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,r,i,o,s){return v(this,void 0,void 0,(function(){return y(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,r,i,o,s)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,r){return v(this,void 0,void 0,(function(){return y(this,(function(i){return[2,e.prototype.realtimeReport.call(this,t,n,r)]}))}))},t}(ea),la=function(e,t,r,i,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:N.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:o,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig,channelId:r.channelId,isInterrupt:r.isInterrupt,messageId:a||0,sentStatus:exports.SentStatus.SENT}},ha=function(e){return e.sort((function(e,t){var n,r,i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i})),e},da=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r,i,new _s(i.appkey,"RC-E","IM"),new na(i.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=i.appkey,a=i.logOutputLevel,u=i.logExpireTime,c=i.navigators,l=i.areaCode,h=i.logServerUrl,d=i.miniCMPProxy;return o.logger.setOutputLevel(a),$o(s,o.logger,t,u),o.reporter=new Ns(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new Wr(s,o.logger,o.statisticLog,t),Ks(s,o.logger,u),o.reporterStatistic=new ca(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new Or(t,s),o._sendMessageStore=new zr(t,s),o._chrmEntryHandler=new Nr(o),o._connMgr=new Vs(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}),In.init({areaCode:l,navigators:c,logServerUrl:h,miniCMPProxy:d}),o}return T(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 Ur(this.runtime,this._appkey,this.currentUserId,e.joinMChrm,this.logger)),this._conversationManager||(this._conversationManager=new Hr(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new si(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new Kr(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 _s(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 v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._connMgr.connect(e,t,n)]}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_RECV_RMTP_O,r,i);var o=Ir[r];if(o)switch(o){case Ir.s_ntf:this._pullMsg(e);break;case Ir.s_msg:this._receiveMsg(e);break;case Ir.s_cmd:this._receiveStateNotify(e);break;case Ir.s_us:this._receiveSettingNotify(e);break;case Ir.rtc_ntf:this._receiveRtcKv(e.data);break;case Ir.s_opNtf:this._pullOperateStatusNotify(e)}else this.logger.error(exports.LogTagId.L_RECV_RMTP_E,r,i)}},t.prototype._receiveStateNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,fi),n=t.time,r=t.type,i=t.chrmId;switch(r){case 2:this._chrmEntryHandler.pullEntry(i,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(i),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,zi).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,r=t.del,i=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:i,expansion:n}}),r&&this._watcher.expansion({deletedExpansion:{messageUId:i,deletedKeys:r}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,Mi),r=n.channelId,i=n.busChannel,o=n.msgTime,s=this._ultraGroupMap["".concat(i,"_").concat(r)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(Lt([s]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},t.prototype._receiveSyncMsg=function(e,t){if($r.includes(e.topic))if(e.topic!==Ir[Ir.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(e.data,ai,{currentUserId:this.currentUserId,signal:e});((n=this._handleMsgProperties(n)).conversationType!==b.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(exports.LogTagId.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==V.EXPANSION_NOTIFY?((n.messageType===V.SYNC_READ_STATUS||n.messageType===V.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=[],r=[],i=e.length-1;i>=0;i-=1){var o=e[i];o.messageType!==V.LOG_COMMAND||"rongcloudsystem"!==o.senderUserId?n.unshift(o):r.unshift(o)}this._watcher.batchMessage(n),0!==r.length&&r.forEach((function(e){var n=e.content,r=n.startTime,i=n.endTime,o=n.platform,s=n.logId,a=n.uri;t.reporter.report(parseInt(r,10),parseInt(i,10),o,a,s,e.messageUId)}))},t.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,fi),n=t.type,r=t.chrmId,i=t.time;if(this.logger.info(exports.LogTagId.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(i)),2===n){var o=this._chrmsQueue[r];if(!o)return;o.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),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()===exports.RCConnectionStatus.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._messageProcessor=function(e){var t=this,n=0,r=[],i=[];return e.forEach((function(e){if((r.push(e.messageUId),e.messageDirection===N.SEND)&&(n=Math.max(e.sentTime,n),t._sendMessageStore.getSendMessageMap()[e.messageUId]))return void t._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==V.DELIVERED&&e.messageType!==V.DELIVERED_MSG)if(e.messageType!==V.EXPANSION_NOTIFY){if(e.messageType===V.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),i.push(o)}else t._receiveMessageExpansion(e)})),{newOutboxTime:n,messageUIds:r,messages:i}},t.prototype._syncMsg=function(){return v(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,l,h,d,p,g,f,_,T,E,v;return y(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),r=this._connMgr.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),i=new Tr(Ir[Ir.pullMsg],r,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o),[4,this._connMgr.send(i,li,{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!==A.SUCCESS||!u||Be(u.finished)||Be(u.list)||Be(u.syncTime)?(this.logger.warn(exports.LogTagId.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,p=void 0===d?1:d,this.logger.info(exports.LogTagId.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),g=this._messageProcessor(c),f=g.newOutboxTime,_=g.messageUIds,T=g.messages,this._batchMessage(T),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._letterbox.setBroadcastSyncTime(p,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),this._pullingMsg=!1,E=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(v=this._pullQueue).push.apply(v,E),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:_.join(","),timestamp:this._latestSyncTimestamp,hasmore:!l,tmpPullQueue:E}),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,ci,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});if(t=this._handleMsgProperties(t),this.logger.info(exports.LogTagId.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),t.messageType!==V.DELIVERED&&t.messageType!==V.DELIVERED_MSG){if(t.conversationType!==b.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!==V.EXPANSION_NOTIFY?t.messageType===V.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,r=e.messageType,i=e.isStatusMessage,o=e.isCounted,s=void 0!==o&&o,a=e.isPersited,l=void 0!==a&&a,h=r in u,d=r in this._customMessageType;if(n=h?E(E({},u[r]),{isStatusMessage:c.includes(r)}):d?this._customMessageType[r]:{isCounted:s,isPersited:l,isStatusMessage:!1},Object.assign(e,n),t&&!Be(i)&&(e.isStatusMessage=i),!t){var p=e.content.user;if(p){var g=p.portrait,f=p.portraitUri,_=g||f;_&&(p.portrait=p.portraitUri=_)}}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,r,i,o,s,a){var u;return void 0===o&&(o=""),v(this,void 0,void 0,(function(){var s,c,l,h,d,p,g,f,_,T;return y(this,(function(E){switch(E.label){case 0:return c=(s=this).currentUserId,l=s._connMgr,h=jn[e]||kn,d=1===r&&0===n,l?(p=l.codec.encodeGetHistoryMsg(t,{timestamp:n,count:d?2:r,order:i,channelId:o}),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:o,timestamp:n,count:r,order:i}),a),[4,l.send(new Tr(h,p,c),Ti,{currentUserId:c,connectedTime:l.getConnectedTime(),conversation:{targetId:t}})]):[3,2];case 1:return g=E.sent(),(f=g.code)===A.SUCCESS&&p?(_=g.data,_=this._fixDownstreamData(d,_,i),T=[],null===(u=_.list)||void 0===u||u.forEach((function(e){e&&T.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:T.join(",")}),a),[2,{code:f,data:{list:_.list,hasMore:_.hasMore}}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:""}),a),[2,{code:f}]);case 2:return[2,{code:A.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,i=this.logger.createTraceId(),o=JSON.stringify(e),this.logger.debug(exports.LogTagId.L_VER_REPORT_T,o,i),s=r.codec.encodeReportSDKInfo(o),a=new Tr(Ir[Ir.reportsdk],s,n),[4,r.send(a)]):[2];case 1:return(u=c.sent().code)!==A.SUCCESS&&this.logger.warn(exports.LogTagId.L_VER_REPORT_R,u,i),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c;return y(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeDeleteMessages(e,t,n,r),u=new Tr(Mn,a,o),[4,s.send(u)]):[2,A.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),[2,c.code]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return y(this,(function(h){switch(h.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeClearMessages(t,n,r,e),u=Qn[e],c=new Tr(u,a,o),[4,s.send(c)]):[2,A.RC_NET_UNAVAILABLE];case 1:return l=h.sent(),[2,l.code]}}))}))},t.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d=this;return y(this,(function(p){switch(p.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,t=t||b.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),u=new Tr(xn,a,o),[4,s.send(u,vi,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=d._conversationManager.get(t,n,r);return Object.assign(e,i),e}})]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return c=p.sent(),l=c.code,h=c.data,l!==A.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==h?void 0:h.list}]}}))}))},t.prototype.removeConversation=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new Tr(Dn,i,t),[4,r.send(o)]):[2,A.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},t.prototype.getConversation=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return e!==b.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:A.CONVER_GET_ERROR}];case 1:return(i=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:A.CONVER_GET_ERROR}];case 2:if(o=c.sent(),s=o.code,a=o.data,s!==A.SUCCESS)return[2,{code:A.CONVER_GET_ERROR}];u=(null==a?void 0:a.list[0])||null,r={conversationType:e,targetId:t,channelId:n,unreadMessageCount:i.unreadMessageCount||0,latestMessage:u,notificationStatus:i.notificationStatus||B.CLOSE,notificationLevel:i.notificationLevel||F.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:A.SUCCESS,data:r}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:A.SUCCESS,data:r})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var r=0;if(e.includes(b.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:A.METHOD_NOT_AVAILABLE});for(var i in this._ultraGroupMap){var o=this._ultraGroupMap[i];(0===t.length||t.includes(o.notificationLevel))&&(r+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return r+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:A.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r,i;return e===b.ULTRA_GROUP?(i=(null===(r=this._ultraGroupMap["".concat(n,"_").concat(t)])||void 0===r?void 0:r.unreadMessageCount)||0,i=this._getUnreadCount(i)):i=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:A.SUCCESS,data:i})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(A.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(A.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(A.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:A.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(A.SUCCESS)},t.prototype.pullConversationStatus=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l=this;return y(this,(function(h){switch(h.label){case 0:return this._isConnected?(n=(t=this)._connMgr,r=t.currentUserId,i=n.codec.encodeGetConversationStatus(e),o=new Tr(Ir[Ir.pullSeAtts],i,r),[4,n.send(o,$i)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return s=h.sent(),a=s.code,u=s.data,this.logger.info(exports.LogTagId.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:r})),a!==A.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===b.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,r=e.notificationLevel,i=e.channelId,o=e.isTop,s=this._ultraGroupMap["".concat(i,"_").concat(t)];return s&&void 0!==r&&(s.notificationLevel=r,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 v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h,d,p=this;return y(this,(function(g){switch(g.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,i=this._conversationManager.getConversationUpdatedTime(),o=r.codec.encodeSetConversationStatus(e,i),s=new Tr(Vn,o,n),[4,r.send(s,ro)]):[2,A.RC_NET_UNAVAILABLE];case 1:return a=g.sent(),u=a.code,c=a.data,u!==A.SUCCESS?[2,u]:(l=c,this._conversationManager.setConversationUpdatedTime(l.version),h=[],e.forEach((function(e){if(e.conversationType!==b.ULTRA_GROUP)p._conversationManager.addStatus(E(E({},e),{updatedTime:l.version}),!0);else{var t=p._setUltraConversationStatus(e);t&&h.push(t)}})),h.length>0&&(d=Lt(h),d=ha(d),this._watcher.conversation(d)),[2,u])}}))}))},t.prototype._joinChrm=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d;return y(this,(function(p){switch(p.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeJoinOrQuitChatRoom(),a=new Tr(s=n?Nn:Ln,o,e),this.logger.info(exports.LogTagId.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:s}),r),[4,i.send(a,Ni)]):[2,A.RC_NET_UNAVAILABLE];case 1:return u=p.sent(),c=u.code,l=u.data,h=c===A.SUCCESS?"info":"warn",this.logger[h](exports.LogTagId.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),r),c===A.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 v(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,u.label=1;case 1:return r<t.length?(i=t[r],this.logger.info(exports.LogTagId.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:i,count:e[i]||10,topic:Nn})),o=this.logger.createTraceId(),[4,this._joinChrm(i,e[i]||10,!0,o)]):[3,4];case 2:if(s=u.sent(),a=s===A.SUCCESS?"info":"warn",this.logger[a](exports.LogTagId.L_REJOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),o),s===A.SUCCESS)return this._watcher.chatroom({rejoinedRoom:{chatroomId:i,count:e[i]}}),[2];s===A.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(i),delete this._chrmsQueue[i]),this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:s}}),u.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),v(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h,d,p,g,f;return y(this,(function(_){switch(_.label){case 0:return this._isConnected?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,t),a=new Tr(Ir[Ir.chrmPull],s,e),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,timestamp:o})),[4,this._connMgr.send(a,li,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return u=_.sent(),c=u.code,l=u.data,r.pulling=!1,c===A.SUCCESS&&l?(h=l.list,d=l.syncTime,p=l.finished,r.timestamp=n?Math.max(d,n):d,r.queue=r.queue.filter((function(e){return e>d})),g=[],f=[],h.forEach((function(e){e.sentTime<o||(g.push(e.messageUId),f.push(e))})),this._batchMessage(f),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:g.join(",")})),(!p||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),r=new Tr(Un,n,e),[4,t.send(r)]):[2,A.RC_NET_UNAVAILABLE];case 1:return i=s.sent(),(o=i.code)===A.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeGetChatRoomInfo(t,n),o=new Tr(Ir[Ir.queryChrmI],i,e),[4,r.send(o,Ai)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==A.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c;return y(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new Tr(Hn,o,e),[4,i.send(s,Ti,{conversation:{targetId:e}})]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==A.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return y(this,(function(h){switch(h.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=r.codec.encodeModifyChatRoomKV(e,t,i),a=t.type===z.UPDATE?An:wn,u=new Tr(a,s,e),[4,r.send(u,Ni)]):[2,A.RC_NET_UNAVAILABLE];case 1:return c=h.sent(),(l=c.code)===A.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},i),[2,l]):[2,l]}}))}))},t.prototype._chatroomKVStoreNotAllSuccess=function(e,t){var n=t.data,r=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(e){var t=r.findIndex((function(t){return e.key===t.key}));-1!==t&&r.splice(t,1)})),r},t.prototype._modifyChatroomKVS=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,h,d,p,g=this;return y(this,(function(f){switch(f.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,t.entries.forEach((function(t){var n=g._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?g.getServerTime():n})),o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===z.UPDATE?bn:Pn,a=new Tr(s,o,e),[4,r.send(a,Ki)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return u=f.sent(),c=u.code,-1!==[A.SUCCESS,A.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(h=[],delete(d=E({},t)).entries,t.entries.forEach((function(e){h.push(E(E({},e),d))})),c===A.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(p=u.data,l=p.errorKeys,h=this._chatroomKVStoreNotAllSuccess(h,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:h,syncTime:(new Date).getTime()},i)),[2,{code:c,data:l}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return t.type=z.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return t.type=z.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return t.type=z.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return t.type=z.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return t.type=z.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return t.type=z.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:A.SUCCESS,data:n}]:this._isConnected?(r=this._connMgr,i=r.codec.encodePullChatRoomKV(0),o=new Tr(Ir[Ir.pullKV],i,e),[4,r.send(o,Hi)]):[2,{code:A.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:A.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:A.CHATROOM_KEY_NOT_EXIST}]}}))}))},t.prototype.getAllChatroomEntry=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:A.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},r=n.codec.encodePullChatRoomKV(0),i=new Tr(Ir[Ir.pullKV],r,e),[4,n.send(i,Hi)]):[2,{code:A.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:A.SUCCESS,data:t}]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,h,d,p=this;return y(this,(function(g){switch(g.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=r.codec.encodePullChatRoomKV(t),s=new Tr(Ir[Ir.pullKV],o,e),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,r.send(s,Hi)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return a=g.sent(),u=a.code,c=a.data,l=u===A.SUCCESS?"info":"warn",this.logger[l](exports.LogTagId.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:t})),u===A.SUCCESS&&c?(h=c.kvEntries,d=[],h.length>0&&(h.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp,s=t.userId;p._chrmEntryHandler.getValue(e,n)===r&&s===p.getCurrentUserId()||d.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,c,i),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()}),s)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,r,i){return v(this,void 0,void 0,(function(){var o,s,a,u,c,l,h,d,p,g,f;return y(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=!![b.PRIVATE,b.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[b.PRIVATE]=Ir.ppMsgS,t[b.GROUP]=Ir.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[b.PRIVATE]=Ir.ppMsgP,t[b.GROUP]=Ir.pgMsgP,t[b.CHATROOM]=Ir.chatMsg,t[b.CUSTOMER_SERVICE]=Ir.pcMsgP,t[b.RTC_ROOM]=Ir.prMsgS,t)[e]}(e)||Ir.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:Et(),n.messageId=a,u=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(c=new gr(Ir[s],u,t)).setHeaderQos(_n.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(c),[2,{code:A.SUCCESS,data:la(e,t,E({},n),"",0,this.currentUserId,a)}]):(l=this._connMgr.getCrtServerTime(),h=la(e,t,E({},n),"",l,this.currentUserId,a),null==r||r(a),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),i),[4,this._connMgr.send(c)])):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return d=_.sent(),p=d.code,g=d.data,p!==A.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:h.messageUId,messageId:h.messageId}),i),h.sentStatus=exports.SentStatus.FAILED,[2,{code:p,data:h}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),f=g,this._sendMessageStore.setMessage(f.messageUId,f.timestamp),h.sentTime=f.timestamp,h.messageUId=f.messageUId,this._conversationManager.setConversationCacheByMessage(h,!0),[2,{code:A.SUCCESS,data:h}])}}))}))},t.prototype.recallMsg=function(e,t,n,r,i){var o;return v(this,void 0,void 0,(function(){var s,a,u,c,l,h,d,p,g,f,_,T,v;return y(this,(function(y){switch(y.label){case 0:return this._isConnected?(s=i.user,a=i.extra,u=i.isDelete,c={conversationType:e,targetId:t,messageUId:n,sentTime:r,channelId:i.channelId||"",isDelete:u||!1},s&&(c.user=s),a&&(c.extra=a),l={content:c,messageType:"RC:RcCmd",disableNotification:null==i?void 0:i.disableNotification,pushConfig:null==i?void 0:i.pushConfig,pushContent:(null===(o=i.pushConfig)||void 0===o?void 0:o.pushContent)||i.pushContent||"",channelId:i.channelId},h=Ir[Ir.recallMsg],d=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},l),(p=new gr(h,d,this.currentUserId)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(p)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return g=y.sent(),f=g.code,_=g.data,e===b.ULTRA_GROUP&&this.logger.debug(exports.LogTagId.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:f,conversationType:e,targetId:t,channelId:i.channelId})),f!==A.SUCCESS?[2,{code:f}]:(T=_,e===b.ULTRA_GROUP?(this._ultraMsgMap[T.messageUId]=T.timestamp,this._updateUltraGroupWhenRecallMsg(t,i.channelId||"",n),[2,{code:A.SUCCESS}]):(this._sendMessageStore.setMessage(T.messageUId,T.timestamp),v=la(e,t,E(E({},l),{isPersited:!0}),T.messageUId,T.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:A.SUCCESS,data:v}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i;return y(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeReadReceipt(t,n),i=new Tr(Ir[Ir.rrMsg],r,e),[2,this._connMgr.send(i)]):[2,{code:A.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i;return y(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeMessageReader(t,n),i=new Tr(Ir[Ir.rrList],r,e),[2,this._connMgr.send(i,ho)]):[2,{code:A.RC_NET_UNAVAILABLE}]}))}))},t.prototype.pullUserSettings=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new Tr(Ir[Ir.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,Xi)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===A.SUCCESS&&this._naviChangeHandler(o),[2,{code:i,data:o}]}}))}))},t.prototype._naviChangeHandler=function(e){var t;if(e){var n=e.settings,r=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(r){var i=this._connMgr.getToken();this.navi.updateVoipCallInfo(i,r);var o=this.navi.getNaviInfoFromCache(i);this._watcher.onNaviDataChange(E({},o))}}else this.logger.warn(exports.LogTagId.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c;return y(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=r&&"uploads"!==r?t||"":pt(e,t),o=this._connMgr.codec.encodeGetFileToken(e,i,n||"",r||""),s=new Tr(Ir[Ir.qnTkn],o,this.currentUserId),[4,this._connMgr.send(s,bi)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,c=Object.assign(c,{fileName:i}),u===A.SUCCESS?[2,{code:u,data:c}]:[2,{code:u}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d;return y(this,(function(p){switch(p.label){case 0:return this._isConnected?(i="",o="",s="",t===Y.QINIU?(o=Pi,s=Di):(o=xi,s=Vi),i=t===Y.QINIU?Ir[Ir.qnUrl]:t===Y.AWS?Ir[Ir.s3Url]:t===Y.STC?Ir[Ir.stcUrl]:t===Y.MINIO?Ir[Ir.minioUrl]:Ir[Ir.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,e,n,r),u=new Tr(i,a,this.currentUserId),[4,this._connMgr.send(u,s)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return c=p.sent(),l=c.code,h=c.data,d=h,l===A.SUCCESS?[2,{code:l,data:d}]:[2,{code:l}]}}))}))},t.prototype.disconnect=function(){return v(this,void 0,void 0,(function(){return y(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,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}},t.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),r=new Tr(Ir[Ir.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Ji)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==A.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([E(E({},e),{createdTime:a})],a),[2,{code:A.SUCCESS}])}}))}))},t.prototype.removeTag=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([e],t),r=new Tr(Ir[Ir.delSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Ji)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==A.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:A.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),r=new Tr(Ir[Ir.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Ji)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==A.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:A.SUCCESS}])}}))}))},t.prototype.getTagList=function(){return v(this,void 0,void 0,(function(){var e,t;return y(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:A.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s=this;return y(this,(function(a){switch(a.label){case 0:return this._isConnected?this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Tr(Ir[Ir.addTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:A.TAG_NOT_EXIST}]:[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return(i=a.sent().code)!==A.SUCCESS?[2,{code:i}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:A.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o=this;return y(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new Tr(Ir[Ir.delTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return(i=s.sent().code)!==A.SUCCESS?[2,{code:i}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:A.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=e.conversationType,r=e.targetId,i=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[e]),a=new Tr(Ir[Ir.delTag],s,this.currentUserId),[4,this._connMgr.send(a)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return(u=c.sent().code)!==A.SUCCESS?[2,{code:u}]:(this._conversationManager.deleteTagStatus(n,r,t,i),[2,{code:A.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h;return y(this,(function(d){switch(d.label){case 0:return this._isConnected?(i=(r=this).currentUserId,o=r._connMgr,s=o.codec.encodeOldConversationList({count:n,type:b.PRIVATE,startTime:t}),a=new Tr(xn,s,i),[4,o.send(a,vi,{currentUserId:i,connectedTime:o.getConnectedTime()})]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return u=d.sent(),c=u.code,l=u.data,c!==A.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,r=[],i=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,u=n._conversationManager.get(o,s,a),c=u.hasMentioned,l=u.mentionedInfo,h=u.lastUnreadTime,d=u.notificationStatus,p=u.isTop,g=u.tags,f=u.unreadMessageCount,_=g&&g[e];if(_){var T=E(E({},t),{hasMentioned:c,mentionedInfo:l,lastUnreadTime:h,notificationStatus:d,isTop:p,unreadMessageCount:f});_.isTop?r.push(E(E({},T),{isTopInTag:!0})):i.push(E(E({},T),{isTopInTag:!1}))}})),r.sort(o),i.sort(o),I(I([],r,!0),i,!0)},t.prototype.getUnreadCountByTag=function(e,t){return v(this,void 0,void 0,(function(){var n;return y(this,(function(r){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:A.SUCCESS,data:n}]):[2,{code:A.RC_NET_UNAVAILABLE}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,h,d;return y(this,(function(p){switch(p.label){case 0:return this._isConnected?(r=t.targetId,i=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(u=this._conversationManager.get(i,r,o)).tags&&Object.hasOwnProperty.call(u.tags,e)?(c=this._connMgr.codec.encodeUpdateConversationTag(a,[t]),l=new Tr(Ir[Ir.addTag],c,this.currentUserId),[4,this._connMgr.send(l)]):[2,{code:A.NO_TAG_IN_CONVER}]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return(h=p.sent().code)!==A.SUCCESS?[2,{code:h}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(i,r,d,o),[2,{code:A.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return v(this,void 0,void 0,(function(){var n,r,i,o;return y(this,(function(s){if(!this._isConnected)return[2,{code:A.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(o in n.tags)i.push({tagId:o,tagName:null===(t=r[o])||void 0===t?void 0:t.tagName});return[2,{code:A.SUCCESS,data:i}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:A.SUCCESS,data:e})},t.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:A.SUCCESS,data:n})},t.prototype.getUnreadConversationList=function(e){return v(this,void 0,void 0,(function(){var t;return y(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:A.SUCCESS,data:t})]}))}))},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===b.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:A.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:A.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===b.ULTRA_GROUP)return Promise.resolve({code:A.METHOD_NOT_AVAILABLE});var r;if(!(r=e===b.ULTRA_GROUP?this._ultraGroupManager.get(b.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:A.SUCCESS,data:F.NOT_SET});var i=r.notificationLevel;return Be(r.notificationLevel)&&!Be(r.notificationStatus)&&(i=B.OPEN===r.notificationStatus?1:0),Promise.resolve({code:A.SUCCESS,data:i})},t.prototype.getConversationNotificationStatus=function(e,t,n){var r;return(r=e===b.ULTRA_GROUP?this._ultraGroupManager.get(b.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:A.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:A.SUCCESS,data:B.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this.getHistoryMessage(e,t,n,r,i,o)},t.prototype.getUltraGroupList=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o=this;return y(this,(function(s){return t=e.targetId,n=e.channelType,this._isUltraGroupListExist?(r=(r=Object.values(this._ultraGroupMap).filter((function(e){return!(e.targetId!==t&&t||e.channelType!==n&&be(n))}))).map((function(e){var t=e.unreadMessageCount,n=e.unreadMentionedCount,r=e.unreadMentionedMeCount;return t=o._getUnreadCount(t),n=o._getUnreadCount(n),r=o._getUnreadCount(r),E(E({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:r})})),r=ha(r),i=Lt(r),[2,{code:A.SUCCESS,data:i}]):[2,{code:A.METHOD_NOT_AVAILABLE}]}))}))},t.prototype._getUnreadCount=function(e){return e>999?999:e},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:A.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===B.OPEN||e.notificationLevel>0)&&t.push({conversationType:b.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:A.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:A.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:b.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:A.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:A.METHOD_NOT_AVAILABLE});var n=0;for(var r in this._ultraGroupMap){r.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=this._ultraGroupMap[r].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:A.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var r in this._ultraGroupMap){var i=this._ultraGroupMap[r];i.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=i.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:A.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:A.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(r){var i=t._ultraGroupMap[r];e.includes(i.targetId)&&n.push({type:i.conversationType,targetId:i.targetId,channelId:i.channelId,unreadMessageCount:t._getUnreadCount(i.unreadMessageCount),mentionedCount:t._getUnreadCount(i.unreadMentionedCount),mentionedMeCount:t._getUnreadCount(i.unreadMentionedMeCount),notificationLevel:i.notificationLevel})})),Promise.resolve({code:A.SUCCESS,data:n})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:A.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:A.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),v(this,void 0,void 0,(function(){var n,r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),r=this._connMgr.codec.encodeClearUnreadCount({conversationType:b.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(i=new gr(Ir[Ir.updUgRTime],r,this.currentUserId)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(i)]):[2,A.RC_NET_UNAVAILABLE]:[2,Promise.resolve(A.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===A.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 v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h,d,p,g=this;return y(this,(function(f){switch(f.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new Tr(Ir[Ir.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,vi,{currentUserId:this.currentUserId,conversationType:b.ULTRA_GROUP})]):[2];case 1:return r=f.sent(),i=r.code,o=r.data,i===A.SUCCESS&&o?(a=o.list,u=o.isFinished,a.forEach((function(e){e.notificationStatus=B.CLOSE,e.notificationLevel=F.NOT_SET,e.isTop=!1,g._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,g._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(i,", try again")),s=setTimeout((function(){g._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:l=f.sent(),h=l.code,d=l.data,h!==A.SUCCESS&&this.logger.warn(exports.LogTagId.O,"pullConversationStatus fail code: ".concat(h,", data: ").concat(d)),p=Object.values(this._ultraGroupMap),p=ha(p),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Lt(p)),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 v(this,void 0,void 0,(function(){var e,t,n,r=this;return y(this,(function(i){switch(i.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return e=i.sent(),t=e.code,n=e.data,t===A.SUCCESS&&n?(this.logger.info(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){r._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c;return y(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Tr(Ir[Ir.pullUgMsg],t,this.currentUserId),r=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),r),[4,this._connMgr.send(n,li,{currentUserId:this.currentUserId,conversation:{conversationType:b.ULTRA_GROUP}})];case 1:return i=l.sent(),o=i.code,s=i.data,o===A.SUCCESS&&s?(a=s.list,u=s.syncTime,c=a.map((function(e){return e.messageUId})).join(","),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:c,timestamp:e,syncTime:u}),r)):this.logger.warn(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:e}),r),[2,{code:o,data:s}]}}))}))},t.prototype._getUltraGroup=function(e,t,n){var r,i,o,s=e.targetId,a=e.messageType,u=e.channelId,c=e.isCounted,l=e.channelType,h=e.sentTime,d=e.senderUserId,p=e.content,g=e.isMentioned,f=this._ultraGroupMap["".concat(u,"_").concat(s)],_=f||{conversationType:b.ULTRA_GROUP,targetId:s,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:B.CLOSE,notificationLevel:F.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==V.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=t,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),g&&(null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.type)!==K.ALL&&(null===(o=null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(_.unreadMentionedMeCount+=1)),_.versionTime=n,_.latestMessage=e,_.channelType=l,f||(this._ultraGroupMap["".concat(u,"_").concat(s)]=_),_},t.prototype._syncUltraMsg=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l=this;return y(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,r=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===A.SUCCESS&&r?(i=r.list,o=r.syncTime,s=r.finished,a={},u=[],i.forEach((function(e){var t,n,r,i=e.targetId,s=e.content,c=e.messageUId,h=e.channelId,d=e.isMentioned;if(l._ultraMsgMap[c])delete l._ultraMsgMap[c];else{var p=0;d&&((null===(t=null==s?void 0:s.mentionedInfo)||void 0===t?void 0:t.type)===K.ALL||(null===(r=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(l.currentUserId)))&&(p=1);var g=l._getUltraGroup(e,p,o);a["".concat(h,"_").concat(i)]=g,l._ultraGroupManager.addUltraGroupStatus(g),u.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(exports.LogTagId.O,"notice ultragroups"),c=Object.values(a),c=ha(c),this._watcher.conversation(Lt(c))),this.logger.debug(exports.LogTagId.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,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,h,d,p,g;return y(this,(function(f){switch(f.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(exports.LogTagId.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),i=t.messageId?t.messageId:Et(),t.messageId=i,o=this._connMgr.codec.encodeUpMsg({conversationType:b.ULTRA_GROUP,targetId:e},t),(s=new gr(Ir[Ir.ugMsg],o,e)).setHeaderQos(_n.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=la(b.ULTRA_GROUP,e,E({},t),"",a,this.currentUserId,i),n&&n(i),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:b.ULTRA_GROUP,targetId:e,channelId:t.channelId}),r),[4,this._connMgr.send(s)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return c=f.sent(),l=c.code,h=c.data,l!==A.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:u.messageUId,messageId:u.messageId}),r),u.sentStatus=exports.SentStatus.FAILED,[2,{code:l,data:u}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:l,messageUId:null==h?void 0:h.messageUId,messageId:null==h?void 0:h.messageId}),r),d=h,u.sentTime=d.timestamp,u.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,p=t.channelId||"",(g=this._ultraGroupMap["".concat(p,"_").concat(e)])?(g.latestMessage=u,be(g.channelType)&&(u.channelType=g.channelType)):(g={conversationType:b.ULTRA_GROUP,targetId:e,channelId:p,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:B.CLOSE,notificationLevel:F.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(p,"_").concat(e)]=g,this._ultraGroupManager.addUltraGroupStatus(g)),this._watcher.conversation(Lt([g])),[2,{code:l,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=e.conversationType,r=e.channelId,i=e.targetId,o=this._connMgr.codec.encodeOperateStatus(i,n,r||"",t||0),(s=new gr(Ir[Ir.operate],o,i)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==A.SUCCESS?[2,{code:a,msg:A[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(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:A.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(r=new Tr(Ir[Ir.qryMsg],n,this.currentUserId)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(r,Lo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==A.SUCCESS?[2,{code:o,msg:A[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,Uo),n=t.conversationType,r=t.info,i=t.summary;this.logger.debug(exports.LogTagId.O,"s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return v(this,void 0,void 0,(function(){var t,n,r;return y(this,(function(i){switch(i.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Tr(Ir[Ir.upMsgEx],t,e.targetId)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return(r=i.sent().code)!==A.SUCCESS?[2,{code:r,msg:A[r]}]:[2,{code:r}]}}))}))},t.prototype.modifyMessage=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new Tr(Ir[Ir.modifyMsg],t,e.targetId)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==A.SUCCESS?[2,{code:i,msg:A[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l;return y(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 Tr(Ir[Ir.qryMsgChange],t,this.currentUserId)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(n,So)]):[2];case 1:return r=h.sent(),i=r.code,o=r.data,this._isPullingUltraChangeMessage=!1,i===A.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=exports.UltraMsgChangeType.CHANNEL_CHANGE,r=exports.UltraMsgChangeType.MSG_RECALL,i=exports.UltraMsgChangeType.MSG_EXPANSION,o=exports.UltraMsgChangeType.MSG_MODIFY,s=exports.UltraMsgChangeType.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[r]&&this._handleMsgRecall(t[r]),t[i]&&this._handleMsgUpdate(t[i]),t[o]&&this._handleMsgUpdate(t[o]),t[s]&&this._handleUserGroupStatus(t[s])},t.prototype._handleUltraChannelChange=function(e){var t=this,n=[],r=[],i=[];e.forEach((function(e){var o=e.subChangeType,s=e.targetId,a=e.channelId,u=e.sendTime,c=e.operatorId,l="".concat(a,"_").concat(s),h=t._ultraGroupMap[l];if(h){var d=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE,p=exports.UltraMsgSubChangeType.PRIVATE_TO_PUBLIC,g=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=exports.UltraMsgSubChangeType.CHANNEL_DELETE,_=exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED;switch(o){case p:h.channelType=exports.UltraGroupChannelType.PUBLIC,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=exports.UltraGroupChannelType.PRIVATE,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete t._ultraGroupMap[l];break;case f:r.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:u}),delete t._ultraGroupMap[l];break;case _:i.push({targetId:s,channelId:a,userId:c,channelType:exports.UltraGroupChannelType.PRIVATE}),c===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),r.length>0&&this._watcher.ultraGroupChannelDelete(r),i.length>0&&this._watcher.ultraGroupChannelUserKicked(i)},t.prototype._handleMsgRecall=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.conversationType,u=e.operatorId,c=e.mentionedType;t._updateUltraGroupWhenRecallMsg(r,i,o,s,c),n.push({targetId:r,conversationType:a,sentTime:s,messageUId:o,senderUserId:u,channelId:i,content:{conversationType:a,targetId:r,messageUId:o,channelId:i},messageDirection:1,messageType:V.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,r=e.conversationType,i=e.sendTime,o=e.messageUId,s=e.channelId,a="".concat(r,"_").concat(n);t[a]||(t[a]=[]),t[a].push({messageUId:o,channelId:s,sendTime:i})})),t){var r=n.split("_"),i=r.shift(),o=r.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:o,conversationType:Number(i),messages:I([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c=this;return y(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(r=new Tr(Ir[Ir.qryMsg],n,this.currentUserId)).setHeaderQos(_n.AT_LEAST_ONCE),[4,this._connMgr.send(r,Lo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return i=l.sent(),o=i.code,s=i.data,o!==A.SUCCESS?[2,{code:o,msg:A[o]}]:(a=(s||{}).list,u=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=c._ultraGroupMap["".concat(n,"_").concat(t)];i&&i.latestMessage.messageUId===r&&(i.latestMessage=e),u.push(e)})),e===exports.UltraMsgChangeType.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===exports.UltraMsgChangeType.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h;return y(this,(function(d){return t=exports.UserGroupChangeType.REMOVE_USER_GROUP,n=exports.UserGroupChangeType.JOIN_USER_GROUP,r=exports.UserGroupChangeType.EXIT_USER_GROUP,i=exports.UserGroupChangeType.CHANNEL_BIND_USER_GROUP,o=exports.UserGroupChangeType.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],l=[],e.forEach((function(e){var h=e.conversationType,d=e.targetId,p=e.userGroupIds,g=e.busChannelType,f=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:h,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:h,targetId:d},userGroupIds:p});break;case r:u.push({conversation:{conversationType:h,targetId:d},userGroupIds:p});break;case i:c.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:g,userGroupIds:p});break;case o:l.push({conversation:{conversationType:h,targetId:d,channelId:f},channelType:g,userGroupIds:p})}})),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 r;return v(this,void 0,void 0,(function(){var i,o,s,a,u,c;return y(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr.codec.encodeGetHistoryMsg(e,t),o=new Tr(Ir[Ir.qryUgMsg],i,this.currentUserId),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:b.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,Ti,{currentUserId:this.currentUserId,conversation:{conversationType:b.ULTRA_GROUP,targetId:e}})]):[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,a===A.SUCCESS&&u?(c=[],null===(r=u.list)||void 0===r||r.forEach((function(e){e&&c.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(r=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),i=new Tr(Ir[Ir.ugUnpushSet],r,e),[4,this._connMgr.send(i)]):[2,{code:A.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:A.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,A.SUCCESS,[2,{code:s}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,r=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),i=new Tr(Ir[Ir.ugUnpushQuery],r,e),[4,n.send(i,uo)]):[2,{code:A.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:A.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===A.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[2,{code:s}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n,r,i){var o="".concat(t,"_").concat(e);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,u=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),r&&u<r&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(i===exports.UltraMentionedType.ALL||i===exports.UltraMentionedType.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,i===exports.UltraMentionedType.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(Lt([s])))}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:A.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Tr(Ir[Ir.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,ao)]):[2,Promise.resolve({code:A.METHOD_NOT_AVAILABLE})]:[2,{code:A.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===A.SUCCESS&&o?[2,{code:i,data:o}]:[2,{code:i}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i;return y(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,r=this._ultraGroupMap["".concat(n,"_").concat(t)]||{},i=r.firstUnreadMessage||null,[2,{code:A.SUCCESS,data:i}]):[2,Promise.resolve({code:A.METHOD_NOT_AVAILABLE})]:[2,{code:A.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i;return y(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),r=new Tr(Ir[Ir.setRtcRoomId],n,t),[4,this._connMgr.send(r)]):[2,A.RC_NET_UNAVAILABLE];case 1:return i=o.sent(),[2,i.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=r instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(r)):r,o=n?new Tr(t,i,e):new gr(t,i,e),[4,this._connMgr.send(o)]):[2,{code:A.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 v(this,void 0,void 0,(function(){var r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return r=Fo(this.rtcCodec,t,n),[4,this.rtcSignaling(e,Ir[Ir.rtcPing],!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,(a=s?this.rtcCodec.decode(ut.RtcOutput,s):null).version=dt(a.version),[2,{code:o,data:a}]}}))}))},t.prototype.getDeviceId=function(){return Zr(this.runtime)},t.prototype.getOSInfo=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){return[2,{code:A.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){return[2,{code:A.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){return[2,{code:A.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){es(),qs()},t.prototype.callExtra=function(e){return Promise.resolve({code:A.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,r){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,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(A.NOT_SUPPORT)}))},t.prototype.removeFromBlacklist=function(e){return new Promise((function(e){e(A.NOT_SUPPORT)}))},t.prototype.getBlacklist=function(){return new Promise((function(e){e({code:A.NOT_SUPPORT})}))},t.prototype.getBlacklistStatus=function(e){return new Promise((function(e){e({code:A.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,r,i){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,r){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,r,i,o){throw new Error("Method not implemented.")},t.prototype.searchMessagesByUser=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,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,r){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,r){throw new Error("Method not implemented.")},t.prototype.setCallInfo=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return(r=this._connMgr)?(i=r.codec.encodeSetCallInfo(t,n),[4,r.send(new Tr(Bn,i,e),xo)]):[3,2];case 1:return o=u.sent(),s=o.code,a=o.data,s===A.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:A.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:A.NOT_SUPPORT})},t.prototype.getProxy=function(){return Promise.resolve({code:A.NOT_SUPPORT})},t.prototype.testProxy=function(e,t){return Promise.resolve({status:A.NOT_SUPPORT})},t.prototype.setNetwork=function(e,t){this._connMgr.setNetwork(e,t)},t}(nn),pa=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.joinRTCRoom=function(e,t,n,r,i,o){return v(this,void 0,void 0,(function(){var s,a,u,c,l;return y(this,(function(h){switch(h.label){case 0:return s=Fo(this._context.rtcCodec,t,n,r,i,o),[4,this.rtcSignaling(e,wt,!0,s)];case 1:return a=h.sent(),u=a.code,c=a.buffer,u===A.SUCCESS&&c&&(l=Ho(this._context.rtcCodec,c)),[2,{code:u,data:l}]}}))}))},t.prototype.quitRTCRoom=function(e){return v(this,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(ut.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,bt,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return v(this,void 0,void 0,(function(){return y(this,(function(r){switch(r.label){case 0:return[4,this._context.rtcPing(e,t,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPingResVersion=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(ut.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Pt,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===A.SUCCESS&&i&&(o=this._context.rtcCodec.decode(ut.RtcRoomInfoOutput,i)),[2,{code:r,data:o}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s;return y(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(ut.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,xt,!0,t)];case 1:return n=a.sent(),r=n.code,i=n.buffer,r===A.SUCCESS&&i&&(s=Ho(this._context.rtcCodec,i),o={users:s.users}),[2,{code:r,data:o}]}}))}))},t.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},t.prototype.setRTCUserInfo=function(e,t,n){return v(this,void 0,void 0,(function(){var r;return y(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(ut.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,Dt,!0,r)];case 1:return[2,i.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return v(this,void 0,void 0,(function(){var n;return y(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(ut.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,Vt,!1,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return v(this,void 0,void 0,(function(){var s;return y(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(ut.RtcSetDataInput,{interior:r,target:i,key:t,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(e,Gt,!1,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),v(this,void 0,void 0,(function(){var o,s;return y(this,(function(a){switch(a.label){case 0:return o={objectName:r,content:this._context.rtcCodec.encode(ut.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(ut.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(ut.RtcValueInfo,{key:"mcu_uris",value:i},!0)]},s=this._context.rtcCodec.encode(ut.RtcUserSetDataInput,o),[4,this.rtcSignaling(e,Bt,!0,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return v(this,void 0,void 0,(function(){var r;return y(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(ut.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(ut.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,Bt,!0,r)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c;return y(this,(function(l){switch(l.label){case 0:return i=this._context.rtcCodec.encode(ut.RtcDataInput,{interior:n,target:r,key:t}),[4,this.rtcSignaling(e,kt,!0,i)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===A.SUCCESS&&a?(u=this._context.rtcCodec.decode(ut.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,r,i){return v(this,void 0,void 0,(function(){var o;return y(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(ut.RtcDataInput,{interior:n,target:r,key:t,objectName:null==i?void 0:i.name,content:null==i?void 0:i.content}),[4,this.rtcSignaling(e,Ft,!1,o)];case 1:return[2,s.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,r){return v(this,void 0,void 0,(function(){return y(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return r=Fo(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Ht,!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,o===A.SUCCESS&&s?(a=this._context.rtcCodec.decode(ut.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},t.prototype.setRTCState=function(e,t){return v(this,void 0,void 0,(function(){var n;return y(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(ut.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,Kt,!0,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(ut.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,qt,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===A.SUCCESS&&i?(o=Ho(this._context.rtcCodec,i),[2,{code:r,data:o}]):[2,{code:r}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return y(this,(function(l){switch(l.label){case 0:return r=Fo(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Yt,!0,r)];case 1:return i=l.sent(),o=i.code,s=i.buffer,o===A.SUCCESS&&s?(a=this._context.rtcCodec.decode(ut.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 v(this,void 0,void 0,(function(){var t,n;return y(this,(function(r){switch(r.label){case 0:return t=this._context.rtcCodec.encode(ut.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,jt,!0,t)];case 1:return n=r.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return r=this._context.rtcCodec.encode(ut.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,Jt,!0,r)];case 1:return i=u.sent(),o=i.code,s=i.buffer,o===A.SUCCESS&&s?(a=Ho(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},t.prototype.requestRoomPK=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u;return y(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=e.roomId,a=this._context.rtcCodec.encode(ut.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,timeoutTime:i,inviteInfo:o}),[4,this.rtcSignaling(s,Wt,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},t.prototype.cancelRoomPK=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=e.roomId,s=this._context.rtcCodec.encode(ut.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteInfo:i}),[4,this.rtcSignaling(o,Xt,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l;return y(this,(function(h){switch(h.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree,u=e.roomId,c=this._context.rtcCodec.encode(ut.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:r,content:i,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,zt,!0,c)];case 1:return l=h.sent().code,this._context.rtcKVManager.reset(),[2,l]}}))}))},t.prototype.endRoomPK=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=e.roomId,s=this._context.rtcCodec.encode(ut.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:r,inviteRoomKeys:i}),[4,this.rtcSignaling(o,Zt,!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,r){return this._context.rtcSignaling(e,t,n,r)},t.prototype.getRTCJoinedUserInfo=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o;return y(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(ut.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",$t,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===A.SUCCESS&&i?(o=this._context.rtcCodec.decode(ut.RtcQueryUserJoinedOutput,i).info||[],[2,{code:r,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:dt(e.joinTime)}}))}]):[2,{code:r}]}}))}))},t}(Cn);function ga(e){return E({},e)}var fa=function(){function e(e,t){var n,r;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[V.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[V.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[V.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[V.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[V.INTERCEPT]=this._processInterceptMessage.bind(this),n[V.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[V.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[V.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((r={})[V.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),r[V.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),r[V.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),r),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=E({},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 i={onConnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.DISCONNECTED),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this),messageDelivered:this._messageDeliveredListerer.bind(this),groupMessageDeliveredStatus:this._groupMessageDeliveredStatusListerer.bind(this),callInfo:this._callInfoListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this)};this.rtcCodec=this.createCodec(en,tn),this._engine=St()?new RCCppEngine(e,this.rtcCodec,i,this._options):new da(e,this.rtcCodec,i,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new At(this._engine)}return e.init=function(t,n){if(this._context)return this._context.logger.warn(exports.LogTagId.A_INIT_REPEAT_O),this._context;this._context=new e(t,n),this._context.logger.info(exports.LogTagId.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(exports.LogTagId.L_IMSDK_VER_O,JSON.stringify({commitId:"8733f13c4f051f4e58aedf9b86db72639c36ecbb",version:"5.7.10"}));var r=this._context._engine;return t.setNetworkStatusListener(r.setNetwork.bind(r)),this._context},e.destroy=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(exports.LogTagId.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return e.sent(),this._context=void 0,[2]}}))}))},e.prototype.createCodec=function(e,t){return new an(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(exports.LogTagId.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(exports.LogTagId.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var r="RCRTC"===e.tag?new pa(this):new Cn(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(r,this._runtime,t)}catch(e){this.logger.error(exports.LogTagId.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,n)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&(this._pluginContextQueue.push(r),this._pluginInstanseMap[e.tag]=i),i},e.prototype._onConnectionStatusChange=function(e,t){var n,r;this.logger.warn(exports.LogTagId.A_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),null===(r=(n=this._watcher).connection)||void 0===r||r.call(n,e,t),this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onconnectionstatechange)||void 0===r||r.call(n,e,t)}))},e.prototype._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(ga(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===b.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===exports.MessageBlockSourceType.MSG_EXPANSION||n===exports.MessageBlockSourceType.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(exports.LogTagId.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0},e.prototype._processChrmSyncMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:e.content.chatroomId,status:e.content.status,reason:e.content.reason,time:e.content.time,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBlockMessage=function(e){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,r=this._engine.getCurrentUserId();n&&Array.isArray(n[r])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[r])},e.prototype._messageReceiver=function(e,t,n){var r,i,o,s,a=this;if(!(null===(i=(r=this._compatibleMessageProccessor)[e.messageType])||void 0===i?void 0:i.call(r,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(ga(e))}catch(e){return a.logger.error(exports.LogTagId.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,ga(e),t,n),!this._messageProccessor[e.messageType])return e;this._messageProccessor[e.messageType](e)}},e.prototype._batchMessageReceiver=function(e,t,n){var r=this,i=[];e.forEach((function(e){var o=r._messageReceiver(e,t,n);o&&i.push(o)})),i.length&&this._watcher.batchMessage&&(this.logger.debug(exports.LogTagId.L_BATCH_MESSAGE_O,i.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(i))},e.prototype._chatroomInfoListener=function(e){var t,n;null===(n=(t=this._watcher).chatroomState)||void 0===n||n.call(t,e)},e.prototype._conversationInfoListener=function(e){var t,n;null===(n=(t=this._watcher).conversationState)||void 0===n||n.call(t,e)},e.prototype._expansionInfoListener=function(e){var t,n;null===(n=(t=this._watcher).expansion)||void 0===n||n.call(t,e)},e.prototype._tagListener=function(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)},e.prototype._conversationTagListener=function(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)},e.prototype._typingStatusListener=function(e){var t,n;null===(n=(t=this._watcher).typingState)||void 0===n||n.call(t,e)},e.prototype._pullFinishedListener=function(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)},e.prototype._MessageBlockedListener=function(e){var t,n;null===(n=(t=this._watcher).messageBlocked)||void 0===n||n.call(t,e)},e.prototype._messageDeliveredListerer=function(e){var t,n;null===(n=(t=this._watcher).messageDelivered)||void 0===n||n.call(t,e)},e.prototype._groupMessageDeliveredStatusListerer=function(e){var t,n;null===(n=(t=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(t,e)},e.prototype._callInfoListener=function(e){var t=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(e)}catch(e){t.logger.warn(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype._ultraGroupEnableListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupEnable)||void 0===n||n.call(t,e)},e.prototype._operateStatusListener=function(e){var t,n;null===(n=(t=this._watcher).operateStatus)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageModifiedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageRecalledListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelDeleteListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(t,e)},e.prototype._userGroupStatusListener=function(e){var t,n;null===(n=(t=this._watcher).userGroupStatus)||void 0===n||n.call(t,e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onrtcdatachange)||void 0===r||r.call(n,e,t)}))},e.prototype._naviDataChange=function(e){this._pluginContextQueue.forEach((function(t){var n;null===(n=t.onnavidatachange)||void 0===n||n.call(t,e)}))},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t._watcher[n]=Ge(r)||Ve(r)?r:void 0}}))},e.prototype._resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,o=e.channelId,s=i.typingContentType,a=o||"",u="".concat(n,"#").concat(r,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[u][c].messageType===s?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.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 v(this,void 0,void 0,(function(){return y(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var r,i;return v(this,void 0,void 0,(function(){var o,s,a,u,c;return y(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!==A.SUCCESS?[2,{code:a}]:(1!==this._engine.getNaviInfoFromCache().type&&(c=Qe.getInfo(),null===(i=(r=this._engine).reportSDKInfo)||void 0===i||i.call(r,c)),[2,{code:a,userId:u}])}}))}))},e.prototype.disconnect=function(e){return v(this,void 0,void 0,(function(){var t=this;return y(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){t.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}})),[2,Promise.resolve()]}}))}))},e.prototype.reconnect=function(e){return this.connect(this.token,!!e,this.logger.createTraceId())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i=!1),Pe(r)&&r.length>0&&(this._registerMessageSearchPropsMapping[e]=r),this._engine.registerMessageType(e,t,n,r,i)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],r={};return n&&Ve(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var i=t[e];be(i)&&(i>-Math.pow(2,64)&&i<Math.pow(2,64)&&Number.isInteger(i)||(r[e]=i))}})),Object.keys(r).length>0?{msg:JSON.stringify(r),code:A.SEARCH_PROPS_LIMIT_ERROR}:{code:A.SUCCESS}},e.prototype.sendMessage=function(e,t,n,r,i){var s=this.checkSearchPropsMsg(n.messageType,n.content),a=s.code,u=s.msg;if(a!==A.SUCCESS)return Promise.resolve({code:a,msg:u});if(e!==b.ULTRA_GROUP){var c=this.getNaviInfoFromCache();if(1===((null==c?void 0:c.grpRRVer)||0)&&n.messageType===V.READ_RECEIPT_RESPONSE)return Promise.resolve({code:A.READ_RECEIPT_ERROR})}var l=n.canIncludeExpansion,h=void 0!==l&&l,d=n.expansion;if(h){var p=qe(d),g=p.isIllgalEx,f=p.isExKeyOrValLengthExceedLimit;if(p.isExceedLimit||f)return Promise.resolve({code:A.EXPANSION_LIMIT_EXCEET});if(g)return Promise.resolve({code:A.BIZ_ERROR_INVALID_PARAMETER})}var _,T,E=JSON.stringify(n.content);return _=E,void 0===T&&(T="utf-8"),("utf-16"===T?R(_):S(_))>o?Promise.resolve({code:A.RC_MSG_CONTENT_EXCEED_LIMIT}):e===b.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,r,i):this._engine.sendMessage(e,t,n,r,i)},e.prototype.sendExpansionMessage=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,h;return y(this,(function(d){switch(d.label){case 0:return t=e.channelId,n=e.conversationType,r=e.targetId,i=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(u=qe(s),c=u.isIllgalEx,l=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||l?[2,Promise.resolve({code:A.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:A.BIZ_ERROR_INVALID_PARAMETER})]:(h={mid:i},s&&(h.put=s),o&&(h.del=o),a&&(h.removeAll=1),[4,this._engine.sendMessage(n,r,{content:h,messageType:V.EXPANSION_NOTIFY,channelId:t})])):[2,{code:A.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return v(this,void 0,void 0,(function(){var r;return y(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:A.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 v(this,void 0,void 0,(function(){var r;return y(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:A.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){return v(this,void 0,void 0,(function(){var e=this;return y(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(exports.LogTagId.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,r,i,o,s,a){if(void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),void 0===s&&(s=""),e===b.ULTRA_GROUP){var u={timestamp:n,count:r,order:i,channelId:o};return this._engine.getUltraHistoryMsg(t,u,a)}return this._engine.getHistoryMessage(e,t,n,r,i,o,s||"",a)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,r,i,o,s)},e.prototype.getConversationList=function(e,t,n,r,i){if(void 0===e&&(e=300),void 0===i&&(i=""),t===b.ULTRA_GROUP){var o=A.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:A[o]})}return this._engine.getConversationList(e,t,n,r,i)},e.prototype.getConversationsByPage=function(e,t,n,r){return this._engine.getConversationsByPage(e,t,n,r)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===b.ULTRA_GROUP?Promise.resolve(A.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===b.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(b.ULTRA_GROUP)){var r=A.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:A[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[b.PRIVATE,b.GROUP,b.SYSTEM,b.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,r){return void 0===r&&(r=""),v(this,void 0,void 0,(function(){var i;return y(this,(function(o){return i=[{conversationType:e,targetId:t,notificationLevel:n,channelId:r}],[2,this._engine.batchSetConversationStatus(i)]}))}))},e.prototype.setConversationStatus=function(e,t,n,r,i){if(void 0===i&&(i=""),e===b.ULTRA_GROUP&&void 0!==n)return Promise.resolve(A.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,r){return void 0===r&&(r=""),this._engine.saveConversationMessageDraft(e,t,n,r)},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,r,i){return this._engine.recallMsg(e,t,n,r,i)},e.prototype.deleteRemoteMessage=function(e,t,n,r){return void 0===r&&(r=""),e===b.ULTRA_GROUP?Promise.resolve(A.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,r)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)},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,r=t.value;return _t(n)&&Tt(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(A.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,o=r.value;if(!_t(i)||!Tt(o))return Promise.resolve({code:A.BIZ_ERROR_INVALID_PARAMETER})}var s=E(E({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return _t(n)&&Tt(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(A.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return _t(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(A.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!_t(r))return Promise.resolve({code:A.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return _t(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(A.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,r){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===r&&(r=0),this._engine.getChatroomHistoryMessages(e,r,t,n)},e.prototype.getFileToken=function(e,t,n,r){return v(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return y(this,(function(h){switch(h.label){case 0:return i=this.getNaviInfoFromCache(),o=(null==i?void 0:i.bosAddr)||"",s=(null==i?void 0:i.uploadServer)||"",a=(null==i?void 0:i.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,r)];case 1:return u=h.sent(),c=u.code,l=u.data,c===A.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,r,i){return void 0===i&&(i=Y.QINIU),v(this,void 0,void 0,(function(){var o,s,a;return y(this,(function(u){switch(u.label){case 0:return(null==r?void 0:r.isBosRes)?[2,Promise.resolve(r)]:[4,this._engine.getFileUrl(e,i,t,n)];case 1:return o=u.sent(),s=o.code,a=o.data,s===A.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return t.length>1e3?[2,Promise.reject(A.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return v(this,void 0,void 0,(function(){return y(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return v(this,void 0,void 0,(function(){return y(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=[b.PRIVATE,b.CHATROOM,b.GROUP,b.SYSTEM,b.APP_PUBLIC_SERVICE,b.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t)},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[b.PRIVATE,b.CHATROOM,b.GROUP,b.SYSTEM,b.APP_PUBLIC_SERVICE,b.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!==b.ULTRA_GROUP){var t=A.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:A[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return y(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,r=e.canIncludeExpansion,t!==b.ULTRA_GROUP?[2,{code:i=A.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:A[i]}]:r?(o=qe(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:A.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:A.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:A.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return v(this,void 0,void 0,(function(){var t;return y(this,(function(n){switch(n.label){case 0:return e.conversationType!==b.ULTRA_GROUP?[2,{code:t=A.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:A[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=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this._engine).callExtra.apply(t,I([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 v(this,void 0,void 0,(function(){return y(this,(function(n){return[2,this._engine.clearConversations(e,t)]}))}))},e.prototype.setUserStatusListener=function(e,t){var n=this;return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){n.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return v(this,void 0,void 0,(function(){var r,i,o;return y(this,(function(s){return r=this.checkSearchPropsMsg(n.messageType,n.content),i=r.code,o=r.msg,i!==A.SUCCESS?[2,Promise.resolve({code:i,msg:o})]:[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.batchInsertMessage=function(e,t){return this._engine.batchInsertMessage(e,t)},e.prototype.getMessageCount=function(e,t,n){return void 0===n&&(n=""),v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),v(this,void 0,void 0,(function(){return y(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,r,i)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return v(this,void 0,void 0,(function(){return y(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,r){return v(this,void 0,void 0,(function(){return y(this,(function(i){return[2,this._engine.updateMessageReceiptStatus(e,t,n,r)]}))}))},e.prototype.setUserStatus=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return v(this,void 0,void 0,(function(){return y(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,r){return void 0===t&&(t=[]),void 0===n&&(n=""),v(this,void 0,void 0,(function(){return y(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),v(this,void 0,void 0,(function(){return y(this,(function(r){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,r,i,o,s){return void 0===s&&(s=""),v(this,void 0,void 0,(function(){return y(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,r,i,o,s)]}))}))},e.prototype.searchMessagesByUser=function(e,t,n,r,i,o){return void 0===i&&(i=5),void 0===o&&(o=""),v(this,void 0,void 0,(function(){return y(this,(function(s){return[2,this._engine.searchMessagesByUser(e,t,n,r,i,o)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){return v(this,void 0,void 0,(function(){return y(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,r,i)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,o,s){return v(this,void 0,void 0,(function(){return y(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,r,i,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(e,t,n,r)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){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,r,i,o){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return v(this,void 0,void 0,(function(){return y(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,r){return this._engine.rtcSignaling(e,t,n,r)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e.prototype.setProxy=function(e){return this._engine.setProxy(e)},e.prototype.getProxy=function(){return this._engine.getProxy()},e.prototype.testProxy=function(e,t){return this._engine.testProxy(e,t)},e}(),_a=l;exports.AConnectionMgr=xs,exports.AEngine=nn,exports.APIContext=fa,exports.AppStorage=f,exports.BasicLogger=Qo,exports.BasicNavi=jr,exports.BasicReporter=Ts,exports.BasicStatistic=$s,exports.BasicStatisticReporter=ea,exports.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},exports.CallLibMsgType={"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"},exports.ChatroomEntryType=z,exports.ChatroomSyncStatusReason=Le,exports.ChatroomUserChangeType=ee,exports.ChrmMemBanType=he,exports.ChrmMemOperateType=ce,exports.ChrmSyncStatus=ae,exports.Codec=an,exports.ConnectionStatus=x,exports.ConversationType=b,exports.DB_LOG_FLUSH_FREQUENCY=3e3,exports.DB_LOG_MAX_SIZE=1e5,exports.DelayTimer=Nt,exports.ErrorCode=A,exports.EventEmitter=Ye,exports.FORMATED_VERSION=h,exports.FileType=M,exports.HTTP_TIMEOUT=6e4,exports.IM_CHATROOM_PULL_INTERVAL_TIME=s,exports.IM_PING_INTERVAL_TIME=15e3,exports.IM_PING_MIN_TIMEOUT=2e3,exports.IM_PING_TIMEOUT=15e3,exports.IM_SIGNAL_TIMEOUT=3e4,exports.IndexDBLogger=_s,exports.IndexDBReporter=Ns,exports.IndexDBStatistic=na,exports.IndexDBStatisticReporter=ca,exports.MAX_MESSAGE_CONTENT_BYTES=o,exports.MAX_MESSAGE_EXPANSION_KEY_LENGTH=32,exports.MAX_MESSAGE_EXPANSION_VAL_LENGTH=4096,exports.MAX_UPLOAD_FILE_SIZE=5368709120,exports.MentionedType=K,exports.MessageBlockType=ne,exports.MessageDirection=N,exports.MessageType=V,exports.NAVI_CACHE_DURATION=r,exports.NAVI_REQ_TIMEOUT=i,exports.NotificationLevel=F,exports.NotificationStatus=B,exports.ONE_LOG_SIZE_MAX=1e3,exports.OperateStatus=oe,exports.PluginContext=Cn,exports.RCAssertError=lt,exports.REAT_TIME_LOG_SIZE=20971520,exports.RTCPluginContext=pa,exports.ReceivedStatus=n,exports.SEND_MESSAGE_TYPE_OPTION=u,exports.STATUS_MESSAGE=c,exports.STORAGE_ROOT_KEY=a,exports.UPLOAD_FILE_CHUNK_SIZE=10485760,exports.UploadMethod=Y,exports.VERSION=l,exports.VersionManage=Qe,exports.WEB_SOCKET_TIMEOUT=5e3,exports.WebSocketNavi=Wr,exports.appendUrl=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},exports.assert=function(e,t,n,r){if(void 0===r&&(r=!1),!ht(e,t,n,r))throw new lt("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},exports.clone=Lt,exports.cloneByJSON=Rt,exports.deInitLogDB=es,exports.forEach=yt,exports.getBrowser=Ot,exports.getClientMessageId=Et,exports.getMimeKey=function(e){var t="application/octet-stream";switch(e){case M.IMAGE:t="image/jpeg";break;case M.AUDIO:t="audio/amr";break;case M.VIDEO:t="video/3gpp";break;case M.SIGHT:t="video/mpeg4";break;case M.COMBINE_HTML:t="text/html"}return t},exports.getUUID=it,exports.getUUID22=ot,exports.getUploadFileName=pt,exports.getbundleId=vt,exports.indexOf=Ct,exports.initLogDB=$o,exports.initStatisticDB=Ks,exports.isArray=Pe,exports.isArrayBuffer=xe,exports.isBoolean=function(e){return"boolean"==typeof e},exports.isConnnectAck=function(e){return Object.keys(ws).some((function(t){return ws[t]===e}))},exports.isDisconnectedByServer=function(e){return Object.keys(As).some((function(t){return As[t]===e}))},exports.isFunction=Ge,exports.isHttpUrl=ke,exports.isInObject=mt,exports.isInclude=function(e,t){return-1!==Ct(e,t)},exports.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},exports.isNumber=be,exports.isObject=Ve,exports.isString=we,exports.isTypeInConversationList=function(e){return[b.PRIVATE,b.GROUP,b.SYSTEM,b.PUBLIC_SERVICE,b.APP_PUBLIC_SERVICE].includes(e)},exports.isUndefined=Be,exports.isValidChannelId=Ke,exports.isValidChrmEntryKey=_t,exports.isValidChrmEntryValue=Tt,exports.isValidConversationType=He,exports.isValidExpansion=qe,exports.isValidFileType=function(e){return be(e)&&Object.prototype.hasOwnProperty.call(M,e)},exports.isValidNotificationLevel=function(e){return be(e)&&Object.prototype.hasOwnProperty.call(F,e)},exports.logger=rt,exports.map=It,exports.notEmptyArray=function(e){return Pe(e)&&e.length>0},exports.notEmptyObject=Fe,exports.notEmptyString=De,exports.pushConfigsToJSON=gt,exports.pushJSONToConfigs=ft,exports.statisticTranscsv=Ws,exports.todo=function(e){return new m(e)},exports.transcsv=Ls,exports.unInitStatisticDB=qs,exports.urlCenter=In,exports.usingCppEngine=St,exports.validate=ht,exports.version=_a;