!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(window,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(o,i,function(e){return t[e]}.bind(null,i));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=17)}([function(t,e,n){(function(o){function i(){try{return e.storage.debug}catch(t){}if(void 0!==o&&"env"in o)return o.env.DEBUG}(e=t.exports=n(25)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(){var t=arguments,n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),!n)return t;var o="color: "+this.color;t=[t[0],o,"color: inherit"].concat(Array.prototype.slice.call(t,1));var i=0,s=0;return t[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(i++,"%c"===t&&(s=i))}),t.splice(s,0,o),t},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=i,e.useColors=function(){return"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(i())}).call(this,n(24))},function(t,e,n){function o(t){if(t)return function(t){for(var e in o.prototype)t[e]=o.prototype[e];return t}(t)}t.exports=o,o.prototype.on=o.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},o.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o,i=0;i0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},o.prototype.cleanup=function(){u("cleanup");for(var t=this.subs.length,e=0;e=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();u("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(u("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(u("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(u("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},o.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){function o(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,i.call(this,t)}var i=n(11),s=n(2),r=n(12),a=n(33),c=n(34),p=n(0)("engine.io-client:websocket");t.exports=o,a(o,i),o.prototype.name="wx",o.prototype.supportsBinary=!0,o.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e={agent:this.agent,perMessageDeflate:this.perMessageDeflate};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(e.headers=this.extraHeaders),this.localAddress&&(e.localAddress=this.localAddress),this.isOk=!1,this.ws=wx,this.ws.connectSocket({url:t}),void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},o.prototype.addEventListeners=function(){var t=this;this.ws.onSocketOpen(function(){t.onOpen(),t.isOk=!0}),this.ws.onSocketClose(function(){t.onClose(),t.isOk=!1}),this.ws.onSocketMessage(function(e){t.onData(e.data)}),this.ws.onSocketError(function(e){t.onError("websocket error",e)})},o.prototype.write=function(t){var e=this;this.writable=!1;for(var n=t.length,o=0,i=n;o=s.RECEIPT_REPORT_MAX_SIZE&&e._receiptReport()},50),n}console.error("msg_ids is not Array type or msg_ids size=0")},h.prototype.addSingleReceiptReport=function(t){this.__checkLogin();var e=this;if(t.msg_ids instanceof Array&&0!==t.msg_ids.length){t.appkey||(t.appkey=e.current_appkey),t.type=3,t.key=t.appkey+t.username;var n=new a(t);return e.report.push(n),setTimeout(function(){e._checkReportSize()>=s.RECEIPT_REPORT_MAX_SIZE&&e._receiptReport()},50),n}console.error("msg_ids is not Array type or msg_ids size=0")},h.prototype._checkReportSize=function(){var t=0;return this.report.forEach(function(e){t+=e.args.msg_ids.length}),t},h.prototype.transSingleMsg=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.TRANS_MSG_SINGLE).setData(t).send()},h.prototype.transGroupMsg=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.TRANS_MSG_GROUP).setData(t).send()},h.prototype.transPlatMsg=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.TRANS_MSG_PLATFORM).setData(t).send()},h.prototype.updateConversation=function(t){this.__checkLogin();var e,n=this;t.appkey||(t.appkey=n.current_appkey),t.gid?e=t.gid:t.username&&(e=t.appkey+t.username),e&&t.extras&&(n.conversations[e]||(n.conversations[e]={}),n.conversations[e].extras=t.extras),u.StorageUtils.addItem(n.channel.conversations_key,JSON.stringify(n.conversations))},h.prototype.addGroupMemberResp=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.ADMIN_ADD_GROUP_MEMBER).setData(t).send()},h.prototype.joinGroup=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.APPLY_JOIN_GROUP).setData(t).send()},h.prototype.getAppkeyChatrooms=function(t){return this.__checkLogin(),!t&&(t={}),new r(this.channel).setEvent(s.EVENTS.ROOM_LIST).setData(t).send().addHook(function(t,e){t.result.rooms.forEach(function(t){u.Cache.rooms[t.id]=t}),e&&e(t)})},h.prototype.getSelfChatrooms=function(){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.ROOM_LIST_SELF).setData({}).send().addHook(function(t,e){t.chat_rooms.forEach(function(t){u.Cache.rooms[t.id]=t}),e&&e(t)})},h.prototype.getChatroomInfo=function(t){this.__checkLogin();var e=new r(this.channel);return u.Cache.rooms[t.id]?setTimeout(function(){var n={code:0,message:"success"};n.info=u.Cache.rooms[t.id],e.cleanRespTimeout(),e.success&&e.success(n)},100):e.setEvent(s.EVENTS.ROOM_INFO).setData(t).send().addHook(function(t,e){u.Cache.rooms[t.info.id]=t.info,e&&e(t)}),e},h.prototype.enterChatroom=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.JOIN_ROOM).setData(t).send()},h.prototype.exitChatroom=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.EXIT_ROOM).setData(t).send()},h.prototype.sendChatroomMsg=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===u.Cache.rooms[t.target_rid]?"":u.Cache.rooms[t.target_rid].name),this.__sendMsg({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,content:t.content,extras:t.extras,msg_body:t.msg_body})},h.prototype.sendChatroomPic=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===u.Cache.rooms[t.target_rid]?"":u.Cache.rooms[t.target_rid].name),this.__sendPic({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,file:t.image,extras:t.extras,msg_body:t.msg_body})},h.prototype.sendChatroomFile=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===u.Cache.rooms[t.target_rid]?"":u.Cache.rooms[t.target_rid].name),this.__sendVideoOrFile({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,file:t.file,extras:t.extras,msg_body:t.msg_body},"file")},h.prototype.sendChatroomVideo=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===u.Cache.rooms[t.target_rid]?"":u.Cache.rooms[t.target_rid].name),this.__sendVideoOrFile({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,file:t.file,msg_body:t.msg_body,extras:t.extras},"video")},h.prototype.sendChatroomCustom=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===u.Cache.rooms[t.target_rid]?"":u.Cache.rooms[t.target_rid].name),this.__sendCustom({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,custom:t.custom,extras:t.extras,msg_body:t.msg_body})},h.prototype.sendChatroomLocation=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===u.Cache.rooms[t.target_rid]?"":u.Cache.rooms[t.target_rid].name),this.__sendLocation({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,latitude:t.latitude,longitude:t.longitude,scale:t.scale,label:t.label,extras:t.extras,msg_body:t.msg_body})},h.prototype.addGroupMemSilence=function(t){return this.__checkLogin(),t.keep_silence=!0,new r(this.channel).setEvent(s.EVENTS.GROUP_MEM_SILENCE).setData(t).send()},h.prototype.delGroupMemSilence=function(t){return this.__checkLogin(),t.keep_silence=!1,new r(this.channel).setEvent(s.EVENTS.GROUP_MEM_SILENCE).setData(t).send()},h.prototype.dissolveGroup=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.DISSOLVE_GROUP).setData(t).send()},h.prototype.addGroupKeeper=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.ADD_GROUP_KEEPER).setData(t).send()},h.prototype.delGroupKeeper=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.DEL_GROUP_KEEPER).setData(t).send()},h.prototype.changeGroupAdmin=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.CHANGE_GROUP_ADMIN).setData(t).send()},h.prototype.getAppkeyPublicGroups=function(t){return this.__checkLogin(),new r(this.channel).setEvent(s.EVENTS.PUBLIC_GROUP_LIST).setData(t).send().addHook(function(t,e){t.result.groups.forEach(function(t){t.group_type=t.flag,delete t.flag}),e&&e(t)})},h.prototype.isInit=function(){return!!this.current_appkey},h.prototype.isLogin=function(){return!!this.current_user},h.prototype.isConnect=function(){return!!this.channel.client&&!!this.channel.client.connected},h.prototype._addEventListen=function(){var t=this;t.channel.client.on(s.EVENTS.MSG_SYNC,function(e){t._onMsgReceive(e)}),t.channel.client.on(s.EVENTS.EVENT_NOTIFICATION,function(e){t._onEventNotification(e)}),t.channel.client.on(s.EVENTS.SYNC_CONVERSATION,function(e){t._onSyncConversation(e)}),t.channel.client.on(s.EVENTS.SYNC_EVENT,function(e){t._onSyncEvent(e)}),t.channel.client.on(s.EVENTS.SYNC_RECEIPT,function(e){t._onSyncMsgReceipt(e)}),t.channel.client.on(s.EVENTS.RECEIPT_CHANGE,function(e){t._onMsgReceiptChange(e)}),t.channel.client.on(s.EVENTS.TRANS_MSG_REC,function(e){t._onTransMsgRec(e)}),t.channel.client.on(s.EVENTS.ROOM_MSG_SYNC,function(e){t._onRoomMsg(e)}),t.channel.client.on(s.EVENTS.ROOM_MSG_SYNC_HIS,function(e){t._onSyncRoomMsg(e)}),t.channel.client.on("disconnect",function(){t._onDisconnect()})},h.prototype.onRoomMsg=function(t){this._onRoomMsgFn=t},h.prototype._onRoomMsg=function(t){this._onRoomMsgFn&&this._onRoomMsgFn(t)},h.prototype._onSyncRoomMsg=function(t){var e=this;t.messages.forEach(function(n){u.Cache.rooms[n.room_id]||e.getChatroomInfo({id:t.room_id}),n.msgs&&n.msgs.forEach(function(t){e._onRoomMsgFn&&e._onRoomMsgFn(t)})})},h.prototype.onMsgReceive=function(t){this._onMsgReceiveFn=t},h.prototype._onMsgReceive=function(t){var e=this;Array.prototype.push.apply([],t.messages.map(function(t){return{msg_id:t.msg_id,msg_type:t.msg_type,from_uid:t.from_uid,from_gid:t.from_gid}})),t.messages.forEach(function(t){if(t.content.sui_mtime&&e[t.from_uid]&&t.content.sui_mtime>new Date(e[t.from_uid]).getTime()/1e3){e[t.from_uid]=1e3*t.content.sui_mtime;var n={};n.from_username=t.content.from_id,n.from_appkey=t.content.from_appkey,n.mtime=t.content.sui_mtime,delete t.content.sui_mtime,e._updateInfoEventFun&&e._updateInfoEventFun(n)}var o;3===t.msg_type?(t.key=t.from_uid,t.from_username=t.content.from_id,t.from_appkey=t.content.from_appkey,o=t.from_appkey+t.from_username):(t.key=t.from_gid,o=String(t.from_gid)),0===t.msg_level?t.msg_level="normal":1===t.msg_level&&(t.msg_level="across");var i=!1;t.from_appkey===e.current_appkey&&t.from_username===e.current_user&&(i=!0,o=(void 0===t.content.target_appkey||""===t.content.target_appkey?t.content.from_appkey:t.content.target_appkey)+t.content.target_id);e.lastMsgs[o]={last_msg_time:t.ctime_ms},e.conversations[o]||(e.conversations[o]={},e.conversations[o].extras={},e.conversations[o].unread_msg_count=0,e.conversations[o].msg_time=[]),e.current_conversation===o||i?(e.conversations[o].recent_time=t.ctime_ms,e.conversations[o].unread_msg_count=0,e.conversations[o].msg_time=[]):(e.conversations[o].unread_msg_count=e.conversations[o].unread_msg_count+1,e.conversations[o].msg_time.push(t.ctime_ms)),new r(e.channel).setEvent(s.EVENTS.MSG_RECV_V2).setData({msg_id:t.msg_id,msg_type:t.msg_type,from_uid:t.from_uid,from_gid:t.from_gid}).send()}),u.StorageUtils.addItem(e.channel.conversations_key,JSON.stringify(e.conversations)),this._onMsgReceiveFn&&this._onMsgReceiveFn(t)},h.prototype.onEventNotification=function(t){this._onEventNotificationFn=t},h.prototype._onEventNotification=function(t){var e=this;if(200!==t.event_type){var n=e.__eventDateFilter(t);if(56===t.event_type&&10==t.extra?(n.by_self=!1,delete n.extra):56===t.event_type&&59==t.extra&&(n.by_self=!0,delete n.extra),1===t.event_type){var o={event_id:t.event_id,event_type:t.event_type,from_uid:t.from_uid,gid:t.gid};new r(e.channel).setEvent(s.EVENTS.EVENT_NOTIFICATION).setData(o).send()}e._onEventNotificationFn&&e._onEventNotificationFn(n),-1!=s.LOGIN_OUT_EVENT.indexOf(t.event_type)&&e.loginOut()}else 3===t.description.type?e._dealMutlReadEvent(t.description.type,t.ctime_ms,t.description.appkey,t.description.username):e._dealMutlReadEvent(t.description.type,t.ctime_ms,t.description.gid)},h.prototype.onSyncConversation=function(t){this._onSyncConversationFn=t},h.prototype._onSyncConversation=function(t){var e=this;e.channel.sync_key=t.sync_key,t.messages&&(t.messages.forEach(function(t){var n,o=0;n=3===t.msg_type?t.from_appkey+t.from_username:String(t.from_gid);var i=t.msgs[t.msgs.length-1].ctime_ms;if(e.current_conversation===n)e.conversations[n]=void 0===e.conversations[n]?{}:e.conversations[n],e.conversations[n].unread_msg_count=o,e.conversations[n].recent_time=i,e.conversations[n].msg_time=[];else if(e.conversations[n]&&e.conversations[n].recent_time){var r=e.conversations[n].recent_time;t.msgs.forEach(function(t){t.ctime_ms<=r||t.content.from_appkey===e.current_appkey&&t.content.from_id===e.current_user?(o=0,e.conversations[n].msg_time=[]):(o++,e.conversations[n].msg_time.push(t.ctime_ms))}),e.channel.sync_type===s.SYNC_TYPE_OPEN?e.conversations[n].unread_msg_count=o:e.conversations[n].unread_msg_count+=o}else o=t.unsync_count,e.conversations[n]=void 0===e.conversations[n]?{}:e.conversations[n],e.conversations[n].unread_msg_count=o,t.msgs.length-1-o<0?e.conversations[n].recent_time=-1:e.conversations[n].recent_time=t.msgs[t.msgs.length-1-o].ctime_ms,e.conversations[n].msg_time=[];e.lastMsgs[n]={last_msg_time:i},delete t.unsync_count,t.unread_msg_count=o}),u.StorageUtils.addItem(e.channel.conversations_key,JSON.stringify(e.conversations)),e._onSyncConversationFn&&t.messages.length>0&&e._onSyncConversationFn(t.messages));var n={sync_key:e.channel.sync_key};new r(e.channel).setEvent(s.EVENTS.SYNC_CONVERSATION_ACK).setData(n).send()},h.prototype.onSyncEvent=function(t){this._onSyncEventFn=t},h.prototype._onSyncEvent=function(t){var e=this;e.channel.sync_event_key=t.sync_key,u.StorageUtils.addItem(e.channel.event_key,t.sync_key);var n={sync_key:e.channel.sync_event_key};new r(e.channel).setEvent(s.EVENTS.SYNC_EVENT_ACK).setData(n).send(),setTimeout(function(){if(e._onSyncEventFn&&t.events&&t.events.length>0){var n=[];t.events.forEach(function(o){if(200===o.event_type)3===o.description.type?e._dealMutlReadEvent(o.description.type,o.ctime_ms,o.description.appkey,o.description.username):e._dealMutlReadEvent(o.description.type,o.ctime_ms,o.description.gid);else{var i=e.__eventDateFilter(o);56===t.event_type&&10==t.extra?(delete i.extra,i.by_self=!1):56===t.event_type&&59==t.extra&&(delete i.extra,i.by_self=!0),n.push(i)}}),e._onSyncEventFn(n)}},1700)},h.prototype.onSyncMsgReceipt=function(t){this._onSyncMsgReceiptFn=t},h.prototype._onSyncMsgReceipt=function(t){var e=this;if(e.channel.msg_receipt_key=t.sync_key,e._onSyncMsgReceiptFn&&t.receipts&&t.receipts.length>0){var n={},o=[];t.receipts.forEach(function(t){var e=t.gid;if(3===t.type&&(e=t.appkey+t.username),n[e]){var i=Number(n[e]);Array.prototype.push.apply(o[i].receipt_msgs,t.receipt_msgs)}else t.receipt_msgs.length>0&&(n[e]=String(o.length),o.push(t))}),setTimeout(function(){e._onSyncMsgReceiptFn&&o.length>0&&e._onSyncMsgReceiptFn(o)},1500)}var i={sync_key:e.channel.msg_receipt_key};new r(e.channel).setEvent(s.EVENTS.SYNC_RECEIPT_ACK).setData(i).send()},h.prototype.onMsgReceiptChange=function(t){this._onMsgReceiptChangeFn=t},h.prototype._onMsgReceiptChange=function(t){this._onMsgReceiptChangeFn&&this._onMsgReceiptChangeFn(t)},h.prototype.onUserInfUpdate=function(t){this._updateInfoEventFun=t},h.prototype.onMutiUnreadMsgUpdate=function(t){this._conversationUpdateFun=t},h.prototype.onTransMsgRec=function(t){this._onTransMsgRecFn=t},h.prototype._onTransMsgRec=function(t){this._onTransMsgRecFn&&this._onTransMsgRecFn(t)},h.prototype.onDisconnect=function(t){this._onDisconnectFn=t},h.prototype._onDisconnect=function(){var t=this;clearTimeout(t.syncTask),clearTimeout(t.msgReceipTask),t.autoDiscon&&(t.current_appkey=null,t.current_user=null,t._onDisconnectFn&&t._onDisconnectFn())},h.prototype._dealMutlReadEvent=function(t,e,n,o){var i,s=this,r={};if(r.type=t,3===t?(i=n+o,r.username=o,r.appkey=n):(i=String(n),r.gid=n),s.conversations[i]=void 0===s.conversations[i]?{msg_time:[],unread_msg_count:0}:s.conversations[i],s.conversations[i].recent_time=e,s.current_conversation===i)s.conversations[i].unread_msg_count=0,s.conversations[i].msg_time=[];else{var a=s.conversations[i].unread_msg_count,c=s.conversations[i].msg_time,p=[],h=0;c.forEach(function(t){t>e&&(h++,p.push(t))}),s.conversations[i].msg_time=p,h0){var e={},n=[];t.report.forEach(function(t){if(e[t.args.key]){var o=Number(e[t.args.key]);Array.prototype.push.apply(n[o].result.msg_ids,t.args.msg_ids),n[o].msg_reports.push(t)}else e[t.args.key]=String(n.length),n.push({result:t.args,msg_reports:[t]})}),t.report=[];for(var o=0;o>8-r%1*8)){if((i=s.charCodeAt(r+=.75))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|i}return c}),n.atob||(n.atob=function(e){var n=String(e).replace(/=+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,s,r=0,a=0,c="";s=n.charAt(a++);~s&&(i=r%4?64*i+s:s,r++%4)?c+=String.fromCharCode(255&i>>(-2*r&6)):0)s=o.indexOf(s);return c})}()},function(t,e,n){"use strict";var o=n(1),i=n(22),s=n(5),r=function(t){this.opts=t};r.prototype.init=function(t){this.opts=t,this.dataCache={},this.memStore={},this.sync_key=0,this.sync_type=0,null!=this.client&&this.client.close(),this.client=i(this.opts.address,{transports:["websocket","polling"]});var e=this,n=o.prototype.emit,s=this.client.onevent;this.client.onevent=function(t){var o=t.data||[];s.call(e.client,t),n.apply(e.client,["*"].concat(o))},this.client.on("*",function(t,n){e.onReceive(t,n)})},r.prototype.onReceive=function(t,e){if(this.opts.debug&&console.log("---<- event:%s, data:%s",t,JSON.stringify(e)),t!==s.EVENTS.EVENT_NOTIFICATION&&t!==s.EVENTS.MSG_SYNC&&t!==s.EVENTS.SYNC_CONVERSATION&&t!==s.EVENTS.SYNC_EVENT&&t!==s.EVENTS.SYNC_RECEIPT&&t!==s.EVENTS.RECEIPT_CHANGE&&t!==s.ROOM_MSG_SYNC&&t!==s.ROOM_MSG_SYNC_HIS){var n=this.dataCache[e.rid];delete e.rid,n&&(0===e.code&&t===s.EVENTS.GET_GROUP_MEMBERS?e.member_list.forEach(function(t){n.userInfoGet&&n.userInfoGet(t.uid,t.mtime),delete t.uid,delete t.mtime}):0===e.code&&t===s.EVENTS.GET_CONVERSATIONS?e.conversations.forEach(function(t){3===t.type&&(n.userInfoGet&&n.userInfoGet(t.key,t.utime),delete t.utime)}):0===e.code&&t===s.EVENTS.GET_FRIEND_LIST?e.friend_list.forEach(function(t){n.userInfoGet&&n.userInfoGet(t.uid,1e3*t.mtime),delete t.uid}):0===e.code&&t===s.EVENTS.GET_BLACK_LIST&&e.black_list.forEach(function(t){delete t.uid}),t===s.EVENTS.ACK?(n.ack&&n.ack({rid:e.rid,data:n.data}),n.cleanAckTimeout()):(n.cleanRespTimeout(),delete this.dataCache[n.rid],e.code&&0!==e.code?n.fail&&n.fail(e):t!=s.EVENTS.S_SINGLE_TEXT_&&t!=s.EVENTS.SEND_GROUP_MSG&&t!=s.EVENTS.SEND_ROOM_MSG?n.hook?n.hook(e,n.success):n.success&&n.success(e):(n.data.msg_id=e.msg_id,t===s.EVENTS.S_SINGLE_TEXT_&&(e.target_username=n.data.content.target_id,e.appkey=n.data.appkey),n.success&&n.success(e,n.data),n.innerCall&&n.innerCall(e.msg_id))))}},r.prototype.generateRid=function(){for(var t=Math.floor(-2147483646*Math.random()+2147483647);this.dataCache[t];)t=Math.floor(-2147483646*Math.random()+2147483647);return t},r.prototype.send=function(t,e){this.opts.debug&&console.log("---\x3e- event:%s, data:%s",t,JSON.stringify(e)),this.client.emit(t,e)},t.exports=r},function(t,e,n){function o(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,o=i(t),s=o.source,p=o.id,u=o.path,h=c[p]&&u in c[p].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||h?(a("ignoring socket cache for %s",s),n=r(s,e)):(c[p]||(a("new io instance for %s",s),c[p]=r(s,e)),n=c[p]),o.query&&!e.query?e.query=o.query:e&&"object"==typeof e.query&&(e.query=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}(e.query)),n.socket(o.path,e)}var i=n(23),s=n(3),r=n(9),a=n(0)("socket.io-client");t.exports=e=o;var c=e.managers={};e.protocol=s.protocol,e.connect=o,e.Manager=n(9),e.Socket=n(14)},function(t,e,n){var o=n(6),i=n(0)("socket.io-client:url");t.exports=function(t,e){var n=t;null==t&&(t=e.protocol+"//"+e.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?e.protocol+t:e.host+t),/^(https?|wss?):\/\//.test(t)||(i("protocol-less url %s",t),t=void 0!==e?e.protocol+"//"+t:"https://"+t),i("parse %s",t),n=o(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var s=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(e&&e.port===n.port?"":":"+n.port),n}},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(t){if(p===setTimeout)return setTimeout(t,0);if((p===n||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function s(){l&&_&&(l=!1,_.length?f=_.concat(f):d=-1,f.length&&r())}function r(){if(!l){var t=i(s);l=!0;for(var e=f.length;e;){for(_=f,f=[];++d1)for(var n=1;n0)return function(t){if(!((t=String(t)).length>1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*c;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*r;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===o&&!1===isNaN(t))return e.long?n(t):function(t){return t>=a?Math.round(t/a)+"d":t>=r?Math.round(t/r)+"h":t>=s?Math.round(t/s)+"m":t>=i?Math.round(t/i)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e){function n(t){if(t)return function(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}(t)}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){o.off(t,n),e.apply(this,arguments)}var o=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var o,i=0;i1?{type:s[o],data:t.substring(1)}:{type:s[o]}:r}}},function(t,e){t.exports=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var o in t)n.call(t,o)&&e.push(o);return e}},function(t,e){t.exports=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";function o(t){var e="";do{e=r[t%a]+e,t=Math.floor(t/a)}while(t>0);return e}function i(){var t=o(+new Date);return t!==s?(p=0,s=t):t+"."+o(p++)}for(var s,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,c={},p=0,u=0;u0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}},function(t,e,n){"use strict";var o=n(5),i=function(t){this.channel=t,this.rid=this.channel.generateRid(),this.times=1};i.prototype.setEvent=function(t){return this.event=t,this},i.prototype.setData=function(t){return this.data=t,this},i.prototype.onSuccess=function(t){return"function"==typeof t&&(this.success=t),this},i.prototype.onFail=function(t){return"function"==typeof t&&(this.fail=t),this},i.prototype.onTimeout=function(t){if("function"==typeof t){this.timeout=t;var e=this;this.respTimeoutTaskId=setTimeout(function(){e.respTimeoutTask()},o.RESP_TIMEOUT)}return this},i.prototype.onAck=function(t){return"function"==typeof t&&(this.ack=t),this},i.prototype.onInnerCall=function(t){return"function"==typeof t&&(this.innerCall=t),this},i.prototype.onUserInfoGet=function(t){return"function"==typeof t&&(this.userInfoGet=t),this},i.prototype.addHook=function(t){return"function"==typeof t&&(this.hook=t),this},i.prototype.ackTimeoutTask=function(){if(this.times>16)+(e>>16)+(n>>16)<<16|65535&n}function e(e,n,o,i,s,r){return t(function(t,e){return t<>>32-e}(t(t(n,e),t(i,r)),s),o)}function n(t,n,o,i,s,r,a){return e(n&o|~n&i,t,n,s,r,a)}function o(t,n,o,i,s,r,a){return e(n&i|o&~i,t,n,s,r,a)}function i(t,n,o,i,s,r,a){return e(n^o^i,t,n,s,r,a)}function s(t,n,o,i,s,r,a){return e(o^(n|~i),t,n,s,r,a)}function r(e,r){e[r>>5]|=128<>>9<<4)]=r;var a,c,p,u,h,_=1732584193,f=-271733879,l=-1732584194,d=271733878;for(a=0;a>5]>>>e%32&255);return n}function c(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e>5]|=(255&t.charCodeAt(e/8))<>>4&15)+o.charAt(15&e);return i}function u(t){return unescape(encodeURIComponent(t))}function h(t){return function(t){return a(r(c(t),8*t.length))}(u(t))}function _(t,e){return function(t,e){var n,o,i=c(t),s=[],p=[];for(s[15]=p[15]=void 0,i.length>16&&(i=r(i,8*t.length)),n=0;n<16;n+=1)s[n]=909522486^i[n],p[n]=1549556828^i[n];return o=r(s.concat(c(e)),512+8*e.length),a(r(p.concat(o),640))}(u(t),u(e))}return function(t,e,n){return e?n?_(e,t):function(t,e){return p(_(t,e))}(e,t):n?h(t):function(t){return p(h(t))}(t)}}},function(t,e,n){"use strict";var o={isBlack:function(t){return!(t&&"string"==typeof t&&t.length>0)}},i={addItem:function(t,e){wx.setStorage({key:t.toString(),data:e})},removeItems:function(t){wx.getStorageInfo({success:function(e){var n=e.keys,o=[];n.forEach(function(e){try{wx.getStorageSync(e)===t&&o.push(e)}catch(t){}}),o.forEach(function(t){wx.removeStorage({key:t,success:function(t){}})})}})},getItem:function(t){return wx.getStorageSync(t)}},s={delRepeatItem:function(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t)&&null!=t&&e.push(t)}),e}},r={rooms:{}};t.exports={StringUtils:o,StorageUtils:i,ArrayUtils:s,Cache:r}}])});