@rongcloud/engine 5.4.4 → 5.4.5

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=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],i=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],o=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],s={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0},"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},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{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:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},a=["RC:TypSts","RC:InterceptMsg"];exports.CONNECTION_TYPE=void 0,(t=exports.CONNECTION_TYPE||(exports.CONNECTION_TYPE={})).WEBSOCKET="websocket",t.COMET="comet";var u,c=function(e){return u||(u={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}}),u},h=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),l=function(){function e(e,t){var n,r=t?"".concat("RCV4-").concat(t):"RCV4-";this._rootStorage=c(e);var i=this._rootStorage.get(r)||{};this._cache=new h(((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}(),d=function(e,t){return d=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])},d(e,t)};function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var f=function(){return f=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},f.apply(this,arguments)};function _(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 m(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function T(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 y,v=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return p(t,e),t}(Error),E=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e=e.replace(r,(function(e){return e.toUpperCase()}))},I=function(e,t){void 0===t&&(t="utf-8");var n,r=0;if("utf-16"===t)for(var i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<=65535?2:4;else for(i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<127?1:n<=2047?2:n<=65535?3:4;return r},C=function(e){return e.match(/\d+(\.\d+){2}/)[0]};!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"}(y||(y={}));var R,S=y;!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"}(R||(R={}));var N,O=R,M=function(e){return"string"==typeof e},U=function(e){return"boolean"==typeof e},A=function(e){return"number"==typeof e&&!isNaN(e)},L=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},w=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},b=function(e){return M(e)&&e.length>0},P=function(e){return"[object Object]"===Object.prototype.toString.call(e)},D=function(e){return"[object Function]"===Object.prototype.toString.call(e)},x=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},V=function(e){return"[object Null]"===Object.prototype.toString.call(e)},k=function(e){for(var t in e)return!0;return!1},G=function(e){return A(e)&&Object.prototype.hasOwnProperty.call(S,e)},B=function(e){var t=!1;return M(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},F=function(e){var t=!1,n=!1,r=!1;if(P(e)){var i=Object.keys(e).length;for(var o in t=i>20,e)if(n||(n=M(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}};!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(N||(N={}));var H,K=N;!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_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",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_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",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_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",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_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",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_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",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"}(H||(H={}));var q,Y=H;!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.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"}(q||(q={}));var j,Q=q,W={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18};!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.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.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(j||(j={}));var J,z=j;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(J||(J={}));var Z,X=J;!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"}(Z||(Z={}));var $,ee=Z;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}($||($={}));var te,ne=$;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(te||(te={}));var re,ie=te;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(re||(re={}));var oe,se,ae,ue,ce=re;exports.LogLevel=void 0,(oe=exports.LogLevel||(exports.LogLevel={}))[oe.LOG=0]="LOG",oe[oe.DEBUG=0]="DEBUG",oe[oe.INFO=1]="INFO",oe[oe.WARN=2]="WARN",oe[oe.ERROR=3]="ERROR",oe[oe.FATAL=4]="FATAL",oe[oe.STATISTICS=6]="STATISTICS",oe[oe.NONE=1e3]="NONE",exports.LogSource=void 0,(se=exports.LogSource||(exports.LogSource={})).IM="IM",se.RTC="RTC",exports.LogTagId=void 0,(ae=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",ae.A_INIT_O="A-init-O",ae.L_INIT_O="L-init-O",ae.P_INIT_O="P-init-O",ae.A_CONNECT_T="A-connect-T",ae.A_CONNECT_R="A-connect-R",ae.A_CONNECT_S="A-connect-S",ae.A_DISCONNECT_O="A-disconnect-O",ae.A_RECONNECT_T="A-reconnect-T",ae.A_RECONNECT_R="A_RECONNECT_R",ae.L_CONNECT_T="L-connect-T",ae.L_CONNECT_R="L-connect-R",ae.L_CONNECT_S="L-connect-S",ae.P_CONNECT_O="P-connect-O",ae.P_CONNECT_S="P-connect-S",ae.A_SEND_MSG_T="A-send_msg-T",ae.A_SEND_MSG_R="A-send_msg-R",ae.P_SEND_MSG_T="P-send_msg-T",ae.P_SEND_MSG_R="P-send_msg-R",ae.L_SEND_MSG_T="L-send_msg-T",ae.L_SEND_MSG_R="L-send_msg-R",ae.L_PULL_MSG_T="L-pull_msg-T",ae.L_PULL_MSG_R="L-pull_msg-R",ae.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",ae.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",ae.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",ae.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",ae.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",ae.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",ae.A_DELETE_MESSAGES_S="A-delete_messages-S",ae.P_DELETE_MSG_S="P-delete_msg-S",ae.L_PULL_CONVERSATION_S="L-pull_conversation-S",ae.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",ae.A_REGTYP_O="A-regtyp-O",ae.P_REGTYP_O="P-regtype-O",ae.P_REGTYP_E="P-regtype-E",ae.L_GET_NAVI_T="L-get_navi-T",ae.L_GET_NAVI_R="L-get_navi-R",ae.L_ENV_S="L-Env-S",ae.L_GET_INDEX_NAVI_S="L-get_index_navi-S",ae.A_JOIN_CHATROOM_T="A-join_chatroom-T",ae.A_JOIN_CHATROOM_R="A-join_chatroom-R",ae.L_JOIN_CHATROOM_T="L-join_chatroom-T",ae.L_JOIN_CHATROOM_R="L-join_chatroom-R",ae.A_QUIT_CHATROOM_T="A-quit_chatroom-T",ae.A_QUIT_CHATROOM_R="A-quit_chatroom-R",ae.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",ae.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",ae.L_MEDIA_S="L-media-S",ae.L_MEDIA_UPLOAD_T="L-media_upload-T",ae.L_MEDIA_UPLOAD_R="L-media_upload-R",ae.G_UPLOAD_LOG_S="G-upload_log-S",ae.G_UPLOAD_LOG_E="G-upload_log-E",ae.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",ae.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",ae.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",ae.A_GET_HISTORY_MSG_T="A-get_history_msg-T",ae.A_GET_HISTORY_MSG_R="A-get_history_msg-R",ae.L_GET_HISTORY_MSG_T="L-get_history_msg-T",ae.L_GET_HISTORY_MSG_R="L-get_history_msg-R",ae.A_CALLBACK_O="A-callback-O",ae.A_CALLBACK_E="A-callback-E",function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ue||(ue={}));var he,le=ue;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(he||(he={}));var de,pe=he;!function(e){e[e.typing=0]="typing"}(de||(de={}));var fe,ge,_e,me,Te,ye,ve,Ee=de;exports.UltraGroupChannelType=void 0,(fe=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[fe.PUBLIC=0]="PUBLIC",fe[fe.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,(_e=exports.UltraMsgChangeType||(exports.UltraMsgChangeType={}))[_e.MSG_EXPANSION=1]="MSG_EXPANSION",_e[_e.MSG_MODIFY=2]="MSG_MODIFY",_e[_e.MSG_RECALL=3]="MSG_RECALL",_e[_e.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",exports.UltraMsgSubChangeType=void 0,(me=exports.UltraMsgSubChangeType||(exports.UltraMsgSubChangeType={}))[me.CHANNEL_DELETE=1]="CHANNEL_DELETE",me[me.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",me[me.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",me[me.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",me[me.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",me[me.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.RTCMode=void 0,(Te=exports.RTCMode||(exports.RTCMode={}))[Te.RTC=0]="RTC",Te[Te.LIVE=2]="LIVE",exports.LiveType=void 0,(ye=exports.LiveType||(exports.LiveType={}))[ye.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",ye[ye.AUDIO=1]="AUDIO",exports.LiveRole=void 0,(ve=exports.LiveRole||(exports.LiveRole={}))[ve.ANCHOR=1]="ANCHOR",ve[ve.AUDIENCE=2]="AUDIENCE";var Ie,Ce,Re,Se={"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.RTCApiType=void 0,(Ie=exports.RTCApiType||(exports.RTCApiType={}))[Ie.ROOM=1]="ROOM",Ie[Ie.PERSON=2]="PERSON",exports.RTCIdentityChangeType=void 0,(Ce=exports.RTCIdentityChangeType||(exports.RTCIdentityChangeType={}))[Ce.AnchorToViewer=1]="AnchorToViewer",Ce[Ce.ViewerToAnchor=2]="ViewerToAnchor",exports.RTCJoinType=void 0,(Re=exports.RTCJoinType||(exports.RTCJoinType={}))[Re.KICK=0]="KICK",Re[Re.REFUSE=1]="REFUSE",Re[Re.COEXIST=2]="COEXIST";var Ne="RC_Logs";function Oe(e){var t=e.target.result;if(1===e.oldVersion)try{t.deleteObjectStore(Ne)}catch(e){console.warn("version 1 indexDB delete error, name: ".concat(e.name,", message: ").concat(e.message,", stack: ").concat(e.stack))}!function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=f({},n.objectStoreParams);r=e.createObjectStore(t,i),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,Ne,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var Me,Ue=function(){function e(){}return e.init=function(){if("undefined"!=typeof window&&window&&window.indexedDB){if(e.indexDBSwitch&&!e.opening){e.opening=!0;var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(t){e.opening=!1,console.warn("open indexDB request failed "+t.target.error)},t.onsuccess=function(t){e.opening=!1,e._db=t.target.result,e._db&&(e._db.onclose=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has unexpectedly closed."),t),e._db=null,e._instance=null},e._db.onerror=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening error."),t),e._db=null,e._instance=null},e._db.onabort=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening aborted."),t),e._db=null,e._instance=null}),e._instance=new e},t.onupgradeneeded=function(t){e.opening=!1,e._db=t.target.result,Oe(t)}}}else console.debug("IndexDB is not currently supported in the environment!")},e.getInstance=function(){return e._instance},e.prototype.addList=function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),o=i.objectStore(t);n.forEach((function(e){null==o||o.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))},e.prototype.getRangeData=function(t,n,r,i){return new Promise((function(o){if(e._db){var s=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),u=s.index(n),c=[],h=u.openCursor(a);h.onsuccess=function(e){var t=e.target.result;t?(c.push(t.value),t.continue()):o(c)},h.onerror=function(e){console.error(e),o([])}}else o([])}))},e.prototype.getCount=function(t,n){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readonly").objectStore(t).count();r.onsuccess=function(){n(r.result)},r.onerror=function(e){console.error(e),n(0)}}else n(0)}))},e.prototype.removeFirstData=function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),o=i.getAllKeys(IDBKeyRange.lowerBound(0),r);o.onsuccess=function(){var e=o.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))},e._db=null,e.indexDBSwitch=!0,e.opening=!1,e}(),Ae=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)}))},Le=function(){var e=Ae();if(e=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))).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},we=Le(),be={};function Pe(e){return 4-e}console&&((Me={})[exports.LogLevel.DEBUG]=console.debug.bind(console),Me[exports.LogLevel.INFO]=console.info.bind(console),Me[exports.LogLevel.WARN]=console.warn.bind(console),Me[exports.LogLevel.ERROR]=console.error.bind(console),Me[exports.LogLevel.FATAL]=console.log.bind(console),be=Me);var De=[],xe=function(e){return M(e)||A(e)||x(e)||U(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)};function Ve(e,t,n,r){t=/^[\w]+-[\w]+-[\w]+?/.test(t)?t:"L-".concat(t,"-O"),r||(r=["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(t)?exports.LogSource.RTC:exports.LogSource.IM);var i=Date.now(),o="";try{o=(o=JSON.stringify({message:n,userId:Ge.userId})).replace(/"/g,'""'),o='"'.concat(o,'"')}catch(e){ze(exports.LogTagId.G_UPLOAD_LOG_E,{name:e.name,message:e.message,stack:e.stack})}I(o)>=1e3&&(o=function(e,t,n){if(void 0===n&&(n="utf-8"),!e||!t)return"";var r="utf-8"===n?3:2,i=0,o=0,s="";for(o=0;o<e.length;o++){if(e.charCodeAt(o)>255?i+=r:i++,i>t)return s;s+=e.charAt(o)}return e}(o,1e3));var s=Pe(e),a={sessionId:we,time:i,level:s,content:"".concat(we,",").concat(Date.now(),",").concat(r,",").concat(s,",").concat(t,",").concat(o,"\n"),userId:Ge.userId};return De.push(a),a}function ke(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];console&&be[e]&&be[e].apply(be,T(["".concat(t,":")],n,!1))}var Ge={localLogLevel:exports.LogLevel.WARN,userId:""},Be=-1;Be>=0&&(clearInterval(Be),Be=-1),"undefined"!=typeof window&&window&&window.indexedDB&&(Be=setInterval((function(){De.length&&function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:if(!(t=Ue.getInstance()))return[3,6];i.label=1;case 1:return i.trys.push([1,4,,5]),[4,t.addList(Ne,e)];case 2:return n=i.sent(),[4,t.getCount(Ne,"time")];case 3:return i.sent()>1e5&&t.removeFirstData(Ne,"time",2e3),[2,n];case 4:return r=i.sent(),ze(exports.LogTagId.G_UPLOAD_LOG_E,{name:r.name,message:r.message,stack:r.stack}),[2,!1];case 5:return[3,7];case 6:return Ue.init(),[2,!1];case 7:return[2]}}))}))}(De.slice()).then((function(e){e&&(De=[])}))}),3e3));var Fe=Date.now(),He=0;function Ke(){var e=Date.now();return Fe!==e&&(Fe=e,He=0),"".concat(Fe,"-").concat(He++)}function qe(e){!e.customLogPrint&&delete e.customLogPrint,Ge=Object.assign(Ge,e)}function Ye(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),e>exports.LogLevel.DEBUG&&(r&&(n=Object.assign(n,r)),Ve(e,t,n,null==r?void 0:r.logSource)),e>=Ge.localLogLevel){var i="".concat((new Date).toISOString(),"[").concat(t,"][").concat(exports.LogLevel[e],"]"),o="".concat(i," - ").concat(xe(n));Ge.customLogPrint?Ge.customLogPrint(e,o):ke(e,i,xe(n))}}var je,Qe=Ye.bind(null,exports.LogLevel.DEBUG),We=Ye.bind(null,exports.LogLevel.INFO),Je=Ye.bind(null,exports.LogLevel.WARN),ze=Ye.bind(null,exports.LogLevel.ERROR),Ze=Ye.bind(null,exports.LogLevel.FATAL),Xe=Object.freeze({__proto__:null,sessionId:we,logLevelTransformer:Pe,formatLogObj:xe,insertIntoLogCache:Ve,_defaultStdout:ke,ID:Ke,init:qe,log:Ye,debug:Qe,info:We,warn:Je,error:ze,fatal:Ze}),$e=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"}},et=function(e){var t="RCDeviceId",n=c(e),r="",i=n.get(t);return i?r=i:(r=Le(),n.set(t,r)),r},tt=function(){function e(){}return e.compress=function(e){for(var t=this,n={},r=0;r<e.length-1;r++){var i=e.charAt(r)+e.charAt(r+1);n.hasOwnProperty(i)?n[i].push(r):n[i]=[r]}for(var o=[],s=[],a=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);o.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);o.push(i)}o.push(e)}},u=0;u<e.length;){var c=t.indexOf(n,e,u);if(c.length<2)s.push(e.charAt(u++));else if(c.length<4)s.push(e.substr(u,c.length)),u+=c.length;else{var h=t.numberEncode(u-c.offset),l=t.numberEncode(c.length);if(h.length+l.length>=c.length)s.push(e.substr(u,c.length)),u+=c.length;else{a();var d=String.fromCharCode(t.dataType.Compressed|h.length<<2|l.length);o.push(d+h+l),u+=c.length}}}a();var p=t.numberEncode(e.length),f=String.fromCharCode(t.dataType.Tail|p.length);return o.push(f+p),o.join("")},e.uncompress=function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),o=i&t.dataType.Mark,s=15&i,a=void 0;switch(o){case t.dataType.Compressed:var u=s>>2,c=3&s;if(0===u||0===c)throw new Error("Data parsing error,at "+n);var h=t.numberDecode(e.substr(n,u)),l=t.numberDecode(e.substr(n+=u,c));if((h=r.length-h)+l>r.length)throw new Error("Data parsing error,at "+n);n+=c,r+=r.substr(h,l);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,s)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=s;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,s)),r+=e.substr(n+=s,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,s),n+=s;break;case t.dataType.Mark:if(s>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+s),n+=16+s;break;default:throw new Error("Data parsing error,at "+n+" header:"+o)}}while(n<e.length);return r},e.indexOf=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>this.max)){var h=Math.min(o,c);if(h<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var l=2,d=l;d<h&&t.charAt(u+d)===t.charAt(n+d);d++)l++;l>=r.length&&(r.length=l,r.offset=u)}}}return r},e.numberEncode=function(e){var t=this,n=[],r=0;do{r=e%t.scale,n.push(t.chars.charAt(r)),e=(e-r)/t.scale}while(e>0);return n.join("")},e.numberDecode=function(e){for(var t=0,n=0,r=e.length-1;r>=0;r--){if(-1===(n=this.chars.indexOf(e.charAt(r))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t},e.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},e.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.scale=e.chars.length,e.max=238327,e}(),nt=function(e){return M(e)&&/https?:\/\//.test(e)},rt=function(){function e(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=et(e.runtime),this.logSwitch=e.logSwitch;var t=$e(e.runtime);this.deviceInfo="".concat(t.type,"|").concat(t.version,"|").concat(null==e?void 0:e.sessionId)}return e.prototype.updateUploadLogAttr=function(e){var t=e.logPolicy,n=e.logSwitch,r=e.runtime,i=e.sessionId,o=void 0===i?"":i,s=e.userId;if(t){var a=t.url,u=t.level,c=t.itv,h=t.times;this.logUrl=a||this.logUrl,this.level=u||this.level,this.itv=c||this.itv,this.times=h||this.times}if(n&&(this.logSwitch=n),r){this.deviceId=et(r);var l=$e(r);this.deviceInfo="".concat(l.type,"|").concat(l.version,"|").concat(o)}s&&(this.info.userId=s)},e.init=function(t){return e.reportSwitch=!0,e._instance||(e._instance=new e(t)),e._instance},e.getInstance=function(){return e._instance},e.prototype.reportRealtimeLog=function(t){var n=this;if(0===t.length||!this.logUrl)return Promise.resolve();var r=tt.compress(t.map((function(e){return e.content})).join("")),i=nt(this.logUrl)?"":"https://",o="".concat(i).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");return this.info.runtime.httpReq({method:"POST",url:o,body:r}).then((function(t){var r=t.data;r&&(r=JSON.parse(r),n.itv=r.nextTime,n.level=r.level,n.logSwitch=r.logSwitch,e.currentRTTimes=1)}))},e.prototype.reportFullLog=function(t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d=this;return m(this,(function(p){switch(p.label){case 0:return n=t.startTime,r=t.endTime,i=t.platform,o=t.logId,s=t.uri,a=Ue.getInstance(),"web"===i.toLowerCase()&&a?n>r?[2]:[4,a.getRangeData(Ne,"time",n,r)]:[2];case 1:return u=(u=p.sent()).filter((function(e){return!e.userId||e.userId===d.info.userId})),c=tt.compress(u.map((function(e){return e.content})).join("")||"no data"),5e3,h=1,l=function(){if(h>3||!e.reportSwitch)return Promise.resolve();var t=s||d.logUrl,n=nt(t)?"":"https://",r="".concat(n).concat(t,"?version=").concat(d.info.version,"&appkey=").concat(d.info.appkey,"&userId=").concat(d.info.userId,"&logId=").concat(o,"&deviceId=").concat(d.deviceId,"&deviceInfo=").concat(d.deviceInfo,"&platform=Web"),i=5e3*(h-1);return h++,new Promise((function(t,n){setTimeout((function(){e.reportSwitch&&d.info.runtime.httpReq({url:r,method:"POST",body:c}).then((function(){t()})).catch((function(e){n(e),l()}))}),i)}))},[2,l()]}}))}))},e.prototype.distroy=function(){e.currentRTTimes=1,e.reportSwitch=!1},e.currentRTTimes=1,e.reportSwitch=!1,e}(),it=[],ot=-1;function st(e){je&&je.updateUploadLogAttr(e)}function at(e,t,n,r){Ve(4-e,t,n);var i=JSON.stringify({message:n});i=i.replace(/"/g,'""'),i='"'.concat(i,'"');var o={level:e,content:[we,Date.now(),r||exports.LogSource.IM,e,t,i].join()+"\n"};it.push(o),it.length>=600&&(it=it.slice(-500))}function ut(){if(ot>=0&&(clearTimeout(ot),ot=-1),je&&je.logSwitch&&rt.reportSwitch){var e=je.itv*Math.pow(2,rt.currentRTTimes-1);rt.currentRTTimes<je.times&&rt.currentRTTimes++,ot=setTimeout((function(){var e=it.filter((function(e){return e.level<=je.level}));0===e.length?ut():je.reportRealtimeLog(e).then((function(){it=[],We(exports.LogTagId.G_UPLOAD_LOG_S,"report real-time log success"),ut()})).catch((function(e){We(exports.LogTagId.G_UPLOAD_LOG_E,"report real-time log error -> "+e),ut()}))}),1e3*e)}}var ct=function(){function e(e,t,n){this.tagId=e,this.logSource=t,this.initiator=n,this._localLogLevel=exports.LogLevel.WARN,this.debug=this.log.bind(this,exports.LogLevel.DEBUG),this.info=this.log.bind(this,exports.LogLevel.INFO),this.warn=this.log.bind(this,exports.LogLevel.WARN),this.error=this.log.bind(this,exports.LogLevel.ERROR),this.fatal=this.log.bind(this,exports.LogLevel.FATAL),this.reportLog=at}return e.prototype.setLogLevel=function(e){this._localLogLevel="number"!=typeof e?exports.LogLevel.WARN:e},e.prototype.setLogStdout=function(e){this._customLogPrint=e},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e>exports.LogLevel.DEBUG&&Ve(e,this.tagId,t.map(xe).join(" ")),!(e<this._localLogLevel)){var r="".concat((new Date).toISOString(),"[").concat(this.tagId,"][").concat(exports.LogLevel[e],"]"),i="".concat(r," - ").concat(t.map(xe).join(" "));this._customLogPrint?this._customLogPrint(e,i):this._stdout?this._stdout(e,i):ke.apply(void 0,T([e,r],t,!1))}},e.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},e.prototype.setStdout=function(e){this._stdout=e},e}(),ht=new ct("RCEngine"),lt=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,T([s],t,!1))}catch(e){ht.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),dt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};dt.engine="5.4.4";var pt,ft,gt=function(){function e(){}return e.add=function(e,t){dt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return ht.warn("The validation engine version '".concat(e,"' is invalid!")),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return dt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return dt},e}();exports.AssertRules=void 0,(ft=exports.AssertRules||(exports.AssertRules={}))[ft.STRING=0]="STRING",ft[ft.ONLY_STRING=1]="ONLY_STRING",ft[ft.NUMBER=2]="NUMBER",ft[ft.BOOLEAN=3]="BOOLEAN",ft[ft.OBJECT=4]="OBJECT",ft[ft.ARRAY=5]="ARRAY",ft[ft.CALLBACK=6]="CALLBACK",ft[ft.CHANNEL_ID=7]="CHANNEL_ID",ft[ft.CONVERSATION=8]="CONVERSATION";var _t,mt,Tt,yt,vt,Et=((pt={})[exports.AssertRules.STRING]=b,pt[exports.AssertRules.ONLY_STRING]=M,pt[exports.AssertRules.NUMBER]=A,pt[exports.AssertRules.BOOLEAN]=function(e){return"boolean"==typeof e},pt[exports.AssertRules.OBJECT]=P,pt[exports.AssertRules.ARRAY]=L,pt[exports.AssertRules.CALLBACK]=function(e){var t=!0;return P(e)||(t=!1),(e=e||{}).onSuccess&&!D(e.onSuccess)&&(t=!1),e.onError&&!D(e.onError)&&(t=!1),t},pt[exports.AssertRules.CHANNEL_ID]=B,pt[exports.AssertRules.CONVERSATION]=function(e){var t=!0;return P(e)||(t=!1),M(e.targetId)||(t=!1),G(e.conversationType)||(t=!1),x(e.channelId)||B(e.channelId)||(t=!1),t},pt),It=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return p(t,e),t}(Error),Ct=function(e,t,n,r){void 0===r&&(r=!1),n=Et[n]||n;var i=r&&!n(t)||!r&&!(x(t)||null===t||n(t));return i&&ht.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},Rt=function(e){if(!P(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{"+t.length+"}$"),t),16)},St=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Ae(),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="."+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,h=t.googleConfig,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=r||"",l.category=i||"",l.richMediaUri=o||"";var d={};d.collapse_key=null==h?void 0:h.collapseKey,d.imageUrl=null==h?void 0:h.imageUrl;var p=null==h?void 0:h.priority;p&&!["high","normal"].includes(p)&&(p="normal"),d.priority=p;var f=[{HW:{channelId:a||""}},{MI:{channelId:s||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:l},{FCM:d}];return JSON.stringify(f)},Ot=function(e,t){var n={},r={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:r};try{var i=JSON.parse(e);null==i||i.forEach((function(e){var t,i,o,s,a=Object.keys(e);if(0!==a.length){var u=a[0];switch(u){case"HW":return void(r.channelIdHW=null===(t=e[u])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[u])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(o=e[u])||void 0===o?void 0:o.channelId);case"VIVO":return void(r.typeVivo=null===(s=e[u])||void 0===s?void 0:s.classification);case"APNS":return n.threadId=e[u]["thread-id"],n.apnsCollapseId=e[u]["apns-collapse-id"],n.category=e[u].category,void(n.richMediaUri=e[u].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[u].collapse_key||"",imageUrl:e[u].imageUrl||"",priority:e[u].priority||""}}}}))}catch(t){ht.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},Mt=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Ut=function(e){var t=e.length;return t<=4096&&t>=1},At=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;P(e)&&function(){for(var n in e)t(e[n],n,e)}(),(L(e)||M(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)}()},Lt=function(e,t){return At(e,(function(n,r){e[r]=t(n,r)})),e},wt=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return At(e,(function(e,r){t===e&&(n=r)})),n},bt=function(e,t){var n=[];return At(e,(function(e){n.push(e)})),-1!==wt(n,t)},Pt=function(e){return JSON.parse(JSON.stringify(e))},Dt=function(){return"undefined"!=typeof RCCppEngine},xt=function(e){switch(e){case W.SERVER_UNAVAILABLE:return Y.SERVER_UNAVAILABLE;case W.TOKEN_INCORRECT:return Y.RC_CONN_USER_OR_PASSWD_ERROR;case W.REDIRECT:return Y.RC_CONN_REDIRECTED;case W.APP_BLOCK_OR_DELETE:return Y.RC_CONN_APP_BLOCKED_OR_DELETED;case W.BLOCK:return Y.RC_CONN_USER_BLOCKED;case W.TOKEN_EXPIRE:return Y.RC_CONN_USER_OR_PASSWD_ERROR;case W.HOSTNAME_ERROR:return Y.HOSTNAME_ERROR;case W.HASOHTERSAMECLIENTONLINE:return Y.HAS_OHTER_SAME_CLIENT_ON_LINE;case W.APP_AUTH_NOT_PASS:return Y.RC_APP_AUTH_NOT_PASS;case W.OTP_USED:return Y.RC_OTP_USED;case W.PLATFORM_ERROR:return Y.RC_PLATFORM_ERROR;default:return Y.RC_NET_UNAVAILABLE}},Vt=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(Vt(e[n]));else for(var n in t={},e)t[n]=Vt(e[n]);else t=e;return t},kt=function(e){var t;try{t=Vt(e)}catch(n){ht.error("clone err:",n),t=JSON.parse(JSON.stringify(e))}return t},Gt=function(e){var t={},n=JSON.parse(e);return At(n,(function(e,n){t[n]=e.v})),t},Bt={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Bt._delayTime=t-e},getTime:function(){var e=Bt._delayTime;return(new Date).getTime()-e}},Ft=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};!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"}(_t||(_t={})),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"}(mt||(mt={})),function(e){e.CONN_ACK="ConnAckMessage",e.DISCONNECT="DisconnectMessage",e.PING_REQ="PingReqMessage",e.PING_RESP="PingRespMessage",e.PUBLISH="PublishMessage",e.PUB_ACK="PubAckMessage",e.QUERY="QueryMessage",e.QUERY_CON="QueryConMessage",e.QUERY_ACK="QueryAckMessage"}(Tt||(Tt={})),function(e){e.PUB="pub",e.QUERY="qry"}(yt||(yt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(vt||(vt={}));var Ht,Kt=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=_t.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=_t.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var i=e>0;e&&i&&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}(),qt=function(){function e(){}return e.writeUTF=function(e,t){var n=[],r=0;if(M(e))for(var i=0,o=e.length;i<o;i++){var s=e.charCodeAt(i);s>=0&&s<=127?(r+=1,n.push(s)):s>=128&&s<=2047?(r+=2,n.push(192|31&s>>6),n.push(128|63&s)):s>=2048&&s<=65535&&(r+=3,n.push(224|15&s>>12),n.push(128|63&s>>6),n.push(128|63&s))}for(i=0,o=n.length;i<o;i++)n[i]>255&&(n[i]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)},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])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+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}(),Yt=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"+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"+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"+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._pool.subarray(this._position,this._position+=e);return qt.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),jt=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=qt.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),Qt="UpStreamMessage",Wt="PushExtra",Jt="DownStreamMessage",zt="DownStreamMessages",Zt="SessionsAttQryInput",Xt="SessionsAttOutput",$t="SyncRequestMsg",en="ChrmPullMsg",tn="NotifyMsg",nn="HistoryMsgInput",rn="HistoryMsgOuput",on="RelationQryInput",sn="RelationsOutput",an="DeleteSessionsInput",un="SessionInfo",cn="DeleteSessionsOutput",hn="RelationsInput",ln="DeleteMsgInput",dn="CleanHisMsgInput",pn="SessionMsgReadInput",fn="ChrmInput",gn="ChrmOutput",_n="QueryChatRoomInfoInput",mn="QueryChatRoomInfoOutput",Tn="RtcInput",yn="RtcUserListOutput",vn="SetUserStatusInput",En="RtcSetDataInput",In="RtcUserSetDataInput",Cn="RtcDataInput",Rn="RtcSetOutDataInput",Sn="MCFollowInput",Nn="RtcTokenOutput",On="RtcQryOutput",Mn="RtcQryUserOutDataInput",Un="RtcUserOutDataOutput",An="RtcQueryListInput",Ln="RtcRoomInfoOutput",wn="RtcValueInfo",bn="RtcKeyDeleteInput",Pn="GetQNupTokenInput",Dn="GetQNupTokenOutput",xn="GetQNdownloadUrlInput",Vn="GetDownloadUrlInput",kn="GetQNdownloadUrlOutput",Gn="GetDownloadUrlOutput",Bn="ChrmKVEntity",Fn="SetChrmKV",Hn="SetChrmKVS",Kn="DeleteChrmKVS",qn="ChrmKVOutput",Yn="ChrmKVSOutput",jn="ChrmKVSVersionEntity",Qn="ChrmKVSOutputEntity",Wn="QueryChrmKV",Jn="SetUserSettingInput",zn="SetUserSettingOutput",Zn="PullUserSettingInput",Xn="PullUserSettingOutput",$n="UserSettingNotification",er="SessionReq",tr="SessionStates",nr="SessionState",rr="SessionStateItem",ir="SessionStateModifyReq",or="SessionStateModifyResp",sr="GroupUnpushQuery",ar="GroupUnpushSet",ur="GroupUnpushResult",cr="GrpReadReceiptMsg",hr="GrpReadReceiptQryReq",lr="GrpReadReceiptQryResp",dr="GrpMsgReadUser",pr="SessionTagAddInput",fr="SessionTagItem",gr="SessionTagDelInput",_r="SessionDisTagReq",mr="ReportSDKInput",Tr="ReportSDKOutput",yr="UltraGrpPullSes",vr="UltraGrpPullMsg",Er="MsgChangeReq",Ir="QueryMsgChange",Cr="MsgChange",Rr="MsgChangeList",Sr="MsgQuery",Nr="MessageQueryInfo",Or="MsgQueryAck",Mr="OperateStatus",Ur="OperateStatusNotify",Ar="OperateInfo",Lr="OperateSummary",wr="RtcNotifyMsg",br="RtcPullKV",Pr="RtcKVOutput",Dr="RtcQueryUserJoinedInput",xr="RtcQueryUserJoinedOutput",Vr="RtcViewerJoinedOutput",kr="RtcInviteInput",Gr="RtcCancelInviteInput",Br="RtcInviteAnswerInput",Fr="RtcEndInviteInput",Hr="SetRtcRoomIdInput",Kr="SetRtcRoomIdOutput",qr=((Ht={})[Qt]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],Ht[zt]=["list","syncTime","finished","broadcastSyncTime"],Ht[Jt]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Ht[Wt]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Ht[Zt]=["nothing"],Ht[Xt]=["inboxTime","sendboxTime","totalUnreadCount"],Ht[$t]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Ht[en]=["syncTime","count"],Ht[tn]=["type","time","chrmId"],Ht[nn]=["targetId","time","count","order","busChannel"],Ht[rn]=["list","syncTime","hasMsg"],Ht[on]=["type","count","startTime","order"],Ht[sn]=["info","isFinished"],Ht[an]=["sessions"],Ht[un]=["type","channelId","busChannel"],Ht[cn]=["nothing"],Ht[hn]=["type","msg","count","busChannel","startTime","endTime"],Ht[ln]=["type","conversationId","msgs","busChannel"],Ht[dn]=["targetId","dataTime","conversationType","busChannel"],Ht[pn]=["type","msgTime","channelId","busChannel"],Ht[fn]=["nothing"],Ht[gn]=["nothing","sessionId","joinTime"],Ht[_n]=["count","order"],Ht[mn]=["userTotalNums","userInfos"],Ht[Pn]=["type","key","httpMethod","queryString"],Ht[xn]=["type","key","fileName"],Ht[Vn]=["type","key","fileName"],Ht[Dn]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Ht[kn]=["downloadUrl"],Ht[Gn]=["downloadUrl"],Ht[Bn]=["key","value","status","timestamp","uid","version"],Ht[Fn]=["entry","bNotify","notification","type"],Ht[Hn]=["entry","bNotify","notification","type"],Ht[Kn]=["entry","bNotify","notification","type"],Ht[qn]=["entries","bFullUpdate","syncTime"],Ht[Yn]=["timestamp","errorKeys","keysVersion"],Ht[jn]=["version","key"],Ht[Qn]=["key","errorCode"],Ht[Wn]=["timestamp"],Ht[Jn]=["version","value"],Ht[zn]=["version","reserve"],Ht[Zn]=["version","reserve"],Ht[Xn]=["items","version"],Ht.UserSettingItem=["targetId","type","key","value","version","status","tags"],Ht[er]=["time"],Ht[tr]=["version","state"],Ht[nr]=["type","channelId","time","stateItem","busChannel"],Ht[rr]=["sessionStateType","value","tags"],Ht[ir]=["version","state"],Ht[or]=["version"],Ht[ar]=["busChannel","unpushLevel"],Ht[sr]=["busChannel"],Ht[ur]=["groupId","busChannel","unpushLevel"],Ht[cr]=["msgId","busChannel"],Ht[hr]=["msgId","busChannel"],Ht[lr]=["totalMemberNum","list"],Ht[dr]=["readTime","userId"],Ht[pr]=["version","tags"],Ht[fr]=["tagId","name","createdTime","isTop"],Ht[gr]=["version","tags"],Ht[_r]=["tagId"],Ht[$n]=["version","reserve"],Ht[mr]=["sdkInfo"],Ht[Tr]=["nothing"],Ht[yr]=["syncTime","isEraseMsgContent"],Ht[vr]=["syncTime"],Ht[Er]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Ht[Ir]=["syncTime"],Ht[Rr]=["list","syncTime","hasNext"],Ht[Cr]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType"],Ht[Sr]=["targetId","type","query"],Ht[Nr]=["msgTime","msgUID","busChannel"],Ht[Or]=["list"],Ht[Mr]=["targetId","type","opType","busChannel"],Ht[Ur]=["type","notifyType","info","summary"],Ht[Ar]=["targetId","busChannel","userId","opType","optime"],Ht[Lr]=["targetId","busChannel","count","opType"],Ht[Tn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],Ht[yn]=["users","token","sessionId","roomInfo"],Ht[vn]=["status"],Ht[En]=["interior","target","key","value","objectName","content"],Ht[In]=["valueInfo","objectName","content"],Ht[Cn]=["interior","target","key","objectName","content"],Ht[Rn]=["target","valueInfo","objectName","content"],Ht[Sn]=["state"],Ht[Nn]=["rtcToken"],Ht[On]=["outInfo"],Ht[Mn]=["userId"],Ht[Un]=["user"],Ht[An]=["order"],Ht[Ln]=["roomId","roomData","userCount","list"],Ht[wn]=["key","value"],Ht[bn]=["key"],Ht[wr]=["type","time","roomId"],Ht[br]=["timestamp","roomId"],Ht[Pr]=["entries","bFullUpdate","syncTime"],Ht[Dr]=["userId"],Ht[xr]=["info"],Ht[kr]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Ht[Gr]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Ht[Br]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Ht[Fr]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Ht[Hr]=["rtcRoomId"],Ht[Kr]=["nothing"],Ht),Yr={},jr=function(e){var t=qr[e];Yr[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],o="set".concat(E(i,0,1));n[o]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Yr[e].decode=function(e){var t={};M(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(E(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Qr in qr)jr(Qr);Yr.getModule=function(e){return Yr[e]()};var Wr="\npackage Modules;\nmessage probuf {\n message ".concat(vn,"\n {\n optional int32 status=1;\n }\n\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(tn," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat($t," {\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(Qt," {\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(Wt," {\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(zt," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(Jt," {\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 optional int64 extStatus = 20; // 消息的扩展标记 第0位,表示送达状态: 0x01 表示已送达;断档: 0x02 表示是否需要执行断档策略; 消息修改: 0x04 拉取历史消息时表示该消息是否修改过 0x08 每条消息携带的频道类型\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(O.IMAGE,";\n audio = ").concat(O.AUDIO,";\n video = ").concat(O.VIDEO,";\n file = ").concat(O.FILE,";\n }\n message ").concat(Pn," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(xn," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Vn," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Dn," {\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 message ").concat(kn," {\n required string downloadUrl = 1;\n }\n message ").concat(Gn," {\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(fn," {\n required int32 nothing = 1;\n }\n message ").concat(gn," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(en," {\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(on,"\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(hn,"\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(sn,"\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 }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(dn,"\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(_n,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(mn,"\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 ").concat(Sn,"\n {\n required string state = 1;\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(nn,"\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(rn,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(An,"{\n optional int32 order=1;\n }\n\n message ").concat(bn,"{\n repeated string key=1;\n }\n\n message ").concat(wn,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(wn," userData=2; //用户资源信息\n }\n\n message ").concat(yn,"{\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(wn," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Tn,"{\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(wn," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(wn," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(On,"{\n repeated ").concat(wn," outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message ").concat(Cn,"{\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(En,"{\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(In," {\n repeated ").concat(wn," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(wn," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(Nn,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(Rn,"{\n required targetType target=1;\n repeated ").concat(wn," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Mn,"{\n repeated string userId = 1;\n }\n message ").concat(Un,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Zt,"{\n required int32 nothing = 1;\n }\n message ").concat(Xt,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(pn,"\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(an,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(un,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(cn,"\n {\n optional int32 nothing=1;\n }\n message ").concat(ln,"\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(Fn," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Hn," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Kn," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(qn," {\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(Yn," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Qn,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Wn," {\n required int64 timestamp = 1;\n }\n message ").concat(Jn," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(zn," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Zn," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Xn," {\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(er," {\n required int64 time = 1;\n }\n message ").concat(tr," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(nr," {\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(rr," {\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(ir," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(sr," {\n optional string busChannel = 1;\n }\n message ").concat(ar,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(ur," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(or," {\n required int64 version=1;\n }\n message ").concat(cr," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(hr," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(lr," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(dr," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(pr," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(fr," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(gr," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(_r," {\n repeated string tagId=1;\n }\n message ").concat($n," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(mr,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Tr,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(wr," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(br,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(Pr,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \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 enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(Dr,"\n {\n required string userId = 1;\n }\n message ").concat(xr,"\n {\n repeated RtcJoinedInfo info = 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(Vr,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(kr,"\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(Gr,"\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(Br,"\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(Fr,"\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 message ").concat(yr,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(vr,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Er,"\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(Ir," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Rr," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(Cr," //变更详情\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:频道变更)\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 optional int32 subChangeType = 11; // 当 changeType 为 4 时,该参数有意义; 1: 删除频道; 2: 公有频道变为私有频道; 3: 私有频道变为公有频道; 4: 私有频道成员变更-加入, SDK 不通知业务层; 5: 私有频道成员变更-退出; 6: 公有频道变为私有频道,当前用户不在白名单中;\n }\n message ").concat(Sr," //请求\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(Or," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(Mr," //客户端发送\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(Ur," //服务端发送\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(Ar," {\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(Lr," {\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 message ").concat(Hr,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(Kr,"\n {\n required int32 nothing = 1; //用于占位\n }\n}\n");var Jr,zr,Zr,Xr,$r,ei,ti,ni=(Jr=Wr,zr=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?g:f;if(t){if(e<0)return g;if(e>=l)return v}else{if(-d>=e)return E;if(e+1>=d)return y}return e<0?r(-e,t).neg():i(0|e%h,0|e/h,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,u,h,l,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;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=f,u=0;u<e.length;u+=8)h=Math.min(8,e.length-u),l=parseInt(e.substring(u,u+h),n),h<8?(d=r(c(n,h)),a=a.mul(d).add(r(l))):a=(a=a.mul(s)).add(r(l));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,h,l,d,p,f,g,_,m,T,y,v,E,I;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,d=(l=(h=4294967296)*h)/2,p=n(16777216),f=n(0),e.ZERO=f,g=n(0,!0),e.UZERO=g,_=n(1),e.ONE=_,m=n(1,!0),e.UONE=m,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,E=i(0,-2147483648,!1),e.MIN_VALUE=E,(I=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},I.toString=function(e){var t,n,i,o,s,a,u,h;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(E)?(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),h=(s.sub(u.mul(o)).toInt()>>>0).toString(e),(s=u).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(E)?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},I.isZero=function(){return 0===this.high&&0===this.low},I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return 1==(1&this.low)},I.isEven=function(){return 0==(1&this.low)},I.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},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.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},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(_)},I.neg=I.negate,I.add=function(e){var n,r,o,a,u,c,h,l,d,p,f;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,h=e.low>>>16,l=0,d=0,p=0,f=0,p+=(f+=a+(65535&e.low))>>>16,d+=(p+=o+h)>>>16,l+=(d+=r+c)>>>16,l+=n+u,i((p&=65535)<<16|(f&=65535),(l&=65535)<<16|(d&=65535),this.unsigned)},I.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){var n,o,a,u,c,h,l,d,g,_,m,T;return this.isZero()?f:(t(e)||(e=s(e)),e.isZero()?f:this.eq(E)?e.isOdd()?E:f:e.eq(E)?this.isOdd()?E:f: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,h=65535&e.high,l=e.low>>>16,g=0,_=0,m=0,T=0,m+=(T+=u*(d=65535&e.low))>>>16,_+=(m+=a*d)>>>16,m&=65535,_+=(m+=u*l)>>>16,g+=(_+=o*d)>>>16,_&=65535,g+=(_+=a*l)>>>16,_&=65535,g+=(_+=u*h)>>>16,g+=n*d+o*l+a*h+u*c,i((m&=65535)<<16|(T&=65535),(g&=65535)<<16|(_&=65535),this.unsigned)))},I.mul=I.multiply,I.divide=function(e){var n,i,o,a,u,h,l;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:f;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return m;o=g}else{if(this.eq(E))return e.eq(_)||e.eq(T)?E:e.eq(E)?_:(n=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?_:T:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(E))return this.unsigned?g:f;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=f}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),l=(h=r(n)).mul(e);l.isNegative()||l.gt(i);)l=(h=r(n-=u,this.unsigned)).mul(e);h.isZero()&&(h=_),o=o.add(h),i=i.sub(l)}return o},I.div=I.divide,I.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.not=function(){return i(~this.low,~this.high,this.unsigned)},I.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return t(e)||(e=s(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},I.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)},I.shl=I.shiftLeft,I.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)},I.shr=I.shiftRight,I.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))},I.shru=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.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]},I.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}(),Zr=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,h=-7,l=n?i-1:0,d=n?-1:1,p=e[t+l];for(l+=d,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+e[t+l],l+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+e[t+l],l+=d,h-=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,h=(1<<c)-1,l=h>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?d/u:d*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=255&s,p+=f,s/=256,c-=8);e[n+p-f]|=128*g}var o,s,a,u,c,h=function(e,t,n){if(void 0===e&&(e=h.DEFAULT_CAPACITY),void 0===t&&(t=h.DEFAULT_ENDIAN),void 0===n&&(n=h.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 h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=e||null,(o=h.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(e,t,n){return new h(e,t,n)},h.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)h.isByteBuffer(e[s])||(e[s]=h.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new h(0,n,r);for(c=new h(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},h.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},h.type=function(){return ArrayBuffer},h.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 h.fromBase64(e,n);case"hex":return h.fromHex(e,n);case"binary":return h.fromBinary(e,n);case"utf8":return h.fromUTF8(e,n);case"debug":return h.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(h.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new h(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 h(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 h(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,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},h.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},h.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=h.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(h.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=h.zigZagDecode32(t.value):t=h.zigZagDecode32(t),t},e&&(h.MAX_VARINT64_BYTES=10,h.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},h.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()},h.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=h.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(h.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=h.zigZagDecode64(n.value):n=h.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,h.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},h.METRICS_CHARS="c",h.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,h.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},h.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},h.calculateString=h.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=h.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===h.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===h.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=h.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,h.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 h||(e=h.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 h(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 h(0,this.littleEndian,this.noAssert);var n=t-e,r=new h(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&&!h.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 h||(e=h.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()},h.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new h(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},h.btoa=function(e){return h.fromBinary(e).toBase64()},h.atob=function(e){return h.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)},h.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new h(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},h.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new h(0|(o+1)/3,t,n),a=0,u=0,c=!1,l=!1,d=!1,p=!1,f=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(l||d||p){f=!0;break}l=d=p=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(l||p){f=!0;break}l=p=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(l||d){f=!0;break}l=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(l){f=!0;break}l=!0}s.offset=u,c=!1;break;case"]":if(!n){if(p||d){f=!0;break}p=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(p){f=!0;break}p=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){f=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){f=!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(f)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!l||!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("")},h.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 h(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()},h.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new h(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},h}(zr),Xr=function(e,t){var n,r,i={};return i.ByteBuffer=e,i.c=e,n=e,i.Long=t||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),i.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},i.DotProto=function(e,t){function n(e,n){var r=-1,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}(i,i.Lang),i.Reflect=function(t){function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case t.WIRE_TYPES.STARTGROUP:i(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,u,c,h,l,d,p,f,g,_,m,T,y,v,E={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},E.T=I,o=function(e,t,n,r,i){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(s=o.prototype=Object.create(I.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 E.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof E.T&&(!t||n instanceof E.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 E.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},E.Namespace=o,a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},u=a.prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},u.verifyValue=function(n){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 t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(typeof n,"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(typeof n,"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(typeof n,"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(i=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==n)return i[s].id;if(i[s].id==n)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),(n>4294967295||n<0)&&a(typeof n,"not in range for uint32"),n;a(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"==typeof n||a(typeof n,"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(s in o={},n)n.hasOwnProperty(s)&&(o[s]=n[s]);n=o}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},u.calculateLength=function(e,r){if(null===r)return 0;var i;switch(this.type){case t.TYPES.int32:return r<0?n.calculateVarint64(r):n.calculateVarint32(r);case t.TYPES.uint32:return n.calculateVarint32(r);case t.TYPES.sint32:return n.calculateVarint32(n.zigZagEncode32(r));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return n.calculateVarint64(r);case t.TYPES.sint64:return n.calculateVarint64(n.zigZagEncode64(r));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return n.calculateVarint32(r);case t.TYPES.double:return 8;case t.TYPES.string:return i=n.calculateUTF8Bytes(r),n.calculateVarint32(i)+i;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return n.calculateVarint32(r.remaining())+r.remaining();case t.TYPES.message:return i=this.resolvedType.calculate(r),n.calculateVarint32(i)+i;case t.TYPES.group:return(i=this.resolvedType.calculate(r))+n.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},u.encodeValue=function(e,r,i){var o,s;if(null===r)return i;switch(this.type){case t.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case t.TYPES.uint32:i.writeVarint32(r);break;case t.TYPES.sint32:i.writeVarint32ZigZag(r);break;case t.TYPES.fixed32:i.writeUint32(r);break;case t.TYPES.sfixed32:i.writeInt32(r);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(r);break;case t.TYPES.sint64:i.writeVarint64ZigZag(r);break;case t.TYPES.fixed64:i.writeUint64(r);break;case t.TYPES.sfixed64:i.writeInt64(r);break;case t.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case t.TYPES.enum:i.writeVarint32(r);break;case t.TYPES.float:i.writeFloat32(r);break;case t.TYPES.double:i.writeFloat64(r);break;case t.TYPES.string:i.writeVString(r);break;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");o=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=o;break;case t.TYPES.message:s=(new n).LE(),this.resolvedType.encode(r,s),i.writeVarint32(s.offset),i.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},u.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+o,e.offset+=o,i;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,r)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return n.fromBinary(e)}},u.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},E.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},(h=c.prototype=Object.create(o.prototype)).build=function(r){var i,o,s,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,o,s){var a,u,c,h,l,d,p;if(null===e||"object"!=typeof e)return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(e,t){u[t]=i(e,r,o,s)})),u;if(u={},e instanceof t.Map){for(h=(c=e.entries()).next();!h.done;h=c.next())u[e.keyElem.valueToString(h.value[0])]=i(h.value[1],r,o,e.valueElem.resolvedType);return u}for(p in l=e.$type,d=void 0,e)e.hasOwnProperty(p)&&(u[p]=l&&(d=l.getChild(p))?i(e[p],r,o,d.resolvedType):i(e[p],r,o));return u}var o,s,a=r.getChildren(t.Reflect.Message.Field),u=r.getChildren(t.Reflect.Message.OneOf),c=function(e){var i,o,s,h;for(t.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 t.Map(s):null,!s.required&&"proto3"!==r.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof c)||Array.isArray(e)||e instanceof t.Map||n.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(i=0,o=arguments.length;o>i;++i)void 0!==(h=arguments[i])&&this.$set(a[i].name,h);else this.$set(e)},h=c.prototype=Object.create(t.Builder.Message.prototype);for(h.add=function(e,n,i){var o=r._fieldsByName[e];if(!i){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");n=o.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},h.$add=h.add,h.set=function(e,n,i){var o,s,a;if(e&&"object"==typeof e){for(o in i=n,e)e.hasOwnProperty(o)&&void 0!==(n=e[o])&&this.$set(o,n,i);return this}if(s=r._fieldsByName[e],i)this[e]=n;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=n=s.verifyValue(n)}return s&&s.oneof&&(a=this[s.oneof.name],null!==n?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},h.$set=h.set,h.get=function(e,n){if(n)return this[e];var i=r._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},h.$get=h.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,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})),n=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===r.getChild("set"+o)&&(h["set"+o]=n),null===r.getChild("set_"+t)&&(h["set_"+t]=n),null===r.getChild("get"+o)&&(h["get"+o]=i),null===r.getChild("get_"+t)&&(h["get_"+t]=i)}(s);return h.encode=function(t,n){var i,o;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),o=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},c.encode=function(e,t,n){return new c(e).encode(t,n)},h.calculate=function(){return r.calculate(this)},h.encodeDelimited=function(e){var t,i=!1;return e||(e=new n,i=!0),t=(new n).LE(),r.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.decode=function(e,t){var i,o;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return o=r.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=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(i=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=r.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))},h.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:r.buildOpt()}),Object.defineProperty(h,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:r}),Object.defineProperty(h,"$type",{value:r})),c}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof g||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 m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},h.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},h.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},h.decode=function(e,n,r){var o,s,a,u,c,h,l,d,p,f,g,_;for(n="number"==typeof n?n:-1,c=e.offset,h=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.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?h[u.name].push(u.decode(s,e)):u.map?(d=u.decode(s,e),h[u.name].set(d[0],d[1])):(h[u.name]=u.decode(s,e),u.oneof&&(null!==(p=h[u.oneof.name])&&p!==u.name&&(h[p]=null),h[u.oneof.name]=u.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:l=e.readVarint32(),e.offset+=l;break;case t.WIRE_TYPES.STARTGROUP:for(;i(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(f=0,g=this._fields.length;g>f;++f)if(null===h[(u=this._fields[f]).name])if("proto3"===this.syntax)h[u.name]=u.defaultValue;else{if(u.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=h,_;t.populateDefaults&&null!==u.defaultValue&&(h[u.name]=u.defaultValue)}return h},E.Message=c,l=function(e,n,r,i,o,s,a,u,h,l){I.call(this,e,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=h||null,this.syntax=l||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=l.prototype=Object.create(I.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},d.verifyValue=function(e,n){var 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===e)return this.required&&r(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],i=0;i<e.length;i++)o.push(this.element.verifyValue(e[i]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(typeof e,"no array expected"),this.element.verifyValue(e))},d.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},d.encode=function(e,r,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===e||this.repeated&&0==e.length)return r;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1),s=r.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],r);a=r.offset-s,(u=n.calculateVarint32(a))>1&&(c=r.slice(s,r.offset),s+=u-1,r.offset=s,r.append(c)),r.writeVarint32(a,s-u)}else for(o=0;o<e.length;o++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],r);else this.map?e.forEach((function(e,i){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.writeVarint32(o),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,r)}),this):this.hasWirePresence(e,i)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,r))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},d.calculate=function(e,r){var i,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);i+=n.calculateVarint32(s),i+=s}else for(o=0;o<e.length;o++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,r){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i+=n.calculateVarint32(o),i+=o}),this):this.hasWirePresence(e,r)&&(i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},d.decode=function(e,n,r){var i,o,s,u,c,h,l;if(!(!this.map&&e==this.type.wireType||!r&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!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(e=7&(h=c.readVarint32()),1==(l=h>>>3))u=this.keyElement.decode(c,e,l);else{if(2!==l)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,e,l)}return[u,i]}return this.element.decode(n,e,this.id)},E.Message.Field=l,p=function(e,t,n,r,i,o,s){l.call(this,e,t,n,null,r,i,o,s),this.extension},p.prototype=Object.create(l.prototype),E.Message.ExtensionField=p,f=function(e,t,n){I.call(this,e,t,n),this.fields=[]},E.Message.OneOf=f,g=function(e,t,n,r,i){o.call(this,e,t,n,r,i),this.className="Enum",this.object=null},g.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},(g.prototype=Object.create(o.prototype)).build=function(e){var n,r,i,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,o=(r=this.getChildren(g.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},E.Enum=g,_=function(e,t,n,r){I.call(this,e,t,n),this.className="Enum.Value",this.id=r},_.prototype=Object.create(I.prototype),E.Enum.Value=_,m=function(e,t,n,r){I.call(this,e,t,n),this.field=r},m.prototype=Object.create(I.prototype),E.Extension=m,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(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var r,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(r=0;r<s.length;r++)!function(e){o[e.name]=function(r,i){try{try{r=e.resolvedRequestType.clazz.decode(n.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!=typeof r)throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(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[r]);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}(t,this)},E.Service=T,y=function(e,t,n,r){I.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(y.prototype=Object.create(I.prototype)).buildOpt=s.buildOpt,E.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),E.Service.RPCMethod=v,E}(i),i.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var 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,h,l,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===(h=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(h+""),c):this.import(e.DotProto.Parser.parse(h),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),l=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){l.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=l),t.enums&&(this.create(t.enums),this.ptr=l),t.services&&(this.create(t.services),this.ptr=l),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}(i,i.Lang,i.Reflect),i.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,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,i.Reflect),i.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),i.loadJson(i.DotProto.Parser.parse(e),t,n)},i.protoFromString=i.loadProto,i.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=i.populateAccessors),new i.Builder(e)},i.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=i.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},i.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=Jr,i.loadProto(r,void 0,"").build("Modules").probuf}(Zr,zr),Xr);ni.getModule=function(e){var t=new ni[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=w(e)?[].slice.call(new Int8Array(e)):e},t};var ri,ii,oi="pgMsgP",si="chatMsg",ai="pcMsgP",ui={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},ci="delMsg",hi="joinChrm",li="joinChrmR",di="exitChrm",pi="setKV",fi="delKV",gi="setKVS",_i="delKVS",mi="qryRelationR",Ti="delRelation",yi="setSeAtt",vi={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Ei="qryPMsg",Ii="qryGMsg",Ci="qryCHMsg",Ri="qryCMsg",Si="qrySMsg",Ni=(($r={})["ppMsgP"]=S.PRIVATE,$r[oi]=S.GROUP,$r[si]=S.CHATROOM,$r[ai]=S.CUSTOMER_SERVICE,$r),Oi=((ei={})[S.PRIVATE]=Ei,ei[S.GROUP]=Ii,ei[S.CHATROOM]=Ci,ei[S.CUSTOMER_SERVICE]=Ri,ei[S.SYSTEM]=Si,ei),Mi=((ti={})[S.PRIVATE]=vi.PRIVATE,ti[S.GROUP]=vi.GROUP,ti[S.ULTRA_GROUP]=vi.ULTRA_GROUP,ti[S.CUSTOMER_SERVICE]=vi.CUSTOMER_SERVICE,ti[S.SYSTEM]=vi.SYSTEM,ti),Ui="1",Ai="0",Li=1,wi=2,bi=3,Pi=function(){function e(e){this._codec="websocket"===e?ni:Yr,this._connectType=e}return e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,s=((r={})[zt]=i._formatSyncMessages,r[Jt]=i._formatReceivedMessage,r[Qt]=i._formatSentMessage,r[rn]=i._formatHistoryMessages,r[sn]=i._formatConversationList,r[mn]=i._formatChatRoomInfos,r[yn]=i._formatRTCUserList,r[On]=i._formatRTCData,r[qn]=i._formatChatRoomKVList,r[Xn]=i._formatUserSetting,r[tr]=i._formatConversationStatus,r[lr]=i._formatGrpReadReceiptQryResp,r[zn]=i._formatSetUserSettingOutput,r[$n]=i._formatUserSettingNotification,r[Rr]=i._formatUltraMsgChangeList,r[Ur]=i._formatUltraOperateStatusNotifyList,r[Or]=i._formatUltraMsgList,r[gn]=i._formatChrmKVVersion,r[Pr]=i._formatRTCRoomKVList,r[Nn]=i._formatRTCAuidenceJoinRoomData,r[xr]=i._formatRTCJoinedUserInfo,r)[t];try{o=e.length>0&&i._codec[t].decode(e),P(o)&&(o=function(e){for(var t in e)P(e[t])&&(e[t]=Rt(e[t]));return e}(o)),D(s)&&(o=s.call(this,o,n))}catch(n){ht.error("PB parse error\n",n,e,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=w(n)?new Uint8Array(n):n;return qt.readUTF(i.subarray(t,r))}catch(e){ht.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){ht.info("formatBytes error\n",e)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,o=e.finished;return(x(o)||null===o)&&(e.finished=!0),e.syncTime=Rt(i),e.list=Lt(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var r=(t=t||{}).currentUserId,i=t.connectedTime,o=e.content,s=e.fromUserId,a=e.type,u=e.groupId,c=e.status,h=e.dataTime,l=e.classname,d=e.msgId,p=e.extraContent,g=e.pushContent,_=e.pushExt,m=e.configFlag,T=e.extStatus;e.toUserId,e.groupUnpush;var y=(e.direction||K.RECEIVE)===K.SEND,v=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(c),E=v.isPersited,I=v.isCounted,C=v.isMentioned,R=v.disableNotification,N=v.receivedStatus,O=v.canIncludeExpansion,M=!!(2&(T||0)),U=!!(4&(T||0)),A=!!(8&(T||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,L=[S.GROUP,S.CHATROOM,S.RTC_ROOM,S.ULTRA_GROUP].indexOf(a)>-1?u:s,w=y?r:s,b=Rt(h),P=b<i,D=a===S.CHATROOM,x=this._formatBytes(o),V={};if(_&&(V=Ot(_.pushConfigs,_.pushId)),x.user){var k=x.user,G=k.portrait,B=k.portraitUri,F=G||B;F&&(x.user.portrait=x.user.portraitUri=F)}var H,q=f(f({},V),{pushTitle:null==_?void 0:_.title,pushContent:g,pushData:g,disablePushTitle:!!m&&Boolean(4&m),forceShowDetailContent:!!m&&Boolean(8&m),templateId:null==_?void 0:_.templateId}),Y=y?K.SEND:K.RECEIVE;D&&s===r&&(Y=K.SEND),p&&(H={},H=Gt(p));var j={conversationType:a,targetId:L,senderUserId:w,messageType:l,messageUId:d,isPersited:E,isCounted:I,isMentioned:C,sentTime:b,messageDirection:Y,receivedTime:Bt.getTime(),disableNotification:R,receivedStatus:N,canIncludeExpansion:O,content:x,expansion:H,configFlag:m,pushConfig:q,channelId:e.busChannel||"",isInterrupt:M,isModifyMessage:U};return a!==S.ULTRA_GROUP&&(j.isOffLineMessage=P),a===S.ULTRA_GROUP&&(j.channelType=A),j},e.prototype._formatSentMessage=function(e,t){var n,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,h=e.configFlag,l=e.extStatus,d=t.signal,p=t.currentUserId,g=d.date,_=d.topic,m=d.targetId,T=!!(2&(l||0)),y=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),v=y.isPersited,E=y.isCounted,I=y.disableNotification,C=y.canIncludeExpansion,R=Ni[_]||S.PRIVATE,N=bt(ui,_),O=this._formatBytes(r),M=m;i===z.RECALL&&(R=O.conversationType||R,M=O.targetId||m),a&&(n={},n=Gt(a));var U={};u&&(U=Ot(u.pushConfigs,u.pushId));var A=f(f({},U),{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==u?void 0:u.templateId});return{conversationType:R,targetId:M,messageType:i,messageUId:s,isPersited:v,isCounted:E,isStatusMessage:N,senderUserId:p,content:this._formatBytes(r),sentTime:1e3*g,receivedTime:Bt.getTime(),messageDirection:K.SEND,isOffLineMessage:!1,disableNotification:I,canIncludeExpansion:C,expansion:n,pushConfig:A,channelId:e.busChannel||"",isInterrupt:T}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,s=r.targetId,a=Rt(e.syncTime),u=[];return At(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===S.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,h=e.operatorId,l=e.subChangeType;return{targetId:t,conversationType:n,changeType:i,messageUId:o,changeTime:Rt(r),sendTime:Rt(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:h,subChangeType:l}})),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=Rt(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._formatConversationList=function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){},o={list:(r=Lt(r,(function(e){var r=e.msg,o=e.userId,s=e.type,a=e.unreadCount,u=e.busChannel,c=e.versionTime,h=e.remindCount,l=e.busChannelType,d=null;r&&((d=n._formatReceivedMessage(r,t)).targetId=o);var p={targetId:o,conversationType:s,unreadMessageCount:Rt(a)||0,latestMessage:d||{},channelId:u||""};return s===S.ULTRA_GROUP&&(p.versionTime=Rt(c)||0,p.unreadMentionedCount=Rt(h)||0,p.channelType=l||exports.UltraGroupChannelType.PUBLIC),i(p)||p})))||[]};return((null==t?void 0:t.conversationType)||S.NONE)===S.ULTRA_GROUP&&(o.isFinished=e.isFinished),o},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:Lt(n,(function(e){var t=e.id,n=e.time;return{id:t,time:Rt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=Lt(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?ce.DELETE:ce.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:Rt(i),version:Rt(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=Rt(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=Rt(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=X.CLOSE,u=ee.NOT_SET,c=!1,h=[];At(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Li:a=n===Ui?X.OPEN:X.CLOSE,u=Number(n)||ee.NOT_SET;break;case wi:c=n===Ui;break;case bi:h=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:Rt(i),tags:h,channelId:s||""})})),n},e.prototype._formatRTCUserList=function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,o=e.entries,s=e.offlineKickTime,a={};return At(t,(function(e){var t=e.userId,n=e.userData,r={};At(n,(function(e){var t=e.key,n=e.value;r[t]=n})),a[t]=r})),{users:a,token:n,sessionId:r,roomInfo:i,kvEntries:o,offlineKickTime:s}},e.prototype._formatRTCData=function(e){var t=e.outInfo,n={};return At(t,(function(e){n[e.key]=e.value})),n},e.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return At(r,(function(e){i[e.key]=e.value})),i},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=Rt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatRTCRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=(t=t||[]).map((function(e){var t=e.timestamp;return Object.assign(e,{timestamp:Rt(t)})})),isFullUpdate:n,syncTime:r}},e.prototype._formatChrmKVVersion=function(e){return e},e.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Rt(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Zt);return e.setNothing(1),e.getArrayData()},e.prototype._getUpMsgModule=function(e,t){var n,r,i,o="comet"===this._connectType,s=e.conversationType,a=t.messageType,u=t.isMentioned,c=t.mentionedType,h=t.mentionedUserIdList,l=t.content,d=t.pushContent,p=t.pushData,f=t.directionalUserIdList,g=t.isFilerWhiteBlacklist,_=t.isVoipPush,m=t.canIncludeExpansion,T=t.expansion,y=t.pushConfig,v=t.channelId;[S.GROUP,S.ULTRA_GROUP].includes(s);var E=this._codec.getModule(Qt),I=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),C=y||{},R=C.pushTitle,N=C.pushContent,O=C.pushData,M=C.iOSConfig,U=C.androidConfig,A=C.templateId,L=C.disablePushTitle,w=C.forceShowDetailContent,b=0;E.setSessionId(I),u&&l&&(l.mentionedInfo={userIdList:(null===(n=l.mentionedInfo)||void 0===n?void 0:n.userIdList)||h||[],type:(null===(r=l.mentionedInfo)||void 0===r?void 0:r.type)||c||ne.ALL,mentionedContent:(null===(i=l.mentionedInfo)||void 0===i?void 0:i.mentionedContent)||""});var P=N||d||"",D=O||p||"";if(P&&E.setPushText(P),D&&E.setAppData(D),f&&E.setUserId(f),b|=_?1:0,b|=g?2:0,b|=L?4:0,b|=w?8:0,E.setConfigFlag(b),E.setClassname(a),l.user&&l.user.portraitUri&&(l.user.portrait=l.user.portraitUri),E.setContent(JSON.stringify(l)),m&&T){var V={};At(T,(function(e,t){V[t]={v:e}})),E.setExtraContent(JSON.stringify(V))}if(y){var k=this._codec.getModule(Wt);if(R&&k.setTitle(R),M&&U){var G=Nt(M,U);k.setPushConfigs(G)}(null==U?void 0:U.notificationId)&&k.setPushId(null==U?void 0:U.notificationId),k.setTemplateId(A||""),E.setPushExt(o?k.getArrayData():k)}return x(v)||E.setBusChannel(v),E},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($t);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(en);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(nn);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(vr);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(on);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(on);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(hn);return r.setType(t),n&&r.setBusChannel([n]),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(an),r=[];return At(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(un);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(ln),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(dn);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(pn);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(Er);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(Er);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(Ir);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(Sr),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.encodeOperateStatus=function(e,t,n,r){var i=this._codec.getModule(Mr);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(fn);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(_n);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(ar);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(sr);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r){var i=this._codec.getModule(Pn);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="comet"===this._connectType,i=this._codec.getModule(Fn),o=t.key,s=t.value,a=t.notificationExtra,u=t.isSendNotification,c=t.type,h=t.timestamp,l=c||ce.UPDATE,d=Ft(t,l),p={key:o,value:s||"",uid:n,version:h};if(x(d)||(p.status=d),i.setEntry(p),u){var f={conversationType:S.CHATROOM,targetId:e},g={key:o,value:s,extra:a,type:l},_=this._getUpMsgModule(f,{messageType:z.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});r?i.setNotification(_.getArrayData()):i.setNotification(_),i.setBNotify(!0),i.setType(S.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){this._connectType;var r=this._codec.getModule(Hn),i=t.entries,o=t.type||ce.UPDATE,s=Ft(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};x(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Wn);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(Zn);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(er);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(ir),o=Bt.getTime(),s=[];return At(e,(function(e){var t=n._codec.getModule(nr),i=e.conversationType,a=e.targetId,u=e.notificationStatus,c=e.isTop,h=e.channelId,l=e.notificationLevel,d=[];t.setType(i),t.setChannelId(a),t.setTime(o),t.setBusChannel(h);var p=u===X.OPEN,f={};x(u)||(f[Li]=p),x(l)||(f[Li]=l),x(c)||(f[wi]=c),At(f,(function(e,t){if(!x(e)){var i=n._codec.getModule(rr);e=e?Ui:Ai,x(l)||Number(t)!==Li||(e=String(l)),i.setSessionStateType(Number(t)),i.setValue(e);var o=r?i.getArrayData():i;d.push(o)}})),t.setStateItem(d);var g=r?t.getArrayData():t;s.push(g)})),i.setVersion(t||o),i.setState(s),i.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(cr);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(pr),o=[];return e.forEach((function(e){var t=n._codec.getModule(fr);t.setTagId(e.tagId),t.setName(e.tagName),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(cr);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(gr),o=[];return e.forEach((function(e){var t=n._codec.getModule(fr);t.setTagId(e),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(_r);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(ir),o=[];return t.forEach((function(t){var i=n._codec.getModule(nr),s=n._codec.getModule(rr),a=[];e.forEach((function(e){var t=n._codec.getModule(fr);t.setTagId(e.tagId),x(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),s.setSessionStateType(bi),s.setValue(JSON.stringify(a)),s.setTags(a),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?s.getArrayData():s]),o.push(r?i.getArrayData():i)})),i.setState(o),i.setVersion(Bt.getTime()),i.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(mr);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(yr);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodeJoinRTCRoom=function(e,t,n,r,i){var o=this,s="comet"===this._connectType,a=this._codec.getModule(Tn);if(e=e||0,a.setRoomType(e),x(t)||a.setBroadcastType(t),x(n)||a.setJoinType(n),r){var u=[],c=this._codec.getModule(wn);for(var h in r)c.setKey(h),c.setValue(r[h]),s?u.push(c.getArrayData()):u.push(c);a.setInnerDatas(u)}if(i){var l=[];Object.keys(i).forEach((function(e){var t=o._codec.getModule(wn);t.setKey(e),t.setValue(i[e]),s?l.push(t.getArrayData()):l.push(t)})),a.setOuterDatas(l)}return a.getArrayData()},e.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(vn).getArrayData()},e.prototype.encodeSetRTCData=function(e,t,n,r,i){var o=this._codec.getModule(En);if(o.setInterior(n),o.setTarget(r),o.setKey(e),o.setValue(t),i){i.name&&o.setObjectName(i.name);var s=i.content;s&&(P(s)&&(s=JSON.stringify(s)),o.setContent(s))}return o.getArrayData()},e.prototype.encodeUserSetRTCData=function(e,t,n,r){var i=this,o="comet"===this._connectType,s=this._codec.getModule(In);s.setObjectName(n);var a=this._codec.getModule(wn);a.setKey(e.name),a.setValue(e.content),o?s.setContent(a.getArrayData()):s.setContent(a);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(wn);n.setKey(e);var s="uris"===e?t:r;n.setValue(s),o?u.push(n.getArrayData()):u.push(n)})),s.setValueInfo(u),s.getArrayData()},e.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var n=this._codec.getModule(In);n.setObjectName(e);var r=this._codec.getModule(wn);return r.setKey("cdn_uris"),r.setValue(t),n.setValueInfo(r),n.getArrayData()},e.prototype.encodeGetRTCData=function(e,t,n){var r=this._codec.getModule(Cn);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()},e.prototype.encodeRemoveRTCData=function(e,t,n,r){var i=this._codec.getModule(Cn);i.setInterior(t),i.setTarget(n),i.setKey(e);var o=(r=r||{}).name,s=r.content;return!x(o)&&i.setObjectName(o),x(s)||(P(s)&&(s=JSON.stringify(s)),i.setContent(s)),i.getArrayData()},e.prototype.encodeSetRTCOutData=function(e,t,n){var r=this._codec.getModule(Rn);r.setTarget(t),L(e)||(e=[e]),At(e,(function(t,n){t.key=t.key?t.key.toString():t.key,t.value=t.value?t.value.toString():t.value,e[n]=t})),r.setValueInfo(e);var i=(n=n||{}).name,o=n.content;return!x(i)&&r.setObjectName(i),x(o)||(P(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()},e.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(Mn);return t.setUserId(e),t.getArrayData()},e.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(Sn);return t.setState(e),t.getArrayData()},e.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(An);return e.setOrder(2),e.getArrayData()},e.prototype.encodeSetRTCUserInfo=function(e,t){var n=this._codec.getModule(wn);return n.setKey(e),n.setValue(t),n.getArrayData()},e.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(bn);return t.setKey(e),t.getArrayData()},e.prototype.encodeIdentityChangeInfo=function(e,t,n){void 0===n&&(n=!1);var r=this._codec.getModule(Tn);return r.setRoomType(exports.RTCMode.LIVE),t&&r.setBroadcastType(t),r.setIdentityChangeType(e),r.setNeedSysChatroom(n),r.getArrayData()},e.prototype.encodePullRTCRoomKV=function(e,t){var n=this._codec.getModule(br);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()},e.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(Dr);return t.setUserId(e),t.getArrayData()},e.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=this._codec.getModule(kr);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setTimeoutTime(i),s.setInviteInfo(o),s.getArrayData()},e.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=this._codec.getModule(Gr);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(r),o.setInviteInfo(i),o.getArrayData()},e.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree?1:0,u=this._codec.getModule(Br);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(o),u.setValue(s),u.setAnswerCode(a),u.getArrayData()},e.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=this._codec.getModule(Fr);return o.setInviteRoomId(t),o.setInviteSessionId(n),o.setInviteContent(r),o.setInviteRoomKeys(i),o.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(Hr);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e}(),Di=function(e,t){this._watcher=t,this.codec=new Pi(e)};function xi(e,t,n){if(e&&je){var r=Ve(Pe(exports.LogLevel.STATISTICS),e,t,n);return je.reportRealtimeLog([r]).then((function(){We(exports.LogTagId.G_UPLOAD_LOG_S,"big data realtime report success")})).catch((function(e){We(exports.LogTagId.G_UPLOAD_LOG_E,"big data realtime report error -> "+e)}))}}!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(ri||(ri={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(ii||(ii={}));var Vi,ki,Gi={},Bi={sdkPrivate:ri.OPEN,serverPrivate:ri.OPEN,bundleId:"lib-next"};function Fi(e){Bi.sdkPrivate=e.sdkPrivate===ri.PRIVATE?ri.PRIVATE:ri.OPEN,Bi.serverPrivate=e.serverPrivate===ri.PRIVATE?ri.PRIVATE:ri.OPEN,e.bundleId&&(Bi.bundleId=e.bundleId)}function Hi(){return Bi}function Ki(e,t,n){void 0===t&&(t={}),void 0===n&&(n=!1),P(t)&&e&&(Gi[e]&&!n||(Gi[e]={}),Gi[e]=f(f({},Gi[e]),t))}function qi(e){return Gi[e]||{}}exports.HttpMethod=void 0,(Vi=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",Vi.POST="POST",exports.NetworkType=void 0,(ki=exports.NetworkType||(exports.NetworkType={})).WIFI="wifi",ki.FOUR_G="4g",ki.THREE_G="3g",ki.TWO_G="2g",ki.FIVE_G="2g",ki.THREE_GENT="3gnet",ki.UNKONWN="unknown";var Yi,ji=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Qi=function(){function e(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return ji(e,t)},e.prototype.read=function(e,t,n){this.readMessage(e,t,n)},e.prototype.readMessage=function(e,t,n){return{stream:e,length:t}},e}(),Wi=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Kt(e,!1,_t.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return ji(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 jt;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),Ji=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Tt.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return p(t,e),t.prototype.readMessage=function(e,n,r){if(e.readByte(),this.status=+e.readByte(),n<=t.MESSAGE_LENGTH)return{stream:e,length:n};if(r===vt.V4){var i=e.readByte();1&i&&(this.userId=e.readUTF()),2&i&&e.readUTF(),4&i&&(this.timestamp=e.readLong()),8&i&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var o=e.readUTF();ht.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(Qi),zi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Tt.DISCONNECT,t.status=0,t}return p(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(Qi),Zi=function(e){function t(){var t=e.call(this,mt.PING_REQ)||this;return t._name=Tt.PING_REQ,t}return p(t,e),t.prototype.writeMessage=function(e){},t}(Wi),Xi=function(e){function t(t){var n=e.call(this,t)||this;return n._name=Tt.PING_RESP,n}return p(t,e),t}(Qi),$i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return p(t,e),t.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},t}(Qi),eo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return p(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}(Wi),to=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Tt.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=yt.PUB,t}return p(t,e),t.prototype.readMessage=function(t,n){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.data=t.readAll(),{stream:t,length:n}},t}($i),no=function(e){function t(t,n,r){var i=e.call(this,mt.PUBLISH)||this;return i._name=Tt.PUBLISH,i.syncMsg=!1,i.identifier=yt.PUB,i.topic=t,i.data=M(n)?qt.writeUTF(n):n,i.targetId=r,i}return p(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(eo),ro=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Tt.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=yt.PUB,t.topic="",t.targetId="",t}return p(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:n}},t}($i),io=function(e){function t(t){var n=e.call(this,mt.PUB_ACK)||this;return n._name=Tt.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return p(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(eo),oo=function(e){function t(t,n,r){var i=e.call(this,mt.QUERY)||this;return i.name=Tt.QUERY,i.identifier=yt.QUERY,i.topic=t,i.data=M(n)?qt.writeUTF(n):n,i.targetId=r,i}return p(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(eo),so=function(e){function t(t){var n=e.call(this,mt.QUERY_CONFIRM)||this;return n._name=Tt.QUERY_CON,n.messageId=t,n}return p(t,e),t}(eo),ao=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Tt.QUERY_ACK,t.status=0,t.identifier=yt.QUERY,t.topic="",t.targetId="",t}return p(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:n}},t}($i),uo=function(e){var t,n=e.type;switch(n){case mt.CONN_ACK:t=new Ji(e);break;case mt.PUBLISH:(t=new to(e)).syncMsg=e.syncMsg;break;case mt.PUB_ACK:t=new ro(e);break;case mt.QUERY_ACK:t=new ao(e);break;case mt.SUB_ACK:case mt.UNSUB_ACK:case mt.PING_RESP:t=new Xi(e);break;case mt.DISCONNECT:t=new zi(e);break;default:t=new Qi(e),ht.error("No support for deserializing "+n+" messages")}return t};!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.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf",e[e.ugUnpushQuery=94]="ugUnpushQuery",e[e.ugUnpushSet=95]="ugUnpushSet",e[e.setRtcRoomId=96]="setRtcRoomId"}(Yi||(Yi={}));var co,ho,lo=Yi,po=function(e,t,n,r,i,o,s,a){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(o,"&pid=").concat(s,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(a?"&protocolVer="+a:"")},fo=function(e){return[lo.ppMsgS,lo.pgMsgS,lo.chatMsgS].map((function(e){return lo[e]})).indexOf(e)>=0};!function(e){e[e.REDIRECT=0]="REDIRECT",e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.REMOTE_CLOSE=3]="REMOTE_CLOSE",e[e.LOGOUT=4]="LOGOUT",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW"}(co||(co={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_COMET="IM-stats_comet-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S"}(ho||(ho={}));var go=function(e,t){ht.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)};var _o=function(e){function t(t,n){var r=e.call(this,"websocket",n)||this;return r._runtime=t,r._socket=null,r._messageIds={},r._syncMessageIds={},r._failedCount=0,r.ALLOW_FAILED_TIMES=2,r._timer=null,r._idCount=0,r._generateMessageId=function(){return r._idCount>=65535&&(r._idCount=0),++r._idCount},r}return p(t,e),t.prototype.connect=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s=this;return m(this,(function(a){return[2,new Promise((function(a){var u=n.slice(),c=!1,h=function(){return _(s,void 0,void 0,(function(){var n,s,l;return m(this,(function(d){switch(d.label){case 0:return 0===u.length||c?[2]:(c=!0,n=u.shift(),Ki(ho.IM_WEBSOCKET,{startTime:(new Date).getTime(),host:n,protocol:ii.WS}),[4,this._connect(e,t,n,r,i,o)]);case 1:if(s=d.sent(),l=s===Y.SUCCESS||s===W.REDIRECT?s:xt(s),Ki(ho.IM_WEBSOCKET,{endTime:(new Date).getTime(),code:l}),function(e){_(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f;return m(this,(function(g){switch(g.label){case 0:t=ho.IM_WEBSOCKET,n=Hi(),r=n.sdkPrivate,i=n.serverPrivate,o=n.bundleId,s=qi(t),a=s.protocol,u=s.startTime,c=s.endTime,h=s.code,l=s.host,d=exports.NetworkType.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return p=g.sent(),ht.info(p.message),[3,4];case 4:return f=0,A(u)&&A(c)&&c>u&&u&&(f=c-u),xi(t,{spr:r,pr:i,bid:o,ptc:a,dur:f,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),s===Y.SUCCESS)this._checkAlive(),a(s);else if(s===W.REDIRECT)a(s);else{if(0===u.length)return a(xt(s)),[2];c=!1,h()}return[2]}}))}))};i=C(i),s._watcher.status(Q.CONNECTING),h()}))]}))}))},t.prototype._connect=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s,a,u,c,h,l=this;return m(this,(function(d){switch(d.label){case 0:return s=r.replace("http","ws"),a=po(s,n,e,t,this._runtime,i,"",o),ht.info("conenct start -> ".concat(a)),this.sendConnectTime=Date.now(),u=this._runtime.createWebSocket(a),c=function(e){l._timer&&(clearTimeout(l._timer),l._timer=null),l._socket===u&&(l._socket=null,l._watcher.status(e))},[4,new Promise((function(e){u.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=function(e,t){var n=new Uint8Array(e),r=new Yt(n),i=r.readByte(),o=new Kt(i),s=uo(o);return s.read(r,n.length-1,t),s}(t,o);if(n instanceof Xi&&l._pingResolve)return l._pingResolve(Y.SUCCESS),void(l._pingResolve=void 0);if(n instanceof Ji)return ht.info("recv connect ack -> ".concat(n.status)),n.status!==W.ACCEPTED?(ht.warn("connect failed: ".concat(n.status)),void e(n.status)):(ht.info("connect success -> ".concat(a)),l.connectedTime=n.timestamp,l.userId=n.userId||"",l._idCount=n.messageId,void e(Y.SUCCESS));if(n instanceof zi){var r=n.status;switch(ht.warn("recv disconnect signal -> status: ".concat(r)),r){case co.BLOCK_NEW:case co.BLOCK:l._watcher.status(Q.BLOCKED);break;case co.OTHER_DEVICE_LOGIN:l._watcher.status(Q.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case co.REDIRECT_NEW:case co.REDIRECT:l._watcher.status(Q.REDIRECT);break;default:l._watcher.status(Q.DISCONNECT_BY_SERVER)}}else l._onReceiveSignal(n)}else ht.error("Socket received invalid data:",t)})),u.onClose((function(t,n){for(var r in ht.warn("websocket closed! code:",t,"reason:",n),c(Q.CONNECTION_CLOSED),l._messageIds){var i=l._messageIds[r];delete l._messageIds[r],i(Y.RC_NET_CHANNEL_INVALID)}e(t)})),u.onError((function(t){for(var n in ht.error("websocket error!",null==t?void 0:t.stack),c(Q.WEBSOCKET_ERROR),l._messageIds){var r=l._messageIds[n];delete l._messageIds[n],r(Y.RC_NET_CHANNEL_INVALID)}e(Y.NETWORK_ERROR)})),u.onOpen((function(){return ht.info("websocket open =>",a)})),setTimeout((function(){e(Y.TIMEOUT)}),5e3)}))];case 1:return(h=d.sent())===Y.SUCCESS?this._socket=u:(ht.warn("connect result -> code: ".concat(h,", url: ").concat(a)),u.close()),[2,h]}}))}))},t.prototype._checkAlive=function(){var e;return _(this,void 0,void 0,(function(){var t,n,r=this;return m(this,(function(i){switch(i.label){case 0:return this._socket?(ht.info("send ping ->"),this.sendOnly(new Zi),t=Ke(),We(exports.LogTagId.L_CHECK_ALIVE_IM_T,{},{traceId:t}),[4,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(Y.TIMEOUT)}),15e3)}))]):[2];case 1:return n=i.sent(),(n===Y.SUCCESS?We:Je)(exports.LogTagId.L_CHECK_ALIVE_IM_R,{isSuccess:n===Y.SUCCESS},{traceId:t}),n!==Y.SUCCESS?(this._failedCount+=1,ht.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(n)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,ht.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._socket=null,this._watcher.status(Q.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(ht.info("recv ping <-"),this._failedCount=0,setTimeout((function(){return r._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a=this;return m(this,(function(u){switch(u.label){case 0:return t=e.messageId,e.header&&e.header.qos!==_t.AT_MOST_ONCE&&(e instanceof to&&!e.syncMsg&&(ht.info("send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new io(t))),e instanceof ao&&(ht.info("send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new so(t)))),t>0&&(e instanceof ro||e instanceof ao)&&(ht.info("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 to?(i=e.syncMsg,o=e.topic,ht.info("recv PublishReader -> messageId: ".concat(t," ").concat(o)),o===lo[lo.userSetData]?[2]:!i||fo(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){a._syncMessageIds[t]=e}))]):[3,2];case 1:s=u.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,s),u.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof no||e instanceof oo)&&(e.messageId=this._generateMessageId()),go(e,this._socket))},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),_(this,void 0,void 0,(function(){var i,o,s,a,u=this;return m(this,(function(c){switch(c.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,go(e,this._socket),[4,new Promise((function(e){u._messageIds[i]=e,setTimeout((function(){u._messageIds[i]&&delete u._messageIds[i],e()}),r)}))]):[3,2];case 1:return(o=c.sent())?o instanceof ao||o instanceof ro?(s=t&&o.data&&[Y.SUCCESS,Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(ht.warn("send failed -> message: ".concat(i,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:Y.SUCCESS,data:a}]):[2,{code:o}]:(ht.warn("send timeout -> message: ".concat(i,", respPBName: ").concat(t,", timeout: ").concat(r)),[2,{code:Y.TIMEOUT}]);case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(Q.DISCONNECTED))},t}(Di);var mo=function(e){function t(t,n){var r=e.call(this,"comet",n)||this;return r._runtime=t,r._messageIds={},r._syncMessageIds={},r._idCount=0,r._generateMessageId=function(){return++r._idCount},r._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),r}return p(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=M(e.data)?JSON.parse(e.data):e.data;return n?!L(n)||(At(n,(function(e){return _(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d=this;return m(this,(function(p){switch(p.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new Kt(t),r=uo(n);for(var i in e)r[i]=e[i];return r}(e),r=n.messageId,i=n._header,o=n.status,n.identifier,s=i&&i.qos!==_t.AT_MOST_ONCE,r&&n.getIdentifier&&((a=this._messageIds[r])&&a(n),this._syncMessageIds[r]&&this._syncMessageIds[r](n)),s&&(n instanceof to&&!n.syncMsg&&(u=new io(r),this.sendOnly(u)),n instanceof ao&&(u=new so(r),this.sendOnly(u))),n instanceof zi){switch(o){case co.OTHER_DEVICE_LOGIN:this._watcher.status(Q.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case co.BLOCK:case co.BLOCK_NEW:this._watcher.status(Q.BLOCKED);break;case co.REDIRECT_NEW:case co.REDIRECT:this._watcher.status(Q.REDIRECT);break;default:this._watcher.status(Q.DISCONNECT_BY_SERVER)}return[2]}return n instanceof to?(c=n.syncMsg,h=n.topic,!c||fo(h)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){d._syncMessageIds[r]=e}))]):[3,2];case 1:l=p.sent(),delete this._syncMessageIds[r],this._watcher.signal(n,l),p.label=2;case 2:return[2]}}))}))})),!0):(ht.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o;return m(this,(function(s){switch(s.label){case 0:return t=(new Date).getTime(),n="".concat(e,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"&timestrap=").concat(t,"&pid=").concat(this._pid),r=Ke(),We(exports.LogTagId.L_CHECK_ALIVE_IM_T,{},{traceId:r}),[4,this._runtime.httpReq({url:n,body:{pid:this._pid},timeout:45e3})];case 1:return i=s.sent(),o=this.handleCometRes(i),(o?We:Je)(exports.LogTagId.L_CHECK_ALIVE_IM_R,{isSuccess:o},{traceId:r}),this._isDisconnected||(o?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(Q.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var o,s,a=this;return m(this,(function(u){return i=C(i),this._protocol=r,this._isDisconnected=!1,this._watcher.status(Q.CONNECTING),o=n.slice(),s=!1,[2,new Promise((function(n){var u=function(){return _(a,void 0,void 0,(function(){var a,c,h;return m(this,(function(l){switch(l.label){case 0:return 0===o.length||s?[2]:(s=!0,a=o.shift(),Ki(ho.IM_COMET,{startTime:(new Date).getTime(),host:a,protocol:ii.NAVI}),[4,this._connect(e,t,a,r,i)]);case 1:if(c=l.sent(),h=c===Y.SUCCESS||c===W.REDIRECT?c:xt(c),Ki(ho.IM_COMET,{endTime:(new Date).getTime(),code:h}),function(e){_(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f;return m(this,(function(g){switch(g.label){case 0:t=ho.IM_COMET,n=Hi(),r=n.sdkPrivate,i=n.serverPrivate,o=n.bundleId,s=qi(t),a=s.protocol,u=s.startTime,c=s.endTime,h=s.code,l=s.host,d=exports.NetworkType.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return p=g.sent(),ht.info(p.message),[3,4];case 4:return f=0,A(u)&&A(c)&&c>u&&u&&(f=c-u),xi(t,{spr:r,pr:i,bid:o,ptc:a,dur:f,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),c===Y.SUCCESS)this._startPullSignal(r),n(c);else if(c===W.REDIRECT)n(c);else{if(0===o.length)return n(xt(c)),[2];s=!1,u()}return[2]}}))}))};a._watcher.status(Q.CONNECTING),u()}))]}))}))},t.prototype._connect=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(ht.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(function(e){if(P(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t}(e.data)?P(e.data)?e.data:JSON.parse(e.data):(ht.error("received data is not a validJson",e.data),!1))},s=po(r,n,e,t,this._runtime,i,this._pid),this.sendConnectTime=Date.now(),ht.info("conenct start -> ".concat(s)),[4,this._runtime.httpReq({url:s,body:{pid:this._pid},timeout:5e3})];case 1:return a=c.sent(),u=o(a),this._domain=n,u&&0===u.status?(this._sessionid=u.sessionid,this.userId=u.userId,this.connectedTime=u.timestamp,We("connect success -> userId: ".concat(u.userId,", url: ").concat(s))):ht.warn("connect result -> code: ".concat(null==u?void 0:u.status,", url: ").concat(s)),[2,null==u?void 0:u.status]}}))}))},t.prototype.sendCometData=function(e,t){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return n=(t=this)._domain,r=t._sessionid,i=t._pid,o=e.messageId,s=e.topic,a=e.targetId,e.identifier,u=e.getHeaderFlag(),c=s?"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(u,"&sessionid=").concat(r,"&topic=").concat(s,"&targetid=").concat(a,"&pid=").concat(i):"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(u,"&sessionid=").concat(r,"&pid=").concat(i),[4,this._runtime.httpReq({url:c,method:exports.HttpMethod.POST,body:e.getCometData()})];case 1:return h=l.sent(),this.handleCometRes(h),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),_(this,void 0,void 0,(function(){var i,o,s,a,u=this;return m(this,(function(c){switch(c.label){case 0:return i=this._generateMessageId(),e.messageId=i,this.sendCometData(e),[4,new Promise((function(e){u._messageIds[i]=e,setTimeout((function(){delete u._messageIds[i],e()}),r)}))];case 1:return(o=c.sent())?(s=t&&o.data&&[Y.SUCCESS,Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?a:null}]:[2,{code:Y.SUCCESS,data:a}]):[2,{code:Y.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(Q.DISCONNECTED)},t}(Di),To=function(e){return["navi",e].join("_")};function yo(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f;return m(this,(function(g){switch(g.label){case 0:t=ho.IM_NAVI,n=Hi(),r=n.sdkPrivate,i=n.serverPrivate,o=n.bundleId,s=qi(t),a=s.protocol,u=s.startTime,c=s.endTime,h=s.code,l=s.host,d=exports.NetworkType.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return p=g.sent(),ht.debug(p.message),[3,4];case 4:return f=0,A(u)&&A(c)&&c>u&&u&&(f=c-u),xi(t,{spr:r,pr:i,bid:o,ptc:a,dur:f,cod:h,hos:l,net:d}),[2]}}))}))}var vo=function(){function e(e,t,n){this.runtime=e,this._watcher=t,this._options=n,this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this._apiVersion=C(this._options.apiVersion)}return e.prototype.getNaviInfo=function(e,t,n,r){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return n&&this._clear(e),r=function(e,t,n){var r,i,o=To(e);try{var s=n.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5}))),0===i.length?n.removeItem(o):n.setItem(o,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null}(this._appkey,e,this.runtime.localStorage),r?[2,r]:(i=this._options.navigators.slice(),t.length&&t.forEach((function(e){i.indexOf(e)<0&&i.unshift(e)})),[4,this.requestNaviInfo(i,this._appkey,e)]);case 1:return(r=o.sent())?(this.setNaviInfo2Cache(e,r),[2,r]):[2,r]}}))}))},e.prototype.setNaviInfo2Cache=function(e,t){!function(e,t,n,r){var i,o=To(e);try{var s=r.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5&&t!==e.token}))),i.push({timestamp:a,naviInfo:n,token:t}),r.setItem(o,JSON.stringify(i))}(this._appkey,e,t,this.runtime.localStorage)},e.prototype._clear=function(e){!function(e,t,n){var r,i=To(e);try{var o=n.getItem(i);r=o?JSON.parse(o):[]}catch(e){r=[]}var s=Date.now();r.length>0&&(r=r.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this.runtime.localStorage)},e}(),Eo=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},e.prototype.getCoreVersion=function(){return this._context.coreVersion},e.prototype.getAPIVersion=function(){return this._context.apiVersion},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.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},e}(),Io=function(e,t,n){return[e,t,n].join("_")},Co=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})},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=Io("inbox",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=Io("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||x(e))){n.broadcastSyncTime=e;var r=Io("broadcastbox",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=Io("broadcastbox",this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n))||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=Io("outbox",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=Io("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),Ro={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},So=function(){function e(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}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===ce.DELETE,u=s===o,c=!this._isExisted(n),h=a?this._remove:this._add;(t||i||u||c)&&h.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)})),ht.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),No=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return m(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=Ro.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===Y.SUCCESS?(Ro.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Ro.clear(e);var t=this._storeCaches[e];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];k(r)||(r=new So(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}(),Oo=function(){function e(e,t,n,r){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=r,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){ht.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],k(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}(),Mo="converStatusChanged",Uo=function(){function e(e,t,n){this._eventEmitter=new lt,this._pullQueue=[],this._isPulling=!1,this._storage=c(e.runtime),this._appkey=t,this._currentUserId=n,this._engine=e,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n)}return e.prototype._set=function(e){var t=this;if(!x(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(Mo,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return _(this,void 0,void 0,(function(){var e,t,n,r;return m(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===Y.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(Mo,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(Mo,(function(e){}))},e}(),Ao={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}},Lo={};for(var wo in Ao){var bo=Ao[wo].keyName;Lo[bo]=wo}var Po,Do=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var r="con-".concat(t,"-").concat(n);this.storage=new l(e,r),this._localStore=new l(e,"CONVER-".concat(t,"-").concat(n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:S.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,r=e.targetId,i=e.messageType,o=e.isMentioned,s=e.content,a=e.senderUserId,u=e.channelId,c=this._getStoreKey(n,r,u),h=this._localStore.get(c)||{},l=Lo.mentionedInfo,d=Lo.hasMentioned,p=h[l]||{},f=p.userIdList||[],g=s.mentionedInfo;if(g){if(o&&n===S.GROUP)(g.userIdList||[]).forEach((function(e){e===t._currentUserId&&f.indexOf(a)<0&&f.push(a)})),g.type===ne.ALL&&f.indexOf(a)<0&&f.push(a);if(i===z.RECALL&&n===S.GROUP){var _=f.indexOf(a);_>=0&&f.splice(_,1)}g={userIdList:f,type:(null==g?void 0:g.type)||p.type},0!==f.length?(h[l]=g,h[d]=!0):(delete h[l],delete h[d]),k(h)?this._localStore.set(c,h):this._localStore.remove(c)}},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=Lo[s],u=n[s];if(!x(a)&&!x(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(u===Ao[a].defaultVal||"tags"===s&&!k(u))delete o[a];else if("tags"===s){var c=u;for(var h in c)c[h].isTop||delete c[h].isTop;o[a]=u}else o[a]=u;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}k(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 Ao){var a=Ao[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Pt(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(Ao[a]){var u=Ao[a],c=u.keyName,h=u.defaultVal;o[c]=s[a]||Pt(h)}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=Ao[u],h=c.keyName,l=c.defaultVal;s[h]=a[u]||Pt(l)}for(var d in s.tags){x(t[d])&&(t[d]=[]);var p=Object.assign({},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){ht.error("adaptOldStore error: ".concat(e.message))}},e}(),xo=[S.PRIVATE,S.GROUP,S.SYSTEM,S.PUBLIC_SERVICE,S.APP_PUBLIC_SERVICE],Vo="conversationChanged",ko="conTagStatusChanged",Go=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new lt,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new Do(e.runtime,t,n),this._statusManager=new Uo(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Vo,(function(e){r(e)})),this._eventEmitter.on(ko,(function(){i()}))}return 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===K.SEND&&a===this._loginUserId,c=r===z.RECALL,h=P(n),l=!1,d={},p=t.lastUnreadTime||0,f=t.lastReadTime||0,g=t.unreadMessageCount||0;if(p>i||u)return{hasChanged:l,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=g+1,t.lastUnreadTime=i,l=!0),c&&h){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),m=!this._recallMsgTimeMap[_]||this._recallMsgTimeMap[_]&&!this._recallMsgTimeMap[_].find((function(e){return e===n.sentTime})),T=p>=n.sentTime;f&&(T=f<n.sentTime),T&&g&&m&&(!this._recallMsgTimeMap[_]&&(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=g-1,l=!0)}return l&&(d.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:l,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;K.SEND;var o=P(n),s=!1,a={};return r&&o&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0,a.hasMentioned={val:!0,time:i},a.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:s,localConversation:t,updateItems:a}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===K.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===ne.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(P(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,h={},l={};n!==S.ULTRA_GROUP&&(x(o)||(l.notificationStatus={time:i,val:o}),x(s)||(l.notificationLevel={time:i,val:s}),x(a)||(l.isTop={time:i,val:a}),x(u)||(l.tags={time:i,val:u},null==u||u.forEach((function(e){h[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,h,c),this._store.set(n,r,{notificationStatus:o,notificationLevel:s,isTop:a,tags:h},c),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:l,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(Vo,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(ko),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId;if(xo.indexOf(r)>=0){var a=!1,u=this._store.get(r,o,s),c={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,u),i=r.hasChanged,o=r.localConversation,s=r.updateItems;a=a||i,c=f(f({},c),s),u=Pt(o)})),a&&this._store.set(r,o,u,s),this._store.updateMentionedData(e),i){var h=this._store.get(r,o,s);h.updatedItems=f({latestMessage:{time:e.sentTime,val:e}},c),h.latestMessage=e;var l=Object.assign(h,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(l)}(a||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||1!==o||s===ee.NOT_SET||s===ee.ALL_MESSAGE)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),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).tags;i=Object.assign(i,n),this._store.set(e,t,{tags:i},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===X.OPEN||-1!==e.notificationLevel&&0!==e.notificationLevel})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===e&&(e=""),this.get(t,n,e).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}(),Bo=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=c(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 _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return m(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!==Y.SUCCESS||x(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,x(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}(),Fo=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return m(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===Y.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}(),Ho=function(e,t){return["send_msg",e,t].join("_")},Ko=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=Ho(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=Ho(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=Ho(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}();(Po={})[S.PRIVATE]=lo.qryPMsg,Po[S.GROUP]=lo.qryGMsg,Po[S.CHATROOM]=lo.qryCHMsg,Po[S.CUSTOMER_SERVICE]=lo.qryCMsg,Po[S.SYSTEM]=lo.qrySMsg;var qo=[lo[lo.recallMsg],lo[lo.ppMsgS],lo[lo.pgMsgS],lo[lo.ppMsgP],lo[lo.pgMsgP],lo[lo.chatMsg],lo[lo.pcMsgP],lo[lo.prMsgS],lo[lo.updUgRTime]],Yo=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 l(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=Qo[s],u=n[s];if(!x(a)&&!x(u))u===jo[a].defaultVal?delete o[a]:o[a]=u}k(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 jo){var a=jo[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Pt(c)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),jo={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Qo={};for(var Wo in jo){var Jo=jo[Wo].keyName;Qo[Jo]=Wo}var zo=function(){function e(e,t,n){this._store=new Yo(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===S.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}(),Zo=function(e,t,r,i,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:K.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}},Xo=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}))},$o=0,es=function(){return++$o},ts=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.naviInfo=null,i._customMessageType={},i._reconnectTimer=-1,i._pullOfflineFinished=!1,i._conversationUpdatedTime=0,i._miniConnectUrl="",i.currentUserId="",i._connectedTime=0,i._localConnectedTime=0,i._status=Q.DISCONNECTED,i._pullingMsg=!1,i._pullQueue=[],i._chrmsQueue={},i._latestSyncTimestamp=0,i._intervalTimer=-1,i._pullChatroomEntryTimestamp=0,i._intervalTimerForChrmPull=-1,i._lastSyncUltraMsgTimeStamp=0,i._lastSyncUltraMsgLocalTimeStamp=0,i._ultraGroupTimer=-1,i._isUltraPulling=!1,i._ultraGroupTimeQue=[],i._isUltraGroupListExist=!1,i._ultraGroupMap={},i._firstPullUltraGroupTime=0,i._ultraMsgMap={},i._pullUltraChangeMessageQue=[],i._isPullingUltraChangeMessage=!1,i._lastPullingUltraChangeMessageTime=0,i._ultraMsgChangeMap={},i._letterbox=new Co(t,r.appkey),i._sendMessageStore=new Ko(t,r.appkey),i._chrmEntryHandler=new No(i),i._connectType=r.connectionType,i}return p(t,e),t.prototype._formatJSONPUrl=function(e,t,n,r){var i=this.runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(i,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(r,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())},t.prototype.getNaviInfo=function(t,n,r){var s;return _(this,void 0,void 0,(function(){var a;return m(this,(function(u){return this.runtime.useNavi||(a=void 0,a=this.runtime.isSupportSocket()&&"websocket"===this._connectType?i.join(","):o.join(","),this._miniConnectUrl=(null===(s=this._options.miniCMPProxy)||void 0===s?void 0:s.length)?this._options.miniCMPProxy.join(","):a||"",n=[]),[2,e.prototype.getNaviInfo.call(this,t,n,r)]}))}))},t.prototype.requestNaviInfo=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l,d,p;return m(this,(function(f){switch(f.label){case 0:r="getServerEndpoint",i=0,o=e.length,f.label=1;case 1:return i<o?(s=this._formatJSONPUrl(e[i],n,t,r),Qe("req navi => ".concat(s)),[4,this.runtime.httpReq({url:s,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(a=f.sent(),u=(new Date).getTime(),Ki(ho.IM_NAVI,{endTime:u}),200!==a.status)return c=void 0,403===a.status?(c=Y.RC_CONN_USER_OR_PASSWD_ERROR,ze("request navi error: "+c)):401===a.status&&(c=Y.RC_CONN_APP_BLOCKED_OR_DELETED,ze("request navi error: "+c)),Ki(ho.IM_NAVI,{code:c}),yo(this.runtime),[3,3];try{return h=a.data.match(/{[\d\D]+}/),0===(l=h&&h[0]?h[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),p=JSON.parse(l),d=/^https/.test(s)?"https":"http",p.protocol=d,this.runtime.useNavi||(p.server="",p.backupServer=this._miniConnectUrl,p.logSwitch=0),Fi({serverPrivate:p.type===ri.PRIVATE?ri.PRIVATE:ri.OPEN}),Ki(ho.IM_NAVI,{code:Y.SUCCESS}),p.userId&&(st({userId:p.userId}),qe({userId:p.userId})),yo(this.runtime),[2,p]}catch(e){ze("parse navi err =>",e)}f.label=3;case 3:return i+=1,[3,1];case 4:return this.runtime.useNavi?[2,null]:(p={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",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._miniConnectUrl},Ki(ho.IM_NAVI,{code:p.code,startTime:0,endTime:0,host:""}),yo(this.runtime),[2,p])}}))}))},t.prototype.getNaviInfoFromCache=function(){return this.naviInfo?f({},this.naviInfo):null},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a=this;return m(this,(function(u){switch(u.label){case 0:return n=[],this.naviInfo=t,t.server?n.push(t.server):ht.warn("navi.server is invalid"),(r=t.backupServer)&&r.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(ht.error("navi invaild.",n),[2,Y.UNKNOWN]):(i=this.runtime.createDataChannel({status:function(r){a._connectionStatusHandler(r,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=vt.V3,1===t.openAnti&&(o=vt.V4),[4,i.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(s=u.sent())===Y.SUCCESS?(this._channel=i,this.currentUserId=i.userId,this._connectedTime=i.connectedTime,this._localConnectedTime=Math.floor((Date.now()+i.sendConnectTime)/2),this._watcher.status(Q.CONNECTED),this._status=Q.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new Go(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._ultraGroupManager=new zo(this,this._appkey,this.currentUserId),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Bo(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new Fo(this),this._joinedChrmManager=new Oo(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval(),1===t.ugMsg&&this._startUltraSyncInterval()):i.close(),[2,s]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,r){if(ht.warn("connection status changed:",e),this._status=e,e!==Q.CONNECTING)if(e!==Q.CONNECTED){if(this._channel&&e!==Q.DISCONNECTED)return e===Q.BLOCKED||e===Q.KICKED_OFFLINE_BY_OTHER_CLIENT||e===Q.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==Q.REDIRECT?(this._watcher.status(e),this._try2Reconnect(t,n,r)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)},t.prototype._try2Reconnect=function(e,t,n){var r,i;return _(this,void 0,void 0,(function(){var o,s=this;return m(this,(function(a){switch(a.label){case 0:return this._channel?(o=vt.V3,1===(null===(r=this.naviInfo)||void 0===r?void 0:r.openAnti)&&(o=vt.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,o)]):[2];case 1:return a.sent()===Y.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(Q.CONNECTED),this._status=Q.CONNECTED,1===(null===(i=this.naviInfo)||void 0===i?void 0:i.ugMsg)&&this._startUltraSyncInterval(),this._rejoinChrm(),[2]):(this._watcher.status(Q.WEBSOCKET_UNAVAILABLE),this._status=Q.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(e,t,n)}),5e3),[2])}}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=lo[r];if(i)switch(i){case lo.s_ntf:ht.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case lo.s_msg:this._receiveMsg(e);break;case lo.s_cmd:this._receiveStateNotify(e);break;case lo.s_us:this._receiveSettingNotify(e);break;case lo.rtc_ntf:this._receiveRtcKv(e);break;case lo.s_opNtf:this._pullOperateStatusNotify(e)}else ht.error("unknown topic:",r)}},t.prototype._receiveStateNotify=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,tn),r=n.time,i=n.type,o=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(o,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(r),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(r),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,$n)).version;this._userSettingManager.pullUserSettings(n)},t.prototype._receiveRtcKv=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,wr),r=n.time,i=n.type,o=n.roomId;if(1===i)this._rtcKVManager.pullEntry(o,r)},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._receiveSyncMsg=function(e,t){var n,r;if(qo.includes(e.topic)){if(e.topic===lo[lo.updUgRTime]){var i=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,pn),o=i.channelId,s=i.busChannel,a=this._ultraGroupMap[s+"_"+o];return a&&(a.unreadMessageCount=0,a.unreadMentionedCount=0,a.lastReadTime=t.timestamp,this._watcher.conversation(kt([a]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var u=null===(r=this._channel)||void 0===r?void 0:r.codec.decodeByPBName(e.data,Qt,{currentUserId:this.currentUserId,signal:e});u=this._handleMsgProperties(u),t&&(u.sentTime=t.timestamp,u.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||u.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),u.messageType!==z.EXPANSION_NOTIFY?(u.messageType===z.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(u.conversationType,u.targetId,u.channelId),this._conversationManager.setConversationCacheByMessage(u,!0),this._watcher.batchMessage([u])):this._receiveMessageExpansion(u))}},t.prototype._pullMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,tn),n=t.type,r=t.chrmId,i=t.time;if(ht.info("s_ntf -> type: ".concat(n,", chrmId: ").concat(r,", 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)},t.prototype._syncMsg=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,h,l,d,p,f,g,_,T,y,v=this;return m(this,(function(m){switch(m.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),ht.info("pullMsg -> sendboxTime: ".concat(e,", inboxTime: ").concat(t,", broadcastSyncTime: ").concat(n)),r=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),i=new oo(lo[lo.pullMsg],r,this.currentUserId),o=Ke(),We(exports.LogTagId.L_PULL_MSG_T,{outboxTime:e,inboxTime:t,broadcastSyncTime:n},{traceId:o}),[4,this._channel.send(i,zt,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=m.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),a!==Y.SUCCESS||!u||x(u.finished)||x(u.list)||x(u.syncTime)?(ht.warn("pullMsg failed -> code:",a,", data: ",u),Je(exports.LogTagId.L_PULL_MSG_R,{code:a,timestamp:this._latestSyncTimestamp},{traceId:o}),this._pullingMsg=!1,[2]):(c=u.list,h=u.finished,l=u.syncTime,d=u.broadcastSyncTime,p=void 0===d?1:d,ht.info("pullMsg success -> syncTime: ".concat(l,", finished: ").concat(h)),f=0,g=[],_=[],c.forEach((function(e){if((g.push(e.messageUId),e.messageDirection===K.SEND)&&(f=Math.max(e.sentTime,f),v._sendMessageStore.getSendMessageMap()[e.messageUId]))return void v._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==z.EXPANSION_NOTIFY){if(e.messageType===z.SYNC_READ_STATUS){if(e.senderUserId!==v.currentUserId)return;v._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=v._handleMsgProperties(e);v._conversationManager.setConversationCacheByMessage(t,!0),_.push(t)}else v._receiveMessageExpansion(e)})),this._watcher.batchMessage(_),this._letterbox.setInboxTime(l,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>l})),this._pullQueue.length=0,(y=this._pullQueue).push.apply(y,T),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),We(exports.LogTagId.L_PULL_MSG_R,{code:a,messageUIds:g.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h},{traceId:o}),(!h||T.length>0)&&this._syncMsg(),[2])}}))}))},t.prototype._receiveMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Jt,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});if((t=this._handleMsgProperties(t)).conversationType!==S.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!==z.EXPANSION_NOTIFY?t.messageType===z.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,r=e.messageType,i=e.isCounted,o=e.isPersited,u=e.isStatusMessage,c=r in s,h=r in this._customMessageType;if(n=c?f(f({},s[r]),{isStatusMessage:a.includes(r)}):h?this._customMessageType[r]:{isCounted:!V(i)&&i,isPersited:!V(o)&&o,isStatusMessage:!1},Object.assign(e,n),t&&!x(u)&&(e.isStatusMessage=u),!t){var l=e.content.user;if(l){var d=l.portrait,p=l.portraitUri,g=d||p;g&&(l.portrait=l.portraitUri=g)}}return e},t.prototype.getHistoryMessage=function(e,t,n,r,i,o,s,a){return void 0===o&&(o=""),_(this,void 0,void 0,(function(){var s,u,c,h,l,d,p,f,g,_;return m(this,(function(m){switch(m.label){case 0:return u=(s=this).currentUserId,c=s._channel,h=Oi[e]||Ei,l=1===r&&0===n,c?(d=c.codec.encodeGetHistoryMsg(t,{timestamp:n,count:l?2:r,order:i,channelId:o}),We(exports.LogTagId.L_GET_HISTORY_MSG_T,{targetId:t,conversationType:e,channelId:o,timestamp:n,count:r,order:i},{traceId:a}),[4,c.send(new oo(h,d,u),rn,{currentUserId:u,connectedTime:c.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return p=m.sent(),(f=p.code)===Y.SUCCESS&&d?(g=p.data,l&&2===g.list.length&&(g.hasMore=!0,0===i?g.list.shift():g.list.pop()),_=[],g.list&&g.list.forEach((function(e){e&&_.push(e.messageUId)})),We(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:f,messageUIds:_.join(",")},{traceId:a}),[2,{code:f,data:{list:g.list,hasMore:g.hasMore}}]):(Je(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:f,messageUIds:""},{traceId:a}),[2,{code:f}]);case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){ht.info("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new oo(lo[lo.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==Y.SUCCESS&&ht.warn("reportSDKInfo failed -> code: ".concat(t))}))}},t.prototype.deleteRemoteMessage=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeDeleteMessages(e,t,n,r),u=new oo(ci,a,o),[4,s.send(u)]):[3,2];case 1:return c=l.sent(),h=c.code,Y.SUCCESS,[2,h];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeClearMessages(t,n,r,e),u=Mi[e],c=new oo(u,a,o),[4,s.send(c)]):[3,2];case 1:return h=d.sent(),l=h.code,Y.SUCCESS,[2,l];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),_(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l,d=this;return m(this,(function(p){switch(p.label){case 0:return o=(i=this).currentUserId,s=i._channel,t=t||S.PRIVATE,s?(a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),u=new oo(mi,a,o),[4,s.send(u,sn,{currentUserId:o,connectedTime:s.connectedTime,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}})]):[3,2];case 1:return c=p.sent(),h=c.code,l=c.data,h!==Y.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==l?void 0:l.list}];case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return(r=this._channel)?(i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new oo(Ti,i,t),[4,r.send(o)]):[3,2];case 1:return s=u.sent(),ht.info("RemoveConversation =>",s),a=s.code,Y.SUCCESS,[2,a];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return e!==S.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap[n+"_"+t])?[3,3]:[2,{code:Y.CONVER_GET_ERROR}];case 1:return(i=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:Y.CONVER_GET_ERROR}];case 2:if(o=c.sent(),s=o.code,a=o.data,s!==Y.SUCCESS)return[2,{code:Y.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||X.CLOSE,notificationLevel:i.notificationLevel||ee.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:Y.SUCCESS,data:r}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:Y.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r,i;return i=e===S.ULTRA_GROUP?(null===(r=this._ultraGroupMap[n+"_"+t])||void 0===r?void 0:r.unreadMessageCount)||0:this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:Y.SUCCESS,data:i})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(Y.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(Y.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(Y.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:Y.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(Y.SUCCESS)},t.prototype.pullConversationStatus=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h=this;return m(this,(function(l){switch(l.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeGetConversationStatus(e),o=new oo(lo[lo.pullSeAtts],i,r),[4,n.send(o,tr)]):[3,2];case 1:return s=l.sent(),a=s.code,u=s.data,We(exports.LogTagId.L_PULL_CONVERSATION_S,{timestamp:e,userId:r}),a!==Y.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.channelId,o=e.isTop,s=e.notificationLevel,a=h._ultraGroupMap[i+"_"+n];t===S.ULTRA_GROUP?a&&(void 0!==r&&(a.notificationStatus=r),void 0!==s&&(a.notificationLevel=s),void 0===s&&void 0===r||h._ultraGroupManager.addUltraGroupStatus(e),"boolean"==typeof o&&(a.isTop=o)):c.push(e)})),[2,{code:a,data:c}]);case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d=this;return m(this,(function(p){switch(p.label){case 0:return n=(t=this).currentUserId,(r=t._channel)?(i=r.codec.encodeSetConversationStatus(e,this._conversationUpdatedTime),o=new oo(yi,i,n),[4,r.send(o,or)]):[3,2];case 1:return s=p.sent(),a=s.code,u=s.data,a===Y.SUCCESS?(c=u,this._conversationUpdatedTime=c.version,h=[],e.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.notificationLevel,o=e.channelId,s=e.isTop;if(t===S.ULTRA_GROUP){var a=d._ultraGroupMap[o+"_"+n];a&&(void 0!==r&&(a.notificationStatus=r),void 0!==i&&(a.notificationLevel=i),void 0===i&&void 0===r||d._ultraGroupManager.addUltraGroupStatus(a),void 0!==s&&(a.isTop=s),h.push(a))}else d._conversationManager.addStatus(f(f({},e),{updatedTime:c.version}),!0)})),h.length>0&&(l=kt(h),l=Xo(l),this._watcher.conversation(l)),[2,a]):[2,a];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return(i=this._channel)?(o=i.codec.encodeJoinOrQuitChatRoom(),a=new oo(s=n?li:hi,o,e),We(exports.LogTagId.L_JOIN_CHATROOM_T,{chatroomId:e,count:t,topic:s},{traceId:r}),[4,i.send(a,gn)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return u=d.sent(),c=u.code,h=u.data,(c===Y.SUCCESS?We:Je)(exports.LogTagId.L_JOIN_CHATROOM_R,{code:c,timestamp:(new Date).getTime()},{traceId:r}),c===Y.SUCCESS&&(l=h.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,l),this.naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull()),[2,c]}}))}))},t.prototype._rejoinChrm=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,a.label=1;case 1:return r<t.length?(i=t[r],We(exports.LogTagId.L_REJOIN_CHATROOM_T,{chatroomId:i,count:e[i]||10,topic:li}),o=Ke(),[4,this._joinChrm(i,e[i]||10,!0,o)]):[3,4];case 2:s=a.sent(),(s===Y.SUCCESS?We:Je)(exports.LogTagId.L_REJOIN_CHATROOM_R,{code:s,timestamp:(new Date).getTime()},{traceId:o}),s===Y.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:i,count:e[i]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:s}}),a.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),_(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l,d,p,f,g;return m(this,(function(_){switch(_.label){case 0:return this._channel?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._channel.codec.encodeChrmSyncMsg(o,t),a=new oo(lo[lo.chrmPull],s,e),We(exports.LogTagId.L_PULL_CHATROOM_MSG_T,{chatroomId:e,timestamp:o}),[4,this._channel.send(a,zt,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return u=_.sent(),c=u.code,h=u.data,r.pulling=!1,c===Y.SUCCESS&&h?(l=h.list,d=h.syncTime,p=h.finished,r.timestamp=n?Math.max(d,n):d,r.queue=r.queue.filter((function(e){return e>d})),f=[],g=[],l.forEach((function(e){e.sentTime<o||(f.push(e.messageUId),g.push(e))})),this._watcher.batchMessage(g),We(exports.LogTagId.L_PULL_CHATROOM_MSG_R,{code:c,timestamp:o,messageUIds:f.join(",")}),(!p||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(Je(exports.LogTagId.L_PULL_CHATROOM_MSG_R,{code:c,timestamp:o,messageUIds:""}),ht.warn("pull chatroom msg failed, code:",c,", data:",h),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o;return m(this,(function(s){switch(s.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),r=new oo(di,n,e),[4,t.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return i=s.sent(),(o=i.code)===Y.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return(r=this._channel)?(i=r.codec.encodeGetChatRoomInfo(t,n),o=new oo(lo[lo.queryChrmI],i,e),[4,r.send(o,mn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==Y.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:return(i=this._channel)?(o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new oo(Ci,o,e),[4,i.send(s,rn,{conversation:{targetId:e}})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),u=a.code,c=a.data,u!==Y.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=r.codec.encodeModifyChatRoomKV(e,t,i),a=t.type===ce.UPDATE?pi:fi,u=new oo(a,s,e),[4,r.send(u,gn)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return c=l.sent(),(h=c.code)===Y.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},i),[2,h]):[2,h]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d,p,f=this;return m(this,(function(g){switch(g.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(t.entries.forEach((function(t){var n=f._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?f.getServerTime():n})),o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===ce.UPDATE?gi:_i,a=new oo(s,o,e),[4,r.send(a,Yn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return u=g.sent(),c=u.code,-1!==[Y.SUCCESS,Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(l=[],delete(d=Object.assign({},t)).entries,t.entries.forEach((function(e){l.push(Object.assign({},e,d))})),c===Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(p=u.data,ht.warn("设置失败的属性:",p.errorKeys),h=p.errorKeys,p&&Array.isArray(p.errorKeys)&&p.errorKeys.forEach((function(e){var t=l.findIndex((function(t){return e.key===t.key}));-1!==t&&l.splice(t,1)}))),ht.warn("设置成功的属性:",l),this._chrmEntryHandler.setLocal(e,{kvEntries:l,syncTime:(new Date).getTime()},i)),[2,{code:c,data:h}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:Y.SUCCESS,data:n})]:[3,1];case 1:return(r=this._channel)?(i=r.codec.encodePullChatRoomKV(0),o=new oo(lo[lo.pullKV],i,e),[4,r.send(o,qn)]):[2,Promise.reject({code:Y.RC_NET_CHANNEL_INVALID})];case 2: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,Promise.resolve({code:Y.SUCCESS,data:null==u?void 0:u.value})]:[2,Promise.resolve({code:Y.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:Y.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(r={},i=n.codec.encodePullChatRoomKV(0),o=new oo(lo[lo.pullKV],i,e),[4,n.send(o,qn)]):[2,Promise.reject({code:Y.RC_NET_CHANNEL_INVALID})];case 2:return s=u.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&a.kvEntries.forEach((function(e){e.key&&(r[e.key]=e.value||"")})),[2,Promise.resolve({code:Y.SUCCESS,data:r})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d,p;return m(this,(function(f){switch(f.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(t||(t=this._pullChatroomEntryTimestamp),o=r.codec.encodePullChatRoomKV(t),s=new oo(lo[lo.pullKV],o,e),We(exports.LogTagId.L_PULL_CHATROOM_KV_T,{chatroomId:e,timestamp:t}),[4,r.send(s,qn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return a=f.sent(),u=a.code,c=a.data,(u===Y.SUCCESS?We:Je)(exports.LogTagId.L_PULL_CHATROOM_KV_R,{code:u,timestamp:t}),u===Y.SUCCESS?(ht.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(e,c,i),ht.info("Save into cache success!"),l=(h=c).kvEntries,d=h.syncTime,this._pullChatroomEntryTimestamp=d||0,p=[],l.length>0&&(l.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp;p.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._watcher.chatroom({updatedEntries:p})),[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._channel?t.forEach((function(t){e._pullChrmMsg(t),e.naviInfo.kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),18e4)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s,a,u,c,h,l,d,p,g,_;return m(this,(function(m){switch(m.label){case 0:return this._channel?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![S.PRIVATE,S.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[S.PRIVATE]=lo.ppMsgS,t[S.GROUP]=lo.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[S.PRIVATE]=lo.ppMsgP,t[S.GROUP]=lo.pgMsgP,t[S.CHATROOM]=lo.chatMsg,t[S.CUSTOMER_SERVICE]=lo.pcMsgP,t[S.RTC_ROOM]=lo.prMsgS,t)[e]}(e)||lo.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(u=new no(lo[s],a,t)).setHeaderQos(_t.AT_LEAST_ONCE),c=n.isPersited?es():0,o?(this._channel.sendOnly(u),[2,{code:Y.SUCCESS,data:Zo(e,t,f({},n),"",0,this.currentUserId,c)}]):(h=Date.now()-this._localConnectedTime+this._connectedTime,l=Zo(e,t,f({},n),"",h,this.currentUserId,c),r&&r(c),We(exports.LogTagId.L_SEND_MSG_T,{messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId},{traceId:i}),[4,this._channel.send(u)])):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return d=m.sent(),p=d.code,g=d.data,p!==Y.SUCCESS?(Je(exports.LogTagId.L_SEND_MSG_R,{code:p,messageUId:l.messageUId,messageId:l.messageId},{traceId:i}),[2,{code:p,data:l}]):(We(exports.LogTagId.L_SEND_MSG_R,{code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId},{traceId:i}),_=g,this._sendMessageStore.setMessage(_.messageUId,_.timestamp),l.sentTime=_.timestamp,l.messageUId=_.messageUId,this._conversationManager.setConversationCacheByMessage(l,!0),[2,{code:Y.SUCCESS,data:l}])}}))}))},t.prototype.recallMsg=function(e,t,n,r,i){var o;return _(this,void 0,void 0,(function(){var s,a,u,c,h,l,d,p,g,_,T,y,v;return m(this,(function(m){switch(m.label){case 0:return this._channel?(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),h={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},l=lo[lo.recallMsg],d=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},h),(p=new no(l,d,this.currentUserId)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(p)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return g=m.sent(),_=g.code,T=g.data,e===S.ULTRA_GROUP&&Qe(exports.LogTagId.L_RECALL_ULTRA_MSG_S,{code:_,conversationType:e,targetId:t,channelId:i.channelId}),_!==Y.SUCCESS?[2,{code:_}]:(y=T,e===S.ULTRA_GROUP?(this._ultraMsgMap[y.messageUId]=y.timestamp,this._updateUltraGroupWhenRecallMsg(t,i.channelId||"",n),[2,{code:Y.SUCCESS}]):(this._sendMessageStore.setMessage(y.messageUId,y.timestamp),v=Zo(e,t,f(f({},h),{isPersited:!0}),y.messageUId,y.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:Y.SUCCESS,data:v}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeReadReceipt(t,n),i=new oo(lo[lo.rrMsg],r,e),[4,this._channel.send(i)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeMessageReader(t,n),i=new oo(lo[lo.rrList],r,e),[4,this._channel.send(i,lr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return _(this,void 0,void 0,(function(){var t,n;return m(this,(function(r){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new oo(lo[lo.pullUS],t,this.currentUserId),[2,this._channel.send(n,Xn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:return this._channel?(i=r&&"uploads"!==r?t||"":St(e,t),o=this._channel.codec.encodeGetFileToken(e,i,n||"",r||""),s=new oo(lo[lo.qnTkn],o,this.currentUserId),[4,this._channel.send(s,Dn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),u=a.code,c=a.data,c=Object.assign(c,{fileName:i}),u===Y.SUCCESS?[2,{code:u,data:c}]:[2,{code:u}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l,d;return m(this,(function(p){switch(p.label){case 0:return this._channel?(i="",o="",s="",t===ie.QINIU?(o=xn,s=kn):(o=Vn,s=Gn),i=t===ie.QINIU?lo[lo.qnUrl]:t===ie.AWS?lo[lo.s3Url]:t===ie.STC?lo[lo.stcUrl]:lo[lo.aliUrl],a=this._channel.codec.encodeGetFileUrl(o,e,n,r),u=new oo(i,a,this.currentUserId),[4,this._channel.send(u,s)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return c=p.sent(),h=c.code,l=c.data,d=l,h===Y.SUCCESS?[2,{code:h,data:d}]:[2,{code:h}]}}))}))},t.prototype.disconnect=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData()},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new oo(lo[lo.addSeTag],n,this.currentUserId),[4,this._channel.send(r,zn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([f(f({},e),{createdTime:a})],a),[2,{code:Y.SUCCESS,data:s}])}}))}))},t.prototype.removeTag=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),r=new oo(lo[lo.delSeTag],n,this.currentUserId),[4,this._channel.send(r,zn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new oo(lo[lo.addSeTag],n,this.currentUserId),[4,this._channel.send(r,zn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:Y.SUCCESS,data:s}])}}))}))},t.prototype.getTagList=function(){return _(this,void 0,void 0,(function(){var e,t;return m(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:Y.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s=this;return m(this,(function(a){switch(a.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new oo(lo[lo.addTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:Y.TAG_NOT_EXIST}]:[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(i=a.sent().code)!==Y.SUCCESS?[2,{code:i}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o=this;return m(this,(function(s){switch(s.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new oo(lo[lo.delTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(i=s.sent().code)!==Y.SUCCESS?[2,{code:i}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return this._channel?(n=e.conversationType,r=e.targetId,i=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._channel.codec.encodeUpdateConversationTag(o,[e]),a=new oo(lo[lo.delTag],s,this.currentUserId),[4,this._channel.send(a)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(u=c.sent().code)!==Y.SUCCESS?[2,{code:u}]:(this._conversationManager.deleteTagStatus(n,r,t,i),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(s=o.codec.encodeOldConversationList({count:n,type:S.PRIVATE,startTime:t}),a=new oo(mi,s,i),[4,o.send(a,sn,{currentUserId:i,connectedTime:o.connectedTime})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return u=d.sent(),c=u.code,h=u.data,l=this._conversationHasTagFilter(e,null==h?void 0:h.list),ht.info("GetConversationListByTag",l),c!==Y.SUCCESS?[2,{code:c}]:[2,{code:c,data:l}]}}))}))},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,h=u.mentionedInfo,l=u.lastUnreadTime,d=u.notificationStatus,p=u.isTop,g=u.tags,_=u.unreadMessageCount,m=g&&g[e];if(m){var T=f(f({},t),{hasMentioned:c,mentionedInfo:h,lastUnreadTime:l,notificationStatus:d,isTop:p,unreadMessageCount:_});m.isTop?r.push(f(f({},T),{isTopInTag:!0})):i.push(f(f({},T),{isTopInTag:!1}))}})),T(T([],r.sort(o),!0),i.sort(o),!0)},t.prototype.getUnreadCountByTag=function(e,t){return _(this,void 0,void 0,(function(){var n;return m(this,(function(r){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:Y.SUCCESS,data:n}]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l,d;return m(this,(function(p){switch(p.label){case 0:return this._channel?(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._channel.codec.encodeUpdateConversationTag(a,[t]),h=new oo(lo[lo.addTag],c,this.currentUserId),[4,this._channel.send(h)]):[2,{code:Y.NO_TAG_IN_CONVER}]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(l=p.sent().code)!==Y.SUCCESS?[2,{code:l}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(i,r,d,o),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return _(this,void 0,void 0,(function(){var n,r,i,o;return m(this,(function(s){if(!this._channel)return[2,{code:Y.RC_NET_CHANNEL_INVALID}];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:Y.SUCCESS,data:i}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:Y.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:Y.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===S.ULTRA_GROUP?(null===(t=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId),Promise.resolve({code:Y.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:Y.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===S.ULTRA_GROUP)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var r;if(!(r=e===S.ULTRA_GROUP?this._ultraGroupManager.get(S.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:Y.SUCCESS,data:ee.NOT_SET});var i=r.notificationLevel;return x(r.notificationLevel)&&!x(r.notificationStatus)&&(i=X.OPEN===r.notificationStatus?1:0),Promise.resolve({code:Y.SUCCESS,data:i})},t.prototype.getConversationNotificationStatus=function(e,t,n){var r;return(r=e===S.ULTRA_GROUP?this._ultraGroupManager.get(S.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:Y.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:Y.SUCCESS,data:X.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 _(this,void 0,void 0,(function(){var t,n,r,i;return m(this,(function(o){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&&A(n))})),r=Xo(r),i=kt(r),[2,{code:Y.SUCCESS,data:i}]):[2,{code:Y.METHOD_NOT_AVAILABLE}]}))}))},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===X.OPEN&&t.push({conversationType:S.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:S.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap){n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount)}return Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e){var t=0;for(var n in this._ultraGroupMap){var r=this._ultraGroupMap[n];r.targetId===e&&(t+=r.unreadMessageCount||0)}return Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:Y.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:Y.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),_(this,void 0,void 0,(function(){var n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._channel?this._status!==Q.CONNECTED?[2,Y.RC_NET_UNAVAILABLE]:(n=Date.now(),r=this._channel.codec.encodeClearUnreadCount({conversationType:S.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(i=new no(lo[lo.updUgRTime],r,this.currentUserId)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID]:[2,Promise.resolve(Y.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===Y.SUCCESS&&(s=this._ultraGroupMap[t+"_"+e])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.lastReadTime=n),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f=this;return m(this,(function(g){switch(g.label){case 0:return this._channel&&this._status===Q.CONNECTED?(!1,t=this._channel.codec.encodeUltraGroup(e,false),n=new oo(lo[lo.pullUgSes],t,this.currentUserId),[4,this._channel.send(n,sn,{currentUserId:this.currentUserId,conversationType:S.ULTRA_GROUP})]):[2];case 1:return r=g.sent(),i=r.code,o=r.data,i===Y.SUCCESS&&o?(a=(null==o?void 0:o.list)||[],u=null==o?void 0:o.isFinished,a.forEach((function(e){e.notificationStatus=X.CLOSE,e.notificationLevel=ee.NOT_SET,e.isTop=!1,f._ultraGroupMap[e.channelId+"_"+e.targetId]=e,f._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(ht.warn("pull super conversation failed, code:",i,", data:",o,"retrying..."),s=setTimeout((function(){f._firstPullUltraGroupTime=e,f._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return[4,this.pullConversationStatus(this._firstPullUltraGroupTime)];case 3:h=g.sent(),l=h.code,d=h.data,l!==Y.SUCCESS&&ht.warn("pullConversationStatus fail code: ".concat(l,", data: ").concat(d)),p=Object.values(this._ultraGroupMap),p=Xo(p),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(kt(p)),0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),g.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(),this._syncUltraMsg(0),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._syncUltraMsg=function(e){var t;return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d,p,f,g,_=this;return m(this,(function(m){switch(m.label){case 0:return this._channel&&this._status===Q.CONNECTED?this._isUltraPulling?[2]:(ht.info("start pull ultra msg, time: ".concat(e)),this._isUltraPulling=!0,n=this._channel.codec.encodeSuperSyncMsg(e),r=new oo(lo[lo.pullUgMsg],n,this.currentUserId),i=Ke(),We(exports.LogTagId.L_PULL_ULTRA_MSG_T,{timestamp:e},{traceId:i}),[4,this._channel.send(r,zt,{currentUserId:this.currentUserId,conversation:{conversationType:S.ULTRA_GROUP}})]):[2];case 1:if(o=m.sent(),s=o.code,a=o.data,ht.info("end pull ultra msg, code: ".concat(s,", syncTime: ").concat(null==a?void 0:a.syncTime,", count: ").concat(null===(t=null==a?void 0:a.list)||void 0===t?void 0:t.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),s!==Y.SUCCESS||!a)return Je(exports.LogTagId.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:"",timestamp:e},{traceId:i}),ht.warn("sync super message failed, code:",s,", data:",a),this._isUltraPulling=!1,[2];if(this._isUltraPulling=!1,u=a.list,c=a.syncTime,h=a.finished,!this._isUltraGroupListExist)return ht.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=c,[2];for(g in l=[],d={},p=[],u.forEach((function(e){var t,n,r,i=e.targetId,o=e.content,s=e.messageType,a=e.messageUId,u=e.channelId,h=e.isCounted,f=e.channelType;if(l.push(a),_._ultraMsgMap[a])delete _._ultraMsgMap[a];else{var g=0;((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===ne.ALL||(null===(r=null===(n=null==o?void 0:o.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(_.currentUserId)))&&(g=1);var m=_._ultraGroupMap[u+"_"+i];if(m)h&&(s===z.RECALL?m.unreadMessageCount>0&&(m.unreadMessageCount-=1):(m.unreadMessageCount+=1,m.unreadMentionedCount+=g)),m.versionTime=c,m.latestMessage=e,m.channelType=f,d[u+"_"+i]=m,_._ultraGroupManager.addUltraGroupStatus(m);else{var T={conversationType:S.ULTRA_GROUP,targetId:i,channelId:u,unreadMessageCount:h?1:0,unreadMentionedCount:h?g:0,versionTime:c,latestMessage:e,notificationStatus:X.CLOSE,notificationLevel:ee.NOT_SET,isTop:!1,channelType:f};_._ultraGroupMap[u+"_"+i]=T,d[u+"_"+i]=T,_._ultraGroupManager.addUltraGroupStatus(T)}p.push(e)}})),Object.keys(d).length>0&&(ht.info("notice ultragroups"),f=Object.values(d),f=Xo(f),this._watcher.conversation(kt(f))),We(exports.LogTagId.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:l.join(","),timestamp:c},{traceId:i}),ht.info("notice ultragroup message"),this._watcher.batchMessage(p),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>c})),this._ultraMsgMap)this._ultraMsgMap[g]<c&&delete this._ultraMsgMap[g];return!1===h?this._syncUltraMsg(c):u&&u.length>0&&(this._lastSyncUltraMsgTimeStamp=c),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l,d,p,g;return m(this,(function(_){switch(_.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:("RC:SRSMsg"===t.messageType&&ht.warn("ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),i=this._channel.codec.encodeUpMsg({conversationType:S.ULTRA_GROUP,targetId:e},t),(o=new no(lo[lo.ugMsg],i,e)).setHeaderQos(_t.AT_LEAST_ONCE),s=Date.now()-this._localConnectedTime+this._connectedTime,a=t.isPersited?es():0,u=Zo(S.ULTRA_GROUP,e,f({},t),"",s,this.currentUserId,a),n&&n(a),We(exports.LogTagId.L_SEND_MSG_T,{messageType:t.messageType,conversationType:S.ULTRA_GROUP,targetId:e,channelId:t.channelId},{traceId:r}),[4,this._channel.send(o)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return c=_.sent(),h=c.code,l=c.data,h!==Y.SUCCESS?(Je(exports.LogTagId.L_SEND_MSG_R,{code:h,messageUId:u.messageUId,messageId:u.messageId},{traceId:r}),[2,{code:h,data:u}]):(We(exports.LogTagId.L_SEND_MSG_R,{code:h,messageUId:null==l?void 0:l.messageUId,messageId:null==l?void 0:l.messageId},{traceId:r}),d=l,u.sentTime=d.timestamp,u.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,p=t.channelId||"",(g=this._ultraGroupMap[p+"_"+e])?(g.latestMessage=u,A(g.channelType)&&(u.channelType=g.channelType)):(g={conversationType:S.ULTRA_GROUP,targetId:e,channelId:p,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:X.CLOSE,notificationLevel:ee.NOT_SET,isTop:!1},this._ultraGroupMap[p+"_"+e]=g,this._ultraGroupManager.addUltraGroupStatus(g)),this._watcher.conversation(kt([g])),[2,{code:h,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(n=e.conversationType,r=e.channelId,i=e.targetId,o=this._channel.codec.encodeOperateStatus(i,n,r||"",t||0),(s=new no(lo[lo.operate],o,i)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(s)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(a=u.sent().code)!==Y.SUCCESS?[2,{code:a,msg:Y[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:Y.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._channel.codec.encodeMsgQuery(e),(r=new oo(lo[lo.qryMsg],n,this.currentUserId)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(r,Or,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o,msg:Y[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._channel){var t=this._channel.codec.decodeByPBName(e.data,Ur),n=t.conversationType,r=t.info,i=t.summary;ht.info("s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new no(lo[lo.upMsgEx],t,e.targetId)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==Y.SUCCESS?[2,{code:i,msg:Y[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},t.prototype.modifyMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodemodifyMessage(e,this.currentUserId),(n=new no(lo[lo.modifyMsg],t,e.targetId)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==Y.SUCCESS?[2,{code:i,msg:Y[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return this._channel?this._status!==Q.CONNECTED||this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._channel.codec.encodeQueryMsgChange(e),(n=new oo(lo[lo.qryMsgChange],t,this.currentUserId)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(n,Rr)]):[2];case 1:if(r=d.sent(),i=r.code,o=r.data,this._isPullingUltraChangeMessage=!1,i!==Y.SUCCESS||!o)return[2];for(h in s=o.hasNext,a=o.list,u=(null==o?void 0:o.syncTime)||0,this._ultraChannelTypeChangeNotice(a),this._ultraChannelUserKickedNotice(a),this._ultraChannelDeleteNotice(a),this._ultraRecalledNotice(a),this._ultraMsgUpdateNotice([exports.UltraMsgChangeType.MSG_EXPANSION,exports.UltraMsgChangeType.MSG_MODIFY],a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(l=this._pullUltraChangeMessageQue).push.apply(l,c),this._ultraMsgMap)this._ultraMsgMap[h]<u&&delete this._ultraMsgMap[h];return s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]}}))}))},t.prototype._ultraChannelTypeChangeNotice=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.changeType,o=e.subChangeType,s=e.channelId,a=void 0===s?"":s;if(i===exports.UltraMsgChangeType.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(a,"_").concat(r)]){var u=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE,c=exports.UltraMsgSubChangeType.PRIVATE_TO_PUBLIC,h=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN;o===c&&(t._ultraGroupMap["".concat(a,"_").concat(r)].channelType=exports.UltraGroupChannelType.PUBLIC),o===u&&(t._ultraGroupMap["".concat(a,"_").concat(r)].channelType=exports.UltraGroupChannelType.PRIVATE);var l=t._ultraGroupMap["".concat(a,"_").concat(r)].channelType,d=void 0===l?exports.UltraGroupChannelType.PUBLIC:l;[u,c,h].includes(o)&&n.push({targetId:r,channelId:a,changeType:o,channelType:d}),o===h&&delete t._ultraGroupMap["".concat(a,"_").concat(r)]}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n)},t.prototype._ultraChannelDeleteNotice=function(e){var t=this,n=[];Array.isArray(e)&&e.forEach((function(e){var r=e.targetId,i=e.sendTime,o=e.changeType,s=e.subChangeType,a=e.channelId,u=void 0===a?"":a;if(o===exports.UltraMsgChangeType.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(u,"_").concat(r)]){var c=t._ultraGroupMap["".concat(u,"_").concat(r)].channelType,h=void 0===c?exports.UltraGroupChannelType.PUBLIC:c;s===exports.UltraMsgSubChangeType.CHANNEL_DELETE&&(n.push({targetId:r,channelId:u,channelType:h,deleteTime:i}),delete t._ultraGroupMap["".concat(u,"_").concat(r)])}})),n.length>0&&this._watcher.ultraGroupChannelDelete(n)},t.prototype._ultraChannelUserKickedNotice=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.changeType,o=e.operatorId,s=e.subChangeType,a=e.channelId,u=void 0===a?"":a;i===exports.UltraMsgChangeType.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(u,"_").concat(r)]&&(s===exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED&&n.push({targetId:r,channelId:u,userId:o,channelType:exports.UltraGroupChannelType.PRIVATE}),o===t.currentUserId&&s===exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED&&delete t._ultraGroupMap["".concat(u,"_").concat(r)])})),n.length>0&&this._watcher.ultraGroupChannelUserKicked(n)},t.prototype._ultraRecalledNotice=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.conversationType,o=e.sendTime,s=e.messageUId,a=e.changeType,u=e.operatorId,c=e.channelId,h=void 0===c?"":c;a===exports.UltraMsgChangeType.MSG_RECALL&&(t._updateUltraGroupWhenRecallMsg(r,h,s),n.push({targetId:r,conversationType:i,sendTime:o,messageUId:s,senderUserId:u,channelId:h}))})),n.length>0&&this._watcher.ultraGroupMessageRecalled(n)},t.prototype._ultraMsgUpdateNotice=function(e,t){var n=this;if(!!t.find((function(t){return e.includes(t.changeType)}))){var r={};t.forEach((function(t){var i=t.targetId,o=t.conversationType,s=t.sendTime,a=t.messageUId,u=t.changeType,c=t.channelId,h=o+"_"+i,l=a+"_"+(void 0===c?"":c)+"_"+s,d=r[h];if(d)d.add(l);else{var p=new Set([l]);r[h]=p}e.includes(u)&&(n._ultraMsgChangeMap[a]=u)}));var i=function(e){var t=e.split("_"),n=t.shift(),i=t.join("_"),s=r[e],a=[];s.forEach((function(e){var t=e.split("_"),n=t[0],r=t[1],i=t[2];a.push({sendTime:Number(i),messageUId:n,channelId:r})}));var u={targetId:i,conversationType:Number(n),messages:a};o._pullUltraMessageList(u)},o=this;for(var s in r)i(s)}},t.prototype._pullUltraMessageList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c=this;return m(this,(function(h){switch(h.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeMsgQuery(e),(n=new oo(lo[lo.qryMsg],t,this.currentUserId)).setHeaderQos(_t.AT_LEAST_ONCE),[4,this._channel.send(n,Or,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=h.sent(),i=r.code,o=r.data,i!==Y.SUCCESS?[2,{code:i,msg:Y[i]}]:(s=(o||{}).list,a=[],u=[],Array.isArray(s)&&s.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=c._ultraGroupMap[n+"_"+t];i&&i.latestMessage.messageUId===e.messageUId&&(i.latestMessage=e);var o=c._ultraMsgChangeMap[r+""];o===exports.UltraMsgChangeType.MSG_EXPANSION?a.push(e):o===exports.UltraMsgChangeType.MSG_MODIFY&&u.push(e)})),a.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(a||[]),u.length>0&&this._watcher.ultraGroupMessageModified(u||[]),[2])}}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(r=this._channel.codec.encodeGetHistoryMsg(e,t),i=new oo(lo[lo.qryUgMsg],r,this.currentUserId),We(exports.LogTagId.L_GET_HISTORY_MSG_T,{targetId:e,conversationType:S.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count},{traceId:n}),[4,this._channel.send(i,rn,{currentUserId:this.currentUserId,conversation:{conversationType:S.ULTRA_GROUP,targetId:e}})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),s=o.code,a=o.data,s===Y.SUCCESS&&a?(u=[],a.list&&a.list.forEach((function(e){e&&u.push(e.messageUId)})),We(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:s,messageUIds:u.join(",")},{traceId:n}),[2,{code:s,data:a}]):(Je(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:s,messageUIds:""},{traceId:n}),ht.warn("get super history message failed, code:",s,", data:",a),[2,{code:s}])}}))}))},t.prototype.searchUltraGroupMessages=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(e){return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:[2,{code:Y.SUCCESS}]:[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?(r=this._channel)?(i=r.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),o=new oo(lo[lo.ugUnpushSet],i,e),[4,r.send(o)]):[3,2]:[2,Promise.resolve({code:Y.METHOD_NOT_AVAILABLE})];case 1:return s=u.sent(),a=s.code,Y.SUCCESS,[2,{code:a}];case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?(n=this._channel)?(r=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),i=new oo(lo[lo.ugUnpushQuery],r,e),[4,n.send(i,ur)]):[3,2]:[2,Promise.resolve({code:Y.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===Y.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[2,{code:s}];case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n){var r="".concat(t,"_").concat(e);if(this._ultraGroupMap[r]){var i=this._ultraGroupMap[r],o=i.latestMessage;o&&o.messageUId===n&&(i.latestMessage=null)}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:Y.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.joinRTCRoom=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s,a;return m(this,(function(u){return this._channel?(s=this._channel.codec.encodeJoinRTCRoom(t,n,r,i,o),a=new oo(lo[lo.rtcRJoin_data],s,e),[2,this._channel.send(a,yn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return _(this,void 0,void 0,(function(){var t,n;return m(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new oo(lo[lo.rtcRExit],t,e),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new oo(lo[lo.rtcPing],r,e),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return _(this,void 0,void 0,(function(){var t,n;return m(this,(function(r){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new oo(lo[lo.rtcRInfo],t,e),[2,this._channel.send(n,Ln)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o;return m(this,(function(s){switch(s.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new oo(lo[lo.rtcUData],t,e),[4,this._channel.send(n,yn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=s.sent(),i=r.code,o=r.data,[2,{code:i,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeSetRTCUserInfo(t,n),i=new oo(lo[lo.rtcUPut],r,e),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return _(this,void 0,void 0,(function(){var n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),r=new no(lo[lo.rtcUDel],n,e),[4,this._channel.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(s=this._channel.codec.encodeSetRTCData(t,n,r,i,o),a=new no(lo[lo.rtcSetData],s,e),[4,this._channel.send(a)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,r,i),s=new oo(lo[lo.userSetData],o,e),[4,this._channel.send(s)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeUserSetRTCCDNUris(t,n),i=new oo(lo[lo.userSetData],r,e),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,r){if(!this._channel)return Promise.resolve({code:Y.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),o=new oo(lo[lo.rtcQryData],i,e);return this._channel.send(o,On)},t.prototype.removeRTCData=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,r,i),s=new no(lo[lo.rtcDelData],o,e),[4,this._channel.send(s)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,r){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,t){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new oo(lo[lo.rtcToken],r,e),[2,this._channel.send(i,Nn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return _(this,void 0,void 0,(function(){var n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),r=new oo(lo[lo.rtcUserState],n,e),[4,this._channel.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:Y.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new oo(lo[lo.rtcUList],t,e);return this._channel.send(n,yn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=exports.RTCMode.LIVE),_(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new oo(lo[lo.viewerJoinR],r,e),[4,this._channel.send(i,Vr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,a=o.data,s!==Y.SUCCESS?[2,{code:s}]:(c=(u=a).rtcToken,h=u.entries,[2,{code:s,data:{token:c,kvEntries:h}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new oo(lo[lo.viewerExitR],t,e),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(r=this._channel.codec.encodeIdentityChangeInfo(t,n),i=new oo(lo[lo.rtcIdentityChange],r,e),[4,this._channel.send(i,yn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return o=u.sent(),s=o.code,a=o.data,s!==Y.SUCCESS?[2,{code:s}]:[2,{code:s,data:a}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(ht.info("audience in room start pull KV"),i=n.codec.encodePullRTCRoomKV(e,0),o=new oo(lo[lo.rtcPullKv],i,r),[4,n.send(o,Pr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),a=s.code,u=s.data,ht.info("audience in room end pull KV, code: ".concat(a,", data: ").concat(JSON.stringify(u||{}))),a===Y.SUCCESS?(c=u.kvEntries,this._watcher.onRTCDataChange(c,e),[2,{code:a,data:u}]):[2,{code:a}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeQueryUserJoinedInfo(e),o=new oo(lo[lo.rtcQueryJoined],i,r),[4,n.send(o,xr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return s=c.sent(),a=s.code,u=s.data,a===Y.SUCCESS?[2,{code:a,data:u}]:[2,{code:a}]}}))}))},t.prototype.getDeviceId=function(){return et(this.runtime)},t.prototype.requestRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new oo(lo[lo.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.cancelRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new oo(lo[lo.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.responseRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new oo(lo[lo.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.endRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new oo(lo[lo.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(t=e.chatRoomId,n=this._channel.codec.encodebindRTCRoomForChatroom(e),r=new oo(lo[lo.setRtcRoomId],n,t),[4,this._channel.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return i=o.sent(),[2,i.code]}}))}))},t.prototype.callExtra=function(e){return Promise.resolve({code:Y.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){throw new Error("Method not implemented.")},t.prototype.removeFromBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},t.prototype.getBlacklistStatus=function(e){throw new Error("Method not implemented.")},t.prototype.insertMessage=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}(vo),ns=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},t.prototype.joinRTCRoom=function(e,t,n,r,i,o){return this._context.joinRTCRoom(e,t,n,r,i,o)},t.prototype.quitRTCRoom=function(e){return this._context.quitRTCRoom(e)},t.prototype.rtcPing=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return this._context.getRTCRoomInfo(e)},t.prototype.getRTCUserInfoList=function(e){return this._context.getRTCUserInfoList(e)},t.prototype.getRTCUserInfo=function(e){return this._context.getRTCUserInfo(e)},t.prototype.setRTCUserInfo=function(e,t,n){return this._context.setRTCUserInfo(e,t,n)},t.prototype.removeRTCUserInfo=function(e,t){return this._context.removeRTCUserInfo(e,t)},t.prototype.setRTCData=function(e,t,n,r,i,o){return this._context.setRTCData(e,t,n,r,i,o)},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)},t.prototype.setRTCCDNUris=function(e,t,n){return this._context.setRTCCDNUris(e,t,n)},t.prototype.getRTCData=function(e,t,n,r){return this._context.getRTCData(e,t,n,r)},t.prototype.removeRTCData=function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)},t.prototype.setRTCOutData=function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)},t.prototype.getRTCOutData=function(e,t){return this._context.getRTCOutData(e,t)},t.prototype.getRTCToken=function(e,t,n){return this._context.getRTCToken(e,t,n)},t.prototype.setRTCState=function(e,t){return this._context.setRTCState(e,t)},t.prototype.getRTCUserList=function(e){return this._context.getRTCUserList(e)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)},t.prototype.quitLivingRoomAsAudience=function(e){return this._context.quitLivingRoomAsAudience(e)},t.prototype.rtcIdentityChange=function(e,t,n){return this._context.rtcIdentityChange(e,t,n)},t.prototype.requestRoomPK=function(e){return this._context.requestRoomPK(e)},t.prototype.cancelRoomPK=function(e){return this._context.cancelRoomPK(e)},t.prototype.responseRoomPK=function(e){return this._context.responseRoomPK(e)},t.prototype.endRoomPK=function(e){return this._context.endRoomPK(e)},t}(Eo);function rs(e){return Object.assign({},e)}var is,os=function(){function e(e,t){var n;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.4.4",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=Q.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend: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,ultraGroupChannelChangeType:void 0,ultraGroupChannelUserKicked:void 0,ultraGroupChannelDelete:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},t),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this.apiPKGName=this._options.apiPKGName||"",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&&(n=this._options.navigators).push.apply(n,r),Fi({bundleId:this.apiPKGName}),function(e){je=rt.init(f(f({},e),{sessionId:we})),ut()}({runtime:this._runtime,logSwitch:1,logPolicy:JSON.parse("{}"),appkey:this.appkey,version:this.apiVersion});var i={status:this._connectionStatusListener.bind(this),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),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this)};this._engine=Dt()?new RCCppEngine(e,i,this._options):new ts(e,i,this._options)}return e.init=function(t,n){return qe({customLogPrint:n.logStdout,localLogLevel:n.logLevel}),ht.setLogLevel(n.logLevel),ht.setLogStdout(n.logStdout),We(exports.LogTagId.L_INIT_O,{appkey:n.appkey,navigators:n.navigators,connectionType:n.connectionType,logLevel:n.logLevel,typingExpireTime:n.typingExpireTime}),!1===n.indexDBSwitch&&(Ue.indexDBSwitch=!1),We(exports.LogTagId.L_IMSDK_VER_O,{commitId:"7424002f9596c7e72553dfa017dfee5e8f975906",version:"5.4.4"}),ht.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(ht.error("Repeat initialize!"),this._context):(ht.warn("RCEngine Commit:","7424002f9596c7e72553dfa017dfee5e8f975906"),this._context=new e(t,n),this._context)},e.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},e.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return ht.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new ns(this):new Eo(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){ht.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),r&&this._pluginContextQueue.push(n),r&&(this._pluginInstanseMap[e.tag]=r),r},e.prototype._handleRedirect=function(){return _(this,void 0,void 0,(function(){var e,t=this;return m(this,(function(n){switch(n.label){case 0:return ht.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return(e=n.sent().code)!==Y.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(e),setTimeout((function(){t._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return _(this,void 0,void 0,(function(){return m(this,(function(n){return We(exports.LogTagId.L_CONNECT_S,{status:e}),[Q.REDIRECT,Q.BLOCKED,Q.KICKED_OFFLINE_BY_OTHER_CLIENT,Q.DISCONNECT_BY_SERVER,Q.DISCONNECTED,Q.NETWORK_UNAVAILABLE].includes(e)&&(Ki(ho.IM_CONNECTION_DURATION,{endTime:(new Date).getTime(),code:e}),function(e){_(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:t=ho.IM_CONNECTION_DURATION,n=Hi().bundleId,r=qi(t),i=r.startTime,o=r.endTime,s=r.code,a=exports.NetworkType.UNKONWN,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return a=h.sent(),[3,4];case 3:return u=h.sent(),ht.debug(u.message),[3,4];case 4:return c=0,A(i)&&A(o)&&o>i&&i&&(c=o-i),xi(t,{bid:n,cod:s,dur:c,net:a}),[2]}}))}))}(this._runtime)),this._connectionStatus=e,e===Q.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(e),this._handleRedirect()):e===Q.BLOCKED||e===Q.KICKED_OFFLINE_BY_OTHER_CLIENT||e===Q.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(e)):e===Q.CONNECTING?this._handleConnecting():e===Q.CONNECTED?this._handleConnected():e===Q.DISCONNECTED?this._handleDisconnect(e):e===Q.NETWORK_UNAVAILABLE&&this._handleSuspend(e),(null===(t=this._watcher.rtcInnerWatcher)||void 0===t?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach((function(t){t.onconnectionstatechange&&t.onconnectionstatechange(e)})),this._watcher.connectionState&&this._watcher.connectionState(e),[2]}))}))},e.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},e.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},e.prototype._handleDisconnect=function(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)},e.prototype._handleSuspend=function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)},e.prototype._messageReceiver=function(e,t,n){var r,i,o;if((e.conversationType===S.RTC_ROOM||Object.prototype.hasOwnProperty.call(Se,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(rs(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==z.TYPING_STATUS||(this._addTypingInfo(rs(e)),!this._watcher.typingState))if(e.messageType!==z.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==z.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(rs(e))}catch(e){return ht.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(rs(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var s=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic,a=this._engine.getCurrentUserId();s&&Array.isArray(s[a])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,s[a])}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra});else{var u=e.content,c=u.startTime,h=u.endTime,l=u.platform,d=u.logId,p=u.uri,f=u.packageName,g={startTime:parseInt(c),endTime:parseInt(h),platform:l,logId:d,uri:p,packageName:f};null===(i=rt.getInstance())||void 0===i||i.reportFullLog(g)}}else if("function"==typeof this._watcher.chatroomState){var _={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){_[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:_,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(r={},r[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?le.QUIT:le.JOIN,r),chatroomId:e.targetId}})},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._watcher.batchMessage(i)},e.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},e.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},e.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},e.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},e.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},e.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},e.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},e.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},e.prototype._ultraGroupEnableListener=function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)},e.prototype._operateStatusListener=function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)},e.prototype._ultraGroupMessageModifiedListener=function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)},e.prototype._ultraGroupMessageRecalledListener=function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){this._watcher.ultraGroupChannelChangeType&&this._watcher.ultraGroupChannelChangeType(e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){this._watcher.ultraGroupChannelUserKicked&&this._watcher.ultraGroupChannelUserKicked(e)},e.prototype._ultraGroupChannelDeleteListener=function(e){this._watcher.ultraGroupChannelDelete&&this._watcher.ultraGroupChannelDelete(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))},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]=D(r)||P(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]}if(e._typingChangedList.length>0){var r=e._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));e._typingStatusListener(r),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))},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._connectionStatus},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.connect=function(e,t,n,r){return void 0===t&&(t=!1),_(this,void 0,void 0,(function(){var i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return this._connectionStatus===Q.CONNECTED?[2,{code:Y.SUCCESS,userId:this._engine.getCurrentUserId()}]:this._connectionStatus===Q.CONNECTING?[2,{code:Y.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:Y.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,i=e.split("@"),o=i[1],s=o?o.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],We(exports.LogTagId.L_GET_NAVI_T,{token:e,uris:s},{traceId:r}),[4,this._engine.getNaviInfo(this._getTokenWithoutNavi(),s,t,this._options.checkCA)]);case 1:return(a=l.sent())?(We(exports.LogTagId.L_GET_NAVI_R,{code:Y.SUCCESS,naviInfo:a},{traceId:r}),We(exports.LogTagId.L_ENV_S,{isEnterprise:1===(null==a?void 0:a.type)},{traceId:r}),1===(null==a?void 0:a.type)?[2,{code:Y.PACKAGE_ENVIRONMENT_ERROR}]:(u=gt.getInfo(),We(exports.LogTagId.L_CONNECT_T,{token:e,refreshNavi:t,reconnectKickEnable:n},{traceId:r}),[4,this._engine.connect(this._getTokenWithoutNavi(),a,n,r)])):(Je(exports.LogTagId.L_GET_NAVI_R,{code:Y.RC_NAVI_RESOURCE_ERROR},{traceId:r}),[2,{code:Y.RC_NAVI_RESOURCE_ERROR}]);case 2:return c=l.sent(),(c===Y.SUCCESS?We:Je)(exports.LogTagId.L_CONNECT_R,{code:c,userId:this._engine.getCurrentUserId()},{traceId:r}),c!==W.REDIRECT?[3,4]:(this._connectionStatus=Q.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,l.sent()];case 4:return h=this._engine.getCurrentUserId(),c===Y.SUCCESS&&(Ki(ho.IM_CONNECTION_DURATION,{startTime:(new Date).getTime()},!0),ht.info("connect success, userId: ".concat(h)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),st({runtime:this._runtime,logSwitch:(null==a?void 0:a.logSwitch)||0,logPolicy:JSON.parse((null==a?void 0:a.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:h}),qe({userId:h}),this._isInternalConnected=!0),c!==Y.SUCCESS||Dt()||1===a.openUS&&this._pullUserSettings(),c!==Y.SUCCESS&&(this._connectionStatus=Q.CONNECTION_CLOSED),[2,{code:c,userId:h}]}}))}))},e.prototype._pullUserSettings=function(){return _(this,void 0,void 0,(function(){return m(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=rt.getInstance())||void 0===e||e.distroy(),qe({userId:""}),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){ht.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(e){return this._isInternalConnected?Promise.resolve({code:Y.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i=!1),this._engine.registerMessageType(e,t,n,r,i)},e.prototype.sendMessage=function(e,t,n,r,i){if(e!==S.ULTRA_GROUP){var o=this.getInfoFromCache();if(1===((null==o?void 0:o.grpRRVer)||0)&&n.messageType===z.READ_RECEIPT_RESPONSE)return Promise.resolve({code:Y.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,u=n.expansion;if(a){var c=F(u),h=c.isIllgalEx,l=c.isExKeyOrValLengthExceedLimit;if(c.isExceedLimit||l)return Promise.resolve({code:Y.EXPANSION_LIMIT_EXCEET});if(h)return Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})}var d=JSON.stringify(n.content);return I(d)>131072?Promise.resolve({code:Y.RC_MSG_CONTENT_EXCEED_LIMIT}):e===S.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,r,i):this._engine.sendMessage(e,t,n,r,i)},e.prototype.sendExpansionMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l;return m(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=F(s),c=u.isIllgalEx,h=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||h?[2,Promise.resolve({code:Y.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})]:(l={mid:i},s&&(l.put=s),o&&(l.del=o),a&&(l.removeAll=1),[4,this._engine.sendMessage(n,r,{content:l,messageType:z.EXPANSION_NOTIFY,channelId:t})])):[2,{code:Y.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return _(this,void 0,void 0,(function(){var r;return m(this,(function(i){return r=this.getInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:Y.READ_RECEIPT_ERROR,data:"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 _(this,void 0,void 0,(function(){var r;return m(this,(function(i){return r=this.getInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:Y.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){ht.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=rt.getInstance())||void 0===e||e.distroy(),qe({userId:""})},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===S.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===S.ULTRA_GROUP){var o=Y.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:Y[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===S.ULTRA_GROUP?Promise.resolve(Y.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===S.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(S.ULTRA_GROUP)){var r=Y.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:Y[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[S.PRIVATE,S.GROUP,S.SYSTEM,S.PUBLIC_SERVICE],!!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=""),_(this,void 0,void 0,(function(){var i;return m(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===S.ULTRA_GROUP&&void 0!==n)return Promise.resolve(Y.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===S.ULTRA_GROUP?Promise.resolve(Y.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 Mt(n)&&Ut(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(Y.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(!Mt(i)||!Ut(o))return Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})}var s=f(f({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return Mt(n)&&Ut(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(Y.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return Mt(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(Y.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(!Mt(r))return Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return Mt(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(Y.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 _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return i=this.getInfoFromCache(),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=l.sent(),c=u.code,h=u.data,c===Y.SUCCESS&&h?[2,Promise.resolve(Object.assign(h,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(c)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r,i){return void 0===i&&(i=ie.QINIU),_(this,void 0,void 0,(function(){var o,s,a;return m(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===Y.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return _(this,void 0,void 0,(function(){return m(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.length>1e3?[2,Promise.reject(Y.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return _(this,void 0,void 0,(function(){return m(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},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!==S.ULTRA_GROUP){var t=Y.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:Y[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return e.channelId,t=e.conversationType,e.targetId,e.messageUId,e.keys,n=e.expansion,e.removeAll,r=e.canIncludeExpansion,t!==S.ULTRA_GROUP?[2,{code:i=Y.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:Y[i]}]:r?(o=F(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:Y.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:Y.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:Y.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return _(this,void 0,void 0,(function(){var t;return m(this,(function(n){switch(n.label){case 0:return e.conversationType!==S.ULTRA_GROUP?[2,{code:t=Y.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:Y[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e){return this._engine.getUltraGroupUnreadCountByTargetId(e)},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.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,T([e],n,!1))},e.prototype.clearConversations=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){ht.error(e)}}))},e.prototype.addToBlacklist=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return _(this,void 0,void 0,(function(){return m(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),_(this,void 0,void 0,(function(){return m(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=""),_(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,r){return _(this,void 0,void 0,(function(){return m(this,(function(i){return[2,this._engine.updateMessageReceiptStatus(e,t,n,r)]}))}))},e.prototype.setUserStatus=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return _(this,void 0,void 0,(function(){return m(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=""),_(this,void 0,void 0,(function(){return m(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),_(this,void 0,void 0,(function(){return m(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=""),_(this,void 0,void 0,(function(){return m(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 _(this,void 0,void 0,(function(){return m(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 _(this,void 0,void 0,(function(){return m(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 _(this,void 0,void 0,(function(){return m(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.joinRTCRoom=function(e,t,n,r,i,o){return this._engine.joinRTCRoom(e,t,n,r,i,o)},e.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},e.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},e.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},e.prototype.setRTCUserInfo=function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)},e.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},e.prototype.setRTCData=function(e,t,n,r,i,o){return this._engine.setRTCData(e,t,n,r,i,o)},e.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),this._engine.setRTCTotalRes(e,t,n,r,i)},e.prototype.setRTCCDNUris=function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)},e.prototype.getRTCData=function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)},e.prototype.removeRTCData=function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)},e.prototype.setRTCOutData=function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)},e.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},e.prototype.getRTCToken=function(e,t,n){return this._engine.getRTCToken(e,t,n)},e.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},e.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},e.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)},e.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},e.prototype.rtcIdentityChange=function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)},e.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},e.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},e.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},e.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},e.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e}();exports.TagChangeType=void 0,(is=exports.TagChangeType||(exports.TagChangeType={}))[is.add=1]="add",is[is.update=2]="update",is[is.delete=3]="delete";exports.AEngine=vo,exports.APIContext=os,exports.AppStorage=l,exports.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},exports.CallLibMsgType=Se,exports.ChatroomEntryType=ce,exports.ChatroomUserChangeType=le,exports.CometChannel=mo,exports.ConnectResultCode=W,exports.ConnectionStatus=Q,exports.ConversationType=S,exports.DB_LOG_FLUSH_FREQUENCY=3e3,exports.DB_LOG_MAX_SIZE=1e5,exports.DelayTimer=Bt,exports.ErrorCode=Y,exports.EventEmitter=lt,exports.FileType=O,exports.IM_CHATROOM_PULL_INTERVAL_TIME=18e4,exports.IM_COMET_PULLMSG_TIMEOUT=45e3,exports.IM_PING_INTERVAL_TIME=15e3,exports.IM_PING_MIN_TIMEOUT=2e3,exports.IM_PING_TIMEOUT=15e3,exports.IM_SIGNAL_TIMEOUT=3e4,exports.Logger=ct,exports.MAX_MESSAGE_CONTENT_BYTES=131072,exports.MAX_MESSAGE_EXPANSION_KEY_LENGTH=32,exports.MAX_MESSAGE_EXPANSION_VAL_LENGTH=4096,exports.MINI_COMET_CONNECT_URIS=o,exports.MINI_SOCKET_CONNECT_URIS=i,exports.MentionedType=ne,exports.MessageBlockType=pe,exports.MessageDirection=K,exports.MessageType=z,exports.NAVI_CACHE_DURATION=72e5,exports.NAVI_REQ_TIMEOUT=1e4,exports.NotificationLevel=ee,exports.NotificationStatus=X,exports.ONE_LOG_SIZE_MAX=1e3,exports.OperateStatus=Ee,exports.PING_REQ_TIMEOUT=5e3,exports.PUBLIC_CLOUD_NAVI_URIS=r,exports.PluginContext=Eo,exports.RCAssertError=It,exports.REAT_TIME_LOG_SIZE=500,exports.RTCPluginContext=ns,exports.ReceivedStatus=n,exports.SEND_MESSAGE_TYPE_OPTION=s,exports.STATUS_MESSAGE=a,exports.STORAGE_ROOT_KEY="RCV4-",exports.UploadMethod=ie,exports.VersionManage=gt,exports.WEB_SOCKET_TIMEOUT=5e3,exports.WebSocketChannel=_o,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),!Ct(e,t,n,r))throw new It("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},exports.clone=kt,exports.cloneByJSON=Pt,exports.engineLogger=ht,exports.forEach=At,exports.formatConnectResponseCode=xt,exports.getBrowser=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"}},exports.getMimeKey=function(e){var t="application/octet-stream";switch(e){case O.IMAGE:t="image/jpeg";break;case O.AUDIO:t="audio/amr";break;case O.VIDEO:t="video/3gpp";break;case O.SIGHT:t="video/mpeg4";break;case O.COMBINE_HTML:t="text/html"}return t},exports.getUUID=Ae,exports.getUUID22=Le,exports.getUploadFileName=St,exports.indexOf=wt,exports.isArray=L,exports.isArrayBuffer=w,exports.isBoolean=U,exports.isFunction=D,exports.isHttpUrl=function(e){return M(e)&&/https?:\/\//.test(e)},exports.isInObject=bt,exports.isInclude=function(e,t){return-1!==wt(e,t)},exports.isNull=V,exports.isNumber=A,exports.isObject=P,exports.isString=M,exports.isUndefined=x,exports.isValidChannelId=B,exports.isValidChrmEntryKey=Mt,exports.isValidChrmEntryValue=Ut,exports.isValidConversationType=G,exports.isValidExpansion=F,exports.isValidFileType=function(e){return A(e)&&Object.prototype.hasOwnProperty.call(O,e)},exports.logger=Xe,exports.map=Lt,exports.notEmptyArray=function(e){return L(e)&&e.length>0},exports.notEmptyObject=k,exports.notEmptyString=b,exports.pushConfigsToJSON=Nt,exports.pushJSONToConfigs=Ot,exports.randomNum=function(e,t){return e+Math.floor(Math.random()*(t-e))},exports.todo=function(e){return new v(e)},exports.usingCppEngine=Dt,exports.validate=Ct,exports.version="5.4.4";
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=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],i=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],o=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],s={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0},"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},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{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:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},a=["RC:TypSts","RC:InterceptMsg"];exports.CONNECTION_TYPE=void 0,(t=exports.CONNECTION_TYPE||(exports.CONNECTION_TYPE={})).WEBSOCKET="websocket",t.COMET="comet";var u,c=function(e){return u||(u={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}}),u},h=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),l=function(){function e(e,t){var n,r=t?"".concat("RCV4-").concat(t):"RCV4-";this._rootStorage=c(e);var i=this._rootStorage.get(r)||{};this._cache=new h(((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}(),d=function(e,t){return d=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])},d(e,t)};function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var f=function(){return f=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},f.apply(this,arguments)};function _(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 m(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function T(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 y,v=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return p(t,e),t}(Error),E=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e=e.replace(r,(function(e){return e.toUpperCase()}))},I=function(e,t){void 0===t&&(t="utf-8");var n,r=0;if("utf-16"===t)for(var i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<=65535?2:4;else for(i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<127?1:n<=2047?2:n<=65535?3:4;return r},C=function(e){return e.match(/\d+(\.\d+){2}/)[0]};!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"}(y||(y={}));var R,S=y;!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"}(R||(R={}));var N,O=R,M=function(e){return"string"==typeof e},U=function(e){return"boolean"==typeof e},A=function(e){return"number"==typeof e&&!isNaN(e)},L=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},w=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},b=function(e){return M(e)&&e.length>0},P=function(e){return"[object Object]"===Object.prototype.toString.call(e)},D=function(e){return"[object Function]"===Object.prototype.toString.call(e)},x=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},V=function(e){return"[object Null]"===Object.prototype.toString.call(e)},G=function(e){for(var t in e)return!0;return!1},k=function(e){return A(e)&&Object.prototype.hasOwnProperty.call(S,e)},B=function(e){var t=!1;return M(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},F=function(e){var t=!1,n=!1,r=!1;if(P(e)){var i=Object.keys(e).length;for(var o in t=i>20,e)if(n||(n=M(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}};!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(N||(N={}));var K,H=N;!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_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",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_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",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_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",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_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",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_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",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"}(K||(K={}));var q,Y=K;!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.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"}(q||(q={}));var j,Q=q,W={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18};!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.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.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(j||(j={}));var J,z=j;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(J||(J={}));var X,Z=J;!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"}(X||(X={}));var $,ee=X;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}($||($={}));var te,ne=$;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(te||(te={}));var re,ie=te;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(re||(re={}));var oe,se,ae,ue,ce=re;exports.LogLevel=void 0,(oe=exports.LogLevel||(exports.LogLevel={}))[oe.LOG=0]="LOG",oe[oe.DEBUG=0]="DEBUG",oe[oe.INFO=1]="INFO",oe[oe.WARN=2]="WARN",oe[oe.ERROR=3]="ERROR",oe[oe.FATAL=4]="FATAL",oe[oe.STATISTICS=6]="STATISTICS",oe[oe.NONE=1e3]="NONE",exports.LogSource=void 0,(se=exports.LogSource||(exports.LogSource={})).IM="IM",se.RTC="RTC",exports.LogTagId=void 0,(ae=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",ae.A_INIT_O="A-init-O",ae.L_INIT_O="L-init-O",ae.P_INIT_O="P-init-O",ae.A_CONNECT_T="A-connect-T",ae.A_CONNECT_R="A-connect-R",ae.A_CONNECT_S="A-connect-S",ae.A_DISCONNECT_O="A-disconnect-O",ae.A_RECONNECT_T="A-reconnect-T",ae.A_RECONNECT_R="A_RECONNECT_R",ae.L_CONNECT_T="L-connect-T",ae.L_CONNECT_R="L-connect-R",ae.L_CONNECT_S="L-connect-S",ae.P_CONNECT_O="P-connect-O",ae.P_CONNECT_S="P-connect-S",ae.A_SEND_MSG_T="A-send_msg-T",ae.A_SEND_MSG_R="A-send_msg-R",ae.P_SEND_MSG_T="P-send_msg-T",ae.P_SEND_MSG_R="P-send_msg-R",ae.L_SEND_MSG_T="L-send_msg-T",ae.L_SEND_MSG_R="L-send_msg-R",ae.L_PULL_MSG_T="L-pull_msg-T",ae.L_PULL_MSG_R="L-pull_msg-R",ae.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",ae.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",ae.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",ae.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",ae.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",ae.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",ae.A_DELETE_MESSAGES_S="A-delete_messages-S",ae.P_DELETE_MSG_S="P-delete_msg-S",ae.L_PULL_CONVERSATION_S="L-pull_conversation-S",ae.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",ae.A_REGTYP_O="A-regtyp-O",ae.P_REGTYP_O="P-regtype-O",ae.P_REGTYP_E="P-regtype-E",ae.L_GET_NAVI_T="L-get_navi-T",ae.L_GET_NAVI_R="L-get_navi-R",ae.L_ENV_S="L-Env-S",ae.L_GET_INDEX_NAVI_S="L-get_index_navi-S",ae.A_JOIN_CHATROOM_T="A-join_chatroom-T",ae.A_JOIN_CHATROOM_R="A-join_chatroom-R",ae.L_JOIN_CHATROOM_T="L-join_chatroom-T",ae.L_JOIN_CHATROOM_R="L-join_chatroom-R",ae.A_QUIT_CHATROOM_T="A-quit_chatroom-T",ae.A_QUIT_CHATROOM_R="A-quit_chatroom-R",ae.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",ae.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",ae.L_MEDIA_S="L-media-S",ae.L_MEDIA_UPLOAD_T="L-media_upload-T",ae.L_MEDIA_UPLOAD_R="L-media_upload-R",ae.G_UPLOAD_LOG_S="G-upload_log-S",ae.G_UPLOAD_LOG_E="G-upload_log-E",ae.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",ae.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",ae.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",ae.A_GET_HISTORY_MSG_T="A-get_history_msg-T",ae.A_GET_HISTORY_MSG_R="A-get_history_msg-R",ae.L_GET_HISTORY_MSG_T="L-get_history_msg-T",ae.L_GET_HISTORY_MSG_R="L-get_history_msg-R",ae.A_CALLBACK_O="A-callback-O",ae.A_CALLBACK_E="A-callback-E",ae.L_CALLBACK_E="L-callback-E",function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ue||(ue={}));var he,le,de=ue;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(he||(he={})),exports.MessageBlockSourceType=void 0,(le=exports.MessageBlockSourceType||(exports.MessageBlockSourceType={}))[le.MSG_ORIGINAL=0]="MSG_ORIGINAL",le[le.MSG_EXPANSION=1]="MSG_EXPANSION",le[le.MSG_MODIFY=2]="MSG_MODIFY";var pe,fe=he;!function(e){e[e.typing=0]="typing"}(pe||(pe={}));var ge,_e,me,Te,ye,ve,Ee,Ie=pe;exports.UltraGroupChannelType=void 0,(ge=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[ge.PUBLIC=0]="PUBLIC",ge[ge.PRIVATE=1]="PRIVATE",exports.UltraGroupChannelChangeType=void 0,(_e=exports.UltraGroupChannelChangeType||(exports.UltraGroupChannelChangeType={}))[_e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",_e[_e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",_e[_e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UltraMsgChangeType=void 0,(me=exports.UltraMsgChangeType||(exports.UltraMsgChangeType={}))[me.MSG_EXPANSION=1]="MSG_EXPANSION",me[me.MSG_MODIFY=2]="MSG_MODIFY",me[me.MSG_RECALL=3]="MSG_RECALL",me[me.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",exports.UltraMsgSubChangeType=void 0,(Te=exports.UltraMsgSubChangeType||(exports.UltraMsgSubChangeType={}))[Te.CHANNEL_DELETE=1]="CHANNEL_DELETE",Te[Te.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",Te[Te.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",Te[Te.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",Te[Te.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",Te[Te.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.RTCMode=void 0,(ye=exports.RTCMode||(exports.RTCMode={}))[ye.RTC=0]="RTC",ye[ye.LIVE=2]="LIVE",exports.LiveType=void 0,(ve=exports.LiveType||(exports.LiveType={}))[ve.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",ve[ve.AUDIO=1]="AUDIO",exports.LiveRole=void 0,(Ee=exports.LiveRole||(exports.LiveRole={}))[Ee.ANCHOR=1]="ANCHOR",Ee[Ee.AUDIENCE=2]="AUDIENCE";var Ce,Re,Se,Ne={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};exports.RTCApiType=void 0,(Ce=exports.RTCApiType||(exports.RTCApiType={}))[Ce.ROOM=1]="ROOM",Ce[Ce.PERSON=2]="PERSON",exports.RTCIdentityChangeType=void 0,(Re=exports.RTCIdentityChangeType||(exports.RTCIdentityChangeType={}))[Re.AnchorToViewer=1]="AnchorToViewer",Re[Re.ViewerToAnchor=2]="ViewerToAnchor",exports.RTCJoinType=void 0,(Se=exports.RTCJoinType||(exports.RTCJoinType={}))[Se.KICK=0]="KICK",Se[Se.REFUSE=1]="REFUSE",Se[Se.COEXIST=2]="COEXIST";var Oe="RC_Logs";function Me(e){var t=e.target.result;if(1===e.oldVersion)try{t.deleteObjectStore(Oe)}catch(e){console.warn("version 1 indexDB delete error, name: ".concat(e.name,", message: ").concat(e.message,", stack: ").concat(e.stack))}!function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=f({},n.objectStoreParams);r=e.createObjectStore(t,i),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,Oe,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var Ue,Ae=function(){function e(){}return e.init=function(){if("undefined"!=typeof window&&window&&window.indexedDB){if(e.indexDBSwitch&&!e.opening){e.opening=!0;var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(t){e.opening=!1,console.warn("open indexDB request failed "+t.target.error)},t.onsuccess=function(t){e.opening=!1,e._db=t.target.result,e._db&&(e._db.onclose=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has unexpectedly closed."),t),e._db=null,e._instance=null},e._db.onerror=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening error."),t),e._db=null,e._instance=null},e._db.onabort=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening aborted."),t),e._db=null,e._instance=null}),e._instance=new e},t.onupgradeneeded=function(t){e.opening=!1,e._db=t.target.result,Me(t)}}}else console.debug("IndexDB is not currently supported in the environment!")},e.getInstance=function(){return e._instance},e.prototype.addList=function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),o=i.objectStore(t);n.forEach((function(e){null==o||o.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))},e.prototype.getRangeData=function(t,n,r,i){return new Promise((function(o){if(e._db){var s=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),u=s.index(n),c=[],h=u.openCursor(a);h.onsuccess=function(e){var t=e.target.result;t?(c.push(t.value),t.continue()):o(c)},h.onerror=function(e){console.error(e),o([])}}else o([])}))},e.prototype.getCount=function(t,n){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readonly").objectStore(t).count();r.onsuccess=function(){n(r.result)},r.onerror=function(e){console.error(e),n(0)}}else n(0)}))},e.prototype.removeFirstData=function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),o=i.getAllKeys(IDBKeyRange.lowerBound(0),r);o.onsuccess=function(){var e=o.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))},e._db=null,e.indexDBSwitch=!0,e.opening=!1,e}(),Le=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)}))},we=function(){var e=Le();if(e=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))).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},be=we(),Pe={};function De(e){return 4-e}console&&((Ue={})[exports.LogLevel.DEBUG]=console.debug.bind(console),Ue[exports.LogLevel.INFO]=console.info.bind(console),Ue[exports.LogLevel.WARN]=console.warn.bind(console),Ue[exports.LogLevel.ERROR]=console.error.bind(console),Ue[exports.LogLevel.FATAL]=console.log.bind(console),Pe=Ue);var xe=[],Ve=function(e){return M(e)||A(e)||x(e)||U(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)};function Ge(e,t,n,r){t=/^[\w]+-[\w]+-[\w]+?/.test(t)?t:"L-".concat(t,"-O"),r||(r=["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(t)?exports.LogSource.RTC:exports.LogSource.IM);var i=Date.now(),o="";try{o=(o=JSON.stringify({message:n,userId:Be.userId})).replace(/"/g,'""'),o='"'.concat(o,'"')}catch(e){Xe(exports.LogTagId.G_UPLOAD_LOG_E,{name:e.name,message:e.message,stack:e.stack})}I(o)>=1e3&&(o=function(e,t,n){if(void 0===n&&(n="utf-8"),!e||!t)return"";var r="utf-8"===n?3:2,i=0,o=0,s="";for(o=0;o<e.length;o++){if(e.charCodeAt(o)>255?i+=r:i++,i>t)return s;s+=e.charAt(o)}return e}(o,1e3));var s=De(e),a={sessionId:be,time:i,level:s,content:"".concat(be,",").concat(Date.now(),",").concat(r,",").concat(s,",").concat(t,",").concat(o,"\n"),userId:Be.userId};return xe.push(a),a}function ke(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];console&&Pe[e]&&Pe[e].apply(Pe,T(["".concat(t,":")],n,!1))}var Be={localLogLevel:exports.LogLevel.WARN,userId:""},Fe=-1;Fe>=0&&(clearInterval(Fe),Fe=-1),"undefined"!=typeof window&&window&&window.indexedDB&&(Fe=setInterval((function(){xe.length&&function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:if(!(t=Ae.getInstance()))return[3,6];i.label=1;case 1:return i.trys.push([1,4,,5]),[4,t.addList(Oe,e)];case 2:return n=i.sent(),[4,t.getCount(Oe,"time")];case 3:return i.sent()>1e5&&t.removeFirstData(Oe,"time",2e3),[2,n];case 4:return r=i.sent(),Xe(exports.LogTagId.G_UPLOAD_LOG_E,{name:r.name,message:r.message,stack:r.stack}),[2,!1];case 5:return[3,7];case 6:return Ae.init(),[2,!1];case 7:return[2]}}))}))}(xe.slice()).then((function(e){e&&(xe=[])}))}),3e3));var Ke=Date.now(),He=0;function qe(){var e=Date.now();return Ke!==e&&(Ke=e,He=0),"".concat(Ke,"-").concat(He++)}function Ye(e){!e.customLogPrint&&delete e.customLogPrint,Be=Object.assign(Be,e)}function je(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),e>exports.LogLevel.DEBUG&&(r&&(n=Object.assign(n,r)),Ge(e,t,n,null==r?void 0:r.logSource)),e>=Be.localLogLevel){var i="".concat((new Date).toISOString(),"[").concat(t,"][").concat(exports.LogLevel[e],"]"),o="".concat(i," - ").concat(Ve(n));Be.customLogPrint?Be.customLogPrint(e,o):ke(e,i,Ve(n))}}var Qe,We=je.bind(null,exports.LogLevel.DEBUG),Je=je.bind(null,exports.LogLevel.INFO),ze=je.bind(null,exports.LogLevel.WARN),Xe=je.bind(null,exports.LogLevel.ERROR),Ze=je.bind(null,exports.LogLevel.FATAL),$e=Object.freeze({__proto__:null,sessionId:be,logLevelTransformer:De,formatLogObj:Ve,insertIntoLogCache:Ge,_defaultStdout:ke,ID:qe,init:Ye,log:je,debug:We,info:Je,warn:ze,error:Xe,fatal:Ze}),et=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"}},tt=function(e){var t="RCDeviceId",n=c(e),r="",i=n.get(t);return i?r=i:(r=we(),n.set(t,r)),r},nt=function(){function e(){}return e.compress=function(e){for(var t=this,n={},r=0;r<e.length-1;r++){var i=e.charAt(r)+e.charAt(r+1);n.hasOwnProperty(i)?n[i].push(r):n[i]=[r]}for(var o=[],s=[],a=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);o.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);o.push(i)}o.push(e)}},u=0;u<e.length;){var c=t.indexOf(n,e,u);if(c.length<2)s.push(e.charAt(u++));else if(c.length<4)s.push(e.substr(u,c.length)),u+=c.length;else{var h=t.numberEncode(u-c.offset),l=t.numberEncode(c.length);if(h.length+l.length>=c.length)s.push(e.substr(u,c.length)),u+=c.length;else{a();var d=String.fromCharCode(t.dataType.Compressed|h.length<<2|l.length);o.push(d+h+l),u+=c.length}}}a();var p=t.numberEncode(e.length),f=String.fromCharCode(t.dataType.Tail|p.length);return o.push(f+p),o.join("")},e.uncompress=function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),o=i&t.dataType.Mark,s=15&i,a=void 0;switch(o){case t.dataType.Compressed:var u=s>>2,c=3&s;if(0===u||0===c)throw new Error("Data parsing error,at "+n);var h=t.numberDecode(e.substr(n,u)),l=t.numberDecode(e.substr(n+=u,c));if((h=r.length-h)+l>r.length)throw new Error("Data parsing error,at "+n);n+=c,r+=r.substr(h,l);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,s)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=s;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,s)),r+=e.substr(n+=s,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,s),n+=s;break;case t.dataType.Mark:if(s>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+s),n+=16+s;break;default:throw new Error("Data parsing error,at "+n+" header:"+o)}}while(n<e.length);return r},e.indexOf=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>this.max)){var h=Math.min(o,c);if(h<=r.length)break;if(!(r.length>2&&t.charAt(u+r.length-1)!==t.charAt(n+r.length-1))){for(var l=2,d=l;d<h&&t.charAt(u+d)===t.charAt(n+d);d++)l++;l>=r.length&&(r.length=l,r.offset=u)}}}return r},e.numberEncode=function(e){var t=this,n=[],r=0;do{r=e%t.scale,n.push(t.chars.charAt(r)),e=(e-r)/t.scale}while(e>0);return n.join("")},e.numberDecode=function(e){for(var t=0,n=0,r=e.length-1;r>=0;r--){if(-1===(n=this.chars.indexOf(e.charAt(r))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t},e.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},e.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.scale=e.chars.length,e.max=238327,e}(),rt=function(e){return M(e)&&/https?:\/\//.test(e)},it=function(){function e(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=tt(e.runtime),this.logSwitch=e.logSwitch;var t=et(e.runtime);this.deviceInfo="".concat(t.type,"|").concat(t.version,"|").concat(null==e?void 0:e.sessionId)}return e.prototype.updateUploadLogAttr=function(e){var t=e.logPolicy,n=e.logSwitch,r=e.runtime,i=e.sessionId,o=void 0===i?"":i,s=e.userId;if(t){var a=t.url,u=t.level,c=t.itv,h=t.times;this.logUrl=a||this.logUrl,this.level=u||this.level,this.itv=c||this.itv,this.times=h||this.times}if(n&&(this.logSwitch=n),r){this.deviceId=tt(r);var l=et(r);this.deviceInfo="".concat(l.type,"|").concat(l.version,"|").concat(o)}s&&(this.info.userId=s)},e.init=function(t){return e.reportSwitch=!0,e._instance||(e._instance=new e(t)),e._instance},e.getInstance=function(){return e._instance},e.prototype.reportRealtimeLog=function(t){var n=this;if(0===t.length||!this.logUrl)return Promise.resolve();var r=nt.compress(t.map((function(e){return e.content})).join("")),i=rt(this.logUrl)?"":"https://",o="".concat(i).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");return this.info.runtime.httpReq({method:"POST",url:o,body:r}).then((function(t){var r=t.data;r&&(r=JSON.parse(r),n.itv=r.nextTime,n.level=r.level,n.logSwitch=r.logSwitch,e.currentRTTimes=1)}))},e.prototype.reportFullLog=function(t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d=this;return m(this,(function(p){switch(p.label){case 0:return n=t.startTime,r=t.endTime,i=t.platform,o=t.logId,s=t.uri,a=Ae.getInstance(),"web"===i.toLowerCase()&&a?n>r?[2]:[4,a.getRangeData(Oe,"time",n,r)]:[2];case 1:return u=(u=p.sent()).filter((function(e){return!e.userId||e.userId===d.info.userId})),c=nt.compress(u.map((function(e){return e.content})).join("")||"no data"),5e3,h=1,l=function(){if(h>3||!e.reportSwitch)return Promise.resolve();var t=s||d.logUrl,n=rt(t)?"":"https://",r="".concat(n).concat(t,"?version=").concat(d.info.version,"&appkey=").concat(d.info.appkey,"&userId=").concat(d.info.userId,"&logId=").concat(o,"&deviceId=").concat(d.deviceId,"&deviceInfo=").concat(d.deviceInfo,"&platform=Web"),i=5e3*(h-1);return h++,new Promise((function(t,n){setTimeout((function(){e.reportSwitch&&d.info.runtime.httpReq({url:r,method:"POST",body:c}).then((function(){t()})).catch((function(e){n(e),l()}))}),i)}))},[2,l()]}}))}))},e.prototype.distroy=function(){e.currentRTTimes=1,e.reportSwitch=!1},e.currentRTTimes=1,e.reportSwitch=!1,e}(),ot=[],st=-1;function at(e){Qe&&Qe.updateUploadLogAttr(e)}function ut(e,t,n,r){Ge(4-e,t,n);var i=JSON.stringify({message:n});i=i.replace(/"/g,'""'),i='"'.concat(i,'"');var o={level:e,content:[be,Date.now(),r||exports.LogSource.IM,e,t,i].join()+"\n"};ot.push(o),ot.length>=600&&(ot=ot.slice(-500))}function ct(){if(st>=0&&(clearTimeout(st),st=-1),Qe&&Qe.logSwitch&&it.reportSwitch){var e=Qe.itv*Math.pow(2,it.currentRTTimes-1);it.currentRTTimes<Qe.times&&it.currentRTTimes++,st=setTimeout((function(){var e=ot.filter((function(e){return e.level<=Qe.level}));0===e.length?ct():Qe.reportRealtimeLog(e).then((function(){ot=[],Je(exports.LogTagId.G_UPLOAD_LOG_S,"report real-time log success"),ct()})).catch((function(e){Je(exports.LogTagId.G_UPLOAD_LOG_E,"report real-time log error -> "+e),ct()}))}),1e3*e)}}var ht=function(){function e(e,t,n){this.tagId=e,this.logSource=t,this.initiator=n,this._localLogLevel=exports.LogLevel.WARN,this.debug=this.log.bind(this,exports.LogLevel.DEBUG),this.info=this.log.bind(this,exports.LogLevel.INFO),this.warn=this.log.bind(this,exports.LogLevel.WARN),this.error=this.log.bind(this,exports.LogLevel.ERROR),this.fatal=this.log.bind(this,exports.LogLevel.FATAL),this.reportLog=ut}return e.prototype.setLogLevel=function(e){this._localLogLevel="number"!=typeof e?exports.LogLevel.WARN:e},e.prototype.setLogStdout=function(e){this._customLogPrint=e},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e>exports.LogLevel.DEBUG&&Ge(e,this.tagId,t.map(Ve).join(" ")),!(e<this._localLogLevel)){var r="".concat((new Date).toISOString(),"[").concat(this.tagId,"][").concat(exports.LogLevel[e],"]"),i="".concat(r," - ").concat(t.map(Ve).join(" "));this._customLogPrint?this._customLogPrint(e,i):this._stdout?this._stdout(e,i):ke.apply(void 0,T([e,r],t,!1))}},e.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},e.prototype.setStdout=function(e){this._stdout=e},e}(),lt=new ht("RCEngine"),dt=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,T([s],t,!1))}catch(e){lt.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),pt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};pt.engine="5.4.5";var ft,gt,_t=function(){function e(){}return e.add=function(e,t){pt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return lt.warn("The validation engine version '".concat(e,"' is invalid!")),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return pt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return pt},e}();exports.AssertRules=void 0,(gt=exports.AssertRules||(exports.AssertRules={}))[gt.STRING=0]="STRING",gt[gt.ONLY_STRING=1]="ONLY_STRING",gt[gt.NUMBER=2]="NUMBER",gt[gt.BOOLEAN=3]="BOOLEAN",gt[gt.OBJECT=4]="OBJECT",gt[gt.ARRAY=5]="ARRAY",gt[gt.CALLBACK=6]="CALLBACK",gt[gt.CHANNEL_ID=7]="CHANNEL_ID",gt[gt.CONVERSATION=8]="CONVERSATION";var mt,Tt,yt,vt,Et,It=((ft={})[exports.AssertRules.STRING]=b,ft[exports.AssertRules.ONLY_STRING]=M,ft[exports.AssertRules.NUMBER]=A,ft[exports.AssertRules.BOOLEAN]=function(e){return"boolean"==typeof e},ft[exports.AssertRules.OBJECT]=P,ft[exports.AssertRules.ARRAY]=L,ft[exports.AssertRules.CALLBACK]=function(e){var t=!0;return P(e)||(t=!1),(e=e||{}).onSuccess&&!D(e.onSuccess)&&(t=!1),e.onError&&!D(e.onError)&&(t=!1),t},ft[exports.AssertRules.CHANNEL_ID]=B,ft[exports.AssertRules.CONVERSATION]=function(e){var t=!0;return P(e)||(t=!1),M(e.targetId)||(t=!1),k(e.conversationType)||(t=!1),x(e.channelId)||B(e.channelId)||(t=!1),t},ft),Ct=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return p(t,e),t}(Error),Rt=function(e,t,n,r){void 0===r&&(r=!1),n=It[n]||n;var i=r&&!n(t)||!r&&!(x(t)||null===t||n(t));return i&&lt.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),!i},St=function(e){if(!P(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{"+t.length+"}$"),t),16)},Nt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=Le(),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="."+a[a.length-1]}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(o).concat(r).concat(s)},Ot=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,h=t.googleConfig,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=r||"",l.category=i||"",l.richMediaUri=o||"";var d={};d.collapse_key=null==h?void 0:h.collapseKey,d.imageUrl=null==h?void 0:h.imageUrl;var p=null==h?void 0:h.priority;p&&!["high","normal"].includes(p)&&(p="normal"),d.priority=p;var f=[{HW:{channelId:a||""}},{MI:{channelId:s||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||""}},{APNS:l},{FCM:d}];return JSON.stringify(f)},Mt=function(e,t){var n={},r={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:r};try{var i=JSON.parse(e);null==i||i.forEach((function(e){var t,i,o,s,a=Object.keys(e);if(0!==a.length){var u=a[0];switch(u){case"HW":return void(r.channelIdHW=null===(t=e[u])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[u])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(o=e[u])||void 0===o?void 0:o.channelId);case"VIVO":return void(r.typeVivo=null===(s=e[u])||void 0===s?void 0:s.classification);case"APNS":return n.threadId=e[u]["thread-id"],n.apnsCollapseId=e[u]["apns-collapse-id"],n.category=e[u].category,void(n.richMediaUri=e[u].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[u].collapse_key||"",imageUrl:e[u].imageUrl||"",priority:e[u].priority||""}}}}))}catch(t){lt.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},Ut=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},At=function(e){var t=e.length;return t<=4096&&t>=1},Lt=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;P(e)&&function(){for(var n in e)t(e[n],n,e)}(),(L(e)||M(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)}()},wt=function(e,t){return Lt(e,(function(n,r){e[r]=t(n,r)})),e},bt=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return Lt(e,(function(e,r){t===e&&(n=r)})),n},Pt=function(e,t){var n=[];return Lt(e,(function(e){n.push(e)})),-1!==bt(n,t)},Dt=function(e){return JSON.parse(JSON.stringify(e))},xt=function(){return"undefined"!=typeof RCCppEngine},Vt=function(e){switch(e){case W.SERVER_UNAVAILABLE:return Y.SERVER_UNAVAILABLE;case W.TOKEN_INCORRECT:return Y.RC_CONN_USER_OR_PASSWD_ERROR;case W.REDIRECT:return Y.RC_CONN_REDIRECTED;case W.APP_BLOCK_OR_DELETE:return Y.RC_CONN_APP_BLOCKED_OR_DELETED;case W.BLOCK:return Y.RC_CONN_USER_BLOCKED;case W.TOKEN_EXPIRE:return Y.RC_CONN_USER_OR_PASSWD_ERROR;case W.HOSTNAME_ERROR:return Y.HOSTNAME_ERROR;case W.HASOHTERSAMECLIENTONLINE:return Y.HAS_OHTER_SAME_CLIENT_ON_LINE;case W.APP_AUTH_NOT_PASS:return Y.RC_APP_AUTH_NOT_PASS;case W.OTP_USED:return Y.RC_OTP_USED;case W.PLATFORM_ERROR:return Y.RC_PLATFORM_ERROR;default:return Y.RC_NET_UNAVAILABLE}},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},kt=function(e){var t;try{t=Gt(e)}catch(n){lt.error("clone err:",n),t=JSON.parse(JSON.stringify(e))}return t},Bt=function(e){var t={},n=JSON.parse(e);return Lt(n,(function(e,n){t[n]=e.v})),t},Ft={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Ft._delayTime=t-e},getTime:function(){var e=Ft._delayTime;return(new Date).getTime()-e}},Kt=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};!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"}(mt||(mt={})),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"}(Tt||(Tt={})),function(e){e.CONN_ACK="ConnAckMessage",e.DISCONNECT="DisconnectMessage",e.PING_REQ="PingReqMessage",e.PING_RESP="PingRespMessage",e.PUBLISH="PublishMessage",e.PUB_ACK="PubAckMessage",e.QUERY="QueryMessage",e.QUERY_CON="QueryConMessage",e.QUERY_ACK="QueryAckMessage"}(yt||(yt={})),function(e){e.PUB="pub",e.QUERY="qry"}(vt||(vt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Et||(Et={}));var Ht,qt=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=mt.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=mt.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var i=e>0;e&&i&&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}(),Yt=function(){function e(){}return e.writeUTF=function(e,t){var n=[],r=0;if(M(e))for(var i=0,o=e.length;i<o;i++){var s=e.charCodeAt(i);s>=0&&s<=127?(r+=1,n.push(s)):s>=128&&s<=2047?(r+=2,n.push(192|31&s>>6),n.push(128|63&s)):s>=2048&&s<=65535&&(r+=3,n.push(224|15&s>>12),n.push(128|63&s>>6),n.push(128|63&s))}for(i=0,o=n.length;i<o;i++)n[i]>255&&(n[i]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)},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])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+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}(),jt=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"+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"+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"+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._pool.subarray(this._position,this._position+=e);return Yt.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),Qt=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=Yt.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),Wt="UpStreamMessage",Jt="PushExtra",zt="DownStreamMessage",Xt="DownStreamMessages",Zt="SessionsAttQryInput",$t="SessionsAttOutput",en="SyncRequestMsg",tn="ChrmPullMsg",nn="NotifyMsg",rn="HistoryMsgInput",on="HistoryMsgOuput",sn="RelationQryInput",an="RelationsOutput",un="DeleteSessionsInput",cn="SessionInfo",hn="DeleteSessionsOutput",ln="RelationsInput",dn="DeleteMsgInput",pn="CleanHisMsgInput",fn="SessionMsgReadInput",gn="ChrmInput",_n="ChrmOutput",mn="QueryChatRoomInfoInput",Tn="QueryChatRoomInfoOutput",yn="RtcInput",vn="RtcUserListOutput",En="SetUserStatusInput",In="RtcSetDataInput",Cn="RtcUserSetDataInput",Rn="RtcDataInput",Sn="RtcSetOutDataInput",Nn="MCFollowInput",On="RtcTokenOutput",Mn="RtcQryOutput",Un="RtcQryUserOutDataInput",An="RtcUserOutDataOutput",Ln="RtcQueryListInput",wn="RtcRoomInfoOutput",bn="RtcValueInfo",Pn="RtcKeyDeleteInput",Dn="GetQNupTokenInput",xn="GetQNupTokenOutput",Vn="GetQNdownloadUrlInput",Gn="GetDownloadUrlInput",kn="GetQNdownloadUrlOutput",Bn="GetDownloadUrlOutput",Fn="ChrmKVEntity",Kn="SetChrmKV",Hn="SetChrmKVS",qn="DeleteChrmKVS",Yn="ChrmKVOutput",jn="ChrmKVSOutput",Qn="ChrmKVSVersionEntity",Wn="ChrmKVSOutputEntity",Jn="QueryChrmKV",zn="SetUserSettingInput",Xn="SetUserSettingOutput",Zn="PullUserSettingInput",$n="PullUserSettingOutput",er="UserSettingNotification",tr="SessionReq",nr="SessionStates",rr="SessionState",ir="SessionStateItem",or="SessionStateModifyReq",sr="SessionStateModifyResp",ar="GroupUnpushQuery",ur="GroupUnpushSet",cr="GroupUnpushResult",hr="GrpReadReceiptMsg",lr="GrpReadReceiptQryReq",dr="GrpReadReceiptQryResp",pr="GrpMsgReadUser",fr="SessionTagAddInput",gr="SessionTagItem",_r="SessionTagDelInput",mr="SessionDisTagReq",Tr="ReportSDKInput",yr="ReportSDKOutput",vr="UltraGrpPullSes",Er="UltraGrpPullMsg",Ir="MsgChangeReq",Cr="QueryMsgChange",Rr="MsgChange",Sr="MsgChangeList",Nr="MsgQuery",Or="MessageQueryInfo",Mr="MsgQueryAck",Ur="OperateStatus",Ar="OperateStatusNotify",Lr="OperateInfo",wr="OperateSummary",br="RtcNotifyMsg",Pr="RtcPullKV",Dr="RtcKVOutput",xr="RtcQueryUserJoinedInput",Vr="RtcQueryUserJoinedOutput",Gr="RtcViewerJoinedOutput",kr="RtcInviteInput",Br="RtcCancelInviteInput",Fr="RtcInviteAnswerInput",Kr="RtcEndInviteInput",Hr="SetRtcRoomIdInput",qr="SetRtcRoomIdOutput",Yr=((Ht={})[Wt]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],Ht[Xt]=["list","syncTime","finished","broadcastSyncTime"],Ht[zt]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Ht[Jt]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Ht[Zt]=["nothing"],Ht[$t]=["inboxTime","sendboxTime","totalUnreadCount"],Ht[en]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Ht[tn]=["syncTime","count"],Ht[nn]=["type","time","chrmId"],Ht[rn]=["targetId","time","count","order","busChannel"],Ht[on]=["list","syncTime","hasMsg"],Ht[sn]=["type","count","startTime","order"],Ht[an]=["info","isFinished"],Ht[un]=["sessions"],Ht[cn]=["type","channelId","busChannel"],Ht[hn]=["nothing"],Ht[ln]=["type","msg","count","busChannel","startTime","endTime"],Ht[dn]=["type","conversationId","msgs","busChannel"],Ht[pn]=["targetId","dataTime","conversationType","busChannel"],Ht[fn]=["type","msgTime","channelId","busChannel"],Ht[gn]=["nothing"],Ht[_n]=["nothing","sessionId","joinTime"],Ht[mn]=["count","order"],Ht[Tn]=["userTotalNums","userInfos"],Ht[Dn]=["type","key","httpMethod","queryString"],Ht[Vn]=["type","key","fileName"],Ht[Gn]=["type","key","fileName"],Ht[xn]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Ht[kn]=["downloadUrl"],Ht[Bn]=["downloadUrl"],Ht[Fn]=["key","value","status","timestamp","uid","version"],Ht[Kn]=["entry","bNotify","notification","type"],Ht[Hn]=["entry","bNotify","notification","type"],Ht[qn]=["entry","bNotify","notification","type"],Ht[Yn]=["entries","bFullUpdate","syncTime"],Ht[jn]=["timestamp","errorKeys","keysVersion"],Ht[Qn]=["version","key"],Ht[Wn]=["key","errorCode"],Ht[Jn]=["timestamp"],Ht[zn]=["version","value"],Ht[Xn]=["version","reserve"],Ht[Zn]=["version","reserve"],Ht[$n]=["items","version"],Ht.UserSettingItem=["targetId","type","key","value","version","status","tags"],Ht[tr]=["time"],Ht[nr]=["version","state"],Ht[rr]=["type","channelId","time","stateItem","busChannel"],Ht[ir]=["sessionStateType","value","tags"],Ht[or]=["version","state"],Ht[sr]=["version"],Ht[ur]=["busChannel","unpushLevel"],Ht[ar]=["busChannel"],Ht[cr]=["groupId","busChannel","unpushLevel"],Ht[hr]=["msgId","busChannel"],Ht[lr]=["msgId","busChannel"],Ht[dr]=["totalMemberNum","list"],Ht[pr]=["readTime","userId"],Ht[fr]=["version","tags"],Ht[gr]=["tagId","name","createdTime","isTop"],Ht[_r]=["version","tags"],Ht[mr]=["tagId"],Ht[er]=["version","reserve"],Ht[Tr]=["sdkInfo"],Ht[yr]=["nothing"],Ht[vr]=["syncTime","isEraseMsgContent"],Ht[Er]=["syncTime"],Ht[Ir]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Ht[Cr]=["syncTime"],Ht[Sr]=["list","syncTime","hasNext"],Ht[Rr]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType"],Ht[Nr]=["targetId","type","query"],Ht[Or]=["msgTime","msgUID","busChannel"],Ht[Mr]=["list"],Ht[Ur]=["targetId","type","opType","busChannel"],Ht[Ar]=["type","notifyType","info","summary"],Ht[Lr]=["targetId","busChannel","userId","opType","optime"],Ht[wr]=["targetId","busChannel","count","opType"],Ht[yn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],Ht[vn]=["users","token","sessionId","roomInfo"],Ht[En]=["status"],Ht[In]=["interior","target","key","value","objectName","content"],Ht[Cn]=["valueInfo","objectName","content"],Ht[Rn]=["interior","target","key","objectName","content"],Ht[Sn]=["target","valueInfo","objectName","content"],Ht[Nn]=["state"],Ht[On]=["rtcToken"],Ht[Mn]=["outInfo"],Ht[Un]=["userId"],Ht[An]=["user"],Ht[Ln]=["order"],Ht[wn]=["roomId","roomData","userCount","list"],Ht[bn]=["key","value"],Ht[Pn]=["key"],Ht[br]=["type","time","roomId"],Ht[Pr]=["timestamp","roomId"],Ht[Dr]=["entries","bFullUpdate","syncTime"],Ht[xr]=["userId"],Ht[Vr]=["info"],Ht[kr]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Ht[Br]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Ht[Fr]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Ht[Kr]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Ht[Hr]=["rtcRoomId"],Ht[qr]=["nothing"],Ht),jr={},Qr=function(e){var t=Yr[e];jr[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],o="set".concat(E(i,0,1));n[o]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},jr[e].decode=function(e){var t={};M(e)&&(e=JSON.parse(e));var n=function(n){var r="get".concat(E(n,0,1));t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Wr in Yr)Qr(Wr);jr.getModule=function(e){return jr[e]()};var Jr="\npackage Modules;\nmessage probuf {\n message ".concat(En,"\n {\n optional int32 status=1;\n }\n\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(nn," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(en," {\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(Wt," {\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(Jt," {\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(Xt," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(zt," {\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 optional int64 extStatus = 20; // 消息的扩展标记 第0位,表示送达状态: 0x01 表示已送达;断档: 0x02 表示是否需要执行断档策略; 消息修改: 0x04 拉取历史消息时表示该消息是否修改过 0x08 每条消息携带的频道类型\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(O.IMAGE,";\n audio = ").concat(O.AUDIO,";\n video = ").concat(O.VIDEO,";\n file = ").concat(O.FILE,";\n }\n message ").concat(Dn," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message ").concat(Vn," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Gn," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(xn," {\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 message ").concat(kn," {\n required string downloadUrl = 1;\n }\n message ").concat(Bn," {\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(gn," {\n required int32 nothing = 1;\n }\n message ").concat(_n," {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message ").concat(tn," {\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(sn,"\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(ln,"\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(an,"\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 }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message ").concat(pn,"\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(mn,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Tn,"\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 ").concat(Nn,"\n {\n required string state = 1;\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(rn,"\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(on,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Ln,"{\n optional int32 order=1;\n }\n\n message ").concat(Pn,"{\n repeated string key=1;\n }\n\n message ").concat(bn,"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(bn," userData=2; //用户资源信息\n }\n\n message ").concat(vn,"{\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(bn," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(yn,"{\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(bn," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(bn," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message ").concat(Mn,"{\n repeated ").concat(bn," outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message ").concat(Rn,"{\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(In,"{\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(Cn," {\n repeated ").concat(bn," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(bn," content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message ").concat(On,"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ").concat(Sn,"{\n required targetType target=1;\n repeated ").concat(bn," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Un,"{\n repeated string userId = 1;\n }\n message ").concat(An,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Zt,"{\n required int32 nothing = 1;\n }\n message ").concat($t,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(fn,"\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(un,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(cn,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(hn,"\n {\n optional int32 nothing=1;\n }\n message ").concat(dn,"\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(Kn," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Hn," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(qn," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Yn," {\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(jn," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Wn,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Jn," {\n required int64 timestamp = 1;\n }\n message ").concat(zn," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Xn," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Zn," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat($n," {\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(tr," {\n required int64 time = 1;\n }\n message ").concat(nr," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(rr," {\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(ir," {\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(or," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(ar," {\n optional string busChannel = 1;\n }\n message ").concat(ur,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(cr," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(sr," {\n required int64 version=1;\n }\n message ").concat(hr," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(lr," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(dr," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(pr," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(fr," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(gr," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(_r," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(mr," {\n repeated string tagId=1;\n }\n message ").concat(er," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Tr,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(yr,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(br," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Pr,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message ").concat(Dr,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \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 enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(xr,"\n {\n required string userId = 1;\n }\n message ").concat(Vr,"\n {\n repeated RtcJoinedInfo info = 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(Gr,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(kr,"\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(Br,"\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(Fr,"\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(Kr,"\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 message ").concat(vr,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Er,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Ir,"\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(Cr," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Sr," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(Rr," //变更详情\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:频道变更)\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 optional int32 subChangeType = 11; // 当 changeType 为 4 时,该参数有意义; 1: 删除频道; 2: 公有频道变为私有频道; 3: 私有频道变为公有频道; 4: 私有频道成员变更-加入, SDK 不通知业务层; 5: 私有频道成员变更-退出; 6: 公有频道变为私有频道,当前用户不在白名单中;\n }\n message ").concat(Nr," //请求\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(Mr," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(Ur," //客户端发送\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(Ar," //服务端发送\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(Lr," {\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(wr," {\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 message ").concat(Hr,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(qr,"\n {\n required int32 nothing = 1; //用于占位\n }\n}\n");var zr,Xr,Zr,$r,ei,ti,ni,ri=(zr=Jr,Xr=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?g:f;if(t){if(e<0)return g;if(e>=l)return v}else{if(-d>=e)return E;if(e+1>=d)return y}return e<0?r(-e,t).neg():i(0|e%h,0|e/h,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,u,h,l,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;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=f,u=0;u<e.length;u+=8)h=Math.min(8,e.length-u),l=parseInt(e.substring(u,u+h),n),h<8?(d=r(c(n,h)),a=a.mul(d).add(r(l))):a=(a=a.mul(s)).add(r(l));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,h,l,d,p,f,g,_,m,T,y,v,E,I;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,d=(l=(h=4294967296)*h)/2,p=n(16777216),f=n(0),e.ZERO=f,g=n(0,!0),e.UZERO=g,_=n(1),e.ONE=_,m=n(1,!0),e.UONE=m,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,E=i(0,-2147483648,!1),e.MIN_VALUE=E,(I=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},I.toString=function(e){var t,n,i,o,s,a,u,h;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(E)?(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),h=(s.sub(u.mul(o)).toInt()>>>0).toString(e),(s=u).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(E)?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},I.isZero=function(){return 0===this.high&&0===this.low},I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return 1==(1&this.low)},I.isEven=function(){return 0==(1&this.low)},I.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},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.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},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(_)},I.neg=I.negate,I.add=function(e){var n,r,o,a,u,c,h,l,d,p,f;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,h=e.low>>>16,l=0,d=0,p=0,f=0,p+=(f+=a+(65535&e.low))>>>16,d+=(p+=o+h)>>>16,l+=(d+=r+c)>>>16,l+=n+u,i((p&=65535)<<16|(f&=65535),(l&=65535)<<16|(d&=65535),this.unsigned)},I.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){var n,o,a,u,c,h,l,d,g,_,m,T;return this.isZero()?f:(t(e)||(e=s(e)),e.isZero()?f:this.eq(E)?e.isOdd()?E:f:e.eq(E)?this.isOdd()?E:f: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,h=65535&e.high,l=e.low>>>16,g=0,_=0,m=0,T=0,m+=(T+=u*(d=65535&e.low))>>>16,_+=(m+=a*d)>>>16,m&=65535,_+=(m+=u*l)>>>16,g+=(_+=o*d)>>>16,_&=65535,g+=(_+=a*l)>>>16,_&=65535,g+=(_+=u*h)>>>16,g+=n*d+o*l+a*h+u*c,i((m&=65535)<<16|(T&=65535),(g&=65535)<<16|(_&=65535),this.unsigned)))},I.mul=I.multiply,I.divide=function(e){var n,i,o,a,u,h,l;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:f;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return m;o=g}else{if(this.eq(E))return e.eq(_)||e.eq(T)?E:e.eq(E)?_:(n=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?_:T:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(E))return this.unsigned?g:f;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=f}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),l=(h=r(n)).mul(e);l.isNegative()||l.gt(i);)l=(h=r(n-=u,this.unsigned)).mul(e);h.isZero()&&(h=_),o=o.add(h),i=i.sub(l)}return o},I.div=I.divide,I.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.not=function(){return i(~this.low,~this.high,this.unsigned)},I.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return t(e)||(e=s(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},I.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)},I.shl=I.shiftLeft,I.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)},I.shr=I.shiftRight,I.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))},I.shru=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.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]},I.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}(),Zr=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,h=-7,l=n?i-1:0,d=n?-1:1,p=e[t+l];for(l+=d,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+e[t+l],l+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+e[t+l],l+=d,h-=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,h=(1<<c)-1,l=h>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?d/u:d*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=255&s,p+=f,s/=256,c-=8);e[n+p-f]|=128*g}var o,s,a,u,c,h=function(e,t,n){if(void 0===e&&(e=h.DEFAULT_CAPACITY),void 0===t&&(t=h.DEFAULT_ENDIAN),void 0===n&&(n=h.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 h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=e||null,(o=h.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(e,t,n){return new h(e,t,n)},h.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)h.isByteBuffer(e[s])||(e[s]=h.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new h(0,n,r);for(c=new h(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},h.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},h.type=function(){return ArrayBuffer},h.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 h.fromBase64(e,n);case"hex":return h.fromHex(e,n);case"binary":return h.fromBinary(e,n);case"utf8":return h.fromUTF8(e,n);case"debug":return h.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(h.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new h(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 h(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 h(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,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},h.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},h.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=h.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(h.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=h.zigZagDecode32(t.value):t=h.zigZagDecode32(t),t},e&&(h.MAX_VARINT64_BYTES=10,h.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},h.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()},h.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=h.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(h.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=h.zigZagDecode64(n.value):n=h.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,h.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},h.METRICS_CHARS="c",h.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,h.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},h.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},h.calculateString=h.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=h.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===h.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===h.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=h.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,h.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 h||(e=h.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 h(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 h(0,this.littleEndian,this.noAssert);var n=t-e,r=new h(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&&!h.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 h||(e=h.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()},h.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new h(e.length/4*3,n),i=0;return u.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},h.btoa=function(e){return h.fromBinary(e).toBase64()},h.atob=function(e){return h.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)},h.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new h(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},h.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new h(0|(o+1)/3,t,n),a=0,u=0,c=!1,l=!1,d=!1,p=!1,f=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(l||d||p){f=!0;break}l=d=p=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(l||p){f=!0;break}l=p=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(l||d){f=!0;break}l=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(l){f=!0;break}l=!0}s.offset=u,c=!1;break;case"]":if(!n){if(p||d){f=!0;break}p=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(p){f=!0;break}p=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){f=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){f=!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(f)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!l||!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("")},h.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 h(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()},h.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new h(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},h}(Xr),$r=function(e,t){var n,r,i={};return i.ByteBuffer=e,i.c=e,n=e,i.Long=t||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),i.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},i.DotProto=function(e,t){function n(e,n){var r=-1,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}(i,i.Lang),i.Reflect=function(t){function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case t.WIRE_TYPES.STARTGROUP:i(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,u,c,h,l,d,p,f,g,_,m,T,y,v,E={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},E.T=I,o=function(e,t,n,r,i){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(s=o.prototype=Object.create(I.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 E.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof E.T&&(!t||n instanceof E.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 E.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},E.Namespace=o,a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},u=a.prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},u.verifyValue=function(n){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 t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(typeof n,e.message)}else a(typeof n,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(typeof n,"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(typeof n,"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(typeof n,"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(i=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==n)return i[s].id;if(i[s].id==n)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(typeof n,"not an integer"),(n>4294967295||n<0)&&a(typeof n,"not in range for uint32"),n;a(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"==typeof n||a(typeof n,"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(s in o={},n)n.hasOwnProperty(s)&&(o[s]=n[s]);n=o}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},u.calculateLength=function(e,r){if(null===r)return 0;var i;switch(this.type){case t.TYPES.int32:return r<0?n.calculateVarint64(r):n.calculateVarint32(r);case t.TYPES.uint32:return n.calculateVarint32(r);case t.TYPES.sint32:return n.calculateVarint32(n.zigZagEncode32(r));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return n.calculateVarint64(r);case t.TYPES.sint64:return n.calculateVarint64(n.zigZagEncode64(r));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return n.calculateVarint32(r);case t.TYPES.double:return 8;case t.TYPES.string:return i=n.calculateUTF8Bytes(r),n.calculateVarint32(i)+i;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return n.calculateVarint32(r.remaining())+r.remaining();case t.TYPES.message:return i=this.resolvedType.calculate(r),n.calculateVarint32(i)+i;case t.TYPES.group:return(i=this.resolvedType.calculate(r))+n.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},u.encodeValue=function(e,r,i){var o,s;if(null===r)return i;switch(this.type){case t.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case t.TYPES.uint32:i.writeVarint32(r);break;case t.TYPES.sint32:i.writeVarint32ZigZag(r);break;case t.TYPES.fixed32:i.writeUint32(r);break;case t.TYPES.sfixed32:i.writeInt32(r);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(r);break;case t.TYPES.sint64:i.writeVarint64ZigZag(r);break;case t.TYPES.fixed64:i.writeUint64(r);break;case t.TYPES.sfixed64:i.writeInt64(r);break;case t.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case t.TYPES.enum:i.writeVarint32(r);break;case t.TYPES.float:i.writeFloat32(r);break;case t.TYPES.double:i.writeFloat64(r);break;case t.TYPES.string:i.writeVString(r);break;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");o=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=o;break;case t.TYPES.message:s=(new n).LE(),this.resolvedType.encode(r,s),i.writeVarint32(s.offset),i.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},u.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+o,e.offset+=o,i;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,r)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return n.fromBinary(e)}},u.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},E.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},(h=c.prototype=Object.create(o.prototype)).build=function(r){var i,o,s,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,o,s){var a,u,c,h,l,d,p;if(null===e||"object"!=typeof e)return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(e,t){u[t]=i(e,r,o,s)})),u;if(u={},e instanceof t.Map){for(h=(c=e.entries()).next();!h.done;h=c.next())u[e.keyElem.valueToString(h.value[0])]=i(h.value[1],r,o,e.valueElem.resolvedType);return u}for(p in l=e.$type,d=void 0,e)e.hasOwnProperty(p)&&(u[p]=l&&(d=l.getChild(p))?i(e[p],r,o,d.resolvedType):i(e[p],r,o));return u}var o,s,a=r.getChildren(t.Reflect.Message.Field),u=r.getChildren(t.Reflect.Message.OneOf),c=function(e){var i,o,s,h;for(t.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 t.Map(s):null,!s.required&&"proto3"!==r.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof c)||Array.isArray(e)||e instanceof t.Map||n.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(i=0,o=arguments.length;o>i;++i)void 0!==(h=arguments[i])&&this.$set(a[i].name,h);else this.$set(e)},h=c.prototype=Object.create(t.Builder.Message.prototype);for(h.add=function(e,n,i){var o=r._fieldsByName[e];if(!i){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");n=o.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},h.$add=h.add,h.set=function(e,n,i){var o,s,a;if(e&&"object"==typeof e){for(o in i=n,e)e.hasOwnProperty(o)&&void 0!==(n=e[o])&&this.$set(o,n,i);return this}if(s=r._fieldsByName[e],i)this[e]=n;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=n=s.verifyValue(n)}return s&&s.oneof&&(a=this[s.oneof.name],null!==n?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},h.$set=h.set,h.get=function(e,n){if(n)return this[e];var i=r._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},h.$get=h.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,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})),n=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===r.getChild("set"+o)&&(h["set"+o]=n),null===r.getChild("set_"+t)&&(h["set_"+t]=n),null===r.getChild("get"+o)&&(h["get"+o]=i),null===r.getChild("get_"+t)&&(h["get_"+t]=i)}(s);return h.encode=function(t,n){var i,o;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),o=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},c.encode=function(e,t,n){return new c(e).encode(t,n)},h.calculate=function(){return r.calculate(this)},h.encodeDelimited=function(e){var t,i=!1;return e||(e=new n,i=!0),t=(new n).LE(),r.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},c.decode=function(e,t){var i,o;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return o=r.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=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(i=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=r.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))},h.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:r.buildOpt()}),Object.defineProperty(h,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:r}),Object.defineProperty(h,"$type",{value:r})),c}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof g||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 m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},h.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},h.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},h.decode=function(e,n,r){var o,s,a,u,c,h,l,d,p,f,g,_;for(n="number"==typeof n?n:-1,c=e.offset,h=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.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?h[u.name].push(u.decode(s,e)):u.map?(d=u.decode(s,e),h[u.name].set(d[0],d[1])):(h[u.name]=u.decode(s,e),u.oneof&&(null!==(p=h[u.oneof.name])&&p!==u.name&&(h[p]=null),h[u.oneof.name]=u.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:l=e.readVarint32(),e.offset+=l;break;case t.WIRE_TYPES.STARTGROUP:for(;i(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(f=0,g=this._fields.length;g>f;++f)if(null===h[(u=this._fields[f]).name])if("proto3"===this.syntax)h[u.name]=u.defaultValue;else{if(u.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=h,_;t.populateDefaults&&null!==u.defaultValue&&(h[u.name]=u.defaultValue)}return h},E.Message=c,l=function(e,n,r,i,o,s,a,u,h,l){I.call(this,e,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=h||null,this.syntax=l||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=l.prototype=Object.create(I.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},d.verifyValue=function(e,n){var 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===e)return this.required&&r(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],i=0;i<e.length;i++)o.push(this.element.verifyValue(e[i]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(typeof e,"no array expected"),this.element.verifyValue(e))},d.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},d.encode=function(e,r,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===e||this.repeated&&0==e.length)return r;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1),s=r.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],r);a=r.offset-s,(u=n.calculateVarint32(a))>1&&(c=r.slice(s,r.offset),s+=u-1,r.offset=s,r.append(c)),r.writeVarint32(a,s-u)}else for(o=0;o<e.length;o++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],r);else this.map?e.forEach((function(e,i){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.writeVarint32(o),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,r)}),this):this.hasWirePresence(e,i)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,r))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},d.calculate=function(e,r){var i,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);i+=n.calculateVarint32(s),i+=s}else for(o=0;o<e.length;o++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,r){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i+=n.calculateVarint32(o),i+=o}),this):this.hasWirePresence(e,r)&&(i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},d.decode=function(e,n,r){var i,o,s,u,c,h,l;if(!(!this.map&&e==this.type.wireType||!r&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!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(e=7&(h=c.readVarint32()),1==(l=h>>>3))u=this.keyElement.decode(c,e,l);else{if(2!==l)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(c,e,l)}return[u,i]}return this.element.decode(n,e,this.id)},E.Message.Field=l,p=function(e,t,n,r,i,o,s){l.call(this,e,t,n,null,r,i,o,s),this.extension},p.prototype=Object.create(l.prototype),E.Message.ExtensionField=p,f=function(e,t,n){I.call(this,e,t,n),this.fields=[]},E.Message.OneOf=f,g=function(e,t,n,r,i){o.call(this,e,t,n,r,i),this.className="Enum",this.object=null},g.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},(g.prototype=Object.create(o.prototype)).build=function(e){var n,r,i,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,o=(r=this.getChildren(g.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},E.Enum=g,_=function(e,t,n,r){I.call(this,e,t,n),this.className="Enum.Value",this.id=r},_.prototype=Object.create(I.prototype),E.Enum.Value=_,m=function(e,t,n,r){I.call(this,e,t,n),this.field=r},m.prototype=Object.create(I.prototype),E.Extension=m,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(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var r,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(r=0;r<s.length;r++)!function(e){o[e.name]=function(r,i){try{try{r=e.resolvedRequestType.clazz.decode(n.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!=typeof r)throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(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[r]);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}(t,this)},E.Service=T,y=function(e,t,n,r){I.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(y.prototype=Object.create(I.prototype)).buildOpt=s.buildOpt,E.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),E.Service.RPCMethod=v,E}(i),i.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var 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,h,l,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===(h=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(h+""),c):this.import(e.DotProto.Parser.parse(h),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),l=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){l.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=l),t.enums&&(this.create(t.enums),this.ptr=l),t.services&&(this.create(t.services),this.ptr=l),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}(i,i.Lang,i.Reflect),i.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,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,i.Reflect),i.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),i.loadJson(i.DotProto.Parser.parse(e),t,n)},i.protoFromString=i.loadProto,i.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=i.populateAccessors),new i.Builder(e)},i.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=i.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},i.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=zr,i.loadProto(r,void 0,"").build("Modules").probuf}(Zr,Xr),$r);ri.getModule=function(e){var t=new ri[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=w(e)?[].slice.call(new Int8Array(e)):e},t};var ii,oi,si="pgMsgP",ai="chatMsg",ui="pcMsgP",ci={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},hi="delMsg",li="joinChrm",di="joinChrmR",pi="exitChrm",fi="setKV",gi="delKV",_i="setKVS",mi="delKVS",Ti="qryRelationR",yi="delRelation",vi="setSeAtt",Ei={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Ii="qryPMsg",Ci="qryGMsg",Ri="qryCHMsg",Si="qryCMsg",Ni="qrySMsg",Oi=((ei={})["ppMsgP"]=S.PRIVATE,ei[si]=S.GROUP,ei[ai]=S.CHATROOM,ei[ui]=S.CUSTOMER_SERVICE,ei),Mi=((ti={})[S.PRIVATE]=Ii,ti[S.GROUP]=Ci,ti[S.CHATROOM]=Ri,ti[S.CUSTOMER_SERVICE]=Si,ti[S.SYSTEM]=Ni,ti),Ui=((ni={})[S.PRIVATE]=Ei.PRIVATE,ni[S.GROUP]=Ei.GROUP,ni[S.ULTRA_GROUP]=Ei.ULTRA_GROUP,ni[S.CUSTOMER_SERVICE]=Ei.CUSTOMER_SERVICE,ni[S.SYSTEM]=Ei.SYSTEM,ni),Ai="1",Li="0",wi=1,bi=2,Pi=3,Di=function(){function e(e){this._codec="websocket"===e?ri:jr,this._connectType=e}return e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,s=((r={})[Xt]=i._formatSyncMessages,r[zt]=i._formatReceivedMessage,r[Wt]=i._formatSentMessage,r[on]=i._formatHistoryMessages,r[an]=i._formatConversationList,r[Tn]=i._formatChatRoomInfos,r[vn]=i._formatRTCUserList,r[Mn]=i._formatRTCData,r[Yn]=i._formatChatRoomKVList,r[$n]=i._formatUserSetting,r[nr]=i._formatConversationStatus,r[dr]=i._formatGrpReadReceiptQryResp,r[Xn]=i._formatSetUserSettingOutput,r[er]=i._formatUserSettingNotification,r[Sr]=i._formatUltraMsgChangeList,r[Ar]=i._formatUltraOperateStatusNotifyList,r[Mr]=i._formatUltraMsgList,r[_n]=i._formatChrmKVVersion,r[Dr]=i._formatRTCRoomKVList,r[On]=i._formatRTCAuidenceJoinRoomData,r[Vr]=i._formatRTCJoinedUserInfo,r)[t];try{o=e.length>0&&i._codec[t].decode(e),P(o)&&(o=function(e){for(var t in e)P(e[t])&&(e[t]=St(e[t]));return e}(o)),D(s)&&(o=s.call(this,o,n))}catch(n){lt.error("PB parse error\n",n,e,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=w(n)?new Uint8Array(n):n;return Yt.readUTF(i.subarray(t,r))}catch(e){lt.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){lt.info("formatBytes error\n",e)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,o=e.finished;return(x(o)||null===o)&&(e.finished=!0),e.syncTime=St(i),e.list=wt(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var r=(t=t||{}).currentUserId,i=t.connectedTime,o=e.content,s=e.fromUserId,a=e.type,u=e.groupId,c=e.status,h=e.dataTime,l=e.classname,d=e.msgId,p=e.extraContent,g=e.pushContent,_=e.pushExt,m=e.configFlag,T=e.extStatus;e.toUserId,e.groupUnpush;var y=(e.direction||H.RECEIVE)===H.SEND,v=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(c),E=v.isPersited,I=v.isCounted,C=v.isMentioned,R=v.disableNotification,N=v.receivedStatus,O=v.canIncludeExpansion,M=!!(2&(T||0)),U=!!(4&(T||0)),A=!!(8&(T||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,L=[S.GROUP,S.CHATROOM,S.RTC_ROOM,S.ULTRA_GROUP].indexOf(a)>-1?u:s,w=y?r:s,b=St(h),P=b<i,D=a===S.CHATROOM,x=this._formatBytes(o),V={};if(_&&(V=Mt(_.pushConfigs,_.pushId)),x.user){var G=x.user,k=G.portrait,B=G.portraitUri,F=k||B;F&&(x.user.portrait=x.user.portraitUri=F)}var K,q=f(f({},V),{pushTitle:null==_?void 0:_.title,pushContent:g,pushData:g,disablePushTitle:!!m&&Boolean(4&m),forceShowDetailContent:!!m&&Boolean(8&m),templateId:null==_?void 0:_.templateId}),Y=y?H.SEND:H.RECEIVE;D&&s===r&&(Y=H.SEND),p&&(K={},K=Bt(p));var j={conversationType:a,targetId:L,senderUserId:w,messageType:l,messageUId:d,isPersited:E,isCounted:I,isMentioned:C,sentTime:b,messageDirection:Y,receivedTime:Ft.getTime(),disableNotification:R,receivedStatus:N,canIncludeExpansion:O,content:x,expansion:K,configFlag:m,pushConfig:q,channelId:e.busChannel||"",isInterrupt:M,isModifyMessage:U};return a!==S.ULTRA_GROUP&&(j.isOffLineMessage=P),a===S.ULTRA_GROUP&&(j.channelType=A),j},e.prototype._formatSentMessage=function(e,t){var n,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,c=e.pushContent,h=e.configFlag,l=e.extStatus,d=t.signal,p=t.currentUserId,g=d.date,_=d.topic,m=d.targetId,T=!!(2&(l||0)),y=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),v=y.isPersited,E=y.isCounted,I=y.disableNotification,C=y.canIncludeExpansion,R=Oi[_]||S.PRIVATE,N=Pt(ci,_),O=this._formatBytes(r),M=m;i===z.RECALL&&(R=O.conversationType||R,M=O.targetId||m),a&&(n={},n=Bt(a));var U={};u&&(U=Mt(u.pushConfigs,u.pushId));var A=f(f({},U),{pushTitle:null==u?void 0:u.title,pushContent:c,pushData:c,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==u?void 0:u.templateId});return{conversationType:R,targetId:M,messageType:i,messageUId:s,isPersited:v,isCounted:E,isStatusMessage:N,senderUserId:p,content:this._formatBytes(r),sentTime:1e3*g,receivedTime:Ft.getTime(),messageDirection:H.SEND,isOffLineMessage:!1,disableNotification:I,canIncludeExpansion:C,expansion:n,pushConfig:A,channelId:e.busChannel||"",isInterrupt:T}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,s=r.targetId,a=St(e.syncTime),u=[];return Lt(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===S.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,h=e.operatorId,l=e.subChangeType;return{targetId:t,conversationType:n,changeType:i,messageUId:o,changeTime:St(r),sendTime:St(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:h,subChangeType:l}})),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=St(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._formatConversationList=function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){},o={list:(r=wt(r,(function(e){var r=e.msg,o=e.userId,s=e.type,a=e.unreadCount,u=e.busChannel,c=e.versionTime,h=e.remindCount,l=e.busChannelType,d=null;r&&((d=n._formatReceivedMessage(r,t)).targetId=o);var p={targetId:o,conversationType:s,unreadMessageCount:St(a)||0,latestMessage:d||{},channelId:u||""};return s===S.ULTRA_GROUP&&(p.versionTime=St(c)||0,p.unreadMentionedCount=St(h)||0,p.channelType=l||exports.UltraGroupChannelType.PUBLIC),i(p)||p})))||[]};return((null==t?void 0:t.conversationType)||S.NONE)===S.ULTRA_GROUP&&(o.isFinished=e.isFinished),o},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:wt(n,(function(e){var t=e.id,n=e.time;return{id:t,time:St(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=wt(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?ce.DELETE:ce.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:St(i),version:St(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return Lt(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=St(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=St(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return Lt(t,(function(e){var t=e.type,r=e.channelId,i=e.time,o=e.stateItem,s=e.busChannel,a=Z.CLOSE,u=ee.NOT_SET,c=!1,h=[];Lt(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case wi:a=n===Ai?Z.OPEN:Z.CLOSE,u=Number(n)||ee.NOT_SET;break;case bi:c=n===Ai;break;case Pi:h=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:St(i),tags:h,channelId:s||""})})),n},e.prototype._formatRTCUserList=function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,o=e.entries,s=e.offlineKickTime,a={};return Lt(t,(function(e){var t=e.userId,n=e.userData,r={};Lt(n,(function(e){var t=e.key,n=e.value;r[t]=n})),a[t]=r})),{users:a,token:n,sessionId:r,roomInfo:i,kvEntries:o,offlineKickTime:s}},e.prototype._formatRTCData=function(e){var t=e.outInfo,n={};return Lt(t,(function(e){n[e.key]=e.value})),n},e.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return Lt(r,(function(e){i[e.key]=e.value})),i},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=St(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatRTCRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=(t=t||[]).map((function(e){var t=e.timestamp;return Object.assign(e,{timestamp:St(t)})})),isFullUpdate:n,syncTime:r}},e.prototype._formatChrmKVVersion=function(e){return e},e.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:St(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Zt);return e.setNothing(1),e.getArrayData()},e.prototype._getUpMsgModule=function(e,t){var n,r,i,o="comet"===this._connectType,s=e.conversationType,a=t.messageType,u=t.isMentioned,c=t.mentionedType,h=t.mentionedUserIdList,l=t.content,d=t.pushContent,p=t.pushData,f=t.directionalUserIdList,g=t.isFilerWhiteBlacklist,_=t.isVoipPush,m=t.canIncludeExpansion,T=t.expansion,y=t.pushConfig,v=t.channelId;[S.GROUP,S.ULTRA_GROUP].includes(s);var E=this._codec.getModule(Wt),I=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),C=y||{},R=C.pushTitle,N=C.pushContent,O=C.pushData,M=C.iOSConfig,U=C.androidConfig,A=C.templateId,L=C.disablePushTitle,w=C.forceShowDetailContent,b=0;E.setSessionId(I),u&&l&&(l.mentionedInfo={userIdList:(null===(n=l.mentionedInfo)||void 0===n?void 0:n.userIdList)||h||[],type:(null===(r=l.mentionedInfo)||void 0===r?void 0:r.type)||c||ne.ALL,mentionedContent:(null===(i=l.mentionedInfo)||void 0===i?void 0:i.mentionedContent)||""});var P=N||d||"",D=O||p||"";if(P&&E.setPushText(P),D&&E.setAppData(D),f&&E.setUserId(f),b|=_?1:0,b|=g?2:0,b|=L?4:0,b|=w?8:0,E.setConfigFlag(b),E.setClassname(a),l.user&&l.user.portraitUri&&(l.user.portrait=l.user.portraitUri),E.setContent(JSON.stringify(l)),m&&T){var V={};Lt(T,(function(e,t){V[t]={v:e}})),E.setExtraContent(JSON.stringify(V))}if(y){var G=this._codec.getModule(Jt);if(R&&G.setTitle(R),M&&U){var k=Ot(M,U);G.setPushConfigs(k)}(null==U?void 0:U.notificationId)&&G.setPushId(null==U?void 0:U.notificationId),G.setTemplateId(A||""),E.setPushExt(o?G.getArrayData():G)}return x(v)||E.setBusChannel(v),E},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(en);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(tn);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(rn);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(Er);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(sn);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(sn);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(ln);return r.setType(t),n&&r.setBusChannel([n]),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(un),r=[];return Lt(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(cn);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(dn),o=[];return Lt(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(pn);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(fn);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(Ir);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(Ir);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(Cr);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(Nr),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.encodeOperateStatus=function(e,t,n,r){var i=this._codec.getModule(Ur);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(gn);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(mn);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(ur);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(ar);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r){var i=this._codec.getModule(Dn);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="comet"===this._connectType,i=this._codec.getModule(Kn),o=t.key,s=t.value,a=t.notificationExtra,u=t.isSendNotification,c=t.type,h=t.timestamp,l=c||ce.UPDATE,d=Kt(t,l),p={key:o,value:s||"",uid:n,version:h};if(x(d)||(p.status=d),i.setEntry(p),u){var f={conversationType:S.CHATROOM,targetId:e},g={key:o,value:s,extra:a,type:l},_=this._getUpMsgModule(f,{messageType:z.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});r?i.setNotification(_.getArrayData()):i.setNotification(_),i.setBNotify(!0),i.setType(S.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){this._connectType;var r=this._codec.getModule(Hn),i=t.entries,o=t.type||ce.UPDATE,s=Kt(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};x(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Jn);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(Zn);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(tr);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(or),o=Ft.getTime(),s=[];return Lt(e,(function(e){var t=n._codec.getModule(rr),i=e.conversationType,a=e.targetId,u=e.notificationStatus,c=e.isTop,h=e.channelId,l=e.notificationLevel,d=[];t.setType(i),t.setChannelId(a),t.setTime(o),t.setBusChannel(h);var p=u===Z.OPEN,f={};x(u)||(f[wi]=p),x(l)||(f[wi]=l),x(c)||(f[bi]=c),Lt(f,(function(e,t){if(!x(e)){var i=n._codec.getModule(ir);e=e?Ai:Li,x(l)||Number(t)!==wi||(e=String(l)),i.setSessionStateType(Number(t)),i.setValue(e);var o=r?i.getArrayData():i;d.push(o)}})),t.setStateItem(d);var g=r?t.getArrayData():t;s.push(g)})),i.setVersion(t||o),i.setState(s),i.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(hr);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(fr),o=[];return e.forEach((function(e){var t=n._codec.getModule(gr);t.setTagId(e.tagId),t.setName(e.tagName),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(hr);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(_r),o=[];return e.forEach((function(e){var t=n._codec.getModule(gr);t.setTagId(e),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(mr);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(or),o=[];return t.forEach((function(t){var i=n._codec.getModule(rr),s=n._codec.getModule(ir),a=[];e.forEach((function(e){var t=n._codec.getModule(gr);t.setTagId(e.tagId),x(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),s.setSessionStateType(Pi),s.setValue(JSON.stringify(a)),s.setTags(a),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?s.getArrayData():s]),o.push(r?i.getArrayData():i)})),i.setState(o),i.setVersion(Ft.getTime()),i.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Tr);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(vr);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodeJoinRTCRoom=function(e,t,n,r,i){var o=this,s="comet"===this._connectType,a=this._codec.getModule(yn);if(e=e||0,a.setRoomType(e),x(t)||a.setBroadcastType(t),x(n)||a.setJoinType(n),r){var u=[],c=this._codec.getModule(bn);for(var h in r)c.setKey(h),c.setValue(r[h]),s?u.push(c.getArrayData()):u.push(c);a.setInnerDatas(u)}if(i){var l=[];Object.keys(i).forEach((function(e){var t=o._codec.getModule(bn);t.setKey(e),t.setValue(i[e]),s?l.push(t.getArrayData()):l.push(t)})),a.setOuterDatas(l)}return a.getArrayData()},e.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(En).getArrayData()},e.prototype.encodeSetRTCData=function(e,t,n,r,i){var o=this._codec.getModule(In);if(o.setInterior(n),o.setTarget(r),o.setKey(e),o.setValue(t),i){i.name&&o.setObjectName(i.name);var s=i.content;s&&(P(s)&&(s=JSON.stringify(s)),o.setContent(s))}return o.getArrayData()},e.prototype.encodeUserSetRTCData=function(e,t,n,r){var i=this,o="comet"===this._connectType,s=this._codec.getModule(Cn);s.setObjectName(n);var a=this._codec.getModule(bn);a.setKey(e.name),a.setValue(e.content),o?s.setContent(a.getArrayData()):s.setContent(a);var u=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(bn);n.setKey(e);var s="uris"===e?t:r;n.setValue(s),o?u.push(n.getArrayData()):u.push(n)})),s.setValueInfo(u),s.getArrayData()},e.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var n=this._codec.getModule(Cn);n.setObjectName(e);var r=this._codec.getModule(bn);return r.setKey("cdn_uris"),r.setValue(t),n.setValueInfo(r),n.getArrayData()},e.prototype.encodeGetRTCData=function(e,t,n){var r=this._codec.getModule(Rn);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()},e.prototype.encodeRemoveRTCData=function(e,t,n,r){var i=this._codec.getModule(Rn);i.setInterior(t),i.setTarget(n),i.setKey(e);var o=(r=r||{}).name,s=r.content;return!x(o)&&i.setObjectName(o),x(s)||(P(s)&&(s=JSON.stringify(s)),i.setContent(s)),i.getArrayData()},e.prototype.encodeSetRTCOutData=function(e,t,n){var r=this._codec.getModule(Sn);r.setTarget(t),L(e)||(e=[e]),Lt(e,(function(t,n){t.key=t.key?t.key.toString():t.key,t.value=t.value?t.value.toString():t.value,e[n]=t})),r.setValueInfo(e);var i=(n=n||{}).name,o=n.content;return!x(i)&&r.setObjectName(i),x(o)||(P(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()},e.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(Un);return t.setUserId(e),t.getArrayData()},e.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(Nn);return t.setState(e),t.getArrayData()},e.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(Ln);return e.setOrder(2),e.getArrayData()},e.prototype.encodeSetRTCUserInfo=function(e,t){var n=this._codec.getModule(bn);return n.setKey(e),n.setValue(t),n.getArrayData()},e.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(Pn);return t.setKey(e),t.getArrayData()},e.prototype.encodeIdentityChangeInfo=function(e,t,n){void 0===n&&(n=!1);var r=this._codec.getModule(yn);return r.setRoomType(exports.RTCMode.LIVE),t&&r.setBroadcastType(t),r.setIdentityChangeType(e),r.setNeedSysChatroom(n),r.getArrayData()},e.prototype.encodePullRTCRoomKV=function(e,t){var n=this._codec.getModule(Pr);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()},e.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(xr);return t.setUserId(e),t.getArrayData()},e.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=this._codec.getModule(kr);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setTimeoutTime(i),s.setInviteInfo(o),s.getArrayData()},e.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=this._codec.getModule(Br);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(r),o.setInviteInfo(i),o.getArrayData()},e.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree?1:0,u=this._codec.getModule(Fr);return u.setInviteUserId(t),u.setInviteRoomId(n),u.setInviteSessionId(r),u.setContent(i),u.setKey(o),u.setValue(s),u.setAnswerCode(a),u.getArrayData()},e.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=this._codec.getModule(Kr);return o.setInviteRoomId(t),o.setInviteSessionId(n),o.setInviteContent(r),o.setInviteRoomKeys(i),o.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(Hr);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e}(),xi=function(e,t){this._watcher=t,this.codec=new Di(e)};function Vi(e,t,n){if(e&&Qe){var r=Ge(De(exports.LogLevel.STATISTICS),e,t,n);return Qe.reportRealtimeLog([r]).then((function(){Je(exports.LogTagId.G_UPLOAD_LOG_S,"big data realtime report success")})).catch((function(e){Je(exports.LogTagId.G_UPLOAD_LOG_E,"big data realtime report error -> "+e)}))}}!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(ii||(ii={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(oi||(oi={}));var Gi,ki,Bi={},Fi={sdkPrivate:ii.OPEN,serverPrivate:ii.OPEN,bundleId:"lib-next"};function Ki(e){Fi.sdkPrivate=e.sdkPrivate===ii.PRIVATE?ii.PRIVATE:ii.OPEN,Fi.serverPrivate=e.serverPrivate===ii.PRIVATE?ii.PRIVATE:ii.OPEN,e.bundleId&&(Fi.bundleId=e.bundleId)}function Hi(){return Fi}function qi(e,t,n){void 0===t&&(t={}),void 0===n&&(n=!1),P(t)&&e&&(Bi[e]&&!n||(Bi[e]={}),Bi[e]=f(f({},Bi[e]),t))}function Yi(e){return Bi[e]||{}}exports.HttpMethod=void 0,(Gi=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",Gi.POST="POST",exports.NetworkType=void 0,(ki=exports.NetworkType||(exports.NetworkType={})).WIFI="wifi",ki.FOUR_G="4g",ki.THREE_G="3g",ki.TWO_G="2g",ki.FIVE_G="2g",ki.THREE_GENT="3gnet",ki.UNKONWN="unknown";var ji,Qi=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Wi=function(){function e(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Qi(e,t)},e.prototype.read=function(e,t,n){this.readMessage(e,t,n)},e.prototype.readMessage=function(e,t,n){return{stream:e,length:t}},e}(),Ji=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new qt(e,!1,mt.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Qi(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 Qt;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),zi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=yt.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return p(t,e),t.prototype.readMessage=function(e,n,r){if(e.readByte(),this.status=+e.readByte(),n<=t.MESSAGE_LENGTH)return{stream:e,length:n};if(r===Et.V4){var i=e.readByte();1&i&&(this.userId=e.readUTF()),2&i&&e.readUTF(),4&i&&(this.timestamp=e.readLong()),8&i&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var o=e.readUTF();lt.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(Wi),Xi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=yt.DISCONNECT,t.status=0,t}return p(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(Wi),Zi=function(e){function t(){var t=e.call(this,Tt.PING_REQ)||this;return t._name=yt.PING_REQ,t}return p(t,e),t.prototype.writeMessage=function(e){},t}(Ji),$i=function(e){function t(t){var n=e.call(this,t)||this;return n._name=yt.PING_RESP,n}return p(t,e),t}(Wi),eo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return p(t,e),t.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},t}(Wi),to=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return p(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}(Ji),no=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=yt.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=vt.PUB,t}return p(t,e),t.prototype.readMessage=function(t,n){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.data=t.readAll(),{stream:t,length:n}},t}(eo),ro=function(e){function t(t,n,r){var i=e.call(this,Tt.PUBLISH)||this;return i._name=yt.PUBLISH,i.syncMsg=!1,i.identifier=vt.PUB,i.topic=t,i.data=M(n)?Yt.writeUTF(n):n,i.targetId=r,i}return p(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(to),io=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=yt.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=vt.PUB,t.topic="",t.targetId="",t}return p(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:n}},t}(eo),oo=function(e){function t(t){var n=e.call(this,Tt.PUB_ACK)||this;return n._name=yt.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return p(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(to),so=function(e){function t(t,n,r){var i=e.call(this,Tt.QUERY)||this;return i.name=yt.QUERY,i.identifier=vt.QUERY,i.topic=t,i.data=M(n)?Yt.writeUTF(n):n,i.targetId=r,i}return p(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(to),ao=function(e){function t(t){var n=e.call(this,Tt.QUERY_CONFIRM)||this;return n._name=yt.QUERY_CON,n.messageId=t,n}return p(t,e),t}(to),uo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=yt.QUERY_ACK,t.status=0,t.identifier=vt.QUERY,t.topic="",t.targetId="",t}return p(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:n}},t}(eo),co=function(e){var t,n=e.type;switch(n){case Tt.CONN_ACK:t=new zi(e);break;case Tt.PUBLISH:(t=new no(e)).syncMsg=e.syncMsg;break;case Tt.PUB_ACK:t=new io(e);break;case Tt.QUERY_ACK:t=new uo(e);break;case Tt.SUB_ACK:case Tt.UNSUB_ACK:case Tt.PING_RESP:t=new $i(e);break;case Tt.DISCONNECT:t=new Xi(e);break;default:t=new Wi(e),lt.error("No support for deserializing "+n+" messages")}return t};!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.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf",e[e.ugUnpushQuery=94]="ugUnpushQuery",e[e.ugUnpushSet=95]="ugUnpushSet",e[e.setRtcRoomId=96]="setRtcRoomId"}(ji||(ji={}));var ho,lo,po=ji,fo=function(e,t,n,r,i,o,s,a){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(o,"&pid=").concat(s,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(a?"&protocolVer="+a:"")},go=function(e){return[po.ppMsgS,po.pgMsgS,po.chatMsgS].map((function(e){return po[e]})).indexOf(e)>=0};!function(e){e[e.REDIRECT=0]="REDIRECT",e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.REMOTE_CLOSE=3]="REMOTE_CLOSE",e[e.LOGOUT=4]="LOGOUT",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW"}(ho||(ho={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_COMET="IM-stats_comet-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S"}(lo||(lo={}));var _o=function(e,t){lt.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)};var mo=function(e){function t(t,n){var r=e.call(this,"websocket",n)||this;return r._runtime=t,r._socket=null,r._messageIds={},r._syncMessageIds={},r._failedCount=0,r.ALLOW_FAILED_TIMES=2,r._timer=null,r._idCount=0,r._generateMessageId=function(){return r._idCount>=65535&&(r._idCount=0),++r._idCount},r}return p(t,e),t.prototype.connect=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s=this;return m(this,(function(a){return[2,new Promise((function(a){var u=n.slice(),c=!1,h=function(){return _(s,void 0,void 0,(function(){var n,s,l;return m(this,(function(d){switch(d.label){case 0:return 0===u.length||c?[2]:(c=!0,n=u.shift(),qi(lo.IM_WEBSOCKET,{startTime:(new Date).getTime(),host:n,protocol:oi.WS}),[4,this._connect(e,t,n,r,i,o)]);case 1:if(s=d.sent(),l=s===Y.SUCCESS||s===W.REDIRECT?s:Vt(s),qi(lo.IM_WEBSOCKET,{endTime:(new Date).getTime(),code:l}),function(e){_(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f;return m(this,(function(g){switch(g.label){case 0:t=lo.IM_WEBSOCKET,n=Hi(),r=n.sdkPrivate,i=n.serverPrivate,o=n.bundleId,s=Yi(t),a=s.protocol,u=s.startTime,c=s.endTime,h=s.code,l=s.host,d=exports.NetworkType.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return p=g.sent(),lt.info(p.message),[3,4];case 4:return f=0,A(u)&&A(c)&&c>u&&u&&(f=c-u),Vi(t,{spr:r,pr:i,bid:o,ptc:a,dur:f,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),s===Y.SUCCESS)this._checkAlive(),a(s);else if(s===W.REDIRECT)a(s);else{if(0===u.length)return a(Vt(s)),[2];c=!1,h()}return[2]}}))}))};i=C(i),s._watcher.status(Q.CONNECTING),h()}))]}))}))},t.prototype._connect=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s,a,u,c,h,l=this;return m(this,(function(d){switch(d.label){case 0:return s=r.replace("http","ws"),a=fo(s,n,e,t,this._runtime,i,"",o),lt.info("conenct start -> ".concat(a)),this.sendConnectTime=Date.now(),u=this._runtime.createWebSocket(a),c=function(e){l._timer&&(clearTimeout(l._timer),l._timer=null),l._socket===u&&(l._socket=null,l._watcher.status(e))},[4,new Promise((function(e){u.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=function(e,t){var n=new Uint8Array(e),r=new jt(n),i=r.readByte(),o=new qt(i),s=co(o);return s.read(r,n.length-1,t),s}(t,o);if(n instanceof $i&&l._pingResolve)return l._pingResolve(Y.SUCCESS),void(l._pingResolve=void 0);if(n instanceof zi)return lt.info("recv connect ack -> ".concat(n.status)),n.status!==W.ACCEPTED?(lt.warn("connect failed: ".concat(n.status)),void e(n.status)):(lt.info("connect success -> ".concat(a)),l.connectedTime=n.timestamp,l.userId=n.userId||"",l._idCount=n.messageId,void e(Y.SUCCESS));if(n instanceof Xi){var r=n.status;switch(lt.warn("recv disconnect signal -> status: ".concat(r)),r){case ho.BLOCK_NEW:case ho.BLOCK:l._watcher.status(Q.BLOCKED);break;case ho.OTHER_DEVICE_LOGIN:l._watcher.status(Q.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case ho.REDIRECT_NEW:case ho.REDIRECT:l._watcher.status(Q.REDIRECT);break;default:l._watcher.status(Q.DISCONNECT_BY_SERVER)}}else l._onReceiveSignal(n)}else lt.error("Socket received invalid data:",t)})),u.onClose((function(t,n){for(var r in lt.warn("websocket closed! code:",t,"reason:",n),c(Q.CONNECTION_CLOSED),l._messageIds){var i=l._messageIds[r];delete l._messageIds[r],i(Y.RC_NET_CHANNEL_INVALID)}e(t)})),u.onError((function(t){for(var n in lt.error("websocket error!",null==t?void 0:t.stack),c(Q.WEBSOCKET_ERROR),l._messageIds){var r=l._messageIds[n];delete l._messageIds[n],r(Y.RC_NET_CHANNEL_INVALID)}e(Y.NETWORK_ERROR)})),u.onOpen((function(){return lt.info("websocket open =>",a)})),setTimeout((function(){e(Y.TIMEOUT)}),5e3)}))];case 1:return(h=d.sent())===Y.SUCCESS?this._socket=u:(lt.warn("connect result -> code: ".concat(h,", url: ").concat(a)),u.close()),[2,h]}}))}))},t.prototype._checkAlive=function(){var e;return _(this,void 0,void 0,(function(){var t,n,r=this;return m(this,(function(i){switch(i.label){case 0:return this._socket?(lt.info("send ping ->"),this.sendOnly(new Zi),t=qe(),Je(exports.LogTagId.L_CHECK_ALIVE_IM_T,{},{traceId:t}),[4,new Promise((function(e){r._pingResolve=e,r._timer&&clearTimeout(r._timer),r._timer=setTimeout((function(){r._pingResolve=void 0,e(Y.TIMEOUT)}),15e3)}))]):[2];case 1:return n=i.sent(),(n===Y.SUCCESS?Je:ze)(exports.LogTagId.L_CHECK_ALIVE_IM_R,{isSuccess:n===Y.SUCCESS},{traceId:t}),n!==Y.SUCCESS?(this._failedCount+=1,lt.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(n)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,lt.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._socket=null,this._watcher.status(Q.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(lt.info("recv ping <-"),this._failedCount=0,setTimeout((function(){return r._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a=this;return m(this,(function(u){switch(u.label){case 0:return t=e.messageId,e.header&&e.header.qos!==mt.AT_MOST_ONCE&&(e instanceof no&&!e.syncMsg&&(lt.info("send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new oo(t))),e instanceof uo&&(lt.info("send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new ao(t)))),t>0&&(e instanceof io||e instanceof uo)&&(lt.info("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 no?(i=e.syncMsg,o=e.topic,lt.info("recv PublishReader -> messageId: ".concat(t," ").concat(o)),o===po[po.userSetData]?[2]:!i||go(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){a._syncMessageIds[t]=e}))]):[3,2];case 1:s=u.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,s),u.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof ro||e instanceof so)&&(e.messageId=this._generateMessageId()),_o(e,this._socket))},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),_(this,void 0,void 0,(function(){var i,o,s,a,u=this;return m(this,(function(c){switch(c.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,_o(e,this._socket),[4,new Promise((function(e){u._messageIds[i]=e,setTimeout((function(){u._messageIds[i]&&delete u._messageIds[i],e()}),r)}))]):[3,2];case 1:return(o=c.sent())?o instanceof uo||o instanceof io?(s=t&&o.data&&[Y.SUCCESS,Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(lt.warn("send failed -> message: ".concat(i,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:Y.SUCCESS,data:a}]):[2,{code:o}]:(lt.warn("send timeout -> message: ".concat(i,", respPBName: ").concat(t,", timeout: ").concat(r)),[2,{code:Y.TIMEOUT}]);case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(Q.DISCONNECTED))},t}(xi);var To=function(e){function t(t,n){var r=e.call(this,"comet",n)||this;return r._runtime=t,r._messageIds={},r._syncMessageIds={},r._idCount=0,r._generateMessageId=function(){return++r._idCount},r._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),r}return p(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=M(e.data)?JSON.parse(e.data):e.data;return n?!L(n)||(Lt(n,(function(e){return _(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d=this;return m(this,(function(p){switch(p.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new qt(t),r=co(n);for(var i in e)r[i]=e[i];return r}(e),r=n.messageId,i=n._header,o=n.status,n.identifier,s=i&&i.qos!==mt.AT_MOST_ONCE,r&&n.getIdentifier&&((a=this._messageIds[r])&&a(n),this._syncMessageIds[r]&&this._syncMessageIds[r](n)),s&&(n instanceof no&&!n.syncMsg&&(u=new oo(r),this.sendOnly(u)),n instanceof uo&&(u=new ao(r),this.sendOnly(u))),n instanceof Xi){switch(o){case ho.OTHER_DEVICE_LOGIN:this._watcher.status(Q.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case ho.BLOCK:case ho.BLOCK_NEW:this._watcher.status(Q.BLOCKED);break;case ho.REDIRECT_NEW:case ho.REDIRECT:this._watcher.status(Q.REDIRECT);break;default:this._watcher.status(Q.DISCONNECT_BY_SERVER)}return[2]}return n instanceof no?(c=n.syncMsg,h=n.topic,!c||go(h)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){d._syncMessageIds[r]=e}))]):[3,2];case 1:l=p.sent(),delete this._syncMessageIds[r],this._watcher.signal(n,l),p.label=2;case 2:return[2]}}))}))})),!0):(lt.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o;return m(this,(function(s){switch(s.label){case 0:return t=(new Date).getTime(),n="".concat(e,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"&timestrap=").concat(t,"&pid=").concat(this._pid),r=qe(),Je(exports.LogTagId.L_CHECK_ALIVE_IM_T,{},{traceId:r}),[4,this._runtime.httpReq({url:n,body:{pid:this._pid},timeout:45e3})];case 1:return i=s.sent(),o=this.handleCometRes(i),(o?Je:ze)(exports.LogTagId.L_CHECK_ALIVE_IM_R,{isSuccess:o},{traceId:r}),this._isDisconnected||(o?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(Q.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var o,s,a=this;return m(this,(function(u){return i=C(i),this._protocol=r,this._isDisconnected=!1,this._watcher.status(Q.CONNECTING),o=n.slice(),s=!1,[2,new Promise((function(n){var u=function(){return _(a,void 0,void 0,(function(){var a,c,h;return m(this,(function(l){switch(l.label){case 0:return 0===o.length||s?[2]:(s=!0,a=o.shift(),qi(lo.IM_COMET,{startTime:(new Date).getTime(),host:a,protocol:oi.NAVI}),[4,this._connect(e,t,a,r,i)]);case 1:if(c=l.sent(),h=c===Y.SUCCESS||c===W.REDIRECT?c:Vt(c),qi(lo.IM_COMET,{endTime:(new Date).getTime(),code:h}),function(e){_(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f;return m(this,(function(g){switch(g.label){case 0:t=lo.IM_COMET,n=Hi(),r=n.sdkPrivate,i=n.serverPrivate,o=n.bundleId,s=Yi(t),a=s.protocol,u=s.startTime,c=s.endTime,h=s.code,l=s.host,d=exports.NetworkType.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return p=g.sent(),lt.info(p.message),[3,4];case 4:return f=0,A(u)&&A(c)&&c>u&&u&&(f=c-u),Vi(t,{spr:r,pr:i,bid:o,ptc:a,dur:f,cod:h,hos:l,net:d}),[2]}}))}))}(this._runtime),c===Y.SUCCESS)this._startPullSignal(r),n(c);else if(c===W.REDIRECT)n(c);else{if(0===o.length)return n(Vt(c)),[2];s=!1,u()}return[2]}}))}))};a._watcher.status(Q.CONNECTING),u()}))]}))}))},t.prototype._connect=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(lt.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(function(e){if(P(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t}(e.data)?P(e.data)?e.data:JSON.parse(e.data):(lt.error("received data is not a validJson",e.data),!1))},s=fo(r,n,e,t,this._runtime,i,this._pid),this.sendConnectTime=Date.now(),lt.info("conenct start -> ".concat(s)),[4,this._runtime.httpReq({url:s,body:{pid:this._pid},timeout:5e3})];case 1:return a=c.sent(),u=o(a),this._domain=n,u&&0===u.status?(this._sessionid=u.sessionid,this.userId=u.userId,this.connectedTime=u.timestamp,Je("connect success -> userId: ".concat(u.userId,", url: ").concat(s))):lt.warn("connect result -> code: ".concat(null==u?void 0:u.status,", url: ").concat(s)),[2,null==u?void 0:u.status]}}))}))},t.prototype.sendCometData=function(e,t){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return n=(t=this)._domain,r=t._sessionid,i=t._pid,o=e.messageId,s=e.topic,a=e.targetId,e.identifier,u=e.getHeaderFlag(),c=s?"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(u,"&sessionid=").concat(r,"&topic=").concat(s,"&targetid=").concat(a,"&pid=").concat(i):"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(u,"&sessionid=").concat(r,"&pid=").concat(i),[4,this._runtime.httpReq({url:c,method:exports.HttpMethod.POST,body:e.getCometData()})];case 1:return h=l.sent(),this.handleCometRes(h),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),_(this,void 0,void 0,(function(){var i,o,s,a,u=this;return m(this,(function(c){switch(c.label){case 0:return i=this._generateMessageId(),e.messageId=i,this.sendCometData(e),[4,new Promise((function(e){u._messageIds[i]=e,setTimeout((function(){delete u._messageIds[i],e()}),r)}))];case 1:return(o=c.sent())?(s=t&&o.data&&[Y.SUCCESS,Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?a:null}]:[2,{code:Y.SUCCESS,data:a}]):[2,{code:Y.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(Q.DISCONNECTED)},t}(xi),yo=function(e){return["navi",e].join("_")};function vo(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f;return m(this,(function(g){switch(g.label){case 0:t=lo.IM_NAVI,n=Hi(),r=n.sdkPrivate,i=n.serverPrivate,o=n.bundleId,s=Yi(t),a=s.protocol,u=s.startTime,c=s.endTime,h=s.code,l=s.host,d=exports.NetworkType.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return p=g.sent(),lt.debug(p.message),[3,4];case 4:return f=0,A(u)&&A(c)&&c>u&&u&&(f=c-u),Vi(t,{spr:r,pr:i,bid:o,ptc:a,dur:f,cod:h,hos:l,net:d}),[2]}}))}))}var Eo=function(){function e(e,t,n){this.runtime=e,this._watcher=t,this._options=n,this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this._apiVersion=C(this._options.apiVersion)}return e.prototype.getNaviInfo=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o;return m(this,(function(s){switch(s.label){case 0:return n&&this._clear(e),i=function(e,t,n){var r,i,o=yo(e);try{var s=n.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5}))),0===i.length?n.removeItem(o):n.setItem(o,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null}(this._appkey,e,this.runtime.localStorage),i?[2,i]:(o=this._options.navigators.slice(),t.length&&t.forEach((function(e){o.indexOf(e)<0&&o.unshift(e)})),[4,this.requestNaviInfo(o,this._appkey,e,r)]);case 1:return(i=s.sent())?(this.setNaviInfo2Cache(e,i),[2,i]):[2,i]}}))}))},e.prototype.setNaviInfo2Cache=function(e,t){!function(e,t,n,r){var i,o=yo(e);try{var s=r.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5&&t!==e.token}))),i.push({timestamp:a,naviInfo:n,token:t}),r.setItem(o,JSON.stringify(i))}(this._appkey,e,t,this.runtime.localStorage)},e.prototype._clear=function(e){!function(e,t,n){var r,i=yo(e);try{var o=n.getItem(i);r=o?JSON.parse(o):[]}catch(e){r=[]}var s=Date.now();r.length>0&&(r=r.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this.runtime.localStorage)},e}(),Io=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},e.prototype.getCoreVersion=function(){return this._context.coreVersion},e.prototype.getAPIVersion=function(){return this._context.apiVersion},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.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},e}(),Co=function(e,t,n){return[e,t,n].join("_")},Ro=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})},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=Co("inbox",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=Co("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||x(e))){n.broadcastSyncTime=e;var r=Co("broadcastbox",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=Co("broadcastbox",this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n))||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=Co("outbox",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=Co("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),So={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},No=function(){function e(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}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===ce.DELETE,u=s===o,c=!this._isExisted(n),h=a?this._remove:this._add;(t||i||u||c)&&h.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)})),lt.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),Oo=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return m(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=So.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===Y.SUCCESS?(So.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){So.clear(e);var t=this._storeCaches[e];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];G(r)||(r=new No(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}(),Mo=function(){function e(e,t,n,r){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=r,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(n){lt.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],G(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}(),Uo="converStatusChanged",Ao=function(){function e(e,t,n){this._eventEmitter=new dt,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n),this._oldStorage=c(e.runtime),this._storage=new l(e.runtime,this._storagePullTimeKey),this._appkey=t,this._currentUserId=n,this._engine=e,this.adaptOldStatus()}return e.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var e=this._oldStorage.get(this._storagePullTimeKey)||0;if(!e)return;this._storage.set(this._storagePullTimeKey,e),this._oldStorage.remove(this._storagePullTimeKey)}catch(e){Xe(exports.LogTagId.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},e.prototype._set=function(e){var t=this;if(!x(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(Uo,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return _(this,void 0,void 0,(function(){var e,t,n,r;return m(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===Y.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(Uo,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(Uo,(function(e){}))},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}(),Lo={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}},wo={};for(var bo in Lo){var Po=Lo[bo].keyName;wo[Po]=bo}var Do,xo=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var r="con-".concat(t,"-").concat(n);this.storage=new l(e,r),this._localStore=new l(e,"CONVER-".concat(t,"-").concat(n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:S.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,r=e.targetId,i=e.messageType,o=e.isMentioned,s=e.content,a=e.senderUserId,u=e.channelId,c=this._getStoreKey(n,r,u),h=this._localStore.get(c)||{},l=wo.mentionedInfo,d=wo.hasMentioned,p=h[l]||{},f=p.userIdList||[],g=s.mentionedInfo;if(g){if(o&&n===S.GROUP)(g.userIdList||[]).forEach((function(e){e===t._currentUserId&&f.indexOf(a)<0&&f.push(a)})),g.type===ne.ALL&&f.indexOf(a)<0&&f.push(a);if(i===z.RECALL&&n===S.GROUP){var _=f.indexOf(a);_>=0&&f.splice(_,1)}g={userIdList:f,type:(null==g?void 0:g.type)||p.type},0!==f.length?(h[l]=g,h[d]=!0):(delete h[l],delete h[d]),G(h)?this._localStore.set(c,h):this._localStore.remove(c)}},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=wo[s],u=n[s];if(!x(a)&&!x(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(u===Lo[a].defaultVal||"tags"===s&&!G(u))delete o[a];else if("tags"===s){var c=u;for(var h in c)c[h].isTop||delete c[h].isTop;o[a]=u}else o[a]=u;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}G(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 Lo){var a=Lo[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Dt(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(Lo[a]){var u=Lo[a],c=u.keyName,h=u.defaultVal;o[c]=s[a]||Dt(h)}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=Lo[u],h=c.keyName,l=c.defaultVal;s[h]=a[u]||Dt(l)}for(var d in s.tags){x(t[d])&&(t[d]=[]);var p=Object.assign({},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){lt.error("adaptOldStore error: ".concat(e.message))}},e}(),Vo=[S.PRIVATE,S.GROUP,S.SYSTEM,S.PUBLIC_SERVICE,S.APP_PUBLIC_SERVICE],Go="conversationChanged",ko="conTagStatusChanged",Bo=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new dt,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new xo(e.runtime,t,n),this._statusManager=new Ao(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Go,(function(e){r(e)})),this._eventEmitter.on(ko,(function(){i()}))}return 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===H.SEND&&a===this._loginUserId,c=r===z.RECALL,h=P(n),l=!1,d={},p=t.lastUnreadTime||0,f=t.lastReadTime||0,g=t.unreadMessageCount||0;if(p>i||u)return{hasChanged:l,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=g+1,t.lastUnreadTime=i,l=!0),c&&h){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),m=!this._recallMsgTimeMap[_]||this._recallMsgTimeMap[_]&&!this._recallMsgTimeMap[_].find((function(e){return e===n.sentTime})),T=p>=n.sentTime;f&&(T=f<n.sentTime),T&&g&&m&&(!this._recallMsgTimeMap[_]&&(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=g-1,l=!0)}return l&&(d.unreadMessageCount={val:t.unreadMessageCount,time:i}),{hasChanged:l,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;H.SEND;var o=P(n),s=!1,a={};return r&&o&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0,a.hasMentioned={val:!0,time:i},a.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:s,localConversation:t,updateItems:a}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===H.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===ne.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(P(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,h={},l={};n!==S.ULTRA_GROUP&&(x(o)||(l.notificationStatus={time:i,val:o}),x(s)||(l.notificationLevel={time:i,val:s}),x(a)||(l.isTop={time:i,val:a}),x(u)||(l.tags={time:i,val:u},null==u||u.forEach((function(e){h[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,h,c),this._store.set(n,r,{notificationStatus:o,notificationLevel:s,isTop:a,tags:h},c),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:l,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(Go,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(ko),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId;if(Vo.indexOf(r)>=0){var a=!1,u=this._store.get(r,o,s),c={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,u),i=r.hasChanged,o=r.localConversation,s=r.updateItems;a=a||i,c=f(f({},c),s),u=Dt(o)})),a&&this._store.set(r,o,u,s),this._store.updateMentionedData(e),i){var h=this._store.get(r,o,s);h.updatedItems=f({latestMessage:{time:e.sentTime,val:e}},c),h.latestMessage=e;var l=Object.assign(h,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(l)}(a||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||1!==o||s===ee.NOT_SET||s===ee.ALL_MESSAGE)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),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).tags;i=Object.assign(i,n),this._store.set(e,t,{tags:i},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===Z.OPEN||-1!==e.notificationLevel&&0!==e.notificationLevel})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===e&&(e=""),this.get(t,n,e).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.setConversationUpdatedTime=function(e){return this._statusManager.setConversationUpdatedTime(e)},e.prototype.getConversationUpdatedTime=function(){return this._statusManager.getConversationUpdatedTime()},e}(),Fo=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=c(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 _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return m(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!==Y.SUCCESS||x(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,x(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}(),Ko=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return m(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===Y.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}(),Ho=function(e,t){return["send_msg",e,t].join("_")},qo=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=Ho(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=Ho(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=Ho(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}();(Do={})[S.PRIVATE]=po.qryPMsg,Do[S.GROUP]=po.qryGMsg,Do[S.CHATROOM]=po.qryCHMsg,Do[S.CUSTOMER_SERVICE]=po.qryCMsg,Do[S.SYSTEM]=po.qrySMsg;var Yo=[po[po.recallMsg],po[po.ppMsgS],po[po.pgMsgS],po[po.ppMsgP],po[po.pgMsgP],po[po.chatMsg],po[po.pcMsgP],po[po.prMsgS],po[po.updUgRTime]],jo=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 l(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=Wo[s],u=n[s];if(!x(a)&&!x(u))u===Qo[a].defaultVal?delete o[a]:o[a]=u}G(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 Qo){var a=Qo[s],u=a.keyName,c=a.defaultVal;o[u]=i[s]||Dt(c)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Qo={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Wo={};for(var Jo in Qo){var zo=Qo[Jo].keyName;Wo[zo]=Jo}var Xo=function(){function e(e,t,n){this._store=new jo(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===S.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}(),Zo=function(e,t,r,i,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:H.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}},$o=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}))},es=0,ts=function(){return++es},ns=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.naviInfo=null,i._customMessageType={},i._reconnectTimer=-1,i._pullOfflineFinished=!1,i._miniConnectUrl="",i.currentUserId="",i._connectedTime=0,i._localConnectedTime=0,i._status=Q.DISCONNECTED,i._pullingMsg=!1,i._pullQueue=[],i._chrmsQueue={},i._latestSyncTimestamp=0,i._intervalTimer=-1,i._intervalTimerForChrmPull=-1,i._lastSyncUltraMsgTimeStamp=0,i._lastSyncUltraMsgLocalTimeStamp=0,i._ultraGroupTimer=-1,i._isUltraPulling=!1,i._ultraGroupTimeQue=[],i._isUltraGroupListExist=!1,i._ultraGroupMap={},i._firstPullUltraGroupTime=0,i._ultraMsgMap={},i._pullUltraChangeMessageQue=[],i._isPullingUltraChangeMessage=!1,i._lastPullingUltraChangeMessageTime=0,i._ultraMsgChangeMap={},i._letterbox=new Ro(t,r.appkey),i._sendMessageStore=new qo(t,r.appkey),i._chrmEntryHandler=new Oo(i),i._connectType=r.connectionType,i}return p(t,e),t.prototype._formatJSONPUrl=function(e,t,n,r){var i=this.runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi";return"".concat(e,"/").concat(i,".js?appId=").concat(n,"&token=").concat(encodeURIComponent(t),"&callBack=").concat(r,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())},t.prototype.getNaviInfo=function(t,n,r){var s;return _(this,void 0,void 0,(function(){var a;return m(this,(function(u){return this.runtime.useNavi||(a=void 0,a=this.runtime.isSupportSocket()&&"websocket"===this._connectType?i.join(","):o.join(","),this._miniConnectUrl=(null===(s=this._options.miniCMPProxy)||void 0===s?void 0:s.length)?this._options.miniCMPProxy.join(","):a||"",n=[]),[2,e.prototype.getNaviInfo.call(this,t,n,r)]}))}))},t.prototype.requestNaviInfo=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l,d,p;return m(this,(function(f){switch(f.label){case 0:r="getServerEndpoint",i=0,o=e.length,f.label=1;case 1:return i<o?(s=this._formatJSONPUrl(e[i],n,t,r),We("req navi => ".concat(s)),[4,this.runtime.httpReq({url:s,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(a=f.sent(),u=(new Date).getTime(),qi(lo.IM_NAVI,{endTime:u}),200!==a.status)return c=void 0,403===a.status?(c=Y.RC_CONN_USER_OR_PASSWD_ERROR,Xe("request navi error: "+c)):401===a.status&&(c=Y.RC_CONN_APP_BLOCKED_OR_DELETED,Xe("request navi error: "+c)),qi(lo.IM_NAVI,{code:c}),vo(this.runtime),[3,3];try{return h=a.data.match(/{[\d\D]+}/),0===(l=h&&h[0]?h[0]:"").indexOf('{\\"code\\":')&&(l=JSON.parse('"'+l+'"')),p=JSON.parse(l),d=/^https/.test(s)?"https":"http",p.protocol=d,this.runtime.useNavi||(p.server="",p.backupServer=this._miniConnectUrl,p.logSwitch=0),Ki({serverPrivate:p.type===ii.PRIVATE?ii.PRIVATE:ii.OPEN}),qi(lo.IM_NAVI,{code:Y.SUCCESS}),p.userId&&(at({userId:p.userId}),Ye({userId:p.userId})),vo(this.runtime),[2,p]}catch(e){Xe("parse navi err =>",e)}f.label=3;case 3:return i+=1,[3,1];case 4:return this.runtime.useNavi?[2,null]:(p={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",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._miniConnectUrl},qi(lo.IM_NAVI,{code:p.code,startTime:0,endTime:0,host:""}),vo(this.runtime),[2,p])}}))}))},t.prototype.getNaviInfoFromCache=function(){return this.naviInfo?f({},this.naviInfo):null},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a=this;return m(this,(function(u){switch(u.label){case 0:return n=[],this.naviInfo=t,t.server?n.push(t.server):lt.warn("navi.server is invalid"),(r=t.backupServer)&&r.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(lt.error("navi invaild.",n),[2,Y.UNKNOWN]):(i=this.runtime.createDataChannel({status:function(r){a._connectionStatusHandler(r,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=Et.V3,1===t.openAnti&&(o=Et.V4),[4,i.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(s=u.sent())===Y.SUCCESS?(this._channel=i,this.currentUserId=i.userId,this._connectedTime=i.connectedTime,this._localConnectedTime=Math.floor((Date.now()+i.sendConnectTime)/2),this._watcher.status(Q.CONNECTED),this._status=Q.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new Bo(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._ultraGroupManager=new Xo(this,this._appkey,this.currentUserId),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Fo(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new Ko(this),this._joinedChrmManager=new Mo(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval(),1===t.ugMsg&&this._startUltraSyncInterval()):i.close(),[2,s]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,r){if(lt.warn("connection status changed:",e),this._status=e,e!==Q.CONNECTING)if(e!==Q.CONNECTED){if(this._channel&&e!==Q.DISCONNECTED)return e===Q.BLOCKED||e===Q.KICKED_OFFLINE_BY_OTHER_CLIENT||e===Q.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==Q.REDIRECT?(this._watcher.status(e),this._try2Reconnect(t,n,r)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)},t.prototype._try2Reconnect=function(e,t,n){var r,i;return _(this,void 0,void 0,(function(){var o,s=this;return m(this,(function(a){switch(a.label){case 0:return this._channel?(o=Et.V3,1===(null===(r=this.naviInfo)||void 0===r?void 0:r.openAnti)&&(o=Et.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,o)]):[2];case 1:return a.sent()===Y.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(Q.CONNECTED),this._status=Q.CONNECTED,1===(null===(i=this.naviInfo)||void 0===i?void 0:i.ugMsg)&&this._startUltraSyncInterval(),this._rejoinChrm(),[2]):(this._watcher.status(Q.WEBSOCKET_UNAVAILABLE),this._status=Q.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(e,t,n)}),5e3),[2])}}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=po[r];if(i)switch(i){case po.s_ntf:lt.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case po.s_msg:this._receiveMsg(e);break;case po.s_cmd:this._receiveStateNotify(e);break;case po.s_us:this._receiveSettingNotify(e);break;case po.rtc_ntf:this._receiveRtcKv(e);break;case po.s_opNtf:this._pullOperateStatusNotify(e)}else lt.error("unknown topic:",r)}},t.prototype._receiveStateNotify=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,nn),r=n.time,i=n.type,o=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(o,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(r),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(r),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,er)).version;this._userSettingManager.pullUserSettings(n)},t.prototype._receiveRtcKv=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,br),r=n.time,i=n.type,o=n.roomId;if(1===i)this._rtcKVManager.pullEntry(o,r)},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._receiveSyncMsg=function(e,t){var n,r;if(Yo.includes(e.topic)){if(e.topic===po[po.updUgRTime]){var i=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,fn),o=i.channelId,s=i.busChannel,a=this._ultraGroupMap[s+"_"+o];return a&&(a.unreadMessageCount=0,a.unreadMentionedCount=0,a.lastReadTime=t.timestamp,this._watcher.conversation(kt([a]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var u=null===(r=this._channel)||void 0===r?void 0:r.codec.decodeByPBName(e.data,Wt,{currentUserId:this.currentUserId,signal:e});u=this._handleMsgProperties(u),t&&(u.sentTime=t.timestamp,u.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||u.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),u.messageType!==z.EXPANSION_NOTIFY?(u.messageType===z.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(u.conversationType,u.targetId,u.channelId),this._conversationManager.setConversationCacheByMessage(u,!0),this._watcher.batchMessage([u])):this._receiveMessageExpansion(u))}},t.prototype._pullMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,nn),n=t.type,r=t.chrmId,i=t.time;if(lt.info("s_ntf -> type: ".concat(n,", chrmId: ").concat(r,", 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)},t.prototype._syncMsg=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,h,l,d,p,f,g,_,T,y,v=this;return m(this,(function(m){switch(m.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),lt.info("pullMsg -> sendboxTime: ".concat(e,", inboxTime: ").concat(t,", broadcastSyncTime: ").concat(n)),r=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),i=new so(po[po.pullMsg],r,this.currentUserId),o=qe(),Je(exports.LogTagId.L_PULL_MSG_T,{outboxTime:e,inboxTime:t,broadcastSyncTime:n},{traceId:o}),[4,this._channel.send(i,Xt,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=m.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),a!==Y.SUCCESS||!u||x(u.finished)||x(u.list)||x(u.syncTime)?(lt.warn("pullMsg failed -> code:",a,", data: ",u),ze(exports.LogTagId.L_PULL_MSG_R,{code:a,timestamp:this._latestSyncTimestamp},{traceId:o}),this._pullingMsg=!1,[2]):(c=u.list,h=u.finished,l=u.syncTime,d=u.broadcastSyncTime,p=void 0===d?1:d,lt.info("pullMsg success -> syncTime: ".concat(l,", finished: ").concat(h)),f=0,g=[],_=[],c.forEach((function(e){if((g.push(e.messageUId),e.messageDirection===H.SEND)&&(f=Math.max(e.sentTime,f),v._sendMessageStore.getSendMessageMap()[e.messageUId]))return void v._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==z.EXPANSION_NOTIFY){if(e.messageType===z.SYNC_READ_STATUS){if(e.senderUserId!==v.currentUserId)return;v._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=v._handleMsgProperties(e);v._conversationManager.setConversationCacheByMessage(t,!0),_.push(t)}else v._receiveMessageExpansion(e)})),this._watcher.batchMessage(_),this._letterbox.setInboxTime(l,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>l})),this._pullQueue.length=0,(y=this._pullQueue).push.apply(y,T),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),Je(exports.LogTagId.L_PULL_MSG_R,{code:a,messageUIds:g.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h},{traceId:o}),(!h||T.length>0)&&this._syncMsg(),[2])}}))}))},t.prototype._receiveMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,zt,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});if((t=this._handleMsgProperties(t)).conversationType!==S.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!==z.EXPANSION_NOTIFY?t.messageType===z.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,r=e.messageType,i=e.isCounted,o=e.isPersited,u=e.isStatusMessage,c=r in s,h=r in this._customMessageType;if(n=c?f(f({},s[r]),{isStatusMessage:a.includes(r)}):h?this._customMessageType[r]:{isCounted:!V(i)&&i,isPersited:!V(o)&&o,isStatusMessage:!1},Object.assign(e,n),t&&!x(u)&&(e.isStatusMessage=u),!t){var l=e.content.user;if(l){var d=l.portrait,p=l.portraitUri,g=d||p;g&&(l.portrait=l.portraitUri=g)}}return e},t.prototype.getHistoryMessage=function(e,t,n,r,i,o,s,a){return void 0===o&&(o=""),_(this,void 0,void 0,(function(){var s,u,c,h,l,d,p,f,g,_;return m(this,(function(m){switch(m.label){case 0:return u=(s=this).currentUserId,c=s._channel,h=Mi[e]||Ii,l=1===r&&0===n,c?(d=c.codec.encodeGetHistoryMsg(t,{timestamp:n,count:l?2:r,order:i,channelId:o}),Je(exports.LogTagId.L_GET_HISTORY_MSG_T,{targetId:t,conversationType:e,channelId:o,timestamp:n,count:r,order:i},{traceId:a}),[4,c.send(new so(h,d,u),on,{currentUserId:u,connectedTime:c.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return p=m.sent(),(f=p.code)===Y.SUCCESS&&d?(g=p.data,l&&2===g.list.length&&(g.hasMore=!0,0===i?g.list.shift():g.list.pop()),_=[],g.list&&g.list.forEach((function(e){e&&_.push(e.messageUId)})),Je(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:f,messageUIds:_.join(",")},{traceId:a}),[2,{code:f,data:{list:g.list,hasMore:g.hasMore}}]):(ze(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:f,messageUIds:""},{traceId:a}),[2,{code:f}]);case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){lt.info("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new so(po[po.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==Y.SUCCESS&&lt.warn("reportSDKInfo failed -> code: ".concat(t))}))}},t.prototype.deleteRemoteMessage=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeDeleteMessages(e,t,n,r),u=new so(hi,a,o),[4,s.send(u)]):[3,2];case 1:return c=l.sent(),h=c.code,Y.SUCCESS,[2,h];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeClearMessages(t,n,r,e),u=Ui[e],c=new so(u,a,o),[4,s.send(c)]):[3,2];case 1:return h=d.sent(),l=h.code,Y.SUCCESS,[2,l];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),_(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l,d=this;return m(this,(function(p){switch(p.label){case 0:return o=(i=this).currentUserId,s=i._channel,t=t||S.PRIVATE,s?(a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),u=new so(Ti,a,o),[4,s.send(u,an,{currentUserId:o,connectedTime:s.connectedTime,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}})]):[3,2];case 1:return c=p.sent(),h=c.code,l=c.data,h!==Y.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==l?void 0:l.list}];case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return(r=this._channel)?(i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new so(yi,i,t),[4,r.send(o)]):[3,2];case 1:return s=u.sent(),lt.info("RemoveConversation =>",s),a=s.code,Y.SUCCESS,[2,a];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return e!==S.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap[n+"_"+t])?[3,3]:[2,{code:Y.CONVER_GET_ERROR}];case 1:return(i=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:Y.CONVER_GET_ERROR}];case 2:if(o=c.sent(),s=o.code,a=o.data,s!==Y.SUCCESS)return[2,{code:Y.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||Z.CLOSE,notificationLevel:i.notificationLevel||ee.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:Y.SUCCESS,data:r}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:Y.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r,i;return i=e===S.ULTRA_GROUP?(null===(r=this._ultraGroupMap[n+"_"+t])||void 0===r?void 0:r.unreadMessageCount)||0:this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:Y.SUCCESS,data:i})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(Y.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(Y.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(Y.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:Y.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(Y.SUCCESS)},t.prototype.pullConversationStatus=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h=this;return m(this,(function(l){switch(l.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeGetConversationStatus(e),o=new so(po[po.pullSeAtts],i,r),[4,n.send(o,nr)]):[3,2];case 1:return s=l.sent(),a=s.code,u=s.data,Je(exports.LogTagId.L_PULL_CONVERSATION_S,{timestamp:e,userId:r}),a!==Y.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.channelId,o=e.isTop,s=e.notificationLevel,a=e.updatedTime;a&&h._conversationManager.setConversationUpdatedTime(a);var u=h._ultraGroupMap[i+"_"+n];t===S.ULTRA_GROUP?u&&(void 0!==r&&(u.notificationStatus=r),void 0!==s&&(u.notificationLevel=s),void 0===s&&void 0===r||h._ultraGroupManager.addUltraGroupStatus(e),"boolean"==typeof o&&(u.isTop=o)):c.push(e)})),[2,{code:a,data:c}]);case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p=this;return m(this,(function(g){switch(g.label){case 0:return n=(t=this).currentUserId,(r=t._channel)?(i=this._conversationManager.getConversationUpdatedTime(),o=r.codec.encodeSetConversationStatus(e,i),s=new so(vi,o,n),[4,r.send(s,sr)]):[3,2];case 1:return a=g.sent(),u=a.code,c=a.data,u===Y.SUCCESS?(h=c,this._conversationManager.setConversationUpdatedTime(h.version),l=[],e.forEach((function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.notificationLevel,o=e.channelId,s=e.isTop;if(t===S.ULTRA_GROUP){var a=p._ultraGroupMap[o+"_"+n];a&&(void 0!==r&&(a.notificationStatus=r),void 0!==i&&(a.notificationLevel=i),void 0===i&&void 0===r||p._ultraGroupManager.addUltraGroupStatus(a),void 0!==s&&(a.isTop=s),l.push(a))}else p._conversationManager.addStatus(f(f({},e),{updatedTime:h.version}),!0)})),l.length>0&&(d=kt(l),d=$o(d),this._watcher.conversation(d)),[2,u]):[2,u];case 2:return[2,Y.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return(i=this._channel)?(o=i.codec.encodeJoinOrQuitChatRoom(),a=new so(s=n?di:li,o,e),Je(exports.LogTagId.L_JOIN_CHATROOM_T,{chatroomId:e,count:t,topic:s},{traceId:r}),[4,i.send(a,_n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return u=d.sent(),c=u.code,h=u.data,(c===Y.SUCCESS?Je:ze)(exports.LogTagId.L_JOIN_CHATROOM_R,{code:c,timestamp:(new Date).getTime()},{traceId:r}),c===Y.SUCCESS&&(l=h.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,l),this.naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull()),[2,c]}}))}))},t.prototype._rejoinChrm=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,a.label=1;case 1:return r<t.length?(i=t[r],Je(exports.LogTagId.L_REJOIN_CHATROOM_T,{chatroomId:i,count:e[i]||10,topic:di}),o=qe(),[4,this._joinChrm(i,e[i]||10,!0,o)]):[3,4];case 2:s=a.sent(),(s===Y.SUCCESS?Je:ze)(exports.LogTagId.L_REJOIN_CHATROOM_R,{code:s,timestamp:(new Date).getTime()},{traceId:o}),s===Y.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:i,count:e[i]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:s}}),a.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),_(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l,d,p,f,g;return m(this,(function(_){switch(_.label){case 0:return this._channel?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._channel.codec.encodeChrmSyncMsg(o,t),a=new so(po[po.chrmPull],s,e),Je(exports.LogTagId.L_PULL_CHATROOM_MSG_T,{chatroomId:e,timestamp:o}),[4,this._channel.send(a,Xt,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return u=_.sent(),c=u.code,h=u.data,r.pulling=!1,c===Y.SUCCESS&&h?(l=h.list,d=h.syncTime,p=h.finished,r.timestamp=n?Math.max(d,n):d,r.queue=r.queue.filter((function(e){return e>d})),f=[],g=[],l.forEach((function(e){e.sentTime<o||(f.push(e.messageUId),g.push(e))})),this._watcher.batchMessage(g),Je(exports.LogTagId.L_PULL_CHATROOM_MSG_R,{code:c,timestamp:o,messageUIds:f.join(",")}),(!p||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(ze(exports.LogTagId.L_PULL_CHATROOM_MSG_R,{code:c,timestamp:o,messageUIds:""}),lt.warn("pull chatroom msg failed, code:",c,", data:",h),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o;return m(this,(function(s){switch(s.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),r=new so(pi,n,e),[4,t.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return i=s.sent(),(o=i.code)===Y.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return(r=this._channel)?(i=r.codec.encodeGetChatRoomInfo(t,n),o=new so(po[po.queryChrmI],i,e),[4,r.send(o,Tn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==Y.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:return(i=this._channel)?(o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new so(Ri,o,e),[4,i.send(s,on,{conversation:{targetId:e}})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),u=a.code,c=a.data,u!==Y.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=r.codec.encodeModifyChatRoomKV(e,t,i),a=t.type===ce.UPDATE?fi:gi,u=new so(a,s,e),[4,r.send(u,_n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return c=l.sent(),(h=c.code)===Y.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},i),[2,h]):[2,h]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d,p,f=this;return m(this,(function(g){switch(g.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(t.entries.forEach((function(t){var n=f._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?f.getServerTime():n})),o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===ce.UPDATE?_i:mi,a=new so(s,o,e),[4,r.send(a,jn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return u=g.sent(),c=u.code,-1!==[Y.SUCCESS,Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c)&&(l=[],delete(d=Object.assign({},t)).entries,t.entries.forEach((function(e){l.push(Object.assign({},e,d))})),c===Y.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(p=u.data,lt.warn("设置失败的属性:",p.errorKeys),h=p.errorKeys,p&&Array.isArray(p.errorKeys)&&p.errorKeys.forEach((function(e){var t=l.findIndex((function(t){return e.key===t.key}));-1!==t&&l.splice(t,1)}))),lt.warn("设置成功的属性:",l),this._chrmEntryHandler.setLocal(e,{kvEntries:l,syncTime:(new Date).getTime()},i)),[2,{code:c,data:h}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.type=ce.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:Y.SUCCESS,data:n})]:[3,1];case 1:return(r=this._channel)?(i=r.codec.encodePullChatRoomKV(0),o=new so(po[po.pullKV],i,e),[4,r.send(o,Yn)]):[2,Promise.reject({code:Y.RC_NET_CHANNEL_INVALID})];case 2: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,Promise.resolve({code:Y.SUCCESS,data:null==u?void 0:u.value})]:[2,Promise.resolve({code:Y.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:Y.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(r={},i=n.codec.encodePullChatRoomKV(0),o=new so(po[po.pullKV],i,e),[4,n.send(o,Yn)]):[2,Promise.reject({code:Y.RC_NET_CHANNEL_INVALID})];case 2:return s=u.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&a.kvEntries.forEach((function(e){e.key&&(r[e.key]=e.value||"")})),[2,Promise.resolve({code:Y.SUCCESS,data:r})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d;return m(this,(function(p){switch(p.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodePullChatRoomKV(t),s=new so(po[po.pullKV],o,e),Je(exports.LogTagId.L_PULL_CHATROOM_KV_T,{chatroomId:e,timestamp:t}),[4,r.send(s,Yn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return a=p.sent(),u=a.code,c=a.data,(u===Y.SUCCESS?Je:ze)(exports.LogTagId.L_PULL_CHATROOM_KV_R,{code:u,timestamp:t}),u===Y.SUCCESS?(lt.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(e,c,i),lt.info("Save into cache success!"),l=(h=c).kvEntries,h.syncTime,d=[],l.length>0&&(l.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp;d.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),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._channel?t.forEach((function(t){e._pullChrmMsg(t),e.naviInfo.kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),18e4)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s,a,u,c,h,l,d,p,g,_;return m(this,(function(m){switch(m.label){case 0:return this._channel?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![S.PRIVATE,S.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[S.PRIVATE]=po.ppMsgS,t[S.GROUP]=po.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[S.PRIVATE]=po.ppMsgP,t[S.GROUP]=po.pgMsgP,t[S.CHATROOM]=po.chatMsg,t[S.CUSTOMER_SERVICE]=po.pcMsgP,t[S.RTC_ROOM]=po.prMsgS,t)[e]}(e)||po.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(u=new ro(po[s],a,t)).setHeaderQos(mt.AT_LEAST_ONCE),c=n.isPersited?ts():0,o?(this._channel.sendOnly(u),[2,{code:Y.SUCCESS,data:Zo(e,t,f({},n),"",0,this.currentUserId,c)}]):(h=Date.now()-this._localConnectedTime+this._connectedTime,l=Zo(e,t,f({},n),"",h,this.currentUserId,c),r&&r(c),Je(exports.LogTagId.L_SEND_MSG_T,{messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId},{traceId:i}),[4,this._channel.send(u)])):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return d=m.sent(),p=d.code,g=d.data,p!==Y.SUCCESS?(ze(exports.LogTagId.L_SEND_MSG_R,{code:p,messageUId:l.messageUId,messageId:l.messageId},{traceId:i}),[2,{code:p,data:l}]):(Je(exports.LogTagId.L_SEND_MSG_R,{code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId},{traceId:i}),_=g,this._sendMessageStore.setMessage(_.messageUId,_.timestamp),l.sentTime=_.timestamp,l.messageUId=_.messageUId,this._conversationManager.setConversationCacheByMessage(l,!0),[2,{code:Y.SUCCESS,data:l}])}}))}))},t.prototype.recallMsg=function(e,t,n,r,i){var o;return _(this,void 0,void 0,(function(){var s,a,u,c,h,l,d,p,g,_,T,y,v;return m(this,(function(m){switch(m.label){case 0:return this._channel?(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),h={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},l=po[po.recallMsg],d=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},h),(p=new ro(l,d,this.currentUserId)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(p)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return g=m.sent(),_=g.code,T=g.data,e===S.ULTRA_GROUP&&We(exports.LogTagId.L_RECALL_ULTRA_MSG_S,{code:_,conversationType:e,targetId:t,channelId:i.channelId}),_!==Y.SUCCESS?[2,{code:_}]:(y=T,e===S.ULTRA_GROUP?(this._ultraMsgMap[y.messageUId]=y.timestamp,this._updateUltraGroupWhenRecallMsg(t,i.channelId||"",n),[2,{code:Y.SUCCESS}]):(this._sendMessageStore.setMessage(y.messageUId,y.timestamp),v=Zo(e,t,f(f({},h),{isPersited:!0}),y.messageUId,y.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:Y.SUCCESS,data:v}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeReadReceipt(t,n),i=new so(po[po.rrMsg],r,e),[4,this._channel.send(i)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeMessageReader(t,n),i=new so(po[po.rrList],r,e),[4,this._channel.send(i,dr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return _(this,void 0,void 0,(function(){var t,n;return m(this,(function(r){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new so(po[po.pullUS],t,this.currentUserId),[2,this._channel.send(n,$n)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:return this._channel?(i=r&&"uploads"!==r?t||"":Nt(e,t),o=this._channel.codec.encodeGetFileToken(e,i,n||"",r||""),s=new so(po[po.qnTkn],o,this.currentUserId),[4,this._channel.send(s,xn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),u=a.code,c=a.data,c=Object.assign(c,{fileName:i}),u===Y.SUCCESS?[2,{code:u,data:c}]:[2,{code:u}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l,d;return m(this,(function(p){switch(p.label){case 0:return this._channel?(i="",o="",s="",t===ie.QINIU?(o=Vn,s=kn):(o=Gn,s=Bn),i=t===ie.QINIU?po[po.qnUrl]:t===ie.AWS?po[po.s3Url]:t===ie.STC?po[po.stcUrl]:po[po.aliUrl],a=this._channel.codec.encodeGetFileUrl(o,e,n,r),u=new so(i,a,this.currentUserId),[4,this._channel.send(u,s)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return c=p.sent(),h=c.code,l=c.data,d=l,h===Y.SUCCESS?[2,{code:h,data:d}]:[2,{code:h}]}}))}))},t.prototype.disconnect=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData()},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new so(po[po.addSeTag],n,this.currentUserId),[4,this._channel.send(r,Xn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([f(f({},e),{createdTime:a})],a),[2,{code:Y.SUCCESS,data:s}])}}))}))},t.prototype.removeTag=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),r=new so(po[po.delSeTag],n,this.currentUserId),[4,this._channel.send(r,Xn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new so(po[po.addSeTag],n,this.currentUserId),[4,this._channel.send(r,Xn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:Y.SUCCESS,data:s}])}}))}))},t.prototype.getTagList=function(){return _(this,void 0,void 0,(function(){var e,t;return m(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:Y.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s=this;return m(this,(function(a){switch(a.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new so(po[po.addTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:Y.TAG_NOT_EXIST}]:[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(i=a.sent().code)!==Y.SUCCESS?[2,{code:i}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o=this;return m(this,(function(s){switch(s.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new so(po[po.delTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(i=s.sent().code)!==Y.SUCCESS?[2,{code:i}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return this._channel?(n=e.conversationType,r=e.targetId,i=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._channel.codec.encodeUpdateConversationTag(o,[e]),a=new so(po[po.delTag],s,this.currentUserId),[4,this._channel.send(a)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(u=c.sent().code)!==Y.SUCCESS?[2,{code:u}]:(this._conversationManager.deleteTagStatus(n,r,t,i),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(s=o.codec.encodeOldConversationList({count:n,type:S.PRIVATE,startTime:t}),a=new so(Ti,s,i),[4,o.send(a,an,{currentUserId:i,connectedTime:o.connectedTime})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return u=d.sent(),c=u.code,h=u.data,l=this._conversationHasTagFilter(e,null==h?void 0:h.list),lt.info("GetConversationListByTag",l),c!==Y.SUCCESS?[2,{code:c}]:[2,{code:c,data:l}]}}))}))},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,h=u.mentionedInfo,l=u.lastUnreadTime,d=u.notificationStatus,p=u.isTop,g=u.tags,_=u.unreadMessageCount,m=g&&g[e];if(m){var T=f(f({},t),{hasMentioned:c,mentionedInfo:h,lastUnreadTime:l,notificationStatus:d,isTop:p,unreadMessageCount:_});m.isTop?r.push(f(f({},T),{isTopInTag:!0})):i.push(f(f({},T),{isTopInTag:!1}))}})),T(T([],r.sort(o),!0),i.sort(o),!0)},t.prototype.getUnreadCountByTag=function(e,t){return _(this,void 0,void 0,(function(){var n;return m(this,(function(r){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:Y.SUCCESS,data:n}]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h,l,d;return m(this,(function(p){switch(p.label){case 0:return this._channel?(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._channel.codec.encodeUpdateConversationTag(a,[t]),h=new so(po[po.addTag],c,this.currentUserId),[4,this._channel.send(h)]):[2,{code:Y.NO_TAG_IN_CONVER}]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(l=p.sent().code)!==Y.SUCCESS?[2,{code:l}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(i,r,d,o),[2,{code:Y.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return _(this,void 0,void 0,(function(){var n,r,i,o;return m(this,(function(s){if(!this._channel)return[2,{code:Y.RC_NET_CHANNEL_INVALID}];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:Y.SUCCESS,data:i}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:Y.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:Y.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===S.ULTRA_GROUP?(null===(t=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId),Promise.resolve({code:Y.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:Y.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===S.ULTRA_GROUP)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var r;if(!(r=e===S.ULTRA_GROUP?this._ultraGroupManager.get(S.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:Y.SUCCESS,data:ee.NOT_SET});var i=r.notificationLevel;return x(r.notificationLevel)&&!x(r.notificationStatus)&&(i=Z.OPEN===r.notificationStatus?1:0),Promise.resolve({code:Y.SUCCESS,data:i})},t.prototype.getConversationNotificationStatus=function(e,t,n){var r;return(r=e===S.ULTRA_GROUP?this._ultraGroupManager.get(S.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:Y.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:Y.SUCCESS,data:Z.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 _(this,void 0,void 0,(function(){var t,n,r,i;return m(this,(function(o){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&&A(n))})),r=$o(r),i=kt(r),[2,{code:Y.SUCCESS,data:i}]):[2,{code:Y.METHOD_NOT_AVAILABLE}]}))}))},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===Z.OPEN&&t.push({conversationType:S.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:S.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:Y.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap){n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount)}return Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e){var t=0;for(var n in this._ultraGroupMap){var r=this._ultraGroupMap[n];r.targetId===e&&(t+=r.unreadMessageCount||0)}return Promise.resolve({code:Y.SUCCESS,data:t})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:Y.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:Y.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),_(this,void 0,void 0,(function(){var n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._channel?this._status!==Q.CONNECTED?[2,Y.RC_NET_UNAVAILABLE]:(n=Date.now(),r=this._channel.codec.encodeClearUnreadCount({conversationType:S.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(i=new ro(po[po.updUgRTime],r,this.currentUserId)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID]:[2,Promise.resolve(Y.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===Y.SUCCESS&&(s=this._ultraGroupMap[t+"_"+e])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.lastReadTime=n),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l,d,p,f=this;return m(this,(function(g){switch(g.label){case 0:return this._channel&&this._status===Q.CONNECTED?(!1,t=this._channel.codec.encodeUltraGroup(e,false),n=new so(po[po.pullUgSes],t,this.currentUserId),[4,this._channel.send(n,an,{currentUserId:this.currentUserId,conversationType:S.ULTRA_GROUP})]):[2];case 1:return r=g.sent(),i=r.code,o=r.data,i===Y.SUCCESS&&o?(a=(null==o?void 0:o.list)||[],u=null==o?void 0:o.isFinished,a.forEach((function(e){e.notificationStatus=Z.CLOSE,e.notificationLevel=ee.NOT_SET,e.isTop=!1,f._ultraGroupMap[e.channelId+"_"+e.targetId]=e,f._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(lt.warn("pull super conversation failed, code:",i,", data:",o,"retrying..."),s=setTimeout((function(){f._firstPullUltraGroupTime=e,f._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return[4,this.pullConversationStatus(this._firstPullUltraGroupTime)];case 3:h=g.sent(),l=h.code,d=h.data,l!==Y.SUCCESS&&lt.warn("pullConversationStatus fail code: ".concat(l,", data: ").concat(d)),p=Object.values(this._ultraGroupMap),p=$o(p),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(kt(p)),0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),g.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(),this._syncUltraMsg(0),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._syncUltraMsg=function(e){var t;return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,h,l,d,p,f,g,_=this;return m(this,(function(m){switch(m.label){case 0:return this._channel&&this._status===Q.CONNECTED?this._isUltraPulling?[2]:(lt.info("start pull ultra msg, time: ".concat(e)),this._isUltraPulling=!0,n=this._channel.codec.encodeSuperSyncMsg(e),r=new so(po[po.pullUgMsg],n,this.currentUserId),i=qe(),Je(exports.LogTagId.L_PULL_ULTRA_MSG_T,{timestamp:e},{traceId:i}),[4,this._channel.send(r,Xt,{currentUserId:this.currentUserId,conversation:{conversationType:S.ULTRA_GROUP}})]):[2];case 1:if(o=m.sent(),s=o.code,a=o.data,lt.info("end pull ultra msg, code: ".concat(s,", syncTime: ").concat(null==a?void 0:a.syncTime,", count: ").concat(null===(t=null==a?void 0:a.list)||void 0===t?void 0:t.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),s!==Y.SUCCESS||!a)return ze(exports.LogTagId.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:"",timestamp:e},{traceId:i}),lt.warn("sync super message failed, code:",s,", data:",a),this._isUltraPulling=!1,[2];if(this._isUltraPulling=!1,u=a.list,c=a.syncTime,h=a.finished,!this._isUltraGroupListExist)return lt.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=c,[2];for(g in l=[],d={},p=[],u.forEach((function(e){var t,n,r,i=e.targetId,o=e.content,s=e.messageType,a=e.messageUId,u=e.channelId,h=e.isCounted,f=e.channelType;if(l.push(a),_._ultraMsgMap[a])delete _._ultraMsgMap[a];else{var g=0;((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===ne.ALL||(null===(r=null===(n=null==o?void 0:o.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(_.currentUserId)))&&(g=1);var m=_._ultraGroupMap[u+"_"+i];if(m)h&&(s===z.RECALL?m.unreadMessageCount>0&&(m.unreadMessageCount-=1):(m.unreadMessageCount+=1,m.unreadMentionedCount+=g)),m.versionTime=c,m.latestMessage=e,m.channelType=f,d[u+"_"+i]=m,_._ultraGroupManager.addUltraGroupStatus(m);else{var T={conversationType:S.ULTRA_GROUP,targetId:i,channelId:u,unreadMessageCount:h?1:0,unreadMentionedCount:h?g:0,versionTime:c,latestMessage:e,notificationStatus:Z.CLOSE,notificationLevel:ee.NOT_SET,isTop:!1,channelType:f};_._ultraGroupMap[u+"_"+i]=T,d[u+"_"+i]=T,_._ultraGroupManager.addUltraGroupStatus(T)}p.push(e)}})),Object.keys(d).length>0&&(lt.info("notice ultragroups"),f=Object.values(d),f=$o(f),this._watcher.conversation(kt(f))),Je(exports.LogTagId.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:l.join(","),timestamp:c},{traceId:i}),lt.info("notice ultragroup message"),this._watcher.batchMessage(p),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>c})),this._ultraMsgMap)this._ultraMsgMap[g]<c&&delete this._ultraMsgMap[g];return!1===h?this._syncUltraMsg(c):u&&u.length>0&&(this._lastSyncUltraMsgTimeStamp=c),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,r){return _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,l,d,p,g;return m(this,(function(_){switch(_.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:("RC:SRSMsg"===t.messageType&&lt.warn("ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),i=this._channel.codec.encodeUpMsg({conversationType:S.ULTRA_GROUP,targetId:e},t),(o=new ro(po[po.ugMsg],i,e)).setHeaderQos(mt.AT_LEAST_ONCE),s=Date.now()-this._localConnectedTime+this._connectedTime,a=t.isPersited?ts():0,u=Zo(S.ULTRA_GROUP,e,f({},t),"",s,this.currentUserId,a),n&&n(a),Je(exports.LogTagId.L_SEND_MSG_T,{messageType:t.messageType,conversationType:S.ULTRA_GROUP,targetId:e,channelId:t.channelId},{traceId:r}),[4,this._channel.send(o)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return c=_.sent(),h=c.code,l=c.data,h!==Y.SUCCESS?(ze(exports.LogTagId.L_SEND_MSG_R,{code:h,messageUId:u.messageUId,messageId:u.messageId},{traceId:r}),[2,{code:h,data:u}]):(Je(exports.LogTagId.L_SEND_MSG_R,{code:h,messageUId:null==l?void 0:l.messageUId,messageId:null==l?void 0:l.messageId},{traceId:r}),d=l,u.sentTime=d.timestamp,u.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,p=t.channelId||"",(g=this._ultraGroupMap[p+"_"+e])?(g.latestMessage=u,A(g.channelType)&&(u.channelType=g.channelType)):(g={conversationType:S.ULTRA_GROUP,targetId:e,channelId:p,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:Z.CLOSE,notificationLevel:ee.NOT_SET,isTop:!1},this._ultraGroupMap[p+"_"+e]=g,this._ultraGroupManager.addUltraGroupStatus(g)),this._watcher.conversation(kt([g])),[2,{code:h,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(n=e.conversationType,r=e.channelId,i=e.targetId,o=this._channel.codec.encodeOperateStatus(i,n,r||"",t||0),(s=new ro(po[po.operate],o,i)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(s)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return(a=u.sent().code)!==Y.SUCCESS?[2,{code:a,msg:Y[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:Y.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._channel.codec.encodeMsgQuery(e),(r=new so(po[po.qryMsg],n,this.currentUserId)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(r,Mr,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==Y.SUCCESS?[2,{code:o,msg:Y[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._channel){var t=this._channel.codec.decodeByPBName(e.data,Ar),n=t.conversationType,r=t.info,i=t.summary;lt.info("s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new ro(po[po.upMsgEx],t,e.targetId)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==Y.SUCCESS?[2,{code:i,msg:Y[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},t.prototype.modifyMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodemodifyMessage(e,this.currentUserId),(n=new ro(po[po.modifyMsg],t,e.targetId)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==Y.SUCCESS?[2,{code:i,msg:Y[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l;return m(this,(function(d){switch(d.label){case 0:return this._channel?this._status!==Q.CONNECTED||this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._channel.codec.encodeQueryMsgChange(e),(n=new so(po[po.qryMsgChange],t,this.currentUserId)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(n,Sr)]):[2];case 1:if(r=d.sent(),i=r.code,o=r.data,this._isPullingUltraChangeMessage=!1,i!==Y.SUCCESS||!o)return[2];for(h in s=o.hasNext,a=o.list,u=(null==o?void 0:o.syncTime)||0,this._ultraChannelTypeChangeNotice(a),this._ultraChannelUserKickedNotice(a),this._ultraChannelDeleteNotice(a),this._ultraRecalledNotice(a),this._ultraMsgUpdateNotice([exports.UltraMsgChangeType.MSG_EXPANSION,exports.UltraMsgChangeType.MSG_MODIFY],a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(l=this._pullUltraChangeMessageQue).push.apply(l,c),this._ultraMsgMap)this._ultraMsgMap[h]<u&&delete this._ultraMsgMap[h];return s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]}}))}))},t.prototype._ultraChannelTypeChangeNotice=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.changeType,o=e.subChangeType,s=e.channelId,a=void 0===s?"":s;if(i===exports.UltraMsgChangeType.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(a,"_").concat(r)]){var u=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE,c=exports.UltraMsgSubChangeType.PRIVATE_TO_PUBLIC,h=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN;o===c&&(t._ultraGroupMap["".concat(a,"_").concat(r)].channelType=exports.UltraGroupChannelType.PUBLIC),o===u&&(t._ultraGroupMap["".concat(a,"_").concat(r)].channelType=exports.UltraGroupChannelType.PRIVATE);var l=t._ultraGroupMap["".concat(a,"_").concat(r)].channelType,d=void 0===l?exports.UltraGroupChannelType.PUBLIC:l;[u,c,h].includes(o)&&n.push({targetId:r,channelId:a,changeType:o,channelType:d}),o===h&&delete t._ultraGroupMap["".concat(a,"_").concat(r)]}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n)},t.prototype._ultraChannelDeleteNotice=function(e){var t=this,n=[];Array.isArray(e)&&e.forEach((function(e){var r=e.targetId,i=e.sendTime,o=e.changeType,s=e.subChangeType,a=e.channelId,u=void 0===a?"":a;if(o===exports.UltraMsgChangeType.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(u,"_").concat(r)]){var c=t._ultraGroupMap["".concat(u,"_").concat(r)].channelType,h=void 0===c?exports.UltraGroupChannelType.PUBLIC:c;s===exports.UltraMsgSubChangeType.CHANNEL_DELETE&&(n.push({targetId:r,channelId:u,channelType:h,deleteTime:i}),delete t._ultraGroupMap["".concat(u,"_").concat(r)])}})),n.length>0&&this._watcher.ultraGroupChannelDelete(n)},t.prototype._ultraChannelUserKickedNotice=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.changeType,o=e.operatorId,s=e.subChangeType,a=e.channelId,u=void 0===a?"":a;i===exports.UltraMsgChangeType.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(u,"_").concat(r)]&&(s===exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED&&n.push({targetId:r,channelId:u,userId:o,channelType:exports.UltraGroupChannelType.PRIVATE}),o===t.currentUserId&&s===exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED&&delete t._ultraGroupMap["".concat(u,"_").concat(r)])})),n.length>0&&this._watcher.ultraGroupChannelUserKicked(n)},t.prototype._ultraRecalledNotice=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.conversationType,o=e.sendTime,s=e.messageUId,a=e.changeType,u=e.operatorId,c=e.channelId,h=void 0===c?"":c;a===exports.UltraMsgChangeType.MSG_RECALL&&(t._updateUltraGroupWhenRecallMsg(r,h,s),n.push({targetId:r,conversationType:i,sendTime:o,messageUId:s,senderUserId:u,channelId:h}))})),n.length>0&&this._watcher.ultraGroupMessageRecalled(n)},t.prototype._ultraMsgUpdateNotice=function(e,t){var n=this;if(!!t.find((function(t){return e.includes(t.changeType)}))){var r={};t.forEach((function(t){var i=t.targetId,o=t.conversationType,s=t.sendTime,a=t.messageUId,u=t.changeType,c=t.channelId,h=o+"_"+i,l=a+"_"+(void 0===c?"":c)+"_"+s,d=r[h];if(d)d.add(l);else{var p=new Set([l]);r[h]=p}e.includes(u)&&(n._ultraMsgChangeMap[a]=u)}));var i=function(e){var t=e.split("_"),n=t.shift(),i=t.join("_"),s=r[e],a=[];s.forEach((function(e){var t=e.split("_"),n=t[0],r=t[1],i=t[2];a.push({sendTime:Number(i),messageUId:n,channelId:r})}));var u={targetId:i,conversationType:Number(n),messages:a};o._pullUltraMessageList(u)},o=this;for(var s in r)i(s)}},t.prototype._pullUltraMessageList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c=this;return m(this,(function(h){switch(h.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeMsgQuery(e),(n=new so(po[po.qryMsg],t,this.currentUserId)).setHeaderQos(mt.AT_LEAST_ONCE),[4,this._channel.send(n,Mr,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=h.sent(),i=r.code,o=r.data,i!==Y.SUCCESS?[2,{code:i,msg:Y[i]}]:(s=(o||{}).list,a=[],u=[],Array.isArray(s)&&s.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=c._ultraGroupMap[n+"_"+t];i&&i.latestMessage.messageUId===e.messageUId&&(i.latestMessage=e);var o=c._ultraMsgChangeMap[r+""];o===exports.UltraMsgChangeType.MSG_EXPANSION?a.push(e):o===exports.UltraMsgChangeType.MSG_MODIFY&&u.push(e)})),a.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(a||[]),u.length>0&&this._watcher.ultraGroupMessageModified(u||[]),[2])}}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:(r=this._channel.codec.encodeGetHistoryMsg(e,t),i=new so(po[po.qryUgMsg],r,this.currentUserId),Je(exports.LogTagId.L_GET_HISTORY_MSG_T,{targetId:e,conversationType:S.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count},{traceId:n}),[4,this._channel.send(i,on,{currentUserId:this.currentUserId,conversation:{conversationType:S.ULTRA_GROUP,targetId:e}})]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),s=o.code,a=o.data,s===Y.SUCCESS&&a?(u=[],a.list&&a.list.forEach((function(e){e&&u.push(e.messageUId)})),Je(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:s,messageUIds:u.join(",")},{traceId:n}),[2,{code:s,data:a}]):(ze(exports.LogTagId.L_GET_HISTORY_MSG_R,{code:s,messageUIds:""},{traceId:n}),lt.warn("get super history message failed, code:",s,", data:",a),[2,{code:s}])}}))}))},t.prototype.searchUltraGroupMessages=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(e){return this._channel?this._status!==Q.CONNECTED?[2,{code:Y.RC_NET_UNAVAILABLE}]:[2,{code:Y.SUCCESS}]:[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?(r=this._channel)?(i=r.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),o=new so(po[po.ugUnpushSet],i,e),[4,r.send(o)]):[3,2]:[2,Promise.resolve({code:Y.METHOD_NOT_AVAILABLE})];case 1:return s=u.sent(),a=s.code,Y.SUCCESS,[2,{code:a}];case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return _(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?(n=this._channel)?(r=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),i=new so(po[po.ugUnpushQuery],r,e),[4,n.send(i,cr)]):[3,2]:[2,Promise.resolve({code:Y.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===Y.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[2,{code:s}];case 2:return[2,{code:Y.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n){var r="".concat(t,"_").concat(e);if(this._ultraGroupMap[r]){var i=this._ultraGroupMap[r],o=i.latestMessage;o&&o.messageUId===n&&(i.latestMessage=null)}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:Y.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.joinRTCRoom=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s,a;return m(this,(function(u){return this._channel?(s=this._channel.codec.encodeJoinRTCRoom(t,n,r,i,o),a=new so(po[po.rtcRJoin_data],s,e),[2,this._channel.send(a,vn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return _(this,void 0,void 0,(function(){var t,n;return m(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new so(po[po.rtcRExit],t,e),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new so(po[po.rtcPing],r,e),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return _(this,void 0,void 0,(function(){var t,n;return m(this,(function(r){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new so(po[po.rtcRInfo],t,e),[2,this._channel.send(n,wn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o;return m(this,(function(s){switch(s.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new so(po[po.rtcUData],t,e),[4,this._channel.send(n,vn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return r=s.sent(),i=r.code,o=r.data,[2,{code:i,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeSetRTCUserInfo(t,n),i=new so(po[po.rtcUPut],r,e),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return _(this,void 0,void 0,(function(){var n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),r=new ro(po[po.rtcUDel],n,e),[4,this._channel.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return _(this,void 0,void 0,(function(){var s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(s=this._channel.codec.encodeSetRTCData(t,n,r,i,o),a=new ro(po[po.rtcSetData],s,e),[4,this._channel.send(a)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,r,i),s=new so(po[po.userSetData],o,e),[4,this._channel.send(s)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeUserSetRTCCDNUris(t,n),i=new so(po[po.userSetData],r,e),[4,this._channel.send(i)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,r){if(!this._channel)return Promise.resolve({code:Y.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),o=new so(po[po.rtcQryData],i,e);return this._channel.send(o,Mn)},t.prototype.removeRTCData=function(e,t,n,r,i){return _(this,void 0,void 0,(function(){var o,s;return m(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,r,i),s=new ro(po[po.rtcDelData],o,e),[4,this._channel.send(s)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,r){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,t){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new so(po[po.rtcToken],r,e),[2,this._channel.send(i,On)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return _(this,void 0,void 0,(function(){var n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),r=new so(po[po.rtcUserState],n,e),[4,this._channel.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:Y.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new so(po[po.rtcUList],t,e);return this._channel.send(n,vn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=exports.RTCMode.LIVE),_(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new so(po[po.viewerJoinR],r,e),[4,this._channel.send(i,Gr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,a=o.data,s!==Y.SUCCESS?[2,{code:s}]:(c=(u=a).rtcToken,h=u.entries,[2,{code:s,data:{token:c,kvEntries:h}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new so(po[po.viewerExitR],t,e),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return _(this,void 0,void 0,(function(){var r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return this._channel?(r=this._channel.codec.encodeIdentityChangeInfo(t,n),i=new so(po[po.rtcIdentityChange],r,e),[4,this._channel.send(i,vn)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return o=u.sent(),s=o.code,a=o.data,s!==Y.SUCCESS?[2,{code:s}]:[2,{code:s,data:a}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(lt.info("audience in room start pull KV"),i=n.codec.encodePullRTCRoomKV(e,0),o=new so(po[po.rtcPullKv],i,r),[4,n.send(o,Dr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),a=s.code,u=s.data,lt.info("audience in room end pull KV, code: ".concat(a,", data: ").concat(JSON.stringify(u||{}))),a===Y.SUCCESS?(c=u.kvEntries,this._watcher.onRTCDataChange(c,e),[2,{code:a,data:u}]):[2,{code:a}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u;return m(this,(function(c){switch(c.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeQueryUserJoinedInfo(e),o=new so(po[po.rtcQueryJoined],i,r),[4,n.send(o,Vr)]):[2,{code:Y.RC_NET_CHANNEL_INVALID}];case 1:return s=c.sent(),a=s.code,u=s.data,a===Y.SUCCESS?[2,{code:a,data:u}]:[2,{code:a}]}}))}))},t.prototype.getDeviceId=function(){return tt(this.runtime)},t.prototype.requestRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new so(po[po.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.cancelRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new so(po[po.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.responseRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new so(po[po.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.endRoomPK=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new so(po[po.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i;return m(this,(function(o){switch(o.label){case 0:return this._channel?(t=e.chatRoomId,n=this._channel.codec.encodebindRTCRoomForChatroom(e),r=new so(po[po.setRtcRoomId],n,t),[4,this._channel.send(r)]):[2,Y.RC_NET_CHANNEL_INVALID];case 1:return i=o.sent(),[2,i.code]}}))}))},t.prototype.callExtra=function(e){return Promise.resolve({code:Y.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){throw new Error("Method not implemented.")},t.prototype.removeFromBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},t.prototype.getBlacklistStatus=function(e){throw new Error("Method not implemented.")},t.prototype.insertMessage=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}(Eo),rs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},t.prototype.joinRTCRoom=function(e,t,n,r,i,o){return this._context.joinRTCRoom(e,t,n,r,i,o)},t.prototype.quitRTCRoom=function(e){return this._context.quitRTCRoom(e)},t.prototype.rtcPing=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return this._context.getRTCRoomInfo(e)},t.prototype.getRTCUserInfoList=function(e){return this._context.getRTCUserInfoList(e)},t.prototype.getRTCUserInfo=function(e){return this._context.getRTCUserInfo(e)},t.prototype.setRTCUserInfo=function(e,t,n){return this._context.setRTCUserInfo(e,t,n)},t.prototype.removeRTCUserInfo=function(e,t){return this._context.removeRTCUserInfo(e,t)},t.prototype.setRTCData=function(e,t,n,r,i,o){return this._context.setRTCData(e,t,n,r,i,o)},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)},t.prototype.setRTCCDNUris=function(e,t,n){return this._context.setRTCCDNUris(e,t,n)},t.prototype.getRTCData=function(e,t,n,r){return this._context.getRTCData(e,t,n,r)},t.prototype.removeRTCData=function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)},t.prototype.setRTCOutData=function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)},t.prototype.getRTCOutData=function(e,t){return this._context.getRTCOutData(e,t)},t.prototype.getRTCToken=function(e,t,n){return this._context.getRTCToken(e,t,n)},t.prototype.setRTCState=function(e,t){return this._context.setRTCState(e,t)},t.prototype.getRTCUserList=function(e){return this._context.getRTCUserList(e)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)},t.prototype.quitLivingRoomAsAudience=function(e){return this._context.quitLivingRoomAsAudience(e)},t.prototype.rtcIdentityChange=function(e,t,n){return this._context.rtcIdentityChange(e,t,n)},t.prototype.requestRoomPK=function(e){return this._context.requestRoomPK(e)},t.prototype.cancelRoomPK=function(e){return this._context.cancelRoomPK(e)},t.prototype.responseRoomPK=function(e){return this._context.responseRoomPK(e)},t.prototype.endRoomPK=function(e){return this._context.endRoomPK(e)},t}(Io);function is(e){return Object.assign({},e)}var os,ss=function(){function e(e,t){var n;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.4.5",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=Q.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend: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,ultraGroupChannelChangeType:void 0,ultraGroupChannelUserKicked:void 0,ultraGroupChannelDelete:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},t),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this.apiPKGName=this._options.apiPKGName||"",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&&(n=this._options.navigators).push.apply(n,r),Ki({bundleId:this.apiPKGName}),function(e){Qe=it.init(f(f({},e),{sessionId:be})),ct()}({runtime:this._runtime,logSwitch:1,logPolicy:JSON.parse("{}"),appkey:this.appkey,version:this.apiVersion});var i={status:this._connectionStatusListener.bind(this),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),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this)};this._engine=xt()?new RCCppEngine(e,i,this._options):new ns(e,i,this._options)}return e.init=function(t,n){return Ye({customLogPrint:n.logStdout,localLogLevel:n.logLevel}),lt.setLogLevel(n.logLevel),lt.setLogStdout(n.logStdout),Je(exports.LogTagId.L_INIT_O,{appkey:n.appkey,navigators:n.navigators,connectionType:n.connectionType,logLevel:n.logLevel,typingExpireTime:n.typingExpireTime}),!1===n.indexDBSwitch&&(Ae.indexDBSwitch=!1),Je(exports.LogTagId.L_IMSDK_VER_O,{commitId:"743dac7564a1dc4799700283055aea09927fa98b",version:"5.4.5"}),lt.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(lt.error("Repeat initialize!"),this._context):(lt.warn("RCEngine Commit:","743dac7564a1dc4799700283055aea09927fa98b"),this._context=new e(t,n),this._context)},e.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},e.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return lt.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new rs(this):new Io(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){lt.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),r&&this._pluginContextQueue.push(n),r&&(this._pluginInstanseMap[e.tag]=r),r},e.prototype._handleRedirect=function(){return _(this,void 0,void 0,(function(){var e,t=this;return m(this,(function(n){switch(n.label){case 0:return lt.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return(e=n.sent().code)!==Y.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(e),setTimeout((function(){t._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return _(this,void 0,void 0,(function(){return m(this,(function(n){return Je(exports.LogTagId.L_CONNECT_S,{status:e}),[Q.REDIRECT,Q.BLOCKED,Q.KICKED_OFFLINE_BY_OTHER_CLIENT,Q.DISCONNECT_BY_SERVER,Q.DISCONNECTED,Q.NETWORK_UNAVAILABLE].includes(e)&&(qi(lo.IM_CONNECTION_DURATION,{endTime:(new Date).getTime(),code:e}),function(e){_(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c;return m(this,(function(h){switch(h.label){case 0:t=lo.IM_CONNECTION_DURATION,n=Hi().bundleId,r=Yi(t),i=r.startTime,o=r.endTime,s=r.code,a=exports.NetworkType.UNKONWN,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return a=h.sent(),[3,4];case 3:return u=h.sent(),lt.debug(u.message),[3,4];case 4:return c=0,A(i)&&A(o)&&o>i&&i&&(c=o-i),Vi(t,{bid:n,cod:s,dur:c,net:a}),[2]}}))}))}(this._runtime)),this._connectionStatus=e,e===Q.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(e),this._handleRedirect()):e===Q.BLOCKED||e===Q.KICKED_OFFLINE_BY_OTHER_CLIENT||e===Q.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(e)):e===Q.CONNECTING?this._handleConnecting():e===Q.CONNECTED?this._handleConnected():e===Q.DISCONNECTED?this._handleDisconnect(e):e===Q.NETWORK_UNAVAILABLE&&this._handleSuspend(e),(null===(t=this._watcher.rtcInnerWatcher)||void 0===t?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach((function(t){t.onconnectionstatechange&&t.onconnectionstatechange(e)})),this._watcher.connectionState&&this._watcher.connectionState(e),[2]}))}))},e.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},e.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},e.prototype._handleDisconnect=function(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)},e.prototype._handleSuspend=function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)},e.prototype._messageReceiver=function(e,t,n){var r,i,o;if((e.conversationType===S.RTC_ROOM||Object.prototype.hasOwnProperty.call(Ne,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(is(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==z.TYPING_STATUS||(this._addTypingInfo(is(e)),!this._watcher.typingState))if(e.messageType!==z.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==z.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(is(e))}catch(e){return lt.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message(is(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var s=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic,a=this._engine.getCurrentUserId();s&&Array.isArray(s[a])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,s[a])}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else{var u={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===S.ULTRA_GROUP){var c=e.content.sourceType;if(u.sourceType=c,(c===exports.MessageBlockSourceType.MSG_EXPANSION||c===exports.MessageBlockSourceType.MSG_MODIFY)&&e.content.sourceContent)try{u.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){ze(exports.LogTagId.L_CALLBACK_E,{source:"message.content.sourceContent",msg:e.message})}}this._MessageBlockedListener(u)}else{var h=e.content,l=h.startTime,d=h.endTime,p=h.platform,f=h.logId,g=h.uri,_=h.packageName,m={startTime:parseInt(l),endTime:parseInt(d),platform:p,logId:f,uri:g,packageName:_};null===(i=it.getInstance())||void 0===i||i.reportFullLog(m)}}else 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}})}}else this._watcher.chatroomState({userChange:{users:(r={},r[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?de.QUIT:de.JOIN,r),chatroomId:e.targetId}})},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._watcher.batchMessage(i)},e.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},e.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},e.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},e.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},e.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},e.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},e.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},e.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},e.prototype._ultraGroupEnableListener=function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)},e.prototype._operateStatusListener=function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)},e.prototype._ultraGroupMessageModifiedListener=function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)},e.prototype._ultraGroupMessageRecalledListener=function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){this._watcher.ultraGroupChannelChangeType&&this._watcher.ultraGroupChannelChangeType(e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){this._watcher.ultraGroupChannelUserKicked&&this._watcher.ultraGroupChannelUserKicked(e)},e.prototype._ultraGroupChannelDeleteListener=function(e){this._watcher.ultraGroupChannelDelete&&this._watcher.ultraGroupChannelDelete(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))},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]=D(r)||P(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]}if(e._typingChangedList.length>0){var r=e._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));e._typingStatusListener(r),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))},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._connectionStatus},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.connect=function(e,t,n,r){return void 0===t&&(t=!1),_(this,void 0,void 0,(function(){var i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return this._connectionStatus===Q.CONNECTED?[2,{code:Y.SUCCESS,userId:this._engine.getCurrentUserId()}]:this._connectionStatus===Q.CONNECTING?[2,{code:Y.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:Y.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,i=e.split("@"),o=i[1],s=o?o.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],Je(exports.LogTagId.L_GET_NAVI_T,{token:e,uris:s},{traceId:r}),[4,this._engine.getNaviInfo(this._getTokenWithoutNavi(),s,t,this._options.checkCA)]);case 1:return(a=l.sent())?(Je(exports.LogTagId.L_GET_NAVI_R,{code:Y.SUCCESS,naviInfo:a},{traceId:r}),Je(exports.LogTagId.L_ENV_S,{isEnterprise:1===(null==a?void 0:a.type)},{traceId:r}),1===(null==a?void 0:a.type)?[2,{code:Y.PACKAGE_ENVIRONMENT_ERROR}]:(u=_t.getInfo(),Je(exports.LogTagId.L_CONNECT_T,{token:e,refreshNavi:t,reconnectKickEnable:n},{traceId:r}),[4,this._engine.connect(this._getTokenWithoutNavi(),a,n,r)])):(ze(exports.LogTagId.L_GET_NAVI_R,{code:Y.RC_NAVI_RESOURCE_ERROR},{traceId:r}),[2,{code:Y.RC_NAVI_RESOURCE_ERROR}]);case 2:return c=l.sent(),(c===Y.SUCCESS?Je:ze)(exports.LogTagId.L_CONNECT_R,{code:c,userId:this._engine.getCurrentUserId()},{traceId:r}),c!==W.REDIRECT?[3,4]:(this._connectionStatus=Q.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,l.sent()];case 4:return h=this._engine.getCurrentUserId(),c===Y.SUCCESS&&(qi(lo.IM_CONNECTION_DURATION,{startTime:(new Date).getTime()},!0),lt.info("connect success, userId: ".concat(h)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),at({runtime:this._runtime,logSwitch:(null==a?void 0:a.logSwitch)||0,logPolicy:JSON.parse((null==a?void 0:a.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:h}),Ye({userId:h}),this._isInternalConnected=!0),c!==Y.SUCCESS||xt()||1===a.openUS&&this._pullUserSettings(),c!==Y.SUCCESS&&(this._connectionStatus=Q.CONNECTION_CLOSED),[2,{code:c,userId:h}]}}))}))},e.prototype._pullUserSettings=function(){return _(this,void 0,void 0,(function(){return m(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=it.getInstance())||void 0===e||e.distroy(),Ye({userId:""}),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){lt.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(e){return this._isInternalConnected?Promise.resolve({code:Y.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i=!1),this._engine.registerMessageType(e,t,n,r,i)},e.prototype.sendMessage=function(e,t,n,r,i){if(e!==S.ULTRA_GROUP){var o=this.getInfoFromCache();if(1===((null==o?void 0:o.grpRRVer)||0)&&n.messageType===z.READ_RECEIPT_RESPONSE)return Promise.resolve({code:Y.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,u=n.expansion;if(a){var c=F(u),h=c.isIllgalEx,l=c.isExKeyOrValLengthExceedLimit;if(c.isExceedLimit||l)return Promise.resolve({code:Y.EXPANSION_LIMIT_EXCEET});if(h)return Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})}var d=JSON.stringify(n.content);return I(d)>131072?Promise.resolve({code:Y.RC_MSG_CONTENT_EXCEED_LIMIT}):e===S.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,r,i):this._engine.sendMessage(e,t,n,r,i)},e.prototype.sendExpansionMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,h,l;return m(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=F(s),c=u.isIllgalEx,h=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||h?[2,Promise.resolve({code:Y.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})]:(l={mid:i},s&&(l.put=s),o&&(l.del=o),a&&(l.removeAll=1),[4,this._engine.sendMessage(n,r,{content:l,messageType:z.EXPANSION_NOTIFY,channelId:t})])):[2,{code:Y.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return _(this,void 0,void 0,(function(){var r;return m(this,(function(i){return r=this.getInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:Y.READ_RECEIPT_ERROR,data:"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 _(this,void 0,void 0,(function(){var r;return m(this,(function(i){return r=this.getInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:Y.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){lt.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=it.getInstance())||void 0===e||e.distroy(),Ye({userId:""})},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===S.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===S.ULTRA_GROUP){var o=Y.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:Y[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===S.ULTRA_GROUP?Promise.resolve(Y.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===S.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(S.ULTRA_GROUP)){var r=Y.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:Y[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[S.PRIVATE,S.GROUP,S.SYSTEM,S.PUBLIC_SERVICE],!!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=""),_(this,void 0,void 0,(function(){var i;return m(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===S.ULTRA_GROUP&&void 0!==n)return Promise.resolve(Y.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===S.ULTRA_GROUP?Promise.resolve(Y.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 Ut(n)&&At(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(Y.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(!Ut(i)||!At(o))return Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})}var s=f(f({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return Ut(n)&&At(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(Y.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return Ut(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(Y.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(!Ut(r))return Promise.resolve({code:Y.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return Ut(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(Y.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 _(this,void 0,void 0,(function(){var i,o,s,a,u,c,h;return m(this,(function(l){switch(l.label){case 0:return i=this.getInfoFromCache(),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=l.sent(),c=u.code,h=u.data,c===Y.SUCCESS&&h?[2,Promise.resolve(Object.assign(h,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(c)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r,i){return void 0===i&&(i=ie.QINIU),_(this,void 0,void 0,(function(){var o,s,a;return m(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===Y.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return _(this,void 0,void 0,(function(){return m(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return t.length>1e3?[2,Promise.reject(Y.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return _(this,void 0,void 0,(function(){return m(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},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!==S.ULTRA_GROUP){var t=Y.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:Y[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return _(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:return e.channelId,t=e.conversationType,e.targetId,e.messageUId,e.keys,n=e.expansion,e.removeAll,r=e.canIncludeExpansion,t!==S.ULTRA_GROUP?[2,{code:i=Y.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:Y[i]}]:r?(o=F(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:Y.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:Y.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:Y.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return _(this,void 0,void 0,(function(){var t;return m(this,(function(n){switch(n.label){case 0:return e.conversationType!==S.ULTRA_GROUP?[2,{code:t=Y.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:Y[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e){return this._engine.getUltraGroupUnreadCountByTargetId(e)},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.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,T([e],n,!1))},e.prototype.clearConversations=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){switch(n.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){lt.error(e)}}))},e.prototype.addToBlacklist=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return _(this,void 0,void 0,(function(){return m(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),_(this,void 0,void 0,(function(){return m(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=""),_(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return _(this,void 0,void 0,(function(){return m(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return _(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,r){return _(this,void 0,void 0,(function(){return m(this,(function(i){return[2,this._engine.updateMessageReceiptStatus(e,t,n,r)]}))}))},e.prototype.setUserStatus=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return _(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return _(this,void 0,void 0,(function(){return m(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=""),_(this,void 0,void 0,(function(){return m(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),_(this,void 0,void 0,(function(){return m(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=""),_(this,void 0,void 0,(function(){return m(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 _(this,void 0,void 0,(function(){return m(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 _(this,void 0,void 0,(function(){return m(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 _(this,void 0,void 0,(function(){return m(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.joinRTCRoom=function(e,t,n,r,i,o){return this._engine.joinRTCRoom(e,t,n,r,i,o)},e.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},e.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},e.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},e.prototype.setRTCUserInfo=function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)},e.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},e.prototype.setRTCData=function(e,t,n,r,i,o){return this._engine.setRTCData(e,t,n,r,i,o)},e.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),this._engine.setRTCTotalRes(e,t,n,r,i)},e.prototype.setRTCCDNUris=function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)},e.prototype.getRTCData=function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)},e.prototype.removeRTCData=function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)},e.prototype.setRTCOutData=function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)},e.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},e.prototype.getRTCToken=function(e,t,n){return this._engine.getRTCToken(e,t,n)},e.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},e.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},e.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)},e.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},e.prototype.rtcIdentityChange=function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)},e.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},e.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},e.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},e.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},e.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e}();exports.TagChangeType=void 0,(os=exports.TagChangeType||(exports.TagChangeType={}))[os.add=1]="add",os[os.update=2]="update",os[os.delete=3]="delete";exports.AEngine=Eo,exports.APIContext=ss,exports.AppStorage=l,exports.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},exports.CallLibMsgType=Ne,exports.ChatroomEntryType=ce,exports.ChatroomUserChangeType=de,exports.CometChannel=To,exports.ConnectResultCode=W,exports.ConnectionStatus=Q,exports.ConversationType=S,exports.DB_LOG_FLUSH_FREQUENCY=3e3,exports.DB_LOG_MAX_SIZE=1e5,exports.DelayTimer=Ft,exports.ErrorCode=Y,exports.EventEmitter=dt,exports.FileType=O,exports.IM_CHATROOM_PULL_INTERVAL_TIME=18e4,exports.IM_COMET_PULLMSG_TIMEOUT=45e3,exports.IM_PING_INTERVAL_TIME=15e3,exports.IM_PING_MIN_TIMEOUT=2e3,exports.IM_PING_TIMEOUT=15e3,exports.IM_SIGNAL_TIMEOUT=3e4,exports.Logger=ht,exports.MAX_MESSAGE_CONTENT_BYTES=131072,exports.MAX_MESSAGE_EXPANSION_KEY_LENGTH=32,exports.MAX_MESSAGE_EXPANSION_VAL_LENGTH=4096,exports.MINI_COMET_CONNECT_URIS=o,exports.MINI_SOCKET_CONNECT_URIS=i,exports.MentionedType=ne,exports.MessageBlockType=fe,exports.MessageDirection=H,exports.MessageType=z,exports.NAVI_CACHE_DURATION=72e5,exports.NAVI_REQ_TIMEOUT=1e4,exports.NotificationLevel=ee,exports.NotificationStatus=Z,exports.ONE_LOG_SIZE_MAX=1e3,exports.OperateStatus=Ie,exports.PING_REQ_TIMEOUT=5e3,exports.PUBLIC_CLOUD_NAVI_URIS=r,exports.PluginContext=Io,exports.RCAssertError=Ct,exports.REAT_TIME_LOG_SIZE=500,exports.RTCPluginContext=rs,exports.ReceivedStatus=n,exports.SEND_MESSAGE_TYPE_OPTION=s,exports.STATUS_MESSAGE=a,exports.STORAGE_ROOT_KEY="RCV4-",exports.UploadMethod=ie,exports.VersionManage=_t,exports.WEB_SOCKET_TIMEOUT=5e3,exports.WebSocketChannel=mo,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),!Rt(e,t,n,r))throw new Ct("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},exports.clone=kt,exports.cloneByJSON=Dt,exports.engineLogger=lt,exports.forEach=Lt,exports.formatConnectResponseCode=Vt,exports.getBrowser=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"}},exports.getMimeKey=function(e){var t="application/octet-stream";switch(e){case O.IMAGE:t="image/jpeg";break;case O.AUDIO:t="audio/amr";break;case O.VIDEO:t="video/3gpp";break;case O.SIGHT:t="video/mpeg4";break;case O.COMBINE_HTML:t="text/html"}return t},exports.getUUID=Le,exports.getUUID22=we,exports.getUploadFileName=Nt,exports.indexOf=bt,exports.isArray=L,exports.isArrayBuffer=w,exports.isBoolean=U,exports.isFunction=D,exports.isHttpUrl=function(e){return M(e)&&/https?:\/\//.test(e)},exports.isInObject=Pt,exports.isInclude=function(e,t){return-1!==bt(e,t)},exports.isNull=V,exports.isNumber=A,exports.isObject=P,exports.isString=M,exports.isUndefined=x,exports.isValidChannelId=B,exports.isValidChrmEntryKey=Ut,exports.isValidChrmEntryValue=At,exports.isValidConversationType=k,exports.isValidExpansion=F,exports.isValidFileType=function(e){return A(e)&&Object.prototype.hasOwnProperty.call(O,e)},exports.logger=$e,exports.map=wt,exports.notEmptyArray=function(e){return L(e)&&e.length>0},exports.notEmptyObject=G,exports.notEmptyString=b,exports.pushConfigsToJSON=Ot,exports.pushJSONToConfigs=Mt,exports.randomNum=function(e,t){return e+Math.floor(Math.random()*(t-e))},exports.todo=function(e){return new v(e)},exports.usingCppEngine=xt,exports.validate=Rt,exports.version="5.4.5";