!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GoEasy=t():e.GoEasy=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=32)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noop=t.GoEasyDomainNumber=t.goEasyArray=t.UUID=t.calibrator=undefined;var o=n(35),r=n(61),i=n(65),s=n(36);t.calibrator=o.calibrator,t.UUID=r.UUID,t.goEasyArray=i.goEasyArray,t.GoEasyDomainNumber=s.GoEasyDomainNumber,t.noop=function(){}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={WRITE:"WRITE",READ:"READ",NONE:"NONE"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={"default":"default",text:"text",image:"image",video:"video",audio:"audio",emoji:"emoji",file:"file"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n1?{type:u[o],data:e.substring(1)}:{type:u[o]}:c}o=new Uint8Array(e)[0];var r=sliceBuffer(e,1);return l&&"blob"===t&&(r=new l([r])),{type:u[o],data:r}},t.encodePayload=function(e,n,o){"function"==typeof n&&(o=n,n=null);var s=r(e);if(!e.length)return o("0:");!function(e,t,n){for(var o=new Array(e.length),r=i(e.length,n),s=function(e,n,r){t(n,function(t,n){o[e]=n,r(t,o)})},a=0;a32)throw Error("notification's title over max length 32");if(e.notification.body.length>50)throw Error("notification's body over max length 50");this.notification=e.notification}}},{key:"setPayload",value:function(e){this.payload=Object.create(null)}},{key:"setSenderId",value:function(){if(!r.IM.userId)throw Error("please call connect() first.");this.senderId=r.IM.userId}},{key:"setTo",value:function(e){this.to=e.to}},{key:"setData",value:function(){this.to&&this.to.type==a.ConversationType.GROUP&&(this.senderData=r.IM.userData)}}]),e}();t["default"]=c},function(e,t,n){"use strict";(function(e){var n,o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.FrameworkDetector=t.Framework=void 0,function(e){e.UNIAPP="UNIAPP",e.REACT_NATIVE="REACT_NATIVE",e.TARO="TARO",e.IONIC="IONIC",e.NATIVE_APPLET_WX="NATIVE_APPLET_WX",e.NATIVE_APPLET_ALIPAY="NATIVE_APPLET_ALIPAY",e.UNKNOWN="UNKNOWN"}(n=t.Framework||(t.Framework={}));var r=function(){function t(){var e,t,r;this.framework=null,this.methods=((e={})[n.UNIAPP]=this.isUniApp,e[n.REACT_NATIVE]=this.isReactNative,e[n.NATIVE_APPLET_WX]=this.isWXApplet,e);var i=this.methods,s=Object.keys(i);try{for(var a=o(s),u=a.next();!u.done;u=a.next()){var c=u.value;if((0,i[c])()){this.framework=c;break}}}catch(l){t={error:l}}finally{try{u&&!u.done&&(r=a["return"])&&r.call(a)}finally{if(t)throw t.error}}this.framework=this.framework||n.UNKNOWN,this.framework}return t.currentFramework=function(){return this.instance.framework},t.prototype.isUniApp=function(){return"object"==typeof uni&&!!uni.getSystemInfoSync},t.prototype.isReactNative=function(){return void 0!==e&&e.__fbGenNativeModule},t.prototype.isTaro=function(){return!1},t.prototype.isWXApplet=function(){return"undefined"!=typeof wx&&wx.getLocation&&"undefined"==typeof uni},t.instance=new t,t}();t.FrameworkDetector=r}).call(this,n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n31457280)throw Error("message-length limit 30mib")}},{key:"setPayload",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e),this.payload.contentType=e.file.type,this.payload.name=e.file.name,this.payload.size=e.file.size;var n=(window.URL||window.webkitURL).createObjectURL(e.file);this.payload.url=n}}]),t}();t["default"]=u},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),o=0,r=n.length;o=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.PlatformDetector=t.Platform=void 0,function(e){e.BROWSER="BROWSER",e.UNKNOWN="UNKNOWN",e.APP_IOS="APP_IOS",e.APP_ANDROID="APP_ANDROID",e.APPLET_WX="APPLET_WX",e.APPLET_ALIPAY="APPLET_ALIPAY",e.APPLET_BYTEDANCE="APPLET_BYTEDANCE"}(o=t.Platform||(t.Platform={}));var i=function(){function e(){var e,t,n;this.platform=null,this.methods=((e={})[o.BROWSER]=this.isBrowser,e[o.APP_IOS]=this.isAppiOS,e[o.APP_ANDROID]=this.isAppAndroid,e[o.APPLET_WX]=this.isWXApplet,e);var i=this.methods,s=Object.keys(i);try{for(var a=r(s),u=a.next();!u.done;u=a.next()){var c=u.value;if((0,i[c])()){this.platform=c;break}}}catch(l){t={error:l}}finally{try{u&&!u.done&&(n=a["return"])&&n.call(a)}finally{if(t)throw t.error}}this.platform=this.platform||o.UNKNOWN,this.platform}return e.currentPlatform=function(){return e.instance.platform},e.prototype.isBrowser=function(){return"undefined"!=typeof navigator&&"undefined"!=typeof document&&!!document.getElementById},e.prototype.isAppiOS=function(){return"object"==typeof uni&&!!uni.getSystemInfoSync&&"ios"===uni.getSystemInfoSync().platform&&"object"==typeof plus},e.prototype.isAppAndroid=function(){return"object"==typeof uni&&!!uni.getSystemInfoSync&&"android"===uni.getSystemInfoSync().platform&&"object"==typeof plus},e.prototype.isWXApplet=function(){return"object"==typeof wx&&!!wx.getSystemInfoSync&&"undefined"==typeof WebSocket&&"undefined"==typeof XMLHttpRequest&&"undefined"==typeof plus},e.prototype.isAlipayApplet=function(){return!1},e.prototype.isBytedanceApplet=function(){return!1},e.prototype.isQQApplet=function(){return!1},e.prototype.isBaiduApplet=function(){return!1},e.instance=new e,e}();t.PlatformDetector=i},function(e,t,n){"use strict";t.__esModule=!0,t.GoEasyIM=t.PubSub=t.MessageStatus=void 0;var o=n(10),r=n(7),i=n(9),s=n(108),a=n(0),u=n(133),c=n(11),l=n(134),f=n(135),p=n(136),d=n(137),h=n(139),y=n(141);!function(e){e["new"]="new",e.sending="sending",e.success="success",e.fail="fail"}(t.MessageStatus||(t.MessageStatus={}));var v=function(){function e(e){this.options=null,this.goEasySocket=null,this.publisher=null,this.subscriber=null,this.presence=null,this.histories=null,this.hereNows=null,this.neverConnect=!0,this.options=e}return e.prototype.initialGoEasySocket=function(e){this.goEasySocket=e,this.subscriber.initialGoEasySocket(),this.presence.initialGoEasySocket()},e.prototype.initialBeforeConnect=function(){this.neverConnect=!1,this.publisher=new p["default"](this),this.subscriber=new d["default"](this),this.histories=new l["default"](this),this.presence=new h["default"](this),this.hereNows=new f["default"](this)},e.prototype.validateOptions=function(){var e=this.options;if(!e.modules||!e.modules.includes(u.ModuleType.PUBSUB))throw Error("Invalid options: module '"+u.ModuleType.PUBSUB+"' is not enabled")},e.prototype.publish=function(e){this.validateOptions(),this.publisher.publish(e)},e.prototype.subscribe=function(e){this.validateOptions(),this.subscriber.subscribe(e)},e.prototype.unsubscribe=function(e){this.validateOptions(),this.subscriber.unsubscribe(e)},e.prototype.subscribePresence=function(e){this.validateOptions(),this.presence.subscribePresence(e)},e.prototype.unsubscribePresence=function(e){this.validateOptions(),this.presence.unsubscribePresence(e)},e.prototype.history=function(e){this.validateOptions(),this.histories.get(e)},e.prototype.hereNow=function(e){this.validateOptions(),this.hereNows.byChannel(e)},e.prototype.hereNowByUserIds=function(e){this.validateOptions(),this.hereNows.byUserId(e)},e.instance=null,e}();t.PubSub=v;var b=function(){function e(e){this.options=e}return e.prototype.initialBeforeConnect=function(e){c.im.initialBeforeConnect(e)},e.prototype.initialAfterConnect=function(){c.im.initialAfterConnect()},e.prototype.initialGoEasySocket=function(e){c.im.initialGoEasySocket(e)},e.prototype.validateOptions=function(){var e=this.options;if(!e.modules||!e.modules.includes(u.ModuleType.IM))throw Error("Invalid options: module '"+u.ModuleType.IM+"' is not enabled")},e.prototype.validateMessageToData=function(e){if(!a.calibrator.isObject(e.to))throw{code:400,content:"TypeError: to requires an object."};if(!a.calibrator.isObject(e.to.data))throw{code:400,content:"TypeError: to.data requires an object."}},e.prototype.on=function(e,t){this.validateOptions(),c.im.on(e,t)},e.prototype.createTextMessage=function(e){if(this.validateOptions(),this.validateMessageToData(e),!a.calibrator.isString(e.text))throw{code:400,content:"TypeError: text requires string."};return c.im.createTextMessage(e)},e.prototype.createImageMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createImageMessage(e)},e.prototype.createFileMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createFileMessage(e)},e.prototype.createAudioMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createAudioMessage(e)},e.prototype.createVideoMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createVideoMessage(e)},e.prototype.createCustomMessage=function(e){if(this.validateOptions(),this.validateMessageToData(e),!a.calibrator.isObject(e.payload))throw{code:400,content:"TypeError: payload requires an object."};return c.im.createCustomMessage(e)},e.prototype.latestConversations=function(e){this.validateOptions(),c.im.latestConversations().then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.removePrivateConversation=function(e){this.validateOptions(),c.im.removePrivateConversation(e.userId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.removeGroupConversation=function(e){this.validateOptions(),c.im.removeGroupConversation(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.history=function(e){this.validateOptions();var t=Object.assign(e,{friendId:e.userId});c.im.history(t).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.upload=function(e){this.validateOptions(),c.im.upload(e.file,e.name,e.onProgress).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.sendMessage=function(e){this.validateOptions(),c.im.sendMessage(e).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.markGroupMessageAsRead=function(e){this.validateOptions(),c.im.groupMarkAsRead(e.groupId,e.timestamp).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.markPrivateMessageAsRead=function(e){this.validateOptions(),c.im.privateMarkAsRead(e.userId,e.timestamp).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.topPrivateConversation=function(e){this.validateOptions(),c.im.topPrivateConversation(e.userId,e.top).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.topGroupConversation=function(e){this.validateOptions(),c.im.topGroupConversation(e.groupId,e.top).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.subscribeUserPresence=function(e){this.validateOptions(),c.im.subscribeUserPresence(e.userIds).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.unsubscribeUserPresence=function(e){this.validateOptions(),c.im.unsubscribeUserPresence(e.userId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.hereNow=function(e){this.validateOptions(),c.im.hereNow(e).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.subscribeGroup=function(e){this.validateOptions(),c.im.subscribeGroup(e).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.unsubscribeGroup=function(e){this.validateOptions(),c.im.unsubscribeGroup(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.subscribeGroupPresence=function(e){this.validateOptions(),c.im.subscribeGroupPresence(e.groupIds).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.unsubscribeGroupPresence=function(e){this.validateOptions(),c.im.unsubscribeGroupPresence(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.groupHereNow=function(e){this.validateOptions(),c.im.groupHereNow(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.groupOnlineCount=function(e){this.validateOptions(),c.im.groupOnlineCount(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e}();t.GoEasyIM=b;var m=function(){function e(t){if(this.im=null,this.pubsub=null,this.goEasySocket=null,this.notification=null,null!==e.instance&&e.instance.getConnectionStatus()!==i["default"].DISCONNECTED)return e.instance;this.validateOptions(t),this.options=t,this.pubsub=new v(this.options),this.im=new b(this.options),this.notification=new y.GoEasyNotification(this.options.allowNotification)}return e.getInstance=function(t){return null===e.instance&&(e.instance=new e(t)),e.instance},e.prototype.connect=function(e){this.getConnectionStatus()!==i["default"].DISCONNECTED&&a.calibrator.isObject(e)&&a.calibrator.isFunction(e.onFailed)?e.onFailed({code:408,content:"It is already connected, don't try again until disconnect() is called. "}):(this.confirmUserId(e),this.pubsub.initialBeforeConnect(),this.im.initialBeforeConnect({id:e.id,data:e.data}),this.goEasySocket=new s["default"](this.options,e),this.im.initialGoEasySocket(this.goEasySocket),this.goEasySocket.connect(this.notification),this.pubsub.initialGoEasySocket(this.goEasySocket),this.im.initialAfterConnect())},e.prototype.disconnect=function(e){this.goEasySocket.disconnect(e).then(function(){a.calibrator.isObject(e)&&a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isObject(e)&&a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.getConnectionStatus=function(){return this.goEasySocket?this.goEasySocket.getStatus():i["default"].DISCONNECTED},e.prototype.validateOptions=function(e){var t="";if(!a.calibrator.isObject(e))throw t="options is require an object.",Error(t);if(!a.calibrator.isPrimitive(e.appkey)||0==e.appkey.length)throw t="Invalid options:'host' is empty.",Error(t);if(!a.calibrator.isPrimitive(e.host)||0==e.host.length)throw t="Invalid options:'host' is empty.",Error(t);if(!a.calibrator.isArray(e.modules))throw t="Invalid options: 'modules' must be nonempty array",Error(t);var n=[u.ModuleType.IM,u.ModuleType.PUBSUB],o=e.modules.map(function(e){var o=e.toUpperCase();if(!n.includes(o))throw t="Invalid options: module '"+e+"' is not support",Error(t);return o});e.modules=o},e.prototype.onClickNotification=function(e){this.notification.onClickNotification(e)},e.prototype.confirmUserId=function(e){if(this.options.modules.includes(u.ModuleType.IM)&&(a.calibrator.isEmpty(e.id)||!a.calibrator.isStringOrNumber(e.id)))throw{code:400,content:"TypeError: id requires number or string."}},e.instance=null,e.version="2.2.4",e.IM_EVENT=o.ImEventType,e.IM_SCENE=r.ConversationType,e}();t["default"]=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eventCenter=undefined;var o=function(){function e(e,t){for(var n=0;n=0&&Math.floor(t)===t&&isFinite(e)}},{key:"isStringOrNumber",value:function(e){return"string"==typeof e||"number"==typeof e}},{key:"isString",value:function(e){return"string"==typeof e}},{key:"isNumber",value:function(e){return"number"==typeof e}},{key:"isArray",value:function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{key:"isEmpty",value:function(e){return this.isArray(e)?0==e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""==e.trim():!this.isDef(e))}},{key:"isNative",value:function(e){return"function"==typeof e&&/native code/.test(e.toString())}},{key:"isFunction",value:function(e){return"function"==typeof e}}]),e}());t.calibrator=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GoEasyDomainNumber=undefined;var o,r=function(){function e(e,t){for(var n=0;n0&&o=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.LocalStorageDispatcher=void 0;var r=n(67),i=function(){function e(){this.domain=null;this.domain="undefined"!=typeof location&&/^(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/.test(location.host)?location.host.split(".").slice(-2).join("."):null}return e.prototype.get=function(e){var t=r.Cookie.get(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){var n=new Date(2030,12,31,0,0,0,0),o=this.domain;r.Cookie.set(e,JSON.stringify(t),n,o)},e.prototype.remove=function(e){var t=this.domain;r.Cookie.remove(e,t)},e.prototype.support=function(){return navigator&&!0===navigator.cookieEnabled},e}(),s=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);return JSON.parse(t)},e.prototype.put=function(e,t){var n=localStorage.setItem(e,JSON.stringify(t));JSON.stringify(n)},e.prototype.remove=function(e){localStorage.removeItem(e)},e.prototype.support=function(){return!("undefined"==typeof localStorage||!localStorage.setItem)},e}(),a=function(){function e(){}return e.prototype.get=function(e){var t=uni.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){uni.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){uni.removeStorageSync(e)},e.prototype.support=function(){return!("object"!=typeof uni||!uni.getStorageSync)},e}(),u=function(){function e(){}return e.prototype.get=function(e){var t=wx.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){wx.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){wx.removeStorageSync(e)},e.prototype.support=function(){return!("object"!=typeof wx||!wx.getStorageSync)},e}(),c=(function(){function e(){}e.prototype.get=function(e){var t=my.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){my.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){my.removeStorageSync(e)},e.prototype.support=function(){return!("undefined"==typeof my||!my.getStorageSync)}}(),function(){function e(){}e.prototype.get=function(e){var t=qq.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){qq.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){qq.removeStorageSync(e)},e.prototype.support=function(){return!("undefined"==typeof qq||!qq.getStorageSync)}}(),function(){function e(){}e.prototype.get=function(e){var t=tt.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){tt.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){tt.removeStorageSync(e)},e.prototype.support=function(){return!("object"!=typeof tt||!tt.getStorageSync)}}(),function(){function e(){}e.prototype.get=function(e){var t=swan.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){swan.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){swan.removeStorageSync(e)},e.prototype.support=function(){return!("undefined"==typeof swan||!swan.getStorageSync)}}(),function(){function e(){this.api=e.dispatch(),this.api}e.dispatch=function(){var e=new s,t=new i;return e.support()?e:t},e.prototype.get=function(e){return this.api.get(e)},e.prototype.put=function(e,t){this.api.put(e,t)},e.prototype.remove=function(e){this.api.remove(e)},e.prototype.support=function(){return"undefined"!=typeof localStorage}}(),function(){function e(){this.supportedStorage=null;var t=e.storages;t.push(new a),t.push(new s),t.push(new u),t.push(new i),this.dispatch(),this.supportedStorage}return e.localStorage=function(){return this.instance.supportedStorage},e.prototype.dispatch=function(){var t,n;try{for(var r=o(e.storages),i=r.next();!i.done;i=r.next()){var s=i.value;if(s.support()){this.supportedStorage=s;break}}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}},e.storages=new Array,e.instance=new e,e}());t.LocalStorageDispatcher=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversion=undefined;var o,r=function(){function e(e,t){for(var n=0;n0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},h.prototype.cleanup=function(){for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||(y()?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...")):e.open(function(t){t?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):e.onreconnect()})))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},h.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){"use strict";var o=n(114),r=n(125);t.polling=function(e){var t=!1,n=!1;e.jsonp;if("undefined"!=typeof location){var r="https:"===location.protocol,i=location.port;i||(i=r?443:80),t=e.hostname!==location.hostname||i!==e.port,n=e.secure!==r}return e.xdomain=t,e.xscheme=n,new o(e)},t.websocket=r},function(e,t,n){(function(t){var o=n(49),r=Object.prototype.toString,i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===r.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===r.call(File);e.exports=function a(e){if(!e||"object"!=typeof e)return!1;if(o(e)){for(var n=0,r=e.length;n * @license MIT */ var o=n(117),r=n(118),i=n(119);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function h(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case undefined:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return L(e).length;default:if(o)return q(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){var o=e[t];e[t]=e[n],e[n]=o}function v(e,t,n,o,r){if(0===e.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:b(e,t,n,o,r);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,o,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,o,r){var i,s=1,a=e.length,u=t.length;if(o!==undefined&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var l=-1;for(i=n;ia&&(n=a-u),i=n;i>=0;i--){for(var f=!0,p=0;pr&&(o=r):o=r;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");o>i/2&&(o=i/2);for(var s=0;s>8,r=n%256,i.push(r),i.push(o);return i}(t,e.length-n),e,n,o)}function k(e,t,n){return 0===t&&n===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,n))}function S(e,t,n){n=Math.min(e.length,n);for(var o=[],r=t;r239?4:c>223?3:c>191?2:1;if(r+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[r+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[r+1],s=e[r+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[r+1],s=e[r+2],a=e[r+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,o.push(l>>>10&1023|55296),l=56320|1023&l),o.push(l),r+=f}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);var n="",o=0;for(;othis.length)return"";if((n===undefined||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,o,r){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(t===undefined&&(t=0),n===undefined&&(n=e?e.length:0),o===undefined&&(o=0),r===undefined&&(r=this.length),t<0||n>e.length||o<0||r>this.length)throw new RangeError("out of range index");if(o>=r&&t>=n)return 0;if(o>=r)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,r>>>=0,this===e)return 0;for(var i=r-o,s=n-t,a=Math.min(i,s),c=this.slice(o,r),l=e.slice(t,n),f=0;fr)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return g(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(e,t,n){var o="";n=Math.min(e.length,n);for(var r=t;ro)&&(n=o);for(var r="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,o,r,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw new RangeError("Index out of range")}function R(e,t,n,o){t<0&&(t=65535+t+1);for(var r=0,i=Math.min(e.length-n,2);r>>8*(o?r:1-r)}function A(e,t,n,o){t<0&&(t=4294967295+t+1);for(var r=0,i=Math.min(e.length-n,4);r>>8*(o?r:3-r)&255}function D(e,t,n,o,r,i){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,o,i){return i||D(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function U(e,t,n,o,i){return i||D(e,0,n,8),r.write(e,t,n,o,52,8),n+8}u.prototype.slice=function(e,t){var n,o=this.length;if(e=~~e,t=t===undefined?o:~~t,e<0?(e+=o)<0&&(e=0):e>o&&(e=o),t<0?(t+=o)<0&&(t=0):t>o&&(t=o),t0&&(r*=256);)o+=this[e+--t]*r;return o},u.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var o=this[e],r=1,i=0;++i=(r*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var o=t,r=1,i=this[e+--o];o>0&&(r*=256);)i+=this[e+--o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),r.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),r.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),r.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),r.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,o){(e=+e,t|=0,n|=0,o)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+r]=e/i&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):A(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t|=0,!o){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t|=0,!o){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):A(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,o){if(n||(n=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t=0;--r)e[r+t]=this[r+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=n===undefined?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===o){(t-=3)>-1&&i.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&i.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function L(e){return o.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,o){for(var r=0;r=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,n(25))},function(e,t,n){"use strict";var o,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,s={},a=0,u=0;function c(e){var t="";do{t=r[e%i]+t,e=Math.floor(e/i)}while(e>0);return t}function l(){var e=c(+new Date);return e!==o?(a=0,o=e):e+"."+c(a++)}for(;ua)&&e.nsecs===undefined&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,u=y,r=p;var b=(1e4*(268435455&(h+=122192928e5))+y)%4294967296;l[c++]=b>>>24&255,l[c++]=b>>>16&255,l[c++]=b>>>8&255,l[c++]=255&b;var m=h/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=p>>>8|128,l[c++]=255&p;for(var g=0;g<6;++g)l[c+g]=f[g];return t||s(l)}},function(e,t){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 o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},function(e,t){for(var n=[],o=0;o<256;++o)n[o]=(o+256).toString(16).substr(1);e.exports=function(e,t){var o=t||0,r=n;return[r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n-1&&e.splice(o,1)}},{key:"unshiftGuid",value:function(e){var t=!1,n=this.findIndex(function(t){return t==e});for(n>-1&&(t=!0,this.splice(n,1)),this.unshift(e);this.length>300;)this.pop();return t}}]),t}());t.goEasyArray=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={maxNumber:5}},function(e,t,n){"use strict";var o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.Cookie=void 0;var r=function(){function e(){}return e.get=function(e){var t,n,r=encodeURIComponent(e)+"=",i=document.cookie.split("; ");try{for(var s=o(i),a=s.next();!a.done;a=s.next()){var u=a.value;if(u.startsWith(r))return decodeURIComponent(u.substring(r.length))}}catch(c){t={error:c}}finally{try{a&&!a.done&&(n=s["return"])&&n.call(s)}finally{if(t)throw t.error}}return null},e.set=function(e,t,n,o,r,i){void 0===r&&(r="/"),void 0===i&&(i=!1);var s=encodeURIComponent(e)+"="+encodeURIComponent(t);n instanceof Date&&(s+="; expires="+n.toGMTString()),r&&(s+="; path="+r),o&&(s+="; domain="+o),i&&(s+="; secure"),document.cookie=s},e.remove=function(t,n,o,r){void 0===o&&(o="/"),void 0===r&&(r=!1),e.set(t,"",new Date(0),n,o,r)},e}();t.Cookie=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.messageCreator=undefined;var o=function(){function e(e,t){for(var n=0;n3072)throw Error("message-length limit 3kb")}}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(84),r=a(n(85)),i=a(n(41)),s=a(n(2));function a(e){return e&&e.__esModule?e:{"default":e}}t["default"]=function u(e,t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),e==s["default"].video?new r["default"](t):e==s["default"].audio||e==s["default"].image||e==s["default"].file?new i["default"](t):o.simplePayloadBuilder}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simplePayloadBuilder=undefined;var o,r=function(){function e(e,t){for(var n=0;n=200&&r.status<300||304==r.status){var t=e.payload;t.message=r.responseText,n({code:200,content:t})}else o({code:r.status,content:r.responseText})}})}catch(n){return new Promise(function(e,t){t({code:500,content:n})})}}}]),t}());t.htmlFileUploader=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n30&&(e.limit=30),r.calibrator.isDef(e.friendId)){if(!r.calibrator.isStringOrNumber(e.friendId))throw Error("TypeError: friendId require string or number.");r.calibrator.isNumber(e.friendId)&&(e.friendId=e.friendId.toString())}else{if(!r.calibrator.isStringOrNumber(e.groupId))throw Error("TypeError: groupId require string or number.");r.calibrator.isNumber(e.groupId)&&(e.groupId=e.groupId.toString())}return e}},{key:"transformHistories",value:function(e,t){var n=[];return e&&e.content&&e.content.map(function(e){var o=Object.create(null);o.messageId=e.i,o.timestamp=e.ts,o.senderId=e.s,o.type=e.mt,o.payload=JSON.parse(e.p),t.groupId&&e.d&&(o.senderData=JSON.parse(e.d)),n.push(o)}),n}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n-1?(s=this.list[o],this.list.splice(o,1),s.lc-1?(c=this.list[u],this.list.splice(u,1),c.unread=0,c.lc=c.lm,c.lastMessage=s,e.status===h["default"].success&&(c.lc=e.timestamp,c.lm=e.timestamp)):c=r.Conversion.buildByOutMessage(s,t,n,o),c.data=o;var l=this.im._dataCache;t===a.ConversationType.GROUP?l.putGroupData(c.groupId,o):(l.putUserData(c.userId,o),c.lastMessage.senderData=i.IM.userData),this.insertOne(c),this.onUpdated()}},{key:"imLastConversations",value:function(e,t){var n=new u["default"]({name:f.EmitType.imLastConversations,params:{},permission:c["default"].READ,singleTimeout:l.SocketTimeout.commonQuerySingle,totalTimeout:l.SocketTimeout.commonQueryTotal,fail:t,success:e});this.im._goEasySocket.emit(n)}},{key:"loadServerConversations",value:function(){var e=this,t=this.im;return new Promise(function(n,o){e.imLastConversations(function(i){if(200==i.code){for(var s=i.content,u=function(n,o){var i=s[n],u=e.list.find(function(e){return i.t==a.ConversationType.GROUP&&i.g==e.groupId||i.t==a.ConversationType.PRIVATE&&i.uid==e.userId});p.calibrator.isDef(u)?u.top=i.top:(u=r.Conversion.buildByConversation(t._dataCache,i),e.insertOne(u))},c=0,l=s.length;c1;){t=Math.floor((o+r)/2),n=this.list[t];var i=this.compares(e,n);if(0==i)return t;i>0?o=t:r=t}return 0==o&&this.compares(this.list[0],e)>0?-1:o}},{key:"compares",value:function(e,t){var n=void 0;return(n=e.top==t.top?t.lastMessage.timestamp-e.lastMessage.timestamp:e.top?-1:1)>0?1:0===n?0:-1}},{key:"removeConversation",value:function(e,t){var n=this,o=t==a.ConversationType.PRIVATE?"userId":"groupId";return p.calibrator.isStringOrNumber(e)?(p.calibrator.isNumber(e)&&(e=e.toString()),-1==this.findConversationIndex(t,e)?Promise.reject({code:400,content:"Failed to remove conversation, "+o+" does not exists."}):new Promise(function(o,r){var i={targetId:e,type:t};n.requestEmit(f.EmitType.removeConversation,i,function(i){var s=n.findConversationIndex(t,e);s>-1&&n.list.splice(s,1),n.onUpdated(),200==i.code?o({}):r({code:i.code||408,content:i.content||"Failed to remove conversation"})},function(e){r({code:e.code||408,content:e.content||"Failed to remove conversation"})})})):Promise.reject({code:400,content:"Failed to remove conversation, "+o+" must be a string or integer."})}},{key:"topConversation",value:function(e,t,n){var o=this,r=n==a.ConversationType.PRIVATE?"userId":"groupId";if(!p.calibrator.isStringOrNumber(e))return Promise.reject({code:400,content:"Failed to top conversation, "+r+" must be a string or integer."});p.calibrator.isNumber(e)&&(e=e.toString());var i=this.findConversationIndex(n,e);return-1==i||this.list[i].top==t?Promise.reject({code:400,content:"Failed to top conversation, "+r+" does not exists."}):new Promise(function(r,i){var s={targetId:e,top:t,type:n};o.requestEmit(f.EmitType.topConversation,s,function(){var i=o.findConversationIndex(n,e),s=o.list[i];s.top=t,o.list.splice(i,1),o.insertOne(s),o.onUpdated(),r({})},function(e){i({code:e.code||408,content:e.content||"Failed to top Conversation"})})})}},{key:"requestEmit",value:function(e,t,n,o){var r=new u["default"]({name:e,params:t,permission:c["default"].WRITE,singleTimeout:l.SocketTimeout.commonRequestSingle,totalTimeout:l.SocketTimeout.commonRequestTotal,success:n,fail:o});this.im._goEasySocket.emit(r)}},{key:"findConversationIndex",value:function(e,t){return this.list.findIndex(function(n){return e==a.ConversationType.PRIVATE?n.type==e&&n.userId==t:n.type==e&&n.groupId==t})}}]),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n300){if(p.calibrator.isObject(e)&&p.calibrator.isFunction(e.onFailed))throw{code:400,content:"user.data-length limit 300 byte."}}else this.userData=e.data;this.otp=e.otp||null}},{key:"setUriAndOpts",value:function(e){var t="://"+p.GoEasyDomainNumber.refreshNumber()+e.host,n=!0;if(v.PlatformDetector.currentPlatform()===v.Platform.BROWSER){var o=void 0;!0===e.supportOldBrowser?(o=["polling","websocket"],n=!1):o=["websocket"],!1!==e.forceTLS&&n?this.uri="https"+t+":443":this.uri="http"+t+":80",this.ioOpts={transports:o,timeout:h.SocketTimeout.connect}}else this.uri="https://wx-"+e.host+":443",this.ioOpts={transports:["websocket"],reconnectionDelayMax:h.SocketTimeout.reconnectionDelayMax}}},{key:"onIoReconnected",value:function(){this.status===l["default"].RECONNECTING&&this.authorize()}},{key:"emit",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,e)}},{key:"doEmit",value:function(e,t,n){d.uniApp.overrideUniShowHideMethods(),t.sid=this.sid,this.ioSocket.doEmit(e,t,n)}},{key:"sendAck",value:function(e,t){this.ioSocket.io.emit(e,t)}},{key:"connect",value:function(e){var n=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"connect",this).call(this),this.onConnecting(this.reconnectingTimes),this.ioSocket.connect({uri:this.uri,opts:this.ioOpts}),e&&e.supportNotification()&&e.getRegIdPromise()?e.getRegIdPromise().then(function(e){n.regId=e,n.authorize()})["catch"](function(e){console.warn("Failed to register the Manufacturers Push service:"+JSON.stringify(e)),n.authorize()}):this.authorize()}},{key:"disconnect",value:function(){var e=this;return new Promise(function(t,n){var o=function(){e.status=l["default"].DISCONNECTED,e.ioSocket.disconnect(),t()};if(e.allowNotification){var r=new u["default"]({name:s.EmitType.manualDisconnect,params:{},permission:c["default"].READ,singleTimeout:h.SocketTimeout.commonInfiniteSingle,totalTimeout:h.SocketTimeout.commonInfiniteTotal,fail:function(e){n(e)},success:o});e.emit(r)}else o()})}},{key:"authorize",value:function(){var e={appkey:this.appKey,userId:this.userId,userData:JSON.stringify(this.userData),otp:this.otp,artifactVersion:this.artifactVersion,sid:this.sid,allowNT:this.allowNotification,regId:this.regId,modules:this.modules,a:this.anonymous,z:m.clientInfo.z};JSON.stringify(e);var t=new u["default"]({name:s.EmitType.authorize,params:e,permission:c["default"].NONE,singleTimeout:h.SocketTimeout.commonInfiniteSingle,totalTimeout:h.SocketTimeout.commonInfiniteTotal,success:this.onAuthorizeSuccess.bind(this),fail:this.onAuthorizeFailed.bind(this)});this.ioSocket.emit(t)}},{key:"onConnecting",value:function(){this.notify(this.connectingObservers,this.reconnectingTimes)}},{key:"onIoReconnecting",value:function(){d.uniApp.overrideUniShowHideMethods(),this.reconnectingTimes++,this.status==l["default"].CONNECTED||this.status==l["default"].EXPIRED_RECONNECTED||this.status==l["default"].RECONNECTING?this.status=l["default"].RECONNECTING:this.status=l["default"].CONNECTING,this.onConnecting()}},{key:"onIoDisconnected",value:function(){this.status==l["default"].DISCONNECTING&&(this.status=l["default"].DISCONNECTED,this.notify(this.disconnectedObservers))}},{key:"onAuthorizeSuccess",value:function(e){(!0===this.anonymous&&e.u&&(b.AnonymousUserIdRepository.put(e.u),this.userId=e.u),this.status===l["default"].RECONNECTING)?this.sid!==e.sid?(this.status=l["default"].EXPIRED_RECONNECTED,this.notify(this.expiredReconnectedObservers)):this.status=l["default"].RECONNECTED:(this.status=l["default"].CONNECTED,this.sid=e.sid);e.enablePublish&&(this.permissions.find(function(e){return e==c["default"].WRITE})||this.permissions.push(c["default"].WRITE)),e.enableSubscribe&&(this.permissions.find(function(e){return e==c["default"].READ})||this.permissions.push(c["default"].READ)),this.reconnectingTimes=0,this.notify(this.connectedObservers)}},{key:"onAuthorizeFailed",value:function(e){this.ioSocket.disconnect(),this.status=l["default"].CONNECT_FAILED;var t={code:e.resultCode||408,content:e.content||"Host unreachable or timeout"};this.notify(this.connectFailedObservers,t)}},{key:"addConnectingObserver",value:function(e){p.calibrator.isFunction(e)&&this.connectingObservers.push(e)}},{key:"addConnectFailedObserver",value:function(e){p.calibrator.isFunction(e)&&this.connectFailedObservers.push(e)}},{key:"addExpiredReconnectedObserver",value:function(e){p.calibrator.isFunction(e)&&this.expiredReconnectedObservers.push(e)}},{key:"addMessageObserver",value:function(e,t){var n=this;this.ioSocket.io.on(e,function(t){n.notifyMessageObservers(e,t)}),this.messageObservers[e]||(this.messageObservers[e]=[]),this.messageObservers[e].push(new f["default"](t))}},{key:"notifyMessageObservers",value:function(e,t){for(var n=this.messageObservers[e],o=0;o0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=l,l.priorWebsocketSuccess=!1,i(l.prototype),l.protocol=a.protocol,l.Socket=l,l.Transport=n(29),l.transports=n(51),l.parser=n(13),l.prototype.createTransport=function(e){var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=a.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new r[e]({query:t,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})},l.prototype.open=function(){var e;if(this.rememberUpgrade&&l.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(n){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},l.prototype.setTransport=function(e){e.name;var t=this;this.transport&&(this.transport.name,this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},l.prototype.probe=function(e){var t=this.createTransport(e,{probe:1}),n=!1,o=this;function r(){if(o.onlyBinaryUpgrades){var e=!this.supportsBinary&&o.transport.supportsBinary;n=n||e}n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",function(e){if(!n)if("pong"===e.type&&"probe"===e.data){if(o.upgrading=!0,o.emit("upgrading",t),!t)return;l.priorWebsocketSuccess="websocket"===t.name,o.transport.name,o.transport.pause(function(){n||"closed"!==o.readyState&&(f(),o.setTransport(t),t.send([{type:"upgrade"}]),o.emit("upgrade",t),t=null,o.upgrading=!1,o.flush())})}else{var r=new Error("probe error");r.transport=t.name,o.emit("upgradeError",r)}}))}function i(){n||(n=!0,f(),t.close(),t=null)}function s(e){var n=new Error("probe error: "+e);n.transport=t.name,i(),o.emit("upgradeError",n)}function a(){s("transport closed")}function u(){s("socket closed")}function c(e){t&&e.name!==t.name&&(e.name,t.name,i())}function f(){t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",a),o.removeListener("close",u),o.removeListener("upgrading",c)}l.priorWebsocketSuccess=!1,t.once("open",r),t.once("error",s),t.once("close",a),this.once("close",u),this.once("upgrading",c),t.open()},l.prototype.onOpen=function(){if(this.readyState="open",l.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause)for(var e=0,t=this.upgrades.length;e';o=document.createElement(e)}catch(t){(o=document.createElement("iframe")).name=n.iframeId,o.src="javascript:0"}o.id=n.iframeId,n.form.appendChild(o),n.iframe=o}this.form.action=this.uri(),l(),e=e.replace(a,"\\\n"),this.area.value=e.replace(s,"\\n");try{this.form.submit()}catch(f){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&c()}:this.iframe.onload=c}}).call(this,n(25))},function(e,t,n){"use strict";var o=n(29),r=n(22),i=n(13),s=n(30),a=n(54);n(8)("engine.io-client:polling");e.exports=c;var u=null!=new(n(123))({xdomain:!1}).responseType;function c(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),o.call(this,e)}s(c,o),c.prototype.name="polling",c.prototype.doOpen=function(){this.poll()},c.prototype.pause=function(e){var t=this;function n(){t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var o=0;this.polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()},c.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},c.prototype.onData=function(e){var t=this;i.decodePayload(e,this.socket.binaryType,function(e,n,o){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():this.readyState)},c.prototype.doClose=function(){var e=this;function t(){e.write([{type:"close"}])}"open"===this.readyState?t():this.once("open",t)},c.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};i.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},c.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=r.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){"use strict";e.exports=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var o in e)n.call(e,o)&&t.push(o);return t}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],o=t[1];return 3*(n+o)/4-o},t.toByteArray=function(e){var t,n,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i=[],s=0,a=n-r;sa?a:s+16383));1===r?(t=e[n-1],i.push(o[t>>2]+o[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(o[t>>10]+o[t>>4&63]+o[t<<2&63]+"="));return i.join("")};for(var o=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var r,i,s=[],a=t;a>18&63]+o[i>>12&63]+o[i>>6&63]+o[63&i]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(e,t){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ t.read=function(e,t,n,o,r){var i,s,a=8*r-o-1,u=(1<>1,l=-7,f=n?r-1:0,p=n?-1:1,d=e[t+f];for(f+=p,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+f],f+=p,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=o;l>0;s=256*s+e[t+f],f+=p,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:(d?-1:1)*Infinity;s+=Math.pow(2,o),i-=c}return(d?-1:1)*s*Math.pow(2,i-o)},t.write=function(e,t,n,o,r,i){var s,a,u,c=8*i-r-1,l=(1<>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=o?0:i-1,h=o?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===Infinity?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,r),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,r),s=0));r>=8;e[n+d]=255&a,d+=h,a/=256,r-=8);for(s=s<0;e[n+d]=255&s,d+=h,s/=256,c-=8);e[n+d-h]|=128*y}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){function n(){}e.exports=function(e,t,o){var r=!1;return o=o||n,i.count=e,0===e?t():i;function i(e,n){if(i.count<=0)throw new Error("after called too many times");--i.count,e?(r=!0,t(e),t=o):0!==i.count||r||t(null,n)}}},function(e,t,n){"use strict"; /*! https://mths.be/utf8js v2.1.2 by @mathias */var o,r,i,s=String.fromCharCode;function a(e){for(var t,n,o=[],r=0,i=e.length;r=55296&&t<=56319&&r=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(e,t){return s(e>>t&63|128)}function l(e,t){if(0==(4294967168&e))return s(e);var n="";return 0==(4294965248&e)?n=s(e>>6&31|192):0==(4294901760&e)?(u(e,t)||(e=65533),n=s(e>>12&15|224),n+=c(e,6)):0==(4292870144&e)&&(n=s(e>>18&7|240),n+=c(e,12),n+=c(e,6)),n+=s(63&e|128)}function f(){if(i>=r)throw Error("Invalid byte index");var e=255&o[i];if(i++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function p(e){var t,n;if(i>r)throw Error("Invalid byte index");if(i==r)return!1;if(t=255&o[i],i++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|f())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|f()<<6|f())>=2048)return u(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|f()<<12|f()<<6|f())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}e.exports={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,o=a(e),r=o.length,i=-1,s="";++i65535&&(r+=s((t-=65536)>>>10&1023|55296),t=56320|1023&t),r+=s(t);return r}(c)}}},function(e,t){var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,o=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),r=o&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;function s(e){return e.map(function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e})}function a(e,t){t=t||{};var o=new n;return s(e).forEach(function(e){o.append(e)}),t.type?o.getBlob(t.type):o.getBlob()}function u(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=o?r?Blob:u:i?a:undefined},function(e,t,n){"use strict";var o=n(124);e.exports=function(e){var t=e.xdomain,n=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||o))return new XMLHttpRequest}catch(i){}try{if("undefined"!=typeof XDomainRequest&&!n&&r)return new XDomainRequest}catch(i){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(i){}}},function(e,t){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(n){e.exports=!1}},function(e,t,n){"use strict";(function(t){var o,r,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=n(29),a=n(13),u=n(22),c=n(30),l=n(54);n(8)("engine.io-client:websocket");if("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{r=n(126)}catch(d){}var f=o||r;function p(e){e&&e.forceBase64&&(this.supportsBinary=!1),("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=o&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(f=r)),s.call(this,e)}"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket||(f=function(e){var t=this;if(t.onopen=function(){},t.onclose=function(){},t.onmessage=function(e){},t.onerror=function(e){},"object"===("undefined"==typeof tt?"undefined":i(tt))&&tt.getSystemInfo){var n=tt.connectSocket({url:e});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen(function(){t.onopen()}),n.onError(function(e){t.onerror(e)}),n.onMessage(function(e){t.onmessage(e)}),n.onClose(function(){t.onclose()})}else if("undefined"!=typeof uni){var o=uni.connectSocket({url:e,complete:function(){}});t.send=function(e){o.send({data:e})},t.close=function(){o.close()},o.onOpen(function(e){t.onopen()}),o.onError(function(e){t.onerror(e)}),o.onMessage(function(e){t.onmessage(e)}),o.onClose(function(e){t.onclose()})}else{var r=wx.connectSocket({url:e});t.send=function(e){r.send({data:e})},t.close=function(e){r.close({code:1e3})},r.onOpen(function(){t.onopen()}),r.onError(function(e){t.onerror(e)}),r.onMessage(function(e){t.onmessage(e)}),r.onClose(function(e){t.onclose(e)})}}),e.exports=p,c(p,s),p.prototype.name="websocket",p.prototype.supportsBinary=!1,p.prototype.doOpen=function(){if(this.check()){var e,t,n=this.uri();("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(e=this.protocols),(t="undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(t.headers=this.extraHeaders),this.localAddress&&(t.localAddress=this.localAddress);try{"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new f(n,e):new f(n):new f(n,e,t):this.ws=new f(n)}catch(o){return this.emit("error",o)}this.ws.binaryType===undefined&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},p.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},p.prototype.write=function(e){var n=this;this.writable=!1;for(var o=e.length,r=0,i=o;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n-1||(this.guidList.unshift(t.i),this.guidList.length>300&&this.guidList.pop(),this.callback(t))}}]),e}();t["default"]=i},function(e,t,n){"use strict";t.__esModule=!0,t.AnonymousUserIdRepository=void 0;var o=n(0),r=n(37),i=function(){function e(){}return e.get=function(){var t=e.storage;if(null!==t){var n=t.get(e.ANONYMOUS_USER_ID_KEY);if(!o.calibrator.isEmpty(n))return n}return null},e.put=function(t){var n=e.storage;null!==n&&n.put(e.ANONYMOUS_USER_ID_KEY,t)},e.storage=r.LocalStorageDispatcher.localStorage(),e.ANONYMOUS_USER_ID_KEY="goeasy-anonymous-user-id",e}();t.AnonymousUserIdRepository=i},function(e,t,n){"use strict";t.__esModule=!0,t.clientInfo=void 0;var o=n(31),r=n(15),i=new(function(){function e(){this.platform=o.PlatformDetector.currentPlatform(),this.framework=r.FrameworkDetector.currentFramework(),this.z=this.toZ()}return e.prototype.toZ=function(){for(var e=JSON.stringify({platform:this.platform,framework:this.framework}),t="",n=0;n500)e.onFailed({code:400,content:"userIds is over max length 500"});else{var n=new s["default"]({name:i.EmitType.hereNowByUserIds,permission:a["default"].READ,params:t,singleTimeout:u.SocketTimeout.commonQuerySingle,totalTimeout:u.SocketTimeout.commonQueryTotal,success:function(t){var n=t.content;n=n.map(function(e){var t={};return t.id=e.userId,t.data=e.userData?JSON.parse(e.userData):{},t}),e.onSuccess({code:t.resultCode||t.code||200,content:n})},fail:function(t){e.onFailed({code:t.resultCode||t.code||200,content:t.content})}});this.pubSub.goEasySocket.emit(n)}}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n32)throw{code:400,content:"TypeError: notification.title over max length 32."};if(r.calibrator.isEmpty(e.notification.body))throw{code:400,content:"notification.body is required."};if(!r.calibrator.isString(e.notification.body))throw{code:400,content:"TypeError: notification.body must be string."};if(e.notification.body.length>50)throw{code:400,content:"notification.body over max length 50."}}else if(r.calibrator.isPrimitive(e.notification))throw{code:400,content:"TypeError: notification requires an object."};var t={channel:e.channel,content:e.message,nt:e.notification,at:e.accessToken,guid:r.UUID.get()},n=new i["default"]({name:s.EmitType.publish,params:t,singleTimeout:u.SocketTimeout.commonRequestSingle,totalTimeout:u.SocketTimeout.commonRequestTotal,permission:a["default"].WRITE,success:function(t){e.onSuccess({code:200,content:"ok"})},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});this.pubSub.goEasySocket.emit(n)}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n-1)){e.a&&this.pubSub.goEasySocket.sendAck("ack",{publishGuid:e.i});var t={time:e.t,channel:e.n,content:e.c};p.GoEasyEventCenter.fire(d.PUBSUB_INTERNAL_EVENTS.MESSAGE_RECEIVED,e),this.findSubscriptionByChannel(t.channel).onMessage(t)}}},{key:"formatOptions",value:function(e){var t=!r.calibrator.isEmpty(e.channel),n=!r.calibrator.isEmpty(e.channels);if(this.formatCallback(e),r.calibrator.isFunction(e.onMessage)||(e.onMessage=r.noop),!t&&!n)return e.onFailed({code:400,content:"channel is required"}),!1;if(!t||!n){if(t&&(r.calibrator.isNumber(e.channel)&&(e.channel=e.channel.toString()),e.channels=[e.channel]),n){if(!Array.isArray(e.channels)||0==e.channels.length)return void e.onFailed({code:400,content:"channels must be an array"});if(e.channels.length>500)return e.onFailed({code:400,content:"channels over max length:500"}),!1;for(var o=0,i=e.channels.length;o=0;o--){for(var r=this.subscriptions[o].channels,i=0;i500)return e.onFailed({code:400,content:"channels over max length:500"}),!1;for(var o=0,i=e.channels.length;o=0;o--){for(var r=this.presenters[o].channels,i=0;i0)&&!(o=i.next()).done;)s.push(o.value)}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(r)throw r.error}}return s};t.__esModule=!0,t.GoEasyNotification=void 0;var r=n(59),i=n(0),s=n(27),a=n(46),u=n(60),c=n(15),l=n(31),f=n(16),p=n(11),d=n(7),h=function(){function e(e){this.uniappPlugin=null,this.regIdPromise=null,this.onClickNotificationCallback=null,this.allowNotification=e,this.supportNotification()&&(this.uniappPlugin=uni.requireNativePlugin("GoEasy-Uniapp"),this.uniappPlugin?this.regIdPromise=this.askRegId():console.warn("No GoEasy-Uniapp Native Plugin."),this.listenNewMessage())}return e.prototype.listenNewMessage=function(){var e=this;s.GoEasyEventCenter.on(a.IM_INTERNAL_EVENTS.MESSAGE_RECEIVED,function(t){return e.onReceivedIMMessage(t)}),s.GoEasyEventCenter.on(u.PUBSUB_INTERNAL_EVENTS.MESSAGE_RECEIVED,function(t){return e.onReceivedPubSubMessage(t)})},e.prototype.onReceivedIMMessage=function(e){var t=this;if(i.calibrator.isObject(e.nt)&&r.uniApp.runningBackend()){var n=f["default"].assemble(e),s={id:n.messageId,tm:n.timestamp,t:n.type,sid:n.senderId,rid:n.receiverId,gid:n.groupId,tt:e.t,nt:e.nt,sd:null,gd:null};e.t===d.ConversationType.PRIVATE?p.im._dataCache.loadData(n.senderId,d.ConversationType.PRIVATE).then(function(e){s.sd=JSON.stringify(e),t.createLocalNotification(s)})["catch"](function(e){t.createLocalNotification(s)}):e.t===d.ConversationType.GROUP?Promise.all([p.im._dataCache.loadData(n.senderId,d.ConversationType.PRIVATE),p.im._dataCache.loadData(n.groupId,d.ConversationType.GROUP)]).then(function(e){var n=o(e,2),r=n[0],i=n[1];s.sd=JSON.stringify(r),s.gd=JSON.stringify(i),t.createLocalNotification(s)})["catch"](function(e){t.createLocalNotification(s)}):this.createLocalNotification(s)}},e.prototype.onReceivedPubSubMessage=function(e){if(i.calibrator.isObject(e.nt)&&r.uniApp.runningBackend()){var t={ch:e.n,ctt:e.c,nt:e.nt};this.createLocalNotification(t)}},e.prototype.createLocalNotification=function(e){var t=e.nt.t,n=e.nt.c,o=Object.assign({title:t,body:n},e,{g:1});delete o.nt,i.calibrator.isObject(o)&&o.body&&o.title?this.uniappPlugin?this.uniappPlugin.createLocalNotification(o):"undefined"!=typeof plus&&plus.push.createMessage(o.body,JSON.stringify(o),{title:o.title}):console.warn("The notification message must contain the and <body> fields")},e.prototype.askRegId=function(){var e=this,t=null,n=0,o=function(){return new Promise(function(r,i){e.uniappPlugin.regId(function(e){r(e)},function(r){if(!(1e6===r.data.code&&n<=10))return clearTimeout(t),i(r);t=setTimeout(function(){n++,e.regIdPromise=o()},3500)})})};return o()},e.prototype.getRegIdPromise=function(){return this.regIdPromise},e.prototype.supportNotification=function(){var e=l.PlatformDetector.currentPlatform(),t=c.FrameworkDetector.currentFramework();return this.allowNotification&&t===c.Framework.UNIAPP&&(e===l.Platform.APP_ANDROID||e===l.Platform.APP_IOS)},e.prototype.parseMessage=function(e){return e.ch?{channel:e.ch,content:e.ctt}:{messageId:e.id,timestamp:e.tm,type:e.t,senderId:e.sid,senderData:e.sd?JSON.parse(e.sd):undefined,toType:e.tt,groupId:e.gid,groupData:e.gd?JSON.parse(e.gd):undefined}},e.prototype.listenIOSUserNotificationClick=function(){var e=this;this.uniappPlugin.onClickNotification(function(t){if(e.availableIntent(t)){var n=e.parseMessage(t);e.onClickNotificationCallback(n)}})},e.prototype.listenAndroidNewIntent=function(){var e=this;plus.globalEvent.addEventListener("newintent",function(){var t=plus.runtime.arguments;try{var n=JSON.parse(t);if(n=e.extactIntentIfXiaoMi(n),!e.availableIntent(n))return;var o=e.parseMessage(n);e.onClickNotificationCallback(o)}catch(r){}},!1)},e.prototype.listenPlusClickNotification=function(){var e=this;plus.push.addEventListener("click",function(t){if(t&&t.payload)try{var n="string"==typeof t.payload?JSON.parse(t.payload):t.payload,o=e.parseMessage(n);e.onClickNotificationCallback(o)}catch(r){}})},e.prototype.listenGoEasyClickNotification=function(){var e=l.PlatformDetector.currentPlatform();e===l.Platform.APP_IOS?this.listenIOSUserNotificationClick():e===l.Platform.APP_ANDROID&&this.listenAndroidNewIntent(),this.getIntentData()},e.prototype.availableIntent=function(e){return e&&Object.keys(e).length&&e.g&&1===parseInt(e.g)},e.prototype.extactIntentIfXiaoMi=function(e){var t=/content=\{(\{.*\})\},/;if(e.key_message&&t.exec(e.key_message)){var n=e.key_message.match(t);e=n.length?JSON.parse(n[1]):null}return e},e.prototype.getIntentData=function(){var e=this;this.uniappPlugin.getIntentData(function(t){if(e.availableIntent(t)){var n=e.parseMessage(t);e.onClickNotificationCallback(n)}})},e.prototype.onClickNotification=function(e){if(this.supportNotification()){if(!i.calibrator.isFunction(e))throw new Error("The arguments must be a function.");null===this.onClickNotificationCallback?(this.onClickNotificationCallback=e,this.uniappPlugin?this.listenGoEasyClickNotification():this.listenPlusClickNotification()):console.warn("The onClickNotification event has been listened on. Please do not listen to it more than once.")}else console.warn("The current environment doesn't support or allowNotification is false.")},e}();t.GoEasyNotification=h}])["default"]});