1234 |
- /*eslint-disable*/
- 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 o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,r||"default");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"===e(r)?r:r+""}function r(e,r,o){return(r=t(r))in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var o=0;r.length>o;o++){var n=r[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,t(n.key),n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(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==ce.defaults.logLevel)r?console.error("【YeIMUniSDK Log】",t):console.log("【YeIMUniSDK Log】",t);else{if(2==ce.defaults.logLevel)return;1==e&&(r?console.error("【YeIMUniSDK Log】",t):console.log("【YeIMUniSDK Log】",t))}}var d=function(){function e(t){var n=this;o(this,e),r(this,"socketTask",void 0),r(this,"onMessageCallBack",[]),ce.uni?this.socketTask=uni.connectSocket({url:t,success:function(){},fail:function(){},complete:function(){}}):(this.socketTask=new WebSocket(t),this.socketTask.onmessage=function(e){if(n.onMessageCallBack)for(var t=0;n.onMessageCallBack.length>t;t++)n.onMessageCallBack[t](e)})}return i(e,[{key:"onOpen",value:function(e){try{ce.uni?this.socketTask.onOpen(e):this.socketTask.onopen=e}catch(e){c(0,e,!0)}}},{key:"onClose",value:function(e){try{ce.uni?this.socketTask.onClose(e):this.socketTask.onclose=e}catch(e){c(0,e,!0)}}},{key:"onError",value:function(e){try{ce.uni?this.socketTask.onError(e):this.socketTask.onerror=e}catch(e){c(0,e,!0)}}},{key:"onMessage",value:function(e){try{ce.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(ce.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,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;try{null!=e&&void 0!==e.success&&"function"==typeof e.success&&e.success(u(o,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,o=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,o))}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 o=e.get(t);o?o.push(r):e.set(t,[r])},off:function(t,r){var o=e.get(t);o&&(r?o.splice(o.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var o=e.get(t);o&&o.slice().map((function(e){e(r)})),(o=e.get("*"))&&o.slice().map((function(e){e(t,r)}))}}};var R=p;function g(e,t){ce.emitter.emit(ce.defaults.eventPrefix+e,t)}function y(e,t){e&&ce.emitter.on(ce.defaults.eventPrefix+e,t)}function E(e,t){e&&ce.emitter.off(ce.defaults.eventPrefix+e,t)}function m(e,t,r,o,n,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(o,n)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(o,n){var i=e.apply(t,r);function s(e){m(i,o,n,s,a,"next",e)}function a(e){m(i,o,n,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 o},e.exports.__esModule=!0,e.exports.default=e.exports;var o={},n=Object.prototype,i=n.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,o){var n=Object.create((t&&t.prototype instanceof R?t:R).prototype),i=new L(o||[]);return s(n,"_invoke",{value:O(e,r,i)}),n}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}o.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!==n&&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 o(n,s,a,c){var d=h(e[n],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){o("next",e,a,c)}),(function(e){o("throw",e,a,c)})):r.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,c)}))}c(d.arg)}var n;s(this,"_invoke",{value:function(e,t){function i(){return new r((function(r,n){o(e,t,r,n)}))}return n=n?n.then(i,i):i()}})}function O(e,t,r){var o="suspendedStart";return function(n,i){if("executing"===o)throw Error("Generator is already running");if("completed"===o){if("throw"===n)throw i;return N()}for(r.method=n,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"===o)throw o="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o="executing";var c=h(e,t,r);if("normal"===c.type){if(o=r.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o="completed",r.method="throw",r.arg=c.arg)}}}function S(e,t){var r=t.method,o=e.iterator[r];if(void 0===o)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 n=h(o,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,p;var i=n.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,o=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:N}}function N(){return{value:void 0,done:!0}}return g.prototype=y,s(b,"constructor",{value:y,configurable:!0}),s(y,"constructor",{value:g,configurable:!0}),g.displayName=l(y,u,"GeneratorFunction"),o.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},o.awrap=function(e){return{__await:e}},_(I.prototype),l(I.prototype,d,(function(){return this})),o.AsyncIterator=I,o.async=function(e,t,r,n,i){void 0===i&&(i=Promise);var s=new I(f(e,t,r,n),i);return o.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},_(b),l(b,u,"Generator"),l(b,c,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),o.keys=function(e){var t=Object(e),r=[];for(var o in t)r.push(o);return r.reverse(),function e(){for(;r.length;){var o=r.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},o.values=T,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,o){return s.type="throw",s.arg=e,t.next=r,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var n=this.tryEntries[o],s=n.completion;if("root"===n.tryLoc)return r("end");if(this.prev>=n.tryLoc){var a=i.call(n,"catchLoc"),c=i.call(n,"finallyLoc");if(a&&c){if(n.catchLoc>this.prev)return r(n.catchLoc,!0);if(n.finallyLoc>this.prev)return r(n.finallyLoc)}else if(a){if(n.catchLoc>this.prev)return r(n.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(n.finallyLoc>this.prev)return r(n.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&i.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var n=o;break}}n&&("break"===e||"continue"===e)&&t>=n.tryLoc&&n.finallyLoc>=t&&(n=null);var s=n?n.completion:{};return s.type=e,s.arg=t,n?(this.method="next",this.next=n.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 o=r.completion;if("throw"===o.type){var n=o.arg;P(r)}return n}}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}},o}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<<t|e>>>32-t},P=function(e,t){var r,o,n,i,s;return n=2147483648&e,i=2147483648&t,s=(1073741823&e)+(1073741823&t),(r=1073741824&e)&(o=1073741824&t)?2147483648^s^n^i:r|o?1073741824&s?3221225472^s^n^i:1073741824^s^n^i:s^n^i},L=function(e,t,r,o,n,i,s){return e=P(e,P(P(function(e,t,r){return e&t|~e&r}(t,r,o),n),s)),P(A(e,i),t)},T=function(e,t,r,o,n,i,s){return e=P(e,P(P(function(e,t,r){return e&r|t&~r}(t,r,o),n),s)),P(A(e,i),t)},N=function(e,t,r,o,n,i,s){return e=P(e,P(P(function(e,t,r){return e^t^r}(t,r,o),n),s)),P(A(e,i),t)},U=function(e,t,r,o,n,i,s){return e=P(e,P(P(function(e,t,r){return t^(e|~r)}(t,r,o),n),s)),P(A(e,i),t)},M=function(e){for(var t,r=e.length,o=r+8,n=16*((o-o%64)/64+1),i=Array(n-1),s=0,a=0;r>a;)s=a%4*8,i[t=(a-a%4)/4]=i[t]|e.charCodeAt(a)<<s,a++;return i[t=(a-a%4)/4]=i[t]|128<<(s=a%4*8),i[n-2]=r<<3,i[n-1]=r>>>29,i},C=function(e){var t,r="",o="";for(t=0;3>=t;t++)r+=(o="0"+(e>>>8*t&255).toString(16)).substr(o.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 o=e.charCodeAt(r);128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128))}return t};function G(e){var t,r,o,n,i,s,a,c,d,u;for(e=k(e+=""),t=M(e),a=1732584193,c=4023233417,d=2562383102,u=271733878,r=0;t.length>r;r+=16)o=a,n=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=U(a,c,d,u,t[r+0],6,4096336452),u=U(u,a,c,d,t[r+7],10,1126891415),d=U(d,u,a,c,t[r+14],15,2878612391),c=U(c,d,u,a,t[r+5],21,4237533241),a=U(a,c,d,u,t[r+12],6,1700485571),u=U(u,a,c,d,t[r+3],10,2399980690),d=U(d,u,a,c,t[r+10],15,4293915773),c=U(c,d,u,a,t[r+1],21,2240044497),a=U(a,c,d,u,t[r+8],6,1873313359),u=U(u,a,c,d,t[r+15],10,4264355552),d=U(d,u,a,c,t[r+6],15,2734768916),c=U(c,d,u,a,t[r+13],21,1309151649),a=U(a,c,d,u,t[r+4],6,4149444226),u=U(u,a,c,d,t[r+11],10,3174756917),d=U(d,u,a,c,t[r+2],15,718787259),c=U(c,d,u,a,t[r+9],21,3951481745),a=P(a,o),c=P(c,n),d=P(d,i),u=P(u,s);return(C(a)+C(c)+C(d)+C(u)).toLowerCase()}var w,x,D,X,B,F=F||function(e,t){var r={},o=r.lib={},n=function(){},i=o.Base={extend:function(e){n.prototype=this;var t=new n;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=o.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,o=this.sigBytes;if(e=e.sigBytes,this.clamp(),o%4)for(var n=0;e>n;n++)t[o+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(o+n)%4*8;else if(r.length>65535)for(n=0;e>n;n+=4)t[o+n>>>2]=r[n>>>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=[],o=0;t>o;o+=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=[],o=0;e>o;o++){var n=t[o>>>2]>>>24-o%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],o=0;t>o;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%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=[],o=0;e>o;o++)r.push(String.fromCharCode(t[o>>>2]>>>24-o%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],o=0;t>o;o++)r[o>>>2]|=(255&e.charCodeAt(o))<<24-o%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=o.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,o=r.words,n=r.sigBytes,i=this.blockSize,a=n/(4*i);a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(n=e.min(4*(t=a*i),n),t){for(var c=0;t>c;c+=i)this._doProcessBlock(o,c);c=o.splice(0,t),r.sigBytes-=n}return new s.init(c,n)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.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=(w=F).lib).WordArray,X=[],B=w.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,o=r[0],n=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=(o<<5|o>>>27)+a+X[c],d=20>c?d+(1518500249+(n&i|~n&s)):40>c?d+(1859775393+(n^i^s)):60>c?d+((n&i|n&s|i&s)-1894007588):d+((n^i^s)-899497514),a=s,s=i,i=n<<30|n>>>2,n=o,o=d}r[0]=r[0]+o|0,r[1]=r[1]+n|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,o=8*e.sigBytes;return t[o>>>5]|=128<<24-o%32,t[14+(o+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(o+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}}),w.SHA1=D._createHelper(B),w.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 o=t.blockSize,n=4*o;r.sigBytes>n&&(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;o>d;d++)a[d]^=1549556828,c[d]^=909522486;i.sigBytes=s.sigBytes=n,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,o=J(this);if(o)return o;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),o=0;t.length>o;o++)r[o]=String.fromCharCode(t[o]);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(oe)}),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,o,n=(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,n||null==e._bodyInit||(n=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=(o=(r=t.method||this.method||"GET").toUpperCase(),te.indexOf(o)>-1?o: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)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("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 oe(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),o=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(n))}})),t}function ne(e,t){if(!(this instanceof ne))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(ne.prototype),ne.prototype.clone=function(){return new ne(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new z(this.headers),url:this.url})},ne.error=function(){var e=new ne(null,{status:0,statusText:""});return e.type="error",e};var ie=[301,302,303,307,308];ne.redirect=function(e,t){if(-1===ie.indexOf(t))throw new RangeError("Invalid status code");return new ne(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(o,n){var i=new re(t,r);if(i.signal&&i.signal.aborted)return n(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(":"),o=r.shift().trim();if(o){var n=r.join(":").trim();t.append(o,n)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;setTimeout((function(){o(new ne(n,r))}),0)},s.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},s.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},s.onabort=function(){setTimeout((function(){n(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)}))}ae.polyfill=!0,j.fetch||(j.fetch=ae,j.Headers=z,j.Request=re,j.Response=ne);var ce,de={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 ue(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(o,n){if(ce.uni)uni.request({url:ce.defaults.baseURL+e,data:r,method:t,header:{"content-type":"application/json",token:null!=ce.token?ce.token:""},success:function(e){if(null==e.data)return n({code:a.NORMAL_ERROR.code,message:e.message?e.message:a.NORMAL_ERROR.describe,data:null});(e=e.data).code===a.NORMAL_SUCCESS.code?o(e.data?e.data:null):n(e)},fail:function(e){c(1,e),n({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!=ce.token?ce.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]?"?":"",o=[];-1==["indices","brackets","repeat","comma"].indexOf(t)&&(t="brackets");var n=function(r){var n=e[r];if(["",void 0,null].indexOf(n)>=0)return"continue";if(n.constructor===Array)switch(t){case"indices":for(var i=0;n.length>i;i++)o.push(r+"["+i+"]="+n[i]);break;case"brackets":default:n.forEach((function(e){o.push(r+"[]="+e)}));break;case"repeat":n.forEach((function(e){o.push(r+"="+e)}));break;case"comma":var s="";n.forEach((function(e){s+=(s?",":"")+e})),o.push(r+"="+s)}else o.push(r+"="+n)};for(var i in e)n(i);return o.length?r+o.join("&"):""}(r,!0),delete i.body),ae(ce.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",n({code:a.NORMAL_ERROR.code,message:r.message?r.message:a.NORMAL_ERROR.describe,data:null}));case 5:r.code===a.NORMAL_SUCCESS.code?o(r.data?r.data:null):n(r);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){c(1,e),n({code:a.NORMAL_ERROR.code,message:JSON.stringify(e.message),data:null})}))}}))}function le(e){return 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?(console.log(111),console.log(t.data),f(e,a.NORMAL_SUCCESS.describe,t.data?t.data:null)):h(e,r,t.message)}},fail:function(t){c(1,t),h(e,a.NORMAL_ERROR.code,t)}})}function fe(e){return 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(t){c(1,t),h(e,a.DOWNLOAD_ERROR.code,a.DOWNLOAD_ERROR.code.describe)}})}function he(){return pe.apply(this,arguments)}function pe(){return(pe=v(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ue(de.Upload.sign,"GET",{});case 2:(t=e.sent).code?c(1,"媒体上传参数获取失败",!0):ce.mediaUploadParams=t;case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(){var e=ce.defaults.baseURL;return"cos"==ce.mediaUploadParams.storage?e="https://".concat(ce.mediaUploadParams.bucket,".cos.").concat(ce.mediaUploadParams.region,".myqcloud.com"):"oss"==ce.mediaUploadParams.storage&&(e="https://".concat(ce.mediaUploadParams.bucket,".").concat(ce.mediaUploadParams.region,".aliyuncs.com")),e}function ge(){return ce.mediaUploadParams.customDomain?ce.mediaUploadParams.customDomain:Re()}function ye(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"files",r=e;if(!ce.mediaUploadParams.baseDir&&"local"===!ce.mediaUploadParams.storage)return r;var o=ce.mediaUploadParams.baseDir,n=new Date,i=t+"/"+(n.getFullYear()+"-"+JSON.stringify(n.getMonth()+1).padStart(2,0)+"-"+JSON.stringify(n.getDate()).padStart(2,0))+"/"+e;if("local"!==ce.mediaUploadParams.storage){if("/"==o.substring(0,1)&&(o=o.substring(1)),"/"===o.substring(o.length-1,o.length)&&(o=o.substring(0,o.length)+o.substring(o.length+1)),!o)return i;r=o+"/"+i}else r=i;return r}function Ee(e,t,r){return me.apply(this,arguments)}function me(){return(me=v(S.mark((function e(t,r,o){var n,i,s,a,c,d,u,l,f,h;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=parseInt((new Date).getTime()/1e3)-1,ce.mediaUploadParams&&ce.mediaUploadParams.expireTime>=n){e.next=4;break}return e.next=4,he();case 4:return a=ce.mediaUploadParams.secretId,c=(i=ce.mediaUploadParams.nowTime)+";"+(s=ce.mediaUploadParams.expireTime),u=ce.mediaUploadParams.signKey,l="sha1"+"\n"+(d=i+";"+s)+"\n"+F.SHA1(t+"\n"+r+"\n\n"+o+"\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 ve(){return be.apply(this,arguments)}function be(){return(be=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,ce.mediaUploadParams&&ce.mediaUploadParams.expireTime>=t){e.next=4;break}return e.next=4,he();case 4:return e.abrupt("return",ce.mediaUploadParams);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _e(e){if(!ce.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(!ce.mediaUploadParams)return h(e,a.PARAMS_ERROR.code,"上传参数异常,暂无法使用此接口");var t=ce.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),o=G((new Date).getTime()+"_"+e.filename)+"_other"+r,n=Re(),i=ge()+"/"+ye(o);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,Ee("post","/","");case 2:r=t.sent,s=le({url:n,name:"file",data:{key:ye(o),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,ve();case 2:s=le({url:n,name:"file",data:{key:ye(o),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=le({url:n+de.Upload.normal,name:"file",data:{key:ye(o)},header:{token:ce.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{url:ge()+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 Ie(e){if(!ce.mediaUploadParams)return h(e,a.PARAMS_ERROR.code,"上传参数异常,暂无法使用此接口");var t=ce.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),o=G((new Date).getTime()+"_"+e.filename)+"_image"+r,n=Re(),i=ge()+"/"+ye(o,"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,Ee("post","/","");case 2:r=t.sent,s=le({url:n,name:"file",data:{key:ye(o,"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 o=198/e.height;t=parseInt(e.height*o),r=parseInt(e.width*o)}else if(e.width>198){var n=198/e.width;t=parseInt(e.height*n),r=parseInt(e.width*n)}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,ve();case 2:s=le({url:n,name:"file",data:{key:ye(o,"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 o=198/e.height;t=parseInt(e.height*o),r=parseInt(e.width*o)}else if(e.width>198){var n=198/e.width;t=parseInt(e.height*n),r=parseInt(e.width*n)}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=le({url:n+de.Upload.image,name:"file",data:{key:ye(o,"image")},header:{token:ce.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{url:ge()+t.data.url,thumbnailUrl:ge()+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 Oe(e){return{conversationId:e.to,conversationType:e.conversationType,fromUserInfo:{nickname:ce.user.nickname,avatarUrl:ce.user.avatarUrl},from:ce.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 Se(e){return ce.uni?uni.getStorageSync(e):localStorage.getItem(e)?JSON.parse(localStorage.getItem(e)):null}function Ae(e,t){ce.uni?uni.setStorageSync(e,t):localStorage.setItem(e,JSON.stringify(t))}function Pe(e){if(!ce.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),Oe(t)}function Le(e){if(!ce.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),Oe(t)}function Te(e){if(!ce.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=Oe(t);return void 0!==e.onProgress&&"function"==typeof e.onProgress&&(r.onProgress=e.onProgress),r}function Ne(e){if(!ce.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),Oe(t)}function Ue(e){if(!ce.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),Oe(t)}function Me(e){if(!ce.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=Oe(t);return void 0!==e.onProgress&&"function"==typeof e.onProgress&&(r.onProgress=e.onProgress),r}function Ce(e){if(!ce.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),Oe(t)}function ke(e){if(!ce.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=Oe(t);return void 0!==e.onProgress&&"function"==typeof e.onProgress&&(r.onProgress=e.onProgress),r}function Ge(e){if(!ce.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),Oe(t)}function we(e){if(!ce.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),Oe(t)}function xe(e){if(!ce.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),Oe(t)}function De(e){if(!ce.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),Oe(t)}function Xe(e){if(!ce.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;(t.body.originalUrl.includes("http://")||t.body.originalUrl.includes("https://")||t.body.originalUrl.includes("ftp://"))&&(t.body.thumbnailUrl.includes("http://")||t.body.thumbnailUrl.includes("https://")||t.body.thumbnailUrl.includes("ftp://"));Ie({filename:ce.token+"_image.png",filepath:t.body.originalUrl,width:t.body.originalWidth,height:t.body.originalHeight,success:function(r){console.log(666),console.log(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,Be(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(t.body.videoUrl.includes("http://")||t.body.videoUrl.includes("https://")||t.body.videoUrl.includes("ftp://"))return Be(e);!function(e){if(!ce.mediaUploadParams)return c(1,"媒体上传参数获取失败",!0);var t=ce.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),o=G((new Date).getTime()+"_"+e.filename)+"_video"+r,n=Re(),i=ge()+"/"+ye(o,"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,Ee("post","/","");case 2:r=t.sent,s=le({url:n,name:"file",data:{key:ye(o,"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,Ee("get","/"+ye(o,"video"),"");case 2:r=t.sent,fe({url:n+"/"+ye(o,"video")+"?ci-process=snapshot&time=1",header:{Authorization:r},success:function(t){Ie({filename:G(o+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,ve();case 2:s=le({url:n,name:"file",data:{key:ye(o,"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=le({url:n+de.Upload.video,name:"file",data:{key:ye(o,"video")},header:{token:ce.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{url:ge()+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:ce.token+"_video.mp4",filepath:t.body.videoUrl,success:function(r){var o=r.data.thumbnailUrl;t.body.videoUrl=r.data.videoUrl,t.body.thumbnailUrl=o,e.message=t,Be(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(t.body.audioUrl.includes("http://")||t.body.audioUrl.includes("https://")||t.body.audioUrl.includes("ftp://"))return Be(e);!function(e){if(!ce.mediaUploadParams)return h(e,a.PARAMS_ERROR.code,"上传参数异常,暂无法使用此接口");var t=ce.mediaUploadParams,r=e.filename.substring(e.filename.lastIndexOf(".")),o=G((new Date).getTime()+"_"+e.filename)+"_audio"+r,n=Re(),i=ge()+"/"+ye(o,"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,Ee("post","/","");case 2:r=t.sent,s=le({url:n,name:"file",data:{key:ye(o,"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,ve();case 2:s=le({url:n,name:"file",data:{key:ye(o,"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=le({url:n+"/upload",name:"file",data:{key:ye(o,"audio")},header:{token:ce.token},filePath:e.filepath,ignoreResult:!1,success:function(t){f(e,a.NORMAL_SUCCESS.describe,{url:ge()+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:ce.token+"_audio.aac",filepath:t.body.audioUrl,success:function(r){t.body.audioUrl=r.data.url,e.message=t,Be(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):Be(e)}function Be(e){ue(de.Message.sendMessage,"POST",e.message).then((function(t){Fe(t),f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message),c(1,t)}))}function Fe(e){if(!e.conversationId)return c(1,"conversationId 不能为空");var t=Ye(e.conversationId),r=t.findIndex((function(t){return t.messageId===e.messageId})),o="yeim:messageList:".concat(G(ce.userId),":conversationId:").concat(G(e.conversationId));-1===r?(t.length>19&&t.splice(0,t.length-19),t.push(e),Ae(o,t)):(t[r]=e,Ae(o,t))}function je(e){if(!ce.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;if(e.limit&&"number"==typeof e.limit&&(t=e.limit),e.nextMessageId){var r=e.nextMessageId,o=Ye(e.conversationId),n=o.findIndex((function(e){return e.messageId===r}));if(-1===n)He(e.conversationId,r,t).then((function(t){f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message)}));else{var i=o[n];if(t>(o=o.slice(0,n)).length){var s=null;He(e.conversationId,s=0==o.length?i.messageId:o[0].messageId,t-o.length).then((function(t){var r=o.concat(t.list);r.sort((function(e,t){return e.sequence-t.sequence})),t.list=r,t.nextMessageId||(t.nextMessageId=s),f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message)}))}else f(e,a.NORMAL_SUCCESS.describe,{list:o,nextMessageId:o[0].messageId})}}else{var c=Ye(e.conversationId);if(t>c.length){var d=null;c.length>0&&(d=c[0].messageId),He(e.conversationId,d,t-c.length).then((function(t){var r=c.concat(t.list);r.sort((function(e,t){return e.sequence-t.sequence})),Ae("yeim:messageList:".concat(G(ce.userId),":conversationId:").concat(G(e.conversationId)),r),t.list=r,t.nextMessageId||(t.nextMessageId=d),f(e,a.NORMAL_SUCCESS.describe,t)})).catch((function(t){h(e,t.code,t.message)}))}else f(e,a.NORMAL_SUCCESS.describe,{list:c,nextMessageId:c[0].messageId})}}function He(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(o,n){ue(de.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),o(t)})).catch((function(e){n(e)}))}))}function Ye(e){var t=Se("yeim:messageList:".concat(G(ce.userId),":conversationId:").concat(G(e)));return(t=t||[]).sort((function(e,t){return e.sequence-t.sequence})),t}function Ve(e){return ce.checkLogged()?e.message?e.message.messageId?void ue(de.Message.deleteMessage,"GET",{messageId:e.message.messageId}).then((function(){e.message.isDeleted=1,Fe(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 We(e){return ce.checkLogged()?e.message?e.message.messageId?void ue(de.Message.revokeMessage,"GET",{messageId:e.message.messageId}).then((function(){e.message.isRevoke=1,Fe(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 Ke(e){if(!ce.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);if(!e)return l(a.PARAMS_ERROR.code,"conversationId 不能为空");var t=Se("yeim:conversationList:".concat(G(ce.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 qe(e){if(!ce.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);var t=e.page,r=e.limit,o=Se("yeim:conversationList:".concat(G(ce.userId))),n=(t-1)*r,i=(o=o||[]).slice(n,o.length>n+r?n+r:o.length);f(e,a.NORMAL_SUCCESS.describe,i)}function ze(e){Ae("yeim:conversationList:".concat(G(ce.userId)),e),g(s.EVENT.CONVERSATION_LIST_CHANGED,e)}function Je(e){if(!ce.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);var t="yeim:conversationList:".concat(G(ce.userId)),r=Se(t),o=(r=r||[]).findIndex((function(t){return t.conversationId===e}));-1!==o&&(r[o].unread=0,Ae(t,r)),ue(de.Conversation.clearConversationUnread,"GET",{conversationId:e}).then((function(){})).catch((function(e){c(1,e)})),g(s.EVENT.CONVERSATION_LIST_CHANGED,r)}function $e(e){if(!ce.checkLogged())return l(a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);var t="yeim:conversationList:".concat(G(ce.userId)),r=Se(t),o=(r=r||[]).findIndex((function(t){return t.conversationId===e}));-1!==o&&(r.splice(o,1),Ae(t,r)),function(e){ce.uni?uni.removeStorageSync(e):localStorage.removeItem(e)}("yeim:messageList:".concat(G(ce.userId),":conversationId:").concat(G(e))),ue(de.Conversation.deleteConversation,"GET",{conversationId:e}).then((function(){})).catch((function(e){c(1,e)})),g(s.EVENT.CONVERSATION_LIST_CHANGED,r)}function Qe(e){return ce.checkLogged()?e.name?e.avatarUrl?void ue(de.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 Ze(e){return ce.checkLogged()?e.groupId?void ue(de.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 et(e){return ce.checkLogged()?e.groupId?e.userId?void ue(de.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 tt(e){return ce.checkLogged()?e.groupId?void ue(de.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 rt(e){return ce.checkLogged()?e.groupId?void ue(de.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 ot(e){if(!ce.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);ue(de.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 nt(e){return ce.checkLogged()?e.groupId?void ue(de.Group.addUser,"POST",{groupId:e.groupId,members:[ce.userId]}).then((function(t){var r=t.group,o=t.successList;if(-1!=t.ignoreList.indexOf(ce.userId))return h(e,a.GROUP_APPLY_REPEAT.code,a.GROUP_APPLY_REPEAT.describe);var n=!1;if(-1!=o.indexOf(ce.userId)&&(n=!0),!n)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 it(e){return ce.checkLogged()?e.groupId?void ue(de.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 st(e){return ce.checkLogged()?e.groupId?e.members&&e.members.length>0?void ue(de.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 at(e){return ce.checkLogged()?e.groupId?e.members&&e.members.length>0?void ue(de.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 ct(e){return ce.checkLogged()?e.groupId?void ue(de.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 dt(e){return ce.checkLogged()?e.groupId?void ue(de.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 ut(e){return ce.checkLogged()?e.groupId?void ue(de.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 lt(e){return ce.checkLogged()?e.id?e.status?void ue(de.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 ft(e){return ce.checkLogged()?e.groupId?e.userId?(e.time||(e.time=0),void ue(de.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 ht(e){if(!ce.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(G(ce.userId));if(e.cloud)ue(de.User.fetchUserInfoById,"GET",{userId:e.userId}).then((function(r){var o=Se(t);(o=o||[]).push(r),Ae(t,o),f(e,a.NORMAL_SUCCESS.describe,r)})).catch((function(t){h(e,t.code,t.message),log(1,t)}));else{var r=Se(t),o=(r=r||[]).findIndex((function(t){return t.userId===e.userId}));-1!==o?(f(e,a.NORMAL_SUCCESS.describe,r[o]),ue(de.User.fetchUserInfoById,"GET",{userId:e.userId}).then((function(e){var r=Se(t);(r=r||[])[o]=e,Ae(t,r)})).catch((function(t){h(e,t.code,t.message),log(1,t)}))):ue(de.User.fetchUserInfoById,"GET",{userId:e.userId}).then((function(r){var o=Se(t);(o=o||[]).push(r),Ae(t,o),f(e,a.NORMAL_SUCCESS.describe,r)})).catch((function(t){h(e,t.code,t.message),log(1,t)}))}}function pt(e){return ce.checkLogged()?Object.keys(e).length>0?void ue(de.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 Rt(e){if(!ce.checkLogged())return h(e,a.LOGIN_EXPIRE.code,a.LOGIN_EXPIRE.describe);ue(de.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 gt(e){return ce.checkLogged()?e.members&&0!=e.members.length?void ue(de.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 yt(e){return ce.checkLogged()?e.members&&0!=e.members.length?void ue(de.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 Et(e){var t="yeim:friendList:".concat(G(ce.userId)),r=e.page?e.page:1,o=e.limit?e.limit:20;if(e.cloud)ue(de.Friend.fetchList,"GET",{profile:e.profile?0:1,page:r,limit:o}).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 n=Se(t),i=(r-1)*o;n=(n=n||[]).slice(i,n.length>i+o?i+o:n.length),f(e,a.NORMAL_SUCCESS.describe,n)}}function mt(){Et({cloud:!0,page:1,limit:9999999,success:function(e){Ae("yeim:friendList:".concat(G(ce.userId)),e.data),g(s.EVENT.FRIEND_LIST_CHANGED,e)},fail:function(){g(s.EVENT.FRIEND_LIST_CHANGED,null)}})}function vt(){bt({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,o=t.unread,n="yeim:friendApplyList:".concat(G(ce.userId)),i="yeim:friendApplyUnread:".concat(G(ce.userId));Ae(n,r),Ae(i,o),g(s.EVENT.FRIEND_APPLY_LIST_CHANGED,e)},fail:function(){g(s.EVENT.FRIEND_APPLY_LIST_CHANGED,null)}})}function bt(e){var t="yeim:friendApplyList:".concat(G(ce.userId)),r="yeim:friendApplyUnread:".concat(G(ce.userId)),o=e.page?e.page:1,n=e.limit?e.limit:20;if(e.cloud)ue(de.Friend.fetchApplyList,"GET",{type:e.type?e.type:0,page:o,limit:n}).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=Se(t),s=(o-1)*n;i=(i=i||[]).slice(s,i.length>s+n?s+n:i.length),f(e,a.NORMAL_SUCCESS.describe,{list:i,unread:Se(r)?Se(r):0})}}function _t(e){ue(de.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 It(e){return ce.checkLogged()?e.id?void ue(de.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 Ot(e){return ce.checkLogged()?e.id?void ue(de.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 St(e){return ce.checkLogged()?e.userId?void ue(de.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 At(e){return ce.checkLogged()?e.members?void ue(de.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 Pt(e){return ce.checkLogged()?e.userId?e.remark||e.extend?void ue(de.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 Lt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function Tt(e){for(var t=1;arguments.length>t;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?Lt(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Lt(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var Nt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),this.defaults=Tt(Tt({baseURL:void 0,socketURL:void 0,eventPrefix:"YeIM_",reConnectTotal:15,reConnectInterval:3e3,heartInterval:3e4,logLevel:0},t),{},{notification:Tt({autoPermission:!1,oppoChannelId:"Default",xiaomiChannelId:"high_system"},t.notification)}),this.uni="undefined"!=typeof uni,this.version="1.2.4",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 o,n=JSON.parse(r.data);if(201==n.code){var i=n.data.user;e.user=i,e.userId=t.userId,e.token=t.token;var s=n.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)),ue(de.Conversation.fetchConversationList,"GET",{page:1,limit:999999}).then((function(e){ze(e.records)})).catch((function(e){c(1,e)})),mt(),vt(),he(),e.uni){e.defaults.notification.autoPermission&&function(){var e=uni.getSystemInfoSync();if("app"==e.uniPlatform&&"android"==e.osName){var t=plus.android.runtimeMainActivity(),r=t.getPackageName(),o=t.getApplicationInfo().plusGetAttribute("uid"),n=plus.android.importClass("android.support.v4.app.NotificationManagerCompat");null==n&&(n=plus.android.importClass("androidx.core.app.NotificationManagerCompat"));var i=n.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 n=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 n("android.settings.APP_NOTIFICATION_SETTINGS")).putExtra("app_package",r),a.putExtra("app_uid",o)}else(a=new n("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.getSystemInfoSync();if("app"==e.uniPlatform&&"android"==e.osName&&ce.defaults.notification&&ce.defaults.notification.oppoChannelId&&plus.android.importClass("android.os.Build").VERSION.SDK_INT>=26){var t=ce.defaults.notification.oppoChannelId,r=plus.android.runtimeMainActivity(),o=plus.android.importClass("android.content.Context"),n=plus.android.importClass("android.app.NotificationManager"),i=r.getSystemService(o.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,"聊天离线通知",n.IMPORTANCE_HIGH);d.setDescription("用于用户离线时推送消息通知"),d.enableVibration(!0),d.enableLights(!0),d.setBypassDnd(!0),d.setLockscreenVisibility(c.VISIBILITY_SECRET),i.createNotificationChannel(d)}}}(),o=uni.getSystemInfoSync(),ce.checkLogged()&&"app"==o.uniPlatform&&plus.push.getClientInfoAsync((function(e){var t=e.clientid;t&&ue(de.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;Fe(t),g(s.EVENT.MESSAGE_RECEIVED,t)}else if(203==e.code){!function(e){var t=Se("yeim:conversationList:".concat(G(ce.userId))),r=(t=t||[]).findIndex((function(t){return t.conversationId===e.conversationId}));-1===r||t.splice(r,1),t.unshift(e),ze(t)}(e.data)}else if(205==e.code){!function(e){if(!e)return c(1,"conversationId 为空,无法继续执行");var t="yeim:messageList:".concat(G(ce.userId),":conversationId:").concat(G(e)),r=Se(t);if(r=r||[]){for(var o=[],n=0;r.length>n;n++){var i=r[n];"out"==i.direction&&(i.isRead=1,r[n].isRead=1,o.push(i))}Ae(t,r),g(s.EVENT.PRIVATE_READ_RECEIPT,{conversationId:e,list:o})}}(e.data.conversationId)}else 207==e.code?function(e){var t="yeim:messageList:".concat(G(ce.userId),":conversationId:").concat(G(e.conversationId)),r=Se(t)?Se(t):[],o=(r=r||[]).findIndex((function(t){return t.messageId===e.messageId}));-1!==o&&(r[o]=e,Ae(t,r)),g(s.EVENT.MESSAGE_REVOKED,e)}(e.data):208==e.code?setTimeout((function(){mt()}),500):209==e.code?setTimeout((function(){vt()}),500):210==e.code?(g(s.EVENT.FRIEND_APPLY_REFUSE,e.data),setTimeout((function(){vt(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&&(ce=uni.$YeIMInstance),ce||(t.baseURL&&t.socketURL?(ce=new e(t),"undefined"!=typeof uni&&(uni.$YeIMInstance=ce),e.prototype.createTextMessage=Pe,e.prototype.createTextAtMessage=Le,e.prototype.createImageMessage=Te,e.prototype.createImageMessageFromUrl=Ne,e.prototype.createAudioMessage=Me,e.prototype.createAudioMessageFromUrl=Ce,e.prototype.createVideoMessage=ke,e.prototype.createVideoMessageFromUrl=Ge,e.prototype.createLocationMessage=Ue,e.prototype.createCustomMessage=we,e.prototype.createMergerMessage=xe,e.prototype.createForwardMessage=De,e.prototype.upload=_e,e.prototype.sendMessage=Xe,e.prototype.getHistoryMessageList=je,e.prototype.revokeMessage=We,e.prototype.deleteMessage=Ve,e.prototype.getConversation=Ke,e.prototype.getConversationList=qe,e.prototype.clearConversationUnread=Je,e.prototype.deleteConversation=$e,e.prototype.getUserInfo=ht,e.prototype.updateUserInfo=pt,e.prototype.getBlackUserList=Rt,e.prototype.addToBlackUserList=gt,e.prototype.removeFromBlacklist=yt,e.prototype.addEventListener=y,e.prototype.removeEventListener=E,e.prototype.createGroup=Qe,e.prototype.dissolveGroup=Ze,e.prototype.updateGroup=tt,e.prototype.getGroup=rt,e.prototype.transferLeader=et,e.prototype.getGroupList=ot,e.prototype.joinGroup=nt,e.prototype.leaveGroup=it,e.prototype.addGroupUsers=st,e.prototype.getGroupUserList=ct,e.prototype.removeGroupUsers=at,e.prototype.setAdminstrator=dt,e.prototype.setMute=ft,e.prototype.getGroupApplyList=ut,e.prototype.handleApply=lt,e.prototype.getFriendList=Et,e.prototype.getFriendApplyList=bt,e.prototype.setApplyListRead=_t,e.prototype.acceptApply=It,e.prototype.refuseApply=Ot,e.prototype.addFriend=St,e.prototype.deleteFriend=At,e.prototype.updateFriend=Pt,c(1,"============= YeIMUniSDK 初始化成功!版本号:"+ce.version+" ============="),ce):console.error(a.SDK_PARAMS_ERROR.describe))}},{key:"getInstance",value:function(){if("undefined"!=typeof uni&&uni.$YeIMInstance&&(ce=uni.$YeIMInstance),ce)return ce;console.error("SDK未初始化,无法获取实例化对象")}}]),e}();export{Nt as YeIMUniSDK,s as YeIMUniSDKDefines,ce as instance};
|