deming/static/goeasy-im-1.1.1.js
2020-08-18 10:43:15 +08:00

2 lines
108 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.GoEasyIM=e():t.GoEasyIM=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var r=n(10);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}},function(t,e,n){var r=n(7),o=n(11);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?o(t):e}},function(t,e,n){var r=n(9);function o(e,n,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=o=Reflect.get:t.exports=o=function(t,e,n){var o=r(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}},o(e,n,i||e)}t.exports=o},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},function(t,e,n){t.exports=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(){if(p()&&!0!==uni.overrideShowHideAlready&&void 0!==getApp().$options){uni.overrideShowHideAlready=!0;var t=getApp().$options,e=t.onShow[0],n=t.onHide[0];t.onShow[0]=function(){getApp().uniAppRunningBackend=!1,e&&e.call(t)},t.onHide[0]=function(){getApp().uniAppRunningBackend=!0,n&&n.call(t)}}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(1),s=n(35),c=function(){this.currentNumber=this.initialCurrentNumber()};c.prototype={maxNumber:parseInt("10"),number:function(){return this.currentNumber},initialCurrentNumber:function(){var t=this;return h()?t.currentNumber=parseInt(a("goeasyNode")):t.currentNumber||(t.currentNumber=f(1,parseInt("10"))),t.currentNumber>0&&t.currentNumber<this.maxNumber?t.currentNumber=t.currentNumber+1:t.currentNumber==this.maxNumber?t.currentNumber=1:t.currentNumber=Math.floor(Math.random()*this.maxNumber+1),h()&&u("goeasyNode",t.currentNumber),t.currentNumber}};var a=function(t){return window.localStorage?window.localStorage.getItem(t):function(t){var e,n=new RegExp("(^| )"+t+"=([^;]*)(;|$)");return(e=document.cookie.match(n))?unescape(e[2]):null}(t)},u=function(t,e){window.localStorage?window.localStorage.setItem(t,e):function(t,e){var n=new Date;n.setTime(n.getTime()+2592e6),document.cookie=t+"="+escape(e)+";expires="+n.toGMTString()}(t,e)},l=function(){Array.apply(this)},f=function(t,e){return Math.floor(Math.random()*(t-e)+e)},p=function(){return!("object"!==("undefined"==typeof uni?"undefined":o(uni))||!uni.getSystemInfo)},h=function(){return p()?"function"==typeof WebSocket&&"function"==typeof XMLHttpRequest:!(d()||"undefined"!=typeof wx&&wx.getLocation&&("function"!=typeof WebSocket||"function"!=typeof XMLHttpRequest)||"object"===("undefined"==typeof tt?"undefined":o(tt))&&tt.getSystemInfo)},d=function(){return"undefined"!=typeof navigator&&"ReactNative"==navigator.product},y=new c,v=function(t){if(JSON.stringify(t),this._isEmpty(t.appkey))void 0!==t.onConnectFailed&&t.onConnectFailed({code:400,content:"appkey is required"});else if(this._copyConfig(t),void 0!==t.host){var e="://"+y.number()+t.host,n="";h()?(n=!1===t.forceTLS?"http"+e+":80":"https"+e+":443",this.socket=i.connect(n,{transports:["polling","websocket"],timeout:1500})):(n="https://wx-"+t.host+":443",this.socket=i(n,{transports:["websocket"],reconnectionDelayMax:3e3})),this._callbackEvents(t)}else t.onConnectFailed({code:400,content:"host is required"})};v.goEasyDomainNumber=y,"undefined"!=typeof window&&(window._GoEasy_=v),Date.prototype.formatDate=function(t){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var n in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),e)e.hasOwnProperty(n)&&new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},(l.prototype=new Array).indexOfGuid=function(t){for(var e=0;e<this.length;e++)if(this[e]==t)return e;return-1},l.prototype.unshiftGuid=function(t){var e=!1,n=this.indexOfGuid(t);for(n>-1&&(e=!0,this.splice(n,1)),this.unshift(t);this.length>300;)this.pop();return e},v.prototype={debug:!1,socket:null,networkStatus:"initial",authorizeResult:null,subscribeBuffer:[],subscriptions:[],subscriptionChannelUUIDs:[],maxRetries:3,_manualConnect:!1,_manualDisconnectStatus:"initial",authorizeStatus:"initial",receivedGuids:new l,_copyConfig:function(t){this._appkey=t.appkey,this._otp=t.otp,this._isEmpty(t.userId)?(this._userId="anonymous-"+Math.floor(1e5*Math.random()+1),t.userId=this._userId):this._userId=this._trim(t.userId),this._isEmpty(t.userData)?this._userData="":this._userData=this._trim(t.userData),1==t.debug&&(this.debug=!0),this._isEmpty(t.type)||(this._type=t.type),this._isEmpty(t.imVersion)||(this._imVersion=t.imVersion)},validateSubscription:function(t){var e=t.channel,n=t.channels;if(void 0===e&&void 0===n)return t.onFailed({code:400,content:"channel is required"}),!1;if(void 0!==e&&void 0!==n)return t.onFailed({code:400,content:"subscribe to either channel or channels, not both"}),!1;if(void 0!==e){if("number"==typeof e&&(e=e.toString()),this._isEmpty(e)&&void 0!==t.onFailed)return t.onFailed({code:400,content:"channel is required"}),!1}else{if(!this._isArray(n)||0===n.length)return t.onFailed({code:400,content:"channels must be an array"}),!1;if(this._isArray(n)&&n.length>500)return t.onFailed({code:400,content:"channels over max length:500"}),!1;if(this._isArray(n)&&n.length>0)for(var r=0;r<n.length;r++){var o=n[r];if("number"==typeof o&&(o=o.toString()),this._isEmpty(o)&&void 0!==t.onFailed)return t.onFailed({code:400,content:"Channels array contains empty channel"}),!1}}return!0},subscribe:function(t){if(r(),JSON.stringify(t),this.validateSubscription(t)){var e=t.channel;if(void 0!==e){"number"==typeof e&&(e=e.toString());var n=[];n.push(e),t.channels=n}this.handleSubscribe(t)}},handleSubscribe:function(t){t.uuid=this.uuid_goeasy(),this.subscribeBuffer[t.uuid]=t;var e=this;null!=e.authorizeResult&&"connected"==e.networkStatus&&(t.checking=!0,e.doSubscribeAndCheckAck(t))},doSubscribe:function(t){JSON.stringify(t);var e=this;if(200==e.authorizeResult.code){var n={channels:t.channels,sid:e.authorizeResult.sid};JSON.stringify(n),e.socket.emit("subscribe",n,(function(n){if(JSON.stringify(n),1!=t.finish)if(t.finish=!0,delete e.subscribeBuffer[t.uuid],JSON.stringify(t),200==n.resultCode){e.subscriptions[t.uuid]=t;for(var r=0;r<t.channels.length;r++){var o=t.channels[r];"number"==typeof o&&(o=o.toString()),e.subscriptionChannelUUIDs[o]=t.uuid}void 0!==t.onSuccess&&t.onSuccess()}else void 0!==t.onFailed&&t.onFailed({code:n.resultCode,content:n.content})}))}else e.authorizeResult.code},doSubscribeAndCheckAck:function(t){JSON.stringify(t),t.finish=!1;var e=this;e.doSubscribe(t);var n=setInterval((function(){t.finish||"connected"!=e.networkStatus?(JSON.stringify(t),t.checking=!1,clearInterval(n)):(JSON.stringify(t),e.doSubscribe(t))}),1300)},subscribePresence:function(t){if(this.validateSubscription(t)){var e=t.channels,n=[];if(this._isArray(e)){for(var r=0;r<e.length;r++){var o=e[r];"number"==typeof o&&(o=o.toString());var i=o+"_presence";n.push(i)}t.channels=n}else{var s=t.channel;"number"==typeof s&&(s=s.toString()),n.push(s+"_presence"),t.channels=n}this.handleSubscribe(t)}},unsubscribe:function(t){function e(){200==o.authorizeResult.code?o.socket.emit("unsubscribe",{sid:o.authorizeResult.sid,channel:t.channel},(function(e){if(i=!0,200==e.resultCode){delete o.subscriptionChannelUUIDs[t.channel];for(var n=o.subscriptions[r].channels,s=0;s<n.length;s++)(t.channel=n[s])&&n.splice(s,1);JSON.stringify(t),void 0!==t.onSuccess&&t.onSuccess()}else void 0!==t.onFailed&&t.onFailed({code:e.resultCode,content:e.content})})):(i=!0,void 0!==t.onFailed&&t.onFailed({code:o.authorizeResult.code,content:o.authorizeResult.content}))}function n(){e();var n=setInterval((function(){!i&&"connected"==o.networkStatus&&s<0?(s++,e()):s==o.maxRetries?(clearInterval(n),void 0!==t.onFailed&&t.onFailed({code:408,content:"Server unreachable or timeout"})):clearInterval(n)}),1e3)}if("number"==typeof t.channel&&(t.channel=t.channel.toString()),this._isEmpty(t.channel))return this.log("'channel' is required."),void(void 0!==t.onFailed&&t.onFailed({code:400,content:"channel is required"}));var r=this.subscriptionChannelUUIDs[t.channel];if(this._isEmpty(r))return this.log("'channel' is not subscribed."),void(void 0!==t.onFailed&&t.onFailed({code:400,content:"channel["+t.channel+"] is not subscribed"}));var o=this,i=!1,s=0;if(null!=this.authorizeResult&&"connected"==o.networkStatus)n();else var c=setInterval((function(){null!=o.authorizeResult&&"connected"==o.networkStatus?(clearInterval(c),n()):++s==o.maxRetries&&(clearInterval(c),void 0!==t.onFailed&&t.onFailed({code:408,content:"Server unreachable or timeout"}))}),1e3)},unsubscribePresence:function(t){return"number"==typeof t.channel&&(t.channel=t.channel.toString()),this._isEmpty(t.channel)?void(void 0!==t.onFailed&&t.onFailed({code:400,content:"channel is required"})):(t.channel=t.channel+"_presence",void this.unsubscribe(t))},publish:function(t){function e(e){200==o.authorizeResult.code?o.socket.emit("publish",{sid:o.authorizeResult.sid,channel:t.channel,content:t.message,guid:e,retried:s},(function(e){i=!0,200==e.resultCode?void 0!==t.onSuccess&&t.onSuccess():void 0!==t.onFailed&&t.onFailed({code:e.resultCode,content:e.content})})):(i=!0,void 0!==t.onFailed&&t.onFailed({code:o.authorizeResult.code,content:o.authorizeResult.content}))}function n(){var n=o.uuid_goeasy();e(n);var r=setInterval((function(){!i&&s<o.maxRetries?(s++,e(n)):s==o.maxRetries?(clearInterval(r),void 0!==t.onFailed&&t.onFailed({code:408,content:"Server unreachable or timeout"})):clearInterval(r)}),1e3)}if(r(),"number"==typeof t.channel&&(t.channel=t.channel.toString()),this._isEmpty(t.channel))return this.log("'channel' is required."),void(void 0!==t.onFailed&&t.onFailed({code:400,content:"channel is required"}));if(this._isEmpty(t.message))return this.log("'message' is required."),void(void 0!==t.onFailed&&t.onFailed({code:400,content:"message is required"}));var o=this,i=!1,s=0;if(null!=this.authorizeResult&&"connected"==o.networkStatus)n();else var c=setInterval((function(){null!=o.authorizeResult&&"connected"==o.networkStatus?(clearInterval(c),n()):++s==o.maxRetries&&(clearInterval(c),void 0!==t.onFailed&&t.onFailed({code:408,content:"Server unreachable or timeout"}))}),1e3)},hereNow:function(t,e){var n={channels:[],includeUsers:!1,distinct:!1};if("undefined"!==t.channels)for(var r=0;r<t.channels.length;r++){var o=t.channels[r];"number"==typeof o&&(o=o.toString()),n.channels.push(o)}1==t.includeUsers&&(n.includeUsers=!0),1==t.distinct&&(n.distinct=!0),this.socket.emit("hereNow",n,(function(t){void 0!==e&&e(t)}))},hereNowByUserIds:function(t,e){var n={userIds:[],distinct:!0};"undefined"!==t.userIds&&(n.userIds=t.userIds),0==t.distinct&&(n.distinct=!1),void 0!==e&&(0===n.userIds.length?e({code:400,content:"userIds is required"}):n.userIds.length>500?e({code:400,content:"userIds is over max length 500"}):this.socket.emit("hereNowByUserIds",n,(function(t){e(t)})))},history:function(t,e){return"number"==typeof t.channel&&(t.channel=t.channel.toString()),this._isEmpty(t.channel)?void(void 0!==e&&e({code:400,content:"channel is required"})):void this.socket.emit("historyMessages",t,(function(t){void 0!==e&&e(t)}))},disconnect:function(){var t=this;this._manualDisconnectStatus="disconnecting","connected"===this.networkStatus&&"authorized"===this.authorizeStatus&&200===this.authorizeResult.code?t.tryEmit("manualDisconnect",null,(function(){t.socket.disconnect()}),(function(){t._manualDisconnectStatus="disconnected"})):this.socket.disconnect(),t.receivedGuids.splice(0,t.receivedGuids.length)},disconnected:function(){return"disconnected"===this.networkStatus},reconnect:function(){this._manualConnect=!0,this.socket.connect()},tryEmit:function(t,e,n,r){function o(){i.socket.emit(t,e,(function(t){s=!0,void 0!==r&&r(t)}))}var i=this,s=!1,c=0;o();var a=setInterval((function(){var t=c===i.maxRetries;s||t?(clearInterval(a),t&&void 0!==n&&n({code:408,content:"Server unreachable or timeout"})):(c++,e&&"undefined"!==e.retried&&(e.retried=c),o())}),1e3)},_callbackEvents:function(t){var e=this;this.socket.on("message",(function(t,n){var r=JSON.parse(t);if(!e.receivedGuids.unshiftGuid(r.i)){r.a&&e.socket.emit("ack",{publishGuid:r.i});var o=e.subscriptionChannelUUIDs[r.n];if(e._endWith(r.n,"presence"))void 0!==e.subscriptions[o].onPresence&&e.subscriptions[o].onPresence(JSON.parse(r.c));else if(void 0!==e.subscriptions[o].onMessage){var i={time:r.t,channel:r.n,content:r.c};r.s&&(i.senderId=r.s),e.subscriptions[o].onMessage(i)}}})),this.socket.on("connect",(function(){function n(){JSON.stringify(o),e._isEmpty(o.artifactVersion)&&e.sendlogs(),e.socket.emit("authorize",o,(function(n){if(JSON.stringify(n),!i)if(i=!0,e.authorizeStatus="authorized",e._manualDisconnectStatus="initial",null==e.authorizeResult&&(e.authorizeResult={}),e.authorizeResult.code=n.resultCode,e.authorizeResult.content=n.content,200==n.resultCode){if(r(),null==e.authorizeResult.sid)e.authorizeResult.sid=n.sid;else if(e.authorizeResult.sid!=n.sid)for(var o in e.authorizeResult.sid=n.sid,e.subscriptions)e.subscriptions.hasOwnProperty(o)&&(JSON.stringify(e.subscriptions[o]),e.doSubscribeAndCheckAck(e.subscriptions[o]));for(var s in e.subscribeBuffer)e.subscribeBuffer.hasOwnProperty(s)&&(JSON.stringify(e.subscribeBuffer[s]),e.doSubscribeAndCheckAck(e.subscribeBuffer[s]));void 0!==t.onConnected&&t.onConnected()}else void 0!==t.onConnectFailed&&t.onConnectFailed({code:n.resultCode,content:n.content})}))}if("disconnecting"!==e._manualDisconnectStatus&&"disconnected"!==e._manualDisconnectStatus||e._manualConnect){e.authorizeStatus="authorizing",e.networkStatus="connected";var o={manual:e._manualConnect,imVersion:e._imVersion,appkey:e._appkey,userId:e._userId,userData:e._userData,otp:e._otp,artifactVersion:"1.0.21",type:e._type};null!=e.authorizeResult&&(o.sid=e.authorizeResult.sid);var i=!1;n();var s=setInterval((function(){i||"connected"!=e.networkStatus?clearInterval(s):n()}),1300)}})),this.socket.on("connect_error",(function(e){void 0!==t.onConnectFailed&&t.onConnectFailed({code:408,content:e})})),this.socket.on("disconnect",(function(){e.networkStatus="disconnected",e.authorizeStatus="initial",e._manualConnect=!1,null==e.authorizeResult&&(e.authorizeResult={}),e.authorizeResult.code=408,e.authorizeResult.content="Server unreachable or timeout",void 0!==t.onDisconnected&&t.onDisconnected()}))},_isEmpty:function(t){return void 0===t||null==t||0==this._trim(t).length},_trim:function(t){return t.replace(/(^\s*)|(\s*$)/g,"")},_endWith:function(t,e){return new RegExp(e+"$").test(t)},_isArray:function(t){return"[object Array]"==Object.prototype.toString.call(t)},log:function(t){"undefined"!=typeof window&&window.console&&this.debug&&console.log(t)},uuid_goeasy:function(){return s().replace(/-/g,"")},sendlogs:function(){}};var m=function(){var t;return function(e){return t&&!t.disconnected()||(t=new v(e)),t}}();t.exports=m},function(t,e,n){"use strict";function r(t,e){"object"===(void 0===t?"undefined":o(t))&&(e=t,t=void 0),e=e||{};var n,r=i(t),s=r.source,u=r.id,l=r.path,f=a[u]&&l in a[u].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||f?n=c(s,e):(a[u]||(a[u]=c(s,e)),n=a[u]),r.query&&!e.query&&(e.query=r.query),n.socket(r.path,e)}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(2),s=n(5),c=n(8);n(4)("socket.io-client"),t.exports=e=r;var a=e.managers={};e.protocol=s.protocol,e.connect=r,e.Manager=n(8),e.Socket=n(30)},function(t,e,n){"use strict";var r=n(3);n(4)("socket.io-client:url"),t.exports=function(t,e){var n=t;e=e||"undefined"!=typeof location&&location,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)||(t=void 0!==e?e.protocol+"//"+t:"https://"+t),n=r(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 o=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port,n.href=n.protocol+"://"+o+(e&&e.port===n.port?"":":"+n.port),n}},function(t,e){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");-1!=o&&-1!=i&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=n.exec(t||""),c={},a=14;a--;)c[r[a]]=s[a]||"";return-1!=o&&-1!=i&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c}},function(t,e){"use strict";t.exports=function(){return function(){}}},function(t,e,n){"use strict";function r(){}function o(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var r=function(t){try{return JSON.stringify(t)}catch(t){return!1}}(t.data);if(!1===r)return f;n+=r}return n}function i(){this.reconstructor=null}function s(t){var n=0,r={type:Number(t.charAt(0))};if(null==e.types[r.type])return a("unknown packet type "+r.type);if(e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type){for(var o="";"-"!==t.charAt(++n)&&(o+=t.charAt(n),n!=t.length););if(o!=Number(o)||"-"!==t.charAt(n))throw new Error("Illegal attachments");r.attachments=Number(o)}if("/"===t.charAt(n+1))for(r.nsp="";++n&&","!==(s=t.charAt(n))&&(r.nsp+=s,n!==t.length););else r.nsp="/";var i=t.charAt(n+1);if(""!==i&&Number(i)==i){for(r.id="";++n;){var s;if(null==(s=t.charAt(n))||Number(s)!=s){--n;break}if(r.id+=t.charAt(n),n===t.length)break}r.id=Number(r.id)}if(t.charAt(++n)){var c=function(t){try{return JSON.parse(t)}catch(t){return!1}}(t.substr(n));if(!1===c||r.type!==e.ERROR&&!l(c))return a("invalid payload");r.data=c}return r}function c(t){this.reconPack=t,this.buffers=[]}function a(t){return{type:e.ERROR,data:"parser error: "+t}}var u=(n(4)("socket.io-parser"),n(6)),l=n(7);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=r,e.Decoder=i;var f=e.ERROR+'"encode error"';r.prototype.encode=function(t,e){e([o(t)])},u(i.prototype),i.prototype.add=function(t){var e;if("string"!=typeof t)throw new Error("Unknown type: "+t);e=s(t),this.emit("decoded",e)},i.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},c.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=binary.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},c.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,n){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.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 r,o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);t&&"object"===(void 0===t?"undefined":o(t))&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new p({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=e.parser||a;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(9),s=n(30),c=n(6),a=n(5),u=n(32),l=n(33),f=(n(4)("socket.io-client:manager"),n(29)),p=n(34),h=Object.prototype.hasOwnProperty;t.exports=r,r.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)h.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},r.prototype.updateSocketIds=function(){for(var t in this.nsps)h.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},r.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},c(r.prototype),r.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},r.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},r.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},r.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},r.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},r.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},r.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},r.prototype.open=r.prototype.connect=function(t,e){if(~this.readyState.indexOf("open"))return this;this.engine=i(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var o=u(n,"open",(function(){r.onopen(),t&&t()})),s=u(n,"error",(function(e){if("undefined"!=typeof window){var n=parseInt(r.uri.match(/[1-9][0-9]*/g)[0]),o=window._GoEasy_.goEasyDomainNumber.initialCurrentNumber();r.uri=r.uri.replace(n,o)}if(r.cleanup(),r.readyState="closed",r.emitAll("connect_error",e),t){var i=new Error("Connection error");i.data=e,t(i)}else r.maybeReconnectOnOpen()}));if(!1!==this._timeout){var c=this._timeout,a=setTimeout((function(){o.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",c)}),c);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(o),this.subs.push(s),this},r.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(u(t,"data",l(this,"ondata"))),this.subs.push(u(t,"ping",l(this,"onping"))),this.subs.push(u(t,"pong",l(this,"onpong"))),this.subs.push(u(t,"error",l(this,"onerror"))),this.subs.push(u(t,"close",l(this,"onclose"))),this.subs.push(u(this.decoder,"decoded",l(this,"ondecoded")))},r.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},r.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},r.prototype.ondata=function(t){this.decoder.add(t)},r.prototype.ondecoded=function(t){this.emit("packet",t)},r.prototype.onerror=function(t){this.emitAll("error",t)},r.prototype.socket=function(t,e){function n(){~f(o.connecting,r)||o.connecting.push(r)}var r=this.nsps[t];if(!r){r=new s(this,t,e),this.nsps[t]=r;var o=this;r.on("connecting",n),r.on("connect",(function(){r.id=o.generateId(t)})),this.autoConnect&&n()}return r},r.prototype.destroy=function(t){var e=f(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},r.prototype.packet=function(t){var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,(function(n){for(var r=0;r<n.length;r++)e.engine.write(n[r],t.options);e.encoding=!1,e.processPacketQueue()})))},r.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},r.prototype.cleanup=function(){for(var t=this.subs.length,e=0;e<t;e++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},r.prototype.close=r.prototype.disconnect=function(){this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},r.prototype.onclose=function(t){this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},r.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();this.reconnecting=!0;var n=setTimeout((function(){t.skipReconnect||(t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||(function(){var t=!1;return"object"===("undefined"==typeof uni?"undefined":o(uni))&&uni.getSystemInfo&&(t=!0),t&&!0===getApp().uniAppRunningBackend}()?(t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...")):t.open((function(e){e?(t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):t.onreconnect()}))))}),e);this.subs.push({destroy:function(){clearTimeout(n)}})}},r.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){"use strict";t.exports=n(10),t.exports.parser=n(15)},function(t,e,n){"use strict";function r(t,e){return this instanceof r?(e=e||{},t&&"object"===(void 0===t?"undefined":o(t))&&(e=t,t=null),t?(t=u(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=u(e.host).host),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=l.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,void this.open()):new r(t,e)}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(11),s=n(6),c=(n(4)("engine.io-client:socket"),n(29)),a=n(15),u=n(3),l=n(22);t.exports=r,r.priorWebsocketSuccess=!1,s(r.prototype),r.protocol=a.protocol,r.Socket=r,r.Transport=n(14),r.transports=n(11),r.parser=n(15),r.prototype.createTransport=function(t){var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(this.query);e.EIO=a.protocol,e.transport=t;var n=this.transportOptions[t]||{};return this.id&&(e.sid=this.id),new i[t]({query:e,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},r.prototype.open=function(){var t;if(this.rememberUpgrade&&r.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout((function(){e.emit("error","No transports available")}),0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},r.prototype.setTransport=function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",(function(){e.onDrain()})).on("packet",(function(t){e.onPacket(t)})).on("error",(function(t){e.onError(t)})).on("close",(function(){e.onClose("transport close")}))},r.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var t=!this.supportsBinary&&f.transport.supportsBinary;l=l||t}l||(u.send([{type:"ping",data:"probe"}]),u.once("packet",(function(t){if(!l)if("pong"===t.type&&"probe"===t.data){if(f.upgrading=!0,f.emit("upgrading",u),!u)return;r.priorWebsocketSuccess="websocket"===u.name,f.transport.pause((function(){l||"closed"!==f.readyState&&(a(),f.setTransport(u),u.send([{type:"upgrade"}]),f.emit("upgrade",u),u=null,f.upgrading=!1,f.flush())}))}else{var e=new Error("probe error");e.transport=u.name,f.emit("upgradeError",e)}})))}function n(){l||(l=!0,a(),u.close(),u=null)}function o(t){var e=new Error("probe error: "+t);e.transport=u.name,n(),f.emit("upgradeError",e)}function i(){o("transport closed")}function s(){o("socket closed")}function c(t){u&&t.name!==u.name&&n()}function a(){u.removeListener("open",e),u.removeListener("error",o),u.removeListener("close",i),f.removeListener("close",s),f.removeListener("upgrading",c)}var u=this.createTransport(t,{probe:1}),l=!1,f=this;r.priorWebsocketSuccess=!1,u.once("open",e),u.once("error",o),u.once("close",i),this.once("close",s),this.once("upgrading",c),u.open()},r.prototype.onOpen=function(){if(this.readyState="open",r.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])},r.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}},r.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},r.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout((function(){"closed"!==e.readyState&&e.onClose("ping timeout")}),t||e.pingInterval+e.pingTimeout)},r.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout((function(){t.ping(),t.onHeartbeat(t.pingTimeout)}),t.pingInterval)},r.prototype.ping=function(){var t=this;this.sendPacket("ping",(function(){t.emit("ping")}))},r.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},r.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},r.prototype.write=r.prototype.send=function(t,e,n){return this.sendPacket("message",t,e,n),this},r.prototype.sendPacket=function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},r.prototype.close=function(){function t(){r.onClose("forced close"),r.transport.close()}function e(){r.removeListener("upgrade",e),r.removeListener("upgradeError",e),t()}function n(){r.once("upgrade",e),r.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var r=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?n():t()})):this.upgrading?n():t()}return this},r.prototype.onError=function(t){r.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},r.prototype.onClose=function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)},r.prototype.filterUpgrades=function(t){for(var e=[],n=0,r=t.length;n<r;n++)~c(this.transports,t[n])&&e.push(t[n]);return e}},function(t,e,n){"use strict";var r=n(12),o=n(27);e.polling=function(t){var e=!1,n=!1;if(t.jsonp,"undefined"!=typeof location){var o="https:"===location.protocol,i=location.port;i||(i=o?443:80),e=t.hostname!==location.hostname||i!==t.port,n=t.secure!==o}return t.xdomain=e,t.xscheme=n,new r(t)},e.websocket=o},function(t,e,n){(function(e){"use strict";function r(){}function o(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{}}function i(t){if(s.call(this,t),this.query=this.query||{},!a){var e=o();a=e.___eio=e.___eio||[]}this.index=a.length;var n=this;a.push((function(t){n.onData(t)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){n.script&&(n.script.onerror=r)}),!1)}var s=n(13),c=n(23);t.exports=i;var a,u=/\n/g,l=/\\n/g;c(i,s),i.prototype.supportsBinary=!1,i.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),s.prototype.doClose.call(this)},i.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)}),100)},i.prototype.doWrite=function(t,e){function n(){r(),e()}function r(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(t)}catch(t){(i=document.createElement("iframe")).name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),c=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=a,s.method="POST",s.setAttribute("accept-charset","utf-8"),c.name="d",s.appendChild(c),document.body.appendChild(s),this.form=s,this.area=c}this.form.action=this.uri(),r(),t=t.replace(l,"\\\n"),this.area.value=t.replace(u,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&n()}:this.iframe.onload=n}}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t){var e=t&&t.forceBase64;u&&!e||(this.supportsBinary=!1),o.call(this,t)}var o=n(14),i=n(22),s=n(15),c=n(23),a=n(24);n(4)("engine.io-client:polling"),t.exports=r;var u=null!=new(n(25))({xdomain:!1}).responseType;c(r,o),r.prototype.name="polling",r.prototype.doOpen=function(){this.poll()},r.prototype.pause=function(t){function e(){n.readyState="paused",t()}var n=this;if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(r++,this.once("pollComplete",(function(){--r||e()}))),this.writable||(r++,this.once("drain",(function(){--r||e()})))}else e()},r.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},r.prototype.onData=function(t){var e=this;s.decodePayload(t,this.socket.binaryType,(function(t,n,r){return"opening"===e.readyState&&e.onOpen(),"close"===t.type?(e.onClose(),!1):void e.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())},r.prototype.doClose=function(){function t(){e.write([{type:"close"}])}var e=this;"open"===this.readyState?t():this.once("open",t)},r.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};s.encodePayload(t,this.supportsBinary,(function(t){e.doWrite(t,n)}))},r.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=a()),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t}},function(t,e,n){"use strict";function r(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.isReactNative=t.isReactNative,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var o=n(15),i=n(6);t.exports=r,i(r.prototype),r.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},r.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},r.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},r.prototype.onPacket=function(t){this.emit("packet",t)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,n){"use strict";function r(t,e,n){for(var r=new Array(t.length),o=s(t.length,n),i=function(t,n,o){e(n,(function(e,n){r[t]=n,o(e,r)}))},c=0;c<t.length;c++)i(c,t[c],o)}var o=n(16),i=n(17),s=n(19),c=n(20);"undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),"undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),e.protocol=3;var a=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},u=o(a),l={type:"error",data:"parser error"},f=n(21);e.encodePacket=function(t,e,n,r){"function"==typeof e&&(r=e,e=!1),"function"==typeof n&&(r=n,n=null);var o=(void 0===t.data||t.data.buffer||t.data,a[t.type]);return void 0!==t.data&&(o+=n?c.encode(String(t.data),{strict:!1}):String(t.data)),r(""+o)},e.decodePacket=function(t,e,n){if(void 0===t)return l;if("string"==typeof t){if(n&&!1===(t=function(t){try{t=c.decode(t,{strict:!1})}catch(t){return!1}return t}(t)))return l;var r=t.charAt(0);return Number(r)==r&&u[r]?t.length>1?{type:u[r],data:t.substring(1)}:{type:u[r]}:l}r=new Uint8Array(t)[0];var o=sliceBuffer(t,1);return f&&"blob"===e&&(o=new f([o])),{type:u[r],data:o}},e.encodePayload=function(t,n,o){"function"==typeof n&&(o=n,n=null);var s=i(t);return t.length?void r(t,(function(t,r){e.encodePacket(t,!!s&&n,!0,(function(t){r(null,function(t){return t.length+":"+t}(t))}))}),(function(t,e){return o(e.join(""))})):o("0:")},e.decodePayload=function(t,n,r){var o;if("function"==typeof n&&(r=n,n=null),""===t)return r(l,0,1);for(var i,s,c="",a=0,u=t.length;a<u;a++){var f=t.charAt(a);if(":"===f){if(""===c||c!=(i=Number(c)))return r(l,0,1);if(c!=(s=t.substr(a+1,i)).length)return r(l,0,1);if(s.length){if(o=e.decodePacket(s,n,!0),l.type===o.type&&l.data===o.data)return r(l,0,1);if(!1===r(o,a+i,u))return}a+=i,c=""}else c+=f}return""!==c?r(l,0,1):void 0}},function(t,e){"use strict";t.exports=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e}},function(t,e,n){var r=n(18),o=Object.prototype.toString,i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);t.exports=function t(e){if(!e||"object"!=typeof e)return!1;if(r(e)){for(var n=0,o=e.length;n<o;n++)if(t(e[n]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(e)||"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||i&&e instanceof Blob||s&&e instanceof File)return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return t(e.toJSON(),!0);for(var c in e)if(Object.prototype.hasOwnProperty.call(e,c)&&t(e[c]))return!0;return!1}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){function n(){}t.exports=function(t,e,r){function o(t,n){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(i=!0,e(t),e=r):0!==o.count||i||e(null,n)}var i=!1;return r=r||n,o.count=t,0===t?e():o}},function(t,e){"use strict";function n(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function r(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function o(t,e){return f(t>>e&63|128)}function i(t,e){if(0==(4294967168&t))return f(t);var n="";return 0==(4294965248&t)?n=f(t>>6&31|192):0==(4294901760&t)?(r(t,e)||(t=65533),n=f(t>>12&15|224),n+=o(t,6)):0==(4292870144&t)&&(n=f(t>>18&7|240),n+=o(t,12),n+=o(t,6)),n+f(63&t|128)}function s(){if(l>=u)throw Error("Invalid byte index");var t=255&a[l];if(l++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function c(t){var e,n;if(l>u)throw Error("Invalid byte index");if(l==u)return!1;if(e=255&a[l],l++,0==(128&e))return e;if(192==(224&e)){if((n=(31&e)<<6|s())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&e)){if((n=(15&e)<<12|s()<<6|s())>=2048)return r(n,t)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=(7&e)<<18|s()<<12|s()<<6|s())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}/*! https://mths.be/utf8js v2.1.2 by @mathias */
var a,u,l,f=String.fromCharCode;t.exports={version:"2.1.2",encode:function(t,e){for(var r=!1!==(e=e||{}).strict,o=n(t),s=o.length,c=-1,a="";++c<s;)a+=i(o[c],r);return a},decode:function(t,e){var r=!1!==(e=e||{}).strict;a=n(t),u=a.length,l=0;for(var o,i=[];!1!==(o=c(r));)i.push(o);return function(t){for(var e,n=t.length,r=-1,o="";++r<n;)(e=t[r])>65535&&(o+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=f(e);return o}(i)}}},function(t,e){function n(t){return t.map((function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var n=new Uint8Array(t.byteLength);n.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=n.buffer}return e}return t}))}function r(t,e){e=e||{};var r=new i;return n(t).forEach((function(t){r.append(t)})),e.type?r.getBlob(e.type):r.getBlob()}function o(t,e){return new Blob(n(t),e||{})}var i=void 0!==i?i:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,s=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),c=s&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),a=i&&i.prototype.append&&i.prototype.getBlob;"undefined"!=typeof Blob&&(r.prototype=Blob.prototype,o.prototype=Blob.prototype),t.exports=s?c?Blob:o:a?r:void 0},function(t,e){e.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},e.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}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){"use strict";function n(t){var e="";do{e=i[t%s]+e,t=Math.floor(t/s)}while(t>0);return e}function r(){var t=n(+new Date);return t!==o?(a=0,o=t):t+"."+n(a++)}for(var o,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),s=64,c={},a=0,u=0;u<s;u++)c[i[u]]=u;r.encode=n,r.decode=function(t){var e=0;for(u=0;u<t.length;u++)e=e*s+c[t.charAt(u)];return e},t.exports=r},function(t,e,n){"use strict";var r=n(26);t.exports=function(t){var e=t.xdomain,n=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!n&&o)return new XDomainRequest}catch(t){}if(!e)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},function(t,e,n){"use strict";function r(t){t&&t.forceBase64&&(this.supportsBinary=!1),("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=o&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(p=i)),c.call(this,t)}var o,i,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=n(14),a=n(15),u=n(22),l=n(23),f=n(24);if(n(4)("engine.io-client:websocket"),"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)if("undefined"!=typeof WebSocket)o=WebSocket;else if("undefined"!=typeof self)o=self.WebSocket||self.MozWebSocket;else try{i=n(28)}catch(t){}var p=o||i;"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket||(p=function(t){var e=this;if(e.onopen=function(){},e.onclose=function(){},e.onmessage=function(t){},e.onerror=function(t){},"object"===("undefined"==typeof tt?"undefined":s(tt))&&tt.getSystemInfo){var n=tt.connectSocket({url:t});e.send=function(t){n.send({data:t})},e.close=function(){n.close()},n.onOpen((function(){e.onopen()})),n.onError((function(t){e.onerror(t)})),n.onMessage((function(t){e.onmessage(t)})),n.onClose((function(){e.onclose()}))}else"undefined"!=typeof uni?(e.send=function(t){uni.sendSocketMessage({data:t})},e.close=function(){uni.closeSocket()},uni.onSocketOpen((function(t){e.onopen()})),uni.onSocketError((function(t){e.onerror(t)})),uni.onSocketMessage((function(t){e.onmessage(t)})),uni.onSocketClose((function(t){e.onclose()})),uni.connectSocket({url:t})):(e.send=function(t){wx.sendSocketMessage({data:t})},e.close=function(){wx.closeSocket()},wx.onSocketOpen((function(t){e.onopen()})),wx.onSocketError((function(t){e.onerror(t)})),wx.onSocketMessage((function(t){e.onmessage(t)})),wx.onSocketClose((function(t){e.onclose()})),wx.connectSocket({url:t}))}),t.exports=r,l(r,c),r.prototype.name="websocket",r.prototype.supportsBinary=!1,r.prototype.doOpen=function(){if(this.check()){var t,e,n=this.uri();("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(t=this.protocols),(e="undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).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);try{"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new p(n,t):new p(n):new p(n,t,e):this.ws=new p(n)}catch(t){return this.emit("error",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()}},r.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},r.prototype.write=function(t){var e=this;this.writable=!1;for(var n=t.length,r=0,o=n;r<o;r++)!function(t){a.encodePacket(t,e.supportsBinary,(function(r){if("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket){if(!e.usingBrowserWebSocket){var o={};t.options&&(o.compress=t.options.compress),e.perMessageDeflate&&("string"==typeof r?Buffer.byteLength(r):r.length)<e.perMessageDeflate.threshold&&(o.compress=!1)}try{e.usingBrowserWebSocket?e.ws.send(r):e.ws.send(r,o)}catch(t){}}else try{e.ws.send(r)}catch(t){}--n||(e.emit("flush"),setTimeout((function(){e.writable=!0,e.emit("drain")}),0))}))}(t[r])},r.prototype.onClose=function(){c.prototype.onClose.call(this)},r.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},r.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",n="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=f()),this.supportsBinary||(t.b64=1),(t=u.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t},r.prototype.check=function(){return!(!p||"__initialize"in p&&this.name===r.prototype.name)}},function(t,e){},function(t,e){var n=[].indexOf;t.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}},function(t,e,n){"use strict";function r(t,e,n){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(5),s=n(6),c=n(31),a=n(32),u=n(33),l=(n(4)("socket.io-client:socket"),n(22)),f=n(17);t.exports=r;var p={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},h=s.prototype.emit;s(r.prototype),r.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[a(t,"open",u(this,"onopen")),a(t,"packet",u(this,"onpacket")),a(t,"close",u(this,"onclose"))]}},r.prototype.open=r.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},r.prototype.send=function(){var t=c(arguments);return t.unshift("message"),this.emit.apply(this,t),this},r.prototype.emit=function(t){if(p.hasOwnProperty(t))return h.apply(this,arguments),this;var e=c(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:f(e))?i.BINARY_EVENT:i.EVENT,data:e,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},r.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},r.prototype.onopen=function(){if("/"!==this.nsp)if(this.query){var t="object"===o(this.query)?l.encode(this.query):this.query;this.packet({type:i.CONNECT,query:t})}else this.packet({type:i.CONNECT})},r.prototype.onclose=function(t){this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},r.prototype.onpacket=function(t){var e=t.nsp===this.nsp,n=t.type===i.ERROR&&"/"===t.nsp;if(e||n)switch(t.type){case i.CONNECT:this.onconnect();break;case i.EVENT:case i.BINARY_EVENT:this.onevent(t);break;case i.ACK:case i.BINARY_ACK:this.onack(t);break;case i.DISCONNECT:this.ondisconnect();break;case i.ERROR:this.emit("error",t.data)}},r.prototype.onevent=function(t){var e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?h.apply(this,e):this.receiveBuffer.push(e)},r.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var r=c(arguments);e.packet({type:f(r)?i.BINARY_ACK:i.ACK,id:t,data:r})}}},r.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])},r.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},r.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)h.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},r.prototype.ondisconnect=function(){this.destroy(),this.onclose("io server disconnect")},r.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},r.prototype.close=r.prototype.disconnect=function(){return this.connected&&this.packet({type:i.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},r.prototype.compress=function(t){return this.flags.compress=t,this},r.prototype.binary=function(t){return this.flags.binary=t,this}},function(t,e){t.exports=function(t,e){for(var n=[],r=(e=e||0)||0;r<t.length;r++)n[r-e]=t[r];return n}},function(t,e){"use strict";t.exports=function(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}}},function(t,e){var n=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}},function(t,e){function n(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&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){var r,o,i=n(36),s=n(37),c=0,a=0;t.exports=function(t,e,n){var u=e&&n||0,l=e||[],f=(t=t||{}).node||r,p=void 0!==t.clockseq?t.clockseq:o;if(null==f||null==p){var h=i();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==p&&(p=o=16383&(h[6]<<8|h[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:a+1,v=d-c+(y-a)/1e4;if(v<0&&void 0===t.clockseq&&(p=p+1&16383),(v<0||d>c)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,a=y,o=p;var m=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;l[u++]=m>>>24&255,l[u++]=m>>>16&255,l[u++]=m>>>8&255,l[u++]=255&m;var g=d/4294967296*1e4&268435455;l[u++]=g>>>8&255,l[u++]=255&g,l[u++]=g>>>24&15|16,l[u++]=g>>>16&255,l[u++]=p>>>8|128,l[u++]=255&p;for(var b=0;b<6;++b)l[u+b]=f[b];return e||s(l)}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return[o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],"-",o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]],o[t[r++]]].join("")}}])},function(t,e,n){var r=n(2);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,n){"use strict";n.r(e);var r=n(0),o=n.n(r),i=n(1),s=n.n(i),c=n(7),a=n.n(c);function u(t){return"string"==typeof t||"number"==typeof t||"symbol"===a()(t)||"boolean"==typeof t}function l(t){return null!=t}function f(t){return null!==t&&"object"===a()(t)}function p(t){return"string"==typeof t||"number"==typeof t}function h(t){return"string"==typeof t}function d(t){return"number"==typeof t}function y(t){return Array.isArray(t)?0==t.length:f(t)?!l(t):!d(t)&&(h(t)?""==t.trim():void 0)}var v,m="undefined"!=typeof window&&window.navigator.userAgent.toLowerCase(),g=(m&&/msie|trident/.test(m),m&&m.indexOf("msie 9.0"),m&&m.indexOf("edge/")>0);m&&/chrome\/\d+/.test(m),m&&m.match(/firefox\/(\d+)/),"undefined"!=typeof Promise&&("function"==typeof(v=Promise)&&/native code/.test(v.toString()));function b(t,e){if(h(t))try{var n=t.split(e);return n[n.length-1]}catch(t){throw Error(t)}}var k="group",w="private",S="system",E=n(8),R=n.n(E);var P=new(function(){function t(){o()(this,t)}return s()(t,[{key:"connect",value:function(t){return new Promise((function(e,n){if(!l(R.a))throw Error("GoEasy is not define.");t=function(t){if(!f(t))throw Error("TypeError: user require an object.");if(!p(t.id))throw Error("TypeError: id require number or string.");d(t.id)&&(t.id=t.id.toString());if(t.data=l(t.data)?t.data:{},(f(t.data)?JSON.stringify(t.data).length:t.data.length)>300)throw Error("user.data-length limit 300 byte");return t}(t),se.userId=t.id,se.goEasy=new R.a({appkey:se.appKey,host:se.host,userId:t.id,otp:t.otp,type:"im",imVersion:se.version,userData:JSON.stringify(t.data),onConnected:function(){se.im._event.notify(ue.CONNECTED),e()},onDisconnected:function(){se.im._event.notify(ue.DISCONNECT),n({code:400,content:"GoEasy disconnected."})},onConnectFailed:function(t){n(t||{code:408,content:"Failed to connect GoEasy"})}})}))}},{key:"disconnect",value:function(){return new Promise((function(t,e){ae.validateGoEasy();try{se.goEasy.disconnect(),t()}catch(t){e(t||{code:408,content:"disconnect failed"})}}))}}]),t}());function x(t){if(Array.isArray(t)&&0!=t.length){for(var e=0,n=t.length;e<n;e++){if(!p(t[e]))return!1;d(t[e])&&(t[e]=t[e].toString())}return t}}function O(t){return!!p(t)&&(d(t)&&(t=t.toString()),t)}var _=new(function(){function t(){o()(this,t)}return s()(t,[{key:"subscribePresence",value:function(t,e){var n=this;return new Promise((function(r,o){var i=x(t);i?(ae.validateGoEasy(),se.goEasy.subscribePresence({channels:i,onPresence:function(t){e==w?n.userPresence(t):n.groupPresence(t)},onSuccess:function(){r()},onFailed:function(t){o(t||{code:408,content:"Failed to subscribe user presence"})}})):o({code:400,content:"TypeError: id require string or number."})}))}},{key:"unsubscribePresence",value:function(t){return new Promise((function(e,n){(t=O(t))?(ae.validateGoEasy(),se.goEasy.unsubscribePresence({channel:t,onSuccess:function(){e()},onFailed:function(t){n(t||{code:408,content:"Failed to unsubscribe user presence"})}})):n({code:400,content:"TypeError: id require string or number."})}))}},{key:"subscribe",value:function(t){return new Promise((function(e,n){(t=x(t))?(ae.validateGoEasy(),se.goEasy.subscribe({channels:t,onMessage:function(t){},onSuccess:function(){e()},onFailed:function(t){n(t||{code:408,content:"Failed to subscribe group message"})}})):n({code:400,content:"TypeError: id require string or number."})}))}},{key:"unSubscribe",value:function(t){return new Promise((function(e,n){(t=O(t))?(ae.validateGoEasy(),se.goEasy.unsubscribe({channel:t,onSuccess:function(){e()},onFailed:function(t){n(t||{code:408,content:"Failed to unsubscribe group message"})}})):n({code:400,content:"TypeError: id require string or number."})}))}},{key:"hereNow",value:function(t,e){return new Promise((function(n,r){var o=null,i="imHereNow";e==w?o=t.userIds=x(t.userIds):(i="imGroupHereNow",o=t.groupId=O(t.groupId)),o?(ae.validateGoEasy(),se.goEasy.tryEmit(i,t,(function(t){r(t||{code:408,content:"Failed to query online group users"})}),(function(t){200==t.code?n(t):r(t)}))):r({code:400,content:"TypeError: id require string or number."})}))}},{key:"onlineCount",value:function(t){return new Promise((function(e,n){(t=O(t))?(ae.validateGoEasy(),se.goEasy.tryEmit("imGroupOnlineCount",{groupId:t},(function(t){n(t||{code:408,content:"Failed to query online group users"})}),(function(t){200==t.code?e(t):n(t)}))):n({code:400,content:"TypeError: id require string or number."})}))}},{key:"userPresence",value:function(t){t&&t.events&&t.events.map((function(t){se.im._event.notify(ue.USER_PRESENCE,t)}))}},{key:"groupPresence",value:function(t){t&&t.events&&t.events.map((function(e){e.groupOnlineCount=t.userAmount,e.groupId=t.channel,se.im._event.notify(ue.GROUP_PRESENCE,e)}))}}]),t}());var I=new(function(){function t(){o()(this,t)}return s()(t,[{key:"history",value:function(t){return new Promise((function(e,n){t=function(t){if(!f(t)||!l(t.friendId)&&!l(t.groupId))throw Error("friendId or groupId is not define.");if(l(t.friendId)&&l(t.groupId))throw Error("only contain friendId or groupId.");if(l(t.friendId)){if(!p(t.friendId))throw Error("TypeError: friendId require string or number.");return d(t.friendId)&&(t.friendId=t.friendId.toString()),t}if(!p(t.groupId))throw Error("TypeError: groupId require string or number.");return d(t.groupId)&&(t.groupId=t.groupId.toString()),t}(t),l(t.limit)||(t.limit=10),t.limit>30&&(t.limit=30),ae.validateGoEasy(),se.goEasy.tryEmit("imHistory",t,(function(t){n(t||{code:408,content:"Failed to query message"})}),(function(t){if(200==t.code){var r=[];t&&t.content&&t.content.map((function(t){var e=Object.create(null);e.timestamp=t.ts,e.senderId=t.s,e.type=t.mt,e.payload=JSON.parse(t.p),r.push(e)})),e({code:200,content:r})}else n(t)}))}))}}]),t}()),C=function(){function t(){o()(this,t),this.on()}return s()(t,[{key:"on",value:function(){var t=this;se.goEasy.socket.on("imMessage",(function(e){t.newMessageReceived(e)}))}},{key:"newMessageReceived",value:function(t){var e=null;if("string"==typeof t&&(e=JSON.parse(t)),!se.goEasy.receivedGuids.unshiftGuid(e.i)){e.a&&se.goEasy.socket.emit("imAck",{publishGuid:e.i});var n="";switch(e.t){case w:n=ue.PRIVATE_MESSAGE_RECEIVED;break;case k:n=ue.GROUP_MESSAGE_RECEIVED;break;case S:n=ue.SYSTEM_MESSAGE_RECEIVED;break;default:n=""}var r=N(e);se.im._conversations.updateByNewMessage(e),se.im._event.notify(n,r)}}}]),t}();function N(t){if(!l(t))return null;try{var e=Object.create(null);return e.type=t.mt,e.timestamp=t.ts,e.senderId=t.s,e.payload=JSON.parse(t.p),e.messageId=t.i,t.t==k?e.groupId=t.r:e.receiverId=t.r,e}catch(t){return t}}var A=function(){function t(e){o()(this,t),this.type="",this.timestamp=null,this.senderId=null,this.payload=null,this.messageId=null,this.validate(e),this.setType(),this.setPayload(e),this.setSenderId(),this.setMessageId()}return s()(t,[{key:"validate",value:function(t){if(!f(t))throw Error("it is an empty message.")}},{key:"setType",value:function(){this.type="message"}},{key:"setPayload",value:function(t){this.payload=Object.create(null)}},{key:"setSenderId",value:function(){if(!se.userId)throw Error("please call connect() first.");this.senderId=se.userId}},{key:"setMessageId",value:function(){this.messageId=ce.uuid()}}]),t}(),M=n(5),T=n.n(M),D=n(3),j=n.n(D),B=n(4),F=n.n(B),U=n(2),q=n.n(U),z={default:"default",text:"text",image:"image",video:"video",audio:"audio",emoji:"emoji",file:"file",customized:"customized"};function L(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var G=function(t){j()(n,t);var e=L(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){if(y(t.text)||""==t.text.trim())throw Error("text is empty")}},{key:"setType",value:function(){this.type=z.text}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t),this.payload.text=t.text}}]),n}(A),V=function(){function t(e){o()(this,t),this.mt=null,this.to=null,this.p=null,this.t=null,this.guid=null,this.validate(e.to,e.message),this.mt=e.message.type,this.to=e.to,this.t=e.conversationType,this.guid=e.message.messageId,this.p=e.message.payload}return s()(t,[{key:"validate",value:function(t,e){if(!(e instanceof A))throw Error("createMessage first.");if(y(t))throw Error("userId is empty.");if(!p(t))throw Error("userId should be a string or number.");if(se.userId==t)throw Error("userId can not be the same as your id.");if(e.type==z.text){if(!(e instanceof G))throw Error("it is not textMessage");if((f(e.payload)?JSON.stringify(e.payload).length:e.payload.length)>3072)throw Error("message-length limit 3kb")}}}]),t}(),H=function t(e){o()(this,t)},J=function(){function t(){o()(this,t)}return s()(t,[{key:"build",value:function(){throw Error("Not implementation yet.")}}]),t}();function W(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var X=new(function(t){j()(n,t);var e=W(n);function n(){return o()(this,n),e.call(this)}return s()(n,[{key:"build",value:function(t){return new Promise((function(e,n){try{new H;e(t.payload)}catch(t){n(t)}}))}}]),n}(J)),K=function(){function t(){o()(this,t)}return s()(t,null,[{key:"resolve",value:function(){return function(){try{return!!(l(uni)&&f(uni)&&uni.getSystemInfo)}catch(t){return!1}}()?"uniApp":function(){try{return!!(l(wx)&&f(wx)&&wx.getLocation)&&("function"!=typeof WebSocket||"function"!=typeof XMLHttpRequest)}catch(t){return!1}}()?"wx":"html"}}]),t}(),$=n(6),Y=n.n($),Q=function(){function t(){o()(this,t)}return s()(t,[{key:"upload",value:function(t){throw Error("Not implementation yet.")}}]),t}();function Z(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function tt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(n),!0).forEach((function(e){Y()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function et(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var nt=new(function(t){j()(n,t);var e=et(n);function n(){return o()(this,n),e.call(this)}return s()(n,[{key:"upload",value:function(t,e){var n=this;try{return new Promise((function(r,o){uni.uploadFile({url:t.host,filePath:n.getTempFilePath(t),name:"file",formData:t.parameters,success:function(e){200===e.statusCode?r({code:200,content:tt(tt({},t.payload),{},{message:e.errMsg})}):o({code:e.statusCode,content:e.errMsg})},fail:function(t){o({code:500,content:t.errMsg})}}).onProgressUpdate((function(t){e&&e(t)}))}))}catch(t){return new Promise((function(e,n){n({code:500,content:t})}))}}},{key:"getTempFilePath",value:function(t){var e=t.file||t.fileRes;return Array.isArray(e.tempFiles)?e.tempFiles[0].path:e.tempFilePath}}]),n}(Q));function rt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ot(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?rt(Object(n),!0).forEach((function(e){Y()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function it(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var st=new(function(t){j()(n,t);var e=it(n);function n(){return o()(this,n),e.apply(this,arguments)}return s()(n,[{key:"upload",value:function(t,e){var n=this;try{return new Promise((function(r,o){wx.uploadFile({url:t.host,filePath:n.getTempFilePath(t),name:"file",formData:t.parameters,success:function(e){200===e.statusCode?r({code:200,content:ot(ot({},t.payload),{},{message:e.errMsg})}):o({code:e.statusCode,content:e.errMsg})},fail:function(t){o({code:500,content:t.errMsg})}}).onProgressUpdate((function(t){e&&e(t)}))}))}catch(t){return new Promise((function(e,n){n({code:500,content:t})}))}}},{key:"getTempFilePath",value:function(t){var e=t.file||t.fileRes;return Array.isArray(e.tempFiles)?e.tempFiles[0].path:e.tempFilePath}}]),n}(Q));function ct(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function at(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ct(Object(n),!0).forEach((function(e){Y()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function ut(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var lt=new(function(t){j()(n,t);var e=ut(n);function n(){return o()(this,n),e.call(this)}return s()(n,[{key:"upload",value:function(t,e){try{return new Promise((function(n,r){var o=new XMLHttpRequest;for(var i in o.open("post",t.host,!0),t.headers)o.setRequestHeader(i,t.headers[i]);o.upload.onprogress=function(t){e&&e(t)},o.upload.onloadstart=function(t){e&&e(t)},o.upload.onloadend=function(t){e&&e(t)};var s=new FormData;for(var c in t.parameters)"fileRes"==c?s.append("file",t.parameters[c]):s.append(c,t.parameters[c]);o.send(s),o.onreadystatechange=function(){4==o.readyState&&(o.status>=200&&o.status<300||304==o.status?n({code:o.status,content:at(at({},t.payload),{},{message:o.responseText})}):r({code:o.status,content:o.responseText}))}}))}catch(t){return new Promise((function(e,n){n({code:500,content:t})}))}}}]),n}(Q)),ft=new(function(){function t(){o()(this,t),this.uploader={uniApp:nt,wx:st,html:lt}}return s()(t,[{key:"upload",value:function(t,e){var n=K.resolve();return this.uploader[n].upload(t,e)}}]),t}()),pt=function(){function t(){o()(this,t)}return s()(t,null,[{key:"resolver",value:function(t){return new Promise((function(e,n){se.goEasy.tryEmit("uploadToken",{filename:t},(function(t){n(t)}),(function(t){200==t.code?e(t):n(t)}))}))}}]),t}(),ht="ALI",dt=function t(e,n,r,i,s){o()(this,t),this.host="",this.headers={},this.parameters={},this.file={},this.payload={},this.host=e,this.headers=n,this.parameters=r,this.file=i,this.payload=s},yt=function(){function t(){o()(this,t)}return s()(t,[{key:"build",value:function(t,e){}},{key:"newFileName",value:function(t){return t&&t.newFilename||""}}]),t}();function vt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var mt=new(function(t){j()(n,t);var e=vt(n);function n(){return o()(this,n),e.call(this)}return s()(n,[{key:"url",value:function(t){return t.host+"/"+t.dir+"/"+this.newFileName(t)}},{key:"build",value:function(t,e){var n={key:t.dir+"/"+this.newFileName(t),OSSAccessKeyId:t.accessKeyId,policy:t.policy,signature:t.signature,success_action_status:"200",fileRes:e},r={newFileName:this.newFileName(t),url:this.url(t)};return new dt(t.host,null,n,e,r)}}]),n}(yt));function gt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var bt=new(function(t){j()(n,t);var e=gt(n);function n(){return o()(this,n),e.call(this)}return s()(n,[{key:"url",value:function(t){return t.downloadUrl}},{key:"build",value:function(t,e){var n={key:this.newFileName(t),token:t.token,file:e},r={newFileName:this.newFileName(t),url:this.url(t)};return new dt(t.host,null,n,e,r)}}]),n}(yt)),kt=function t(e){return o()(this,t),e==ht?mt:bt},wt=new(function(){function t(){o()(this,t)}return s()(t,[{key:"build",value:function(t,e){return new Promise((function(n,r){pt.resolver(e).then((function(e){var r=e.content;n(new kt(r.vendor).build(r,t))})).catch((function(t){r(t)}))}))}}]),t}()),St=new(function(){function t(){o()(this,t),this.requestBuilder=wt,this.fileUploader=ft}return s()(t,[{key:"upload",value:function(t,e,n){var r=this;return new Promise((function(o,i){r.requestBuilder.build(t,e).then((function(t){o(r.doUpload(t,n))})).catch((function(t){i(t)}))}))}},{key:"customizeUpload",value:function(t,e){this.doUpload(t,e)}},{key:"doUpload",value:function(t,e){return this.fileUploader.upload(t,e)}}]),t}());function Et(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Rt=function(t){j()(n,t);var e=Et(n);function n(){return o()(this,n),e.call(this)}return s()(n,[{key:"build",value:function(t){var e=this;return new Promise((function(n,r){var o=new H;e.upload(t).then((function(e){var r=e.content,i=void 0===r?{}:r;(o=t.payload).url=i.url,o.name=i.newFileName,n(o)})).catch((function(t){r(t)}))}))}},{key:"upload",value:function(t){var e=t.type==z.video?t.payload.video.name:t.payload.name;return St.upload(t.file,e,t.onProgress)}}]),n}(J),Pt=new Rt;function xt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Ot=new(function(t){j()(n,t);var e=xt(n);function n(){return o()(this,n),e.call(this)}return s()(n,[{key:"build",value:function(t){var e=this;return new Promise((function(n,r){var o=new H;e.upload(t).then((function(e){e.content;o=t.payload;var r="?x-oss-process=video/snapshot,t_0000,f_jpg,w_"+t.payload.video.width+",m_fast,ar_auto";o.video.url=e.content.url,o.thumbnail.url=e.content.url+r,o.video.name=e.content.newFileName,n(o)})).catch((function(t){r(t)}))}))}}]),n}(Rt)),_t=function t(e){return o()(this,t),e==z.text?X:e==z.video?Ot:Pt},It=new(function(){function t(){o()(this,t)}return s()(t,[{key:"build",value:function(t,e,n){return new Promise((function(r,o){var i=new V({to:t,message:e,conversationType:n}),s=e.type;new _t(s).build(e).then((function(t){i.p=JSON.stringify(t),r(i)})).catch((function(t){o(t)}))}))}}]),t}()),Ct=new(function(){function t(){o()(this,t)}return s()(t,[{key:"send",value:function(t,e,n){return ae.validateGoEasy(),new Promise((function(r,o){It.build(t,e,n).then((function(t){se.goEasy.tryEmit("publishIM",t,(function(){o({code:408,content:"Failed to send private message."})}),(function(t){200==t.resultCode?r({code:200,content:t.content}):o(t)}))})).catch((function(t){o({code:t.code||400,content:t.content||t})}))}))}}]),t}()),Nt=function(){function t(){o()(this,t),this.type="",this.lastMessage=null,this.unread=0,this.lastConsumedTimestamp=0}return s()(t,null,[{key:"buildByNewMessage",value:function(e){var n=new t;return n.type=e.t,n.lastMessage=N(e),n.lastConsumedTimestamp=n.lastMessage.timestamp-1,n.unread=1,e.t==k?n.groupId=e.r:se.userId==e.r?n.userId=e.s:n.userId=e.r,n}},{key:"buildByConversations",value:function(e){var n=new t;return n.type=e.t,n.lastMessage=N(e.lmsg),n.unread=0,n.lastConsumedTimestamp=e.lcts,e.t==k?n.groupId=e.g:n.userId=e.uid,n}}]),t}(),At=function(){function t(){o()(this,t),this.list=[],this.synchronized=!1}return s()(t,[{key:"onUpdated",value:function(){var t=this;this.latestConversations().then((function(){se.im._event.notify(ue.CONVERSATIONS_UPDATED,{unreadTotal:t.getUnreadTotal(t.list),conversations:t.list})}))}},{key:"updateByNewMessage",value:function(t){var e,n=this,r=this.list.findIndex((function(e){return t.t==k&&t.r==e.groupId||t.t==w&&n.getFriendId(t)==e.userId}));r>-1?((e=this.list[r]).unread+=1,this.list.splice(r,1),this.applyLastMessage(e,t)):e=Nt.buildByNewMessage(t),this.insertOne(e),this.onUpdated()}},{key:"imLastConversations",value:function(){return new Promise((function(t,e){ae.validateGoEasy(),se.goEasy.tryEmit("imLastConversations",{},(function(t){e(t)}),(function(n){200==n.code?t(n.content):e(n)}))}))}},{key:"loadServerConversations",value:function(){var t=this;return new Promise((function(e,n){t.imLastConversations().then((function(n){for(var r=function(e,r){var o=t.list.find((function(t){return n[e].t==k&&n[e].g==t.groupId||n[e].t==w&&n[e].uid==t.userId}));l(o)||(o=Nt.buildByConversations(n[e]),t.insertOne(o))},o=0,i=n.length;o<i;o++)r(o);t.synchronized=!0,e({code:200,content:{unreadTotal:t.getUnreadTotal(t.list),conversations:t.list}})})).catch((function(t){n(t)}))}))}},{key:"loadLocalConversations",value:function(){return Promise.resolve({code:200,content:{unreadTotal:this.getUnreadTotal(this.list),conversations:this.list}})}},{key:"latestConversations",value:function(){return this.synchronized?this.loadLocalConversations():this.loadServerConversations()}},{key:"privateMarkAsRead",value:function(t,e){var n=this,r=se.im._conversations.list.find((function(e){return e.userId==t}));if(!r)return Promise.reject({code:400,content:"not found this message."});e||(e=r.lastMessage.timestamp);var o={friendId:t,lastTimestamp:e,lastConsumedTimestamp:r.lastConsumedTimestamp},i=this.markAsRead(o,"markPrivateMessageAsRead");return new Promise((function(t,o){i.then((function(o){n.resetConversation(r,e,o.content.amount),t({code:200,content:"ok"})})).catch((function(t){o({code:500,content:t})}))}))}},{key:"groupMarkAsRead",value:function(t,e){var n=this,r=se.im._conversations.list.find((function(e){return e.groupId==t}));if(!r)return Promise.reject({code:400,content:"not found this message."});if(e||(e=r.lastMessage.timestamp),e<r.lastConsumedTimestamp)return Promise.reject({code:400,content:"Can not set a read timestamp"});if(e>r.lastMessage.timestamp)return Promise.reject({code:400,content:"Can not set a nonexistent timestamp"});var o={groupId:t,lastTimestamp:e,lastConsumedTimestamp:r.lastConsumedTimestamp},i=this.markAsRead(o,"markGroupMessageAsRead");return new Promise((function(t,o){i.then((function(o){n.resetConversation(r,e,o.content.amount),t({code:200,content:"ok"})})).catch((function(t){o({code:500,content:t})}))}))}},{key:"markAsRead",value:function(t,e){return new Promise((function(n,r){ae.validateGoEasy(),se.goEasy.tryEmit(e,t,(function(t){r(t||{code:408,content:"Failed to query message"})}),(function(t){200==t.code?n(t):r(t)}))}))}},{key:"resetConversation",value:function(t,e,n){t.unread-=n,t.lastConsumedTimestamp=e,this.onUpdated()}},{key:"getUnreadTotal",value:function(t){for(var e=0,n=0,r=t.length;n<r;n++)e+=t[n].unread;return e}},{key:"getFriendId",value:function(t){return t.r==se.userId?t.s:t.r}},{key:"insertOne",value:function(t){var e=this.getPosIndex(t);this.list.splice(e+1,0,t)}},{key:"getPosIndex",value:function(t){if(0==this.list.length)return-1;for(var e,n,r=0,o=this.list.length;o-r>1;){e=Math.floor((r+o)/2),n=this.list[e];var i=this.compares(t,n);if(0==i)return e;i>0?r=e:o=e}return 0==r&&this.compares(this.list[0],t)>0?-1:r}},{key:"compares",value:function(t,e){var n=e.lastMessage.timestamp-t.lastMessage.timestamp;return n>0?1:0==n?0:-1}},{key:"applyLastMessage",value:function(t,e){t.lastMessage.timestamp<e.ts&&(t.lastMessage=N(e))}}]),t}();function Mt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Tt=function(t){j()(n,t);var e=Mt(n);function n(t){var r;return o()(this,n),(r=e.call(this,t)).file=null,r.onProgress=null,r.setFile(t.file),r.setOnProgress(t.onProgress),r}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t)}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t),this.payload.size="",this.payload.contentType="",this.payload.name="",this.payload.url=""}},{key:"setType",value:function(){this.type=z.file}},{key:"setFile",value:function(t){this.file=t}},{key:"setOnProgress",value:function(t){this.onProgress=t}}]),n}(A);function Dt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var jt=function(t){j()(n,t);var e=Dt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){if(T()(q()(n.prototype),"validate",this).call(this,t),!l(t.file))throw Error("file is empty.")}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t)}}]),n}(Tt);function Bt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Ft=function(t){j()(n,t);var e=Bt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){if(T()(q()(n.prototype),"validate",this).call(this,t),!l(t.file.tempFiles)||0==t.file.tempFiles[0].length)throw Error("tempFiles is empty.")}},{key:"setType",value:function(){this.type=z.image}},{key:"setFile",value:function(t){var e="chooseMedia:ok"==t.errMsg?t.tempFiles[0].tempFilePath:t.tempFiles[0].path;t.tempFiles[0].path=e,this.file=t}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t);var e=this,r=t.file.tempFiles[0],o="chooseMedia:ok"==t.file.errMsg?r.tempFilePath:r.path;this.payload.url=o,this.payload.size=r.size,this.payload.width="",this.payload.height="",this.payload.contentType="";var i=y(r.name)||null==r.name?o:r.name;this.payload.name="wx-image."+b(i,"."),this.payload.contentType="image/"+b(i,"."),wx.getImageInfo({src:o,success:function(t){e.payload.width=t.width,e.payload.height=t.height}})}}]),n}(jt);function Ut(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var qt=function(t){j()(n,t);var e=Ut(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t)}},{key:"setType",value:function(){this.type=z.audio}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t);var e=t.file.tempFilePath;this.payload.url=e,this.payload.duration=t.file.duration/1e3,this.payload.size=t.file.fileSize;var r=y(t.file.name)||null==t.file.name?e:t.file.name;this.payload.contentType="audio/"+b(r,"."),this.payload.name="wx-audio."+b(r,".")}}]),n}(jt);function zt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Lt=function(t){j()(n,t);var e=zt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t)}},{key:"setType",value:function(){this.type=z.video}},{key:"setFile",value:function(t){this.file="chooseMedia:ok"==t.errMsg?t.tempFiles[0]:t}},{key:"setPayload",value:function(t){this.payload=Object.create(null);var e=Object.create(null),n=Object.create(null),r="chooseMedia:ok"==t.file.errMsg?t.file.tempFiles[0]:t.file,o=r.duration,i=r.height,s=r.size,c=r.tempFilePath,a=r.thumbTempFilePath,u=r.width,l=r.name,f=void 0===l?"":l,p=y(f)?c:f;e.contentType="video/"+b(p,"."),e.name="wx-video."+b(p,"."),e.url=c,e.width=n.width=u,e.height=n.height=i,e.size=s,e.duration=o,n.url=a,n.contentType="image/jpg",n.name="wx-thumbnail.jpg",this.payload.video=e,this.payload.thumbnail=n}}]),n}(jt);function Gt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Vt=function(t){j()(n,t);var e=Gt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){if(T()(q()(n.prototype),"validate",this).call(this,t),!l(t.file))throw Error("file is empty.")}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t)}}]),n}(Tt);function Ht(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Jt=function(t){j()(n,t);var e=Ht(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t)}},{key:"setType",value:function(){this.type=z.audio}},{key:"setPayload",value:function(t){var e=this;T()(q()(n.prototype),"setPayload",this).call(this,t);var r=this,o=t.file.tempFilePath;this.payload.url=o;var i=y(t.file.name)||null==t.file.name?o:t.file.name;if(this.payload.contentType="audio/"+b(i,"."),this.payload.name="uni-audio."+b(i,"."),l(t.file.duration))this.payload.duration=t.file.duration/1e3;else{var s=uni.createInnerAudioContext();s.src=o,s.onCanplay((function(t){r.payload.duration=s.duration,s.destroy()}))}uni.getFileInfo({filePath:o,success:function(t){e.payload.size=t.size}})}}]),n}(Vt);function Wt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Xt=function(t){j()(n,t);var e=Wt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t)}},{key:"setType",value:function(){this.type=z.video}},{key:"setPayload",value:function(t){var e=Object.create(null),n=Object.create(null);this.payload=Object.create(null);var r=t.file,o=r.duration,i=r.height,s=r.size,c=r.tempFilePath,a=r.width,u=r.name,l=void 0===u?"":u,f=y(l)?c:l;e.contentType="video/"+b(f,"."),e.name="uni-video."+b(f,"."),e.size=s,e.duration=o,e.url=n.url=c,e.width=n.width=a,e.height=n.height=i,n.contentType="image/jpg",n.name="wx-thumbnail.jpg",this.payload.video=e,this.payload.thumbnail=n}}]),n}(Vt);function Kt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var $t=function(t){j()(n,t);var e=Kt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){if(T()(q()(n.prototype),"validate",this).call(this,t),!l(t.file.tempFiles)||0==t.file.tempFiles[0].length)throw Error("tempFiles is empty.")}},{key:"setType",value:function(){this.type=z.image}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t);var e=this,r=t.file.tempFiles[0];this.payload.url=r.path,this.payload.size=r.size,this.payload.width="",this.payload.height="";var o=y(r.name)||null==r.name?r.path:r.name;this.payload.contentType="image/"+b(o,"."),this.payload.name="uni-image."+b(o,"."),uni.getImageInfo({src:r.path,success:function(t){e.payload.width=t.width,e.payload.height=t.height}})}}]),n}(Vt);function Yt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var Qt=function(t){j()(n,t);var e=Yt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){if(T()(q()(n.prototype),"validate",this).call(this,t),!(t.file instanceof File))throw Error("wrong file type.");if(0==t.file.size)throw Error("File size is 0.");if(t.file.size>31457280)throw Error("message-length limit 30mib")}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t),this.payload.contentType=t.file.type,this.payload.name=t.file.name,this.payload.size=t.file.size;var e=(window.URL||window.webkitURL).createObjectURL(t.file);this.payload.url=e}}]),n}(Tt);function Zt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var te=function(t){j()(n,t);var e=Zt(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t);var e=["gif","jpg","png","jpeg"];if(!e.find((function(e){return e==t.file.type.split("/")[1].toLowerCase()})))throw Error("Only "+e.join(",")+" is supported image.")}},{key:"setType",value:function(){this.type=z.image}},{key:"setPayload",value:function(t){var e=this;T()(q()(n.prototype),"setPayload",this).call(this,t);var r=window.URL||window.webkitURL,o=new Image;o.src=r.createObjectURL(t.file),o.onload=function(){e.payload.width=o.width,e.payload.height=o.height,r.revokeObjectURL(o.src)}}}]),n}(Qt);function ee(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var ne=function(t){j()(n,t);var e=ee(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t);var e=["mp3","ogg","wav","wma","ape","acc","mpeg"];if(!e.find((function(e){return e==t.file.type.split("/")[1].toLowerCase()})))throw Error("Only "+e.join(",")+" is supported audio.")}},{key:"setType",value:function(){this.type=z.audio}},{key:"setPayload",value:function(t){T()(q()(n.prototype),"setPayload",this).call(this,t);var e=this,r=window.URL||window.webkitURL,o=document.createElement("audio");o.src=r.createObjectURL(t.file),o.onloadedmetadata=function(){e.payload.duration=o.duration,r.revokeObjectURL(o.src)}}}]),n}(Qt);function re(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=q()(t);if(e){var o=q()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return F()(this,n)}}var oe=function(t){j()(n,t);var e=re(n);function n(t){return o()(this,n),e.call(this,t)}return s()(n,[{key:"validate",value:function(t){T()(q()(n.prototype),"validate",this).call(this,t);var e=["avi","mov","rmvb","rm","flv","mp4","3gp","quicktime"];if(!e.find((function(e){return e==t.file.type.split("/")[1].toLowerCase()})))throw Error("Only "+e.join(",")+" is supported video.")}},{key:"setType",value:function(){this.type=z.video}},{key:"setPayload",value:function(t){this.payload=Object.create(null);var e=Object.create(null),n=Object.create(null);e.contentType=t.file.type,e.size=t.file.size,e.duration=0,e.url=n.url="",e.name=t.file.name,e.width=n.width=0,e.height=n.height=0,n.contentType="image/jpg",this.payload.video=e,this.payload.thumbnail=n;var r=this,o=window.URL||window.webkitURL,i=document.createElement("video"),s=o.createObjectURL(t.file);i.src=s,i.onloadedmetadata=function(){r.payload.video.duration=i.duration,r.payload.video.width=r.payload.thumbnail.width=i.videoWidth,r.payload.video.height=r.payload.thumbnail.height=i.videoHeight,r.payload.video.url=s,r.payload.thumbnail.url=function(t){var e=document.createElement("canvas");return e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0,e.width,e.height),e.toDataURL("image/png")}(i),o.revokeObjectURL(i.src)}}}]),n}(Qt);var ie=new(function(){function t(){o()(this,t),this.messageTypes={wx:{image:Ft,file:jt,audio:qt,video:Lt,text:G},uniApp:{image:$t,file:Vt,audio:Jt,video:Xt,text:G},html:{image:te,file:Qt,audio:ne,video:oe,text:G}}}return s()(t,[{key:"create",value:function(t,e){var n=K.resolve();return new this.messageTypes[n][t](e)}}]),t}()),se=function(){function t(){if(o()(this,t),this._event=le,this._connection=P,this._conversations=null,this._receive=null,this._messageSender=Ct,this._history=I,this._presence=_,!(this instanceof t&&t.appKey&&t.host))throw Error("please call getInstance to structure instance.")}return s()(t,[{key:"on",value:function(t,e){this._event.on(t,e)}},{key:"connect",value:function(t){var e=this,n=this._connection.connect(t);return new Promise((function(t,r){n.then((function(){e._conversations=new At,e._receive=new C,t()})).catch((function(t){r(t)}))}))}},{key:"disconnect",value:function(){return this._connection.disconnect()}},{key:"createTextMessage",value:function(t){return ie.create(z.text,t)}},{key:"createImageMessage",value:function(t){return ie.create(z.image,t)}},{key:"createFileMessage",value:function(t){return ie.create(z.file,t)}},{key:"createAudioMessage",value:function(t){return ie.create(z.audio,t)}},{key:"createVideoMessage",value:function(t){return ie.create(z.video,t)}},{key:"latestConversations",value:function(){return this._conversations?this._conversations.latestConversations():Promise.reject({code:500,content:"Please connect GoEasyIM first."})}},{key:"groupMarkAsRead",value:function(t,e){return this._conversations.groupMarkAsRead(t,e)}},{key:"privateMarkAsRead",value:function(t,e){return this._conversations.privateMarkAsRead(t,e)}},{key:"history",value:function(t){return this._history.history(t)}},{key:"upload",value:function(t,e,n){return St.upload(t,e,n)}},{key:"sendSystemMessage",value:function(t,e){return this._messageSender.send(t,e,S)}},{key:"sendPrivateMessage",value:function(t,e){return this._messageSender.send(t,e,w)}},{key:"subscribeUserPresence",value:function(t){return this._presence.subscribePresence(t,w)}},{key:"unsubscribeUserPresence",value:function(t){return this._presence.unsubscribePresence(t)}},{key:"hereNow",value:function(t){return this._presence.hereNow(t,w)}},{key:"sendGroupMessage",value:function(t,e){return this._messageSender.send(t,e,k)}},{key:"subscribeGroup",value:function(t){return this._presence.subscribe(t)}},{key:"unsubscribeGroup",value:function(t){return this._presence.unSubscribe(t)}},{key:"subscribeGroupPresence",value:function(t){return this._presence.subscribePresence(t,k)}},{key:"unsubscribeGroupPresence",value:function(t){return this._presence.unsubscribePresence(t)}},{key:"groupHereNow",value:function(t){return this._presence.hereNow({groupId:t},k)}},{key:"groupOnlineCount",value:function(t){return this._presence.onlineCount(t)}}],[{key:"getInstance",value:function(e){var n="";if(!f(e))throw n="options is require an object.",Error(n);if(!u(e.appkey)||0==e.appkey.length)throw n="Invalid options: 'appkey' is empty.",Error(n);if(!u(e.appkey)||0==e.appkey.length)throw n="Invalid options:'host' is empty.",Error(n);return null==this.im&&(this.appKey=e.appkey,this.host=e.host,this.im=new t),this.im}}]),t}();se.version=null,se.goEasy=null,se.im=null,se.appKey=void 0,se.host=void 0,se.userId=void 0;var ce=function(){function t(){o()(this,t)}return s()(t,null,[{key:"uuid",value:function(){return se.goEasy.uuid_goeasy()}}]),t}(),ae=new(function(){function t(){o()(this,t)}return s()(t,[{key:"validateGoEasy",value:function(){if(!l(se.goEasy))throw Error("please call connect() first.")}}]),t}()),ue=Object.create(null);ue.PRIVATE_MESSAGE_RECEIVED="PRIVATE_MESSAGE_RECEIVED",ue.GROUP_MESSAGE_RECEIVED="GROUP_MESSAGE_RECEIVED",ue.SYSTEM_MESSAGE_RECEIVED="SYSTEM_MESSAGE_RECEIVED",ue.CONVERSATIONS_UPDATED="CONVERSATIONS_UPDATED",ue.CONNECTED="CONNECTED",ue.DISCONNECTED="DISCONNECTED",ue.USER_PRESENCE="USER_PRESENCE",ue.GROUP_PRESENCE="GROUP_PRESENCE";var le=new(function(){function t(){o()(this,t),this.subs=null,this.subs=Object.create(null)}return s()(t,[{key:"on",value:function(t,e){if(!h(t))throw Error("eventType require a string.");if(!l(ue[t]))throw Error("event not found.");if(!function(t){return"function"==typeof t}(e))throw Error("event require a callback.");this.subs[t]=e}},{key:"notify",value:function(t,e){var n=this.subs[t];n&&n(e)}}]),t}()),fe=null,pe=function(){function t(){if(o()(this,t),!(this instanceof t&&se.appKey&&se.host))throw Error("please call getInstance to structure instance.")}return s()(t,[{key:"on",value:function(t,e){fe.on(t,e)}},{key:"connect",value:function(t){return fe.connect(t)}},{key:"disconnect",value:function(){return fe.disconnect()}},{key:"createTextMessage",value:function(t){return fe.createTextMessage(t)}},{key:"createImageMessage",value:function(t){return fe.createImageMessage(t)}},{key:"createFileMessage",value:function(t){return fe.createFileMessage(t)}},{key:"createAudioMessage",value:function(t){return fe.createAudioMessage(t)}},{key:"createVideoMessage",value:function(t){return fe.createVideoMessage(t)}},{key:"latestConversations",value:function(){return fe.latestConversations()}},{key:"history",value:function(t){return fe.history(t)}},{key:"upload",value:function(t,e,n){return fe.upload(t,e,n)}},{key:"sendSystemMessage",value:function(t,e){return fe.sendSystemMessage(t,e)}},{key:"sendPrivateMessage",value:function(t,e){return fe.sendPrivateMessage(t,e)}},{key:"markGroupMessageAsRead",value:function(t,e){return fe.groupMarkAsRead(t,e)}},{key:"markPrivateMessageAsRead",value:function(t,e){return fe.privateMarkAsRead(t,e)}},{key:"subscribeUserPresence",value:function(t){return fe.subscribeUserPresence(t)}},{key:"unsubscribeUserPresence",value:function(t){return fe.unsubscribeUserPresence(t)}},{key:"hereNow",value:function(t){return fe.hereNow(t)}},{key:"sendGroupMessage",value:function(t,e){return fe.sendGroupMessage(t,e)}},{key:"subscribeGroup",value:function(t){return fe.subscribeGroup(t)}},{key:"unsubscribeGroup",value:function(t){return fe.unsubscribeGroup(t)}},{key:"subscribeGroupPresence",value:function(t){return fe.subscribeGroupPresence(t)}},{key:"unsubscribeGroupPresence",value:function(t){return fe.unsubscribeGroupPresence(t)}},{key:"groupHereNow",value:function(t){return fe.groupHereNow(t)}},{key:"groupOnlineCount",value:function(t){return fe.groupOnlineCount(t)}}],[{key:"getInstance",value:function(e){return null==t.goEasyIM&&(se.version=t.version,fe=se.getInstance(e),this.goEasyIM=new t),this.goEasyIM}}]),t}();pe.goEasyIM=null,pe.EVENT=Object.create(ue),pe.version="1.1.1";e.default=pe}]).default}));