function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var r=function(t,r){if("object"!==e(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r);if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return t+""}(t,"string");return"symbol"===e(r)?r:r+""}function r(e,r,n){return(r=t(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,r){for(var n=0;r.length>n;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function i(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var s={EVENT:{}};s.EVENT.NET_CHANGED="net_changed",s.EVENT.CONVERSATION_LIST_CHANGED="conversation_list_changed",s.EVENT.MESSAGE_RECEIVED="message_received",s.EVENT.MESSAGE_REVOKED="message_revoked",s.EVENT.PRIVATE_READ_RECEIPT="private_read_receipt",s.EVENT.FRIEND_LIST_CHANGED="friend_list_changed",s.EVENT.FRIEND_APPLY_LIST_CHANGED="friend_apply_list_changed",s.EVENT.FRIEND_APPLY_REFUSE="friend_apply_refuse",s.EVENT.KICKED_OUT="kicked_out",s.CONVERSATION_TYPE={},s.CONVERSATION_TYPE.PRIVATE="private",s.CONVERSATION_TYPE.GROUP="group",s.MESSAGE_TYPE={},s.MESSAGE_TYPE.TEXT="text",s.MESSAGE_TYPE.TEXT_AT="text_at",s.MESSAGE_TYPE.IMAGE="image",s.MESSAGE_TYPE.AUDIO="audio",s.MESSAGE_TYPE.VIDEO="video",s.MESSAGE_TYPE.LOCATION="location",s.MESSAGE_TYPE.CUSTOM="custom",s.MESSAGE_TYPE.MERGER="merger",s.MESSAGE_TYPE.FORWARD="forward",s.MESSAGE_TYPE.SYS_NOTICE="sys_notice",s.MESSAGE_TYPE.GROUP_SYS_NOTICE="group_sys_notice",s.USER={},s.USER.ADDFRIEND={},s.USER.ADDFRIEND.ALLOW=1,s.USER.ADDFRIEND.CONFIRM=2,s.USER.ADDFRIEND.DENY=3,s.GROUP={},s.GROUP.JOINMODE={},s.GROUP.JOINMODE.FREE=1,s.GROUP.JOINMODE.CHECK=2,s.GROUP.JOINMODE.FORBIDDEN=3,s.GROUP.APPLYSTATUS={},s.GROUP.APPLYSTATUS.PENDING=1,s.GROUP.APPLYSTATUS.AGREE=2,s.GROUP.APPLYSTATUS.REFUSE=3;var a={NORMAL_SUCCESS:{code:200,describe:"接口调用成功"},APPLY_NEED:{code:20020,describe:"好友申请已发送,请等待对方处理"},NORMAL_ERROR:{code:500,describe:"未知错误"},SDK_PARAMS_ERROR:{code:9001,describe:"YeIMUniSDK 初始化失败,请检查参数是否存在异常"},CONNECT_ERROR:{code:10001,describe:"聊天服务网络连接错误"},NO_USERID:{code:10002,describe:"用户验证失败,请检查userId、token"},LOGIN_EXPIRE:{code:10003,describe:"用户登录状态过期,请重新登录"},NO_CONVERSATION:{code:10004,describe:"未找到此会话"},PARAMS_ERROR:{code:10008,describe:"请求参数错误"},LOGIN_ERROR:{code:10103,describe:"用户登录失败,请稍后再试"},GROUP_APPLY_REPEAT:{code:10251,describe:"此用户已在当前群组,请勿重复加入"},GROUP_APPLY_ERROR:{code:10252,describe:"申请入群异常,请稍后重试"},GROUP_APPLY_WAIT:{code:10253,describe:"已发送入群申请,请等待审核"},UPLOAD_ERROR:{code:10300,describe:"本地上传失败,请检查配置"},DOWNLOAD_ERROR:{code:10301,describe:"文件下载失败"},COS_UPLOAD_ERROR:{code:10302,describe:"腾讯云COS上传文件失败,请检查配置是否填写正确"},COS_DOWNLOAD_ERROR_1:{code:10303,describe:"腾讯云媒体截图接口:下载视频缩略图失败,请检查网络或开启万象功能"},OSS_UPLOAD_ERROR:{code:10304,describe:"阿里云OSS上传文件失败,请检查配置是否填写正确"}};function c(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0==de.defaults.logLevel)r?console.error("【YeIMUniSDK Log】",t):console.log("【YeIMUniSDK Log】",t);else{if(2==de.defaults.logLevel)return;1==e&&(r?console.error("【YeIMUniSDK Log】",t):console.log("【YeIMUniSDK Log】",t))}}var d=function(){function e(t){var o=this;n(this,e),r(this,"socketTask",void 0),r(this,"onMessageCallBack",[]),de.uni?this.socketTask=uni.connectSocket({url:t,success:function(){},fail:function(){},complete:function(){}}):(this.socketTask=new WebSocket(t),this.socketTask.onmessage=function(e){if(o.onMessageCallBack)for(var t=0;o.onMessageCallBack.length>t;t++)o.onMessageCallBack[t](e)})}return i(e,[{key:"onOpen",value:function(e){try{de.uni?this.socketTask.onOpen(e):this.socketTask.onopen=e}catch(e){c(0,e,!0)}}},{key:"onClose",value:function(e){try{de.uni?this.socketTask.onClose(e):this.socketTask.onclose=e}catch(e){c(0,e,!0)}}},{key:"onError",value:function(e){try{de.uni?this.socketTask.onError(e):this.socketTask.onerror=e}catch(e){c(0,e,!0)}}},{key:"onMessage",value:function(e){try{de.uni?this.socketTask.onMessage(e):this.onMessageCallBack.push(e)}catch(e){c(0,e,!0)}}},{key:"send",value:function(e){if(this.socketTask)try{this.socketTask.send(de.uni?{data:JSON.stringify(e)}:JSON.stringify(e))}catch(e){c(0,e,!0)}}},{key:"close",value:function(){try{this.socketTask.close()}catch(e){c(0,e,!0)}}},{key:"destroy",value:function(){this.socketTask=void 0}}]),e}();function u(){return{code:arguments.length>0&&void 0!==arguments[0]?arguments[0]:200,message:arguments.length>1?arguments[1]:void 0,data:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null}}function l(){return{code:arguments.length>0&&void 0!==arguments[0]?arguments[0]:500,message:arguments.length>1?arguments[1]:void 0,data:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null}}function f(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;try{null!=e&&void 0!==e.success&&"function"==typeof e.success&&e.success(u(n,t,r))}catch(e){console.error(e)}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;try{null!=e&&void 0!==e.fail&&"function"==typeof e.fail&&e.fail(l(t,r,n))}catch(e){console.error(e)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var p={};({get exports(){return p},set exports(e){p=e}}).exports=function(e){return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var n=e.get(t);n&&n.slice().map((function(e){e(r)})),(n=e.get("*"))&&n.slice().map((function(e){e(t,r)}))}}};var R=p;function g(e,t){de.emitter.emit(de.defaults.eventPrefix+e,t)}function y(e,t){e&&de.emitter.on(de.defaults.eventPrefix+e,t)}function E(e,t){e&&de.emitter.off(de.defaults.eventPrefix+e,t)}function m(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){m(i,n,o,s,a,"next",e)}function a(e){m(i,n,o,s,a,"throw",e)}s(void 0)}))}}var b={},_={get exports(){return b},set exports(e){b=e}},I={};!function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}({get exports(){return I},set exports(e){I=e}}),function(e){var t=I.default;function r(){ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ e.exports=r=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var n={},o=Object.prototype,i=o.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",d=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function f(e,t,r,n){var o=Object.create((t&&t.prototype instanceof R?t:R).prototype),i=new L(n||[]);return s(o,"_invoke",{value:O(e,r,i)}),o}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}n.wrap=f;var p={};function R(){}function g(){}function y(){}var E={};l(E,c,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(T([])));v&&v!==o&&i.call(v,c)&&(E=v);var b=y.prototype=R.prototype=Object.create(E);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,r){function n(o,s,a,c){var d=h(e[o],e,s);if("throw"!==d.type){var u=d.arg,l=u.value;return l&&"object"==t(l)&&i.call(l,"__await")?r.resolve(l.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):r.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,c)}))}c(d.arg)}var o;s(this,"_invoke",{value:function(e,t){function i(){return new r((function(r,o){n(e,t,r,o)}))}return o=o?o.then(i,i):i()}})}function O(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return N()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=S(s,r);if(a){if(a===p)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=h(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function S(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=h(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function T(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r=0;--n){var o=this.tryEntries[n],s=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var a=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(a&&c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(a){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(this.prev>=n.tryLoc&&i.call(n,"finallyLoc")&&n.finallyLoc>this.prev){var o=n;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(_);var O=b(),S=O;try{regeneratorRuntime=O}catch(t){"object"===("undefined"==typeof globalThis?"undefined":e(globalThis))?globalThis.regeneratorRuntime=O:Function("r","regeneratorRuntime = r")(O)}var A=function(e,t){return e<>>32-t},P=function(e,t){var r,n,o,i,s;return o=2147483648&e,i=2147483648&t,s=(1073741823&e)+(1073741823&t),(r=1073741824&e)&(n=1073741824&t)?2147483648^s^o^i:r|n?1073741824&s?3221225472^s^o^i:1073741824^s^o^i:s^o^i},L=function(e,t,r,n,o,i,s){return e=P(e,P(P(function(e,t,r){return e&t|~e&r}(t,r,n),o),s)),P(A(e,i),t)},T=function(e,t,r,n,o,i,s){return e=P(e,P(P(function(e,t,r){return e&r|t&~r}(t,r,n),o),s)),P(A(e,i),t)},N=function(e,t,r,n,o,i,s){return e=P(e,P(P(function(e,t,r){return e^t^r}(t,r,n),o),s)),P(A(e,i),t)},M=function(e,t,r,n,o,i,s){return e=P(e,P(P(function(e,t,r){return t^(e|~r)}(t,r,n),o),s)),P(A(e,i),t)},U=function(e){for(var t,r=e.length,n=r+8,o=16*((n-n%64)/64+1),i=Array(o-1),s=0,a=0;r>a;)s=a%4*8,i[t=(a-a%4)/4]=i[t]|e.charCodeAt(a)<>>29,i},C=function(e){var t,r="",n="";for(t=0;3>=t;t++)r+=(n="0"+(e>>>8*t&255).toString(16)).substr(n.length-2,2);return r},k=function(e){e=e.replace(/\x0d\x0a/g,"\n");for(var t="",r=0;e.length>r;r++){var n=e.charCodeAt(r);128>n?t+=String.fromCharCode(n):n>127&&2048>n?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t};function w(e){var t,r,n,o,i,s,a,c,d,u;for(e=k(e+=""),t=U(e),a=1732584193,c=4023233417,d=2562383102,u=271733878,r=0;t.length>r;r+=16)n=a,o=c,i=d,s=u,a=L(a,c,d,u,t[r+0],7,3614090360),u=L(u,a,c,d,t[r+1],12,3905402710),d=L(d,u,a,c,t[r+2],17,606105819),c=L(c,d,u,a,t[r+3],22,3250441966),a=L(a,c,d,u,t[r+4],7,4118548399),u=L(u,a,c,d,t[r+5],12,1200080426),d=L(d,u,a,c,t[r+6],17,2821735955),c=L(c,d,u,a,t[r+7],22,4249261313),a=L(a,c,d,u,t[r+8],7,1770035416),u=L(u,a,c,d,t[r+9],12,2336552879),d=L(d,u,a,c,t[r+10],17,4294925233),c=L(c,d,u,a,t[r+11],22,2304563134),a=L(a,c,d,u,t[r+12],7,1804603682),u=L(u,a,c,d,t[r+13],12,4254626195),d=L(d,u,a,c,t[r+14],17,2792965006),c=L(c,d,u,a,t[r+15],22,1236535329),a=T(a,c,d,u,t[r+1],5,4129170786),u=T(u,a,c,d,t[r+6],9,3225465664),d=T(d,u,a,c,t[r+11],14,643717713),c=T(c,d,u,a,t[r+0],20,3921069994),a=T(a,c,d,u,t[r+5],5,3593408605),u=T(u,a,c,d,t[r+10],9,38016083),d=T(d,u,a,c,t[r+15],14,3634488961),c=T(c,d,u,a,t[r+4],20,3889429448),a=T(a,c,d,u,t[r+9],5,568446438),u=T(u,a,c,d,t[r+14],9,3275163606),d=T(d,u,a,c,t[r+3],14,4107603335),c=T(c,d,u,a,t[r+8],20,1163531501),a=T(a,c,d,u,t[r+13],5,2850285829),u=T(u,a,c,d,t[r+2],9,4243563512),d=T(d,u,a,c,t[r+7],14,1735328473),c=T(c,d,u,a,t[r+12],20,2368359562),a=N(a,c,d,u,t[r+5],4,4294588738),u=N(u,a,c,d,t[r+8],11,2272392833),d=N(d,u,a,c,t[r+11],16,1839030562),c=N(c,d,u,a,t[r+14],23,4259657740),a=N(a,c,d,u,t[r+1],4,2763975236),u=N(u,a,c,d,t[r+4],11,1272893353),d=N(d,u,a,c,t[r+7],16,4139469664),c=N(c,d,u,a,t[r+10],23,3200236656),a=N(a,c,d,u,t[r+13],4,681279174),u=N(u,a,c,d,t[r+0],11,3936430074),d=N(d,u,a,c,t[r+3],16,3572445317),c=N(c,d,u,a,t[r+6],23,76029189),a=N(a,c,d,u,t[r+9],4,3654602809),u=N(u,a,c,d,t[r+12],11,3873151461),d=N(d,u,a,c,t[r+15],16,530742520),c=N(c,d,u,a,t[r+2],23,3299628645),a=M(a,c,d,u,t[r+0],6,4096336452),u=M(u,a,c,d,t[r+7],10,1126891415),d=M(d,u,a,c,t[r+14],15,2878612391),c=M(c,d,u,a,t[r+5],21,4237533241),a=M(a,c,d,u,t[r+12],6,1700485571),u=M(u,a,c,d,t[r+3],10,2399980690),d=M(d,u,a,c,t[r+10],15,4293915773),c=M(c,d,u,a,t[r+1],21,2240044497),a=M(a,c,d,u,t[r+8],6,1873313359),u=M(u,a,c,d,t[r+15],10,4264355552),d=M(d,u,a,c,t[r+6],15,2734768916),c=M(c,d,u,a,t[r+13],21,1309151649),a=M(a,c,d,u,t[r+4],6,4149444226),u=M(u,a,c,d,t[r+11],10,3174756917),d=M(d,u,a,c,t[r+2],15,718787259),c=M(c,d,u,a,t[r+9],21,3951481745),a=P(a,n),c=P(c,o),d=P(d,i),u=P(u,s);return(C(a)+C(c)+C(d)+C(u)).toLowerCase()}var G,x,D,X,B,F=F||function(e,t){var r={},n=r.lib={},o=function(){},i=n.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=n.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes;if(e=e.sigBytes,this.clamp(),n%4)for(var o=0;e>o;o++)t[n+o>>>2]|=(r[o>>>2]>>>24-o%4*8&255)<<24-(n+o)%4*8;else if(r.length>65535)for(o=0;e>o;o+=4)t[n+o>>>2]=r[o>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],n=0;t>n;n+=4)r.push(4294967296*e.random()|0);return new s.init(r,t)}}),a=r.enc={},c=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;e>n;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;t>n;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new s.init(r,t/2)}},d=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;e>n;n++)r.push(String.fromCharCode(t[n>>>2]>>>24-n%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;t>n;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},l=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,o=r.sigBytes,i=this.blockSize,a=o/(4*i);a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(o=e.min(4*(t=a*i),o),t){for(var c=0;t>c;c+=i)this._doProcessBlock(n,c);c=n.splice(0,t),r.sigBytes-=o}return new s.init(c,o)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});n.Hasher=l.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}});var f=r.algo={};return r}(Math);x=(B=(G=F).lib).WordArray,X=[],B=G.algo.SHA1=(D=B.Hasher).extend({_doReset:function(){this._hash=new x.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],c=0;80>c;c++){if(16>c)X[c]=0|e[t+c];else{var d=X[c-3]^X[c-8]^X[c-14]^X[c-16];X[c]=d<<1|d>>>31}d=(n<<5|n>>>27)+a+X[c],d=20>c?d+(1518500249+(o&i|~o&s)):40>c?d+(1859775393+(o^i^s)):60>c?d+((o&i|o&s|i&s)-1894007588):d+((o^i^s)-899497514),a=s,s=i,i=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=D.clone.call(this);return e._hash=this._hash.clone(),e}}),G.SHA1=D._createHelper(B),G.HmacSHA1=D._createHmacHelper(B),function(){var e=F.enc.Utf8;F.algo.HMAC=F.lib.Base.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=e.parse(r));var n=t.blockSize,o=4*n;r.sigBytes>o&&(r=t.finalize(r)),r.clamp();for(var i=this._oKey=r.clone(),s=this._iKey=r.clone(),a=i.words,c=s.words,d=0;n>d;d++)a[d]^=1549556828,c[d]^=909522486;i.sigBytes=s.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}();var j="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==j&&j||{},H={searchParams:"URLSearchParams"in j,iterable:"Symbol"in j&&"iterator"in Symbol,blob:"FileReader"in j&&"Blob"in j&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in j,arrayBuffer:"ArrayBuffer"in j};if(H.arrayBuffer)var Y=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],V=ArrayBuffer.isView||function(e){return e&&Y.indexOf(Object.prototype.toString.call(e))>-1};function W(e){if("string"!=typeof e&&(e+=""),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function K(e){return"string"!=typeof e&&(e+=""),e}function q(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return H.iterable&&(t[Symbol.iterator]=function(){return t}),t}function z(e){this.map={},e instanceof z?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function J(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function $(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function Q(e){var t=new FileReader,r=$(t);return t.readAsArrayBuffer(e),r}function Z(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function ee(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:H.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:H.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:H.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=""+e:H.arrayBuffer&&H.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=Z(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):H.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||V(e))?this._bodyArrayBuffer=Z(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):H.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},H.blob&&(this.blob=function(){var e=J(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=J(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(Q)}),this.text=function(){var e,t,r,n=J(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=$(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),n=0;t.length>n;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},H.formData&&(this.formData=function(){return this.text().then(ne)}),this.json=function(){return this.text().then(JSON.parse)},this}z.prototype.append=function(e,t){e=W(e),t=K(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},z.prototype.delete=function(e){delete this.map[W(e)]},z.prototype.get=function(e){return e=W(e),this.has(e)?this.map[e]:null},z.prototype.has=function(e){return this.map.hasOwnProperty(W(e))},z.prototype.set=function(e,t){this.map[W(e)]=K(t)},z.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},z.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),q(e)},z.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),q(e)},z.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),q(e)},H.iterable&&(z.prototype[Symbol.iterator]=z.prototype.entries);var te=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function re(e,t){if(!(this instanceof re))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,o=(t=t||{}).body;if(e instanceof re){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new z(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=e+"";if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new z(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),te.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in j)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function ne(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function oe(e,t){if(!(this instanceof oe))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&300>this.status,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new z(t.headers),this.url=t.url||"",this._initBody(e)}re.prototype.clone=function(){return new re(this,{body:this._bodyInit})},ee.call(re.prototype),ee.call(oe.prototype),oe.prototype.clone=function(){return new oe(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new z(this.headers),url:this.url})},oe.error=function(){var e=new oe(null,{status:0,statusText:""});return e.type="error",e};var ie=[301,302,303,307,308];oe.redirect=function(e,t){if(-1===ie.indexOf(t))throw new RangeError("Invalid status code");return new oe(null,{status:t,headers:{location:e}})};var se=j.DOMException;try{new se}catch(e){(se=function(e,t){this.message=e,this.name=t,this.stack=Error(e).stack}).prototype=Object.create(Error.prototype),se.prototype.constructor=se}function ae(t,r){return new Promise((function(n,o){var i=new re(t,r);if(i.signal&&i.signal.aborted)return o(new se("Aborted","AbortError"));var s=new XMLHttpRequest;function a(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new z,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;setTimeout((function(){n(new oe(o,r))}),0)},s.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},s.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},s.onabort=function(){setTimeout((function(){o(new se("Aborted","AbortError"))}),0)},s.open(i.method,function(e){try{return""===e&&j.location.href?j.location.href:e}catch(t){return e}}(i.url),!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&(H.blob?s.responseType="blob":H.arrayBuffer&&i.headers.get("Content-Type")&&-1!==i.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!r||"object"!==e(r.headers)||r.headers instanceof z?i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){s.setRequestHeader(e,K(r.headers[e]))})),i.signal&&(i.signal.addEventListener("abort",a),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",a)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}function ce(e){return e.startsWith("http:")||e.startsWith("https:")||e.startsWith("ftp:")}ae.polyfill=!0,j.fetch||(j.fetch=ae,j.Headers=z,j.Request=re,j.Response=oe);var de,ue={User:{fetchUserInfoById:"/user/info",updateUserInfo:"/user/update",getBlackUserList:"/user/black/list",addToBlackUserList:"/user/black/add",removeFromBlacklist:"/user/black/remove"},Group:{create:"/group/create",update:"/group/edit",dissolve:"/group/dissolve",fetchGroupInfoById:"/group/get",list:"/group/list",transferLeader:"/group/transferLeader",addUser:"/group/user/add",leave:"/group/user/leave",remove:"/group/user/delete",memberList:"/group/user/list",adminstrator:"/group/user/set/adminstrator",applyList:"/group/user/apply/list",handleApply:"/group/user/apply/change",setMute:"/group/user/set/mute"},Conversation:{fetchConversationList:"/conversation/list",clearConversationUnread:"/conversation/update/unread",deleteConversation:"/conversation/delete"},Message:{sendMessage:"/message/save",fetchHistoryMessageList:"/v117/message/list",deleteMessage:"/message/delete",revokeMessage:"/message/revoke"},Friend:{fetchList:"/friend/list",fetchApplyList:"/friend/apply/list",setRead:"/friend/apply/set/read",acceptApply:"/friend/apply/accept",refuseApply:"/friend/apply/refuse",addFriend:"/friend/add",deleteFriend:"/friend/delete",updateFriend:"/friend/update"},Push:{bindClientId:"/user/bind/push/id"},Upload:{sign:"/upload/sign",normal:"/upload",image:"/upload/image",video:"/upload/video"}};function le(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Promise((function(n,o){if(de.uni)uni.request({url:de.defaults.baseURL+e,data:r,method:t,header:{"content-type":"application/json",token:null!=de.token?de.token:""},success:function(e){if(null==e.data)return o({code:a.NORMAL_ERROR.code,message:e.message?e.message:a.NORMAL_ERROR.describe,data:null});(e=e.data).code===a.NORMAL_SUCCESS.code?n(e.data?e.data:null):o(e)},fail:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return""+e},t}((function(e){c(1,e),o({code:a.NORMAL_ERROR.code,message:JSON.stringify(e),data:null})}))});else{var i={method:t,body:JSON.stringify(r),headers:{"Content-Type":"application/json",token:null!=de.token?de.token:""}};"GET"==t&&(e+=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"brackets",r=1>=arguments.length||void 0===arguments[1]||arguments[1]?"?":"",n=[];-1==["indices","brackets","repeat","comma"].indexOf(t)&&(t="brackets");var o=function(r){var o=e[r];if(["",void 0,null].indexOf(o)>=0)return"continue";if(o.constructor===Array)switch(t){case"indices":for(var i=0;o.length>i;i++)n.push(r+"["+i+"]="+o[i]);break;case"brackets":default:o.forEach((function(e){n.push(r+"[]="+e)}));break;case"repeat":o.forEach((function(e){n.push(r+"="+e)}));break;case"comma":var s="";o.forEach((function(e){s+=(s?",":"")+e})),n.push(r+"="+s)}else n.push(r+"="+o)};for(var i in e)o(i);return n.length?r+n.join("&"):""}(r,!0),delete i.body),ae(de.defaults.baseURL+e,i).then(function(){var e=v(S.mark((function e(t){var r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json();case 2:if(null!=(r=e.sent)){e.next=5;break}return e.abrupt("return",o({code:a.NORMAL_ERROR.code,message:r.message?r.message:a.NORMAL_ERROR.describe,data:null}));case 5:r.code===a.NORMAL_SUCCESS.code?n(r.data?r.data:null):o(r);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){c(1,e),o({code:a.NORMAL_ERROR.code,message:JSON.stringify(e.message),data:null})}))}}))}function fe(e){return de.uni?uni.uploadFile({url:e.url,name:e.name,formData:e.data,header:e.header,filePath:e.filePath,success:function(t){if(e.ignoreResult)f(e,a.NORMAL_SUCCESS.describe);else{null==t.data&&reject(null);var r=(t=JSON.parse(t.data)).code;r===a.NORMAL_SUCCESS.code?f(e,a.NORMAL_SUCCESS.describe,t.data?t.data:null):h(e,r,t.message)}},fail:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return""+e},t}((function(t){c(1,t),h(e,a.NORMAL_ERROR.code,t)}))}):new Promise(function(){var t=v(S.mark((function t(r,n){var o,i,s;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(i in o=new FormData,e.data)o.append(i,e.data[i]);if(!e.filePath.startsWith("blob:")){t.next=12;break}return t.next=5,ae(blobUrl);case 5:return s=t.sent,t.next=8,s.blob();case 8:formData.append("file",t.sent),t.next=13;break;case 12:o.append("file",e.filePath);case 13:ae(e.url,{method:"POST",body:o,headers:e.header}).then(function(){var t=v(S.mark((function t(r){var n;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.ok){t.next=7;break}return t.next=3,r.json();case 3:(n=t.sent).code==a.NORMAL_SUCCESS.code?f(e,a.NORMAL_SUCCESS.describe,n.data?n.data:null):(c(1,n.message),h(e,a.NORMAL_ERROR.code,n.message)),t.next=9;break;case 7:c(1,"network error"),h(e,a.NORMAL_ERROR.code,"network error");case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).then((function(t){c(1,t),h(e,a.NORMAL_ERROR.code,t)}));case 14:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}())}function he(e){return de.uni?uni.downloadFile({url:e.url,header:e.header,success:function(t){200===t.statusCode?f(e,a.NORMAL_SUCCESS.describe,t.tempFilePath):h(e,a.DOWNLOAD_ERROR.code,a.DOWNLOAD_ERROR.code.describe)},fail:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return""+e},t}((function(t){c(1,t),h(e,a.DOWNLOAD_ERROR.code,a.DOWNLOAD_ERROR.code.describe)}))}):ae(e.url,{header:e.header}).then((function(e){return e.blob()})).then((function(t){var r=new File([t],e.filename?e.filename:"1.jpg");f(e,a.NORMAL_SUCCESS.describe,r)})).catch((function(t){c(1,fail),h(e,a.DOWNLOAD_ERROR.code,a.DOWNLOAD_ERROR.code.describe)}))}function pe(){return Re.apply(this,arguments)}function Re(){return(Re=v(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,le(ue.Upload.sign,"GET",{});case 2:(t=e.sent).code?c(1,"媒体上传参数获取失败",!0):de.mediaUploadParams=t;case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(){var e=de.defaults.baseURL;return"cos"==de.mediaUploadParams.storage?e="https://".concat(de.mediaUploadParams.bucket,".cos.").concat(de.mediaUploadParams.region,".myqcloud.com"):"oss"==de.mediaUploadParams.storage&&(e="https://".concat(de.mediaUploadParams.bucket,".").concat(de.mediaUploadParams.region,".aliyuncs.com")),e}function ye(){return de.mediaUploadParams.customDomain?de.mediaUploadParams.customDomain:ge()}function Ee(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"files",r=e;if(!de.mediaUploadParams.baseDir&&"local"===!de.mediaUploadParams.storage)return r;var n=de.mediaUploadParams.baseDir,o=new Date,i=t+"/"+(o.getFullYear()+"-"+JSON.stringify(o.getMonth()+1).padStart(2,0)+"-"+JSON.stringify(o.getDate()).padStart(2,0))+"/"+e;if("local"!==de.mediaUploadParams.storage){if("/"==n.substring(0,1)&&(n=n.substring(1)),"/"===n.substring(n.length-1,n.length)&&(n=n.substring(0,n.length)+n.substring(n.length+1)),!n)return i;r=n+"/"+i}else r=i;return r}function me(e,t,r){return ve.apply(this,arguments)}function ve(){return(ve=v(S.mark((function e(t,r,n){var o,i,s,a,c,d,u,l,f,h;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=parseInt((new Date).getTime()/1e3)-1,de.mediaUploadParams&&de.mediaUploadParams.expireTime>=o){e.next=4;break}return e.next=4,pe();case 4:return a=de.mediaUploadParams.secretId,c=(i=de.mediaUploadParams.nowTime)+";"+(s=de.mediaUploadParams.expireTime),u=de.mediaUploadParams.signKey,l="sha1"+"\n"+(d=i+";"+s)+"\n"+F.SHA1(t+"\n"+r+"\n\n"+n+"\n")+"\n",f=F.HmacSHA1(l,u),h="q-sign-algorithm=sha1&q-ak=".concat(a,"&q-sign-time=").concat(c,"&q-key-time=").concat(d,"&q-header-list=&q-url-param-list=&q-signature=").concat(f),e.abrupt("return",h);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function be(){return _e.apply(this,arguments)}function _e(){return(_e=v(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=parseInt((new Date).getTime()/1e3)-1,de.mediaUploadParams&&de.mediaUploadParams.expireTime>=t){e.next=4;break}return e.next=4,pe();case 4:return e.abrupt("return",de.mediaUploadParams);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(e){if(!de.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(!de.mediaUploadParams)return h(e,a.PARAMS_ERROR.code,"上传参数异常,暂无法使用此接口");var t=de.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),n=w((new Date).getTime()+"_"+e.filename)+"_other"+r,o=ge(),i=ye()+"/"+Ee(n);if("cos"===t.storage)setTimeout(v(S.mark((function t(){var r,s;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,me("post","/","");case 2:r=t.sent,s=fe({url:o,name:"file",data:{key:Ee(n),success_action_status:200,Signature:r,"Content-Type":""},header:{Authorization:r},filePath:e.filepath,ignoreResult:!0,success:function(){f(e,a.NORMAL_SUCCESS.describe,{url:i})},fail:function(){h(e,a.COS_UPLOAD_ERROR.code,a.COS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 5:case"end":return t.stop()}}),t)}))),0);else if("oss"===t.storage)setTimeout(v(S.mark((function r(){var s;return S.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,be();case 2:s=fe({url:o,name:"file",data:{key:Ee(n),policy:t.policyBase64,OSSAccessKeyId:t.accessKeyId,success_action_status:200,signature:t.signature},filePath:e.filepath,ignoreResult:!0,success:function(){f(e,a.NORMAL_SUCCESS.describe,{url:i})},fail:function(){h(e,a.OSS_UPLOAD_ERROR.code,a.OSS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 4:case"end":return r.stop()}}),r)}))));else if("local"===t.storage){var s=fe({url:o+ue.Upload.normal,name:"file",data:{key:Ee(n)},header:{token:de.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{url:ye()+t.data.url})},fail:function(){h(e,a.UPLOAD_ERROR.code,a.UPLOAD_ERROR.describe)}});void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}))}}function Oe(e){if(!de.mediaUploadParams)return h(e,a.PARAMS_ERROR.code,"上传参数异常,暂无法使用此接口");var t=de.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),n=w((new Date).getTime()+"_"+e.filename)+"_image"+r,o=ge(),i=ye()+"/"+Ee(n,"image");if("cos"===t.storage)setTimeout(v(S.mark((function t(){var r,s;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,me("post","/","");case 2:r=t.sent,s=fe({url:o,name:"file",data:{key:Ee(n,"image"),success_action_status:200,Signature:r,"Content-Type":""},header:{Authorization:r},filePath:e.filepath,ignoreResult:!0,success:function(){var t=0,r=0;if(e.height>198){var n=198/e.height;t=parseInt(e.height*n),r=parseInt(e.width*n)}else if(e.width>198){var o=198/e.width;t=parseInt(e.height*o),r=parseInt(e.width*o)}f(e,a.NORMAL_SUCCESS.describe,{url:i,thumbnailUrl:i+"?imageMogr2/thumbnail/"+r+"x"+t,thumbnailWidth:r,thumbnailHeight:t})},fail:function(){h(e,a.COS_UPLOAD_ERROR.code,a.COS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 5:case"end":return t.stop()}}),t)}))),0);else if("oss"===t.storage)setTimeout(v(S.mark((function r(){var s;return S.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,be();case 2:s=fe({url:o,name:"file",data:{key:Ee(n,"image"),policy:t.policyBase64,OSSAccessKeyId:t.accessKeyId,success_action_status:200,signature:t.signature},filePath:e.filepath,ignoreResult:!0,success:function(){var t=0,r=0;if(e.height>198){var n=198/e.height;t=parseInt(e.height*n),r=parseInt(e.width*n)}else if(e.width>198){var o=198/e.width;t=parseInt(e.height*o),r=parseInt(e.width*o)}f(e,a.NORMAL_SUCCESS.describe,{url:i,thumbnailUrl:i+"?x-oss-process=image/resize,m_fixed,h_"+t+",w_"+r,thumbnailWidth:r,thumbnailHeight:t})},fail:function(){h(e,a.OSS_UPLOAD_ERROR.code,a.OSS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 4:case"end":return r.stop()}}),r)}))));else if("local"===t.storage){var s=fe({url:o+ue.Upload.image,name:"file",data:{key:Ee(n,"image")},header:{token:de.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{url:ye()+t.data.url,thumbnailUrl:ye()+t.data.thumbnailUrl,thumbnailWidth:t.data.thumbnailWidth,thumbnailHeight:t.data.thumbnailHeight})},fail:function(){h(e,a.UPLOAD_ERROR.code,a.UPLOAD_ERROR.describe)}});void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}))}}function Se(e){if(!de.mediaUploadParams)return c(1,"媒体上传参数获取失败",!0);var t=de.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),n=w((new Date).getTime()+"_"+e.filename)+"_video"+r,o=ge(),i=ye()+"/"+Ee(n,"video");if("cos"==t.storage)setTimeout(v(S.mark((function t(){var r,s;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,me("post","/","");case 2:r=t.sent,s=fe({url:o,name:"file",data:{key:Ee(n,"video"),success_action_status:200,Signature:r,"Content-Type":""},header:{Authorization:r},filePath:e.filepath,ignoreResult:!0,success:function(){var t=v(S.mark((function t(){var r;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,me("get","/"+Ee(n,"video"),"");case 2:r=t.sent,he({url:o+"/"+Ee(n,"video")+"?ci-process=snapshot&time=1",header:{Authorization:r},success:function(t){Oe({filename:w(n+t.data)+"_videoThumb.jpg",filepath:t.data,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{videoUrl:i,thumbnailUrl:t.data.url})},fail:function(t){h(e,a.NORMAL_ERROR.code,t)}})},fail:function(){h(e,a.COS_DOWNLOAD_ERROR_1.code,a.COS_DOWNLOAD_ERROR_1.describe)}});case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),fail:function(){h(e,a.COS_UPLOAD_ERROR.code,a.COS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 5:case"end":return t.stop()}}),t)}))),0);else if("oss"===t.storage)setTimeout(v(S.mark((function r(){var s;return S.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,be();case 2:s=fe({url:o,name:"file",data:{key:Ee(n,"video"),policy:t.policyBase64,OSSAccessKeyId:t.accessKeyId,success_action_status:200,signature:t.signature},filePath:e.filepath,ignoreResult:!0,success:function(){f(e,a.NORMAL_SUCCESS.describe,{videoUrl:i,thumbnailUrl:i+"?x-oss-process=video/snapshot,t_1000,f_jpg,m_fast"})},fail:function(){h(e,a.OSS_UPLOAD_ERROR.code,a.OSS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 4:case"end":return r.stop()}}),r)}))));else if("local"===t.storage){var s=fe({url:o+ue.Upload.video,name:"file",data:{key:Ee(n,"video")},header:{token:de.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{videoUrl:ye()+t.data.url,thumbnailUrl:ye()+t.data.thumbnailUrl})},fail:function(){h(e,a.UPLOAD_ERROR.code,a.UPLOAD_ERROR.describe)}});void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}))}}function Ae(e){return{conversationId:e.to,conversationType:e.conversationType,fromUserInfo:{nickname:de.user.nickname,avatarUrl:de.user.avatarUrl},from:de.userId,to:e.to,type:e.type,isRead:0,isRevoke:0,isDeleted:0,status:"unSend",time:(new Date).getTime(),body:e.body,extra:e.extra?e.extra:""}}function Pe(e){return de.uni?uni.getStorageSync(e):localStorage.getItem(e)?JSON.parse(localStorage.getItem(e)):null}function Le(e,t){de.uni?uni.setStorageSync(e,t):localStorage.setItem(e,JSON.stringify(t))}function Te(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body||!e.body.text)return l(a.PARAMS_ERROR.code,"text 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.TEXT,conversationType:e.conversationType,body:{text:e.body.text}};return e.extra&&(t.extra=e.extra),Ae(t)}function Ne(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(e.conversationType!=s.CONVERSATION_TYPE.GROUP)return l(a.PARAMS_ERROR.code,"仅群聊支持文本@消息");if(!e.body||!e.body.text)return l(a.PARAMS_ERROR.code,"text 不能为空");if(!e.body.atUserIdList)return l(a.PARAMS_ERROR.code,"atUserIdList 不能为空");if("[object Array]"!==Object.prototype.toString.call(e.body.atUserIdList))return l(a.PARAMS_ERROR.code,"atUserIdList 应为用户ID组成的字符串数组");var t={to:e.toId,type:s.MESSAGE_TYPE.TEXT_AT,conversationType:e.conversationType,body:{text:e.body.text,atUserIdList:e.body.atUserIdList}};return e.extra&&(t.extra=e.extra),Ae(t)}function Me(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body||!e.body.file)return l(a.PARAMS_ERROR.code,"file 不能为空");if(!e.body.file.tempFilePath)return l(a.PARAMS_ERROR.code,"tempFilePath 不能为空");if(!e.body.file.width)return l(a.PARAMS_ERROR.code,"width 不能为空");if(!e.body.file.height)return l(a.PARAMS_ERROR.code,"height 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.IMAGE,conversationType:e.conversationType,body:{originalUrl:e.body.file.tempFilePath,originalWidth:e.body.file.width,originalHeight:e.body.file.height,thumbnailUrl:e.body.file.tempFilePath,thumbnailWidth:e.body.file.width,thumbnailHeight:e.body.file.height}};e.extra&&(t.extra=e.extra);var r=Ae(t);return void 0!==e.onProgress&&"function"==typeof e.onProgress&&(r.onProgress=e.onProgress),r}function Ue(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body)return l(a.PARAMS_ERROR.code,"body 不能为空");if(!e.body.originalUrl)return l(a.PARAMS_ERROR.code,"originalUrl 不能为空");if(!e.body.originalWidth)return l(a.PARAMS_ERROR.code,"originalWidth 不能为空");if(!e.body.originalHeight)return l(a.PARAMS_ERROR.code,"originalHeight 不能为空");if(!e.body.thumbnailUrl)return l(a.PARAMS_ERROR.code,"thumbnailUrl 不能为空");if(!e.body.thumbnailWidth)return l(a.PARAMS_ERROR.code,"thumbnailWidth 不能为空");if(!e.body.thumbnailHeight)return l(a.PARAMS_ERROR.code,"thumbnailHeight 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.IMAGE,conversationType:e.conversationType,body:{originalUrl:e.body.originalUrl,originalWidth:e.body.originalWidth,originalHeight:e.body.originalHeight,thumbnailUrl:e.body.thumbnailUrl,thumbnailWidth:e.body.thumbnailWidth,thumbnailHeight:e.body.thumbnailHeight}};return e.extra&&(t.extra=e.extra),Ae(t)}function Ce(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body.address)return l(a.PARAMS_ERROR.code,"address 不能为空");if(!e.body.description)return l(a.PARAMS_ERROR.code,"description 不能为空");if(!e.body.longitude)return l(a.PARAMS_ERROR.code,"longitude 不能为空");if(!e.body.latitude)return l(a.PARAMS_ERROR.code,"latitude 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.LOCATION,conversationType:e.conversationType,body:{address:e.body.address,description:e.body.description,longitude:e.body.longitude,latitude:e.body.latitude}};return e.extra&&(t.extra=e.extra),Ae(t)}function ke(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body||!e.body.file)return l(a.PARAMS_ERROR.code,"file 不能为空");if(!e.body.file.tempFilePath)return l(a.PARAMS_ERROR.code,"tempFilePath 不能为空");if(!e.body.file.duration)return l(a.PARAMS_ERROR.code,"duration 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.AUDIO,conversationType:e.conversationType,body:{audioUrl:e.body.file.tempFilePath,duration:e.body.file.duration}};e.extra&&(t.extra=e.extra);var r=Ae(t);return void 0!==e.onProgress&&"function"==typeof e.onProgress&&(r.onProgress=e.onProgress),r}function we(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body)return l(a.PARAMS_ERROR.code,"body 不能为空");if(!e.body.audioUrl)return l(a.PARAMS_ERROR.code,"audioUrl 不能为空");if(!e.body.duration)return l(a.PARAMS_ERROR.code,"duration 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.AUDIO,conversationType:e.conversationType,body:{audioUrl:e.body.audioUrl,duration:e.body.duration}};return e.extra&&(t.extra=e.extra),Ae(t)}function Ge(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body||!e.body.file)return l(a.PARAMS_ERROR.code,"file 不能为空");if(!e.body.file.duration)return l(a.PARAMS_ERROR.code,"duration 不能为空");if("number"!=typeof e.body.file.duration)return l(a.PARAMS_ERROR.code,"duration 参数请传入整型");if(!e.body.file.tempFilePath)return l(a.PARAMS_ERROR.code,"tempFilePath 不能为空");if(!e.body.file.width)return l(a.PARAMS_ERROR.code,"width 不能为空");if(!e.body.file.height)return l(a.PARAMS_ERROR.code,"height 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.VIDEO,conversationType:e.conversationType,body:{videoUrl:e.body.file.tempFilePath,thumbnailUrl:"",duration:e.body.file.duration,videoWidth:e.body.file.width,videoHeight:e.body.file.height}};e.extra&&(t.extra=e.extra);var r=Ae(t);return void 0!==e.onProgress&&"function"==typeof e.onProgress&&(r.onProgress=e.onProgress),r}function xe(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body)return l(a.PARAMS_ERROR.code,"file 不能为空");if(!e.body.duration)return l(a.PARAMS_ERROR.code,"duration 不能为空");if("number"!=typeof e.body.duration)return l(a.PARAMS_ERROR.code,"duration 参数请传入整型");if(!e.body.videoUrl)return l(a.PARAMS_ERROR.code,"tempFilePath 不能为空");if(!e.body.width)return l(a.PARAMS_ERROR.code,"width 不能为空");if(!e.body.height)return l(a.PARAMS_ERROR.code,"height 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.VIDEO,conversationType:e.conversationType,body:{videoUrl:e.body.videoUrl,thumbnailUrl:e.body.thumbnailUrl,duration:e.body.duration,videoWidth:e.body.width,videoHeight:e.body.height}};return e.extra&&(t.extra=e.extra),Ae(t)}function De(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body||!e.body.custom)return l(a.PARAMS_ERROR.code,"自定义消息的 body 和 body.custom 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.CUSTOM,conversationType:e.conversationType,body:{custom:e.body.custom}};return e.extra&&(t.extra=e.extra),Ae(t)}function Xe(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body||!e.body.title)return l(a.PARAMS_ERROR.code,"title 不能为空");if(!e.body.messageList)return l(a.PARAMS_ERROR.code,"messageList 不能为空");if("[object Array]"!==Object.prototype.toString.call(e.body.messageList))return l(a.PARAMS_ERROR.code,"messageList 应为由Message结构组成的数组");if(!e.body.summaryList)return l(a.PARAMS_ERROR.code,"summaryList 不能为空");if("[object Array]"!==Object.prototype.toString.call(e.body.summaryList))return l(a.PARAMS_ERROR.code,"summaryList 应为字符串数组");var t={to:e.toId,type:s.MESSAGE_TYPE.MERGER,conversationType:e.conversationType,body:{title:e.body.title,messageList:e.body.messageList,summaryList:e.body.summaryList}};return e.extra&&(t.extra=e.extra),Ae(t)}function Be(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(null==e||!e.toId)return l(a.PARAMS_ERROR.code,"toId 不能为空");if(!e.conversationType)return l(a.PARAMS_ERROR.code,"conversationType 不能为空");if(!e.body||!e.body.message)return l(a.PARAMS_ERROR.code,"message 不能为空");var t={to:e.toId,type:s.MESSAGE_TYPE.FORWARD,conversationType:e.conversationType,body:{message:e.body.message}};return e.extra&&(t.extra=e.extra),Ae(t)}function Fe(e){if(!de.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(!e.message)return h(e,a.PARAMS_ERROR.code,"message 不能为空");var t=e.message;t.type==s.MESSAGE_TYPE.IMAGE?function(e){var t=e.message;if("string"==typeof t.body.originalUrl&&ce(t.body.originalUrl)&&ce(t.body.thumbnailUrl))return je(e);Oe({filename:de.token+"_image.png",filepath:t.body.originalUrl,width:t.body.originalWidth,height:t.body.originalHeight,success:function(r){t.body.originalUrl=r.data.url,t.body.thumbnailWidth=r.data.thumbnailWidth,t.body.thumbnailHeight=r.data.thumbnailHeight,t.body.thumbnailUrl=r.data.thumbnailUrl,e.message=t,je(e)},fail:function(t){h(e,t.code,t.message),c(1,t)},onProgress:function(e){void 0!==t.onProgress&&"function"==typeof t.onProgress&&t.onProgress(e)}})}(e):t.type==s.MESSAGE_TYPE.VIDEO?function(e){var t=e.message;if("string"==typeof t.body.videoUrl&&ce(t.body.videoUrl))return je(e);Se({filename:de.token+"_video.mp4",filepath:t.body.videoUrl,success:function(r){console.log(Se),console.log(r);var n=r.data.thumbnailUrl;t.body.videoUrl=r.data.videoUrl,t.body.thumbnailUrl=n,e.message=t,je(e)},fail:function(t){h(e,t.code,t.message),c(1,t)},onProgress:function(e){void 0!==t.onProgress&&"function"==typeof t.onProgress&&t.onProgress(e)}})}(e):t.type==s.MESSAGE_TYPE.AUDIO?function(e){var t=e.message;if("string"==typeof t.body.audioUrl&&ce(t.body.audioUrl))return je(e);!function(e){if(!de.mediaUploadParams)return h(e,a.PARAMS_ERROR.code,"上传参数异常,暂无法使用此接口");var t=de.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),n=w((new Date).getTime()+"_"+e.filename)+"_audio"+r,o=ge(),i=ye()+"/"+Ee(n,"audio");if("cos"===t.storage)setTimeout(v(S.mark((function t(){var r,s;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,me("post","/","");case 2:r=t.sent,s=fe({url:o,name:"file",data:{key:Ee(n,"audio"),success_action_status:200,Signature:r,"Content-Type":""},header:{Authorization:r},filePath:e.filepath,ignoreResult:!0,success:function(){f(e,a.NORMAL_SUCCESS.describe,{url:i})},fail:function(){h(e,a.COS_UPLOAD_ERROR.code,a.COS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 5:case"end":return t.stop()}}),t)}))),0);else if("oss"===t.storage)setTimeout(v(S.mark((function r(){var s;return S.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,be();case 2:s=fe({url:o,name:"file",data:{key:Ee(n,"audio"),policy:t.policyBase64,OSSAccessKeyId:t.accessKeyId,success_action_status:200,signature:t.signature},filePath:e.filepath,ignoreResult:!0,success:function(){f(e,a.NORMAL_SUCCESS.describe,{url:i})},fail:function(){h(e,a.OSS_UPLOAD_ERROR.code,a.OSS_UPLOAD_ERROR.describe)}}),void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}));case 4:case"end":return r.stop()}}),r)}))));else if("local"===t.storage){var s=fe({url:o+"/upload",name:"file",data:{key:Ee(n,"audio")},header:{token:de.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{url:ye()+t.data.url})},fail:function(){h(e,a.UPLOAD_ERROR.code,a.UPLOAD_ERROR.describe)}});void 0!==e.onProgress&&"function"==typeof e.onProgress&&s.onProgressUpdate((function(t){e.onProgress(t)}))}}({filename:de.token+"_audio.aac",filepath:t.body.audioUrl,success:function(r){t.body.audioUrl=r.data.url,e.message=t,je(e)},fail:function(t){h(e,t.code,t.message),c(1,t)},onProgress:function(e){void 0!==t.onProgress&&"function"==typeof t.onProgress&&t.onProgress(e)}})}(e):je(e)}function je(e){le(ue.Message.sendMessage,"POST",e.message).then((function(t){He(t),f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),c(1,t)}))}function He(e){if(!e.conversationId)return c(1,"conversationId 不能为空");var t=We(e.conversationId),r=t.findIndex((function(t){return t.messageId===e.messageId})),n="yeim:messageList:".concat(w(de.userId),":conversationId:").concat(w(e.conversationId));-1===r?(t.length>19&&t.splice(0,t.length-19),t.push(e),Le(n,t)):(t[r]=e,Le(n,t))}function Ye(e){if(!de.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(!e.conversationId)return h(e,a.PARAMS_ERROR.code,"conversationId 不能为空");var t=20;e.limit&&"number"==typeof e.limit&&(t=e.limit);var r=We(e.conversationId),n=!1;if(!e.nextMessageId){var o=Pe("yeim:conversationList:".concat(w(de.userId))),i=(o=o||[]).findIndex((function(t){return t.conversationId===e.conversationId}));if(i>-1&&r.length>0){var s=o[i];s.lastMessage.messageId&&s.lastMessage.messageId!=r[r.length-1].messageId&&(n=!0)}}if(n)Ve(e.conversationId,null,20).then((function(t){var r=t.list;Le("yeim:messageList:".concat(w(de.userId),":conversationId:").concat(w(e.conversationId)),r),f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message)}));else if(e.nextMessageId){var c=e.nextMessageId,d=r.findIndex((function(e){return e.messageId===c}));if(-1===d)Ve(e.conversationId,c,t).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message)}));else{var u=r[d];if(t>(r=r.slice(0,d)).length){var l=null;Ve(e.conversationId,l=0==r.length?u.messageId:r[0].messageId,t-r.length).then((function(t){var n=r.concat(t.list);n.sort((function(e,t){return e.sequence-t.sequence})),t.list=n,t.nextMessageId||(t.nextMessageId=l),f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message)}))}else f(e,a.NORMAL_SUCCESS.describe,{list:r,nextMessageId:r[0].messageId})}}else if(t>r.length){var p=null;r.length>0&&(p=r[0].messageId),Ve(e.conversationId,p,t-r.length).then((function(t){var n=r.concat(t.list);n.sort((function(e,t){return e.sequence-t.sequence})),Le("yeim:messageList:".concat(w(de.userId),":conversationId:").concat(w(e.conversationId)),n),t.list=n,t.nextMessageId||(t.nextMessageId=p),f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message)}))}else f(e,a.NORMAL_SUCCESS.describe,{list:r,nextMessageId:r[0].messageId})}function Ve(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20;return new Promise((function(n,o){le(ue.Message.fetchHistoryMessageList,"GET",{nextMessageId:null==t||""==t?null:t,conversationId:e,limit:r}).then((function(e){var t={},r=e.records;(r=r.reverse()).sort((function(e,t){return e.sequence-t.sequence})),t.list=r,e.nextMessageId&&(t.nextMessageId=e.nextMessageId),n(t)})).catch((function(e){o(e)}))}))}function We(e){var t=Pe("yeim:messageList:".concat(w(de.userId),":conversationId:").concat(w(e)));return(t=t||[]).sort((function(e,t){return e.sequence-t.sequence})),t}function Ke(e){return de.checkLogged()?e.message?e.message.messageId?void le(ue.Message.deleteMessage,"GET",{messageId:e.message.messageId}).then((function(){e.message.isDeleted=1,He(e.message),f(e,a.NORMAL_SUCCESS.describe,e.message)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"message.messageId 不能为空"):h(e,a.PARAMS_ERROR.code,"message 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function qe(e){return de.checkLogged()?e.message?e.message.messageId?void le(ue.Message.revokeMessage,"GET",{messageId:e.message.messageId}).then((function(){e.message.isRevoke=1,He(e.message),f(e,a.NORMAL_SUCCESS.describe,e.message)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"message.messageId 不能为空"):h(e,a.PARAMS_ERROR.code,"message 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function ze(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(!e)return l(a.PARAMS_ERROR.code,"conversationId 不能为空");var t=Pe("yeim:conversationList:".concat(w(de.userId))),r=(t=t||[]).findIndex((function(t){return t.conversationId===e}));return-1!==r?u(a.NORMAL_SUCCESS.describe,t[r]):l(a.NO_CONVERSATION.code,a.NO_CONVERSATION.describe)}function Je(e){if(!de.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);var t=e.page,r=e.limit,n=Pe("yeim:conversationList:".concat(w(de.userId))),o=(t-1)*r,i=(n=n||[]).slice(o,n.length>o+r?o+r:n.length);f(e,a.NORMAL_SUCCESS.describe,i)}function $e(e){Le("yeim:conversationList:".concat(w(de.userId)),e),g(s.EVENT.CONVERSATION_LIST_CHANGED,e)}function Qe(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);var t="yeim:conversationList:".concat(w(de.userId)),r=Pe(t),n=(r=r||[]).findIndex((function(t){return t.conversationId===e}));-1!==n&&(r[n].unread=0,Le(t,r)),le(ue.Conversation.clearConversationUnread,"GET",{conversationId:e}).then((function(){})).catch((function(e){c(1,e)})),g(s.EVENT.CONVERSATION_LIST_CHANGED,r)}function Ze(e){if(!de.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);var t="yeim:conversationList:".concat(w(de.userId)),r=Pe(t),n=(r=r||[]).findIndex((function(t){return t.conversationId===e}));-1!==n&&(r.splice(n,1),Le(t,r)),function(e){de.uni?uni.removeStorageSync(e):localStorage.removeItem(e)}("yeim:messageList:".concat(w(de.userId),":conversationId:").concat(w(e))),le(ue.Conversation.deleteConversation,"GET",{conversationId:e}).then((function(){})).catch((function(e){c(1,e)})),g(s.EVENT.CONVERSATION_LIST_CHANGED,r)}function et(e){return de.checkLogged()?e.name?e.avatarUrl?void le(ue.Group.create,"POST",e).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"avatarUrl 不能为空"):h(e,a.PARAMS_ERROR.code,"name 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function tt(e){return de.checkLogged()?e.groupId?void le(ue.Group.dissolve,"GET",{groupId:e.groupId}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function rt(e){return de.checkLogged()?e.groupId?e.userId?void le(ue.Group.transferLeader,"GET",{groupId:e.groupId,userId:e.userId}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"userId 不能为空"):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function nt(e){return de.checkLogged()?e.groupId?void le(ue.Group.update,"POST",e).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function ot(e){return de.checkLogged()?e.groupId?void le(ue.Group.fetchGroupInfoById,"GET",{groupId:e.groupId}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function it(e){if(!de.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);le(ue.Group.list,"GET",{}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),c(1,t)}))}function st(e){return de.checkLogged()?e.groupId?void le(ue.Group.addUser,"POST",{groupId:e.groupId,members:[de.userId]}).then((function(t){var r=t.group,n=t.successList;if(-1!=t.ignoreList.indexOf(de.userId))return h(e,a.GROUP_APPLY_REPEAT.code,a.GROUP_APPLY_REPEAT.describe);var o=!1;if(-1!=n.indexOf(de.userId)&&(o=!0),!o)return h(e,a.GROUP_APPLY_ERROR.code,a.GROUP_APPLY_ERROR.describe);if(r.joinMode==s.GROUP.JOINMODE.FREE)f(e,a.NORMAL_SUCCESS.code,"成功加入群组");else{if(r.joinMode!=s.GROUP.JOINMODE.CHECK)return h(e,a.NORMAL_ERROR.code,a.NORMAL_ERROR.describe);f(e,a.GROUP_APPLY_WAIT.code,a.GROUP_APPLY_WAIT.describe)}})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function at(e){return de.checkLogged()?e.groupId?void le(ue.Group.leave,"GET",{groupId:e.groupId}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function ct(e){return de.checkLogged()?e.groupId?e.members&&e.members.length>0?void le(ue.Group.addUser,"POST",{groupId:e.groupId,members:e.members}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"members 不能为空"):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function dt(e){return de.checkLogged()?e.groupId?e.members&&e.members.length>0?void le(ue.Group.remove,"POST",{groupId:e.groupId,members:e.members}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"members 不能为空"):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function ut(e){return de.checkLogged()?e.groupId?void le(ue.Group.memberList,"GET",{groupId:e.groupId}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function lt(e){return de.checkLogged()?e.groupId?void le(ue.Group.adminstrator,"GET",{groupId:e.groupId,userId:e.userId,isAdmin:1===isAdmin?isAdmin:0}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function ft(e){return de.checkLogged()?e.groupId?void le(ue.Group.applyList,"GET",{}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function ht(e){return de.checkLogged()?e.id?e.status?void le(ue.Group.handleApply,"GET",{id:e.id,status:e.status}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"status 不能为空"):h(e,a.PARAMS_ERROR.code,"id 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function pt(e){return de.checkLogged()?e.groupId?e.userId?(e.time||(e.time=0),void le(ue.Group.setMute,"GET",{groupId:e.groupId,userId:e.userId,time:e.time}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),c(1,t)}))):h(e,a.PARAMS_ERROR.code,"userId 不能为空"):h(e,a.PARAMS_ERROR.code,"groupId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function Rt(e){if(!de.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(!e.userId)return h(e,a.PARAMS_ERROR.code,"userId 不能为空");var t="yeim:userList:".concat(w(de.userId));if(e.cloud)le(ue.User.fetchUserInfoById,"GET",{userId:e.userId}).then((function(r){var n=Pe(t);(n=n||[]).push(r),Le(t,n),f(e,a.NORMAL_SUCCESS.describe,r)})).catch((function(t){h(e,t.code,t.message),log(1,t)}));else{var r=Pe(t),n=(r=r||[]).findIndex((function(t){return t.userId===e.userId}));-1!==n?(f(e,a.NORMAL_SUCCESS.describe,r[n]),le(ue.User.fetchUserInfoById,"GET",{userId:e.userId}).then((function(e){var r=Pe(t);(r=r||[])[n]=e,Le(t,r)})).catch((function(t){h(e,t.code,t.message),log(1,t)}))):le(ue.User.fetchUserInfoById,"GET",{userId:e.userId}).then((function(r){var n=Pe(t);(n=n||[]).push(r),Le(t,n),f(e,a.NORMAL_SUCCESS.describe,r)})).catch((function(t){h(e,t.code,t.message),log(1,t)}))}}function gt(e){return de.checkLogged()?Object.keys(e).length>0?void le(ue.User.updateUserInfo,"POST",e).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),log(1,t)})):h(e,a.PARAMS_ERROR.code,"请至少选择一个属性进行更新"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function yt(e){if(!de.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);le(ue.User.getBlackUserList,"GET",{}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),log(1,t)}))}function Et(e){return de.checkLogged()?e.members&&0!=e.members.length?void le(ue.User.addToBlackUserList,"POST",{members:e.members}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),log(1,t)})):h(e,a.PARAMS_ERROR.code,"members 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function mt(e){return de.checkLogged()?e.members&&0!=e.members.length?void le(ue.User.removeFromBlacklist,"POST",{members:e.members}).then((function(){f(e,a.NORMAL_SUCCESS.describe)})).catch((function(t){h(e,t.code,t.message),log(1,t)})):h(e,a.PARAMS_ERROR.code,"members 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function vt(e){var t="yeim:friendList:".concat(w(de.userId)),r=e.page?e.page:1,n=e.limit?e.limit:20;if(e.cloud)le(ue.Friend.fetchList,"GET",{profile:e.profile?0:1,page:r,limit:n}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t.records)})).catch((function(t){h(e,t.code,t.message),c(1,t)}));else{var o=Pe(t),i=(r-1)*n;o=(o=o||[]).slice(i,o.length>i+n?i+n:o.length),f(e,a.NORMAL_SUCCESS.describe,o)}}function bt(){vt({cloud:!0,page:1,limit:9999999,success:function(e){Le("yeim:friendList:".concat(w(de.userId)),e.data),g(s.EVENT.FRIEND_LIST_CHANGED,e)},fail:function(){g(s.EVENT.FRIEND_LIST_CHANGED,null)}})}function _t(){It({cloud:!0,type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,page:1,limit:9999999,success:function(e){var t=e.data,r=t.records,n=t.unread,o="yeim:friendApplyList:".concat(w(de.userId)),i="yeim:friendApplyUnread:".concat(w(de.userId));Le(o,r),Le(i,n),g(s.EVENT.FRIEND_APPLY_LIST_CHANGED,e)},fail:function(){g(s.EVENT.FRIEND_APPLY_LIST_CHANGED,null)}})}function It(e){var t="yeim:friendApplyList:".concat(w(de.userId)),r="yeim:friendApplyUnread:".concat(w(de.userId)),n=e.page?e.page:1,o=e.limit?e.limit:20;if(e.cloud)le(ue.Friend.fetchApplyList,"GET",{type:e.type?e.type:0,page:n,limit:o}).then((function(t){f(e,a.NORMAL_SUCCESS.describe,{records:t.apply.records,unread:t.unread})})).catch((function(t){h(e,t.code,t.message),c(1,t)}));else{var i=Pe(t),s=(n-1)*o;i=(i=i||[]).slice(s,i.length>s+o?s+o:i.length),f(e,a.NORMAL_SUCCESS.describe,{list:i,unread:Pe(r)?Pe(r):0})}}function Ot(e){le(ue.Friend.setRead,"GET",{}).then((function(){f(e,a.NORMAL_SUCCESS.describe,null)})).catch((function(t){h(e,t.code,t.message),c(1,t)}))}function St(e){return de.checkLogged()?e.id?void le(ue.Friend.acceptApply,"GET",{id:e.id,remark:e.remark?e.remark:null}).then((function(){f(e,a.NORMAL_SUCCESS.describe,null)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"id 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function At(e){return de.checkLogged()?e.id?void le(ue.Friend.refuseApply,"GET",{id:e.id}).then((function(){f(e,a.NORMAL_SUCCESS.describe,null)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"id 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function Pt(e){return de.checkLogged()?e.userId?void le(ue.Friend.addFriend,"POST",{userId:e.userId,remark:e.remark?e.remark:null,extraMessage:e.extraMessage?e.extraMessage:null}).then((function(){f(e,a.NORMAL_SUCCESS.describe,null)})).catch((function(t){t.code===a.APPLY_NEED.code?f(e,a.APPLY_NEED.describe,null,a.APPLY_NEED.code):(h(e,t.code,t.message),c(1,t))})):h(e,a.PARAMS_ERROR.code,"userId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function Lt(e){return de.checkLogged()?e.members?void le(ue.Friend.deleteFriend,"POST",{members:e.members}).then((function(){f(e,a.NORMAL_SUCCESS.describe,null)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"members 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function Tt(e){return de.checkLogged()?e.userId?e.remark||e.extend?void le(ue.Friend.updateFriend,"POST",{userId:e.userId,remark:e.remark?e.remark:null,extend:e.extend?e.extend:null}).then((function(){f(e,a.NORMAL_SUCCESS.describe,null)})).catch((function(t){h(e,t.code,t.message),c(1,t)})):h(e,a.PARAMS_ERROR.code,"请至少传入一个参数更新"):h(e,a.PARAMS_ERROR.code,"userId 不能为空"):h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe)}function Nt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mt(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nt(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ut=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e),this.defaults=Mt(Mt({baseURL:void 0,socketURL:void 0,eventPrefix:"YeIM_",reConnectTotal:15,reConnectInterval:3e3,heartInterval:3e4,logLevel:0},t),{},{notification:Mt({autoPermission:!1,oppoChannelId:"Default",xiaomiChannelId:"high_system"},t.notification)}),this.uni="undefined"!=typeof uni,this.version="1.2.82",this.emitter=R(),this.firstConnect=!0,this.webSocket=void 0,this.socketLogged=!1,this.allowReconnect=!0,this.lockReconnect=!1,this.reConnectNum=0,this.connectTimer=void 0,this.heartTimer=void 0,this.checkTimer=void 0,this.user={},this.userId=void 0,this.token=void 0,this.mediaUploadParams={},this.mobileDeviceId=void 0,this.inApp=!0}return i(e,[{key:"connect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t.userId||!t.token)return h(t,a.NO_USERID.code,a.NO_USERID.describe);this.webSocket=new d(this.defaults.socketURL+"/"+t.userId+"/"+t.token),this.webSocket.onOpen(this.socketOpen.bind(this)),this.webSocket.onClose(this.socketClose.bind(this)),this.webSocket.onError(this.socketError.bind(this)),this.webSocket.onMessage(this.socketMessage.bind(this)),this.connectTimer&&(clearTimeout(this.connectTimer),this.connectTimer=void 0),this.connectTimer=setTimeout((function(){return e.connectTimer=void 0,c(1,"连接服务端失败,请检查配置"),h(t,a.CONNECT_ERROR.code,a.CONNECT_ERROR.describe)}),this.defaults.reConnectInterval+1e3),this.webSocket.onMessage((function(r){if(e.socketLogged)return clearTimeout(e.connectTimer),void(e.connectTimer=void 0);clearTimeout(e.connectTimer),e.connectTimer=void 0;var n,o=JSON.parse(r.data);if(201==o.code){var i=o.data.user;e.user=i,e.userId=t.userId,e.token=t.token;var s=o.data.pushConfig;if(s.oppoChannelId&&(e.defaults.notification.oppoChannelId=s.oppoChannelId),s.xiaomiChannelId&&(e.defaults.notification.xiaomiChannelId=s.xiaomiChannelId),e.socketLogged=!0,e.reConnectNum=0,c(1,"YeIMServer登陆成功,登陆用户:".concat(t.userId)),le(ue.Conversation.fetchConversationList,"GET",{page:1,limit:999999}).then((function(e){$e(e.records)})).catch((function(e){c(1,e)})),bt(),_t(),pe(),e.uni){e.defaults.notification.autoPermission&&function(){var e=uni.getDeviceInfo();if("app"==e.uniPlatform&&"android"==e.osName){var t=plus.android.runtimeMainActivity(),r=t.getPackageName(),n=t.getApplicationInfo().plusGetAttribute("uid"),o=plus.android.importClass("android.support.v4.app.NotificationManagerCompat");null==o&&(o=plus.android.importClass("androidx.core.app.NotificationManagerCompat"));var i=o.from(t).areNotificationsEnabled(),s=uni.getStorageSync("first_flag")||!1;i||s||(uni.setStorageSync("first_flag",!0),uni.showModal({title:"通知权限开启提醒",content:"您还没有开启通知权限,无法接受到消息通知,请前往设置!",showCancel:!1,confirmText:"去设置",success:function(e){if(e.confirm){var o=plus.android.importClass("android.content.Intent"),i=plus.android.importClass("android.os.Build");if(26>i.VERSION.SDK_INT)if(21>i.VERSION.SDK_INT){a.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);var s=Uri.fromParts("package",mainActivity.getPackageName(),null);a.setData(s)}else{var a;(a=new o("android.settings.APP_NOTIFICATION_SETTINGS")).putExtra("app_package",r),a.putExtra("app_uid",n)}else(a=new o("android.settings.APP_NOTIFICATION_SETTINGS")).putExtra("android.provider.extra.APP_PACKAGE",r);t.startActivity(a)}}}))}else if("app"==e.uniPlatform&&"ios"==e.osName){var a=0,c=plus.ios.invoke("UIApplication","sharedApplication"),d=plus.ios.invoke(c,"currentUserNotificationSettings");d?(a=d.plusGetAttribute("types"),plus.ios.deleteObject(d)):a=plus.ios.invoke(c,"enabledRemoteNotificationTypes"),plus.ios.deleteObject(c),0==(0!=a)&&uni.showModal({title:"通知权限开启提醒",content:"您还没有开启通知权限,无法接受到消息通知,请前往设置!",showCancel:!1,confirmText:"去设置",success:function(e){if(e.confirm){var t=plus.ios.invoke("UIApplication","sharedApplication"),r=plus.ios.invoke("NSURL","URLWithString:","app-settings:");plus.ios.invoke(t,"openURL:",r),plus.ios.deleteObject(r),plus.ios.deleteObject(t)}}})}}(),function(){var e=uni.getDeviceInfo();if("app"==e.uniPlatform&&"android"==e.osName&&de.defaults.notification&&de.defaults.notification.oppoChannelId&&plus.android.importClass("android.os.Build").VERSION.SDK_INT>=26){var t=de.defaults.notification.oppoChannelId,r=plus.android.runtimeMainActivity(),n=plus.android.importClass("android.content.Context"),o=plus.android.importClass("android.app.NotificationManager"),i=r.getSystemService(n.NOTIFICATION_SERVICE),s=i.getNotificationChannel(t),a=plus.android.importClass("android.app.NotificationChannel"),c=plus.android.importClass("android.app.Notification");if(s&&i.deleteNotificationChannel(s),!s||null==s||"null"==s||null==s){var d=new a(t,"聊天离线通知",o.IMPORTANCE_HIGH);d.setDescription("用于用户离线时推送消息通知"),d.enableVibration(!0),d.enableLights(!0),d.setBypassDnd(!0),d.setLockscreenVisibility(c.VISIBILITY_SECRET),i.createNotificationChannel(d)}}}(),n=uni.getDeviceInfo(),de.checkLogged()&&"app"==n.uniPlatform&&plus.push.getClientInfoAsync((function(e){var t=e.clientid;t&&le(ue.Push.bindClientId,"GET",{clientId:t}).then((function(){c(0,"注册APP用户离线通知推送标识符成功,当前获取的cid为:"+t)})).catch((function(e){c(1,"注册APP用户离线通知推送标识符异常:"+e.message)}))}));var d=[];uni.onPushMessage((function(t){if(!e.inApp&&"receive"==t.type){var r=t.data.__UUID__;d.indexOf(r)>0||(d.push(r),uni.createPushMessage({title:t.data.title,content:t.data.content,sound:"system",success:function(){},fail:function(){}}))}}))}return f(t,a.NORMAL_SUCCESS.describe,i)}return h(t,a.LOGIN_ERROR.code,a.LOGIN_ERROR.describe)}))}},{key:"disConnect",value:function(){this.allowReconnect=!1,this.webSocket.close(),this.webSocket.destroy()}},{key:"reConnect",value:function(){var e=this;if(this.allowReconnect&&!this.lockReconnect){if(!this.userId||!this.token)return void(this.allowReconnect=!1);if(this.defaults.reConnectTotal>0&&this.reConnectNum>=this.defaults.reConnectTotal)return void(this.allowReconnect=!1);this.reConnectNum++,this.lockReconnect=!0,g(s.EVENT.NET_CHANGED,"connecting"),setTimeout((function(){c(1,"WebSocket 正在进行第".concat(e.reConnectNum,"次重连"));try{e.connect({userId:e.userId,token:e.token})}catch(e){console.log(e)}e.lockReconnect=!1}),this.defaults.reConnectInterval)}}},{key:"readyState",value:function(){return this.webSocket&&this.webSocket.socketTask?this.webSocket.socketTask.readyState:3}},{key:"startHeartTimer",value:function(){var e=this;this.clearHeartTimer(),this.webSocket&&this.webSocket.socketTask&&(this.heartTimer=setTimeout((function(){if(1==e.readyState()){e.webSocket.send({type:"heart",data:"ping"}),e.checkTimer=setTimeout((function(){e.webSocket.close()}),e.defaults.heartInterval)}}),this.defaults.heartInterval))}},{key:"clearHeartTimer",value:function(){return clearTimeout(this.heartTimer),clearTimeout(this.checkTimer),this}},{key:"socketOpen",value:function(e){c(1,"WebSocket成功连接"),g(s.EVENT.NET_CHANGED,"connected")}},{key:"socketClose",value:function(e){c(1,"WebSocket断开连接"),this.socketLogged=!1,this.webSocket.close(),this.webSocket.destroy(),g(s.EVENT.NET_CHANGED,"closed"),this.reConnect()}},{key:"socketError",value:function(e){c(1,e),this.reConnect()}},{key:"socketMessage",value:function(e){if(c(0,e),this.startHeartTimer(),this.socketLogged){var t=JSON.parse(e.data);t?this.socketMessageHandle(t):c(1,e)}}},{key:"socketMessageHandle",value:function(e){if(200==e.code){var t=e.data;He(t),g(s.EVENT.MESSAGE_RECEIVED,t)}else if(203==e.code){!function(e){var t=Pe("yeim:conversationList:".concat(w(de.userId))),r=(t=t||[]).findIndex((function(t){return t.conversationId===e.conversationId}));-1===r||t.splice(r,1),t.unshift(e),$e(t)}(e.data)}else if(205==e.code){!function(e){if(!e)return c(1,"conversationId 为空,无法继续执行");var t="yeim:messageList:".concat(w(de.userId),":conversationId:").concat(w(e)),r=Pe(t);if(r=r||[]){for(var n=[],o=0;r.length>o;o++){var i=r[o];"out"==i.direction&&(i.isRead=1,r[o].isRead=1,n.push(i))}Le(t,r),g(s.EVENT.PRIVATE_READ_RECEIPT,{conversationId:e,list:n})}}(e.data.conversationId)}else 207==e.code?function(e){var t="yeim:messageList:".concat(w(de.userId),":conversationId:").concat(w(e.conversationId)),r=Pe(t)?Pe(t):[],n=(r=r||[]).findIndex((function(t){return t.messageId===e.messageId}));-1!==n&&(r[n]=e,Le(t,r)),g(s.EVENT.MESSAGE_REVOKED,e)}(e.data):208==e.code?setTimeout((function(){bt()}),500):209==e.code?setTimeout((function(){_t()}),500):210==e.code?(g(s.EVENT.FRIEND_APPLY_REFUSE,e.data),setTimeout((function(){_t(1)}),500)):10009==e.code&&(this.allowReconnect=!1,this.clearHeartTimer(),this.webSocket.close(),g(s.EVENT.KICKED_OUT,!0),c(1,"用户:".concat(this.userId," 由于多个实例同时登录被踢出")))}},{key:"checkLogged",value:function(){return!!(this.socketLogged&&this.userId&&this.token)}},{key:"intoApp",value:function(){this.inApp=!0}},{key:"leaveApp",value:function(){this.inApp=!1}}],[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"undefined"!=typeof uni&&uni.$YeIMInstance&&(de=uni.$YeIMInstance),de||(t.baseURL&&t.socketURL?(de=new e(t),"undefined"!=typeof uni&&(uni.$YeIMInstance=de),e.prototype.createTextMessage=Te,e.prototype.createTextAtMessage=Ne,e.prototype.createImageMessage=Me,e.prototype.createImageMessageFromUrl=Ue,e.prototype.createAudioMessage=ke,e.prototype.createAudioMessageFromUrl=we,e.prototype.createVideoMessage=Ge,e.prototype.createVideoMessageFromUrl=xe,e.prototype.createLocationMessage=Ce,e.prototype.createCustomMessage=De,e.prototype.createMergerMessage=Xe,e.prototype.createForwardMessage=Be,e.prototype.upload=Ie,e.prototype.sendMessage=Fe,e.prototype.getHistoryMessageList=Ye,e.prototype.revokeMessage=qe,e.prototype.deleteMessage=Ke,e.prototype.getConversation=ze,e.prototype.getConversationList=Je,e.prototype.clearConversationUnread=Qe,e.prototype.deleteConversation=Ze,e.prototype.getUserInfo=Rt,e.prototype.updateUserInfo=gt,e.prototype.getBlackUserList=yt,e.prototype.addToBlackUserList=Et,e.prototype.removeFromBlacklist=mt,e.prototype.addEventListener=y,e.prototype.removeEventListener=E,e.prototype.createGroup=et,e.prototype.dissolveGroup=tt,e.prototype.updateGroup=nt,e.prototype.getGroup=ot,e.prototype.transferLeader=rt,e.prototype.getGroupList=it,e.prototype.joinGroup=st,e.prototype.leaveGroup=at,e.prototype.addGroupUsers=ct,e.prototype.getGroupUserList=ut,e.prototype.removeGroupUsers=dt,e.prototype.setAdminstrator=lt,e.prototype.setMute=pt,e.prototype.getGroupApplyList=ft,e.prototype.handleApply=ht,e.prototype.getFriendList=vt,e.prototype.getFriendApplyList=It,e.prototype.setApplyListRead=Ot,e.prototype.acceptApply=St,e.prototype.refuseApply=At,e.prototype.addFriend=Pt,e.prototype.deleteFriend=Lt,e.prototype.updateFriend=Tt,c(1,"============= YeIMUniSDK 初始化成功!版本号:"+de.version+" ============="),de):console.error(a.SDK_PARAMS_ERROR.describe))}},{key:"getInstance",value:function(){if("undefined"!=typeof uni&&uni.$YeIMInstance&&(de=uni.$YeIMInstance),de)return de;console.error("SDK未初始化,无法获取实例化对象")}}]),e}();export{Ut as YeIMUniSDK,s as YeIMUniSDKDefines,de as instance};