easemob-websdk 4.24.2 → 4.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Easemob-chat.js +1 -1
- package/miniCore/miniCore.js +1 -1
- package/miniProgram/Easemob-chat.js +1 -1
- package/package.json +1 -1
- package/uniApp/Easemob-chat.js +1 -1
package/uniApp/Easemob-chat.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see Easemob-chat.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.websdk=t():e.websdk=t()}(this,(function(){return function(){var e={83:function(e,t,r){e.exports=a;var n,o,i=r(101);function a(e,t,r,n,a,s){if(i.call(this,e,t,n,void 0,void 0,a,s),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}((a.prototype=Object.create(i.prototype)).constructor=a).className="MapField",a.fromJSON=function(e,t){return new a(e,t.id,t.keyType,t.type,t.options,t.comment)},a.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},a.prototype.resolve=function(){if(this.resolved)return this;if(void 0===n.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},a.d=function(e,t,r){return"function"==typeof r?r=o.decorateType(r).name:r&&"object"==typeof r&&(r=o.decorateEnum(r).name),function(n,i){o.decorateType(n.constructor).add(new a(i,e,t,r))}},a._configure=function(){n=r(452),o=r(629)}},87:function(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},101:function(e,t,r){e.exports=u;var n,o,i,a,s=r(558);((u.prototype=Object.create(s.prototype)).constructor=u).className="Field";var c=/^required|optional|repeated$/;function u(e,t,r,n,a,u,l){if(i.isObject(n)?(l=a,u=n,n=a=void 0):i.isObject(a)&&(l=u,u=a,a=void 0),s.call(this,e,u),!i.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!i.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!c.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==a&&!i.isString(a))throw TypeError("extend must be a string");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=a||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!i.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=l}u.fromJSON=function(e,t){return new u(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(u.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),u.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),s.prototype.setOption.call(this,e,t,r)},u.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},u.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof a?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof n&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof n)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=i.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;i.utf8.write(this.typeDefault,e=i.newBuffer(i.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=i.emptyObject:this.repeated?this.defaultValue=i.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof a&&(this.parent.ctor.prototype[this.name]=this.defaultValue),s.prototype.resolve.call(this)},u.d=function(e,t,r,n){return"function"==typeof t?t=i.decorateType(t).name:t&&"object"==typeof t&&(t=i.decorateEnum(t).name),function(o,a){i.decorateType(o.constructor).add(new u(a,e,t,r,{default:n}))}},u._configure=function(){a=r(465),n=r(660),o=r(452),i=r(629)}},177:function(e,t,r){"use strict";e.exports=s;var n,o,i,a=r(694);function s(e,t){a.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}((s.prototype=Object.create(a.prototype)).constructor=s).className="Service",s.fromJSON=function(e,t){var r=new s(e,t.options);if(t.methods)for(var o=Object.keys(t.methods),i=0;i<o.length;++i)r.add(n.fromJSON(o[i],t.methods[o[i]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},s.prototype.toJSON=function(e){var t=a.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||void 0,"methods",a.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(s.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),s.prototype.get=function(e){return this.methods[e]||a.prototype.get.call(this,e)},s.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return a.prototype.resolve.call(this)},s.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof n?(this.methods[e.name]=e,e.parent=this,c(this)):a.prototype.add.call(this,e)},s.prototype.remove=function(e){if(e instanceof n){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,c(this)}return a.prototype.remove.call(this,e)},s.prototype.create=function(e,t,r){for(var n,a=new i.Service(e,t,r),s=0;s<this.methodsArray.length;++s){var c=o.lcFirst((n=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");a[c]=o.codegen(["r","c"],o.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return a},s._configure=function(){n=r(512),o=r(629),i=r(470)}},183:function(e,t,r){e.exports=o;var n=r(629);function o(e,t){this.lo=e>>>0,this.hi=t>>>0}var i=o.zero=new o(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var a=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(e){if(0===e)return i;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new o(r,n)},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if("string"==typeof e||e instanceof String){if(!n.Long)return o.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):i},o.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;o.fromHash=function(e){return e===a?i:new o((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},220:function(e,t,r){e.exports=a;var n,o,i=r(558);function a(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),i.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function s(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}((a.prototype=Object.create(i.prototype)).constructor=a).className="OneOf",a.fromJSON=function(e,t){return new a(e,t.oneof,t.options,t.comment)},a.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},a.prototype.add=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,s(this),this},a.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},a.prototype.onAdd=function(e){i.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}s(this)},a.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);i.prototype.onRemove.call(this,e)},a.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){o.decorateType(t.constructor).add(new a(r,e)),Object.defineProperty(t,r,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}},a._configure=function(){n=r(101),o=r(629)}},229:function(e,t,r){var n,o;function i(e){return function(t){var r=t.Writer,i=t.types,a=t.util;return function(t,s){s=s||r.create();for(var c=e.fieldsArray.slice().sort(a.compareFieldsById),u=0;u<c.length;u++){var l=c[u],d=e._fieldsArray.indexOf(l),h=l.resolvedType instanceof n?"uint32":l.type,p=o.basic[h],f=t[l.name];if(l.resolvedType instanceof n&&"string"==typeof f&&(f=i[d].values[f]),l.map){if(null!=f&&t.hasOwnProperty(l.name))for(var m=Object.keys(f),g=0;g<m.length;++g)s.uint32((l.id<<3|2)>>>0).fork().uint32(8|o.mapKey[l.keyType])[l.keyType](m[g]),void 0===p?i[d].encode(f[m[g]],s.uint32(18).fork()).ldelim().ldelim():s.uint32(16|p)[h](f[m[g]]).ldelim()}else if(l.repeated){if(f&&f.length)if(l.packed&&void 0!==o.packed[h]){s.uint32((l.id<<3|2)>>>0).fork();for(var v=0;v<f.length;v++)s[h](f[v]);s.ldelim()}else for(var E=0;E<f.length;E++)void 0===p?l.resolvedType.group?i[d].encode(f[E],s.uint32((l.id<<3|3)>>>0)).uint32((l.id<<3|4)>>>0):i[d].encode(f[E],s.uint32((l.id<<3|2)>>>0).fork()).ldelim():s.uint32((l.id<<3|p)>>>0)[h](f[E])}else(!l.optional||null!=f&&t.hasOwnProperty(l.name))&&(l.optional||null!=f&&t.hasOwnProperty(l.name)||console.warn("注意啦!!!很大概率会报错 类型:",t.$type?t.$type.name:"不晓得","没有设置对应的属性:",l.name,"检查是不是proto文件属性设置为了required"),void 0===p?l.resolvedType.group?i[d].encode(f,s.uint32((l.id<<3|3)>>>0)).uint32((l.id<<3|4)>>>0):i[d].encode(f,s.uint32((l.id<<3|2)>>>0).fork()).ldelim():s.uint32((l.id<<3|p)>>>0)[h](f))}return s}}}e.exports=i,i._configure=function(){n=r(660),o=r(452)}},278:function(e,t,r){"use strict";var n;function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}e.exports=o,o.create=function(e){return this.$type.create(e)},o.encode=function(e,t){return arguments.length?1==arguments.length?this.$type.encode(arguments[0]):this.$type.encode(arguments[0],arguments[1]):this.$type.encode(this)},o.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},o.decode=function(e){return this.$type.decode(e)},o.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},o.verify=function(e){return this.$type.verify(e)},o.fromObject=function(e){return this.$type.fromObject(e)},o.toObject=function(e,t){return e=e||this,this.$type.toObject(e,t)},o.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)},o.set=function(e,t){o[e]=t},o.get=function(e){return o[e]},o._configure=function(){n=r(629)}},322:function(e,t,r){e.exports=u;var n,o=r(629),i=r(442);function a(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function s(){}function c(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new a(s,0,0),this.tail=this.head,this.states=null}function l(e,t,r){t[r]=255&e}function d(e,t){this.len=e,this.next=void 0,this.val=t}function h(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function p(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}u.create=o.Buffer?function(){return(u.create=function(){return new(void 0)})()}:function(){return new u},u.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(u.alloc=o.pool(u.alloc,o.Array.prototype.subarray)),u.prototype._push=function(e,t,r){return this.tail=this.tail.next=new a(e,t,r),this.len+=t,this},d.prototype=Object.create(a.prototype),d.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(h,10,n.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=n.from(e);return this._push(h,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=n.from(e).zzEncode();return this._push(h,t.length(),t)},u.prototype.bool=function(e){return this._push(l,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(p,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=n.from(e);return this._push(p,4,t.lo)._push(p,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var f=o.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};u.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(l,1,0);if(o.isString(e)){var r=u.alloc(t=i.length(e));i.write(e,r,0),e=r}return this.uint32(t)._push(f,t,e)},u.prototype.string=function(e){var t=i.length(e);return t?this.uint32(t)._push(i.write,t,e):this._push(l,1,0)},u.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new a(s,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new a(s,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},u._configure=function(){n=r(183),r(986),i=r(442)}},442:function(e){"use strict";var t=e.exports;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,i=[],a=0;t<r;)(n=e[t++])<128?i[a++]=n:n>191&&n<224?i[a++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[a++]=55296+(n>>10),i[a++]=56320+(1023&n)):i[a++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),a=0);return o?(a&&o.push(String.fromCharCode.apply(String,i.slice(0,a))),o.join("")):String.fromCharCode.apply(String,i.slice(0,a))},t.write=function(e,t,r){for(var n,o,i=r,a=0;a<e.length;++a)(n=e.charCodeAt(a))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&o),++a,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-i}},452:function(e,t,r){"use strict";var n=e.exports,o=r(629),i=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function a(e,t){var r=0,n={};for(t|=0;r<e.length;)n[i[r+t]]=e[r++];return n}n.basic=a([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=a([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",o.emptyArray,null]),n.long=a([0,0,0,1,1],7),n.mapKey=a([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=a([1,5,0,0,0,5,5,0,0,0,1,1,0]),n._configure=function(){o=r(629)}},465:function(e,t,r){e.exports=E;var n,o,i,a,s,c,u,l,d,h,p,f,m,g,v=r(694);function E(e,t){v.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function y(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}((E.prototype=Object.create(v.prototype)).constructor=E).className="Type",Object.defineProperties(E.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=u.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=u.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=E.generateConstructor(this))},set:function(e){var t=e.prototype;t instanceof i||((e.prototype=new i).constructor=e,u.merge(e.prototype,t)),e.$type=e.prototype.$type=this,u.merge(e,i,!0),u.merge(e.prototype,i,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r){var o=this._oneofsArray[r].resolve().name,a=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=0;return{setter:function(r){if(!(e.indexOf(r)<0)){t[r]=1;for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}},getter:function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}}}(this._oneofsArray[r].oneof);n[o]={get:a.getter,set:a.setter}}r&&Object.defineProperties(e.prototype,n)}}}),E.generateConstructor=function(e){return function(t){for(var r,n=0;n<e.fieldsArray.length;n++)(r=e._fieldsArray[n]).map?this[r.name]={}:r.repeated&&(this[r.name]=[]);if(t)for(var o=Object.keys(t),i=0;i<o.length;++i)null!=t[o[i]]&&(this[o[i]]=t[o[i]])}},E.fromJSON=function(e,t){var r=new E(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var i=Object.keys(t.fields),s=0;s<i.length;++s)r.add((void 0!==t.fields[i[s]].keyType?g.fromJSON:o.fromJSON)(i[s],t.fields[i[s]]));if(t.oneofs)for(i=Object.keys(t.oneofs),s=0;s<i.length;++s)r.add(a.fromJSON(i[s],t.oneofs[i[s]]));if(t.nested)for(i=Object.keys(t.nested),s=0;s<i.length;++s){var c=t.nested[i[s]];r.add((void 0!==c.id?o.fromJSON:void 0!==c.fields?E.fromJSON:void 0!==c.values?n.fromJSON:void 0!==c.methods?p.fromJSON:v.fromJSON)(i[s],c))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},E.prototype.toJSON=function(e){var t=v.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return{options:t&&t.options||void 0,oneofs:v.arrayToJSON(this.oneofsArray,e),fields:v.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},extensions:this.extensions&&this.extensions.length?this.extensions:void 0,reserved:this.reserved&&this.reserved.length?this.reserved:void 0,group:this.group||void 0,nested:t&&t.nested||void 0,comment:r?this.comment:void 0}},E.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return v.prototype.resolveAll.call(this)},E.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},E.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById&&this._fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),y(this)}return e instanceof a?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),y(this)):v.prototype.add.call(this,e)},E.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),y(this)}if(e instanceof a){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),y(this)}return v.prototype.remove.call(this,e)},E.prototype.isReservedId=function(e){return v.isReservedId(this.reserved,e)},E.prototype.isReservedName=function(e){return v.isReservedName(this.reserved,e)},E.prototype.create=function(e){return new this.ctor(e)},E.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=d(this)({Writer:s,types:t,util:u}),this.decode=h(this)({Reader:c,types:t,util:u}),this.verify=l(this)({types:t,util:u}),this.fromObject=m.fromObject(this)({types:t,util:u}),this.toObject=m.toObject(this)({types:t,util:u});var n=f[e];if(n){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(o),o.toObject=this.toObject,this.toObject=n.toObject.bind(o)}return this},E.prototype.encode=function(e,t){return this.setup().encode(e,t)},E.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},E.prototype.decode=function(e,t){return this.setup().decode(e,t)},E.prototype.decodeDelimited=function(e){return e instanceof c||(e=c.create(e)),this.decode(e,e.uint32())},E.prototype.verify=function(e){return this.setup().verify(e)},E.prototype.fromObject=function(e){return this.setup().fromObject(e)},E.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},E.d=function(e){return function(t){u.decorateType(t,e)}},E._configure=function(){n=r(660),o=r(101),i=r(278),a=r(220),s=r(322),c=r(970),u=r(629),l=r(811),d=r(229),h=r(801),p=r(177),f=r(793),m=r(921),g=r(83)}},470:function(e,t,r){"use strict";e.exports=o;var n=r(629);function o(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(o.prototype=Object.create(n.EventEmitter.prototype)).constructor=o,o.prototype.rpcCall=function e(t,r,o,i,a){if(!i)throw TypeError("request must be specified");var s=this;if(!a)return n.asPromise(e,s,t,r,o,i);if(s.rpcImpl)try{return s.rpcImpl(t,r[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),(function(e,r){if(e)return s.emit("error",e,t),a(e);if(null!==r){if(!(r instanceof o))try{r=o[s.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return s.emit("error",e,t),a(e)}return s.emit("data",r,t),a(null,r)}s.end(!0)}))}catch(e){return s.emit("error",e,t),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},o.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},496:function(e){e.exports=d;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,o=/^ *[*/]+ */,i=/^\s*\*?\/*/,a=/\n/g,s=/\s/,c=/\\(.?)/g,u={0:"\0",r:"\r",n:"\n",t:"\t"};function l(e){return e.replace(c,(function(e,t){switch(t){case"\\":case"":return t;default:return u[t]||""}}))}function d(e,c){e=e.toString();var u=0,d=e.length,h=1,p=null,f=null,m=0,g=!1,v=[],E=null;function y(e){return Error("illegal "+e+" (line "+h+")")}function _(t){return e.charAt(t)}function T(t,r){p=e.charAt(t++),m=h,g=!1;var n,s=t-(c?2:3);do{if(--s<0||"\n"===(n=e.charAt(s))){g=!0;break}}while(" "===n||"\t"===n);for(var u=e.substring(t,r).split(a),l=0;l<u.length;++l)u[l]=u[l].replace(c?i:o,"").trim();f=u.join("\n").trim()}function I(t){var r=O(t),n=e.substring(t,r);return/^\s*\/{1,2}/.test(n)}function O(e){for(var t=e;t<d&&"\n"!==_(t);)t++;return t}function R(){if(v.length>0)return v.shift();if(E)return function(){var t="'"===E?n:r;t.lastIndex=u-1;var o=t.exec(e);if(!o)throw y("string");return u=t.lastIndex,C(E),E=null,l(o[1])}();var o,i,a,p,f;do{if(u===d)return null;for(o=!1;s.test(a=_(u));)if("\n"===a&&++h,++u===d)return null;if("/"===_(u)){if(++u===d)throw y("comment");if("/"===_(u))if(c){if(p=u,f=!1,I(u)){f=!0;do{if((u=O(u))===d)break;u++}while(I(u))}else u=Math.min(d,O(u)+1);f&&T(p,u),h++,o=!0}else{for(f="/"===_(p=u+1);"\n"!==_(++u);)if(u===d)return null;++u,f&&T(p,u-1),++h,o=!0}else{if("*"!==(a=_(u)))return"/";p=u+1,f=c||"*"===_(p);do{if("\n"===a&&++h,++u===d)throw y("comment");i=a,a=_(u)}while("*"!==i||"/"!==a);++u,f&&T(p,u-2),o=!0}}}while(o);var m=u;if(t.lastIndex=0,!t.test(_(m++)))for(;m<d&&!t.test(_(m));)++m;var g=e.substring(u,u=m);return'"'!==g&&"'"!==g||(E=g),g}function C(e){v.push(e)}function S(){if(!v.length){var e=R();if(null===e)return null;C(e)}return v[0]}return Object.defineProperty({next:R,peek:S,push:C,skip:function(e,t){var r=S();if(r===e)return R(),!0;if(!t)throw y("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t=null;return void 0===e?m===h-1&&(c||"*"===p||g)&&(t=f):(m<e&&S(),m!==e||g||!c&&"/"!==p||(t=f)),t}},"line",{get:function(){return h}})}d.unescape=l},512:function(e,t,r){"use strict";e.exports=i;var n,o=r(558);function i(e,t,r,i,a,s,c,u){if(n.isObject(a)?(c=a,a=s=void 0):n.isObject(s)&&(c=s,s=void 0),void 0!==t&&!n.isString(t))throw TypeError("type must be a string");if(!n.isString(r))throw TypeError("requestType must be a string");if(!n.isString(i))throw TypeError("responseType must be a string");o.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!a||void 0,this.responseType=i,this.responseStream=!!s||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=u}((i.prototype=Object.create(o.prototype)).constructor=i).className="Method",i.fromJSON=function(e,t){return new i(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment)},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return n.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0])},i.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),o.prototype.resolve.call(this))},i._configure=function(){n=r(629)}},558:function(e,t,r){"use strict";var n,o;function i(e,t){if(!n.isString(e))throw TypeError("name must be a string");if(t&&!n.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}e.exports=i,i.className="ReflectionObject",Object.defineProperties(i.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),i.prototype.toJSON=function(){throw Error()},i.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof o&&t._handleAdd(this)},i.prototype.onRemove=function(e){var t=e.root;t instanceof o&&t._handleRemove(this),this.parent=null,this.resolved=!1},i.prototype.resolve=function(){return this.resolved||this.root instanceof o&&(this.resolved=!0),this},i.prototype.getOption=function(e){if(this.options)return this.options[e]},i.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},i.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},i.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},i._configure=function(e){o=r(773),n=r(629)}},566:function(e,t){var r;r=function(e){e.version="1.2.2";var t=function(){for(var e=0,t=new Array(256),r=0;256!=r;++r)e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=r)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1,t[r]=e;return"undefined"!=typeof Int32Array?new Int32Array(t):t}(),r=function(e){var t=0,r=0,n=0,o="undefined"!=typeof Int32Array?new Int32Array(4096):new Array(4096);for(n=0;256!=n;++n)o[n]=e[n];for(n=0;256!=n;++n)for(r=e[n],t=256+n;t<4096;t+=256)r=o[t]=r>>>8^e[255&r];var i=[];for(n=1;16!=n;++n)i[n-1]="undefined"!=typeof Int32Array?o.subarray(256*n,256*n+256):o.slice(256*n,256*n+256);return i}(t),n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],c=r[5],u=r[6],l=r[7],d=r[8],h=r[9],p=r[10],f=r[11],m=r[12],g=r[13],v=r[14];e.table=t,e.bstr=function(e,r){for(var n=-1^r,o=0,i=e.length;o<i;)n=n>>>8^t[255&(n^e.charCodeAt(o++))];return~n},e.buf=function(e,r){for(var E=-1^r,y=e.length-15,_=0;_<y;)E=v[e[_++]^255&E]^g[e[_++]^E>>8&255]^m[e[_++]^E>>16&255]^f[e[_++]^E>>>24]^p[e[_++]]^h[e[_++]]^d[e[_++]]^l[e[_++]]^u[e[_++]]^c[e[_++]]^s[e[_++]]^a[e[_++]]^i[e[_++]]^o[e[_++]]^n[e[_++]]^t[e[_++]];for(y+=15;_<y;)E=E>>>8^t[255&(E^e[_++])];return~E},e.str=function(e,r){for(var n=-1^r,o=0,i=e.length,a=0,s=0;o<i;)(a=e.charCodeAt(o++))<128?n=n>>>8^t[255&(n^a)]:a<2048?n=(n=n>>>8^t[255&(n^(192|a>>6&31))])>>>8^t[255&(n^(128|63&a))]:a>=55296&&a<57344?(a=64+(1023&a),s=1023&e.charCodeAt(o++),n=(n=(n=(n=n>>>8^t[255&(n^(240|a>>8&7))])>>>8^t[255&(n^(128|a>>2&63))])>>>8^t[255&(n^(128|s>>6&15|(3&a)<<4))])>>>8^t[255&(n^(128|63&s))]):n=(n=(n=n>>>8^t[255&(n^(224|a>>12&15))])>>>8^t[255&(n^(128|a>>6&63))])>>>8^t[255&(n^(128|63&a))];return~n}},"undefined"==typeof DO_NOT_EXPORT_CRC?r(t):r({})},570:function(e){e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function n(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=n;var o={},i={};function a(e,t){var r,n,a;return t?(a=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=c(e,(0|e)<0?-1:0,!0),a&&(i[e]=r),r):(a=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=c(e,e<0?-1:0,!1),a&&(o[e]=r),r)}function s(e,t){if(isNaN(e))return t?v:g;if(t){if(e<0)return v;if(e>=p)return I}else{if(e<=-f)return O;if(e+1>=f)return T}return e<0?s(-e,t).neg():c(e%h|0,e/h|0,t)}function c(e,t,n){return new r(e,t,n)}r.fromInt=a,r.fromNumber=s,r.fromBits=c;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var o=s(u(r,8)),i=g,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),d=parseInt(e.substring(a,a+c),r);if(c<8){var h=s(u(r,c));i=i.mul(h).add(s(d))}else i=(i=i.mul(o)).add(s(d))}return i.unsigned=t,i}function d(e,t){return"number"==typeof e?s(e,t):"string"==typeof e?l(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=d;var h=4294967296,p=h*h,f=p/2,m=a(1<<24),g=a(0);r.ZERO=g;var v=a(0,!0);r.UZERO=v;var E=a(1);r.ONE=E;var y=a(1,!0);r.UONE=y;var _=a(-1);r.NEG_ONE=_;var T=c(-1,2147483647,!1);r.MAX_VALUE=T;var I=c(-1,-1,!0);r.MAX_UNSIGNED_VALUE=I;var O=c(0,-2147483648,!1);r.MIN_VALUE=O;var R=r.prototype;R.toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},R.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(O)){var t=s(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=s(u(e,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=(i.sub(c.mul(o)).toInt()>>>0).toString(e);if((i=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},R.isZero=function(){return 0===this.high&&0===this.low},R.eqz=R.isZero,R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return!(1&~this.low)},R.isEven=function(){return!(1&this.low)},R.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.ne=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.le=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.ge=R.greaterThanOrEqual,R.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(E)},R.neg=R.negate,R.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,a=e.high>>>16,s=65535&e.high,u=e.low>>>16,l=0,h=0,p=0,f=0;return p+=(f+=i+(65535&e.low))>>>16,h+=(p+=o+u)>>>16,l+=(h+=r+s)>>>16,l+=t+a,c((p&=65535)<<16|(f&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},R.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){if(this.isZero())return g;if(n(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(O))return e.isOdd()?O:g;if(e.eq(O))return this.isOdd()?O:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return s(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,a=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=65535&e.low,f=0,v=0,E=0,y=0;return E+=(y+=a*p)>>>16,v+=(E+=i*p)>>>16,E&=65535,v+=(E+=a*h)>>>16,f+=(v+=o*p)>>>16,v&=65535,f+=(v+=i*h)>>>16,v&=65535,f+=(v+=a*l)>>>16,f+=r*p+o*h+i*l+a*u,c((E&=65535)<<16|(y&=65535),(f&=65535)<<16|(v&=65535),this.unsigned)},R.mul=R.multiply,R.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var r,o,i;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return y;i=v}else{if(this.eq(O))return e.eq(E)||e.eq(_)?O:e.eq(O)?E:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?E:_:(o=this.sub(e.mul(r)),i=r.add(o.div(e)));if(e.eq(O))return this.unsigned?v:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=g}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),l=a<=48?1:u(2,a-48),h=s(r),p=h.mul(e);p.isNegative()||p.gt(o);)p=(h=s(r-=l,this.unsigned)).mul(e);h.isZero()&&(h=E),i=i.add(h),o=o.sub(p)}return i},R.div=R.divide,R.modulo=function(e){return n(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.rem=R.modulo,R.not=function(){return c(~this.low,~this.high,this.unsigned)},R.and=function(e){return n(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return n(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},R.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},R.shl=R.shiftLeft,R.shiftRight=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},R.shru=R.shiftRightUnsigned,R.shr_u=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,n){return n?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},627:function(e){e.exports=function(e,t,r){var n=r||8192,o=n>>>1,i=null,a=n;return function(r){if(r<1||r>o)return e(r);a+r>n&&(i=e(n),a=0);var s=t.call(i,a,a+=r);return 7&a&&(a=1+(7|a)),s}}},629:function(e,t,r){var n=e.exports,o=r(896);n.LongBits=r(183),n.Long=r(879),n.pool=r(627),n.float=r(899),n.asPromise=r(880),n.EventEmitter=r(87),n.path=r(814),n.base64=r(986),n.utf8=r(442),n.compareFieldsById=function(e,t){return e.id-t.id},n.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},n.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],o=e[r++];void 0!==o&&(t[n]=o)}return t},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},n.isObject=function(e){return e&&"object"==typeof e},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.merge=function(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)void 0!==e[n[o]]&&r||(e[n[o]]=t[n[o]]);return e},n.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(n.decorateRoot.remove(e.$type),e.$type.name=t,n.decorateRoot.add(e.$type)),e.$type;Type||(Type=r(465));var o=new Type(t||e.name);return n.decorateRoot.add(o),o.ctor=e,Object.defineProperty(e,"$type",{value:o,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:o,enumerable:!1}),o},n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.copy=function(e){if("object"!=typeof e)return e;var t={};for(var r in e)t[r]=e[r];return t},n.deepCopy=function e(t){if("object"!=typeof t)return t;var r={};for(var n in t)r[n]=e(t[n]);return r},n.ProtocolError=function(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&merge(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n.Buffer=null,n.newBuffer=function(e){return"number"==typeof e?new n.Array(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.stringToBytes=function(e){var t,r,n=[];t=e.length;for(var o=0;o<t;o++)(r=e.charCodeAt(o))>=65536&&r<=1114111?(n.push(r>>18&7|240),n.push(r>>12&63|128),n.push(r>>6&63|128),n.push(63&r|128)):r>=2048&&r<=65535?(n.push(r>>12&15|224),n.push(r>>6&63|128),n.push(63&r|128)):r>=128&&r<=2047?(n.push(r>>6&31|192),n.push(63&r|128)):n.push(255&r);return n},n.byteToString=function(e){if("string"==typeof e)return e;for(var t="",r=e,n=0;n<r.length;n++){var o=r[n].toString(2),i=o.match(/^1+?(?=0)/);if(i&&8==o.length){for(var a=i[0].length,s=r[n].toString(2).slice(7-a),c=1;c<a;c++)s+=r[c+n].toString(2).slice(2);t+=String.fromCharCode(parseInt(s,2)),n+=a-1}else t+=String.fromCharCode(r[n])}return t},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},Object.defineProperty(n,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(773)))}})},638:function(e){"use strict";var t=4096,r=65547,n=15,o=2113929216,i=65536,a=65536,s=10485760,c={MANUAL:0,AUTO_IMMEDIATE:1,AUTO_THRESHOLD:2},u={SUCCESS:0,FAILED:-1,NOT_INITIALIZED:-2,INITIALIZED_FAILED:-3,COMPRESS_FAILED:-4,DECOMPRESS_FAILED:-5,PARAM_ERROR:-6,BUFFER_RESIZE_FAILED:-7};function l(e){if(!(e>0))return a;if(e<=a)return a;if(e>1073741823)return e;for(var t=a;t<e;)t*=2;return t}var d={byU16:0,byU32:1};function h(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var p="fast";function f(e){return 2654435761*(e>>>0)>>>20&4095}function m(e){return 2654435761*(e>>>0)>>>19&8191}function g(e,t,r){if("fast"===p){var n=h(e,t);return r===d.byU16?m(n):f(n)}throw new Error("Unsupported hash strategy: "+p)}function v(e,t,r,n,o){r[t]=e-o}function E(e,t,r,n,o){v(t,g(e,t,n),r,0,o)}function y(e,t,r,n){return t[e]+n}function _(e,t,r,n,o){return y(g(e,t,n),r,0,o)}function T(e,t,r,n){for(var o=t;t<n-3;){if(h(e,t)!==h(e,r)){for(;t<n&&e[t]===e[r];)t++,r++;return t-o}t+=4,r+=4}for(;t<n&&e[t]===e[r];)t++,r++;return t-o}function I(e,t,i,a,s,c,u,l,h,p){var f,m,I,S,N,b,A=e.hashTable,M=a,w=M-e.dictSize,U=e.dictionary,L=e.dictionaryStart,P=L+e.dictSize,D=e.dictSize>0?P-a:0,k=a,x=a+s,B=x-12,G=x-5,j=0,H=c>0?c:i.length,F=0;if(s>o)return 0;switch(h){case 0:default:f=a,m=a;break;case 1:f=a-e.currentOffset,m=a-e.dictSize;break;case 2:f=a-e.currentOffset,m=a}if(l===d.byU16&&s>=r)return 0;if(s<13)return C(t,i,k,x,j,H,u);E(t,M,A,l,f),I=g(t,++M,l);e:for(;;){var W,z,q=M,K=1,V=64;do{var J=I;if(M=q,q+=K,K=V++>>>6,q>B)return C(t,i,k,x,j,H,u);W=y(J,A,0,f),2===h&&(W<a?(F=D,m=L):(F=0,m=a)),I=g(t,q,l),v(M,J,A,0,f)}while(1===p&&W<w||l!==d.byU16&&W+65535<M||!O(t,U,M,W,F,h,a));for(;M>k&&W+F>m;){var Y=W+F-1;if(t[M-1]!==(2===h&&W<a?U[Y-L+e.dictionaryStart]:t[Y]))break;M--,W--}var X=M-k;if(z=j++,u&&j+X+8+Math.floor(X/255)>H)return 0;if(X>=n){var Q=X-n;for(i[z]=240;Q>=255;)i[j++]=255,Q-=255;i[j++]=Q}else i[z]=X<<4;if(X>=16&&i.set&&t.subarray)i.set(t.subarray(k,k+X),j),j+=X;else for(var Z=0;Z<X;Z++)i[j++]=t[k+Z];t:for(;;){var $;if(b=M-W,(S=i)[N=j]=255&b,S[N+1]=b>>>8&255,j+=2,2===h&&W<a){var ee=M+(P-(W+F));if(ee>G&&(ee=G),(M+=4+($=R(t,U,M+4,W+F+4-L+e.dictionaryStart,ee,P-L)))===ee&&ee<G){var te=T(t,M,a,G);$+=te,M+=te}}else M+=4+($=T(t,M+4,W+4,G));if(u&&j+6+($>>>8)>H)return 0;if($>=15){for(i[z]+=15,$-=15;$>=510;)i[j++]=255,i[j++]=255,$-=510;$>=255&&($-=255,i[j++]=255),i[j++]=$}else i[z]+=$;if(k=M,M>B)break e;if(E(t,M-2,A,l,f),W=_(t,M,A,l,f),2===h&&(W<a?(F=D,m=L):(F=0,m=a)),E(t,M,A,l,f),!((1!==p||W>=w)&&W+65535>=M&&O(t,U,M,W,F,h,a)))break t;i[z=j++]=0}I=g(t,++M,l)}return C(t,i,k,x,j,H,u)}function O(e,t,r,n,o,i,a){return h(e,r)===h(2===i&&n+o<a?t:e,n+o)}function R(e,t,r,n,o,i,a){for(var s=r;n<i&&r<o&&t[n]===e[r];)n++,r++;return r-s}function C(e,t,r,o,i,a,s){var c=o-r;if(s&&i+c+1+Math.floor((c+255-n)/255)>a)return 0;if(c>=n){for(t[i++]=240,c-=n;c>=255;)t[i++]=255,c-=255;t[i++]=c}else t[i++]=c<<4;var u=r,l=o,d=l-u;if(d>=16&&t.set&&e.subarray)t.set(e.subarray(u,l),i),i+=d;else for(var h=u;h<l;h++)t[i++]=e[h];return i}function S(e,t,r,n){var o,i=0;if(n&&t.ip>=r)return-1;do{if(i+=o=e[t.ip++],t.ip>r)return-1;if(i>2147483647)return-1}while(255===o);return i}function N(e,t,r,o,i,a,s,c,u,l,d,h,p){if(null==e)return-1;if(a<0)return-1;var f,m,g=r,v=r+o,E=i,y=i+a,_=i+u,T=d-p,I=h+p,O=p<65536;if(c&&_>y-12&&(_=y-12),0===a)return c||1===o&&0===e[g]?0:-1;if(0===o)return-1;for(;;){var R,C,N,b;if(g>=v)return-(g-r)-1;if((C=(R=e[g++])>>>4)===n){var A=S(e,U={ip:g},v-n,!0);if(g=U.ip,-1===A)return-(g-r)-1;if(E+(C+=A)<E)return-(g-r)-1;if(g+C<g)return-(g-r)-1}if(N=E+C,s&&(N>(c?_:y-12)||g+C>v-8)||!s&&N>y-8){if(c)g+C>v&&(N=E+(C=v-g)),N>y&&(N=y,C=y-E);else{if(!s&&N!==y)return-(g-r)-1;if(s&&(g+C!==v||N>y))return-(g-r)-1}if(C>=16&&t.set&&e.subarray)t.set(e.subarray(g,g+C),E);else for(var M=0;M<C;M++)t[E+M]=e[g+M];if(g+=C,E+=C,!c||N===y||g>=v-2)break;if(!c)break}if(C>=16&&t.set&&e.subarray)t.set(e.subarray(g,g+C),E);else for(M=0;M<C;M++)t[E+M]=e[g+M];if(E=N,(g+=C)+2>v)return-(g-r)-1;var w=(f=e)[m=g]|f[m+1]<<8;if(g+=2,b=N-w,O&&b+p<d)return-(g-r)-1;if(0===w)return-(g-r)-1;if(15==(C=15&R)){var U;if(A=S(e,U={ip:g},v-5+1,!1),g=U.ip,-1===A)return-(g-r)-1;if(E+(C+=A)<E)return-(g-r)-1}if(C+=4,2===l&&b<d){if(E+C>y-5){if(!c)return-(g-r)-1;C=Math.min(C,y-E)}if(C<=d-b){var L=I-(d-b);for(M=0;M<C;M++)t[E+M]=t[L+M];E+=C}else{var P=d-b;for(L=I-P,M=0;M<P;M++)t[E+M]=t[L+M];var D=C-P;if(D>(E+=P)-d)for(var k=d,x=E+D;E<x;)t[E++]=t[k++];else{for(M=0;M<D;M++)t[E+M]=t[d+M];E+=D}}}else{if(b<T)return-(g-r)-1;if(N=E+C,c&&N>y-12){var B=Math.min(C,y-E),G=E+B;if(b+B>E)for(;E<G;)t[E++]=t[b++];else{for(M=0;M<B;M++)t[E+M]=t[b+M];E=G}if(E===y)break}else if(E-b<8)for(t[E]=t[b],t[E+1]=t[b+1],t[E+2]=t[b+2],t[E+3]=t[b+3],E+=4,b+=4;E<N;)t[E++]=t[b++];else for(;E<N;)t[E++]=t[b++]}}return s?E-i:g-r}function b(){return{hashTable:new Uint32Array(t),currentOffset:0,initCheck:0,dictionary:null,dictionaryStart:0,dictSize:0,bufferStart:null}}function A(e){e.hashTable.fill(0),e.currentOffset=0,e.initCheck=0,e.dictionary=null,e.dictionaryStart=0,e.dictSize=0,e.bufferStart=null}function M(e,t,r,n,o,i,a,s){n=n||0,i=i||0;var c=e.dictionaryStart+e.dictSize,u=n;if(e.initCheck)return 0;e.dictSize>0&&u>c&&(u=c),function(e){if(e.currentOffset>2147483648){for(var t=e.currentOffset-65536,r=e.dictionaryStart+e.dictSize,n=0;n<e.hashTable.length;n++)e.hashTable[n]<t?e.hashTable[n]=0:e.hashTable[n]-=t;e.currentOffset=65536,e.dictSize>65536&&(e.dictSize=65536),e.dictionaryStart=r-e.dictSize}}(e);var l,h=n+o;e.dictionary&&h>e.dictionaryStart&&h<c&&(e.dictSize=c-h,e.dictSize>65536&&(e.dictSize=65536),e.dictSize<4&&(e.dictSize=0),e.dictionaryStart=c-e.dictSize);var p=e.dictSize<65536&&e.dictSize<e.currentOffset?1:0;return e.dictionary&&c===n?(l=I(e,t,r,n,o,a||0,s||!1,d.byU32,1,p),e.dictSize+=o,e.currentOffset+=o,l):(l=I(e,t,r,n,o,a||0,s||!1,d.byU32,2,p),e.dictionary=t,e.dictionaryStart=n,e.dictSize=o,e.currentOffset+=o,l)}function w(e,t,r,n){var o=e.dictionaryStart+e.dictSize;n>65536&&(n=65536),n>e.dictSize&&(n=e.dictSize);var i=o-n;if(t.set&&e.dictionary.subarray)t.set(e.dictionary.subarray(i,i+n),r);else for(var a=0;a<n;a++)t[r+a]=e.dictionary[i+a];return e.dictionary=t,e.dictionaryStart=r,e.dictSize=n,n}function U(e,t,r,n){return e.prefixSize=n,e.prefixEnd=r+n,e.externalDict=null,e.extDictStart=0,e.extDictSize=0,1}function L(e,t,r,n,o,i,a){var s;if(e.prefixEnd===i){if((s=N(t,r,n,o,i,a,!0,!1,0,2,e.prefixEnd-e.prefixSize,e.extDictStart,e.extDictSize))<=0)return s;e.prefixSize+=s,e.prefixEnd+=s}else{if(e.extDictSize=e.prefixSize,e.extDictStart=e.prefixEnd-e.extDictSize,(s=N(t,r,n,o,i,a,!0,!1,0,2,i,e.extDictStart,e.extDictSize))<=0)return s;e.prefixSize=s,e.prefixEnd=i+s}return s}function P(e){var t=(e=e||{}).minWorkArea||a,r=e.maxWorkArea||s,n=e.shrinkThreshold||t;t<a&&(t=a),r<t&&(r=t),n<t&&(n=t),n>r&&(n=r),this.minBufferSize=i+t,this.maxBufferSize=i+r,this.shrinkThreshold=i+n,this.ringBufferSize=this.minBufferSize,this.shrinkMode=void 0!==e.shrinkMode?e.shrinkMode:c.MANUAL,this.ringBuffer=new Uint8Array(this.ringBufferSize),this.offset=0,this.stream=b()}function D(e){var t=(e=e||{}).minWorkArea||a,r=e.maxWorkArea||s,n=e.shrinkThreshold||t;t<a&&(t=a),r<t&&(r=t),n<t&&(n=t),n>r&&(n=r),this.minBufferSize=i+t,this.maxBufferSize=i+r,this.shrinkThreshold=i+n,this.ringBufferSize=this.minBufferSize,this.shrinkMode=void 0!==e.shrinkMode?e.shrinkMode:c.MANUAL,this.ringBuffer=new Uint8Array(this.ringBufferSize),this.offset=0,this.streamDecode={externalDict:null,extDictStart:0,extDictSize:0,prefixEnd:0,prefixSize:0}}P.prototype._resizeBuffer=function(e){var t=new Uint8Array(e),r=0;if(this.offset>0){var n=this.offset<i?this.offset:i,o=this.offset>i?this.offset-i:0;t.set(this.ringBuffer.subarray(o,o+n),0),w(this.stream,t,0,n),r=n}return this.ringBuffer=t,this.ringBufferSize=e,this.offset=r,!0},P.prototype.compress=function(e,t){var r=e.length;if(r<=0)return u.PARAM_ERROR;if(r>this.maxBufferSize-i)return u.PARAM_ERROR;if(r>this.ringBufferSize-i){var n=l(r),o=i+n;if(o>this.maxBufferSize&&(o=this.maxBufferSize),!this._resizeBuffer(o))return u.BUFFER_RESIZE_FAILED}this.offset+r>this.ringBufferSize&&(w(this.stream,this.ringBuffer,0,i),this.offset=i);var a=this.offset;this.ringBuffer.set(e,a);var s=M(this.stream,this.ringBuffer,t,a,r,0,t.length,!0);return s<=0?u.COMPRESS_FAILED:(this.offset+=r,this._tryAutoShrink(),s)},P.prototype.reset=function(){this.offset=0,A(this.stream)},P.prototype.shrink=function(){this.ringBufferSize>this.minBufferSize&&this._resizeBuffer(this.minBufferSize)},P.prototype._tryAutoShrink=function(){this.shrinkMode!==c.MANUAL&&(this.ringBufferSize<=this.minBufferSize||(this.shrinkMode===c.AUTO_IMMEDIATE||this.shrinkMode===c.AUTO_THRESHOLD&&this.ringBufferSize>this.shrinkThreshold)&&this.shrink())},P.prototype.getWorkArea=function(){return this.ringBufferSize-i},P.prototype.getRingBufferSize=function(){return this.ringBufferSize},P.prototype.getBaseBufferSize=function(){return this.minBufferSize},P.prototype.getMaxBufferSize=function(){return this.maxBufferSize},P.prototype.getCurrentOffset=function(){return this.offset},P.prototype.getShrinkMode=function(){return this.shrinkMode},P.prototype.setShrinkMode=function(e){this.shrinkMode=e},P.prototype.getShrinkThreshold=function(){return this.shrinkThreshold},P.prototype.setShrinkThreshold=function(e){var t=this.minBufferSize-i,r=this.maxBufferSize-i;if(e<t||e>r)return u.PARAM_ERROR;this.shrinkThreshold=i+e},D.prototype._resizeBuffer=function(e){var t=new Uint8Array(e),r=0;if(this.offset>0){var n=this.offset<i?this.offset:i,o=this.offset>i?this.offset-i:0;t.set(this.ringBuffer.subarray(o,o+n),0),r=n,U(this.streamDecode,0,0,n)}return this.ringBuffer=t,this.ringBufferSize=e,this.offset=r,!0},D.prototype.decompress=function(e,t,r){var n=e.length;if(n<=0||r<=0)return u.PARAM_ERROR;if(r>this.maxBufferSize-i)return u.PARAM_ERROR;if(r>this.ringBufferSize-i){var o=l(r),a=i+o;if(a>this.maxBufferSize&&(a=this.maxBufferSize),!this._resizeBuffer(a))return u.BUFFER_RESIZE_FAILED}if(this.offset+r>this.ringBufferSize){var s=this.offset-i;s>0&&this.ringBuffer.set(this.ringBuffer.subarray(s,s+i),0),U(this.streamDecode,this.ringBuffer,0,i),this.offset=i}var c=L(this.streamDecode,e,this.ringBuffer,0,n,this.offset,r);return c<=0?u.DECOMPRESS_FAILED:(t.set(this.ringBuffer.subarray(this.offset,this.offset+c),0),this.offset+=c,this._tryAutoShrink(),c)},D.prototype.reset=function(){this.offset=0,this.streamDecode={externalDict:null,extDictStart:0,extDictSize:0,prefixEnd:0,prefixSize:0}},D.prototype.shrink=function(){this.ringBufferSize>this.minBufferSize&&this._resizeBuffer(this.minBufferSize)},D.prototype._tryAutoShrink=function(){this.shrinkMode!==c.MANUAL&&(this.ringBufferSize<=this.minBufferSize||(this.shrinkMode===c.AUTO_IMMEDIATE||this.shrinkMode===c.AUTO_THRESHOLD&&this.ringBufferSize>this.shrinkThreshold)&&this.shrink())},D.prototype.getWorkArea=function(){return this.ringBufferSize-i},D.prototype.getRingBufferSize=function(){return this.ringBufferSize},D.prototype.getBaseBufferSize=function(){return this.minBufferSize},D.prototype.getMaxBufferSize=function(){return this.maxBufferSize},D.prototype.getCurrentOffset=function(){return this.offset},D.prototype.getShrinkMode=function(){return this.shrinkMode},D.prototype.setShrinkMode=function(e){this.shrinkMode=e},D.prototype.getShrinkThreshold=function(){return this.shrinkThreshold},D.prototype.setShrinkThreshold=function(e){var t=this.minBufferSize-i,r=this.maxBufferSize-i;if(e<t||e>r)return u.PARAM_ERROR;this.shrinkThreshold=i+e},e.exports={LZ4_MAX_INPUT_SIZE:o,BLOCK_MAX_SIZE:65536,DICT_SIZE:i,DEFAULT_WORK_AREA:a,DEFAULT_MAX_WORK:s,SHRINK_MODE:c,LZ4_ERROR:u,alignToPowerOf2:l,calcDefaultBufferSize:function(){return 131072},calcDefaultMaxBufferSize:function(){return 10551296},setHashStrategy:function(e){if("fast"!==e&&"compatible"!==e)throw new Error("Invalid hash strategy: "+e+'. Use "fast" or "compatible".');p=e},getHashStrategy:function(){return p},compress:function(e,n,i,a,s){if(null==e)return 0;if(null==n)return 0;if(i=i||0,a=void 0===a?e.length:a,s=s||0,i<0||s<0)return 0;if(a<0)return 0;if(i+a>e.length)return 0;if(a>o)return 0;if(0===a)return n.length>s?(n[s]=0,1):0;var c=a<r?d.byU16:d.byU32;return I({hashTable:new Uint32Array(c===d.byU16?8192:t),currentOffset:0,dictSize:0,dictionary:null,dictionaryStart:0},e,n,i,a,0,!1,c,0,0)},compressLimited:function(e,n,i,a,s,c){if(null==e)return 0;if(null==n)return 0;if(i=i||0,a=void 0===a?e.length:a,s=s||0,i<0||s<0)return 0;if(a<0||c<0)return 0;if(i+a>e.length)return 0;if(a>o)return 0;if(c<1)return 0;if(0===a)return n[s]=0,1;var u=a<r?d.byU16:d.byU32;return I({hashTable:new Uint32Array(u===d.byU16?8192:t),currentOffset:0,dictSize:0,dictionary:null,dictionaryStart:0},e,n,i,a,c,!0,u,0,0)},compressBound:function(e){return e<0||e>o?0:e+Math.floor(e/255)+16},decompressSafe:function(e,t,r,n,o,i){return null==e||null==t?-1:(o=o||0,(r=r||0)<0||o<0||n<0||i<0||r+n>e.length||o+i>t.length?-1:N(e,t,r,n,o,i,!0,!1,0,0,o,null,0))},decompressFast:function(e,t,r,n,o){return N(e,t,r=r||0,0,n=n||0,o,!1,!1,0,1,n-65536,0,65536)},createStream:b,resetStream:A,loadDict:function(e,t,r,n){if(e.initCheck&&A(e),n<4)return e.dictionary=null,e.dictSize=0,0;n>65536&&(r=r+n-65536,n=65536);var o=r-e.currentOffset;e.dictionary=t,e.dictionaryStart=r,e.dictSize=n,e.currentOffset+=n;for(var i=r,a=r+n;i<=a-4;)E(t,i,e.hashTable,d.byU32,o),i+=3;return n},compressContinue:M,saveDict:w,createStreamDecode:function(){return{externalDict:null,extDictStart:0,extDictSize:0,prefixEnd:0,prefixSize:0}},setStreamDecode:U,decompressSafeContinue:L,RingBufferEncoder:P,RingBufferDecoder:D,_hashU16:m,_hashU32:f,_TABLE_TYPE:d}},660:function(e,t,r){e.exports=i;var n=r(558);((i.prototype=Object.create(n.prototype)).constructor=i).className="Enum";var o=r(694);function i(e,t,r,o,i){if(n.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=i||{},this.reserved=void 0,t)for(var a=Object.keys(t),s=0;s<a.length;++s)"number"==typeof t[a[s]]&&(this.valuesById[this.values[a[s]]=t[a[s]]]=a[s])}i.fromJSON=function(e,t){var r=new i(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return util.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},i.prototype.add=function(e,t,r){if(!util.isString(e))throw TypeError("name must be a string");if(!util.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},i.prototype.remove=function(e){if(!util.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},i.prototype.isReservedId=function(e){return o.isReservedId(this.reserved,e)},i.prototype.isReservedName=function(e){return o.isReservedName(this.reserved,e)}},694:function(e,t,r){e.exports=l;var n,o,i,a,s,c=r(558);function u(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function l(e,t){c.call(this,e,t),this.nested=void 0,this._nestedArray=null}function d(e){return e._nestedArray=null,e}((l.prototype=Object.create(c.prototype)).constructor=l).className="Namespace",l.fromJSON=function(e,t){return new l(e,t.options).addJSON(t.nested)},l.arrayToJSON=u,l.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>=t)return!0;return!1},l.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(l.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=i.toArray(this.nested))}}),l.prototype.toJSON=function(e){return i.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},l.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),i=0;i<r.length;++i)t=e[r[i]],this.add((void 0!==t.fields?a.fromJSON:void 0!==t.values?n.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?o.fromJSON:l.fromJSON)(r[i],t));return this},l.prototype.get=function(e){return this.nested&&this.nested[e]||null},l.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof n)return this.nested[e].values;throw Error("no such enum: "+e)},l.prototype.add=function(e){if(!(e instanceof o&&void 0!==e.extend||e instanceof a||e instanceof n||e instanceof s||e instanceof l))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof l&&e instanceof l)||t instanceof a||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,i=0;i<r.length;++i)e.add(r[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),d(this)},l.prototype.remove=function(e){if(!(e instanceof c))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},l.prototype.define=function(e,t){if(i.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof l))throw Error("path conflicts with non-namespace objects")}else r.add(r=new l(n))}return t&&r.addJSON(t),r},l.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof l?e[t++].resolveAll():e[t++].resolve();return this.resolve()},l.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),i.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof l&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof l&&(n=this._nestedArray[o].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},l.prototype.lookupType=function(e){var t=this.lookup(e,[a]);if(!t)throw Error("no such type: "+e);return t},l.prototype.lookupEnum=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},l.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[a,n]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},l.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},l._configure=function(){n=r(660),o=r(101),i=r(629),a=r(465),s=r(177)}},773:function(e,t,r){e.exports=d;var n=r(694);((d.prototype=Object.create(n.prototype)).constructor=d).className="Root";var o,i,a,s=r(101),c=r(660),u=r(220),l=r(629);function d(e){n.call(this,"",e),this.deferred=[],this.files=[],this.names=[]}function h(){}d.fromJSON=function(e,t){return e="string"==typeof e?JSON.parse(e):e,t||(t=new d),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},d.prototype.resolvePath=l.path.resolve,d.prototype.parseFromPbString=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return l.asPromise(e,o,t,r);var s=null;if("string"==typeof t)s=JSON.parse(t);else{if("object"!=typeof t)return void console.log("pb格式转化失败");s=t}function c(e,t){if(n){var r=n;n=null,r(e,t)}}function u(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){i.filename=e;var n,a=i(t,o,r),s=0;if(a.imports)for(;s<a.imports.length;++s)d(n=a.imports[s]);if(a.weakImports){for(s=0;s<a.weakImports.length;++s)n=a.weakImports[s];d(n)}}else o.setOptions(t.options).addJSON(t.nested)}catch(e){c(e)}c(null,o)}function d(e){o.names.indexOf(e)>-1||(o.names.push(e),e in a&&u(e,a[e]))}u(s.name,s.pbJsonStr)},d.prototype.load=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return l.asPromise(e,o,t,r);var s=n===h;function c(e,t){if(n){var r=n;if(n=null,s)throw e;r(e,t)}}function u(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){i.filename=e;var n,a=i(t,o,r),u=0;if(a.imports)for(;u<a.imports.length;++u)(n=o.resolvePath(e,a.imports[u]))&&d(n);if(a.weakImports)for(u=0;u<a.weakImports.length;++u)(n=o.resolvePath(e,a.weakImports[u]))&&d(n,!0)}else o.setOptions(t.options).addJSON(t.nested)}catch(e){c(e)}s||p||c(null,o)}function d(e,t){var r=e.lastIndexOf("google/protobuf/");if(r>-1){var i=e.substring(r);i in a&&(e=i)}if(!(o.files.indexOf(e)>-1))if(o.files.push(e),e in a)s?u(e,a[e]):(++p,setTimeout((function(){--p,u(e,a[e])})));else if(s){var d;try{d=l.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||c(e))}u(e,d)}else++p,l.fetch(e,(function(r,i){--p,n&&(r?t?p||c(null,o):c(r):u(e,i))}))}var p=0;l.isString(t)&&(t=[t]);for(var f,m=0;m<t.length;++m)(f=o.resolvePath("",t[m]))&&d(f);if(s)return o;p||c(null,o)},d.prototype.loadSync=function(e,t){if(!l.isNode)throw Error("not supported");return this.load(e,t,h)},d.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return n.prototype.resolveAll.call(this)};var p=/^[A-Z]/;function f(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new s(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.declaringField=t,t.extensionField=n,r.add(n),!0}return!1}d.prototype._handleAdd=function(e){if(e instanceof s)void 0===e.extend||e.extensionField||f(0,e)||this.deferred.push(e);else if(e instanceof c)p.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof u)){if(e instanceof o)for(var t=0;t<this.deferred.length;)f(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);p.test(e.name)&&(e.parent[e.name]=e)}},d.prototype._handleRemove=function(e){if(e instanceof s){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof c)p.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);p.test(e.name)&&delete e.parent[e.name]}},d._configure=function(){o=r(465),i=r(922),a=r(940),s=r(101),c=r(660),u=r(220),l=r(629)}},793:function(e,t,r){var n,o=t;o[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=this.lookup(e["@type"]);if(t){var r="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return this.create({type_url:"/"+r,value:t.encode(t.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){if(t&&t.json&&e.type_url&&e.value){var r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),o=this.lookup(r);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof n){var i=e.$type.toObject(e,t);return i["@type"]=e.$type.fullName,i}return this.toObject(e,t)}},o._configure=function(){n=r(278)}},801:function(e,t,r){var n,o,i;function a(e){return"missing required '"+e.name+"'"}function s(e){return function(t){var r=t.Reader,s=t.types,c=t.util;return function(t,u){t instanceof r||(t=r.create(t));for(var l,d=void 0===u?t.len:t.pos+u,h=new this.ctor;t.pos<d;){var p=t.uint32();if(e.group&&4==(7&p))break;for(var f=p>>>3,m=0,g=!1;m<e.fieldsArray.length;++m){var v=e._fieldsArray[m].resolve(),E=v.name,y=v.resolvedType instanceof n?"int32":v.type;if(f==v.id){if(g=!0,v.map)t.skip().pos++,h[E]===c.emptyObject&&(h[E]={}),l=t[v.keyType](),t.pos++,null!=o.long[v.keyType]?null==o.basic[y]?h[E]["object"==typeof l?c.longToHash(l):l]=s[m].decode(t,t.uint32()):h[E]["object"==typeof l?c.longToHash(l):l]=t[y]():null==o.basic[y]?h[E]=s[m].decode(t,t.uint32()):h[E]=t[y]();else if(v.repeated)if(h[E]&&h[E].length||(h[E]=[]),null!=o.packed[y]&&2==(7&p))for(var _=t.uint32()+t.pos;t.pos<_;)h[E].push(t[y]());else null==o.basic[y]?v.resolvedType.group?h[E].push(s[m].decode(t)):h[E].push(s[m].decode(t,t.uint32())):h[E].push(t[y]());else null==o.basic[y]?v.resolvedType.group?h[E]=s[m].decode(t):h[E]=s[m].decode(t,t.uint32()):h[E]=t[y]();break}}g||(console.log("t",p),t.skipType(7&p))}for(m=0;m<e._fieldsArray.length;++m){var T=e._fieldsArray[m];if(T.required&&!h.hasOwnProperty(T.name))throw i.ProtocolError(a(T),{instance:h})}return h}}}e.exports=s,s._configure=function(){n=r(660),o=r(452),i=r(629)}},811:function(e,t,r){var n,o;function i(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function a(e,t,r,a){var s=a.types;if(e.resolvedType)if(e.resolvedType instanceof n){if(Object.keys(e.resolvedType.values).indexOf(r)<0)return i(e,"enum value")}else{var c=s[t].verify(r);if(c)return e.name+"."+c}else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!o.isInteger(r))return i(e,"integer");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!(o.isInteger(r)||r&&o.isInteger(r.low)&&o.isInteger(r.high)))return i(e,"integer|Long");break;case"float":case"double":if("number"!=typeof r)return i(e,"number");break;case"bool":if("boolean"!=typeof r)return i(e,"boolean");break;case"string":if(!o.isString(r))return i(e,"string");break;case"bytes":if(!(r&&"number"==typeof r.length||o.isString(r)))return i(e,"buffer")}}function s(e,t){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!o.key32Re.test(t))return i(e,"integer key");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!o.key64Re.test(t))return i(e,"integer|Long key");break;case"bool":if(!o.key2Re.test(t))return i(e,"boolean key")}}function c(e){return function(t){return function(r){var n;if("object"!=typeof r||null===r)return"object expected";var c,u={};e.oneofsArray.length&&(c={});for(var l=0;l<e.fieldsArray.length;++l){var d,h=e._fieldsArray[l].resolve(),p=r[h.name];if(!h.optional||null!=p&&r.hasOwnProperty(h.name))if(h.map){if(!o.isObject(p))return i(h,"object");var f=Object.keys(p);for(d=0;d<f.length;++d){if(n=s(h,f[d]))return n;if(n=a(h,l,p[f[d]],t))return n}}else if(h.repeated){if(!Array.isArray(p))return i(h,"array");for(d=0;d<p.length;++d)if(n=a(h,l,p[d],t))return n}else{if(h.partOf){var m=h.partOf.name;if(1===u[h.partOf.name]&&1===c[m])return h.partOf.name+": multiple values";c[m]=1}if(n=a(h,l,p,t))return n}}}}}e.exports=c,c._configure=function(){n=r(660),o=r(629)}},814:function(e){var t=e.exports,r=t.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=t.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),o="";n&&(o=t.shift()+"/");for(var i=0;i<t.length;)".."===t[i]?i>0&&".."!==t[i-1]?t.splice(--i,2):n?t.splice(i,1):++i:"."===t[i]?t.splice(i,1):++i;return o+t.join("/")};t.resolve=function(e,t,o){return o||(t=n(t)),r(t)?t:(o||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}},879:function(e){e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function n(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=n;var o={},i={};function a(e,t){var r,n,a;return t?(a=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=c(e,(0|e)<0?-1:0,!0),a&&(i[e]=r),r):(a=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=c(e,e<0?-1:0,!1),a&&(o[e]=r),r)}function s(e,t){if(isNaN(e))return t?v:g;if(t){if(e<0)return v;if(e>=p)return I}else{if(e<=-f)return O;if(e+1>=f)return T}return e<0?s(-e,t).neg():c(e%h|0,e/h|0,t)}function c(e,t,n){return new r(e,t,n)}r.fromInt=a,r.fromNumber=s,r.fromBits=c;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var o=s(u(r,8)),i=g,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),d=parseInt(e.substring(a,a+c),r);if(c<8){var h=s(u(r,c));i=i.mul(h).add(s(d))}else i=(i=i.mul(o)).add(s(d))}return i.unsigned=t,i}function d(e,t){return"number"==typeof e?s(e,t):"string"==typeof e?l(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=d;var h=4294967296,p=h*h,f=p/2,m=a(1<<24),g=a(0);r.ZERO=g;var v=a(0,!0);r.UZERO=v;var E=a(1);r.ONE=E;var y=a(1,!0);r.UONE=y;var _=a(-1);r.NEG_ONE=_;var T=c(-1,2147483647,!1);r.MAX_VALUE=T;var I=c(-1,-1,!0);r.MAX_UNSIGNED_VALUE=I;var O=c(0,-2147483648,!1);r.MIN_VALUE=O;var R=r.prototype;R.toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},R.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(O)){var t=s(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=s(u(e,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=(i.sub(c.mul(o)).toInt()>>>0).toString(e);if((i=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},R.isZero=function(){return 0===this.high&&0===this.low},R.eqz=R.isZero,R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return!(1&~this.low)},R.isEven=function(){return!(1&this.low)},R.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.ne=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.le=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.ge=R.greaterThanOrEqual,R.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(E)},R.neg=R.negate,R.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,a=e.high>>>16,s=65535&e.high,u=e.low>>>16,l=0,h=0,p=0,f=0;return p+=(f+=i+(65535&e.low))>>>16,h+=(p+=o+u)>>>16,l+=(h+=r+s)>>>16,l+=t+a,c((p&=65535)<<16|(f&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},R.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){if(this.isZero())return g;if(n(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(O))return e.isOdd()?O:g;if(e.eq(O))return this.isOdd()?O:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return s(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,a=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=65535&e.low,f=0,v=0,E=0,y=0;return E+=(y+=a*p)>>>16,v+=(E+=i*p)>>>16,E&=65535,v+=(E+=a*h)>>>16,f+=(v+=o*p)>>>16,v&=65535,f+=(v+=i*h)>>>16,v&=65535,f+=(v+=a*l)>>>16,f+=r*p+o*h+i*l+a*u,c((E&=65535)<<16|(y&=65535),(f&=65535)<<16|(v&=65535),this.unsigned)},R.mul=R.multiply,R.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var r,o,i;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return y;i=v}else{if(this.eq(O))return e.eq(E)||e.eq(_)?O:e.eq(O)?E:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?E:_:(o=this.sub(e.mul(r)),i=r.add(o.div(e)));if(e.eq(O))return this.unsigned?v:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=g}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),l=a<=48?1:u(2,a-48),h=s(r),p=h.mul(e);p.isNegative()||p.gt(o);)p=(h=s(r-=l,this.unsigned)).mul(e);h.isZero()&&(h=E),i=i.add(h),o=o.sub(p)}return i},R.div=R.divide,R.modulo=function(e){return n(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.rem=R.modulo,R.not=function(){return c(~this.low,~this.high,this.unsigned)},R.and=function(e){return n(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return n(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},R.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},R.shl=R.shiftLeft,R.shiftRight=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},R.shru=R.shiftRightUnsigned,R.shr_u=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,n){return n?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},880:function(e){"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,o=2,i=!0;o<arguments.length;)r[n++]=arguments[o++];return new Promise((function(o,a){r[n]=function(e){if(i)if(i=!1,e)a(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];o.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,a(e))}}))}},887:function(e,t,r){var n,o,i;!function(a){"use strict";if(null!=t&&"number"!=typeof t.nodeType)e.exports=a();else if(null!=r.amdO)o=[],void 0===(i="function"==typeof(n=a)?n.apply(t,o):n)||(e.exports=i);else{var s=a(),c="undefined"!=typeof self?self:$.global;"function"!=typeof c.btoa&&(c.btoa=s.btoa),"function"!=typeof c.atob&&(c.atob=s.atob)}}((function(){"use strict";var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(r){for(var n,o,i=String(r),a=0,s=e,c="";i.charAt(0|a)||(s="=",a%1);c+=s.charAt(63&n>>8-a%1*8)){if((o=i.charCodeAt(a+=3/4))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return c},atob:function(r){var n=String(r).replace(/[=]+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,a=0,s=0,c="";i=n.charAt(s++);~i&&(o=a%4?64*o+i:i,a++%4)?c+=String.fromCharCode(255&o>>(-2*a&6)):0)i=e.indexOf(i);return c}}}))},896:function(e){e.exports={}},899:function(e){function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function i(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function s(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:i,e.writeFloatBE=n?i:o,e.readFloatLE=n?a:s,e.readFloatBE=n?s:a}():function(){function t(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,n)}}function a(e,t,r){var n=e(t,r),o=2*(n>>31)+1,i=n>>>23&255,a=8388607&n;return 255===i?a?NaN:o*(1/0):0===i?1401298464324817e-60*o*a:o*Math.pow(2,i-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=a.bind(null,o),e.readFloatBE=a.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function i(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function s(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:i,e.writeDoubleBE=n?i:o,e.readDoubleLE=n?a:s,e.readDoubleBE=n?s:a}():function(){function t(e,t,r,n,o,i){var a=n<0?1:0;if(a&&(n=-n),0===n)e(0,o,i+t),e(1/n>0?0:2147483648,o,i+r);else if(isNaN(n))e(0,o,i+t),e(2146959360,o,i+r);else if(n>17976931348623157e292)e(0,o,i+t),e((a<<31|2146435072)>>>0,o,i+r);else{var s;if(n<22250738585072014e-324)e((s=n/5e-324)>>>0,o,i+t),e((a<<31|s/4294967296)>>>0,o,i+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(s=n*Math.pow(2,-c))>>>0,o,i+t),e((a<<31|c+1023<<20|1048576*s&1048575)>>>0,o,i+r)}}}function a(e,t,r,n,o){var i=e(n,o+t),a=e(n,o+r),s=2*(a>>31)+1,c=a>>>20&2047,u=4294967296*(1048575&a)+i;return 2047===c?u?NaN:s*(1/0):0===c?5e-324*s*u:s*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=a.bind(null,o,0,4),e.readDoubleBE=a.bind(null,i,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},921:function(e,t,r){var n,o,i=e.exports;function a(e,t,r,i){var a=i.m,s=i.d,c=i.types,u=i.ksi,l=void 0!==u;if(e.resolvedType)if(e.resolvedType instanceof n){for(var d=l?s[r][u]:s[r],h=e.resolvedType.values,p=Object.keys(h),f=0;f<p.length;f++)if(!(e.repeated&&h[p[f]]===e.typeDefault||p[f]!=d&&h[p[f]]!=d)){l?a[r][u]=h[p[f]]:a[r]=h[p[f]];break}}else{if("object"!=typeof(l?s[r][u]:s[r]))throw TypeError(e.fullName+": object expected");l?a[r][u]=c[t].fromObject(s[r][u]):a[r]=c[t].fromObject(s[r])}else{var m=!1;switch(e.type){case"double":case"float":l?a[r][u]=Number(s[r][u]):a[r]=Number(s[r]);break;case"uint32":case"fixed32":l?a[r][u]=s[r][u]>>>0:a[r]=s[r]>>>0;break;case"int32":case"sint32":case"sfixed32":l?a[r][u]=0|s[r][u]:a[r]=0|s[r];break;case"uint64":m=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o.Long?l?a[r][u]=o.Long.fromValue(s[r][u]).unsigned=m:a[r]=o.Long.fromValue(s[r]).unsigned=m:"string"==typeof(l?s[r][u]:s[r])?l?a[r][u]=parseInt(s[r][u],10):a[r]=parseInt(s[r],10):"number"==typeof(l?s[r][u]:s[r])?l?a[r][u]=s[r][u]:a[r]=s[r]:"object"==typeof(l?s[r][u]:s[r])&&(l?a[r][u]=new o.LongBits(s[r][u].low>>>0,s[r][u].high>>>0).toNumber(m):a[r]=new o.LongBits(s[r].low>>>0,s[r].high>>>0).toNumber(m));break;case"bytes":"string"==typeof(l?s[r][u]:s[r])?l?o.base64.decode(s[r][u],a[r][u]=o.newBuffer(o.base64.length(s[r][u])),0):o.base64.decode(s[r],a[r]=o.newBuffer(o.base64.length(s[r])),0):(l?s[r][u]:s[r]).length&&(l?a[r][u]=s[r][u]:a[r]=s[r]);break;case"string":l?a[r][u]=String(s[r][u]):a[r]=String(s[r]);break;case"bool":l?a[r][u]=Boolean(s[r][u]):a[r]=Boolean(s[r])}}}function s(e,t,r,i){var a=i.m,s=i.d,c=i.types,u=i.ksi,l=i.o,d=void 0!==u;if(e.resolvedType)e.resolvedType instanceof n?d?s[r][u]=l.enums===String?c[t].values[a[r][u]]:a[r][u]:s[r]=l.enums===String?c[t].values[a[r]]:a[r]:d?s[r][u]=c[t].toObject(a[r][u],l):s[r]=c[t].toObject(a[r],l);else{var h=!1;switch(e.type){case"double":case"float":d?s[r][u]=l.json&&!isFinite(a[r][u])?String(a[r][u]):a[r][u]:s[r]=l.json&&!isFinite(a[r])?String(a[r]):a[r];break;case"uint64":h=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":"number"==typeof a[r][u]?d?s[r][u]=l.longs===String?String(a[r][u]):a[r][u]:s[r]=l.longs===String?String(a[r]):a[r]:d?s[r][u]=l.longs===String?o.Long.prototype.toString.call(a[r][u]):l.longs===Number?new o.LongBits(a[r][u].low>>>0,a[r][u].high>>>0).toNumber(h):a[r][u]:s[r]=l.longs===String?o.Long.prototype.toString.call(a[r]):l.longs===Number?new o.LongBits(a[r].low>>>0,a[r].high>>>0).toNumber(h):a[r];break;case"bytes":d?s[r][u]=l.bytes===String?o.base64.encode(a[r][u],0,a[r][u].length):l.bytes===Array?Array.prototype.slice.call(a[r][u]):a[r][u]:s[r]=l.bytes===String?o.base64.encode(a[r],0,a[r].length):l.bytes===Array?Array.prototype.slice.call(a[r]):a[r];break;default:d?s[r][u]=a[r][u]:s[r]=a[r]}}}i._configure=function(){n=r(660),o=r(629)},i.fromObject=function(e){var t=e.fieldsArray;return function(e){return function(r){if(r instanceof this.ctor)return r;if(!t.length)return new this.ctor;for(var i=new this.ctor,s=0;s<t.length;++s){var c,u=t[s].resolve(),l=u.name;if(u.map){if(r[l]){if("object"!=typeof r[l])throw TypeError(u.fullName+": object expected");i[l]={}}var d=Object.keys(r[l]);for(c=0;c<d.length;++c)a(u,s,l,o.merge(o.copy(e),{m:i,d:r,ksi:d[c]}))}else if(u.repeated){if(r[l]){if(!Array.isArray(r[l]))throw TypeError(u.fullName+": array expected");for(i[l]=[],c=0;c<r[l].length;++c)a(u,s,l,o.merge(o.copy(e),{m:i,d:r,ksi:c}))}}else(u.resolvedType instanceof n||null!=r[l])&&a(u,s,l,o.merge(o.copy(e),{m:i,d:r}))}return i}}},i.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);return function(r){return t.length?function(i,a){a=a||{};for(var c,u,l={},d=[],h=[],p=[],f=0;f<t.length;++f)t[f].partOf||(t[f].resolve().repeated?d:t[f].map?h:p).push(t[f]);if(d.length&&(a.arrays||a.defaults))for(f=0;f<d.length;++f)l[d[f].name]=[];if(h.length&&(a.objects||a.defaults))for(f=0;f<h.length;++f)l[h[f].name]={};if(p.length&&a.defaults)for(f=0;f<p.length;++f)if(u=(c=p[f]).name,c.resolvedType instanceof n)l[u]=a.enums=String?c.resolvedType.valuesById[c.typeDefault]:c.typeDefault;else if(c.long)if(o.Long){var m=new o.Long(c.typeDefault.low,c.typeDefault.high,c.typeDefault.unsigned);l[u]=a.longs===String?m.toString():a.longs===Number?m.toNumber():m}else l[u]=a.longs===String?c.typeDefault.toString():c.typeDefault.toNumber();else c.bytes?l[u]=a.bytes===String?String.fromCharCode.apply(String,c.typeDefault):Array.prototype.slice.call(c.typeDefault).join("*..*").split("*..*"):l[u]=c.typeDefault;var g=!1;for(f=0;f<t.length;++f){u=(c=t[f]).name;var v,E,y=e._fieldsArray.indexOf(c);if(c.map){if(g||(g=!0),i[u]&&(v=Object.keys(i[u]).length))for(l[u]={},E=0;E<v.length;++E)s(c,y,u,o.merge(o.copy(r),{m:i,d:l,ksi:v[E],o:a}))}else if(c.repeated){if(i[u]&&i[u].length)for(l[u]=[],E=0;E<i[u].length;++E)s(c,y,u,o.merge(o.copy(r),{m:i,d:l,ksi:E,o:a}))}else null!=i[u]&&i.hasOwnProperty(u)&&s(c,y,u,o.merge(o.copy(r),{m:i,d:l,o:a})),c.partOf&&a.oneofs&&(l[c.partOf.name]=u)}return l}:function(){return{}}}}},922:function(e,t,r){"use strict";var n,o,i,a,s,c,u,l,d,h,p;e.exports=R,R.filename=null,R.defaults={keepCase:!1};var f=/^[1-9][0-9]*$/,m=/^-?[1-9][0-9]*$/,g=/^0[x][0-9a-fA-F]+$/,v=/^-?0[x][0-9a-fA-F]+$/,E=/^0[0-7]+$/,y=/^-?0[0-7]+$/,_=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,T=/^[a-zA-Z_][a-zA-Z_0-9]*$/,I=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,O=/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/;function R(e,t,r){t instanceof o||(r=t,t=new o),r||(r=R.defaults);var C,S,N,b,A,M=n(e,r.alternateCommentMode||!1),w=M.next,U=M.push,L=M.peek,P=M.skip,D=M.cmnt,k=!0,x=!1,B=t,G=r.keepCase?function(e){return e}:p.camelCase;function j(e,t,r){var n=R.filename;return r||(R.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+M.line+")")}function H(){var e,t=[];do{if('"'!==(e=w())&&"'"!==e)throw j(e);t.push(w()),P(e),e=L()}while('"'===e||"'"===e);return t.join("")}function F(e){var t=w();switch(t){case"'":case'"':return U(t),H();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e){var t=1;switch("-"===e.charAt(0)&&(t=-1,e=e.substring(1)),e){case"inf":case"INF":case"Inf":return t*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(f.test(e))return t*parseInt(e,10);if(g.test(e))return t*parseInt(e,16);if(E.test(e))return t*parseInt(e,8);if(_.test(e))return t*parseFloat(e);throw j(e,"number",!0)}(t)}catch(r){if(e&&I.test(t))return t;throw j(t,"value")}}function W(e,t){var r,n;do{!t||'"'!==(r=L())&&"'"!==r?e.push([n=z(w()),P("to",!0)?z(w()):n]):e.push(H())}while(P(",",!0));P(";")}function z(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw j(e,"id");if(m.test(e))return parseInt(e,10);if(v.test(e))return parseInt(e,16);if(y.test(e))return parseInt(e,8);throw j(e,"id")}function q(){if(void 0!==C)throw j("package");if(C=w(),!I.test(C))throw j(C,"name");B=B.define(C),P(";")}function K(){var e,t=L();switch(t){case"weak":e=N||(N=[]),w();break;case"public":w();default:e=S||(S=[])}t=H(),P(";"),e.push(t)}function V(){if(P("="),b=H(),!(x="proto3"===b)&&"proto2"!==b)throw j(b,"syntax");P(";")}function J(e,t){switch(t){case"option":return Q(e,t),P(";"),!0;case"message":return function(e,t){if(!T.test(t=w()))throw j(t,"type name");var r=new i(t);Y(r,(function(e){if(!J(r,e))switch(e){case"map":!function(e){P("<");var t=w();if(void 0===h.mapKey[t])throw j(t,"type");P(",");var r=w();if(!I.test(r))throw j(r,"type");P(">");var n=w();if(!T.test(n))throw j(n,"name");P("=");var o=new s(G(n),z(w()),t,r);Y(o,(function(e){if("option"!==e)throw j(e);Q(o,e),P(";")}),(function(){ee(o)})),e.add(o)}(r);break;case"required":case"optional":case"repeated":X(r,e);break;case"oneof":!function(e,t){if(!T.test(t=w()))throw j(t,"name");var r=new c(G(t));Y(r,(function(e){"option"===e?(Q(r,e),P(";")):(U(e),X(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":W(r.extensions||(r.extensions=[]));break;case"reserved":W(r.reserved||(r.reserved=[]),!0);break;default:if(!x||!I.test(e))throw j(e);U(e),X(r,"optional")}})),e.add(r)}(e,t),!0;case"enum":return function(e,t){if(!T.test(t=w()))throw j(t,"name");var r=new u(t);Y(r,(function(e){switch(e){case"option":Q(r,e),P(";");break;case"reserved":W(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!T.test(t))throw j(t,"name");P("=");var r=z(w(),!0),n={};Y(n,(function(e){if("option"!==e)throw j(e);Q(n,e),P(";")}),(function(){ee(n)})),e.add(t,r,n.comment)}(r,e)}})),e.add(r)}(e,t),!0;case"service":return function(e,t){if(!T.test(t=w()))throw j(t,"service name");var r=new l(t);Y(r,(function(e){if(!J(r,e)){if("rpc"!==e)throw j(e);!function(e,t){var r=t;if(!T.test(t=w()))throw j(t,"name");var n,o,i,a,s=t;if(P("("),P("stream",!0)&&(o=!0),!I.test(t=w()))throw j(t);if(n=t,P(")"),P("returns"),P("("),P("stream",!0)&&(a=!0),!I.test(t=w()))throw j(t);i=t,P(")");var c=new d(s,r,n,i,o,a);Y(c,(function(e){if("option"!==e)throw j(e);Q(c,e),P(";")})),e.add(c)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!I.test(t=w()))throw j(t,"reference");var r=t;Y(null,(function(t){switch(t){case"required":case"repeated":case"optional":X(e,t,r);break;default:if(!x||!I.test(t))throw j(t);U(t),X(e,"optional",r)}}))}(e,t),!0}return!1}function Y(e,t,r){var n=M.line;if(e&&(e.comment=D(),e.filename=R.filename),P("{",!0)){for(var o;"}"!==(o=w());)t(o);P(";",!0)}else r&&r(),P(";"),e&&"string"!=typeof e.comment&&(e.comment=D(n))}function X(e,t,r){var n=w();if("group"!==n){if(!I.test(n))throw j(n,"type");var o=w();if(!T.test(o))throw j(o,"name");o=G(o),P("=");var s=new a(o,z(w()),n,t,r);Y(s,(function(e){if("option"!==e)throw j(e);Q(s,e),P(";")}),(function(){ee(s)})),e.add(s),x||!s.repeated||void 0===h.packed[n]&&void 0!==h.basic[n]||s.setOption("packed",!1,!0)}else!function(e,t){var r=w();if(!T.test(r))throw j(r,"name");var n=p.lcFirst(r);r===n&&(r=p.ucFirst(r)),P("=");var o=z(w()),s=new i(r);s.group=!0;var c=new a(n,o,r,t);c.filename=R.filename,Y(s,(function(e){switch(e){case"option":Q(s,e),P(";");break;case"required":case"optional":case"repeated":X(s,e);break;default:throw j(e)}})),e.add(s).add(c)}(e,t)}function Q(e,t){var r=P("(",!0);if(!I.test(t=w()))throw j(t,"name");var n=t;r&&(P(")"),n="("+n+")",t=L(),O.test(t)&&(n+=t,w())),P("="),Z(e,n)}function Z(e,t){if(P("{",!0))do{if(!T.test(A=w()))throw j(A,"name");"{"===L()?Z(e,t+"."+A):(P(":"),"{"===L()?Z(e,t+"."+A):$(e,t+"."+A,F(!0)))}while(!P("}",!0));else $(e,t,F(!0))}function $(e,t,r){e.setOption&&e.setOption(t,r)}function ee(e){if(P("[",!0)){do{Q(e,"option")}while(P(",",!0));P("]")}return e}for(;null!==(A=w());)switch(A){case"package":if(!k)throw j(A);q();break;case"import":if(!k)throw j(A);K();break;case"syntax":if(!k)throw j(A);V();break;case"option":if(!k)throw j(A);Q(B,A),P(";");break;default:if(J(B,A)){k=!1;continue}throw j(A)}return R.filename=null,{package:C,imports:S,weakImports:N,syntax:b,root:t}}R._configure=function(){n=r(496),o=r(773),i=r(465),a=r(101),s=r(83),c=r(220),u=r(660),l=r(177),d=r(512),h=r(452),p=r(629)}},940:function(e){e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},970:function(e,t,r){e.exports=s;var n,o,i=r(629);function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function s(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){return e instanceof Uint8Array||Array.isArray(e)?new s(e):"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?new s(new Uint8Array(e)):void 0}:function(e){if(Array.isArray(e))return new s(e)};function l(){var e=new n(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new n(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}s.create=i.Buffer?function(e){return(s.create=function(e){return i.Buffer.isBuffer(e)?new(void 0)(e):u(e)})(e)}:u,s.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,s.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),s.prototype.int32=function(){return 0|this.uint32()},s.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},s.prototype.bool=function(){return 0!==this.uint32()},s.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},s.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},s.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},s.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},s.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},s.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},s.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},s._configure=function(){n=r(183),o=r(442);var e=i.Long?"toLong":"toNumber";i.merge(s.prototype,{int64:function(){return l.call(this)[e](!1)},uint64:function(){return l.call(this)[e](!0)},sint64:function(){return l.call(this).zzDecode()[e](!1)},fixed64:function(){return h.call(this)[e](!0)},sfixed64:function(){return h.call(this)[e](!1)}})}},986:function(e){"use strict";var t=e.exports;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(e,t,n){for(var o,i=null,a=[],s=0,c=0;t<n;){var u=e[t++];switch(c){case 0:a[s++]=r[u>>2],o=(3&u)<<4,c=1;break;case 1:a[s++]=r[o|u>>4],o=(15&u)<<2,c=2;break;case 2:a[s++]=r[o|u>>6],a[s++]=r[63&u],c=0}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),s=0)}return c&&(a[s++]=r[o],a[s++]=61,1===c&&(a[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,a.slice(0,s))),i.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var i="invalid encoding";t.decode=function(e,t,r){for(var o,a=r,s=0,c=0;c<e.length;){var u=e.charCodeAt(c++);if(61===u&&s>1)break;if(void 0===(u=n[u]))throw Error(i);switch(s){case 0:o=u,s=1;break;case 1:t[r++]=o<<2|(48&u)>>4,o=u,s=2;break;case 2:t[r++]=(15&o)<<4|(60&u)>>2,o=u,s=3;break;case 3:t[r++]=(3&o)<<6|u,s=0}}if(1===s)throw Error(i);return r-a},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.amdO={},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";r.d(n,{default:function(){return Zc}});var e={};r.r(e),r.d(e,{acceptContactInvite:function(){return oo},acceptInvitation:function(){return no},addContact:function(){return eo},addConversationMark:function(){return wo},addReaction:function(){return go},addToBlackList:function(){return so},addUsersToBlacklist:function(){return co},addUsersToBlocklist:function(){return uo},declineContactInvite:function(){return ao},declineInvitation:function(){return io},deleteAllMessagesAndConversations:function(){return Do},deleteContact:function(){return ro},deleteConversation:function(){return zn},deleteReaction:function(){return vo},deleteSession:function(){return Wn},fetchHistoryMessages:function(){return Xn},fetchUserInfoById:function(){return Vn},getAllContacts:function(){return bo},getBlacklist:function(){return Pn},getBlocklist:function(){return Dn},getContacts:function(){return xn},getContactsWithCursor:function(){return Ao},getConversationlist:function(){return Hn},getHistoryMessages:function(){return Zn},getRTCToken:function(){return $o},getReactionDetail:function(){return _o},getReactionList:function(){return Eo},getReactionlist:function(){return yo},getRoster:function(){return kn},getSelfIdsOnOtherPlatform:function(){return Po},getServerConversations:function(){return Oo},getServerConversationsByFilter:function(){return Lo},getServerPinnedConversations:function(){return Co},getServerPinnedMessages:function(){return Go},getSessionList:function(){return jn},getTokenExpireTimestamp:function(){return Yn},getUserIdByRTCUIds:function(){return ei},modifyMessage:function(){return mo},pinConversation:function(){return So},pinMessage:function(){return xo},recallMessage:function(){return fo},removeConversationMark:function(){return Uo},removeFromBlackList:function(){return lo},removeHistoryMessages:function(){return Io},removeRoster:function(){return to},removeUserFromBlackList:function(){return ho},removeUserFromBlocklist:function(){return po},reportMessage:function(){return To},searchMessages:function(){return $n},setContactRemark:function(){return No},unbindPushToken:function(){return jo},unpinMessage:function(){return Bo},updateCurrentUserNick:function(){return Jn},updateOwnUserInfo:function(){return qn},updateUserInfo:function(){return Kn},uploadPushToken:function(){return Gn},uploadToken:function(){return Bn},voiceFileToText:function(){return Zo},voiceMessageToText:function(){return Qo}});var t={};r.r(t),r.d(t,{acceptGroupInvite:function(){return xi},acceptGroupJoinRequest:function(){return Li},addUsersToGroupAllowlist:function(){return da},addUsersToGroupWhitelist:function(){return la},agreeInviteIntoGroup:function(){return ki},agreeJoinGroup:function(){return Ui},blockGroup:function(){return si},blockGroupMember:function(){return Zi},blockGroupMembers:function(){return ea},blockGroupMessage:function(){return La},blockGroupMessages:function(){return ci},changeGroupOwner:function(){return fi},changeOwner:function(){return pi},createGroup:function(){return ii},createGroupNew:function(){return oi},createGroupVNext:function(){return ai},deleteGroupSharedFile:function(){return Ca},destroyGroup:function(){return Si},disableSendGroupMsg:function(){return ca},dissolveGroup:function(){return Ci},downloadGroupSharedFile:function(){return ba},enableSendGroupMsg:function(){return ua},fetchGroupAnnouncement:function(){return Ia},fetchGroupSharedFileList:function(){return Sa},getGroup:function(){return di},getGroupAdmin:function(){return _i},getGroupAllowlist:function(){return ga},getGroupBlacklist:function(){return aa},getGroupBlacklistNew:function(){return ia},getGroupBlocklist:function(){return sa},getGroupInfo:function(){return mi},getGroupMemberAttributes:function(){return Ma},getGroupMembers:function(){return yi},getGroupMembersAttributes:function(){return wa},getGroupMsgReadUser:function(){return Ta},getGroupMuteList:function(){return Yi},getGroupMutelist:function(){return Xi},getGroupSharedFilelist:function(){return Na},getGroupWhitelist:function(){return ma},getJoinedGroups:function(){return hi},getJoinedGroupsCount:function(){return Ua},getMuted:function(){return Ji},getPublicGroups:function(){return li},groupBlockMulti:function(){return $i},groupBlockSingle:function(){return Qi},inviteToGroup:function(){return Ai},inviteUsersToGroup:function(){return Mi},isGroupWhiteUser:function(){return va},isInGroupAllowlist:function(){return ya},isInGroupMutelist:function(){return _a},isInGroupWhiteList:function(){return Ea},joinGroup:function(){return wi},leaveGroup:function(){return bi},listGroupMember:function(){return vi},listGroupMembers:function(){return Ei},listGroups:function(){return ui},modifyGroup:function(){return gi},mute:function(){return zi},muteGroupMember:function(){return qi},quitGroup:function(){return Ni},rejectGroupInvite:function(){return Gi},rejectGroupJoinRequest:function(){return Di},rejectInviteIntoGroup:function(){return Bi},rejectJoinGroup:function(){return Pi},removeAdmin:function(){return Oi},removeGroupAdmin:function(){return Ri},removeGroupAllowlistMember:function(){return fa},removeGroupBlockMulti:function(){return na},removeGroupBlockSingle:function(){return ta},removeGroupMember:function(){return Hi},removeGroupMembers:function(){return Wi},removeGroupWhitelistMember:function(){return pa},removeMultiGroupMember:function(){return Fi},removeMute:function(){return Ki},removeSingleGroupMember:function(){return ji},rmUsersFromGroupWhitelist:function(){return ha},setAdmin:function(){return Ti},setGroupAdmin:function(){return Ii},setGroupMemberAttributes:function(){return Aa},unblockGroupMember:function(){return ra},unblockGroupMembers:function(){return oa},unblockGroupMessage:function(){return Pa},unmuteGroupMember:function(){return Vi},updateGroupAnnouncement:function(){return Oa},uploadGroupSharedFile:function(){return Ra}});var o={};r.r(o),r.d(o,{addUsersToChatRoom:function(){return qa},addUsersToChatRoomAllowlist:function(){return Ts},addUsersToChatRoomWhitelist:function(){return _s},blockChatRoomMember:function(){return cs},blockChatRoomMembers:function(){return ls},chatRoomBlockMulti:function(){return us},chatRoomBlockSingle:function(){return ss},createChatRoom:function(){return xa},deleteChatRoomSharedFile:function(){return Ls},destroyChatRoom:function(){return Ba},disableSendChatRoomMsg:function(){return Es},enableSendChatRoomMsg:function(){return ys},fetchChatRoomAnnouncement:function(){return Ms},fetchChatRoomSharedFileList:function(){return Ps},getChatRoomAdmin:function(){return Za},getChatRoomAllowlist:function(){return Ss},getChatRoomAttributes:function(){return ks},getChatRoomBlacklist:function(){return gs},getChatRoomBlacklistNew:function(){return ms},getChatRoomBlocklist:function(){return vs},getChatRoomDetails:function(){return Ga},getChatRoomMembers:function(){return Qa},getChatRoomMuteList:function(){return is},getChatRoomMuted:function(){return os},getChatRoomMutelist:function(){return as},getChatRoomSharedFilelist:function(){return Ds},getChatRoomWhitelist:function(){return Cs},getChatRooms:function(){return ka},getJoinedChatRooms:function(){return Hs},isChatRoomWhiteUser:function(){return Ns},isInChatRoomAllowlist:function(){return bs},isInChatRoomMutelist:function(){return As},joinChatRoom:function(){return Ka},leaveChatRoom:function(){return Ja},listChatRoomMember:function(){return Ya},listChatRoomMembers:function(){return Xa},modifyChatRoom:function(){return ja},muteChatRoomMember:function(){return ts},quitChatRoom:function(){return Va},removeChatRoomAdmin:function(){return es},removeChatRoomAllowlistMember:function(){return Rs},removeChatRoomAttribute:function(){return js},removeChatRoomAttributes:function(){return Gs},removeChatRoomBlockMulti:function(){return ps},removeChatRoomBlockSingle:function(){return ds},removeChatRoomMember:function(){return Fa},removeChatRoomMembers:function(){return za},removeChatRoomWhitelistMember:function(){return Os},removeMultiChatRoomMember:function(){return Wa},removeMuteChatRoomMember:function(){return rs},removeSingleChatRoomMember:function(){return Ha},rmUsersFromChatRoomWhitelist:function(){return Is},setChatRoomAdmin:function(){return $a},setChatRoomAttribute:function(){return Bs},setChatRoomAttributes:function(){return xs},unblockChatRoomMember:function(){return hs},unblockChatRoomMembers:function(){return fs},unmuteChatRoomMember:function(){return ns},updateChatRoomAnnouncement:function(){return ws},uploadChatRoomSharedFile:function(){return Us}});var i={};r.r(i),r.d(i,{getPresenceStatus:function(){return Ys},getSubscribedPresenceList:function(){return Vs},getSubscribedPresencelist:function(){return Js},publishPresence:function(){return zs},subscribePresence:function(){return qs},unsubscribePresence:function(){return Ks}});var a={};r.r(a),r.d(a,{clearRemindTypeForConversation:function(){return $s},getPushPerformLanguage:function(){return nc},getSilentModeForAll:function(){return Qs},getSilentModeForConversation:function(){return ec},getSilentModeForConversations:function(){return tc},getSilentModeRemindTypeConversations:function(){return oc},setPushPerformLanguage:function(){return rc},setSilentModeForAll:function(){return Xs},setSilentModeForConversation:function(){return Zs}});var s={};r.r(s),r.d(s,{changeChatThreadName:function(){return dc},createChatThread:function(){return sc},destroyChatThread:function(){return lc},getChatThreadDetail:function(){return Ec},getChatThreadLastMessage:function(){return gc},getChatThreadMembers:function(){return hc},getChatThreads:function(){return mc},getJoinedChatThreads:function(){return fc},joinChatThread:function(){return cc},leaveChatThread:function(){return uc},removeChatThreadMember:function(){return pc}});var c={};r.r(c),r.d(c,{getSupportedLanguages:function(){return yc},translateMessage:function(){return _c}});var u={};function l(){u.converter._configure(),u.decoder._configure(),u.encoder._configure(),u.Field._configure(),u.MapField._configure(),u.Message._configure(),u.Namespace._configure(),u.Method._configure(),u.ReflectionObject._configure(),u.OneOf._configure(),u.parse._configure(),u.Reader._configure(),u.Root._configure(),u.Service._configure(),u.verifier._configure(),u.Type._configure(),u.types._configure(),u.wrappers._configure(),u.Writer._configure()}u.build="minimal",u.Writer=r(322),u.encoder=r(229),u.Reader=r(970),u.util=r(629),u.rpc=r(470),u.roots=r(896),u.verifier=r(811),u.tokenize=r(496),u.parse=r(922),u.common=r(940),u.ReflectionObject=r(558),u.Namespace=r(694),u.Root=r(773),u.Enum=r(660),u.Type=r(465),u.Field=r(101),u.OneOf=r(220),u.MapField=r(83),u.Service=r(177),u.Method=r(512),u.converter=r(921),u.decoder=r(801),u.Message=r(278),u.wrappers=r(793),u.types=r(452),u.util=r(629),u.configure=l,u.load=function(e,t,r){return"function"==typeof t?(r=t,t=new u.Root):t||(t=new u.Root),t.load(e,r)},u.loadSync=function(e,t){return t||(t=new u.Root),t.loadSync(e)},u.parseFromPbString=function(e,t,r){return"function"==typeof t?(r=t,t=new u.Root):t||(t=new u.Root),t.parseFromPbString(e,r)},l();var d,h=u,p=r(570),f=r.n(p),m=function(){function e(e){this.type=e.type,this.message=e.message,this.data=e.data}return e.create=function(t){return new e(t)},e}();!function(e){e[e.REQUEST_SUCCESS=0]="REQUEST_SUCCESS",e[e.REQUEST_TIMEOUT=-1]="REQUEST_TIMEOUT",e[e.REQUEST_UNKNOWN=-2]="REQUEST_UNKNOWN",e[e.REQUEST_PARAMETER_ERROR=-3]="REQUEST_PARAMETER_ERROR",e[e.REQUEST_ABORT=-4]="REQUEST_ABORT",e[e.WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR=0]="WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_OPEN_ERROR=1]="WEBIM_CONNCTION_OPEN_ERROR",e[e.WEBIM_CONNCTION_AUTH_ERROR=2]="WEBIM_CONNCTION_AUTH_ERROR",e[e.WEBIM_CONNCTION_OPEN_USERGRID_ERROR=3]="WEBIM_CONNCTION_OPEN_USERGRID_ERROR",e[e.WEBIM_CONNCTION_ATTACH_ERROR=4]="WEBIM_CONNCTION_ATTACH_ERROR",e[e.WEBIM_CONNCTION_ATTACH_USERGRID_ERROR=5]="WEBIM_CONNCTION_ATTACH_USERGRID_ERROR",e[e.WEBIM_CONNCTION_REOPEN_ERROR=6]="WEBIM_CONNCTION_REOPEN_ERROR",e[e.WEBIM_CONNCTION_SERVER_CLOSE_ERROR=7]="WEBIM_CONNCTION_SERVER_CLOSE_ERROR",e[e.WEBIM_CONNCTION_SERVER_ERROR=8]="WEBIM_CONNCTION_SERVER_ERROR",e[e.WEBIM_CONNCTION_IQ_ERROR=9]="WEBIM_CONNCTION_IQ_ERROR",e[e.WEBIM_CONNCTION_PING_ERROR=10]="WEBIM_CONNCTION_PING_ERROR",e[e.WEBIM_CONNCTION_NOTIFYVERSION_ERROR=11]="WEBIM_CONNCTION_NOTIFYVERSION_ERROR",e[e.WEBIM_CONNCTION_GETROSTER_ERROR=12]="WEBIM_CONNCTION_GETROSTER_ERROR",e[e.WEBIM_CONNCTION_CROSSDOMAIN_ERROR=13]="WEBIM_CONNCTION_CROSSDOMAIN_ERROR",e[e.WEBIM_CONNCTION_LISTENING_OUTOF_MAXRETRIES=14]="WEBIM_CONNCTION_LISTENING_OUTOF_MAXRETRIES",e[e.WEBIM_CONNCTION_RECEIVEMSG_CONTENTERROR=15]="WEBIM_CONNCTION_RECEIVEMSG_CONTENTERROR",e[e.WEBIM_CONNCTION_DISCONNECTED=16]="WEBIM_CONNCTION_DISCONNECTED",e[e.WEBIM_CONNCTION_AJAX_ERROR=17]="WEBIM_CONNCTION_AJAX_ERROR",e[e.WEBIM_CONNCTION_JOINROOM_ERROR=18]="WEBIM_CONNCTION_JOINROOM_ERROR",e[e.WEBIM_CONNCTION_GETROOM_ERROR=19]="WEBIM_CONNCTION_GETROOM_ERROR",e[e.WEBIM_CONNCTION_GETROOMINFO_ERROR=20]="WEBIM_CONNCTION_GETROOMINFO_ERROR",e[e.WEBIM_CONNCTION_GETROOMMEMBER_ERROR=21]="WEBIM_CONNCTION_GETROOMMEMBER_ERROR",e[e.WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR=22]="WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR",e[e.WEBIM_CONNCTION_LOAD_CHATROOM_ERROR=23]="WEBIM_CONNCTION_LOAD_CHATROOM_ERROR",e[e.WEBIM_CONNCTION_NOT_SUPPORT_CHATROOM_ERROR=24]="WEBIM_CONNCTION_NOT_SUPPORT_CHATROOM_ERROR",e[e.WEBIM_CONNCTION_JOINCHATROOM_ERROR=25]="WEBIM_CONNCTION_JOINCHATROOM_ERROR",e[e.WEBIM_CONNCTION_QUITCHATROOM_ERROR=26]="WEBIM_CONNCTION_QUITCHATROOM_ERROR",e[e.WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR=27]="WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR=28]="WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_SESSIONID_NOT_ASSIGN_ERROR=29]="WEBIM_CONNCTION_SESSIONID_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_RID_NOT_ASSIGN_ERROR=30]="WEBIM_CONNCTION_RID_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_CALLBACK_INNER_ERROR=31]="WEBIM_CONNCTION_CALLBACK_INNER_ERROR",e[e.WEBIM_CONNCTION_CLIENT_OFFLINE=32]="WEBIM_CONNCTION_CLIENT_OFFLINE",e[e.WEBIM_CONNCTION_CLIENT_LOGOUT=33]="WEBIM_CONNCTION_CLIENT_LOGOUT",e[e.WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR=34]="WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR",e[e.WEBIM_CONNECTION_ACCEPT_INVITATION_FROM_GROUP=35]="WEBIM_CONNECTION_ACCEPT_INVITATION_FROM_GROUP",e[e.WEBIM_CONNECTION_DECLINE_INVITATION_FROM_GROUP=36]="WEBIM_CONNECTION_DECLINE_INVITATION_FROM_GROUP",e[e.WEBIM_CONNECTION_ACCEPT_JOIN_GROUP=37]="WEBIM_CONNECTION_ACCEPT_JOIN_GROUP",e[e.WEBIM_CONNECTION_DECLINE_JOIN_GROUP=38]="WEBIM_CONNECTION_DECLINE_JOIN_GROUP",e[e.WEBIM_CONNECTION_CLOSED=39]="WEBIM_CONNECTION_CLOSED",e[e.WEBIM_CONNECTION_ERROR=40]="WEBIM_CONNECTION_ERROR",e[e.MAX_LIMIT=50]="MAX_LIMIT",e[e.MESSAGE_NOT_FOUND=51]="MESSAGE_NOT_FOUND",e[e.NO_PERMISSION=52]="NO_PERMISSION",e[e.OPERATION_UNSUPPORTED=53]="OPERATION_UNSUPPORTED",e[e.OPERATION_NOT_ALLOWED=54]="OPERATION_NOT_ALLOWED",e[e.WEBIM_TOKEN_EXPIRED=56]="WEBIM_TOKEN_EXPIRED",e[e.WEBIM_SERVER_SERVING_DISABLED=57]="WEBIM_SERVER_SERVING_DISABLED",e[e.WEBIM_UPLOADFILE_BROWSER_ERROR=100]="WEBIM_UPLOADFILE_BROWSER_ERROR",e[e.WEBIM_UPLOADFILE_ERROR=101]="WEBIM_UPLOADFILE_ERROR",e[e.WEBIM_UPLOADFILE_NO_LOGIN=102]="WEBIM_UPLOADFILE_NO_LOGIN",e[e.WEBIM_UPLOADFILE_NO_FILE=103]="WEBIM_UPLOADFILE_NO_FILE",e[e.WEBIM_DOWNLOADFILE_ERROR=200]="WEBIM_DOWNLOADFILE_ERROR",e[e.WEBIM_DOWNLOADFILE_NO_LOGIN=201]="WEBIM_DOWNLOADFILE_NO_LOGIN",e[e.WEBIM_DOWNLOADFILE_BROWSER_ERROR=202]="WEBIM_DOWNLOADFILE_BROWSER_ERROR",e[e.PARSE_FILE_ERROR=203]="PARSE_FILE_ERROR",e[e.USER_NOT_FOUND=204]="USER_NOT_FOUND",e[e.MESSAGE_PARAMETER_ERROR=205]="MESSAGE_PARAMETER_ERROR",e[e.WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE=206]="WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE",e[e.WEBIM_CONNCTION_USER_REMOVED=207]="WEBIM_CONNCTION_USER_REMOVED",e[e.WEBIM_USER_ALREADY_LOGIN=208]="WEBIM_USER_ALREADY_LOGIN",e[e.USER_LOGIN_TOO_MANY_DEVICES=214]="USER_LOGIN_TOO_MANY_DEVICES",e[e.WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD=216]="WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD",e[e.WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE=217]="WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE",e[e.USER_MUTED_BY_ADMIN=219]="USER_MUTED_BY_ADMIN",e[e.USER_DEVICE_CHANGED=220]="USER_DEVICE_CHANGED",e[e.USER_NOT_FRIEND=221]="USER_NOT_FRIEND",e[e.WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION=222]="WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION",e[e.WEBIM_DOWNLOADFILE_ERROR_EXPIRED=223]="WEBIM_DOWNLOADFILE_ERROR_EXPIRED",e[e.WEBIM_MESSAGE_REC_TEXT=300]="WEBIM_MESSAGE_REC_TEXT",e[e.WEBIM_MESSAGE_REC_TEXT_ERROR=301]="WEBIM_MESSAGE_REC_TEXT_ERROR",e[e.WEBIM_MESSAGE_REC_EMOTION=302]="WEBIM_MESSAGE_REC_EMOTION",e[e.WEBIM_MESSAGE_REC_PHOTO=303]="WEBIM_MESSAGE_REC_PHOTO",e[e.SERVER_GET_DNSLIST_FAILED=304]="SERVER_GET_DNSLIST_FAILED",e[e.WEBIM_MESSAGE_REC_AUDIO_FILE=305]="WEBIM_MESSAGE_REC_AUDIO_FILE",e[e.WEBIM_MESSAGE_REC_VEDIO=306]="WEBIM_MESSAGE_REC_VEDIO",e[e.WEBIM_MESSAGE_REC_VEDIO_FILE=307]="WEBIM_MESSAGE_REC_VEDIO_FILE",e[e.WEBIM_MESSAGE_REC_FILE=308]="WEBIM_MESSAGE_REC_FILE",e[e.WEBIM_MESSAGE_SED_TEXT=309]="WEBIM_MESSAGE_SED_TEXT",e[e.WEBIM_MESSAGE_SED_EMOTION=310]="WEBIM_MESSAGE_SED_EMOTION",e[e.WEBIM_MESSAGE_SED_PHOTO=311]="WEBIM_MESSAGE_SED_PHOTO",e[e.WEBIM_MESSAGE_SED_AUDIO=312]="WEBIM_MESSAGE_SED_AUDIO",e[e.WEBIM_MESSAGE_SED_AUDIO_FILE=313]="WEBIM_MESSAGE_SED_AUDIO_FILE",e[e.WEBIM_MESSAGE_SED_VEDIO=314]="WEBIM_MESSAGE_SED_VEDIO",e[e.WEBIM_MESSAGE_SED_VEDIO_FILE=315]="WEBIM_MESSAGE_SED_VEDIO_FILE",e[e.WEBIM_MESSAGE_SED_FILE=316]="WEBIM_MESSAGE_SED_FILE",e[e.WEBIM_MESSAGE_SED_ERROR=317]="WEBIM_MESSAGE_SED_ERROR",e[e.STATUS_INIT=400]="STATUS_INIT",e[e.STATUS_DOLOGIN_USERGRID=401]="STATUS_DOLOGIN_USERGRID",e[e.STATUS_DOLOGIN_IM=402]="STATUS_DOLOGIN_IM",e[e.STATUS_OPENED=403]="STATUS_OPENED",e[e.STATUS_CLOSING=404]="STATUS_CLOSING",e[e.STATUS_CLOSED=405]="STATUS_CLOSED",e[e.STATUS_ERROR=406]="STATUS_ERROR",e[e.FILE_INVALID=407]="FILE_INVALID",e[e.FILE_DURATION_TOO_LONG=408]="FILE_DURATION_TOO_LONG",e[e.FILE_VOICE_TO_TEXT_FAILED=409]="FILE_VOICE_TO_TEXT_FAILED",e[e.FILE_NOT_FOUND=410]="FILE_NOT_FOUND",e[e.FILE_TOO_LARGE=411]="FILE_TOO_LARGE",e[e.SERVER_BUSY=500]="SERVER_BUSY",e[e.MESSAGE_INCLUDE_ILLEGAL_CONTENT=501]="MESSAGE_INCLUDE_ILLEGAL_CONTENT",e[e.MESSAGE_EXTERNAL_LOGIC_BLOCKED=502]="MESSAGE_EXTERNAL_LOGIC_BLOCKED",e[e.SERVER_UNKNOWN_ERROR=503]="SERVER_UNKNOWN_ERROR",e[e.MESSAGE_RECALL_TIME_LIMIT=504]="MESSAGE_RECALL_TIME_LIMIT",e[e.SERVICE_NOT_ENABLED=505]="SERVICE_NOT_ENABLED",e[e.SERVICE_NOT_ALLOW_MESSAGING=506]="SERVICE_NOT_ALLOW_MESSAGING",e[e.SERVICE_NOT_ALLOW_MESSAGING_MUTE=507]="SERVICE_NOT_ALLOW_MESSAGING_MUTE",e[e.MESSAGE_MODERATION_BLOCKED=508]="MESSAGE_MODERATION_BLOCKED",e[e.MESSAGE_CURRENT_LIMITING=509]="MESSAGE_CURRENT_LIMITING",e[e.MESSAGE_WEBSOCKET_DISCONNECTED=510]="MESSAGE_WEBSOCKET_DISCONNECTED",e[e.MESSAGE_SIZE_LIMIT=511]="MESSAGE_SIZE_LIMIT",e[e.MESSAGE_SEND_TIMEOUT=512]="MESSAGE_SEND_TIMEOUT",e[e.MESSAGE_STREAM_INTERVAL_TIMEOUT=513]="MESSAGE_STREAM_INTERVAL_TIMEOUT",e[e.MESSAGE_STREAM_TIMEOUT=514]="MESSAGE_STREAM_TIMEOUT",e[e.GROUP_NOT_EXIST=605]="GROUP_NOT_EXIST",e[e.GROUP_NOT_JOINED=602]="GROUP_NOT_JOINED",e[e.GROUP_MEMBERS_FULL=606]="GROUP_MEMBERS_FULL",e[e.PERMISSION_DENIED=603]="PERMISSION_DENIED",e[e.WEBIM_LOAD_MSG_ERROR=604]="WEBIM_LOAD_MSG_ERROR",e[e.GROUP_ALREADY_JOINED=601]="GROUP_ALREADY_JOINED",e[e.GROUP_MEMBERS_LIMIT=607]="GROUP_MEMBERS_LIMIT",e[e.GROUP_IS_DISABLED=608]="GROUP_IS_DISABLED",e[e.GROUP_MEMBER_ATTRIBUTES_SET_FAILED=609]="GROUP_MEMBER_ATTRIBUTES_SET_FAILED",e[e.REST_PARAMS_STATUS=700]="REST_PARAMS_STATUS",e[e.CHATROOM_NOT_JOINED=702]="CHATROOM_NOT_JOINED",e[e.CHATROOM_MEMBERS_FULL=704]="CHATROOM_MEMBERS_FULL",e[e.CHATROOM_NOT_EXIST=705]="CHATROOM_NOT_EXIST",e[e.LOCAL_DB_OPERATION_FAILED=800]="LOCAL_DB_OPERATION_FAILED",e[e.SDK_RUNTIME_ERROR=999]="SDK_RUNTIME_ERROR",e[e.PRESENCE_PARAM_EXCEED=1100]="PRESENCE_PARAM_EXCEED",e[e.REACTION_ALREADY_ADDED=1101]="REACTION_ALREADY_ADDED",e[e.REACTION_CREATING=1102]="REACTION_CREATING",e[e.REACTION_OPERATION_IS_ILLEGAL=1103]="REACTION_OPERATION_IS_ILLEGAL",e[e.TRANSLATION_NOT_VALID=1200]="TRANSLATION_NOT_VALID",e[e.TRANSLATION_TEXT_TOO_LONG=1201]="TRANSLATION_TEXT_TOO_LONG",e[e.TRANSLATION_FAILED=1204]="TRANSLATION_FAILED",e[e.THREAD_NOT_EXIST=1300]="THREAD_NOT_EXIST",e[e.THREAD_ALREADY_EXIST=1301]="THREAD_ALREADY_EXIST",e[e.MODIFY_MESSAGE_NOT_EXIST=1302]="MODIFY_MESSAGE_NOT_EXIST",e[e.MODIFY_MESSAGE_FORMAT_ERROR=1303]="MODIFY_MESSAGE_FORMAT_ERROR",e[e.MODIFY_MESSAGE_FAILED=1304]="MODIFY_MESSAGE_FAILED",e[e.CONVERSATION_NOT_EXIST=1400]="CONVERSATION_NOT_EXIST"}(d||(d={}));var g,v,E,y,_,T,I,O=function(){return O=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},O.apply(this,arguments)},R=function(e,t,r,n){var o,i,a,s,c,u,l,h,p,f,m,g,v,E,y,_,T,I,R,C,S,N,b,A,M,w,U,L,P,D,k,x=e.response;x&&"string"==typeof x&&(x=JSON.parse(x));var B=e.status,G={elapse:n,httpCode:B,errDesc:null==x?void 0:x.error_description};if(400===B){if(4000005===x.error_code||4000006===x.error_code)return void t({type:d.REQUEST_PARAMETER_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});if(40002===x.error_code)return void t({type:d.THREAD_ALREADY_EXIST,message:null==x?void 0:x.error_description,extraInfo:G});if(40009===x.error_code)return void t({type:d.OPERATION_UNSUPPORTED,message:null==x?void 0:x.error_description,extraInfo:G});if(60005===x.error_code)return void t({type:d.GROUP_MEMBER_ATTRIBUTES_SET_FAILED,message:(null==x?void 0:x.desc)||(null==x?void 0:x.error_description),extraInfo:G});if(60010===x.error_code)return void((null===(o=null==x?void 0:x.error_description)||void 0===o?void 0:o.includes("exceeds chatgroup user metadata single value limit"))?t({type:d.MAX_LIMIT,message:(null==x?void 0:x.desc)||x.error_description,extraInfo:G}):t({type:d.NO_PERMISSION,message:(null==x?void 0:x.desc)||x.error_description,extraInfo:G}));if(60011===x.error_code)return void t({type:d.CHATROOM_NOT_JOINED,message:null==x?void 0:x.desc,extraInfo:G});if(14403===x.error_code)return void t({type:d.WEBIM_UPLOADFILE_ERROR,message:null==x?void 0:x.error_description,data:x,extraInfo:G});if(60006===x.error_code||60007===x.error_code||60009===x.error_code||60012===x.error_code)return void t({type:d.MAX_LIMIT,message:(null==x?void 0:x.desc)||(null==x?void 0:x.error_description),extraInfo:G});if(91104===x.error_code)return void t({type:d.NO_PERMISSION,message:null==x?void 0:x.error_description,extraInfo:G});if(null===(i=x.error_description)||void 0===i?void 0:i.includes("are not members of this group"))return(null===(a=e.responseURL)||void 0===a?void 0:a.includes("chatgroups"))?t({type:d.GROUP_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.CHATROOM_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}),void r({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:null==x?void 0:x.error_description,data:e.responseText,extraInfo:G});if("the app not open presence"===(null==x?void 0:x.result))return void t({type:d.SERVICE_NOT_ENABLED,message:null==x?void 0:x.result,extraInfo:G});if(null===(s=null==x?void 0:x.error_description)||void 0===s?void 0:s.includes("remark length must less"))return void t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G});switch(null==x?void 0:x.error_description){case"the user is already operation this message":t({type:d.REACTION_ALREADY_ADDED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The quantity has exceeded the limit!":t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The user not in this group!":t({type:d.GROUP_NOT_JOINED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"the user operation is illegal!":t({type:d.REACTION_OPERATION_IS_ILLEGAL,message:null==x?void 0:x.error_description,extraInfo:G});break;case"this appKey is not open reaction service!":case"this appKey not open message roaming":t({type:d.SERVICE_NOT_ENABLED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"this message is creating reaction, please try again.":t({type:d.REACTION_CREATING,message:null==x?void 0:x.error_description,extraInfo:G});break;case"groupId can not be null!":t({type:d.GROUP_NOT_EXIST,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The input text is too long.":t({type:d.TRANSLATION_TEXT_TOO_LONG,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The target language is not valid.":t({type:d.TRANSLATION_NOT_VALID,message:null==x?void 0:x.error_description,extraInfo:G});break;case"report failed, get message by id failed":t({type:d.MESSAGE_NOT_FOUND,message:null==x?void 0:x.error_description,extraInfo:G});break;case"ext is too big ":t({type:d.PRESENCE_PARAM_EXCEED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"Request body not readable.Please check content type is correct!":case"param mark must be not empty, please check!":case"param mark illegal, please check it!":case"param pin_msg_id illegal, please check it!":t({type:d.REQUEST_PARAMETER_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});break;case"updateRemark | they are not friends, please add as a friend first.":t({type:d.USER_NOT_FRIEND,message:null==x?void 0:x.error_description,extraInfo:G});break;default:t({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:null==x?void 0:x.error_description,data:e.responseText,extraInfo:G}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:null==x?void 0:x.error_description,data:e.responseText,extraInfo:G})}}else if(401===B)4010101===x.error_code?t({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G}):40001===x.error_code||60001===x.error_code||"Unable to authenticate (OAuth)"===x.error_description?t({type:d.NO_PERMISSION,message:null==x?void 0:x.error_description,extraInfo:G}):(r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:G}),t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:G}));else if(403===B)(null===(c=e.responseURL)||void 0===c?void 0:c.includes("/chatgroups/"))&&(null===(u=e.responseURL)||void 0===u?void 0:u.includes("/invite"))&&(null===(l=x.error_description)||void 0===l?void 0:l.includes("doesn't exist"))?t({type:d.USER_NOT_FOUND,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):4e4===x.error_code||60004===x.error_code||15002===x.error_code||4030204===x.error_code?t({type:d.SERVICE_NOT_ENABLED,message:null==x?void 0:x.error_description,extraInfo:G}):40003===x.error_code||40004===x.error_code?t({type:d.THREAD_ALREADY_EXIST,message:null==x?void 0:x.error_description,extraInfo:G}):40005===x.error_code||40007===x.error_code||91002===x.error_code?t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G}):60002===x.error_code?t({type:d.PERMISSION_DENIED,message:null==x?void 0:x.error_description,extraInfo:G}):91101===x.error_code?t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G}):91102===x.error_code&&t({type:d.REQUEST_PARAMETER_ERROR,message:x.error_description,extraInfo:G}),"group member list is full!"===x.error_description?(null===(h=e.responseURL)||void 0===h?void 0:h.includes("chatgroups"))?t({type:d.GROUP_MEMBERS_FULL,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.CHATROOM_MEMBERS_FULL,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(p=x.error_description)||void 0===p?void 0:p.includes("invite users to join group failed"))&&(null===(f=x.error_description)||void 0===f?void 0:f.includes("already in group"))?(null===(m=e.responseURL)||void 0===m?void 0:m.includes("chatgroups"))&&t({type:d.GROUP_ALREADY_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(g=x.error_description)||void 0===g?void 0:g.includes("are not members of this group"))?(null===(v=e.responseURL)||void 0===v?void 0:v.includes("chatgroups"))?t({type:d.GROUP_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.CHATROOM_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(E=x.error_description)||void 0===E?void 0:E.includes("service not open!"))||(null===(y=x.error_description)||void 0===y?void 0:y.includes("message report not open"))||(null===(_=x.error_description)||void 0===_?void 0:_.includes("messageroaming function not open"))?t({type:d.SERVICE_NOT_ENABLED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(T=x.error_description)||void 0===T?void 0:T.includes("members size is greater than max user size !"))?t({type:d.GROUP_MEMBERS_LIMIT,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(I=x.error_description)||void 0===I?void 0:I.includes("can not operate this group, reason: group is disabled"))?t({type:d.GROUP_IS_DISABLED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(R=x.error_description)||void 0===R?void 0:R.includes("Invitee's contact max count"))||(null===(C=x.error_description)||void 0===C?void 0:C.includes("Inviter's contact max count"))?t({type:d.MAX_LIMIT,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.PERMISSION_DENIED,data:e.response||e.responseText,message:"permission denied",extraInfo:O(O({},G),{errDesc:"permission denied"})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:G});else if(404===B){if(4040302===x.error_code)return void t({type:d.WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});40011===x.error_code?t({type:d.THREAD_NOT_EXIST,message:null==x?void 0:x.error_description,extraInfo:G}):40012===x.error_code?t({type:d.NO_PERMISSION,message:null==x?void 0:x.error_description,extraInfo:G}):60003===x.error_code||20004===x.error_code?t({type:d.GROUP_NOT_JOINED,message:null==x?void 0:x.error_description,extraInfo:G}):91001===x.error_code&&t({type:d.CONVERSATION_NOT_EXIST,message:null==x?void 0:x.error_description,extraInfo:G}),(null===(S=x.error_description)||void 0===S?void 0:S.includes("do not find this group"))||(null===(N=x.error_description)||void 0===N?void 0:N.includes("does not exist"))?(null===(b=e.responseURL)||void 0===b?void 0:b.includes("chatgroups"))?t({type:d.GROUP_NOT_EXIST,data:e.response||e.responseText,message:"The chat room dose not exist.",extraInfo:O(O({},G),{errDesc:"The chat room dose not exist."})}):t({type:d.CHATROOM_NOT_EXIST,data:e.response||e.responseText,message:"The chat room dose not exist.",extraInfo:O(O({},G),{errDesc:"The chat room dose not exist."})}):(null===(A=x.error_description)||void 0===A?void 0:A.includes("username"))&&(null===(M=x.error_description)||void 0===M?void 0:M.includes("doesn't exist!'"))||(null===(w=x.error_description)||void 0===w?void 0:w.includes("user not found"))||(null===(U=x.error_description)||void 0===U?void 0:U.includes("Service resource not found"))&&"UserNotFoundException"===(null==x?void 0:x.exception)?t({type:d.USER_NOT_FOUND,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(L=x.error_description)||void 0===L?void 0:L.includes("user session pin message not exist"))?t({type:d.MESSAGE_NOT_FOUND,message:x.error_description,extraInfo:G}):t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.response||e.responseText,message:e.responseText,extraInfo:G}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.response||e.responseText,message:e.responseText,extraInfo:G})}else if(406===B)90004===x.error_code&&t({type:d.OPERATION_NOT_ALLOWED,message:null==x?void 0:x.error_description,extraInfo:G});else if(429===B||503===B){if(null===(P=x.error_description)||void 0===P?void 0:P.includes("The request has reached the maximum limit"))return void t({type:d.MAX_LIMIT,message:e.responseText,extraInfo:G});if(null===(D=x.error_description)||void 0===D?void 0:D.includes("upload client logs reached limit"))return void t({type:d.MAX_LIMIT,message:e.responseText});t({type:d.SERVER_BUSY,data:e.response||e.responseText,message:"Server is busy.",extraInfo:O(O({},G),{errDesc:"Server is busy."})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:"Server is busy.",extraInfo:O(O({},G),{errDesc:"Server is busy."})})}else if(500===B){if(40006===x.error_code||40008===x.error_code||40010===x.error_code||5000701===x.error_code)return void t({type:d.SERVER_UNKNOWN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});if(90005===x.error_code||99999===x.error_code)return void t({type:d.REQUEST_UNKNOWN,message:null==x?void 0:x.error_description,extraInfo:G});if(null===(k=x.error_description)||void 0===k?void 0:k.includes("translte failed!"))return void t({type:d.TRANSLATION_FAILED,message:e.responseText,extraInfo:G});t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:"",extraInfo:G}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:"",extraInfo:G})}else if(502===B){if(5020801===x.error_code)return void t({type:d.SERVER_UNKNOWN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})})}else t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})})};!function(e){e[e.UNKNOWOPERATION=-1]="UNKNOWOPERATION",e[e.REST_GET_SESSION_LIST=1]="REST_GET_SESSION_LIST",e[e.REST_DEL_SESSION=2]="REST_DEL_SESSION",e[e.REST_GET_HISTORY_MESSAGE=3]="REST_GET_HISTORY_MESSAGE",e[e.REST_PIN_CONVERSATION=4]="REST_PIN_CONVERSATION",e[e.REST_MARK_CONVERSATION=5]="REST_MARK_CONVERSATION",e[e.REST_UPLOAD_FILE_IN_PARTS=6]="REST_UPLOAD_FILE_IN_PARTS",e[e.REST_DELETE_MESSAGES_CONVERSATIONS=7]="REST_DELETE_MESSAGES_CONVERSATIONS",e[e.REST_PIN_MESSAGE=8]="REST_PIN_MESSAGE",e[e.REST_FETCH_PINMESSAGES=9]="REST_FETCH_PINMESSAGES",e[e.REST_FETCH_CONVERSATIONS=10]="REST_FETCH_CONVERSATIONS",e[e.REST_OPERATE=100]="REST_OPERATE",e[e.MSYNC_SENDMESSAGE=101]="MSYNC_SENDMESSAGE",e[e.MSYNC_RECALLMESSAGE=102]="MSYNC_RECALLMESSAGE",e[e.MSYNC_MODIFYMESSAGE=103]="MSYNC_MODIFYMESSAGE",e[e.MSYNC_OPERATE=200]="MSYNC_OPERATE",e[e.ROSTER_ADD=201]="ROSTER_ADD",e[e.ROSTER_REMOVE=202]="ROSTER_REMOVE",e[e.ROSTER_ACCEPT=203]="ROSTER_ACCEPT",e[e.ROSTER_DECLINE=204]="ROSTER_DECLINE",e[e.ROSTER_BAN=205]="ROSTER_BAN",e[e.ROSTER_ALLOW=206]="ROSTER_ALLOW",e[e.ROSTER_BLACKLIST=207]="ROSTER_BLACKLIST",e[e.ROSTER_CONTACTS=208]="ROSTER_CONTACTS",e[e.ROSTER_GET_ALL_CONTACTS_REMARKS=209]="ROSTER_GET_ALL_CONTACTS_REMARKS",e[e.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE=210]="ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE",e[e.ROSTER_SET_CONTACT_REMARK=211]="ROSTER_SET_CONTACT_REMARK",e[e.ROSTER_OPERATE=300]="ROSTER_OPERATE",e[e.USER_LOGIN=301]="USER_LOGIN",e[e.USER_CREATE=302]="USER_CREATE",e[e.USER_UPDATE_USERINFO=303]="USER_UPDATE_USERINFO",e[e.USER_FETCH_USERINFO=304]="USER_FETCH_USERINFO",e[e.USER_UPDATE_NICK=305]="USER_UPDATE_NICK",e[e.USER_UPLOAD_PUSH_TOKEN=306]="USER_UPLOAD_PUSH_TOKEN",e[e.USER_LOGGEDIN_OTHER_PLATFORM=307]="USER_LOGGEDIN_OTHER_PLATFORM",e[e.USER_OPERATE=400]="USER_OPERATE",e[e.GROUP_CREATEGROUP=401]="GROUP_CREATEGROUP",e[e.GROUP_BLOCK_MESSAGE=402]="GROUP_BLOCK_MESSAGE",e[e.GROUP_FETCH_PUBLICGROUPS_WITHCURSOR=403]="GROUP_FETCH_PUBLICGROUPS_WITHCURSOR",e[e.GROUP_FETCH_USERS_GROUP=404]="GROUP_FETCH_USERS_GROUP",e[e.GROUP_CHANGE_OWNER=405]="GROUP_CHANGE_OWNER",e[e.GROUP_FETCH_SPECIFICATION=406]="GROUP_FETCH_SPECIFICATION",e[e.GROUP_CHANGE_GROUPATTRIBUTE=407]="GROUP_CHANGE_GROUPATTRIBUTE",e[e.GROUP_FETCH_MEMEBERS=408]="GROUP_FETCH_MEMEBERS",e[e.GROUP_GET_ADMIN=409]="GROUP_GET_ADMIN",e[e.GROUP_SET_ADMIN=410]="GROUP_SET_ADMIN",e[e.GROUP_REMOVE_ADMIN=411]="GROUP_REMOVE_ADMIN",e[e.GROUP_DESTOTYGROUP=412]="GROUP_DESTOTYGROUP",e[e.GROUP_LEAVEGROUP=413]="GROUP_LEAVEGROUP",e[e.GROUP_INVITE_TO_GROUP=414]="GROUP_INVITE_TO_GROUP",e[e.GROUP_JOIN_PUBLICGROUP=415]="GROUP_JOIN_PUBLICGROUP",e[e.GROUP_ACCEPT_JOINPUBLICGROUPAPPL=416]="GROUP_ACCEPT_JOINPUBLICGROUPAPPL",e[e.GROUP_DECLINE_JOINPUBLICGROUPAPPL=417]="GROUP_DECLINE_JOINPUBLICGROUPAPPL",e[e.GROUP_ACCEPT_INVITATION=418]="GROUP_ACCEPT_INVITATION",e[e.GROUP_DECLINE_INVITATION=419]="GROUP_DECLINE_INVITATION",e[e.GROUP_REMOVE_MEMBER=420]="GROUP_REMOVE_MEMBER",e[e.GROUP_REMOVE_MEMBERS=421]="GROUP_REMOVE_MEMBERS",e[e.GROUP_MUTE_MEMBERS=422]="GROUP_MUTE_MEMBERS",e[e.GROUP_UNMUTE_MEMBERS=423]="GROUP_UNMUTE_MEMBERS",e[e.GROUP_FETCH_MUTES=424]="GROUP_FETCH_MUTES",e[e.GROUP_BLOCK_MEMBER=425]="GROUP_BLOCK_MEMBER",e[e.GROUP_BLOCK_MEMBERS=426]="GROUP_BLOCK_MEMBERS",e[e.GROUP_UNBLOCK_MEMBER=427]="GROUP_UNBLOCK_MEMBER",e[e.GROUP_UNBLOCK_MEMBERS=428]="GROUP_UNBLOCK_MEMBERS",e[e.GROUP_GET_BLOCK_LIST=429]="GROUP_GET_BLOCK_LIST",e[e.GROUP_MUTE_ALLMEMBERS=430]="GROUP_MUTE_ALLMEMBERS",e[e.GROUP_UNMUTE_ALLMEMBERS=431]="GROUP_UNMUTE_ALLMEMBERS",e[e.GROUP_ADD_WHITELIST=432]="GROUP_ADD_WHITELIST",e[e.GROUP_REMOVE_WHITELIST=433]="GROUP_REMOVE_WHITELIST",e[e.GROUP_FETCH_WHITELIST=434]="GROUP_FETCH_WHITELIST",e[e.GROUP_IS_IN_WHITELIST=435]="GROUP_IS_IN_WHITELIST",e[e.GROUP_GET_READ_USERS=436]="GROUP_GET_READ_USERS",e[e.GROUP_FETCH_ANNOUNCEMENT=437]="GROUP_FETCH_ANNOUNCEMENT",e[e.GROUP_UPDATE_ANNOUNCEMENT=438]="GROUP_UPDATE_ANNOUNCEMENT",e[e.GROUP_UPLOAD_SHAREDFILE=439]="GROUP_UPLOAD_SHAREDFILE",e[e.GROUP_DELETE_SHAREDFILE=440]="GROUP_DELETE_SHAREDFILE",e[e.GROUP_FETCH_SHAREDFILE=441]="GROUP_FETCH_SHAREDFILE",e[e.GROUP_DOWNLOAD_SHAREDFILE=442]="GROUP_DOWNLOAD_SHAREDFILE",e[e.GROUP_MEMBER_SET_META_DATA=443]="GROUP_MEMBER_SET_META_DATA",e[e.GROUP_MEMBER_FETCH_META_DATA=444]="GROUP_MEMBER_FETCH_META_DATA",e[e.GROUP_OPERATE=500]="GROUP_OPERATE",e[e.CHATROOM_FETCH_CHATROOMSWITHPAGE=501]="CHATROOM_FETCH_CHATROOMSWITHPAGE",e[e.CHATROOM_CREATECHATROOM=502]="CHATROOM_CREATECHATROOM",e[e.CHATROOM_DESTORYCHATROOM=503]="CHATROOM_DESTORYCHATROOM",e[e.CHATROOM_FETCH_SPECIFICATION=504]="CHATROOM_FETCH_SPECIFICATION",e[e.CHATROOM_CHANGE_ATTRIBUTE=505]="CHATROOM_CHANGE_ATTRIBUTE",e[e.CHATROOM_REMOVE_MEMBER=506]="CHATROOM_REMOVE_MEMBER",e[e.CHATROOM_REMOVE_MEMBERS=507]="CHATROOM_REMOVE_MEMBERS",e[e.CHATROOM_ADD_MEMBERS=508]="CHATROOM_ADD_MEMBERS",e[e.CHATROOM_JOINCAHTROOM=509]="CHATROOM_JOINCAHTROOM",e[e.CHATROOM_LEAVECAHTROOM=510]="CHATROOM_LEAVECAHTROOM",e[e.CHATROOM_FETCH_MEMBERS=511]="CHATROOM_FETCH_MEMBERS",e[e.CHATROOM_GET_ADMIN=512]="CHATROOM_GET_ADMIN",e[e.CHATROOM_SET_ADMIN=513]="CHATROOM_SET_ADMIN",e[e.CHATROOM_REMOVE_ADMIN=514]="CHATROOM_REMOVE_ADMIN",e[e.CHATROOM_MUTE_USER=515]="CHATROOM_MUTE_USER",e[e.CHATROOM_UNMUTE_USER=516]="CHATROOM_UNMUTE_USER",e[e.CHATROOM_FETCH_MUTES=517]="CHATROOM_FETCH_MUTES",e[e.CHATROOM_BLOCK_USER=518]="CHATROOM_BLOCK_USER",e[e.CHATROOM_BLOCK_USERS=519]="CHATROOM_BLOCK_USERS",e[e.CHATROOM_UNBLOCK_USER=520]="CHATROOM_UNBLOCK_USER",e[e.CHATROOM_UNBLOCK_USERS=521]="CHATROOM_UNBLOCK_USERS",e[e.CHATROOM_FETCH_BANS=522]="CHATROOM_FETCH_BANS",e[e.CHATROOM_MUTE_ALLMEMEBERS=523]="CHATROOM_MUTE_ALLMEMEBERS",e[e.CHATROOM_UNMUTE_ALLMEMEBERS=524]="CHATROOM_UNMUTE_ALLMEMEBERS",e[e.CHATROOM_ADD_WHITELIST=525]="CHATROOM_ADD_WHITELIST",e[e.CHATROOM_REMOVE_WHITELIST=526]="CHATROOM_REMOVE_WHITELIST",e[e.CHATROOM_FETCH_WHITELIST=527]="CHATROOM_FETCH_WHITELIST",e[e.CHATROOM_FETCH_MEMBERIN_WHITELIST=528]="CHATROOM_FETCH_MEMBERIN_WHITELIST",e[e.CHATROOM_FETCH_ANNOUNCEMENT=529]="CHATROOM_FETCH_ANNOUNCEMENT",e[e.CHATROOM_UPDATE_ANNOUNCEMENT=530]="CHATROOM_UPDATE_ANNOUNCEMENT",e[e.CHATROOM_REMOVE_SHARE_FILE=531]="CHATROOM_REMOVE_SHARE_FILE",e[e.CHATROOM_GET_SHARE_FILE_LIST=532]="CHATROOM_GET_SHARE_FILE_LIST",e[e.CHATROOM_UPLOAD_FILE=533]="CHATROOM_UPLOAD_FILE",e[e.CHATROOM_SET_META_DATA=534]="CHATROOM_SET_META_DATA",e[e.CHATROOM_DELETE_META_DATA=535]="CHATROOM_DELETE_META_DATA",e[e.CHATROOM_FETCH_META_DATA=536]="CHATROOM_FETCH_META_DATA",e[e.CHATROOM_FETCH_USER_JOINED_CHATROOM=537]="CHATROOM_FETCH_USER_JOINED_CHATROOM",e[e.CHATROOM_OPERATE=600]="CHATROOM_OPERATE"}(g||(g={})),function(e){e.SDK_INTERNAL="SDK_INTERNAL",e.LOGIN="USER_LOGIN",e.REGISTER="USER_CREATE",e.GET_CHATROOM_LIST="CHATROOM_FETCH_CHATROOMSWITHPAGE",e.CREATE_CHATROOM="CHATROOM_CREATECHATROOM",e.DESTROY_CHATROOM="CHATROOM_DESTORYCHATROOM",e.GET_CHATROOM_DETAIL="CHATROOM_FETCH_SPECIFICATION",e.MODIFY_CHATROOM="CHATROOM_CHANGE_ATTRIBUTE",e.REMOVE_CHATROOM_MEMBER="CHATROOM_REMOVE_MEMBER",e.MULTI_REMOVE_CHATROOM_MEMBER="CHATROOM_REMOVE_MEMBERS",e.ADD_USERS_TO_CHATROOM="CHATROOM_ADD_MEMBERS",e.JOIN_CHATROOM="CHATROOM_JOINCAHTROOM",e.QUIT_CHATROOM="CHATROOM_LEAVECAHTROOM",e.LIST_CHATROOM_MEMBERS="CHATROOM_FETCH_MEMBERS",e.GET_CHATROOM_ADMIN="CHATROOM_GET_ADMIN",e.SET_CHATROOM_ADMIN="CHATROOM_SET_ADMIN",e.REMOVE_CHATROOM_ADMIN="CHATROOM_REMOVE_ADMIN",e.MUTE_CHATROOM_MEMBER="CHATROOM_MUTE_USER",e.REMOVE_MUTE_CHATROOM_MEMBER="CHATROOM_UNMUTE_USER",e.GET_MUTE_CHATROOM_MEMBERS="CHATROOM_FETCH_MUTES",e.SET_CHATROOM_MEMBER_TO_BLACK="CHATROOM_BLOCK_USER",e.MULTI_SET_CHATROOM_MEMBER_TO_BLACK="CHATROOM_BLOCK_USERS",e.REMOVE_CHATROOM_MEMBER_BLACK="CHATROOM_UNBLOCK_USER",e.MULTI_REMOVE_CHATROOM_MEMBER_BLACK="CHATROOM_UNBLOCK_USERS",e.GET_CHATROOM_BLOCK_MEMBERS="CHATROOM_FETCH_BANS",e.DISABLED_CHATROOM_SEND_MSG="CHATROOM_MUTE_ALLMEMEBERS",e.ENABLE_CHATROOM_SEND_MSG="CHATROOM_UNMUTE_ALLMEMEBERS",e.ADD_CHATROOM_WHITE_USERS="CHATROOM_ADD_WHITELIST",e.REMOVE_CHATROOM_WHITE_USERS="CHATROOM_REMOVE_WHITELIST",e.GET_CHATROOM_WHITE_USERS="CHATROOM_FETCH_WHITELIST",e.CHECK_CHATROOM_WHITE_USER="CHATROOM_FETCH_MEMBERIN_WHITELIST",e.GET_CHATROOM_ANN="CHATROOM_FETCH_ANNOUNCEMENT",e.UPDATE_CHATROOM_ANN="CHATROOM_UPDATE_ANNOUNCEMENT",e.DELETE_CHATROOM_FILE="CHATROOM_REMOVE_SHARE_FILE",e.GET_CHATROOM_FILES="CHATROOM_GET_SHARE_FILE_LIST",e.UPLOAD_CHATROOM_FILE="CHATROOM_UPLOAD_FILE",e.SET_CHATROOM_ATTR="CHATROOM_SET_META_DATA",e.DELETE_CHATROOM_ATTR="CHATROOM_DELETE_META_DATA",e.GET_CHATROOM_ATTR="CHATROOM_FETCH_META_DATA",e.GET_USER_JOINED_CHATROOM="CHATROOM_FETCH_USER_JOINED_CHATROOM",e.CREATE_GROUP="GROUP_CREATEGROUP",e.BLOCK_GROUP="GROUP_BLOCK_MESSAGE",e.LIST_GROUP="GROUP_FETCH_PUBLICGROUPS_WITHCURSOR",e.GET_USER_GROUP="GROUP_FETCH_USERS_GROUP",e.CHANGE_OWNER="GROUP_CHANGE_OWNER",e.GET_GROUP_INFO="GROUP_FETCH_SPECIFICATION",e.MODIFY_GROUP="GROUP_CHANGE_GROUPATTRIBUTE",e.LIST_GROUP_MEMBER="GROUP_FETCH_MEMEBERS",e.GET_GROUP_ADMIN="GROUP_GET_ADMIN",e.SET_GROUP_ADMIN="GROUP_SET_ADMIN",e.REMOVE_GROUP_ADMIN="GROUP_REMOVE_ADMIN",e.DISSOLVE_GROUP="GROUP_DESTOTYGROUP",e.QUIT_GROUP="GROUP_LEAVEGROUP",e.INVITE_TO_GROUP="GROUP_INVITE_TO_GROUP",e.JOIN_GROUP="GROUP_JOIN_PUBLICGROUP",e.AGREE_JOIN_GROUP="GROUP_ACCEPT_JOINPUBLICGROUPAPPL",e.REJECT_JOIN_GROUP="GROUP_DECLINE_JOINPUBLICGROUPAPPL",e.AGREE_INVITE_GROUP="GROUP_ACCEPT_INVITATION",e.REJECT_INVITE_GROUP="GROUP_DECLINE_INVITATION",e.REMOVE_GROUP_MEMBER="GROUP_REMOVE_MEMBER",e.MULTI_REMOVE_GROUP_MEMBER="GROUP_REMOVE_MEMBERS",e.MUTE_GROUP_MEMBER="GROUP_MUTE_MEMBERS",e.UNMUTE_GROUP_MEMBER="GROUP_UNMUTE_MEMBERS",e.GET_GROUP_MUTE_LIST="GROUP_FETCH_MUTES",e.BLOCK_GROUP_MEMBER="GROUP_BLOCK_MEMBER",e.BLOCK_GROUP_MEMBERS="GROUP_BLOCK_MEMBERS",e.UNBLOCK_GROUP_MEMBER="GROUP_UNBLOCK_MEMBER",e.UNBLOCK_GROUP_MEMBERS="GROUP_UNBLOCK_MEMBERS",e.GET_GROUP_BLACK_LIST="GROUP_GET_BLOCK_LIST",e.DISABLED_SEND_GROUP_MSG="GROUP_MUTE_ALLMEMBERS",e.ENABLE_SEND_GROUP_MSG="GROUP_UNMUTE_ALLMEMBERS",e.ADD_USERS_TO_GROUP_WHITE="GROUP_ADD_WHITELIST",e.REMOVE_GROUP_WHITE_MEMBER="GROUP_REMOVE_WHITELIST",e.GET_GROUP_WHITE_LIST="GROUP_FETCH_WHITELIST",e.IS_IN_GROUP_WHITE_LIST="GROUP_IS_IN_WHITELIST",e.GET_GROUP_MSG_READ_USER="GROUP_GET_READ_USERS",e.GET_GROUP_ANN="GROUP_FETCH_ANNOUNCEMENT",e.UPDATE_GROUP_ANN="GROUP_UPDATE_ANNOUNCEMENT",e.UPLOAD_GROUP_FILE="GROUP_UPLOAD_SHAREDFILE",e.DELETE_GROUP_FILE="GROUP_DELETE_SHAREDFILE",e.GET_GROUP_FILE_LIST="GROUP_FETCH_SHAREDFILE",e.DOWN_GROUP_FILE="GROUP_DOWNLOAD_SHAREDFILE",e.SET_GROUP_MEMBER_ATTRS="GROUP_MEMBER_SET_META_DATA",e.GET_GROUP_MEMBER_ATTR="GROUP_MEMBER_FETCH_META_DATA",e.GET_SESSION_LIST="REST_GET_SESSION_LIST",e.REST_FETCH_CONVERSATIONS="REST_FETCH_CONVERSATIONS",e.DELETE_SESSION="REST_DEL_SESSION",e.GET_HISTORY_MSG="REST_GET_HISTORY_MESSAGE",e.PIN_CONVERSATION="REST_PIN_CONVERSATION",e.REST_UPLOAD_FILE_IN_PARTS="REST_UPLOAD_FILE_IN_PARTS",e.REST_DELETE_MESSAGES_CONVERSATIONS="REST_DELETE_MESSAGES_CONVERSATIONS",e.MARK_CONVERSATION="REST_MARK_CONVERSATION",e.REST_FETCH_PINMESSAGES="REST_FETCH_PINMESSAGES",e.REST_PIN_MESSAGE="REST_PIN_MESSAGE",e.UPDATE_USER_INFO="USER_UPDATE_USERINFO",e.GET_USER_INFO="USER_FETCH_USERINFO",e.UPDATE_USER_NICK="USER_UPDATE_NICK",e.UPLOAD_PUSH_TOKEN="USER_UPLOAD_PUSH_TOKEN",e.USER_LOGGEDIN_OTHER_PLATFORM="USER_LOGGEDIN_OTHER_PLATFORM",e.GET_BLACK_LIST="ROSTER_BLACKLIST",e.GET_CONTACTS="ROSTER_CONTACTS",e.ROSTER_GET_ALL_CONTACTS_REMARKS="ROSTER_GET_ALL_CONTACTS_REMARKS",e.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE="ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE",e.ROSTER_SET_CONTACT_REMARK="ROSTER_SET_CONTACT_REMARK",e.ROSTER_ADD="ROSTER_ADD",e.ROSTER_REMOVE="ROSTER_REMOVE",e.ROSTER_ACCEPT="ROSTER_ACCEPT",e.ROSTER_DECLINE="ROSTER_DECLINE",e.ROSTER_BAN="ROSTER_BAN",e.ROSTER_ALLOW="ROSTER_ALLOW",e.SEND_MSG="MSYNC_SENDMESSAGE",e.UPLOAD_MSG_ATTACH="UPLOAD_MSG_ATTACH",e.SEND_RECALL_MSG="MSYNC_RECALLMESSAGE",e.MODIFY_MESSAGE="MSYNC_MODIFYMESSAGE",e.REST_FETCHHISTORYMESSAGE="REST_FETCHHISTORYMESSAGE",e.REST_SEARCH_MESSAGES="REST_SEARCH_MESSAGES",e.MSYNC_SYNCOFFLINEMESSAGE="MSYNC_SYNCOFFLINEMESSAGE"}(v||(v={})),function(e){e.GET_DNS="REST_DNSLIST",e.LOGIN_BY_AGORA_TOKEN="LOGIN_BY_AGORA_TOKEN",e.LOGIN_BY_PWD="LOGIN_BY_PWD",e.RESISTER="REGISTER",e.REST_INIT_UPLOAD_TASK_IN_PARTS="REST_INIT_UPLOAD_TASK_IN_PARTS",e.REST_UPLOAD_PART="REST_UPLOAD_PART",e.REST_COMPLETE_UPLOAD_PART="REST_COMPLETE_UPLOAD_PART",e.REST_ABORT_UPLOAD_PART="REST_ABORT_UPLOAD_PART",e.CONNECT_WEBSOCKET="CONNECT_WEBSOCKET"}(E||(E={})),function(e){e[e["5G"]=7]="5G",e[e["4G"]=7]="4G",e[e["3G"]=7]="3G",e[e["2G"]=7]="2G",e[e["SLOW-2G"]=7]="SLOW-2G",e[e.WIFI=2]="WIFI",e[e.LAN=1]="LAN",e[e.DISCONNECTED=0]="DISCONNECTED",e[e.NONE=0]="NONE",e[e.UNKNOWN=-1]="UNKNOWN",e[e["WEBIM UNABLE TO GET"]=-2]="WEBIM UNABLE TO GET"}(y||(y={})),function(e){e[e.success=200]="success",e[e.failed=500]="failed",e[e.disconnect=-1]="disconnect",e[e.closed=401]="closed",e[e.notFound=404]="notFound",e[e.reachLimit=429]="reachLimit"}(_||(_={})),function(e){e[e.web=0]="web",e[e.native=1]="native"}(T||(T={})),function(e){e[e.singleChat=0]="singleChat",e[e.groupChat=1]="groupChat",e[e.chatRoom=2]="chatRoom"}(I||(I={}));var C=new Map,S=new Map,N=1e3,b=9675,A=-1;function M(){console.log&&(console.log.apply?console.log.apply(console,Array.prototype.slice.call(arguments)):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}var w,U="undefined"!=typeof window&&void 0!==window.navigator&&/Trident\/|MSIE /.test(window.navigator.userAgent),L=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},P=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},D=function(){},k={};!function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(w||(w={}));var x=function(){function e(e,t,r){this.name=e||"defaultLogger",this.currentLevel=0,this.useCookiePersist=!1,this.storageLogLevelKey="loglevel",this.levels=w,this.consoleLogVisibility=!0,this.logMethods=["trace","debug","info","warn","error"],this.methodFactory=r||this.defaultMethodFactory,this.report=!1;var n=this._getPersistedLevel();null==n&&(n=null===t?"WARN":t),this.logs=[],this.reportLogs=[],this.reportInterval=3e5,this.timer=null,this.config={useCache:!1,maxCache:3145728,color:"",background:""},this.logBytes=0,this.setLevel(n,!1,"")}return e.prototype.reportLog=function(){var e,t,r;return L(this,void 0,void 0,(function(){var n,o,i,a,s,c,u,l;return P(this,(function(d){switch(d.label){case 0:if(0===(null===(e=this.reportLogs)||void 0===e?void 0:e.length))return[2];for(n=2097152,o=this.reportLogs.join("\n")+"\n",i=o.length,a=[];i>n;)a.push(o.substring(0,n)),i-=n,o=o.substring(n);a.push(o),s=0,c=a,d.label=1;case 1:if(!(s<c.length))return[3,8];if(u=c[s],this.reportLogs=[],!(null===(r=null===(t=this.connection)||void 0===t?void 0:t.context)||void 0===r?void 0:r.accessToken))return[2];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,this.reportData(u)];case 3:return"ok"!==(null==(l=d.sent())?void 0:l.status)&&this.reportLogs.unshift(u),[3,5];case 4:return d.sent(),this.reportLogs.unshift(u),[3,5];case 5:return[4,_e.delay(3e3)];case 6:d.sent(),d.label=7;case 7:return s++,[3,1];case 8:return[2]}}))}))},e.prototype.reportData=function(e){var t,r=this;if(this.connection){var n=this.connection.context||{},o=n.orgName,i=n.appName,a=n.accessToken,s=n.userId;if(o&&i){var c={url:"".concat(null===(t=this.connection)||void 0===t?void 0:t.apiUrl,"/").concat(o,"/").concat(i,"/sdk/users/").concat(s,"/client/logs"),type:"POST",data:JSON.stringify({resource:this.connection.clientResource||"random_".concat(Date.now()),logContent:e}),dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return ae.call(this.connection,c).then((function(e){return r.log("report log success",e),e})).catch((function(e){r.error("report log error",e)}))}}else this.error("report log error","connection is null")},e.prototype._regularlyReportLogs=function(){var e,t=this;this.timer&&clearInterval(this.timer),(null!==(e=this.reportInterval)&&void 0!==e?e:0)<6e4&&(this.reportInterval=6e4),this.timer=setInterval((function(){t.reportLog()}),this.reportInterval||3e5)},e.prototype._stopReportLogs=function(){return L(this,void 0,void 0,(function(){return P(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.reportLog()];case 1:return e.sent(),[3,3];case 2:return e.sent(),this.error("report log error when stopping upload"),[3,3];case 3:return this.reportLogs=[],clearInterval(this.timer),[2]}}))}))},e.prototype.setConfig=function(e){this.config=e},e.prototype.getLevel=function(){return this.currentLevel},e.prototype.setLevel=function(e,t,r){if("string"==typeof e&&(e=w[e]),void 0===e&&(e=0),!("number"==typeof e&&e>=0&&e<=this.levels.SILENT))throw Error("log.setLevel() called with invalid level: "+e);if(this.currentLevel=e,!1!==t&&this._persistLevel(e),this.replaceLoggingMethods(e,r||""),"undefined"==typeof console&&e<w.SILENT)throw Error("No console available for logging")},e.prototype.setDefaultLevel=function(e){this._getPersistedLevel()||this.setLevel(e,!1,"")},e.prototype.enableAll=function(e){this.setLevel(this.levels.TRACE,!0,"")},e.prototype.disableAll=function(e){this.setLevel(this.levels.SILENT,!0,"")},e.prototype.getLogs=function(){return this.logs},e.prototype.download=function(){if("undefined"!=typeof window&&"undefined"!=typeof document){var e=this.getLogs().join("\n"),t=new Blob([e],{type:"text/plain;charset=UTF-8"}),r=window.URL.createObjectURL(t),n=document.createElement("a");n.style.display="none",n.href=r,n.setAttribute("download","sdklog"),document.body.appendChild(n),n.click()}},e.prototype.setConsoleLogVisibility=function(e){this.consoleLogVisibility=e},e.prototype._bindMethod=function(e,t,r){var n=this,o=e[t],i=this.getTime();if(r)return this._cacheLog;if("function"==typeof o.bind)return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=n.getTime();n.consoleLogVisibility&&o.call.apply(o,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e,"".concat(a," IM SDK [").concat("log"===t?"debug":t,"]: ")],r,!1)),n.onLog&&n.onLog({time:a,level:"log"===t?"debug":t,logs:r}),n._cacheReportLogs.apply(n,r)};try{return Function.prototype.bind.call(o,e,"".concat(i," IM SDK [").concat("log"===t?"debug":t,"]: "))}catch(t){return function(){return Function.prototype.apply.apply(o,[e,arguments])}}},e.prototype.getTime=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},e.prototype._cacheLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=(new Date).toLocaleString()+": ",n="";e.forEach((function(e){n+="object"==typeof e?JSON.stringify(e)+" ":e+" "})),this._cacheLogCall(r+n),this._cacheReportLogs.apply(this,e)},e.prototype._cacheLogCall=function(e){var t=e.length,r=this.logBytes+t,n=this.config.maxCache;if(!(t>=n)){if(r<n)this.logBytes+=t;else for(var o=r-n,i=0;i<o;){var a=this.logs.shift();void 0!==a&&(i+=a.length)}this.logs.push(e)}},e.prototype._cacheReportLogs=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.report){var r=(new Date).toLocaleString()+": ",n="";e.forEach((function(e){n+="object"==typeof e?JSON.stringify(e)+" ":e+" "})),this.reportLogs.push(r+n)}},e.prototype._getPersistedLevel=function(){var e;if("undefined"==typeof window)return 5;if("undefined"===(e=window&&window.localStorage&&window.localStorage[this.storageLogLevelKey])){var t=window.document.cookie,r=t.indexOf(encodeURIComponent(this.storageLogLevelKey));-1!==r&&(e=/^([^;]+)/.exec(t.slice(r))[1])}return e||5},e.prototype._persistLevel=function(e){var t=this.logMethods[e]||"SILENT";if("undefined"!=typeof window){if(window.localStorage)try{window.localStorage[this.storageLogLevelKey]=t}catch(e){console.log(e)}this.useCookiePersist&&(window.document.cookie=encodeURIComponent(this.storageLogLevelKey)+"="+t+";")}},e.prototype.replaceLoggingMethods=function(e,t){for(var r=this,n=0;n<this.logMethods.length;n++){var o=this.logMethods[n];this[o]=n<e?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.report&&r._cacheReportLogs.apply(r,e)}:this.methodFactory(o,e,t)}this.log=this.debug},e.prototype.defaultMethodFactory=function(e,t,r){return this.realMethod(e)||this.enableLoggingWhenConsoleArrives.apply(this,[e,t,r])},e.prototype.realMethod=function(e){return"debug"===e&&(e="log"),"undefined"!=typeof console&&("trace"===e&&U?M:void 0!==console[e]?this._bindMethod(console,e,this.config.useCache):void 0!==console.log?this._bindMethod(console,"log",this.config.useCache):D)},e.prototype.enableLoggingWhenConsoleArrives=function(e,t,r){return function(){"undefined"!=typeof console&&(this.replaceLoggingMethods.call(this,t,r),this[e].apply(this,arguments))}.bind(this)},e}(),B=new x;B.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");return this};var G="undefined"!=typeof window?window.log:void 0;B.noConflict=function(){return"undefined"!=typeof window&&window.log===B&&(window.log=G),B},B.getLoggers=function(){return k},B.initReport=function(e){var t=e.report,r=e.reportInterval,n=e.connection;B.report=t,B.reportInterval=r,B.connection=n,t&&B._regularlyReportLogs()};var j=B,H=5242880,F=5242880,W={size:0},z={singleChat:"CHAT",groupChat:"GROUP",chatRoom:"ROOM"},q=15e3,K=3e5,V=3e5,J=[d.MAX_LIMIT,d.WEBIM_TOKEN_EXPIRED,d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,d.USER_NOT_FOUND,d.WEBIM_CONNCTION_AUTH_ERROR,d.REQUEST_PARAMETER_ERROR,d.WEBIM_CONNCTION_AUTH_ERROR,d.WEBIM_SERVER_SERVING_DISABLED,d.USER_LOGIN_TOO_MANY_DEVICES,d.USER_DEVICE_CHANGED],Y=function(){return Y=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Y.apply(this,arguments)};function X(){var e=this.context,t=e.orgName,r=e.appName,n=e.accessToken,o={url:"".concat(this.apiUrl,"/").concat(t,"/").concat(r,"/sdk/chatfiles/part-upload"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+n}};return j.debug("Call multipartInit"),ae.call(this,o,v.SDK_INTERNAL).then((function(e){var t=e.entities[0];return{data:{fileMaxSize:t.file_upper_limit,partMinSize:t.part_lower_limit,uuid:t.uuid},extraInfo:e.extraInfo,type:e.type}}))}function Q(e){var t=this;return new Promise((function(r,n){var o,i,a=(new Date).getTime(),s=t.context,c=s.orgName,u=s.appName,l=s.accessToken,h=e.uuid,p=e.partNumber,f=e.part,m=e.onProgress,g="".concat(t.apiUrl,"/").concat(c,"/").concat(u,"/sdk/chatfiles/part-upload/").concat(h),v=new XMLHttpRequest;j.debug("Call multipartUpload"),v.upload&&(null===(i=(o=v.upload).addEventListener)||void 0===i||i.call(o,"progress",(function(e){null==m||m(e)}),!1)),v.addEventListener("abort",(function(){n({type:d.REQUEST_ABORT,message:"Request Abort",errorType:"onabort",xhr:v,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"Request Abort",url:g}})}),!1),v.addEventListener("error",(function(){n({type:d.WEBIM_UPLOADFILE_ERROR,data:v,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"request error",url:g}})}),!1),v.addEventListener("load",(function(){try{var e=JSON.parse(v.responseText);if(200!==v.status)return n({type:d.WEBIM_UPLOADFILE_ERROR,data:e,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"part upload failed",url:g}}),!1;try{r(Y(Y({},e),{extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,url:g}}))}catch(e){n({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,data:e,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"part upload failed",url:g}})}}catch(e){n({type:d.WEBIM_UPLOADFILE_ERROR,data:v.responseText,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"part upload failed",url:g}})}}),!1),v.addEventListener("timeout",(function(){n({type:d.REQUEST_TIMEOUT,message:"request timeout",extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"request timeout",url:g}})}),!1);var E=new FormData;E.append("part_file",f),E.append("part_number",p),v.timeout=K,v.open("PUT",g),v.setRequestHeader("restrict-access","true"),v.setRequestHeader("Accept","*/*"),v.setRequestHeader("Authorization","Bearer "+l),v.send(E)}))}function Z(e){var t=e.uuid,r=e.thumbnailHeight,n=e.thumbnailWidth,o=e.conversationInfo,i=e.uploadMd5,a=e.uploadImageType,s=e.imageWidth,c=e.imageHeight,u=o.conversationId,l=o.conversationType,d=z[l],h=this.context,p=h.orgName,f=h.appName,m=h.accessToken,g="".concat(this.apiUrl,"/").concat(p,"/").concat(f,"/sdk/chatfiles/part-upload/").concat(t,"?restrict-access=true&chat-type=").concat(d,"&chat-target=").concat(u);n&&(g+="&thumbnail-width=".concat(n)),r&&(g+="&thumbnail-height=".concat(r)),i&&(g+="&md5=".concat(encodeURIComponent(i))),a&&(g+="&imagetype=".concat(a),"number"==typeof s&&s>0&&(g+="&width=".concat(s)),"number"==typeof c&&c>0&&(g+="&height=".concat(c)));var E={url:g,dataType:"json",type:"POST",headers:{Authorization:"Bearer "+m}};return j.debug("Call multipartComplete"),ae.call(this,E,v.SDK_INTERNAL)}function $(e){var t=e.uuid,r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/sdk/chatfiles/part-upload/").concat(t),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+i}};return j.debug("Call multipartAbort"),ae.call(this,a,v.SDK_INTERNAL)}var ee=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},te=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},re=function(){function e(e,t){var r=this;this.handleUploadProgress=function(e,t){var n,o;if(e.total){r.progressArr[t]=e.loaded;var i=r.progressArr.reduce((function(e,t){return e+t}),0);null===(o=(n=r.options).onFileUploadProgress)||void 0===o||o.call(n,{isTrusted:e.isTrusted,type:e.type,loaded:i>r.file.size?r.file.size:i,total:r.file.size,lengthComputable:e.lengthComputable})}},this.uuid="",this.pool=[],this.progressArr=[],this.connection=e,this.options=t,this.partSize=H,this.file=t.file,this.init(),this.rpt=this.connection.dataReport.geOperateFun({operationName:v.REST_UPLOAD_FILE_IN_PARTS})}return e.prototype.init=function(){var e,t,r,n;return ee(this,void 0,void 0,(function(){var o,i,a,s,c,u,l,h,p,f,m,g,v,y,_;return te(this,(function(T){switch(T.label){case 0:return T.trys.push([0,4,,6]),[4,X.call(this.connection)];case 1:return o=T.sent(),i=o.data||{},a=i.fileMaxSize,s=void 0===a?0:a,c=i.partMinSize,u=void 0===c?H:c,l=i.uuid,h=void 0===l?"":l,p=o.extraInfo,g=p.elapse,v=p.httpCode,_=p.url,this.partSize=u,this.uuid=h,W.size=u,j.debug("multipartInit success","uuid: ".concat(h),"fileMaxSize: ".concat(s),"partMinSize: ".concat(u)),this.file.size>s?[4,this.multipartAbort()]:[3,3];case 2:return T.sent(),null===(t=(e=this.options).onFileUploadError)||void 0===t||t.call(e,{code:d.WEBIM_UPLOADFILE_ERROR,message:"The file size exceeds the maximum limit"}),[2];case 3:return this.rpt({data:{requestUrl:_,requestName:E.REST_INIT_UPLOAD_TASK_IN_PARTS,requestElapse:g,requestMethod:"POST",isSuccess:1,code:v}}),this.upload(),[3,6];case 4:return f=T.sent(),m=(null==f?void 0:f.extraInfo)||{},g=m.elapse,v=m.httpCode,y=m.errDesc,_=m.url,this.rpt({data:{requestUrl:_,requestName:E.REST_INIT_UPLOAD_TASK_IN_PARTS,requestElapse:g,requestMethod:"POST",isSuccess:0,codeDesc:y,code:v}}),[4,this.multipartAbort()];case 5:return T.sent(),null===(n=null===(r=this.options)||void 0===r?void 0:r.onInitFail)||void 0===n||n.call(r),[3,6];case 6:return[2]}}))}))},e.prototype.upload=function(){var e,t,r;return ee(this,void 0,void 0,(function(){var n,o,i,a,s,c,u=this;return te(this,(function(l){switch(l.label){case 0:(new FileReader).readAsArrayBuffer(this.file),n=this.file.size,o=Math.ceil(n/this.partSize),l.label=1;case 1:l.trys.push([1,7,,9]),i=function(t){var r,o,i,s;return te(this,(function(c){switch(c.label){case 0:return r=t*a.partSize,o=Math.min(n,r+a.partSize),i=null===(e=a.file)||void 0===e?void 0:e.slice(r,o),(s=Q.call(a.connection,{uuid:a.uuid,partNumber:"".concat(t+1),part:i,onProgress:function(e){u.handleUploadProgress(e,t)}})).then((function(e){var t=(null==e?void 0:e.extraInfo)||{},r=t.elapse,n=t.httpCode,o=t.url;u.rpt({data:{requestUrl:o,requestName:E.REST_UPLOAD_PART,requestElapse:r,isSuccess:1,requestMethod:"PUT",code:n}}),u.handleTask(s)})),s.catch((function(e){var t=(null==e?void 0:e.extraInfo)||{},r=t.elapse,n=t.httpCode,o=t.url,i=t.errDesc;u.rpt({data:{requestUrl:o,requestName:E.REST_UPLOAD_PART,requestElapse:r,isSuccess:0,requestMethod:"PUT",code:n,codeDesc:i}}),delete e.extraInfo})),a.pool.push(s),4!==a.pool.length?[3,2]:[4,Promise.race(a.pool)];case 1:c.sent(),c.label=2;case 2:return[2]}}))},a=this,s=0,l.label=2;case 2:return s<o?[5,i(s)]:[3,5];case 3:l.sent(),l.label=4;case 4:return s++,[3,2];case 5:return[4,Promise.all(this.pool)];case 6:return l.sent(),this.multipartComplete(),[3,9];case 7:return c=l.sent(),[4,this.multipartAbort()];case 8:return l.sent(),this.rpt({data:{isLastApi:1,isSuccess:0}}),null===(r=(t=this.options).onFileUploadError)||void 0===r||r.call(t,c),[3,9];case 9:return[2]}}))}))},e.prototype.multipartComplete=function(){var e,t,r,n;return ee(this,void 0,void 0,(function(){var o,i,a,s,c,u,l,d,h,p,f;return te(this,(function(m){switch(m.label){case 0:return m.trys.push([0,2,,3]),o=this.options.thumbnailInfo||{},i=o.width,a=o.height,[4,Z.call(this.connection,{uuid:this.uuid,thumbnailHeight:a,thumbnailWidth:i,conversationInfo:this.options.conversationInfo,uploadMd5:this.options.uploadMd5,uploadImageType:this.options.uploadImageType,imageWidth:this.options.imageWidth,imageHeight:this.options.imageHeight})];case 1:return s=m.sent(),c=(null==s?void 0:s.extraInfo)||{},d=c.elapse,h=c.httpCode,f=c.url,this.rpt({data:{requestUrl:f,requestName:E.REST_COMPLETE_UPLOAD_PART,requestElapse:d,requestMethod:"POST",isSuccess:1,code:h}}),this.rpt({data:{isLastApi:1,isSuccess:1}}),null===(t=(e=this.options).onFileUploadComplete)||void 0===t||t.call(e,s),[3,3];case 2:return u=m.sent(),l=(null==u?void 0:u.extraInfo)||{},d=l.elapse,h=l.httpCode,p=l.errDesc,f=l.url,this.rpt({data:{requestUrl:f,requestName:E.REST_COMPLETE_UPLOAD_PART,requestElapse:d,requestMethod:"POST",isSuccess:0,codeDesc:p,code:h}}),this.rpt({data:{isLastApi:1,isSuccess:0}}),null===(n=(r=this.options).onFileUploadError)||void 0===n||n.call(r,u),[3,3];case 3:return[2]}}))}))},e.prototype.multipartAbort=function(){return ee(this,void 0,void 0,(function(){var e,t,r,n,o,i,a,s;return te(this,(function(c){switch(c.label){case 0:if(!this.uuid)return[2];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,$.call(this.connection,{uuid:this.uuid})];case 2:return e=c.sent(),t=(null==e?void 0:e.extraInfo)||{},o=t.elapse,i=t.httpCode,s=t.url,this.rpt({data:{requestUrl:s,requestName:E.REST_ABORT_UPLOAD_PART,requestElapse:o,requestMethod:"DELETE",isSuccess:1,code:i}}),[3,4];case 3:return r=c.sent(),n=(null==r?void 0:r.extraInfo)||{},o=n.elapse,i=n.httpCode,a=n.errDesc,s=n.url,this.rpt({data:{requestUrl:s,requestName:E.REST_ABORT_UPLOAD_PART,requestElapse:o,requestMethod:"DELETE",isSuccess:0,codeDesc:a,code:i}}),[3,4];case 4:return[2]}}))}))},e.prototype.handleTask=function(e){var t=this.pool.findIndex((function(t){return t===e}));this.pool.splice(t,1)},e}(),ne=function(e){var t,r,n=this,o=(new Date).getTime(),i=e.apiUrl,a=e.orgName,s=e.appName,c=e.operateName,u=e.accessToken,l=e.conversationInfo,h=l.conversationType,p=l.conversationId,f=z[h],m=e.uploadUrl||"".concat(i,"/").concat(a,"/").concat(s,"/chatfiles?chat-type=").concat(f,"&chat-target=").concat(p);e.uploadUrl||(e._uploadMd5&&(m+="&md5=".concat(encodeURIComponent(e._uploadMd5))),e._uploadImageType&&(m+="&imagetype=".concat(e._uploadImageType),"number"==typeof e.width&&e.width>0&&(m+="&width=".concat(e.width)),"number"==typeof e.height&&e.height>0&&(m+="&height=".concat(e.height))));var g=function(t){var r=(new Date).getTime()-o;n.dataReport&&c&&[v.UPLOAD_MSG_ATTACH,v.UPLOAD_CHATROOM_FILE,v.UPLOAD_GROUP_FILE].includes(c)&&n.dataReport.geOperateFun({operationName:c})({isEndApi:!0,data:{isSuccess:0,requestMethod:"POST",requestName:c,requestElapse:r,requestUrl:m,code:(null==y?void 0:y.status)||0,codeDesc:"upload file error"}}),e.onFileUploadError&&e.onFileUploadError(t)};function E(e){g({type:d.WEBIM_UPLOADFILE_ERROR,data:y})}var y=new XMLHttpRequest;y.upload&&(null===(r=(t=y.upload).addEventListener)||void 0===r||r.call(t,"progress",e.onFileUploadProgress||ie,!1)),y.addEventListener("abort",e.onFileUploadCanceled||ie,!1),y.addEventListener("error",E,!1),y.addEventListener("load",(function(t){try{var r=JSON.parse(y.responseText);if(400===y.status)return g({type:d.WEBIM_UPLOADFILE_ERROR,data:r}),!1;try{!function(t){var r=(new Date).getTime()-o;n.dataReport&&c&&[v.UPLOAD_MSG_ATTACH,v.UPLOAD_CHATROOM_FILE,v.UPLOAD_GROUP_FILE].includes(c)&&n.dataReport.geOperateFun({operationName:c})({isEndApi:!0,data:{isSuccess:(null==t?void 0:t.error)?0:1,requestMethod:"POST",requestName:c,requestElapse:r,requestUrl:m,code:y.status,codeDesc:(null==t?void 0:t.error_description)||""}}),e.onFileUploadComplete&&e.onFileUploadComplete(t)}(r)}catch(t){g({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,data:t})}}catch(t){g({type:d.WEBIM_UPLOADFILE_ERROR,data:y.responseText})}}),!1),y.addEventListener("timeout",E,!1),y.timeout=K,y.open("POST",m),y.setRequestHeader("restrict-access","true"),y.setRequestHeader("Accept","*/*"),y.setRequestHeader("Authorization","Bearer "+u);var _=new FormData;_.append("file",e.file.data),e.thumbnailWidth&&_.append("thumbnail-width",e.thumbnailWidth+""),e.thumbnailHeight&&_.append("thumbnail-height",e.thumbnailHeight+""),y.send(_)},oe=function(){return oe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},oe.apply(this,arguments)},ie=function(){};function ae(e,t){var r,n=this;return pe().platform===le.WEB?new Promise((function(t,n){var o=e.dataType||"text",i=e.success||ie,a=e.error||ie,s=new XMLHttpRequest;s.timeout=q;var c=!1;s.ontimeout=function(){j.warn("request timeout"),c=!0;var e={type:d.REQUEST_TIMEOUT,message:"Request Timeout",errorType:"timeout_error",xhr:s};a(e),n(e)},s.onerror=function(){n({type:d.REQUEST_UNKNOWN,message:"Request Unknow Error",errorType:"onerror",xhr:s})},s.onabort=function(){n({type:d.REQUEST_ABORT,message:"Request Abort",errorType:"onabort",xhr:s})},s.onreadystatechange=function(){if(4===s.readyState){var e=(new Date).getTime()-r,u=s.status||0,l={elapse:e,httpCode:u};if(200===u){_e.ajaxUnconventionalErrorTimes=0;try{switch(o){case"text":return i(s.responseText),void t(s.responseText);case"json":var h=JSON.parse(s.responseText);return h.extraInfo=l,i(h),void t(h);case"xml":return s.responseXML&&s.responseXML.documentElement?(i(s.responseXML.documentElement),void t(s.responseXML.documentElement)):(a({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"XHR.responseXML is null or XHR.responseXML.documentElement is null"}),void n({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"XHR.responseXML is null or XHR.responseXML.documentElement is null"}));default:a({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Invalid dataType"}),n({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Invalid dataType"})}return t(s.response||s.responseText),void i(s.response||s.responseText,s)}catch(e){n(e)}return}0===u?setTimeout((function(){j.error("request timeout:",c),!c&&R(s,n,a,e)}),0):([400,401,403,404,429,500,503].includes(u)||(j.warn("rest api request fail status:",u),_e.ajaxUnconventionalErrorTimes++),R(s,n,a,e))}0===s.readyState&&(a({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Request not initialized"}),n({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Request not initialized"}))},e.responseType&&s.responseType&&(s.responseType=e.responseType),e.mimeType&&s.overrideMimeType(e.mimeType);var u=e.type||"POST",l=e.data||null,h="";if("get"===u.toLowerCase()&&l){for(var p in l)l.hasOwnProperty(p)&&(h+=p+"="+l[p]+"&");h=h?h.slice(0,-1):h,e.url+=(e.url.indexOf("?")>0?"&":"?")+(h?h+"&":h)+"_v="+(new Date).getTime(),l=null,h=""}r=(new Date).getTime(),s.open(u,e.url);var f=e.headers||{};for(var m in f["Content-Type"]||(f["Content-Type"]="application/json"),f)f.hasOwnProperty(m)&&s.setRequestHeader(m,f[m]);s.send(l)})).then((function(r){var o,i;if(n.dataReport&&t&&t!==v.SDK_INTERNAL){var a=n.dataReport.geOperateFun({operationName:t}),s=oe({isSuccess:1,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(r.extraInfo));t===v.REST_FETCH_CONVERSATIONS?s.resultCount=null===(o=r.data.channel_infos)||void 0===o?void 0:o.length:t===v.REST_FETCHHISTORYMESSAGE&&(s.resultCount=null===(i=r.data.msgs)||void 0===i?void 0:i.length),a({isEndApi:!0,data:s})}return t===v.SDK_INTERNAL&&(r.extraInfo.url=e.url),t!==v.SDK_INTERNAL&&delete r.extraInfo,"Object"===se(r)?oe(oe({},r),{type:d.REQUEST_SUCCESS}):{data:r,type:d.REQUEST_SUCCESS}})).catch((function(o){var i,a;if(n.dataReport&&t&&t!==v.SDK_INTERNAL&&n.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:oe({isSuccess:0,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(o.extraInfo))}),t===v.SDK_INTERNAL)if(o.extraInfo)o.extraInfo.url=e.url;else{var s={elapse:(new Date).getTime()-r,httpCode:null!==(a=null===(i=o.xhr)||void 0===i?void 0:i.status)&&void 0!==a?a:0,url:e.url};o.extraInfo=s}throw t!==v.SDK_INTERNAL&&delete o.extraInfo,o})):ce.call(this,e,t)}function se(e){return Object.prototype.toString.call(e).slice(8,-1)}function ce(e,t){var r=this;return new Promise((function(r,n){var o=e.success||ie,i=e.error||ie,a=e.type||"POST",s=e.data||null,c="",u=(new Date).getTime(),l=_e.getEnvInfo();if("get"===a.toLowerCase()&&s){for(var h in s)s.hasOwnProperty(h)&&(c+=h+"="+s[h]+"&");c=c?c.slice(0,-1):c,e.url+=(e.url.indexOf("?")>0?"&":"?")+(c?c+"&":c)+"_v="+(new Date).getTime(),s=null,c=""}var p={url:e.url,data:e.data,method:a,headers:{},timeout:q,success:function(e){var a,s,c,l,d,h={elapse:(new Date).getTime()-u,httpCode:Number((null===(a=e.statusCode)||void 0===a?void 0:a.toString())||(null===(s=e.status)||void 0===s?void 0:s.toString())),errDesc:(null===(c=null==e?void 0:e.data)||void 0===c?void 0:c.error_description)||""};if("200"===(null===(l=e.statusCode)||void 0===l?void 0:l.toString())||"200"===(null===(d=e.status)||void 0===d?void 0:d.toString())){e.data.extraInfo=h;var p=e.data;o(p),r(p)}else e.extraInfo=h,i(p=e),n(p),j.warn(t,"reject reason: ",p)},complete:function(){},fail:function(e){var r={elapse:(new Date).getTime()-u,httpCode:A,errDesc:"request:fail"};if(e.extraInfo=r,e.data={error:"request:fail",error_description:"request:fail"},"request:fail timeout"===e.errMsg)return n({type:d.REQUEST_TIMEOUT,message:"Request Timeout",extraInfo:r}),void i({type:d.REQUEST_TIMEOUT,message:"Request Timeout",extraInfo:r});i(e),n(e),j.error(t,"fail reason:",e)}};if("zfb"===l.platform||"dd"===l.platform?p.headers=e.headers:p.header=e.headers,"dd"===l.platform)return dd.httpRequest(p);l.global.request(p)})).then((function(n){var o,i;if(r.dataReport&&t&&t!==v.SDK_INTERNAL){var a=r.dataReport.geOperateFun({operationName:t}),s=oe({isSuccess:1,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(n.extraInfo));t===v.REST_FETCH_CONVERSATIONS?s.resultCount=null===(o=n.data.channel_infos)||void 0===o?void 0:o.length:t===v.REST_FETCHHISTORYMESSAGE&&(s.resultCount=null===(i=n.data.msgs)||void 0===i?void 0:i.length),a({isEndApi:!0,data:s})}return t!==v.SDK_INTERNAL&&delete n.extraInfo,"Object"===se(n)?oe(oe({},n),{type:d.REQUEST_SUCCESS}):{data:n,type:d.REQUEST_SUCCESS}})).catch((function(n){r.dataReport&&t&&t!==v.SDK_INTERNAL&&r.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:oe({isSuccess:0,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(n.extraInfo))}),t!==v.SDK_INTERNAL&&delete n.extraInfo;var o=JSON.stringify(n.data||{}),i=oe(oe({},n),{status:n.statusCode||n.status||0,response:o,responseText:o});R(i,(function(e){throw oe(oe({},n),{message:e.message,type:e.type})}),ie,0)}))}function ue(e,t){var r;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(!e)return r;r=t?e.apply(t,n):e.apply(void 0,n),e=null}}var le,de=ue((function(e,t){var r=pe();if(r.platform!==le.WEB){var n=r.global,o=function(r){r.isConnected?e():t()};n.offNetworkStatusChange&&n.offNetworkStatusChange(o),n.onNetworkStatusChange&&n.onNetworkStatusChange(o)}else"undefined"!=typeof addEventListener&&(window.addEventListener("online",e),window.addEventListener("offline",t))})),he=ue((function(e,t){var r,n,o=pe();if(o.platform===le.WEB)"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){document.hidden?null==t||t():null==e||e()}),!1);else{var i=o.global;i.onAppShow&&(null===(r=i.onAppShow)||void 0===r||r.call(i,e)),i.onAppHide&&(null===(n=i.onAppHide)||void 0===n||n.call(i,t))}}));function pe(){return"undefined"!=typeof swan&&fe(swan)?{platform:le.BAIDU,global:swan}:"undefined"!=typeof tt&&fe(tt)?{platform:le.TT,global:tt}:"undefined"!=typeof dd&&fe(dd)?{platform:le.DD,global:dd}:"undefined"!=typeof my&&fe(my)?{platform:le.ZFB,global:my}:"undefined"!=typeof wx&&fe(wx)||"undefined"!=typeof wx&&"function"==typeof wx.createCanvas?{platform:le.WX,global:wx}:"undefined"!=typeof qq&&fe(qq)?{platform:le.QQ,global:qq}:"undefined"!=typeof uni&&fe(uni)?{platform:le.UNI,global:uni}:"undefined"!=typeof window&&window.WebSocket?{platform:le.WEB,global:window}:{platform:le.NODE,global:r.g||{}}}function fe(e){for(var t=["canIUse","getSystemInfo"],r=0,n=t.length;r<n;r++)if(!e[t[r]])return!1;return!0}function me(e,t){var r,n,o,i,a=this,s=e.accessToken,c=e.appKey,u=null===(n=null===(r=null==e?void 0:e.file)||void 0===r?void 0:r.data)||void 0===n?void 0:n.size,l=[],h="",p="";if(s)if(c&&(l=c.split("#"),h=l[0],p=l[1]),h||p){var f=e._filePath;if(f&&"string"==typeof f){var m=pe(),g=null===(o=m.global)||void 0===o?void 0:o.uploadFile;if(m.platform!==le.WEB&&"function"==typeof g){var v=z[e.chatType]||"CHAT",E="".concat(e.apiUrl,"/").concat(h,"/").concat(p,"/chatfiles?chat-type=").concat(v,"&chat-target=").concat(e.to);return e._uploadMd5&&(E+="&md5=".concat(encodeURIComponent(e._uploadMd5))),e._uploadImageType&&(E+="&imagetype=".concat(e._uploadImageType),"number"==typeof e.width&&e.width>0&&(E+="&width=".concat(e.width)),"number"==typeof e.height&&e.height>0&&(E+="&height=".concat(e.height))),void g({url:E,filePath:f,name:"file",header:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+s,"restrict-access":"true"},success:function(t){if(200===t.statusCode)try{var r="string"==typeof t.data?JSON.parse(t.data):t.data;e.onFileUploadComplete&&e.onFileUploadComplete(r)}catch(r){e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,data:oe(oe({},t),{rawData:t.data,error:r})})}else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,data:t})},fail:function(t){e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,data:t})}})}e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,message:"Current platform does not support path-based upload"})}else if(u<=0)e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,message:"fileSize must be greater than 0"});else if(e.uploadUrl)ne.call(this,oe(oe({},e),{orgName:h,appName:p,operateName:t,conversationInfo:{conversationId:e.to,conversationType:e.chatType}}));else{var y=W.size||F;this.uploadPartEnable&&u>1.5*y?new re(this,{file:null===(i=null==e?void 0:e.file)||void 0===i?void 0:i.data,onFileUploadProgress:e.onFileUploadProgress||ie,onFileUploadComplete:e.onFileUploadComplete||ie,onFileUploadError:e.onFileUploadError||ie,onFileUploadCanceled:e.onFileUploadCanceled||ie,conversationInfo:{conversationId:e.to,conversationType:e.chatType},onInitFail:function(){ne.call(a,oe(oe({},e),{orgName:h,appName:p,operateName:t,conversationInfo:{conversationId:e.to,conversationType:e.chatType}}))},thumbnailInfo:{width:e.thumbnailWidth,height:e.thumbnailHeight},uploadMd5:e._uploadMd5,uploadImageType:e._uploadImageType,imageWidth:e.width,imageHeight:e.height}):ne.call(this,oe(oe({},e),{orgName:h,appName:p,operateName:t,conversationInfo:{conversationId:e.to,conversationType:e.chatType}}))}}else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,message:this._initWithAppId?"appId illegal":"AppKey illegal"});else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_NO_LOGIN,message:"AccessToken cannot be empty"})}function ge(e,t){var r;e.onFileDownloadComplete=e.onFileDownloadComplete||ie,e.onFileDownloadError=e.onFileDownloadError||ie;var n=(new Date).getTime(),o=new XMLHttpRequest,i=this;o.addEventListener("load",(function(){var r,a=(new Date).getTime()-n;i.dataReport&&t&&t===v.DOWN_GROUP_FILE&&i.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:{isSuccess:200===o.status?1:0,requestMethod:e.method||"GET",requestName:t,requestElapse:a,requestUrl:null==e?void 0:e.url,code:o.status,codeDesc:200===o.status?"":"download file error"}}),200===o.status?e.onFileDownloadComplete&&e.onFileDownloadComplete(o.response):403===o.status||404===o.status?((r=new FileReader).addEventListener("loadend",(function(t){var r;try{var n=JSON.parse(null===(r=t.target)||void 0===r?void 0:r.result);j.error("download file failed","status:".concat(o.status),n),403===o.status?"chatfile no permission"===n.error_description?e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION,id:e.id,xhr:o}):e.onFileDownloadError&&e.onFileDownloadError({type:d.PERMISSION_DENIED,id:e.id,xhr:o}):404===o.status&&("file_expired"===n.error?e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR_EXPIRED,id:e.id,xhr:o}):e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o}))}catch(t){j.error("Error parsing download error response:",t),e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o})}})),r.readAsText(o.response)):500===o.status?(j.error("download file failed","status:".concat(o.status),"type:".concat(d.SERVER_UNKNOWN_ERROR)),e.onFileDownloadError&&e.onFileDownloadError({type:d.SERVER_UNKNOWN_ERROR,id:e.id,xhr:o})):(j.error("download file failed","status:".concat(o.status),"type:".concat(d.WEBIM_DOWNLOADFILE_ERROR)),e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o}))}),!1),o.addEventListener("error",(function(r){var a=(new Date).getTime()-n;i.dataReport&&t&&t===v.DOWN_GROUP_FILE&&i.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:{isSuccess:0,requestMethod:e.method||"GET",requestName:t,requestElapse:a,requestUrl:null==e?void 0:e.url,code:(null==o?void 0:o.status)||0,codeDesc:"download file error"}}),e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o})}),!1);var a=e.method||"GET",s=e.responseType||"blob",c=e.mimeType||"text/plain; charset=x-user-defined";o.open(a,e.url),"undefined"!=typeof Blob?o.responseType=s:o.overrideMimeType(c);var u={"X-Requested-With":"XMLHttpRequest","share-secret":e.secret,Authorization:"Bearer "+(null===(r=null==this?void 0:this.context)||void 0===r?void 0:r.accessToken)},l=e.headers||{};for(var h in l)u[h]=l[h];for(var h in u)u[h]&&o.setRequestHeader(h,u[h]);o.send(null)}function ve(e){void 0===e&&(e={});var t=e.elapse,r=void 0===t?0:t,n=e.httpCode,o=void 0===n?0:n,i=e.errDesc;return{requestElapse:r,code:o,codeDesc:void 0===i?"":i}}!function(e){e.WEB="web",e.WX="wx",e.QQ="qq",e.ZFB="zfb",e.DD="dd",e.TT="tt",e.BAIDU="baidu",e.QUICK_APP="quick_app",e.UNI="uni",e.NODE="node"}(le||(le={}));var Ee,ye="localDeviceInfo",_e={autoIncrement:0,ajaxUnconventionalErrorTimes:0,isUseHttps:function(e){var t;return"boolean"==typeof e?e:!("undefined"!=typeof window)||"https:"===(null===(t=window.location)||void 0===t?void 0:t.protocol)},getRetryDelay:function(e){return e<=5?Number((Math.random()+1).toFixed(2)):e>5&&e<20?Math.floor(4*Math.random())+3:Math.floor(6*Math.random())+5},ajax:ae,getUniqueId:function(){this.autoIncrement?this.autoIncrement++:this.autoIncrement=1;var e=new Date,t=new Date(2010,1,1);return(e.getTime()-t.getTime()+this.autoIncrement).toString()},getFileUrl:function(e){var t={url:"",filename:"",filetype:"",data:{}},r="string"==typeof e?document.getElementById(e):e;if(window.URL.createObjectURL){if(!r.files)throw Error("this is not HTMLInputElement");var n=r.files;if(n.length>0){var o=n.item(0);t.data=o,t.url=window.URL.createObjectURL(o),t.filename=(null==o?void 0:o.name)||""}}else{if("string"!=typeof e)throw Error("in IE fileInputId must be string");o=document.getElementById(e).value,t.url=o;var i=o.lastIndexOf("/"),a=o.lastIndexOf("\\"),s=Math.max(i,a);t.filename=s<0?o:o.substring(s+1)}var c=t.filename.lastIndexOf(".");return-1!==c&&(t.filetype=t.filename.substring(c+1).toLowerCase()),t},uploadFile:me,flow:function(e){for(var t=e.length,r=t;r--;)if("function"!=typeof e[r])throw new TypeError("Expected a function");return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var o=0,i=t?e[o].apply(this,r):r[0];++o<t;)i=e[o].call(this,i);return i}},listenNetwork:de,listenBrowserVisibility:he,getEnvInfo:pe,wxRequest:ce,parseDownloadResponse:function(e){if(!window||!window.URL)throw Error("parseDownloadResponse can be used in broswer only");return e&&e.type&&"application/json"===e.type||0>Object.prototype.toString.call(e).indexOf("Blob")?this.url+"?token=":window.URL.createObjectURL(e)},download:ge,parseNotify:function(e){for(var t="",r=0;r<e.length;r++)t+="%"+e[r].toString(16);return JSON.parse(decodeURIComponent(t))},getExtraData:ve,retryPromise:function(e,t,r){return new Promise((function(n,o){var i=function(t){e().then(n).catch((function(e){t>0?setTimeout((function(){i(t-1)}),r||1e3):o(e)}))};i(t||3)}))},formatAttachUrl:function(e){return e&&"string"==typeof e?"".concat(this.apiUrl).concat(e.slice(e.indexOf("/",9))):""},Uint8ArrayToString:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},getLocalDeviceInfo:function(){return function(e){var t,r=_e.getEnvInfo(),n=r.platform,o="";n!==le.NODE&&n!==le.QUICK_APP||(o="");try{n===le.WEB?window.localStorage?o=localStorage.getItem(e)||"":j.error("localStorage is not supported"):n===le.WX||n===le.QQ||n===le.TT||n===le.BAIDU||n===le.UNI?o=r.global.getStorageSync(e)||"":n!==le.ZFB&&n!==le.DD||(o=(null===(t=r.global.getStorageSync({key:e}))||void 0===t?void 0:t.data)||"")}catch(t){j.info("get local ".concat(e," failed: "),t)}return j.info("".concat(e," "),o),o}(ye)},setLocalDeviceInfo:function(e){!function(e,t){var r=_e.getEnvInfo(),n=r.platform;if(n!==le.NODE&&n!==le.QUICK_APP)if(n===le.WEB)try{window.localStorage?localStorage.setItem(e,t):j.error("localStorage is not supported")}catch(t){j.error("set local ".concat(e," failed: "),t)}else r.global.setStorage({key:e,data:t,success:function(t){j.debug("set local ".concat(e," success: "),t)},fail:function(t){j.error("set local ".concat(e," failed: "),t)}})}(ye,e)},detectBrowser:function(){if("undefined"==typeof navigator)return"unknown";var e=navigator.userAgent;return/MicroMessenger/i.test(e)?"WeChat":/QQBrowser/i.test(e)?"QQ":!/Chrome/i.test(e)||/Edg/i.test(e)||/OPR/i.test(e)?!/Safari/i.test(e)||/Chrome/i.test(e)||/CriOS/i.test(e)?/Firefox/i.test(e)?"Firefox":/MSIE/i.test(e)||/Trident/i.test(e)?"IE":/Edg/i.test(e)?"Edge":"unknown":"Safari":"Chrome"},getDevicePlatform:function(e){return e.platform===le.WX&&"undefined"!=typeof uni&&fe(uni)?le.UNI:e.platform},delay:function(e){return new Promise((function(t){return setTimeout(t,e)}))}};!function(e){e[e.SYNC_INIT=0]="SYNC_INIT",e[e.SYNC_START=1]="SYNC_START",e[e.SYNC_FINISH=2]="SYNC_FINISH"}(Ee||(Ee={}));var Te,Ie,Oe=r(887),Re=r.n(Oe);!function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNKNOWN=2]="UNKNOWN",e[e.NONE=3]="NONE"}(Te||(Te={})),function(e){e[e.START=0]="START",e[e.START_AND_COMPLETED=1]="START_AND_COMPLETED",e[e.IN_PROGRESS=2]="IN_PROGRESS",e[e.COMPLETED=3]="COMPLETED",e[e.ERROR=4]="ERROR"}(Ie||(Ie={}));var Ce=function(){return Ce=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ce.apply(this,arguments)},Se={chat:"singleChat",chatroom:"chatRoom",groupchat:"groupChat",singleChat:"singleChat",chatRoom:"chatRoom",groupChat:"groupChat"};function Ne(e,t){var r,n,o,i=t||{},a=i.formatCustomExts,s=void 0===a||a,c=i.formatChatType,u=void 0!==c&&c,l=e.id,h=e.payload,p=e.timestamp,f=e.to,m=h.bodies&&h.bodies.length>0?h.bodies[0]:{},g={},v={},E=h.type?h.type:f.indexOf("@conference.easemob.com")>-1?"groupChat":"singleChat";E="chat"===E?"singleChat":E,u&&h.type&&(E=Se[h.type]);var y="";switch(m.type){case"txt":if(Object.prototype.hasOwnProperty.call(m,"subType")&&"sub_combine"===m.subType)y=nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"combine",chatType:E,to:h.to,from:h.from,ext:h.ext,time:p,title:m.title||"",summary:m.summary||"",url:y||"",secret:m.secret||"",file_length:m.file_length||0,filename:m.filename||"",compatibleText:m.msg,combineLevel:m.combineLevel||0};else if(g={id:l,type:"txt",chatType:E,msg:m.msg||"",to:h.to||"",from:h.from,time:p,ext:h.ext},Object.prototype.hasOwnProperty.call(m,"subType")&&"sub_stream"===m.subType&&h.stream){var _=0;switch(h.stream.stream_status){case"stream_start":_=Ie.START;break;case"stream_start_completed":_=Ie.START_AND_COMPLETED;break;case"stream_in_progress":_=Ie.IN_PROGRESS;break;case"stream_completed":case"stream_full":_=Ie.COMPLETED;break;default:_=0}var T=0;512===h.stream.stream_error?T=d.MESSAGE_STREAM_INTERVAL_TIMEOUT:513===h.stream.stream_error&&(T=d.MESSAGE_STREAM_TIMEOUT),g.stream={customType:h.stream.stream_type,status:_,errorType:T,text:m.msg,finishReason:h.stream.stream_finish_reason}}break;case"img":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"img",chatType:E,to:h.to,from:h.from,time:p,ext:h.ext,width:(null===(r=m.size)||void 0===r?void 0:r.width)||0,height:(null===(n=m.size)||void 0===n?void 0:n.height)||0,thumb:this.useOwnUploadFun?"":"".concat(y,"&thumbnail=true"),thumb_secret:m.secret,secret:m.secret||"",url:y||"",file_length:m.file_length||0,file:{},isGif:"sub_gif"===m.subType};break;case"video":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"video",chatType:E,from:h.from,to:h.to,thumb:_e.formatAttachUrl.call(this,m.thumb),thumb_secret:m.thumb_secret||"",url:y||"",secret:m.secret||"",filename:m.filename,length:m.length||0,file:{},file_length:m.file_length||0,filetype:h.ext.file_type||"",ext:h.ext,time:p};break;case"loc":g={id:l,type:"loc",chatType:E,from:h.from,to:h.to,buildingName:m.buildingName||"",addr:m.addr,lat:m.lat,lng:m.lng,ext:h.ext,time:p};break;case"audio":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"audio",chatType:E,from:h.from,to:h.to,secret:m.secret||"",ext:h.ext,time:p,url:y||"",file:{},filename:m.filename,length:m.length||0,file_length:m.file_length||0,filetype:h.ext.file_type||""};break;case"file":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"file",chatType:E,from:h.from,to:h.to,ext:h.ext,time:p,url:y||"",secret:m.secret||"",file:{},filename:m.filename||"",file_length:m.file_length||0,filetype:h.ext.file_type||""};break;case"cmd":g={id:l,type:"cmd",chatType:E,from:h.from,to:h.to,ext:h.ext,time:p,action:m.action||""};break;case"custom":var I=m.customExts||{};s&&m.customExts&&(I={},m.customExts.map((function(e){I=Ce(Ce({},I),e)}))),g={id:l,type:"custom",chatType:E,from:h.from,to:h.to,ext:h.ext,time:p,customEvent:m.customEvent||"",customExts:I};break;case"combine":y=nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"combine",chatType:E,msg:m.msg||"",to:h.to||"",from:h.from,time:p,ext:h.ext,title:m.title||"",summary:m.summary||"",url:y||"",compatibleText:m.text,combineLevel:m.combineLevel||0,secret:m.secret||"",filename:m.filename||"",file_length:m.file_length||0};break;default:j.error("unexpected message: ".concat(e))}if(h.msgConfig&&(v.msgConfig=h.msgConfig),null==h?void 0:h.meta){var O=h.meta;O.thread&&(v.chatThread={messageId:O.thread.msg_parent_id,parentId:O.thread.muc_parent_id,chatThreadName:O.thread.thread_name}),O.reaction&&(v.reactions=O.reaction),O.translations&&(v.translations=O.translations)}var R=null===(o=null==h?void 0:h.meta)||void 0===o?void 0:o.edit_msg;if(R){var C=R.edit_time,S=R.operator,N=R.count;g.modifiedInfo={operationTime:C,operatorId:S,operationCount:N}}return Ce(Ce({},g),v)}var be,Ae=function(e){return"".concat(e.conversationType,"-").concat(e.conversationId)},Me=function(e){var t=e.isRecallSelfMsg,r=e.conversation,n=e.recalledMsgTime,o=r.unReadCount,i=void 0===o?0:o,a=r.unreadCountClearTimestamp;return t||(void 0===a?0:a)>n?i:i&&i>0?i-1:0},we=function(e){var t,r=0;if(0===e.length)return r;for(t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r},Ue=function(){return Ue=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ue.apply(this,arguments)};!function(e){e[e.STREAM_START=0]="STREAM_START",e[e.STREAM_START_COMPLETED=1]="STREAM_START_COMPLETED",e[e.STREAM_IN_PROGRESS=2]="STREAM_IN_PROGRESS",e[e.STREAM_COMPLETED=3]="STREAM_COMPLETED",e[e.STREAM_FULL=4]="STREAM_FULL"}(be||(be={}));var Le=new(function(){function e(){this.cache=new Map,this.mergedContent=new Map,this.lastDispatchedSeq=new Map,this.hasCompleted=new Map,this.msgExt=new Map}return e.prototype.addChunk=function(e,t){this.cache.has(e)||(this.cache.set(e,[]),this.mergedContent.set(e,""),this.lastDispatchedSeq.set(e,-1),this.hasCompleted.set(e,!1)),t.streamInfo.status===Ie.COMPLETED&&this.hasCompleted.set(e,!0);var r=this.cache.get(e);-1===r.findIndex((function(e){return e.seq===t.seq}))?(r.push(t),r.sort((function(e,t){return e.seq-t.seq}))):j.warn("Stream message chunk already exists",t.seq)},e.prototype.getMergedContent=function(e){return this.mergedContent.get(e)||""},e.prototype.appendToMergedContent=function(e,t){var r=this.mergedContent.get(e)||"";this.mergedContent.set(e,r+t)},e.prototype.getChunks=function(e){return this.cache.get(e)||[]},e.prototype.getSequentialChunks=function(e){var t=this.cache.get(e);if(!t||0===t.length)return[];for(var r=this.lastDispatchedSeq.get(e),n=[],o=0,i=t;o<i.length;o++){var a=i[o];if(0!==n.length){var s=n[n.length-1];if(a.seq!==s.seq+1)break;n.push(a)}else{if(void 0!==r&&-1!==r&&a.seq!==r+1)continue;n.push(a)}}return n},e.prototype.markDispatched=function(e,t){var r;t>(null!==(r=this.lastDispatchedSeq.get(e))&&void 0!==r?r:-1)&&this.lastDispatchedSeq.set(e,t)},e.prototype.getLastDispatchedSeq=function(e){var t;return null!==(t=this.lastDispatchedSeq.get(e))&&void 0!==t?t:-1},e.prototype.isCompleted=function(e){var t=this.cache.get(e);return!(!t||0===t.length)&&t[t.length-1].streamInfo.status===Ie.COMPLETED},e.prototype.hasMissingSeqs=function(e){var t=this.cache.get(e);if(!t||0===t.length)return!1;var r=t.find((function(e){return e.streamInfo.status===Ie.START||e.streamInfo.status===Ie.START_AND_COMPLETED}));if(!r)return!0;for(var n=r.seq,o=Math.max.apply(Math,t.map((function(e){return e.seq}))),i=new Set(t.map((function(e){return e.seq}))),a=n;a<=o;a++)if(!i.has(a))return!0;return!1},e.prototype.setMergedContent=function(e,t){this.mergedContent.set(e,t)},e.prototype.hasReceivedCompleted=function(e){return this.hasCompleted.get(e)||!1},e.prototype.hasReceivedFull=function(e){var t=this.cache.get(e);return!!t&&t.some((function(e){return e.streamInfo.status===be.STREAM_FULL}))},e.prototype.setMsgExt=function(e,t){this.msgExt.set(e,t)},e.prototype.getMsgExt=function(e){return this.msgExt.get(e)},e.prototype.clear=function(e){this.cache.delete(e),this.mergedContent.delete(e),this.lastDispatchedSeq.delete(e),this.hasCompleted.delete(e),this.msgExt.delete(e)},e.prototype.clearAll=function(){this.cache.clear(),this.mergedContent.clear(),this.lastDispatchedSeq.clear(),this.hasCompleted.clear(),this.msgExt.clear()},e}());function Pe(e,t,r,n,o,i,a,s,c,u,l,d,h,p,f,m,g){var v={id:e,chatType:t,type:"txt",to:r,msg:n,from:o,time:i,stream:a,onlineState:s};return function(e,t,r,n,o,i,a,s,c,u){t&&Object.keys(t).length>0&&(e.ext=t),r&&r.length>0&&(e.reactions=r),n&&n.length>0&&(e.translations=n),o&&o.operationCount>0&&(e.modifiedInfo=o),i&&(e.chatThread=i),a&&(e.chatThreadOverview=a),s&&(e.isContentReplaced=s),c&&(e.isRead=c),u&&(e.isDelivered=u)}(v,c,u,l,d,h,p,f,m,g),v}var De,ke=function(e,t,r,n,o,i,a,s,c,u,l,h,p,m,g,v,E,y,_){var T,I,O,R,C,S;try{var N=function(e,t){var r,n=null!==(r=e.streamError)&&void 0!==r?r:0;512===n?n=d.MESSAGE_STREAM_INTERVAL_TIMEOUT:513===n&&(n=d.MESSAGE_STREAM_TIMEOUT);var o={customType:e.streamType,seq:Number(e.streamSeq.toString()),status:e.streamStatus,errorType:n,text:t,finishReason:e.streamFinishReason};return void 0!==e.streamSeq&&(e.streamSeq&&"object"==typeof e.streamSeq?o.seq=Number(new(f())(e.streamSeq.low,e.streamSeq.high,e.streamSeq.unsigned).toString()):o.seq=Number(e.streamSeq)),o}(t.stream,e.text),b=N.seq,A=N.text,M=(N.finishReason,t.stream.streamStatus),w={msgId:n,seq:b,text:A,streamInfo:N,timestamp:Number(a)};if(Le.addChunk(n,w),M===be.STREAM_FULL){var U=Le.getChunks(n);if(0===U.length){var L=A,P=Le.getMergedContent(n),D=L.slice(P.length),k=Ue(Ue({},N),{status:Ie.START_AND_COMPLETED,text:D}),x=Pe(n,s,i,L,o,Number(a),k,c,u,l,h,p,m,g,v,E,y);return!_&&(null===(I=null===(T=this.eventHandler)||void 0===T?void 0:T.dispatch)||void 0===I||I.call(T,"onStreamMessage",x)),Le.setMergedContent(n,L),Le.clear(n),x}var B=U[U.length-2];if(B&&B.streamInfo.status===Ie.START_AND_COMPLETED)return void j.debug("Stream message FULL ignored (already dispatched)");var G=Le.hasMissingSeqs(n),H=Le.hasReceivedCompleted(n);if(G||!H){j.debug("Stream message has missing (FULL)",{msgId:n,seq:b}),L=A,P=Le.getMergedContent(n),D=L.slice(P.length),"seq"in(k=Ue(Ue({},N),{status:0===N.errorType?Ie.COMPLETED:Ie.ERROR,text:D}))&&delete k.seq;var F=U[0].timestamp;return x=Pe(n,s,i,L,o,Number(F)||Number(a),k,c,u,l,h,p,m,g,v,E,y),!_&&(null===(R=null===(O=this.eventHandler)||void 0===O?void 0:O.dispatch)||void 0===R||R.call(O,"onStreamMessage",x)),Le.setMergedContent(n,L),j.debug("Stream message dispatched (FULL with missing)",{msgId:n,seq:b,status:"STREAM_COMPLETED",incrementalLength:D.length,fullLength:L.length}),Le.clear(n),x}return j.debug("Stream message FULL ignored (no missing)",{msgId:n,seq:b}),void Le.clear(n)}if(Le.hasMissingSeqs(n))return void j.debug("Stream message has missing",{msgId:n,seq:b});for(var W=Le.getSequentialChunks(n),z=0,q=W;z<q.length;z++){var K=q[z],V=Le.getMergedContent(n)+K.text,J=(D=K.text,K.streamInfo.status);J===be.STREAM_FULL&&(J=Ie.COMPLETED),0!==K.streamInfo.errorType&&(J=Ie.ERROR),"seq"in(k=Ue(Ue({},K.streamInfo),{status:J,text:D}))&&delete k.seq,x=Pe(n,s,i,V,o,(F=Le.getChunks(n)[0].timestamp)||K.timestamp,k,c,u,l,h,p,m,g,v,E,y),!_&&(null===(S=null===(C=this.eventHandler)||void 0===C?void 0:C.dispatch)||void 0===S||S.call(C,"onStreamMessage",x)),Le.markDispatched(n,K.seq),Le.appendToMergedContent(n,K.text),j.debug("Stream message dispatched",{msgId:n,seq:K.seq,status:J,incrementalLength:D.length,mergedLength:V.length})}var Y=Le.getMergedContent(n);j.debug("Stream message processed",{msgId:n,seq:b,status:M,textLength:A.length,mergedLength:Y.length,dispatchedChunks:W.length})}catch(t){j.error("Error handling stream message",t,{msgId:n,msgBody:e})}},xe=function(){function e(e){var t=e.id;this.id=t,this.type=e.type}return e.prototype.set=function(e){this.body={id:this.id,ackId:e.id,type:"read",to:e.to,from:e.from||"",chatType:e.chatType}},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType,ackId:e.id,type:"read",to:e.to,from:e.from||"",ackContent:e.ackContent,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly}},e}(),Be=function(){function e(e){this.id=e.id,this.type=e.type}return e.prototype.set=function(e){this.body={id:this.id,ackId:e.ackId,type:"delivery",to:e.to,from:e.from||""}},e.create=function(e){return{id:_e.getUniqueId(),ackId:e.ackId,type:"delivery",to:e.to,from:e.from||"",isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly}},e}(),Ge=function(){function e(e){var t=e.type,r=e.id;this.id=r,this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"channel",to:e.to,from:e.from||"",time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),mid:e.mid,type:"channel",chatType:e.chatType||"singleChat",to:e.to,from:e.from||"",time:Date.now(),isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly}},e}(),je=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t,this.value=""}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"txt",to:e.to,msg:e.msg,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),isChatThread:e.isChatThread},this.value=e.msg},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){var t,r;return(null===(t=e.msgConfig)||void 0===t?void 0:t.languages)&&Array.isArray(null===(r=e.msgConfig)||void 0===r?void 0:r.languages),{type:"txt",id:_e.getUniqueId(),msg:e.msg,to:e.to,from:e.from||"",chatType:e.chatType,ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),He=function(){function e(e){var t=e.type,r=e.id;this.id=r||_e.getUniqueId(),this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"cmd",to:e.to,action:e.action,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),type:"cmd",to:e.to,from:e.from||"",chatType:e.chatType||"singleChat",action:e.action,time:Date.now(),ext:e.ext,msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Fe=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"custom",to:e.to,customEvent:e.customEvent,customExts:e.customExts,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"custom",to:e.to,customEvent:e.customEvent,customExts:e.customExts,from:e.from||"",ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),We=function(){function e(e){var t=e.type,r=e.id;this.id=r||_e.getUniqueId(),this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"loc",to:e.to,addr:e.addr,buildingName:e.buildingName,lat:e.lat,lng:e.lng,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"loc",to:e.to,addr:e.addr,buildingName:e.buildingName,lat:e.lat,lng:e.lng,from:e.from||"",ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),ze=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"img",file:e.file,width:e.width,height:e.height,to:e.to,from:e.from||"",roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){var t,r,n,o,i,a,s,c=e.imageType,u=null===(n=null===(r=null===(t=e.file)||void 0===t?void 0:t.data)||void 0===r?void 0:r.type)||void 0===n?void 0:n.toLowerCase(),l=null===(i=null===(o=e.file)||void 0===o?void 0:o.filetype)||void 0===i?void 0:i.toLowerCase(),d=null===(s=null===(a=e.file)||void 0===a?void 0:a.filename)||void 0===s?void 0:s.toLowerCase(),h="image/gif"===u||"gif"===l||"image/gif"===l||!0===(null==d?void 0:d.endsWith(".gif")),p=e.isGif||h,f=p||!0===e.isOriginalImage||"original"===c;return{id:_e.getUniqueId(),chatType:e.chatType,type:"img",url:e.url,width:e.width,height:e.height,file:e.file,to:e.to,from:e.from||"",ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,file_length:e.file_length,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv,thumbnailWidth:e.thumbnailWidth,thumbnailHeight:e.thumbnailHeight,isGif:p,isOriginalImage:f}},e}(),qe=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"audio",file:e.file,filename:e.filename,length:e.length,file_length:e.file_length,fileInputId:e.fileInputId,to:e.to,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType,type:"audio",filename:e.filename,length:e.length,file:e.file,to:e.to,from:e.from||"",ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,file_length:e.file_length,msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Ke=function(){function e(e){var t=e.type,r=e.id;this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"video",file:e.file,filename:e.filename,length:e.length,file_length:e.file_length,fileInputId:e.fileInputId,to:e.to,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),apiUrl:e.apiUrl,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"video",file:e.file,filename:e.filename,length:e.length,file_length:e.file_length,fileInputId:e.fileInputId,to:e.to,from:e.from||"",ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Ve=function(){function e(e){var t=e.type,r=e.id;this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"file",file:e.file,filename:e.filename,fileInputId:e.fileInputId,to:e.to,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"file",file:e.file,filename:e.filename,fileInputId:e.fileInputId,file_length:e.file_length,to:e.to,from:e.from||"",ext:e.ext,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Je=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t,this.value=""}return e.create=function(e){return{type:"combine",id:_e.getUniqueId(),to:e.to,from:e.from||"",chatType:e.chatType,ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv,compatibleText:e.compatibleText,title:e.title,summary:e.summary,messageList:e.messageList,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete}},e}(),Ye=function(){function e(t,r){return this.type=t,this.id=r||_e.getUniqueId(),e.createOldMsg({type:t,id:this.id})}return e.createOldMsg=function(e){switch(e.type){case"read":return new xe({type:"read",id:e.id});case"delivery":return new Be({type:"delivery",id:e.id});case"channel":return new Ge({type:"channel",id:e.id});case"txt":return new je({type:"txt",id:e.id});case"cmd":return new He({type:"cmd",id:e.id});case"custom":return new Fe({type:"custom",id:e.id});case"loc":return new We({type:"loc",id:e.id});case"img":return new ze({type:"img",id:e.id});case"audio":return new qe({type:"audio",id:e.id});case"video":return new Ke({type:"video",id:e.id});case"file":return new Ve({type:"file",id:e.id})}},e.create=function(e){return"txt"!==(t=e).type||"version"in t?function(e){return"img"===e.type&&!("version"in e)}(e)?ze.create(e):function(e){return"cmd"===e.type&&!("version"in e)}(e)?He.create(e):function(e){return"file"===e.type&&!("version"in e)}(e)?Ve.create(e):function(e){return"audio"===e.type&&!("version"in e)}(e)?qe.create(e):function(e){return"video"===e.type&&!("version"in e)}(e)?Ke.create(e):function(e){return"custom"===e.type&&!("version"in e)}(e)?Fe.create(e):function(e){return"loc"===e.type&&!("version"in e)}(e)?We.create(e):function(e){return"channel"===e.type&&!("version"in e)}(e)?Ge.create(e):function(e){return"delivery"===e.type&&!("version"in e)}(e)?Be.create(e):function(e){return"read"===e.type&&!("version"in e)}(e)?xe.create(e):function(e){return"combine"===e.type&&!("version"in e)}(e)?Je.create(e):{}:je.create(e);var t},e.prototype.set=function(e){},e.getFileUrl=_e.getFileUrl,e.createImageMessage=function(e){return function(e){var t,r="image/gif"===e.file.filetype||(null===(t=e.file.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".gif")),n=r||!!e.isOriginalImage;return{id:_e.getUniqueId(),chatType:e.chatType,type:"img",to:e.to,from:e.from||"",file:{url:"",filename:e.file.filename,filetype:e.file.filetype||"",data:e.file.data||void 0},filename:e.file.filename,filetype:e.file.filetype||"",width:e.width,height:e.height,file_length:e.file.size,ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,isGif:r,isOriginalImage:n,_useInternalUpload:!!e.file.path||void 0,_filePath:e.file.path}}(e)},e.download=_e.download,e.parseDownloadResponse=_e.parseDownloadResponse,e}();!function(e){e[e.CREATE=0]="CREATE",e[e.FAIL=1]="FAIL",e[e.INPROGRESS=2]="INPROGRESS",e[e.SUCCESS=3]="SUCCESS"}(De||(De={}));var Xe,Qe=function(){return Qe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Qe.apply(this,arguments)},Ze=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},$e=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};!function(e){e["chat:user"]="singleChat",e["chat:group"]="groupChat",e["chat:room"]="chatRoom"}(Xe||(Xe={}));var et={0:"TEXT",1:"IMAGE",2:"VIDEO",3:"LOCATION",4:"VOICE",5:"FILE",6:"COMMAND",7:"CUSTOM",8:"COMBINE"};function rt(e){for(var t={},r=0;r<e.length;r++)if(8===e[r].type)t[e[r].key]=JSON.parse(e[r].stringValue);else if(7===e[r].type)t[e[r].key]=e[r].stringValue;else if(6===e[r].type)t[e[r].key]=e[r].doubleValue;else if(5===e[r].type)t[e[r].key]=e[r].floatValue;else if(1===e[r].type){var n=e[r].varintValue,o=new(f())(n.low,n.high,n.unsigned).toString();t[e[r].key]=0!==Number(o)}else 2!==e[r].type&&3!==e[r].type&&4!==e[r].type||(n=e[r].varintValue,o=new(f())(n.low,n.high,n.unsigned).toString(),t[e[r].key]=Number(o));return t}function nt(e){var t="";return e.remotePath&&(t=_e.formatAttachUrl.call(this,e.remotePath),e.remotePath.includes("?em-redirect")||(t="".concat(t,"?em-redirect=true"),e.secretKey&&(t="".concat(t,"&share-secret=").concat(e.secretKey)))),t}function ot(e,t,r){var n=_e.formatAttachUrl.call(this,e),o=n.indexOf("#"),i=o>=0?n.slice(0,o):n,a=o>=0?n.slice(o):"",s=i.indexOf("?"),c=s>=0?i.slice(0,s):i,u=s>=0?i.slice(s+1):"",l=u?u.split("&"):[],d=function(e){return l.some((function(t){return t.split("=")[0]===e}))};return r&&!d("size")&&l.push("size=".concat(r)),d("em-redirect")||l.push("em-redirect=true"),t&&!d("share-secret")&&l.push("share-secret=".concat(t)),"".concat(c).concat(l.length?"?".concat(l.join("&")):"").concat(a)}function it(e,t){var r,n,o=t.from&&t.from.name;if(o===this.context.userId){var i=null===(r=null==e?void 0:e.from)||void 0===r?void 0:r.clientResource;o===(null===(n=null==t?void 0:t.to)||void 0===n?void 0:n.name)&&i&&i!==this.clientResource&&(o="".concat(o,"/").concat(i))}return o}function at(e,t){var r,n=t.to&&t.to.name;return(null===(r=null==e?void 0:e.to)||void 0===r?void 0:r.clientResource)&&(n="".concat(n,"/").concat(e.to.clientResource)),n}function st(e){var t,r,n,o,i,a,s,c,u,l,d,h,p,f,m,g,v,E,y,_,T,I,O,R,C,S,N;return Ze(this,void 0,void 0,(function(){var b,A,M,w,U,L,P,D,k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z,$,ee,te,re,ne,oe,ie,ae,se,ce,ue,le,de,he,pe,fe,me,ge,ve,Ee,ye,Te,Ie,Oe,Re,Ce,Se,be;return $e(this,(function(Ae){switch(Ae.label){case 0:switch(b=e.status,A=e.thirdMessage,M=e.msgBody,w=e.msgId,U=e.type,L=e.from,P=e.to,D=e.time,k=e.onlineState,x=e.chatType,B=e.ignoreCallback,G=e.priority,H=e.format,F=e.broadcast,W=void 0!==F&&F,z=e.isContentReplaced,q=void 0!==z&&z,K=e.meta,V={},J={},Y=b.errorCode>0,X=b.errorCode,Q=b.reason,Z={},$=[],ee=[],te={},re=null,ne=null,ie=!1,ae=!1,A.ext&&(Z=rt(A.ext)),A.meta&&"string"==typeof A.meta&&((se=JSON.parse(A.meta)).reaction&&($=se.reaction).forEach((function(e){e.isAddedBySelf=e.state,delete e.state})),se.translations&&(ee=se.translations),se.edit_msg&&(ce=se.edit_msg,ue=ce.count,le=ce.operator,de=ce.edit_time,te={operationTime:de,operatorId:le,operationCount:ue}),se.thread&&"{}"!==JSON.stringify(se.thread)&&(re={messageId:se.thread.msg_parent_id,parentId:se.thread.muc_parent_id,chatThreadName:se.thread.thread_name}),se.thread_overview&&"{}"!==JSON.stringify(se.thread_overview)&&(ne={id:se.thread_overview.id,parentId:se.thread_overview.muc_parent_id,name:se.thread_overview.name,lastMessage:se.thread_overview.last_message&&"{}"!==JSON.stringify(se.thread_overview.last_message)?Ne.call(this,se.thread_overview.last_message):null,createTimestamp:se.thread_overview.create_timestamp,updateTimestamp:se.thread_overview.update_timestamp,messageCount:se.thread_overview.message_count||0}),se.isDelivered&&(ie=!0),se.isRead&&(ae=!0)),M.type){case 0:return[3,1];case 1:return[3,8];case 2:return[3,11];case 3:return[3,14];case 4:return[3,17];case 5:return[3,20];case 6:return[3,23];case 7:return[3,24];case 8:return[3,27]}return[3,28];case 1:return Object.prototype.hasOwnProperty.call(M,"subType")&&0===M.subType?(oe=nt.call(this,M),he={id:w,type:"combine",chatType:x,to:P,from:L,ext:Z,time:Number(D),onlineState:k,title:M.title||"",summary:M.summary||"",url:oe||"",secret:M.secretKey||"",file_length:M.fileLength||0,filename:M.displayName||"",compatibleText:M.text,combineLevel:M.combineLevel||0},V.msgConfig&&(he.msgConfig=V.msgConfig),$.length>0&&(he.reactions=$),re&&(he.chatThread=re),ne&&(he.chatThreadOverview=ne),"chatRoom"===x&&(he.priority=G,he.broadcast=W),te.operationCount>0&&(he.modifiedInfo=te),q&&(he.isContentReplaced=q),ae&&(he.isRead=!0),ie&&(he.isDelivered=!0),J=he,B?[3,3]:[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(he,De.SUCCESS)]):[3,4];case 2:Ae.sent(),null===(n=this.eventHandler)||void 0===n||n.dispatch("onCombineMessage",he),Ae.label=3;case 3:return[3,29];case 4:return Object.prototype.hasOwnProperty.call(M,"subType")&&10===M.subType&&A.stream?(pe=ke.call(this,M,A,K,w,L,P,D,x,k,Z,$,ee,te,re,ne,q,ae,ie,null!=B&&B),J=pe,[3,29]):[3,5];case 5:return!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,data:M.text,ext:Z,sourceMsg:M.text,time:D,msgConfig:A.msgConfig,onlineState:k}).msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onTextMessage&&this.onTextMessage(V),fe={id:w,type:"txt",chatType:x,msg:M.text,to:P,from:L,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(fe.msgConfig=V.msgConfig),$.length>0&&(fe.reactions=$),re&&(fe.chatThread=re),ne&&(fe.chatThreadOverview=ne),ee.length>0&&(fe.translations=ee),te.operationCount>0&&(fe.modifiedInfo=te),"chatRoom"===x&&(fe.priority=G,fe.broadcast=W),q&&(fe.isContentReplaced=q),ae&&(fe.isRead=!0),ie&&(fe.isDelivered=!0),J=fe,B?[3,7]:[4,null===(i=null===(o=this._localCache)||void 0===o?void 0:o.getInstance())||void 0===i?void 0:i.storeMessage(fe,De.SUCCESS)];case 6:Ae.sent(),null===(a=this.eventHandler)||void 0===a||a.dispatch("onTextMessage",fe),Ae.label=7;case 7:return[3,29];case 8:return me=(null===(s=null==M?void 0:M.size)||void 0===s?void 0:s.width)||0,ge=(null===(c=null==M?void 0:M.size)||void 0===c?void 0:c.height)||0,oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,thumb:this.useOwnUploadFun?"":"".concat(oe,"&thumbnail=true"),thumb_secret:M.secretKey,file_length:M.fileLength||"",width:me,height:ge,filetype:M.filetype||"",accessToken:this.token,ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onPictureMessage&&this.onPictureMessage(V),ve={id:w,type:"img",chatType:x,from:L,to:P,url:oe||"",width:me,height:ge,secret:M.secretKey||"",thumb:this.useOwnUploadFun?"":"".concat(oe,"&thumbnail=true"),thumb_secret:M.secretKey,file_length:M.fileLength||0,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(ve.msgConfig=V.msgConfig),$.length>0&&(ve.reactions=$),re&&(ve.chatThread=re),ne&&(ve.chatThreadOverview=ne),"chatRoom"===x&&(ve.priority=G,ve.broadcast=W),te.operationCount>0&&(ve.modifiedInfo=te),q&&(ve.isContentReplaced=q),ae&&(ve.isRead=!0),ie&&(ve.isDelivered=!0),Object.prototype.hasOwnProperty.call(M,"subType")&&1===M.subType&&(ve.isGif=!0),ve.isOriginalImage=!(2===M.imageType&&!ve.isGif),M.remotePath&&!this.useOwnUploadFun?(ve.originalImageUrl=ot.call(this,M.remotePath,M.secretKey),ve.bigImageUrl=ot.call(this,M.remotePath,M.secretKey,"large"),ve.thumb="".concat(oe,"&thumbnail=true")):M.remotePath&&this.useOwnUploadFun&&(ve.originalImageUrl=M.remotePath),J=ve,B?[3,10]:[4,null===(l=null===(u=this._localCache)||void 0===u?void 0:u.getInstance())||void 0===l?void 0:l.storeMessage(ve,De.SUCCESS)];case 9:Ae.sent(),null===(d=this.eventHandler)||void 0===d||d.dispatch("onImageMessage",ve),Ae.label=10;case 10:return[3,29];case 11:return oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,length:M.duration||"",file_length:M.fileLength||"",filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onVideoMessage&&this.onVideoMessage(V),Ee={id:w,type:"video",chatType:x,from:L,to:P,url:oe,secret:M.secretKey,thumb:_e.formatAttachUrl.call(this,M.thumbnailRemotePath),thumb_secret:M.thumbnailSecretKey,filename:M.displayName,length:M.duration||0,file:{},file_length:M.fileLength||0,filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Ee.msgConfig=V.msgConfig),$.length>0&&(Ee.reactions=$),re&&(Ee.chatThread=re),ne&&(Ee.chatThreadOverview=ne),"chatRoom"===x&&(Ee.priority=G,Ee.broadcast=W),te.operationCount>0&&(Ee.modifiedInfo=te),q&&(Ee.isContentReplaced=q),ae&&(Ee.isRead=!0),ie&&(Ee.isDelivered=!0),J=Ee,B?[3,13]:[4,null===(p=null===(h=this._localCache)||void 0===h?void 0:h.getInstance())||void 0===p?void 0:p.storeMessage(Ee,De.SUCCESS)];case 12:Ae.sent(),null===(f=this.eventHandler)||void 0===f||f.dispatch("onVideoMessage",Ee),Ae.label=13;case 13:return[3,29];case 14:return!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,addr:M.address,buildingName:M.buildingName,lat:M.latitude,lng:M.longitude,ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onLocationMessage&&this.onLocationMessage(V),ye={id:w,type:"loc",chatType:x,from:L,to:P,buildingName:M.buildingName,addr:M.address,lat:M.latitude,lng:M.longitude,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(ye.msgConfig=V.msgConfig),$.length>0&&(ye.reactions=$),re&&(ye.chatThread=re),ne&&(ye.chatThreadOverview=ne),"chatRoom"===x&&(ye.priority=G,ye.broadcast=W),te.operationCount>0&&(ye.modifiedInfo=te),q&&(ye.isContentReplaced=q),ae&&(ye.isRead=!0),ie&&(ye.isDelivered=!0),J=ye,B?[3,16]:[4,null===(g=null===(m=this._localCache)||void 0===m?void 0:m.getInstance())||void 0===g?void 0:g.storeMessage(ye,De.SUCCESS)];case 15:Ae.sent(),null===(v=this.eventHandler)||void 0===v||v.dispatch("onLocationMessage",ye),Ae.label=16;case 16:return[3,29];case 17:return oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,file_length:M.fileLength||"",accessToken:this.token||"",ext:Z,length:M.duration,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onAudioMessage&&this.onAudioMessage(V),Te={id:w,type:"audio",chatType:x,from:L,to:P,url:oe,secret:M.secretKey,file:{},filename:M.displayName,length:M.duration||0,file_length:M.fileLength||0,filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Te.msgConfig=V.msgConfig),$.length>0&&(Te.reactions=$),re&&(Te.chatThread=re),ne&&(Te.chatThreadOverview=ne),"chatRoom"===x&&(Te.priority=G,Te.broadcast=W),te.operationCount>0&&(Te.modifiedInfo=te),q&&(Te.isContentReplaced=q),ae&&(Te.isRead=!0),ie&&(Te.isDelivered=!0),J=Te,B?[3,19]:[4,null===(y=null===(E=this._localCache)||void 0===E?void 0:E.getInstance())||void 0===y?void 0:y.storeMessage(Te,De.SUCCESS)];case 18:Ae.sent(),null===(_=this.eventHandler)||void 0===_||_.dispatch("onAudioMessage",Te),Ae.label=19;case 19:return[3,29];case 20:return oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,file_length:M.fileLength,accessToken:this.token||"",ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onFileMessage&&this.onFileMessage(V),Ie={id:w,type:"file",chatType:x,from:L,to:P,url:oe,secret:M.secretKey,file:{},filename:M.displayName,length:M.duration||0,file_length:M.fileLength||0,filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Ie.msgConfig=V.msgConfig),$.length>0&&(Ie.reactions=$),re&&(Ie.chatThread=re),ne&&(Ie.chatThreadOverview=ne),"chatRoom"===x&&(Ie.priority=G,Ie.broadcast=W),te.operationCount>0&&(Ie.modifiedInfo=te),q&&(Ie.isContentReplaced=q),ae&&(Ie.isRead=!0),ie&&(Ie.isDelivered=!0),J=Ie,B?[3,22]:[4,null===(I=null===(T=this._localCache)||void 0===T?void 0:T.getInstance())||void 0===I?void 0:I.storeMessage(Ie,De.SUCCESS)];case 21:Ae.sent(),null===(O=this.eventHandler)||void 0===O||O.dispatch("onFileMessage",Ie),Ae.label=22;case 22:return[3,29];case 23:return!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,action:M.action,ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onCmdMessage&&this.onCmdMessage(V),Oe={id:w,type:"cmd",chatType:x,from:L,to:P,action:M.action,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Oe.msgConfig=V.msgConfig),$.length>0&&(Oe.reactions=$),re&&(Oe.chatThread=re),ne&&(Oe.chatThreadOverview=ne),"chatRoom"===x&&(Oe.priority=G,Oe.broadcast=W),te.operationCount>0&&(Oe.modifiedInfo=te),q&&(Oe.isContentReplaced=q),ae&&(Oe.isRead=!0),ie&&(Oe.isDelivered=!0),J=Oe,B||null===(R=this.eventHandler)||void 0===R||R.dispatch("onCmdMessage",Oe),[3,29];case 24:return Re={},Ce={},A.contents[0].customExts&&(Re=rt(A.contents[0].customExts)),A.contents[0].params&&(Ce=rt(A.contents[0].params)),V={id:w,type:U,contentsType:et[M.type],from:L,to:P,customEvent:M.customEvent,params:Ce,customExts:Re,ext:Z,time:D,onlineState:k},!B&&this.onCustomMessage&&this.onCustomMessage(V),Se={id:w,type:"custom",chatType:x,from:L,to:P,customEvent:M.customEvent,params:Ce,customExts:Re,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Se.msgConfig=V.msgConfig),$.length>0&&(Se.reactions=$),re&&(Se.chatThread=re),ne&&(Se.chatThreadOverview=ne),te.operationCount>0&&(Se.modifiedInfo=te),"chatRoom"===x&&(Se.priority=G,Se.broadcast=W),q&&(Se.isContentReplaced=q),ae&&(Se.isRead=!0),ie&&(Se.isDelivered=!0),J=Se,B?[3,26]:[4,null===(S=null===(C=this._localCache)||void 0===C?void 0:C.getInstance())||void 0===S?void 0:S.storeMessage(Se,De.SUCCESS)];case 25:Ae.sent(),null===(N=this.eventHandler)||void 0===N||N.dispatch("onCustomMessage",Se),Ae.label=26;case 26:return[3,29];case 27:return oe=nt.call(this,M),be={id:w,type:"combine",chatType:x,to:P,from:L,ext:Z,time:Number(D),onlineState:k,title:M.title||"",summary:M.summary||"",url:oe||"",secret:M.secretKey||"",file_length:M.fileLength||0,filename:M.displayName||"",compatibleText:M.text,combineLevel:M.combineLevel||0},V.msgConfig&&(be.msgConfig=V.msgConfig),$.length>0&&(be.reactions=$),re&&(be.chatThread=re),ne&&(be.chatThreadOverview=ne),"chatRoom"===x&&(be.priority=G,be.broadcast=W),te.operationCount>0&&(be.modifiedInfo=te),q&&(be.isContentReplaced=q),ae&&(be.isRead=!0),ie&&(be.isDelivered=!0),J=be,!B&&this.eventHandler&&this.eventHandler.dispatch("onCombineMessage",be),[3,29];case 28:return j.error("Unknow message type, message:",M),[3,29];case 29:return H?[2,J]:[2,V]}}))}))}function ct(e,t,r){if(this.delivery&&e!==t){var n=this.getUniqueId(),o=new Ye("delivery",n);o.set({ackId:r,to:e}),j.debug("send delivery ack"),this.send(o.body)}}var ut=function(e,t,r,n,o){var i,a,s,c,u,l,d,h,p,m,g,v,E,y,_,T,I,O,R,C,S,N,b,A,M,w,U,L,P,D;return Ze(this,void 0,void 0,(function(){var k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z,$,ee,te,re,ne,oe,ie,ae,se,ce,ue,le,de,he,pe,fe,me,ge,ve,Ee,ye,Te,Ie,Oe,Re,Ce,Se,Ne,be;return $e(this,(function(we){switch(we.label){case 0:if(k=new(f())(e.timestamp.low,e.timestamp.high,e.timestamp.unsigned).toString(),x=this.root.lookup("easemob.pb.MessageBody"),B=x.decode(e.payload),G=3,H=!1,F=new(f())(e.id.low,e.id.high,e.id.unsigned).toString(),o&&e.from&&e.from.name===this.context.userId&&e.from.clientResource===this.clientResource&&B.type===sr.CHATROOM)return[2,j.debug("Discard your own chat room message:",F)];if(W=(null===(i=e.from)||void 0===i?void 0:i.name)||"",z=e.to?e.to.name:"",q=!!e.to&&-1!==e.to.domain.indexOf("conference"),this._load_msg_cache.some((function(e){return e.msgId===F}))&&10!==B.contents[0].subType&&!r)return[2,j.debug("Discard message in cache:",F)];if(this._load_msg_cache.length<=this.max_cache_length||this._load_msg_cache.shift(),this._load_msg_cache.push({msgId:F,from:W,to:z,isGroup:q}),e.meta&&e.meta.length){if(K=_e.parseNotify(e.meta),V=K.is_online,J=K.callback_replace,this.useReplacedMessageContents&&J&&(H=!0),V||0===V)switch(V){case 0:G=0;break;case 1:G=1;break;default:G=2}}else G=3;switch(Y=B.ackMessageId?new(f())(B.ackMessageId.low,B.ackMessageId.high,B.ackMessageId.unsigned).toString():"",X="",Q=it.call(this,e,B),Z=at.call(this,e,B),j.debug("received message:",{metaId:F,metaNs:e.ns,type:B.type,from:Q,to:Z,contentType:null===(s=null===(a=B.contents)||void 0===a?void 0:a[0])||void 0===s?void 0:s.type,contentLen:null===(c=B.contents)||void 0===c?void 0:c.length}),B.type){case sr.SINGLECHAT:return[3,1];case sr.GROUPCHAT:return[3,2];case sr.CHATROOM:return[3,3];case sr.READ_ACK:return[3,4];case sr.DELIVER_ACK:return[3,5];case sr.RECALL:return[3,6];case sr.CHANNEL_ACK:return[3,15];case sr.EDIT:return[3,16]}return[3,20];case 1:return X="chat","agoraToken"===this.grantType&&(X="singleChat"),this.delivery&&!r&&Q!==this.context.userId&&10!==(null===(u=B.contents[0])||void 0===u?void 0:u.subType)&&ct.call(this,Q,Z,F),[3,21];case 2:return X="groupchat","agoraToken"===this.grantType&&(X="groupChat"),[3,21];case 3:return X="chatroom","agoraToken"===this.grantType&&(X="chatRoom"),G=1,[3,21];case 4:return X="read_ack",$=void 0,B.ext[0]&&JSON.parse(B.ext[0].stringValue)?($={id:F,type:"read",from:Q,to:Z,mid:Y,groupReadCount:B.ext[0]&&JSON.parse(B.ext[0].stringValue),ackContent:B.ackContent,onlineState:G},this.onReadMessage&&this.onReadMessage($),null===(l=this.eventHandler)||void 0===l||l.dispatch("onReadMessage",$),[2]):($={id:F,type:"read",from:Q,to:Z,mid:Y,onlineState:G},this.onReadMessage&&this.onReadMessage($),null===(d=this.eventHandler)||void 0===d||d.dispatch("onReadMessage",$),[2]);case 5:return X="deliver_ack",this.onDeliveredMessage&&this.onDeliveredMessage({id:F,type:"delivery",from:Q,to:Z,mid:Y,onlineState:G}),ee={id:F,type:"delivery",from:Q,to:Z,mid:Y,onlineState:G},null===(h=this.eventHandler)||void 0===h||h.dispatch("onDeliveredMessage",ee),[2];case 6:return X="recall",te="",e.ext&&(te=(null===(p=rt(e.ext))||void 0===p?void 0:p.recallMessageExtensionInfo)||""),re={id:F,from:Q||"admin",to:Z,mid:Y,ext:te,onlineState:G},ne=Z===this.user?Q:Z,[4,null===(g=null===(m=this._localCache)||void 0===m?void 0:m.getInstance())||void 0===g?void 0:g.getMessageByServerMsgId(re.mid)];case 7:return(oe=we.sent())?[4,null===(E=null===(v=this._localCache)||void 0===v?void 0:v.getInstance())||void 0===E?void 0:E.removeMsgByServerMsgId(re.mid)]:[3,9];case 8:we.sent(),we.label=9;case 9:return"singleChat"!==(null==oe?void 0:oe.chatType)&&"groupChat"!==(null==oe?void 0:oe.chatType)?[3,14]:(ie=(null==oe?void 0:oe.from)===this.user||""===(null==oe?void 0:oe.from),[4,null===(_=null===(y=this._localCache)||void 0===y?void 0:y.getInstance())||void 0===_?void 0:_.getConversationLastMessage(ne,oe.chatType)]);case 10:return ae=we.sent(),[4,null===(I=null===(T=this._localCache)||void 0===T?void 0:T.getInstance())||void 0===I?void 0:I.getConversationBySessionId(Ae({conversationId:ne,conversationType:oe.chatType}))];case 11:return(se=we.sent())?[4,null===(R=null===(O=this._localCache)||void 0===O?void 0:O.getInstance())||void 0===R?void 0:R.updateLocalConversation(Ae({conversationId:ne,conversationType:oe.chatType}),{lastMessageId:null==ae?void 0:ae.serverMsgId,unReadCount:Me({conversation:se,isRecallSelfMsg:ie,recalledMsgTime:oe.time})})]:[3,13];case 12:we.sent(),we.label=13;case 13:we.label=14;case 14:return this.onRecallMessage&&this.onRecallMessage(re),null===(C=this.eventHandler)||void 0===C||C.dispatch("onRecallMessage",re),[2];case 15:return this.onChannelMessage&&this.onChannelMessage({id:F,mid:Y,type:"channel",chatType:"singleChat",from:Q,to:Z,time:Number(k),onlineState:G}),ce={id:F,mid:Y,type:"channel",chatType:"singleChat",from:Q,to:Z,time:Number(k),onlineState:G},null===(S=this.eventHandler)||void 0===S||S.dispatch("onChannelMessage",ce),[2];case 16:return ue={errorCode:0,reason:""},le="",de=0,he="",B.meta&&"string"==typeof B.meta&&(pe=JSON.parse(B.meta)).edit_msg&&(fe=pe.edit_msg,me=fe.sender,ge=fe.send_time,ve=fe.chat_type,le=me,de=ge,he=Xe[ve]),Ee=B.editMessageId&&new(f())(B.editMessageId.low,B.editMessageId.high,B.editMessageId.unsigned).toString(),ye=B.editScope,[4,st.call(this,{status:ue,thirdMessage:B,msgBody:B.contents[0],msgId:Ee,type:X,from:le,to:Z,time:de,onlineState:G,ignoreCallback:!0,format:!0,isContentReplaced:H})];case 17:return(Te=we.sent()).chatType=he,e.ignoreCallback?[2,Te]:Te?[4,null===(b=null===(N=this._localCache)||void 0===N?void 0:N.getInstance())||void 0===b?void 0:b.getMessageByServerMsgId(Te.id)]:[3,19];case 18:(Ie=we.sent())&&(Oe=Ie.ext||{},(ye===cr.BODY_AND_EXT||Object.keys(Te.ext||{}).length>0)&&(Oe=Te.ext),"txt"===Te.type&&"txt"===Ie.type?null===(M=null===(A=this._localCache)||void 0===A?void 0:A.getInstance())||void 0===M||M.putMessageToDB(Qe(Qe({},Ie),{msg:Te.msg,modifiedInfo:Te.modifiedInfo,translations:Te.translations,ext:Oe})):"custom"===Te.type&&"custom"===Ie.type?null===(U=null===(w=this._localCache)||void 0===w?void 0:w.getInstance())||void 0===U||U.putMessageToDB(Qe(Qe({},Ie),{ext:Oe,customExts:Te.customExts,customEvent:Te.customEvent,modifiedInfo:Te.modifiedInfo})):null===(P=null===(L=this._localCache)||void 0===L?void 0:L.getInstance())||void 0===P||P.putMessageToDB(Qe(Qe({},Ie),{ext:Oe,modifiedInfo:Te.modifiedInfo}))),we.label=19;case 19:return null===(D=this.eventHandler)||void 0===D||D.dispatch("onModifiedMessage",Te),[2];case 20:return j.error("unexpected message type: ".concat(B.type)),[2];case 21:Re="normal",Se=!1,"chat"===X.toLowerCase()||"singleChat"===X?Ce="singleChat":"groupchat"===X.toLowerCase()||"groupChat"===X?Ce="groupChat":(Ce="chatRoom",G=1,e.ext&&(Ne=rt(e.ext),Se=!!(null==Ne?void 0:Ne.is_broadcast),Re=0===Ne.chatroom_msg_tag?"high":2===Ne.chatroom_msg_tag?"low":"normal")),be=0,we.label=22;case 22:return be<B.contents.length?[4,st.call(this,{status:t,thirdMessage:B,msgBody:B.contents[be],msgId:F,type:X,from:Q,to:Z,time:k,onlineState:G,chatType:Ce,ignoreCallback:r,priority:Re,format:n,broadcast:Se,isContentReplaced:H,meta:e})]:[3,25];case 23:return[2,we.sent()];case 24:return be++,[3,22];case 25:return[2]}}))}))},lt=function(){return lt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},lt.apply(this,arguments)},dt=["public","members_only","allow_user_invites","invite_need_confirm"],ht={name:"name",title:"name",description:"description",public:"public",members_only:"approval",allow_user_invites:"allowInvites",max_users:"maxUsers",invite_need_confirm:"inviteNeedConfirm",custom:"ext",last_modified:"lastModified",avatar:"avatar"};function pt(e,t){var r,n,o,i,a,s,c=this,u=this.context,l=u.userId,d=u.jid,h=t.from.name===l&&d.clientResource!==t.from.clientResource;return t.isThread?(o={id:t.mucId.name,name:t.mucName,operation:"",parentId:t.mucParentId.name,operator:t.from.name,userName:t.to.length?t.to[0].name:""},i={chatThreadId:t.mucId.name,chatThreadName:t.mucName,operation:"",parentId:t.mucParentId.name}):(n={type:"",owner:t.from.name,gid:t.mucId.name,from:t.from.name,fromJid:t.from,to:t.to.length?t.to[0].name:"",toJid:t.to,chatroom:t.isChatroom,status:t.status},a={operation:"",id:t.mucId.name,from:t.from.name},t.isChatroom&&(null===(r=null==t?void 0:t.eventInfo)||void 0===r?void 0:r.ext)&&(s=JSON.parse(t.eventInfo.ext))),({45:function(){var e,r,n;a.operation="memberAttributesUpdate";var o=JSON.parse(null===(e=null==t?void 0:t.eventInfo)||void 0===e?void 0:e.ext)||{};a.attributes=o.properties||{},a.userId=o.username||"",h?null===(r=c.eventHandler)||void 0===r||r.dispatch("onMultiDeviceEvent",a):null===(n=c.eventHandler)||void 0===n||n.dispatch("onGroupEvent",a)},44:function(){var e;a.operation="removeChatRoomAttributes",a.attributes=s.result.successKeys,s.result.successKeys.length>0&&(null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomEvent",a))},43:function(){var e;a.operation="updateChatRoomAttributes";var t={};s.result.successKeys.forEach((function(e){t[e]=s.properties[e]})),a.attributes=t,s.result.successKeys.length>0&&(null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomEvent",a))},42:function(){},41:function(){},40:function(){},39:function(){},38:function(){var e;i.operation="chatThreadNameUpdate",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},37:function(){var e;o.operation="userRemove",null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatThreadChange",o)},36:function(){var e;i.operation="chatThreadLeave",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},35:function(){var e;i.operation="chatThreadJoin",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},34:function(){var e;i.operation="chatThreadDestroy",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},33:function(){var e;i.operation="chatThreadCreate",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},32:function(){var e,r,o,i;n.type=t.isChatroom?"rmChatRoomMute":"rmGroupMute",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="unmuteAllMembers",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},31:function(){var e,r,o,i;n.type=t.isChatroom?"muteChatRoom":"muteGroup",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="muteAllMembers",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},30:function(){var e,r,o,i;n.type=t.isChatroom?"rmUserFromChatRoomWhiteList":"rmUserFromGroupWhiteList",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="removeAllowlistMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},29:function(){var e,r,o,i;n.type=t.isChatroom?"addUserToChatRoomWhiteList":"addUserToGroupWhiteList",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="addUserToAllowlist",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},28:function(){var e,r,o,i;n.type="deleteFile",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="deleteFile",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},27:function(){var e,r,o,i;n.type="uploadFile",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="uploadFile",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},26:function(){var e,r,o,i;n.type="deleteAnnouncement",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="deleteAnnouncement",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},25:function(){var e,r,o,i;n.type="updateAnnouncement",n.announcement=t.reason,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="updateAnnouncement",a.announcement=t.reason,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},24:function(){var e,r,o,i;n.type="removeMute",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="unmuteMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},23:function(){var e,r,o,i;if(n.type="addMute",c.onPresence&&c.onPresence(n),t.ext&&"string"==typeof t.ext){var s=JSON.parse(t.ext);s.user_mute_time&&(n.muteTimestamp=s.user_mute_time,a.muteTimestamp=s.user_mute_time)}t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="muteMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},22:function(){var e,r,o,i;n.type="removeAdmin",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="removeAdmin",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},21:function(){var e,r,o,i;n.type="addAdmin",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="setAdmin",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},20:function(){var e,r,o,i;n.type="changeOwner",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="changeOwner",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},19:function(){var e,r,o,i;n.type="direct_joined",n.groupName=t.mucName,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="directJoined",a.name=t.mucName,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},18:function(){var e,r,o,i,s;n.type=t.isChatroom?"leaveChatRoom":"leaveGroup",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n);var u=t.mucMemberCount;if(u&&(a.memberCount=u),a.operation="memberAbsence",t.members&&t.members.length>0){var l=lt({},a);l.members=t.members,l.operation="membersAbsence",delete l.from,t.isChatroom?t.members.forEach((function(e){var t;null===(t=c.eventHandler)||void 0===t||t.dispatch("onChatroomEvent",lt(lt({},a),{from:e}))})):null===(o=c.eventHandler)||void 0===o||o.dispatch("onGroupEvent",l)}else t.isChatroom?null===(i=c.eventHandler)||void 0===i||i.dispatch("onChatroomEvent",a):null===(s=c.eventHandler)||void 0===s||s.dispatch("onGroupEvent",a)},17:function(){var e,r,o,i,s;t.isChatroom&&t.ext&&(a.ext=t.ext,n.ext=t.ext),n.type=t.isChatroom?"memberJoinChatRoomSuccess":"memberJoinPublicGroupSuccess",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n);var u=t.mucMemberCount;if(a.operation="memberPresence",u&&(a.memberCount=u),t.members&&t.members.length>0){var l=lt({},a);l.members=t.members,l.operation="membersPresence",delete l.from,t.isChatroom?t.members.forEach((function(e){var t;null===(t=c.eventHandler)||void 0===t||t.dispatch("onChatroomEvent",lt(lt({},a),{from:e}))})):null===(o=c.eventHandler)||void 0===o||o.dispatch("onGroupEvent",l)}else t.isChatroom?null===(i=c.eventHandler)||void 0===i||i.dispatch("onChatroomEvent",a):null===(s=c.eventHandler)||void 0===s||s.dispatch("onGroupEvent",a)},16:function(){var e,r;n.type="unblock",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},15:function(){var e,r;n.type="block",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},14:function(){var e,r,o,i,s,u=t.isChatroom;if(!u){var l=JSON.parse((null===(e=null==t?void 0:t.eventInfo)||void 0===e?void 0:e.ext)||"{}",(function(e,t){return"last_modified"===e?Number(t):dt.includes(e)?"true"===t||!0===t:t}));a.detail=n.detail={},Object.keys(l).forEach((function(e){var t=ht[e];if(t){var r=l[e];a.detail&&(a.detail[t]=r),n.detail&&(n.detail[t]=r)}}))}n.type="update",c.onPresence&&c.onPresence(n),u?null===(r=c.eventHandler)||void 0===r||r.dispatch("onChatroomChange",n):null===(o=c.eventHandler)||void 0===o||o.dispatch("onGroupChange",n),a.operation="updateInfo",u?null===(i=c.eventHandler)||void 0===i||i.dispatch("onChatroomEvent",a):null===(s=c.eventHandler)||void 0===s||s.dispatch("onGroupEvent",a)},13:function(){var e,r,o,i;n.type="allow",n.reason=t.reason,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),t.reason&&(a.reason=t.reason),a.operation="unblockMember",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},12:function(){var e,r;n.type="ban",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},11:function(){var e,r;n.type="getBlackList",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},10:function(){var e,r,o,i;n.type="removedFromGroup",n.kicked=n.to,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="removeMember",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},9:function(){var e,r,o,i;n.type="invite_decline",n.kicked=n.to,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="rejectInvite",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},8:function(){var e,r,o,i;n.type="invite_accept",n.kicked=n.to,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="acceptInvite",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},7:function(){var e,r,o,i;n.type="invite",n.kicked=n.to,n.groupName=t.mucName,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="inviteToJoin",a.name=t.mucName,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},6:function(){var e,r,o,i;n.type="joinPublicGroupDeclined",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="joinPublicGroupDeclined",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):(a.userId=t.to.length?t.to[0].name:"",null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a))},5:function(){var e,r,o,i;n.type="joinPublicGroupSuccess",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="acceptRequest",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},4:function(){var e,r,o,i;n.type="joinGroupNotifications",n.reason=t.reason,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),t.reason&&(a.reason=t.reason),a.operation="requestToJoin",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},3:function(){var e,r;n.type="leave",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},2:function(){var e,r;n.type="join",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},1:function(){var e,r,o,i;n.type="deleteGroupChat",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="destroy",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},0:function(){var e,r;a.operation="create",t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomEvent",a):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupEvent",a)}}[e]||function(){console.error("No match operation ".concat(e))})()}var ft,mt=function(e){var t=this.root.lookup("easemob.pb.MUCBody").decode(e.payload),r=t.operation;j.debug("onMucMessage",t),pt.call(this,r,t)},gt={handleRosterMsg:function(e){var t,r,n,o,i,a,s=this.root.lookup("easemob.pb.RosterBody").decode(e.payload),c={type:"",to:s.to[0].name,from:s.from.name,status:s.reason};switch(s.operation){case 2:c.type="subscribe",this.onContactInvited&&this.onContactInvited(c),null===(t=this.eventHandler)||void 0===t||t.dispatch("onContactInvited",c);break;case 3:c.type="unsubscribed",this.onContactDeleted&&this.onContactDeleted(c),null===(r=this.eventHandler)||void 0===r||r.dispatch("onContactDeleted",c);break;case 4:c.type="subscribed",this.onContactAdded&&this.onContactAdded(c),null===(n=this.eventHandler)||void 0===n||n.dispatch("onContactAdded",c);break;case 5:c.type="unsubscribed",this.onContactRefuse&&this.onContactRefuse(c),null===(o=this.eventHandler)||void 0===o||o.dispatch("onContactRefuse",c);break;case 6:case 7:break;case 8:c.type="subscribed",this.onContactAgreed&&this.onContactAgreed(c),null===(i=this.eventHandler)||void 0===i||i.dispatch("onContactAgreed",c);break;case 9:c.type="unsubscribed",this.onContactRefuse&&this.onContactRefuse(c),null===(a=this.eventHandler)||void 0===a||a.dispatch("onContactRefuse",c);break;default:j.error("handleRosterMsg:",s)}this.onPresence&&c.type&&this.onPresence(c)}},vt=function(e){var t,r,n,o,i,a,s=this.root.lookup("easemob.pb.StatisticsBody").decode(e.payload),c=s.operation,u=s.reason;switch(c){case 0:this.onStatisticMessage&&this.onStatisticMessage(s),null===(t=this.eventHandler)||void 0===t||t.dispatch("onStatisticMessage",s);break;case 1:a=m.create({type:d.WEBIM_CONNCTION_USER_REMOVED,message:"user has been removed"}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(r=this.eventHandler)||void 0===r||r.dispatch("onError",a),Le.clearAll();break;case 2:a=m.create({type:d.WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE,message:"the user is already logged on another device"}),u&&(a.data={loginInfoCustomExt:s.reason}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(n=this.eventHandler)||void 0===n||n.dispatch("onError",a),Le.clearAll();break;case 3:a=m.create({type:d.WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD,message:"the user was kicked by changing password"}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(o=this.eventHandler)||void 0===o||o.dispatch("onError",a),Le.clearAll();break;case 4:a=m.create({type:d.WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE,message:"the user was kicked by other device"}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(i=this.eventHandler)||void 0===i||i.dispatch("onError",a),Le.clearAll();break;default:j.error("handleStatisticsMsg:",s)}};function Et(e){var t,r=[],n=[],o=e.data;o&&o.values&&o.values.forEach((function(e){Object.entries(e.status).forEach((function(e){n.push({device:e[0],status:Number(e[1])})})),r.push({userId:e.uid,lastTime:Number(e.last_time),expire:Number(e.expiry),ext:e.ext,statusDetails:n})})),this.onPresenceStatusChange&&this.onPresenceStatusChange(r),null===(t=this.eventHandler)||void 0===t||t.dispatch("onPresenceStatusChange",r)}function yt(e){var t=this;e.data.forEach((function(e){var r,n={from:e.from,to:e.to,chatType:"chat"===e.channel_type?"singleChat":"groupChat",messageId:e.messageId,reactions:e.reactions,ts:e.ts};null===(r=t.eventHandler)||void 0===r||r.dispatch("onReactionChange",n)}))}function _t(e){var t,r,n,o;if(e.data){var i=e.data,a={id:i.id||"",name:i.name||"",parentId:i.muc_parent_id||"",messageId:i.msg_parent_id||"",timestamp:i.timestamp||0,operator:i.from||"",operation:""};switch(i.operation){case"create":a.operation="create",a.createTimestamp=a.timestamp,a.messageCount=0,null===(t=this.eventHandler)||void 0===t||t.dispatch("onChatThreadChange",a);break;case"update_msg":a.operation="update",a.messageCount=i.message_count,i.last_message&&"{}"!==JSON.stringify(i.last_message)?a.lastMessage=Ne.call(this,i.last_message):"{}"===JSON.stringify(i.last_message)&&(a.lastMessage={}),null===(r=this.eventHandler)||void 0===r||r.dispatch("onChatThreadChange",a);break;case"update":a.operation="update",a.messageCount=i.message_count,null===(n=this.eventHandler)||void 0===n||n.dispatch("onChatThreadChange",a);break;case"delete":a.operation="destroy",null===(o=this.eventHandler)||void 0===o||o.dispatch("onChatThreadChange",a)}}}function Tt(e){var t,r=e.data;if(r.resource!==this.clientResource){var n={operation:"deleteRoaming",conversationId:r.to,chatType:"chat"===r.chatType?"singleChat":"groupChat",resource:r.resource};null===(t=this.eventHandler)||void 0===t||t.dispatch("onMultiDeviceEvent",n)}}function It(e){var t,r,n=e.data,o="";if(this.clientResource!==n.res||n.from!==this.user){switch(n.op){case"del":o="deleteConversation";break;case"top":o="pinnedConversation";break;case"not_top":o="unpinnedConversation";break;case"mark":o="markConversation";break;case"mark_delete":o="unMarkConversation";break;case"pin":o="pin";break;case"pin_delete":o="unpin";break;default:return void j.error("unexpected conversation op:",n.op)}if("pin"!==o&&"unpin"!==o){var i={operation:o,conversationId:n.id,conversationType:"chat"===n.type?"singleChat":"groupChat",timestamp:n.ts};"markConversation"!==i.operation&&"unMarkConversation"!==i.operation||n.ext&&(i.conversationMark=ft[n.ext]),null===(r=this.eventHandler)||void 0===r||r.dispatch("onMultiDeviceEvent",i)}else{var a=n.ext,s=n.from,c=n.id,u=n.type,l=n.ts,d={messageId:a||"",conversationId:"chat"===u?s:c,conversationType:Se[u],operation:o,operatorId:s,time:l};null===(t=this.eventHandler)||void 0===t||t.dispatch("onMessagePinEvent",d)}}}function Ot(e){var t,r=this;null===(t=e.values)||void 0===t||t.forEach((function(e){var t,n,o,i,a;if(e.operator_resource!==r.clientResource)if("ignoreInterval"in e.data){var s={operation:"setSilentModeForUser",resource:e.operator_resource,data:e.data};null===(t=r.eventHandler)||void 0===t||t.dispatch("onMultiDeviceEvent",s)}else"group"in e?(s={operation:0===Object.keys(null!==(n=e.data)&&void 0!==n?n:{}).length?"removeSilentModeForConversation":"setSilentModeForConversation",resource:e.operator_resource,conversationId:e.group,type:"groupChat",data:e.data},null===(o=r.eventHandler)||void 0===o||o.dispatch("onMultiDeviceEvent",s)):(s={operation:0===Object.keys(null!==(i=e.data)&&void 0!==i?i:{}).length?"removeSilentModeForConversation":"setSilentModeForConversation",resource:e.operator_resource,conversationId:e.user,type:"singleChat",data:e.data},null===(a=r.eventHandler)||void 0===a||a.dispatch("onMultiDeviceEvent",s))}))}!function(e){e[e.mark_0=0]="mark_0",e[e.mark_1=1]="mark_1",e[e.mark_2=2]="mark_2",e[e.mark_3=3]="mark_3",e[e.mark_4=4]="mark_4",e[e.mark_5=5]="mark_5",e[e.mark_6=6]="mark_6",e[e.mark_7=7]="mark_7",e[e.mark_8=8]="mark_8",e[e.mark_9=9]="mark_9",e[e.mark_10=10]="mark_10",e[e.mark_11=11]="mark_11",e[e.mark_12=12]="mark_12",e[e.mark_13=13]="mark_13",e[e.mark_14=14]="mark_14",e[e.mark_15=15]="mark_15",e[e.mark_16=16]="mark_16",e[e.mark_17=17]="mark_17",e[e.mark_18=18]="mark_18",e[e.mark_19=19]="mark_19"}(ft||(ft={}));var Rt=function(e){var t=_e.parseNotify(e.payload);switch(t.type){case"presence":Et.call(this,t);break;case"reaction":yt.call(this,t);break;case"thread":_t.call(this,t);break;case"roaming_delete":Tt.call(this,t);break;case"conv":It.call(this,t);break;case"user_notification_mute":Ot.call(this,t);break;default:j.error("unexpected notify type: ".concat(t.type))}};function Ct(){var e=this.context.appName,t=this.context.orgName;return!(!e||!t)||(this.onError&&this.onError({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function St(){var e,t=this.context.accessToken;if(!t){var r=m.create({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return j.debug("token not assign error",t),this.onError&&this.onError(r),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",r),!1}return!0}function Nt(){if(this._initWithAppId){if(!Ct.call(this))return{error:m.create({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"})};if(!St.call(this))return{error:m.create({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"})}}else if(!Ct.call(this)||!St.call(this))return{error:m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"})};return{}}function bt(e){var t=e.data,r=e.type;return{data:{status:Object.keys(t.errorKeys).length>0?"fail":"success",errorKeys:t.errorKeys,successKeys:t.successKeys},type:r}}function At(e){var t=e.data,r=void 0;return Object.keys(t.errorKeys).length>0&&Object.keys(t.errorKeys).forEach((function(e){var n=t.errorKeys[e];r=n.includes("is not part of you")?m.create({type:d.NO_PERMISSION,message:n}):n.includes("size of metadata for this single chatroom exceeds the user defined limit")||n.includes("total size of chatroom metadata for this app exceeds the user defined limit")||n.includes("is exceeding maximum limit")?m.create({type:d.MAX_LIMIT,message:n}):n.includes("is not Legal")?m.create({type:d.REQUEST_PARAMETER_ERROR,message:n}):n.includes("Failed to update userMetadata. Concurrent updates not allowed")?m.create({type:d.OPERATION_NOT_ALLOWED,message:n}):m.create({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:n})})),r}function Mt(e){if("string"!=typeof e.deviceId||""===e.deviceId)throw Error('Invalid parameter: "deviceId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user),type:"PUT",data:JSON.stringify({device_id:e.deviceId,device_token:e.deviceToken,notifier_name:e.notifierName}),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};j.debug("Call uploadPushTokenToServer",e);var s=ae.bind(this,a,v.UPLOAD_PUSH_TOKEN);return _e.retryPromise(s).then((function(e){var t=e.entities[0]||{};return{type:e.type,data:t}}))}var wt,Ut,Lt=r(638),Pt=r.n(Lt),Dt=r(566),kt=r.n(Dt),xt=268435455;function Bt(e){var t=e;return kt().buf(t)>>>0}!function(e){e[e.COMPRESS_NONE=0]="COMPRESS_NONE",e[e.COMPRESS_ZLIB=1]="COMPRESS_ZLIB",e[e.COMPRESS_LZ4=2]="COMPRESS_LZ4"}(wt||(wt={})),function(e){e[e.NONE=-1]="NONE",e[e.UPLINK_ONLY=0]="UPLINK_ONLY",e[e.DOWNLINK_ONLY=1]="DOWNLINK_ONLY",e[e.BIDIRECTIONAL=2]="BIDIRECTIONAL"}(Ut||(Ut={}));var Gt=268435455,jt=function(){function e(){this.mode=Ut.NONE,this.enableUplinkCompression=!1,this.enableDownlinkCompression=!1;var e={minWorkArea:Pt().DEFAULT_WORK_AREA,maxWorkArea:Pt().DEFAULT_MAX_WORK,shrinkMode:Pt().SHRINK_MODE.MANUAL};this.encoder=new(Pt().RingBufferEncoder)(e),this.decoder=new(Pt().RingBufferDecoder)(e)}return e.prototype.compress=function(e){var t=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!t||0===t.length)return new Uint8Array(0);if(t.length>Gt)throw new Error("Data size exceeds maximum allowed: ".concat(t.length));var r=Pt().compressBound(t.length),n=new Uint8Array(r),o=this.encoder.compress(t,n);if(o<0)throw new Error("LZ4 compression failed with error code: ".concat(o));var i=n.subarray(0,o),a=function(e){if(e<0)throw new Error("encodeLength: Length must be non-negative");if(e>xt)throw new Error("encodeLength: Length exceeds maximum: ".concat(xt));if(0===e)return new Uint8Array([0]);for(var t=[],r=e;r>0;){var n=127&r;(r>>>=7)>0&&(n|=128),t.push(n)}return new Uint8Array(t)}(t.length),s=Bt(t),c=new Uint8Array(a.length+4+o),u=0;return c.set(a,u),u+=a.length,new DataView(c.buffer).setUint32(u,s,!1),u+=4,c.set(i,u),c},e.prototype.decompress=function(e){var t=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!t||0===t.length)return new Uint8Array(0);if(t.length<5)throw new Error("Compressed data is too short: must contain at least length and CRC32");var r={offset:0},n=function(e,t){if(t.offset>=e.length)throw new Error("decodeLength: No data to decode: offset beyond data length");for(var r=0,n=0;t.offset<e.length;){var o=e[t.offset];if(t.offset++,r|=(127&o)<<n,!(128&o))return r>>>0;if((n+=7)>=28)throw new Error("decodeLength: Invalid length encoding: exceeds 4 bytes")}throw new Error("decodeLength: Incomplete length encoding: missing terminator byte")}(t,r);if(n>Gt)throw new Error("Original size exceeds maximum allowed: ".concat(n));if(t.length<r.offset+4)throw new Error("Compressed data is too short: missing CRC32 checksum");var o=new DataView(t.buffer,t.byteOffset+r.offset,4).getUint32(0,!1);r.offset+=4;var i=t.subarray(r.offset),a=new Uint8Array(n),s=this.decoder.decompress(i,a,n);if(s<0||s!==n)throw new Error("LZ4 decompression failed: expected ".concat(n,", got ").concat(s));var c=Bt(a);if(c!==o)throw new Error("CRC32 checksum mismatch: expected ".concat(o,", got ").concat(c));return a},e.prototype.resetEncoder=function(){this.encoder.reset()},e.prototype.resetDecoder=function(){this.decoder.reset()},e.prototype.reset=function(){this.resetEncoder(),this.resetDecoder()},e.prototype.shrinkEncoder=function(){this.encoder.shrink()},e.prototype.shrinkDecoder=function(){this.decoder.shrink()},e.prototype.shrink=function(){this.shrinkEncoder(),this.shrinkDecoder()},e}();function Ht(e){switch(e){case Ut.UPLINK_ONLY:return{mode:Ut.UPLINK_ONLY,enableUplinkCompression:!0,enableDownlinkCompression:!1};case Ut.DOWNLINK_ONLY:return{mode:Ut.DOWNLINK_ONLY,enableUplinkCompression:!1,enableDownlinkCompression:!0};case Ut.BIDIRECTIONAL:return{mode:Ut.BIDIRECTIONAL,enableUplinkCompression:!0,enableDownlinkCompression:!0};case Ut.NONE:default:return{mode:Ut.NONE,enableUplinkCompression:!1,enableDownlinkCompression:!1}}}function Ft(e,t){var r=Ht(t),n=r.mode,o=r.enableUplinkCompression,i=r.enableDownlinkCompression;e.reset(),e.mode=n,e.enableUplinkCompression=o,e.enableDownlinkCompression=i}function Wt(e,t,r){for(var n=[],o=Math.max(e.length,t.length),i=0,a=0;a<o||i;){var s=i+(a<e.length?e[a]:0)+(a<t.length?t[a]:0);n.push(s%r),i=Math.floor(s/r),a++}return n}function zt(e,t,r){if(e<0)return null;if(0==e)return[];for(var n=[],o=t;1&e&&(n=Wt(n,o,r)),0!=(e>>=1);)o=Wt(o,o,r);return n}var qt=function(){function e(e){e=e||{},this.seq=0,this.mid=(e.mid||1)%1023,this.timeOffset=e.timeOffset||0,this.lastTime=0}return e.prototype.gen=function(){var e=Date.now();if(this.lastTime==e){if(this.seq++,this.seq>4095){for(this.seq=0;Date.now()<=e;);e=Date.now()}}else this.seq=0;this.lastTime=e;for(var t=(e-this.timeOffset).toString(2),r=this.seq.toString(2),n=this.mid.toString(2);r.length<12;)r="0"+r;for(;n.length<10;)n="0"+n;for(var o,i=t+n+r,a="",s=i.length;s>0;s-=4)a=parseInt(i.substring(s-4,s),2).toString(16)+a;return"0x"===(o=a).substring(0,2)&&(o=o.substring(2)),function(e,t,r){var n=function(e,t){for(var r=e.split(""),n=[],o=r.length-1;o>=0;o--){var i=parseInt(r[o],t);if(isNaN(i))return null;n.push(i)}return n}(e,t);if(null===n)return null;for(var o=[],i=[1],a=0;a<n.length;a++)n[a]&&(o=Wt(o,zt(n[a],i,r),r)),i=zt(t,i,r);var s="";for(a=o.length-1;a>=0;a--)s+=o[a].toString(r);return s}(o=o.toLowerCase(),16,10)},e}(),Kt=function(){return Kt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Kt.apply(this,arguments)};function Vt(e){try{var t=this._compressor;return t&&t.enableDownlinkCompression&&"string"!=typeof e.data?[Kt(Kt({},e),{data:t.decompress(e.data)}),!0]:[e,!0]}catch(t){return this._compressorFailureCount++,j.error("decompress message error",t),j.error("decompress failure times:",this._compressorFailureCount),this.sock.close(),[e,!1]}}function Jt(e){try{var t=this._compressor;return t&&t.enableUplinkCompression?[t.compress(e),!0]:[e,!0]}catch(t){return this._compressorFailureCount++,j.error("compress message error",t),j.error("compress failure times:",this._compressorFailureCount),this.sock.close(),[e,!1]}}function Yt(e,t,r){var n=Math.min(e,t);if(n<=r)return{width:e,height:t};var o=r/n;return{width:Math.round(e*o),height:Math.round(t*o)}}function Xt(e,t){return e+t|0}function Qt(e){for(var t="",r=0;r<4;r++)t+="0".concat((e>>>8*r&255).toString(16)).slice(-2);return t}function Zt(e){var t=new Uint8Array(e),r=t.length,n=64*((r+8>>>6)+1),o=new Uint8Array(n);o.set(t),o[r]=128;for(var i=8*r,a=i>>>0,s=Math.floor(i/4294967296)>>>0,c=0;c<4;c++)o[n-8+c]=a>>>8*c&255,o[n-4+c]=s>>>8*c&255;var u=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],l=new Array(64);for(c=0;c<64;c++)l[c]=Math.floor(4294967296*Math.abs(Math.sin(c+1)));for(var d,h,p=1732584193,f=4023233417,m=2562383102,g=271733878,v=new Array(16),E=0;E<n;E+=64){for(c=0;c<16;c++){var y=E+4*c;v[c]=o[y]|o[y+1]<<8|o[y+2]<<16|o[y+3]<<24}var _=p,T=f,I=m,O=g;for(c=0;c<64;c++){var R=0,C=0;c<16?(R=T&I|~T&O,C=c):c<32?(R=O&T|~O&I,C=(5*c+1)%16):c<48?(R=T^I^O,C=(3*c+5)%16):(R=I^(T|~O),C=7*c%16);var S=I,N=T,b=(d=Xt(Xt(_,R),Xt(l[c],v[C])))<<(h=u[c])|d>>>32-h;T=Xt(T,b),_=O,I=N,O=S}p=Xt(p,_),f=Xt(f,T),m=Xt(m,I),g=Xt(g,O)}return"".concat(Qt(p)).concat(Qt(f)).concat(Qt(m)).concat(Qt(g))}var $t=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},er=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},tr=1048576;function rr(e){return new Promise((function(t,r){if("undefined"!=typeof FileReader){var n=new FileReader;n.onload=function(){return t(n.result)},n.onerror=function(){return r(n.error||new Error("Failed to read file"))},n.readAsArrayBuffer(e)}else r(new Error("FileReader is not available"))}))}function nr(e,t,r){return"img"===t?e>("original"===r?204800:tr):e>tr}function or(e){return $t(this,void 0,void 0,(function(){return er(this,(function(t){switch(t.label){case 0:return[4,rr(e)];case 1:return[2,Zt(t.sent())]}}))}))}function ir(e){return"original"===e?"origin":"large"}function ar(e,t,r,n){var o,i;return $t(this,void 0,void 0,(function(){var a,s,c,u,l,d,h,p,f,m,g,E,y,_;return er(this,(function(T){switch(T.label){case 0:a=e.context,s=a.orgName,c=a.appName,u=a.accessToken,l="".concat(e.apiUrl,"/").concat(s,"/").concat(c,"/chatfiles/exists?md5=").concat(t),"img"===r&&n&&(l+="&imageType=".concat(ir(n))),T.label=1;case 1:return T.trys.push([1,3,,4]),[4,ae.call(e,{url:l,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+u}},v.SDK_INTERNAL)];case 2:return d=T.sent(),(h=null===(o=null==d?void 0:d.entities)||void 0===o?void 0:o[0])?(p=!0===h.exists,f=h.uuid||"",m=h["share-secret"]||"",I=null!==(i=h["exists-type"])&&void 0!==i?i:h.existsType,g="origin"===I||"original"===I?"original":"large"===I?"large":void 0,E=p&&!!f,y=n,"img"===r&&E&&("original"===g?y="original":"large"===g&&("original"===n?E=!1:y="large")),j.debug("precheck result","exists: ".concat(p),"uuid: ".concat(f),"existsType: ".concat(g||""),"effectiveImageType: ".concat(y||""),"hit: ".concat(E)),[2,{exists:p,uuid:f,shareSecret:m,existsType:g,effectiveImageType:y,hit:E}]):[2,{exists:!1,hit:!1}];case 3:return _=T.sent(),j.warn("precheck failed, proceeding with upload",_),[2,{exists:!1,hit:!1}];case 4:return[2]}var I}))}))}var sr,cr,ur,lr,dr=function(){return dr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},dr.apply(this,arguments)},hr=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},pr=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},fr=new qt;!function(e){e[e.NORMAL=0]="NORMAL",e[e.SINGLECHAT=1]="SINGLECHAT",e[e.GROUPCHAT=2]="GROUPCHAT",e[e.CHATROOM=3]="CHATROOM",e[e.READ_ACK=4]="READ_ACK",e[e.DELIVER_ACK=5]="DELIVER_ACK",e[e.RECALL=6]="RECALL",e[e.CHANNEL_ACK=7]="CHANNEL_ACK",e[e.EDIT=8]="EDIT"}(sr||(sr={})),function(e){e[e.BODY=1]="BODY",e[e.BODY_AND_EXT=2]="BODY_AND_EXT"}(cr||(cr={})),function(e){e[e.APNs=0]="APNs",e[e.FCM=1]="FCM",e[e.HMSPUSH=2]="HMSPUSH",e[e.MIPUSH=3]="MIPUSH",e[e.MEIZUPUSH=4]="MEIZUPUSH",e[e.VIVOPUSH=5]="VIVOPUSH",e[e.OPPOPUSH=6]="OPPOPUSH",e[e.HONORPUSH=7]="HONORPUSH"}(ur||(ur={})),function(e){e[e.OK=0]="OK",e[e.FAIL=1]="FAIL",e[e.UNAUTHORIZED=2]="UNAUTHORIZED",e[e.MISSING_PARAMETER=3]="MISSING_PARAMETER",e[e.WRONG_PARAMETER=4]="WRONG_PARAMETER",e[e.REDIRECT=5]="REDIRECT",e[e.TOKEN_EXPIRED=6]="TOKEN_EXPIRED",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.NO_ROUTE=8]="NO_ROUTE",e[e.UNKNOWN_COMMAND=9]="UNKNOWN_COMMAND",e[e.PB_PARSER_ERROR=10]="PB_PARSER_ERROR",e[e.BIND_ANOTHER_DEVICE=11]="BIND_ANOTHER_DEVICE",e[e.IM_FORBIDDEN=12]="IM_FORBIDDEN",e[e.TOO_MANY_DEVICES=13]="TOO_MANY_DEVICES",e[e.PLATFORM_LIMIT=14]="PLATFORM_LIMIT",e[e.USER_MUTED=15]="USER_MUTED",e[e.ENCRYPT_DISABLE=16]="ENCRYPT_DISABLE",e[e.ENCRYPT_ENABLE=17]="ENCRYPT_ENABLE",e[e.DECRYPT_FAILURE=18]="DECRYPT_FAILURE",e[e.PERMISSION_DENIED_EXTERNAL=19]="PERMISSION_DENIED_EXTERNAL",e[e.RESOURCE_CHANGED=20]="RESOURCE_CHANGED"}(lr||(lr={}));var mr=["txt","img","video","audio","file","loc","custom","cmd","combine"],gr=_e.getEnvInfo();function vr(){var e="webim",t="",r="",n=(new Date).valueOf(),o=_e.getDevicePlatform(gr);if(this.isFixedDeviceId){var i=_e.getLocalDeviceInfo();if(i){var a=JSON.parse(i);e=a.deviceId,t=a.deviceName,r=a.deviceUuid,void 0!==this.customOSPlatform&&(t=this.deviceId,e="custom".concat(this.customOSPlatform,"_").concat(r))}else"webim"===this.deviceId?(r="".concat(o,"_").concat(n.toString()),e="".concat(this.deviceId,"_").concat(r),t=this.deviceId,void 0!==this.customOSPlatform&&(e="custom".concat(this.customOSPlatform,"_").concat(r))):(e=t=r="webim_".concat(o,"_").concat(this.deviceId),void 0!==this.customOSPlatform&&(r="".concat(o,"_").concat(n.toString()),t=this.deviceId,e="custom".concat(this.customOSPlatform,"_").concat(r))),_e.setLocalDeviceInfo(JSON.stringify({deviceId:e,deviceName:t,deviceUuid:r}))}else"webim"===this.deviceId?(r="random_".concat(o,"_").concat(n.toString()),e="".concat(this.deviceId,"_").concat(r),t=this.deviceId):e=t=r="webim_".concat(o,"_").concat(this.deviceId),void 0!==this.customOSPlatform&&(r="random_".concat(o,"_").concat(n.toString()),t=this.deviceId,e="custom".concat(this.customOSPlatform,"_").concat(r));return{deviceId:e,deviceName:t,deviceUuid:r,devicePlatform:o}}function Er(){var e,t,r,n,o=vr.call(this),i=o.deviceId,a=o.deviceName,s=o.deviceUuid,c=o.devicePlatform,u=[];this.context.jid&&(this.context.jid.clientResource=i),this._compressor&&Ft(this._compressor,Ut.NONE);var l=this.root.lookup("easemob.pb.Provision"),d=c===le.UNI,h=!this.logOut,p=l.decode(u);if(void 0!==this.customOSPlatform&&(p.osCustomValue=this.customOSPlatform,this.osType=5),p.compressType=this.compressType,p.encryptType=this.encryptType,p.osType=this.osType,p.version=this.version,p.deviceName=a,p.resource=i,p.deviceUuid=s,p.authToken='{"token":"$t$'+this.token+'"}',p.sessionId=Date.now().toString()+":",d){var f=!this.isAutoLogin;h&&(f=!1),j.debug("isManualLogin",f),p.isManualLogin=f}var m=this._compressorFailureCount>=1?[]:[wt.COMPRESS_LZ4];p.protocolCompressType=m,this.sessionId=p.sessionId,this.loginInfoCustomExt&&(p.reason=this.loginInfoCustomExt),j.info("provision info",{version:this.version,resource:i,isFixedDeviceId:this.isFixedDeviceId,loginInfoCustomExt:!!this.loginInfoCustomExt,token:(null===(t=null===(e=this.token)||void 0===e?void 0:e.slice)||void 0===t?void 0:t.call(e,0,10))+"...",userId:null===(n=null===(r=this.context)||void 0===r?void 0:r.jid)||void 0===n?void 0:n.name}),p.actionVersion="v5.2",p=l.encode(p).finish();var g=this.root.lookup("easemob.pb.MSync"),v=g.decode(u);return v.version=this.version,v.guid=this.context.jid,v.auth="$t$"+this.token,v.command=3,v.deviceId=a,v.serviceId=this.dataReport.getServiceId(),v.encryptType=this.encryptType,v.payload=p,v.traceId=fr.gen(),g.encode(v).finish()}function yr(e){var t=[],r=this.root.lookup("easemob.pb.Logout"),n=r.decode(t);n.sessionId=this.sessionId,n.reason=e,n=r.encode(n).finish();var o=this.root.lookup("easemob.pb.MSync"),i=o.decode(t);return i.version=this.version,i.guid=this.context.jid,i.auth="$t$"+this.token,i.command=4,i.deviceId=this.deviceId||"webim",i.serviceId=this.dataReport.getServiceId(),i.encryptType=this.encryptType,i.payload=n,i.traceId=fr.gen(),j.debug("traceId",i.traceId),o.encode(i).finish()}function _r(e,t){var r=this,n=_e.getEnvInfo();if("zfb"===n.platform||"dd"===n.platform){for(var o="",i=0;i<e.length;i++)o+=String.fromCharCode(e[i]);return{data:o=Re().btoa(o),isBuffer:!1,complete:function(){},fail:function(e){"sendSocketMessage:fail taskID not exist"!==e.errMsg&&"SocketTast.send:fail SocketTask.readyState is not OPEN"!==e.errMsg||(j.error("send message fail and reconnect"),r.reconnecting||r.reconnect()),t&&r._msgHash&&r._msgHash[t]&&r._msgHash[t].fail({id:t})}}}var a=e;return{data:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),fail:function(e){"sendSocketMessage:fail taskID not exist"!==e.errMsg&&"SocketTast.send:fail SocketTask.readyState is not OPEN"!==e.errMsg||r.reconnecting||r.reconnect(),t&&r._msgHash&&r._msgHash[t]&&r._msgHash[t].fail({id:t})}}}function Tr(e,t){var r;return hr(this,void 0,void 0,(function(){var n,o,i,a,s;return pr(this,(function(c){switch(c.label){case 0:for(j.debug("metas length: ",e.length),n=[],o=0;o<e.length;o++)switch(i=e[o],new(f())(i.id.low,i.id.high,i.id.unsigned).toString(),i.ns){case 0:vt.call(this,i);break;case 1:n.push(ut.call(this,i,t,!1,!0,!0));break;case 2:mt.call(this,i);break;case 3:gt.handleRosterMsg.call(this,i);break;case 4:this.registerConfrIQHandler&&this.registerConfrIQHandler(i,t,this);break;case 5:Rt.call(this,i);break;default:j.error("distributeMeta",i)}return[4,Promise.all(n)];case 1:return a=c.sent(),(s=a.filter((function(e){return e&&"cmd"!==e.type}))).length>0&&(null===(r=this.eventHandler)||void 0===r||r.dispatch("onMessage",s)),[2]}}))}))}function Ir(e,t){Tr.call(this,e,t)}function Or(e){var t,r=this;qr.clear(),this._offlineMessagePullState===Ee.SYNC_INIT&&(this._offlineMessagePullState=Ee.SYNC_START,this._offlineMessagePullQueue=e.unread.reduce((function(e,t,n){return e.find((function(e){return e.name===t.queue.name}))||e.push(t),r.pullOfflineMessageInfo.pullCount+=t.n,e}),[]),this.pullOfflineMessageInfo.startTime=Date.now(),this._offlineMessageRpt=this.dataReport.geOperateFun({operationName:v.MSYNC_SYNCOFFLINEMESSAGE}),null===(t=this.eventHandler)||void 0===t||t.dispatch("onOfflineMessageSyncStart"))}function Rr(e){var t;if(this._offlineMessagePullState===Ee.SYNC_START){var r=this._offlineMessagePullQueue.findIndex((function(t){return t.queue.name===e.queue.name}));if(r>-1){this._offlineMessagePullQueue.splice(r,1);var n=qr.get(e.queue.name)||0;n>0&&this._offlineMessageRpt({isEndApi:!1,data:{isSuccess:1,requestName:v.MSYNC_SYNCOFFLINEMESSAGE,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success,resultCount:n,requestElapse:Date.now()-this.pullOfflineMessageInfo.startTime}})}0===this._offlineMessagePullQueue.length&&(this._offlineMessagePullState=Ee.SYNC_FINISH,null===(t=this.eventHandler)||void 0===t||t.dispatch("onOfflineMessageSyncFinish"),this._offlineMessageRpt({data:{isLastApi:1,isSuccess:1,requestName:v.MSYNC_SYNCOFFLINEMESSAGE,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success,resultCount:this.pullOfflineMessageInfo.pullCount}}),qr.clear())}}function Cr(e){var t=this.root.lookup("easemob.pb.CommUnreadDL");t=t.decode(e.payload);var r=new(f())(t.timestamp.low,t.timestamp.high,t.timestamp.unsigned).toString();if(this.expirationTime&&this.compareTokenExpireTime(Number(r),this.expirationTime),0===t.unread.length)kr.call(this);else{Or.call(this,t),j.debug("pull unread message",t.unread);for(var n=0;n<t.unread.length;n++)br.call(this,t.unread[n].queue)}kr.call(this)}function Sr(){var e=[],t=this.root.lookup("easemob.pb.StatisticsBody"),r=t.decode(e);r.operation=0,r=t.encode(r).finish();var n=this.root.lookup("easemob.pb.Meta").decode(e);n.id=(new Date).valueOf(),n.ns=0,n.payload=r;var o=this.root.lookup("easemob.pb.CommSyncUL"),i=o.decode(e);i.meta=n,i=o.encode(i).finish();var a=this.root.lookup("easemob.pb.MSync"),s=a.decode(e);return s.version=this.version,s.encryptType=[0],s.command=0,s.payload=i,s.traceId=fr.gen(),j.debug("traceId",s.traceId),a.encode(s).finish()}function Nr(e){var t=[],r=this.root.lookup("easemob.pb.CommSyncUL"),n=r.decode(t);n.queue=e,n=r.encode(n).finish();var o=this.root.lookup("easemob.pb.MSync"),i=o.decode(t);return i.version=this.version,i.encryptType=this.encryptType,i.command=0,i.payload=n,i.traceId=fr.gen(),j.debug("traceId",i.traceId),o.encode(i).finish()}function br(e){j.debug("sendBackqueue",e);var t=Nr.call(this,e);tn.call(this,t)}function Ar(e,t){var r=[],n=this.root.lookup("easemob.pb.CommSyncUL"),o=n.decode(r);o.queue=t,o.key=new(f())(e.low,e.high,e.unsigned).toString(),o=n.encode(o).finish();var i=this.root.lookup("easemob.pb.MSync"),a=i.decode(r);return a.version=this.version,a.encryptType=this.encryptType,a.command=0,a.payload=o,a.traceId=fr.gen(),j.debug("traceId",a.traceId),i.encode(a).finish()}function Mr(){var e=this;this.uniPush&&!1===this.isRegisterPush&&(this.isRegisterPush=!0,this.uniPush.onRegister((function(t){j.debug("push token onRegister");var r=e.uniPushConfig||{},n=r.APNsCertificateName,o=void 0===n?"":n,i=r.HMSCertificateName,a=void 0===i?"":i,s=r.HONORCertificateName,c=void 0===s?"":s,u=r.MEIZUCertificateName,l=void 0===u?"":u,d=r.MICertificateName,h=void 0===d?"":d,p=r.OPPOCertificateName,f=void 0===p?"":p,m=r.VIVOCertificateName,g=void 0===m?"":m,v=r.FCMCertificateName,E=void 0===v?"":v;switch(t.push_type){case ur.APNs:e.pushCertificateName=o;break;case ur.FCM:e.pushCertificateName=E;break;case ur.HMSPUSH:e.pushCertificateName=a;break;case ur.HONORPUSH:e.pushCertificateName=c;break;case ur.MEIZUPUSH:e.pushCertificateName=l;break;case ur.MIPUSH:e.pushCertificateName=h;break;case ur.OPPOPUSH:e.pushCertificateName=f;break;case ur.VIVOPUSH:e.pushCertificateName=g;break;default:j.error("unexpected push type",t.push_type)}e.pushCertificateName&&t.push_token&&Mt.call(e,{deviceId:e.clientResource,deviceToken:t.push_token,notifierName:e.pushCertificateName}).then((function(){j.debug("uploadPushToken success")})).catch((function(e){j.debug("uploadPushToken failed",e)}))})))}function wr(){var e;this._offlineMessagePullState=Ee.SYNC_INIT,this._offlineMessagePullQueue=[],this.times=1,this.autoReconnectNumTotal=0,this.onOpened&&this.onOpened(),Mr.call(this),null===(e=this.eventHandler)||void 0===e||e.dispatch("onConnected"),Dr.call(this),Br.call(this),xr.call(this),kr.call(this),this.pullOfflineMessageInfo={pullCount:0,startTime:0}}function Ur(e,t){j.debug("sendLastSession",e);var r=Ar.call(this,e,t);tn.call(this,r)}function Lr(e){var t,r,n,o,i,a,s,c,u,l,h,p,f,g,v,E,y,_,T=this,I=this.root.lookup("easemob.pb.Provision").decode(e.payload);if(this.context.jid&&(this.context.jid.clientResource=I.resource),this.clientResource=I.resource,this.provisionTimer&&clearTimeout(this.provisionTimer),j.debug("provision status",I.status),this._isLogging=!1,I.status.errorCode===lr.OK){if(this.disconnectedReason=void 0,I.authToken){var O=JSON.parse(I.authToken).expires_in;if(!this.tokenExpiredTimer&&!this.tokenWillExpireTimer){var R=Date.now();this.expirationTime=O;var C=this.expirationTime-R;this.expiresIn=C<0?0:C,this.tokenExpireTimeCountDown(this.expiresIn)}}var S=I.protocolCompressType,N=I.protocolCompressDirection;if(j.debug("protocol compress types",S),j.debug("protocol compress direction",N),S.length>0&&S[0]===wt.COMPRESS_LZ4){var b=null!=N?N:Ut.NONE;this._compressor?Ft(this._compressor,b):this._compressor=function(e){var t=Ht(e),r=t.mode,n=t.enableUplinkCompression,o=t.enableDownlinkCompression;if(r===Ut.NONE)return null;var i=new jt;return i.mode=r,i.enableUplinkCompression=n,i.enableDownlinkCompression=o,i}(b)}this.reconnecting=!1,this.logOut=!1,this.needSetReadyState&&(this.sock=dr(dr({},this.sock),{close:this.sock.close,send:this.sock.send,readyState:1})),this._localCache?(null===(t=this._localCache)||void 0===t?void 0:t.getInstance())?wr.call(this):this._localCache&&new this._localCache({user:this.user,dbName:"cache_".concat(Math.abs(we(this.appKey||this.appId)),"_").concat(this.user),version:2,onInit:function(){return hr(T,void 0,void 0,(function(){return pr(this,(function(e){return j.debug("localCache init success"),wr.call(this),[2]}))}))}}):wr.call(this),null===(r=this.connectionResolve)||void 0===r||r.call(this)}else{var A=void 0,M=I.status,w=M.reason,U=M.errorCode;switch(j.error("provision errorCode: ",U),j.error("provision reason: ",w),U){case lr.FAIL:A="Sorry, user register limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the number of user registrations limit has been reached"}):"Sorry, user register rate limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, user register rate limit"}):"Sorry, token expired"===w?m.create({type:d.WEBIM_TOKEN_EXPIRED,message:"Sorry, token expired"}):"Sorry, token or password does not match login info"===w?m.create({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"INVALID_TOKEN"}):"Sorry, user not found"===w?m.create({type:d.USER_NOT_FOUND,message:"User not found"}):m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"Auth failed"}),null===(n=this.connectionReject)||void 0===n||n.call(this,A),null===(o=this.eventHandler)||void 0===o||o.dispatch("onError",A);break;case lr.WRONG_PARAMETER:A=m.create({type:d.REQUEST_PARAMETER_ERROR,message:"Invalid parameter"}),null===(i=this.connectionReject)||void 0===i||i.call(this,A),null===(a=this.eventHandler)||void 0===a||a.dispatch("onError",A);break;case lr.UNAUTHORIZED:A=m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"Auth failed"}),null===(s=this.connectionReject)||void 0===s||s.call(this,A),null===(c=this.eventHandler)||void 0===c||c.dispatch("onError",A);break;case lr.IM_FORBIDDEN:A=m.create({type:d.WEBIM_SERVER_SERVING_DISABLED,message:"Server serving disabled."}),null===(u=this.connectionReject)||void 0===u||u.call(this,A),null===(l=this.eventHandler)||void 0===l||l.dispatch("onError",A);break;case lr.PERMISSION_DENIED:A="Sorry, the app month live count limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the monthly active user limit for this app has been reached"}):"Sorry, the app day live count limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the daily active user limit for this app has been reached"}):"Sorry, the app online count limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the maximum number limit of online users for this app has been reached"}):m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"Auth failed"}),null===(h=this.connectionReject)||void 0===h||h.call(this,A),null===(p=this.eventHandler)||void 0===p||p.dispatch("onError",A);break;case lr.TOO_MANY_DEVICES:A=m.create({type:d.USER_LOGIN_TOO_MANY_DEVICES,message:"the number of devices the user is logged in to exceeds the limit"}),null===(f=this.connectionReject)||void 0===f||f.call(this,A),null===(g=this.eventHandler)||void 0===g||g.dispatch("onError",A);break;case lr.RESOURCE_CHANGED:A=m.create({type:d.USER_DEVICE_CHANGED,message:"user device is changed"}),null===(v=this.connectionReject)||void 0===v||v.call(this,A),null===(E=this.eventHandler)||void 0===E||E.dispatch("onError",A);break;default:A=m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:w}),null===(y=this.connectionReject)||void 0===y||y.call(this,A),null===(_=this.eventHandler)||void 0===_||_.dispatch("onError",A)}this.disconnectedReason=A}}function Pr(e){var t=this.root.lookup("easemob.pb.Logout").decode(e.payload);j.debug("receiveLogoutResult",t)}function Dr(){var e,t;if((null===(e=this.unMSyncSendMsgMap)||void 0===e?void 0:e.size)>0){for(var r=Array.from(this.unMSyncSendMsgMap.keys()),n=0;n<r.length;n++){var o=this.unMSyncSendMsgMap.get(r[n]);tn.call(this,o,r[n])}null===(t=this.unMSyncSendMsgMap)||void 0===t||t.clear()}}function kr(){var e=Sr.call(this);tn.call(this,e)}function xr(){j.debug("sendUnreadDeal");var e=jr.call(this);tn.call(this,e)}function Br(){var e=this;Gr.call(this),this.heartBeatID=setInterval((function(){(Date.now()-e.lastHeartbeat)/1e3>=30&&(j.debug("send heart beat"),xr.call(e),e.lastHeartbeat=Date.now())}),this.heartBeatWait)}function Gr(){clearInterval(this.heartBeatID)}function jr(){var e=this.root.lookup("easemob.pb.MSync"),t=e.decode([]);return t.version=this.version,t.encryptType=this.encryptType,t.command=1,t.traceId=fr.gen(),j.debug("traceId",t.traceId),e.encode(t).finish()}function Hr(e,t){return e.some((function(e){return e.name===t.name}))}function Fr(e){var t=this.root.lookup("easemob.pb.CommNotice").decode(e.payload),r=Hr(this._queues,t.queue);j.debug("receive notice",t.queue,r),r||this.clientResource===t.queue.clientResource&&t.queue.name===this.context.userId||(this._queues.push(t.queue),1===this._queues.length&&br.call(this,t.queue))}function Wr(e){return hr(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return pr(this,(function(l){t=_e.getEnvInfo(),r=this.root.lookup("easemob.pb.MSync"),n=e,"zfb"!==t.platform&&"dd"!==t.platform||(o=Re().atob(e.data),i=Array.from(o,(function(e,t){return o.charCodeAt(t)})),n=dr(dr({},e),{data:new Uint8Array(i)}));try{return a=Vt.call(this,n),s=a[0],a[1]?(c="miniCore"===this.name||"web"===t.platform,u=c?new Uint8Array(s.data):s.data,[2,r.decode(u)]):[2,void 0]}catch(e){throw new Error("decode message fail.")}}))}))}function zr(e){var t=this;this.lastHeartbeat=Date.now(),this.probingTimer&&clearTimeout(this.probingTimer),e.then((function(e){if(e)switch(e.command){case 0:Kr.call(t,e);break;case 1:Cr.call(t,e);break;case 2:Fr.call(t,e);break;case 3:Lr.call(t,e);break;case 4:Pr.call(t,e);break;default:j.error("unexpected msync command: ".concat(e.command))}else j.error("unexpected msync result: ".concat(e))}))}var qr=new Map;function Kr(e){var t,r,n,o,i,a,s,c,u,l,h,p,g,v,E,y,T,O,R,N,b,A,M,w,U,L,P,D,k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z,$,ee,te,re,ne,oe,ie,ae,se,ce,ue,le,de;return hr(this,void 0,void 0,(function(){var he,pe,fe,me,ge,ve,ye,Te,Ie,Oe,Re,Ce,Se,Ne,be,Ae,Me,we,Ue,Le,Pe,ke,xe,Be,Ge,je,He,Fe,We,ze,qe,Ke,Ve,Je,Ye,Qe,Ze,$e,et,tt,rt,nt,ot,it,at,st,ct,lt=this;return pr(this,(function(dt){switch(dt.label){case 0:if(he=(he=this.root.lookup("easemob.pb.CommSyncDL")).decode(e.payload),pe=new(f())(he.serverId.low,he.serverId.high,he.serverId.unsigned).toString(),fe=new(f())(he.metaId.low,he.metaId.high,he.metaId.unsigned).toString(),!(Number(fe)>0))return[3,23];if(clearTimeout(null===(t=this._msgHash[fe])||void 0===t?void 0:t.messageTimer),!he.status)return[3,22];if(0!==he.status.errorCode)return[3,21];if(null==(me=this._msgHash[fe])?void 0:me.isHandleChatroom){try{if(ge="join"===(null===(r=this._msgHash[fe])||void 0===r?void 0:r.operation)){ve={};try{he.metas.length>0&&(ye=this.root.lookup("easemob.pb.MUCBody"),Te=ye.decode(he.metas[0].payload),(Ie=JSON.parse(Te.status.chatroomInfo||"{}")[this.user])&&(ve={isAllMembersMuted:Ie.is_all_mute,createTimestamp:Ie.create_timestamp,isInAllowlist:Ie.is_in_white_list,memberCount:Ie.member_count,muteExpireTimestamp:Ie.mute_duration?Ie.mute_duration:-1}))}catch(e){j.error("decode chat room info error",e)}(null===(n=this._msgHash[fe])||void 0===n?void 0:n.resolve)instanceof Function&&this._msgHash[fe].resolve({type:0,data:{action:"apply",id:this._msgHash[fe].roomId,result:!0,user:this.context.userId,info:ve}}),(null===(o=this._msgHash[fe])||void 0===o?void 0:o.success)instanceof Function&&this._msgHash[fe].success({type:0,data:{action:"apply",id:this._msgHash[fe].roomId,result:!0,user:this.context.userId,info:ve}})}(null===(i=this._msgHash[fe])||void 0===i?void 0:i.resolve)instanceof Function&&!ge&&this._msgHash[fe].resolve({type:0,data:{result:!0}}),(null===(a=this._msgHash[fe])||void 0===a?void 0:a.success)instanceof Function&&!ge&&this._msgHash[fe].success({type:0,data:{result:!0}}),S.has(fe)&&(Oe=S.get(fe),et=Oe.rpt,tt=Oe.requestName,et({isEndApi:!0,data:{isSuccess:1,requestName:tt,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success}}),S.delete(fe))}catch(e){S.has(fe)&&(Re=S.get(fe),et=Re.rpt,tt=Re.requestName,et({isEndApi:!0,data:{isSuccess:0,requestName:tt,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.failed,codeDesc:"when executing success function error"}}),S.delete(fe)),nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing success function error",data:e}),this.onError&&this.onError(nt),null===(s=this.eventHandler)||void 0===s||s.dispatch("onError",nt)}delete this._msgHash[fe]}return!me||me.isHandleChatroom?[3,20]:(Ce=null,Se="",Ne=0,be="",Ae=null,this._msgHash[fe].thirdMessage?(this._msgHash[fe].thirdMessage.id=he.serverId,this._msgHash[fe].thirdMessage.timestamp=he.timestamp,[4,ut.call(this,this._msgHash[fe].thirdMessage,he.status,!0,!0)]):[3,2]);case 1:Ae=dt.sent(),dt.label=2;case 2:if(0===he.metas.length)return[3,13];dt.label=3;case 3:switch(dt.trys.push([3,12,,13]),Me=he.metas[0],we=he.status,Me.ns){case 1:return[3,4];case 5:return[3,9]}return[3,10];case 4:return this.useReplacedMessageContents?[4,ut.call(this,Me,we,!0,!0)]:[3,8];case 5:return Ae=dt.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.getMessageByServerMsgId(fe)];case 6:return(Ue=dt.sent())?[4,null===(h=null===(l=this._localCache)||void 0===l?void 0:l.getInstance())||void 0===h?void 0:h.putMessageToDB(dr(dr(dr({},Ue),Ae),{id:fe}))]:[3,8];case 7:dt.sent(),dt.label=8;case 8:return[3,11];case 9:return(Le=_e.parseNotify(he.metas[0].payload)).edit_msg&&(Pe=Le.edit_msg,ke=Pe.count,xe=Pe.operator,Be=Pe.edit_time,Ge=Pe.sender,je=Pe.send_time,He=Pe.chat_type,Ce={operationTime:Be,operatorId:xe,operationCount:ke},Se=Ge,Ne=Number(je),be=Xe[He]),[3,11];case 10:return j.error("decode local meta error",Me),[3,11];case 11:return[3,13];case 12:return Fe=dt.sent(),nt=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:"decode local meta message error",data:Fe}),this.onError&&this.onError(nt),null===(p=this.eventHandler)||void 0===p||p.dispatch("onError",nt),[3,13];case 13:C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:1,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success,msgId:pe,messageType:null!==(g=I[null==Ae?void 0:Ae.chatType])&&void 0!==g?g:I.singleChat}}),C.delete(fe)),dt.label=14;case 14:return dt.trys.push([14,18,,19]),We={localMsgId:fe,serverMsgId:pe},Ce&&(ze=this._msgHash[fe],qe=ze.editMessageId,Ke=ze.ext,Ve=ze.customExts,Je=ze.customEvent,Ae.modifiedInfo=Ce,Ae.from=Se,Ae.time=Number(Ne),Ae.chatType=be,Ae.id=qe,null===(y=null===(E=null===(v=this._localCache)||void 0===v?void 0:v.getInstance())||void 0===E?void 0:E.getMessageByServerMsgId(qe))||void 0===y||y.then((function(e){var t,r,n,o,i,a;e&&("txt"===e.type?null===(r=null===(t=lt._localCache)||void 0===t?void 0:t.getInstance())||void 0===r||r.putMessageToDB(dr(dr({},e),{msg:Ae.msg,modifiedInfo:Ae.modifiedInfo,translations:Ae.translations,ext:Ke?Ae.ext:e.ext})):"custom"===e.type?null===(o=null===(n=lt._localCache)||void 0===n?void 0:n.getInstance())||void 0===o||o.putMessageToDB(dr(dr({},e),{ext:Ke?Ae.ext:e.ext,customExts:Ve,customEvent:Je,modifiedInfo:Ae.modifiedInfo})):null===(a=null===(i=lt._localCache)||void 0===i?void 0:i.getInstance())||void 0===a||a.putMessageToDB(dr(dr({},e),{ext:Ke?Ae.ext:e.ext,modifiedInfo:Ae.modifiedInfo})))}))),Ae&&(Ce?("txt"===Ae.type&&(We.message=Ae),We.modifiedInfo=Ce):We.message=Ae),[4,null===(O=null===(T=this._localCache)||void 0===T?void 0:T.getInstance())||void 0===O?void 0:O.updateLocalMessage(fe,{serverMsgId:pe,status:De.SUCCESS})];case 15:return dt.sent(),(null===(R=this._msgHash[fe])||void 0===R?void 0:R.success)instanceof Function?[4,this._msgHash[fe].success(fe,pe)]:[3,17];case 16:dt.sent(),dt.label=17;case 17:return(null===(N=this._msgHash[fe])||void 0===N?void 0:N.resolve)instanceof Function&&this._msgHash[fe].resolve(We),[3,19];case 18:return Ye=dt.sent(),nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing success function error",data:Ye}),this.onError&&this.onError(nt),null===(b=this.eventHandler)||void 0===b||b.dispatch("onError",nt),[3,19];case 19:this.onReceivedMessage&&this.onReceivedMessage({id:fe,mid:pe,to:this._msgHash[fe].to,time:0}),null===(A=this.eventHandler)||void 0===A||A.dispatch("onReceivedMessage",{id:fe,mid:pe,to:this._msgHash[fe].to}),delete this._msgHash[fe],dt.label=20;case 20:return[3,22];case 21:if(15===he.status.errorCode)(null===(M=this._msgHash[fe])||void 0===M?void 0:M.fail)instanceof Function&&this._msgHash[fe].fail({type:d.SERVICE_NOT_ALLOW_MESSAGING_MUTE,reason:"you were muted"}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject({type:d.SERVICE_NOT_ALLOW_MESSAGING_MUTE,reason:"you were muted"}),null===(U=null===(w=this._localCache)||void 0===w?void 0:w.getInstance())||void 0===U||U.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL});else if(1===he.status.errorCode){switch(Qe=void 0,he.status.reason){case"blocked":Qe=d.PERMISSION_DENIED;break;case"group not found":Qe=d.GROUP_NOT_EXIST;break;case"not in group or chatroom":Qe=d.GROUP_NOT_JOINED;break;case"exceed recall time limit":Qe=d.MESSAGE_RECALL_TIME_LIMIT;break;case"message recall disabled":Qe=d.SERVICE_NOT_ENABLED;break;case"not in group or chatroom white list":Qe=d.SERVICE_NOT_ALLOW_MESSAGING;break;case"nonroster":Qe=d.USER_NOT_FRIEND,he.status.reason="not contact";break;case"group is disabled":Qe=d.GROUP_IS_DISABLED,he.status.reason="group is disabled";break;case"limit directed users":Qe=d.MAX_LIMIT;break;case"Sorry, edit limit reached":Qe=d.MAX_LIMIT,he.status.reason="Modify message limit reached";break;case"Sorry, message does not exist":Qe=d.MODIFY_MESSAGE_NOT_EXIST,he.status.reason="The message does not exist.";break;case"Sorry, You do not have permission":Qe=d.PERMISSION_DENIED,he.status.reason="You do not have the modified permission.";break;case"Sorry, format is incorrect":Qe=d.MODIFY_MESSAGE_FORMAT_ERROR,he.status.reason="The modify messaged format error.";break;case"Sorry, edit is not available":Qe=d.SERVICE_NOT_ENABLED,he.status.reason="The message modify function is not activated.";break;case"Sorry, edit fail":Qe=d.MODIFY_MESSAGE_FAILED,he.status.reason="Modify message failed.";break;default:he.status.reason.includes("grpID")&&he.status.reason.includes("does not exist!")?(Qe=d.CHATROOM_NOT_EXIST,he.status.reason="The chat room dose not exist."):he.status.reason.includes("username")&&he.status.reason.includes("doesn't exist!")?Qe=d.USER_NOT_FOUND:"group member list is full!"===he.status.reason?Qe=d.CHATROOM_MEMBERS_FULL:he.status.reason.includes("can not join this group")&&he.status.reason.includes("is in the blacklist")?(Qe=d.PERMISSION_DENIED,he.status.reason="permission denied"):"can not operate this group, reason: group is disabled"===he.status.reason?Qe=d.GROUP_IS_DISABLED:he.status.reason.includes("moderation")?Qe=d.MESSAGE_MODERATION_BLOCKED:he.status.reason.includes("group ID illegal, please check it")?(Qe=d.REQUEST_PARAMETER_ERROR,he.status.reason="Invalid parameter"):Qe=he.status.reason.includes("has create too many chatrooms")||he.status.reason.includes("has joined too many chatrooms")?d.MAX_LIMIT:he.status.reason.includes("auto create failed")?d.SERVER_BUSY:d.SERVER_UNKNOWN_ERROR}this._msgHash[fe]&&((null===(L=this._msgHash[fe])||void 0===L?void 0:L.isHandleChatroom)?(rt=m.create({type:Qe,message:he.status.reason||"",data:""}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].error instanceof Function&&this._msgHash[fe].error(rt),S.has(fe)&&(Ze=_.failed,Qe===d.CHATROOM_NOT_EXIST?Ze=_.notFound:Qe===d.CHATROOM_MEMBERS_FULL&&(Ze=_.reachLimit),$e=S.get(fe),et=$e.rpt,tt=$e.requestName,et({isEndApi:!0,data:{isSuccess:0,requestName:tt,requestMethod:"WEBSOCKET",requestUrl:this.url,code:Ze,codeDesc:he.status.reason}}),S.delete(fe))):(rt=m.create({type:Qe,message:he.status.reason||"",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:Qe,reason:he.status.reason?he.status.reason:"",data:{id:fe,mid:pe}}),null===(D=null===(P=this._localCache)||void 0===P?void 0:P.getInstance())||void 0===D||D.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})),delete this._msgHash[fe])}else if(7===he.status.errorCode)"sensitive words"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"sensitive words",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,data:{id:fe,mid:pe,reason:"sensitive words"}}),null===(x=null===(k=this._localCache)||void 0===k?void 0:k.getInstance())||void 0===x||x.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"blocked by mod_antispam"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"blocked by mod_antispam",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,data:{id:fe,mid:pe,reason:"blocked by mod_antispam"}}),null===(G=null===(B=this._localCache)||void 0===B?void 0:B.getInstance())||void 0===G||G.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"user is mute"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.USER_MUTED_BY_ADMIN,message:"user is mute",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail(rt),null===(F=null===(H=this._localCache)||void 0===H?void 0:H.getInstance())||void 0===F||F.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"traffic limit"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.MESSAGE_CURRENT_LIMITING,message:"traffic limit",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail(rt),null===(z=null===(W=this._localCache)||void 0===W?void 0:W.getInstance())||void 0===z||z.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"Sorry, data is too large"===he.status.reason&&this._msgHash[fe]&&(rt=m.create({type:d.MESSAGE_SIZE_LIMIT,message:"Sorry, data is too large",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail(rt),null===(K=null===(q=this._localCache)||void 0===q?void 0:q.getInstance())||void 0===K||K.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL}));else if(19===he.status.errorCode)this._msgHash[fe]&&(C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,codeDesc:he.status.reason||"",msgId:pe,messageType:null!==(J=I[null===(V=this._msgHash[fe])||void 0===V?void 0:V.chatType])&&void 0!==J?J:I.singleChat}}),C.delete(fe)),rt=m.create({type:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,message:he.status.reason||"",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,data:{id:fe,mid:pe,reason:he.status.reason}}),null===(X=null===(Y=this._localCache)||void 0===Y?void 0:Y.getInstance())||void 0===X||X.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL}));else if(this._msgHash[fe]){C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.WEBIM_LOAD_MSG_ERROR,codeDesc:(null===(Q=he.status)||void 0===Q?void 0:Q.reason)||"",msgId:pe,messageType:null!==($=I[null===(Z=this._msgHash[fe])||void 0===Z?void 0:Z.chatType])&&void 0!==$?$:I.singleChat}}),C.delete(fe));try{rt=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:(null===(ee=he.status)||void 0===ee?void 0:ee.reason)||"",data:{id:fe,mid:pe,reason:he.status&&he.status.reason}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),null===(re=null===(te=this._localCache)||void 0===te?void 0:te.getInstance())||void 0===re||re.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL}),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.WEBIM_LOAD_MSG_ERROR,data:{errorCode:he.status&&he.status.errorCode,reason:he.status&&he.status.reason}})}catch(e){nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing fail function error",data:e}),this.onError&&this.onError(nt),null===(ne=this.eventHandler)||void 0===ne||ne.dispatch("onError",nt)}delete this._msgHash[fe]}else C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,codeDesc:"on message error",msgId:pe,messageType:null!==(ie=I[null===(oe=this._msgHash[fe])||void 0===oe?void 0:oe.chatType])&&void 0!==ie?ie:I.singleChat}}),C.delete(fe)),nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"on message error"}),this.onError&&this.onError(nt),null===(ae=this.eventHandler)||void 0===ae||ae.dispatch("onError",nt);dt.label=22;case 22:return[2];case 23:if(he.metas&&0!==he.metas.length){this._offlineMessagePullState!==Ee.SYNC_FINISH&&qr.set(he.queue.name,he.metas.length);try{Ir.call(this,he.metas,he.status)}catch(e){nt=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:"decode message error",data:e}),j.error("decode message error",e),this.onError&&this.onError(nt),null===(se=this.eventHandler)||void 0===se||se.dispatch("onError",nt)}finally{he.isLast?(j.debug("DLMessage isLast",he.isLast),ot=-1,this._queues.some((function(e,t){return e.name===he.name&&(ot=t,!0)}))&&ot>0&&this._queues.splice(ot,1),this._queues.length>0&&br.call(this,this._queues[0]),Rr.call(this,he)):he.nextKey&&(st=new(f())(he.nextKey.low,he.nextKey.high,he.nextKey.unsigned).toString(),j.debug("nexKey:",st,"this.nextKey:",this.nexKey),st!==this.nexKey||(null===(ce=he.queue)||void 0===ce?void 0:ce.name)!==this.currentQueue?(this.nexKey=st,this.currentQueue=null===(ue=he.queue)||void 0===ue?void 0:ue.name,Ur.call(this,he.nextKey,he.queue)):(j.debug("nexKey and queue are same, delete it"),it=-1,this._queues.some((function(e,t){return e.name===he.queue.name&&(it=t,!0)}))&&this._queues.splice(it,1),this._queues.length>0&&br.call(this,this._queues[0])))}}else he.isLast?(j.debug("isLast",he.isLast),at=-1,this._queues.some((function(e,t){return e.name===he.queue.name&&(at=t,!0)}))&&this._queues.splice(at,1),this._queues.length>0&&br.call(this,this._queues[0]),Rr.call(this,he)):he.nextKey&&(st=new(f())(he.nextKey.low,he.nextKey.high,he.nextKey.unsigned).toString(),j.debug("nexKey:",st,"this.nextKey:",this.nexKey),st!==this.nexKey||(null===(le=he.queue)||void 0===le?void 0:le.name)!==this.currentQueue?(this.nexKey=st,this.currentQueue=null===(de=he.queue)||void 0===de?void 0:de.name,Ur.call(this,he.nextKey,he.queue)):(j.debug("nexKey and queue are same, delete it"),ct=-1,this._queues.some((function(e,t){return e.name===he.queue.name&&(ct=t,!0)}))&&this._queues.splice(ct,1),this._queues.length>0&&br.call(this,this._queues[0])));return[2]}}))}))}function Vr(e){var t=[],r=this.root.lookup("easemob.pb.KeyValue"),n=[];for(var o in e){var i=r.decode(t);if(i.key=o,void 0!==e[o]){if("object"==typeof e[o])i.type=8,i.stringValue=JSON.stringify(e[o]);else if("string"==typeof e[o])i.type=7,i.stringValue=e[o];else if("boolean"==typeof e[o])i.type=1,i.varintValue=!0===e[o]?1:0;else if(Number.isInteger(e[o]))i.type=2,i.varintValue=e[o];else if("bigint"==typeof e[o]||"symbol"==typeof e[o]||"function"==typeof e[o]||Number.isNaN(e[o]))i.type=7,i.stringValue=e[o].toString();else{if("number"!=typeof e[o]||Number.isInteger(e[o]))continue;i.type=6,i.doubleValue=e[o]}n.push(i)}}return n}function Jr(e){var t,r,n,o=[];if(this.root){var i,a=this.root.lookup("easemob.pb.MessageBody.Content").decode(o);switch(i=!e.group&&"groupchat"!==(null===(t=null==e?void 0:e.chatType)||void 0===t?void 0:t.toLowerCase())||e.roomType?e.group&&e.roomType||"chatroom"===(null===(r=null==e?void 0:e.chatType)||void 0===r?void 0:r.toLowerCase())?"chatRoom":"singleChat":"groupChat",e.type){case"txt":a.type=0,a.text=e.msg;break;case"img":a.type=1,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.size=e.body.size,a.thumbnailDisplayName=e.body.filename):e.file?(a.displayName=e.file.filename,a.remotePath=e.file.url,a.secretKey=e.file.secret,a.fileLength=e.file.file_length,a.size=e.file.size,a.thumbnailDisplayName=e.file.filename):(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.size=e.size,a.thumbnailDisplayName=e.filename),e.isBuildCombinedMsg&&(a.remotePath=e.url,a.secretKey=e.secret,a.size={height:e.height,width:e.width}),e.isGif&&(a.subType=1);var s=e.imageType,c=e.isGif||!0===e.isOriginalImage||"original"===s;a.imageType=c?1:2;break;case"video":a.type=2,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.duration=e.body.length,a.thumbnailDisplayName=e.body.filename,a.thumbnailRemotePath=this.useOwnUploadFun?"":"".concat(e.body.url,"?vframe=true"),a.thumbnailSecretKey=this.useOwnUploadFun?"":e.body.secret):e.isBuildCombinedMsg&&(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.duration=e.length,a.thumbnailDisplayName=e.filename,a.thumbnailRemotePath=e.thumb,a.thumbnailSecretKey=e.thumb_secret);break;case"loc":a.type=3,a.latitude=e.lat,a.longitude=e.lng,a.address=e.addr,a.buildingName=e.buildingName,a.latitude=e.lat;break;case"audio":a.type=4,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.duration=e.body.length,a.thumbnailDisplayName=e.body.filename):e.isBuildCombinedMsg&&(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.duration=e.length,a.thumbnailDisplayName=e.filename);break;case"file":a.type=5,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.thumbnailDisplayName=e.body.filename):e.isBuildCombinedMsg&&(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.thumbnailDisplayName=e.filename);break;case"cmd":a.type=6,a.action=e.action;break;case"custom":a.type=7,a.customEvent=e.customEvent,a.customExts=Vr.call(this,e.customExts);break;case"combine":a.type=0,a.subType=0,a.text=e.compatibleText,a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.title=e.title,a.summary=e.summary,a.combineLevel=e.combineLevel}var u=[];e.ext&&(u=Vr.call(this,e.ext));var l=this.root.lookup("easemob.pb.MessageBody"),h=l.decode(o),p=e.from||this.context.jid.name;h.from={name:e.isBuildCombinedMsg?p:this.context.jid.name};var m=e.to.indexOf("/"),g=m>-1?e.to.substring(0,m):e.to;if(h.to={name:g},"channel"===e.type)h.type=sr.CHANNEL_ACK,e.mid&&(h.ackMessageId=e.mid);else if("recall"===e.type)h.type=sr.RECALL,h.ackMessageId=e.ackId;else if("delivery"===e.type)h.type=sr.DELIVER_ACK,h.ackMessageId=e.ackId;else if("read"===e.type)h.type=sr.READ_ACK,h.ackMessageId=e.ackId,"groupChat"===i&&(h.msgConfig={allowGroupAck:!0},h.ackContent=e.ackContent);else if("chatRoom"===i)h.type=sr.CHATROOM;else if("groupChat"===i){if(h.type=sr.GROUPCHAT,e.msgConfig){var v=e.msgConfig.allowGroupAck;h.msgConfig={allowGroupAck:!!v}}}else"singleChat"===i&&(h.type=sr.SINGLECHAT);e.editMessageId&&(h.type=sr.EDIT,h.editMessageId=e.editMessageId,h.editScope=cr.BODY,e.ext&&(h.editScope=cr.BODY_AND_EXT)),h.contents=[a],h.ext=u;var E=function(e){var t={};return"translations"in e&&(t.translations=e.translations),"isChatThread"in e&&e.isChatThread&&(t.thread={}),Object.keys(t).length>0?JSON.stringify(t):""}(e);E&&(h.meta=E),h=l.encode(h).finish();var y=this.root.lookup("easemob.pb.Meta"),_=y.decode(o);_.id=e.id;var T="easemob.com";if("chatRoom"!==i&&"groupChat"!==i||(T="conference.easemob.com"),_.to={appKey:this.appKey,name:g,domain:T},m>-1&&(_.to.clientResource=e.to.substring(m+1,e.to.length)),"chatRoom"===i&&(_.ext=Vr.call(this,function(e){return{chatroom_msg_tag:"high"===e.priority?0:"low"===e.priority?2:1}}(e))),"recall"===e.type&&e.metaExt&&(_.ext=Vr.call(this,{recallMessageExtensionInfo:e.metaExt})),_.ns=1,_.payload=h,_.routetype=e.deliverOnlineOnly?1:0,"singleChat"!==i&&Array.isArray(e.receiverList)&&(null===(n=e.receiverList)||void 0===n?void 0:n.length)>0&&(_.directedUsers=e.receiverList,_.routetype=2),"delivery"!==e.type&&void 0!==e.webhookEnv){if("string"!=typeof e.webhookEnv)throw Error('Invalid parameter: "webhookEnv"');_.env=e.webhookEnv}if(e.isBuildCombinedMsg)return _.timestamp=f().fromValue(e.time),y.encode(_).finish();var I=this.root.lookup("easemob.pb.CommSyncUL"),O=I.decode(o);O.meta=_,!e.isPing&&Xr.call(this,e,_),O=I.encode(O).finish();var R=this.root.lookup("easemob.pb.MSync"),C=R.decode(o);return C.version=this.version,C.encryptType=this.encryptType,C.command=0,C.payload=O,C.traceId=fr.gen(),j.debug("traceId",C.traceId),R.encode(C).finish()}e.fail&&e.fail({type:d.WEBIM_CONNCTION_CLIENT_OFFLINE,message:"Not logged in"})}function Yr(e){var t,r,n,o,i,a,s,c,u,l=this,h=dr({},e);if(h.editMessageId){var p=Jr.call(this,h);tn.call(this,p)}else{if(e.file||"img"===e.type&&e._filePath){if(h.accessToken=this.token,h.appKey=this.appKey,h.apiUrl=this.apiUrl,h.body&&h.body.url)return Jr.call(this,h);var f=(null===(r=null===(t=h.file)||void 0===t?void 0:t.data)||void 0===r?void 0:r.type)||(null===(n=h.file)||void 0===n?void 0:n.filetype)||h.filetype||"";if(h.isGif&&f&&"image/gif"!==f)return void this._msgHash[h.id].reject({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"The file type is not gif."});var m=null!==(a=null===(i=null===(o=h.file)||void 0===o?void 0:o.data)||void 0===i?void 0:i.size)&&void 0!==a?a:h.file_length;if("number"==typeof m&&m<=0){var g={type:d.WEBIM_UPLOADFILE_ERROR,message:"fileSize must be greater than 0"};return h.onFileUploadError instanceof Function&&h.onFileUploadError(g),void(null===(s=this._msgHash[h.id])||void 0===s||s.reject(g))}return new Promise((function(t,r){var n=h.onFileUploadComplete,o=h.onFileUploadError,i=function(e,t){var r,n={type:d.WEBIM_UPLOADFILE_ERROR,message:e,data:t};o instanceof Function&&o(n),null===(r=l._msgHash[h.id])||void 0===r||r.reject(n)},a=function(e){var t=(null==e?void 0:e.message)||"";return/missing .*capability|requires file path string/i.test(t)},s=function(t){var r,o,i,a,s,c,u,p,f,m,g,E,y;if(t.entities){if(t.entities[0]["file-metadata"]){var _=t.entities[0]["file-metadata"]["content-length"];h.file_length=_,h.filetype=t.entities[0]["file-metadata"]["content-type"],_>204800&&(h.thumbnail=!0)}var T,I,O,R=(null===(o=h.file)||void 0===o?void 0:o.filename)||h.filename||(null===(i=h.body)||void 0===i?void 0:i.filename)||"image",S=h.filetype||(null===(a=h.file)||void 0===a?void 0:a.filetype)||(null===(s=t.entities[0]["file-metadata"])||void 0===s?void 0:s["content-type"])||"",b=null!==(g=null!==(f=null!==(p=null===(u=null===(c=h.file)||void 0===c?void 0:c.data)||void 0===u?void 0:u.size)&&void 0!==p?p:h.file_length)&&void 0!==f?f:null===(m=t.entities[0]["file-metadata"])||void 0===m?void 0:m["content-length"])&&void 0!==g?g:0,A="".concat(l.getChatFilesUrl(),"/").concat(t.entities[0].uuid);if(h.body={type:h.type||"file",secret:t.entities[0]["share-secret"],filename:R,url:A,length:h.length||0,filetype:S,file_length:b,size:{width:h.width||0,height:h.height||0}},h.file&&(h.file.url=t.uri),e.secret=t.entities[0]["share-secret"],t.url=e.url="".concat(A,"?em-redirect=true&share-secret=").concat(t.entities[0]["share-secret"]),e.file_length=h.file_length=b,"img"===h.type){var M=(T=A,I=t.entities[0]["share-secret"],O="em-redirect=true".concat(I?"&share-secret=".concat(I):""),{originalImageUrl:"".concat(T,"?").concat(O),bigImageUrl:"".concat(T,"?size=large&").concat(O)}),w="".concat(e.url,"&thumbnail=true");e.thumb=w,t.thumb="".concat(t.url,"&thumbnail=true"),e.originalImageUrl=M.originalImageUrl,e.bigImageUrl=M.bigImageUrl,t.originalImageUrl=M.originalImageUrl,t.bigImageUrl=M.bigImageUrl}"video"===h.type&&(e.thumb="".concat(e.url,"&vframe=true"),e.thumb_secret=t.entities[0]["share-secret"],t.thumb="".concat(t.url,"&vframe=true")),n instanceof Function&&n(t,h.id);var U=Jr.call(l,h);C.size<=N&&C.set(h.id,{rpt:l.dataReport.geOperateFun({operationName:v.SEND_MSG})}),null===(y=null===(E=l._localCache)||void 0===E?void 0:E.getInstance())||void 0===y||y.storeMessage(e,De.INPROGRESS),tn.call(l,U)}else null===(r=l._msgHash[h.id])||void 0===r||r.reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the file",data:t})};h.onFileUploadComplete=s,h.onFileUploadError=function(e){var t;o instanceof Function&&o(e),null===(t=l._msgHash[h.id])||void 0===t||t.reject({type:d.WEBIM_UPLOADFILE_ERROR,message:e.message||"Failed to upload the file",data:e})},hr(l,void 0,void 0,(function(){var e,t,r,n,o,c,u,l,d,p,f,m,g,E,y,_,T,I,O,R,C,S,N,b,A,M,w,U,L,P,D,k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z;return pr(this,(function($){switch($.label){case 0:if($.trys.push([0,26,,27]),"img"!==h.type)return[3,25];if(e=this._imageProcessor,t=null===(B=h.file)||void 0===B?void 0:B.data,r=h._filePath,n=null!==(H=null!==(G=null==t?void 0:t.size)&&void 0!==G?G:h.file_length)&&void 0!==H?H:0,o=(null==t?void 0:t.type)||(null===(F=h.file)||void 0===F?void 0:F.filetype)||h.filetype||"",c=h.imageType,u=h.isGif||!0===h.isOriginalImage||"original"===c,l=void 0,!r||!e)return[3,4];$.label=1;case 1:return $.trys.push([1,3,,4]),[4,e.getImageInfo(r)];case 2:return(l=$.sent()).path&&l.path!==r&&(j.debug("Miniapp image message file path normalized",r,l.path),r=l.path,h._filePath=l.path),[3,4];case 3:return d=$.sent(),j.warn("Failed to normalize miniapp image path",d),[3,4];case 4:if(h.width&&h.height||!t&&!r)return[3,12];$.label=5;case 5:return $.trys.push([5,11,,12]),e?(f=l)?[3,7]:[4,e.getImageInfo(r||t)]:[3,8];case 6:f=$.sent(),$.label=7;case 7:return p=f,r&&p.path&&p.path!==r&&(r=p.path,h._filePath=p.path),h.width||(h.width=p.width),h.height||(h.height=p.height),[3,10];case 8:return"undefined"==typeof Image||"undefined"==typeof URL?[3,10]:[4,new Promise((function(e,r){var n=new Image,o=URL.createObjectURL(t);n.onload=function(){URL.revokeObjectURL(o),e({w:n.width,h:n.height})},n.onerror=function(){URL.revokeObjectURL(o),r(new Error("load failed"))},n.src=o}))];case 9:m=$.sent(),h.width||(h.width=m.w),h.height||(h.height=m.h),$.label=10;case 10:return[3,12];case 11:return g=$.sent(),r&&a(g)?(i("Failed to read image info on mini program platform",g),[2]):(j.warn("Failed to read image info",g),[3,12]);case 12:if(r&&(!h.width||!h.height)&&!e)return i("Mini program platform is missing image info capability"),[2];if(E=h.width,y=h.height,_=r||t,!u&&!h.isGif&&r&&!e)return i("Mini program platform is missing image compression capability"),[2];if(u||h.isGif||!e)return[3,16];if(!(T=r||t))return[3,16];$.label=13;case 13:return $.trys.push([13,15,,16]),[4,e.generateBigImage(T,{maxShortEdge:720,quality:.85})];case 14:return(I=$.sent())&&(I.file&&(h.file=dr(dr({},h.file),{data:I.file})),I.path&&(h._filePath=I.path,r=I.path),h.file_length=I.size,h.filetype=I.type,h.file&&(h.file.filetype=I.type),h.width=I.width,h.height=I.height,j.debug("Image compressed for large send","".concat(I.width,"x").concat(I.height,", size: ").concat(I.size))),[3,16];case 15:return O=$.sent(),r&&a(O)?(i("Mini program platform is missing image compression capability",O),[2]):(j.warn("Big image generation failed, falling back to original",O),h.isOriginalImage=!0,u=!0,[3,16]);case 16:return L=null!==(K=null!==(q=null===(z=null===(W=h.file)||void 0===W?void 0:W.data)||void 0===z?void 0:z.size)&&void 0!==q?q:h.file_length)&&void 0!==K?K:0,R=u?"original":"large",this.enableMd5Check?(h._uploadMd5=void 0,P="",e&&_?[3,17]:(j.warn("Image MD5 capability or source is missing, proceeding without MD5"),[3,20])):[3,24];case 17:return $.trys.push([17,19,,20]),[4,e.computeMd5(_)];case 18:return P=$.sent(),h._uploadMd5=P,[3,20];case 19:return C=$.sent(),j.warn("Failed to compute image MD5, proceeding without MD5",C),[3,20];case 20:if(!P||!nr(L,"img",R))return[3,24];$.label=21;case 21:return $.trys.push([21,23,,24]),[4,ar(this,P,"img",R)];case 22:return(k=$.sent()).hit&&k.uuid?("original"===(S=k.effectiveImageType||R)&&(h.isOriginalImage=!0,u=!0,h.width=E,h.height=y),j.debug("Precheck hit, skipping upload","uuid: ".concat(k.uuid),"effectiveImageType: ".concat(S)),N="original"===S?n:L,b="original"===S?o||(null===(V=h.file)||void 0===V?void 0:V.filetype)||"image/jpeg":(null===(J=h.file)||void 0===J?void 0:J.filetype)||h.filetype||"image/jpeg",A={entities:[{uuid:k.uuid,"share-secret":k.shareSecret||"","file-metadata":{"content-length":N,"content-type":b}}],uri:"".concat(this.getChatFilesUrl(),"/").concat(k.uuid)},s(A),[2]):[3,24];case 23:return M=$.sent(),j.warn("Precheck error, proceeding with upload",M),[3,24];case 24:h._uploadImageType=ir(R),$.label=25;case 25:return[3,27];case 26:return w=$.sent(),j.warn("Image preprocessing failed, proceeding with normal upload",w),[3,27];case 27:return this.enableMd5Check&&"img"!==h.type?(U=null===(Y=h.file)||void 0===Y?void 0:Y.data,L=null!==(Q=null!==(X=null==U?void 0:U.size)&&void 0!==X?X:h.file_length)&&void 0!==Q?Q:0,h._uploadMd5=void 0,P="",U?[3,28]:(j.warn("Attachment source is unavailable, proceeding without MD5"),[3,31])):[3,35];case 28:return $.trys.push([28,30,,31]),[4,or(U)];case 29:return P=$.sent(),h._uploadMd5=P,[3,31];case 30:return D=$.sent(),j.warn("Failed to compute attachment MD5, proceeding without MD5",D),[3,31];case 31:if(!P||!nr(L,h.type))return[3,35];$.label=32;case 32:return $.trys.push([32,34,,35]),[4,ar(this,P,h.type)];case 33:return(k=$.sent()).hit&&k.uuid?(j.debug("Attachment precheck hit, skipping upload","uuid: ".concat(k.uuid),"type: ".concat(h.type)),s({entities:[{uuid:k.uuid,"share-secret":k.shareSecret||"","file-metadata":{"content-length":L,"content-type":U.type||h.filetype||(null===(Z=h.file)||void 0===Z?void 0:Z.filetype)||""}}],uri:"".concat(this.getChatFilesUrl(),"/").concat(k.uuid)}),[2]):[3,35];case 34:return x=$.sent(),j.warn("Attachment precheck failed, proceeding with upload",x),[3,35];case 35:return _e.uploadFile.call(this,h,v.UPLOAD_MSG_ATTACH),[2]}}))}))}))}if("combine"===e.type){h.accessToken=this.token,h.appKey=this.appKey,h.apiUrl=this.apiUrl;var E=h.onFileUploadComplete,y=h.onFileUploadError;return new Promise((function(t,r){var n,o,i,a;if((null===(n=e.messageList)||void 0===n?void 0:n.length)>300||0===(null===(o=e.messageList)||void 0===o?void 0:o.length))return l._msgHash[h.id].reject({type:d.MAX_LIMIT,message:"The number of combined messages exceeded the limit."});var s=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([],e.messageList,!0),c=0;if(s.forEach((function(e){(null==e?void 0:e.combineLevel)>c&&(c=null==e?void 0:e.combineLevel)})),h.combineLevel=c+1,h.combineLevel>10)return l._msgHash[h.id].reject({type:d.MAX_LIMIT,message:"The level of the merged message exceeded the limit."});var u=Qr.call(l,s),p=function(t,r){var n,o,i,a,s,c,u="".concat(l.getChatFilesUrl(),"/").concat(t.entities[0].uuid),d=null===(n=t.entities[0])||void 0===n?void 0:n["share-secret"],p="".concat(u,"?em-redirect=true");d&&(p="".concat(p,"&share-secret=").concat(d)),E instanceof Function&&E({url:p,secret:d}),e.url=p,e.secret=d,h.url=p,h.secret=t.entities[0]["share-secret"],h.filename=(null===(o=h.file)||void 0===o?void 0:o.filename)||(null==r?void 0:r.fileName),h.file_length=(null===(a=null===(i=h.file)||void 0===i?void 0:i.data)||void 0===a?void 0:a.size)||(null==r?void 0:r.fileLength)||0,null===(c=null===(s=l._localCache)||void 0===s?void 0:s.getInstance())||void 0===c||c.storeMessage(e,De.INPROGRESS);var f=Jr.call(l,h);tn.call(l,f)},f=_e.getEnvInfo();if("web"!==f.platform&&"node"!==f.platform&&"quick_app"!==f.platform&&(null===(a=null===(i=f.global)||void 0===i?void 0:i.canIUse)||void 0===a?void 0:a.call(i,"getFileSystemManager"))){var m=f.global.getFileSystemManager(),g=l.getChatFilesUrl();m.writeFile({filePath:"".concat(f.global.env.USER_DATA_PATH,"/combine"),data:u.buffer,encoding:"binary",success:function(e){f.global.uploadFile({url:g,filePath:"".concat(f.global.env.USER_DATA_PATH,"/combine"),name:"file",header:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+h.accessToken},success:function(e){if(200===e.statusCode){j.debug("upload success");var t=JSON.parse(e.data);p(t,{fileName:"combine",fileLength:u.length})}else j.error("upload fail"),h.onFileUploadError instanceof Function&&h.onFileUploadError(e),this._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})},fail:function(t){j.error("upload fail"),h.onFileUploadError instanceof Function&&h.onFileUploadError(e),this._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:t})}})},fail:function(e){j.error("write file fail",e),this._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})}})}else{var _=new File([u],"combine",{type:"application/octet-stream"}),T={url:URL.createObjectURL(_),filename:h.id,data:_};h.file=T,h.onFileUploadComplete=function(e){p(e)},h.onFileUploadError=function(e){y instanceof Function&&y(e),l._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})},_e.uploadFile.call(l,h,v.UPLOAD_MSG_ATTACH)}}))}"img"===e.type&&(h.body||(h.body=dr(dr({},h),{size:{width:h.width||0,height:h.height||0}}))),null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u||u.storeMessage(e,De.INPROGRESS),p=Jr.call(this,h),tn.call(this,p)}}function Xr(e,t){if(e.editMessageId)return t.ignoreCallback=!0,void(this._msgHash[e.id].thirdMessage=t);mr.includes(e.type)&&(this._msgHash[e.id].thirdMessage=t)}function Qr(e){for(var t=Uint8Array.from("cm",(function(e){return e.charCodeAt(0)})),r=0;r<e.length;r++){for(var n=e[r],o=dr(dr({},n),{isBuildCombinedMsg:!0}),i=this.mSync.encodeChatMsg.call(this,o),a=i.length,s=new Uint8Array(4),c=0;c<4;c++)s[c]=a>>8*(3-c)&255;var u=new Uint8Array(t.length+s.length+i.length);u.set(t),u.set(s,t.length),u.set(i,t.length+s.length),t=u}var l=new Uint8Array(t.length+1),d=0;for(r=2;r<t.length;r++)r%2==1&&(d^=t[r]);return l.set(t),j.debug("checkResult:",d),l[t.length]=d,l}function Zr(e,t,r){var n=[],o=this.root.lookup("easemob.pb.MUCBody"),i=e.roomId,a=e.ext,s=void 0===a?"":a,c=e.leaveOtherRooms,u=void 0!==c&&c,l=o.decode(n);l.mucId={appKey:this.appKey,name:i,domain:"conference.easemob.com"},l.operation="join"===r?2:3,l.from={name:this.context.userId},l.isChatroom=!0,"join"===r&&(l.ext=s,l.leaveOtherRooms=u),l=o.encode(l).finish();var d=this.root.lookup("easemob.pb.Meta").decode(n);d.id=t,d.from={appKey:this.appKey,name:this.context.userId,domain:"easemob.com",client_resource:this.context.jid.clientResource},d.to={domain:"easemob.com"},d.ns=2,d.payload=l;var h=this.root.lookup("easemob.pb.CommSyncUL"),p=h.decode(n);p.meta=d,p=h.encode(p).finish();var f=this.root.lookup("easemob.pb.MSync"),m=f.decode(n);return m.version=this.version,m.encryptType=this.encryptType,m.command=0,m.payload=p,m.traceId=fr.gen(),j.debug("traceId",m.traceId),f.encode(m).finish()}function $r(e,t){var r=_e.getUniqueId(),n=Zr.call(this,e,r,t),o="join"===t?v.JOIN_CHATROOM:v.QUIT_CHATROOM,i=this.dataReport.geOperateFun({operationName:o});return S.size<=N&&S.set(r,{rpt:i,requestName:o}),tn.call(this,dr(dr({},e),{isHandleChatroom:!0,joinMsg:n,id:r,operation:t}),r)}function en(e){var t=this;return new Promise((function(r,n){var o,i,a,s,c,u;if(j.debug("call send"),t.logOut)return j.error("send message failed",d.WEBIM_CONNECTION_CLOSED),n({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"});if(!e.id||"string"!=typeof e.id||""===e.id)return n({type:d.MESSAGE_PARAMETER_ERROR,message:'Missing required parameter: "id"'});if(!e.to||"string"!=typeof e.to||""===e.to)return n({type:d.MESSAGE_PARAMETER_ERROR,message:'Missing required parameter: "to"'});var l="file"===e.type||"img"===e.type||"audio"===e.type||"video"===e.type,h="delivery"===e.type||"read"===e.type||"channel"===e.type,p="cmd"===e.type,f="recall"===e.type,m=null==e?void 0:e.editMessageId,g=!(h||f||p||m);if(e.id){if(!l&&!h||l&&t.useOwnUploadFun){var E="recall"===e.type?v.SEND_RECALL_MSG:v.SEND_MSG;m&&(E=v.MODIFY_MESSAGE),C.size<=N&&C.set(e.id,{rpt:t.dataReport.geOperateFun({operationName:E})})}g&&(null===(i=null===(o=t._localCache)||void 0===o?void 0:o.getInstance())||void 0===i||i.storeMessage(e,De.CREATE)),t._msgHash[e.id]=dr(dr({},e),{resolve:r,reject:n})}if(l||"combine"===e.type)return Yr.call(t,e);if("txt"===e.type&&(null===(a=e.msgConfig)||void 0===a?void 0:a.languages)&&Array.isArray(null===(s=e.msgConfig)||void 0===s?void 0:s.languages)&&e.msgConfig.languages.length>0){var y=t.translateMessage||t.translation.translateMessage;if(!y)throw new Error("there is no method to translate message");y.call(t,{text:e.msg,languages:e.msgConfig.languages}).then((function(r){var n,o,i,a=null===(n=r.data[0])||void 0===n?void 0:n.translations;a=a.map((function(e){return{code:e.to,text:e.text}})),e.translations=a,t._msgHash[e.id].translations=a,null===(i=null===(o=t._localCache)||void 0===o?void 0:o.getInstance())||void 0===i||i.storeMessage(e,De.INPROGRESS);var s=Jr.call(t,e);tn.call(t,s,e.id)})).catch((function(e){n(e)}))}else{g&&(null===(u=null===(c=t._localCache)||void 0===c?void 0:c.getInstance())||void 0===u||u.storeMessage(e,De.INPROGRESS));var _=Jr.call(t,e);tn.call(t,_,e.id)}}))}function tn(e,t){var r,n,o,i,a=this;if(e.isHandleChatroom){if(!this.isOpened()){var s={data:"",type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"};if(S.has(e.id)){var c=S.get(e.id);(0,c.rpt)({isEndApi:!0,data:{isSuccess:0,requestName:c.requestName,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.disconnect,codeDesc:"websocket has been disconnected"}}),S.delete(e.id)}return Promise.reject(s)}return new Promise((function(r,n){var o,i;a._msgHash[e.id]=dr(dr({},e),{resolve:r,reject:n});var s=Jt.call(a,e.joinMsg),c=s[0];if(!s[1]){var u={type:d.SDK_RUNTIME_ERROR,message:"compress message failed"};return null===(i=null===(o=a._msgHash[e.id])||void 0===o?void 0:o.reject)||void 0===i||i.call(o,u),void delete a._msgHash[e.id]}var l=a._getSock?_r.call(a,c,t):c;if(t){var h=setTimeout((function(){var t,r=a._msgHash[e.id];if(r){var n={type:d.REQUEST_TIMEOUT,message:"request timeout"};null===(t=r.reject)||void 0===t||t.call(r,n),clearTimeout(r.messageTimer),delete a._msgHash[e.id],a.reconnecting||a.reconnect(!0)}}),15e3);a._msgHash[e.id].messageTimer=h}a.sock.send(l)}))}if(!this.isOpened())return null===(r=this.unMSyncSendMsgMap)||void 0===r||r.set(t,e),!this.logOut&&this.autoReconnectNumTotal<this.autoReconnectNumMax&&(j.info("need to reconnect",this.autoReconnectNumTotal,this.autoReconnectNumMax),this.offLineSendConnecting=!0,this.reconnecting||this.reconnect()),void(this.onError&&this.onError({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"}));var u=t&&setTimeout((function(){var e,r,n;if(a._msgHash[null!=t?t:""]){var o={type:d.MESSAGE_SEND_TIMEOUT,message:"send message timeout"};null===(r=(e=a._msgHash[null!=t?t:""]).reject)||void 0===r||r.call(e,o),clearTimeout(null===(n=a._msgHash[null!=t?t:""])||void 0===n?void 0:n.messageTimer),delete a._msgHash[null!=t?t:""],a.reconnecting||a.reconnect(!0)}}),15e3);this._msgHash[null!=t?t:""]&&(this._msgHash[null!=t?t:""].messageTimer=u);var l=Jt.call(this,e),h=l[0];if(!l[1])return s={type:d.SDK_RUNTIME_ERROR,message:"compress message failed"},null===(o=null===(n=this._msgHash[null!=t?t:""])||void 0===n?void 0:n.reject)||void 0===o||o.call(n,s),clearTimeout(null===(i=this._msgHash[null!=t?t:""])||void 0===i?void 0:i.messageTimer),void delete this._msgHash[null!=t?t:""];var p=this._getSock?_r.call(this,h,t):h;this.sock.send(p)}var rn=function(e,t){return e.send=en,e.sendMsg=en,j.info("init Msync by ".concat(e.name)),{generateProvision:Er.bind(e),generateLogout:yr.bind(e),base64transform:_r.bind(e),distributeMeta:Tr.bind(e),decodeMeta:Ir.bind(e),decodeUnreadDL:Cr.bind(e),_rebuild:Sr.bind(e),_lastsession:Ar.bind(e),receiveProvision:Lr.bind(e),isInQueue:Hr.bind(e),decodeNotice:Fr.bind(e),decodeMSync:Wr.bind(e),distributeMSync:zr.bind(e),encodeChatMsg:Jr.bind(e),upLoadFile:Yr.bind(e),send:en.bind(e),stopHeartBeat:Gr.bind(e),handleChatRoom:$r.bind(e),sendUnreadDeal:xr.bind(e)}},nn=["onTextMessage","onFileMessage","onAudioMessage","onVideoMessage","onImageMessage","onLocationMessage","onCustomMessage","onCMDMessage","onStreamMessage"],on=function(){function e(e,t,r){this.handlerData={},this.handlerData={},e.addEventHandler=this.addEventHandler.bind(this),e.removeEventHandler=this.removeEventHandler.bind(this)}return e.prototype.addEventHandler=function(e,t){this.handlerData[e]=t},e.prototype.removeEventHandler=function(e){delete this.handlerData[e]},e.prototype.dispatch=function(e,t){for(var r in nn.includes(e)&&t?j.debug("dispatch event: "+e,{id:t.id,type:t.type,time:t.time,from:t.from,to:t.to,chatType:t.chatType}):"onMessage"===e?j.debug("dispatch event: "+e,null==t?void 0:t.length):j.debug("dispatch event: "+e,t||""),this.handlerData){var n=this.handlerData[r][e];n&&n(t)}},e}(),an=function(){};function sn(e){this.onOpened=e.onOpened||an,this.onPresence=e.onPresence||an,this.onTextMessage=e.onTextMessage||an,this.onPictureMessage=e.onPictureMessage||an,this.onAudioMessage=e.onAudioMessage||an,this.onVideoMessage=e.onVideoMessage||an,this.onFileMessage=e.onFileMessage||an,this.onLocationMessage=e.onLocationMessage||an,this.onCmdMessage=e.onCmdMessage||an,this.onCustomMessage=e.onCustomMessage||an,this.onReceivedMessage=e.onReceivedMessage||an,this.onDeliveredMessage=e.onDeliveredMessage||an,this.onReadMessage=e.onReadMessage||an,this.onRecallMessage=e.onRecallMessage||an,this.onChannelMessage=e.onChannelMessage||an,this.onError=e.onError||an,this.onOffline=e.onOffline||an,this.onOnline=e.onOnline||an,this.onStatisticMessage=e.onStatisticMessage||an,this.onContactInvited=e.onContactInvited||an,this.onContactAgreed=e.onContactAgreed||an,this.onContactRefuse=e.onContactRefuse||an,this.onContactDeleted=e.onContactDeleted||an,this.onContactAdded=e.onContactAdded||an,this.onTokenWillExpire=e.onTokenWillExpire||an,this.onTokenExpired=e.onTokenExpired||an,this.onClosed=e.onClosed||an,this.onPresenceStatusChange=e.onPresenceStatusChange||an}var cn={biz:"",debug:!1,token:""},un="https://data-reporting.rtnsvc.com/report",ln="https://data-reporting.realtimemesh.com/report",dn=function(e){var t=Number(g[e]);return t===g.USER_LOGIN?"MANUALLOGIN":t===g.MSYNC_SENDMESSAGE?"SENDMESSAGE":t>g.UNKNOWOPERATION&&t<g.REST_OPERATE?"REST":t>g.REST_OPERATE&&t<g.MSYNC_OPERATE?"MESSAGE":t>g.MSYNC_OPERATE&&t<g.ROSTER_OPERATE?"ROSTER":t>g.ROSTER_OPERATE&&t<g.USER_OPERATE?"USER":t>g.USER_OPERATE&&t<g.GROUP_OPERATE?"GROUP":t>g.GROUP_OPERATE&&t<g.CHATROOM_OPERATE?"CHATROOM":"OPERATION"},hn=function(){return(new Date).getTime()},pn=function(e){return[le.BAIDU,le.WX,le.DD,le.ZFB,le.TT,le.QUICK_APP,le.UNI].includes(e.platform)},fn=function(){return e=1,t=99999,e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e))+e;var e,t},mn={},gn=1e3,vn=function(){function e(e){this.eventQueue=[],this.stock=gn,this.config=e,this.governor()}return e.prototype.add=function(e){this.stock<=0?console.warn("Event Report limit ".concat(gn," per minute")):(this.eventQueue.push(e),this.consume(),this.stock-=1)},e.prototype.consume=function(){var e=this;0!==this.eventQueue.length&&(this.timer&&this.eventQueue.length<=10&&clearTimeout(this.timer),this.timer=setTimeout((function(){var t,r=e.eventQueue.splice(0,10),n=r.filter((function(e){return e.appId===r[0].appId})),o=r.filter((function(e){return e.appId!==r[0].appId}));(t=e.eventQueue).unshift.apply(t,o),e.batchSend(n)}),1e3))},e.prototype.governor=function(){var e=this,t=setInterval((function(){e.stock=gn}),6e4);"undefined"!=typeof addEventListener&&addEventListener("beforeunload",(function(){clearInterval(t)}))},e.prototype.batchSend=function(e){var t,r;if(void 0===e&&(e=[]),0!==e.length)try{var n=e.map((function(e){e.biz,e.appId;var t=e.eventId,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["biz","appId","eventId"]);return{eventId:Number(t),body:r}}));!function(e,t){try{var r=t.biz,n=t.appId,o=t.data,i=t.debug,a=t.onSuccess;if(!r)throw new Error("biz is not defined");mn.global||(mn=_e.getEnvInfo());var s=mn;if(pn(s)){var c={url:i?ln:un,data:o,method:"POST",timeout:K,success:function(){null==a||a()},fail:function(){},complete:function(){}},u={token:e,appid:null!=n?n:"",sendts:"".concat(Math.floor((new Date).getTime()/1e3)),biz:r,debug:"".concat(i)};if("zfb"===s.platform||"dd"===s.platform?c.headers=u:c.header=u,"dd"===s.platform)return s.global.httpRequest(c);s.global.request(c)}else{var l=new XMLHttpRequest;l.onreadystatechange=function(){2===l.readyState&&(null==a||a())},l.open("POST",i?ln:un),l.setRequestHeader("Content-Type","application/json"),l.setRequestHeader("token",e),l.setRequestHeader("appid",null!=n?n:""),l.setRequestHeader("sendts","".concat(Math.floor((new Date).getTime()/1e3))),l.setRequestHeader("biz",r),l.setRequestHeader("debug","".concat(i)),l.send(JSON.stringify(o))}}catch(e){console.error(e)}}(this.config.token,{biz:null===(t=e[0])||void 0===t?void 0:t.biz,appId:null===(r=e[0])||void 0===r?void 0:r.appId,data:n,debug:this.config.debug,onSuccess:this.consume.bind(this)})}catch(e){console.error(e)}},e}(),En=function(){return En=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},En.apply(this,arguments)},yn=new(function(){function e(e){this.inited=!1,this.appId="",this.biz="",this.eventQueue={},this.config=cn,e&&this.init(e)}return e.prototype.init=function(e){var t;if(void 0===e&&(e={}),!e.biz||!e.token)throw new Error("Event Report: biz or token is not defined");try{this.appId=null!==(t=e.appId)&&void 0!==t?t:"",this.biz=e.biz,this.config=En(En({},cn),e),this.eventQueue=new vn(this.config),this.log(e),this.inited=!0}catch(e){console.error(e)}},e.prototype.updateAppId=function(e){this.appId=e},e.prototype.send=function(e,t,r){var n;if(void 0===t&&(t={}),this.inited){var o=En(En({},t),{eventId:Number(e),biz:this.biz,appId:null!==(n=null==r?void 0:r.appId)&&void 0!==n?n:this.appId});this.eventQueue.add(o),this.log(o)}else console.error("Event Report: init is not called")},e.prototype.log=function(e){try{if(this.config.debug){var t=e.payload,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["payload"]);console.log("%c Event Report: ".concat(this.config.biz," "),"background: #8A97FC; color: #fff"),console.table(r),t&&(console.info("payload:"),console.table(t))}}catch(e){console.error(e)}},e}()),_n=function(){return _n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_n.apply(this,arguments)},Tn={requestName:"",subrequestid:"1",requestMethod:"GET",requestUrl:"",requestElapse:0,code:0,codeDesc:"",isLastApi:0,isSuccess:1},In=function(){function e(e){this.platform=_e.getEnvInfo(),this.isReportDt=e.isReport||!1,this.isCollectDt=!0,pn(this.platform)&&!this.isReportDt&&(this.isCollectDt=!1),this.eventQueue=[],this.accessChannel="direct",this.options=function(e,t){t.platform||(t=_e.getEnvInfo());var r=e.org,n=e.appkey,o=e.deviceId,i=e.sdkVersion,a=e.uikitVersion,s="undefined"!=typeof navigator?null===navigator||void 0===navigator?void 0:navigator.userAgent:"".concat(t.platform,"_mini_program");return{org:r,appkey:n,deviceId:o,sdkServiceId:"sid_".concat(_e.getUniqueId(),"_").concat(fn()),did:s,sdkVersion:i,os:7,sdkProduct:T.web,uikitVersion:a}}(e,this.platform),this.sid=this.options.sdkServiceId,this.init(e)}return e.getInstance=function(t){return e.instance||(e.instance=new e(t)),e.instance},e.prototype.getServiceId=function(){return this.sid||"sid_0"},e.prototype.setIsReportDt=function(e){this.isReportDt=e,e&&this.rptEventQueue()},e.prototype.setIsCollectDt=function(e){this.isCollectDt=e,e||(this.eventQueue=[])},e.prototype.rptEventQueue=function(){var e=this;this.eventQueue.length&&this.eventQueue.forEach((function(t,r){yn.send(t.eventId,t.dt),r>=e.eventQueue.length-1&&(e.eventQueue=[])}))},e.prototype.init=function(t){e.instance||(e.instance=this,yn.init({biz:"im",token:"32f24ab2ddb74f508aa9286c356cec84",appId:t.appkey,debug:!1}),this.reportInit())},e.prototype.updateAppKey=function(e){this.options.appkey=e,this.eventQueue.forEach((function(t){"default#appkey"===t.dt.appkey&&(t.dt.appkey=e)}))},e.prototype.reportInit=function(){if(this.isCollectDt){var e=this.options,t=e.did,r=e.os,n=e.sdkVersion,o=e.deviceId;this.reportData(9674,{did:t,os:r,sdkVersion:n,deviceId:o})}},e.prototype.geOperateFun=function(e){var t=this;if(!this.isCollectDt)return function(){};var r=1,n=0,o="",i=hn(),a=e.uid,s=e.operationName;a&&(this.uid=a);var c={uid:this.uid,operationId:"opr_".concat(_e.getUniqueId(),"_").concat(fn()),requestid:"req_".concat(_e.getUniqueId(),"_").concat(fn()),operationName:s};return function(e){var a,u,l,d;if(e.data.isSuccess?(n=0,o=""):(0===e.data.code&&(e.data.code=A),n=null!==(a=e.data.code)&&void 0!==a?a:n,o=null!==(u=e.data.codeDesc)&&void 0!==u?u:o),(null===(l=e.data)||void 0===l?void 0:l.accessChannel)&&(t.accessChannel=null===(d=e.data)||void 0===d?void 0:d.accessChannel),e.isRetry?(r++,e.data.subrequestid="".concat(r)):(c.requestid="req_".concat(_e.getUniqueId(),"_").concat(fn()),r=1),e.data.isLastApi){var h=hn();e.data.requestElapse=h-i,e.data.requestMethod="",e.data.subrequestid="0",e.data.code=200===n?0:n,e.data.codeDesc=o}else e.data.requestName||(e.data.requestName=s);e.data.requestElapse||(e.data.requestElapse=hn()-i),t.reportData.call(t,b,_n(_n(_n(_n({},Tn),c),e.data),{accessChannel:t.accessChannel,operationType:dn(s)})),e.isEndApi&&t.reportData.call(t,b,_n(_n(_n({},c),Tn),{isSuccess:e.data.isSuccess,isLastApi:1,subrequestid:"0",requestMethod:"",code:200===n?0:n,codeDesc:o,requestElapse:e.data.requestElapse,accessChannel:t.accessChannel,operationType:dn(s)}))}},e.prototype.reportData=function(e,t){return r=this,n=void 0,i=function(){var r,n,o,i,a,s,c,u,l;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),r=hn(),n=0,e!==b?[3,2]:[4,(h=this.platform,new Promise((function(e){var t;h.platform||(h=_e.getEnvInfo());var r="";if(h.platform===le.WEB){var n=navigator.connection;(null==n?void 0:n.type)?(null==n||n.type,r=y.WIFI):(null==n?void 0:n.effectiveType)&&(r=y[n.effectiveType.toLocaleUpperCase()]),e(r)}else h.platform===le.NODE?(r=y.UNKNOWN,e(r)):null===(t=h.global)||void 0===t||t.getNetworkType({success:function(t){r=y[t.networkType.toLocaleUpperCase()],e(r)}})})))];case 1:n=d.sent(),d.label=2;case 2:return o=this.options,i=o.appkey,a=o.sdkServiceId,s=o.sdkProduct,c=o.uikitVersion,u=_n({lts:r,net:n,appkey:i,sdkServiceId:a,sdkProduct:s,uikitVersion:c},t),this.isReportDt?yn.send(e,u):this.isCollectDt&&this.eventQueue.push({eventId:e,dt:u}),[3,4];case 3:return l=d.sent(),console.warn(l),[3,4];case 4:return[2]}var h}))},new((o=void 0)||(o=Promise))((function(e,t){function a(e){try{c(i.next(e))}catch(e){t(e)}}function s(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(a,s)}c((i=i.apply(r,n||[])).next())}));var r,n,o,i},e}(),On=function(){return On=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},On.apply(this,arguments)},Rn=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Cn=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Sn={txt:"text",img:"image",video:"video",file:"file",loc:"location",custom:"custom",combine:"combine"},Nn={text:"txt",image:"img",video:"video",file:"file",location:"loc",custom:"custom"},bn=5,An=new Set(["txt","img","video","file","loc","custom","combine"]);function Mn(e){return m.create({type:d.REQUEST_PARAMETER_ERROR,message:e})}function wn(e,t){j.error(e,t)}function Un(e){var t,r,n,o=Se[e.conversationType],i=Nn[e.contentType]||e.contentType,a=function(e,t){return"groupchat"===t.conversationType||"chatroom"===t.conversationType?t.receiverId:t.senderId!==e?t.senderId:t.receiverId}(this.context.userId,e),s={id:"".concat(e.messageId),conversationId:a,chatType:o,from:e.senderId,to:e.receiverId,ext:e.ext||{},time:new Date(e.sentTime).getTime()},c=e.content||{},u="string"==typeof e.text?e.text:void 0;switch(i){case"txt":n=On(On({},s),{type:"txt",msg:c.message||e.text||""}),Array.isArray(e.translations)&&e.translations.length>0&&(n.translations={translations:e.translations.map((function(e){return{text:e.text,to:e.code}}))});break;case"img":var l=c.url||c.remotePath||"",d=c.secret||c.secretKey||"",h=this.useOwnUploadFun?l:nt.call(this,{remotePath:l,secretKey:d});n=On(On({},s),{type:"img",url:h||"",width:(null===(t=c.size)||void 0===t?void 0:t.width)||c.width||0,height:(null===(r=c.size)||void 0===r?void 0:r.height)||c.height||0,secret:d,thumb:this.useOwnUploadFun?c.thumb||"":c.thumb?_e.formatAttachUrl.call(this,c.thumb):h?"".concat(h,"&thumbnail=true"):"",thumb_secret:c.thumb_secret||c.thumbnailSecretKey||d||"",file_length:c.file_length||c.fileLength||0,filetype:c.filetype||"",file:{},isGif:"sub_gif"===c.subType||1===c.subType});break;case"video":l=c.url||c.remotePath||"",d=c.secret||c.secretKey||"",h=this.useOwnUploadFun?l:nt.call(this,{remotePath:l,secretKey:d}),n=On(On({},s),{type:"video",url:h||"",secret:d||"",thumb:c.thumb?_e.formatAttachUrl.call(this,c.thumb):_e.formatAttachUrl.call(this,c.thumbnailRemotePath||""),thumb_secret:c.thumb_secret||c.thumbnailSecretKey||"",filename:c.filename||c.displayName||"",length:c.length||c.duration||0,file:{},file_length:c.file_length||c.fileLength||0,filetype:c.filetype||""});break;case"file":l=c.url||c.remotePath||"",d=c.secret||c.secretKey||"",h=this.useOwnUploadFun?l:nt.call(this,{remotePath:l,secretKey:d}),n=On(On({},s),{type:"file",url:h||"",secret:d||"",file:{},filename:c.filename||c.displayName||"",length:c.length||c.duration||0,file_length:c.file_length||c.fileLength||0,filetype:c.filetype||""});break;case"loc":n=On(On({},s),{type:"loc",buildingName:c.buildingName||"",addr:c.addr||c.address||"",lat:c.lat||c.latitude||0,lng:c.lng||c.longitude||0});break;case"custom":n=On(On({},s),{type:"custom",customEvent:c.customEvent||"",customExts:c.customExts||{},params:c.params||{}});break;default:n=On(On({},s),{type:i})}if(void 0!==u&&(n.text=u),e.highlight&&"object"==typeof e.highlight){for(var p=[],f=0,m=Object.values(e.highlight);f<m.length;f++){var g=m[f];Array.isArray(g)&&p.push.apply(p,g)}p.length>0&&(n.highlight=p)}return n}var Ln={singleChat:"chat",chatRoom:"chatroom",groupChat:"groupchat"};function Pn(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/users/"+this.user+"/blocks/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i},success:function(t){var r={};t.data.forEach((function(e){r[e]={name:e}})),"function"==typeof(null==e?void 0:e.success)&&e.success(t)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return j.debug("Call getBlocklist"),ae.call(this,a,v.GET_BLACK_LIST)}var Dn=Pn,kn=xn;function xn(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/users/"+this.user+"/contacts/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+a},success:function(r){var n=[];r.data.forEach((function(e){n.push({name:e,subscription:"both",jid:t.context.jid})})),"function"==typeof(null==e?void 0:e.success)&&e.success(n)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return j.debug("Call getContacts"),ae.call(this,s,v.GET_CONTACTS)}function Bn(e){return j.debug("Call uploadPushToken"),Mt.call(this,e)}var Gn=Bn;function jn(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/user_channels"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return j.debug("Call getSessionList"),ae.call(this,a)}function Hn(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=!!(e&&"number"==typeof e.pageNum&&"number"==typeof e.pageSize&&e.pageNum>0&&e.pageSize>0),c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(this.user,"/user_channels").concat(s?"/page":""),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return s&&(c.data={pageNum:e.pageNum,pageSize:e.pageSize}),j.debug("Call getConversationlist"),ae.call(this,c,v.GET_SESSION_LIST).then((function(e){return Fn.call(t,e)}))}function Fn(e){var t=this,r=e.data.channel_infos;return null==r||r.forEach((function(e){e.meta&&"{}"!==JSON.stringify(e.meta)?(e.meta.payload=JSON.parse(e.meta.payload),e.lastMessage=Ne.call(t,e.meta,{formatCustomExts:!1})):e.lastMessage=e.meta,delete e.meta})),e}function Wn(e){if(e&&"string"!=typeof e.channel)throw Error("Invalid parameter channel: ".concat(e.channel));if(e&&"singleChat"!==e.chatType&&"groupChat"!==e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(e&&"boolean"!=typeof e.deleteRoam)throw Error("Invalid parameter deleteRoam: ".concat(e.deleteRoam));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r,n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid;r="singleChat"===e.chatType?"chat":"groupChat";var c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/user/").concat(this.user,"/user_channel?resource=").concat(s.clientResource),dataType:"json",type:"DELETE",data:JSON.stringify({channel:e.channel,type:r,delete_roam:e.deleteRoam}),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call deleteSession",e),ae.call(this,c,v.DELETE_SESSION)}var zn=Wn;function qn(e,t){var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=["nickname","avatarurl","mail","phone","gender","sign","birth","ext"],c={},u=_e.getEnvInfo();if("wx"===u.platform||"qq"===u.platform)if("string"==typeof e&&void 0!==t){if(!s.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");c[e]=t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");s.forEach((function(t){s.includes(t)&&void 0!==e[t]&&(c[t]=e[t])}))}else if("string"==typeof e){if(!s.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");c=e+"="+t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");var l=[];s.forEach((function(t){if(s.includes(t)&&void 0!==e[t]){var r=encodeURIComponent(t),n=encodeURIComponent(e[t]);l.push(r+"="+n)}})),c=l.join("&")}var d={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/metadata/user/").concat(this.user),type:"PUT",data:c,dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/x-www-form-urlencoded"}};return j.debug("Call updateOwnUserInfo",e),ae.call(this,d,v.UPDATE_USER_INFO)}var Kn=qn;function Vn(e,t){var r=Nt.call(this).error;if(r)return Promise.reject(r);var n,o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=[];if("string"==typeof e)c=[e];else{if("[object Array]"!==Object.prototype.toString.call(e))throw new Error("illegal params");c=e}n="string"==typeof t?[t]:t&&"[object Array]"===Object.prototype.toString.call(t)?t:["nickname","avatarurl","mail","phone","gender","sign","birth","ext"];var u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/metadata/user/get"),type:"POST",data:JSON.stringify({targets:c,properties:n}),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return j.debug("Call fetchUserInfoById",e),ae.call(this,u,v.GET_USER_INFO)}function Jn(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user),type:"PUT",dataType:"json",data:JSON.stringify({nickname:e}),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call updateCurrentUserNick",e),ae.call(this,a)}function Yn(e){if("string"!=typeof e||""===e)throw Error('Invalid parameter: "token"');var t=this.context,r=t.orgName,n=t.appName,o={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/sdk/users/").concat(this.user,"/token/expires"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json"}};return j.debug("Call getTokenExpireTimestamp",e),ae.call(this,o,v.SDK_INTERNAL)}function Xn(e){var t=this;return new Promise((function(r,n){if(!e.queue)throw Error('Invalid parameter: "specified"');var o=Nt.call(t).error;if(o)return Promise.reject(o);(function e(t){var o=this,i=t.count||20;Qn.call(this,{count:i,isGroup:!!t.isGroup,queue:t.queue,start:t.start,format:t.format,success:function(n){if(n.msgs.length>=i||n.is_last){var a=n.msgs.splice(0,i).reverse();t.success&&t.success(a),r(a)}else e.call(o,On(On({},t),{start:null}))},fail:function(e){n(e),t.fail&&t.fail(e)}})}).call(t,e),j.debug("Call fetchHistoryMessages",e)}))}function Qn(e){var t=this,r=e.queue,n=this.mr_cache[r]||(this.mr_cache[r]={msgs:[]}),o=this.context.userId,i=e.start||-1,a=e.count||20;if(n.msgs.length>=a||n.is_last)"function"==typeof e.success&&e.success(n);else{n&&n.next_key&&(i=n.next_key),e.start&&(i=e.start);var s={queue:r+(e.isGroup?"@conference.easemob.com":"@easemob.com"),start:i,end:-1},c=this.context,u=c.orgName,l=c.appName,h={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(o,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"},data:JSON.stringify(s),success:function(r){return Rn(t,void 0,void 0,(function(){var t,o,i,a,s,c,u=this;return Cn(this,(function(l){switch(l.label){case 0:if(t=null==r?void 0:r.data,!r.data.msgs)return"function"==typeof e.success&&e.success(n),n.is_last=!0,n.next_key="",[2];o=t.msgs,i=o.length,n.is_last=t.is_last,n.next_key=t.next_key,a=function(t){return Rn(u,void 0,void 0,(function(){var r,n,o,i,a;return Cn(this,(function(s){switch(s.label){case 0:for(r=[],t=Re().atob(t),n=0,o=t.length;n<o;++n)r.push(t.charCodeAt(n));return i=(i=this.context.root.lookup("easemob.pb.Meta")).decode(r),a={errorCode:0,reason:""},1!==i.ns?[3,2]:[4,ut.call(this,i,a,!0,e.format)];case 1:return[2,s.sent()];case 2:return[2]}}))}))},s=0,l.label=1;case 1:return s<i?[4,a(o[s].msg)]:[3,4];case 2:(c=l.sent())&&n.msgs.push(c),l.label=3;case 3:return s++,[3,1];case 4:return"function"==typeof e.success&&e.success(n),[2]}}))}))},error:function(e){if(e.error&&e.error_description){var r=m.create({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:"fetch history messages error",data:e});t.onError&&t.onError(r)}}};ae.call(this,h,v.GET_HISTORY_MSG).catch((function(t){"function"==typeof e.fail&&e.fail(t)}))}}function Zn(e){var t=this;return new Promise((function(r,n){var o=e.targetId,i=e.cursor,a=void 0===i?-1:i,s=e.pageSize,c=void 0===s?20:s,u=e.chatType,l=e.searchDirection,d=e.searchOptions,h=void 0===d?{}:d,p=h.msgTypes,f=void 0===p?[]:p,m=h.startTime,g=void 0===m?null:m,E=h.endTime,y=void 0===E?null:E,_=h.from,T=void 0===_?null:_;if("string"!=typeof o||""===o)return n(Mn('"Invalid parameter": "targetId"'));if(T&&"string"!=typeof T)return n(Mn('"Invalid parameter": "searchOptions.from"'));if(f&&!Array.isArray(f))return n(Mn('"Invalid parameter": "searchOptions.msgTypes"'));if(g&&"number"!=typeof g)return n(Mn('"Invalid parameter": "searchOptions.startTime"'));if(y&&"number"!=typeof y)return n(Mn('"Invalid parameter": "searchOptions.endTime"'));var I=Nt.call(t).error;if(I)return n(I);var O=t.context,R=O.orgName,C=O.appName,S=O.userId,N="singleChat"===e.chatType?"@easemob.com":"@conference.easemob.com",b={queue:"".concat(o).concat(N),start:a,pull_number:c,is_positive:"down"===l,msgType:f.join(",")||"",end:-1,startTime:g,endTime:y,userId:"singleChat"===u?null:T},A={url:"".concat(t.apiUrl,"/").concat(R,"/").concat(C,"/users/").concat(S,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+t.token,"Content-Type":"application/json"},data:JSON.stringify(b),success:function(n){return Rn(t,void 0,void 0,(function(){var t,o,i,a,s,c,u,l,d=this;return Cn(this,(function(h){switch(h.label){case 0:t=null==n?void 0:n.data,o=t.msgs||[],i=function(e){return Rn(d,void 0,void 0,(function(){var t,r,n,o,i;return Cn(this,(function(a){switch(a.label){case 0:for(t=[],e=Re().atob(e),r=0,n=e.length;r<n;++r)t.push(e.charCodeAt(r));return o=(o=this.context.root.lookup("easemob.pb.Meta")).decode(t),i={errorCode:0,reason:""},1!==o.ns?[3,2]:[4,ut.call(this,o,i,!0,!0)];case 1:return[2,a.sent()];case 2:return[2]}}))}))},a=[],s=0,h.label=1;case 1:return s<o.length?[4,i(o[s].msg)]:[3,4];case 2:(c=h.sent())&&a.push(c),h.label=3;case 3:return s++,[3,1];case 4:return t.msgs=a,u={cursor:t.next_key,messages:a,isLast:t.is_last},null===(l=e.success)||void 0===l||l.call(e,u),r(u),[2]}}))}))},error:e.fail};ae.call(t,A,v.REST_FETCHHISTORYMESSAGE).catch((function(e){n(e)})),j.debug("Call getHistoryMessages",e)}))}function $n(e){var t,r,n=this,o=Nt.call(this).error;if(o)return Promise.reject(o);var i=null==e?void 0:e.option,a=null!==(t=null==e?void 0:e.pageNum)&&void 0!==t?t:1,s=null!==(r=null==e?void 0:e.pageSize)&&void 0!==r?r:20,c=[];try{c=function(e,t,r){var n;if(!e||"object"!=typeof e)throw Mn('"Invalid parameter": "option"');if(!Array.isArray(e.keywordList))throw Mn('"Invalid parameter": "keywordList"');var o=e.keywordList.map((function(e){return"".concat(null!=e?e:"").trim()})).filter((function(e){return e.length>0}));if(0===o.length)throw Mn('"Invalid parameter": "keywordList"');if(o.length>bn)throw Mn('"Invalid parameter": "keywordList exceeds max count 5"');if(void 0!==e.conversationId&&("string"!=typeof e.conversationId||""===e.conversationId.trim()))throw Mn('"Invalid parameter": "conversationId"');if(void 0!==e.conversationType&&!["singleChat","groupChat","chatRoom"].includes(e.conversationType))throw Mn('"Invalid parameter": "conversationType"');if(void 0===e.conversationId!=(void 0===e.conversationType))throw Mn('"Invalid parameter": "conversationId and conversationType must be used together"');if(void 0!==e.startTime&&void 0===e.endTime||void 0===e.startTime&&void 0!==e.endTime)throw Mn('"Invalid parameter": "startTime/endTime"');if(void 0!==e.startTime&&("number"!=typeof e.startTime||"number"!=typeof e.endTime||e.endTime<e.startTime))throw Mn('"Invalid parameter": "startTime/endTime"');if("number"!=typeof t||t<1)throw Mn('"Invalid parameter": "pageNum"');if("number"!=typeof r||r<1||r>100)throw Mn('"Invalid parameter": "pageSize"');if(e.msgTypes&&!Array.isArray(e.msgTypes))throw Mn('"Invalid parameter": "msgTypes"');if(null===(n=e.msgTypes)||void 0===n?void 0:n.some((function(e){return!An.has(e)})))throw Mn('"Invalid parameter": "msgTypes contains unsupported type"');return o}(i,a,s)}catch(t){return j.error("searchMessages parameter validation failed",{params:e,error:t}),Promise.reject(t)}var u=this.context,l=u.orgName,h=u.appName,p=u.accessToken,f=function(e,t,r,n,o){var i=function(e,t){var r,n=null!==(r=e.keywordListMatchType)&&void 0!==r?r:"or",o={searchMode:"default"};return 1===t.length?o.keyword=t[0]:(o.keywords=t,o.keywordMatch="and"===n?"all":"any"),{data:o,normalizedKeywordList:t}}(e,t).data;return e.conversationId&&("singleChat"===e.conversationType?i.participantPairs=[{userId1:o,userId2:e.conversationId}]:"groupChat"===e.conversationType?i.groupIds=[e.conversationId]:"chatRoom"===e.conversationType?i.chatroomIds=[e.conversationId]:i.conversationId=e.conversationId),e.msgTypes&&e.msgTypes.length>0&&(i.contentType=e.msgTypes.filter((function(e){return e in Sn})).map((function(e){return Sn[e]})).join(",")),"number"==typeof e.startTime&&"number"==typeof e.endTime&&(i.startTime=e.startTime,i.endTime=e.endTime),e.searchScope&&(i.searchExt=e.searchScope),i.sort="relevance:desc",i.highlightEnable=!0,i.page=r,i.size=n,i}(i,c,a,s,this.user),g={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(h,"/users/").concat(this.user,"/messages/search/get"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+p,"Content-Type":"application/json",Accept:"application/json; charset=utf-8"},data:JSON.stringify({data:f})};return j.debug("Call searchMessages",e),ae.call(this,g,v.REST_SEARCH_MESSAGES).then((function(t){var r,o,i=(null==t?void 0:t.data)||{},c=(null==i?void 0:i.data)&&"object"==typeof i.data?i.data:i,u=c.pagination||{},l=Array.isArray(c.items)?c.items:Array.isArray(c.list)?c.list:[];Array.isArray(c.items)||Array.isArray(c.list)||wn("searchMessages response items/list is invalid",{params:e,responseData:c,rawResponse:t});var h=[];l.forEach((function(t,r){try{h.push(Un.call(n,t))}catch(n){throw wn("searchMessages failed to map response item",{params:e,index:r,item:t,error:n}),m.create({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:"Failed to parse search result item",data:{index:r,item:t,error:n}})}}));var p={messages:h,pageNum:u.page||c.page||a,pageSize:s,totalPages:"number"==typeof u.totalPages?u.totalPages:-1,isLast:"number"!=typeof u.isFinished||1===u.isFinished,requestId:null===(r=null==i?void 0:i.meta)||void 0===r?void 0:r.requestId,timestamp:(null===(o=null==i?void 0:i.meta)||void 0===o?void 0:o.timestamp)||Date.now()};return"number"!=typeof u.page&&void 0!==u.page&&wn("searchMessages pagination.page is invalid",{params:e,pagination:u,rawResponse:t}),p}))}function eo(e,t){return Rn(this,void 0,void 0,(function(){var r,n,o,i,a,s,c;return Cn(this,(function(u){switch(u.label){case 0:if(r=Nt.call(this).error)return[2,Promise.reject(r)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call addContact",e,t),n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(this.user,"/contacts/apply?resource=").concat(s.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:[e],reason:t}),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}},[4,ae.call(this,c,v.ROSTER_ADD)];case 1:return u.sent(),[2]}}))}))}var to=ro;function ro(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Cn(this,(function(c){switch(c.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call deleteContact",e),r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/contacts/users/").concat(e,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s,v.ROSTER_REMOVE)];case 1:return c.sent(),[2]}}))}))}function no(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Cn(this,(function(c){switch(c.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call acceptInvitation",e),r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/contacts/accept/users/").concat(e,"?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s,v.ROSTER_ACCEPT)];case 1:return c.sent(),[2]}}))}))}var oo=no;function io(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Cn(this,(function(c){switch(c.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call declineInvitation",e),r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/contacts/decline/users/").concat(e,"?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s,v.ROSTER_DECLINE)];case 1:return c.sent(),[2]}}))}))}var ao=io;function so(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Cn(this,(function(l){switch(l.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(r=e.name,n=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');n=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');n=r}return j.debug("Call addToBlockList",e),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(c.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:n}),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,ae.call(this,u,v.ROSTER_BAN).then((function(e){return{type:e.type,data:{userIds:(null==e?void 0:e.data)||[]}}}))];case 1:return[2,l.sent()]}}))}))}var co=so,uo=so;function lo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Cn(this,(function(l){switch(l.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(r=e.name,n=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');n=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');n=r}return j.debug("Call removeFromBlockList",e),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",data:JSON.stringify({usernames:n}),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,ae.call(this,u,v.ROSTER_ALLOW)];case 1:return l.sent(),[2]}}))}))}var ho=lo,po=lo;function fo(e){var t=this,r=(null==e?void 0:e.ext)||"";if("string"!=typeof r)throw Error('"Invalid parameter": "ext"',r);var n=this.getUniqueId(),o={id:n,to:e.to};this._msgHash[n]=On({},o);var i="";void 0!==e.chatType?i=e.chatType:void 0!==e.type&&(i="chat"===e.type?"singleChat":e.type);var a={id:n,type:"recall",chatType:i,ackId:e.mid,to:e.to,isChatThread:e.isChatThread||!1,metaExt:r,success:function(r){return Rn(t,void 0,void 0,(function(){var t,n,o,a,s,c,u,l,d;return Cn(this,(function(h){switch(h.label){case 0:return h.trys.push([0,5,,6]),"singleChat"!==i&&"groupChat"!==i?[3,4]:[4,null===(o=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===o?void 0:o.removeMsgByServerMsgId(e.mid)];case 1:return h.sent(),[4,null===(s=null===(a=this._localCache)||void 0===a?void 0:a.getInstance())||void 0===s?void 0:s.getConversationLastMessage(e.to,i)];case 2:return t=h.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.updateLocalConversation(Ae({conversationId:e.to,conversationType:i}),{lastMessageId:null==t?void 0:t.serverMsgId})];case 3:h.sent(),h.label=4;case 4:return null===(l=null==e?void 0:e.success)||void 0===l||l.call(e,r),[3,6];case 5:return h.sent(),null===(d=null==e?void 0:e.success)||void 0===d||d.call(e,r),[3,6];case 6:return[2]}}))}))},fail:e.fail};return j.debug("Call recallMessage",e),this.mSync.send(a,this)}function mo(e){var t=e||{},r=t.messageId,n=t.modifiedMessage;if(j.debug("Call modifyMessage",r,n),""===r)throw Error('Invalid parameter: "messageId"');return this.mSync.send(On({editMessageId:r},n))}function go(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Cn(this,(function(l){switch(l.label){case 0:if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.reaction,s=e.messageId,c={msgId:s,message:a},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,u)]);case 1:return l.sent(),[2]}}))}))}function vo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c;return Cn(this,(function(u){switch(u.label){case 0:if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reactionId: ".concat(e.reaction));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.messageId,s=e.reaction,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user,"?msgId=").concat(a,"&message=").concat(s),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,c)]);case 1:return u.sent(),[2]}}))}))}function Eo(e){if("string"!=typeof e.chatType||!e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatType,s=e.messageId,c={msgIdList:"string"==typeof s?[s]:s,msgType:"singleChat"===a?"chat":"groupchat",groupId:e.groupId||null},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user),type:"GET",data:c,dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,u).then((function(e){var t=e.data;return null==t||t.forEach((function(e){null==e||e.reactionList.forEach((function(e){e.isAddedBySelf=e.state,delete e.state,delete e.reactionId}))})),e}))}var yo=Eo;function _o(e){if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.cursor,s=e.pageSize,c={msgId:e.messageId,message:e.reaction,currentPage:a||null,pageSize:s||20},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user,"/detail"),type:"GET",data:c,dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,u).then((function(e){return e.data.isAddedBySelf=e.data.state,delete e.data.state,delete e.data.reactionId,e}))}function To(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d;return Cn(this,(function(h){switch(h.label){case 0:if("string"!=typeof e.reportType||!e.reportType)throw Error("Invalid parameter reportType: ".concat(e.reportType));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reportReason||!e.reportReason)throw Error("Invalid parameter messageId: ".concat(e.reportReason));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.reportType,s=e.reportReason,c=e.messageId,u={username:this.user,reportType:a,reportReason:s},l="".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/user/").concat(this.user,"/moderation/report/message/").concat(c),d={url:l,type:"POST",data:JSON.stringify(u),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,d)]);case 1:return h.sent(),[2]}}))}))}function Io(e){var t;return Rn(this,void 0,void 0,(function(){var r,n,o,i,a,s,c,u,l;return Cn(this,(function(d){switch(d.label){case 0:if("string"!=typeof e.targetId||""===e.targetId)throw Error('"Invalid parameter targetId": '+e.targetId);if(!["singleChat","groupChat","chatRoom"].includes(e.chatType))throw Error('"Invalid parameter chatType": '+e.chatType);if(e.beforeTimeStamp&&("number"!=typeof e.beforeTimeStamp||e.beforeTimeStamp<0||(null===(t=e.beforeTimeStamp)||void 0===t?void 0:t.toString().length)>18))throw Error('"Invalid parameter beforeTimeStamp": '+e.beforeTimeStamp);if(e.messageIds&&!(Array.isArray(e.messageIds)&&e.messageIds.length>0&&e.messageIds.length<=20))throw Error('"Invalid parameter messageIds": '+e.messageIds);if(!e.messageIds&&!e.beforeTimeStamp)throw Error("messageIds or beforeTimeStamp field is required.");return(r=Nt.call(this).error)?[2,Promise.reject(r)]:(n=this.context,o=n.orgName,i=n.appName,a=n.userId,s="singleChat"===e.chatType?"userId":"groupId",c="singleChat"===e.chatType?"chat":"group",u=e.messageIds?"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/message/roaming/").concat(c,"/user/").concat(a,"?").concat(s,"=").concat(e.targetId,"&msgIdList=").concat(e.messageIds,"&resource=").concat(this.clientResource):"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/message/roaming/").concat(c,"/user/").concat(a,"/time?").concat(s,"=").concat(e.targetId,"&delTime=").concat(e.beforeTimeStamp,"&&resource=").concat(this.clientResource),l={url:u,dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"}},j.debug("Call removeHistoryMessages",e),[4,ae.call(this,l)]);case 1:return d.sent(),[2]}}))}))}function Oo(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if((null==e?void 0:e.includeEmptyConversations)&&"boolean"!=typeof e.includeEmptyConversations)throw Error("Invalid parameter includeEmptyConversations: ".concat(e.includeEmptyConversations));var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",need_mark:!0,needEmptySession:(null==e?void 0:e.includeEmptyConversations)||!1},headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getServerConversations",e),new Promise((function(e,r){ae.call(t,s,v.REST_FETCH_CONVERSATIONS).then((function(r){return Rn(t,void 0,void 0,(function(){var t,n,o=this;return Cn(this,(function(i){switch(i.label){case 0:return t=Ro.call(this,r),this._localCache?(n=t.data.conversations.map((function(e){return Rn(o,void 0,void 0,(function(){var t,r,n,o;return Cn(this,(function(i){switch(i.label){case 0:return[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(e.lastMessage,De.SUCCESS,!0)];case 1:return i.sent(),[4,null===(o=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===o?void 0:o.updateLocalConversation(Ae({conversationId:e.conversationId,conversationType:e.conversationType}),{unReadCount:e.unReadCount})];case 2:return i.sent(),[2]}}))}))})),[4,Promise.all(n)]):[3,2];case 1:i.sent(),i.label=2;case 2:return e(t),[2]}}))}))})).catch((function(e){r(e)}))}))}function Ro(e){var t=this,r=e.data,n=r.cursor,o=r.channel_infos,i=[];null==o||o.forEach((function(e){var r=null;(null==e?void 0:e.meta)&&"{}"!==JSON.stringify(e.meta)&&(e.meta.payload=JSON.parse(e.meta.payload),"delivery"!==(r=Ne.call(t,e.meta)).type&&"read"!==r.type&&"channel"!==r.type&&(r.chatType=Se[r.chatType]));var n={conversationId:e.session_to,conversationType:"chat"===e.session_type?"singleChat":"groupChat",isPinned:e.is_top,pinnedTime:e.is_top?e.update_top_status_time:0,unReadCount:e.unread_num,lastMessage:r};e.marks&&(n.marks=e.marks.map((function(e){return ft[e]}))),i.push(n)}));var a={conversations:i,cursor:n||""};return{type:e.type,data:a}}function Co(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if((null==e?void 0:e.includeEmptyConversations)&&"boolean"!=typeof e.includeEmptyConversations)throw Error("Invalid parameter includeEmptyConversations: ".concat(e.includeEmptyConversations));var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",is_top:!0,need_mark:!0,needEmptySession:(null==e?void 0:e.includeEmptyConversations)||!1},headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getServerPinnedConversations",e),ae.call(this,s,v.GET_SESSION_LIST).then((function(e){return Ro.call(t,e)}))}function So(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d,h,p,f;return Cn(this,(function(m){if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(r=e.conversationId,n=e.conversationType,o=e.isPinned,i="singleChat"===n?"chat":"groupChat","string"!=typeof r||""===r)throw Error("Invalid parameter conversationId: ".concat(r));if(!["singleChat","groupChat"].includes(n))throw Error("Invalid parameter conversationType: ".concat(n));if("boolean"!=typeof o)throw Error("Invalid parameter isPinned: ".concat(o));return a=this.context,s=a.orgName,c=a.appName,u=a.accessToken,l=a.jid,d={type:i,to:r},h=o?"":"type=".concat(i,"&to=").concat(r,"&"),p="".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/user/").concat(this.user,"/user_channel/top?").concat(h,"resource=").concat(l.clientResource),f={url:p,type:o?"POST":"DELETE",dataType:"json",headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},o&&(f.data=JSON.stringify(d)),j.debug("Call pinConversation",e),[2,ae.call(this,f,v.PIN_CONVERSATION).then((function(e){var t=e.type,r=e.data;return{type:t,data:{isPinned:r.is_top||!1,pinnedTime:r.is_top?r.update_top_status_time:0}}}))]}))}))}function No(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l;return Cn(this,(function(d){switch(d.label){case 0:if(t=e.userId,r=e.remark,n=Nt.call(this).error)return[2,Promise.reject(n)];if("string"!=typeof t||""===t)throw Error('Invalid parameter: "userId"');if("string"!=typeof r)throw Error('Invalid parameter: "remark"');return j.debug("Call setContactRemark",e),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u="".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/users/").concat(this.context.userId,"/contacts/users/").concat(t,"?resource=").concat(c.clientResource),l={url:u,type:"PUT",data:JSON.stringify({remark:r}),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,ae.call(this,l,v.ROSTER_SET_CONTACT_REMARK)];case 1:return d.sent(),[2]}}))}))}function bo(){var e=Nt.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(this.user,"/contacts/users?needReturnRemark=true"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+o}};return j.debug("Call getAllContacts"),ae.call(this,i,v.ROSTER_GET_ALL_CONTACTS_REMARKS).then((function(e){var t=((null==e?void 0:e.entities)||[]).map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:t}}))}function Ao(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);j.debug("Call getContactsWithCursor",e);var r=e||{},n=r.pageSize,o=void 0===n?20:n,i=r.cursor,a=void 0===i?"":i;if(o&&"number"!=typeof o)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));var s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(this.user,"/contacts?needReturnRemark=true&limit=").concat(o,"&cursor=").concat(a),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+l}};return ae.call(this,d,v.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE).then((function(e){var t,r,n=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.contacts)||[],o=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.cursor)||"",i=n.map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:{cursor:o,contacts:i}}}))}function Mo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d,h,p,f,m;return Cn(this,(function(g){switch(g.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(j.debug("Call markConversation",e),n=(r=e||{}).conversations,o=void 0===n?[]:n,i=r.mark,a=r.isMarked,!Array.isArray(o))throw Error("Invalid parameter conversations");if(s=o.map((function(e){if(!e.conversationId||!["singleChat","groupChat"].includes(e.conversationType))throw Error("Invalid parameter conversations");return{to:e.conversationId,type:Ln[e.conversationType]}})),"boolean"!=typeof a)throw Error("Invalid parameter isMarked: ".concat(a));if("number"!=typeof i)throw Error("Invalid parameter mark: ".concat(i));return c=this.context,u=c.orgName,l=c.appName,d=c.accessToken,h=c.userId,p=c.jid,f={mark:ft[i],targets:s},m={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(h,"/user_channels/mark?resource=").concat(p.clientResource),dataType:"json",data:JSON.stringify(f),type:a?"Post":"Delete",headers:{Authorization:"Bearer "+d}},[4,ae.call(this,m,v.MARK_CONVERSATION).then((function(e){var t,r=(null===(t=e.data)||void 0===t?void 0:t.ignore)||[];r&&Array.isArray(r)&&r.length>0&&j.debug("markConversation has ignored conversations",r.map((function(e){return{conversationId:e.to,conversationType:Se[e.type]}})))}))];case 1:return g.sent(),[2]}}))}))}function wo(e){return Rn(this,void 0,void 0,(function(){var t,r;return Cn(this,(function(n){return j.debug("Call addConversationMark",e),t=e.conversations,r=e.mark,[2,Mo.call(this,{conversations:t,mark:r,isMarked:!0})]}))}))}function Uo(e){return Rn(this,void 0,void 0,(function(){var t,r;return Cn(this,(function(n){return j.debug("Call removeConversationMark",e),t=e.conversations,r=e.mark,[2,Mo.call(this,{conversations:t,mark:r,isMarked:!1})]}))}))}function Lo(e){var t,r,n=this,o=Nt.call(this).error;if(o)return Promise.reject(o);if(j.debug("Call getServerConversationsByFilter",e),(null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if("number"!=typeof(null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.mark))throw Error("Invalid parameter mark: ".concat(null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.mark));var i=this.context,a=i.orgName,s=i.appName,c=i.accessToken,u="".concat(this.apiUrl,"/").concat(a,"/").concat(s,"/sdk/user/").concat(this.user,"/user_channels/mark/search?"),l=e.pageSize,d=e.cursor,h=((null==e?void 0:e.filter)||{}).mark,p={url:u,type:"GET",dataType:"json",data:{limit:l||10,cursor:d||"",need_mark:!0,mark:ft[h]},headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return ae.call(this,p,v.GET_SESSION_LIST).then((function(e){return Ro.call(n,e)}))}function Po(){var e=Nt.call(this).error;if(e)return Promise.reject(e);j.debug("Call getSelfIdsOnOtherPlatform");var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i=t.userId,a=t.jid,s={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(i,"/resources"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return ae.call(this,s,v.USER_LOGGEDIN_OTHER_PLATFORM).then((function(e){var t,r=null===(t=e.data)||void 0===t?void 0:t.filter((function(e){return e.res!==a.clientResource})),n=null==r?void 0:r.map((function(e){return"".concat(i,"/").concat(e.res)}));return{type:e.type,data:n}}))}function Do(){var e,t,r,n,o,i;return Rn(this,void 0,void 0,(function(){var a,s,c,u,l,d,h,p,f;return Cn(this,(function(m){switch(m.label){case 0:return(a=Nt.call(this).error)?[2,Promise.reject(a)]:(j.debug("Call deleteAllMessagesAndConversations"),s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d=s.userId,h=s.jid,p="".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/message/roaming/user/").concat(d,"/delete/all?resource=").concat(h.clientResource),f={url:p,type:"POST",dataType:"json",headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}},[4,ae.call(this,f,v.REST_DELETE_MESSAGES_CONVERSATIONS)]);case 1:return m.sent(),null===(t=null===(e=this._localCache)||void 0===e?void 0:e.getInstance())||void 0===t||t.clearConversationMap(),[4,null===(n=null===(r=this._localCache)||void 0===r?void 0:r.getInstance())||void 0===n?void 0:n.clearStoreData("conversationList")];case 2:return m.sent(),[4,null===(i=null===(o=this._localCache)||void 0===o?void 0:o.getInstance())||void 0===i?void 0:i.clearStoreData("message")];case 3:return m.sent(),[2]}}))}))}function ko(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d,h,p,f,m;return Cn(this,(function(g){switch(g.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(j.debug("Call setMessagePinStatus",e),n=(r=e||{}).conversationId,o=void 0===n?"":n,i=r.conversationType,a=r.messageId,s=r.isPinned,"string"!=typeof o||""===o)throw Error("Invalid parameter conversationId");if("string"!=typeof a||""===a)throw Error("Invalid parameter messageId");if("boolean"!=typeof s)throw Error("Invalid parameter isPinned");return c=this.context,u=c.orgName,l=c.appName,d=c.accessToken,h=c.userId,p=c.jid,f={to:o,type:Ln[i],pin_msg_id:a},m={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(h,"/user_channel/pin?resource=").concat(p.clientResource),dataType:"json",data:JSON.stringify(f),type:s?"Post":"Delete",headers:{Authorization:"Bearer "+d}},[4,ae.call(this,m,v.REST_PIN_MESSAGE)];case 1:return g.sent(),[2]}}))}))}function xo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o;return Cn(this,(function(i){return j.debug("Call pinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,o=t.messageId,[2,ko.call(this,{conversationId:n,conversationType:r,messageId:o,isPinned:!0})]}))}))}function Bo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o;return Cn(this,(function(i){return j.debug("Call unpinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,o=t.messageId,[2,ko.call(this,{conversationId:n,conversationType:r,messageId:o,isPinned:!1})]}))}))}function Go(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);j.debug("Call getServerPinnedMessages",e);var n=e.conversationId,o=e.conversationType,i=e.pageSize,a=e.cursor;if("string"!=typeof n||""===n)throw Error("Invalid parameter conversationId");if(i&&"number"!=typeof i)throw Error("Invalid parameter pageSize: ".concat(i));if(a&&"string"!=typeof a)throw Error("Invalid parameter cursor: ".concat(a));var s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/user/").concat(this.user,"/user_channel/pin"),type:"GET",dataType:"json",data:{to:n,type:Ln[o],limit:i||10,cursor:a||""},headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}};return ae.call(this,d,v.GET_SESSION_LIST).then((function(e){return{type:0,data:{list:e.data.msg_infos.map((function(e){e.message.payload=JSON.parse(e.message.payload);var r=e.message,n=e.pin_opt_at,o=e.pin_operator;return{message:Ne.call(t,r,{formatChatType:!0}),pinTime:n,operatorId:o}})),cursor:e.data.cursor||""}}}))}function jo(){var e=this;j.debug("Call unbindPushToken");var t={deviceId:this.clientResource,deviceToken:"",notifierName:this.pushCertificateName};return Mt.call(this,t).then((function(t){return e.isRegisterPush=!1,t}))}function Ho(e){if(!e||"string"!=typeof e.fileId||""===e.fileId)return Promise.reject(Error('Invalid parameter: "fileId"'));if(void 0!==e.currentUserId&&"string"!=typeof e.currentUserId)return Promise.reject(Error('Invalid parameter: "currentUserId"'));if(void 0!==e.audio){if("object"!=typeof e.audio||null===e.audio||Array.isArray(e.audio))return Promise.reject(Error('Invalid parameter: "audio"'));var t=e.audio,r=t.format,n=t.sampleRate,o=t.bitsPerSample,i=t.channels;if(void 0!==r&&"string"!=typeof r)return Promise.reject(Error('Invalid parameter: "audio.format"'));if(void 0!==n&&"number"!=typeof n)return Promise.reject(Error('Invalid parameter: "audio.sampleRate"'));if(void 0!==o&&"number"!=typeof o)return Promise.reject(Error('Invalid parameter: "audio.bitsPerSample"'));if(void 0!==i&&"number"!=typeof i)return Promise.reject(Error('Invalid parameter: "audio.channels"'))}var a=Nt.call(this).error;if(a)return Promise.reject(a);var s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d=s.userId,h=e.currentUserId||d,p={data:On({fileId:e.fileId,username:h},e.audio?{audio:e.audio}:{})};if(!c||!u||!h)return Promise.reject(Error('Invalid parameter: "orgname", "appname" or "currentUserId"'));var f={url:"".concat(this.apiUrl,"/api/sdk/v1/").concat(c,"/").concat(u,"/speech/transcriptions"),type:"POST",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+l,"Content-Type":"application/json",Accept:"application/json"}};return j.debug("Call transcribeSpeech",p),ae.call(this,f).then((function(e){var t;return{type:0,data:{text:(null===(t=e.data)||void 0===t?void 0:t.text)||""}}}))}function Fo(e){if(!e||!qo(t=e.file)&&!Ko(t))return Promise.reject(Error('Invalid parameter: "file"'));var t;if(void 0!==e.currentUserId&&"string"!=typeof e.currentUserId)return Promise.reject(Error('Invalid parameter: "currentUserId"'));if(void 0!==e.audio){if("object"!=typeof e.audio||null===e.audio||Array.isArray(e.audio))return Promise.reject(Error('Invalid parameter: "audio"'));var r=e.audio,n=r.format,o=r.sampleRate,i=r.bitsPerSample,a=r.channels;if(void 0!==n&&"string"!=typeof n)return Promise.reject(Error('Invalid parameter: "audio.format"'));if(void 0!==o&&"number"!=typeof o)return Promise.reject(Error('Invalid parameter: "audio.sampleRate"'));if(void 0!==i&&"number"!=typeof i)return Promise.reject(Error('Invalid parameter: "audio.bitsPerSample"'));if(void 0!==a&&"number"!=typeof a)return Promise.reject(Error('Invalid parameter: "audio.channels"'))}var s=Nt.call(this).error;if(s)return Promise.reject(s);var c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,p=c.userId,f=e.currentUserId||p;if(!u||!l||!f)return Promise.reject(Error('Invalid parameter: "orgname", "appname" or "currentUserId"'));var m="".concat(this.apiUrl,"/api/sdk/v1/").concat(u,"/").concat(l,"/speech/recognitions");if(qo(e.file))return function(e){var t=new FormData,r=Wo(e.currentUserId,e.audio);return Object.keys(r).forEach((function(e){t.append(e,r[e])})),t.append("file",e.file),j.debug("Call recognizeSpeech",{currentUserId:e.currentUserId,fileName:e.file.name,fileSize:e.file.size,audio:e.audio}),new Promise((function(r,n){var o=new XMLHttpRequest;o.timeout=q,o.ontimeout=function(){n({type:d.REQUEST_TIMEOUT,message:"Request Timeout",errorType:"timeout_error",xhr:o})},o.onerror=function(){n({type:d.REQUEST_UNKNOWN,message:"Request Unknown Error",errorType:"onerror",xhr:o})},o.onabort=function(){n({type:d.REQUEST_ABORT,message:"Request Abort",errorType:"onabort",xhr:o})},o.onreadystatechange=function(){var e,t;if(4===o.readyState){var i=zo(o.responseText);200!==o.status?n({type:o.status||d.REQUEST_UNKNOWN,data:i,message:(null===(t=null==i?void 0:i.error)||void 0===t?void 0:t.message)||(null==i?void 0:i.message)||"Request Error",xhr:o}):r({type:d.REQUEST_SUCCESS,data:{text:(null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.text)||""}})}},o.open("POST",e.requestUrl),o.setRequestHeader("Authorization","Bearer "+e.accessToken),o.setRequestHeader("Accept","application/json"),o.send(t)}))}({file:e.file,currentUserId:f,audio:e.audio,requestUrl:m,accessToken:h});var g=Vo();return Ko(e.file)&&g?function(e){var t=Wo(e.currentUserId,e.audio);return j.debug("Call recognizeSpeech",{currentUserId:e.currentUserId,filePath:e.file.filePath,fileName:e.file.name||e.file.filePath.split("?")[0].split("/").filter(Boolean).pop(),fileSize:e.file.size,audio:e.audio}),new Promise((function(r,n){e.platForm.global.uploadFile({url:e.requestUrl,filePath:e.file.filePath,name:"file",header:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+e.accessToken,Accept:"application/json"},formData:t,success:function(e){var t,o,i=zo(e.data);200!==e.statusCode?n({type:e.statusCode||d.REQUEST_UNKNOWN,data:i,message:(null===(o=null==i?void 0:i.error)||void 0===o?void 0:o.message)||(null==i?void 0:i.message)||"Request Error"}):r({type:d.REQUEST_SUCCESS,data:{text:(null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.text)||""}})},fail:function(e){n({type:d.REQUEST_UNKNOWN,message:"Request Unknown Error",errorType:"upload_fail",data:e})}})}))}({file:e.file,currentUserId:f,audio:e.audio,requestUrl:m,accessToken:h,platForm:g}):Promise.reject(Error('Invalid parameter: "file"'))}function Wo(e,t){var r={username:e};return void 0!==(null==t?void 0:t.format)&&(r["audio.format"]=t.format),void 0!==(null==t?void 0:t.sampleRate)&&(r["audio.sampleRate"]=String(t.sampleRate)),void 0!==(null==t?void 0:t.bitsPerSample)&&(r["audio.bitsPerSample"]=String(t.bitsPerSample)),void 0!==(null==t?void 0:t.channels)&&(r["audio.channels"]=String(t.channels)),r}function zo(e){if("string"==typeof e&&e)try{return JSON.parse(e)}catch(t){return e}return e}function qo(e){return"undefined"!=typeof File&&e instanceof File}function Ko(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"string"==typeof e.filePath&&""!==e.filePath}function Vo(){var e,t=_e.getEnvInfo();if("web"!==t.platform&&"node"!==t.platform&&"quick_app"!==t.platform&&"function"==typeof(null===(e=t.global)||void 0===e?void 0:e.uploadFile))return t}function Jo(e){var t,r=function(e){var t,r,n=zo(null==e?void 0:e.data),o=null===(t=null==n?void 0:n.error)||void 0===t?void 0:t.code;return{serviceCode:"string"==typeof o||"number"==typeof o?String(o):void 0,serviceMessage:null===(r=null==n?void 0:n.error)||void 0===r?void 0:r.message}}(e),n=r.serviceCode,o=r.serviceMessage;if("number"==typeof(null==e?void 0:e.type)&&!n)return{type:e.type,message:(null==e?void 0:e.message)||"Voice-to-text failed"};switch(n){case"4041001":return{type:d.FILE_NOT_FOUND,message:"File not found"};case"4001002":return{type:d.FILE_INVALID,message:"Invalid file"};case"5021001":return{type:d.WEBIM_UPLOADFILE_ERROR,message:"File upload failed"};case"4001003":return{type:d.FILE_DURATION_TOO_LONG,message:"Voice duration exceeds 60 seconds"};case"4031001":return{type:d.SERVICE_NOT_ENABLED,message:"Service not enabled"};case"4031002":return{type:d.MAX_LIMIT,message:"Beta service usage limit exceeded"};case"4001001":return"string"==typeof(t=o)&&t.toLowerCase().includes("uploaded file exceeds")?{type:d.FILE_TOO_LARGE,message:"File too large"}:{type:d.REQUEST_PARAMETER_ERROR,message:o||"Missing or invalid request parameter"};case"5021003":case"5001003":return{type:d.FILE_VOICE_TO_TEXT_FAILED,message:"Voice-to-text failed"};case"4011001":return{type:d.NO_PERMISSION,message:o||"Unauthorized or invalid token"};default:return{type:d.FILE_VOICE_TO_TEXT_FAILED,message:o||(null==e?void 0:e.message)||"Voice-to-text failed"}}}function Yo(e,t,r){void 0===r&&(r="");var n={type:e};return e===d.REQUEST_SUCCESS?(n.data={text:r},n):(void 0!==t&&(n.message=t),n)}function Xo(e){return!(void 0===e||"object"==typeof e&&null!==e&&!Array.isArray(e))||void 0!==(null==e?void 0:e.format)&&"string"!=typeof e.format||void 0!==(null==e?void 0:e.sampleRate)&&"number"!=typeof e.sampleRate||void 0!==(null==e?void 0:e.bitsPerSample)&&"number"!=typeof e.bitsPerSample||void 0!==(null==e?void 0:e.channels)&&"number"!=typeof e.channels}function Qo(e,t){if(!e||"audio"!==e.type)return Promise.reject(Yo(d.FILE_INVALID,"Invalid file"));if(Xo(t))return Promise.reject(Yo(d.FILE_INVALID,"Invalid file"));if(!e.url)return Promise.reject(Yo(d.FILE_NOT_FOUND,"File not found"));var r=function(e){if(e){var t=e.split("#")[0].split("?")[0].split("/").filter(Boolean);return t[t.length-1]}}(e.url);return r?Ho.call(this,On({fileId:r},t?{audio:t}:{})).then((function(e){var t;return Yo(e.type,e.message,(null===(t=e.data)||void 0===t?void 0:t.text)||"")})).catch((function(e){var t=Jo(e);throw Yo(t.type,t.message)})):Promise.reject(Yo(d.FILE_INVALID,"Invalid file"))}function Zo(e,t){return Xo(t)?Promise.reject(Yo(d.FILE_INVALID,"Invalid file")):qo(e)||Ko(e)&&Vo()?Fo.call(this,On({file:e},t?{audio:t}:{})).then((function(e){var t;return Yo(e.type,e.message,(null===(t=e.data)||void 0===t?void 0:t.text)||"")})).catch((function(e){var t=Jo(e);throw Yo(t.type,t.message)})):Promise.reject(Yo(d.FILE_INVALID,"Invalid file"))}function $o(e){void 0===e&&(e="*");var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i=t.userId,a={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(i,"/token/rtc?channelName=").concat(e),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return ae.call(this,a).then((function(e){return{type:e.type,data:{appId:(null==e?void 0:e.app_id)||"",RTCToken:(null==e?void 0:e.rtc_token)||"",channelName:(null==e?void 0:e.channel_name)||"",RTCUId:(null==e?void 0:e.rtcUid)||0,expire:(null==e?void 0:e.expires_in)||0}}}))}function ei(e){if(!Array.isArray(e)||0===e.length)throw Error("Invalid parameter RTCUIds: "+e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/rtc_mapper/batch/get"),type:"POST",dataType:"json",data:JSON.stringify({data:e}),headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return ae.call(this,i).then((function(e){return{type:e.type,data:e.data||{}}}))}var ti=function(){return ti=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ti.apply(this,arguments)},ri=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},ni=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function oi(e){if(!e||!e.data)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups?resource=").concat(a.clientResource),dataType:"json",type:"POST",data:JSON.stringify({owner:this.user,groupname:e.data.groupname,avatar:e.data.avatar,desc:e.data.desc,members:e.data.members,public:e.data.public,approval:e.data.approval,allowinvites:e.data.allowinvites,invite_need_confirm:e.data.inviteNeedConfirm,maxusers:e.data.maxusers,custom:e.data.ext}),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:function(t){e.success&&e.success(t)},error:e.error};return j.debug("Call createGroup:",e),ae.call(this,s,v.CREATE_GROUP)}var ii=oi;function ai(e){var t,r,n,o,i,a,s,c,u;if(!e)throw Error("Invalid parameter");var l=Nt.call(this).error;if(l)return Promise.reject(l);var h=this.context,p=h.orgName,f=h.appName,m=h.accessToken,g=h.jid,E={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(f,"/chatgroups?resource=").concat(g.clientResource),dataType:"json",type:"POST",data:JSON.stringify({owner:this.user,groupname:null!==(t=e.groupName)&&void 0!==t?t:"",avatar:null!==(r=e.avatar)&&void 0!==r?r:"",desc:null!==(n=e.description)&&void 0!==n?n:"",members:e.members,public:null!==(o=e.isPublic)&&void 0!==o&&o,approval:null!==(i=e.needApprovalToJoin)&&void 0!==i&&i,allowinvites:null===(a=e.allowMemberToInvite)||void 0===a||a,invite_need_confirm:null!==(s=e.inviteNeedConfirm)&&void 0!==s&&s,maxusers:null!==(c=e.maxMemberCount)&&void 0!==c?c:200,custom:null!==(u=e.extension)&&void 0!==u?u:""}),headers:{Authorization:"Bearer "+m,"Content-Type":"application/json"}};return j.debug("Call createGroupVNext:",e),ae.call(this,E,v.CREATE_GROUP).then((function(e){return{type:d.REQUEST_SUCCESS,data:{groupId:e.data.groupid}}}))}function si(e){var t;if("string"!=typeof e.groupId||""===e.groupId)throw Error("Invalid parameter");var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={entities:[(t={},t["notification_ignore_"+e.groupId]=!0,t)]},u={type:"PUT",url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(this.user,"?resource=").concat(s.clientResource),data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call blockGroupMessages",e),ae.call(this,u,v.BLOCK_GROUP)}var ci=si;function ui(e){if("number"!=typeof e.limit)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={limit:e.limit,cursor:e.cursor};e.cursor||delete a.cursor;var s={url:this.apiUrl+"/"+n+"/"+o+"/publicchatgroups?version=v3",type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call listGroups",e),ae.call(this,s,v.LIST_GROUP).then((function(t){var r,n=t.data.map((function(e){return{groupid:e.id,groupname:e.name}}));return null===(r=e.success)||void 0===r||r.call(e,ti(ti({},t),{data:n})),ti(ti({},t),{data:n})}))}var li=ui;function di(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/users/"+this.user+"/joined_chatgroups",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return j.debug("Call getJoinedGroups",e),ae.call(this,a,v.GET_USER_GROUP)}function hi(e){if("number"!=typeof e.pageNum||"number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageNum or pageSize"');if(e.pageNum<0||e.pageSize<0)throw Error('"pageNum" should >= 0 and "pageSize" should >= 0');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.needAffiliations||e.needRole?"/chatgroups/user/".concat(this.user,"?pagenum=").concat(e.pageNum,"&pagesize=").concat(e.pageSize,"&needAffiliations=").concat(e.needAffiliations,"&needRole=").concat(e.needRole,"&version=v3"):"/users/".concat(this.user,"/joined_chatgroups?pagenum=").concat(e.pageNum,"&pagesize=").concat(e.pageSize,"&version=v3"),s={url:this.apiUrl+"/"+n+"/"+o+a,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e&&(null==e?void 0:e.error)};return j.debug("Call getGroup",e),ae.call(this,s,v.GET_USER_GROUP).then((function(t){var r,n=t.uri,o=t.entities,i=[];if(n.includes("joined_chatgroups")){var a=t.data.map((function(e){return{groupid:e.id,groupname:e.name,disabled:e.disabled,role:e.permission}}));return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:a})),ti(ti({},t),{data:a})}return o.forEach((function(e){var t={affiliationsCount:e.affiliations_count,groupName:e.name,groupId:e.groupId,role:e.permission,disabled:e.disabled,approval:e.membersonly,allowInvites:e.allowinvites,description:e.description,maxUsers:e.maxusers,public:e.public};i.push(t)})),t.entities=i,t}))}function pi(e){if("string"!=typeof e.groupId||"string"!=typeof e.newOwner)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={newowner:e.newOwner},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatgroups/").concat(e.groupId,"?resource=").concat(s.clientResource),type:"PUT",dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},data:JSON.stringify(r),success:e.success,error:e.error};return j.debug("Call changeOwner",e),ae.call(this,c,v.CHANGE_OWNER)}var fi=pi;function mi(e){if("string"!=typeof e.groupId&&!Array.isArray(e.groupId))throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+e.groupId+"?joined_time=true",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupInfo",e),ae.call(this,a,v.GET_GROUP_INFO)}function gi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={groupname:e.groupName,avatar:e.avatar,description:e.description,custom:e.ext},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"?resource=").concat(a.clientResource),type:"PUT",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call modifyGroup",e),ae.call(this,u,v.MODIFY_GROUP)}function vi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(isNaN(e.pageNum)||e.pageNum<=0)throw Error('The parameter "pageNum" should be a positive number');if(isNaN(e.pageSize)||e.pageSize<=0)throw Error('The parameter "pageSize" should be a positive number');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={pagenum:e.pageNum,pagesize:e.pageSize},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatgroups/"+e.groupId+"/users?version=v3",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call listGroupMember",e),ae.call(this,s,v.LIST_GROUP_MEMBER)}var Ei=vi;function yi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(e.cursor&&"string"!=typeof e.cursor)throw Error('Invalid parameter: "cursor"');if(e.limit&&"number"!=typeof e.limit)throw Error('Invalid parameter: "limit"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={cursor:e.cursor,limit:e.limit||50,joined_time:!0},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatgroups/"+e.groupId+"/users",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getGroupMembers",e),ae.call(this,s,v.LIST_GROUP_MEMBER).then((function(e){var t=e.data,r=e.cursor,n=t.map((function(e){for(var t in e)if(["member","admin","owner"].includes(t))return{role:t,userId:e[t],joinedTime:e.joined_time}}));return{type:d.REQUEST_SUCCESS,data:{cursor:r,members:n}}}))}function _i(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/admin?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupAdmin",e),ae.call(this,s,v.GET_GROUP_ADMIN)}function Ti(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={newadmin:e.username},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/admin?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setGroupAdmin",e),ae.call(this,u,v.SET_GROUP_ADMIN)}var Ii=Ti;function Oi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/admin/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeAdmin",e),ae.call(this,u,v.REMOVE_GROUP_ADMIN)}var Ri=Oi;function Ci(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"?version=v3&resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call destroyGroup",e),ae.call(this,c,v.DISSOLVE_GROUP)}var Si=Ci;function Ni(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/quit?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call quitGroup",e),ae.call(this,c,v.QUIT_GROUP)}var bi=Ni;function Ai(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.groupId,n={usernames:e.users},o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatgroups/").concat(r,"/invite?resource=").concat(c.clientResource),type:"POST",data:JSON.stringify(n),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call inviteUsersToGroup",e),ae.call(this,u,v.INVITE_TO_GROUP)}var Mi=Ai;function wi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(e.groupId,"/apply?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify({message:e.message||""}),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call joinGroup",e),ae.call(this,s,v.JOIN_GROUP)}function Ui(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.applicant||""===e.applicant)throw Error('Invalid parameter: "applicant"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={applicant:e.applicant,verifyResult:!0,reason:"no clue"},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/apply_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call agreeJoinGroup",e),ae.call(this,u,v.AGREE_JOIN_GROUP)}var Li=Ui;function Pi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.applicant||""===e.applicant)throw Error('Invalid parameter: "applicant"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={applicant:e.applicant,verifyResult:!1,reason:e.reason||""},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/apply_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call rejectGroupJoinRequest",e),ae.call(this,u,v.REJECT_JOIN_GROUP)}var Di=Pi;function ki(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.invitee||""===e.invitee)throw Error('Invalid parameter: "invitee"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={invitee:e.invitee,verifyResult:!0},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/invite_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call acceptGroupInvite",e),ae.call(this,u,v.AGREE_INVITE_GROUP)}var xi=ki;function Bi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.invitee||""===e.invitee)throw Error('Invalid parameter: "invitee"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={invitee:e.invitee,verifyResult:!1},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/invite_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call rejectGroupInvite",e),ae.call(this,u,v.REJECT_INVITE_GROUP)}var Gi=Bi;function ji(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.groupId,n=e.username,o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatgroups/").concat(r,"/users/").concat(n,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeGroupMember",e),ae.call(this,u,v.REMOVE_GROUP_MEMBER)}var Hi=ji;function Fi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.users.join(","),u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/users/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeGroupMembers",e),ae.call(this,u,v.MULTI_REMOVE_GROUP_MEMBER)}var Wi=Fi;function zi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!(Array.isArray(e.username)||"string"==typeof e.username&&""!==e.username))throw Error('Invalid parameter: "username"');if("number"!=typeof e.muteDuration)throw Error('Invalid parameter: "muteDuration"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:"string"==typeof e.username?[e.username]:e.username,mute_duration:e.muteDuration},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/mute?resource=").concat(a.clientResource,"&version=v3"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},data:JSON.stringify(c),success:e.success,error:e.error};return j.debug("Call muteGroupMember",e),ae.call(this,u,v.MUTE_GROUP_MEMBER)}var qi=zi;function Ki(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!(Array.isArray(e.username)||"string"==typeof e.username&&""!==e.username))throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/mute/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call unmuteGroupMember",e),ae.call(this,u,v.UNMUTE_GROUP_MEMBER)}var Vi=Ki;function Ji(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/mute?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupMuteList",e),ae.call(this,s,v.GET_GROUP_MUTE_LIST)}var Yi=Ji,Xi=Ji;function Qi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call blockGroupMember",e),ae.call(this,u,v.BLOCK_GROUP_MEMBER).then((function(t){var r,n=t.data[0]||{},o={action:"add_blocks",groupid:e.groupId,result:n.result,user:n.user};return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var Zi=Qi;function $i(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:e.usernames},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users?resource=").concat(a.clientResource,"&version=v3"),data:JSON.stringify(c),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call blockGroupMembers",e),ae.call(this,u,v.BLOCK_GROUP_MEMBERS).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return ti(ti({},t),{action:"add_blocks",groupid:e.groupId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var ea=$i;function ta(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockGroupMember",e),ae.call(this,u,v.UNBLOCK_GROUP_MEMBER).then((function(t){var r,n=t.data[0]||{},o={action:"remove_blocks",groupid:e.groupId,result:n.result,user:n.user};return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var ra=ta;function na(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.usernames.join(","),u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockGroupMembers",e),ae.call(this,u,v.UNBLOCK_GROUP_MEMBERS).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return ti(ti({},t),{action:"remove_blocks",groupid:e.groupId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var oa=na;function ia(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/blocks/users?version=v3",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupBlacklist",e),ae.call(this,s,v.GET_GROUP_BLACK_LIST)}var aa=ia,sa=ia;function ca(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call disableSendGroupMsg",e),ae.call(this,c,v.DISABLED_SEND_GROUP_MSG)}function ua(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call enableSendGroupMsg",e),ae.call(this,c,v.ENABLE_SEND_GROUP_MSG)}function la(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:e.users},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/white/users?resource=").concat(a.clientResource,"&version=v3"),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call addUsersToGroupWhitelist",e),ae.call(this,u,v.ADD_USERS_TO_GROUP_WHITE).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return ti(ti({},t),{action:"add_user_whitelist",groupid:e.groupId})}));return 1===(null==o?void 0:o.length)&&(o=o[0]),null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var da=la;function ha(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/white/users/").concat(e.userName,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call removeGroupAllowlistMember",e),ae.call(this,c,v.REMOVE_GROUP_WHITE_MEMBER).then((function(t){var r,n=t.data[0]||{},o={action:"remove_user_whitelist",groupid:e.groupId,result:n.result,user:n.user};return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var pa=ha,fa=ha;function ma(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/white/users?version=v3",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupAllowlist",e),ae.call(this,s,v.GET_GROUP_WHITE_LIST)}var ga=ma;function va(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/white/users/"+e.userName+"?version=v3",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call isInGroupAllowlist",e),ae.call(this,s,v.IS_IN_GROUP_WHITE_LIST)}var Ea=va,ya=va;function _a(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s={url:this.apiUrl+"/"+n+"/"+o+"/sdk/chatgroups/"+e.groupId+"/mute/"+a+"?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i}};return j.debug("Call isInGroupMutelist",e),ae.call(this,s).then((function(e){return{type:e.type,data:e.data}}))}function Ta(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.msgId||""===e.msgId)throw Error('Invalid parameter: "msgId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+e.groupId+"/acks/"+e.msgId,dataType:"json",type:"GET",data:{limit:500,key:void 0},headers:{Authorization:"Bearer "+i},success:e.success,error:e.error};return j.debug("Call getGroupMsgReadUser",e),ae.call(this,a,v.GET_GROUP_MSG_READ_USER)}function Ia(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(a,"/announcement?version=v3"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call fetchGroupAnnouncement",e),ae.call(this,s,v.GET_GROUP_ANN)}function Oa(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.announcement)throw Error('Invalid parameter: "announcement"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={announcement:e.announcement},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/announcement?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call updateGroupAnnouncement",e),ae.call(this,u,v.UPDATE_GROUP_ANN)}function Ra(e){var t;if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("object"!=typeof e.file)throw Error('Invalid parameter: "file"');var r=Nt.call(this).error;if(r)return null===(t=e.onFileUploadError)||void 0===t?void 0:t.call(e,r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c=e.groupId;me.call(this,{uploadUrl:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatgroups/").concat(c,"/share_files?resource=").concat(s.clientResource),onFileUploadProgress:e.onFileUploadProgress,onFileUploadComplete:e.onFileUploadComplete,onFileUploadError:e.onFileUploadError,onFileUploadCanceled:e.onFileUploadCanceled,accessToken:a,apiUrl:this.apiUrl,file:e.file,appKey:this.context.appKey,to:c,chatType:"groupChat"},v.UPLOAD_GROUP_FILE),j.debug("Call uploadGroupSharedFile",e)}function Ca(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.fileId||""===e.fileId)throw Error('Invalid parameter: "file"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.fileId,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/share_files/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call deleteGroupSharedFile",e),ae.call(this,u,v.DELETE_GROUP_FILE)}function Sa(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.pageNum||1,s=e.pageSize||10,c=e.groupId,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(c,"/share_files?pagenum=").concat(a,"&pagesize=").concat(s,"&version=v3"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupSharedFilelist",e),ae.call(this,u,v.GET_GROUP_FILE_LIST)}var Na=Sa;function ba(e){var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i=this.apiUrl,a=e.groupId,s=e.fileId;ge.call(this,{url:"".concat(i,"/").concat(r,"/").concat(n,"/chatgroups/").concat(a,"/share_files/").concat(s),onFileDownloadComplete:e.onFileDownloadComplete,onFileDownloadError:e.onFileDownloadError,accessToken:o,id:s,secret:e.secret},v.DOWN_GROUP_FILE),j.debug("Call downloadGroupSharedFile",e)}function Aa(e){return ri(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d;return ni(this,(function(h){switch(h.label){case 0:if(t=e.groupId,r=e.userId,n=e.memberAttributes,"string"!=typeof t||""===t)throw Error('Invalid parameter: "groupId"');if("string"!=typeof r||""===r)throw Error('Invalid parameter: "userId"');if("object"!=typeof n)throw Error('Invalid parameter: "memberAttributes"');return(o=Nt.call(this).error)?[2,Promise.reject(o)]:(i=this.context,a=i.orgName,s=i.appName,c=i.accessToken,u=i.jid,l={metaData:n},d={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(s,"/sdk/metadata/chatgroup/").concat(t,"/user/").concat(r,"?resource=").concat(u.clientResource,"&version=v3"),type:"PUT",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}},j.debug("Call setGroupMemberAttributes",e),[4,ae.call(this,d,v.SET_GROUP_MEMBER_ATTRS)]);case 1:return h.sent(),[2]}}))}))}function Ma(e){var t=e.groupId,r=e.userId;return wa.call(this,{groupId:t,userIds:[r]}).then((function(e){var t;return{type:e.type,data:null===(t=e.data)||void 0===t?void 0:t[r]}}))}function wa(e){var t=e.groupId,r=e.userIds,n=e.keys,o=void 0===n?[]:n;if("string"!=typeof t||""===t)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(r)||(null==r?void 0:r.length)<=0)throw Error('Invalid parameter: "userIds"');if(!Array.isArray(o))throw Error('Invalid parameter: "keys"');var i=Nt.call(this).error;if(i)return Promise.reject(i);var a=this.context,s=a.orgName,c=a.appName,u=a.accessToken,l={targets:r,properties:o},d={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/metadata/chatgroup/").concat(t,"/get?version=v3"),type:"POST",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}};return j.debug("Call getGroupMembersAttributes",e),ae.call(this,d,v.GET_GROUP_MEMBER_ATTR).then((function(e){return{type:e.type,data:(null==e?void 0:e.data)||{}}}))}function Ua(){var e=Nt.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/chatgroups/user/").concat(this.context.userId,"/joined_count"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return j.debug("Call getJoinedGroupsCount"),ae.call(this,i).then((function(e){return{type:d.REQUEST_SUCCESS,data:e.data||0}}))}function La(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/shield?version=v3&resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call blockGroupMessages",e),ae.call(this,c).then((function(e){return{type:d.REQUEST_SUCCESS,data:e.data||{}}}))}function Pa(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/shield?version=v3&resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call unblockGroupMessages",e),ae.call(this,c).then((function(e){return{type:d.REQUEST_SUCCESS,data:e.data||{}}}))}var Da=function(){return Da=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Da.apply(this,arguments)};function ka(e){var t=this;if("number"!=typeof e.pagenum||"number"!=typeof e.pagesize)throw Error("Invalid parameter");var r=Nt.call(this).error;if(r)return Promise.reject(r);var n={pagenum:e.pagenum||1,pagesize:e.pagesize||20},o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c={url:this.apiUrl+"/"+i+"/"+a+"/chatrooms",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+s},data:n,success:function(t){"function"==typeof e.success&&e.success(t)},error:function(r){r.error&&r.error_description&&t.onError&&t.onError({type:d.WEBIM_CONNCTION_LOAD_CHATROOM_ERROR,message:r.error_description,data:r}),"function"==typeof e.error&&e.error(r)}};return j.debug("Call getChatRooms",e),ae.call(this,c,v.GET_CHATROOM_LIST)}function xa(e){if("string"!=typeof e.name)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={name:e.name,description:e.description,maxusers:e.maxusers,owner:this.user,members:e.members},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatrooms?resource=").concat(s.clientResource),dataType:"json",type:"POST",data:JSON.stringify(r),headers:{Authorization:"Bearer "+(e.token||a),"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call createChatRoom",e),ae.call(this,c,v.CREATE_CHATROOM)}function Ba(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(e.chatRoomId,"?resource=").concat(a.clientResource,"&version=v3"),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+(e.token||i)},success:e.success,error:e.error};return j.debug("Call destroyChatRoom",e),ae.call(this,s,v.DESTROY_CHATROOM)}function Ga(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+e.chatRoomId,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomDetails",e),ae.call(this,a,v.GET_CHATROOM_DETAIL)}function ja(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={groupname:e.chatRoomName,description:e.description,maxusers:e.maxusers},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"?resource=").concat(a.clientResource),type:"PUT",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call modifyChatRoom",e),ae.call(this,u,v.MODIFY_CHATROOM)}function Ha(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||"string"!=typeof e.username)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/users/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeChatRoomMember",e),ae.call(this,u,v.REMOVE_CHATROOM_MEMBER)}var Fa=Ha;function Wa(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||!Array.isArray(e.users))throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.chatRoomId,n=e.users.join(","),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatrooms/").concat(r,"/users/").concat(n,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeChatRoomMembers",e),ae.call(this,u,v.MULTI_REMOVE_CHATROOM_MEMBER)}var za=Wa;function qa(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||!Array.isArray(e.users))throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.chatRoomId,n={usernames:e.users},o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatrooms/").concat(r,"/users?resource=").concat(c.clientResource),type:"POST",data:JSON.stringify(n),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call addUsersToChatRoom",e),ae.call(this,u,v.ADD_USERS_TO_CHATROOM)}function Ka(e){var t=e.roomId,r=e.message,n=void 0===r?"":r,o=e.ext,i=void 0===o?"":o,a=e.leaveOtherRooms,s=void 0!==a&&a,c=e.success,u=e.error;if("string"!=typeof t||""===t)throw Error("Invalid parameter roomId");if("string"!=typeof i)throw Error("Invalid parameter ext");if("boolean"!=typeof s)throw Error("Invalid parameter leaveOtherRooms");var l=Nt.call(this).error;return l?Promise.reject(l):(j.debug("Call joinChatRoom",e),this.logOut?Promise.reject({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"}):this.mSync.handleChatRoom({roomId:t,ext:i,leaveOtherRooms:s,message:n,success:c,errorCb:u},"join"))}function Va(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error("Invalid parameter");var t=Nt.call(this).error;return t?Promise.reject(t):(j.debug("Call leaveChatRoom",e),this.logOut?Promise.reject({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"}):this.mSync.handleChatRoom(e,"leave"))}var Ja=Va;function Ya(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(isNaN(e.pageNum)||e.pageNum<=0)throw Error('The parameter "pageNum" should be a positive number');if(isNaN(e.pageSize)||e.pageSize<=0)throw Error('The parameter "pageSize" should be a positive number');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={pagenum:e.pageNum,pagesize:e.pageSize},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatrooms/"+e.chatRoomId+"/users?version=v3",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call listChatRoomMembers",e),ae.call(this,s,v.LIST_CHATROOM_MEMBERS)}var Xa=Ya;function Qa(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(e.cursor&&"string"!=typeof e.cursor)throw Error('Invalid parameter: "cursor"');if(e.limit&&"number"!=typeof e.limit)throw Error('Invalid parameter: "limit"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={cursor:e.cursor,limit:e.limit||50,joined_time:!0},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatrooms/"+e.chatRoomId+"/users",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getChatRoomMembers",e),ae.call(this,s,v.LIST_GROUP_MEMBER).then((function(e){var t=e.data,r=e.cursor,n=t.map((function(e){for(var t in e)if(["member","admin","owner"].includes(t))return{role:t,userId:e[t],joinedTime:e.joined_time}}));return{type:d.REQUEST_SUCCESS,data:{cursor:r,members:n}}}))}function Za(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/admin?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomAdmin",e),ae.call(this,s,v.GET_CHATROOM_ADMIN)}function $a(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={newadmin:e.username},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/admin?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setChatRoomAdmin",e),ae.call(this,u,v.SET_CHATROOM_ADMIN)}function es(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/admin/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeChatRoomAdmin",e),ae.call(this,u,v.REMOVE_CHATROOM_ADMIN)}function ts(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');if("number"!=typeof e.muteDuration)throw Error('Invalid parameter: "muteDuration"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:[e.username],mute_duration:e.muteDuration},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/mute?resource=").concat(a.clientResource),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},data:JSON.stringify(c),success:e.success,error:e.error};return j.debug("Call muteChatRoomMember",e),ae.call(this,u,v.MUTE_CHATROOM_MEMBER)}function rs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/mute/").concat(c,"?resource=").concat(a.clientResource),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call unmuteChatRoomMember",e),ae.call(this,u,v.REMOVE_MUTE_CHATROOM_MEMBER)}var ns=rs;function os(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/mute?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomMutelist",e),ae.call(this,s,v.GET_MUTE_CHATROOM_MEMBERS)}var is=os,as=os;function ss(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call blockChatRoomMember",e),ae.call(this,u,v.SET_CHATROOM_MEMBER_TO_BLACK).then((function(t){var r,n=t.data[0]||{},o=Da(Da({},n),{action:"add_blocks",id:e.chatRoomId});return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var cs=ss;function us(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:e.usernames},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users?resource=").concat(a.clientResource,"&version=v3"),data:JSON.stringify(c),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Chat blockChatRoomMembers:",u),ae.call(this,u,v.MULTI_SET_CHATROOM_MEMBER_TO_BLACK).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return Da(Da({},t),{action:"add_blocks",id:e.chatRoomId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var ls=us;function ds(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockChatRoomMember",e),ae.call(this,u,v.REMOVE_CHATROOM_MEMBER_BLACK).then((function(t){var r,n=t.data;return null===(r=e.success)||void 0===r||r.call(e,Da(Da({},t),{data:Da(Da({},n[0]),{action:"remove_blocks",id:e.chatRoomId})})),Da(Da({},t),{data:Da(Da({},n[0]),{action:"remove_blocks",id:e.chatRoomId})})}))}var hs=ds;function ps(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.usernames.join(","),u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockChatRoomMembers",e),ae.call(this,u,v.MULTI_REMOVE_CHATROOM_MEMBER_BLACK).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return Da(Da({},t),{action:"remove_blocks",id:e.chatRoomId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var fs=ps;function ms(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/blocks/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomBlocklist",e),ae.call(this,s,v.GET_CHATROOM_BLOCK_MEMBERS)}var gs=ms,vs=ms;function Es(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call disableSendChatRoomMsg",e),ae.call(this,c,v.DISABLED_CHATROOM_SEND_MSG)}function ys(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call enableSendChatRoomMsg",e),ae.call(this,c,v.ENABLE_CHATROOM_SEND_MSG)}function _s(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:e.users},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/white/users?resource=").concat(a.clientResource,"&version=v3"),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call addUsersToChatRoomWhitelist",e),ae.call(this,u,v.ADD_USERS_TO_CHATROOM).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return Da(Da({},t),{action:"add_user_whitelist",id:e.chatRoomId})}));return 1===(null==o?void 0:o.length)&&(o=o[0]),null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var Ts=_s;function Is(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/white/users/").concat(e.userName,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call removeChatRoomAllowlistMember",e),ae.call(this,c,v.REMOVE_CHATROOM_WHITE_USERS).then((function(t){var r;return null===(r=e.success)||void 0===r||r.call(e,Da(Da({},t),{data:Da(Da({},t.data[0]),{action:"remove_user_whitelist",id:e.chatRoomId})})),Da(Da({},t),{data:Da(Da({},t.data[0]),{action:"remove_user_whitelist",id:e.chatRoomId})})}))}var Os=Is,Rs=Is;function Cs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/white/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomAllowlist",e),ae.call(this,s,v.GET_CHATROOM_WHITE_USERS)}var Ss=Cs;function Ns(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/white/users/"+e.userName,type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call isInChatRoomAllowlist",e),ae.call(this,s,v.CHECK_CHATROOM_WHITE_USER)}var bs=Ns;function As(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s={url:this.apiUrl+"/"+n+"/"+o+"/sdk/chatrooms/"+e.chatRoomId+"/mute/"+a+"?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i}};return j.debug("Call isInChatRoomMutelist",e),ae.call(this,s).then((function(e){return{type:e.type,data:e.data}}))}function Ms(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.roomId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(a,"/announcement?version=v3"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call fetchChatRoomAnnouncement",e),ae.call(this,s,v.GET_CHATROOM_ANN)}function ws(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("string"!=typeof e.announcement)throw Error('Invalid parameter: "announcement"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.roomId,c={announcement:e.announcement},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/announcement?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call updateChatRoomAnnouncement:",e),ae.call(this,u,v.UPDATE_CHATROOM_ANN)}function Us(e){var t;if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("object"!=typeof e.file)throw Error('Invalid parameter: "file"');var r=Nt.call(this).error;if(r)return null===(t=e.onFileUploadError)||void 0===t?void 0:t.call(e,r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c=e.roomId;me.call(this,{uploadUrl:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatrooms/").concat(c,"/share_files?resource=").concat(s.clientResource),onFileUploadProgress:e.onFileUploadProgress,onFileUploadComplete:e.onFileUploadComplete,onFileUploadError:e.onFileUploadError,onFileUploadCanceled:e.onFileUploadCanceled,accessToken:a,apiUrl:this.apiUrl,file:e.file,appKey:this.context.appKey,to:c,chatType:"chatRoom"},v.UPLOAD_CHATROOM_FILE),j.debug("Call uploadChatRoomSharedFile",e)}function Ls(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("string"!=typeof e.fileId||""===e.fileId)throw Error('Invalid parameter: "fileId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.roomId,c=e.fileId,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/share_files/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call deleteChatRoomSharedFile",e),ae.call(this,u,v.DELETE_CHATROOM_FILE)}function Ps(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.roomId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(a,"/share_files"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json",accept:"application/json"},success:e.success,error:e.error};return j.debug("Call fetchChatRoomSharedFileList",e),ae.call(this,s,v.GET_CHATROOM_FILES)}var Ds=Ps;function ks(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if(e.attributeKeys&&!Array.isArray(e.attributeKeys))throw Error('"Invalid parameter attributeKeys": '+e.attributeKeys);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=(r.jid,e.chatRoomId),s={keys:e.attributeKeys},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(a),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call getChatRoomAttributes:",e),ae.call(this,c,v.GET_CHATROOM_ATTR).then((function(e){return{data:e.data,type:e.type}}))}function xs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if("object"!=typeof e.attributes)throw Error("Invalid parameter attributes: "+e.attributes);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributes,u=e.autoDelete,l=void 0===u||u,d=e.isForced?"/forced":"",h={metaData:c,autoDelete:l?"DELETE":"NO_DELETE"},p={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(s,"/user/").concat(a)+d,type:"PUT",dataType:"json",data:JSON.stringify(h),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call setChatRoomAttributes:",e),ae.call(this,p,v.SET_CHATROOM_ATTR).then((function(e){return bt(e)}))}function Bs(e){var t;if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if("string"!=typeof e.attributeKey||""===e.attributeKey)throw Error("Invalid parameter attributeKey: "+e.attributeKey);if("string"!=typeof e.attributeValue||""===e.attributeValue)throw Error("Invalid parameter attributeValue: "+e.attributeValue);var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.userId,c=e.chatRoomId,u=e.attributeKey,l=e.attributeValue,d=e.autoDelete,h=void 0===d||d,p=e.isForced?"/forced":"",f={metaData:(t={},t[u]=l,t),autoDelete:h?"DELETE":"NO_DELETE"},m={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/metadata/chatroom/").concat(c,"/user/").concat(s)+p,type:"PUT",dataType:"json",data:JSON.stringify(f),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call setChatRoomAttribute:",e),ae.call(this,m,v.SET_CHATROOM_ATTR).then((function(e){var t=At(e);if(t)throw t}))}function Gs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if(!Array.isArray(e.attributeKeys))throw Error('"Invalid parameter attributes": '+e.attributeKeys);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributeKeys,u=e.isForced?"/forced":"",l={keys:c},d={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(s,"/user/").concat(a)+u,type:"DELETE",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call removeChatRoomAttributes:",e),ae.call(this,d,v.DELETE_CHATROOM_ATTR).then((function(e){return bt(e)}))}function js(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if("string"!=typeof e.attributeKey||""===e.attributeKey)throw Error('"Invalid parameter attributeKey": '+e.attributeKey);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributeKey,u=e.isForced?"/forced":"",l={keys:[c]},d={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(s,"/user/").concat(a)+u,type:"DELETE",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call removeChatRoomAttribute:",e),ae.call(this,d,v.DELETE_CHATROOM_ATTR).then((function(e){var t=At(e);if(t)throw t}))}function Hs(e){var t=this,r=e||{},n=r.pageNum,o=r.pageSize;if(isNaN(n)||n<=0)throw Error("Invalid parameter pageNum:".concat(n));if(isNaN(o)||o<=0)throw Error("Invalid parameter pageSize:".concat(o));var i=Nt.call(this).error;if(i)return Promise.reject(i);var a={pagenum:n,pagesize:o,detail:!0},s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(this.user,"/joined_chatrooms"),dataType:"json",type:"GET",data:a,headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}};return j.debug("Call getJoinedChatRooms",e),ae.call(this,d,v.GET_USER_JOINED_CHATROOM).then((function(e){var r=(e.data||[]).map((function(e){var r=e.id,n=e.title,o=e.owner,i=e.created,a=e.description,s=e.max_users;return{id:r,name:n,owner:o.split("".concat(t.appKey,"_"))[1],created:i,description:a,maxusers:s}}));return{type:e.type,data:r}}))}var Fs=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Ws=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function zs(e){return Fs(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Ws(this,(function(l){switch(l.label){case 0:if("string"!=typeof e.description)throw Error('Invalid parameter: "description"');return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s=this.context.jid.clientResource,c={ext:e.description},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/presence/").concat(s,"/1"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error},j.debug("Call publishPresence:",e),[4,ae.call(this,u)]);case 1:return l.sent(),[2]}}))}))}function qs(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');if("number"!=typeof e.expiry)throw Error('Invalid parameter: "expiry"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.userId,a=r.accessToken,s={usernames:e.usernames},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(i,"/presence/").concat(e.expiry),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call subscribePresence:",e),ae.call(this,c).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function Ks(e){return Fs(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Ws(this,(function(c){switch(c.label){case 0:if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.userId,a=r.accessToken,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(i,"/presence"),type:"DELETE",dataType:"json",data:JSON.stringify(e.usernames),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error},j.debug("Call unsubscribePresence:",e),[4,ae.call(this,s)]);case 1:return c.sent(),[2]}}))}))}function Vs(e){if("number"!=typeof e.pageNum||"number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageNum or pageSize"');if(e.pageNum<0||e.pageSize<0)throw Error('"pageNum" should >= 0 and "pageSize" should >= 0');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.userId,a=r.accessToken,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(i,"/presence/sublist?pageNum=").concat(e.pageNum,"&pageSize=").concat(e.pageSize),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getSubscribedPresenceList:",e),ae.call(this,s).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}var Js=Vs;function Ys(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={usernames:e.usernames},n=this.context,o=n.orgName,i=n.appName,a=n.userId,s=n.accessToken,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/presence"),type:"POST",dataType:"json",data:JSON.stringify(r),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getPresenceStatus:",e),ae.call(this,c).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function Xs(e){if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var t=e.options.paramType;if("number"!=typeof t||t<0||t>2)throw Error('Invalid parameter: "options of paramType"');if(0===t){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===t){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===t){var r=e.options,n=r.startTime,o=r.endTime;if(!(n instanceof Object&&Object.keys(n).length))throw Error('Invalid parameter: "options of startTime"');if("number"!=typeof n.hours||"number"!=typeof n.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(o instanceof Object&&Object.keys(o).length))throw Error('Invalid parameter: "options of endTime"');if("number"!=typeof o.hours||"number"!=typeof o.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}var i=Nt.call(this).error;if(i)return Promise.reject(i);var a=this.context,s=a.accessToken,c=a.orgName,u=a.appName,l=a.userId,d=a.jid,h={};switch(t){case 0:h={type:e.options.remindType};break;case 1:h={ignoreDuration:e.options.duration};break;case 2:var p=e.options;n=p.startTime,o=p.endTime,h={ignoreInterval:"".concat(n.hours,":").concat(n.minutes,"-").concat(o.hours,":").concat(o.minutes)}}var f={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(l,"/notification/user/").concat(l,"?resource=").concat(d.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(h),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setSilentModeForAll:",e),ae.call(this,f)}function Qs(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/user/").concat(a),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return j.debug("Call getSilentModeForAll:",e),ae.call(this,s)}function Zs(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var t=e.options.paramType;if("number"!=typeof t||t<0||t>2)throw Error('Invalid parameter: "options of paramType"');if(0===t){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===t){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===t){var r=e.options,n=r.startTime,o=r.endTime;if(!(n instanceof Object&&Object.keys(n).length))throw Error('Invalid parameter: "options of startTime"');if("number"!=typeof n.hours||"number"!=typeof n.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(o instanceof Object&&Object.keys(o).length))throw Error('Invalid parameter: "options of endTime"');if("number"!=typeof o.hours||"number"!=typeof o.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}var i=Nt.call(this).error;if(i)return Promise.reject(i);var a=this.context,s=a.accessToken,c=a.orgName,u=a.appName,l=a.userId,d=a.jid,h="chatgroup",p={};switch(t){case 0:p={type:e.options.remindType};break;case 1:p={ignoreDuration:e.options.duration};break;case 2:var f=e.options;n=f.startTime,o=f.endTime,p={ignoreInterval:"".concat(n.hours,":").concat(n.minutes,"-").concat(o.hours,":").concat(o.minutes)}}"singleChat"===e.type&&(h="user");var m={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(l,"/notification/").concat(h,"/").concat(e.conversationId,"?resource=").concat(d.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setSilentModeForConversation:",e),ae.call(this,m)}function $s(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s=r.jid,c="chatgroup";"singleChat"===e.type&&(c="user");var u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/").concat(c,"/").concat(e.conversationId,"?resource=").concat(s.clientResource),type:"PUT",dataType:"json",data:JSON.stringify({type:"DEFAULT"}),headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call clearRemindTypeForConversation:",e),ae.call(this,u)}function ec(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s="chatgroup";"singleChat"===e.type&&(s="user");var c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/").concat(s,"/").concat(e.conversationId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getSilentModeForConversation:",e),ae.call(this,c)}function tc(e){if(!Array.isArray(e.conversationList))throw Error('Invalid parameter: "conversationList"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s=[],c=[];e.conversationList.forEach((function(e){"singleChat"===e.type?s.push(e.id):c.push(e.id)}));var u=s.length?s.join(","):"",l=c.length?c.join(","):"",d={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification?user=").concat(u,"&group=").concat(l),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getSilentModeForConversations:",e),ae.call(this,d)}function rc(e){if("string"!=typeof e.language||!e.language)throw Error('Invalid parameter: "language"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={translationLanguage:e.language},n=this.context,o=n.accessToken,i=n.orgName,a=n.appName,s=n.userId,c={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/users/").concat(s,"/notification/language"),type:"PUT",dataType:"json",data:JSON.stringify(r),headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setPushPerformLanguage:",e),ae.call(this,c)}function nc(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/language"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return j.debug("Call getPushPerformLanguage:",e),ae.call(this,s)}function oc(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);if("number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageSize"');var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s={limit:e.pageSize||10,cursor:e.cursor};e.cursor||delete s.cursor;var c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/mute/type"),type:"GET",dataType:"json",data:s,headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"}};return j.debug("Call getSilentModeRemindTypeConversations:",e),ae.call(this,c).then((function(e){return e.data?{data:{conversations:e.data.map((function(e){return"user"in e?{conversationId:e.user,type:"singleChat",remindType:e.value}:{conversationId:e.group,type:"groupChat",remindType:e.value}})),cursor:e.cursor},type:e.type}:e}))}var ic=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},ac=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function sc(e){if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));if("string"!=typeof e.messageId||""===e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={name:e.name,msg_id:e.messageId,group_id:e.parentId,owner:this.user},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,c).then((function(e){var t=e.data.thread_id;return e.data={chatThreadId:t},e}))}function cc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/join?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s).then((function(e){var t=e.data.detail;return t.messageId=t.msgId,t.parentId=t.groupId,delete t.msgId,delete t.groupId,e}))}function uc(e){return ic(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return ac(this,(function(c){switch(c.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/quit?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s)]);case 1:return c.sent(),[2]}}))}))}function lc(e){return ic(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return ac(this,(function(c){switch(c.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s)]);case 1:return c.sent(),[2]}}))}))}function dc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={name:e.name},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"?resource=").concat(a.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,c)}function hc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={limit:e.pageSize||20,cursor:e.cursor||""},s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/users"),type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s)}function pc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.username||""===e.username)throw Error("Invalid parameter username: ".concat(e.username));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/users/").concat(e.username,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s)}function fc(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={limit:e.pageSize||20,cursor:e.cursor||""},s={url:e.parentId?"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/threads/chatgroups/").concat(e.parentId,"/user/").concat(this.user):"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/threads/user/").concat(this.user),type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function mc(e){if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={cursor:e.cursor||"",limit:e.pageSize||20},s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/threads/chatgroups/").concat(e.parentId),type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function gc(e){var t=this;if(!Array.isArray(e.chatThreadIds))throw Error("Invalid parameter chatThreadIds: ".concat(e.chatThreadIds));var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={threadIds:e.chatThreadIds},c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/thread/message"),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return ae.call(this,c).then((function(e){return vc.call(t,e)}))}function vc(e){var t=this,r=e.entities;return null==r||r.forEach((function(e){e.chatThreadId=e.thread_id,e.last_message&&"{}"!==JSON.stringify(e.last_message)?e.lastMessage=Ne.call(t,e.last_message):e.lastMessage=e.last_message,delete e.thread_id,delete e.last_message})),e}function Ec(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,a).then((function(e){return e.data.affiliationsCount=e.data.affiliations_count,e.data.messageId=e.data.msgId,e.data.parentId=e.data.groupId,delete e.data.affiliations_count,delete e.data.msgId,delete e.data.groupId,e}))}function yc(){var e=Nt.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(this.user,"/translate/support/language"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+o}};return j.debug("Call getSupportedLanguages"),ae.call(this,i)}function _c(e){if("string"!=typeof e.text||""===e.text)throw Error('Invalid parameter: "text"');if(!Array.isArray(e.languages))throw Error('Invalid parameter: "language"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a="".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/translate"),s={text:e.text,to:e.languages},c={url:a,dataType:"json",type:"POST",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i}};return j.debug("Call translateMessage"),ae.call(this,c)}var Tc=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Ic=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function Oc(e){return Tc(this,void 0,void 0,(function(){return Ic(this,(function(t){return[2,Zt(e)]}))}))}var Rc=new(function(){function e(){}return e.prototype.getImageInfo=function(e){return Tc(this,void 0,void 0,(function(){return Ic(this,(function(t){return"string"==typeof e?[2,this._getImageInfoFromUrl(e)]:[2,this._getImageInfoFromFile(e)]}))}))},e.prototype._getImageInfoFromFile=function(e){return new Promise((function(t,r){var n=URL.createObjectURL(e),o=new Image;o.onload=function(){URL.revokeObjectURL(n),t({width:o.width,height:o.height,type:e.type})},o.onerror=function(){URL.revokeObjectURL(n),r(new Error("Failed to load image"))},o.src=n}))},e.prototype._getImageInfoFromUrl=function(e){return new Promise((function(t,r){var n=new Image;n.onload=function(){return t({width:n.width,height:n.height})},n.onerror=function(){return r(new Error("Failed to load image from URL"))},n.src=e}))},e.prototype.generateBigImage=function(e,t){return Tc(this,void 0,void 0,(function(){var r,n,o,i,a,s,c,u,l;return Ic(this,(function(d){switch(d.label){case 0:if("string"==typeof e)throw new Error("Web image processor requires File input for compression");return[4,this.getImageInfo(e)];case 1:return r=d.sent(),(n=Yt(r.width,r.height,t.maxShortEdge)).width===r.width&&n.height===r.height?[2,null]:"function"!=typeof createImageBitmap?[3,3]:[4,createImageBitmap(e)];case 2:return i=d.sent(),[3,5];case 3:return[4,this._loadImage(e)];case 4:i=d.sent(),d.label=5;case 5:if(o=i,a=void 0!==globalThis.OffscreenCanvas?new globalThis.OffscreenCanvas(n.width,n.height):this._createCanvas(n.width,n.height),!(s=a.getContext("2d")))throw new Error("Failed to get canvas context");return s.drawImage(o,0,0,n.width,n.height),c="image/png"===e.type?"image/png":"image/webp"===e.type?"image/webp":"image/jpeg",[4,this._canvasToBlob(a,c,t.quality)];case 6:return u=d.sent(),[2,{file:l=new File([u],e.name||"compressed.jpg",{type:c}),width:n.width,height:n.height,size:l.size,type:c}]}}))}))},e.prototype.computeMd5=function(e){return Tc(this,void 0,void 0,(function(){return Ic(this,(function(t){switch(t.label){case 0:if("string"==typeof e)throw new Error("Web image processor requires File input for MD5");return[4,e.arrayBuffer()];case 1:return[2,Oc(t.sent())]}}))}))},e.prototype._loadImage=function(e){return new Promise((function(t,r){var n=URL.createObjectURL(e),o=new Image;o.onload=function(){URL.revokeObjectURL(n),t(o)},o.onerror=function(){URL.revokeObjectURL(n),r(new Error("Failed to load image"))},o.src=n}))},e.prototype._createCanvas=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,r},e.prototype._canvasToBlob=function(e,t,r){return"convertToBlob"in e?e.convertToBlob({type:t,quality:r}):new Promise((function(n,o){e.toBlob((function(e){return e?n(e):o(new Error("toBlob failed"))}),t,r)}))},e}()),Cc=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Sc=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Nc=function(){function e(e){this._pathCache=new Map,this.runtime=e}return e.prototype.getImageInfo=function(e){return"string"!=typeof e?Promise.reject(new Error("MiniApp image processor requires file path string")):this._loadImageInfo(e)},e.prototype.generateBigImage=function(e,t){return Cc(this,void 0,void 0,(function(){var r,n,o,i,a,s,c;return Sc(this,(function(u){switch(u.label){case 0:return"string"!=typeof e?[2,Promise.reject(new Error("MiniApp image processor requires file path string"))]:this.runtime.compressImage?[4,this._loadImageInfo(e)]:[2,Promise.reject(new Error("Platform missing compressImage capability"))];case 1:return r=u.sent(),(n=r.path||e)!==e&&j.debug("Miniapp image path normalized before compress",e,n),(o=Yt(r.width,r.height,t.maxShortEdge)).width===r.width&&o.height===r.height?[2,null]:(i=this.runtime.compressImage,[4,new Promise((function(e,r){i({src:n,quality:Math.round(100*t.quality),compressedWidth:o.width,compressedHeight:o.height,success:function(t){return e(t.tempFilePath)},fail:r})}))]);case 2:return a=u.sent(),j.debug("Miniapp compressImage temp path",a),[4,this._normalizeLocalPath(a)];case 3:return s=u.sent(),[4,this._getFileSize(s)];case 4:return c=u.sent(),[2,{path:s,width:o.width,height:o.height,size:c,type:"image/jpeg"}]}}))}))},e.prototype.computeMd5=function(e){var t,r;return Cc(this,void 0,void 0,(function(){var n,o;return Sc(this,(function(i){switch(i.label){case 0:return"string"!=typeof e?[2,Promise.reject(new Error("MiniApp image processor requires file path string"))]:(n=null===(r=(t=this.runtime).getFileSystemManager)||void 0===r?void 0:r.call(t))?[4,this._normalizeLocalPath(e)]:[2,Promise.reject(new Error("Platform missing getFileSystemManager capability"))];case 1:return o=i.sent(),[4,new Promise((function(e,t){n.readFile({filePath:o,success:function(t){return e(t.data)},fail:t})}))];case 2:return[2,Zt(i.sent())]}}))}))},e.prototype._getFileSize=function(e){var t,r;return Cc(this,void 0,void 0,(function(){var n,o,i,a,s,c,u,l,d,h;return Sc(this,(function(p){switch(p.label){case 0:return(n=null===(r=(t=this.runtime).getFileSystemManager)||void 0===r?void 0:r.call(t))?[4,this._normalizeLocalPath(e)]:(j.warn("Miniapp getFileSize: no FileSystemManager available"),[2,0]);case 1:o=p.sent(),j.debug("Miniapp getFileSize paths","original: ".concat(e),"normalized: ".concat(o)),i=function(e){var t,r;return Sc(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,new Promise((function(t,r){n.getFileInfo({filePath:e,success:function(e){return t(e.size)},fail:r})}))];case 1:return(t=o.sent())>0?(j.debug("Miniapp getFileSize success via getFileInfo","path: ".concat(e,", size: ").concat(t)),[2,{value:t}]):[3,3];case 2:return r=o.sent(),j.debug("Miniapp getFileInfo failed for path",e,r),[3,3];case 3:return[2]}}))},a=0,s=o!==e?[o,e]:[e],p.label=2;case 2:return a<s.length?(c=s[a],[5,i(c)]):[3,5];case 3:if("object"==typeof(u=p.sent()))return[2,u.value];p.label=4;case 4:return a++,[3,2];case 5:return p.trys.push([5,7,,8]),[4,new Promise((function(e,t){n.readFile({filePath:o,success:function(t){return e(t.data)},fail:t})}))];case 6:return l=p.sent(),d=l.byteLength,j.debug("Miniapp getFileSize fallback via readFile","size: ".concat(d)),[2,d];case 7:return h=p.sent(),j.warn("Miniapp getFileSize: all methods failed","path: ".concat(e),h),[2,0];case 8:return[2]}}))}))},e.prototype._loadImageInfo=function(e){var t=this;return new Promise((function(r,n){t.runtime.getImageInfo({src:e,success:function(e){return r({width:e.width,height:e.height,type:e.type,path:e.path})},fail:n})}))},e.prototype._normalizeLocalPath=function(e){return Cc(this,void 0,void 0,(function(){var t,r,n;return Sc(this,(function(o){switch(o.label){case 0:return/^https?:\/\/tmp\//i.test(e)?(t=this._pathCache.get(e))?[2,t]:[4,this._loadImageInfo(e)]:[2,e];case 1:return r=o.sent(),n=r.path||e,/^https?:\/\/tmp\//i.test(n)?[4,this._materializeTempPath(n)]:[3,3];case 2:n=o.sent(),o.label=3;case 3:return this._pathCache.set(e,n),j.debug("Miniapp image path normalization result",e,n),[2,n]}}))}))},e.prototype._materializeTempPath=function(e){var t,r,n;return Cc(this,void 0,void 0,(function(){var o,i,a,s,c,u;return Sc(this,(function(l){switch(l.label){case 0:if(!(null==(o=null===(r=(t=this.runtime).getFileSystemManager)||void 0===r?void 0:r.call(t))?void 0:o.saveFile)||!(null===(n=this.runtime.env)||void 0===n?void 0:n.USER_DATA_PATH))return[2,e];i=e.match(/(\.[a-zA-Z0-9]+)(?:\?.*)?$/),a=i?i[1]:"",s="".concat(this.runtime.env.USER_DATA_PATH,"/em-image-").concat(Date.now(),"-").concat(Math.random().toString(36).slice(2)).concat(a),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,new Promise((function(t,r){var n;null===(n=o.saveFile)||void 0===n||n.call(o,{tempFilePath:e,filePath:s,success:function(e){return t(e.savedFilePath||s)},fail:r})}))];case 2:return c=l.sent(),j.debug("Miniapp temp image materialized to user data path",e,c),[2,c];case 3:return u=l.sent(),j.warn("Miniapp saveFile failed while materializing temp image path",u),[2,e];case 4:return[2]}}))}))},e}(),bc=function(){return bc=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},bc.apply(this,arguments)},Ac=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Mc=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},wc=_e.getEnvInfo(),Uc=function(){function r(n){var u,l,d=this;this.name="connection",this.appKey="",this.dnsTotal=0,this.max_cache_length=100,this._compressorFailureCount=0,this._reportLogs=!1,this._reportInterval=V,this._isLogging=!1,this._initWithAppId=!1,this.uikitVersion="",this.lastHeartbeat=Date.now(),this.isDebug=n.isDebug||!1,this.isReport=!1,this.uploadPartEnable=!0,this.enableMd5Check=null!==(u=n.enableMd5Check)&&void 0!==u&&u,this.isHttpDNS=void 0===n.isHttpDNS||n.isHttpDNS,this.heartBeatWait=n.heartBeatWait||3e4,this.autoReconnectNumMax=n.autoReconnectNumMax||5,this.refreshDNSIntervals=this.autoReconnectNumMax<5?this.autoReconnectNumMax:5,this.delivery=n.delivery||!1,this.disconnectedReason=void 0,this.loginInfoCustomExt=void 0,this.https=_e.isUseHttps(n.https),this.dnsArr=["https://rs.easemob.com","https://rs.chat.rtnsvc.com","https://rs.chat.realtimemesh.com"].filter((function(e){return e.startsWith(d.https?"https":"")})),this.dnsIndex=0,this.restHosts=[],this.restTotal=0,this.restIndex=0,this.hostIndex=0,this.socketHost=[],this.hostTotal=0,this.times=1,this.autoReconnectNumTotal=0,this.domain="easemob.com",this.dnsTotal=this.dnsArr.length,"appKey"in n&&(this.appKey=n.appKey),"appId"in n&&(this.appId=n.appId,this._initWithAppId=!0),this.appName="",this.orgName="",this.token="",this.grantType="",this.apiUrl=n.apiUrl||"",this.url=n.url||"",this.version="4.24.2",this.deviceId=n.deviceId||"webim",this.isFixedDeviceId=null===(l=n.isFixedDeviceId)||void 0===l||l,this.osType=16,this.useOwnUploadFun=n.useOwnUploadFun||!1;var h=_e.getEnvInfo(),p=h.global;if(this._imageProcessor=h.platform===le.WEB?Rc:(null==p?void 0:p.getImageInfo)?function(e){return new Nc(e)}(p):null,this.isAutoLogin=n.isAutoLogin||!1,this.compressType=[0],this.encryptType=[0],this.clientResource="",this.expiresIn=0,this.expirationTime=0,this.useReplacedMessageContents=n.useReplacedMessageContents||!1,this.logOut=!0,this.context={jid:{appKey:"",clientResource:"",domain:"easemob.com",name:""},userId:"",appKey:"",appId:"",status:0,restTokenData:"",appName:"",orgName:"",root:{},accessToken:""},this._msgHash={},this._msgPromiseHash={},this._queues=[],this._load_msg_cache=[],this.unMSyncSendMsgMap=new Map,this.mr_cache={},this.reconnecting=!1,this._offlineMessagePullState=Ee.SYNC_INIT,this._offlineMessagePullQueue=[],this.uniPushConfig={},this.uniPush=null,this.isRegisterPush=!1,this.pushCertificateName="",this._compressor=null,void 0!==n.customOSPlatform){if("number"!=typeof n.customOSPlatform||n.customOSPlatform<1||n.customOSPlatform>100)throw Error("Invalid customOSPlatform: ".concat(n.customOSPlatform));this.customOSPlatform=n.customOSPlatform,this.deviceId=n.customDeviceName||this.deviceId}if(this._initWithAppId){if(this.appKey="","string"!=typeof this.appId||!this.appId)throw Error("Invalid appId: ".concat(this.appId))}else{if("string"!=typeof this.appKey||2!==this.appKey.split("#").length)throw Error("Invalid appKey: ".concat(this.appKey));this.devInfos=this.appKey.split("#"),this.orgName=this.devInfos[0],this.appName=this.devInfos[1]}this.listen=sn.bind(this),this.mSync=this.usePlugin(rn),this.eventHandler=this.usePlugin(on),Object.assign(r.prototype,e),Object.assign(r.prototype,t),Object.assign(r.prototype,o),Object.assign(r.prototype,i),Object.assign(r.prototype,a),Object.assign(r.prototype,s),Object.assign(r.prototype,c),this.dataReport=new In({appkey:this.appKey||"default#appkey",org:this.orgName,sdkVersion:this.version,deviceId:this.deviceId,isReport:this.isReport,uikitVersion:n.uikitVersion||""});var f=0,m=this;if(Object.defineProperty(_e,"ajaxUnconventionalErrorTimes",{set:function(e){0!==e&&(j.debug("rest api request fail times: ".concat(e)),(f=e)%5==0&&m.isHttpDNS&&(j.debug("refresh dns config when rest request fail."),zc.call(m,(function(){})).catch((function(e){j.error("refresh dns config error",e)}))))},get:function(){return f}}),this.isFixedDeviceId){var g=_e.getLocalDeviceInfo();g&&(this.clientResource=JSON.parse(g).deviceId)}j.debug("init SDK: Conn ".concat(this.version," ").concat(wc.platform))}return r.prototype.usePlugin=function(e,t){if("push"!==t)return t?void(this[t]=new e(this)):new e(this);e.config&&e.emPush?(this.uniPushConfig=e.config,this.uniPush=e.emPush):j.error("use push plugin failed","emPush",this.uniPush,"config",this.uniPushConfig)},r.prototype.listen=function(e){},r.prototype.addEventHandler=function(e,t){},r.prototype.removeEventHandler=function(e){},r.prototype.registerUser=function(e){return Ac(this,void 0,void 0,(function(){var t,r;return Mc(this,(function(n){switch(n.label){case 0:if(!e.username||!e.password)throw Error("Invalid parameter");n.label=1;case 1:return n.trys.push([1,5,,6]),t=this.dataReport.geOperateFun({uid:e.username,operationName:v.REGISTER}),this.isHttpDNS?(this.dnsIndex=0,[4,zc.call(this,t)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[4,Pc.call(this,e,{rpt:t})];case 4:return[2,n.sent()];case 5:throw r=n.sent(),e.error&&e.error(r),r;case 6:return[2]}}))}))},r.prototype.open=function(e){var t;return Ac(this,void 0,void 0,(function(){var r,n,o,i,a,s;return Mc(this,(function(c){switch(c.label){case 0:if(j.debug("open",e.user,"isLogout:",this.logOut),this._isLogging)throw n=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"Currently logging in, please wait."});if(!this.logOut)throw n=m.create({type:d.WEBIM_USER_ALREADY_LOGIN,message:"The user has logged in."});this.retryConnectTimes=0,this._isLogging=!0,c.label=1;case 1:if(c.trys.push([1,6,7,8]),"web"===wc.platform&&(r=_e.detectBrowser(),j.info("browser",r)),n=Hc.call(this,e))throw null===(t=this.onError)||void 0===t||t.call(this,n),n;return e.accessToken&&(this.token=e.accessToken),o=bc({},e),i=this.dataReport.geOperateFun({uid:e.user,operationName:v.LOGIN}),this.dnsIndex=0,this.isHttpDNS?[4,zc.call(this,i)]:[3,3];case 2:c.sent(),c.label=3;case 3:return j.initReport({report:this._reportLogs,reportInterval:this._reportInterval,connection:this}),[4,kc.call(this,o,{rpt:i})];case 4:return a=c.sent(),[4,Gc.call(this,i)];case 5:return c.sent(),j.debug("grantType",this.grantType),_e.listenNetwork(xc.bind(this),Bc.bind(this)),_e.listenBrowserVisibility((function(){j.debug("visibility: true")}),(function(){j.debug("visibility: false")})),[2,a];case 6:throw s=c.sent(),this._isLogging=!1,e.error&&e.error(s),j.error("login failed",s),s;case 7:return j.reportLog(),[7];case 8:return[2]}}))}))},r.prototype.isOpened=function(){return this.sock&&1===this.sock.readyState||!1},r.prototype.close=function(e){var t,r,n,o;void 0===e&&(e="inner:logout"),j.debug("call close"),j._stopReportLogs(),this.logOut=!0,this.disconnectedReason=void 0,this.reconnecting=!1,this.context.status=d.STATUS_CLOSING,e&&(null==e?void 0:e.startsWith("inner"))&&this.sendLogout(e),this.sock&&this.sock.close(),null===(t=this.unMSyncSendMsgMap)||void 0===t||t.clear(),this.stopHeartBeat(),this.rejectMessage(),this.context.status=d.STATUS_CLOSED,this._load_msg_cache=[],this._queues=[],this._msgHash={},this.mr_cache={},this.token="",this.context.accessToken="",this.isRegisterPush=!1,this.clearTokenTimeout(),null===(n=null===(r=null==this?void 0:this._localCache)||void 0===r?void 0:r.getInstance())||void 0===n||n.close(),this.connectionTimer&&clearTimeout(this.connectionTimer),this.provisionTimer&&clearTimeout(this.provisionTimer),this.probingTimer&&clearTimeout(this.probingTimer),null===(o=this._compressor)||void 0===o||o.shrink(),this._compressor=null,this._compressorFailureCount=0,Le.clearAll()},r.prototype.downloadAndParseCombineMessage=function(e){var t=this,r=e.url,n=e.secret;return new Promise((function(e,o){var i,a,s=_e.getEnvInfo(),c="web"!==s.platform&&"node"!==s.platform&&"quick_app"!==s.platform&&(null===(a=null===(i=s.global)||void 0===i?void 0:i.canIUse)||void 0===a?void 0:a.call(i,"getFileSystemManager")),u=function(r){var n=function(e){o({type:d.PARSE_FILE_ERROR,message:"Read file failed",data:e})},i=function(r){return Ac(t,void 0,void 0,(function(){var t,n,i,a,s,u,l,h,p,f,m,g,v;return Mc(this,(function(E){switch(E.label){case 0:for(t=c?new Uint8Array(r.data):new Uint8Array(r.target.result),n=0,i=0,a=2,s=t.subarray(n,n+a),u=_e.Uint8ArrayToString(s),j.debug("file header:",u),i+=a,l=0,h=2;h<t.length-1;h++)h%2==1&&(l^=t[h]);if(p=t.subarray(t.length-1,t.length),j.debug("checkResult:",l,p[0]===l),p[0]!==l)return[2,o({type:d.PARSE_FILE_ERROR,message:"File verification failed"})];if("cm"!==u)return[3,7];E.label=1;case 1:E.trys.push([1,5,,6]),f=[],m=function(){var e,r,o,s;return Mc(this,(function(c){switch(c.label){case 0:return n+=a,i+=a=4,e=t.subarray(n,n+a),n+=a,a=e.reduce((function(t,r,n){return t+(r<<8*(e.length-n-1))}),0),i+=a,r=t.subarray(n,n+a),o=(o=g.root.lookup("easemob.pb.Meta")).decode(r),[4,ut.call(g,o,0,!0,!0)];case 1:return s=c.sent(),f.push(s),[2]}}))},g=this,E.label=2;case 2:return i<t.length-1?[5,m()]:[3,4];case 3:return E.sent(),[3,2];case 4:return[2,e(f)];case 5:return v=E.sent(),o({type:d.PARSE_FILE_ERROR,message:"Parse file failed",data:v}),[3,6];case 6:return[3,8];case 7:return[2,o({type:d.PARSE_FILE_ERROR,message:"File verification failed"})];case 8:return[2]}}))}))};if(c){var a=s.global.getFileSystemManager(),u=r.tempFilePath;a.readFile({filePath:u,success:i,fail:n})}else if(r instanceof Blob){var l=new FileReader;l.readAsArrayBuffer(r),l.onerror=n,l.onload=i}},l=function(e){o({type:d.WEBIM_DOWNLOADFILE_ERROR,message:"Download failed, please try again",data:e})};c?s.global.downloadFile({url:r,success:u,fail:l}):_e.download.call(t,{url:r,headers:{Accept:"application/json"},onFileDownloadComplete:u,onFileDownloadError:l,secret:n,accessToken:t.context.accessToken})}))},r.prototype.getChatFilesUrl=function(){return"".concat(this.apiUrl,"/").concat(this.orgName,"/").concat(this.appName,"/chatfiles")},r.prototype.stopHeartBeat=function(){clearInterval(this.heartBeatID)},r.prototype.clear=function(){this.restTotal=0,this.restIndex=0,this.hostIndex=0,this.hostTotal=0},r.prototype.heartBeat=function(){},r.prototype.renewToken=function(e){var t=this,r=this.isOpened();return j.debug("isOpened",r),r?this.getTokenExpireTimestamp(e).then((function(r){var n=r.expire_timestamp,o=Date.now();return t.expirationTime=n,t.expiresIn=n-o,t.token=e,t.context.accessToken=e,t.clearTokenTimeout(),t.tokenExpireTimeCountDown(t.expiresIn),{status:!0,token:e,expire:n}})):Promise.reject({status:!1})},r.prototype.clearTokenTimeout=function(){j.info("clearTokenTimeout"),this.tokenWillExpireTimer&&clearTimeout(this.tokenWillExpireTimer),this.tokenExpiredTimer&&clearTimeout(this.tokenExpiredTimer),this.tokenWillExpireTimer=null,this.tokenExpiredTimer=null},r.prototype.tokenExpireTimeCountDown=function(e){var t=this;j.info("tokenExpireTimeCountDown",e),e>Math.pow(2,31)-1&&(e=Math.pow(2,31)-1),this.tokenWillExpireTimer=setTimeout((function(){var r;t.onTokenWillExpire&&t.onTokenWillExpire(),null===(r=t.eventHandler)||void 0===r||r.dispatch("onTokenWillExpire"),j.info("onTokenWillExpire",Math.floor(e-e/5))}),e-e/5),this.tokenExpiredTimer=setTimeout((function(){var e;j.info("onTokenExpired",0),t.onTokenExpired&&t.onTokenExpired(),null===(e=t.eventHandler)||void 0===e||e.dispatch("onTokenExpired"),t.close("inner:token expired")}),e)},r.prototype.compareTokenExpireTime=function(e,t){var r,n=Number(t)-Number(e);j.debug("compareTokenExpireTime",n),n<=this.expiresIn/5&&n>0?(this.onTokenWillExpire&&this.onTokenWillExpire(),null===(r=this.eventHandler)||void 0===r||r.dispatch("onTokenWillExpire"),j.info("onTokenWillExpire",n)):n<=0&&(this.closeByTokenExpired(),j.info("closeByTokenExpired",n))},r.prototype.closeByTokenExpired=function(){var e;j.info("closed By TokenExpired"),this.onTokenExpired&&this.onTokenExpired(),null===(e=this.eventHandler)||void 0===e||e.dispatch("onTokenExpired"),this.close("inner:token expired")},r.prototype.rejectMessage=function(){var e=this,t=Object.keys(this._msgHash);if(t.length>0){var r=m.create({type:d.MESSAGE_WEBSOCKET_DISCONNECTED,message:"websocket disconnected"});t.forEach((function(t){var n,o,i;(null===(n=e.unMSyncSendMsgMap)||void 0===n?void 0:n.has(t))||(e._msgHash[t].reject instanceof Function&&e._msgHash[t].reject(r),null===(i=null===(o=e._localCache)||void 0===o?void 0:o.getInstance())||void 0===i||i.updateLocalMessage(t,{serverMsgId:t,status:De.FAIL}),e._msgHash[t].fail instanceof Function&&e._msgHash[t].fail(r),e._msgHash[t].messageTimer&&clearTimeout(e._msgHash[t].messageTimer),delete e._msgHash[t])}))}},r.prototype.resetConnState=function(){this.mSync.stopHeartBeat(),this.times=1,this.autoReconnectNumTotal=0,this.hostIndex=0},r.prototype.reconnect=function(e){var t,r=this;if(this.logout)return j.warn("The user has already logged out when reconnecting");if(j.debug("socket reconnect readyState",this.sock.readyState),(0!==this.sock.readyState||e)&&(1!==this.sock.readyState||e)){j.info("reconnect: time",this.times),j.info("reconnect sock.readyState: ",this.sock.readyState),!1===this.reconnecting&&(this.reconnecting=!0),null===(t=this.eventHandler)||void 0===t||t.dispatch("onReconnecting"),this.rejectMessage(),this.isHttpDNS&&(this.hostIndex<this.socketHost.length-1?this.hostIndex++:this.hostIndex=this.socketHost.length-1);var n=1e3*_e.getRetryDelay(this.times);j.info("reconnect delay: ",n),setTimeout((function(){(1!==r.sock.readyState||e)&&(j.info("login sock.readyState: ",r.sock.readyState),r.sock.close(),jc.call(r).catch((function(e){j.error("reconnect websocket failed",e)})),r.times++)}),n),this.autoReconnectNumTotal++}},r.prototype.send=function(e){return Promise.resolve(null)},r.prototype.setLoginInfoCustomExt=function(e){if(j.debug("setLoginInfoCustomExt","params:",e),e){if("string"!=typeof e)throw new Error("ext must be a string");if(e.length>1024)throw new Error("ext length must be less than 1024")}this.loginInfoCustomExt=e},r.prototype.onShow=function(){var e=this;j.debug("execute onshow callback",this.lastHeartbeat),!this.logOut&&!this.reconnecting&&Date.now()-this.lastHeartbeat>2e3&&(j.debug("send ping"),this.mSync.sendUnreadDeal(),this.probingTimer&&clearTimeout(this.probingTimer),this.probingTimer=setTimeout((function(){j.error("Websocket connection timeout"),e.logOut||e.reconnecting||e.reconnect(!0)}),8e3))},r.prototype.sendLogout=function(e){void 0===e&&(e="logout");try{var t=this.mSync.generateLogout(e),r=Jt.call(this,t),n=r[0];if(r[1]){var o=this._getSock?this.mSync.base64transform(n):n;this.sock&&1===this.sock.readyState&&this.sock.send(o)}}catch(e){j.error("sendLogout failed",e)}},r._getSock=function(){},r}();function Lc(e,t){var r=t.rpt,n=t.isRetry,o=this.apiUrl+"/"+this.orgName+"/"+this.appName+"/users",i={requestName:E.RESISTER,requestUrl:o},a={headers:{"Content-Type":"application/json"},url:o,dataType:"json",data:JSON.stringify({username:e.username,password:e.password,nickname:e.nickname||""})};return _e.ajax(a,v.SDK_INTERNAL).then((function(e){var t=bc(bc({},e),{type:d.REQUEST_SUCCESS}),o=e.extraInfo,a=o.httpCode,s=o.elapse;return r({isEndApi:!0,isRetry:n,data:bc(bc({},{requestElapse:s,isSuccess:1,code:a}),i)}),t})).catch((function(e){var t=e.extraInfo,o=t.elapse,a=t.httpCode,s=t.errDesc;throw r({isRetry:n,data:bc(bc({},{requestElapse:o,isSuccess:0,code:a,codeDesc:s}),i)}),e}))}function Pc(e,t){return Ac(this,void 0,void 0,(function(){var r,n;return Mc(this,(function(o){switch(o.label){case 0:r=t.rpt,o.label=1;case 1:return o.trys.push([1,3,,7]),[4,Lc.call(this,e,t)];case 2:return[2,o.sent()];case 3:return!((n=o.sent()).message.includes("Open registration doesn't allow")||n.message.includes("username be unique")||n.message.includes("is not legal"))&&this.isHttpDNS&&this.restIndex+1<this.restTotal?(this.restIndex++,Kc.call(this),[4,Pc.call(this,e,{rpt:r})]):[3,5];case 4:return[2,o.sent()];case 5:throw j.error("retry signup failed",n),r({data:{isLastApi:1,isSuccess:0}}),n;case 6:return[3,7];case 7:return[2]}}))}))}function Dc(e,t){var r;return Ac(this,void 0,void 0,(function(){var n,o,i,a,s,c,u,l,d,h=this;return Mc(this,(function(p){switch(p.label){case 0:if(n=Hc.call(this,e))throw n;return j.debug("socket readyState",null===(r=this.sock)||void 0===r?void 0:r.readyState),o=t.rpt,i=t.isRetry,Fc.call(this,e),this.user=e.user,a=this.context.appName,s=this.context.orgName,c=this.apiUrl+"/"+s+"/"+a+"/token",e.accessToken?(j.debug("login with accessToken"),this.grantType="accessToken",this.token=e.accessToken,this.context.accessToken=e.accessToken,this.context.restTokenData=e.accessToken,[2,{accessToken:e.accessToken}]):[3,1];case 1:return e.agoraToken?(j.info("login with agoraToken"),this.grantType="agoraToken",this.token=e.agoraToken,this.context.accessToken=e.agoraToken,this.context.restTokenData=e.agoraToken,[2,{accessToken:e.agoraToken}]):[3,2];case 2:return j.info("login with password"),this.grantType="password",u={grant_type:"password",username:e.user,password:e.pwd,timestamp:+new Date},l=JSON.stringify(u),d={headers:{"Content-Type":"application/json"},url:c,dataType:"json",data:l,version:this.version},j.debug("start get token"),[4,_e.ajax(d,v.SDK_INTERNAL).then((function(e){j.debug("get token success"),h.token=e.access_token,h.context.restTokenData=e.access_token,h.context.accessToken=e.access_token,h.expiresIn=e.expires_in;var t=e.extraInfo,r=t.httpCode,n=t.elapse,a={requestName:E.LOGIN_BY_PWD,requestElapse:n,requestUrl:c,isSuccess:1,code:r};return o({isRetry:i,data:a}),{accessToken:e.access_token,duration:e.expires_in}})).catch((function(e){j.error("get token failed",e);var t=e.extraInfo,r=t.elapse,n=t.httpCode,a=t.errDesc,s={requestName:E.LOGIN_BY_PWD,requestElapse:r,requestUrl:c,isSuccess:0,code:n,codeDesc:a};throw o({isRetry:i,data:s}),e}))];case 3:return[2,p.sent()]}}))}))}function kc(e,t){var r;return Ac(this,void 0,void 0,(function(){var n,o,i;return Mc(this,(function(a){switch(a.label){case 0:n=t.rpt,a.label=1;case 1:return a.trys.push([1,3,,7]),[4,Dc.call(this,e,t)];case 2:return[2,a.sent()];case 3:return"invalid password"!==(o=a.sent()).message&&"user not found"!==o.message&&this.isHttpDNS&&this.restIndex+1<this.restTotal?(this.restIndex++,Kc.call(this),[4,kc.call(this,e,{rpt:n,isRetry:!0})]):[3,5];case 4:return[2,a.sent()];case 5:throw j.error("retry login failed",o),n({data:{isLastApi:1,isSuccess:0}}),this.clear(),i=void 0,o.error&&o.error_description?(i=m.create({type:d.WEBIM_CONNCTION_OPEN_USERGRID_ERROR,message:o.error_description,data:o}),this.onError&&this.onError(i),i):(i=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:null!==(r=o.message)&&void 0!==r?r:"login failed",data:o}),this.onError&&this.onError(i),i);case 6:return[3,7];case 7:return[2]}}))}))}function xc(){var e;j.debug("online"),this.onOnline&&this.onOnline(),null===(e=this.eventHandler)||void 0===e||e.dispatch("onOnline"),this.sock&&1!==this.sock.readyState&&(j.debug("sock.readyState:",this.sock.readyState),this.logOut||this.reconnecting||this.reconnect())}function Bc(){var e,t;j.debug("offline"),null===(e=this.sock)||void 0===e||e.close(),this.onOffline&&this.onOffline(),null===(t=this.eventHandler)||void 0===t||t.dispatch("onOffline")}function Gc(e){var t,r,n;return Ac(this,void 0,void 0,(function(){var o,i,a,s;return Mc(this,(function(c){switch(c.label){case 0:o=(new Date).getTime(),c.label=1;case 1:return c.trys.push([1,3,,7]),[4,jc.call(this,e)];case 2:return i=c.sent(),e&&e({data:{isLastApi:1,isSuccess:1,accessChannel:null===(t=this.socketHost[this.hostIndex])||void 0===t?void 0:t.channel}}),[2,i];case 3:if(a=c.sent(),j.error("connect to msync failed times:",this.retryConnectTimes,a),J.includes(a.type))throw e&&e({data:{isLastApi:1,isSuccess:0,accessChannel:null===(r=this.socketHost[this.hostIndex])||void 0===r?void 0:r.channel,codeDesc:this.disconnectedReason&&JSON.stringify(this.disconnectedReason)||a.message}}),a;return this.retryConnectTimes++,this.retryConnectTimes<3?(this.isHttpDNS&&(this.hostIndex<this.socketHost.length-1?this.hostIndex++:this.hostIndex=this.socketHost.length-1,qc.call(this)),a.type===d.REQUEST_TIMEOUT&&"provision timeout"===a.message||(s=(new Date).getTime()-o,null==e||e({isRetry:1!==this.retryConnectTimes,data:{requestUrl:this.url,requestName:E.CONNECT_WEBSOCKET,isSuccess:0,code:_.closed,requestElapse:s,codeDesc:this.disconnectedReason&&JSON.stringify(this.disconnectedReason)||"websocket close"}})),[4,Gc.call(this,e)]):[3,5];case 4:return c.sent(),[3,6];case 5:throw j.error("connect failed three times",a),e&&e({data:{isLastApi:1,isSuccess:0,accessChannel:null===(n=this.socketHost[this.hostIndex])||void 0===n?void 0:n.channel,codeDesc:this.disconnectedReason&&JSON.stringify(this.disconnectedReason)||a.message}}),a;case 6:return[3,7];case 7:return[2]}}))}))}function jc(e){var t=this,r=(new Date).getTime(),n="pending";return new Promise((function(o,i){var a;t._getSock?void 0===(a=t._getSock()).readyState&&(t.needSetReadyState=!0):(a=new WebSocket(t.url)).binaryType="arraybuffer",t.sock=a,t.connectionTimer&&clearTimeout(t.connectionTimer),t.connectionTimer=setTimeout((function(){t.disconnectedReason={type:d.REQUEST_TIMEOUT,message:"connection timeout"},a.close(),null==i||i(t.disconnectedReason)}),1e4),j.debug("start connect ws",t.url),t.connectionResolve=o,t.connectionReject=i;var s=function(){if(t.connectionTimer&&clearTimeout(t.connectionTimer),j.debug("websocket onOpen"),e){var n=(new Date).getTime()-r;e({isRetry:0!==t.retryConnectTimes,data:{requestUrl:t.url,requestName:E.CONNECT_WEBSOCKET,isSuccess:1,code:_.success,requestElapse:n}})}var o;o=t._getSock?_e.flow([t.mSync.generateProvision,t.mSync.base64transform])():t.mSync.generateProvision();try{t.provisionTimer&&clearTimeout(t.provisionTimer),t.provisionTimer=setTimeout((function(){j.error("provision timeout"),t.disconnectedReason=m.create({type:d.REQUEST_TIMEOUT,message:"provision timeout"}),a.close(),null==i||i(t.disconnectedReason)}),1e4),a.send(o)}catch(e){j.error("send provision message error",e);var s=m.create({type:d.SDK_RUNTIME_ERROR,message:"send message error",data:e});t.onError&&t.onError(s)}},c=function(e){t.connectionTimer&&clearTimeout(t.connectionTimer),setTimeout((function(){var r,o,a,s,c,u,l;if(j.debug("websocket onClose, isLogging:",t._isLogging,e),t.needSetReadyState&&(t.sock=bc(bc({},t.sock),{close:t.sock.close,send:t.sock.send,readyState:3})),t._isLogging)return null==i||i({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"}),void(n="rejected");if("rejected"!==n)if(n="rejected",t.logOut)t.clear(),t.resetConnState(),null===(o=null===(r=null==t?void 0:t._localCache)||void 0===r?void 0:r.getInstance())||void 0===o||o.close(),t.onClosed&&t.onClosed(),null===(a=t.eventHandler)||void 0===a||a.dispatch("onDisconnected",t.disconnectedReason),null==i||i(t.disconnectedReason||{type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"});else if(t.autoReconnectNumTotal<t.autoReconnectNumMax){t.reconnect();var h={type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"};t.onError&&t.onError(h),t.autoReconnectNumTotal%t.refreshDNSIntervals===0&&t.isHttpDNS&&(j.debug("refresh dns config when websocket close"),zc.call(t,(function(){})).catch((function(e){j.error("refresh dns config failed",e)})))}else null===(s=t.unMSyncSendMsgMap)||void 0===s||s.clear(),t.rejectMessage(),h={type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"},t.disconnectedReason=m.create({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"reconnection failed"}),t.onError&&t.onError(h),null===(u=null===(c=null==t?void 0:t._localCache)||void 0===c?void 0:c.getInstance())||void 0===u||u.close(),t.onClosed&&t.onClosed(),null===(l=t.eventHandler)||void 0===l||l.dispatch("onDisconnected",t.disconnectedReason),t.resetConnState(),t.reconnecting=!1,null==i||i(h),j.debug("reconnect fail");else j.debug("reject is null")}),0)},u=function(e){var r=t.mSync,n=r.decodeMSync,o=r.distributeMSync;_e.flow([n,o])(e)};"web"===wc.platform?(a.onopen=s,a.onclose=c,a.onmessage=u):(a.onOpen(s),a.onMessage(u),a.onClose(c),"undefined"!=typeof window&&window.WebSocket||a.onError((function(e){var r,o,a,s;if(t.connectionTimer&&clearTimeout(t.connectionTimer),j.debug("websocket onerror, isLogging:",t._isLogging,e),3!==t.sock.readyState&&(t.sock=bc(bc({},t.sock),{close:t.sock.close,send:t.sock.send,readyState:3})),t.onError&&t.onError({type:d.WEBIM_CONNECTION_ERROR,message:"on socket error",data:e}),t._isLogging)return null==i||i({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"}),void(n="rejected");if("rejected"!==n){if(n="rejected",!t.logOut)if(t.autoReconnectNumTotal<t.autoReconnectNumMax)j.debug("sock.onError reconnect",t.autoReconnectNumTotal,t.autoReconnectNumMax),t.reconnect(),t.autoReconnectNumTotal%t.refreshDNSIntervals===0&&t.isHttpDNS&&(j.debug("refresh dns config when websocket error"),zc.call(t,(function(){})).catch((function(e){j.error("refresh dns config failed",e)})));else{var c={type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"};t.disconnectedReason=m.create({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"reconnection failed"}),null===(r=t.unMSyncSendMsgMap)||void 0===r||r.clear(),t.rejectMessage(),t.onError&&t.onError(c),null===(a=null===(o=null==t?void 0:t._localCache)||void 0===o?void 0:o.getInstance())||void 0===a||a.close(),t.onClosed&&t.onClosed(),null===(s=t.eventHandler)||void 0===s||s.dispatch("onDisconnected",t.disconnectedReason),t.resetConnState(),t.reconnecting=!1,null==i||i(c),j.info("reconnect fail")}}else j.debug("reject is null")})))}))}function Hc(e){if("object"!=typeof e||null===e)return m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the param is illegal"});if(!e.user||"string"!=typeof e.user){var t=m.create({type:d.WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR,message:"the user is empty or type is not string"});return j.debug("open params error",t),t}return!("agoraToken"in e)||e.agoraToken&&"string"==typeof e.agoraToken?!("accessToken"in e)||e.accessToken&&"string"==typeof e.accessToken?"accessToken"in e||"agoraToken"in e||e.pwd?void 0:(t=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the accessToken or pwd is illegal"}),j.debug("open params error",t),t):(t=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the accessToken is illegal"}),j.debug("open params error",t),t):(t=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the agoraToken is illegal"}),j.debug("open params error",t),console.warn("agoraToken is deprecated, please use accessToken instead"),t)}function Fc(e){this.context.jid={appKey:this.appKey,name:e.user,domain:this.domain,clientResource:this.clientResource},this.context.root=this.root,this.context.userId=e.user,this.context.appKey=this.appKey,this.context.appName=this.appName,this.context.orgName=this.orgName}function Wc(e){var t=this,r=e.rpt,n=e.isRetry,o=this.dnsIndex<this.dnsTotal?this.dnsIndex:0,i="".concat(this.dnsArr[o],"/easemob/server.json");j.debug("call getHttpDNS: "+this.dnsIndex);var a={url:i,dataType:"json",type:"GET",data:{}};return this._initWithAppId?a.data={app_id:this.appId,sdk_version:"4.10.0",file_version:"1"}:a.data={app_key:wc.platform===le.WEB?encodeURIComponent(this.appKey):this.appKey},_e.ajax(a,v.SDK_INTERNAL).then((function(e){if(!e)throw m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"get DNS failed"});j.debug("getHttpDNS success");var o=e.rest.hosts,a=t.https?"https":"http";if(t._initWithAppId){if(!e.app_key)throw(c=m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"get DNS failed"})).extraInfo=e.extraInfo,c;t.appKey=e.app_key,t.context.appKey=t.appKey,t.devInfos=t.appKey.split("#"),t.orgName=t.devInfos[0],t.appName=t.devInfos[1],t.dataReport.updateAppKey(t.appKey)}if(!o)throw(c=m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"DNS hosts resolution failed",data:e.rest})).extraInfo=e.extraInfo,c;var s=o.filter((function(e){if(e.protocol===a)return e}));t.restHosts=s,t.restTotal=s.length;var c,u=e["msync-wx"].hosts;if(!u)throw(c=m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"DNS msync-wx resolution failed",data:e["msync-wx"]})).extraInfo=e.extraInfo,c;var l=u.filter((function(e){if(e.protocol===a)return e}));if(t.socketHost=l,t.hostTotal=l.length,t.isHttpDNS&&Kc.call(t),t.isHttpDNS&&qc.call(t),t._reportLogs="true"===e.enableReportLogs,t._reportInterval=Number(e.reportInterval||V),"true"===(null==e?void 0:e.enableDataReport)?(t.dataReport.setIsCollectDt(!0),t.dataReport.setIsReportDt(!0)):(t.dataReport.setIsReportDt(!1),t.dataReport.setIsCollectDt(!1)),"false"===(null==e?void 0:e.uploadinparts_enable)&&(t.uploadPartEnable=!1),void 0!==(null==e?void 0:e.enableMd5Check)&&(t.enableMd5Check="true"===e.enableMd5Check),e.extraInfo){var h=e.extraInfo,p=h.elapse,f=h.httpCode,g={requestUrl:i,requestName:E.GET_DNS,requestElapse:p,isSuccess:1,code:f};r&&r({isRetry:n,data:g})}})).catch((function(e){var t=e.extraInfo||{},o=t.elapse,a=t.httpCode,s=t.errDesc,c={requestUrl:i,requestName:E.GET_DNS,isSuccess:0,code:a,codeDesc:s,requestElapse:o};throw r&&r({isRetry:n,data:c}),m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:e.message,data:e})}))}function zc(e,t){return Ac(this,void 0,void 0,(function(){var r;return Mc(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,6]),[4,Wc.call(this,{rpt:e,isRetry:t})];case 1:case 3:return[2,n.sent()];case 2:return r=n.sent(),j.error("get DNS failed",r,"times:",this.dnsIndex),this.dnsIndex++,this.dnsIndex<this.dnsTotal?[4,zc.call(this,e,!0)]:[3,4];case 4:throw j.error("retryRequestDNS failed"),m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"get DNS failed",data:r});case 5:return[3,6];case 6:return[2]}}))}))}function qc(){var e=this.socketHost[this.hostIndex],t=e.domain,r=e.ip,n=e.port,o="";o=t||r,n&&"80"!==n&&"443"!==n&&(o+=":"+n),o&&(this.url="//"+o+"/websocket");var i=this.https?"wss:":"ws:";this.url=i+this.url}function Kc(){var e,t;if(this.restIndex>this.restTotal)return j.debug("restIndex > restTotal"),"";var r="",n=this.restHosts[this.restIndex],o=n.domain,i=n.ip,a=n.port,s=this.https?"https:":"http:";return i&&"undefined"!=typeof window&&"http:"===(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.protocol)?r=s+"//"+i+":"+a:(r=s+"//"+o,a&&"80"!==a&&"443"!==a&&(r+=":".concat(a)),"undefined"==typeof window||window.location||(r="https://"+o),"undefined"!=typeof window&&window.location&&"file:"===(null===(t=window.location)||void 0===t?void 0:t.protocol)&&(r="https://"+o)),"undefined"==typeof window&&(r=s+"//"+o),this.apiUrl=r,r}var Vc=_e.getEnvInfo(),Jc=Vc.global;h.util.Long=f(),h.configure();var Yc=h.Root.fromJSON({nested:{easemob:{nested:{pb:{nested:{MessageBody:{fields:{type:{type:"Type",id:1},from:{type:"JID",id:2},to:{type:"JID",id:3},contents:{rule:"repeated",type:"Content",id:4},ext:{rule:"repeated",type:"KeyValue",id:5},ackMessageId:{type:"uint64",id:6},msgConfig:{type:"MessageConfig",id:7},ackContent:{type:"string",id:8},meta:{type:"string",id:9},editMessageId:{type:"uint64",id:11},editScope:{type:"EditScope",id:12},stream:{type:"Stream",id:13}},nested:{Content:{fields:{type:{type:"Type",id:1},text:{type:"string",id:2},latitude:{type:"double",id:3},longitude:{type:"double",id:4},address:{type:"string",id:5},displayName:{type:"string",id:6},remotePath:{type:"string",id:7},secretKey:{type:"string",id:8},fileLength:{type:"int32",id:9},action:{type:"string",id:10},params:{rule:"repeated",type:"KeyValue",id:11},duration:{type:"int32",id:12},size:{type:"Size",id:13},thumbnailRemotePath:{type:"string",id:14},thumbnailSecretKey:{type:"string",id:15},thumbnailDisplayName:{type:"string",id:16},thumbnailFileLength:{type:"int32",id:17},thumbnailSize:{type:"Size",id:18},customEvent:{type:"string",id:19},customExts:{rule:"repeated",type:"KeyValue",id:20},buildingName:{type:"string",id:21},subType:{type:"SubType",id:22},title:{type:"string",id:23},summary:{type:"string",id:24},combineLevel:{type:"int32",id:25},imageType:{type:"int32",id:26}},nested:{Type:{values:{TEXT:0,IMAGE:1,VIDEO:2,LOCATION:3,VOICE:4,FILE:5,COMMAND:6,CUSTOM:7,COMBINE:8}},Size:{fields:{width:{type:"double",id:1},height:{type:"double",id:2}}},SubType:{values:{COMBINE:0,GIF:1,SUB_STREAM:10}}}},Type:{values:{NORMAL:0,CHAT:1,GROUPCHAT:2,CHATROOM:3,READ_ACK:4,DELIVER_ACK:5,RECALL:6,CHANNEL_ACK:7,EDIT:8}},EditScope:{values:{BODY:1,BODY_AND_EXT:2}},MessageConfig:{fields:{allowGroupAck:{type:"bool",id:1}}},Stream:{fields:{streamType:{type:"string",id:1},streamSeq:{type:"uint64",id:2},streamStatus:{type:"StreamStatus",id:3},streamError:{type:"uint32",id:4},streamFinishReason:{type:"int32",id:5}},nested:{StreamStatus:{values:{STREAM_START:0,STREAM_IN_PROGRESS:1,STREAM_COMPLETED:2,STREAM_FULL:3}}}}}},KeyValue:{oneofs:{value:{oneof:["varintValue","floatValue","doubleValue","stringValue"]}},fields:{key:{type:"string",id:1},type:{type:"ValueType",id:2},varintValue:{type:"int64",id:3},floatValue:{type:"float",id:4},doubleValue:{type:"double",id:5},stringValue:{type:"string",id:6}},nested:{ValueType:{values:{BOOL:1,INT:2,UINT:3,LLINT:4,FLOAT:5,DOUBLE:6,STRING:7,JSON_STRING:8}}}},JID:{fields:{appKey:{type:"string",id:1},name:{type:"string",id:2},domain:{type:"string",id:3},clientResource:{type:"string",id:4}}},ConferenceBody:{fields:{sessionId:{type:"string",id:1},operation:{type:"Operation",id:2},conferenceId:{type:"string",id:3},type:{type:"Type",id:4},content:{type:"string",id:5},network:{type:"string",id:6},version:{type:"string",id:7},identity:{type:"Identity",id:8},duration:{type:"string",id:9},peerName:{type:"string",id:10},endReason:{type:"EndReason",id:11},status:{type:"Status",id:12},isDirect:{type:"bool",id:13},controlType:{type:"StreamControlType",id:14},routeFlag:{type:"int32",id:15},routeKey:{type:"string",id:16}},nested:{Status:{fields:{errorCode:{type:"int32",id:1}}},Operation:{values:{JOIN:0,INITIATE:1,ACCEPT_INITIATE:2,ANSWER:3,TERMINATE:4,REMOVE:5,STREAM_CONTROL:6,MEDIA_REQUEST:7}},Type:{values:{VOICE:0,VIDEO:1}},Identity:{values:{CALLER:0,CALLEE:1}},EndReason:{values:{HANGUP:0,NORESPONSE:1,REJECT:2,BUSY:3,FAIL:4,UNSUPPORTED:5,OFFLINE:6}},StreamControlType:{values:{PAUSE_VOICE:0,RESUME_VOICE:1,PAUSE_VIDEO:2,RESUME_VIDEO:3}}}},MSync:{fields:{version:{type:"Version",id:1,options:{default:"MSYNC_V1"}},guid:{type:"JID",id:2},auth:{type:"string",id:3},compressAlgorimth:{type:"uint32",id:4},crypto:{type:"uint32",id:5},userAgent:{type:"string",id:6},pov:{type:"uint64",id:7},command:{type:"Command",id:8},deviceId:{type:"uint32",id:10},encryptType:{rule:"repeated",type:"EncryptType",id:11,options:{packed:!1}},encryptKey:{type:"string",id:12},payload:{type:"bytes",id:9},traceId:{type:"uint64",id:20}},nested:{Version:{values:{MSYNC_V1:0,MSYNC_V2:1}},Command:{values:{SYNC:0,UNREAD:1,NOTICE:2,PROVISION:3,LOGOUT:4}}}},EncryptType:{values:{ENCRYPT_NONE:0,ENCRYPT_AES_128_CBC:1,ENCRYPT_AES_256_CBC:2}},CommSyncUL:{fields:{meta:{type:"Meta",id:1},key:{type:"uint64",id:2},queue:{type:"JID",id:3},isRoam:{type:"bool",id:4},lastFullRoamKey:{type:"uint64",id:5}}},CommSyncDL:{fields:{status:{type:"Status",id:1},metaId:{type:"uint64",id:2},serverId:{type:"uint64",id:3},metas:{rule:"repeated",type:"Meta",id:4},nextKey:{type:"uint64",id:5},queue:{type:"JID",id:6},isLast:{type:"bool",id:7},timestamp:{type:"uint64",id:8},isRoam:{type:"bool",id:9}}},CommNotice:{fields:{queue:{type:"JID",id:1}}},CommUnreadUL:{fields:{}},CommUnreadDL:{fields:{status:{type:"Status",id:1},unread:{rule:"repeated",type:"MetaQueue",id:2},timestamp:{type:"uint64",id:3}}},MetaQueue:{fields:{queue:{type:"JID",id:1},n:{type:"uint32",id:2}}},Meta:{fields:{id:{type:"uint64",id:1},from:{type:"JID",id:2},to:{type:"JID",id:3},timestamp:{type:"uint64",id:4},ns:{type:"NameSpace",id:5},payload:{type:"bytes",id:6},routetype:{type:"RouteType",id:7},ext:{rule:"repeated",type:"KeyValue",id:8},meta:{type:"bytes",id:9},directedUsers:{rule:"repeated",type:"string",id:10},env:{type:"string",id:13}},nested:{NameSpace:{values:{STATISTIC:0,CHAT:1,MUC:2,ROSTER:3,CONFERENCE:4,NOTIFY:5,QUERY:6}},RouteType:{values:{ROUTE_ALL:0,ROUTE_ONLINE:1,ROUTE_DIRECT:2}}}},Status:{fields:{errorCode:{type:"ErrorCode",id:1},reason:{type:"string",id:2},redirectInfo:{rule:"repeated",type:"RedirectInfo",id:3}},nested:{ErrorCode:{values:{OK:0,FAIL:1,UNAUTHORIZED:2,MISSING_PARAMETER:3,WRONG_PARAMETER:4,REDIRECT:5,TOKEN_EXPIRED:6,PERMISSION_DENIED:7,NO_ROUTE:8,UNKNOWN_COMMAND:9,PB_PARSER_ERROR:10,BIND_ANOTHER_DEVICE:11,IM_FORBIDDEN:12,TOO_MANY_DEVICES:13,PLATFORM_LIMIT:14,USER_MUTED:15,ENCRYPT_DISABLE:16,ENCRYPT_ENABLE:17,DECRYPT_FAILURE:18,PERMISSION_DENIED_EXTERNAL:19}}}},RedirectInfo:{fields:{host:{type:"string",id:1},port:{type:"uint32",id:2}}},Provision:{fields:{osType:{type:"OsType",id:1},version:{type:"string",id:2},networkType:{type:"NetworkType",id:3},appSign:{type:"string",id:4},compressType:{rule:"repeated",type:"CompressType",id:5,options:{packed:!1}},encryptType:{rule:"repeated",type:"EncryptType",id:6,options:{packed:!1}},encryptKey:{type:"string",id:7},status:{type:"Status",id:8},deviceUuid:{type:"string",id:9},isManualLogin:{type:"bool",id:10},password:{type:"string",id:11},deviceName:{type:"string",id:12},resource:{type:"string",id:13},auth:{type:"string",id:14},serviceId:{type:"string",id:16},actionVersion:{type:"string",id:17},authToken:{type:"string",id:18},osCustomValue:{type:"uint32",id:19},sessionId:{type:"string",id:20},reason:{type:"string",id:21},protocolCompressType:{rule:"repeated",type:"CompressType",id:22},protocolCompressDirection:{type:"CompressDirection",id:23}},nested:{OsType:{values:{OS_IOS:0,OS_ANDROID:1,OS_LINUX:2,OS_OSX:3,OS_WIN:4,OS_CUSTOM:5,OS_OTHER:16}},NetworkType:{values:{NETWORK_NONE:0,NETWORK_WIFI:1,NETWORK_4G:2,NETWORK_3G:3,NETWORK_2G:4,NETWORK_WIRE:5}},CompressType:{values:{COMPRESS_NONE:0,COMPRESS_ZLIB:1,COMPRESS_LZ4:2}},CompressDirection:{values:{ONLY_UP:0,ONLY_DOWN:1,BI:2}}}},Logout:{fields:{sessionId:{type:"string",id:1},reason:{type:"string",id:2},status:{type:"Status",id:3}}},MUCBody:{fields:{mucId:{type:"JID",id:1},operation:{type:"Operation",id:2},from:{type:"JID",id:3},to:{rule:"repeated",type:"JID",id:4},setting:{type:"Setting",id:5},reason:{type:"string",id:6},isChatroom:{type:"bool",id:7},status:{type:"Status",id:8},isThread:{type:"bool",id:9},mucParentId:{type:"JID",id:10},mucName:{type:"string",id:11},eventInfo:{type:"EventInfo",id:12},mucMemberCount:{type:"int32",id:13},ext:{type:"string",id:14},leaveOtherRooms:{type:"bool",id:15},members:{rule:"repeated",type:"string",id:16}},nested:{Operation:{values:{CREATE:0,DESTROY:1,JOIN:2,LEAVE:3,APPLY:4,APPLY_ACCEPT:5,APPLY_DECLINE:6,INVITE:7,INVITE_ACCEPT:8,INVITE_DECLINE:9,KICK:10,GET_BLACKLIST:11,BAN:12,ALLOW:13,UPDATE:14,BLOCK:15,UNBLOCK:16,PRESENCE:17,ABSENCE:18,DIRECT_JOINED:19,ASSIGN_OWNER:20,ADD_ADMIN:21,REMOVE_ADMIN:22,ADD_MUTE:23,REMOVE_MUTE:24,UPDATE_ANNOUNCEMENT:25,DELETE_ANNOUNCEMENT:26,UPLOAD_FILE:27,DELETE_FILE:28,ADD_USER_WHITE_LIST:29,REMOVE_USER_WHITE_LIST:30,BAN_GROUP:31,REMOVE_BAN_GROUP:32,THREAD_CREATE:33,THREAD_DESTROY:34,THREAD_JOIN:35,THREAD_LEAVE:36,THREAD_KICK:37,THREAD_UPDATE:38,THREAD_PRESENCE:39,THREAD_ABSENCE:40,DISABLE_GROUP:41,ABLE_GROUP:42,SET_METADATA:43,DELETE_METADATA:44,GROUP_MEMBER_METADATA_UPDATE:45}},Setting:{fields:{name:{type:"string",id:1},desc:{type:"string",id:2},type:{type:"Type",id:3},maxUsers:{type:"int32",id:4},owner:{type:"string",id:5}},nested:{Type:{values:{PRIVATE_OWNER_INVITE:0,PRIVATE_MEMBER_INVITE:1,PUBLIC_JOIN_APPROVAL:2,PUBLIC_JOIN_OPEN:3,PUBLIC_ANONYMOUS:4}}}},Status:{fields:{errorCode:{type:"ErrorCode",id:1},description:{type:"string",id:2},chatroomInfo:{type:"string",id:3}},nested:{ErrorCode:{values:{OK:0,PERMISSION_DENIED:1,WRONG_PARAMETER:2,MUC_NOT_EXIST:3,USER_NOT_EXIST:4,UNKNOWN:5}}}},EventInfo:{fields:{eventType:{type:"EventType",id:1,options:{default:"EVENT_NONE"}},ext:{type:"string",id:2}},nested:{EventType:{values:{EVENT_NONE:0,CIRCLE_CHANNEL:1}}}}}},RosterBody:{fields:{operation:{type:"Operation",id:1},status:{type:"Status",id:2},from:{type:"JID",id:3},to:{rule:"repeated",type:"JID",id:4},reason:{type:"string",id:5},rosterVer:{type:"string",id:6},biDirection:{type:"bool",id:7}},nested:{Operation:{values:{GET_ROSTER:0,GET_BLACKLIST:1,ADD:2,REMOVE:3,ACCEPT:4,DECLINE:5,BAN:6,ALLOW:7,REMOTE_ACCEPT:8,REMOTE_DECLINE:9}},Status:{fields:{errorCode:{type:"ErrorCode",id:1},description:{type:"string",id:2}},nested:{ErrorCode:{values:{OK:0,USER_NOT_EXIST:1,USER_ALREADY_FRIEND:2,USER_ALREADY_BLACKLIST:3}}}}}},StatisticsBody:{fields:{operation:{type:"Operation",id:1},os:{type:"OsType",id:2},version:{type:"string",id:3},network:{type:"NetworkType",id:4},imTime:{type:"uint32",id:5},chatTime:{type:"uint32",id:6},location:{type:"string",id:7},reason:{type:"string",id:10}},nested:{Operation:{values:{INFORMATION:0,USER_REMOVED:1,USER_LOGIN_ANOTHER_DEVICE:2,USER_KICKED_BY_CHANGE_PASSWORD:3,USER_KICKED_BY_OTHER_DEVICE:4}},OsType:{values:{OS_IOS:0,OS_ANDROID:1,OS_LINUX:2,OS_OSX:3,OS_WIN:4,OS_CUSTOM:5,OS_OTHER:16}},NetworkType:{values:{NETWORK_NONE:0,NETWORK_WIFI:1,NETWORK_4G:2,NETWORK_3G:3,NETWORK_2G:4,NETWORK_WIRE:5}}}}}}}}}});Uc.prototype.root=Yc;var Xc=function(e){this.onOpen=Jc.onSocketOpen,this.onClose=Jc.onSocketClose,this.onMessage=Jc.onSocketMessage,this.onError=Jc.onSocketError,this.close=Jc.closeSocket,this.send=Jc.sendSocketMessage,this.connectSocket=Jc.connectSocket,this.readyState=void 0,this.offSocketOpen=Jc.offSocketOpen,this.offSocketMessage=Jc.offSocketMessage,this.offSocketError=Jc.offSocketError,this.offSocketClose=Jc.offSocketClose,this.connect=function(){this.offSocketOpen(),this.offSocketMessage(),this.offSocketClose(),this.offSocketError(),Jc.connectSocket({url:e.url,header:{"content-type":"application/json"},success:function(e){},fail:function(){}})}};Uc.prototype._getSock=function(){var e,t=this;return this.sock&&this.sock.close&&this.sock.close(),(e="zfb"===Vc.platform||"dd"===Vc.platform?new Xc(this):Jc.connectSocket({url:this.url,header:{"content-type":"application/json"},success:function(e){j.debug("socket connect success",e)},fail:function(e){j.debug("socket connect fail",e),t.reconnecting=!1,e.errMsg.indexOf("suspend")},complete:function(){}})).connect&&e.connect(),e},Uc.prototype.getUniqueId=_e.getUniqueId,Uc.prototype.deviceId="miniProgram_"+Vc.platform,Uc.prototype._localCache=void 0;var Qc=j.getLogger("defaultLogger");Qc.setConfig({useCache:!1,maxCache:3145728}),Qc.enableAll(),_e.ajax=_e.wxRequest;var Zc={connection:Uc,message:Ye,utils:_e,logger:Qc,statusCode:d}}(),n.default}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.websdk=t():e.websdk=t()}(this,(function(){return function(){var e={83:function(e,t,r){e.exports=a;var n,o,i=r(101);function a(e,t,r,n,a,s){if(i.call(this,e,t,n,void 0,void 0,a,s),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}((a.prototype=Object.create(i.prototype)).constructor=a).className="MapField",a.fromJSON=function(e,t){return new a(e,t.id,t.keyType,t.type,t.options,t.comment)},a.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},a.prototype.resolve=function(){if(this.resolved)return this;if(void 0===n.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},a.d=function(e,t,r){return"function"==typeof r?r=o.decorateType(r).name:r&&"object"==typeof r&&(r=o.decorateEnum(r).name),function(n,i){o.decorateType(n.constructor).add(new a(i,e,t,r))}},a._configure=function(){n=r(452),o=r(629)}},87:function(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},101:function(e,t,r){e.exports=u;var n,o,i,a,s=r(558);((u.prototype=Object.create(s.prototype)).constructor=u).className="Field";var c=/^required|optional|repeated$/;function u(e,t,r,n,a,u,l){if(i.isObject(n)?(l=a,u=n,n=a=void 0):i.isObject(a)&&(l=u,u=a,a=void 0),s.call(this,e,u),!i.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!i.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!c.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==a&&!i.isString(a))throw TypeError("extend must be a string");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=a||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!i.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=l}u.fromJSON=function(e,t){return new u(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(u.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),u.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),s.prototype.setOption.call(this,e,t,r)},u.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},u.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof a?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof n&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof n)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=i.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;i.utf8.write(this.typeDefault,e=i.newBuffer(i.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=i.emptyObject:this.repeated?this.defaultValue=i.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof a&&(this.parent.ctor.prototype[this.name]=this.defaultValue),s.prototype.resolve.call(this)},u.d=function(e,t,r,n){return"function"==typeof t?t=i.decorateType(t).name:t&&"object"==typeof t&&(t=i.decorateEnum(t).name),function(o,a){i.decorateType(o.constructor).add(new u(a,e,t,r,{default:n}))}},u._configure=function(){a=r(465),n=r(660),o=r(452),i=r(629)}},177:function(e,t,r){"use strict";e.exports=s;var n,o,i,a=r(694);function s(e,t){a.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}((s.prototype=Object.create(a.prototype)).constructor=s).className="Service",s.fromJSON=function(e,t){var r=new s(e,t.options);if(t.methods)for(var o=Object.keys(t.methods),i=0;i<o.length;++i)r.add(n.fromJSON(o[i],t.methods[o[i]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},s.prototype.toJSON=function(e){var t=a.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||void 0,"methods",a.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(s.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),s.prototype.get=function(e){return this.methods[e]||a.prototype.get.call(this,e)},s.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return a.prototype.resolve.call(this)},s.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof n?(this.methods[e.name]=e,e.parent=this,c(this)):a.prototype.add.call(this,e)},s.prototype.remove=function(e){if(e instanceof n){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,c(this)}return a.prototype.remove.call(this,e)},s.prototype.create=function(e,t,r){for(var n,a=new i.Service(e,t,r),s=0;s<this.methodsArray.length;++s){var c=o.lcFirst((n=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");a[c]=o.codegen(["r","c"],o.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return a},s._configure=function(){n=r(512),o=r(629),i=r(470)}},183:function(e,t,r){e.exports=o;var n=r(629);function o(e,t){this.lo=e>>>0,this.hi=t>>>0}var i=o.zero=new o(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var a=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(e){if(0===e)return i;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new o(r,n)},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if("string"==typeof e||e instanceof String){if(!n.Long)return o.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):i},o.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;o.fromHash=function(e){return e===a?i:new o((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},220:function(e,t,r){e.exports=a;var n,o,i=r(558);function a(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),i.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function s(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}((a.prototype=Object.create(i.prototype)).constructor=a).className="OneOf",a.fromJSON=function(e,t){return new a(e,t.oneof,t.options,t.comment)},a.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},a.prototype.add=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,s(this),this},a.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},a.prototype.onAdd=function(e){i.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}s(this)},a.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);i.prototype.onRemove.call(this,e)},a.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){o.decorateType(t.constructor).add(new a(r,e)),Object.defineProperty(t,r,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}},a._configure=function(){n=r(101),o=r(629)}},229:function(e,t,r){var n,o;function i(e){return function(t){var r=t.Writer,i=t.types,a=t.util;return function(t,s){s=s||r.create();for(var c=e.fieldsArray.slice().sort(a.compareFieldsById),u=0;u<c.length;u++){var l=c[u],d=e._fieldsArray.indexOf(l),h=l.resolvedType instanceof n?"uint32":l.type,p=o.basic[h],f=t[l.name];if(l.resolvedType instanceof n&&"string"==typeof f&&(f=i[d].values[f]),l.map){if(null!=f&&t.hasOwnProperty(l.name))for(var m=Object.keys(f),g=0;g<m.length;++g)s.uint32((l.id<<3|2)>>>0).fork().uint32(8|o.mapKey[l.keyType])[l.keyType](m[g]),void 0===p?i[d].encode(f[m[g]],s.uint32(18).fork()).ldelim().ldelim():s.uint32(16|p)[h](f[m[g]]).ldelim()}else if(l.repeated){if(f&&f.length)if(l.packed&&void 0!==o.packed[h]){s.uint32((l.id<<3|2)>>>0).fork();for(var v=0;v<f.length;v++)s[h](f[v]);s.ldelim()}else for(var E=0;E<f.length;E++)void 0===p?l.resolvedType.group?i[d].encode(f[E],s.uint32((l.id<<3|3)>>>0)).uint32((l.id<<3|4)>>>0):i[d].encode(f[E],s.uint32((l.id<<3|2)>>>0).fork()).ldelim():s.uint32((l.id<<3|p)>>>0)[h](f[E])}else(!l.optional||null!=f&&t.hasOwnProperty(l.name))&&(l.optional||null!=f&&t.hasOwnProperty(l.name)||console.warn("注意啦!!!很大概率会报错 类型:",t.$type?t.$type.name:"不晓得","没有设置对应的属性:",l.name,"检查是不是proto文件属性设置为了required"),void 0===p?l.resolvedType.group?i[d].encode(f,s.uint32((l.id<<3|3)>>>0)).uint32((l.id<<3|4)>>>0):i[d].encode(f,s.uint32((l.id<<3|2)>>>0).fork()).ldelim():s.uint32((l.id<<3|p)>>>0)[h](f))}return s}}}e.exports=i,i._configure=function(){n=r(660),o=r(452)}},278:function(e,t,r){"use strict";var n;function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}e.exports=o,o.create=function(e){return this.$type.create(e)},o.encode=function(e,t){return arguments.length?1==arguments.length?this.$type.encode(arguments[0]):this.$type.encode(arguments[0],arguments[1]):this.$type.encode(this)},o.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},o.decode=function(e){return this.$type.decode(e)},o.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},o.verify=function(e){return this.$type.verify(e)},o.fromObject=function(e){return this.$type.fromObject(e)},o.toObject=function(e,t){return e=e||this,this.$type.toObject(e,t)},o.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)},o.set=function(e,t){o[e]=t},o.get=function(e){return o[e]},o._configure=function(){n=r(629)}},322:function(e,t,r){e.exports=u;var n,o=r(629),i=r(442);function a(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function s(){}function c(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new a(s,0,0),this.tail=this.head,this.states=null}function l(e,t,r){t[r]=255&e}function d(e,t){this.len=e,this.next=void 0,this.val=t}function h(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function p(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}u.create=o.Buffer?function(){return(u.create=function(){return new(void 0)})()}:function(){return new u},u.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(u.alloc=o.pool(u.alloc,o.Array.prototype.subarray)),u.prototype._push=function(e,t,r){return this.tail=this.tail.next=new a(e,t,r),this.len+=t,this},d.prototype=Object.create(a.prototype),d.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(h,10,n.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=n.from(e);return this._push(h,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=n.from(e).zzEncode();return this._push(h,t.length(),t)},u.prototype.bool=function(e){return this._push(l,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(p,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=n.from(e);return this._push(p,4,t.lo)._push(p,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var f=o.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};u.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(l,1,0);if(o.isString(e)){var r=u.alloc(t=i.length(e));i.write(e,r,0),e=r}return this.uint32(t)._push(f,t,e)},u.prototype.string=function(e){var t=i.length(e);return t?this.uint32(t)._push(i.write,t,e):this._push(l,1,0)},u.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new a(s,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new a(s,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},u._configure=function(){n=r(183),r(986),i=r(442)}},442:function(e){"use strict";var t=e.exports;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,i=[],a=0;t<r;)(n=e[t++])<128?i[a++]=n:n>191&&n<224?i[a++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[a++]=55296+(n>>10),i[a++]=56320+(1023&n)):i[a++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),a=0);return o?(a&&o.push(String.fromCharCode.apply(String,i.slice(0,a))),o.join("")):String.fromCharCode.apply(String,i.slice(0,a))},t.write=function(e,t,r){for(var n,o,i=r,a=0;a<e.length;++a)(n=e.charCodeAt(a))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&o),++a,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-i}},452:function(e,t,r){"use strict";var n=e.exports,o=r(629),i=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function a(e,t){var r=0,n={};for(t|=0;r<e.length;)n[i[r+t]]=e[r++];return n}n.basic=a([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=a([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",o.emptyArray,null]),n.long=a([0,0,0,1,1],7),n.mapKey=a([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=a([1,5,0,0,0,5,5,0,0,0,1,1,0]),n._configure=function(){o=r(629)}},465:function(e,t,r){e.exports=E;var n,o,i,a,s,c,u,l,d,h,p,f,m,g,v=r(694);function E(e,t){v.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function y(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}((E.prototype=Object.create(v.prototype)).constructor=E).className="Type",Object.defineProperties(E.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=u.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=u.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=E.generateConstructor(this))},set:function(e){var t=e.prototype;t instanceof i||((e.prototype=new i).constructor=e,u.merge(e.prototype,t)),e.$type=e.prototype.$type=this,u.merge(e,i,!0),u.merge(e.prototype,i,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r){var o=this._oneofsArray[r].resolve().name,a=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=0;return{setter:function(r){if(!(e.indexOf(r)<0)){t[r]=1;for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}},getter:function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}}}(this._oneofsArray[r].oneof);n[o]={get:a.getter,set:a.setter}}r&&Object.defineProperties(e.prototype,n)}}}),E.generateConstructor=function(e){return function(t){for(var r,n=0;n<e.fieldsArray.length;n++)(r=e._fieldsArray[n]).map?this[r.name]={}:r.repeated&&(this[r.name]=[]);if(t)for(var o=Object.keys(t),i=0;i<o.length;++i)null!=t[o[i]]&&(this[o[i]]=t[o[i]])}},E.fromJSON=function(e,t){var r=new E(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var i=Object.keys(t.fields),s=0;s<i.length;++s)r.add((void 0!==t.fields[i[s]].keyType?g.fromJSON:o.fromJSON)(i[s],t.fields[i[s]]));if(t.oneofs)for(i=Object.keys(t.oneofs),s=0;s<i.length;++s)r.add(a.fromJSON(i[s],t.oneofs[i[s]]));if(t.nested)for(i=Object.keys(t.nested),s=0;s<i.length;++s){var c=t.nested[i[s]];r.add((void 0!==c.id?o.fromJSON:void 0!==c.fields?E.fromJSON:void 0!==c.values?n.fromJSON:void 0!==c.methods?p.fromJSON:v.fromJSON)(i[s],c))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},E.prototype.toJSON=function(e){var t=v.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return{options:t&&t.options||void 0,oneofs:v.arrayToJSON(this.oneofsArray,e),fields:v.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},extensions:this.extensions&&this.extensions.length?this.extensions:void 0,reserved:this.reserved&&this.reserved.length?this.reserved:void 0,group:this.group||void 0,nested:t&&t.nested||void 0,comment:r?this.comment:void 0}},E.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return v.prototype.resolveAll.call(this)},E.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},E.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById&&this._fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),y(this)}return e instanceof a?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),y(this)):v.prototype.add.call(this,e)},E.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),y(this)}if(e instanceof a){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),y(this)}return v.prototype.remove.call(this,e)},E.prototype.isReservedId=function(e){return v.isReservedId(this.reserved,e)},E.prototype.isReservedName=function(e){return v.isReservedName(this.reserved,e)},E.prototype.create=function(e){return new this.ctor(e)},E.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=d(this)({Writer:s,types:t,util:u}),this.decode=h(this)({Reader:c,types:t,util:u}),this.verify=l(this)({types:t,util:u}),this.fromObject=m.fromObject(this)({types:t,util:u}),this.toObject=m.toObject(this)({types:t,util:u});var n=f[e];if(n){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(o),o.toObject=this.toObject,this.toObject=n.toObject.bind(o)}return this},E.prototype.encode=function(e,t){return this.setup().encode(e,t)},E.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},E.prototype.decode=function(e,t){return this.setup().decode(e,t)},E.prototype.decodeDelimited=function(e){return e instanceof c||(e=c.create(e)),this.decode(e,e.uint32())},E.prototype.verify=function(e){return this.setup().verify(e)},E.prototype.fromObject=function(e){return this.setup().fromObject(e)},E.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},E.d=function(e){return function(t){u.decorateType(t,e)}},E._configure=function(){n=r(660),o=r(101),i=r(278),a=r(220),s=r(322),c=r(970),u=r(629),l=r(811),d=r(229),h=r(801),p=r(177),f=r(793),m=r(921),g=r(83)}},470:function(e,t,r){"use strict";e.exports=o;var n=r(629);function o(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(o.prototype=Object.create(n.EventEmitter.prototype)).constructor=o,o.prototype.rpcCall=function e(t,r,o,i,a){if(!i)throw TypeError("request must be specified");var s=this;if(!a)return n.asPromise(e,s,t,r,o,i);if(s.rpcImpl)try{return s.rpcImpl(t,r[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),(function(e,r){if(e)return s.emit("error",e,t),a(e);if(null!==r){if(!(r instanceof o))try{r=o[s.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return s.emit("error",e,t),a(e)}return s.emit("data",r,t),a(null,r)}s.end(!0)}))}catch(e){return s.emit("error",e,t),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},o.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},496:function(e){e.exports=d;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,o=/^ *[*/]+ */,i=/^\s*\*?\/*/,a=/\n/g,s=/\s/,c=/\\(.?)/g,u={0:"\0",r:"\r",n:"\n",t:"\t"};function l(e){return e.replace(c,(function(e,t){switch(t){case"\\":case"":return t;default:return u[t]||""}}))}function d(e,c){e=e.toString();var u=0,d=e.length,h=1,p=null,f=null,m=0,g=!1,v=[],E=null;function y(e){return Error("illegal "+e+" (line "+h+")")}function _(t){return e.charAt(t)}function T(t,r){p=e.charAt(t++),m=h,g=!1;var n,s=t-(c?2:3);do{if(--s<0||"\n"===(n=e.charAt(s))){g=!0;break}}while(" "===n||"\t"===n);for(var u=e.substring(t,r).split(a),l=0;l<u.length;++l)u[l]=u[l].replace(c?i:o,"").trim();f=u.join("\n").trim()}function I(t){var r=O(t),n=e.substring(t,r);return/^\s*\/{1,2}/.test(n)}function O(e){for(var t=e;t<d&&"\n"!==_(t);)t++;return t}function R(){if(v.length>0)return v.shift();if(E)return function(){var t="'"===E?n:r;t.lastIndex=u-1;var o=t.exec(e);if(!o)throw y("string");return u=t.lastIndex,C(E),E=null,l(o[1])}();var o,i,a,p,f;do{if(u===d)return null;for(o=!1;s.test(a=_(u));)if("\n"===a&&++h,++u===d)return null;if("/"===_(u)){if(++u===d)throw y("comment");if("/"===_(u))if(c){if(p=u,f=!1,I(u)){f=!0;do{if((u=O(u))===d)break;u++}while(I(u))}else u=Math.min(d,O(u)+1);f&&T(p,u),h++,o=!0}else{for(f="/"===_(p=u+1);"\n"!==_(++u);)if(u===d)return null;++u,f&&T(p,u-1),++h,o=!0}else{if("*"!==(a=_(u)))return"/";p=u+1,f=c||"*"===_(p);do{if("\n"===a&&++h,++u===d)throw y("comment");i=a,a=_(u)}while("*"!==i||"/"!==a);++u,f&&T(p,u-2),o=!0}}}while(o);var m=u;if(t.lastIndex=0,!t.test(_(m++)))for(;m<d&&!t.test(_(m));)++m;var g=e.substring(u,u=m);return'"'!==g&&"'"!==g||(E=g),g}function C(e){v.push(e)}function S(){if(!v.length){var e=R();if(null===e)return null;C(e)}return v[0]}return Object.defineProperty({next:R,peek:S,push:C,skip:function(e,t){var r=S();if(r===e)return R(),!0;if(!t)throw y("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t=null;return void 0===e?m===h-1&&(c||"*"===p||g)&&(t=f):(m<e&&S(),m!==e||g||!c&&"/"!==p||(t=f)),t}},"line",{get:function(){return h}})}d.unescape=l},512:function(e,t,r){"use strict";e.exports=i;var n,o=r(558);function i(e,t,r,i,a,s,c,u){if(n.isObject(a)?(c=a,a=s=void 0):n.isObject(s)&&(c=s,s=void 0),void 0!==t&&!n.isString(t))throw TypeError("type must be a string");if(!n.isString(r))throw TypeError("requestType must be a string");if(!n.isString(i))throw TypeError("responseType must be a string");o.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!a||void 0,this.responseType=i,this.responseStream=!!s||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=u}((i.prototype=Object.create(o.prototype)).constructor=i).className="Method",i.fromJSON=function(e,t){return new i(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment)},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return n.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0])},i.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),o.prototype.resolve.call(this))},i._configure=function(){n=r(629)}},558:function(e,t,r){"use strict";var n,o;function i(e,t){if(!n.isString(e))throw TypeError("name must be a string");if(t&&!n.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}e.exports=i,i.className="ReflectionObject",Object.defineProperties(i.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),i.prototype.toJSON=function(){throw Error()},i.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof o&&t._handleAdd(this)},i.prototype.onRemove=function(e){var t=e.root;t instanceof o&&t._handleRemove(this),this.parent=null,this.resolved=!1},i.prototype.resolve=function(){return this.resolved||this.root instanceof o&&(this.resolved=!0),this},i.prototype.getOption=function(e){if(this.options)return this.options[e]},i.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},i.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},i.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},i._configure=function(e){o=r(773),n=r(629)}},566:function(e,t){var r;r=function(e){e.version="1.2.2";var t=function(){for(var e=0,t=new Array(256),r=0;256!=r;++r)e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=r)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1,t[r]=e;return"undefined"!=typeof Int32Array?new Int32Array(t):t}(),r=function(e){var t=0,r=0,n=0,o="undefined"!=typeof Int32Array?new Int32Array(4096):new Array(4096);for(n=0;256!=n;++n)o[n]=e[n];for(n=0;256!=n;++n)for(r=e[n],t=256+n;t<4096;t+=256)r=o[t]=r>>>8^e[255&r];var i=[];for(n=1;16!=n;++n)i[n-1]="undefined"!=typeof Int32Array?o.subarray(256*n,256*n+256):o.slice(256*n,256*n+256);return i}(t),n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],c=r[5],u=r[6],l=r[7],d=r[8],h=r[9],p=r[10],f=r[11],m=r[12],g=r[13],v=r[14];e.table=t,e.bstr=function(e,r){for(var n=-1^r,o=0,i=e.length;o<i;)n=n>>>8^t[255&(n^e.charCodeAt(o++))];return~n},e.buf=function(e,r){for(var E=-1^r,y=e.length-15,_=0;_<y;)E=v[e[_++]^255&E]^g[e[_++]^E>>8&255]^m[e[_++]^E>>16&255]^f[e[_++]^E>>>24]^p[e[_++]]^h[e[_++]]^d[e[_++]]^l[e[_++]]^u[e[_++]]^c[e[_++]]^s[e[_++]]^a[e[_++]]^i[e[_++]]^o[e[_++]]^n[e[_++]]^t[e[_++]];for(y+=15;_<y;)E=E>>>8^t[255&(E^e[_++])];return~E},e.str=function(e,r){for(var n=-1^r,o=0,i=e.length,a=0,s=0;o<i;)(a=e.charCodeAt(o++))<128?n=n>>>8^t[255&(n^a)]:a<2048?n=(n=n>>>8^t[255&(n^(192|a>>6&31))])>>>8^t[255&(n^(128|63&a))]:a>=55296&&a<57344?(a=64+(1023&a),s=1023&e.charCodeAt(o++),n=(n=(n=(n=n>>>8^t[255&(n^(240|a>>8&7))])>>>8^t[255&(n^(128|a>>2&63))])>>>8^t[255&(n^(128|s>>6&15|(3&a)<<4))])>>>8^t[255&(n^(128|63&s))]):n=(n=(n=n>>>8^t[255&(n^(224|a>>12&15))])>>>8^t[255&(n^(128|a>>6&63))])>>>8^t[255&(n^(128|63&a))];return~n}},"undefined"==typeof DO_NOT_EXPORT_CRC?r(t):r({})},570:function(e){e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function n(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=n;var o={},i={};function a(e,t){var r,n,a;return t?(a=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=c(e,(0|e)<0?-1:0,!0),a&&(i[e]=r),r):(a=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=c(e,e<0?-1:0,!1),a&&(o[e]=r),r)}function s(e,t){if(isNaN(e))return t?v:g;if(t){if(e<0)return v;if(e>=p)return I}else{if(e<=-f)return O;if(e+1>=f)return T}return e<0?s(-e,t).neg():c(e%h|0,e/h|0,t)}function c(e,t,n){return new r(e,t,n)}r.fromInt=a,r.fromNumber=s,r.fromBits=c;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var o=s(u(r,8)),i=g,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),d=parseInt(e.substring(a,a+c),r);if(c<8){var h=s(u(r,c));i=i.mul(h).add(s(d))}else i=(i=i.mul(o)).add(s(d))}return i.unsigned=t,i}function d(e,t){return"number"==typeof e?s(e,t):"string"==typeof e?l(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=d;var h=4294967296,p=h*h,f=p/2,m=a(1<<24),g=a(0);r.ZERO=g;var v=a(0,!0);r.UZERO=v;var E=a(1);r.ONE=E;var y=a(1,!0);r.UONE=y;var _=a(-1);r.NEG_ONE=_;var T=c(-1,2147483647,!1);r.MAX_VALUE=T;var I=c(-1,-1,!0);r.MAX_UNSIGNED_VALUE=I;var O=c(0,-2147483648,!1);r.MIN_VALUE=O;var R=r.prototype;R.toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},R.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(O)){var t=s(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=s(u(e,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=(i.sub(c.mul(o)).toInt()>>>0).toString(e);if((i=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},R.isZero=function(){return 0===this.high&&0===this.low},R.eqz=R.isZero,R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return!(1&~this.low)},R.isEven=function(){return!(1&this.low)},R.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.ne=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.le=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.ge=R.greaterThanOrEqual,R.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(E)},R.neg=R.negate,R.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,a=e.high>>>16,s=65535&e.high,u=e.low>>>16,l=0,h=0,p=0,f=0;return p+=(f+=i+(65535&e.low))>>>16,h+=(p+=o+u)>>>16,l+=(h+=r+s)>>>16,l+=t+a,c((p&=65535)<<16|(f&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},R.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){if(this.isZero())return g;if(n(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(O))return e.isOdd()?O:g;if(e.eq(O))return this.isOdd()?O:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return s(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,a=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=65535&e.low,f=0,v=0,E=0,y=0;return E+=(y+=a*p)>>>16,v+=(E+=i*p)>>>16,E&=65535,v+=(E+=a*h)>>>16,f+=(v+=o*p)>>>16,v&=65535,f+=(v+=i*h)>>>16,v&=65535,f+=(v+=a*l)>>>16,f+=r*p+o*h+i*l+a*u,c((E&=65535)<<16|(y&=65535),(f&=65535)<<16|(v&=65535),this.unsigned)},R.mul=R.multiply,R.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var r,o,i;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return y;i=v}else{if(this.eq(O))return e.eq(E)||e.eq(_)?O:e.eq(O)?E:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?E:_:(o=this.sub(e.mul(r)),i=r.add(o.div(e)));if(e.eq(O))return this.unsigned?v:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=g}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),l=a<=48?1:u(2,a-48),h=s(r),p=h.mul(e);p.isNegative()||p.gt(o);)p=(h=s(r-=l,this.unsigned)).mul(e);h.isZero()&&(h=E),i=i.add(h),o=o.sub(p)}return i},R.div=R.divide,R.modulo=function(e){return n(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.rem=R.modulo,R.not=function(){return c(~this.low,~this.high,this.unsigned)},R.and=function(e){return n(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return n(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},R.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},R.shl=R.shiftLeft,R.shiftRight=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},R.shru=R.shiftRightUnsigned,R.shr_u=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,n){return n?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},627:function(e){e.exports=function(e,t,r){var n=r||8192,o=n>>>1,i=null,a=n;return function(r){if(r<1||r>o)return e(r);a+r>n&&(i=e(n),a=0);var s=t.call(i,a,a+=r);return 7&a&&(a=1+(7|a)),s}}},629:function(e,t,r){var n=e.exports,o=r(896);n.LongBits=r(183),n.Long=r(879),n.pool=r(627),n.float=r(899),n.asPromise=r(880),n.EventEmitter=r(87),n.path=r(814),n.base64=r(986),n.utf8=r(442),n.compareFieldsById=function(e,t){return e.id-t.id},n.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},n.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],o=e[r++];void 0!==o&&(t[n]=o)}return t},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},n.isObject=function(e){return e&&"object"==typeof e},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.merge=function(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)void 0!==e[n[o]]&&r||(e[n[o]]=t[n[o]]);return e},n.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(n.decorateRoot.remove(e.$type),e.$type.name=t,n.decorateRoot.add(e.$type)),e.$type;Type||(Type=r(465));var o=new Type(t||e.name);return n.decorateRoot.add(o),o.ctor=e,Object.defineProperty(e,"$type",{value:o,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:o,enumerable:!1}),o},n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.copy=function(e){if("object"!=typeof e)return e;var t={};for(var r in e)t[r]=e[r];return t},n.deepCopy=function e(t){if("object"!=typeof t)return t;var r={};for(var n in t)r[n]=e(t[n]);return r},n.ProtocolError=function(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&merge(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n.Buffer=null,n.newBuffer=function(e){return"number"==typeof e?new n.Array(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.stringToBytes=function(e){var t,r,n=[];t=e.length;for(var o=0;o<t;o++)(r=e.charCodeAt(o))>=65536&&r<=1114111?(n.push(r>>18&7|240),n.push(r>>12&63|128),n.push(r>>6&63|128),n.push(63&r|128)):r>=2048&&r<=65535?(n.push(r>>12&15|224),n.push(r>>6&63|128),n.push(63&r|128)):r>=128&&r<=2047?(n.push(r>>6&31|192),n.push(63&r|128)):n.push(255&r);return n},n.byteToString=function(e){if("string"==typeof e)return e;for(var t="",r=e,n=0;n<r.length;n++){var o=r[n].toString(2),i=o.match(/^1+?(?=0)/);if(i&&8==o.length){for(var a=i[0].length,s=r[n].toString(2).slice(7-a),c=1;c<a;c++)s+=r[c+n].toString(2).slice(2);t+=String.fromCharCode(parseInt(s,2)),n+=a-1}else t+=String.fromCharCode(r[n])}return t},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},Object.defineProperty(n,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(773)))}})},638:function(e){"use strict";var t=4096,r=65547,n=15,o=2113929216,i=65536,a=65536,s=10485760,c={MANUAL:0,AUTO_IMMEDIATE:1,AUTO_THRESHOLD:2},u={SUCCESS:0,FAILED:-1,NOT_INITIALIZED:-2,INITIALIZED_FAILED:-3,COMPRESS_FAILED:-4,DECOMPRESS_FAILED:-5,PARAM_ERROR:-6,BUFFER_RESIZE_FAILED:-7};function l(e){if(!(e>0))return a;if(e<=a)return a;if(e>1073741823)return e;for(var t=a;t<e;)t*=2;return t}var d={byU16:0,byU32:1};function h(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var p="fast";function f(e){return 2654435761*(e>>>0)>>>20&4095}function m(e){return 2654435761*(e>>>0)>>>19&8191}function g(e,t,r){if("fast"===p){var n=h(e,t);return r===d.byU16?m(n):f(n)}throw new Error("Unsupported hash strategy: "+p)}function v(e,t,r,n,o){r[t]=e-o}function E(e,t,r,n,o){v(t,g(e,t,n),r,0,o)}function y(e,t,r,n){return t[e]+n}function _(e,t,r,n,o){return y(g(e,t,n),r,0,o)}function T(e,t,r,n){for(var o=t;t<n-3;){if(h(e,t)!==h(e,r)){for(;t<n&&e[t]===e[r];)t++,r++;return t-o}t+=4,r+=4}for(;t<n&&e[t]===e[r];)t++,r++;return t-o}function I(e,t,i,a,s,c,u,l,h,p){var f,m,I,S,N,b,A=e.hashTable,M=a,w=M-e.dictSize,U=e.dictionary,L=e.dictionaryStart,P=L+e.dictSize,D=e.dictSize>0?P-a:0,k=a,x=a+s,B=x-12,G=x-5,j=0,H=c>0?c:i.length,F=0;if(s>o)return 0;switch(h){case 0:default:f=a,m=a;break;case 1:f=a-e.currentOffset,m=a-e.dictSize;break;case 2:f=a-e.currentOffset,m=a}if(l===d.byU16&&s>=r)return 0;if(s<13)return C(t,i,k,x,j,H,u);E(t,M,A,l,f),I=g(t,++M,l);e:for(;;){var W,z,q=M,K=1,V=64;do{var J=I;if(M=q,q+=K,K=V++>>>6,q>B)return C(t,i,k,x,j,H,u);W=y(J,A,0,f),2===h&&(W<a?(F=D,m=L):(F=0,m=a)),I=g(t,q,l),v(M,J,A,0,f)}while(1===p&&W<w||l!==d.byU16&&W+65535<M||!O(t,U,M,W,F,h,a));for(;M>k&&W+F>m;){var Y=W+F-1;if(t[M-1]!==(2===h&&W<a?U[Y-L+e.dictionaryStart]:t[Y]))break;M--,W--}var X=M-k;if(z=j++,u&&j+X+8+Math.floor(X/255)>H)return 0;if(X>=n){var Q=X-n;for(i[z]=240;Q>=255;)i[j++]=255,Q-=255;i[j++]=Q}else i[z]=X<<4;if(X>=16&&i.set&&t.subarray)i.set(t.subarray(k,k+X),j),j+=X;else for(var Z=0;Z<X;Z++)i[j++]=t[k+Z];t:for(;;){var $;if(b=M-W,(S=i)[N=j]=255&b,S[N+1]=b>>>8&255,j+=2,2===h&&W<a){var ee=M+(P-(W+F));if(ee>G&&(ee=G),(M+=4+($=R(t,U,M+4,W+F+4-L+e.dictionaryStart,ee,P-L)))===ee&&ee<G){var te=T(t,M,a,G);$+=te,M+=te}}else M+=4+($=T(t,M+4,W+4,G));if(u&&j+6+($>>>8)>H)return 0;if($>=15){for(i[z]+=15,$-=15;$>=510;)i[j++]=255,i[j++]=255,$-=510;$>=255&&($-=255,i[j++]=255),i[j++]=$}else i[z]+=$;if(k=M,M>B)break e;if(E(t,M-2,A,l,f),W=_(t,M,A,l,f),2===h&&(W<a?(F=D,m=L):(F=0,m=a)),E(t,M,A,l,f),!((1!==p||W>=w)&&W+65535>=M&&O(t,U,M,W,F,h,a)))break t;i[z=j++]=0}I=g(t,++M,l)}return C(t,i,k,x,j,H,u)}function O(e,t,r,n,o,i,a){return h(e,r)===h(2===i&&n+o<a?t:e,n+o)}function R(e,t,r,n,o,i,a){for(var s=r;n<i&&r<o&&t[n]===e[r];)n++,r++;return r-s}function C(e,t,r,o,i,a,s){var c=o-r;if(s&&i+c+1+Math.floor((c+255-n)/255)>a)return 0;if(c>=n){for(t[i++]=240,c-=n;c>=255;)t[i++]=255,c-=255;t[i++]=c}else t[i++]=c<<4;var u=r,l=o,d=l-u;if(d>=16&&t.set&&e.subarray)t.set(e.subarray(u,l),i),i+=d;else for(var h=u;h<l;h++)t[i++]=e[h];return i}function S(e,t,r,n){var o,i=0;if(n&&t.ip>=r)return-1;do{if(i+=o=e[t.ip++],t.ip>r)return-1;if(i>2147483647)return-1}while(255===o);return i}function N(e,t,r,o,i,a,s,c,u,l,d,h,p){if(null==e)return-1;if(a<0)return-1;var f,m,g=r,v=r+o,E=i,y=i+a,_=i+u,T=d-p,I=h+p,O=p<65536;if(c&&_>y-12&&(_=y-12),0===a)return c||1===o&&0===e[g]?0:-1;if(0===o)return-1;for(;;){var R,C,N,b;if(g>=v)return-(g-r)-1;if((C=(R=e[g++])>>>4)===n){var A=S(e,U={ip:g},v-n,!0);if(g=U.ip,-1===A)return-(g-r)-1;if(E+(C+=A)<E)return-(g-r)-1;if(g+C<g)return-(g-r)-1}if(N=E+C,s&&(N>(c?_:y-12)||g+C>v-8)||!s&&N>y-8){if(c)g+C>v&&(N=E+(C=v-g)),N>y&&(N=y,C=y-E);else{if(!s&&N!==y)return-(g-r)-1;if(s&&(g+C!==v||N>y))return-(g-r)-1}if(C>=16&&t.set&&e.subarray)t.set(e.subarray(g,g+C),E);else for(var M=0;M<C;M++)t[E+M]=e[g+M];if(g+=C,E+=C,!c||N===y||g>=v-2)break;if(!c)break}if(C>=16&&t.set&&e.subarray)t.set(e.subarray(g,g+C),E);else for(M=0;M<C;M++)t[E+M]=e[g+M];if(E=N,(g+=C)+2>v)return-(g-r)-1;var w=(f=e)[m=g]|f[m+1]<<8;if(g+=2,b=N-w,O&&b+p<d)return-(g-r)-1;if(0===w)return-(g-r)-1;if(15==(C=15&R)){var U;if(A=S(e,U={ip:g},v-5+1,!1),g=U.ip,-1===A)return-(g-r)-1;if(E+(C+=A)<E)return-(g-r)-1}if(C+=4,2===l&&b<d){if(E+C>y-5){if(!c)return-(g-r)-1;C=Math.min(C,y-E)}if(C<=d-b){var L=I-(d-b);for(M=0;M<C;M++)t[E+M]=t[L+M];E+=C}else{var P=d-b;for(L=I-P,M=0;M<P;M++)t[E+M]=t[L+M];var D=C-P;if(D>(E+=P)-d)for(var k=d,x=E+D;E<x;)t[E++]=t[k++];else{for(M=0;M<D;M++)t[E+M]=t[d+M];E+=D}}}else{if(b<T)return-(g-r)-1;if(N=E+C,c&&N>y-12){var B=Math.min(C,y-E),G=E+B;if(b+B>E)for(;E<G;)t[E++]=t[b++];else{for(M=0;M<B;M++)t[E+M]=t[b+M];E=G}if(E===y)break}else if(E-b<8)for(t[E]=t[b],t[E+1]=t[b+1],t[E+2]=t[b+2],t[E+3]=t[b+3],E+=4,b+=4;E<N;)t[E++]=t[b++];else for(;E<N;)t[E++]=t[b++]}}return s?E-i:g-r}function b(){return{hashTable:new Uint32Array(t),currentOffset:0,initCheck:0,dictionary:null,dictionaryStart:0,dictSize:0,bufferStart:null}}function A(e){e.hashTable.fill(0),e.currentOffset=0,e.initCheck=0,e.dictionary=null,e.dictionaryStart=0,e.dictSize=0,e.bufferStart=null}function M(e,t,r,n,o,i,a,s){n=n||0,i=i||0;var c=e.dictionaryStart+e.dictSize,u=n;if(e.initCheck)return 0;e.dictSize>0&&u>c&&(u=c),function(e){if(e.currentOffset>2147483648){for(var t=e.currentOffset-65536,r=e.dictionaryStart+e.dictSize,n=0;n<e.hashTable.length;n++)e.hashTable[n]<t?e.hashTable[n]=0:e.hashTable[n]-=t;e.currentOffset=65536,e.dictSize>65536&&(e.dictSize=65536),e.dictionaryStart=r-e.dictSize}}(e);var l,h=n+o;e.dictionary&&h>e.dictionaryStart&&h<c&&(e.dictSize=c-h,e.dictSize>65536&&(e.dictSize=65536),e.dictSize<4&&(e.dictSize=0),e.dictionaryStart=c-e.dictSize);var p=e.dictSize<65536&&e.dictSize<e.currentOffset?1:0;return e.dictionary&&c===n?(l=I(e,t,r,n,o,a||0,s||!1,d.byU32,1,p),e.dictSize+=o,e.currentOffset+=o,l):(l=I(e,t,r,n,o,a||0,s||!1,d.byU32,2,p),e.dictionary=t,e.dictionaryStart=n,e.dictSize=o,e.currentOffset+=o,l)}function w(e,t,r,n){var o=e.dictionaryStart+e.dictSize;n>65536&&(n=65536),n>e.dictSize&&(n=e.dictSize);var i=o-n;if(t.set&&e.dictionary.subarray)t.set(e.dictionary.subarray(i,i+n),r);else for(var a=0;a<n;a++)t[r+a]=e.dictionary[i+a];return e.dictionary=t,e.dictionaryStart=r,e.dictSize=n,n}function U(e,t,r,n){return e.prefixSize=n,e.prefixEnd=r+n,e.externalDict=null,e.extDictStart=0,e.extDictSize=0,1}function L(e,t,r,n,o,i,a){var s;if(e.prefixEnd===i){if((s=N(t,r,n,o,i,a,!0,!1,0,2,e.prefixEnd-e.prefixSize,e.extDictStart,e.extDictSize))<=0)return s;e.prefixSize+=s,e.prefixEnd+=s}else{if(e.extDictSize=e.prefixSize,e.extDictStart=e.prefixEnd-e.extDictSize,(s=N(t,r,n,o,i,a,!0,!1,0,2,i,e.extDictStart,e.extDictSize))<=0)return s;e.prefixSize=s,e.prefixEnd=i+s}return s}function P(e){var t=(e=e||{}).minWorkArea||a,r=e.maxWorkArea||s,n=e.shrinkThreshold||t;t<a&&(t=a),r<t&&(r=t),n<t&&(n=t),n>r&&(n=r),this.minBufferSize=i+t,this.maxBufferSize=i+r,this.shrinkThreshold=i+n,this.ringBufferSize=this.minBufferSize,this.shrinkMode=void 0!==e.shrinkMode?e.shrinkMode:c.MANUAL,this.ringBuffer=new Uint8Array(this.ringBufferSize),this.offset=0,this.stream=b()}function D(e){var t=(e=e||{}).minWorkArea||a,r=e.maxWorkArea||s,n=e.shrinkThreshold||t;t<a&&(t=a),r<t&&(r=t),n<t&&(n=t),n>r&&(n=r),this.minBufferSize=i+t,this.maxBufferSize=i+r,this.shrinkThreshold=i+n,this.ringBufferSize=this.minBufferSize,this.shrinkMode=void 0!==e.shrinkMode?e.shrinkMode:c.MANUAL,this.ringBuffer=new Uint8Array(this.ringBufferSize),this.offset=0,this.streamDecode={externalDict:null,extDictStart:0,extDictSize:0,prefixEnd:0,prefixSize:0}}P.prototype._resizeBuffer=function(e){var t=new Uint8Array(e),r=0;if(this.offset>0){var n=this.offset<i?this.offset:i,o=this.offset>i?this.offset-i:0;t.set(this.ringBuffer.subarray(o,o+n),0),w(this.stream,t,0,n),r=n}return this.ringBuffer=t,this.ringBufferSize=e,this.offset=r,!0},P.prototype.compress=function(e,t){var r=e.length;if(r<=0)return u.PARAM_ERROR;if(r>this.maxBufferSize-i)return u.PARAM_ERROR;if(r>this.ringBufferSize-i){var n=l(r),o=i+n;if(o>this.maxBufferSize&&(o=this.maxBufferSize),!this._resizeBuffer(o))return u.BUFFER_RESIZE_FAILED}this.offset+r>this.ringBufferSize&&(w(this.stream,this.ringBuffer,0,i),this.offset=i);var a=this.offset;this.ringBuffer.set(e,a);var s=M(this.stream,this.ringBuffer,t,a,r,0,t.length,!0);return s<=0?u.COMPRESS_FAILED:(this.offset+=r,this._tryAutoShrink(),s)},P.prototype.reset=function(){this.offset=0,A(this.stream)},P.prototype.shrink=function(){this.ringBufferSize>this.minBufferSize&&this._resizeBuffer(this.minBufferSize)},P.prototype._tryAutoShrink=function(){this.shrinkMode!==c.MANUAL&&(this.ringBufferSize<=this.minBufferSize||(this.shrinkMode===c.AUTO_IMMEDIATE||this.shrinkMode===c.AUTO_THRESHOLD&&this.ringBufferSize>this.shrinkThreshold)&&this.shrink())},P.prototype.getWorkArea=function(){return this.ringBufferSize-i},P.prototype.getRingBufferSize=function(){return this.ringBufferSize},P.prototype.getBaseBufferSize=function(){return this.minBufferSize},P.prototype.getMaxBufferSize=function(){return this.maxBufferSize},P.prototype.getCurrentOffset=function(){return this.offset},P.prototype.getShrinkMode=function(){return this.shrinkMode},P.prototype.setShrinkMode=function(e){this.shrinkMode=e},P.prototype.getShrinkThreshold=function(){return this.shrinkThreshold},P.prototype.setShrinkThreshold=function(e){var t=this.minBufferSize-i,r=this.maxBufferSize-i;if(e<t||e>r)return u.PARAM_ERROR;this.shrinkThreshold=i+e},D.prototype._resizeBuffer=function(e){var t=new Uint8Array(e),r=0;if(this.offset>0){var n=this.offset<i?this.offset:i,o=this.offset>i?this.offset-i:0;t.set(this.ringBuffer.subarray(o,o+n),0),r=n,U(this.streamDecode,0,0,n)}return this.ringBuffer=t,this.ringBufferSize=e,this.offset=r,!0},D.prototype.decompress=function(e,t,r){var n=e.length;if(n<=0||r<=0)return u.PARAM_ERROR;if(r>this.maxBufferSize-i)return u.PARAM_ERROR;if(r>this.ringBufferSize-i){var o=l(r),a=i+o;if(a>this.maxBufferSize&&(a=this.maxBufferSize),!this._resizeBuffer(a))return u.BUFFER_RESIZE_FAILED}if(this.offset+r>this.ringBufferSize){var s=this.offset-i;s>0&&this.ringBuffer.set(this.ringBuffer.subarray(s,s+i),0),U(this.streamDecode,this.ringBuffer,0,i),this.offset=i}var c=L(this.streamDecode,e,this.ringBuffer,0,n,this.offset,r);return c<=0?u.DECOMPRESS_FAILED:(t.set(this.ringBuffer.subarray(this.offset,this.offset+c),0),this.offset+=c,this._tryAutoShrink(),c)},D.prototype.reset=function(){this.offset=0,this.streamDecode={externalDict:null,extDictStart:0,extDictSize:0,prefixEnd:0,prefixSize:0}},D.prototype.shrink=function(){this.ringBufferSize>this.minBufferSize&&this._resizeBuffer(this.minBufferSize)},D.prototype._tryAutoShrink=function(){this.shrinkMode!==c.MANUAL&&(this.ringBufferSize<=this.minBufferSize||(this.shrinkMode===c.AUTO_IMMEDIATE||this.shrinkMode===c.AUTO_THRESHOLD&&this.ringBufferSize>this.shrinkThreshold)&&this.shrink())},D.prototype.getWorkArea=function(){return this.ringBufferSize-i},D.prototype.getRingBufferSize=function(){return this.ringBufferSize},D.prototype.getBaseBufferSize=function(){return this.minBufferSize},D.prototype.getMaxBufferSize=function(){return this.maxBufferSize},D.prototype.getCurrentOffset=function(){return this.offset},D.prototype.getShrinkMode=function(){return this.shrinkMode},D.prototype.setShrinkMode=function(e){this.shrinkMode=e},D.prototype.getShrinkThreshold=function(){return this.shrinkThreshold},D.prototype.setShrinkThreshold=function(e){var t=this.minBufferSize-i,r=this.maxBufferSize-i;if(e<t||e>r)return u.PARAM_ERROR;this.shrinkThreshold=i+e},e.exports={LZ4_MAX_INPUT_SIZE:o,BLOCK_MAX_SIZE:65536,DICT_SIZE:i,DEFAULT_WORK_AREA:a,DEFAULT_MAX_WORK:s,SHRINK_MODE:c,LZ4_ERROR:u,alignToPowerOf2:l,calcDefaultBufferSize:function(){return 131072},calcDefaultMaxBufferSize:function(){return 10551296},setHashStrategy:function(e){if("fast"!==e&&"compatible"!==e)throw new Error("Invalid hash strategy: "+e+'. Use "fast" or "compatible".');p=e},getHashStrategy:function(){return p},compress:function(e,n,i,a,s){if(null==e)return 0;if(null==n)return 0;if(i=i||0,a=void 0===a?e.length:a,s=s||0,i<0||s<0)return 0;if(a<0)return 0;if(i+a>e.length)return 0;if(a>o)return 0;if(0===a)return n.length>s?(n[s]=0,1):0;var c=a<r?d.byU16:d.byU32;return I({hashTable:new Uint32Array(c===d.byU16?8192:t),currentOffset:0,dictSize:0,dictionary:null,dictionaryStart:0},e,n,i,a,0,!1,c,0,0)},compressLimited:function(e,n,i,a,s,c){if(null==e)return 0;if(null==n)return 0;if(i=i||0,a=void 0===a?e.length:a,s=s||0,i<0||s<0)return 0;if(a<0||c<0)return 0;if(i+a>e.length)return 0;if(a>o)return 0;if(c<1)return 0;if(0===a)return n[s]=0,1;var u=a<r?d.byU16:d.byU32;return I({hashTable:new Uint32Array(u===d.byU16?8192:t),currentOffset:0,dictSize:0,dictionary:null,dictionaryStart:0},e,n,i,a,c,!0,u,0,0)},compressBound:function(e){return e<0||e>o?0:e+Math.floor(e/255)+16},decompressSafe:function(e,t,r,n,o,i){return null==e||null==t?-1:(o=o||0,(r=r||0)<0||o<0||n<0||i<0||r+n>e.length||o+i>t.length?-1:N(e,t,r,n,o,i,!0,!1,0,0,o,null,0))},decompressFast:function(e,t,r,n,o){return N(e,t,r=r||0,0,n=n||0,o,!1,!1,0,1,n-65536,0,65536)},createStream:b,resetStream:A,loadDict:function(e,t,r,n){if(e.initCheck&&A(e),n<4)return e.dictionary=null,e.dictSize=0,0;n>65536&&(r=r+n-65536,n=65536);var o=r-e.currentOffset;e.dictionary=t,e.dictionaryStart=r,e.dictSize=n,e.currentOffset+=n;for(var i=r,a=r+n;i<=a-4;)E(t,i,e.hashTable,d.byU32,o),i+=3;return n},compressContinue:M,saveDict:w,createStreamDecode:function(){return{externalDict:null,extDictStart:0,extDictSize:0,prefixEnd:0,prefixSize:0}},setStreamDecode:U,decompressSafeContinue:L,RingBufferEncoder:P,RingBufferDecoder:D,_hashU16:m,_hashU32:f,_TABLE_TYPE:d}},660:function(e,t,r){e.exports=i;var n=r(558);((i.prototype=Object.create(n.prototype)).constructor=i).className="Enum";var o=r(694);function i(e,t,r,o,i){if(n.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=i||{},this.reserved=void 0,t)for(var a=Object.keys(t),s=0;s<a.length;++s)"number"==typeof t[a[s]]&&(this.valuesById[this.values[a[s]]=t[a[s]]]=a[s])}i.fromJSON=function(e,t){var r=new i(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return util.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},i.prototype.add=function(e,t,r){if(!util.isString(e))throw TypeError("name must be a string");if(!util.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},i.prototype.remove=function(e){if(!util.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},i.prototype.isReservedId=function(e){return o.isReservedId(this.reserved,e)},i.prototype.isReservedName=function(e){return o.isReservedName(this.reserved,e)}},694:function(e,t,r){e.exports=l;var n,o,i,a,s,c=r(558);function u(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function l(e,t){c.call(this,e,t),this.nested=void 0,this._nestedArray=null}function d(e){return e._nestedArray=null,e}((l.prototype=Object.create(c.prototype)).constructor=l).className="Namespace",l.fromJSON=function(e,t){return new l(e,t.options).addJSON(t.nested)},l.arrayToJSON=u,l.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>=t)return!0;return!1},l.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(l.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=i.toArray(this.nested))}}),l.prototype.toJSON=function(e){return i.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},l.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),i=0;i<r.length;++i)t=e[r[i]],this.add((void 0!==t.fields?a.fromJSON:void 0!==t.values?n.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?o.fromJSON:l.fromJSON)(r[i],t));return this},l.prototype.get=function(e){return this.nested&&this.nested[e]||null},l.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof n)return this.nested[e].values;throw Error("no such enum: "+e)},l.prototype.add=function(e){if(!(e instanceof o&&void 0!==e.extend||e instanceof a||e instanceof n||e instanceof s||e instanceof l))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof l&&e instanceof l)||t instanceof a||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,i=0;i<r.length;++i)e.add(r[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),d(this)},l.prototype.remove=function(e){if(!(e instanceof c))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},l.prototype.define=function(e,t){if(i.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof l))throw Error("path conflicts with non-namespace objects")}else r.add(r=new l(n))}return t&&r.addJSON(t),r},l.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof l?e[t++].resolveAll():e[t++].resolve();return this.resolve()},l.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),i.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof l&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof l&&(n=this._nestedArray[o].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},l.prototype.lookupType=function(e){var t=this.lookup(e,[a]);if(!t)throw Error("no such type: "+e);return t},l.prototype.lookupEnum=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},l.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[a,n]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},l.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},l._configure=function(){n=r(660),o=r(101),i=r(629),a=r(465),s=r(177)}},773:function(e,t,r){e.exports=d;var n=r(694);((d.prototype=Object.create(n.prototype)).constructor=d).className="Root";var o,i,a,s=r(101),c=r(660),u=r(220),l=r(629);function d(e){n.call(this,"",e),this.deferred=[],this.files=[],this.names=[]}function h(){}d.fromJSON=function(e,t){return e="string"==typeof e?JSON.parse(e):e,t||(t=new d),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},d.prototype.resolvePath=l.path.resolve,d.prototype.parseFromPbString=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return l.asPromise(e,o,t,r);var s=null;if("string"==typeof t)s=JSON.parse(t);else{if("object"!=typeof t)return void console.log("pb格式转化失败");s=t}function c(e,t){if(n){var r=n;n=null,r(e,t)}}function u(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){i.filename=e;var n,a=i(t,o,r),s=0;if(a.imports)for(;s<a.imports.length;++s)d(n=a.imports[s]);if(a.weakImports){for(s=0;s<a.weakImports.length;++s)n=a.weakImports[s];d(n)}}else o.setOptions(t.options).addJSON(t.nested)}catch(e){c(e)}c(null,o)}function d(e){o.names.indexOf(e)>-1||(o.names.push(e),e in a&&u(e,a[e]))}u(s.name,s.pbJsonStr)},d.prototype.load=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return l.asPromise(e,o,t,r);var s=n===h;function c(e,t){if(n){var r=n;if(n=null,s)throw e;r(e,t)}}function u(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){i.filename=e;var n,a=i(t,o,r),u=0;if(a.imports)for(;u<a.imports.length;++u)(n=o.resolvePath(e,a.imports[u]))&&d(n);if(a.weakImports)for(u=0;u<a.weakImports.length;++u)(n=o.resolvePath(e,a.weakImports[u]))&&d(n,!0)}else o.setOptions(t.options).addJSON(t.nested)}catch(e){c(e)}s||p||c(null,o)}function d(e,t){var r=e.lastIndexOf("google/protobuf/");if(r>-1){var i=e.substring(r);i in a&&(e=i)}if(!(o.files.indexOf(e)>-1))if(o.files.push(e),e in a)s?u(e,a[e]):(++p,setTimeout((function(){--p,u(e,a[e])})));else if(s){var d;try{d=l.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||c(e))}u(e,d)}else++p,l.fetch(e,(function(r,i){--p,n&&(r?t?p||c(null,o):c(r):u(e,i))}))}var p=0;l.isString(t)&&(t=[t]);for(var f,m=0;m<t.length;++m)(f=o.resolvePath("",t[m]))&&d(f);if(s)return o;p||c(null,o)},d.prototype.loadSync=function(e,t){if(!l.isNode)throw Error("not supported");return this.load(e,t,h)},d.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return n.prototype.resolveAll.call(this)};var p=/^[A-Z]/;function f(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new s(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.declaringField=t,t.extensionField=n,r.add(n),!0}return!1}d.prototype._handleAdd=function(e){if(e instanceof s)void 0===e.extend||e.extensionField||f(0,e)||this.deferred.push(e);else if(e instanceof c)p.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof u)){if(e instanceof o)for(var t=0;t<this.deferred.length;)f(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);p.test(e.name)&&(e.parent[e.name]=e)}},d.prototype._handleRemove=function(e){if(e instanceof s){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof c)p.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);p.test(e.name)&&delete e.parent[e.name]}},d._configure=function(){o=r(465),i=r(922),a=r(940),s=r(101),c=r(660),u=r(220),l=r(629)}},793:function(e,t,r){var n,o=t;o[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=this.lookup(e["@type"]);if(t){var r="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return this.create({type_url:"/"+r,value:t.encode(t.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){if(t&&t.json&&e.type_url&&e.value){var r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),o=this.lookup(r);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof n){var i=e.$type.toObject(e,t);return i["@type"]=e.$type.fullName,i}return this.toObject(e,t)}},o._configure=function(){n=r(278)}},801:function(e,t,r){var n,o,i;function a(e){return"missing required '"+e.name+"'"}function s(e){return function(t){var r=t.Reader,s=t.types,c=t.util;return function(t,u){t instanceof r||(t=r.create(t));for(var l,d=void 0===u?t.len:t.pos+u,h=new this.ctor;t.pos<d;){var p=t.uint32();if(e.group&&4==(7&p))break;for(var f=p>>>3,m=0,g=!1;m<e.fieldsArray.length;++m){var v=e._fieldsArray[m].resolve(),E=v.name,y=v.resolvedType instanceof n?"int32":v.type;if(f==v.id){if(g=!0,v.map)t.skip().pos++,h[E]===c.emptyObject&&(h[E]={}),l=t[v.keyType](),t.pos++,null!=o.long[v.keyType]?null==o.basic[y]?h[E]["object"==typeof l?c.longToHash(l):l]=s[m].decode(t,t.uint32()):h[E]["object"==typeof l?c.longToHash(l):l]=t[y]():null==o.basic[y]?h[E]=s[m].decode(t,t.uint32()):h[E]=t[y]();else if(v.repeated)if(h[E]&&h[E].length||(h[E]=[]),null!=o.packed[y]&&2==(7&p))for(var _=t.uint32()+t.pos;t.pos<_;)h[E].push(t[y]());else null==o.basic[y]?v.resolvedType.group?h[E].push(s[m].decode(t)):h[E].push(s[m].decode(t,t.uint32())):h[E].push(t[y]());else null==o.basic[y]?v.resolvedType.group?h[E]=s[m].decode(t):h[E]=s[m].decode(t,t.uint32()):h[E]=t[y]();break}}g||(console.log("t",p),t.skipType(7&p))}for(m=0;m<e._fieldsArray.length;++m){var T=e._fieldsArray[m];if(T.required&&!h.hasOwnProperty(T.name))throw i.ProtocolError(a(T),{instance:h})}return h}}}e.exports=s,s._configure=function(){n=r(660),o=r(452),i=r(629)}},811:function(e,t,r){var n,o;function i(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function a(e,t,r,a){var s=a.types;if(e.resolvedType)if(e.resolvedType instanceof n){if(Object.keys(e.resolvedType.values).indexOf(r)<0)return i(e,"enum value")}else{var c=s[t].verify(r);if(c)return e.name+"."+c}else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!o.isInteger(r))return i(e,"integer");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!(o.isInteger(r)||r&&o.isInteger(r.low)&&o.isInteger(r.high)))return i(e,"integer|Long");break;case"float":case"double":if("number"!=typeof r)return i(e,"number");break;case"bool":if("boolean"!=typeof r)return i(e,"boolean");break;case"string":if(!o.isString(r))return i(e,"string");break;case"bytes":if(!(r&&"number"==typeof r.length||o.isString(r)))return i(e,"buffer")}}function s(e,t){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!o.key32Re.test(t))return i(e,"integer key");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!o.key64Re.test(t))return i(e,"integer|Long key");break;case"bool":if(!o.key2Re.test(t))return i(e,"boolean key")}}function c(e){return function(t){return function(r){var n;if("object"!=typeof r||null===r)return"object expected";var c,u={};e.oneofsArray.length&&(c={});for(var l=0;l<e.fieldsArray.length;++l){var d,h=e._fieldsArray[l].resolve(),p=r[h.name];if(!h.optional||null!=p&&r.hasOwnProperty(h.name))if(h.map){if(!o.isObject(p))return i(h,"object");var f=Object.keys(p);for(d=0;d<f.length;++d){if(n=s(h,f[d]))return n;if(n=a(h,l,p[f[d]],t))return n}}else if(h.repeated){if(!Array.isArray(p))return i(h,"array");for(d=0;d<p.length;++d)if(n=a(h,l,p[d],t))return n}else{if(h.partOf){var m=h.partOf.name;if(1===u[h.partOf.name]&&1===c[m])return h.partOf.name+": multiple values";c[m]=1}if(n=a(h,l,p,t))return n}}}}}e.exports=c,c._configure=function(){n=r(660),o=r(629)}},814:function(e){var t=e.exports,r=t.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=t.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),o="";n&&(o=t.shift()+"/");for(var i=0;i<t.length;)".."===t[i]?i>0&&".."!==t[i-1]?t.splice(--i,2):n?t.splice(i,1):++i:"."===t[i]?t.splice(i,1):++i;return o+t.join("/")};t.resolve=function(e,t,o){return o||(t=n(t)),r(t)?t:(o||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}},879:function(e){e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function n(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=n;var o={},i={};function a(e,t){var r,n,a;return t?(a=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=c(e,(0|e)<0?-1:0,!0),a&&(i[e]=r),r):(a=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=c(e,e<0?-1:0,!1),a&&(o[e]=r),r)}function s(e,t){if(isNaN(e))return t?v:g;if(t){if(e<0)return v;if(e>=p)return I}else{if(e<=-f)return O;if(e+1>=f)return T}return e<0?s(-e,t).neg():c(e%h|0,e/h|0,t)}function c(e,t,n){return new r(e,t,n)}r.fromInt=a,r.fromNumber=s,r.fromBits=c;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var o=s(u(r,8)),i=g,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),d=parseInt(e.substring(a,a+c),r);if(c<8){var h=s(u(r,c));i=i.mul(h).add(s(d))}else i=(i=i.mul(o)).add(s(d))}return i.unsigned=t,i}function d(e,t){return"number"==typeof e?s(e,t):"string"==typeof e?l(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=d;var h=4294967296,p=h*h,f=p/2,m=a(1<<24),g=a(0);r.ZERO=g;var v=a(0,!0);r.UZERO=v;var E=a(1);r.ONE=E;var y=a(1,!0);r.UONE=y;var _=a(-1);r.NEG_ONE=_;var T=c(-1,2147483647,!1);r.MAX_VALUE=T;var I=c(-1,-1,!0);r.MAX_UNSIGNED_VALUE=I;var O=c(0,-2147483648,!1);r.MIN_VALUE=O;var R=r.prototype;R.toInt=function(){return this.unsigned?this.low>>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},R.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(O)){var t=s(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=s(u(e,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=(i.sub(c.mul(o)).toInt()>>>0).toString(e);if((i=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},R.isZero=function(){return 0===this.high&&0===this.low},R.eqz=R.isZero,R.isNegative=function(){return!this.unsigned&&this.high<0},R.isPositive=function(){return this.unsigned||this.high>=0},R.isOdd=function(){return!(1&~this.low)},R.isEven=function(){return!(1&this.low)},R.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.ne=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.le=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.ge=R.greaterThanOrEqual,R.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(E)},R.neg=R.negate,R.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,a=e.high>>>16,s=65535&e.high,u=e.low>>>16,l=0,h=0,p=0,f=0;return p+=(f+=i+(65535&e.low))>>>16,h+=(p+=o+u)>>>16,l+=(h+=r+s)>>>16,l+=t+a,c((p&=65535)<<16|(f&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},R.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){if(this.isZero())return g;if(n(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(O))return e.isOdd()?O:g;if(e.eq(O))return this.isOdd()?O:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return s(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,a=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,p=65535&e.low,f=0,v=0,E=0,y=0;return E+=(y+=a*p)>>>16,v+=(E+=i*p)>>>16,E&=65535,v+=(E+=a*h)>>>16,f+=(v+=o*p)>>>16,v&=65535,f+=(v+=i*h)>>>16,v&=65535,f+=(v+=a*l)>>>16,f+=r*p+o*h+i*l+a*u,c((E&=65535)<<16|(y&=65535),(f&=65535)<<16|(v&=65535),this.unsigned)},R.mul=R.multiply,R.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var r,o,i;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return y;i=v}else{if(this.eq(O))return e.eq(E)||e.eq(_)?O:e.eq(O)?E:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?E:_:(o=this.sub(e.mul(r)),i=r.add(o.div(e)));if(e.eq(O))return this.unsigned?v:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=g}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),l=a<=48?1:u(2,a-48),h=s(r),p=h.mul(e);p.isNegative()||p.gt(o);)p=(h=s(r-=l,this.unsigned)).mul(e);h.isZero()&&(h=E),i=i.add(h),o=o.sub(p)}return i},R.div=R.divide,R.modulo=function(e){return n(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.rem=R.modulo,R.not=function(){return c(~this.low,~this.high,this.unsigned)},R.and=function(e){return n(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return n(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},R.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},R.shl=R.shiftLeft,R.shiftRight=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},R.shru=R.shiftRightUnsigned,R.shr_u=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,n){return n?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},880:function(e){"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,o=2,i=!0;o<arguments.length;)r[n++]=arguments[o++];return new Promise((function(o,a){r[n]=function(e){if(i)if(i=!1,e)a(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];o.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,a(e))}}))}},887:function(e,t,r){var n,o,i;!function(a){"use strict";if(null!=t&&"number"!=typeof t.nodeType)e.exports=a();else if(null!=r.amdO)o=[],void 0===(i="function"==typeof(n=a)?n.apply(t,o):n)||(e.exports=i);else{var s=a(),c="undefined"!=typeof self?self:$.global;"function"!=typeof c.btoa&&(c.btoa=s.btoa),"function"!=typeof c.atob&&(c.atob=s.atob)}}((function(){"use strict";var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(r){for(var n,o,i=String(r),a=0,s=e,c="";i.charAt(0|a)||(s="=",a%1);c+=s.charAt(63&n>>8-a%1*8)){if((o=i.charCodeAt(a+=3/4))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return c},atob:function(r){var n=String(r).replace(/[=]+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,a=0,s=0,c="";i=n.charAt(s++);~i&&(o=a%4?64*o+i:i,a++%4)?c+=String.fromCharCode(255&o>>(-2*a&6)):0)i=e.indexOf(i);return c}}}))},896:function(e){e.exports={}},899:function(e){function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function i(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function s(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:i,e.writeFloatBE=n?i:o,e.readFloatLE=n?a:s,e.readFloatBE=n?s:a}():function(){function t(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,n)}}function a(e,t,r){var n=e(t,r),o=2*(n>>31)+1,i=n>>>23&255,a=8388607&n;return 255===i?a?NaN:o*(1/0):0===i?1401298464324817e-60*o*a:o*Math.pow(2,i-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=a.bind(null,o),e.readFloatBE=a.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function i(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function s(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:i,e.writeDoubleBE=n?i:o,e.readDoubleLE=n?a:s,e.readDoubleBE=n?s:a}():function(){function t(e,t,r,n,o,i){var a=n<0?1:0;if(a&&(n=-n),0===n)e(0,o,i+t),e(1/n>0?0:2147483648,o,i+r);else if(isNaN(n))e(0,o,i+t),e(2146959360,o,i+r);else if(n>17976931348623157e292)e(0,o,i+t),e((a<<31|2146435072)>>>0,o,i+r);else{var s;if(n<22250738585072014e-324)e((s=n/5e-324)>>>0,o,i+t),e((a<<31|s/4294967296)>>>0,o,i+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(s=n*Math.pow(2,-c))>>>0,o,i+t),e((a<<31|c+1023<<20|1048576*s&1048575)>>>0,o,i+r)}}}function a(e,t,r,n,o){var i=e(n,o+t),a=e(n,o+r),s=2*(a>>31)+1,c=a>>>20&2047,u=4294967296*(1048575&a)+i;return 2047===c?u?NaN:s*(1/0):0===c?5e-324*s*u:s*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=a.bind(null,o,0,4),e.readDoubleBE=a.bind(null,i,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},921:function(e,t,r){var n,o,i=e.exports;function a(e,t,r,i){var a=i.m,s=i.d,c=i.types,u=i.ksi,l=void 0!==u;if(e.resolvedType)if(e.resolvedType instanceof n){for(var d=l?s[r][u]:s[r],h=e.resolvedType.values,p=Object.keys(h),f=0;f<p.length;f++)if(!(e.repeated&&h[p[f]]===e.typeDefault||p[f]!=d&&h[p[f]]!=d)){l?a[r][u]=h[p[f]]:a[r]=h[p[f]];break}}else{if("object"!=typeof(l?s[r][u]:s[r]))throw TypeError(e.fullName+": object expected");l?a[r][u]=c[t].fromObject(s[r][u]):a[r]=c[t].fromObject(s[r])}else{var m=!1;switch(e.type){case"double":case"float":l?a[r][u]=Number(s[r][u]):a[r]=Number(s[r]);break;case"uint32":case"fixed32":l?a[r][u]=s[r][u]>>>0:a[r]=s[r]>>>0;break;case"int32":case"sint32":case"sfixed32":l?a[r][u]=0|s[r][u]:a[r]=0|s[r];break;case"uint64":m=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o.Long?l?a[r][u]=o.Long.fromValue(s[r][u]).unsigned=m:a[r]=o.Long.fromValue(s[r]).unsigned=m:"string"==typeof(l?s[r][u]:s[r])?l?a[r][u]=parseInt(s[r][u],10):a[r]=parseInt(s[r],10):"number"==typeof(l?s[r][u]:s[r])?l?a[r][u]=s[r][u]:a[r]=s[r]:"object"==typeof(l?s[r][u]:s[r])&&(l?a[r][u]=new o.LongBits(s[r][u].low>>>0,s[r][u].high>>>0).toNumber(m):a[r]=new o.LongBits(s[r].low>>>0,s[r].high>>>0).toNumber(m));break;case"bytes":"string"==typeof(l?s[r][u]:s[r])?l?o.base64.decode(s[r][u],a[r][u]=o.newBuffer(o.base64.length(s[r][u])),0):o.base64.decode(s[r],a[r]=o.newBuffer(o.base64.length(s[r])),0):(l?s[r][u]:s[r]).length&&(l?a[r][u]=s[r][u]:a[r]=s[r]);break;case"string":l?a[r][u]=String(s[r][u]):a[r]=String(s[r]);break;case"bool":l?a[r][u]=Boolean(s[r][u]):a[r]=Boolean(s[r])}}}function s(e,t,r,i){var a=i.m,s=i.d,c=i.types,u=i.ksi,l=i.o,d=void 0!==u;if(e.resolvedType)e.resolvedType instanceof n?d?s[r][u]=l.enums===String?c[t].values[a[r][u]]:a[r][u]:s[r]=l.enums===String?c[t].values[a[r]]:a[r]:d?s[r][u]=c[t].toObject(a[r][u],l):s[r]=c[t].toObject(a[r],l);else{var h=!1;switch(e.type){case"double":case"float":d?s[r][u]=l.json&&!isFinite(a[r][u])?String(a[r][u]):a[r][u]:s[r]=l.json&&!isFinite(a[r])?String(a[r]):a[r];break;case"uint64":h=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":"number"==typeof a[r][u]?d?s[r][u]=l.longs===String?String(a[r][u]):a[r][u]:s[r]=l.longs===String?String(a[r]):a[r]:d?s[r][u]=l.longs===String?o.Long.prototype.toString.call(a[r][u]):l.longs===Number?new o.LongBits(a[r][u].low>>>0,a[r][u].high>>>0).toNumber(h):a[r][u]:s[r]=l.longs===String?o.Long.prototype.toString.call(a[r]):l.longs===Number?new o.LongBits(a[r].low>>>0,a[r].high>>>0).toNumber(h):a[r];break;case"bytes":d?s[r][u]=l.bytes===String?o.base64.encode(a[r][u],0,a[r][u].length):l.bytes===Array?Array.prototype.slice.call(a[r][u]):a[r][u]:s[r]=l.bytes===String?o.base64.encode(a[r],0,a[r].length):l.bytes===Array?Array.prototype.slice.call(a[r]):a[r];break;default:d?s[r][u]=a[r][u]:s[r]=a[r]}}}i._configure=function(){n=r(660),o=r(629)},i.fromObject=function(e){var t=e.fieldsArray;return function(e){return function(r){if(r instanceof this.ctor)return r;if(!t.length)return new this.ctor;for(var i=new this.ctor,s=0;s<t.length;++s){var c,u=t[s].resolve(),l=u.name;if(u.map){if(r[l]){if("object"!=typeof r[l])throw TypeError(u.fullName+": object expected");i[l]={}}var d=Object.keys(r[l]);for(c=0;c<d.length;++c)a(u,s,l,o.merge(o.copy(e),{m:i,d:r,ksi:d[c]}))}else if(u.repeated){if(r[l]){if(!Array.isArray(r[l]))throw TypeError(u.fullName+": array expected");for(i[l]=[],c=0;c<r[l].length;++c)a(u,s,l,o.merge(o.copy(e),{m:i,d:r,ksi:c}))}}else(u.resolvedType instanceof n||null!=r[l])&&a(u,s,l,o.merge(o.copy(e),{m:i,d:r}))}return i}}},i.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);return function(r){return t.length?function(i,a){a=a||{};for(var c,u,l={},d=[],h=[],p=[],f=0;f<t.length;++f)t[f].partOf||(t[f].resolve().repeated?d:t[f].map?h:p).push(t[f]);if(d.length&&(a.arrays||a.defaults))for(f=0;f<d.length;++f)l[d[f].name]=[];if(h.length&&(a.objects||a.defaults))for(f=0;f<h.length;++f)l[h[f].name]={};if(p.length&&a.defaults)for(f=0;f<p.length;++f)if(u=(c=p[f]).name,c.resolvedType instanceof n)l[u]=a.enums=String?c.resolvedType.valuesById[c.typeDefault]:c.typeDefault;else if(c.long)if(o.Long){var m=new o.Long(c.typeDefault.low,c.typeDefault.high,c.typeDefault.unsigned);l[u]=a.longs===String?m.toString():a.longs===Number?m.toNumber():m}else l[u]=a.longs===String?c.typeDefault.toString():c.typeDefault.toNumber();else c.bytes?l[u]=a.bytes===String?String.fromCharCode.apply(String,c.typeDefault):Array.prototype.slice.call(c.typeDefault).join("*..*").split("*..*"):l[u]=c.typeDefault;var g=!1;for(f=0;f<t.length;++f){u=(c=t[f]).name;var v,E,y=e._fieldsArray.indexOf(c);if(c.map){if(g||(g=!0),i[u]&&(v=Object.keys(i[u]).length))for(l[u]={},E=0;E<v.length;++E)s(c,y,u,o.merge(o.copy(r),{m:i,d:l,ksi:v[E],o:a}))}else if(c.repeated){if(i[u]&&i[u].length)for(l[u]=[],E=0;E<i[u].length;++E)s(c,y,u,o.merge(o.copy(r),{m:i,d:l,ksi:E,o:a}))}else null!=i[u]&&i.hasOwnProperty(u)&&s(c,y,u,o.merge(o.copy(r),{m:i,d:l,o:a})),c.partOf&&a.oneofs&&(l[c.partOf.name]=u)}return l}:function(){return{}}}}},922:function(e,t,r){"use strict";var n,o,i,a,s,c,u,l,d,h,p;e.exports=R,R.filename=null,R.defaults={keepCase:!1};var f=/^[1-9][0-9]*$/,m=/^-?[1-9][0-9]*$/,g=/^0[x][0-9a-fA-F]+$/,v=/^-?0[x][0-9a-fA-F]+$/,E=/^0[0-7]+$/,y=/^-?0[0-7]+$/,_=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,T=/^[a-zA-Z_][a-zA-Z_0-9]*$/,I=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,O=/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/;function R(e,t,r){t instanceof o||(r=t,t=new o),r||(r=R.defaults);var C,S,N,b,A,M=n(e,r.alternateCommentMode||!1),w=M.next,U=M.push,L=M.peek,P=M.skip,D=M.cmnt,k=!0,x=!1,B=t,G=r.keepCase?function(e){return e}:p.camelCase;function j(e,t,r){var n=R.filename;return r||(R.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+M.line+")")}function H(){var e,t=[];do{if('"'!==(e=w())&&"'"!==e)throw j(e);t.push(w()),P(e),e=L()}while('"'===e||"'"===e);return t.join("")}function F(e){var t=w();switch(t){case"'":case'"':return U(t),H();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e){var t=1;switch("-"===e.charAt(0)&&(t=-1,e=e.substring(1)),e){case"inf":case"INF":case"Inf":return t*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(f.test(e))return t*parseInt(e,10);if(g.test(e))return t*parseInt(e,16);if(E.test(e))return t*parseInt(e,8);if(_.test(e))return t*parseFloat(e);throw j(e,"number",!0)}(t)}catch(r){if(e&&I.test(t))return t;throw j(t,"value")}}function W(e,t){var r,n;do{!t||'"'!==(r=L())&&"'"!==r?e.push([n=z(w()),P("to",!0)?z(w()):n]):e.push(H())}while(P(",",!0));P(";")}function z(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw j(e,"id");if(m.test(e))return parseInt(e,10);if(v.test(e))return parseInt(e,16);if(y.test(e))return parseInt(e,8);throw j(e,"id")}function q(){if(void 0!==C)throw j("package");if(C=w(),!I.test(C))throw j(C,"name");B=B.define(C),P(";")}function K(){var e,t=L();switch(t){case"weak":e=N||(N=[]),w();break;case"public":w();default:e=S||(S=[])}t=H(),P(";"),e.push(t)}function V(){if(P("="),b=H(),!(x="proto3"===b)&&"proto2"!==b)throw j(b,"syntax");P(";")}function J(e,t){switch(t){case"option":return Q(e,t),P(";"),!0;case"message":return function(e,t){if(!T.test(t=w()))throw j(t,"type name");var r=new i(t);Y(r,(function(e){if(!J(r,e))switch(e){case"map":!function(e){P("<");var t=w();if(void 0===h.mapKey[t])throw j(t,"type");P(",");var r=w();if(!I.test(r))throw j(r,"type");P(">");var n=w();if(!T.test(n))throw j(n,"name");P("=");var o=new s(G(n),z(w()),t,r);Y(o,(function(e){if("option"!==e)throw j(e);Q(o,e),P(";")}),(function(){ee(o)})),e.add(o)}(r);break;case"required":case"optional":case"repeated":X(r,e);break;case"oneof":!function(e,t){if(!T.test(t=w()))throw j(t,"name");var r=new c(G(t));Y(r,(function(e){"option"===e?(Q(r,e),P(";")):(U(e),X(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":W(r.extensions||(r.extensions=[]));break;case"reserved":W(r.reserved||(r.reserved=[]),!0);break;default:if(!x||!I.test(e))throw j(e);U(e),X(r,"optional")}})),e.add(r)}(e,t),!0;case"enum":return function(e,t){if(!T.test(t=w()))throw j(t,"name");var r=new u(t);Y(r,(function(e){switch(e){case"option":Q(r,e),P(";");break;case"reserved":W(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!T.test(t))throw j(t,"name");P("=");var r=z(w(),!0),n={};Y(n,(function(e){if("option"!==e)throw j(e);Q(n,e),P(";")}),(function(){ee(n)})),e.add(t,r,n.comment)}(r,e)}})),e.add(r)}(e,t),!0;case"service":return function(e,t){if(!T.test(t=w()))throw j(t,"service name");var r=new l(t);Y(r,(function(e){if(!J(r,e)){if("rpc"!==e)throw j(e);!function(e,t){var r=t;if(!T.test(t=w()))throw j(t,"name");var n,o,i,a,s=t;if(P("("),P("stream",!0)&&(o=!0),!I.test(t=w()))throw j(t);if(n=t,P(")"),P("returns"),P("("),P("stream",!0)&&(a=!0),!I.test(t=w()))throw j(t);i=t,P(")");var c=new d(s,r,n,i,o,a);Y(c,(function(e){if("option"!==e)throw j(e);Q(c,e),P(";")})),e.add(c)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!I.test(t=w()))throw j(t,"reference");var r=t;Y(null,(function(t){switch(t){case"required":case"repeated":case"optional":X(e,t,r);break;default:if(!x||!I.test(t))throw j(t);U(t),X(e,"optional",r)}}))}(e,t),!0}return!1}function Y(e,t,r){var n=M.line;if(e&&(e.comment=D(),e.filename=R.filename),P("{",!0)){for(var o;"}"!==(o=w());)t(o);P(";",!0)}else r&&r(),P(";"),e&&"string"!=typeof e.comment&&(e.comment=D(n))}function X(e,t,r){var n=w();if("group"!==n){if(!I.test(n))throw j(n,"type");var o=w();if(!T.test(o))throw j(o,"name");o=G(o),P("=");var s=new a(o,z(w()),n,t,r);Y(s,(function(e){if("option"!==e)throw j(e);Q(s,e),P(";")}),(function(){ee(s)})),e.add(s),x||!s.repeated||void 0===h.packed[n]&&void 0!==h.basic[n]||s.setOption("packed",!1,!0)}else!function(e,t){var r=w();if(!T.test(r))throw j(r,"name");var n=p.lcFirst(r);r===n&&(r=p.ucFirst(r)),P("=");var o=z(w()),s=new i(r);s.group=!0;var c=new a(n,o,r,t);c.filename=R.filename,Y(s,(function(e){switch(e){case"option":Q(s,e),P(";");break;case"required":case"optional":case"repeated":X(s,e);break;default:throw j(e)}})),e.add(s).add(c)}(e,t)}function Q(e,t){var r=P("(",!0);if(!I.test(t=w()))throw j(t,"name");var n=t;r&&(P(")"),n="("+n+")",t=L(),O.test(t)&&(n+=t,w())),P("="),Z(e,n)}function Z(e,t){if(P("{",!0))do{if(!T.test(A=w()))throw j(A,"name");"{"===L()?Z(e,t+"."+A):(P(":"),"{"===L()?Z(e,t+"."+A):$(e,t+"."+A,F(!0)))}while(!P("}",!0));else $(e,t,F(!0))}function $(e,t,r){e.setOption&&e.setOption(t,r)}function ee(e){if(P("[",!0)){do{Q(e,"option")}while(P(",",!0));P("]")}return e}for(;null!==(A=w());)switch(A){case"package":if(!k)throw j(A);q();break;case"import":if(!k)throw j(A);K();break;case"syntax":if(!k)throw j(A);V();break;case"option":if(!k)throw j(A);Q(B,A),P(";");break;default:if(J(B,A)){k=!1;continue}throw j(A)}return R.filename=null,{package:C,imports:S,weakImports:N,syntax:b,root:t}}R._configure=function(){n=r(496),o=r(773),i=r(465),a=r(101),s=r(83),c=r(220),u=r(660),l=r(177),d=r(512),h=r(452),p=r(629)}},940:function(e){e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},970:function(e,t,r){e.exports=s;var n,o,i=r(629);function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function s(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){return e instanceof Uint8Array||Array.isArray(e)?new s(e):"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?new s(new Uint8Array(e)):void 0}:function(e){if(Array.isArray(e))return new s(e)};function l(){var e=new n(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new n(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}s.create=i.Buffer?function(e){return(s.create=function(e){return i.Buffer.isBuffer(e)?new(void 0)(e):u(e)})(e)}:u,s.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,s.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),s.prototype.int32=function(){return 0|this.uint32()},s.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},s.prototype.bool=function(){return 0!==this.uint32()},s.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},s.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},s.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},s.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},s.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},s.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},s.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},s._configure=function(){n=r(183),o=r(442);var e=i.Long?"toLong":"toNumber";i.merge(s.prototype,{int64:function(){return l.call(this)[e](!1)},uint64:function(){return l.call(this)[e](!0)},sint64:function(){return l.call(this).zzDecode()[e](!1)},fixed64:function(){return h.call(this)[e](!0)},sfixed64:function(){return h.call(this)[e](!1)}})}},986:function(e){"use strict";var t=e.exports;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(e,t,n){for(var o,i=null,a=[],s=0,c=0;t<n;){var u=e[t++];switch(c){case 0:a[s++]=r[u>>2],o=(3&u)<<4,c=1;break;case 1:a[s++]=r[o|u>>4],o=(15&u)<<2,c=2;break;case 2:a[s++]=r[o|u>>6],a[s++]=r[63&u],c=0}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),s=0)}return c&&(a[s++]=r[o],a[s++]=61,1===c&&(a[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,a.slice(0,s))),i.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var i="invalid encoding";t.decode=function(e,t,r){for(var o,a=r,s=0,c=0;c<e.length;){var u=e.charCodeAt(c++);if(61===u&&s>1)break;if(void 0===(u=n[u]))throw Error(i);switch(s){case 0:o=u,s=1;break;case 1:t[r++]=o<<2|(48&u)>>4,o=u,s=2;break;case 2:t[r++]=(15&o)<<4|(60&u)>>2,o=u,s=3;break;case 3:t[r++]=(3&o)<<6|u,s=0}}if(1===s)throw Error(i);return r-a},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.amdO={},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";r.d(n,{default:function(){return Zc}});var e={};r.r(e),r.d(e,{acceptContactInvite:function(){return oo},acceptInvitation:function(){return no},addContact:function(){return eo},addConversationMark:function(){return wo},addReaction:function(){return go},addToBlackList:function(){return so},addUsersToBlacklist:function(){return co},addUsersToBlocklist:function(){return uo},declineContactInvite:function(){return ao},declineInvitation:function(){return io},deleteAllMessagesAndConversations:function(){return Do},deleteContact:function(){return ro},deleteConversation:function(){return zn},deleteReaction:function(){return vo},deleteSession:function(){return Wn},fetchHistoryMessages:function(){return Xn},fetchUserInfoById:function(){return Vn},getAllContacts:function(){return bo},getBlacklist:function(){return Pn},getBlocklist:function(){return Dn},getContacts:function(){return xn},getContactsWithCursor:function(){return Ao},getConversationlist:function(){return Hn},getHistoryMessages:function(){return Zn},getRTCToken:function(){return $o},getReactionDetail:function(){return _o},getReactionList:function(){return Eo},getReactionlist:function(){return yo},getRoster:function(){return kn},getSelfIdsOnOtherPlatform:function(){return Po},getServerConversations:function(){return Oo},getServerConversationsByFilter:function(){return Lo},getServerPinnedConversations:function(){return Co},getServerPinnedMessages:function(){return Go},getSessionList:function(){return jn},getTokenExpireTimestamp:function(){return Yn},getUserIdByRTCUIds:function(){return ei},modifyMessage:function(){return mo},pinConversation:function(){return So},pinMessage:function(){return xo},recallMessage:function(){return fo},removeConversationMark:function(){return Uo},removeFromBlackList:function(){return lo},removeHistoryMessages:function(){return Io},removeRoster:function(){return to},removeUserFromBlackList:function(){return ho},removeUserFromBlocklist:function(){return po},reportMessage:function(){return To},searchMessages:function(){return $n},setContactRemark:function(){return No},unbindPushToken:function(){return jo},unpinMessage:function(){return Bo},updateCurrentUserNick:function(){return Jn},updateOwnUserInfo:function(){return qn},updateUserInfo:function(){return Kn},uploadPushToken:function(){return Gn},uploadToken:function(){return Bn},voiceFileToText:function(){return Zo},voiceMessageToText:function(){return Qo}});var t={};r.r(t),r.d(t,{acceptGroupInvite:function(){return xi},acceptGroupJoinRequest:function(){return Li},addUsersToGroupAllowlist:function(){return da},addUsersToGroupWhitelist:function(){return la},agreeInviteIntoGroup:function(){return ki},agreeJoinGroup:function(){return Ui},blockGroup:function(){return si},blockGroupMember:function(){return Zi},blockGroupMembers:function(){return ea},blockGroupMessage:function(){return La},blockGroupMessages:function(){return ci},changeGroupOwner:function(){return fi},changeOwner:function(){return pi},createGroup:function(){return ii},createGroupNew:function(){return oi},createGroupVNext:function(){return ai},deleteGroupSharedFile:function(){return Ca},destroyGroup:function(){return Si},disableSendGroupMsg:function(){return ca},dissolveGroup:function(){return Ci},downloadGroupSharedFile:function(){return ba},enableSendGroupMsg:function(){return ua},fetchGroupAnnouncement:function(){return Ia},fetchGroupSharedFileList:function(){return Sa},getGroup:function(){return di},getGroupAdmin:function(){return _i},getGroupAllowlist:function(){return ga},getGroupBlacklist:function(){return aa},getGroupBlacklistNew:function(){return ia},getGroupBlocklist:function(){return sa},getGroupInfo:function(){return mi},getGroupMemberAttributes:function(){return Ma},getGroupMembers:function(){return yi},getGroupMembersAttributes:function(){return wa},getGroupMsgReadUser:function(){return Ta},getGroupMuteList:function(){return Yi},getGroupMutelist:function(){return Xi},getGroupSharedFilelist:function(){return Na},getGroupWhitelist:function(){return ma},getJoinedGroups:function(){return hi},getJoinedGroupsCount:function(){return Ua},getMuted:function(){return Ji},getPublicGroups:function(){return li},groupBlockMulti:function(){return $i},groupBlockSingle:function(){return Qi},inviteToGroup:function(){return Ai},inviteUsersToGroup:function(){return Mi},isGroupWhiteUser:function(){return va},isInGroupAllowlist:function(){return ya},isInGroupMutelist:function(){return _a},isInGroupWhiteList:function(){return Ea},joinGroup:function(){return wi},leaveGroup:function(){return bi},listGroupMember:function(){return vi},listGroupMembers:function(){return Ei},listGroups:function(){return ui},modifyGroup:function(){return gi},mute:function(){return zi},muteGroupMember:function(){return qi},quitGroup:function(){return Ni},rejectGroupInvite:function(){return Gi},rejectGroupJoinRequest:function(){return Di},rejectInviteIntoGroup:function(){return Bi},rejectJoinGroup:function(){return Pi},removeAdmin:function(){return Oi},removeGroupAdmin:function(){return Ri},removeGroupAllowlistMember:function(){return fa},removeGroupBlockMulti:function(){return na},removeGroupBlockSingle:function(){return ta},removeGroupMember:function(){return Hi},removeGroupMembers:function(){return Wi},removeGroupWhitelistMember:function(){return pa},removeMultiGroupMember:function(){return Fi},removeMute:function(){return Ki},removeSingleGroupMember:function(){return ji},rmUsersFromGroupWhitelist:function(){return ha},setAdmin:function(){return Ti},setGroupAdmin:function(){return Ii},setGroupMemberAttributes:function(){return Aa},unblockGroupMember:function(){return ra},unblockGroupMembers:function(){return oa},unblockGroupMessage:function(){return Pa},unmuteGroupMember:function(){return Vi},updateGroupAnnouncement:function(){return Oa},uploadGroupSharedFile:function(){return Ra}});var o={};r.r(o),r.d(o,{addUsersToChatRoom:function(){return qa},addUsersToChatRoomAllowlist:function(){return Ts},addUsersToChatRoomWhitelist:function(){return _s},blockChatRoomMember:function(){return cs},blockChatRoomMembers:function(){return ls},chatRoomBlockMulti:function(){return us},chatRoomBlockSingle:function(){return ss},createChatRoom:function(){return xa},deleteChatRoomSharedFile:function(){return Ls},destroyChatRoom:function(){return Ba},disableSendChatRoomMsg:function(){return Es},enableSendChatRoomMsg:function(){return ys},fetchChatRoomAnnouncement:function(){return Ms},fetchChatRoomSharedFileList:function(){return Ps},getChatRoomAdmin:function(){return Za},getChatRoomAllowlist:function(){return Ss},getChatRoomAttributes:function(){return ks},getChatRoomBlacklist:function(){return gs},getChatRoomBlacklistNew:function(){return ms},getChatRoomBlocklist:function(){return vs},getChatRoomDetails:function(){return Ga},getChatRoomMembers:function(){return Qa},getChatRoomMuteList:function(){return is},getChatRoomMuted:function(){return os},getChatRoomMutelist:function(){return as},getChatRoomSharedFilelist:function(){return Ds},getChatRoomWhitelist:function(){return Cs},getChatRooms:function(){return ka},getJoinedChatRooms:function(){return Hs},isChatRoomWhiteUser:function(){return Ns},isInChatRoomAllowlist:function(){return bs},isInChatRoomMutelist:function(){return As},joinChatRoom:function(){return Ka},leaveChatRoom:function(){return Ja},listChatRoomMember:function(){return Ya},listChatRoomMembers:function(){return Xa},modifyChatRoom:function(){return ja},muteChatRoomMember:function(){return ts},quitChatRoom:function(){return Va},removeChatRoomAdmin:function(){return es},removeChatRoomAllowlistMember:function(){return Rs},removeChatRoomAttribute:function(){return js},removeChatRoomAttributes:function(){return Gs},removeChatRoomBlockMulti:function(){return ps},removeChatRoomBlockSingle:function(){return ds},removeChatRoomMember:function(){return Fa},removeChatRoomMembers:function(){return za},removeChatRoomWhitelistMember:function(){return Os},removeMultiChatRoomMember:function(){return Wa},removeMuteChatRoomMember:function(){return rs},removeSingleChatRoomMember:function(){return Ha},rmUsersFromChatRoomWhitelist:function(){return Is},setChatRoomAdmin:function(){return $a},setChatRoomAttribute:function(){return Bs},setChatRoomAttributes:function(){return xs},unblockChatRoomMember:function(){return hs},unblockChatRoomMembers:function(){return fs},unmuteChatRoomMember:function(){return ns},updateChatRoomAnnouncement:function(){return ws},uploadChatRoomSharedFile:function(){return Us}});var i={};r.r(i),r.d(i,{getPresenceStatus:function(){return Ys},getSubscribedPresenceList:function(){return Vs},getSubscribedPresencelist:function(){return Js},publishPresence:function(){return zs},subscribePresence:function(){return qs},unsubscribePresence:function(){return Ks}});var a={};r.r(a),r.d(a,{clearRemindTypeForConversation:function(){return $s},getPushPerformLanguage:function(){return nc},getSilentModeForAll:function(){return Qs},getSilentModeForConversation:function(){return ec},getSilentModeForConversations:function(){return tc},getSilentModeRemindTypeConversations:function(){return oc},setPushPerformLanguage:function(){return rc},setSilentModeForAll:function(){return Xs},setSilentModeForConversation:function(){return Zs}});var s={};r.r(s),r.d(s,{changeChatThreadName:function(){return dc},createChatThread:function(){return sc},destroyChatThread:function(){return lc},getChatThreadDetail:function(){return Ec},getChatThreadLastMessage:function(){return gc},getChatThreadMembers:function(){return hc},getChatThreads:function(){return mc},getJoinedChatThreads:function(){return fc},joinChatThread:function(){return cc},leaveChatThread:function(){return uc},removeChatThreadMember:function(){return pc}});var c={};r.r(c),r.d(c,{getSupportedLanguages:function(){return yc},translateMessage:function(){return _c}});var u={};function l(){u.converter._configure(),u.decoder._configure(),u.encoder._configure(),u.Field._configure(),u.MapField._configure(),u.Message._configure(),u.Namespace._configure(),u.Method._configure(),u.ReflectionObject._configure(),u.OneOf._configure(),u.parse._configure(),u.Reader._configure(),u.Root._configure(),u.Service._configure(),u.verifier._configure(),u.Type._configure(),u.types._configure(),u.wrappers._configure(),u.Writer._configure()}u.build="minimal",u.Writer=r(322),u.encoder=r(229),u.Reader=r(970),u.util=r(629),u.rpc=r(470),u.roots=r(896),u.verifier=r(811),u.tokenize=r(496),u.parse=r(922),u.common=r(940),u.ReflectionObject=r(558),u.Namespace=r(694),u.Root=r(773),u.Enum=r(660),u.Type=r(465),u.Field=r(101),u.OneOf=r(220),u.MapField=r(83),u.Service=r(177),u.Method=r(512),u.converter=r(921),u.decoder=r(801),u.Message=r(278),u.wrappers=r(793),u.types=r(452),u.util=r(629),u.configure=l,u.load=function(e,t,r){return"function"==typeof t?(r=t,t=new u.Root):t||(t=new u.Root),t.load(e,r)},u.loadSync=function(e,t){return t||(t=new u.Root),t.loadSync(e)},u.parseFromPbString=function(e,t,r){return"function"==typeof t?(r=t,t=new u.Root):t||(t=new u.Root),t.parseFromPbString(e,r)},l();var d,h=u,p=r(570),f=r.n(p),m=function(){function e(e){this.type=e.type,this.message=e.message,this.data=e.data}return e.create=function(t){return new e(t)},e}();!function(e){e[e.REQUEST_SUCCESS=0]="REQUEST_SUCCESS",e[e.REQUEST_TIMEOUT=-1]="REQUEST_TIMEOUT",e[e.REQUEST_UNKNOWN=-2]="REQUEST_UNKNOWN",e[e.REQUEST_PARAMETER_ERROR=-3]="REQUEST_PARAMETER_ERROR",e[e.REQUEST_ABORT=-4]="REQUEST_ABORT",e[e.WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR=0]="WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_OPEN_ERROR=1]="WEBIM_CONNCTION_OPEN_ERROR",e[e.WEBIM_CONNCTION_AUTH_ERROR=2]="WEBIM_CONNCTION_AUTH_ERROR",e[e.WEBIM_CONNCTION_OPEN_USERGRID_ERROR=3]="WEBIM_CONNCTION_OPEN_USERGRID_ERROR",e[e.WEBIM_CONNCTION_ATTACH_ERROR=4]="WEBIM_CONNCTION_ATTACH_ERROR",e[e.WEBIM_CONNCTION_ATTACH_USERGRID_ERROR=5]="WEBIM_CONNCTION_ATTACH_USERGRID_ERROR",e[e.WEBIM_CONNCTION_REOPEN_ERROR=6]="WEBIM_CONNCTION_REOPEN_ERROR",e[e.WEBIM_CONNCTION_SERVER_CLOSE_ERROR=7]="WEBIM_CONNCTION_SERVER_CLOSE_ERROR",e[e.WEBIM_CONNCTION_SERVER_ERROR=8]="WEBIM_CONNCTION_SERVER_ERROR",e[e.WEBIM_CONNCTION_IQ_ERROR=9]="WEBIM_CONNCTION_IQ_ERROR",e[e.WEBIM_CONNCTION_PING_ERROR=10]="WEBIM_CONNCTION_PING_ERROR",e[e.WEBIM_CONNCTION_NOTIFYVERSION_ERROR=11]="WEBIM_CONNCTION_NOTIFYVERSION_ERROR",e[e.WEBIM_CONNCTION_GETROSTER_ERROR=12]="WEBIM_CONNCTION_GETROSTER_ERROR",e[e.WEBIM_CONNCTION_CROSSDOMAIN_ERROR=13]="WEBIM_CONNCTION_CROSSDOMAIN_ERROR",e[e.WEBIM_CONNCTION_LISTENING_OUTOF_MAXRETRIES=14]="WEBIM_CONNCTION_LISTENING_OUTOF_MAXRETRIES",e[e.WEBIM_CONNCTION_RECEIVEMSG_CONTENTERROR=15]="WEBIM_CONNCTION_RECEIVEMSG_CONTENTERROR",e[e.WEBIM_CONNCTION_DISCONNECTED=16]="WEBIM_CONNCTION_DISCONNECTED",e[e.WEBIM_CONNCTION_AJAX_ERROR=17]="WEBIM_CONNCTION_AJAX_ERROR",e[e.WEBIM_CONNCTION_JOINROOM_ERROR=18]="WEBIM_CONNCTION_JOINROOM_ERROR",e[e.WEBIM_CONNCTION_GETROOM_ERROR=19]="WEBIM_CONNCTION_GETROOM_ERROR",e[e.WEBIM_CONNCTION_GETROOMINFO_ERROR=20]="WEBIM_CONNCTION_GETROOMINFO_ERROR",e[e.WEBIM_CONNCTION_GETROOMMEMBER_ERROR=21]="WEBIM_CONNCTION_GETROOMMEMBER_ERROR",e[e.WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR=22]="WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR",e[e.WEBIM_CONNCTION_LOAD_CHATROOM_ERROR=23]="WEBIM_CONNCTION_LOAD_CHATROOM_ERROR",e[e.WEBIM_CONNCTION_NOT_SUPPORT_CHATROOM_ERROR=24]="WEBIM_CONNCTION_NOT_SUPPORT_CHATROOM_ERROR",e[e.WEBIM_CONNCTION_JOINCHATROOM_ERROR=25]="WEBIM_CONNCTION_JOINCHATROOM_ERROR",e[e.WEBIM_CONNCTION_QUITCHATROOM_ERROR=26]="WEBIM_CONNCTION_QUITCHATROOM_ERROR",e[e.WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR=27]="WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR=28]="WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_SESSIONID_NOT_ASSIGN_ERROR=29]="WEBIM_CONNCTION_SESSIONID_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_RID_NOT_ASSIGN_ERROR=30]="WEBIM_CONNCTION_RID_NOT_ASSIGN_ERROR",e[e.WEBIM_CONNCTION_CALLBACK_INNER_ERROR=31]="WEBIM_CONNCTION_CALLBACK_INNER_ERROR",e[e.WEBIM_CONNCTION_CLIENT_OFFLINE=32]="WEBIM_CONNCTION_CLIENT_OFFLINE",e[e.WEBIM_CONNCTION_CLIENT_LOGOUT=33]="WEBIM_CONNCTION_CLIENT_LOGOUT",e[e.WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR=34]="WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR",e[e.WEBIM_CONNECTION_ACCEPT_INVITATION_FROM_GROUP=35]="WEBIM_CONNECTION_ACCEPT_INVITATION_FROM_GROUP",e[e.WEBIM_CONNECTION_DECLINE_INVITATION_FROM_GROUP=36]="WEBIM_CONNECTION_DECLINE_INVITATION_FROM_GROUP",e[e.WEBIM_CONNECTION_ACCEPT_JOIN_GROUP=37]="WEBIM_CONNECTION_ACCEPT_JOIN_GROUP",e[e.WEBIM_CONNECTION_DECLINE_JOIN_GROUP=38]="WEBIM_CONNECTION_DECLINE_JOIN_GROUP",e[e.WEBIM_CONNECTION_CLOSED=39]="WEBIM_CONNECTION_CLOSED",e[e.WEBIM_CONNECTION_ERROR=40]="WEBIM_CONNECTION_ERROR",e[e.MAX_LIMIT=50]="MAX_LIMIT",e[e.MESSAGE_NOT_FOUND=51]="MESSAGE_NOT_FOUND",e[e.NO_PERMISSION=52]="NO_PERMISSION",e[e.OPERATION_UNSUPPORTED=53]="OPERATION_UNSUPPORTED",e[e.OPERATION_NOT_ALLOWED=54]="OPERATION_NOT_ALLOWED",e[e.WEBIM_TOKEN_EXPIRED=56]="WEBIM_TOKEN_EXPIRED",e[e.WEBIM_SERVER_SERVING_DISABLED=57]="WEBIM_SERVER_SERVING_DISABLED",e[e.WEBIM_UPLOADFILE_BROWSER_ERROR=100]="WEBIM_UPLOADFILE_BROWSER_ERROR",e[e.WEBIM_UPLOADFILE_ERROR=101]="WEBIM_UPLOADFILE_ERROR",e[e.WEBIM_UPLOADFILE_NO_LOGIN=102]="WEBIM_UPLOADFILE_NO_LOGIN",e[e.WEBIM_UPLOADFILE_NO_FILE=103]="WEBIM_UPLOADFILE_NO_FILE",e[e.WEBIM_DOWNLOADFILE_ERROR=200]="WEBIM_DOWNLOADFILE_ERROR",e[e.WEBIM_DOWNLOADFILE_NO_LOGIN=201]="WEBIM_DOWNLOADFILE_NO_LOGIN",e[e.WEBIM_DOWNLOADFILE_BROWSER_ERROR=202]="WEBIM_DOWNLOADFILE_BROWSER_ERROR",e[e.PARSE_FILE_ERROR=203]="PARSE_FILE_ERROR",e[e.USER_NOT_FOUND=204]="USER_NOT_FOUND",e[e.MESSAGE_PARAMETER_ERROR=205]="MESSAGE_PARAMETER_ERROR",e[e.WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE=206]="WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE",e[e.WEBIM_CONNCTION_USER_REMOVED=207]="WEBIM_CONNCTION_USER_REMOVED",e[e.WEBIM_USER_ALREADY_LOGIN=208]="WEBIM_USER_ALREADY_LOGIN",e[e.USER_LOGIN_TOO_MANY_DEVICES=214]="USER_LOGIN_TOO_MANY_DEVICES",e[e.WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD=216]="WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD",e[e.WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE=217]="WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE",e[e.USER_MUTED_BY_ADMIN=219]="USER_MUTED_BY_ADMIN",e[e.USER_DEVICE_CHANGED=220]="USER_DEVICE_CHANGED",e[e.USER_NOT_FRIEND=221]="USER_NOT_FRIEND",e[e.WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION=222]="WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION",e[e.WEBIM_DOWNLOADFILE_ERROR_EXPIRED=223]="WEBIM_DOWNLOADFILE_ERROR_EXPIRED",e[e.WEBIM_MESSAGE_REC_TEXT=300]="WEBIM_MESSAGE_REC_TEXT",e[e.WEBIM_MESSAGE_REC_TEXT_ERROR=301]="WEBIM_MESSAGE_REC_TEXT_ERROR",e[e.WEBIM_MESSAGE_REC_EMOTION=302]="WEBIM_MESSAGE_REC_EMOTION",e[e.WEBIM_MESSAGE_REC_PHOTO=303]="WEBIM_MESSAGE_REC_PHOTO",e[e.SERVER_GET_DNSLIST_FAILED=304]="SERVER_GET_DNSLIST_FAILED",e[e.WEBIM_MESSAGE_REC_AUDIO_FILE=305]="WEBIM_MESSAGE_REC_AUDIO_FILE",e[e.WEBIM_MESSAGE_REC_VEDIO=306]="WEBIM_MESSAGE_REC_VEDIO",e[e.WEBIM_MESSAGE_REC_VEDIO_FILE=307]="WEBIM_MESSAGE_REC_VEDIO_FILE",e[e.WEBIM_MESSAGE_REC_FILE=308]="WEBIM_MESSAGE_REC_FILE",e[e.WEBIM_MESSAGE_SED_TEXT=309]="WEBIM_MESSAGE_SED_TEXT",e[e.WEBIM_MESSAGE_SED_EMOTION=310]="WEBIM_MESSAGE_SED_EMOTION",e[e.WEBIM_MESSAGE_SED_PHOTO=311]="WEBIM_MESSAGE_SED_PHOTO",e[e.WEBIM_MESSAGE_SED_AUDIO=312]="WEBIM_MESSAGE_SED_AUDIO",e[e.WEBIM_MESSAGE_SED_AUDIO_FILE=313]="WEBIM_MESSAGE_SED_AUDIO_FILE",e[e.WEBIM_MESSAGE_SED_VEDIO=314]="WEBIM_MESSAGE_SED_VEDIO",e[e.WEBIM_MESSAGE_SED_VEDIO_FILE=315]="WEBIM_MESSAGE_SED_VEDIO_FILE",e[e.WEBIM_MESSAGE_SED_FILE=316]="WEBIM_MESSAGE_SED_FILE",e[e.WEBIM_MESSAGE_SED_ERROR=317]="WEBIM_MESSAGE_SED_ERROR",e[e.STATUS_INIT=400]="STATUS_INIT",e[e.STATUS_DOLOGIN_USERGRID=401]="STATUS_DOLOGIN_USERGRID",e[e.STATUS_DOLOGIN_IM=402]="STATUS_DOLOGIN_IM",e[e.STATUS_OPENED=403]="STATUS_OPENED",e[e.STATUS_CLOSING=404]="STATUS_CLOSING",e[e.STATUS_CLOSED=405]="STATUS_CLOSED",e[e.STATUS_ERROR=406]="STATUS_ERROR",e[e.FILE_INVALID=407]="FILE_INVALID",e[e.FILE_DURATION_TOO_LONG=408]="FILE_DURATION_TOO_LONG",e[e.FILE_VOICE_TO_TEXT_FAILED=409]="FILE_VOICE_TO_TEXT_FAILED",e[e.FILE_NOT_FOUND=410]="FILE_NOT_FOUND",e[e.FILE_TOO_LARGE=411]="FILE_TOO_LARGE",e[e.SERVER_BUSY=500]="SERVER_BUSY",e[e.MESSAGE_INCLUDE_ILLEGAL_CONTENT=501]="MESSAGE_INCLUDE_ILLEGAL_CONTENT",e[e.MESSAGE_EXTERNAL_LOGIC_BLOCKED=502]="MESSAGE_EXTERNAL_LOGIC_BLOCKED",e[e.SERVER_UNKNOWN_ERROR=503]="SERVER_UNKNOWN_ERROR",e[e.MESSAGE_RECALL_TIME_LIMIT=504]="MESSAGE_RECALL_TIME_LIMIT",e[e.SERVICE_NOT_ENABLED=505]="SERVICE_NOT_ENABLED",e[e.SERVICE_NOT_ALLOW_MESSAGING=506]="SERVICE_NOT_ALLOW_MESSAGING",e[e.SERVICE_NOT_ALLOW_MESSAGING_MUTE=507]="SERVICE_NOT_ALLOW_MESSAGING_MUTE",e[e.MESSAGE_MODERATION_BLOCKED=508]="MESSAGE_MODERATION_BLOCKED",e[e.MESSAGE_CURRENT_LIMITING=509]="MESSAGE_CURRENT_LIMITING",e[e.MESSAGE_WEBSOCKET_DISCONNECTED=510]="MESSAGE_WEBSOCKET_DISCONNECTED",e[e.MESSAGE_SIZE_LIMIT=511]="MESSAGE_SIZE_LIMIT",e[e.MESSAGE_SEND_TIMEOUT=512]="MESSAGE_SEND_TIMEOUT",e[e.MESSAGE_STREAM_INTERVAL_TIMEOUT=513]="MESSAGE_STREAM_INTERVAL_TIMEOUT",e[e.MESSAGE_STREAM_TIMEOUT=514]="MESSAGE_STREAM_TIMEOUT",e[e.GROUP_NOT_EXIST=605]="GROUP_NOT_EXIST",e[e.GROUP_NOT_JOINED=602]="GROUP_NOT_JOINED",e[e.GROUP_MEMBERS_FULL=606]="GROUP_MEMBERS_FULL",e[e.PERMISSION_DENIED=603]="PERMISSION_DENIED",e[e.WEBIM_LOAD_MSG_ERROR=604]="WEBIM_LOAD_MSG_ERROR",e[e.GROUP_ALREADY_JOINED=601]="GROUP_ALREADY_JOINED",e[e.GROUP_MEMBERS_LIMIT=607]="GROUP_MEMBERS_LIMIT",e[e.GROUP_IS_DISABLED=608]="GROUP_IS_DISABLED",e[e.GROUP_MEMBER_ATTRIBUTES_SET_FAILED=609]="GROUP_MEMBER_ATTRIBUTES_SET_FAILED",e[e.REST_PARAMS_STATUS=700]="REST_PARAMS_STATUS",e[e.CHATROOM_NOT_JOINED=702]="CHATROOM_NOT_JOINED",e[e.CHATROOM_MEMBERS_FULL=704]="CHATROOM_MEMBERS_FULL",e[e.CHATROOM_NOT_EXIST=705]="CHATROOM_NOT_EXIST",e[e.LOCAL_DB_OPERATION_FAILED=800]="LOCAL_DB_OPERATION_FAILED",e[e.SDK_RUNTIME_ERROR=999]="SDK_RUNTIME_ERROR",e[e.PRESENCE_PARAM_EXCEED=1100]="PRESENCE_PARAM_EXCEED",e[e.REACTION_ALREADY_ADDED=1101]="REACTION_ALREADY_ADDED",e[e.REACTION_CREATING=1102]="REACTION_CREATING",e[e.REACTION_OPERATION_IS_ILLEGAL=1103]="REACTION_OPERATION_IS_ILLEGAL",e[e.TRANSLATION_NOT_VALID=1200]="TRANSLATION_NOT_VALID",e[e.TRANSLATION_TEXT_TOO_LONG=1201]="TRANSLATION_TEXT_TOO_LONG",e[e.TRANSLATION_FAILED=1204]="TRANSLATION_FAILED",e[e.THREAD_NOT_EXIST=1300]="THREAD_NOT_EXIST",e[e.THREAD_ALREADY_EXIST=1301]="THREAD_ALREADY_EXIST",e[e.MODIFY_MESSAGE_NOT_EXIST=1302]="MODIFY_MESSAGE_NOT_EXIST",e[e.MODIFY_MESSAGE_FORMAT_ERROR=1303]="MODIFY_MESSAGE_FORMAT_ERROR",e[e.MODIFY_MESSAGE_FAILED=1304]="MODIFY_MESSAGE_FAILED",e[e.CONVERSATION_NOT_EXIST=1400]="CONVERSATION_NOT_EXIST"}(d||(d={}));var g,v,E,y,_,T,I,O=function(){return O=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},O.apply(this,arguments)},R=function(e,t,r,n){var o,i,a,s,c,u,l,h,p,f,m,g,v,E,y,_,T,I,R,C,S,N,b,A,M,w,U,L,P,D,k,x=e.response;x&&"string"==typeof x&&(x=JSON.parse(x));var B=e.status,G={elapse:n,httpCode:B,errDesc:null==x?void 0:x.error_description};if(400===B){if(4000005===x.error_code||4000006===x.error_code)return void t({type:d.REQUEST_PARAMETER_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});if(40002===x.error_code)return void t({type:d.THREAD_ALREADY_EXIST,message:null==x?void 0:x.error_description,extraInfo:G});if(40009===x.error_code)return void t({type:d.OPERATION_UNSUPPORTED,message:null==x?void 0:x.error_description,extraInfo:G});if(60005===x.error_code)return void t({type:d.GROUP_MEMBER_ATTRIBUTES_SET_FAILED,message:(null==x?void 0:x.desc)||(null==x?void 0:x.error_description),extraInfo:G});if(60010===x.error_code)return void((null===(o=null==x?void 0:x.error_description)||void 0===o?void 0:o.includes("exceeds chatgroup user metadata single value limit"))?t({type:d.MAX_LIMIT,message:(null==x?void 0:x.desc)||x.error_description,extraInfo:G}):t({type:d.NO_PERMISSION,message:(null==x?void 0:x.desc)||x.error_description,extraInfo:G}));if(60011===x.error_code)return void t({type:d.CHATROOM_NOT_JOINED,message:null==x?void 0:x.desc,extraInfo:G});if(14403===x.error_code)return void t({type:d.WEBIM_UPLOADFILE_ERROR,message:null==x?void 0:x.error_description,data:x,extraInfo:G});if(60006===x.error_code||60007===x.error_code||60009===x.error_code||60012===x.error_code)return void t({type:d.MAX_LIMIT,message:(null==x?void 0:x.desc)||(null==x?void 0:x.error_description),extraInfo:G});if(91104===x.error_code)return void t({type:d.NO_PERMISSION,message:null==x?void 0:x.error_description,extraInfo:G});if(null===(i=x.error_description)||void 0===i?void 0:i.includes("are not members of this group"))return(null===(a=e.responseURL)||void 0===a?void 0:a.includes("chatgroups"))?t({type:d.GROUP_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.CHATROOM_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}),void r({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:null==x?void 0:x.error_description,data:e.responseText,extraInfo:G});if("the app not open presence"===(null==x?void 0:x.result))return void t({type:d.SERVICE_NOT_ENABLED,message:null==x?void 0:x.result,extraInfo:G});if(null===(s=null==x?void 0:x.error_description)||void 0===s?void 0:s.includes("remark length must less"))return void t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G});switch(null==x?void 0:x.error_description){case"the user is already operation this message":t({type:d.REACTION_ALREADY_ADDED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The quantity has exceeded the limit!":t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The user not in this group!":t({type:d.GROUP_NOT_JOINED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"the user operation is illegal!":t({type:d.REACTION_OPERATION_IS_ILLEGAL,message:null==x?void 0:x.error_description,extraInfo:G});break;case"this appKey is not open reaction service!":case"this appKey not open message roaming":t({type:d.SERVICE_NOT_ENABLED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"this message is creating reaction, please try again.":t({type:d.REACTION_CREATING,message:null==x?void 0:x.error_description,extraInfo:G});break;case"groupId can not be null!":t({type:d.GROUP_NOT_EXIST,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The input text is too long.":t({type:d.TRANSLATION_TEXT_TOO_LONG,message:null==x?void 0:x.error_description,extraInfo:G});break;case"The target language is not valid.":t({type:d.TRANSLATION_NOT_VALID,message:null==x?void 0:x.error_description,extraInfo:G});break;case"report failed, get message by id failed":t({type:d.MESSAGE_NOT_FOUND,message:null==x?void 0:x.error_description,extraInfo:G});break;case"ext is too big ":t({type:d.PRESENCE_PARAM_EXCEED,message:null==x?void 0:x.error_description,extraInfo:G});break;case"Request body not readable.Please check content type is correct!":case"param mark must be not empty, please check!":case"param mark illegal, please check it!":case"param pin_msg_id illegal, please check it!":t({type:d.REQUEST_PARAMETER_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});break;case"updateRemark | they are not friends, please add as a friend first.":t({type:d.USER_NOT_FRIEND,message:null==x?void 0:x.error_description,extraInfo:G});break;default:t({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:null==x?void 0:x.error_description,data:e.responseText,extraInfo:G}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:null==x?void 0:x.error_description,data:e.responseText,extraInfo:G})}}else if(401===B)4010101===x.error_code?t({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G}):40001===x.error_code||60001===x.error_code||"Unable to authenticate (OAuth)"===x.error_description?t({type:d.NO_PERMISSION,message:null==x?void 0:x.error_description,extraInfo:G}):(r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:G}),t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:G}));else if(403===B)(null===(c=e.responseURL)||void 0===c?void 0:c.includes("/chatgroups/"))&&(null===(u=e.responseURL)||void 0===u?void 0:u.includes("/invite"))&&(null===(l=x.error_description)||void 0===l?void 0:l.includes("doesn't exist"))?t({type:d.USER_NOT_FOUND,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):4e4===x.error_code||60004===x.error_code||15002===x.error_code||4030204===x.error_code?t({type:d.SERVICE_NOT_ENABLED,message:null==x?void 0:x.error_description,extraInfo:G}):40003===x.error_code||40004===x.error_code?t({type:d.THREAD_ALREADY_EXIST,message:null==x?void 0:x.error_description,extraInfo:G}):40005===x.error_code||40007===x.error_code||91002===x.error_code?t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G}):60002===x.error_code?t({type:d.PERMISSION_DENIED,message:null==x?void 0:x.error_description,extraInfo:G}):91101===x.error_code?t({type:d.MAX_LIMIT,message:null==x?void 0:x.error_description,extraInfo:G}):91102===x.error_code&&t({type:d.REQUEST_PARAMETER_ERROR,message:x.error_description,extraInfo:G}),"group member list is full!"===x.error_description?(null===(h=e.responseURL)||void 0===h?void 0:h.includes("chatgroups"))?t({type:d.GROUP_MEMBERS_FULL,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.CHATROOM_MEMBERS_FULL,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(p=x.error_description)||void 0===p?void 0:p.includes("invite users to join group failed"))&&(null===(f=x.error_description)||void 0===f?void 0:f.includes("already in group"))?(null===(m=e.responseURL)||void 0===m?void 0:m.includes("chatgroups"))&&t({type:d.GROUP_ALREADY_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(g=x.error_description)||void 0===g?void 0:g.includes("are not members of this group"))?(null===(v=e.responseURL)||void 0===v?void 0:v.includes("chatgroups"))?t({type:d.GROUP_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.CHATROOM_NOT_JOINED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(E=x.error_description)||void 0===E?void 0:E.includes("service not open!"))||(null===(y=x.error_description)||void 0===y?void 0:y.includes("message report not open"))||(null===(_=x.error_description)||void 0===_?void 0:_.includes("messageroaming function not open"))?t({type:d.SERVICE_NOT_ENABLED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(T=x.error_description)||void 0===T?void 0:T.includes("members size is greater than max user size !"))?t({type:d.GROUP_MEMBERS_LIMIT,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(I=x.error_description)||void 0===I?void 0:I.includes("can not operate this group, reason: group is disabled"))?t({type:d.GROUP_IS_DISABLED,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(R=x.error_description)||void 0===R?void 0:R.includes("Invitee's contact max count"))||(null===(C=x.error_description)||void 0===C?void 0:C.includes("Inviter's contact max count"))?t({type:d.MAX_LIMIT,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):t({type:d.PERMISSION_DENIED,data:e.response||e.responseText,message:"permission denied",extraInfo:O(O({},G),{errDesc:"permission denied"})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:G});else if(404===B){if(4040302===x.error_code)return void t({type:d.WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});40011===x.error_code?t({type:d.THREAD_NOT_EXIST,message:null==x?void 0:x.error_description,extraInfo:G}):40012===x.error_code?t({type:d.NO_PERMISSION,message:null==x?void 0:x.error_description,extraInfo:G}):60003===x.error_code||20004===x.error_code?t({type:d.GROUP_NOT_JOINED,message:null==x?void 0:x.error_description,extraInfo:G}):91001===x.error_code&&t({type:d.CONVERSATION_NOT_EXIST,message:null==x?void 0:x.error_description,extraInfo:G}),(null===(S=x.error_description)||void 0===S?void 0:S.includes("do not find this group"))||(null===(N=x.error_description)||void 0===N?void 0:N.includes("does not exist"))?(null===(b=e.responseURL)||void 0===b?void 0:b.includes("chatgroups"))?t({type:d.GROUP_NOT_EXIST,data:e.response||e.responseText,message:"The chat room dose not exist.",extraInfo:O(O({},G),{errDesc:"The chat room dose not exist."})}):t({type:d.CHATROOM_NOT_EXIST,data:e.response||e.responseText,message:"The chat room dose not exist.",extraInfo:O(O({},G),{errDesc:"The chat room dose not exist."})}):(null===(A=x.error_description)||void 0===A?void 0:A.includes("username"))&&(null===(M=x.error_description)||void 0===M?void 0:M.includes("doesn't exist!'"))||(null===(w=x.error_description)||void 0===w?void 0:w.includes("user not found"))||(null===(U=x.error_description)||void 0===U?void 0:U.includes("Service resource not found"))&&"UserNotFoundException"===(null==x?void 0:x.exception)?t({type:d.USER_NOT_FOUND,data:e.response||e.responseText,message:x.error_description,extraInfo:G}):(null===(L=x.error_description)||void 0===L?void 0:L.includes("user session pin message not exist"))?t({type:d.MESSAGE_NOT_FOUND,message:x.error_description,extraInfo:G}):t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.response||e.responseText,message:e.responseText,extraInfo:G}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.response||e.responseText,message:e.responseText,extraInfo:G})}else if(406===B)90004===x.error_code&&t({type:d.OPERATION_NOT_ALLOWED,message:null==x?void 0:x.error_description,extraInfo:G});else if(429===B||503===B){if(null===(P=x.error_description)||void 0===P?void 0:P.includes("The request has reached the maximum limit"))return void t({type:d.MAX_LIMIT,message:e.responseText,extraInfo:G});if(null===(D=x.error_description)||void 0===D?void 0:D.includes("upload client logs reached limit"))return void t({type:d.MAX_LIMIT,message:e.responseText});t({type:d.SERVER_BUSY,data:e.response||e.responseText,message:"Server is busy.",extraInfo:O(O({},G),{errDesc:"Server is busy."})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:"Server is busy.",extraInfo:O(O({},G),{errDesc:"Server is busy."})})}else if(500===B){if(40006===x.error_code||40008===x.error_code||40010===x.error_code||5000701===x.error_code)return void t({type:d.SERVER_UNKNOWN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});if(90005===x.error_code||99999===x.error_code)return void t({type:d.REQUEST_UNKNOWN,message:null==x?void 0:x.error_description,extraInfo:G});if(null===(k=x.error_description)||void 0===k?void 0:k.includes("translte failed!"))return void t({type:d.TRANSLATION_FAILED,message:e.responseText,extraInfo:G});t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:"",extraInfo:G}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:"",extraInfo:G})}else if(502===B){if(5020801===x.error_code)return void t({type:d.SERVER_UNKNOWN_ERROR,message:null==x?void 0:x.error_description,extraInfo:G});t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})})}else t({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})}),r({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:e.responseText,message:e.responseText,extraInfo:O(O({},G),{errDesc:"ajax error"})})};!function(e){e[e.UNKNOWOPERATION=-1]="UNKNOWOPERATION",e[e.REST_GET_SESSION_LIST=1]="REST_GET_SESSION_LIST",e[e.REST_DEL_SESSION=2]="REST_DEL_SESSION",e[e.REST_GET_HISTORY_MESSAGE=3]="REST_GET_HISTORY_MESSAGE",e[e.REST_PIN_CONVERSATION=4]="REST_PIN_CONVERSATION",e[e.REST_MARK_CONVERSATION=5]="REST_MARK_CONVERSATION",e[e.REST_UPLOAD_FILE_IN_PARTS=6]="REST_UPLOAD_FILE_IN_PARTS",e[e.REST_DELETE_MESSAGES_CONVERSATIONS=7]="REST_DELETE_MESSAGES_CONVERSATIONS",e[e.REST_PIN_MESSAGE=8]="REST_PIN_MESSAGE",e[e.REST_FETCH_PINMESSAGES=9]="REST_FETCH_PINMESSAGES",e[e.REST_FETCH_CONVERSATIONS=10]="REST_FETCH_CONVERSATIONS",e[e.REST_OPERATE=100]="REST_OPERATE",e[e.MSYNC_SENDMESSAGE=101]="MSYNC_SENDMESSAGE",e[e.MSYNC_RECALLMESSAGE=102]="MSYNC_RECALLMESSAGE",e[e.MSYNC_MODIFYMESSAGE=103]="MSYNC_MODIFYMESSAGE",e[e.MSYNC_OPERATE=200]="MSYNC_OPERATE",e[e.ROSTER_ADD=201]="ROSTER_ADD",e[e.ROSTER_REMOVE=202]="ROSTER_REMOVE",e[e.ROSTER_ACCEPT=203]="ROSTER_ACCEPT",e[e.ROSTER_DECLINE=204]="ROSTER_DECLINE",e[e.ROSTER_BAN=205]="ROSTER_BAN",e[e.ROSTER_ALLOW=206]="ROSTER_ALLOW",e[e.ROSTER_BLACKLIST=207]="ROSTER_BLACKLIST",e[e.ROSTER_CONTACTS=208]="ROSTER_CONTACTS",e[e.ROSTER_GET_ALL_CONTACTS_REMARKS=209]="ROSTER_GET_ALL_CONTACTS_REMARKS",e[e.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE=210]="ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE",e[e.ROSTER_SET_CONTACT_REMARK=211]="ROSTER_SET_CONTACT_REMARK",e[e.ROSTER_OPERATE=300]="ROSTER_OPERATE",e[e.USER_LOGIN=301]="USER_LOGIN",e[e.USER_CREATE=302]="USER_CREATE",e[e.USER_UPDATE_USERINFO=303]="USER_UPDATE_USERINFO",e[e.USER_FETCH_USERINFO=304]="USER_FETCH_USERINFO",e[e.USER_UPDATE_NICK=305]="USER_UPDATE_NICK",e[e.USER_UPLOAD_PUSH_TOKEN=306]="USER_UPLOAD_PUSH_TOKEN",e[e.USER_LOGGEDIN_OTHER_PLATFORM=307]="USER_LOGGEDIN_OTHER_PLATFORM",e[e.USER_OPERATE=400]="USER_OPERATE",e[e.GROUP_CREATEGROUP=401]="GROUP_CREATEGROUP",e[e.GROUP_BLOCK_MESSAGE=402]="GROUP_BLOCK_MESSAGE",e[e.GROUP_FETCH_PUBLICGROUPS_WITHCURSOR=403]="GROUP_FETCH_PUBLICGROUPS_WITHCURSOR",e[e.GROUP_FETCH_USERS_GROUP=404]="GROUP_FETCH_USERS_GROUP",e[e.GROUP_CHANGE_OWNER=405]="GROUP_CHANGE_OWNER",e[e.GROUP_FETCH_SPECIFICATION=406]="GROUP_FETCH_SPECIFICATION",e[e.GROUP_CHANGE_GROUPATTRIBUTE=407]="GROUP_CHANGE_GROUPATTRIBUTE",e[e.GROUP_FETCH_MEMEBERS=408]="GROUP_FETCH_MEMEBERS",e[e.GROUP_GET_ADMIN=409]="GROUP_GET_ADMIN",e[e.GROUP_SET_ADMIN=410]="GROUP_SET_ADMIN",e[e.GROUP_REMOVE_ADMIN=411]="GROUP_REMOVE_ADMIN",e[e.GROUP_DESTOTYGROUP=412]="GROUP_DESTOTYGROUP",e[e.GROUP_LEAVEGROUP=413]="GROUP_LEAVEGROUP",e[e.GROUP_INVITE_TO_GROUP=414]="GROUP_INVITE_TO_GROUP",e[e.GROUP_JOIN_PUBLICGROUP=415]="GROUP_JOIN_PUBLICGROUP",e[e.GROUP_ACCEPT_JOINPUBLICGROUPAPPL=416]="GROUP_ACCEPT_JOINPUBLICGROUPAPPL",e[e.GROUP_DECLINE_JOINPUBLICGROUPAPPL=417]="GROUP_DECLINE_JOINPUBLICGROUPAPPL",e[e.GROUP_ACCEPT_INVITATION=418]="GROUP_ACCEPT_INVITATION",e[e.GROUP_DECLINE_INVITATION=419]="GROUP_DECLINE_INVITATION",e[e.GROUP_REMOVE_MEMBER=420]="GROUP_REMOVE_MEMBER",e[e.GROUP_REMOVE_MEMBERS=421]="GROUP_REMOVE_MEMBERS",e[e.GROUP_MUTE_MEMBERS=422]="GROUP_MUTE_MEMBERS",e[e.GROUP_UNMUTE_MEMBERS=423]="GROUP_UNMUTE_MEMBERS",e[e.GROUP_FETCH_MUTES=424]="GROUP_FETCH_MUTES",e[e.GROUP_BLOCK_MEMBER=425]="GROUP_BLOCK_MEMBER",e[e.GROUP_BLOCK_MEMBERS=426]="GROUP_BLOCK_MEMBERS",e[e.GROUP_UNBLOCK_MEMBER=427]="GROUP_UNBLOCK_MEMBER",e[e.GROUP_UNBLOCK_MEMBERS=428]="GROUP_UNBLOCK_MEMBERS",e[e.GROUP_GET_BLOCK_LIST=429]="GROUP_GET_BLOCK_LIST",e[e.GROUP_MUTE_ALLMEMBERS=430]="GROUP_MUTE_ALLMEMBERS",e[e.GROUP_UNMUTE_ALLMEMBERS=431]="GROUP_UNMUTE_ALLMEMBERS",e[e.GROUP_ADD_WHITELIST=432]="GROUP_ADD_WHITELIST",e[e.GROUP_REMOVE_WHITELIST=433]="GROUP_REMOVE_WHITELIST",e[e.GROUP_FETCH_WHITELIST=434]="GROUP_FETCH_WHITELIST",e[e.GROUP_IS_IN_WHITELIST=435]="GROUP_IS_IN_WHITELIST",e[e.GROUP_GET_READ_USERS=436]="GROUP_GET_READ_USERS",e[e.GROUP_FETCH_ANNOUNCEMENT=437]="GROUP_FETCH_ANNOUNCEMENT",e[e.GROUP_UPDATE_ANNOUNCEMENT=438]="GROUP_UPDATE_ANNOUNCEMENT",e[e.GROUP_UPLOAD_SHAREDFILE=439]="GROUP_UPLOAD_SHAREDFILE",e[e.GROUP_DELETE_SHAREDFILE=440]="GROUP_DELETE_SHAREDFILE",e[e.GROUP_FETCH_SHAREDFILE=441]="GROUP_FETCH_SHAREDFILE",e[e.GROUP_DOWNLOAD_SHAREDFILE=442]="GROUP_DOWNLOAD_SHAREDFILE",e[e.GROUP_MEMBER_SET_META_DATA=443]="GROUP_MEMBER_SET_META_DATA",e[e.GROUP_MEMBER_FETCH_META_DATA=444]="GROUP_MEMBER_FETCH_META_DATA",e[e.GROUP_OPERATE=500]="GROUP_OPERATE",e[e.CHATROOM_FETCH_CHATROOMSWITHPAGE=501]="CHATROOM_FETCH_CHATROOMSWITHPAGE",e[e.CHATROOM_CREATECHATROOM=502]="CHATROOM_CREATECHATROOM",e[e.CHATROOM_DESTORYCHATROOM=503]="CHATROOM_DESTORYCHATROOM",e[e.CHATROOM_FETCH_SPECIFICATION=504]="CHATROOM_FETCH_SPECIFICATION",e[e.CHATROOM_CHANGE_ATTRIBUTE=505]="CHATROOM_CHANGE_ATTRIBUTE",e[e.CHATROOM_REMOVE_MEMBER=506]="CHATROOM_REMOVE_MEMBER",e[e.CHATROOM_REMOVE_MEMBERS=507]="CHATROOM_REMOVE_MEMBERS",e[e.CHATROOM_ADD_MEMBERS=508]="CHATROOM_ADD_MEMBERS",e[e.CHATROOM_JOINCAHTROOM=509]="CHATROOM_JOINCAHTROOM",e[e.CHATROOM_LEAVECAHTROOM=510]="CHATROOM_LEAVECAHTROOM",e[e.CHATROOM_FETCH_MEMBERS=511]="CHATROOM_FETCH_MEMBERS",e[e.CHATROOM_GET_ADMIN=512]="CHATROOM_GET_ADMIN",e[e.CHATROOM_SET_ADMIN=513]="CHATROOM_SET_ADMIN",e[e.CHATROOM_REMOVE_ADMIN=514]="CHATROOM_REMOVE_ADMIN",e[e.CHATROOM_MUTE_USER=515]="CHATROOM_MUTE_USER",e[e.CHATROOM_UNMUTE_USER=516]="CHATROOM_UNMUTE_USER",e[e.CHATROOM_FETCH_MUTES=517]="CHATROOM_FETCH_MUTES",e[e.CHATROOM_BLOCK_USER=518]="CHATROOM_BLOCK_USER",e[e.CHATROOM_BLOCK_USERS=519]="CHATROOM_BLOCK_USERS",e[e.CHATROOM_UNBLOCK_USER=520]="CHATROOM_UNBLOCK_USER",e[e.CHATROOM_UNBLOCK_USERS=521]="CHATROOM_UNBLOCK_USERS",e[e.CHATROOM_FETCH_BANS=522]="CHATROOM_FETCH_BANS",e[e.CHATROOM_MUTE_ALLMEMEBERS=523]="CHATROOM_MUTE_ALLMEMEBERS",e[e.CHATROOM_UNMUTE_ALLMEMEBERS=524]="CHATROOM_UNMUTE_ALLMEMEBERS",e[e.CHATROOM_ADD_WHITELIST=525]="CHATROOM_ADD_WHITELIST",e[e.CHATROOM_REMOVE_WHITELIST=526]="CHATROOM_REMOVE_WHITELIST",e[e.CHATROOM_FETCH_WHITELIST=527]="CHATROOM_FETCH_WHITELIST",e[e.CHATROOM_FETCH_MEMBERIN_WHITELIST=528]="CHATROOM_FETCH_MEMBERIN_WHITELIST",e[e.CHATROOM_FETCH_ANNOUNCEMENT=529]="CHATROOM_FETCH_ANNOUNCEMENT",e[e.CHATROOM_UPDATE_ANNOUNCEMENT=530]="CHATROOM_UPDATE_ANNOUNCEMENT",e[e.CHATROOM_REMOVE_SHARE_FILE=531]="CHATROOM_REMOVE_SHARE_FILE",e[e.CHATROOM_GET_SHARE_FILE_LIST=532]="CHATROOM_GET_SHARE_FILE_LIST",e[e.CHATROOM_UPLOAD_FILE=533]="CHATROOM_UPLOAD_FILE",e[e.CHATROOM_SET_META_DATA=534]="CHATROOM_SET_META_DATA",e[e.CHATROOM_DELETE_META_DATA=535]="CHATROOM_DELETE_META_DATA",e[e.CHATROOM_FETCH_META_DATA=536]="CHATROOM_FETCH_META_DATA",e[e.CHATROOM_FETCH_USER_JOINED_CHATROOM=537]="CHATROOM_FETCH_USER_JOINED_CHATROOM",e[e.CHATROOM_OPERATE=600]="CHATROOM_OPERATE"}(g||(g={})),function(e){e.SDK_INTERNAL="SDK_INTERNAL",e.LOGIN="USER_LOGIN",e.REGISTER="USER_CREATE",e.GET_CHATROOM_LIST="CHATROOM_FETCH_CHATROOMSWITHPAGE",e.CREATE_CHATROOM="CHATROOM_CREATECHATROOM",e.DESTROY_CHATROOM="CHATROOM_DESTORYCHATROOM",e.GET_CHATROOM_DETAIL="CHATROOM_FETCH_SPECIFICATION",e.MODIFY_CHATROOM="CHATROOM_CHANGE_ATTRIBUTE",e.REMOVE_CHATROOM_MEMBER="CHATROOM_REMOVE_MEMBER",e.MULTI_REMOVE_CHATROOM_MEMBER="CHATROOM_REMOVE_MEMBERS",e.ADD_USERS_TO_CHATROOM="CHATROOM_ADD_MEMBERS",e.JOIN_CHATROOM="CHATROOM_JOINCAHTROOM",e.QUIT_CHATROOM="CHATROOM_LEAVECAHTROOM",e.LIST_CHATROOM_MEMBERS="CHATROOM_FETCH_MEMBERS",e.GET_CHATROOM_ADMIN="CHATROOM_GET_ADMIN",e.SET_CHATROOM_ADMIN="CHATROOM_SET_ADMIN",e.REMOVE_CHATROOM_ADMIN="CHATROOM_REMOVE_ADMIN",e.MUTE_CHATROOM_MEMBER="CHATROOM_MUTE_USER",e.REMOVE_MUTE_CHATROOM_MEMBER="CHATROOM_UNMUTE_USER",e.GET_MUTE_CHATROOM_MEMBERS="CHATROOM_FETCH_MUTES",e.SET_CHATROOM_MEMBER_TO_BLACK="CHATROOM_BLOCK_USER",e.MULTI_SET_CHATROOM_MEMBER_TO_BLACK="CHATROOM_BLOCK_USERS",e.REMOVE_CHATROOM_MEMBER_BLACK="CHATROOM_UNBLOCK_USER",e.MULTI_REMOVE_CHATROOM_MEMBER_BLACK="CHATROOM_UNBLOCK_USERS",e.GET_CHATROOM_BLOCK_MEMBERS="CHATROOM_FETCH_BANS",e.DISABLED_CHATROOM_SEND_MSG="CHATROOM_MUTE_ALLMEMEBERS",e.ENABLE_CHATROOM_SEND_MSG="CHATROOM_UNMUTE_ALLMEMEBERS",e.ADD_CHATROOM_WHITE_USERS="CHATROOM_ADD_WHITELIST",e.REMOVE_CHATROOM_WHITE_USERS="CHATROOM_REMOVE_WHITELIST",e.GET_CHATROOM_WHITE_USERS="CHATROOM_FETCH_WHITELIST",e.CHECK_CHATROOM_WHITE_USER="CHATROOM_FETCH_MEMBERIN_WHITELIST",e.GET_CHATROOM_ANN="CHATROOM_FETCH_ANNOUNCEMENT",e.UPDATE_CHATROOM_ANN="CHATROOM_UPDATE_ANNOUNCEMENT",e.DELETE_CHATROOM_FILE="CHATROOM_REMOVE_SHARE_FILE",e.GET_CHATROOM_FILES="CHATROOM_GET_SHARE_FILE_LIST",e.UPLOAD_CHATROOM_FILE="CHATROOM_UPLOAD_FILE",e.SET_CHATROOM_ATTR="CHATROOM_SET_META_DATA",e.DELETE_CHATROOM_ATTR="CHATROOM_DELETE_META_DATA",e.GET_CHATROOM_ATTR="CHATROOM_FETCH_META_DATA",e.GET_USER_JOINED_CHATROOM="CHATROOM_FETCH_USER_JOINED_CHATROOM",e.CREATE_GROUP="GROUP_CREATEGROUP",e.BLOCK_GROUP="GROUP_BLOCK_MESSAGE",e.LIST_GROUP="GROUP_FETCH_PUBLICGROUPS_WITHCURSOR",e.GET_USER_GROUP="GROUP_FETCH_USERS_GROUP",e.CHANGE_OWNER="GROUP_CHANGE_OWNER",e.GET_GROUP_INFO="GROUP_FETCH_SPECIFICATION",e.MODIFY_GROUP="GROUP_CHANGE_GROUPATTRIBUTE",e.LIST_GROUP_MEMBER="GROUP_FETCH_MEMEBERS",e.GET_GROUP_ADMIN="GROUP_GET_ADMIN",e.SET_GROUP_ADMIN="GROUP_SET_ADMIN",e.REMOVE_GROUP_ADMIN="GROUP_REMOVE_ADMIN",e.DISSOLVE_GROUP="GROUP_DESTOTYGROUP",e.QUIT_GROUP="GROUP_LEAVEGROUP",e.INVITE_TO_GROUP="GROUP_INVITE_TO_GROUP",e.JOIN_GROUP="GROUP_JOIN_PUBLICGROUP",e.AGREE_JOIN_GROUP="GROUP_ACCEPT_JOINPUBLICGROUPAPPL",e.REJECT_JOIN_GROUP="GROUP_DECLINE_JOINPUBLICGROUPAPPL",e.AGREE_INVITE_GROUP="GROUP_ACCEPT_INVITATION",e.REJECT_INVITE_GROUP="GROUP_DECLINE_INVITATION",e.REMOVE_GROUP_MEMBER="GROUP_REMOVE_MEMBER",e.MULTI_REMOVE_GROUP_MEMBER="GROUP_REMOVE_MEMBERS",e.MUTE_GROUP_MEMBER="GROUP_MUTE_MEMBERS",e.UNMUTE_GROUP_MEMBER="GROUP_UNMUTE_MEMBERS",e.GET_GROUP_MUTE_LIST="GROUP_FETCH_MUTES",e.BLOCK_GROUP_MEMBER="GROUP_BLOCK_MEMBER",e.BLOCK_GROUP_MEMBERS="GROUP_BLOCK_MEMBERS",e.UNBLOCK_GROUP_MEMBER="GROUP_UNBLOCK_MEMBER",e.UNBLOCK_GROUP_MEMBERS="GROUP_UNBLOCK_MEMBERS",e.GET_GROUP_BLACK_LIST="GROUP_GET_BLOCK_LIST",e.DISABLED_SEND_GROUP_MSG="GROUP_MUTE_ALLMEMBERS",e.ENABLE_SEND_GROUP_MSG="GROUP_UNMUTE_ALLMEMBERS",e.ADD_USERS_TO_GROUP_WHITE="GROUP_ADD_WHITELIST",e.REMOVE_GROUP_WHITE_MEMBER="GROUP_REMOVE_WHITELIST",e.GET_GROUP_WHITE_LIST="GROUP_FETCH_WHITELIST",e.IS_IN_GROUP_WHITE_LIST="GROUP_IS_IN_WHITELIST",e.GET_GROUP_MSG_READ_USER="GROUP_GET_READ_USERS",e.GET_GROUP_ANN="GROUP_FETCH_ANNOUNCEMENT",e.UPDATE_GROUP_ANN="GROUP_UPDATE_ANNOUNCEMENT",e.UPLOAD_GROUP_FILE="GROUP_UPLOAD_SHAREDFILE",e.DELETE_GROUP_FILE="GROUP_DELETE_SHAREDFILE",e.GET_GROUP_FILE_LIST="GROUP_FETCH_SHAREDFILE",e.DOWN_GROUP_FILE="GROUP_DOWNLOAD_SHAREDFILE",e.SET_GROUP_MEMBER_ATTRS="GROUP_MEMBER_SET_META_DATA",e.GET_GROUP_MEMBER_ATTR="GROUP_MEMBER_FETCH_META_DATA",e.GET_SESSION_LIST="REST_GET_SESSION_LIST",e.REST_FETCH_CONVERSATIONS="REST_FETCH_CONVERSATIONS",e.DELETE_SESSION="REST_DEL_SESSION",e.GET_HISTORY_MSG="REST_GET_HISTORY_MESSAGE",e.PIN_CONVERSATION="REST_PIN_CONVERSATION",e.REST_UPLOAD_FILE_IN_PARTS="REST_UPLOAD_FILE_IN_PARTS",e.REST_DELETE_MESSAGES_CONVERSATIONS="REST_DELETE_MESSAGES_CONVERSATIONS",e.MARK_CONVERSATION="REST_MARK_CONVERSATION",e.REST_FETCH_PINMESSAGES="REST_FETCH_PINMESSAGES",e.REST_PIN_MESSAGE="REST_PIN_MESSAGE",e.UPDATE_USER_INFO="USER_UPDATE_USERINFO",e.GET_USER_INFO="USER_FETCH_USERINFO",e.UPDATE_USER_NICK="USER_UPDATE_NICK",e.UPLOAD_PUSH_TOKEN="USER_UPLOAD_PUSH_TOKEN",e.USER_LOGGEDIN_OTHER_PLATFORM="USER_LOGGEDIN_OTHER_PLATFORM",e.GET_BLACK_LIST="ROSTER_BLACKLIST",e.GET_CONTACTS="ROSTER_CONTACTS",e.ROSTER_GET_ALL_CONTACTS_REMARKS="ROSTER_GET_ALL_CONTACTS_REMARKS",e.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE="ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE",e.ROSTER_SET_CONTACT_REMARK="ROSTER_SET_CONTACT_REMARK",e.ROSTER_ADD="ROSTER_ADD",e.ROSTER_REMOVE="ROSTER_REMOVE",e.ROSTER_ACCEPT="ROSTER_ACCEPT",e.ROSTER_DECLINE="ROSTER_DECLINE",e.ROSTER_BAN="ROSTER_BAN",e.ROSTER_ALLOW="ROSTER_ALLOW",e.SEND_MSG="MSYNC_SENDMESSAGE",e.UPLOAD_MSG_ATTACH="UPLOAD_MSG_ATTACH",e.SEND_RECALL_MSG="MSYNC_RECALLMESSAGE",e.MODIFY_MESSAGE="MSYNC_MODIFYMESSAGE",e.REST_FETCHHISTORYMESSAGE="REST_FETCHHISTORYMESSAGE",e.REST_SEARCH_MESSAGES="REST_SEARCH_MESSAGES",e.MSYNC_SYNCOFFLINEMESSAGE="MSYNC_SYNCOFFLINEMESSAGE"}(v||(v={})),function(e){e.GET_DNS="REST_DNSLIST",e.LOGIN_BY_AGORA_TOKEN="LOGIN_BY_AGORA_TOKEN",e.LOGIN_BY_PWD="LOGIN_BY_PWD",e.RESISTER="REGISTER",e.REST_INIT_UPLOAD_TASK_IN_PARTS="REST_INIT_UPLOAD_TASK_IN_PARTS",e.REST_UPLOAD_PART="REST_UPLOAD_PART",e.REST_COMPLETE_UPLOAD_PART="REST_COMPLETE_UPLOAD_PART",e.REST_ABORT_UPLOAD_PART="REST_ABORT_UPLOAD_PART",e.CONNECT_WEBSOCKET="CONNECT_WEBSOCKET"}(E||(E={})),function(e){e[e["5G"]=7]="5G",e[e["4G"]=7]="4G",e[e["3G"]=7]="3G",e[e["2G"]=7]="2G",e[e["SLOW-2G"]=7]="SLOW-2G",e[e.WIFI=2]="WIFI",e[e.LAN=1]="LAN",e[e.DISCONNECTED=0]="DISCONNECTED",e[e.NONE=0]="NONE",e[e.UNKNOWN=-1]="UNKNOWN",e[e["WEBIM UNABLE TO GET"]=-2]="WEBIM UNABLE TO GET"}(y||(y={})),function(e){e[e.success=200]="success",e[e.failed=500]="failed",e[e.disconnect=-1]="disconnect",e[e.closed=401]="closed",e[e.notFound=404]="notFound",e[e.reachLimit=429]="reachLimit"}(_||(_={})),function(e){e[e.web=0]="web",e[e.native=1]="native"}(T||(T={})),function(e){e[e.singleChat=0]="singleChat",e[e.groupChat=1]="groupChat",e[e.chatRoom=2]="chatRoom"}(I||(I={}));var C=new Map,S=new Map,N=1e3,b=9675,A=-1;function M(){console.log&&(console.log.apply?console.log.apply(console,Array.prototype.slice.call(arguments)):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}var w,U="undefined"!=typeof window&&void 0!==window.navigator&&/Trident\/|MSIE /.test(window.navigator.userAgent),L=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},P=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},D=function(){},k={};!function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(w||(w={}));var x=function(){function e(e,t,r){this.name=e||"defaultLogger",this.currentLevel=0,this.useCookiePersist=!1,this.storageLogLevelKey="loglevel",this.levels=w,this.consoleLogVisibility=!0,this.logMethods=["trace","debug","info","warn","error"],this.methodFactory=r||this.defaultMethodFactory,this.report=!1;var n=this._getPersistedLevel();null==n&&(n=null===t?"WARN":t),this.logs=[],this.reportLogs=[],this.reportInterval=3e5,this.timer=null,this.config={useCache:!1,maxCache:3145728,color:"",background:""},this.logBytes=0,this.setLevel(n,!1,"")}return e.prototype.reportLog=function(){var e,t,r;return L(this,void 0,void 0,(function(){var n,o,i,a,s,c,u,l;return P(this,(function(d){switch(d.label){case 0:if(0===(null===(e=this.reportLogs)||void 0===e?void 0:e.length))return[2];for(n=2097152,o=this.reportLogs.join("\n")+"\n",i=o.length,a=[];i>n;)a.push(o.substring(0,n)),i-=n,o=o.substring(n);a.push(o),s=0,c=a,d.label=1;case 1:if(!(s<c.length))return[3,8];if(u=c[s],this.reportLogs=[],!(null===(r=null===(t=this.connection)||void 0===t?void 0:t.context)||void 0===r?void 0:r.accessToken))return[2];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,this.reportData(u)];case 3:return"ok"!==(null==(l=d.sent())?void 0:l.status)&&this.reportLogs.unshift(u),[3,5];case 4:return d.sent(),this.reportLogs.unshift(u),[3,5];case 5:return[4,_e.delay(3e3)];case 6:d.sent(),d.label=7;case 7:return s++,[3,1];case 8:return[2]}}))}))},e.prototype.reportData=function(e){var t,r=this;if(this.connection){var n=this.connection.context||{},o=n.orgName,i=n.appName,a=n.accessToken,s=n.userId;if(o&&i){var c={url:"".concat(null===(t=this.connection)||void 0===t?void 0:t.apiUrl,"/").concat(o,"/").concat(i,"/sdk/users/").concat(s,"/client/logs"),type:"POST",data:JSON.stringify({resource:this.connection.clientResource||"random_".concat(Date.now()),logContent:e}),dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return ae.call(this.connection,c).then((function(e){return r.log("report log success",e),e})).catch((function(e){r.error("report log error",e)}))}}else this.error("report log error","connection is null")},e.prototype._regularlyReportLogs=function(){var e,t=this;this.timer&&clearInterval(this.timer),(null!==(e=this.reportInterval)&&void 0!==e?e:0)<6e4&&(this.reportInterval=6e4),this.timer=setInterval((function(){t.reportLog()}),this.reportInterval||3e5)},e.prototype._stopReportLogs=function(){return L(this,void 0,void 0,(function(){return P(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.reportLog()];case 1:return e.sent(),[3,3];case 2:return e.sent(),this.error("report log error when stopping upload"),[3,3];case 3:return this.reportLogs=[],clearInterval(this.timer),[2]}}))}))},e.prototype.setConfig=function(e){this.config=e},e.prototype.getLevel=function(){return this.currentLevel},e.prototype.setLevel=function(e,t,r){if("string"==typeof e&&(e=w[e]),void 0===e&&(e=0),!("number"==typeof e&&e>=0&&e<=this.levels.SILENT))throw Error("log.setLevel() called with invalid level: "+e);if(this.currentLevel=e,!1!==t&&this._persistLevel(e),this.replaceLoggingMethods(e,r||""),"undefined"==typeof console&&e<w.SILENT)throw Error("No console available for logging")},e.prototype.setDefaultLevel=function(e){this._getPersistedLevel()||this.setLevel(e,!1,"")},e.prototype.enableAll=function(e){this.setLevel(this.levels.TRACE,!0,"")},e.prototype.disableAll=function(e){this.setLevel(this.levels.SILENT,!0,"")},e.prototype.getLogs=function(){return this.logs},e.prototype.download=function(){if("undefined"!=typeof window&&"undefined"!=typeof document){var e=this.getLogs().join("\n"),t=new Blob([e],{type:"text/plain;charset=UTF-8"}),r=window.URL.createObjectURL(t),n=document.createElement("a");n.style.display="none",n.href=r,n.setAttribute("download","sdklog"),document.body.appendChild(n),n.click()}},e.prototype.setConsoleLogVisibility=function(e){this.consoleLogVisibility=e},e.prototype._bindMethod=function(e,t,r){var n=this,o=e[t],i=this.getTime();if(r)return this._cacheLog;if("function"==typeof o.bind)return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=n.getTime();n.consoleLogVisibility&&o.call.apply(o,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e,"".concat(a," IM SDK [").concat("log"===t?"debug":t,"]: ")],r,!1)),n.onLog&&n.onLog({time:a,level:"log"===t?"debug":t,logs:r}),n._cacheReportLogs.apply(n,r)};try{return Function.prototype.bind.call(o,e,"".concat(i," IM SDK [").concat("log"===t?"debug":t,"]: "))}catch(t){return function(){return Function.prototype.apply.apply(o,[e,arguments])}}},e.prototype.getTime=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},e.prototype._cacheLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=(new Date).toLocaleString()+": ",n="";e.forEach((function(e){n+="object"==typeof e?JSON.stringify(e)+" ":e+" "})),this._cacheLogCall(r+n),this._cacheReportLogs.apply(this,e)},e.prototype._cacheLogCall=function(e){var t=e.length,r=this.logBytes+t,n=this.config.maxCache;if(!(t>=n)){if(r<n)this.logBytes+=t;else for(var o=r-n,i=0;i<o;){var a=this.logs.shift();void 0!==a&&(i+=a.length)}this.logs.push(e)}},e.prototype._cacheReportLogs=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.report){var r=(new Date).toLocaleString()+": ",n="";e.forEach((function(e){n+="object"==typeof e?JSON.stringify(e)+" ":e+" "})),this.reportLogs.push(r+n)}},e.prototype._getPersistedLevel=function(){var e;if("undefined"==typeof window)return 5;if("undefined"===(e=window&&window.localStorage&&window.localStorage[this.storageLogLevelKey])){var t=window.document.cookie,r=t.indexOf(encodeURIComponent(this.storageLogLevelKey));-1!==r&&(e=/^([^;]+)/.exec(t.slice(r))[1])}return e||5},e.prototype._persistLevel=function(e){var t=this.logMethods[e]||"SILENT";if("undefined"!=typeof window){if(window.localStorage)try{window.localStorage[this.storageLogLevelKey]=t}catch(e){console.log(e)}this.useCookiePersist&&(window.document.cookie=encodeURIComponent(this.storageLogLevelKey)+"="+t+";")}},e.prototype.replaceLoggingMethods=function(e,t){for(var r=this,n=0;n<this.logMethods.length;n++){var o=this.logMethods[n];this[o]=n<e?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.report&&r._cacheReportLogs.apply(r,e)}:this.methodFactory(o,e,t)}this.log=this.debug},e.prototype.defaultMethodFactory=function(e,t,r){return this.realMethod(e)||this.enableLoggingWhenConsoleArrives.apply(this,[e,t,r])},e.prototype.realMethod=function(e){return"debug"===e&&(e="log"),"undefined"!=typeof console&&("trace"===e&&U?M:void 0!==console[e]?this._bindMethod(console,e,this.config.useCache):void 0!==console.log?this._bindMethod(console,"log",this.config.useCache):D)},e.prototype.enableLoggingWhenConsoleArrives=function(e,t,r){return function(){"undefined"!=typeof console&&(this.replaceLoggingMethods.call(this,t,r),this[e].apply(this,arguments))}.bind(this)},e}(),B=new x;B.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");return this};var G="undefined"!=typeof window?window.log:void 0;B.noConflict=function(){return"undefined"!=typeof window&&window.log===B&&(window.log=G),B},B.getLoggers=function(){return k},B.initReport=function(e){var t=e.report,r=e.reportInterval,n=e.connection;B.report=t,B.reportInterval=r,B.connection=n,t&&B._regularlyReportLogs()};var j=B,H=5242880,F=5242880,W={size:0},z={singleChat:"CHAT",groupChat:"GROUP",chatRoom:"ROOM"},q=15e3,K=3e5,V=3e5,J=[d.MAX_LIMIT,d.WEBIM_TOKEN_EXPIRED,d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,d.USER_NOT_FOUND,d.WEBIM_CONNCTION_AUTH_ERROR,d.REQUEST_PARAMETER_ERROR,d.WEBIM_CONNCTION_AUTH_ERROR,d.WEBIM_SERVER_SERVING_DISABLED,d.USER_LOGIN_TOO_MANY_DEVICES,d.USER_DEVICE_CHANGED],Y=function(){return Y=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Y.apply(this,arguments)};function X(){var e=this.context,t=e.orgName,r=e.appName,n=e.accessToken,o={url:"".concat(this.apiUrl,"/").concat(t,"/").concat(r,"/sdk/chatfiles/part-upload"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+n}};return j.debug("Call multipartInit"),ae.call(this,o,v.SDK_INTERNAL).then((function(e){var t=e.entities[0];return{data:{fileMaxSize:t.file_upper_limit,partMinSize:t.part_lower_limit,uuid:t.uuid},extraInfo:e.extraInfo,type:e.type}}))}function Q(e){var t=this;return new Promise((function(r,n){var o,i,a=(new Date).getTime(),s=t.context,c=s.orgName,u=s.appName,l=s.accessToken,h=e.uuid,p=e.partNumber,f=e.part,m=e.onProgress,g="".concat(t.apiUrl,"/").concat(c,"/").concat(u,"/sdk/chatfiles/part-upload/").concat(h),v=new XMLHttpRequest;j.debug("Call multipartUpload"),v.upload&&(null===(i=(o=v.upload).addEventListener)||void 0===i||i.call(o,"progress",(function(e){null==m||m(e)}),!1)),v.addEventListener("abort",(function(){n({type:d.REQUEST_ABORT,message:"Request Abort",errorType:"onabort",xhr:v,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"Request Abort",url:g}})}),!1),v.addEventListener("error",(function(){n({type:d.WEBIM_UPLOADFILE_ERROR,data:v,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"request error",url:g}})}),!1),v.addEventListener("load",(function(){try{var e=JSON.parse(v.responseText);if(200!==v.status)return n({type:d.WEBIM_UPLOADFILE_ERROR,data:e,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"part upload failed",url:g}}),!1;try{r(Y(Y({},e),{extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,url:g}}))}catch(e){n({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,data:e,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"part upload failed",url:g}})}}catch(e){n({type:d.WEBIM_UPLOADFILE_ERROR,data:v.responseText,extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"part upload failed",url:g}})}}),!1),v.addEventListener("timeout",(function(){n({type:d.REQUEST_TIMEOUT,message:"request timeout",extraInfo:{elapse:(new Date).getTime()-a,httpCode:v.status||-1,errDesc:"request timeout",url:g}})}),!1);var E=new FormData;E.append("part_file",f),E.append("part_number",p),v.timeout=K,v.open("PUT",g),v.setRequestHeader("restrict-access","true"),v.setRequestHeader("Accept","*/*"),v.setRequestHeader("Authorization","Bearer "+l),v.send(E)}))}function Z(e){var t=e.uuid,r=e.thumbnailHeight,n=e.thumbnailWidth,o=e.conversationInfo,i=e.uploadMd5,a=e.uploadImageType,s=e.imageWidth,c=e.imageHeight,u=o.conversationId,l=o.conversationType,d=z[l],h=this.context,p=h.orgName,f=h.appName,m=h.accessToken,g="".concat(this.apiUrl,"/").concat(p,"/").concat(f,"/sdk/chatfiles/part-upload/").concat(t,"?restrict-access=true&chat-type=").concat(d,"&chat-target=").concat(u);n&&(g+="&thumbnail-width=".concat(n)),r&&(g+="&thumbnail-height=".concat(r)),i&&(g+="&md5=".concat(encodeURIComponent(i))),a&&(g+="&imagetype=".concat(a),"number"==typeof s&&s>0&&(g+="&width=".concat(s)),"number"==typeof c&&c>0&&(g+="&height=".concat(c)));var E={url:g,dataType:"json",type:"POST",headers:{Authorization:"Bearer "+m}};return j.debug("Call multipartComplete"),ae.call(this,E,v.SDK_INTERNAL)}function $(e){var t=e.uuid,r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/sdk/chatfiles/part-upload/").concat(t),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+i}};return j.debug("Call multipartAbort"),ae.call(this,a,v.SDK_INTERNAL)}var ee=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},te=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},re=function(){function e(e,t){var r=this;this.handleUploadProgress=function(e,t){var n,o;if(e.total){r.progressArr[t]=e.loaded;var i=r.progressArr.reduce((function(e,t){return e+t}),0);null===(o=(n=r.options).onFileUploadProgress)||void 0===o||o.call(n,{isTrusted:e.isTrusted,type:e.type,loaded:i>r.file.size?r.file.size:i,total:r.file.size,lengthComputable:e.lengthComputable})}},this.uuid="",this.pool=[],this.progressArr=[],this.connection=e,this.options=t,this.partSize=H,this.file=t.file,this.init(),this.rpt=this.connection.dataReport.geOperateFun({operationName:v.REST_UPLOAD_FILE_IN_PARTS})}return e.prototype.init=function(){var e,t,r,n;return ee(this,void 0,void 0,(function(){var o,i,a,s,c,u,l,h,p,f,m,g,v,y,_;return te(this,(function(T){switch(T.label){case 0:return T.trys.push([0,4,,6]),[4,X.call(this.connection)];case 1:return o=T.sent(),i=o.data||{},a=i.fileMaxSize,s=void 0===a?0:a,c=i.partMinSize,u=void 0===c?H:c,l=i.uuid,h=void 0===l?"":l,p=o.extraInfo,g=p.elapse,v=p.httpCode,_=p.url,this.partSize=u,this.uuid=h,W.size=u,j.debug("multipartInit success","uuid: ".concat(h),"fileMaxSize: ".concat(s),"partMinSize: ".concat(u)),this.file.size>s?[4,this.multipartAbort()]:[3,3];case 2:return T.sent(),null===(t=(e=this.options).onFileUploadError)||void 0===t||t.call(e,{code:d.WEBIM_UPLOADFILE_ERROR,message:"The file size exceeds the maximum limit"}),[2];case 3:return this.rpt({data:{requestUrl:_,requestName:E.REST_INIT_UPLOAD_TASK_IN_PARTS,requestElapse:g,requestMethod:"POST",isSuccess:1,code:v}}),this.upload(),[3,6];case 4:return f=T.sent(),m=(null==f?void 0:f.extraInfo)||{},g=m.elapse,v=m.httpCode,y=m.errDesc,_=m.url,this.rpt({data:{requestUrl:_,requestName:E.REST_INIT_UPLOAD_TASK_IN_PARTS,requestElapse:g,requestMethod:"POST",isSuccess:0,codeDesc:y,code:v}}),[4,this.multipartAbort()];case 5:return T.sent(),null===(n=null===(r=this.options)||void 0===r?void 0:r.onInitFail)||void 0===n||n.call(r),[3,6];case 6:return[2]}}))}))},e.prototype.upload=function(){var e,t,r;return ee(this,void 0,void 0,(function(){var n,o,i,a,s,c,u=this;return te(this,(function(l){switch(l.label){case 0:(new FileReader).readAsArrayBuffer(this.file),n=this.file.size,o=Math.ceil(n/this.partSize),l.label=1;case 1:l.trys.push([1,7,,9]),i=function(t){var r,o,i,s;return te(this,(function(c){switch(c.label){case 0:return r=t*a.partSize,o=Math.min(n,r+a.partSize),i=null===(e=a.file)||void 0===e?void 0:e.slice(r,o),(s=Q.call(a.connection,{uuid:a.uuid,partNumber:"".concat(t+1),part:i,onProgress:function(e){u.handleUploadProgress(e,t)}})).then((function(e){var t=(null==e?void 0:e.extraInfo)||{},r=t.elapse,n=t.httpCode,o=t.url;u.rpt({data:{requestUrl:o,requestName:E.REST_UPLOAD_PART,requestElapse:r,isSuccess:1,requestMethod:"PUT",code:n}}),u.handleTask(s)})),s.catch((function(e){var t=(null==e?void 0:e.extraInfo)||{},r=t.elapse,n=t.httpCode,o=t.url,i=t.errDesc;u.rpt({data:{requestUrl:o,requestName:E.REST_UPLOAD_PART,requestElapse:r,isSuccess:0,requestMethod:"PUT",code:n,codeDesc:i}}),delete e.extraInfo})),a.pool.push(s),4!==a.pool.length?[3,2]:[4,Promise.race(a.pool)];case 1:c.sent(),c.label=2;case 2:return[2]}}))},a=this,s=0,l.label=2;case 2:return s<o?[5,i(s)]:[3,5];case 3:l.sent(),l.label=4;case 4:return s++,[3,2];case 5:return[4,Promise.all(this.pool)];case 6:return l.sent(),this.multipartComplete(),[3,9];case 7:return c=l.sent(),[4,this.multipartAbort()];case 8:return l.sent(),this.rpt({data:{isLastApi:1,isSuccess:0}}),null===(r=(t=this.options).onFileUploadError)||void 0===r||r.call(t,c),[3,9];case 9:return[2]}}))}))},e.prototype.multipartComplete=function(){var e,t,r,n;return ee(this,void 0,void 0,(function(){var o,i,a,s,c,u,l,d,h,p,f;return te(this,(function(m){switch(m.label){case 0:return m.trys.push([0,2,,3]),o=this.options.thumbnailInfo||{},i=o.width,a=o.height,[4,Z.call(this.connection,{uuid:this.uuid,thumbnailHeight:a,thumbnailWidth:i,conversationInfo:this.options.conversationInfo,uploadMd5:this.options.uploadMd5,uploadImageType:this.options.uploadImageType,imageWidth:this.options.imageWidth,imageHeight:this.options.imageHeight})];case 1:return s=m.sent(),c=(null==s?void 0:s.extraInfo)||{},d=c.elapse,h=c.httpCode,f=c.url,this.rpt({data:{requestUrl:f,requestName:E.REST_COMPLETE_UPLOAD_PART,requestElapse:d,requestMethod:"POST",isSuccess:1,code:h}}),this.rpt({data:{isLastApi:1,isSuccess:1}}),null===(t=(e=this.options).onFileUploadComplete)||void 0===t||t.call(e,s),[3,3];case 2:return u=m.sent(),l=(null==u?void 0:u.extraInfo)||{},d=l.elapse,h=l.httpCode,p=l.errDesc,f=l.url,this.rpt({data:{requestUrl:f,requestName:E.REST_COMPLETE_UPLOAD_PART,requestElapse:d,requestMethod:"POST",isSuccess:0,codeDesc:p,code:h}}),this.rpt({data:{isLastApi:1,isSuccess:0}}),null===(n=(r=this.options).onFileUploadError)||void 0===n||n.call(r,u),[3,3];case 3:return[2]}}))}))},e.prototype.multipartAbort=function(){return ee(this,void 0,void 0,(function(){var e,t,r,n,o,i,a,s;return te(this,(function(c){switch(c.label){case 0:if(!this.uuid)return[2];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,$.call(this.connection,{uuid:this.uuid})];case 2:return e=c.sent(),t=(null==e?void 0:e.extraInfo)||{},o=t.elapse,i=t.httpCode,s=t.url,this.rpt({data:{requestUrl:s,requestName:E.REST_ABORT_UPLOAD_PART,requestElapse:o,requestMethod:"DELETE",isSuccess:1,code:i}}),[3,4];case 3:return r=c.sent(),n=(null==r?void 0:r.extraInfo)||{},o=n.elapse,i=n.httpCode,a=n.errDesc,s=n.url,this.rpt({data:{requestUrl:s,requestName:E.REST_ABORT_UPLOAD_PART,requestElapse:o,requestMethod:"DELETE",isSuccess:0,codeDesc:a,code:i}}),[3,4];case 4:return[2]}}))}))},e.prototype.handleTask=function(e){var t=this.pool.findIndex((function(t){return t===e}));this.pool.splice(t,1)},e}(),ne=function(e){var t,r,n=this,o=(new Date).getTime(),i=e.apiUrl,a=e.orgName,s=e.appName,c=e.operateName,u=e.accessToken,l=e.conversationInfo,h=l.conversationType,p=l.conversationId,f=z[h],m=e.uploadUrl||"".concat(i,"/").concat(a,"/").concat(s,"/chatfiles?chat-type=").concat(f,"&chat-target=").concat(p);e.uploadUrl||(e._uploadMd5&&(m+="&md5=".concat(encodeURIComponent(e._uploadMd5))),e._uploadImageType&&(m+="&imagetype=".concat(e._uploadImageType),"number"==typeof e.width&&e.width>0&&(m+="&width=".concat(e.width)),"number"==typeof e.height&&e.height>0&&(m+="&height=".concat(e.height))));var g=function(t){var r=(new Date).getTime()-o;n.dataReport&&c&&[v.UPLOAD_MSG_ATTACH,v.UPLOAD_CHATROOM_FILE,v.UPLOAD_GROUP_FILE].includes(c)&&n.dataReport.geOperateFun({operationName:c})({isEndApi:!0,data:{isSuccess:0,requestMethod:"POST",requestName:c,requestElapse:r,requestUrl:m,code:(null==y?void 0:y.status)||0,codeDesc:"upload file error"}}),e.onFileUploadError&&e.onFileUploadError(t)};function E(e){g({type:d.WEBIM_UPLOADFILE_ERROR,data:y})}var y=new XMLHttpRequest;y.upload&&(null===(r=(t=y.upload).addEventListener)||void 0===r||r.call(t,"progress",e.onFileUploadProgress||ie,!1)),y.addEventListener("abort",e.onFileUploadCanceled||ie,!1),y.addEventListener("error",E,!1),y.addEventListener("load",(function(t){try{var r=JSON.parse(y.responseText);if(400===y.status)return g({type:d.WEBIM_UPLOADFILE_ERROR,data:r}),!1;try{!function(t){var r=(new Date).getTime()-o;n.dataReport&&c&&[v.UPLOAD_MSG_ATTACH,v.UPLOAD_CHATROOM_FILE,v.UPLOAD_GROUP_FILE].includes(c)&&n.dataReport.geOperateFun({operationName:c})({isEndApi:!0,data:{isSuccess:(null==t?void 0:t.error)?0:1,requestMethod:"POST",requestName:c,requestElapse:r,requestUrl:m,code:y.status,codeDesc:(null==t?void 0:t.error_description)||""}}),e.onFileUploadComplete&&e.onFileUploadComplete(t)}(r)}catch(t){g({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,data:t})}}catch(t){g({type:d.WEBIM_UPLOADFILE_ERROR,data:y.responseText})}}),!1),y.addEventListener("timeout",E,!1),y.timeout=K,y.open("POST",m),y.setRequestHeader("restrict-access","true"),y.setRequestHeader("Accept","*/*"),y.setRequestHeader("Authorization","Bearer "+u);var _=new FormData;_.append("file",e.file.data),e.thumbnailWidth&&_.append("thumbnail-width",e.thumbnailWidth+""),e.thumbnailHeight&&_.append("thumbnail-height",e.thumbnailHeight+""),y.send(_)},oe=function(){return oe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},oe.apply(this,arguments)},ie=function(){};function ae(e,t){var r,n=this;return pe().platform===le.WEB?new Promise((function(t,n){var o=e.dataType||"text",i=e.success||ie,a=e.error||ie,s=new XMLHttpRequest;s.timeout=q;var c=!1;s.ontimeout=function(){j.warn("request timeout"),c=!0;var e={type:d.REQUEST_TIMEOUT,message:"Request Timeout",errorType:"timeout_error",xhr:s};a(e),n(e)},s.onerror=function(){n({type:d.REQUEST_UNKNOWN,message:"Request Unknow Error",errorType:"onerror",xhr:s})},s.onabort=function(){n({type:d.REQUEST_ABORT,message:"Request Abort",errorType:"onabort",xhr:s})},s.onreadystatechange=function(){if(4===s.readyState){var e=(new Date).getTime()-r,u=s.status||0,l={elapse:e,httpCode:u};if(200===u){_e.ajaxUnconventionalErrorTimes=0;try{switch(o){case"text":return i(s.responseText),void t(s.responseText);case"json":var h=JSON.parse(s.responseText);return h.extraInfo=l,i(h),void t(h);case"xml":return s.responseXML&&s.responseXML.documentElement?(i(s.responseXML.documentElement),void t(s.responseXML.documentElement)):(a({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"XHR.responseXML is null or XHR.responseXML.documentElement is null"}),void n({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"XHR.responseXML is null or XHR.responseXML.documentElement is null"}));default:a({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Invalid dataType"}),n({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Invalid dataType"})}return t(s.response||s.responseText),void i(s.response||s.responseText,s)}catch(e){n(e)}return}0===u?setTimeout((function(){j.error("request timeout:",c),!c&&R(s,n,a,e)}),0):([400,401,403,404,429,500,503].includes(u)||(j.warn("rest api request fail status:",u),_e.ajaxUnconventionalErrorTimes++),R(s,n,a,e))}0===s.readyState&&(a({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Request not initialized"}),n({type:d.WEBIM_CONNCTION_AJAX_ERROR,data:s.responseText,message:"Request not initialized"}))},e.responseType&&s.responseType&&(s.responseType=e.responseType),e.mimeType&&s.overrideMimeType(e.mimeType);var u=e.type||"POST",l=e.data||null,h="";if("get"===u.toLowerCase()&&l){for(var p in l)l.hasOwnProperty(p)&&(h+=p+"="+l[p]+"&");h=h?h.slice(0,-1):h,e.url+=(e.url.indexOf("?")>0?"&":"?")+(h?h+"&":h)+"_v="+(new Date).getTime(),l=null,h=""}r=(new Date).getTime(),s.open(u,e.url);var f=e.headers||{};for(var m in f["Content-Type"]||(f["Content-Type"]="application/json"),f)f.hasOwnProperty(m)&&s.setRequestHeader(m,f[m]);s.send(l)})).then((function(r){var o,i;if(n.dataReport&&t&&t!==v.SDK_INTERNAL){var a=n.dataReport.geOperateFun({operationName:t}),s=oe({isSuccess:1,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(r.extraInfo));t===v.REST_FETCH_CONVERSATIONS?s.resultCount=null===(o=r.data.channel_infos)||void 0===o?void 0:o.length:t===v.REST_FETCHHISTORYMESSAGE&&(s.resultCount=null===(i=r.data.msgs)||void 0===i?void 0:i.length),a({isEndApi:!0,data:s})}return t===v.SDK_INTERNAL&&(r.extraInfo.url=e.url),t!==v.SDK_INTERNAL&&delete r.extraInfo,"Object"===se(r)?oe(oe({},r),{type:d.REQUEST_SUCCESS}):{data:r,type:d.REQUEST_SUCCESS}})).catch((function(o){var i,a;if(n.dataReport&&t&&t!==v.SDK_INTERNAL&&n.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:oe({isSuccess:0,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(o.extraInfo))}),t===v.SDK_INTERNAL)if(o.extraInfo)o.extraInfo.url=e.url;else{var s={elapse:(new Date).getTime()-r,httpCode:null!==(a=null===(i=o.xhr)||void 0===i?void 0:i.status)&&void 0!==a?a:0,url:e.url};o.extraInfo=s}throw t!==v.SDK_INTERNAL&&delete o.extraInfo,o})):ce.call(this,e,t)}function se(e){return Object.prototype.toString.call(e).slice(8,-1)}function ce(e,t){var r=this;return new Promise((function(r,n){var o=e.success||ie,i=e.error||ie,a=e.type||"POST",s=e.data||null,c="",u=(new Date).getTime(),l=_e.getEnvInfo();if("get"===a.toLowerCase()&&s){for(var h in s)s.hasOwnProperty(h)&&(c+=h+"="+s[h]+"&");c=c?c.slice(0,-1):c,e.url+=(e.url.indexOf("?")>0?"&":"?")+(c?c+"&":c)+"_v="+(new Date).getTime(),s=null,c=""}var p={url:e.url,data:e.data,method:a,headers:{},timeout:q,success:function(e){var a,s,c,l,d,h={elapse:(new Date).getTime()-u,httpCode:Number((null===(a=e.statusCode)||void 0===a?void 0:a.toString())||(null===(s=e.status)||void 0===s?void 0:s.toString())),errDesc:(null===(c=null==e?void 0:e.data)||void 0===c?void 0:c.error_description)||""};if("200"===(null===(l=e.statusCode)||void 0===l?void 0:l.toString())||"200"===(null===(d=e.status)||void 0===d?void 0:d.toString())){e.data.extraInfo=h;var p=e.data;o(p),r(p)}else e.extraInfo=h,i(p=e),n(p),j.warn(t,"reject reason: ",p)},complete:function(){},fail:function(e){var r={elapse:(new Date).getTime()-u,httpCode:A,errDesc:"request:fail"};if(e.extraInfo=r,e.data={error:"request:fail",error_description:"request:fail"},"request:fail timeout"===e.errMsg)return n({type:d.REQUEST_TIMEOUT,message:"Request Timeout",extraInfo:r}),void i({type:d.REQUEST_TIMEOUT,message:"Request Timeout",extraInfo:r});i(e),n(e),j.error(t,"fail reason:",e)}};if("zfb"===l.platform||"dd"===l.platform?p.headers=e.headers:p.header=e.headers,"dd"===l.platform)return dd.httpRequest(p);l.global.request(p)})).then((function(n){var o,i;if(r.dataReport&&t&&t!==v.SDK_INTERNAL){var a=r.dataReport.geOperateFun({operationName:t}),s=oe({isSuccess:1,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(n.extraInfo));t===v.REST_FETCH_CONVERSATIONS?s.resultCount=null===(o=n.data.channel_infos)||void 0===o?void 0:o.length:t===v.REST_FETCHHISTORYMESSAGE&&(s.resultCount=null===(i=n.data.msgs)||void 0===i?void 0:i.length),a({isEndApi:!0,data:s})}return t!==v.SDK_INTERNAL&&delete n.extraInfo,"Object"===se(n)?oe(oe({},n),{type:d.REQUEST_SUCCESS}):{data:n,type:d.REQUEST_SUCCESS}})).catch((function(n){r.dataReport&&t&&t!==v.SDK_INTERNAL&&r.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:oe({isSuccess:0,requestUrl:e.url,requestName:t,requestMethod:e.type},ve(n.extraInfo))}),t!==v.SDK_INTERNAL&&delete n.extraInfo;var o=JSON.stringify(n.data||{}),i=oe(oe({},n),{status:n.statusCode||n.status||0,response:o,responseText:o});R(i,(function(e){throw oe(oe({},n),{message:e.message,type:e.type})}),ie,0)}))}function ue(e,t){var r;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(!e)return r;r=t?e.apply(t,n):e.apply(void 0,n),e=null}}var le,de=ue((function(e,t){var r=pe();if(r.platform!==le.WEB){var n=r.global,o=function(r){r.isConnected?e():t()};n.offNetworkStatusChange&&n.offNetworkStatusChange(o),n.onNetworkStatusChange&&n.onNetworkStatusChange(o)}else"undefined"!=typeof addEventListener&&(window.addEventListener("online",e),window.addEventListener("offline",t))})),he=ue((function(e,t){var r,n,o=pe();if(o.platform===le.WEB)"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){document.hidden?null==t||t():null==e||e()}),!1);else{var i=o.global;i.onAppShow&&(null===(r=i.onAppShow)||void 0===r||r.call(i,e)),i.onAppHide&&(null===(n=i.onAppHide)||void 0===n||n.call(i,t))}}));function pe(){return"undefined"!=typeof swan&&fe(swan)?{platform:le.BAIDU,global:swan}:"undefined"!=typeof tt&&fe(tt)?{platform:le.TT,global:tt}:"undefined"!=typeof dd&&fe(dd)?{platform:le.DD,global:dd}:"undefined"!=typeof my&&fe(my)?{platform:le.ZFB,global:my}:"undefined"!=typeof wx&&fe(wx)||"undefined"!=typeof wx&&"function"==typeof wx.createCanvas?{platform:le.WX,global:wx}:"undefined"!=typeof qq&&fe(qq)?{platform:le.QQ,global:qq}:"undefined"!=typeof uni&&fe(uni)?{platform:le.UNI,global:uni}:"undefined"!=typeof window&&window.WebSocket?{platform:le.WEB,global:window}:{platform:le.NODE,global:r.g||{}}}function fe(e){for(var t=["canIUse","getSystemInfo"],r=0,n=t.length;r<n;r++)if(!e[t[r]])return!1;return!0}function me(e,t){var r,n,o,i,a=this,s=e.accessToken,c=e.appKey,u=null===(n=null===(r=null==e?void 0:e.file)||void 0===r?void 0:r.data)||void 0===n?void 0:n.size,l=[],h="",p="";if(s)if(c&&(l=c.split("#"),h=l[0],p=l[1]),h||p){var f=e._filePath;if(f&&"string"==typeof f){var m=pe(),g=null===(o=m.global)||void 0===o?void 0:o.uploadFile;if(m.platform!==le.WEB&&"function"==typeof g){var v=z[e.chatType]||"CHAT",E="".concat(e.apiUrl,"/").concat(h,"/").concat(p,"/chatfiles?chat-type=").concat(v,"&chat-target=").concat(e.to);return e._uploadMd5&&(E+="&md5=".concat(encodeURIComponent(e._uploadMd5))),e._uploadImageType&&(E+="&imagetype=".concat(e._uploadImageType),"number"==typeof e.width&&e.width>0&&(E+="&width=".concat(e.width)),"number"==typeof e.height&&e.height>0&&(E+="&height=".concat(e.height))),void g({url:E,filePath:f,name:"file",header:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+s,"restrict-access":"true"},success:function(t){if(200===t.statusCode)try{var r="string"==typeof t.data?JSON.parse(t.data):t.data;e.onFileUploadComplete&&e.onFileUploadComplete(r)}catch(r){e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,data:oe(oe({},t),{rawData:t.data,error:r})})}else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,data:t})},fail:function(t){e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,data:t})}})}e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,message:"Current platform does not support path-based upload"})}else if(u<=0)e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,message:"fileSize must be greater than 0"});else if(e.uploadUrl)ne.call(this,oe(oe({},e),{orgName:h,appName:p,operateName:t,conversationInfo:{conversationId:e.to,conversationType:e.chatType}}));else{var y=W.size||F;this.uploadPartEnable&&u>1.5*y?new re(this,{file:null===(i=null==e?void 0:e.file)||void 0===i?void 0:i.data,onFileUploadProgress:e.onFileUploadProgress||ie,onFileUploadComplete:e.onFileUploadComplete||ie,onFileUploadError:e.onFileUploadError||ie,onFileUploadCanceled:e.onFileUploadCanceled||ie,conversationInfo:{conversationId:e.to,conversationType:e.chatType},onInitFail:function(){ne.call(a,oe(oe({},e),{orgName:h,appName:p,operateName:t,conversationInfo:{conversationId:e.to,conversationType:e.chatType}}))},thumbnailInfo:{width:e.thumbnailWidth,height:e.thumbnailHeight},uploadMd5:e._uploadMd5,uploadImageType:e._uploadImageType,imageWidth:e.width,imageHeight:e.height}):ne.call(this,oe(oe({},e),{orgName:h,appName:p,operateName:t,conversationInfo:{conversationId:e.to,conversationType:e.chatType}}))}}else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,message:this._initWithAppId?"appId illegal":"AppKey illegal"});else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_NO_LOGIN,message:"AccessToken cannot be empty"})}function ge(e,t){var r;e.onFileDownloadComplete=e.onFileDownloadComplete||ie,e.onFileDownloadError=e.onFileDownloadError||ie;var n=(new Date).getTime(),o=new XMLHttpRequest,i=this;o.addEventListener("load",(function(){var r,a=(new Date).getTime()-n;i.dataReport&&t&&t===v.DOWN_GROUP_FILE&&i.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:{isSuccess:200===o.status?1:0,requestMethod:e.method||"GET",requestName:t,requestElapse:a,requestUrl:null==e?void 0:e.url,code:o.status,codeDesc:200===o.status?"":"download file error"}}),200===o.status?e.onFileDownloadComplete&&e.onFileDownloadComplete(o.response):403===o.status||404===o.status?((r=new FileReader).addEventListener("loadend",(function(t){var r;try{var n=JSON.parse(null===(r=t.target)||void 0===r?void 0:r.result);j.error("download file failed","status:".concat(o.status),n),403===o.status?"chatfile no permission"===n.error_description?e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION,id:e.id,xhr:o}):e.onFileDownloadError&&e.onFileDownloadError({type:d.PERMISSION_DENIED,id:e.id,xhr:o}):404===o.status&&("file_expired"===n.error?e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR_EXPIRED,id:e.id,xhr:o}):e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o}))}catch(t){j.error("Error parsing download error response:",t),e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o})}})),r.readAsText(o.response)):500===o.status?(j.error("download file failed","status:".concat(o.status),"type:".concat(d.SERVER_UNKNOWN_ERROR)),e.onFileDownloadError&&e.onFileDownloadError({type:d.SERVER_UNKNOWN_ERROR,id:e.id,xhr:o})):(j.error("download file failed","status:".concat(o.status),"type:".concat(d.WEBIM_DOWNLOADFILE_ERROR)),e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o}))}),!1),o.addEventListener("error",(function(r){var a=(new Date).getTime()-n;i.dataReport&&t&&t===v.DOWN_GROUP_FILE&&i.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:{isSuccess:0,requestMethod:e.method||"GET",requestName:t,requestElapse:a,requestUrl:null==e?void 0:e.url,code:(null==o?void 0:o.status)||0,codeDesc:"download file error"}}),e.onFileDownloadError&&e.onFileDownloadError({type:d.WEBIM_DOWNLOADFILE_ERROR,id:e.id,xhr:o})}),!1);var a=e.method||"GET",s=e.responseType||"blob",c=e.mimeType||"text/plain; charset=x-user-defined";o.open(a,e.url),"undefined"!=typeof Blob?o.responseType=s:o.overrideMimeType(c);var u={"X-Requested-With":"XMLHttpRequest","share-secret":e.secret,Authorization:"Bearer "+(null===(r=null==this?void 0:this.context)||void 0===r?void 0:r.accessToken)},l=e.headers||{};for(var h in l)u[h]=l[h];for(var h in u)u[h]&&o.setRequestHeader(h,u[h]);o.send(null)}function ve(e){void 0===e&&(e={});var t=e.elapse,r=void 0===t?0:t,n=e.httpCode,o=void 0===n?0:n,i=e.errDesc;return{requestElapse:r,code:o,codeDesc:void 0===i?"":i}}!function(e){e.WEB="web",e.WX="wx",e.QQ="qq",e.ZFB="zfb",e.DD="dd",e.TT="tt",e.BAIDU="baidu",e.QUICK_APP="quick_app",e.UNI="uni",e.NODE="node"}(le||(le={}));var Ee,ye="localDeviceInfo",_e={autoIncrement:0,ajaxUnconventionalErrorTimes:0,isUseHttps:function(e){var t;return"boolean"==typeof e?e:!("undefined"!=typeof window)||"https:"===(null===(t=window.location)||void 0===t?void 0:t.protocol)},getRetryDelay:function(e){return e<=5?Number((Math.random()+1).toFixed(2)):e>5&&e<20?Math.floor(4*Math.random())+3:Math.floor(6*Math.random())+5},ajax:ae,getUniqueId:function(){this.autoIncrement?this.autoIncrement++:this.autoIncrement=1;var e=new Date,t=new Date(2010,1,1);return(e.getTime()-t.getTime()+this.autoIncrement).toString()},getFileUrl:function(e){var t={url:"",filename:"",filetype:"",data:{}},r="string"==typeof e?document.getElementById(e):e;if(window.URL.createObjectURL){if(!r.files)throw Error("this is not HTMLInputElement");var n=r.files;if(n.length>0){var o=n.item(0);t.data=o,t.url=window.URL.createObjectURL(o),t.filename=(null==o?void 0:o.name)||""}}else{if("string"!=typeof e)throw Error("in IE fileInputId must be string");o=document.getElementById(e).value,t.url=o;var i=o.lastIndexOf("/"),a=o.lastIndexOf("\\"),s=Math.max(i,a);t.filename=s<0?o:o.substring(s+1)}var c=t.filename.lastIndexOf(".");return-1!==c&&(t.filetype=t.filename.substring(c+1).toLowerCase()),t},uploadFile:me,flow:function(e){for(var t=e.length,r=t;r--;)if("function"!=typeof e[r])throw new TypeError("Expected a function");return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var o=0,i=t?e[o].apply(this,r):r[0];++o<t;)i=e[o].call(this,i);return i}},listenNetwork:de,listenBrowserVisibility:he,getEnvInfo:pe,wxRequest:ce,parseDownloadResponse:function(e){if(!window||!window.URL)throw Error("parseDownloadResponse can be used in broswer only");return e&&e.type&&"application/json"===e.type||0>Object.prototype.toString.call(e).indexOf("Blob")?this.url+"?token=":window.URL.createObjectURL(e)},download:ge,parseNotify:function(e){for(var t="",r=0;r<e.length;r++)t+="%"+e[r].toString(16);return JSON.parse(decodeURIComponent(t))},getExtraData:ve,retryPromise:function(e,t,r){return new Promise((function(n,o){var i=function(t){e().then(n).catch((function(e){t>0?setTimeout((function(){i(t-1)}),r||1e3):o(e)}))};i(t||3)}))},formatAttachUrl:function(e){return e&&"string"==typeof e?"".concat(this.apiUrl).concat(e.slice(e.indexOf("/",9))):""},Uint8ArrayToString:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},getLocalDeviceInfo:function(){return function(e){var t,r=_e.getEnvInfo(),n=r.platform,o="";n!==le.NODE&&n!==le.QUICK_APP||(o="");try{n===le.WEB?window.localStorage?o=localStorage.getItem(e)||"":j.error("localStorage is not supported"):n===le.WX||n===le.QQ||n===le.TT||n===le.BAIDU||n===le.UNI?o=r.global.getStorageSync(e)||"":n!==le.ZFB&&n!==le.DD||(o=(null===(t=r.global.getStorageSync({key:e}))||void 0===t?void 0:t.data)||"")}catch(t){j.info("get local ".concat(e," failed: "),t)}return j.info("".concat(e," "),o),o}(ye)},setLocalDeviceInfo:function(e){!function(e,t){var r=_e.getEnvInfo(),n=r.platform;if(n!==le.NODE&&n!==le.QUICK_APP)if(n===le.WEB)try{window.localStorage?localStorage.setItem(e,t):j.error("localStorage is not supported")}catch(t){j.error("set local ".concat(e," failed: "),t)}else r.global.setStorage({key:e,data:t,success:function(t){j.debug("set local ".concat(e," success: "),t)},fail:function(t){j.error("set local ".concat(e," failed: "),t)}})}(ye,e)},detectBrowser:function(){if("undefined"==typeof navigator)return"unknown";var e=navigator.userAgent;return/MicroMessenger/i.test(e)?"WeChat":/QQBrowser/i.test(e)?"QQ":!/Chrome/i.test(e)||/Edg/i.test(e)||/OPR/i.test(e)?!/Safari/i.test(e)||/Chrome/i.test(e)||/CriOS/i.test(e)?/Firefox/i.test(e)?"Firefox":/MSIE/i.test(e)||/Trident/i.test(e)?"IE":/Edg/i.test(e)?"Edge":"unknown":"Safari":"Chrome"},getDevicePlatform:function(e){return e.platform===le.WX&&"undefined"!=typeof uni&&fe(uni)?le.UNI:e.platform},delay:function(e){return new Promise((function(t){return setTimeout(t,e)}))}};!function(e){e[e.SYNC_INIT=0]="SYNC_INIT",e[e.SYNC_START=1]="SYNC_START",e[e.SYNC_FINISH=2]="SYNC_FINISH"}(Ee||(Ee={}));var Te,Ie,Oe=r(887),Re=r.n(Oe);!function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNKNOWN=2]="UNKNOWN",e[e.NONE=3]="NONE"}(Te||(Te={})),function(e){e[e.START=0]="START",e[e.START_AND_COMPLETED=1]="START_AND_COMPLETED",e[e.IN_PROGRESS=2]="IN_PROGRESS",e[e.COMPLETED=3]="COMPLETED",e[e.ERROR=4]="ERROR"}(Ie||(Ie={}));var Ce=function(){return Ce=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ce.apply(this,arguments)},Se={chat:"singleChat",chatroom:"chatRoom",groupchat:"groupChat",singleChat:"singleChat",chatRoom:"chatRoom",groupChat:"groupChat"};function Ne(e,t){var r,n,o,i=t||{},a=i.formatCustomExts,s=void 0===a||a,c=i.formatChatType,u=void 0!==c&&c,l=e.id,h=e.payload,p=e.timestamp,f=e.to,m=h.bodies&&h.bodies.length>0?h.bodies[0]:{},g={},v={},E=h.type?h.type:f.indexOf("@conference.easemob.com")>-1?"groupChat":"singleChat";E="chat"===E?"singleChat":E,u&&h.type&&(E=Se[h.type]);var y="";switch(m.type){case"txt":if(Object.prototype.hasOwnProperty.call(m,"subType")&&"sub_combine"===m.subType)y=nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"combine",chatType:E,to:h.to,from:h.from,ext:h.ext,time:p,title:m.title||"",summary:m.summary||"",url:y||"",secret:m.secret||"",file_length:m.file_length||0,filename:m.filename||"",compatibleText:m.msg,combineLevel:m.combineLevel||0};else if(g={id:l,type:"txt",chatType:E,msg:m.msg||"",to:h.to||"",from:h.from,time:p,ext:h.ext},Object.prototype.hasOwnProperty.call(m,"subType")&&"sub_stream"===m.subType&&h.stream){var _=0;switch(h.stream.stream_status){case"stream_start":_=Ie.START;break;case"stream_start_completed":_=Ie.START_AND_COMPLETED;break;case"stream_in_progress":_=Ie.IN_PROGRESS;break;case"stream_completed":case"stream_full":_=Ie.COMPLETED;break;default:_=0}var T=0;512===h.stream.stream_error?T=d.MESSAGE_STREAM_INTERVAL_TIMEOUT:513===h.stream.stream_error&&(T=d.MESSAGE_STREAM_TIMEOUT),g.stream={customType:h.stream.stream_type,status:_,errorType:T,text:m.msg,finishReason:h.stream.stream_finish_reason}}break;case"img":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"img",chatType:E,to:h.to,from:h.from,time:p,ext:h.ext,width:(null===(r=m.size)||void 0===r?void 0:r.width)||0,height:(null===(n=m.size)||void 0===n?void 0:n.height)||0,thumb:this.useOwnUploadFun?"":"".concat(y,"&thumbnail=true"),thumb_secret:m.secret,secret:m.secret||"",url:y||"",file_length:m.file_length||0,file:{},isGif:"sub_gif"===m.subType};break;case"video":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"video",chatType:E,from:h.from,to:h.to,thumb:_e.formatAttachUrl.call(this,m.thumb),thumb_secret:m.thumb_secret||"",url:y||"",secret:m.secret||"",filename:m.filename,length:m.length||0,file:{},file_length:m.file_length||0,filetype:h.ext.file_type||"",ext:h.ext,time:p};break;case"loc":g={id:l,type:"loc",chatType:E,from:h.from,to:h.to,buildingName:m.buildingName||"",addr:m.addr,lat:m.lat,lng:m.lng,ext:h.ext,time:p};break;case"audio":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"audio",chatType:E,from:h.from,to:h.to,secret:m.secret||"",ext:h.ext,time:p,url:y||"",file:{},filename:m.filename,length:m.length||0,file_length:m.file_length||0,filetype:h.ext.file_type||""};break;case"file":y=this.useOwnUploadFun?null==m?void 0:m.url:nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"file",chatType:E,from:h.from,to:h.to,ext:h.ext,time:p,url:y||"",secret:m.secret||"",file:{},filename:m.filename||"",file_length:m.file_length||0,filetype:h.ext.file_type||""};break;case"cmd":g={id:l,type:"cmd",chatType:E,from:h.from,to:h.to,ext:h.ext,time:p,action:m.action||""};break;case"custom":var I=m.customExts||{};s&&m.customExts&&(I={},m.customExts.map((function(e){I=Ce(Ce({},I),e)}))),g={id:l,type:"custom",chatType:E,from:h.from,to:h.to,ext:h.ext,time:p,customEvent:m.customEvent||"",customExts:I};break;case"combine":y=nt.call(this,{remotePath:null==m?void 0:m.url,secret:null==m?void 0:m.secret}),g={id:l,type:"combine",chatType:E,msg:m.msg||"",to:h.to||"",from:h.from,time:p,ext:h.ext,title:m.title||"",summary:m.summary||"",url:y||"",compatibleText:m.text,combineLevel:m.combineLevel||0,secret:m.secret||"",filename:m.filename||"",file_length:m.file_length||0};break;default:j.error("unexpected message: ".concat(e))}if(h.msgConfig&&(v.msgConfig=h.msgConfig),null==h?void 0:h.meta){var O=h.meta;O.thread&&(v.chatThread={messageId:O.thread.msg_parent_id,parentId:O.thread.muc_parent_id,chatThreadName:O.thread.thread_name}),O.reaction&&(v.reactions=O.reaction),O.translations&&(v.translations=O.translations)}var R=null===(o=null==h?void 0:h.meta)||void 0===o?void 0:o.edit_msg;if(R){var C=R.edit_time,S=R.operator,N=R.count;g.modifiedInfo={operationTime:C,operatorId:S,operationCount:N}}return Ce(Ce({},g),v)}var be,Ae=function(e){return"".concat(e.conversationType,"-").concat(e.conversationId)},Me=function(e){var t=e.isRecallSelfMsg,r=e.conversation,n=e.recalledMsgTime,o=r.unReadCount,i=void 0===o?0:o,a=r.unreadCountClearTimestamp;return t||(void 0===a?0:a)>n?i:i&&i>0?i-1:0},we=function(e){var t,r=0;if(0===e.length)return r;for(t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r},Ue=function(){return Ue=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ue.apply(this,arguments)};!function(e){e[e.STREAM_START=0]="STREAM_START",e[e.STREAM_START_COMPLETED=1]="STREAM_START_COMPLETED",e[e.STREAM_IN_PROGRESS=2]="STREAM_IN_PROGRESS",e[e.STREAM_COMPLETED=3]="STREAM_COMPLETED",e[e.STREAM_FULL=4]="STREAM_FULL"}(be||(be={}));var Le=new(function(){function e(){this.cache=new Map,this.mergedContent=new Map,this.lastDispatchedSeq=new Map,this.hasCompleted=new Map,this.msgExt=new Map}return e.prototype.addChunk=function(e,t){this.cache.has(e)||(this.cache.set(e,[]),this.mergedContent.set(e,""),this.lastDispatchedSeq.set(e,-1),this.hasCompleted.set(e,!1)),t.streamInfo.status===Ie.COMPLETED&&this.hasCompleted.set(e,!0);var r=this.cache.get(e);-1===r.findIndex((function(e){return e.seq===t.seq}))?(r.push(t),r.sort((function(e,t){return e.seq-t.seq}))):j.warn("Stream message chunk already exists",t.seq)},e.prototype.getMergedContent=function(e){return this.mergedContent.get(e)||""},e.prototype.appendToMergedContent=function(e,t){var r=this.mergedContent.get(e)||"";this.mergedContent.set(e,r+t)},e.prototype.getChunks=function(e){return this.cache.get(e)||[]},e.prototype.getSequentialChunks=function(e){var t=this.cache.get(e);if(!t||0===t.length)return[];for(var r=this.lastDispatchedSeq.get(e),n=[],o=0,i=t;o<i.length;o++){var a=i[o];if(0!==n.length){var s=n[n.length-1];if(a.seq!==s.seq+1)break;n.push(a)}else{if(void 0!==r&&-1!==r&&a.seq!==r+1)continue;n.push(a)}}return n},e.prototype.markDispatched=function(e,t){var r;t>(null!==(r=this.lastDispatchedSeq.get(e))&&void 0!==r?r:-1)&&this.lastDispatchedSeq.set(e,t)},e.prototype.getLastDispatchedSeq=function(e){var t;return null!==(t=this.lastDispatchedSeq.get(e))&&void 0!==t?t:-1},e.prototype.isCompleted=function(e){var t=this.cache.get(e);return!(!t||0===t.length)&&t[t.length-1].streamInfo.status===Ie.COMPLETED},e.prototype.hasMissingSeqs=function(e){var t=this.cache.get(e);if(!t||0===t.length)return!1;var r=t.find((function(e){return e.streamInfo.status===Ie.START||e.streamInfo.status===Ie.START_AND_COMPLETED}));if(!r)return!0;for(var n=r.seq,o=Math.max.apply(Math,t.map((function(e){return e.seq}))),i=new Set(t.map((function(e){return e.seq}))),a=n;a<=o;a++)if(!i.has(a))return!0;return!1},e.prototype.setMergedContent=function(e,t){this.mergedContent.set(e,t)},e.prototype.hasReceivedCompleted=function(e){return this.hasCompleted.get(e)||!1},e.prototype.hasReceivedFull=function(e){var t=this.cache.get(e);return!!t&&t.some((function(e){return e.streamInfo.status===be.STREAM_FULL}))},e.prototype.setMsgExt=function(e,t){this.msgExt.set(e,t)},e.prototype.getMsgExt=function(e){return this.msgExt.get(e)},e.prototype.clear=function(e){this.cache.delete(e),this.mergedContent.delete(e),this.lastDispatchedSeq.delete(e),this.hasCompleted.delete(e),this.msgExt.delete(e)},e.prototype.clearAll=function(){this.cache.clear(),this.mergedContent.clear(),this.lastDispatchedSeq.clear(),this.hasCompleted.clear(),this.msgExt.clear()},e}());function Pe(e,t,r,n,o,i,a,s,c,u,l,d,h,p,f,m,g){var v={id:e,chatType:t,type:"txt",to:r,msg:n,from:o,time:i,stream:a,onlineState:s};return function(e,t,r,n,o,i,a,s,c,u){t&&Object.keys(t).length>0&&(e.ext=t),r&&r.length>0&&(e.reactions=r),n&&n.length>0&&(e.translations=n),o&&o.operationCount>0&&(e.modifiedInfo=o),i&&(e.chatThread=i),a&&(e.chatThreadOverview=a),s&&(e.isContentReplaced=s),c&&(e.isRead=c),u&&(e.isDelivered=u)}(v,c,u,l,d,h,p,f,m,g),v}var De,ke=function(e,t,r,n,o,i,a,s,c,u,l,h,p,m,g,v,E,y,_){var T,I,O,R,C,S;try{var N=function(e,t){var r,n=null!==(r=e.streamError)&&void 0!==r?r:0;512===n?n=d.MESSAGE_STREAM_INTERVAL_TIMEOUT:513===n&&(n=d.MESSAGE_STREAM_TIMEOUT);var o={customType:e.streamType,seq:Number(e.streamSeq.toString()),status:e.streamStatus,errorType:n,text:t,finishReason:e.streamFinishReason};return void 0!==e.streamSeq&&(e.streamSeq&&"object"==typeof e.streamSeq?o.seq=Number(new(f())(e.streamSeq.low,e.streamSeq.high,e.streamSeq.unsigned).toString()):o.seq=Number(e.streamSeq)),o}(t.stream,e.text),b=N.seq,A=N.text,M=(N.finishReason,t.stream.streamStatus),w={msgId:n,seq:b,text:A,streamInfo:N,timestamp:Number(a)};if(Le.addChunk(n,w),M===be.STREAM_FULL){var U=Le.getChunks(n);if(0===U.length){var L=A,P=Le.getMergedContent(n),D=L.slice(P.length),k=Ue(Ue({},N),{status:Ie.START_AND_COMPLETED,text:D}),x=Pe(n,s,i,L,o,Number(a),k,c,u,l,h,p,m,g,v,E,y);return!_&&(null===(I=null===(T=this.eventHandler)||void 0===T?void 0:T.dispatch)||void 0===I||I.call(T,"onStreamMessage",x)),Le.setMergedContent(n,L),Le.clear(n),x}var B=U[U.length-2];if(B&&B.streamInfo.status===Ie.START_AND_COMPLETED)return void j.debug("Stream message FULL ignored (already dispatched)");var G=Le.hasMissingSeqs(n),H=Le.hasReceivedCompleted(n);if(G||!H){j.debug("Stream message has missing (FULL)",{msgId:n,seq:b}),L=A,P=Le.getMergedContent(n),D=L.slice(P.length),"seq"in(k=Ue(Ue({},N),{status:0===N.errorType?Ie.COMPLETED:Ie.ERROR,text:D}))&&delete k.seq;var F=U[0].timestamp;return x=Pe(n,s,i,L,o,Number(F)||Number(a),k,c,u,l,h,p,m,g,v,E,y),!_&&(null===(R=null===(O=this.eventHandler)||void 0===O?void 0:O.dispatch)||void 0===R||R.call(O,"onStreamMessage",x)),Le.setMergedContent(n,L),j.debug("Stream message dispatched (FULL with missing)",{msgId:n,seq:b,status:"STREAM_COMPLETED",incrementalLength:D.length,fullLength:L.length}),Le.clear(n),x}return j.debug("Stream message FULL ignored (no missing)",{msgId:n,seq:b}),void Le.clear(n)}if(Le.hasMissingSeqs(n))return void j.debug("Stream message has missing",{msgId:n,seq:b});for(var W=Le.getSequentialChunks(n),z=0,q=W;z<q.length;z++){var K=q[z],V=Le.getMergedContent(n)+K.text,J=(D=K.text,K.streamInfo.status);J===be.STREAM_FULL&&(J=Ie.COMPLETED),0!==K.streamInfo.errorType&&(J=Ie.ERROR),"seq"in(k=Ue(Ue({},K.streamInfo),{status:J,text:D}))&&delete k.seq,x=Pe(n,s,i,V,o,(F=Le.getChunks(n)[0].timestamp)||K.timestamp,k,c,u,l,h,p,m,g,v,E,y),!_&&(null===(S=null===(C=this.eventHandler)||void 0===C?void 0:C.dispatch)||void 0===S||S.call(C,"onStreamMessage",x)),Le.markDispatched(n,K.seq),Le.appendToMergedContent(n,K.text),j.debug("Stream message dispatched",{msgId:n,seq:K.seq,status:J,incrementalLength:D.length,mergedLength:V.length})}var Y=Le.getMergedContent(n);j.debug("Stream message processed",{msgId:n,seq:b,status:M,textLength:A.length,mergedLength:Y.length,dispatchedChunks:W.length})}catch(t){j.error("Error handling stream message",t,{msgId:n,msgBody:e})}},xe=function(){function e(e){var t=e.id;this.id=t,this.type=e.type}return e.prototype.set=function(e){this.body={id:this.id,ackId:e.id,type:"read",to:e.to,from:e.from||"",chatType:e.chatType}},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType,ackId:e.id,type:"read",to:e.to,from:e.from||"",ackContent:e.ackContent,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly}},e}(),Be=function(){function e(e){this.id=e.id,this.type=e.type}return e.prototype.set=function(e){this.body={id:this.id,ackId:e.ackId,type:"delivery",to:e.to,from:e.from||""}},e.create=function(e){return{id:_e.getUniqueId(),ackId:e.ackId,type:"delivery",to:e.to,from:e.from||"",isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly}},e}(),Ge=function(){function e(e){var t=e.type,r=e.id;this.id=r,this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"channel",to:e.to,from:e.from||"",time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),mid:e.mid,type:"channel",chatType:e.chatType||"singleChat",to:e.to,from:e.from||"",time:Date.now(),isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly}},e}(),je=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t,this.value=""}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"txt",to:e.to,msg:e.msg,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),isChatThread:e.isChatThread},this.value=e.msg},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){var t,r;return(null===(t=e.msgConfig)||void 0===t?void 0:t.languages)&&Array.isArray(null===(r=e.msgConfig)||void 0===r?void 0:r.languages),{type:"txt",id:_e.getUniqueId(),msg:e.msg,to:e.to,from:e.from||"",chatType:e.chatType,ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),He=function(){function e(e){var t=e.type,r=e.id;this.id=r||_e.getUniqueId(),this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"cmd",to:e.to,action:e.action,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),type:"cmd",to:e.to,from:e.from||"",chatType:e.chatType||"singleChat",action:e.action,time:Date.now(),ext:e.ext,msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Fe=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"custom",to:e.to,customEvent:e.customEvent,customExts:e.customExts,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"custom",to:e.to,customEvent:e.customEvent,customExts:e.customExts,from:e.from||"",ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),We=function(){function e(e){var t=e.type,r=e.id;this.id=r||_e.getUniqueId(),this.type=t}return e.prototype.set=function(e){this.body={id:this.id,chatType:e.chatType||"singleChat",type:"loc",to:e.to,addr:e.addr,buildingName:e.buildingName,lat:e.lat,lng:e.lng,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now()}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"loc",to:e.to,addr:e.addr,buildingName:e.buildingName,lat:e.lat,lng:e.lng,from:e.from||"",ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),ze=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"img",file:e.file,width:e.width,height:e.height,to:e.to,from:e.from||"",roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){var t,r,n,o,i,a,s,c=e.imageType,u=null===(n=null===(r=null===(t=e.file)||void 0===t?void 0:t.data)||void 0===r?void 0:r.type)||void 0===n?void 0:n.toLowerCase(),l=null===(i=null===(o=e.file)||void 0===o?void 0:o.filetype)||void 0===i?void 0:i.toLowerCase(),d=null===(s=null===(a=e.file)||void 0===a?void 0:a.filename)||void 0===s?void 0:s.toLowerCase(),h="image/gif"===u||"gif"===l||"image/gif"===l||!0===(null==d?void 0:d.endsWith(".gif")),p=e.isGif||h,f=p||!0===e.isOriginalImage||"original"===c;return{id:_e.getUniqueId(),chatType:e.chatType,type:"img",url:e.url,width:e.width,height:e.height,file:e.file,to:e.to,from:e.from||"",ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,file_length:e.file_length,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv,thumbnailWidth:e.thumbnailWidth,thumbnailHeight:e.thumbnailHeight,isGif:p,isOriginalImage:f}},e}(),qe=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"audio",file:e.file,filename:e.filename,length:e.length,file_length:e.file_length,fileInputId:e.fileInputId,to:e.to,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType,type:"audio",filename:e.filename,length:e.length,file:e.file,to:e.to,from:e.from||"",ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,file_length:e.file_length,msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Ke=function(){function e(e){var t=e.type,r=e.id;this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"video",file:e.file,filename:e.filename,length:e.length,file_length:e.file_length,fileInputId:e.fileInputId,to:e.to,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),apiUrl:e.apiUrl,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"video",file:e.file,filename:e.filename,length:e.length,file_length:e.file_length,fileInputId:e.fileInputId,to:e.to,from:e.from||"",ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Ve=function(){function e(e){var t=e.type,r=e.id;this.id=r,this.type=t}return e.prototype.set=function(e){e.file=e.file||e.fileInputId&&_e.getFileUrl(e.fileInputId),this.body={id:this.id,chatType:e.chatType||"singleChat",type:"file",file:e.file,filename:e.filename,fileInputId:e.fileInputId,to:e.to,from:e.from,roomType:e.roomType,success:e.success,fail:e.fail,ext:e.ext,time:Date.now(),onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,isChatThread:e.isChatThread}},e.prototype.setChatType=function(e){return!!this.body&&(this.body.chatType=e,!0)},e.prototype.setGroup=function(e){return!!this.body&&(this.body.group=e,!0)},e.create=function(e){return{id:_e.getUniqueId(),chatType:e.chatType||"singleChat",type:"file",file:e.file,filename:e.filename,fileInputId:e.fileInputId,file_length:e.file_length,to:e.to,from:e.from||"",ext:e.ext,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,body:e.body,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv}},e}(),Je=function(){function e(e){var t=e.type,r=e.id||_e.getUniqueId();this.id=r,this.type=t,this.value=""}return e.create=function(e){return{type:"combine",id:_e.getUniqueId(),to:e.to,from:e.from||"",chatType:e.chatType,ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,webhookEnv:e.webhookEnv,compatibleText:e.compatibleText,title:e.title,summary:e.summary,messageList:e.messageList,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete}},e}(),Ye=function(){function e(t,r){return this.type=t,this.id=r||_e.getUniqueId(),e.createOldMsg({type:t,id:this.id})}return e.createOldMsg=function(e){switch(e.type){case"read":return new xe({type:"read",id:e.id});case"delivery":return new Be({type:"delivery",id:e.id});case"channel":return new Ge({type:"channel",id:e.id});case"txt":return new je({type:"txt",id:e.id});case"cmd":return new He({type:"cmd",id:e.id});case"custom":return new Fe({type:"custom",id:e.id});case"loc":return new We({type:"loc",id:e.id});case"img":return new ze({type:"img",id:e.id});case"audio":return new qe({type:"audio",id:e.id});case"video":return new Ke({type:"video",id:e.id});case"file":return new Ve({type:"file",id:e.id})}},e.create=function(e){return"txt"!==(t=e).type||"version"in t?function(e){return"img"===e.type&&!("version"in e)}(e)?ze.create(e):function(e){return"cmd"===e.type&&!("version"in e)}(e)?He.create(e):function(e){return"file"===e.type&&!("version"in e)}(e)?Ve.create(e):function(e){return"audio"===e.type&&!("version"in e)}(e)?qe.create(e):function(e){return"video"===e.type&&!("version"in e)}(e)?Ke.create(e):function(e){return"custom"===e.type&&!("version"in e)}(e)?Fe.create(e):function(e){return"loc"===e.type&&!("version"in e)}(e)?We.create(e):function(e){return"channel"===e.type&&!("version"in e)}(e)?Ge.create(e):function(e){return"delivery"===e.type&&!("version"in e)}(e)?Be.create(e):function(e){return"read"===e.type&&!("version"in e)}(e)?xe.create(e):function(e){return"combine"===e.type&&!("version"in e)}(e)?Je.create(e):{}:je.create(e);var t},e.prototype.set=function(e){},e.getFileUrl=_e.getFileUrl,e.createImageMessage=function(e){return function(e){var t,r="image/gif"===e.file.filetype||(null===(t=e.file.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".gif")),n=r||!!e.isOriginalImage;return{id:_e.getUniqueId(),chatType:e.chatType,type:"img",to:e.to,from:e.from||"",file:{url:"",filename:e.file.filename,filetype:e.file.filetype||"",data:e.file.data||void 0},filename:e.file.filename,filetype:e.file.filetype||"",width:e.width,height:e.height,file_length:e.file.size,ext:e.ext,time:Date.now(),msgConfig:e.msgConfig,onFileUploadError:e.onFileUploadError,onFileUploadComplete:e.onFileUploadComplete,onFileUploadProgress:e.onFileUploadProgress,isChatThread:e.isChatThread,priority:e.priority,deliverOnlineOnly:e.deliverOnlineOnly,receiverList:e.receiverList,isGif:r,isOriginalImage:n,_useInternalUpload:!!e.file.path||void 0,_filePath:e.file.path}}(e)},e.download=_e.download,e.parseDownloadResponse=_e.parseDownloadResponse,e}();!function(e){e[e.CREATE=0]="CREATE",e[e.FAIL=1]="FAIL",e[e.INPROGRESS=2]="INPROGRESS",e[e.SUCCESS=3]="SUCCESS"}(De||(De={}));var Xe,Qe=function(){return Qe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Qe.apply(this,arguments)},Ze=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},$e=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};!function(e){e["chat:user"]="singleChat",e["chat:group"]="groupChat",e["chat:room"]="chatRoom"}(Xe||(Xe={}));var et={0:"TEXT",1:"IMAGE",2:"VIDEO",3:"LOCATION",4:"VOICE",5:"FILE",6:"COMMAND",7:"CUSTOM",8:"COMBINE"};function rt(e){for(var t={},r=0;r<e.length;r++)if(8===e[r].type)t[e[r].key]=JSON.parse(e[r].stringValue);else if(7===e[r].type)t[e[r].key]=e[r].stringValue;else if(6===e[r].type)t[e[r].key]=e[r].doubleValue;else if(5===e[r].type)t[e[r].key]=e[r].floatValue;else if(1===e[r].type){var n=e[r].varintValue,o=new(f())(n.low,n.high,n.unsigned).toString();t[e[r].key]=0!==Number(o)}else 2!==e[r].type&&3!==e[r].type&&4!==e[r].type||(n=e[r].varintValue,o=new(f())(n.low,n.high,n.unsigned).toString(),t[e[r].key]=Number(o));return t}function nt(e){var t="";return e.remotePath&&(t=_e.formatAttachUrl.call(this,e.remotePath),e.remotePath.includes("?em-redirect")||(t="".concat(t,"?em-redirect=true"),e.secretKey&&(t="".concat(t,"&share-secret=").concat(e.secretKey)))),t}function ot(e,t,r){var n=_e.formatAttachUrl.call(this,e),o=n.indexOf("#"),i=o>=0?n.slice(0,o):n,a=o>=0?n.slice(o):"",s=i.indexOf("?"),c=s>=0?i.slice(0,s):i,u=s>=0?i.slice(s+1):"",l=u?u.split("&"):[],d=function(e){return l.some((function(t){return t.split("=")[0]===e}))};return r&&!d("size")&&l.push("size=".concat(r)),d("em-redirect")||l.push("em-redirect=true"),t&&!d("share-secret")&&l.push("share-secret=".concat(t)),"".concat(c).concat(l.length?"?".concat(l.join("&")):"").concat(a)}function it(e,t){var r,n,o=t.from&&t.from.name;if(o===this.context.userId){var i=null===(r=null==e?void 0:e.from)||void 0===r?void 0:r.clientResource;o===(null===(n=null==t?void 0:t.to)||void 0===n?void 0:n.name)&&i&&i!==this.clientResource&&(o="".concat(o,"/").concat(i))}return o}function at(e,t){var r,n=t.to&&t.to.name;return(null===(r=null==e?void 0:e.to)||void 0===r?void 0:r.clientResource)&&(n="".concat(n,"/").concat(e.to.clientResource)),n}function st(e){var t,r,n,o,i,a,s,c,u,l,d,h,p,f,m,g,v,E,y,_,T,I,O,R,C,S,N;return Ze(this,void 0,void 0,(function(){var b,A,M,w,U,L,P,D,k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z,$,ee,te,re,ne,oe,ie,ae,se,ce,ue,le,de,he,pe,fe,me,ge,ve,Ee,ye,Te,Ie,Oe,Re,Ce,Se,be;return $e(this,(function(Ae){switch(Ae.label){case 0:switch(b=e.status,A=e.thirdMessage,M=e.msgBody,w=e.msgId,U=e.type,L=e.from,P=e.to,D=e.time,k=e.onlineState,x=e.chatType,B=e.ignoreCallback,G=e.priority,H=e.format,F=e.broadcast,W=void 0!==F&&F,z=e.isContentReplaced,q=void 0!==z&&z,K=e.meta,V={},J={},Y=b.errorCode>0,X=b.errorCode,Q=b.reason,Z={},$=[],ee=[],te={},re=null,ne=null,ie=!1,ae=!1,A.ext&&(Z=rt(A.ext)),A.meta&&"string"==typeof A.meta&&((se=JSON.parse(A.meta)).reaction&&($=se.reaction).forEach((function(e){e.isAddedBySelf=e.state,delete e.state})),se.translations&&(ee=se.translations),se.edit_msg&&(ce=se.edit_msg,ue=ce.count,le=ce.operator,de=ce.edit_time,te={operationTime:de,operatorId:le,operationCount:ue}),se.thread&&"{}"!==JSON.stringify(se.thread)&&(re={messageId:se.thread.msg_parent_id,parentId:se.thread.muc_parent_id,chatThreadName:se.thread.thread_name}),se.thread_overview&&"{}"!==JSON.stringify(se.thread_overview)&&(ne={id:se.thread_overview.id,parentId:se.thread_overview.muc_parent_id,name:se.thread_overview.name,lastMessage:se.thread_overview.last_message&&"{}"!==JSON.stringify(se.thread_overview.last_message)?Ne.call(this,se.thread_overview.last_message):null,createTimestamp:se.thread_overview.create_timestamp,updateTimestamp:se.thread_overview.update_timestamp,messageCount:se.thread_overview.message_count||0}),se.isDelivered&&(ie=!0),se.isRead&&(ae=!0)),M.type){case 0:return[3,1];case 1:return[3,8];case 2:return[3,11];case 3:return[3,14];case 4:return[3,17];case 5:return[3,20];case 6:return[3,23];case 7:return[3,24];case 8:return[3,27]}return[3,28];case 1:return Object.prototype.hasOwnProperty.call(M,"subType")&&0===M.subType?(oe=nt.call(this,M),he={id:w,type:"combine",chatType:x,to:P,from:L,ext:Z,time:Number(D),onlineState:k,title:M.title||"",summary:M.summary||"",url:oe||"",secret:M.secretKey||"",file_length:M.fileLength||0,filename:M.displayName||"",compatibleText:M.text,combineLevel:M.combineLevel||0},V.msgConfig&&(he.msgConfig=V.msgConfig),$.length>0&&(he.reactions=$),re&&(he.chatThread=re),ne&&(he.chatThreadOverview=ne),"chatRoom"===x&&(he.priority=G,he.broadcast=W),te.operationCount>0&&(he.modifiedInfo=te),q&&(he.isContentReplaced=q),ae&&(he.isRead=!0),ie&&(he.isDelivered=!0),J=he,B?[3,3]:[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(he,De.SUCCESS)]):[3,4];case 2:Ae.sent(),null===(n=this.eventHandler)||void 0===n||n.dispatch("onCombineMessage",he),Ae.label=3;case 3:return[3,29];case 4:return Object.prototype.hasOwnProperty.call(M,"subType")&&10===M.subType&&A.stream?(pe=ke.call(this,M,A,K,w,L,P,D,x,k,Z,$,ee,te,re,ne,q,ae,ie,null!=B&&B),J=pe,[3,29]):[3,5];case 5:return!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,data:M.text,ext:Z,sourceMsg:M.text,time:D,msgConfig:A.msgConfig,onlineState:k}).msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onTextMessage&&this.onTextMessage(V),fe={id:w,type:"txt",chatType:x,msg:M.text,to:P,from:L,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(fe.msgConfig=V.msgConfig),$.length>0&&(fe.reactions=$),re&&(fe.chatThread=re),ne&&(fe.chatThreadOverview=ne),ee.length>0&&(fe.translations=ee),te.operationCount>0&&(fe.modifiedInfo=te),"chatRoom"===x&&(fe.priority=G,fe.broadcast=W),q&&(fe.isContentReplaced=q),ae&&(fe.isRead=!0),ie&&(fe.isDelivered=!0),J=fe,B?[3,7]:[4,null===(i=null===(o=this._localCache)||void 0===o?void 0:o.getInstance())||void 0===i?void 0:i.storeMessage(fe,De.SUCCESS)];case 6:Ae.sent(),null===(a=this.eventHandler)||void 0===a||a.dispatch("onTextMessage",fe),Ae.label=7;case 7:return[3,29];case 8:return me=(null===(s=null==M?void 0:M.size)||void 0===s?void 0:s.width)||0,ge=(null===(c=null==M?void 0:M.size)||void 0===c?void 0:c.height)||0,oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,thumb:this.useOwnUploadFun?"":"".concat(oe,"&thumbnail=true"),thumb_secret:M.secretKey,file_length:M.fileLength||"",width:me,height:ge,filetype:M.filetype||"",accessToken:this.token,ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onPictureMessage&&this.onPictureMessage(V),ve={id:w,type:"img",chatType:x,from:L,to:P,url:oe||"",width:me,height:ge,secret:M.secretKey||"",thumb:this.useOwnUploadFun?"":"".concat(oe,"&thumbnail=true"),thumb_secret:M.secretKey,file_length:M.fileLength||0,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(ve.msgConfig=V.msgConfig),$.length>0&&(ve.reactions=$),re&&(ve.chatThread=re),ne&&(ve.chatThreadOverview=ne),"chatRoom"===x&&(ve.priority=G,ve.broadcast=W),te.operationCount>0&&(ve.modifiedInfo=te),q&&(ve.isContentReplaced=q),ae&&(ve.isRead=!0),ie&&(ve.isDelivered=!0),Object.prototype.hasOwnProperty.call(M,"subType")&&1===M.subType&&(ve.isGif=!0),ve.isOriginalImage=!(2===M.imageType&&!ve.isGif),M.remotePath&&!this.useOwnUploadFun?(ve.originalImageUrl=ot.call(this,M.remotePath,M.secretKey),ve.bigImageUrl=ot.call(this,M.remotePath,M.secretKey,"large"),ve.thumb="".concat(oe,"&thumbnail=true")):M.remotePath&&this.useOwnUploadFun&&(ve.originalImageUrl=M.remotePath),J=ve,B?[3,10]:[4,null===(l=null===(u=this._localCache)||void 0===u?void 0:u.getInstance())||void 0===l?void 0:l.storeMessage(ve,De.SUCCESS)];case 9:Ae.sent(),null===(d=this.eventHandler)||void 0===d||d.dispatch("onImageMessage",ve),Ae.label=10;case 10:return[3,29];case 11:return oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,length:M.duration||"",file_length:M.fileLength||"",filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onVideoMessage&&this.onVideoMessage(V),Ee={id:w,type:"video",chatType:x,from:L,to:P,url:oe,secret:M.secretKey,thumb:_e.formatAttachUrl.call(this,M.thumbnailRemotePath),thumb_secret:M.thumbnailSecretKey,filename:M.displayName,length:M.duration||0,file:{},file_length:M.fileLength||0,filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Ee.msgConfig=V.msgConfig),$.length>0&&(Ee.reactions=$),re&&(Ee.chatThread=re),ne&&(Ee.chatThreadOverview=ne),"chatRoom"===x&&(Ee.priority=G,Ee.broadcast=W),te.operationCount>0&&(Ee.modifiedInfo=te),q&&(Ee.isContentReplaced=q),ae&&(Ee.isRead=!0),ie&&(Ee.isDelivered=!0),J=Ee,B?[3,13]:[4,null===(p=null===(h=this._localCache)||void 0===h?void 0:h.getInstance())||void 0===p?void 0:p.storeMessage(Ee,De.SUCCESS)];case 12:Ae.sent(),null===(f=this.eventHandler)||void 0===f||f.dispatch("onVideoMessage",Ee),Ae.label=13;case 13:return[3,29];case 14:return!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,addr:M.address,buildingName:M.buildingName,lat:M.latitude,lng:M.longitude,ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onLocationMessage&&this.onLocationMessage(V),ye={id:w,type:"loc",chatType:x,from:L,to:P,buildingName:M.buildingName,addr:M.address,lat:M.latitude,lng:M.longitude,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(ye.msgConfig=V.msgConfig),$.length>0&&(ye.reactions=$),re&&(ye.chatThread=re),ne&&(ye.chatThreadOverview=ne),"chatRoom"===x&&(ye.priority=G,ye.broadcast=W),te.operationCount>0&&(ye.modifiedInfo=te),q&&(ye.isContentReplaced=q),ae&&(ye.isRead=!0),ie&&(ye.isDelivered=!0),J=ye,B?[3,16]:[4,null===(g=null===(m=this._localCache)||void 0===m?void 0:m.getInstance())||void 0===g?void 0:g.storeMessage(ye,De.SUCCESS)];case 15:Ae.sent(),null===(v=this.eventHandler)||void 0===v||v.dispatch("onLocationMessage",ye),Ae.label=16;case 16:return[3,29];case 17:return oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,file_length:M.fileLength||"",accessToken:this.token||"",ext:Z,length:M.duration,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onAudioMessage&&this.onAudioMessage(V),Te={id:w,type:"audio",chatType:x,from:L,to:P,url:oe,secret:M.secretKey,file:{},filename:M.displayName,length:M.duration||0,file_length:M.fileLength||0,filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Te.msgConfig=V.msgConfig),$.length>0&&(Te.reactions=$),re&&(Te.chatThread=re),ne&&(Te.chatThreadOverview=ne),"chatRoom"===x&&(Te.priority=G,Te.broadcast=W),te.operationCount>0&&(Te.modifiedInfo=te),q&&(Te.isContentReplaced=q),ae&&(Te.isRead=!0),ie&&(Te.isDelivered=!0),J=Te,B?[3,19]:[4,null===(y=null===(E=this._localCache)||void 0===E?void 0:E.getInstance())||void 0===y?void 0:y.storeMessage(Te,De.SUCCESS)];case 18:Ae.sent(),null===(_=this.eventHandler)||void 0===_||_.dispatch("onAudioMessage",Te),Ae.label=19;case 19:return[3,29];case 20:return oe=this.useOwnUploadFun?M.remotePath:nt.call(this,M),!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,url:oe,secret:M.secretKey,filename:M.displayName,file_length:M.fileLength,accessToken:this.token||"",ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).delay&&delete V.delay,!V.msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onFileMessage&&this.onFileMessage(V),Ie={id:w,type:"file",chatType:x,from:L,to:P,url:oe,secret:M.secretKey,file:{},filename:M.displayName,length:M.duration||0,file_length:M.fileLength||0,filetype:M.filetype||"",accessToken:this.token||"",ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Ie.msgConfig=V.msgConfig),$.length>0&&(Ie.reactions=$),re&&(Ie.chatThread=re),ne&&(Ie.chatThreadOverview=ne),"chatRoom"===x&&(Ie.priority=G,Ie.broadcast=W),te.operationCount>0&&(Ie.modifiedInfo=te),q&&(Ie.isContentReplaced=q),ae&&(Ie.isRead=!0),ie&&(Ie.isDelivered=!0),J=Ie,B?[3,22]:[4,null===(I=null===(T=this._localCache)||void 0===T?void 0:T.getInstance())||void 0===I?void 0:I.storeMessage(Ie,De.SUCCESS)];case 21:Ae.sent(),null===(O=this.eventHandler)||void 0===O||O.dispatch("onFileMessage",Ie),Ae.label=22;case 22:return[3,29];case 23:return!(V={id:w,type:U,contentsType:et[M.type],from:L,to:P,action:M.action,ext:Z,time:D,msgConfig:A.msgConfig,onlineState:k}).msgConfig&&delete A.msgConfig,V.error=Y,V.errorText=Q,V.errorCode=X,!B&&this.onCmdMessage&&this.onCmdMessage(V),Oe={id:w,type:"cmd",chatType:x,from:L,to:P,action:M.action,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Oe.msgConfig=V.msgConfig),$.length>0&&(Oe.reactions=$),re&&(Oe.chatThread=re),ne&&(Oe.chatThreadOverview=ne),"chatRoom"===x&&(Oe.priority=G,Oe.broadcast=W),te.operationCount>0&&(Oe.modifiedInfo=te),q&&(Oe.isContentReplaced=q),ae&&(Oe.isRead=!0),ie&&(Oe.isDelivered=!0),J=Oe,B||null===(R=this.eventHandler)||void 0===R||R.dispatch("onCmdMessage",Oe),[3,29];case 24:return Re={},Ce={},A.contents[0].customExts&&(Re=rt(A.contents[0].customExts)),A.contents[0].params&&(Ce=rt(A.contents[0].params)),V={id:w,type:U,contentsType:et[M.type],from:L,to:P,customEvent:M.customEvent,params:Ce,customExts:Re,ext:Z,time:D,onlineState:k},!B&&this.onCustomMessage&&this.onCustomMessage(V),Se={id:w,type:"custom",chatType:x,from:L,to:P,customEvent:M.customEvent,params:Ce,customExts:Re,ext:Z,time:Number(D),onlineState:k},V.msgConfig&&(Se.msgConfig=V.msgConfig),$.length>0&&(Se.reactions=$),re&&(Se.chatThread=re),ne&&(Se.chatThreadOverview=ne),te.operationCount>0&&(Se.modifiedInfo=te),"chatRoom"===x&&(Se.priority=G,Se.broadcast=W),q&&(Se.isContentReplaced=q),ae&&(Se.isRead=!0),ie&&(Se.isDelivered=!0),J=Se,B?[3,26]:[4,null===(S=null===(C=this._localCache)||void 0===C?void 0:C.getInstance())||void 0===S?void 0:S.storeMessage(Se,De.SUCCESS)];case 25:Ae.sent(),null===(N=this.eventHandler)||void 0===N||N.dispatch("onCustomMessage",Se),Ae.label=26;case 26:return[3,29];case 27:return oe=nt.call(this,M),be={id:w,type:"combine",chatType:x,to:P,from:L,ext:Z,time:Number(D),onlineState:k,title:M.title||"",summary:M.summary||"",url:oe||"",secret:M.secretKey||"",file_length:M.fileLength||0,filename:M.displayName||"",compatibleText:M.text,combineLevel:M.combineLevel||0},V.msgConfig&&(be.msgConfig=V.msgConfig),$.length>0&&(be.reactions=$),re&&(be.chatThread=re),ne&&(be.chatThreadOverview=ne),"chatRoom"===x&&(be.priority=G,be.broadcast=W),te.operationCount>0&&(be.modifiedInfo=te),q&&(be.isContentReplaced=q),ae&&(be.isRead=!0),ie&&(be.isDelivered=!0),J=be,!B&&this.eventHandler&&this.eventHandler.dispatch("onCombineMessage",be),[3,29];case 28:return j.error("Unknow message type, message:",M),[3,29];case 29:return H?[2,J]:[2,V]}}))}))}function ct(e,t,r){if(this.delivery&&e!==t){var n=this.getUniqueId(),o=new Ye("delivery",n);o.set({ackId:r,to:e}),j.debug("send delivery ack"),this.send(o.body)}}var ut=function(e,t,r,n,o){var i,a,s,c,u,l,d,h,p,m,g,v,E,y,_,T,I,O,R,C,S,N,b,A,M,w,U,L,P,D;return Ze(this,void 0,void 0,(function(){var k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z,$,ee,te,re,ne,oe,ie,ae,se,ce,ue,le,de,he,pe,fe,me,ge,ve,Ee,ye,Te,Ie,Oe,Re,Ce,Se,Ne,be;return $e(this,(function(we){switch(we.label){case 0:if(k=new(f())(e.timestamp.low,e.timestamp.high,e.timestamp.unsigned).toString(),x=this.root.lookup("easemob.pb.MessageBody"),B=x.decode(e.payload),G=3,H=!1,F=new(f())(e.id.low,e.id.high,e.id.unsigned).toString(),o&&e.from&&e.from.name===this.context.userId&&e.from.clientResource===this.clientResource&&B.type===sr.CHATROOM)return[2,j.debug("Discard your own chat room message:",F)];if(W=(null===(i=e.from)||void 0===i?void 0:i.name)||"",z=e.to?e.to.name:"",q=!!e.to&&-1!==e.to.domain.indexOf("conference"),this._load_msg_cache.some((function(e){return e.msgId===F}))&&10!==B.contents[0].subType&&!r)return[2,j.debug("Discard message in cache:",F)];if(this._load_msg_cache.length<=this.max_cache_length||this._load_msg_cache.shift(),this._load_msg_cache.push({msgId:F,from:W,to:z,isGroup:q}),e.meta&&e.meta.length){if(K=_e.parseNotify(e.meta),V=K.is_online,J=K.callback_replace,this.useReplacedMessageContents&&J&&(H=!0),V||0===V)switch(V){case 0:G=0;break;case 1:G=1;break;default:G=2}}else G=3;switch(Y=B.ackMessageId?new(f())(B.ackMessageId.low,B.ackMessageId.high,B.ackMessageId.unsigned).toString():"",X="",Q=it.call(this,e,B),Z=at.call(this,e,B),j.debug("received message:",{metaId:F,metaNs:e.ns,type:B.type,from:Q,to:Z,contentType:null===(s=null===(a=B.contents)||void 0===a?void 0:a[0])||void 0===s?void 0:s.type,contentLen:null===(c=B.contents)||void 0===c?void 0:c.length}),B.type){case sr.SINGLECHAT:return[3,1];case sr.GROUPCHAT:return[3,2];case sr.CHATROOM:return[3,3];case sr.READ_ACK:return[3,4];case sr.DELIVER_ACK:return[3,5];case sr.RECALL:return[3,6];case sr.CHANNEL_ACK:return[3,15];case sr.EDIT:return[3,16]}return[3,20];case 1:return X="chat","agoraToken"===this.grantType&&(X="singleChat"),this.delivery&&!r&&Q!==this.context.userId&&10!==(null===(u=B.contents[0])||void 0===u?void 0:u.subType)&&ct.call(this,Q,Z,F),[3,21];case 2:return X="groupchat","agoraToken"===this.grantType&&(X="groupChat"),[3,21];case 3:return X="chatroom","agoraToken"===this.grantType&&(X="chatRoom"),G=1,[3,21];case 4:return X="read_ack",$=void 0,B.ext[0]&&JSON.parse(B.ext[0].stringValue)?($={id:F,type:"read",from:Q,to:Z,mid:Y,groupReadCount:B.ext[0]&&JSON.parse(B.ext[0].stringValue),ackContent:B.ackContent,onlineState:G},this.onReadMessage&&this.onReadMessage($),null===(l=this.eventHandler)||void 0===l||l.dispatch("onReadMessage",$),[2]):($={id:F,type:"read",from:Q,to:Z,mid:Y,onlineState:G},this.onReadMessage&&this.onReadMessage($),null===(d=this.eventHandler)||void 0===d||d.dispatch("onReadMessage",$),[2]);case 5:return X="deliver_ack",this.onDeliveredMessage&&this.onDeliveredMessage({id:F,type:"delivery",from:Q,to:Z,mid:Y,onlineState:G}),ee={id:F,type:"delivery",from:Q,to:Z,mid:Y,onlineState:G},null===(h=this.eventHandler)||void 0===h||h.dispatch("onDeliveredMessage",ee),[2];case 6:return X="recall",te="",e.ext&&(te=(null===(p=rt(e.ext))||void 0===p?void 0:p.recallMessageExtensionInfo)||""),re={id:F,from:Q||"admin",to:Z,mid:Y,ext:te,onlineState:G},ne=Z===this.user?Q:Z,[4,null===(g=null===(m=this._localCache)||void 0===m?void 0:m.getInstance())||void 0===g?void 0:g.getMessageByServerMsgId(re.mid)];case 7:return(oe=we.sent())?[4,null===(E=null===(v=this._localCache)||void 0===v?void 0:v.getInstance())||void 0===E?void 0:E.removeMsgByServerMsgId(re.mid)]:[3,9];case 8:we.sent(),we.label=9;case 9:return"singleChat"!==(null==oe?void 0:oe.chatType)&&"groupChat"!==(null==oe?void 0:oe.chatType)?[3,14]:(ie=(null==oe?void 0:oe.from)===this.user||""===(null==oe?void 0:oe.from),[4,null===(_=null===(y=this._localCache)||void 0===y?void 0:y.getInstance())||void 0===_?void 0:_.getConversationLastMessage(ne,oe.chatType)]);case 10:return ae=we.sent(),[4,null===(I=null===(T=this._localCache)||void 0===T?void 0:T.getInstance())||void 0===I?void 0:I.getConversationBySessionId(Ae({conversationId:ne,conversationType:oe.chatType}))];case 11:return(se=we.sent())?[4,null===(R=null===(O=this._localCache)||void 0===O?void 0:O.getInstance())||void 0===R?void 0:R.updateLocalConversation(Ae({conversationId:ne,conversationType:oe.chatType}),{lastMessageId:null==ae?void 0:ae.serverMsgId,unReadCount:Me({conversation:se,isRecallSelfMsg:ie,recalledMsgTime:oe.time})})]:[3,13];case 12:we.sent(),we.label=13;case 13:we.label=14;case 14:return this.onRecallMessage&&this.onRecallMessage(re),null===(C=this.eventHandler)||void 0===C||C.dispatch("onRecallMessage",re),[2];case 15:return this.onChannelMessage&&this.onChannelMessage({id:F,mid:Y,type:"channel",chatType:"singleChat",from:Q,to:Z,time:Number(k),onlineState:G}),ce={id:F,mid:Y,type:"channel",chatType:"singleChat",from:Q,to:Z,time:Number(k),onlineState:G},null===(S=this.eventHandler)||void 0===S||S.dispatch("onChannelMessage",ce),[2];case 16:return ue={errorCode:0,reason:""},le="",de=0,he="",B.meta&&"string"==typeof B.meta&&(pe=JSON.parse(B.meta)).edit_msg&&(fe=pe.edit_msg,me=fe.sender,ge=fe.send_time,ve=fe.chat_type,le=me,de=ge,he=Xe[ve]),Ee=B.editMessageId&&new(f())(B.editMessageId.low,B.editMessageId.high,B.editMessageId.unsigned).toString(),ye=B.editScope,[4,st.call(this,{status:ue,thirdMessage:B,msgBody:B.contents[0],msgId:Ee,type:X,from:le,to:Z,time:de,onlineState:G,ignoreCallback:!0,format:!0,isContentReplaced:H})];case 17:return(Te=we.sent()).chatType=he,e.ignoreCallback?[2,Te]:Te?[4,null===(b=null===(N=this._localCache)||void 0===N?void 0:N.getInstance())||void 0===b?void 0:b.getMessageByServerMsgId(Te.id)]:[3,19];case 18:(Ie=we.sent())&&(Oe=Ie.ext||{},(ye===cr.BODY_AND_EXT||Object.keys(Te.ext||{}).length>0)&&(Oe=Te.ext),"txt"===Te.type&&"txt"===Ie.type?null===(M=null===(A=this._localCache)||void 0===A?void 0:A.getInstance())||void 0===M||M.putMessageToDB(Qe(Qe({},Ie),{msg:Te.msg,modifiedInfo:Te.modifiedInfo,translations:Te.translations,ext:Oe})):"custom"===Te.type&&"custom"===Ie.type?null===(U=null===(w=this._localCache)||void 0===w?void 0:w.getInstance())||void 0===U||U.putMessageToDB(Qe(Qe({},Ie),{ext:Oe,customExts:Te.customExts,customEvent:Te.customEvent,modifiedInfo:Te.modifiedInfo})):null===(P=null===(L=this._localCache)||void 0===L?void 0:L.getInstance())||void 0===P||P.putMessageToDB(Qe(Qe({},Ie),{ext:Oe,modifiedInfo:Te.modifiedInfo}))),we.label=19;case 19:return null===(D=this.eventHandler)||void 0===D||D.dispatch("onModifiedMessage",Te),[2];case 20:return j.error("unexpected message type: ".concat(B.type)),[2];case 21:Re="normal",Se=!1,"chat"===X.toLowerCase()||"singleChat"===X?Ce="singleChat":"groupchat"===X.toLowerCase()||"groupChat"===X?Ce="groupChat":(Ce="chatRoom",G=1,e.ext&&(Ne=rt(e.ext),Se=!!(null==Ne?void 0:Ne.is_broadcast),Re=0===Ne.chatroom_msg_tag?"high":2===Ne.chatroom_msg_tag?"low":"normal")),be=0,we.label=22;case 22:return be<B.contents.length?[4,st.call(this,{status:t,thirdMessage:B,msgBody:B.contents[be],msgId:F,type:X,from:Q,to:Z,time:k,onlineState:G,chatType:Ce,ignoreCallback:r,priority:Re,format:n,broadcast:Se,isContentReplaced:H,meta:e})]:[3,25];case 23:return[2,we.sent()];case 24:return be++,[3,22];case 25:return[2]}}))}))},lt=function(){return lt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},lt.apply(this,arguments)},dt=["public","members_only","allow_user_invites","invite_need_confirm"],ht={name:"name",title:"name",description:"description",public:"public",members_only:"approval",allow_user_invites:"allowInvites",max_users:"maxUsers",invite_need_confirm:"inviteNeedConfirm",custom:"ext",last_modified:"lastModified",avatar:"avatar"};function pt(e,t){var r,n,o,i,a,s,c=this,u=this.context,l=u.userId,d=u.jid,h=t.from.name===l&&d.clientResource!==t.from.clientResource;return t.isThread?(o={id:t.mucId.name,name:t.mucName,operation:"",parentId:t.mucParentId.name,operator:t.from.name,userName:t.to.length?t.to[0].name:""},i={chatThreadId:t.mucId.name,chatThreadName:t.mucName,operation:"",parentId:t.mucParentId.name}):(n={type:"",owner:t.from.name,gid:t.mucId.name,from:t.from.name,fromJid:t.from,to:t.to.length?t.to[0].name:"",toJid:t.to,chatroom:t.isChatroom,status:t.status},a={operation:"",id:t.mucId.name,from:t.from.name},t.isChatroom&&(null===(r=null==t?void 0:t.eventInfo)||void 0===r?void 0:r.ext)&&(s=JSON.parse(t.eventInfo.ext))),({45:function(){var e,r,n;a.operation="memberAttributesUpdate";var o=JSON.parse(null===(e=null==t?void 0:t.eventInfo)||void 0===e?void 0:e.ext)||{};a.attributes=o.properties||{},a.userId=o.username||"",h?null===(r=c.eventHandler)||void 0===r||r.dispatch("onMultiDeviceEvent",a):null===(n=c.eventHandler)||void 0===n||n.dispatch("onGroupEvent",a)},44:function(){var e;a.operation="removeChatRoomAttributes",a.attributes=s.result.successKeys,s.result.successKeys.length>0&&(null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomEvent",a))},43:function(){var e;a.operation="updateChatRoomAttributes";var t={};s.result.successKeys.forEach((function(e){t[e]=s.properties[e]})),a.attributes=t,s.result.successKeys.length>0&&(null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomEvent",a))},42:function(){},41:function(){},40:function(){},39:function(){},38:function(){var e;i.operation="chatThreadNameUpdate",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},37:function(){var e;o.operation="userRemove",null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatThreadChange",o)},36:function(){var e;i.operation="chatThreadLeave",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},35:function(){var e;i.operation="chatThreadJoin",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},34:function(){var e;i.operation="chatThreadDestroy",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},33:function(){var e;i.operation="chatThreadCreate",null===(e=c.eventHandler)||void 0===e||e.dispatch("onMultiDeviceEvent",i)},32:function(){var e,r,o,i;n.type=t.isChatroom?"rmChatRoomMute":"rmGroupMute",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="unmuteAllMembers",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},31:function(){var e,r,o,i;n.type=t.isChatroom?"muteChatRoom":"muteGroup",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="muteAllMembers",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},30:function(){var e,r,o,i;n.type=t.isChatroom?"rmUserFromChatRoomWhiteList":"rmUserFromGroupWhiteList",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="removeAllowlistMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},29:function(){var e,r,o,i;n.type=t.isChatroom?"addUserToChatRoomWhiteList":"addUserToGroupWhiteList",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="addUserToAllowlist",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},28:function(){var e,r,o,i;n.type="deleteFile",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="deleteFile",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},27:function(){var e,r,o,i;n.type="uploadFile",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="uploadFile",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},26:function(){var e,r,o,i;n.type="deleteAnnouncement",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="deleteAnnouncement",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},25:function(){var e,r,o,i;n.type="updateAnnouncement",n.announcement=t.reason,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="updateAnnouncement",a.announcement=t.reason,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},24:function(){var e,r,o,i;n.type="removeMute",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="unmuteMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},23:function(){var e,r,o,i;if(n.type="addMute",c.onPresence&&c.onPresence(n),t.ext&&"string"==typeof t.ext){var s=JSON.parse(t.ext);s.user_mute_time&&(n.muteTimestamp=s.user_mute_time,a.muteTimestamp=s.user_mute_time)}t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="muteMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},22:function(){var e,r,o,i;n.type="removeAdmin",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="removeAdmin",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},21:function(){var e,r,o,i;n.type="addAdmin",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="setAdmin",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},20:function(){var e,r,o,i;n.type="changeOwner",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="changeOwner",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},19:function(){var e,r,o,i;n.type="direct_joined",n.groupName=t.mucName,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="directJoined",a.name=t.mucName,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},18:function(){var e,r,o,i,s;n.type=t.isChatroom?"leaveChatRoom":"leaveGroup",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n);var u=t.mucMemberCount;if(u&&(a.memberCount=u),a.operation="memberAbsence",t.members&&t.members.length>0){var l=lt({},a);l.members=t.members,l.operation="membersAbsence",delete l.from,t.isChatroom?t.members.forEach((function(e){var t;null===(t=c.eventHandler)||void 0===t||t.dispatch("onChatroomEvent",lt(lt({},a),{from:e}))})):null===(o=c.eventHandler)||void 0===o||o.dispatch("onGroupEvent",l)}else t.isChatroom?null===(i=c.eventHandler)||void 0===i||i.dispatch("onChatroomEvent",a):null===(s=c.eventHandler)||void 0===s||s.dispatch("onGroupEvent",a)},17:function(){var e,r,o,i,s;t.isChatroom&&t.ext&&(a.ext=t.ext,n.ext=t.ext),n.type=t.isChatroom?"memberJoinChatRoomSuccess":"memberJoinPublicGroupSuccess",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n);var u=t.mucMemberCount;if(a.operation="memberPresence",u&&(a.memberCount=u),t.members&&t.members.length>0){var l=lt({},a);l.members=t.members,l.operation="membersPresence",delete l.from,t.isChatroom?t.members.forEach((function(e){var t;null===(t=c.eventHandler)||void 0===t||t.dispatch("onChatroomEvent",lt(lt({},a),{from:e}))})):null===(o=c.eventHandler)||void 0===o||o.dispatch("onGroupEvent",l)}else t.isChatroom?null===(i=c.eventHandler)||void 0===i||i.dispatch("onChatroomEvent",a):null===(s=c.eventHandler)||void 0===s||s.dispatch("onGroupEvent",a)},16:function(){var e,r;n.type="unblock",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},15:function(){var e,r;n.type="block",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},14:function(){var e,r,o,i,s,u=t.isChatroom;if(!u){var l=JSON.parse((null===(e=null==t?void 0:t.eventInfo)||void 0===e?void 0:e.ext)||"{}",(function(e,t){return"last_modified"===e?Number(t):dt.includes(e)?"true"===t||!0===t:t}));a.detail=n.detail={},Object.keys(l).forEach((function(e){var t=ht[e];if(t){var r=l[e];a.detail&&(a.detail[t]=r),n.detail&&(n.detail[t]=r)}}))}n.type="update",c.onPresence&&c.onPresence(n),u?null===(r=c.eventHandler)||void 0===r||r.dispatch("onChatroomChange",n):null===(o=c.eventHandler)||void 0===o||o.dispatch("onGroupChange",n),a.operation="updateInfo",u?null===(i=c.eventHandler)||void 0===i||i.dispatch("onChatroomEvent",a):null===(s=c.eventHandler)||void 0===s||s.dispatch("onGroupEvent",a)},13:function(){var e,r,o,i;n.type="allow",n.reason=t.reason,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),t.reason&&"undefined"!==t.reason&&(a.reason=t.reason),a.operation="unblockMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},12:function(){var e,r;n.type="ban",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},11:function(){var e,r;n.type="getBlackList",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},10:function(){var e,r,o,i;n.type="removedFromGroup",n.kicked=n.to,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="removeMember",a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},9:function(){var e,r,o,i;n.type="invite_decline",n.kicked=n.to,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="rejectInvite",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},8:function(){var e,r,o,i;n.type="invite_accept",n.kicked=n.to,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="acceptInvite",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},7:function(){var e,r,o,i;n.type="invite",n.kicked=n.to,n.groupName=t.mucName,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="inviteToJoin",a.name=t.mucName,a.userId=n.to,t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},6:function(){var e,r,o,i;n.type="joinPublicGroupDeclined",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="joinPublicGroupDeclined",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):(a.userId=t.to.length?t.to[0].name:"",null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a))},5:function(){var e,r,o,i;n.type="joinPublicGroupSuccess",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="acceptRequest",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},4:function(){var e,r,o,i;n.type="joinGroupNotifications",n.reason=t.reason,c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),t.reason&&"undefined"!==t.reason&&(a.reason=t.reason),a.operation="requestToJoin",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},3:function(){var e,r;n.type="leave",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},2:function(){var e,r;n.type="join",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n)},1:function(){var e,r,o,i;n.type="deleteGroupChat",c.onPresence&&c.onPresence(n),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",n):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",n),a.operation="destroy",t.isChatroom?null===(o=c.eventHandler)||void 0===o||o.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},0:function(){var e,r;a.operation="create",t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomEvent",a):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupEvent",a)}}[e]||function(){console.error("No match operation ".concat(e))})()}var ft,mt=function(e){var t=this.root.lookup("easemob.pb.MUCBody").decode(e.payload),r=t.operation;j.debug("onMucMessage",t),pt.call(this,r,t)},gt={handleRosterMsg:function(e){var t,r,n,o,i,a,s=this.root.lookup("easemob.pb.RosterBody").decode(e.payload),c={type:"",to:s.to[0].name,from:s.from.name,status:s.reason};switch(s.operation){case 2:c.type="subscribe",this.onContactInvited&&this.onContactInvited(c),null===(t=this.eventHandler)||void 0===t||t.dispatch("onContactInvited",c);break;case 3:c.type="unsubscribed",this.onContactDeleted&&this.onContactDeleted(c),null===(r=this.eventHandler)||void 0===r||r.dispatch("onContactDeleted",c);break;case 4:c.type="subscribed",this.onContactAdded&&this.onContactAdded(c),null===(n=this.eventHandler)||void 0===n||n.dispatch("onContactAdded",c);break;case 5:c.type="unsubscribed",this.onContactRefuse&&this.onContactRefuse(c),null===(o=this.eventHandler)||void 0===o||o.dispatch("onContactRefuse",c);break;case 6:case 7:break;case 8:c.type="subscribed",this.onContactAgreed&&this.onContactAgreed(c),null===(i=this.eventHandler)||void 0===i||i.dispatch("onContactAgreed",c);break;case 9:c.type="unsubscribed",this.onContactRefuse&&this.onContactRefuse(c),null===(a=this.eventHandler)||void 0===a||a.dispatch("onContactRefuse",c);break;default:j.error("handleRosterMsg:",s)}this.onPresence&&c.type&&this.onPresence(c)}},vt=function(e){var t,r,n,o,i,a,s=this.root.lookup("easemob.pb.StatisticsBody").decode(e.payload),c=s.operation,u=s.reason;switch(c){case 0:this.onStatisticMessage&&this.onStatisticMessage(s),null===(t=this.eventHandler)||void 0===t||t.dispatch("onStatisticMessage",s);break;case 1:a=m.create({type:d.WEBIM_CONNCTION_USER_REMOVED,message:"user has been removed"}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(r=this.eventHandler)||void 0===r||r.dispatch("onError",a),Le.clearAll();break;case 2:a=m.create({type:d.WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE,message:"the user is already logged on another device"}),u&&(a.data={loginInfoCustomExt:s.reason}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(n=this.eventHandler)||void 0===n||n.dispatch("onError",a),Le.clearAll();break;case 3:a=m.create({type:d.WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD,message:"the user was kicked by changing password"}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(o=this.eventHandler)||void 0===o||o.dispatch("onError",a),Le.clearAll();break;case 4:a=m.create({type:d.WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE,message:"the user was kicked by other device"}),this.disconnectedReason=a,this.logOut=!0,this.onError&&this.onError(a),null===(i=this.eventHandler)||void 0===i||i.dispatch("onError",a),Le.clearAll();break;default:j.error("handleStatisticsMsg:",s)}};function Et(e){var t,r=[],n=[],o=e.data;o&&o.values&&o.values.forEach((function(e){Object.entries(e.status).forEach((function(e){n.push({device:e[0],status:Number(e[1])})})),r.push({userId:e.uid,lastTime:Number(e.last_time),expire:Number(e.expiry),ext:e.ext,statusDetails:n})})),this.onPresenceStatusChange&&this.onPresenceStatusChange(r),null===(t=this.eventHandler)||void 0===t||t.dispatch("onPresenceStatusChange",r)}function yt(e){var t=this;e.data.forEach((function(e){var r,n={from:e.from,to:e.to,chatType:"chat"===e.channel_type?"singleChat":"groupChat",messageId:e.messageId,reactions:e.reactions,ts:e.ts};null===(r=t.eventHandler)||void 0===r||r.dispatch("onReactionChange",n)}))}function _t(e){var t,r,n,o;if(e.data){var i=e.data,a={id:i.id||"",name:i.name||"",parentId:i.muc_parent_id||"",messageId:i.msg_parent_id||"",timestamp:i.timestamp||0,operator:i.from||"",operation:""};switch(i.operation){case"create":a.operation="create",a.createTimestamp=a.timestamp,a.messageCount=0,null===(t=this.eventHandler)||void 0===t||t.dispatch("onChatThreadChange",a);break;case"update_msg":a.operation="update",a.messageCount=i.message_count,i.last_message&&"{}"!==JSON.stringify(i.last_message)?a.lastMessage=Ne.call(this,i.last_message):"{}"===JSON.stringify(i.last_message)&&(a.lastMessage={}),null===(r=this.eventHandler)||void 0===r||r.dispatch("onChatThreadChange",a);break;case"update":a.operation="update",a.messageCount=i.message_count,null===(n=this.eventHandler)||void 0===n||n.dispatch("onChatThreadChange",a);break;case"delete":a.operation="destroy",null===(o=this.eventHandler)||void 0===o||o.dispatch("onChatThreadChange",a)}}}function Tt(e){var t,r=e.data;if(r.resource!==this.clientResource){var n={operation:"deleteRoaming",conversationId:r.to,chatType:"chat"===r.chatType?"singleChat":"groupChat",resource:r.resource};null===(t=this.eventHandler)||void 0===t||t.dispatch("onMultiDeviceEvent",n)}}function It(e){var t,r,n=e.data,o="";if(this.clientResource!==n.res||n.from!==this.user){switch(n.op){case"del":o="deleteConversation";break;case"top":o="pinnedConversation";break;case"not_top":o="unpinnedConversation";break;case"mark":o="markConversation";break;case"mark_delete":o="unMarkConversation";break;case"pin":o="pin";break;case"pin_delete":o="unpin";break;default:return void j.error("unexpected conversation op:",n.op)}if("pin"!==o&&"unpin"!==o){var i={operation:o,conversationId:n.id,conversationType:"chat"===n.type?"singleChat":"groupChat",timestamp:n.ts};"markConversation"!==i.operation&&"unMarkConversation"!==i.operation||n.ext&&(i.conversationMark=ft[n.ext]),null===(r=this.eventHandler)||void 0===r||r.dispatch("onMultiDeviceEvent",i)}else{var a=n.ext,s=n.from,c=n.id,u=n.type,l=n.ts,d={messageId:a||"",conversationId:"chat"===u?s:c,conversationType:Se[u],operation:o,operatorId:s,time:l};null===(t=this.eventHandler)||void 0===t||t.dispatch("onMessagePinEvent",d)}}}function Ot(e){var t,r=this;null===(t=e.values)||void 0===t||t.forEach((function(e){var t,n,o,i,a;if(e.operator_resource!==r.clientResource)if("ignoreInterval"in e.data){var s={operation:"setSilentModeForUser",resource:e.operator_resource,data:e.data};null===(t=r.eventHandler)||void 0===t||t.dispatch("onMultiDeviceEvent",s)}else"group"in e?(s={operation:0===Object.keys(null!==(n=e.data)&&void 0!==n?n:{}).length?"removeSilentModeForConversation":"setSilentModeForConversation",resource:e.operator_resource,conversationId:e.group,type:"groupChat",data:e.data},null===(o=r.eventHandler)||void 0===o||o.dispatch("onMultiDeviceEvent",s)):(s={operation:0===Object.keys(null!==(i=e.data)&&void 0!==i?i:{}).length?"removeSilentModeForConversation":"setSilentModeForConversation",resource:e.operator_resource,conversationId:e.user,type:"singleChat",data:e.data},null===(a=r.eventHandler)||void 0===a||a.dispatch("onMultiDeviceEvent",s))}))}!function(e){e[e.mark_0=0]="mark_0",e[e.mark_1=1]="mark_1",e[e.mark_2=2]="mark_2",e[e.mark_3=3]="mark_3",e[e.mark_4=4]="mark_4",e[e.mark_5=5]="mark_5",e[e.mark_6=6]="mark_6",e[e.mark_7=7]="mark_7",e[e.mark_8=8]="mark_8",e[e.mark_9=9]="mark_9",e[e.mark_10=10]="mark_10",e[e.mark_11=11]="mark_11",e[e.mark_12=12]="mark_12",e[e.mark_13=13]="mark_13",e[e.mark_14=14]="mark_14",e[e.mark_15=15]="mark_15",e[e.mark_16=16]="mark_16",e[e.mark_17=17]="mark_17",e[e.mark_18=18]="mark_18",e[e.mark_19=19]="mark_19"}(ft||(ft={}));var Rt=function(e){var t=_e.parseNotify(e.payload);switch(t.type){case"presence":Et.call(this,t);break;case"reaction":yt.call(this,t);break;case"thread":_t.call(this,t);break;case"roaming_delete":Tt.call(this,t);break;case"conv":It.call(this,t);break;case"user_notification_mute":Ot.call(this,t);break;default:j.error("unexpected notify type: ".concat(t.type))}};function Ct(){var e=this.context.appName,t=this.context.orgName;return!(!e||!t)||(this.onError&&this.onError({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function St(){var e,t=this.context.accessToken;if(!t){var r=m.create({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return j.debug("token not assign error",t),this.onError&&this.onError(r),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",r),!1}return!0}function Nt(){if(this._initWithAppId){if(!Ct.call(this))return{error:m.create({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"})};if(!St.call(this))return{error:m.create({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"})}}else if(!Ct.call(this)||!St.call(this))return{error:m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"})};return{}}function bt(e){var t=e.data,r=e.type;return{data:{status:Object.keys(t.errorKeys).length>0?"fail":"success",errorKeys:t.errorKeys,successKeys:t.successKeys},type:r}}function At(e){var t=e.data,r=void 0;return Object.keys(t.errorKeys).length>0&&Object.keys(t.errorKeys).forEach((function(e){var n=t.errorKeys[e];r=n.includes("is not part of you")?m.create({type:d.NO_PERMISSION,message:n}):n.includes("size of metadata for this single chatroom exceeds the user defined limit")||n.includes("total size of chatroom metadata for this app exceeds the user defined limit")||n.includes("is exceeding maximum limit")?m.create({type:d.MAX_LIMIT,message:n}):n.includes("is not Legal")?m.create({type:d.REQUEST_PARAMETER_ERROR,message:n}):n.includes("Failed to update userMetadata. Concurrent updates not allowed")?m.create({type:d.OPERATION_NOT_ALLOWED,message:n}):m.create({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:n})})),r}function Mt(e){if("string"!=typeof e.deviceId||""===e.deviceId)throw Error('Invalid parameter: "deviceId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user),type:"PUT",data:JSON.stringify({device_id:e.deviceId,device_token:e.deviceToken,notifier_name:e.notifierName}),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};j.debug("Call uploadPushTokenToServer",e);var s=ae.bind(this,a,v.UPLOAD_PUSH_TOKEN);return _e.retryPromise(s).then((function(e){var t=e.entities[0]||{};return{type:e.type,data:t}}))}var wt,Ut,Lt=r(638),Pt=r.n(Lt),Dt=r(566),kt=r.n(Dt),xt=268435455;function Bt(e){var t=e;return kt().buf(t)>>>0}!function(e){e[e.COMPRESS_NONE=0]="COMPRESS_NONE",e[e.COMPRESS_ZLIB=1]="COMPRESS_ZLIB",e[e.COMPRESS_LZ4=2]="COMPRESS_LZ4"}(wt||(wt={})),function(e){e[e.NONE=-1]="NONE",e[e.UPLINK_ONLY=0]="UPLINK_ONLY",e[e.DOWNLINK_ONLY=1]="DOWNLINK_ONLY",e[e.BIDIRECTIONAL=2]="BIDIRECTIONAL"}(Ut||(Ut={}));var Gt=268435455,jt=function(){function e(){this.mode=Ut.NONE,this.enableUplinkCompression=!1,this.enableDownlinkCompression=!1;var e={minWorkArea:Pt().DEFAULT_WORK_AREA,maxWorkArea:Pt().DEFAULT_MAX_WORK,shrinkMode:Pt().SHRINK_MODE.MANUAL};this.encoder=new(Pt().RingBufferEncoder)(e),this.decoder=new(Pt().RingBufferDecoder)(e)}return e.prototype.compress=function(e){var t=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!t||0===t.length)return new Uint8Array(0);if(t.length>Gt)throw new Error("Data size exceeds maximum allowed: ".concat(t.length));var r=Pt().compressBound(t.length),n=new Uint8Array(r),o=this.encoder.compress(t,n);if(o<0)throw new Error("LZ4 compression failed with error code: ".concat(o));var i=n.subarray(0,o),a=function(e){if(e<0)throw new Error("encodeLength: Length must be non-negative");if(e>xt)throw new Error("encodeLength: Length exceeds maximum: ".concat(xt));if(0===e)return new Uint8Array([0]);for(var t=[],r=e;r>0;){var n=127&r;(r>>>=7)>0&&(n|=128),t.push(n)}return new Uint8Array(t)}(t.length),s=Bt(t),c=new Uint8Array(a.length+4+o),u=0;return c.set(a,u),u+=a.length,new DataView(c.buffer).setUint32(u,s,!1),u+=4,c.set(i,u),c},e.prototype.decompress=function(e){var t=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!t||0===t.length)return new Uint8Array(0);if(t.length<5)throw new Error("Compressed data is too short: must contain at least length and CRC32");var r={offset:0},n=function(e,t){if(t.offset>=e.length)throw new Error("decodeLength: No data to decode: offset beyond data length");for(var r=0,n=0;t.offset<e.length;){var o=e[t.offset];if(t.offset++,r|=(127&o)<<n,!(128&o))return r>>>0;if((n+=7)>=28)throw new Error("decodeLength: Invalid length encoding: exceeds 4 bytes")}throw new Error("decodeLength: Incomplete length encoding: missing terminator byte")}(t,r);if(n>Gt)throw new Error("Original size exceeds maximum allowed: ".concat(n));if(t.length<r.offset+4)throw new Error("Compressed data is too short: missing CRC32 checksum");var o=new DataView(t.buffer,t.byteOffset+r.offset,4).getUint32(0,!1);r.offset+=4;var i=t.subarray(r.offset),a=new Uint8Array(n),s=this.decoder.decompress(i,a,n);if(s<0||s!==n)throw new Error("LZ4 decompression failed: expected ".concat(n,", got ").concat(s));var c=Bt(a);if(c!==o)throw new Error("CRC32 checksum mismatch: expected ".concat(o,", got ").concat(c));return a},e.prototype.resetEncoder=function(){this.encoder.reset()},e.prototype.resetDecoder=function(){this.decoder.reset()},e.prototype.reset=function(){this.resetEncoder(),this.resetDecoder()},e.prototype.shrinkEncoder=function(){this.encoder.shrink()},e.prototype.shrinkDecoder=function(){this.decoder.shrink()},e.prototype.shrink=function(){this.shrinkEncoder(),this.shrinkDecoder()},e}();function Ht(e){switch(e){case Ut.UPLINK_ONLY:return{mode:Ut.UPLINK_ONLY,enableUplinkCompression:!0,enableDownlinkCompression:!1};case Ut.DOWNLINK_ONLY:return{mode:Ut.DOWNLINK_ONLY,enableUplinkCompression:!1,enableDownlinkCompression:!0};case Ut.BIDIRECTIONAL:return{mode:Ut.BIDIRECTIONAL,enableUplinkCompression:!0,enableDownlinkCompression:!0};case Ut.NONE:default:return{mode:Ut.NONE,enableUplinkCompression:!1,enableDownlinkCompression:!1}}}function Ft(e,t){var r=Ht(t),n=r.mode,o=r.enableUplinkCompression,i=r.enableDownlinkCompression;e.reset(),e.mode=n,e.enableUplinkCompression=o,e.enableDownlinkCompression=i}function Wt(e,t,r){for(var n=[],o=Math.max(e.length,t.length),i=0,a=0;a<o||i;){var s=i+(a<e.length?e[a]:0)+(a<t.length?t[a]:0);n.push(s%r),i=Math.floor(s/r),a++}return n}function zt(e,t,r){if(e<0)return null;if(0==e)return[];for(var n=[],o=t;1&e&&(n=Wt(n,o,r)),0!=(e>>=1);)o=Wt(o,o,r);return n}var qt=function(){function e(e){e=e||{},this.seq=0,this.mid=(e.mid||1)%1023,this.timeOffset=e.timeOffset||0,this.lastTime=0}return e.prototype.gen=function(){var e=Date.now();if(this.lastTime==e){if(this.seq++,this.seq>4095){for(this.seq=0;Date.now()<=e;);e=Date.now()}}else this.seq=0;this.lastTime=e;for(var t=(e-this.timeOffset).toString(2),r=this.seq.toString(2),n=this.mid.toString(2);r.length<12;)r="0"+r;for(;n.length<10;)n="0"+n;for(var o,i=t+n+r,a="",s=i.length;s>0;s-=4)a=parseInt(i.substring(s-4,s),2).toString(16)+a;return"0x"===(o=a).substring(0,2)&&(o=o.substring(2)),function(e,t,r){var n=function(e,t){for(var r=e.split(""),n=[],o=r.length-1;o>=0;o--){var i=parseInt(r[o],t);if(isNaN(i))return null;n.push(i)}return n}(e,t);if(null===n)return null;for(var o=[],i=[1],a=0;a<n.length;a++)n[a]&&(o=Wt(o,zt(n[a],i,r),r)),i=zt(t,i,r);var s="";for(a=o.length-1;a>=0;a--)s+=o[a].toString(r);return s}(o=o.toLowerCase(),16,10)},e}(),Kt=function(){return Kt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Kt.apply(this,arguments)};function Vt(e){try{var t=this._compressor;return t&&t.enableDownlinkCompression&&"string"!=typeof e.data?[Kt(Kt({},e),{data:t.decompress(e.data)}),!0]:[e,!0]}catch(t){return this._compressorFailureCount++,j.error("decompress message error",t),j.error("decompress failure times:",this._compressorFailureCount),this.sock.close(),[e,!1]}}function Jt(e){try{var t=this._compressor;return t&&t.enableUplinkCompression?[t.compress(e),!0]:[e,!0]}catch(t){return this._compressorFailureCount++,j.error("compress message error",t),j.error("compress failure times:",this._compressorFailureCount),this.sock.close(),[e,!1]}}function Yt(e,t,r){var n=Math.min(e,t);if(n<=r)return{width:e,height:t};var o=r/n;return{width:Math.round(e*o),height:Math.round(t*o)}}function Xt(e,t){return e+t|0}function Qt(e){for(var t="",r=0;r<4;r++)t+="0".concat((e>>>8*r&255).toString(16)).slice(-2);return t}function Zt(e){var t=new Uint8Array(e),r=t.length,n=64*((r+8>>>6)+1),o=new Uint8Array(n);o.set(t),o[r]=128;for(var i=8*r,a=i>>>0,s=Math.floor(i/4294967296)>>>0,c=0;c<4;c++)o[n-8+c]=a>>>8*c&255,o[n-4+c]=s>>>8*c&255;var u=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],l=new Array(64);for(c=0;c<64;c++)l[c]=Math.floor(4294967296*Math.abs(Math.sin(c+1)));for(var d,h,p=1732584193,f=4023233417,m=2562383102,g=271733878,v=new Array(16),E=0;E<n;E+=64){for(c=0;c<16;c++){var y=E+4*c;v[c]=o[y]|o[y+1]<<8|o[y+2]<<16|o[y+3]<<24}var _=p,T=f,I=m,O=g;for(c=0;c<64;c++){var R=0,C=0;c<16?(R=T&I|~T&O,C=c):c<32?(R=O&T|~O&I,C=(5*c+1)%16):c<48?(R=T^I^O,C=(3*c+5)%16):(R=I^(T|~O),C=7*c%16);var S=I,N=T,b=(d=Xt(Xt(_,R),Xt(l[c],v[C])))<<(h=u[c])|d>>>32-h;T=Xt(T,b),_=O,I=N,O=S}p=Xt(p,_),f=Xt(f,T),m=Xt(m,I),g=Xt(g,O)}return"".concat(Qt(p)).concat(Qt(f)).concat(Qt(m)).concat(Qt(g))}var $t=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},er=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},tr=1048576;function rr(e){return new Promise((function(t,r){if("undefined"!=typeof FileReader){var n=new FileReader;n.onload=function(){return t(n.result)},n.onerror=function(){return r(n.error||new Error("Failed to read file"))},n.readAsArrayBuffer(e)}else r(new Error("FileReader is not available"))}))}function nr(e,t,r){return"img"===t?e>("original"===r?204800:tr):e>tr}function or(e){return $t(this,void 0,void 0,(function(){return er(this,(function(t){switch(t.label){case 0:return[4,rr(e)];case 1:return[2,Zt(t.sent())]}}))}))}function ir(e){return"original"===e?"origin":"large"}function ar(e,t,r,n){var o,i;return $t(this,void 0,void 0,(function(){var a,s,c,u,l,d,h,p,f,m,g,E,y,_;return er(this,(function(T){switch(T.label){case 0:a=e.context,s=a.orgName,c=a.appName,u=a.accessToken,l="".concat(e.apiUrl,"/").concat(s,"/").concat(c,"/chatfiles/exists?md5=").concat(t),"img"===r&&n&&(l+="&imageType=".concat(ir(n))),T.label=1;case 1:return T.trys.push([1,3,,4]),[4,ae.call(e,{url:l,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+u}},v.SDK_INTERNAL)];case 2:return d=T.sent(),(h=null===(o=null==d?void 0:d.entities)||void 0===o?void 0:o[0])?(p=!0===h.exists,f=h.uuid||"",m=h["share-secret"]||"",I=null!==(i=h["exists-type"])&&void 0!==i?i:h.existsType,g="origin"===I||"original"===I?"original":"large"===I?"large":void 0,E=p&&!!f,y=n,"img"===r&&E&&("original"===g?y="original":"large"===g&&("original"===n?E=!1:y="large")),j.debug("precheck result","exists: ".concat(p),"uuid: ".concat(f),"existsType: ".concat(g||""),"effectiveImageType: ".concat(y||""),"hit: ".concat(E)),[2,{exists:p,uuid:f,shareSecret:m,existsType:g,effectiveImageType:y,hit:E}]):[2,{exists:!1,hit:!1}];case 3:return _=T.sent(),j.warn("precheck failed, proceeding with upload",_),[2,{exists:!1,hit:!1}];case 4:return[2]}var I}))}))}var sr,cr,ur,lr,dr=function(){return dr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},dr.apply(this,arguments)},hr=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},pr=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},fr=new qt;!function(e){e[e.NORMAL=0]="NORMAL",e[e.SINGLECHAT=1]="SINGLECHAT",e[e.GROUPCHAT=2]="GROUPCHAT",e[e.CHATROOM=3]="CHATROOM",e[e.READ_ACK=4]="READ_ACK",e[e.DELIVER_ACK=5]="DELIVER_ACK",e[e.RECALL=6]="RECALL",e[e.CHANNEL_ACK=7]="CHANNEL_ACK",e[e.EDIT=8]="EDIT"}(sr||(sr={})),function(e){e[e.BODY=1]="BODY",e[e.BODY_AND_EXT=2]="BODY_AND_EXT"}(cr||(cr={})),function(e){e[e.APNs=0]="APNs",e[e.FCM=1]="FCM",e[e.HMSPUSH=2]="HMSPUSH",e[e.MIPUSH=3]="MIPUSH",e[e.MEIZUPUSH=4]="MEIZUPUSH",e[e.VIVOPUSH=5]="VIVOPUSH",e[e.OPPOPUSH=6]="OPPOPUSH",e[e.HONORPUSH=7]="HONORPUSH"}(ur||(ur={})),function(e){e[e.OK=0]="OK",e[e.FAIL=1]="FAIL",e[e.UNAUTHORIZED=2]="UNAUTHORIZED",e[e.MISSING_PARAMETER=3]="MISSING_PARAMETER",e[e.WRONG_PARAMETER=4]="WRONG_PARAMETER",e[e.REDIRECT=5]="REDIRECT",e[e.TOKEN_EXPIRED=6]="TOKEN_EXPIRED",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.NO_ROUTE=8]="NO_ROUTE",e[e.UNKNOWN_COMMAND=9]="UNKNOWN_COMMAND",e[e.PB_PARSER_ERROR=10]="PB_PARSER_ERROR",e[e.BIND_ANOTHER_DEVICE=11]="BIND_ANOTHER_DEVICE",e[e.IM_FORBIDDEN=12]="IM_FORBIDDEN",e[e.TOO_MANY_DEVICES=13]="TOO_MANY_DEVICES",e[e.PLATFORM_LIMIT=14]="PLATFORM_LIMIT",e[e.USER_MUTED=15]="USER_MUTED",e[e.ENCRYPT_DISABLE=16]="ENCRYPT_DISABLE",e[e.ENCRYPT_ENABLE=17]="ENCRYPT_ENABLE",e[e.DECRYPT_FAILURE=18]="DECRYPT_FAILURE",e[e.PERMISSION_DENIED_EXTERNAL=19]="PERMISSION_DENIED_EXTERNAL",e[e.RESOURCE_CHANGED=20]="RESOURCE_CHANGED"}(lr||(lr={}));var mr=["txt","img","video","audio","file","loc","custom","cmd","combine"],gr=_e.getEnvInfo();function vr(){var e="webim",t="",r="",n=(new Date).valueOf(),o=_e.getDevicePlatform(gr);if(this.isFixedDeviceId){var i=_e.getLocalDeviceInfo();if(i){var a=JSON.parse(i);e=a.deviceId,t=a.deviceName,r=a.deviceUuid,void 0!==this.customOSPlatform&&(t=this.deviceId,e="custom".concat(this.customOSPlatform,"_").concat(r))}else"webim"===this.deviceId?(r="".concat(o,"_").concat(n.toString()),e="".concat(this.deviceId,"_").concat(r),t=this.deviceId,void 0!==this.customOSPlatform&&(e="custom".concat(this.customOSPlatform,"_").concat(r))):(e=t=r="webim_".concat(o,"_").concat(this.deviceId),void 0!==this.customOSPlatform&&(r="".concat(o,"_").concat(n.toString()),t=this.deviceId,e="custom".concat(this.customOSPlatform,"_").concat(r))),_e.setLocalDeviceInfo(JSON.stringify({deviceId:e,deviceName:t,deviceUuid:r}))}else"webim"===this.deviceId?(r="random_".concat(o,"_").concat(n.toString()),e="".concat(this.deviceId,"_").concat(r),t=this.deviceId):e=t=r="webim_".concat(o,"_").concat(this.deviceId),void 0!==this.customOSPlatform&&(r="random_".concat(o,"_").concat(n.toString()),t=this.deviceId,e="custom".concat(this.customOSPlatform,"_").concat(r));return{deviceId:e,deviceName:t,deviceUuid:r,devicePlatform:o}}function Er(){var e,t,r,n,o=vr.call(this),i=o.deviceId,a=o.deviceName,s=o.deviceUuid,c=o.devicePlatform,u=[];this.context.jid&&(this.context.jid.clientResource=i),this._compressor&&Ft(this._compressor,Ut.NONE);var l=this.root.lookup("easemob.pb.Provision"),d=c===le.UNI,h=!this.logOut,p=l.decode(u);if(void 0!==this.customOSPlatform&&(p.osCustomValue=this.customOSPlatform,this.osType=5),p.compressType=this.compressType,p.encryptType=this.encryptType,p.osType=this.osType,p.version=this.version,p.deviceName=a,p.resource=i,p.deviceUuid=s,p.authToken='{"token":"$t$'+this.token+'"}',p.sessionId=Date.now().toString()+":",d){var f=!this.isAutoLogin;h&&(f=!1),j.debug("isManualLogin",f),p.isManualLogin=f}var m=this._compressorFailureCount>=1?[]:[wt.COMPRESS_LZ4];p.protocolCompressType=m,this.sessionId=p.sessionId,this.loginInfoCustomExt&&(p.reason=this.loginInfoCustomExt),j.info("provision info",{version:this.version,resource:i,isFixedDeviceId:this.isFixedDeviceId,loginInfoCustomExt:!!this.loginInfoCustomExt,token:(null===(t=null===(e=this.token)||void 0===e?void 0:e.slice)||void 0===t?void 0:t.call(e,0,10))+"...",userId:null===(n=null===(r=this.context)||void 0===r?void 0:r.jid)||void 0===n?void 0:n.name}),p.actionVersion="v5.2",p=l.encode(p).finish();var g=this.root.lookup("easemob.pb.MSync"),v=g.decode(u);return v.version=this.version,v.guid=this.context.jid,v.command=3,v.deviceId=a,v.serviceId=this.dataReport.getServiceId(),v.encryptType=this.encryptType,v.payload=p,v.traceId=fr.gen(),g.encode(v).finish()}function yr(e){var t=[],r=this.root.lookup("easemob.pb.Logout"),n=r.decode(t);n.sessionId=this.sessionId,n.reason=e,n=r.encode(n).finish();var o=this.root.lookup("easemob.pb.MSync"),i=o.decode(t);return i.version=this.version,i.guid=this.context.jid,i.auth="$t$"+this.token,i.command=4,i.deviceId=this.deviceId||"webim",i.serviceId=this.dataReport.getServiceId(),i.encryptType=this.encryptType,i.payload=n,i.traceId=fr.gen(),j.debug("traceId",i.traceId),o.encode(i).finish()}function _r(e,t){var r=this,n=_e.getEnvInfo();if("zfb"===n.platform||"dd"===n.platform){for(var o="",i=0;i<e.length;i++)o+=String.fromCharCode(e[i]);return{data:o=Re().btoa(o),isBuffer:!1,complete:function(){},fail:function(e){"sendSocketMessage:fail taskID not exist"!==e.errMsg&&"SocketTast.send:fail SocketTask.readyState is not OPEN"!==e.errMsg||(j.error("send message fail and reconnect"),r.reconnecting||r.reconnect()),t&&r._msgHash&&r._msgHash[t]&&r._msgHash[t].fail({id:t})}}}var a=e;return{data:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),fail:function(e){"sendSocketMessage:fail taskID not exist"!==e.errMsg&&"SocketTast.send:fail SocketTask.readyState is not OPEN"!==e.errMsg||r.reconnecting||r.reconnect(),t&&r._msgHash&&r._msgHash[t]&&r._msgHash[t].fail({id:t})}}}function Tr(e,t){var r;return hr(this,void 0,void 0,(function(){var n,o,i,a,s;return pr(this,(function(c){switch(c.label){case 0:for(j.debug("metas length: ",e.length),n=[],o=0;o<e.length;o++)switch(i=e[o],new(f())(i.id.low,i.id.high,i.id.unsigned).toString(),i.ns){case 0:vt.call(this,i);break;case 1:n.push(ut.call(this,i,t,!1,!0,!0));break;case 2:mt.call(this,i);break;case 3:gt.handleRosterMsg.call(this,i);break;case 4:this.registerConfrIQHandler&&this.registerConfrIQHandler(i,t,this);break;case 5:Rt.call(this,i);break;default:j.error("distributeMeta",i)}return[4,Promise.all(n)];case 1:return a=c.sent(),(s=a.filter((function(e){return e&&"cmd"!==e.type}))).length>0&&(null===(r=this.eventHandler)||void 0===r||r.dispatch("onMessage",s)),[2]}}))}))}function Ir(e,t){Tr.call(this,e,t)}function Or(e){var t,r=this;qr.clear(),this._offlineMessagePullState===Ee.SYNC_INIT&&(this._offlineMessagePullState=Ee.SYNC_START,this._offlineMessagePullQueue=e.unread.reduce((function(e,t,n){return e.find((function(e){return e.name===t.queue.name}))||e.push(t),r.pullOfflineMessageInfo.pullCount+=t.n,e}),[]),this.pullOfflineMessageInfo.startTime=Date.now(),this._offlineMessageRpt=this.dataReport.geOperateFun({operationName:v.MSYNC_SYNCOFFLINEMESSAGE}),null===(t=this.eventHandler)||void 0===t||t.dispatch("onOfflineMessageSyncStart"))}function Rr(e){var t;if(this._offlineMessagePullState===Ee.SYNC_START){var r=this._offlineMessagePullQueue.findIndex((function(t){return t.queue.name===e.queue.name}));if(r>-1){this._offlineMessagePullQueue.splice(r,1);var n=qr.get(e.queue.name)||0;n>0&&this._offlineMessageRpt({isEndApi:!1,data:{isSuccess:1,requestName:v.MSYNC_SYNCOFFLINEMESSAGE,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success,resultCount:n,requestElapse:Date.now()-this.pullOfflineMessageInfo.startTime}})}0===this._offlineMessagePullQueue.length&&(this._offlineMessagePullState=Ee.SYNC_FINISH,null===(t=this.eventHandler)||void 0===t||t.dispatch("onOfflineMessageSyncFinish"),this._offlineMessageRpt({data:{isLastApi:1,isSuccess:1,requestName:v.MSYNC_SYNCOFFLINEMESSAGE,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success,resultCount:this.pullOfflineMessageInfo.pullCount}}),qr.clear())}}function Cr(e){var t=this.root.lookup("easemob.pb.CommUnreadDL");t=t.decode(e.payload);var r=new(f())(t.timestamp.low,t.timestamp.high,t.timestamp.unsigned).toString();if(this.expirationTime&&this.compareTokenExpireTime(Number(r),this.expirationTime),0===t.unread.length)kr.call(this);else{Or.call(this,t),j.debug("pull unread message",t.unread);for(var n=0;n<t.unread.length;n++)br.call(this,t.unread[n].queue)}kr.call(this)}function Sr(){var e=[],t=this.root.lookup("easemob.pb.StatisticsBody"),r=t.decode(e);r.operation=0,r=t.encode(r).finish();var n=this.root.lookup("easemob.pb.Meta").decode(e);n.id=(new Date).valueOf(),n.ns=0,n.payload=r;var o=this.root.lookup("easemob.pb.CommSyncUL"),i=o.decode(e);i.meta=n,i=o.encode(i).finish();var a=this.root.lookup("easemob.pb.MSync"),s=a.decode(e);return s.version=this.version,s.encryptType=[0],s.command=0,s.payload=i,s.traceId=fr.gen(),j.debug("traceId",s.traceId),a.encode(s).finish()}function Nr(e){var t=[],r=this.root.lookup("easemob.pb.CommSyncUL"),n=r.decode(t);n.queue=e,n=r.encode(n).finish();var o=this.root.lookup("easemob.pb.MSync"),i=o.decode(t);return i.version=this.version,i.encryptType=this.encryptType,i.command=0,i.payload=n,i.traceId=fr.gen(),j.debug("traceId",i.traceId),o.encode(i).finish()}function br(e){j.debug("sendBackqueue",e);var t=Nr.call(this,e);tn.call(this,t)}function Ar(e,t){var r=[],n=this.root.lookup("easemob.pb.CommSyncUL"),o=n.decode(r);o.queue=t,o.key=new(f())(e.low,e.high,e.unsigned).toString(),o=n.encode(o).finish();var i=this.root.lookup("easemob.pb.MSync"),a=i.decode(r);return a.version=this.version,a.encryptType=this.encryptType,a.command=0,a.payload=o,a.traceId=fr.gen(),j.debug("traceId",a.traceId),i.encode(a).finish()}function Mr(){var e=this;this.uniPush&&!1===this.isRegisterPush&&(this.isRegisterPush=!0,this.uniPush.onRegister((function(t){j.debug("push token onRegister");var r=e.uniPushConfig||{},n=r.APNsCertificateName,o=void 0===n?"":n,i=r.HMSCertificateName,a=void 0===i?"":i,s=r.HONORCertificateName,c=void 0===s?"":s,u=r.MEIZUCertificateName,l=void 0===u?"":u,d=r.MICertificateName,h=void 0===d?"":d,p=r.OPPOCertificateName,f=void 0===p?"":p,m=r.VIVOCertificateName,g=void 0===m?"":m,v=r.FCMCertificateName,E=void 0===v?"":v;switch(t.push_type){case ur.APNs:e.pushCertificateName=o;break;case ur.FCM:e.pushCertificateName=E;break;case ur.HMSPUSH:e.pushCertificateName=a;break;case ur.HONORPUSH:e.pushCertificateName=c;break;case ur.MEIZUPUSH:e.pushCertificateName=l;break;case ur.MIPUSH:e.pushCertificateName=h;break;case ur.OPPOPUSH:e.pushCertificateName=f;break;case ur.VIVOPUSH:e.pushCertificateName=g;break;default:j.error("unexpected push type",t.push_type)}e.pushCertificateName&&t.push_token&&Mt.call(e,{deviceId:e.clientResource,deviceToken:t.push_token,notifierName:e.pushCertificateName}).then((function(){j.debug("uploadPushToken success")})).catch((function(e){j.debug("uploadPushToken failed",e)}))})))}function wr(){var e;this._offlineMessagePullState=Ee.SYNC_INIT,this._offlineMessagePullQueue=[],this.times=1,this.autoReconnectNumTotal=0,this.onOpened&&this.onOpened(),Mr.call(this),null===(e=this.eventHandler)||void 0===e||e.dispatch("onConnected"),Dr.call(this),Br.call(this),xr.call(this),kr.call(this),this.pullOfflineMessageInfo={pullCount:0,startTime:0}}function Ur(e,t){j.debug("sendLastSession",e);var r=Ar.call(this,e,t);tn.call(this,r)}function Lr(e){var t,r,n,o,i,a,s,c,u,l,h,p,f,g,v,E,y,_,T=this,I=this.root.lookup("easemob.pb.Provision").decode(e.payload);if(this.context.jid&&(this.context.jid.clientResource=I.resource),this.clientResource=I.resource,this.provisionTimer&&clearTimeout(this.provisionTimer),j.debug("provision status",I.status),this._isLogging=!1,I.status.errorCode===lr.OK){if(this.disconnectedReason=void 0,I.authToken){var O=JSON.parse(I.authToken).expires_in;if(!this.tokenExpiredTimer&&!this.tokenWillExpireTimer){var R=Date.now();this.expirationTime=O;var C=this.expirationTime-R;this.expiresIn=C<0?0:C,this.tokenExpireTimeCountDown(this.expiresIn)}}var S=I.protocolCompressType,N=I.protocolCompressDirection;if(j.debug("protocol compress types",S),j.debug("protocol compress direction",N),S.length>0&&S[0]===wt.COMPRESS_LZ4){var b=null!=N?N:Ut.NONE;this._compressor?Ft(this._compressor,b):this._compressor=function(e){var t=Ht(e),r=t.mode,n=t.enableUplinkCompression,o=t.enableDownlinkCompression;if(r===Ut.NONE)return null;var i=new jt;return i.mode=r,i.enableUplinkCompression=n,i.enableDownlinkCompression=o,i}(b)}this.reconnecting=!1,this.logOut=!1,this.needSetReadyState&&(this.sock=dr(dr({},this.sock),{close:this.sock.close,send:this.sock.send,readyState:1})),this._localCache?(null===(t=this._localCache)||void 0===t?void 0:t.getInstance())?wr.call(this):this._localCache&&new this._localCache({user:this.user,dbName:"cache_".concat(Math.abs(we(this.appKey||this.appId)),"_").concat(this.user),version:2,onInit:function(){return hr(T,void 0,void 0,(function(){return pr(this,(function(e){return j.debug("localCache init success"),wr.call(this),[2]}))}))}}):wr.call(this),null===(r=this.connectionResolve)||void 0===r||r.call(this)}else{var A=void 0,M=I.status,w=M.reason,U=M.errorCode;switch(j.error("provision errorCode: ",U),j.error("provision reason: ",w),U){case lr.FAIL:A="Sorry, user register limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the number of user registrations limit has been reached"}):"Sorry, user register rate limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, user register rate limit"}):"Sorry, token expired"===w?m.create({type:d.WEBIM_TOKEN_EXPIRED,message:"Sorry, token expired"}):"Sorry, token or password does not match login info"===w?m.create({type:d.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"INVALID_TOKEN"}):"Sorry, user not found"===w?m.create({type:d.USER_NOT_FOUND,message:"User not found"}):m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"Auth failed"}),null===(n=this.connectionReject)||void 0===n||n.call(this,A),null===(o=this.eventHandler)||void 0===o||o.dispatch("onError",A);break;case lr.WRONG_PARAMETER:A=m.create({type:d.REQUEST_PARAMETER_ERROR,message:"Invalid parameter"}),null===(i=this.connectionReject)||void 0===i||i.call(this,A),null===(a=this.eventHandler)||void 0===a||a.dispatch("onError",A);break;case lr.UNAUTHORIZED:A=m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"Auth failed"}),null===(s=this.connectionReject)||void 0===s||s.call(this,A),null===(c=this.eventHandler)||void 0===c||c.dispatch("onError",A);break;case lr.IM_FORBIDDEN:A=m.create({type:d.WEBIM_SERVER_SERVING_DISABLED,message:"Server serving disabled."}),null===(u=this.connectionReject)||void 0===u||u.call(this,A),null===(l=this.eventHandler)||void 0===l||l.dispatch("onError",A);break;case lr.PERMISSION_DENIED:A="Sorry, the app month live count limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the monthly active user limit for this app has been reached"}):"Sorry, the app day live count limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the daily active user limit for this app has been reached"}):"Sorry, the app online count limit"===w?m.create({type:d.MAX_LIMIT,message:"Sorry, the maximum number limit of online users for this app has been reached"}):m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:"Auth failed"}),null===(h=this.connectionReject)||void 0===h||h.call(this,A),null===(p=this.eventHandler)||void 0===p||p.dispatch("onError",A);break;case lr.TOO_MANY_DEVICES:A=m.create({type:d.USER_LOGIN_TOO_MANY_DEVICES,message:"the number of devices the user is logged in to exceeds the limit"}),null===(f=this.connectionReject)||void 0===f||f.call(this,A),null===(g=this.eventHandler)||void 0===g||g.dispatch("onError",A);break;case lr.RESOURCE_CHANGED:A=m.create({type:d.USER_DEVICE_CHANGED,message:"user device is changed"}),null===(v=this.connectionReject)||void 0===v||v.call(this,A),null===(E=this.eventHandler)||void 0===E||E.dispatch("onError",A);break;default:A=m.create({type:d.WEBIM_CONNCTION_AUTH_ERROR,message:w}),null===(y=this.connectionReject)||void 0===y||y.call(this,A),null===(_=this.eventHandler)||void 0===_||_.dispatch("onError",A)}this.disconnectedReason=A}}function Pr(e){var t=this.root.lookup("easemob.pb.Logout").decode(e.payload);j.debug("receiveLogoutResult",t)}function Dr(){var e,t;if((null===(e=this.unMSyncSendMsgMap)||void 0===e?void 0:e.size)>0){for(var r=Array.from(this.unMSyncSendMsgMap.keys()),n=0;n<r.length;n++){var o=this.unMSyncSendMsgMap.get(r[n]);tn.call(this,o,r[n])}null===(t=this.unMSyncSendMsgMap)||void 0===t||t.clear()}}function kr(){var e=Sr.call(this);tn.call(this,e)}function xr(){j.debug("sendUnreadDeal");var e=jr.call(this);tn.call(this,e)}function Br(){var e=this;Gr.call(this),this.heartBeatID=setInterval((function(){(Date.now()-e.lastHeartbeat)/1e3>=30&&(j.debug("send heart beat"),xr.call(e),e.lastHeartbeat=Date.now())}),this.heartBeatWait)}function Gr(){clearInterval(this.heartBeatID)}function jr(){var e=this.root.lookup("easemob.pb.MSync"),t=e.decode([]);return t.version=this.version,t.encryptType=this.encryptType,t.command=1,t.traceId=fr.gen(),j.debug("traceId",t.traceId),e.encode(t).finish()}function Hr(e,t){return e.some((function(e){return e.name===t.name}))}function Fr(e){var t=this.root.lookup("easemob.pb.CommNotice").decode(e.payload),r=Hr(this._queues,t.queue);j.debug("receive notice",t.queue,r),r||this.clientResource===t.queue.clientResource&&t.queue.name===this.context.userId||(this._queues.push(t.queue),1===this._queues.length&&br.call(this,t.queue))}function Wr(e){return hr(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return pr(this,(function(l){t=_e.getEnvInfo(),r=this.root.lookup("easemob.pb.MSync"),n=e,"zfb"!==t.platform&&"dd"!==t.platform||(o=Re().atob(e.data),i=Array.from(o,(function(e,t){return o.charCodeAt(t)})),n=dr(dr({},e),{data:new Uint8Array(i)}));try{return a=Vt.call(this,n),s=a[0],a[1]?(c="miniCore"===this.name||"web"===t.platform,u=c?new Uint8Array(s.data):s.data,[2,r.decode(u)]):[2,void 0]}catch(e){throw new Error("decode message fail.")}}))}))}function zr(e){var t=this;this.lastHeartbeat=Date.now(),this.probingTimer&&clearTimeout(this.probingTimer),e.then((function(e){if(e)switch(e.command){case 0:Kr.call(t,e);break;case 1:Cr.call(t,e);break;case 2:Fr.call(t,e);break;case 3:Lr.call(t,e);break;case 4:Pr.call(t,e);break;default:j.error("unexpected msync command: ".concat(e.command))}else j.error("unexpected msync result: ".concat(e))}))}var qr=new Map;function Kr(e){var t,r,n,o,i,a,s,c,u,l,h,p,g,v,E,y,T,O,R,N,b,A,M,w,U,L,P,D,k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z,$,ee,te,re,ne,oe,ie,ae,se,ce,ue,le,de;return hr(this,void 0,void 0,(function(){var he,pe,fe,me,ge,ve,ye,Te,Ie,Oe,Re,Ce,Se,Ne,be,Ae,Me,we,Ue,Le,Pe,ke,xe,Be,Ge,je,He,Fe,We,ze,qe,Ke,Ve,Je,Ye,Qe,Ze,$e,et,tt,rt,nt,ot,it,at,st,ct,lt=this;return pr(this,(function(dt){switch(dt.label){case 0:if(he=(he=this.root.lookup("easemob.pb.CommSyncDL")).decode(e.payload),pe=new(f())(he.serverId.low,he.serverId.high,he.serverId.unsigned).toString(),fe=new(f())(he.metaId.low,he.metaId.high,he.metaId.unsigned).toString(),!(Number(fe)>0))return[3,23];if(clearTimeout(null===(t=this._msgHash[fe])||void 0===t?void 0:t.messageTimer),!he.status)return[3,22];if(0!==he.status.errorCode)return[3,21];if(null==(me=this._msgHash[fe])?void 0:me.isHandleChatroom){try{if(ge="join"===(null===(r=this._msgHash[fe])||void 0===r?void 0:r.operation)){ve={};try{he.metas.length>0&&(ye=this.root.lookup("easemob.pb.MUCBody"),Te=ye.decode(he.metas[0].payload),(Ie=JSON.parse(Te.status.chatroomInfo||"{}")[this.user])&&(ve={isAllMembersMuted:Ie.is_all_mute,createTimestamp:Ie.create_timestamp,isInAllowlist:Ie.is_in_white_list,memberCount:Ie.member_count,muteExpireTimestamp:Ie.mute_duration?Ie.mute_duration:-1}))}catch(e){j.error("decode chat room info error",e)}(null===(n=this._msgHash[fe])||void 0===n?void 0:n.resolve)instanceof Function&&this._msgHash[fe].resolve({type:0,data:{action:"apply",id:this._msgHash[fe].roomId,result:!0,user:this.context.userId,info:ve}}),(null===(o=this._msgHash[fe])||void 0===o?void 0:o.success)instanceof Function&&this._msgHash[fe].success({type:0,data:{action:"apply",id:this._msgHash[fe].roomId,result:!0,user:this.context.userId,info:ve}})}(null===(i=this._msgHash[fe])||void 0===i?void 0:i.resolve)instanceof Function&&!ge&&this._msgHash[fe].resolve({type:0,data:{result:!0}}),(null===(a=this._msgHash[fe])||void 0===a?void 0:a.success)instanceof Function&&!ge&&this._msgHash[fe].success({type:0,data:{result:!0}}),S.has(fe)&&(Oe=S.get(fe),et=Oe.rpt,tt=Oe.requestName,et({isEndApi:!0,data:{isSuccess:1,requestName:tt,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success}}),S.delete(fe))}catch(e){S.has(fe)&&(Re=S.get(fe),et=Re.rpt,tt=Re.requestName,et({isEndApi:!0,data:{isSuccess:0,requestName:tt,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.failed,codeDesc:"when executing success function error"}}),S.delete(fe)),nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing success function error",data:e}),this.onError&&this.onError(nt),null===(s=this.eventHandler)||void 0===s||s.dispatch("onError",nt)}delete this._msgHash[fe]}return!me||me.isHandleChatroom?[3,20]:(Ce=null,Se="",Ne=0,be="",Ae=null,this._msgHash[fe].thirdMessage?(this._msgHash[fe].thirdMessage.id=he.serverId,this._msgHash[fe].thirdMessage.timestamp=he.timestamp,[4,ut.call(this,this._msgHash[fe].thirdMessage,he.status,!0,!0)]):[3,2]);case 1:Ae=dt.sent(),dt.label=2;case 2:if(0===he.metas.length)return[3,13];dt.label=3;case 3:switch(dt.trys.push([3,12,,13]),Me=he.metas[0],we=he.status,Me.ns){case 1:return[3,4];case 5:return[3,9]}return[3,10];case 4:return this.useReplacedMessageContents?[4,ut.call(this,Me,we,!0,!0)]:[3,8];case 5:return Ae=dt.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.getMessageByServerMsgId(fe)];case 6:return(Ue=dt.sent())?[4,null===(h=null===(l=this._localCache)||void 0===l?void 0:l.getInstance())||void 0===h?void 0:h.putMessageToDB(dr(dr(dr({},Ue),Ae),{id:fe}))]:[3,8];case 7:dt.sent(),dt.label=8;case 8:return[3,11];case 9:return(Le=_e.parseNotify(he.metas[0].payload)).edit_msg&&(Pe=Le.edit_msg,ke=Pe.count,xe=Pe.operator,Be=Pe.edit_time,Ge=Pe.sender,je=Pe.send_time,He=Pe.chat_type,Ce={operationTime:Be,operatorId:xe,operationCount:ke},Se=Ge,Ne=Number(je),be=Xe[He]),[3,11];case 10:return j.error("decode local meta error",Me),[3,11];case 11:return[3,13];case 12:return Fe=dt.sent(),nt=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:"decode local meta message error",data:Fe}),this.onError&&this.onError(nt),null===(p=this.eventHandler)||void 0===p||p.dispatch("onError",nt),[3,13];case 13:C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:1,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.success,msgId:pe,messageType:null!==(g=I[null==Ae?void 0:Ae.chatType])&&void 0!==g?g:I.singleChat}}),C.delete(fe)),dt.label=14;case 14:return dt.trys.push([14,18,,19]),We={localMsgId:fe,serverMsgId:pe},Ce&&(ze=this._msgHash[fe],qe=ze.editMessageId,Ke=ze.ext,Ve=ze.customExts,Je=ze.customEvent,Ae.modifiedInfo=Ce,Ae.from=Se,Ae.time=Number(Ne),Ae.chatType=be,Ae.id=qe,null===(y=null===(E=null===(v=this._localCache)||void 0===v?void 0:v.getInstance())||void 0===E?void 0:E.getMessageByServerMsgId(qe))||void 0===y||y.then((function(e){var t,r,n,o,i,a;e&&("txt"===e.type?null===(r=null===(t=lt._localCache)||void 0===t?void 0:t.getInstance())||void 0===r||r.putMessageToDB(dr(dr({},e),{msg:Ae.msg,modifiedInfo:Ae.modifiedInfo,translations:Ae.translations,ext:Ke?Ae.ext:e.ext})):"custom"===e.type?null===(o=null===(n=lt._localCache)||void 0===n?void 0:n.getInstance())||void 0===o||o.putMessageToDB(dr(dr({},e),{ext:Ke?Ae.ext:e.ext,customExts:Ve,customEvent:Je,modifiedInfo:Ae.modifiedInfo})):null===(a=null===(i=lt._localCache)||void 0===i?void 0:i.getInstance())||void 0===a||a.putMessageToDB(dr(dr({},e),{ext:Ke?Ae.ext:e.ext,modifiedInfo:Ae.modifiedInfo})))}))),Ae&&(Ce?("txt"===Ae.type&&(We.message=Ae),We.modifiedInfo=Ce):We.message=Ae),[4,null===(O=null===(T=this._localCache)||void 0===T?void 0:T.getInstance())||void 0===O?void 0:O.updateLocalMessage(fe,{serverMsgId:pe,status:De.SUCCESS})];case 15:return dt.sent(),(null===(R=this._msgHash[fe])||void 0===R?void 0:R.success)instanceof Function?[4,this._msgHash[fe].success(fe,pe)]:[3,17];case 16:dt.sent(),dt.label=17;case 17:return(null===(N=this._msgHash[fe])||void 0===N?void 0:N.resolve)instanceof Function&&this._msgHash[fe].resolve(We),[3,19];case 18:return Ye=dt.sent(),nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing success function error",data:Ye}),this.onError&&this.onError(nt),null===(b=this.eventHandler)||void 0===b||b.dispatch("onError",nt),[3,19];case 19:this.onReceivedMessage&&this.onReceivedMessage({id:fe,mid:pe,to:this._msgHash[fe].to,time:0}),null===(A=this.eventHandler)||void 0===A||A.dispatch("onReceivedMessage",{id:fe,mid:pe,to:this._msgHash[fe].to}),delete this._msgHash[fe],dt.label=20;case 20:return[3,22];case 21:if(15===he.status.errorCode)(null===(M=this._msgHash[fe])||void 0===M?void 0:M.fail)instanceof Function&&this._msgHash[fe].fail({type:d.SERVICE_NOT_ALLOW_MESSAGING_MUTE,reason:"you were muted"}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject({type:d.SERVICE_NOT_ALLOW_MESSAGING_MUTE,reason:"you were muted"}),null===(U=null===(w=this._localCache)||void 0===w?void 0:w.getInstance())||void 0===U||U.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL});else if(1===he.status.errorCode){switch(Qe=void 0,he.status.reason){case"blocked":Qe=d.PERMISSION_DENIED;break;case"group not found":Qe=d.GROUP_NOT_EXIST;break;case"not in group or chatroom":Qe=d.GROUP_NOT_JOINED;break;case"exceed recall time limit":Qe=d.MESSAGE_RECALL_TIME_LIMIT;break;case"message recall disabled":Qe=d.SERVICE_NOT_ENABLED;break;case"not in group or chatroom white list":Qe=d.SERVICE_NOT_ALLOW_MESSAGING;break;case"nonroster":Qe=d.USER_NOT_FRIEND,he.status.reason="not contact";break;case"group is disabled":Qe=d.GROUP_IS_DISABLED,he.status.reason="group is disabled";break;case"limit directed users":Qe=d.MAX_LIMIT;break;case"Sorry, edit limit reached":Qe=d.MAX_LIMIT,he.status.reason="Modify message limit reached";break;case"Sorry, message does not exist":Qe=d.MODIFY_MESSAGE_NOT_EXIST,he.status.reason="The message does not exist.";break;case"Sorry, You do not have permission":Qe=d.PERMISSION_DENIED,he.status.reason="You do not have the modified permission.";break;case"Sorry, format is incorrect":Qe=d.MODIFY_MESSAGE_FORMAT_ERROR,he.status.reason="The modify messaged format error.";break;case"Sorry, edit is not available":Qe=d.SERVICE_NOT_ENABLED,he.status.reason="The message modify function is not activated.";break;case"Sorry, edit fail":Qe=d.MODIFY_MESSAGE_FAILED,he.status.reason="Modify message failed.";break;default:he.status.reason.includes("grpID")&&he.status.reason.includes("does not exist!")?(Qe=d.CHATROOM_NOT_EXIST,he.status.reason="The chat room dose not exist."):he.status.reason.includes("username")&&he.status.reason.includes("doesn't exist!")?Qe=d.USER_NOT_FOUND:"group member list is full!"===he.status.reason?Qe=d.CHATROOM_MEMBERS_FULL:he.status.reason.includes("can not join this group")&&he.status.reason.includes("is in the blacklist")?(Qe=d.PERMISSION_DENIED,he.status.reason="permission denied"):"can not operate this group, reason: group is disabled"===he.status.reason?Qe=d.GROUP_IS_DISABLED:he.status.reason.includes("moderation")?Qe=d.MESSAGE_MODERATION_BLOCKED:he.status.reason.includes("group ID illegal, please check it")?(Qe=d.REQUEST_PARAMETER_ERROR,he.status.reason="Invalid parameter"):Qe=he.status.reason.includes("has create too many chatrooms")||he.status.reason.includes("has joined too many chatrooms")?d.MAX_LIMIT:he.status.reason.includes("auto create failed")?d.SERVER_BUSY:d.SERVER_UNKNOWN_ERROR}this._msgHash[fe]&&((null===(L=this._msgHash[fe])||void 0===L?void 0:L.isHandleChatroom)?(rt=m.create({type:Qe,message:he.status.reason||"",data:""}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].error instanceof Function&&this._msgHash[fe].error(rt),S.has(fe)&&(Ze=_.failed,Qe===d.CHATROOM_NOT_EXIST?Ze=_.notFound:Qe===d.CHATROOM_MEMBERS_FULL&&(Ze=_.reachLimit),$e=S.get(fe),et=$e.rpt,tt=$e.requestName,et({isEndApi:!0,data:{isSuccess:0,requestName:tt,requestMethod:"WEBSOCKET",requestUrl:this.url,code:Ze,codeDesc:he.status.reason}}),S.delete(fe))):(rt=m.create({type:Qe,message:he.status.reason||"",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:Qe,reason:he.status.reason?he.status.reason:"",data:{id:fe,mid:pe}}),null===(D=null===(P=this._localCache)||void 0===P?void 0:P.getInstance())||void 0===D||D.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})),delete this._msgHash[fe])}else if(7===he.status.errorCode)"sensitive words"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"sensitive words",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,data:{id:fe,mid:pe,reason:"sensitive words"}}),null===(x=null===(k=this._localCache)||void 0===k?void 0:k.getInstance())||void 0===x||x.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"blocked by mod_antispam"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"blocked by mod_antispam",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,data:{id:fe,mid:pe,reason:"blocked by mod_antispam"}}),null===(G=null===(B=this._localCache)||void 0===B?void 0:B.getInstance())||void 0===G||G.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"user is mute"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.USER_MUTED_BY_ADMIN,message:"user is mute",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail(rt),null===(F=null===(H=this._localCache)||void 0===H?void 0:H.getInstance())||void 0===F||F.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"traffic limit"===he.status.reason&&this._msgHash[fe]?(rt=m.create({type:d.MESSAGE_CURRENT_LIMITING,message:"traffic limit",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail(rt),null===(z=null===(W=this._localCache)||void 0===W?void 0:W.getInstance())||void 0===z||z.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL})):"Sorry, data is too large"===he.status.reason&&this._msgHash[fe]&&(rt=m.create({type:d.MESSAGE_SIZE_LIMIT,message:"Sorry, data is too large",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail(rt),null===(K=null===(q=this._localCache)||void 0===q?void 0:q.getInstance())||void 0===K||K.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL}));else if(19===he.status.errorCode)this._msgHash[fe]&&(C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,codeDesc:he.status.reason||"",msgId:pe,messageType:null!==(J=I[null===(V=this._msgHash[fe])||void 0===V?void 0:V.chatType])&&void 0!==J?J:I.singleChat}}),C.delete(fe)),rt=m.create({type:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,message:he.status.reason||"",data:{id:fe,mid:pe}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,data:{id:fe,mid:pe,reason:he.status.reason}}),null===(X=null===(Y=this._localCache)||void 0===Y?void 0:Y.getInstance())||void 0===X||X.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL}));else if(this._msgHash[fe]){C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.WEBIM_LOAD_MSG_ERROR,codeDesc:(null===(Q=he.status)||void 0===Q?void 0:Q.reason)||"",msgId:pe,messageType:null!==($=I[null===(Z=this._msgHash[fe])||void 0===Z?void 0:Z.chatType])&&void 0!==$?$:I.singleChat}}),C.delete(fe));try{rt=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:(null===(ee=he.status)||void 0===ee?void 0:ee.reason)||"",data:{id:fe,mid:pe,reason:he.status&&he.status.reason}}),this._msgHash[fe].reject instanceof Function&&this._msgHash[fe].reject(rt),null===(re=null===(te=this._localCache)||void 0===te?void 0:te.getInstance())||void 0===re||re.updateLocalMessage(fe,{serverMsgId:pe,status:De.FAIL}),this._msgHash[fe].fail instanceof Function&&this._msgHash[fe].fail({type:d.WEBIM_LOAD_MSG_ERROR,data:{errorCode:he.status&&he.status.errorCode,reason:he.status&&he.status.reason}})}catch(e){nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing fail function error",data:e}),this.onError&&this.onError(nt),null===(ne=this.eventHandler)||void 0===ne||ne.dispatch("onError",nt)}delete this._msgHash[fe]}else C.has(fe)&&(C.get(fe).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,codeDesc:"on message error",msgId:pe,messageType:null!==(ie=I[null===(oe=this._msgHash[fe])||void 0===oe?void 0:oe.chatType])&&void 0!==ie?ie:I.singleChat}}),C.delete(fe)),nt=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"on message error"}),this.onError&&this.onError(nt),null===(ae=this.eventHandler)||void 0===ae||ae.dispatch("onError",nt);dt.label=22;case 22:return[2];case 23:if(he.metas&&0!==he.metas.length){this._offlineMessagePullState!==Ee.SYNC_FINISH&&qr.set(he.queue.name,he.metas.length);try{Ir.call(this,he.metas,he.status)}catch(e){nt=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:"decode message error",data:e}),j.error("decode message error",e),this.onError&&this.onError(nt),null===(se=this.eventHandler)||void 0===se||se.dispatch("onError",nt)}finally{he.isLast?(j.debug("DLMessage isLast",he.isLast),ot=-1,this._queues.some((function(e,t){return e.name===he.name&&(ot=t,!0)}))&&ot>0&&this._queues.splice(ot,1),this._queues.length>0&&br.call(this,this._queues[0]),Rr.call(this,he)):he.nextKey&&(st=new(f())(he.nextKey.low,he.nextKey.high,he.nextKey.unsigned).toString(),j.debug("nexKey:",st,"this.nextKey:",this.nexKey),st!==this.nexKey||(null===(ce=he.queue)||void 0===ce?void 0:ce.name)!==this.currentQueue?(this.nexKey=st,this.currentQueue=null===(ue=he.queue)||void 0===ue?void 0:ue.name,Ur.call(this,he.nextKey,he.queue)):(j.debug("nexKey and queue are same, delete it"),it=-1,this._queues.some((function(e,t){return e.name===he.queue.name&&(it=t,!0)}))&&this._queues.splice(it,1),this._queues.length>0&&br.call(this,this._queues[0])))}}else he.isLast?(j.debug("isLast",he.isLast),at=-1,this._queues.some((function(e,t){return e.name===he.queue.name&&(at=t,!0)}))&&this._queues.splice(at,1),this._queues.length>0&&br.call(this,this._queues[0]),Rr.call(this,he)):he.nextKey&&(st=new(f())(he.nextKey.low,he.nextKey.high,he.nextKey.unsigned).toString(),j.debug("nexKey:",st,"this.nextKey:",this.nexKey),st!==this.nexKey||(null===(le=he.queue)||void 0===le?void 0:le.name)!==this.currentQueue?(this.nexKey=st,this.currentQueue=null===(de=he.queue)||void 0===de?void 0:de.name,Ur.call(this,he.nextKey,he.queue)):(j.debug("nexKey and queue are same, delete it"),ct=-1,this._queues.some((function(e,t){return e.name===he.queue.name&&(ct=t,!0)}))&&this._queues.splice(ct,1),this._queues.length>0&&br.call(this,this._queues[0])));return[2]}}))}))}function Vr(e){var t=[],r=this.root.lookup("easemob.pb.KeyValue"),n=[];for(var o in e){var i=r.decode(t);if(i.key=o,void 0!==e[o]){if("object"==typeof e[o])i.type=8,i.stringValue=JSON.stringify(e[o]);else if("string"==typeof e[o])i.type=7,i.stringValue=e[o];else if("boolean"==typeof e[o])i.type=1,i.varintValue=!0===e[o]?1:0;else if(Number.isInteger(e[o]))i.type=2,i.varintValue=e[o];else if("bigint"==typeof e[o]||"symbol"==typeof e[o]||"function"==typeof e[o]||Number.isNaN(e[o]))i.type=7,i.stringValue=e[o].toString();else{if("number"!=typeof e[o]||Number.isInteger(e[o]))continue;i.type=6,i.doubleValue=e[o]}n.push(i)}}return n}function Jr(e){var t,r,n,o=[];if(this.root){var i,a=this.root.lookup("easemob.pb.MessageBody.Content").decode(o);switch(i=!e.group&&"groupchat"!==(null===(t=null==e?void 0:e.chatType)||void 0===t?void 0:t.toLowerCase())||e.roomType?e.group&&e.roomType||"chatroom"===(null===(r=null==e?void 0:e.chatType)||void 0===r?void 0:r.toLowerCase())?"chatRoom":"singleChat":"groupChat",e.type){case"txt":a.type=0,a.text=e.msg;break;case"img":a.type=1,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.size=e.body.size,a.thumbnailDisplayName=e.body.filename):e.file?(a.displayName=e.file.filename,a.remotePath=e.file.url,a.secretKey=e.file.secret,a.fileLength=e.file.file_length,a.size=e.file.size,a.thumbnailDisplayName=e.file.filename):(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.size=e.size,a.thumbnailDisplayName=e.filename),e.isBuildCombinedMsg&&(a.remotePath=e.url,a.secretKey=e.secret,a.size={height:e.height,width:e.width}),e.isGif&&(a.subType=1);var s=e.imageType,c=e.isGif||!0===e.isOriginalImage||"original"===s;a.imageType=c?1:2;break;case"video":a.type=2,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.duration=e.body.length,a.thumbnailDisplayName=e.body.filename,a.thumbnailRemotePath=this.useOwnUploadFun?"":"".concat(e.body.url,"?vframe=true"),a.thumbnailSecretKey=this.useOwnUploadFun?"":e.body.secret):e.isBuildCombinedMsg&&(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.duration=e.length,a.thumbnailDisplayName=e.filename,a.thumbnailRemotePath=e.thumb,a.thumbnailSecretKey=e.thumb_secret);break;case"loc":a.type=3,a.latitude=e.lat,a.longitude=e.lng,a.address=e.addr,a.buildingName=e.buildingName,a.latitude=e.lat;break;case"audio":a.type=4,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.duration=e.body.length,a.thumbnailDisplayName=e.body.filename):e.isBuildCombinedMsg&&(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.duration=e.length,a.thumbnailDisplayName=e.filename);break;case"file":a.type=5,e.body?(a.displayName=e.body.filename,a.remotePath=e.body.url,a.secretKey=e.body.secret,a.fileLength=e.body.file_length,a.thumbnailDisplayName=e.body.filename):e.isBuildCombinedMsg&&(a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.thumbnailDisplayName=e.filename);break;case"cmd":a.type=6,a.action=e.action;break;case"custom":a.type=7,a.customEvent=e.customEvent,a.customExts=Vr.call(this,e.customExts);break;case"combine":a.type=0,a.subType=0,a.text=e.compatibleText,a.displayName=e.filename,a.remotePath=e.url,a.secretKey=e.secret,a.fileLength=e.file_length,a.title=e.title,a.summary=e.summary,a.combineLevel=e.combineLevel}var u=[];e.ext&&(u=Vr.call(this,e.ext));var l=this.root.lookup("easemob.pb.MessageBody"),h=l.decode(o),p=e.from||this.context.jid.name;h.from={name:e.isBuildCombinedMsg?p:this.context.jid.name};var m=e.to.indexOf("/"),g=m>-1?e.to.substring(0,m):e.to;if(h.to={name:g},"channel"===e.type)h.type=sr.CHANNEL_ACK,e.mid&&(h.ackMessageId=e.mid);else if("recall"===e.type)h.type=sr.RECALL,h.ackMessageId=e.ackId;else if("delivery"===e.type)h.type=sr.DELIVER_ACK,h.ackMessageId=e.ackId;else if("read"===e.type)h.type=sr.READ_ACK,h.ackMessageId=e.ackId,"groupChat"===i&&(h.msgConfig={allowGroupAck:!0},h.ackContent=e.ackContent);else if("chatRoom"===i)h.type=sr.CHATROOM;else if("groupChat"===i){if(h.type=sr.GROUPCHAT,e.msgConfig){var v=e.msgConfig.allowGroupAck;h.msgConfig={allowGroupAck:!!v}}}else"singleChat"===i&&(h.type=sr.SINGLECHAT);e.editMessageId&&(h.type=sr.EDIT,h.editMessageId=e.editMessageId,h.editScope=cr.BODY,e.ext&&(h.editScope=cr.BODY_AND_EXT)),h.contents=[a],h.ext=u;var E=function(e){var t={};return"translations"in e&&(t.translations=e.translations),"isChatThread"in e&&e.isChatThread&&(t.thread={}),Object.keys(t).length>0?JSON.stringify(t):""}(e);E&&(h.meta=E),h=l.encode(h).finish();var y=this.root.lookup("easemob.pb.Meta"),_=y.decode(o);_.id=e.id;var T="easemob.com";if("chatRoom"!==i&&"groupChat"!==i||(T="conference.easemob.com"),_.to={appKey:this.appKey,name:g,domain:T},m>-1&&(_.to.clientResource=e.to.substring(m+1,e.to.length)),"chatRoom"===i&&(_.ext=Vr.call(this,function(e){return{chatroom_msg_tag:"high"===e.priority?0:"low"===e.priority?2:1}}(e))),"recall"===e.type&&e.metaExt&&(_.ext=Vr.call(this,{recallMessageExtensionInfo:e.metaExt})),_.ns=1,_.payload=h,_.routetype=e.deliverOnlineOnly?1:0,"singleChat"!==i&&Array.isArray(e.receiverList)&&(null===(n=e.receiverList)||void 0===n?void 0:n.length)>0&&(_.directedUsers=e.receiverList,_.routetype=2),"delivery"!==e.type&&void 0!==e.webhookEnv){if("string"!=typeof e.webhookEnv)throw Error('Invalid parameter: "webhookEnv"');_.env=e.webhookEnv}if(e.isBuildCombinedMsg)return _.timestamp=f().fromValue(e.time),y.encode(_).finish();var I=this.root.lookup("easemob.pb.CommSyncUL"),O=I.decode(o);O.meta=_,!e.isPing&&Xr.call(this,e,_),O=I.encode(O).finish();var R=this.root.lookup("easemob.pb.MSync"),C=R.decode(o);return C.version=this.version,C.encryptType=this.encryptType,C.command=0,C.payload=O,C.traceId=fr.gen(),j.debug("traceId",C.traceId),R.encode(C).finish()}e.fail&&e.fail({type:d.WEBIM_CONNCTION_CLIENT_OFFLINE,message:"Not logged in"})}function Yr(e){var t,r,n,o,i,a,s,c,u,l=this,h=dr({},e);if(h.editMessageId){var p=Jr.call(this,h);tn.call(this,p)}else{if(e.file||"img"===e.type&&e._filePath){if(h.accessToken=this.token,h.appKey=this.appKey,h.apiUrl=this.apiUrl,h.body&&h.body.url)return Jr.call(this,h);var f=(null===(r=null===(t=h.file)||void 0===t?void 0:t.data)||void 0===r?void 0:r.type)||(null===(n=h.file)||void 0===n?void 0:n.filetype)||h.filetype||"";if(h.isGif&&f&&"image/gif"!==f)return void this._msgHash[h.id].reject({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"The file type is not gif."});var m=null!==(a=null===(i=null===(o=h.file)||void 0===o?void 0:o.data)||void 0===i?void 0:i.size)&&void 0!==a?a:h.file_length;if("number"==typeof m&&m<=0){var g={type:d.WEBIM_UPLOADFILE_ERROR,message:"fileSize must be greater than 0"};return h.onFileUploadError instanceof Function&&h.onFileUploadError(g),void(null===(s=this._msgHash[h.id])||void 0===s||s.reject(g))}return new Promise((function(t,r){var n=h.onFileUploadComplete,o=h.onFileUploadError,i=function(e,t){var r,n={type:d.WEBIM_UPLOADFILE_ERROR,message:e,data:t};o instanceof Function&&o(n),null===(r=l._msgHash[h.id])||void 0===r||r.reject(n)},a=function(e){var t=(null==e?void 0:e.message)||"";return/missing .*capability|requires file path string/i.test(t)},s=function(t){var r,o,i,a,s,c,u,p,f,m,g,E,y;if(t.entities){if(t.entities[0]["file-metadata"]){var _=t.entities[0]["file-metadata"]["content-length"];h.file_length=_,h.filetype=t.entities[0]["file-metadata"]["content-type"],_>204800&&(h.thumbnail=!0)}var T,I,O,R=(null===(o=h.file)||void 0===o?void 0:o.filename)||h.filename||(null===(i=h.body)||void 0===i?void 0:i.filename)||"image",S=h.filetype||(null===(a=h.file)||void 0===a?void 0:a.filetype)||(null===(s=t.entities[0]["file-metadata"])||void 0===s?void 0:s["content-type"])||"",b=null!==(g=null!==(f=null!==(p=null===(u=null===(c=h.file)||void 0===c?void 0:c.data)||void 0===u?void 0:u.size)&&void 0!==p?p:h.file_length)&&void 0!==f?f:null===(m=t.entities[0]["file-metadata"])||void 0===m?void 0:m["content-length"])&&void 0!==g?g:0,A="".concat(l.getChatFilesUrl(),"/").concat(t.entities[0].uuid);if(h.body={type:h.type||"file",secret:t.entities[0]["share-secret"],filename:R,url:A,length:h.length||0,filetype:S,file_length:b,size:{width:h.width||0,height:h.height||0}},h.file&&(h.file.url=t.uri),e.secret=t.entities[0]["share-secret"],t.url=e.url="".concat(A,"?em-redirect=true&share-secret=").concat(t.entities[0]["share-secret"]),e.file_length=h.file_length=b,"img"===h.type){var M=(T=A,I=t.entities[0]["share-secret"],O="em-redirect=true".concat(I?"&share-secret=".concat(I):""),{originalImageUrl:"".concat(T,"?").concat(O),bigImageUrl:"".concat(T,"?size=large&").concat(O)}),w="".concat(e.url,"&thumbnail=true");e.thumb=w,t.thumb="".concat(t.url,"&thumbnail=true"),e.originalImageUrl=M.originalImageUrl,e.bigImageUrl=M.bigImageUrl,t.originalImageUrl=M.originalImageUrl,t.bigImageUrl=M.bigImageUrl}"video"===h.type&&(e.thumb="".concat(e.url,"&vframe=true"),e.thumb_secret=t.entities[0]["share-secret"],t.thumb="".concat(t.url,"&vframe=true")),n instanceof Function&&n(t,h.id);var U=Jr.call(l,h);C.size<=N&&C.set(h.id,{rpt:l.dataReport.geOperateFun({operationName:v.SEND_MSG})}),null===(y=null===(E=l._localCache)||void 0===E?void 0:E.getInstance())||void 0===y||y.storeMessage(e,De.INPROGRESS),tn.call(l,U)}else null===(r=l._msgHash[h.id])||void 0===r||r.reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the file",data:t})};h.onFileUploadComplete=s,h.onFileUploadError=function(e){var t;o instanceof Function&&o(e),null===(t=l._msgHash[h.id])||void 0===t||t.reject({type:d.WEBIM_UPLOADFILE_ERROR,message:e.message||"Failed to upload the file",data:e})},hr(l,void 0,void 0,(function(){var e,t,r,n,o,c,u,l,d,p,f,m,g,E,y,_,T,I,O,R,C,S,N,b,A,M,w,U,L,P,D,k,x,B,G,H,F,W,z,q,K,V,J,Y,X,Q,Z;return pr(this,(function($){switch($.label){case 0:if($.trys.push([0,26,,27]),"img"!==h.type)return[3,25];if(e=this._imageProcessor,t=null===(B=h.file)||void 0===B?void 0:B.data,r=h._filePath,n=null!==(H=null!==(G=null==t?void 0:t.size)&&void 0!==G?G:h.file_length)&&void 0!==H?H:0,o=(null==t?void 0:t.type)||(null===(F=h.file)||void 0===F?void 0:F.filetype)||h.filetype||"",c=h.imageType,u=h.isGif||!0===h.isOriginalImage||"original"===c,l=void 0,!r||!e)return[3,4];$.label=1;case 1:return $.trys.push([1,3,,4]),[4,e.getImageInfo(r)];case 2:return(l=$.sent()).path&&l.path!==r&&(j.debug("Miniapp image message file path normalized",r,l.path),r=l.path,h._filePath=l.path),[3,4];case 3:return d=$.sent(),j.warn("Failed to normalize miniapp image path",d),[3,4];case 4:if(h.width&&h.height||!t&&!r)return[3,12];$.label=5;case 5:return $.trys.push([5,11,,12]),e?(f=l)?[3,7]:[4,e.getImageInfo(r||t)]:[3,8];case 6:f=$.sent(),$.label=7;case 7:return p=f,r&&p.path&&p.path!==r&&(r=p.path,h._filePath=p.path),h.width||(h.width=p.width),h.height||(h.height=p.height),[3,10];case 8:return"undefined"==typeof Image||"undefined"==typeof URL?[3,10]:[4,new Promise((function(e,r){var n=new Image,o=URL.createObjectURL(t);n.onload=function(){URL.revokeObjectURL(o),e({w:n.width,h:n.height})},n.onerror=function(){URL.revokeObjectURL(o),r(new Error("load failed"))},n.src=o}))];case 9:m=$.sent(),h.width||(h.width=m.w),h.height||(h.height=m.h),$.label=10;case 10:return[3,12];case 11:return g=$.sent(),r&&a(g)?(i("Failed to read image info on mini program platform",g),[2]):(j.warn("Failed to read image info",g),[3,12]);case 12:if(r&&(!h.width||!h.height)&&!e)return i("Mini program platform is missing image info capability"),[2];if(E=h.width,y=h.height,_=r||t,!u&&!h.isGif&&r&&!e)return i("Mini program platform is missing image compression capability"),[2];if(u||h.isGif||!e)return[3,16];if(!(T=r||t))return[3,16];$.label=13;case 13:return $.trys.push([13,15,,16]),[4,e.generateBigImage(T,{maxShortEdge:720,quality:.85})];case 14:return(I=$.sent())&&(I.file&&(h.file=dr(dr({},h.file),{data:I.file})),I.path&&(h._filePath=I.path,r=I.path),h.file_length=I.size,h.filetype=I.type,h.file&&(h.file.filetype=I.type),h.width=I.width,h.height=I.height,j.debug("Image compressed for large send","".concat(I.width,"x").concat(I.height,", size: ").concat(I.size))),[3,16];case 15:return O=$.sent(),r&&a(O)?(i("Mini program platform is missing image compression capability",O),[2]):(j.warn("Big image generation failed, falling back to original",O),h.isOriginalImage=!0,u=!0,[3,16]);case 16:return L=null!==(K=null!==(q=null===(z=null===(W=h.file)||void 0===W?void 0:W.data)||void 0===z?void 0:z.size)&&void 0!==q?q:h.file_length)&&void 0!==K?K:0,R=u?"original":"large",this.enableMd5Check?(h._uploadMd5=void 0,P="",e&&_?[3,17]:(j.warn("Image MD5 capability or source is missing, proceeding without MD5"),[3,20])):[3,24];case 17:return $.trys.push([17,19,,20]),[4,e.computeMd5(_)];case 18:return P=$.sent(),h._uploadMd5=P,[3,20];case 19:return C=$.sent(),j.warn("Failed to compute image MD5, proceeding without MD5",C),[3,20];case 20:if(!P||!nr(L,"img",R))return[3,24];$.label=21;case 21:return $.trys.push([21,23,,24]),[4,ar(this,P,"img",R)];case 22:return(k=$.sent()).hit&&k.uuid?("original"===(S=k.effectiveImageType||R)&&(h.isOriginalImage=!0,u=!0,h.width=E,h.height=y),j.debug("Precheck hit, skipping upload","uuid: ".concat(k.uuid),"effectiveImageType: ".concat(S)),N="original"===S?n:L,b="original"===S?o||(null===(V=h.file)||void 0===V?void 0:V.filetype)||"image/jpeg":(null===(J=h.file)||void 0===J?void 0:J.filetype)||h.filetype||"image/jpeg",A={entities:[{uuid:k.uuid,"share-secret":k.shareSecret||"","file-metadata":{"content-length":N,"content-type":b}}],uri:"".concat(this.getChatFilesUrl(),"/").concat(k.uuid)},s(A),[2]):[3,24];case 23:return M=$.sent(),j.warn("Precheck error, proceeding with upload",M),[3,24];case 24:h._uploadImageType=ir(R),$.label=25;case 25:return[3,27];case 26:return w=$.sent(),j.warn("Image preprocessing failed, proceeding with normal upload",w),[3,27];case 27:return this.enableMd5Check&&"img"!==h.type?(U=null===(Y=h.file)||void 0===Y?void 0:Y.data,L=null!==(Q=null!==(X=null==U?void 0:U.size)&&void 0!==X?X:h.file_length)&&void 0!==Q?Q:0,h._uploadMd5=void 0,P="",U?[3,28]:(j.warn("Attachment source is unavailable, proceeding without MD5"),[3,31])):[3,35];case 28:return $.trys.push([28,30,,31]),[4,or(U)];case 29:return P=$.sent(),h._uploadMd5=P,[3,31];case 30:return D=$.sent(),j.warn("Failed to compute attachment MD5, proceeding without MD5",D),[3,31];case 31:if(!P||!nr(L,h.type))return[3,35];$.label=32;case 32:return $.trys.push([32,34,,35]),[4,ar(this,P,h.type)];case 33:return(k=$.sent()).hit&&k.uuid?(j.debug("Attachment precheck hit, skipping upload","uuid: ".concat(k.uuid),"type: ".concat(h.type)),s({entities:[{uuid:k.uuid,"share-secret":k.shareSecret||"","file-metadata":{"content-length":L,"content-type":U.type||h.filetype||(null===(Z=h.file)||void 0===Z?void 0:Z.filetype)||""}}],uri:"".concat(this.getChatFilesUrl(),"/").concat(k.uuid)}),[2]):[3,35];case 34:return x=$.sent(),j.warn("Attachment precheck failed, proceeding with upload",x),[3,35];case 35:return _e.uploadFile.call(this,h,v.UPLOAD_MSG_ATTACH),[2]}}))}))}))}if("combine"===e.type){h.accessToken=this.token,h.appKey=this.appKey,h.apiUrl=this.apiUrl;var E=h.onFileUploadComplete,y=h.onFileUploadError;return new Promise((function(t,r){var n,o,i,a;if((null===(n=e.messageList)||void 0===n?void 0:n.length)>300||0===(null===(o=e.messageList)||void 0===o?void 0:o.length))return l._msgHash[h.id].reject({type:d.MAX_LIMIT,message:"The number of combined messages exceeded the limit."});var s=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([],e.messageList,!0),c=0;if(s.forEach((function(e){(null==e?void 0:e.combineLevel)>c&&(c=null==e?void 0:e.combineLevel)})),h.combineLevel=c+1,h.combineLevel>10)return l._msgHash[h.id].reject({type:d.MAX_LIMIT,message:"The level of the merged message exceeded the limit."});var u=Qr.call(l,s),p=function(t,r){var n,o,i,a,s,c,u="".concat(l.getChatFilesUrl(),"/").concat(t.entities[0].uuid),d=null===(n=t.entities[0])||void 0===n?void 0:n["share-secret"],p="".concat(u,"?em-redirect=true");d&&(p="".concat(p,"&share-secret=").concat(d)),E instanceof Function&&E({url:p,secret:d}),e.url=p,e.secret=d,h.url=p,h.secret=t.entities[0]["share-secret"],h.filename=(null===(o=h.file)||void 0===o?void 0:o.filename)||(null==r?void 0:r.fileName),h.file_length=(null===(a=null===(i=h.file)||void 0===i?void 0:i.data)||void 0===a?void 0:a.size)||(null==r?void 0:r.fileLength)||0,null===(c=null===(s=l._localCache)||void 0===s?void 0:s.getInstance())||void 0===c||c.storeMessage(e,De.INPROGRESS);var f=Jr.call(l,h);tn.call(l,f)},f=_e.getEnvInfo();if("web"!==f.platform&&"node"!==f.platform&&"quick_app"!==f.platform&&(null===(a=null===(i=f.global)||void 0===i?void 0:i.canIUse)||void 0===a?void 0:a.call(i,"getFileSystemManager"))){var m=f.global.getFileSystemManager(),g=l.getChatFilesUrl();m.writeFile({filePath:"".concat(f.global.env.USER_DATA_PATH,"/combine"),data:u.buffer,encoding:"binary",success:function(e){f.global.uploadFile({url:g,filePath:"".concat(f.global.env.USER_DATA_PATH,"/combine"),name:"file",header:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+h.accessToken},success:function(e){if(200===e.statusCode){j.debug("upload success");var t=JSON.parse(e.data);p(t,{fileName:"combine",fileLength:u.length})}else j.error("upload fail"),h.onFileUploadError instanceof Function&&h.onFileUploadError(e),this._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})},fail:function(t){j.error("upload fail"),h.onFileUploadError instanceof Function&&h.onFileUploadError(e),this._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:t})}})},fail:function(e){j.error("write file fail",e),this._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})}})}else{var _=new File([u],"combine",{type:"application/octet-stream"}),T={url:URL.createObjectURL(_),filename:h.id,data:_};h.file=T,h.onFileUploadComplete=function(e){p(e)},h.onFileUploadError=function(e){y instanceof Function&&y(e),l._msgHash[h.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})},_e.uploadFile.call(l,h,v.UPLOAD_MSG_ATTACH)}}))}"img"===e.type&&(h.body||(h.body=dr(dr({},h),{size:{width:h.width||0,height:h.height||0}}))),null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u||u.storeMessage(e,De.INPROGRESS),p=Jr.call(this,h),tn.call(this,p)}}function Xr(e,t){if(e.editMessageId)return t.ignoreCallback=!0,void(this._msgHash[e.id].thirdMessage=t);mr.includes(e.type)&&(this._msgHash[e.id].thirdMessage=t)}function Qr(e){for(var t=Uint8Array.from("cm",(function(e){return e.charCodeAt(0)})),r=0;r<e.length;r++){for(var n=e[r],o=dr(dr({},n),{isBuildCombinedMsg:!0}),i=this.mSync.encodeChatMsg.call(this,o),a=i.length,s=new Uint8Array(4),c=0;c<4;c++)s[c]=a>>8*(3-c)&255;var u=new Uint8Array(t.length+s.length+i.length);u.set(t),u.set(s,t.length),u.set(i,t.length+s.length),t=u}var l=new Uint8Array(t.length+1),d=0;for(r=2;r<t.length;r++)r%2==1&&(d^=t[r]);return l.set(t),j.debug("checkResult:",d),l[t.length]=d,l}function Zr(e,t,r){var n=[],o=this.root.lookup("easemob.pb.MUCBody"),i=e.roomId,a=e.ext,s=void 0===a?"":a,c=e.leaveOtherRooms,u=void 0!==c&&c,l=o.decode(n);l.mucId={appKey:this.appKey,name:i,domain:"conference.easemob.com"},l.operation="join"===r?2:3,l.from={name:this.context.userId},l.isChatroom=!0,"join"===r&&(l.ext=s,l.leaveOtherRooms=u),l=o.encode(l).finish();var d=this.root.lookup("easemob.pb.Meta").decode(n);d.id=t,d.from={appKey:this.appKey,name:this.context.userId,domain:"easemob.com",client_resource:this.context.jid.clientResource},d.to={domain:"easemob.com"},d.ns=2,d.payload=l;var h=this.root.lookup("easemob.pb.CommSyncUL"),p=h.decode(n);p.meta=d,p=h.encode(p).finish();var f=this.root.lookup("easemob.pb.MSync"),m=f.decode(n);return m.version=this.version,m.encryptType=this.encryptType,m.command=0,m.payload=p,m.traceId=fr.gen(),j.debug("traceId",m.traceId),f.encode(m).finish()}function $r(e,t){var r=_e.getUniqueId(),n=Zr.call(this,e,r,t),o="join"===t?v.JOIN_CHATROOM:v.QUIT_CHATROOM,i=this.dataReport.geOperateFun({operationName:o});return S.size<=N&&S.set(r,{rpt:i,requestName:o}),tn.call(this,dr(dr({},e),{isHandleChatroom:!0,joinMsg:n,id:r,operation:t}),r)}function en(e){var t=this;return new Promise((function(r,n){var o,i,a,s,c,u;if(j.debug("call send"),t.logOut)return j.error("send message failed",d.WEBIM_CONNECTION_CLOSED),n({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"});if(!e.id||"string"!=typeof e.id||""===e.id)return n({type:d.MESSAGE_PARAMETER_ERROR,message:'Missing required parameter: "id"'});if(!e.to||"string"!=typeof e.to||""===e.to)return n({type:d.MESSAGE_PARAMETER_ERROR,message:'Missing required parameter: "to"'});var l="file"===e.type||"img"===e.type||"audio"===e.type||"video"===e.type,h="delivery"===e.type||"read"===e.type||"channel"===e.type,p="cmd"===e.type,f="recall"===e.type,m=null==e?void 0:e.editMessageId,g=!(h||f||p||m);if(e.id){if(!l&&!h||l&&t.useOwnUploadFun){var E="recall"===e.type?v.SEND_RECALL_MSG:v.SEND_MSG;m&&(E=v.MODIFY_MESSAGE),C.size<=N&&C.set(e.id,{rpt:t.dataReport.geOperateFun({operationName:E})})}g&&(null===(i=null===(o=t._localCache)||void 0===o?void 0:o.getInstance())||void 0===i||i.storeMessage(e,De.CREATE)),t._msgHash[e.id]=dr(dr({},e),{resolve:r,reject:n})}if(l||"combine"===e.type)return Yr.call(t,e);if("txt"===e.type&&(null===(a=e.msgConfig)||void 0===a?void 0:a.languages)&&Array.isArray(null===(s=e.msgConfig)||void 0===s?void 0:s.languages)&&e.msgConfig.languages.length>0){var y=t.translateMessage||t.translation.translateMessage;if(!y)throw new Error("there is no method to translate message");y.call(t,{text:e.msg,languages:e.msgConfig.languages}).then((function(r){var n,o,i,a=null===(n=r.data[0])||void 0===n?void 0:n.translations;a=a.map((function(e){return{code:e.to,text:e.text}})),e.translations=a,t._msgHash[e.id].translations=a,null===(i=null===(o=t._localCache)||void 0===o?void 0:o.getInstance())||void 0===i||i.storeMessage(e,De.INPROGRESS);var s=Jr.call(t,e);tn.call(t,s,e.id)})).catch((function(e){n(e)}))}else{g&&(null===(u=null===(c=t._localCache)||void 0===c?void 0:c.getInstance())||void 0===u||u.storeMessage(e,De.INPROGRESS));var _=Jr.call(t,e);tn.call(t,_,e.id)}}))}function tn(e,t){var r,n,o,i,a=this;if(e.isHandleChatroom){if(!this.isOpened()){var s={data:"",type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"};if(S.has(e.id)){var c=S.get(e.id);(0,c.rpt)({isEndApi:!0,data:{isSuccess:0,requestName:c.requestName,requestMethod:"WEBSOCKET",requestUrl:this.url,code:_.disconnect,codeDesc:"websocket has been disconnected"}}),S.delete(e.id)}return Promise.reject(s)}return new Promise((function(r,n){var o,i;a._msgHash[e.id]=dr(dr({},e),{resolve:r,reject:n});var s=Jt.call(a,e.joinMsg),c=s[0];if(!s[1]){var u={type:d.SDK_RUNTIME_ERROR,message:"compress message failed"};return null===(i=null===(o=a._msgHash[e.id])||void 0===o?void 0:o.reject)||void 0===i||i.call(o,u),void delete a._msgHash[e.id]}var l=a._getSock?_r.call(a,c,t):c;if(t){var h=setTimeout((function(){var t,r=a._msgHash[e.id];if(r){var n={type:d.REQUEST_TIMEOUT,message:"request timeout"};null===(t=r.reject)||void 0===t||t.call(r,n),clearTimeout(r.messageTimer),delete a._msgHash[e.id],a.reconnecting||a.reconnect(!0)}}),15e3);a._msgHash[e.id].messageTimer=h}a.sock.send(l)}))}if(!this.isOpened())return null===(r=this.unMSyncSendMsgMap)||void 0===r||r.set(t,e),!this.logOut&&this.autoReconnectNumTotal<this.autoReconnectNumMax&&(j.info("need to reconnect",this.autoReconnectNumTotal,this.autoReconnectNumMax),this.offLineSendConnecting=!0,this.reconnecting||this.reconnect()),void(this.onError&&this.onError({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"}));var u=t&&setTimeout((function(){var e,r,n;if(a._msgHash[null!=t?t:""]){var o={type:d.MESSAGE_SEND_TIMEOUT,message:"send message timeout"};null===(r=(e=a._msgHash[null!=t?t:""]).reject)||void 0===r||r.call(e,o),clearTimeout(null===(n=a._msgHash[null!=t?t:""])||void 0===n?void 0:n.messageTimer),delete a._msgHash[null!=t?t:""],a.reconnecting||a.reconnect(!0)}}),15e3);this._msgHash[null!=t?t:""]&&(this._msgHash[null!=t?t:""].messageTimer=u);var l=Jt.call(this,e),h=l[0];if(!l[1])return s={type:d.SDK_RUNTIME_ERROR,message:"compress message failed"},null===(o=null===(n=this._msgHash[null!=t?t:""])||void 0===n?void 0:n.reject)||void 0===o||o.call(n,s),clearTimeout(null===(i=this._msgHash[null!=t?t:""])||void 0===i?void 0:i.messageTimer),void delete this._msgHash[null!=t?t:""];var p=this._getSock?_r.call(this,h,t):h;this.sock.send(p)}var rn=function(e,t){return e.send=en,e.sendMsg=en,j.info("init Msync by ".concat(e.name)),{generateProvision:Er.bind(e),generateLogout:yr.bind(e),base64transform:_r.bind(e),distributeMeta:Tr.bind(e),decodeMeta:Ir.bind(e),decodeUnreadDL:Cr.bind(e),_rebuild:Sr.bind(e),_lastsession:Ar.bind(e),receiveProvision:Lr.bind(e),isInQueue:Hr.bind(e),decodeNotice:Fr.bind(e),decodeMSync:Wr.bind(e),distributeMSync:zr.bind(e),encodeChatMsg:Jr.bind(e),upLoadFile:Yr.bind(e),send:en.bind(e),stopHeartBeat:Gr.bind(e),handleChatRoom:$r.bind(e),sendUnreadDeal:xr.bind(e)}},nn=["onTextMessage","onFileMessage","onAudioMessage","onVideoMessage","onImageMessage","onLocationMessage","onCustomMessage","onCMDMessage","onStreamMessage"],on=function(){function e(e,t,r){this.handlerData={},this.handlerData={},e.addEventHandler=this.addEventHandler.bind(this),e.removeEventHandler=this.removeEventHandler.bind(this)}return e.prototype.addEventHandler=function(e,t){this.handlerData[e]=t},e.prototype.removeEventHandler=function(e){delete this.handlerData[e]},e.prototype.dispatch=function(e,t){for(var r in nn.includes(e)&&t?j.debug("dispatch event: "+e,{id:t.id,type:t.type,time:t.time,from:t.from,to:t.to,chatType:t.chatType}):"onMessage"===e?j.debug("dispatch event: "+e,null==t?void 0:t.length):j.debug("dispatch event: "+e,t||""),this.handlerData){var n=this.handlerData[r][e];n&&n(t)}},e}(),an=function(){};function sn(e){this.onOpened=e.onOpened||an,this.onPresence=e.onPresence||an,this.onTextMessage=e.onTextMessage||an,this.onPictureMessage=e.onPictureMessage||an,this.onAudioMessage=e.onAudioMessage||an,this.onVideoMessage=e.onVideoMessage||an,this.onFileMessage=e.onFileMessage||an,this.onLocationMessage=e.onLocationMessage||an,this.onCmdMessage=e.onCmdMessage||an,this.onCustomMessage=e.onCustomMessage||an,this.onReceivedMessage=e.onReceivedMessage||an,this.onDeliveredMessage=e.onDeliveredMessage||an,this.onReadMessage=e.onReadMessage||an,this.onRecallMessage=e.onRecallMessage||an,this.onChannelMessage=e.onChannelMessage||an,this.onError=e.onError||an,this.onOffline=e.onOffline||an,this.onOnline=e.onOnline||an,this.onStatisticMessage=e.onStatisticMessage||an,this.onContactInvited=e.onContactInvited||an,this.onContactAgreed=e.onContactAgreed||an,this.onContactRefuse=e.onContactRefuse||an,this.onContactDeleted=e.onContactDeleted||an,this.onContactAdded=e.onContactAdded||an,this.onTokenWillExpire=e.onTokenWillExpire||an,this.onTokenExpired=e.onTokenExpired||an,this.onClosed=e.onClosed||an,this.onPresenceStatusChange=e.onPresenceStatusChange||an}var cn={biz:"",debug:!1,token:""},un="https://data-reporting.rtnsvc.com/report",ln="https://data-reporting.realtimemesh.com/report",dn=function(e){var t=Number(g[e]);return t===g.USER_LOGIN?"MANUALLOGIN":t===g.MSYNC_SENDMESSAGE?"SENDMESSAGE":t>g.UNKNOWOPERATION&&t<g.REST_OPERATE?"REST":t>g.REST_OPERATE&&t<g.MSYNC_OPERATE?"MESSAGE":t>g.MSYNC_OPERATE&&t<g.ROSTER_OPERATE?"ROSTER":t>g.ROSTER_OPERATE&&t<g.USER_OPERATE?"USER":t>g.USER_OPERATE&&t<g.GROUP_OPERATE?"GROUP":t>g.GROUP_OPERATE&&t<g.CHATROOM_OPERATE?"CHATROOM":"OPERATION"},hn=function(){return(new Date).getTime()},pn=function(e){return[le.BAIDU,le.WX,le.DD,le.ZFB,le.TT,le.QUICK_APP,le.UNI].includes(e.platform)},fn=function(){return e=1,t=99999,e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e))+e;var e,t},mn={},gn=1e3,vn=function(){function e(e){this.eventQueue=[],this.stock=gn,this.config=e,this.governor()}return e.prototype.add=function(e){this.stock<=0?console.warn("Event Report limit ".concat(gn," per minute")):(this.eventQueue.push(e),this.consume(),this.stock-=1)},e.prototype.consume=function(){var e=this;0!==this.eventQueue.length&&(this.timer&&this.eventQueue.length<=10&&clearTimeout(this.timer),this.timer=setTimeout((function(){var t,r=e.eventQueue.splice(0,10),n=r.filter((function(e){return e.appId===r[0].appId})),o=r.filter((function(e){return e.appId!==r[0].appId}));(t=e.eventQueue).unshift.apply(t,o),e.batchSend(n)}),1e3))},e.prototype.governor=function(){var e=this,t=setInterval((function(){e.stock=gn}),6e4);"undefined"!=typeof addEventListener&&addEventListener("beforeunload",(function(){clearInterval(t)}))},e.prototype.batchSend=function(e){var t,r;if(void 0===e&&(e=[]),0!==e.length)try{var n=e.map((function(e){e.biz,e.appId;var t=e.eventId,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["biz","appId","eventId"]);return{eventId:Number(t),body:r}}));!function(e,t){try{var r=t.biz,n=t.appId,o=t.data,i=t.debug,a=t.onSuccess;if(!r)throw new Error("biz is not defined");mn.global||(mn=_e.getEnvInfo());var s=mn;if(pn(s)){var c={url:i?ln:un,data:o,method:"POST",timeout:K,success:function(){null==a||a()},fail:function(){},complete:function(){}},u={token:e,appid:null!=n?n:"",sendts:"".concat(Math.floor((new Date).getTime()/1e3)),biz:r,debug:"".concat(i)};if("zfb"===s.platform||"dd"===s.platform?c.headers=u:c.header=u,"dd"===s.platform)return s.global.httpRequest(c);s.global.request(c)}else{var l=new XMLHttpRequest;l.onreadystatechange=function(){2===l.readyState&&(null==a||a())},l.open("POST",i?ln:un),l.setRequestHeader("Content-Type","application/json"),l.setRequestHeader("token",e),l.setRequestHeader("appid",null!=n?n:""),l.setRequestHeader("sendts","".concat(Math.floor((new Date).getTime()/1e3))),l.setRequestHeader("biz",r),l.setRequestHeader("debug","".concat(i)),l.send(JSON.stringify(o))}}catch(e){console.error(e)}}(this.config.token,{biz:null===(t=e[0])||void 0===t?void 0:t.biz,appId:null===(r=e[0])||void 0===r?void 0:r.appId,data:n,debug:this.config.debug,onSuccess:this.consume.bind(this)})}catch(e){console.error(e)}},e}(),En=function(){return En=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},En.apply(this,arguments)},yn=new(function(){function e(e){this.inited=!1,this.appId="",this.biz="",this.eventQueue={},this.config=cn,e&&this.init(e)}return e.prototype.init=function(e){var t;if(void 0===e&&(e={}),!e.biz||!e.token)throw new Error("Event Report: biz or token is not defined");try{this.appId=null!==(t=e.appId)&&void 0!==t?t:"",this.biz=e.biz,this.config=En(En({},cn),e),this.eventQueue=new vn(this.config),this.log(e),this.inited=!0}catch(e){console.error(e)}},e.prototype.updateAppId=function(e){this.appId=e},e.prototype.send=function(e,t,r){var n;if(void 0===t&&(t={}),this.inited){var o=En(En({},t),{eventId:Number(e),biz:this.biz,appId:null!==(n=null==r?void 0:r.appId)&&void 0!==n?n:this.appId});this.eventQueue.add(o),this.log(o)}else console.error("Event Report: init is not called")},e.prototype.log=function(e){try{if(this.config.debug){var t=e.payload,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["payload"]);console.log("%c Event Report: ".concat(this.config.biz," "),"background: #8A97FC; color: #fff"),console.table(r),t&&(console.info("payload:"),console.table(t))}}catch(e){console.error(e)}},e}()),_n=function(){return _n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_n.apply(this,arguments)},Tn={requestName:"",subrequestid:"1",requestMethod:"GET",requestUrl:"",requestElapse:0,code:0,codeDesc:"",isLastApi:0,isSuccess:1},In=function(){function e(e){this.platform=_e.getEnvInfo(),this.isReportDt=e.isReport||!1,this.isCollectDt=!0,pn(this.platform)&&!this.isReportDt&&(this.isCollectDt=!1),this.eventQueue=[],this.accessChannel="direct",this.options=function(e,t){t.platform||(t=_e.getEnvInfo());var r=e.org,n=e.appkey,o=e.deviceId,i=e.sdkVersion,a=e.uikitVersion,s="undefined"!=typeof navigator?null===navigator||void 0===navigator?void 0:navigator.userAgent:"".concat(t.platform,"_mini_program");return{org:r,appkey:n,deviceId:o,sdkServiceId:"sid_".concat(_e.getUniqueId(),"_").concat(fn()),did:s,sdkVersion:i,os:7,sdkProduct:T.web,uikitVersion:a}}(e,this.platform),this.sid=this.options.sdkServiceId,this.init(e)}return e.getInstance=function(t){return e.instance||(e.instance=new e(t)),e.instance},e.prototype.getServiceId=function(){return this.sid||"sid_0"},e.prototype.setIsReportDt=function(e){this.isReportDt=e,e&&this.rptEventQueue()},e.prototype.setIsCollectDt=function(e){this.isCollectDt=e,e||(this.eventQueue=[])},e.prototype.rptEventQueue=function(){var e=this;this.eventQueue.length&&this.eventQueue.forEach((function(t,r){yn.send(t.eventId,t.dt),r>=e.eventQueue.length-1&&(e.eventQueue=[])}))},e.prototype.init=function(t){e.instance||(e.instance=this,yn.init({biz:"im",token:"32f24ab2ddb74f508aa9286c356cec84",appId:t.appkey,debug:!1}),this.reportInit())},e.prototype.updateAppKey=function(e){this.options.appkey=e,this.eventQueue.forEach((function(t){"default#appkey"===t.dt.appkey&&(t.dt.appkey=e)}))},e.prototype.reportInit=function(){if(this.isCollectDt){var e=this.options,t=e.did,r=e.os,n=e.sdkVersion,o=e.deviceId;this.reportData(9674,{did:t,os:r,sdkVersion:n,deviceId:o})}},e.prototype.geOperateFun=function(e){var t=this;if(!this.isCollectDt)return function(){};var r=1,n=0,o="",i=hn(),a=e.uid,s=e.operationName;a&&(this.uid=a);var c={uid:this.uid,operationId:"opr_".concat(_e.getUniqueId(),"_").concat(fn()),requestid:"req_".concat(_e.getUniqueId(),"_").concat(fn()),operationName:s};return function(e){var a,u,l,d;if(e.data.isSuccess?(n=0,o=""):(0===e.data.code&&(e.data.code=A),n=null!==(a=e.data.code)&&void 0!==a?a:n,o=null!==(u=e.data.codeDesc)&&void 0!==u?u:o),(null===(l=e.data)||void 0===l?void 0:l.accessChannel)&&(t.accessChannel=null===(d=e.data)||void 0===d?void 0:d.accessChannel),e.isRetry?(r++,e.data.subrequestid="".concat(r)):(c.requestid="req_".concat(_e.getUniqueId(),"_").concat(fn()),r=1),e.data.isLastApi){var h=hn();e.data.requestElapse=h-i,e.data.requestMethod="",e.data.subrequestid="0",e.data.code=200===n?0:n,e.data.codeDesc=o}else e.data.requestName||(e.data.requestName=s);e.data.requestElapse||(e.data.requestElapse=hn()-i),t.reportData.call(t,b,_n(_n(_n(_n({},Tn),c),e.data),{accessChannel:t.accessChannel,operationType:dn(s)})),e.isEndApi&&t.reportData.call(t,b,_n(_n(_n({},c),Tn),{isSuccess:e.data.isSuccess,isLastApi:1,subrequestid:"0",requestMethod:"",code:200===n?0:n,codeDesc:o,requestElapse:e.data.requestElapse,accessChannel:t.accessChannel,operationType:dn(s)}))}},e.prototype.reportData=function(e,t){return r=this,n=void 0,i=function(){var r,n,o,i,a,s,c,u,l;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),r=hn(),n=0,e!==b?[3,2]:[4,(h=this.platform,new Promise((function(e){var t;h.platform||(h=_e.getEnvInfo());var r="";if(h.platform===le.WEB){var n=navigator.connection;(null==n?void 0:n.type)?(null==n||n.type,r=y.WIFI):(null==n?void 0:n.effectiveType)&&(r=y[n.effectiveType.toLocaleUpperCase()]),e(r)}else h.platform===le.NODE?(r=y.UNKNOWN,e(r)):null===(t=h.global)||void 0===t||t.getNetworkType({success:function(t){r=y[t.networkType.toLocaleUpperCase()],e(r)}})})))];case 1:n=d.sent(),d.label=2;case 2:return o=this.options,i=o.appkey,a=o.sdkServiceId,s=o.sdkProduct,c=o.uikitVersion,u=_n({lts:r,net:n,appkey:i,sdkServiceId:a,sdkProduct:s,uikitVersion:c},t),this.isReportDt?yn.send(e,u):this.isCollectDt&&this.eventQueue.push({eventId:e,dt:u}),[3,4];case 3:return l=d.sent(),console.warn(l),[3,4];case 4:return[2]}var h}))},new((o=void 0)||(o=Promise))((function(e,t){function a(e){try{c(i.next(e))}catch(e){t(e)}}function s(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(a,s)}c((i=i.apply(r,n||[])).next())}));var r,n,o,i},e}(),On=function(){return On=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},On.apply(this,arguments)},Rn=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Cn=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Sn={txt:"text",img:"image",video:"video",file:"file",loc:"location",custom:"custom",combine:"combine"},Nn={text:"txt",image:"img",video:"video",file:"file",location:"loc",custom:"custom"},bn=5,An=new Set(["txt","img","video","file","loc","custom","combine"]);function Mn(e){return m.create({type:d.REQUEST_PARAMETER_ERROR,message:e})}function wn(e,t){j.error(e,t)}function Un(e){var t,r,n,o=Se[e.conversationType],i=Nn[e.contentType]||e.contentType,a=function(e,t){return"groupchat"===t.conversationType||"chatroom"===t.conversationType?t.receiverId:t.senderId!==e?t.senderId:t.receiverId}(this.context.userId,e),s={id:"".concat(e.messageId),conversationId:a,chatType:o,from:e.senderId,to:e.receiverId,ext:e.ext||{},time:new Date(e.sentTime).getTime()},c=e.content||{},u="string"==typeof e.text?e.text:void 0;switch(i){case"txt":n=On(On({},s),{type:"txt",msg:c.message||e.text||""}),Array.isArray(e.translations)&&e.translations.length>0&&(n.translations={translations:e.translations.map((function(e){return{text:e.text,to:e.code}}))});break;case"img":var l=c.url||c.remotePath||"",d=c.secret||c.secretKey||"",h=this.useOwnUploadFun?l:nt.call(this,{remotePath:l,secretKey:d});n=On(On({},s),{type:"img",url:h||"",width:(null===(t=c.size)||void 0===t?void 0:t.width)||c.width||0,height:(null===(r=c.size)||void 0===r?void 0:r.height)||c.height||0,secret:d,thumb:this.useOwnUploadFun?c.thumb||"":c.thumb?_e.formatAttachUrl.call(this,c.thumb):h?"".concat(h,"&thumbnail=true"):"",thumb_secret:c.thumb_secret||c.thumbnailSecretKey||d||"",file_length:c.file_length||c.fileLength||0,filetype:c.filetype||"",file:{},isGif:"sub_gif"===c.subType||1===c.subType});break;case"video":l=c.url||c.remotePath||"",d=c.secret||c.secretKey||"",h=this.useOwnUploadFun?l:nt.call(this,{remotePath:l,secretKey:d}),n=On(On({},s),{type:"video",url:h||"",secret:d||"",thumb:c.thumb?_e.formatAttachUrl.call(this,c.thumb):_e.formatAttachUrl.call(this,c.thumbnailRemotePath||""),thumb_secret:c.thumb_secret||c.thumbnailSecretKey||"",filename:c.filename||c.displayName||"",length:c.length||c.duration||0,file:{},file_length:c.file_length||c.fileLength||0,filetype:c.filetype||""});break;case"file":l=c.url||c.remotePath||"",d=c.secret||c.secretKey||"",h=this.useOwnUploadFun?l:nt.call(this,{remotePath:l,secretKey:d}),n=On(On({},s),{type:"file",url:h||"",secret:d||"",file:{},filename:c.filename||c.displayName||"",length:c.length||c.duration||0,file_length:c.file_length||c.fileLength||0,filetype:c.filetype||""});break;case"loc":n=On(On({},s),{type:"loc",buildingName:c.buildingName||"",addr:c.addr||c.address||"",lat:c.lat||c.latitude||0,lng:c.lng||c.longitude||0});break;case"custom":n=On(On({},s),{type:"custom",customEvent:c.customEvent||"",customExts:c.customExts||{},params:c.params||{}});break;default:n=On(On({},s),{type:i})}if(void 0!==u&&(n.text=u),e.highlight&&"object"==typeof e.highlight){for(var p=[],f=0,m=Object.values(e.highlight);f<m.length;f++){var g=m[f];Array.isArray(g)&&p.push.apply(p,g)}p.length>0&&(n.highlight=p)}return n}var Ln={singleChat:"chat",chatRoom:"chatroom",groupChat:"groupchat"};function Pn(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/users/"+this.user+"/blocks/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i},success:function(t){var r={};t.data.forEach((function(e){r[e]={name:e}})),"function"==typeof(null==e?void 0:e.success)&&e.success(t)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return j.debug("Call getBlocklist"),ae.call(this,a,v.GET_BLACK_LIST)}var Dn=Pn,kn=xn;function xn(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/users/"+this.user+"/contacts/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+a},success:function(r){var n=[];r.data.forEach((function(e){n.push({name:e,subscription:"both",jid:t.context.jid})})),"function"==typeof(null==e?void 0:e.success)&&e.success(n)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return j.debug("Call getContacts"),ae.call(this,s,v.GET_CONTACTS)}function Bn(e){return j.debug("Call uploadPushToken"),Mt.call(this,e)}var Gn=Bn;function jn(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/user_channels"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return j.debug("Call getSessionList"),ae.call(this,a)}function Hn(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=!!(e&&"number"==typeof e.pageNum&&"number"==typeof e.pageSize&&e.pageNum>0&&e.pageSize>0),c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(this.user,"/user_channels").concat(s?"/page":""),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return s&&(c.data={pageNum:e.pageNum,pageSize:e.pageSize}),j.debug("Call getConversationlist"),ae.call(this,c,v.GET_SESSION_LIST).then((function(e){return Fn.call(t,e)}))}function Fn(e){var t=this,r=e.data.channel_infos;return null==r||r.forEach((function(e){e.meta&&"{}"!==JSON.stringify(e.meta)?(e.meta.payload=JSON.parse(e.meta.payload),e.lastMessage=Ne.call(t,e.meta,{formatCustomExts:!1})):e.lastMessage=e.meta,delete e.meta})),e}function Wn(e){if(e&&"string"!=typeof e.channel)throw Error("Invalid parameter channel: ".concat(e.channel));if(e&&"singleChat"!==e.chatType&&"groupChat"!==e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(e&&"boolean"!=typeof e.deleteRoam)throw Error("Invalid parameter deleteRoam: ".concat(e.deleteRoam));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r,n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid;r="singleChat"===e.chatType?"chat":"groupChat";var c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/user/").concat(this.user,"/user_channel?resource=").concat(s.clientResource),dataType:"json",type:"DELETE",data:JSON.stringify({channel:e.channel,type:r,delete_roam:e.deleteRoam}),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call deleteSession",e),ae.call(this,c,v.DELETE_SESSION)}var zn=Wn;function qn(e,t){var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=["nickname","avatarurl","mail","phone","gender","sign","birth","ext"],c={},u=_e.getEnvInfo();if("wx"===u.platform||"qq"===u.platform)if("string"==typeof e&&void 0!==t){if(!s.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");c[e]=t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");s.forEach((function(t){s.includes(t)&&void 0!==e[t]&&(c[t]=e[t])}))}else if("string"==typeof e){if(!s.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");c=e+"="+t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");var l=[];s.forEach((function(t){if(s.includes(t)&&void 0!==e[t]){var r=encodeURIComponent(t),n=encodeURIComponent(e[t]);l.push(r+"="+n)}})),c=l.join("&")}var d={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/metadata/user/").concat(this.user),type:"PUT",data:c,dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/x-www-form-urlencoded"}};return j.debug("Call updateOwnUserInfo",e),ae.call(this,d,v.UPDATE_USER_INFO)}var Kn=qn;function Vn(e,t){var r=Nt.call(this).error;if(r)return Promise.reject(r);var n,o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=[];if("string"==typeof e)c=[e];else{if("[object Array]"!==Object.prototype.toString.call(e))throw new Error("illegal params");c=e}n="string"==typeof t?[t]:t&&"[object Array]"===Object.prototype.toString.call(t)?t:["nickname","avatarurl","mail","phone","gender","sign","birth","ext"];var u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/metadata/user/get"),type:"POST",data:JSON.stringify({targets:c,properties:n}),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return j.debug("Call fetchUserInfoById",e),ae.call(this,u,v.GET_USER_INFO)}function Jn(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user),type:"PUT",dataType:"json",data:JSON.stringify({nickname:e}),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call updateCurrentUserNick",e),ae.call(this,a)}function Yn(e){if("string"!=typeof e||""===e)throw Error('Invalid parameter: "token"');var t=this.context,r=t.orgName,n=t.appName,o={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/sdk/users/").concat(this.user,"/token/expires"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json"}};return j.debug("Call getTokenExpireTimestamp",e),ae.call(this,o,v.SDK_INTERNAL)}function Xn(e){var t=this;return new Promise((function(r,n){if(!e.queue)throw Error('Invalid parameter: "specified"');var o=Nt.call(t).error;if(o)return Promise.reject(o);(function e(t){var o=this,i=t.count||20;Qn.call(this,{count:i,isGroup:!!t.isGroup,queue:t.queue,start:t.start,format:t.format,success:function(n){if(n.msgs.length>=i||n.is_last){var a=n.msgs.splice(0,i).reverse();t.success&&t.success(a),r(a)}else e.call(o,On(On({},t),{start:null}))},fail:function(e){n(e),t.fail&&t.fail(e)}})}).call(t,e),j.debug("Call fetchHistoryMessages",e)}))}function Qn(e){var t=this,r=e.queue,n=this.mr_cache[r]||(this.mr_cache[r]={msgs:[]}),o=this.context.userId,i=e.start||-1,a=e.count||20;if(n.msgs.length>=a||n.is_last)"function"==typeof e.success&&e.success(n);else{n&&n.next_key&&(i=n.next_key),e.start&&(i=e.start);var s={queue:r+(e.isGroup?"@conference.easemob.com":"@easemob.com"),start:i,end:-1},c=this.context,u=c.orgName,l=c.appName,h={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(o,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"},data:JSON.stringify(s),success:function(r){return Rn(t,void 0,void 0,(function(){var t,o,i,a,s,c,u=this;return Cn(this,(function(l){switch(l.label){case 0:if(t=null==r?void 0:r.data,!r.data.msgs)return"function"==typeof e.success&&e.success(n),n.is_last=!0,n.next_key="",[2];o=t.msgs,i=o.length,n.is_last=t.is_last,n.next_key=t.next_key,a=function(t){return Rn(u,void 0,void 0,(function(){var r,n,o,i,a;return Cn(this,(function(s){switch(s.label){case 0:for(r=[],t=Re().atob(t),n=0,o=t.length;n<o;++n)r.push(t.charCodeAt(n));return i=(i=this.context.root.lookup("easemob.pb.Meta")).decode(r),a={errorCode:0,reason:""},1!==i.ns?[3,2]:[4,ut.call(this,i,a,!0,e.format)];case 1:return[2,s.sent()];case 2:return[2]}}))}))},s=0,l.label=1;case 1:return s<i?[4,a(o[s].msg)]:[3,4];case 2:(c=l.sent())&&n.msgs.push(c),l.label=3;case 3:return s++,[3,1];case 4:return"function"==typeof e.success&&e.success(n),[2]}}))}))},error:function(e){if(e.error&&e.error_description){var r=m.create({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:"fetch history messages error",data:e});t.onError&&t.onError(r)}}};ae.call(this,h,v.GET_HISTORY_MSG).catch((function(t){"function"==typeof e.fail&&e.fail(t)}))}}function Zn(e){var t=this;return new Promise((function(r,n){var o=e.targetId,i=e.cursor,a=void 0===i?-1:i,s=e.pageSize,c=void 0===s?20:s,u=e.chatType,l=e.searchDirection,d=e.searchOptions,h=void 0===d?{}:d,p=h.msgTypes,f=void 0===p?[]:p,m=h.startTime,g=void 0===m?null:m,E=h.endTime,y=void 0===E?null:E,_=h.from,T=void 0===_?null:_;if("string"!=typeof o||""===o)return n(Mn('"Invalid parameter": "targetId"'));if(T&&"string"!=typeof T)return n(Mn('"Invalid parameter": "searchOptions.from"'));if(f&&!Array.isArray(f))return n(Mn('"Invalid parameter": "searchOptions.msgTypes"'));if(g&&"number"!=typeof g)return n(Mn('"Invalid parameter": "searchOptions.startTime"'));if(y&&"number"!=typeof y)return n(Mn('"Invalid parameter": "searchOptions.endTime"'));var I=Nt.call(t).error;if(I)return n(I);var O=t.context,R=O.orgName,C=O.appName,S=O.userId,N="singleChat"===e.chatType?"@easemob.com":"@conference.easemob.com",b={queue:"".concat(o).concat(N),start:a,pull_number:c,is_positive:"down"===l,msgType:f.join(",")||"",end:-1,startTime:g,endTime:y,userId:"singleChat"===u?null:T},A={url:"".concat(t.apiUrl,"/").concat(R,"/").concat(C,"/users/").concat(S,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+t.token,"Content-Type":"application/json"},data:JSON.stringify(b),success:function(n){return Rn(t,void 0,void 0,(function(){var t,o,i,a,s,c,u,l,d=this;return Cn(this,(function(h){switch(h.label){case 0:t=null==n?void 0:n.data,o=t.msgs||[],i=function(e){return Rn(d,void 0,void 0,(function(){var t,r,n,o,i;return Cn(this,(function(a){switch(a.label){case 0:for(t=[],e=Re().atob(e),r=0,n=e.length;r<n;++r)t.push(e.charCodeAt(r));return o=(o=this.context.root.lookup("easemob.pb.Meta")).decode(t),i={errorCode:0,reason:""},1!==o.ns?[3,2]:[4,ut.call(this,o,i,!0,!0)];case 1:return[2,a.sent()];case 2:return[2]}}))}))},a=[],s=0,h.label=1;case 1:return s<o.length?[4,i(o[s].msg)]:[3,4];case 2:(c=h.sent())&&a.push(c),h.label=3;case 3:return s++,[3,1];case 4:return t.msgs=a,u={cursor:t.next_key,messages:a,isLast:t.is_last},null===(l=e.success)||void 0===l||l.call(e,u),r(u),[2]}}))}))},error:e.fail};ae.call(t,A,v.REST_FETCHHISTORYMESSAGE).catch((function(e){n(e)})),j.debug("Call getHistoryMessages",e)}))}function $n(e){var t,r,n=this,o=Nt.call(this).error;if(o)return Promise.reject(o);var i=null==e?void 0:e.option,a=null!==(t=null==e?void 0:e.pageNum)&&void 0!==t?t:1,s=null!==(r=null==e?void 0:e.pageSize)&&void 0!==r?r:20,c=[];try{c=function(e,t,r){var n;if(!e||"object"!=typeof e)throw Mn('"Invalid parameter": "option"');if(!Array.isArray(e.keywordList))throw Mn('"Invalid parameter": "keywordList"');var o=e.keywordList.map((function(e){return"".concat(null!=e?e:"").trim()})).filter((function(e){return e.length>0}));if(0===o.length)throw Mn('"Invalid parameter": "keywordList"');if(o.length>bn)throw Mn('"Invalid parameter": "keywordList exceeds max count 5"');if(void 0!==e.conversationId&&("string"!=typeof e.conversationId||""===e.conversationId.trim()))throw Mn('"Invalid parameter": "conversationId"');if(void 0!==e.conversationType&&!["singleChat","groupChat","chatRoom"].includes(e.conversationType))throw Mn('"Invalid parameter": "conversationType"');if(void 0===e.conversationId!=(void 0===e.conversationType))throw Mn('"Invalid parameter": "conversationId and conversationType must be used together"');if(void 0!==e.startTime&&void 0===e.endTime||void 0===e.startTime&&void 0!==e.endTime)throw Mn('"Invalid parameter": "startTime/endTime"');if(void 0!==e.startTime&&("number"!=typeof e.startTime||"number"!=typeof e.endTime||e.endTime<e.startTime))throw Mn('"Invalid parameter": "startTime/endTime"');if("number"!=typeof t||t<1)throw Mn('"Invalid parameter": "pageNum"');if("number"!=typeof r||r<1||r>100)throw Mn('"Invalid parameter": "pageSize"');if(e.msgTypes&&!Array.isArray(e.msgTypes))throw Mn('"Invalid parameter": "msgTypes"');if(null===(n=e.msgTypes)||void 0===n?void 0:n.some((function(e){return!An.has(e)})))throw Mn('"Invalid parameter": "msgTypes contains unsupported type"');return o}(i,a,s)}catch(t){return j.error("searchMessages parameter validation failed",{params:e,error:t}),Promise.reject(t)}var u=this.context,l=u.orgName,h=u.appName,p=u.accessToken,f=function(e,t,r,n,o){var i=function(e,t){var r,n=null!==(r=e.keywordListMatchType)&&void 0!==r?r:"or",o={searchMode:"default"};return 1===t.length?o.keyword=t[0]:(o.keywords=t,o.keywordMatch="and"===n?"all":"any"),{data:o,normalizedKeywordList:t}}(e,t).data;return e.conversationId&&("singleChat"===e.conversationType?i.participantPairs=[{userId1:o,userId2:e.conversationId}]:"groupChat"===e.conversationType?i.groupIds=[e.conversationId]:"chatRoom"===e.conversationType?i.chatroomIds=[e.conversationId]:i.conversationId=e.conversationId),e.msgTypes&&e.msgTypes.length>0&&(i.contentType=e.msgTypes.filter((function(e){return e in Sn})).map((function(e){return Sn[e]})).join(",")),"number"==typeof e.startTime&&"number"==typeof e.endTime&&(i.startTime=e.startTime,i.endTime=e.endTime),e.searchScope&&(i.searchExt=e.searchScope),i.sort="relevance:desc",i.highlightEnable=!0,i.page=r,i.size=n,i}(i,c,a,s,this.user),g={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(h,"/users/").concat(this.user,"/messages/search/get"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+p,"Content-Type":"application/json",Accept:"application/json; charset=utf-8"},data:JSON.stringify({data:f})};return j.debug("Call searchMessages",e),ae.call(this,g,v.REST_SEARCH_MESSAGES).then((function(t){var r,o,i=(null==t?void 0:t.data)||{},c=(null==i?void 0:i.data)&&"object"==typeof i.data?i.data:i,u=c.pagination||{},l=Array.isArray(c.items)?c.items:Array.isArray(c.list)?c.list:[];Array.isArray(c.items)||Array.isArray(c.list)||wn("searchMessages response items/list is invalid",{params:e,responseData:c,rawResponse:t});var h=[];l.forEach((function(t,r){try{h.push(Un.call(n,t))}catch(n){throw wn("searchMessages failed to map response item",{params:e,index:r,item:t,error:n}),m.create({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:"Failed to parse search result item",data:{index:r,item:t,error:n}})}}));var p={messages:h,pageNum:u.page||c.page||a,pageSize:s,totalPages:"number"==typeof u.totalPages?u.totalPages:-1,isLast:"number"!=typeof u.isFinished||1===u.isFinished,requestId:null===(r=null==i?void 0:i.meta)||void 0===r?void 0:r.requestId,timestamp:(null===(o=null==i?void 0:i.meta)||void 0===o?void 0:o.timestamp)||Date.now()};return"number"!=typeof u.page&&void 0!==u.page&&wn("searchMessages pagination.page is invalid",{params:e,pagination:u,rawResponse:t}),p}))}function eo(e,t){return Rn(this,void 0,void 0,(function(){var r,n,o,i,a,s,c;return Cn(this,(function(u){switch(u.label){case 0:if(r=Nt.call(this).error)return[2,Promise.reject(r)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call addContact",e,t),n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(this.user,"/contacts/apply?resource=").concat(s.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:[e],reason:t}),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}},[4,ae.call(this,c,v.ROSTER_ADD)];case 1:return u.sent(),[2]}}))}))}var to=ro;function ro(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Cn(this,(function(c){switch(c.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call deleteContact",e),r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/contacts/users/").concat(e,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s,v.ROSTER_REMOVE)];case 1:return c.sent(),[2]}}))}))}function no(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Cn(this,(function(c){switch(c.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call acceptInvitation",e),r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/contacts/accept/users/").concat(e,"?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s,v.ROSTER_ACCEPT)];case 1:return c.sent(),[2]}}))}))}var oo=no;function io(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Cn(this,(function(c){switch(c.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return j.debug("Call declineInvitation",e),r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/contacts/decline/users/").concat(e,"?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s,v.ROSTER_DECLINE)];case 1:return c.sent(),[2]}}))}))}var ao=io;function so(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Cn(this,(function(l){switch(l.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(r=e.name,n=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');n=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');n=r}return j.debug("Call addToBlockList",e),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(c.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:n}),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,ae.call(this,u,v.ROSTER_BAN).then((function(e){return{type:e.type,data:{userIds:(null==e?void 0:e.data)||[]}}}))];case 1:return[2,l.sent()]}}))}))}var co=so,uo=so;function lo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Cn(this,(function(l){switch(l.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(r=e.name,n=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');n=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');n=r}return j.debug("Call removeFromBlockList",e),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",data:JSON.stringify({usernames:n}),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,ae.call(this,u,v.ROSTER_ALLOW)];case 1:return l.sent(),[2]}}))}))}var ho=lo,po=lo;function fo(e){var t=this,r=(null==e?void 0:e.ext)||"";if("string"!=typeof r)throw Error('"Invalid parameter": "ext"',r);var n=this.getUniqueId(),o={id:n,to:e.to};this._msgHash[n]=On({},o);var i="";void 0!==e.chatType?i=e.chatType:void 0!==e.type&&(i="chat"===e.type?"singleChat":e.type);var a={id:n,type:"recall",chatType:i,ackId:e.mid,to:e.to,isChatThread:e.isChatThread||!1,metaExt:r,success:function(r){return Rn(t,void 0,void 0,(function(){var t,n,o,a,s,c,u,l,d;return Cn(this,(function(h){switch(h.label){case 0:return h.trys.push([0,5,,6]),"singleChat"!==i&&"groupChat"!==i?[3,4]:[4,null===(o=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===o?void 0:o.removeMsgByServerMsgId(e.mid)];case 1:return h.sent(),[4,null===(s=null===(a=this._localCache)||void 0===a?void 0:a.getInstance())||void 0===s?void 0:s.getConversationLastMessage(e.to,i)];case 2:return t=h.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.updateLocalConversation(Ae({conversationId:e.to,conversationType:i}),{lastMessageId:null==t?void 0:t.serverMsgId})];case 3:h.sent(),h.label=4;case 4:return null===(l=null==e?void 0:e.success)||void 0===l||l.call(e,r),[3,6];case 5:return h.sent(),null===(d=null==e?void 0:e.success)||void 0===d||d.call(e,r),[3,6];case 6:return[2]}}))}))},fail:e.fail};return j.debug("Call recallMessage",e),this.mSync.send(a,this)}function mo(e){var t=e||{},r=t.messageId,n=t.modifiedMessage;if(j.debug("Call modifyMessage",r,n),""===r)throw Error('Invalid parameter: "messageId"');return this.mSync.send(On({editMessageId:r},n))}function go(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Cn(this,(function(l){switch(l.label){case 0:if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.reaction,s=e.messageId,c={msgId:s,message:a},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,u)]);case 1:return l.sent(),[2]}}))}))}function vo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c;return Cn(this,(function(u){switch(u.label){case 0:if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reactionId: ".concat(e.reaction));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.messageId,s=e.reaction,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user,"?msgId=").concat(a,"&message=").concat(s),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,c)]);case 1:return u.sent(),[2]}}))}))}function Eo(e){if("string"!=typeof e.chatType||!e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatType,s=e.messageId,c={msgIdList:"string"==typeof s?[s]:s,msgType:"singleChat"===a?"chat":"groupchat",groupId:e.groupId||null},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user),type:"GET",data:c,dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,u).then((function(e){var t=e.data;return null==t||t.forEach((function(e){null==e||e.reactionList.forEach((function(e){e.isAddedBySelf=e.state,delete e.state,delete e.reactionId}))})),e}))}var yo=Eo;function _o(e){if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.cursor,s=e.pageSize,c={msgId:e.messageId,message:e.reaction,currentPage:a||null,pageSize:s||20},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/reaction/user/").concat(this.user,"/detail"),type:"GET",data:c,dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,u).then((function(e){return e.data.isAddedBySelf=e.data.state,delete e.data.state,delete e.data.reactionId,e}))}function To(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d;return Cn(this,(function(h){switch(h.label){case 0:if("string"!=typeof e.reportType||!e.reportType)throw Error("Invalid parameter reportType: ".concat(e.reportType));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reportReason||!e.reportReason)throw Error("Invalid parameter messageId: ".concat(e.reportReason));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.reportType,s=e.reportReason,c=e.messageId,u={username:this.user,reportType:a,reportReason:s},l="".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/user/").concat(this.user,"/moderation/report/message/").concat(c),d={url:l,type:"POST",data:JSON.stringify(u),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,d)]);case 1:return h.sent(),[2]}}))}))}function Io(e){var t;return Rn(this,void 0,void 0,(function(){var r,n,o,i,a,s,c,u,l;return Cn(this,(function(d){switch(d.label){case 0:if("string"!=typeof e.targetId||""===e.targetId)throw Error('"Invalid parameter targetId": '+e.targetId);if(!["singleChat","groupChat","chatRoom"].includes(e.chatType))throw Error('"Invalid parameter chatType": '+e.chatType);if(e.beforeTimeStamp&&("number"!=typeof e.beforeTimeStamp||e.beforeTimeStamp<0||(null===(t=e.beforeTimeStamp)||void 0===t?void 0:t.toString().length)>18))throw Error('"Invalid parameter beforeTimeStamp": '+e.beforeTimeStamp);if(e.messageIds&&!(Array.isArray(e.messageIds)&&e.messageIds.length>0&&e.messageIds.length<=20))throw Error('"Invalid parameter messageIds": '+e.messageIds);if(!e.messageIds&&!e.beforeTimeStamp)throw Error("messageIds or beforeTimeStamp field is required.");return(r=Nt.call(this).error)?[2,Promise.reject(r)]:(n=this.context,o=n.orgName,i=n.appName,a=n.userId,s="singleChat"===e.chatType?"userId":"groupId",c="singleChat"===e.chatType?"chat":"group",u=e.messageIds?"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/message/roaming/").concat(c,"/user/").concat(a,"?").concat(s,"=").concat(e.targetId,"&msgIdList=").concat(e.messageIds,"&resource=").concat(this.clientResource):"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/message/roaming/").concat(c,"/user/").concat(a,"/time?").concat(s,"=").concat(e.targetId,"&delTime=").concat(e.beforeTimeStamp,"&&resource=").concat(this.clientResource),l={url:u,dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"}},j.debug("Call removeHistoryMessages",e),[4,ae.call(this,l)]);case 1:return d.sent(),[2]}}))}))}function Oo(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if((null==e?void 0:e.includeEmptyConversations)&&"boolean"!=typeof e.includeEmptyConversations)throw Error("Invalid parameter includeEmptyConversations: ".concat(e.includeEmptyConversations));var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",need_mark:!0,needEmptySession:(null==e?void 0:e.includeEmptyConversations)||!1},headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getServerConversations",e),new Promise((function(e,r){ae.call(t,s,v.REST_FETCH_CONVERSATIONS).then((function(r){return Rn(t,void 0,void 0,(function(){var t,n,o=this;return Cn(this,(function(i){switch(i.label){case 0:return t=Ro.call(this,r),this._localCache?(n=t.data.conversations.map((function(e){return Rn(o,void 0,void 0,(function(){var t,r,n,o;return Cn(this,(function(i){switch(i.label){case 0:return[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(e.lastMessage,De.SUCCESS,!0)];case 1:return i.sent(),[4,null===(o=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===o?void 0:o.updateLocalConversation(Ae({conversationId:e.conversationId,conversationType:e.conversationType}),{unReadCount:e.unReadCount})];case 2:return i.sent(),[2]}}))}))})),[4,Promise.all(n)]):[3,2];case 1:i.sent(),i.label=2;case 2:return e(t),[2]}}))}))})).catch((function(e){r(e)}))}))}function Ro(e){var t=this,r=e.data,n=r.cursor,o=r.channel_infos,i=[];null==o||o.forEach((function(e){var r=null;(null==e?void 0:e.meta)&&"{}"!==JSON.stringify(e.meta)&&(e.meta.payload=JSON.parse(e.meta.payload),"delivery"!==(r=Ne.call(t,e.meta)).type&&"read"!==r.type&&"channel"!==r.type&&(r.chatType=Se[r.chatType]));var n={conversationId:e.session_to,conversationType:"chat"===e.session_type?"singleChat":"groupChat",isPinned:e.is_top,pinnedTime:e.is_top?e.update_top_status_time:0,unReadCount:e.unread_num,lastMessage:r};e.marks&&(n.marks=e.marks.map((function(e){return ft[e]}))),i.push(n)}));var a={conversations:i,cursor:n||""};return{type:e.type,data:a}}function Co(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if((null==e?void 0:e.includeEmptyConversations)&&"boolean"!=typeof e.includeEmptyConversations)throw Error("Invalid parameter includeEmptyConversations: ".concat(e.includeEmptyConversations));var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",is_top:!0,need_mark:!0,needEmptySession:(null==e?void 0:e.includeEmptyConversations)||!1},headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getServerPinnedConversations",e),ae.call(this,s,v.GET_SESSION_LIST).then((function(e){return Ro.call(t,e)}))}function So(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d,h,p,f;return Cn(this,(function(m){if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(r=e.conversationId,n=e.conversationType,o=e.isPinned,i="singleChat"===n?"chat":"groupChat","string"!=typeof r||""===r)throw Error("Invalid parameter conversationId: ".concat(r));if(!["singleChat","groupChat"].includes(n))throw Error("Invalid parameter conversationType: ".concat(n));if("boolean"!=typeof o)throw Error("Invalid parameter isPinned: ".concat(o));return a=this.context,s=a.orgName,c=a.appName,u=a.accessToken,l=a.jid,d={type:i,to:r},h=o?"":"type=".concat(i,"&to=").concat(r,"&"),p="".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/user/").concat(this.user,"/user_channel/top?").concat(h,"resource=").concat(l.clientResource),f={url:p,type:o?"POST":"DELETE",dataType:"json",headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},o&&(f.data=JSON.stringify(d)),j.debug("Call pinConversation",e),[2,ae.call(this,f,v.PIN_CONVERSATION).then((function(e){var t=e.type,r=e.data;return{type:t,data:{isPinned:r.is_top||!1,pinnedTime:r.is_top?r.update_top_status_time:0}}}))]}))}))}function No(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l;return Cn(this,(function(d){switch(d.label){case 0:if(t=e.userId,r=e.remark,n=Nt.call(this).error)return[2,Promise.reject(n)];if("string"!=typeof t||""===t)throw Error('Invalid parameter: "userId"');if("string"!=typeof r)throw Error('Invalid parameter: "remark"');return j.debug("Call setContactRemark",e),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u="".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/users/").concat(this.context.userId,"/contacts/users/").concat(t,"?resource=").concat(c.clientResource),l={url:u,type:"PUT",data:JSON.stringify({remark:r}),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,ae.call(this,l,v.ROSTER_SET_CONTACT_REMARK)];case 1:return d.sent(),[2]}}))}))}function bo(){var e=Nt.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(this.user,"/contacts/users?needReturnRemark=true"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+o}};return j.debug("Call getAllContacts"),ae.call(this,i,v.ROSTER_GET_ALL_CONTACTS_REMARKS).then((function(e){var t=((null==e?void 0:e.entities)||[]).map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:t}}))}function Ao(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);j.debug("Call getContactsWithCursor",e);var r=e||{},n=r.pageSize,o=void 0===n?20:n,i=r.cursor,a=void 0===i?"":i;if(o&&"number"!=typeof o)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));var s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(this.user,"/contacts?needReturnRemark=true&limit=").concat(o,"&cursor=").concat(a),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+l}};return ae.call(this,d,v.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE).then((function(e){var t,r,n=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.contacts)||[],o=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.cursor)||"",i=n.map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:{cursor:o,contacts:i}}}))}function Mo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d,h,p,f,m;return Cn(this,(function(g){switch(g.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(j.debug("Call markConversation",e),n=(r=e||{}).conversations,o=void 0===n?[]:n,i=r.mark,a=r.isMarked,!Array.isArray(o))throw Error("Invalid parameter conversations");if(s=o.map((function(e){if(!e.conversationId||!["singleChat","groupChat"].includes(e.conversationType))throw Error("Invalid parameter conversations");return{to:e.conversationId,type:Ln[e.conversationType]}})),"boolean"!=typeof a)throw Error("Invalid parameter isMarked: ".concat(a));if("number"!=typeof i)throw Error("Invalid parameter mark: ".concat(i));return c=this.context,u=c.orgName,l=c.appName,d=c.accessToken,h=c.userId,p=c.jid,f={mark:ft[i],targets:s},m={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(h,"/user_channels/mark?resource=").concat(p.clientResource),dataType:"json",data:JSON.stringify(f),type:a?"Post":"Delete",headers:{Authorization:"Bearer "+d}},[4,ae.call(this,m,v.MARK_CONVERSATION).then((function(e){var t,r=(null===(t=e.data)||void 0===t?void 0:t.ignore)||[];r&&Array.isArray(r)&&r.length>0&&j.debug("markConversation has ignored conversations",r.map((function(e){return{conversationId:e.to,conversationType:Se[e.type]}})))}))];case 1:return g.sent(),[2]}}))}))}function wo(e){return Rn(this,void 0,void 0,(function(){var t,r;return Cn(this,(function(n){return j.debug("Call addConversationMark",e),t=e.conversations,r=e.mark,[2,Mo.call(this,{conversations:t,mark:r,isMarked:!0})]}))}))}function Uo(e){return Rn(this,void 0,void 0,(function(){var t,r;return Cn(this,(function(n){return j.debug("Call removeConversationMark",e),t=e.conversations,r=e.mark,[2,Mo.call(this,{conversations:t,mark:r,isMarked:!1})]}))}))}function Lo(e){var t,r,n=this,o=Nt.call(this).error;if(o)return Promise.reject(o);if(j.debug("Call getServerConversationsByFilter",e),(null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if("number"!=typeof(null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.mark))throw Error("Invalid parameter mark: ".concat(null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.mark));var i=this.context,a=i.orgName,s=i.appName,c=i.accessToken,u="".concat(this.apiUrl,"/").concat(a,"/").concat(s,"/sdk/user/").concat(this.user,"/user_channels/mark/search?"),l=e.pageSize,d=e.cursor,h=((null==e?void 0:e.filter)||{}).mark,p={url:u,type:"GET",dataType:"json",data:{limit:l||10,cursor:d||"",need_mark:!0,mark:ft[h]},headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return ae.call(this,p,v.GET_SESSION_LIST).then((function(e){return Ro.call(n,e)}))}function Po(){var e=Nt.call(this).error;if(e)return Promise.reject(e);j.debug("Call getSelfIdsOnOtherPlatform");var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i=t.userId,a=t.jid,s={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(i,"/resources"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return ae.call(this,s,v.USER_LOGGEDIN_OTHER_PLATFORM).then((function(e){var t,r=null===(t=e.data)||void 0===t?void 0:t.filter((function(e){return e.res!==a.clientResource})),n=null==r?void 0:r.map((function(e){return"".concat(i,"/").concat(e.res)}));return{type:e.type,data:n}}))}function Do(){var e,t,r,n,o,i;return Rn(this,void 0,void 0,(function(){var a,s,c,u,l,d,h,p,f;return Cn(this,(function(m){switch(m.label){case 0:return(a=Nt.call(this).error)?[2,Promise.reject(a)]:(j.debug("Call deleteAllMessagesAndConversations"),s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d=s.userId,h=s.jid,p="".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/message/roaming/user/").concat(d,"/delete/all?resource=").concat(h.clientResource),f={url:p,type:"POST",dataType:"json",headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}},[4,ae.call(this,f,v.REST_DELETE_MESSAGES_CONVERSATIONS)]);case 1:return m.sent(),null===(t=null===(e=this._localCache)||void 0===e?void 0:e.getInstance())||void 0===t||t.clearConversationMap(),[4,null===(n=null===(r=this._localCache)||void 0===r?void 0:r.getInstance())||void 0===n?void 0:n.clearStoreData("conversationList")];case 2:return m.sent(),[4,null===(i=null===(o=this._localCache)||void 0===o?void 0:o.getInstance())||void 0===i?void 0:i.clearStoreData("message")];case 3:return m.sent(),[2]}}))}))}function ko(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d,h,p,f,m;return Cn(this,(function(g){switch(g.label){case 0:if(t=Nt.call(this).error)return[2,Promise.reject(t)];if(j.debug("Call setMessagePinStatus",e),n=(r=e||{}).conversationId,o=void 0===n?"":n,i=r.conversationType,a=r.messageId,s=r.isPinned,"string"!=typeof o||""===o)throw Error("Invalid parameter conversationId");if("string"!=typeof a||""===a)throw Error("Invalid parameter messageId");if("boolean"!=typeof s)throw Error("Invalid parameter isPinned");return c=this.context,u=c.orgName,l=c.appName,d=c.accessToken,h=c.userId,p=c.jid,f={to:o,type:Ln[i],pin_msg_id:a},m={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(h,"/user_channel/pin?resource=").concat(p.clientResource),dataType:"json",data:JSON.stringify(f),type:s?"Post":"Delete",headers:{Authorization:"Bearer "+d}},[4,ae.call(this,m,v.REST_PIN_MESSAGE)];case 1:return g.sent(),[2]}}))}))}function xo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o;return Cn(this,(function(i){return j.debug("Call pinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,o=t.messageId,[2,ko.call(this,{conversationId:n,conversationType:r,messageId:o,isPinned:!0})]}))}))}function Bo(e){return Rn(this,void 0,void 0,(function(){var t,r,n,o;return Cn(this,(function(i){return j.debug("Call unpinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,o=t.messageId,[2,ko.call(this,{conversationId:n,conversationType:r,messageId:o,isPinned:!1})]}))}))}function Go(e){var t=this,r=Nt.call(this).error;if(r)return Promise.reject(r);j.debug("Call getServerPinnedMessages",e);var n=e.conversationId,o=e.conversationType,i=e.pageSize,a=e.cursor;if("string"!=typeof n||""===n)throw Error("Invalid parameter conversationId");if(i&&"number"!=typeof i)throw Error("Invalid parameter pageSize: ".concat(i));if(a&&"string"!=typeof a)throw Error("Invalid parameter cursor: ".concat(a));var s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/user/").concat(this.user,"/user_channel/pin"),type:"GET",dataType:"json",data:{to:n,type:Ln[o],limit:i||10,cursor:a||""},headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}};return ae.call(this,d,v.GET_SESSION_LIST).then((function(e){return{type:0,data:{list:e.data.msg_infos.map((function(e){e.message.payload=JSON.parse(e.message.payload);var r=e.message,n=e.pin_opt_at,o=e.pin_operator;return{message:Ne.call(t,r,{formatChatType:!0}),pinTime:n,operatorId:o}})),cursor:e.data.cursor||""}}}))}function jo(){var e=this;j.debug("Call unbindPushToken");var t={deviceId:this.clientResource,deviceToken:"",notifierName:this.pushCertificateName};return Mt.call(this,t).then((function(t){return e.isRegisterPush=!1,t}))}function Ho(e){if(!e||"string"!=typeof e.fileId||""===e.fileId)return Promise.reject(Error('Invalid parameter: "fileId"'));if(void 0!==e.currentUserId&&"string"!=typeof e.currentUserId)return Promise.reject(Error('Invalid parameter: "currentUserId"'));if(void 0!==e.audio){if("object"!=typeof e.audio||null===e.audio||Array.isArray(e.audio))return Promise.reject(Error('Invalid parameter: "audio"'));var t=e.audio,r=t.format,n=t.sampleRate,o=t.bitsPerSample,i=t.channels;if(void 0!==r&&"string"!=typeof r)return Promise.reject(Error('Invalid parameter: "audio.format"'));if(void 0!==n&&"number"!=typeof n)return Promise.reject(Error('Invalid parameter: "audio.sampleRate"'));if(void 0!==o&&"number"!=typeof o)return Promise.reject(Error('Invalid parameter: "audio.bitsPerSample"'));if(void 0!==i&&"number"!=typeof i)return Promise.reject(Error('Invalid parameter: "audio.channels"'))}var a=Nt.call(this).error;if(a)return Promise.reject(a);var s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d=s.userId,h=e.currentUserId||d,p={data:On({fileId:e.fileId,username:h},e.audio?{audio:e.audio}:{})};if(!c||!u||!h)return Promise.reject(Error('Invalid parameter: "orgname", "appname" or "currentUserId"'));var f={url:"".concat(this.apiUrl,"/api/sdk/v1/").concat(c,"/").concat(u,"/speech/transcriptions"),type:"POST",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+l,"Content-Type":"application/json",Accept:"application/json"}};return j.debug("Call transcribeSpeech",p),ae.call(this,f).then((function(e){var t;return{type:0,data:{text:(null===(t=e.data)||void 0===t?void 0:t.text)||""}}}))}function Fo(e){if(!e||!qo(t=e.file)&&!Ko(t))return Promise.reject(Error('Invalid parameter: "file"'));var t;if(void 0!==e.currentUserId&&"string"!=typeof e.currentUserId)return Promise.reject(Error('Invalid parameter: "currentUserId"'));if(void 0!==e.audio){if("object"!=typeof e.audio||null===e.audio||Array.isArray(e.audio))return Promise.reject(Error('Invalid parameter: "audio"'));var r=e.audio,n=r.format,o=r.sampleRate,i=r.bitsPerSample,a=r.channels;if(void 0!==n&&"string"!=typeof n)return Promise.reject(Error('Invalid parameter: "audio.format"'));if(void 0!==o&&"number"!=typeof o)return Promise.reject(Error('Invalid parameter: "audio.sampleRate"'));if(void 0!==i&&"number"!=typeof i)return Promise.reject(Error('Invalid parameter: "audio.bitsPerSample"'));if(void 0!==a&&"number"!=typeof a)return Promise.reject(Error('Invalid parameter: "audio.channels"'))}var s=Nt.call(this).error;if(s)return Promise.reject(s);var c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,p=c.userId,f=e.currentUserId||p;if(!u||!l||!f)return Promise.reject(Error('Invalid parameter: "orgname", "appname" or "currentUserId"'));var m="".concat(this.apiUrl,"/api/sdk/v1/").concat(u,"/").concat(l,"/speech/recognitions");if(qo(e.file))return function(e){var t=new FormData,r=Wo(e.currentUserId,e.audio);return Object.keys(r).forEach((function(e){t.append(e,r[e])})),t.append("file",e.file),j.debug("Call recognizeSpeech",{currentUserId:e.currentUserId,fileName:e.file.name,fileSize:e.file.size,audio:e.audio}),new Promise((function(r,n){var o=new XMLHttpRequest;o.timeout=q,o.ontimeout=function(){n({type:d.REQUEST_TIMEOUT,message:"Request Timeout",errorType:"timeout_error",xhr:o})},o.onerror=function(){n({type:d.REQUEST_UNKNOWN,message:"Request Unknown Error",errorType:"onerror",xhr:o})},o.onabort=function(){n({type:d.REQUEST_ABORT,message:"Request Abort",errorType:"onabort",xhr:o})},o.onreadystatechange=function(){var e,t;if(4===o.readyState){var i=zo(o.responseText);200!==o.status?n({type:o.status||d.REQUEST_UNKNOWN,data:i,message:(null===(t=null==i?void 0:i.error)||void 0===t?void 0:t.message)||(null==i?void 0:i.message)||"Request Error",xhr:o}):r({type:d.REQUEST_SUCCESS,data:{text:(null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.text)||""}})}},o.open("POST",e.requestUrl),o.setRequestHeader("Authorization","Bearer "+e.accessToken),o.setRequestHeader("Accept","application/json"),o.send(t)}))}({file:e.file,currentUserId:f,audio:e.audio,requestUrl:m,accessToken:h});var g=Vo();return Ko(e.file)&&g?function(e){var t=Wo(e.currentUserId,e.audio);return j.debug("Call recognizeSpeech",{currentUserId:e.currentUserId,filePath:e.file.filePath,fileName:e.file.name||e.file.filePath.split("?")[0].split("/").filter(Boolean).pop(),fileSize:e.file.size,audio:e.audio}),new Promise((function(r,n){e.platForm.global.uploadFile({url:e.requestUrl,filePath:e.file.filePath,name:"file",header:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+e.accessToken,Accept:"application/json"},formData:t,success:function(e){var t,o,i=zo(e.data);200!==e.statusCode?n({type:e.statusCode||d.REQUEST_UNKNOWN,data:i,message:(null===(o=null==i?void 0:i.error)||void 0===o?void 0:o.message)||(null==i?void 0:i.message)||"Request Error"}):r({type:d.REQUEST_SUCCESS,data:{text:(null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.text)||""}})},fail:function(e){n({type:d.REQUEST_UNKNOWN,message:"Request Unknown Error",errorType:"upload_fail",data:e})}})}))}({file:e.file,currentUserId:f,audio:e.audio,requestUrl:m,accessToken:h,platForm:g}):Promise.reject(Error('Invalid parameter: "file"'))}function Wo(e,t){var r={username:e};return void 0!==(null==t?void 0:t.format)&&(r["audio.format"]=t.format),void 0!==(null==t?void 0:t.sampleRate)&&(r["audio.sampleRate"]=String(t.sampleRate)),void 0!==(null==t?void 0:t.bitsPerSample)&&(r["audio.bitsPerSample"]=String(t.bitsPerSample)),void 0!==(null==t?void 0:t.channels)&&(r["audio.channels"]=String(t.channels)),r}function zo(e){if("string"==typeof e&&e)try{return JSON.parse(e)}catch(t){return e}return e}function qo(e){return"undefined"!=typeof File&&e instanceof File}function Ko(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"string"==typeof e.filePath&&""!==e.filePath}function Vo(){var e,t=_e.getEnvInfo();if("web"!==t.platform&&"node"!==t.platform&&"quick_app"!==t.platform&&"function"==typeof(null===(e=t.global)||void 0===e?void 0:e.uploadFile))return t}function Jo(e){var t,r=function(e){var t,r,n=zo(null==e?void 0:e.data),o=null===(t=null==n?void 0:n.error)||void 0===t?void 0:t.code;return{serviceCode:"string"==typeof o||"number"==typeof o?String(o):void 0,serviceMessage:null===(r=null==n?void 0:n.error)||void 0===r?void 0:r.message}}(e),n=r.serviceCode,o=r.serviceMessage;if("number"==typeof(null==e?void 0:e.type)&&!n)return{type:e.type,message:(null==e?void 0:e.message)||"Voice-to-text failed"};switch(n){case"4041001":return{type:d.FILE_NOT_FOUND,message:"File not found"};case"4001002":return{type:d.FILE_INVALID,message:"Invalid file"};case"5021001":return{type:d.WEBIM_UPLOADFILE_ERROR,message:"File upload failed"};case"4001003":return{type:d.FILE_DURATION_TOO_LONG,message:"Voice duration exceeds 60 seconds"};case"4031001":return{type:d.SERVICE_NOT_ENABLED,message:"Service not enabled"};case"4031002":return{type:d.MAX_LIMIT,message:"Beta service usage limit exceeded"};case"4001001":return"string"==typeof(t=o)&&t.toLowerCase().includes("uploaded file exceeds")?{type:d.FILE_TOO_LARGE,message:"File too large"}:{type:d.REQUEST_PARAMETER_ERROR,message:o||"Missing or invalid request parameter"};case"5021003":case"5001003":return{type:d.FILE_VOICE_TO_TEXT_FAILED,message:"Voice-to-text failed"};case"4011001":return{type:d.NO_PERMISSION,message:o||"Unauthorized or invalid token"};default:return{type:d.FILE_VOICE_TO_TEXT_FAILED,message:o||(null==e?void 0:e.message)||"Voice-to-text failed"}}}function Yo(e,t,r){void 0===r&&(r="");var n={type:e};return e===d.REQUEST_SUCCESS?(n.data={text:r},n):(void 0!==t&&(n.message=t),n)}function Xo(e){return!(void 0===e||"object"==typeof e&&null!==e&&!Array.isArray(e))||void 0!==(null==e?void 0:e.format)&&"string"!=typeof e.format||void 0!==(null==e?void 0:e.sampleRate)&&"number"!=typeof e.sampleRate||void 0!==(null==e?void 0:e.bitsPerSample)&&"number"!=typeof e.bitsPerSample||void 0!==(null==e?void 0:e.channels)&&"number"!=typeof e.channels}function Qo(e,t){if(!e||"audio"!==e.type)return Promise.reject(Yo(d.FILE_INVALID,"Invalid file"));if(Xo(t))return Promise.reject(Yo(d.FILE_INVALID,"Invalid file"));if(!e.url)return Promise.reject(Yo(d.FILE_NOT_FOUND,"File not found"));var r=function(e){if(e){var t=e.split("#")[0].split("?")[0].split("/").filter(Boolean);return t[t.length-1]}}(e.url);return r?Ho.call(this,On({fileId:r},t?{audio:t}:{})).then((function(e){var t;return Yo(e.type,e.message,(null===(t=e.data)||void 0===t?void 0:t.text)||"")})).catch((function(e){var t=Jo(e);throw Yo(t.type,t.message)})):Promise.reject(Yo(d.FILE_INVALID,"Invalid file"))}function Zo(e,t){return Xo(t)?Promise.reject(Yo(d.FILE_INVALID,"Invalid file")):qo(e)||Ko(e)&&Vo()?Fo.call(this,On({file:e},t?{audio:t}:{})).then((function(e){var t;return Yo(e.type,e.message,(null===(t=e.data)||void 0===t?void 0:t.text)||"")})).catch((function(e){var t=Jo(e);throw Yo(t.type,t.message)})):Promise.reject(Yo(d.FILE_INVALID,"Invalid file"))}function $o(e){void 0===e&&(e="*");var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i=t.userId,a={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(i,"/token/rtc?channelName=").concat(e),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return ae.call(this,a).then((function(e){return{type:e.type,data:{appId:(null==e?void 0:e.app_id)||"",RTCToken:(null==e?void 0:e.rtc_token)||"",channelName:(null==e?void 0:e.channel_name)||"",RTCUId:(null==e?void 0:e.rtcUid)||0,expire:(null==e?void 0:e.expires_in)||0}}}))}function ei(e){if(!Array.isArray(e)||0===e.length)throw Error("Invalid parameter RTCUIds: "+e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/rtc_mapper/batch/get"),type:"POST",dataType:"json",data:JSON.stringify({data:e}),headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return ae.call(this,i).then((function(e){return{type:e.type,data:e.data||{}}}))}var ti=function(){return ti=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ti.apply(this,arguments)},ri=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},ni=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function oi(e){if(!e||!e.data)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups?resource=").concat(a.clientResource),dataType:"json",type:"POST",data:JSON.stringify({owner:this.user,groupname:e.data.groupname,avatar:e.data.avatar,desc:e.data.desc,members:e.data.members,public:e.data.public,approval:e.data.approval,allowinvites:e.data.allowinvites,invite_need_confirm:e.data.inviteNeedConfirm,maxusers:e.data.maxusers,custom:e.data.ext}),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:function(t){e.success&&e.success(t)},error:e.error};return j.debug("Call createGroup:",e),ae.call(this,s,v.CREATE_GROUP)}var ii=oi;function ai(e){var t,r,n,o,i,a,s,c,u;if(!e)throw Error("Invalid parameter");var l=Nt.call(this).error;if(l)return Promise.reject(l);var h=this.context,p=h.orgName,f=h.appName,m=h.accessToken,g=h.jid,E={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(f,"/chatgroups?resource=").concat(g.clientResource),dataType:"json",type:"POST",data:JSON.stringify({owner:this.user,groupname:null!==(t=e.groupName)&&void 0!==t?t:"",avatar:null!==(r=e.avatar)&&void 0!==r?r:"",desc:null!==(n=e.description)&&void 0!==n?n:"",members:e.members,public:null!==(o=e.isPublic)&&void 0!==o&&o,approval:null!==(i=e.needApprovalToJoin)&&void 0!==i&&i,allowinvites:null===(a=e.allowMemberToInvite)||void 0===a||a,invite_need_confirm:null!==(s=e.inviteNeedConfirm)&&void 0!==s&&s,maxusers:null!==(c=e.maxMemberCount)&&void 0!==c?c:200,custom:null!==(u=e.extension)&&void 0!==u?u:""}),headers:{Authorization:"Bearer "+m,"Content-Type":"application/json"}};return j.debug("Call createGroupVNext:",e),ae.call(this,E,v.CREATE_GROUP).then((function(e){return{type:d.REQUEST_SUCCESS,data:{groupId:e.data.groupid}}}))}function si(e){var t;if("string"!=typeof e.groupId||""===e.groupId)throw Error("Invalid parameter");var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={entities:[(t={},t["notification_ignore_"+e.groupId]=!0,t)]},u={type:"PUT",url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(this.user,"?resource=").concat(s.clientResource),data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call blockGroupMessages",e),ae.call(this,u,v.BLOCK_GROUP)}var ci=si;function ui(e){if("number"!=typeof e.limit)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={limit:e.limit,cursor:e.cursor};e.cursor||delete a.cursor;var s={url:this.apiUrl+"/"+n+"/"+o+"/publicchatgroups?version=v3",type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call listGroups",e),ae.call(this,s,v.LIST_GROUP).then((function(t){var r,n=t.data.map((function(e){return{groupid:e.id,groupname:e.name}}));return null===(r=e.success)||void 0===r||r.call(e,ti(ti({},t),{data:n})),ti(ti({},t),{data:n})}))}var li=ui;function di(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/users/"+this.user+"/joined_chatgroups",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return j.debug("Call getJoinedGroups",e),ae.call(this,a,v.GET_USER_GROUP)}function hi(e){if("number"!=typeof e.pageNum||"number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageNum or pageSize"');if(e.pageNum<0||e.pageSize<0)throw Error('"pageNum" should >= 0 and "pageSize" should >= 0');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.needAffiliations||e.needRole?"/chatgroups/user/".concat(this.user,"?pagenum=").concat(e.pageNum,"&pagesize=").concat(e.pageSize,"&needAffiliations=").concat(e.needAffiliations,"&needRole=").concat(e.needRole,"&version=v3"):"/users/".concat(this.user,"/joined_chatgroups?pagenum=").concat(e.pageNum,"&pagesize=").concat(e.pageSize,"&version=v3"),s={url:this.apiUrl+"/"+n+"/"+o+a,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e&&(null==e?void 0:e.error)};return j.debug("Call getGroup",e),ae.call(this,s,v.GET_USER_GROUP).then((function(t){var r,n=t.uri,o=t.entities,i=[];if(n.includes("joined_chatgroups")){var a=t.data.map((function(e){return{groupid:e.id,groupname:e.name,disabled:e.disabled,role:e.permission}}));return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:a})),ti(ti({},t),{data:a})}return o.forEach((function(e){var t={affiliationsCount:e.affiliations_count,groupName:e.name,groupId:e.groupId,role:e.permission,disabled:e.disabled,approval:e.membersonly,allowInvites:e.allowinvites,description:e.description,maxUsers:e.maxusers,public:e.public};i.push(t)})),t.entities=i,t}))}function pi(e){if("string"!=typeof e.groupId||"string"!=typeof e.newOwner)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={newowner:e.newOwner},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatgroups/").concat(e.groupId,"?resource=").concat(s.clientResource),type:"PUT",dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},data:JSON.stringify(r),success:e.success,error:e.error};return j.debug("Call changeOwner",e),ae.call(this,c,v.CHANGE_OWNER)}var fi=pi;function mi(e){if("string"!=typeof e.groupId&&!Array.isArray(e.groupId))throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+e.groupId+"?joined_time=true",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupInfo",e),ae.call(this,a,v.GET_GROUP_INFO)}function gi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={groupname:e.groupName,avatar:e.avatar,description:e.description,custom:e.ext},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"?resource=").concat(a.clientResource),type:"PUT",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call modifyGroup",e),ae.call(this,u,v.MODIFY_GROUP)}function vi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(isNaN(e.pageNum)||e.pageNum<=0)throw Error('The parameter "pageNum" should be a positive number');if(isNaN(e.pageSize)||e.pageSize<=0)throw Error('The parameter "pageSize" should be a positive number');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={pagenum:e.pageNum,pagesize:e.pageSize},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatgroups/"+e.groupId+"/users?version=v3",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call listGroupMember",e),ae.call(this,s,v.LIST_GROUP_MEMBER)}var Ei=vi;function yi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(e.cursor&&"string"!=typeof e.cursor)throw Error('Invalid parameter: "cursor"');if(e.limit&&"number"!=typeof e.limit)throw Error('Invalid parameter: "limit"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={cursor:e.cursor,limit:e.limit||50,joined_time:!0},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatgroups/"+e.groupId+"/users",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getGroupMembers",e),ae.call(this,s,v.LIST_GROUP_MEMBER).then((function(e){var t=e.data,r=e.cursor,n=t.map((function(e){for(var t in e)if(["member","admin","owner"].includes(t))return{role:t,userId:e[t],joinedTime:e.joined_time}}));return{type:d.REQUEST_SUCCESS,data:{cursor:r,members:n}}}))}function _i(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/admin?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupAdmin",e),ae.call(this,s,v.GET_GROUP_ADMIN)}function Ti(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={newadmin:e.username},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/admin?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setGroupAdmin",e),ae.call(this,u,v.SET_GROUP_ADMIN)}var Ii=Ti;function Oi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/admin/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeAdmin",e),ae.call(this,u,v.REMOVE_GROUP_ADMIN)}var Ri=Oi;function Ci(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"?version=v3&resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call destroyGroup",e),ae.call(this,c,v.DISSOLVE_GROUP)}var Si=Ci;function Ni(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/quit?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call quitGroup",e),ae.call(this,c,v.QUIT_GROUP)}var bi=Ni;function Ai(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.groupId,n={usernames:e.users},o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatgroups/").concat(r,"/invite?resource=").concat(c.clientResource),type:"POST",data:JSON.stringify(n),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call inviteUsersToGroup",e),ae.call(this,u,v.INVITE_TO_GROUP)}var Mi=Ai;function wi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(e.groupId,"/apply?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify({message:e.message||""}),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call joinGroup",e),ae.call(this,s,v.JOIN_GROUP)}function Ui(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.applicant||""===e.applicant)throw Error('Invalid parameter: "applicant"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={applicant:e.applicant,verifyResult:!0,reason:"no clue"},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/apply_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call agreeJoinGroup",e),ae.call(this,u,v.AGREE_JOIN_GROUP)}var Li=Ui;function Pi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.applicant||""===e.applicant)throw Error('Invalid parameter: "applicant"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={applicant:e.applicant,verifyResult:!1,reason:e.reason||""},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/apply_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call rejectGroupJoinRequest",e),ae.call(this,u,v.REJECT_JOIN_GROUP)}var Di=Pi;function ki(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.invitee||""===e.invitee)throw Error('Invalid parameter: "invitee"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={invitee:e.invitee,verifyResult:!0},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/invite_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call acceptGroupInvite",e),ae.call(this,u,v.AGREE_INVITE_GROUP)}var xi=ki;function Bi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.invitee||""===e.invitee)throw Error('Invalid parameter: "invitee"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={invitee:e.invitee,verifyResult:!1},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/invite_verify?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call rejectGroupInvite",e),ae.call(this,u,v.REJECT_INVITE_GROUP)}var Gi=Bi;function ji(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.groupId,n=e.username,o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatgroups/").concat(r,"/users/").concat(n,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeGroupMember",e),ae.call(this,u,v.REMOVE_GROUP_MEMBER)}var Hi=ji;function Fi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.users.join(","),u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/users/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeGroupMembers",e),ae.call(this,u,v.MULTI_REMOVE_GROUP_MEMBER)}var Wi=Fi;function zi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!(Array.isArray(e.username)||"string"==typeof e.username&&""!==e.username))throw Error('Invalid parameter: "username"');if("number"!=typeof e.muteDuration)throw Error('Invalid parameter: "muteDuration"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:"string"==typeof e.username?[e.username]:e.username,mute_duration:e.muteDuration},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/mute?resource=").concat(a.clientResource,"&version=v3"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},data:JSON.stringify(c),success:e.success,error:e.error};return j.debug("Call muteGroupMember",e),ae.call(this,u,v.MUTE_GROUP_MEMBER)}var qi=zi;function Ki(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!(Array.isArray(e.username)||"string"==typeof e.username&&""!==e.username))throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/mute/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call unmuteGroupMember",e),ae.call(this,u,v.UNMUTE_GROUP_MEMBER)}var Vi=Ki;function Ji(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/mute?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupMuteList",e),ae.call(this,s,v.GET_GROUP_MUTE_LIST)}var Yi=Ji,Xi=Ji;function Qi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call blockGroupMember",e),ae.call(this,u,v.BLOCK_GROUP_MEMBER).then((function(t){var r,n=t.data[0]||{},o={action:"add_blocks",groupid:e.groupId,result:n.result,user:n.user};return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var Zi=Qi;function $i(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:e.usernames},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users?resource=").concat(a.clientResource,"&version=v3"),data:JSON.stringify(c),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call blockGroupMembers",e),ae.call(this,u,v.BLOCK_GROUP_MEMBERS).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return ti(ti({},t),{action:"add_blocks",groupid:e.groupId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var ea=$i;function ta(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockGroupMember",e),ae.call(this,u,v.UNBLOCK_GROUP_MEMBER).then((function(t){var r,n=t.data[0]||{},o={action:"remove_blocks",groupid:e.groupId,result:n.result,user:n.user};return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var ra=ta;function na(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.usernames.join(","),u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockGroupMembers",e),ae.call(this,u,v.UNBLOCK_GROUP_MEMBERS).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return ti(ti({},t),{action:"remove_blocks",groupid:e.groupId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var oa=na;function ia(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/blocks/users?version=v3",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupBlacklist",e),ae.call(this,s,v.GET_GROUP_BLACK_LIST)}var aa=ia,sa=ia;function ca(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call disableSendGroupMsg",e),ae.call(this,c,v.DISABLED_SEND_GROUP_MSG)}function ua(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call enableSendGroupMsg",e),ae.call(this,c,v.ENABLE_SEND_GROUP_MSG)}function la(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:e.users},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/white/users?resource=").concat(a.clientResource,"&version=v3"),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call addUsersToGroupWhitelist",e),ae.call(this,u,v.ADD_USERS_TO_GROUP_WHITE).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return ti(ti({},t),{action:"add_user_whitelist",groupid:e.groupId})}));return 1===(null==o?void 0:o.length)&&(o=o[0]),null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var da=la;function ha(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/white/users/").concat(e.userName,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call removeGroupAllowlistMember",e),ae.call(this,c,v.REMOVE_GROUP_WHITE_MEMBER).then((function(t){var r,n=t.data[0]||{},o={action:"remove_user_whitelist",groupid:e.groupId,result:n.result,user:n.user};return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,ti(ti({},t),{data:o})),ti(ti({},t),{data:o})}))}var pa=ha,fa=ha;function ma(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/white/users?version=v3",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupAllowlist",e),ae.call(this,s,v.GET_GROUP_WHITE_LIST)}var ga=ma;function va(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+a+"/white/users/"+e.userName+"?version=v3",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call isInGroupAllowlist",e),ae.call(this,s,v.IS_IN_GROUP_WHITE_LIST)}var Ea=va,ya=va;function _a(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s={url:this.apiUrl+"/"+n+"/"+o+"/sdk/chatgroups/"+e.groupId+"/mute/"+a+"?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i}};return j.debug("Call isInGroupMutelist",e),ae.call(this,s).then((function(e){return{type:e.type,data:e.data}}))}function Ta(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.msgId||""===e.msgId)throw Error('Invalid parameter: "msgId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/chatgroups/"+e.groupId+"/acks/"+e.msgId,dataType:"json",type:"GET",data:{limit:500,key:void 0},headers:{Authorization:"Bearer "+i},success:e.success,error:e.error};return j.debug("Call getGroupMsgReadUser",e),ae.call(this,a,v.GET_GROUP_MSG_READ_USER)}function Ia(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.groupId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(a,"/announcement?version=v3"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call fetchGroupAnnouncement",e),ae.call(this,s,v.GET_GROUP_ANN)}function Oa(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.announcement)throw Error('Invalid parameter: "announcement"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={announcement:e.announcement},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/announcement?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call updateGroupAnnouncement",e),ae.call(this,u,v.UPDATE_GROUP_ANN)}function Ra(e){var t;if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("object"!=typeof e.file)throw Error('Invalid parameter: "file"');var r=Nt.call(this).error;if(r)return null===(t=e.onFileUploadError)||void 0===t?void 0:t.call(e,r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c=e.groupId;me.call(this,{uploadUrl:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatgroups/").concat(c,"/share_files?resource=").concat(s.clientResource),onFileUploadProgress:e.onFileUploadProgress,onFileUploadComplete:e.onFileUploadComplete,onFileUploadError:e.onFileUploadError,onFileUploadCanceled:e.onFileUploadCanceled,accessToken:a,apiUrl:this.apiUrl,file:e.file,appKey:this.context.appKey,to:c,chatType:"groupChat"},v.UPLOAD_GROUP_FILE),j.debug("Call uploadGroupSharedFile",e)}function Ca(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.fileId||""===e.fileId)throw Error('Invalid parameter: "file"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.fileId,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/share_files/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call deleteGroupSharedFile",e),ae.call(this,u,v.DELETE_GROUP_FILE)}function Sa(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.pageNum||1,s=e.pageSize||10,c=e.groupId,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(c,"/share_files?pagenum=").concat(a,"&pagesize=").concat(s,"&version=v3"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getGroupSharedFilelist",e),ae.call(this,u,v.GET_GROUP_FILE_LIST)}var Na=Sa;function ba(e){var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i=this.apiUrl,a=e.groupId,s=e.fileId;ge.call(this,{url:"".concat(i,"/").concat(r,"/").concat(n,"/chatgroups/").concat(a,"/share_files/").concat(s),onFileDownloadComplete:e.onFileDownloadComplete,onFileDownloadError:e.onFileDownloadError,accessToken:o,id:s,secret:e.secret},v.DOWN_GROUP_FILE),j.debug("Call downloadGroupSharedFile",e)}function Aa(e){return ri(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u,l,d;return ni(this,(function(h){switch(h.label){case 0:if(t=e.groupId,r=e.userId,n=e.memberAttributes,"string"!=typeof t||""===t)throw Error('Invalid parameter: "groupId"');if("string"!=typeof r||""===r)throw Error('Invalid parameter: "userId"');if("object"!=typeof n)throw Error('Invalid parameter: "memberAttributes"');return(o=Nt.call(this).error)?[2,Promise.reject(o)]:(i=this.context,a=i.orgName,s=i.appName,c=i.accessToken,u=i.jid,l={metaData:n},d={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(s,"/sdk/metadata/chatgroup/").concat(t,"/user/").concat(r,"?resource=").concat(u.clientResource,"&version=v3"),type:"PUT",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}},j.debug("Call setGroupMemberAttributes",e),[4,ae.call(this,d,v.SET_GROUP_MEMBER_ATTRS)]);case 1:return h.sent(),[2]}}))}))}function Ma(e){var t=e.groupId,r=e.userId;return wa.call(this,{groupId:t,userIds:[r]}).then((function(e){var t;return{type:e.type,data:null===(t=e.data)||void 0===t?void 0:t[r]}}))}function wa(e){var t=e.groupId,r=e.userIds,n=e.keys,o=void 0===n?[]:n;if("string"!=typeof t||""===t)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(r)||(null==r?void 0:r.length)<=0)throw Error('Invalid parameter: "userIds"');if(!Array.isArray(o))throw Error('Invalid parameter: "keys"');var i=Nt.call(this).error;if(i)return Promise.reject(i);var a=this.context,s=a.orgName,c=a.appName,u=a.accessToken,l={targets:r,properties:o},d={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/metadata/chatgroup/").concat(t,"/get?version=v3"),type:"POST",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}};return j.debug("Call getGroupMembersAttributes",e),ae.call(this,d,v.GET_GROUP_MEMBER_ATTR).then((function(e){return{type:e.type,data:(null==e?void 0:e.data)||{}}}))}function Ua(){var e=Nt.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/chatgroups/user/").concat(this.context.userId,"/joined_count"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return j.debug("Call getJoinedGroupsCount"),ae.call(this,i).then((function(e){return{type:d.REQUEST_SUCCESS,data:e.data||0}}))}function La(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/shield?version=v3&resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call blockGroupMessages",e),ae.call(this,c).then((function(e){return{type:d.REQUEST_SUCCESS,data:e.data||{}}}))}function Pa(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatgroups/").concat(s,"/shield?version=v3&resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call unblockGroupMessages",e),ae.call(this,c).then((function(e){return{type:d.REQUEST_SUCCESS,data:e.data||{}}}))}var Da=function(){return Da=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Da.apply(this,arguments)};function ka(e){var t=this;if("number"!=typeof e.pagenum||"number"!=typeof e.pagesize)throw Error("Invalid parameter");var r=Nt.call(this).error;if(r)return Promise.reject(r);var n={pagenum:e.pagenum||1,pagesize:e.pagesize||20},o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c={url:this.apiUrl+"/"+i+"/"+a+"/chatrooms",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+s},data:n,success:function(t){"function"==typeof e.success&&e.success(t)},error:function(r){r.error&&r.error_description&&t.onError&&t.onError({type:d.WEBIM_CONNCTION_LOAD_CHATROOM_ERROR,message:r.error_description,data:r}),"function"==typeof e.error&&e.error(r)}};return j.debug("Call getChatRooms",e),ae.call(this,c,v.GET_CHATROOM_LIST)}function xa(e){if("string"!=typeof e.name)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={name:e.name,description:e.description,maxusers:e.maxusers,owner:this.user,members:e.members},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatrooms?resource=").concat(s.clientResource),dataType:"json",type:"POST",data:JSON.stringify(r),headers:{Authorization:"Bearer "+(e.token||a),"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call createChatRoom",e),ae.call(this,c,v.CREATE_CHATROOM)}function Ba(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(e.chatRoomId,"?resource=").concat(a.clientResource,"&version=v3"),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+(e.token||i)},success:e.success,error:e.error};return j.debug("Call destroyChatRoom",e),ae.call(this,s,v.DESTROY_CHATROOM)}function Ga(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+e.chatRoomId,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomDetails",e),ae.call(this,a,v.GET_CHATROOM_DETAIL)}function ja(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={groupname:e.chatRoomName,description:e.description,maxusers:e.maxusers},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"?resource=").concat(a.clientResource),type:"PUT",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call modifyChatRoom",e),ae.call(this,u,v.MODIFY_CHATROOM)}function Ha(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||"string"!=typeof e.username)throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/users/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeChatRoomMember",e),ae.call(this,u,v.REMOVE_CHATROOM_MEMBER)}var Fa=Ha;function Wa(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||!Array.isArray(e.users))throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.chatRoomId,n=e.users.join(","),o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatrooms/").concat(r,"/users/").concat(n,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeChatRoomMembers",e),ae.call(this,u,v.MULTI_REMOVE_CHATROOM_MEMBER)}var za=Wa;function qa(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||!Array.isArray(e.users))throw Error("Invalid parameter");var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=e.chatRoomId,n={usernames:e.users},o=this.context,i=o.orgName,a=o.appName,s=o.accessToken,c=o.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatrooms/").concat(r,"/users?resource=").concat(c.clientResource),type:"POST",data:JSON.stringify(n),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call addUsersToChatRoom",e),ae.call(this,u,v.ADD_USERS_TO_CHATROOM)}function Ka(e){var t=e.roomId,r=e.message,n=void 0===r?"":r,o=e.ext,i=void 0===o?"":o,a=e.leaveOtherRooms,s=void 0!==a&&a,c=e.success,u=e.error;if("string"!=typeof t||""===t)throw Error("Invalid parameter roomId");if("string"!=typeof i)throw Error("Invalid parameter ext");if("boolean"!=typeof s)throw Error("Invalid parameter leaveOtherRooms");var l=Nt.call(this).error;return l?Promise.reject(l):(j.debug("Call joinChatRoom",e),this.logOut?Promise.reject({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"}):this.mSync.handleChatRoom({roomId:t,ext:i,leaveOtherRooms:s,message:n,success:c,errorCb:u},"join"))}function Va(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error("Invalid parameter");var t=Nt.call(this).error;return t?Promise.reject(t):(j.debug("Call leaveChatRoom",e),this.logOut?Promise.reject({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"}):this.mSync.handleChatRoom(e,"leave"))}var Ja=Va;function Ya(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(isNaN(e.pageNum)||e.pageNum<=0)throw Error('The parameter "pageNum" should be a positive number');if(isNaN(e.pageSize)||e.pageSize<=0)throw Error('The parameter "pageSize" should be a positive number');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={pagenum:e.pageNum,pagesize:e.pageSize},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatrooms/"+e.chatRoomId+"/users?version=v3",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call listChatRoomMembers",e),ae.call(this,s,v.LIST_CHATROOM_MEMBERS)}var Xa=Ya;function Qa(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(e.cursor&&"string"!=typeof e.cursor)throw Error('Invalid parameter: "cursor"');if(e.limit&&"number"!=typeof e.limit)throw Error('Invalid parameter: "limit"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={cursor:e.cursor,limit:e.limit||50,joined_time:!0},n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={url:this.apiUrl+"/"+o+"/"+i+"/chatrooms/"+e.chatRoomId+"/users",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call getChatRoomMembers",e),ae.call(this,s,v.LIST_GROUP_MEMBER).then((function(e){var t=e.data,r=e.cursor,n=t.map((function(e){for(var t in e)if(["member","admin","owner"].includes(t))return{role:t,userId:e[t],joinedTime:e.joined_time}}));return{type:d.REQUEST_SUCCESS,data:{cursor:r,members:n}}}))}function Za(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/admin?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomAdmin",e),ae.call(this,s,v.GET_CHATROOM_ADMIN)}function $a(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={newadmin:e.username},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/admin?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setChatRoomAdmin",e),ae.call(this,u,v.SET_CHATROOM_ADMIN)}function es(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/admin/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call removeChatRoomAdmin",e),ae.call(this,u,v.REMOVE_CHATROOM_ADMIN)}function ts(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');if("number"!=typeof e.muteDuration)throw Error('Invalid parameter: "muteDuration"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:[e.username],mute_duration:e.muteDuration},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/mute?resource=").concat(a.clientResource),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},data:JSON.stringify(c),success:e.success,error:e.error};return j.debug("Call muteChatRoomMember",e),ae.call(this,u,v.MUTE_CHATROOM_MEMBER)}function rs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/mute/").concat(c,"?resource=").concat(a.clientResource),dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call unmuteChatRoomMember",e),ae.call(this,u,v.REMOVE_MUTE_CHATROOM_MEMBER)}var ns=rs;function os(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/mute?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomMutelist",e),ae.call(this,s,v.GET_MUTE_CHATROOM_MEMBERS)}var is=os,as=os;function ss(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call blockChatRoomMember",e),ae.call(this,u,v.SET_CHATROOM_MEMBER_TO_BLACK).then((function(t){var r,n=t.data[0]||{},o=Da(Da({},n),{action:"add_blocks",id:e.chatRoomId});return null===(r=null==e?void 0:e.success)||void 0===r||r.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var cs=ss;function us(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:e.usernames},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users?resource=").concat(a.clientResource,"&version=v3"),data:JSON.stringify(c),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Chat blockChatRoomMembers:",u),ae.call(this,u,v.MULTI_SET_CHATROOM_MEMBER_TO_BLACK).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return Da(Da({},t),{action:"add_blocks",id:e.chatRoomId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var ls=us;function ds(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.username||""===e.username)throw Error('Invalid parameter: "username"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockChatRoomMember",e),ae.call(this,u,v.REMOVE_CHATROOM_MEMBER_BLACK).then((function(t){var r,n=t.data;return null===(r=e.success)||void 0===r||r.call(e,Da(Da({},t),{data:Da(Da({},n[0]),{action:"remove_blocks",id:e.chatRoomId})})),Da(Da({},t),{data:Da(Da({},n[0]),{action:"remove_blocks",id:e.chatRoomId})})}))}var hs=ds;function ps(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.usernames.join(","),u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call unblockChatRoomMembers",e),ae.call(this,u,v.MULTI_REMOVE_CHATROOM_MEMBER_BLACK).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return Da(Da({},t),{action:"remove_blocks",id:e.chatRoomId})}));return null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var fs=ps;function ms(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/blocks/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomBlocklist",e),ae.call(this,s,v.GET_CHATROOM_BLOCK_MEMBERS)}var gs=ms,vs=ms;function Es(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call disableSendChatRoomMsg",e),ae.call(this,c,v.DISABLED_CHATROOM_SEND_MSG)}function ys(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/ban?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call enableSendChatRoomMsg",e),ae.call(this,c,v.ENABLE_CHATROOM_SEND_MSG)}function _s(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:e.users},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/white/users?resource=").concat(a.clientResource,"&version=v3"),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call addUsersToChatRoomWhitelist",e),ae.call(this,u,v.ADD_USERS_TO_CHATROOM).then((function(t){var r,n,o=null===(r=t.data)||void 0===r?void 0:r.map((function(t){return Da(Da({},t),{action:"add_user_whitelist",id:e.chatRoomId})}));return 1===(null==o?void 0:o.length)&&(o=o[0]),null===(n=null==e?void 0:e.success)||void 0===n||n.call(e,Da(Da({},t),{data:o})),Da(Da({},t),{data:o})}))}var Ts=_s;function Is(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/white/users/").concat(e.userName,"?resource=").concat(a.clientResource,"&version=v3"),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},error:e.error};return j.debug("Call removeChatRoomAllowlistMember",e),ae.call(this,c,v.REMOVE_CHATROOM_WHITE_USERS).then((function(t){var r;return null===(r=e.success)||void 0===r||r.call(e,Da(Da({},t),{data:Da(Da({},t.data[0]),{action:"remove_user_whitelist",id:e.chatRoomId})})),Da(Da({},t),{data:Da(Da({},t.data[0]),{action:"remove_user_whitelist",id:e.chatRoomId})})}))}var Os=Is,Rs=Is;function Cs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/white/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getChatRoomAllowlist",e),ae.call(this,s,v.GET_CHATROOM_WHITE_USERS)}var Ss=Cs;function Ns(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if("string"!=typeof e.userName||""===e.userName)throw Error('Invalid parameter: "userName"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+n+"/"+o+"/chatrooms/"+a+"/white/users/"+e.userName,type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call isInChatRoomAllowlist",e),ae.call(this,s,v.CHECK_CHATROOM_WHITE_USER)}var bs=Ns;function As(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s={url:this.apiUrl+"/"+n+"/"+o+"/sdk/chatrooms/"+e.chatRoomId+"/mute/"+a+"?version=v3",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i}};return j.debug("Call isInChatRoomMutelist",e),ae.call(this,s).then((function(e){return{type:e.type,data:e.data}}))}function Ms(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.roomId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(a,"/announcement?version=v3"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call fetchChatRoomAnnouncement",e),ae.call(this,s,v.GET_CHATROOM_ANN)}function ws(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("string"!=typeof e.announcement)throw Error('Invalid parameter: "announcement"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.roomId,c={announcement:e.announcement},u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/announcement?resource=").concat(a.clientResource,"&version=v3"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call updateChatRoomAnnouncement:",e),ae.call(this,u,v.UPDATE_CHATROOM_ANN)}function Us(e){var t;if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("object"!=typeof e.file)throw Error('Invalid parameter: "file"');var r=Nt.call(this).error;if(r)return null===(t=e.onFileUploadError)||void 0===t?void 0:t.call(e,r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.jid,c=e.roomId;me.call(this,{uploadUrl:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/chatrooms/").concat(c,"/share_files?resource=").concat(s.clientResource),onFileUploadProgress:e.onFileUploadProgress,onFileUploadComplete:e.onFileUploadComplete,onFileUploadError:e.onFileUploadError,onFileUploadCanceled:e.onFileUploadCanceled,accessToken:a,apiUrl:this.apiUrl,file:e.file,appKey:this.context.appKey,to:c,chatType:"chatRoom"},v.UPLOAD_CHATROOM_FILE),j.debug("Call uploadChatRoomSharedFile",e)}function Ls(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("string"!=typeof e.fileId||""===e.fileId)throw Error('Invalid parameter: "fileId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s=e.roomId,c=e.fileId,u={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(s,"/share_files/").concat(c,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call deleteChatRoomSharedFile",e),ae.call(this,u,v.DELETE_CHATROOM_FILE)}function Ps(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=e.roomId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/chatrooms/").concat(a,"/share_files"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json",accept:"application/json"},success:e.success,error:e.error};return j.debug("Call fetchChatRoomSharedFileList",e),ae.call(this,s,v.GET_CHATROOM_FILES)}var Ds=Ps;function ks(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if(e.attributeKeys&&!Array.isArray(e.attributeKeys))throw Error('"Invalid parameter attributeKeys": '+e.attributeKeys);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=(r.jid,e.chatRoomId),s={keys:e.attributeKeys},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(a),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call getChatRoomAttributes:",e),ae.call(this,c,v.GET_CHATROOM_ATTR).then((function(e){return{data:e.data,type:e.type}}))}function xs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if("object"!=typeof e.attributes)throw Error("Invalid parameter attributes: "+e.attributes);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributes,u=e.autoDelete,l=void 0===u||u,d=e.isForced?"/forced":"",h={metaData:c,autoDelete:l?"DELETE":"NO_DELETE"},p={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(s,"/user/").concat(a)+d,type:"PUT",dataType:"json",data:JSON.stringify(h),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call setChatRoomAttributes:",e),ae.call(this,p,v.SET_CHATROOM_ATTR).then((function(e){return bt(e)}))}function Bs(e){var t;if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if("string"!=typeof e.attributeKey||""===e.attributeKey)throw Error("Invalid parameter attributeKey: "+e.attributeKey);if("string"!=typeof e.attributeValue||""===e.attributeValue)throw Error("Invalid parameter attributeValue: "+e.attributeValue);var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s=n.userId,c=e.chatRoomId,u=e.attributeKey,l=e.attributeValue,d=e.autoDelete,h=void 0===d||d,p=e.isForced?"/forced":"",f={metaData:(t={},t[u]=l,t),autoDelete:h?"DELETE":"NO_DELETE"},m={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/metadata/chatroom/").concat(c,"/user/").concat(s)+p,type:"PUT",dataType:"json",data:JSON.stringify(f),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return j.debug("Call setChatRoomAttribute:",e),ae.call(this,m,v.SET_CHATROOM_ATTR).then((function(e){var t=At(e);if(t)throw t}))}function Gs(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if(!Array.isArray(e.attributeKeys))throw Error('"Invalid parameter attributes": '+e.attributeKeys);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributeKeys,u=e.isForced?"/forced":"",l={keys:c},d={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(s,"/user/").concat(a)+u,type:"DELETE",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call removeChatRoomAttributes:",e),ae.call(this,d,v.DELETE_CHATROOM_ATTR).then((function(e){return bt(e)}))}function js(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter chatRoomId: "+e.chatRoomId);if("string"!=typeof e.attributeKey||""===e.attributeKey)throw Error('"Invalid parameter attributeKey": '+e.attributeKey);var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributeKey,u=e.isForced?"/forced":"",l={keys:[c]},d={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/metadata/chatroom/").concat(s,"/user/").concat(a)+u,type:"DELETE",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return j.debug("Call removeChatRoomAttribute:",e),ae.call(this,d,v.DELETE_CHATROOM_ATTR).then((function(e){var t=At(e);if(t)throw t}))}function Hs(e){var t=this,r=e||{},n=r.pageNum,o=r.pageSize;if(isNaN(n)||n<=0)throw Error("Invalid parameter pageNum:".concat(n));if(isNaN(o)||o<=0)throw Error("Invalid parameter pageSize:".concat(o));var i=Nt.call(this).error;if(i)return Promise.reject(i);var a={pagenum:n,pagesize:o,detail:!0},s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,d={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(this.user,"/joined_chatrooms"),dataType:"json",type:"GET",data:a,headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}};return j.debug("Call getJoinedChatRooms",e),ae.call(this,d,v.GET_USER_JOINED_CHATROOM).then((function(e){var r=(e.data||[]).map((function(e){var r=e.id,n=e.title,o=e.owner,i=e.created,a=e.description,s=e.max_users;return{id:r,name:n,owner:o.split("".concat(t.appKey,"_"))[1],created:i,description:a,maxusers:s}}));return{type:e.type,data:r}}))}var Fs=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Ws=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function zs(e){return Fs(this,void 0,void 0,(function(){var t,r,n,o,i,a,s,c,u;return Ws(this,(function(l){switch(l.label){case 0:if("string"!=typeof e.description)throw Error('Invalid parameter: "description"');return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s=this.context.jid.clientResource,c={ext:e.description},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/presence/").concat(s,"/1"),type:"POST",dataType:"json",data:JSON.stringify(c),headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error},j.debug("Call publishPresence:",e),[4,ae.call(this,u)]);case 1:return l.sent(),[2]}}))}))}function qs(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');if("number"!=typeof e.expiry)throw Error('Invalid parameter: "expiry"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.userId,a=r.accessToken,s={usernames:e.usernames},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(i,"/presence/").concat(e.expiry),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call subscribePresence:",e),ae.call(this,c).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function Ks(e){return Fs(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return Ws(this,(function(c){switch(c.label){case 0:if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.userId,a=r.accessToken,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(i,"/presence"),type:"DELETE",dataType:"json",data:JSON.stringify(e.usernames),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error},j.debug("Call unsubscribePresence:",e),[4,ae.call(this,s)]);case 1:return c.sent(),[2]}}))}))}function Vs(e){if("number"!=typeof e.pageNum||"number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageNum or pageSize"');if(e.pageNum<0||e.pageSize<0)throw Error('"pageNum" should >= 0 and "pageSize" should >= 0');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.userId,a=r.accessToken,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(i,"/presence/sublist?pageNum=").concat(e.pageNum,"&pageSize=").concat(e.pageSize),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getSubscribedPresenceList:",e),ae.call(this,s).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}var Js=Vs;function Ys(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={usernames:e.usernames},n=this.context,o=n.orgName,i=n.appName,a=n.userId,s=n.accessToken,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/presence"),type:"POST",dataType:"json",data:JSON.stringify(r),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getPresenceStatus:",e),ae.call(this,c).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function Xs(e){if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var t=e.options.paramType;if("number"!=typeof t||t<0||t>2)throw Error('Invalid parameter: "options of paramType"');if(0===t){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===t){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===t){var r=e.options,n=r.startTime,o=r.endTime;if(!(n instanceof Object&&Object.keys(n).length))throw Error('Invalid parameter: "options of startTime"');if("number"!=typeof n.hours||"number"!=typeof n.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(o instanceof Object&&Object.keys(o).length))throw Error('Invalid parameter: "options of endTime"');if("number"!=typeof o.hours||"number"!=typeof o.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}var i=Nt.call(this).error;if(i)return Promise.reject(i);var a=this.context,s=a.accessToken,c=a.orgName,u=a.appName,l=a.userId,d=a.jid,h={};switch(t){case 0:h={type:e.options.remindType};break;case 1:h={ignoreDuration:e.options.duration};break;case 2:var p=e.options;n=p.startTime,o=p.endTime,h={ignoreInterval:"".concat(n.hours,":").concat(n.minutes,"-").concat(o.hours,":").concat(o.minutes)}}var f={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(l,"/notification/user/").concat(l,"?resource=").concat(d.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(h),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setSilentModeForAll:",e),ae.call(this,f)}function Qs(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/user/").concat(a),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return j.debug("Call getSilentModeForAll:",e),ae.call(this,s)}function Zs(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var t=e.options.paramType;if("number"!=typeof t||t<0||t>2)throw Error('Invalid parameter: "options of paramType"');if(0===t){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===t){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===t){var r=e.options,n=r.startTime,o=r.endTime;if(!(n instanceof Object&&Object.keys(n).length))throw Error('Invalid parameter: "options of startTime"');if("number"!=typeof n.hours||"number"!=typeof n.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(o instanceof Object&&Object.keys(o).length))throw Error('Invalid parameter: "options of endTime"');if("number"!=typeof o.hours||"number"!=typeof o.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}var i=Nt.call(this).error;if(i)return Promise.reject(i);var a=this.context,s=a.accessToken,c=a.orgName,u=a.appName,l=a.userId,d=a.jid,h="chatgroup",p={};switch(t){case 0:p={type:e.options.remindType};break;case 1:p={ignoreDuration:e.options.duration};break;case 2:var f=e.options;n=f.startTime,o=f.endTime,p={ignoreInterval:"".concat(n.hours,":").concat(n.minutes,"-").concat(o.hours,":").concat(o.minutes)}}"singleChat"===e.type&&(h="user");var m={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(l,"/notification/").concat(h,"/").concat(e.conversationId,"?resource=").concat(d.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setSilentModeForConversation:",e),ae.call(this,m)}function $s(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s=r.jid,c="chatgroup";"singleChat"===e.type&&(c="user");var u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/").concat(c,"/").concat(e.conversationId,"?resource=").concat(s.clientResource),type:"PUT",dataType:"json",data:JSON.stringify({type:"DEFAULT"}),headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call clearRemindTypeForConversation:",e),ae.call(this,u)}function ec(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s="chatgroup";"singleChat"===e.type&&(s="user");var c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/").concat(s,"/").concat(e.conversationId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getSilentModeForConversation:",e),ae.call(this,c)}function tc(e){if(!Array.isArray(e.conversationList))throw Error('Invalid parameter: "conversationList"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s=[],c=[];e.conversationList.forEach((function(e){"singleChat"===e.type?s.push(e.id):c.push(e.id)}));var u=s.length?s.join(","):"",l=c.length?c.join(","):"",d={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification?user=").concat(u,"&group=").concat(l),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call getSilentModeForConversations:",e),ae.call(this,d)}function rc(e){if("string"!=typeof e.language||!e.language)throw Error('Invalid parameter: "language"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r={translationLanguage:e.language},n=this.context,o=n.accessToken,i=n.orgName,a=n.appName,s=n.userId,c={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/users/").concat(s,"/notification/language"),type:"PUT",dataType:"json",data:JSON.stringify(r),headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},success:e.success,error:e.error};return j.debug("Call setPushPerformLanguage:",e),ae.call(this,c)}function nc(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/language"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return j.debug("Call getPushPerformLanguage:",e),ae.call(this,s)}function oc(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);if("number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageSize"');var r=this.context,n=r.accessToken,o=r.orgName,i=r.appName,a=r.userId,s={limit:e.pageSize||10,cursor:e.cursor};e.cursor||delete s.cursor;var c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/users/").concat(a,"/notification/mute/type"),type:"GET",dataType:"json",data:s,headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"}};return j.debug("Call getSilentModeRemindTypeConversations:",e),ae.call(this,c).then((function(e){return e.data?{data:{conversations:e.data.map((function(e){return"user"in e?{conversationId:e.user,type:"singleChat",remindType:e.value}:{conversationId:e.group,type:"groupChat",remindType:e.value}})),cursor:e.cursor},type:e.type}:e}))}var ic=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},ac=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function sc(e){if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));if("string"!=typeof e.messageId||""===e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={name:e.name,msg_id:e.messageId,group_id:e.parentId,owner:this.user},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread?resource=").concat(a.clientResource),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,c).then((function(e){var t=e.data.thread_id;return e.data={chatThreadId:t},e}))}function cc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/join?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s).then((function(e){var t=e.data.detail;return t.messageId=t.msgId,t.parentId=t.groupId,delete t.msgId,delete t.groupId,e}))}function uc(e){return ic(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return ac(this,(function(c){switch(c.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/quit?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s)]);case 1:return c.sent(),[2]}}))}))}function lc(e){return ic(this,void 0,void 0,(function(){var t,r,n,o,i,a,s;return ac(this,(function(c){switch(c.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return(t=Nt.call(this).error)?[2,Promise.reject(t)]:(r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}},[4,ae.call(this,s)]);case 1:return c.sent(),[2]}}))}))}function dc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={name:e.name},c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"?resource=").concat(a.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,c)}function hc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={limit:e.pageSize||20,cursor:e.cursor||""},s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/users"),type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s)}function pc(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.username||""===e.username)throw Error("Invalid parameter username: ".concat(e.username));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId,"/users/").concat(e.username,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s)}function fc(e){var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={limit:e.pageSize||20,cursor:e.cursor||""},s={url:e.parentId?"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/threads/chatgroups/").concat(e.parentId,"/user/").concat(this.user):"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/threads/user/").concat(this.user),type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function mc(e){if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={cursor:e.cursor||"",limit:e.pageSize||20},s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/threads/chatgroups/").concat(e.parentId),type:"GET",dataType:"json",data:a,headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,s).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function gc(e){var t=this;if(!Array.isArray(e.chatThreadIds))throw Error("Invalid parameter chatThreadIds: ".concat(e.chatThreadIds));var r=Nt.call(this).error;if(r)return Promise.reject(r);var n=this.context,o=n.orgName,i=n.appName,a=n.accessToken,s={threadIds:e.chatThreadIds},c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(i,"/thread/message"),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return ae.call(this,c).then((function(e){return vc.call(t,e)}))}function vc(e){var t=this,r=e.entities;return null==r||r.forEach((function(e){e.chatThreadId=e.thread_id,e.last_message&&"{}"!==JSON.stringify(e.last_message)?e.lastMessage=Ne.call(t,e.last_message):e.lastMessage=e.last_message,delete e.thread_id,delete e.last_message})),e}function Ec(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/thread/").concat(e.chatThreadId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return ae.call(this,a).then((function(e){return e.data.affiliationsCount=e.data.affiliations_count,e.data.messageId=e.data.msgId,e.data.parentId=e.data.groupId,delete e.data.affiliations_count,delete e.data.msgId,delete e.data.groupId,e}))}function yc(){var e=Nt.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,n=t.appName,o=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/users/").concat(this.user,"/translate/support/language"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+o}};return j.debug("Call getSupportedLanguages"),ae.call(this,i)}function _c(e){if("string"!=typeof e.text||""===e.text)throw Error('Invalid parameter: "text"');if(!Array.isArray(e.languages))throw Error('Invalid parameter: "language"');var t=Nt.call(this).error;if(t)return Promise.reject(t);var r=this.context,n=r.orgName,o=r.appName,i=r.accessToken,a="".concat(this.apiUrl,"/").concat(n,"/").concat(o,"/users/").concat(this.user,"/translate"),s={text:e.text,to:e.languages},c={url:a,dataType:"json",type:"POST",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i}};return j.debug("Call translateMessage"),ae.call(this,c)}var Tc=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Ic=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function Oc(e){return Tc(this,void 0,void 0,(function(){return Ic(this,(function(t){return[2,Zt(e)]}))}))}var Rc=new(function(){function e(){}return e.prototype.getImageInfo=function(e){return Tc(this,void 0,void 0,(function(){return Ic(this,(function(t){return"string"==typeof e?[2,this._getImageInfoFromUrl(e)]:[2,this._getImageInfoFromFile(e)]}))}))},e.prototype._getImageInfoFromFile=function(e){return new Promise((function(t,r){var n=URL.createObjectURL(e),o=new Image;o.onload=function(){URL.revokeObjectURL(n),t({width:o.width,height:o.height,type:e.type})},o.onerror=function(){URL.revokeObjectURL(n),r(new Error("Failed to load image"))},o.src=n}))},e.prototype._getImageInfoFromUrl=function(e){return new Promise((function(t,r){var n=new Image;n.onload=function(){return t({width:n.width,height:n.height})},n.onerror=function(){return r(new Error("Failed to load image from URL"))},n.src=e}))},e.prototype.generateBigImage=function(e,t){return Tc(this,void 0,void 0,(function(){var r,n,o,i,a,s,c,u,l;return Ic(this,(function(d){switch(d.label){case 0:if("string"==typeof e)throw new Error("Web image processor requires File input for compression");return[4,this.getImageInfo(e)];case 1:return r=d.sent(),(n=Yt(r.width,r.height,t.maxShortEdge)).width===r.width&&n.height===r.height?[2,null]:"function"!=typeof createImageBitmap?[3,3]:[4,createImageBitmap(e)];case 2:return i=d.sent(),[3,5];case 3:return[4,this._loadImage(e)];case 4:i=d.sent(),d.label=5;case 5:if(o=i,a=void 0!==globalThis.OffscreenCanvas?new globalThis.OffscreenCanvas(n.width,n.height):this._createCanvas(n.width,n.height),!(s=a.getContext("2d")))throw new Error("Failed to get canvas context");return s.drawImage(o,0,0,n.width,n.height),c="image/png"===e.type?"image/png":"image/webp"===e.type?"image/webp":"image/jpeg",[4,this._canvasToBlob(a,c,t.quality)];case 6:return u=d.sent(),[2,{file:l=new File([u],e.name||"compressed.jpg",{type:c}),width:n.width,height:n.height,size:l.size,type:c}]}}))}))},e.prototype.computeMd5=function(e){return Tc(this,void 0,void 0,(function(){return Ic(this,(function(t){switch(t.label){case 0:if("string"==typeof e)throw new Error("Web image processor requires File input for MD5");return[4,e.arrayBuffer()];case 1:return[2,Oc(t.sent())]}}))}))},e.prototype._loadImage=function(e){return new Promise((function(t,r){var n=URL.createObjectURL(e),o=new Image;o.onload=function(){URL.revokeObjectURL(n),t(o)},o.onerror=function(){URL.revokeObjectURL(n),r(new Error("Failed to load image"))},o.src=n}))},e.prototype._createCanvas=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,r},e.prototype._canvasToBlob=function(e,t,r){return"convertToBlob"in e?e.convertToBlob({type:t,quality:r}):new Promise((function(n,o){e.toBlob((function(e){return e?n(e):o(new Error("toBlob failed"))}),t,r)}))},e}()),Cc=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Sc=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Nc=function(){function e(e){this._pathCache=new Map,this.runtime=e}return e.prototype.getImageInfo=function(e){return"string"!=typeof e?Promise.reject(new Error("MiniApp image processor requires file path string")):this._loadImageInfo(e)},e.prototype.generateBigImage=function(e,t){return Cc(this,void 0,void 0,(function(){var r,n,o,i,a,s,c;return Sc(this,(function(u){switch(u.label){case 0:return"string"!=typeof e?[2,Promise.reject(new Error("MiniApp image processor requires file path string"))]:this.runtime.compressImage?[4,this._loadImageInfo(e)]:[2,Promise.reject(new Error("Platform missing compressImage capability"))];case 1:return r=u.sent(),(n=r.path||e)!==e&&j.debug("Miniapp image path normalized before compress",e,n),(o=Yt(r.width,r.height,t.maxShortEdge)).width===r.width&&o.height===r.height?[2,null]:(i=this.runtime.compressImage,[4,new Promise((function(e,r){i({src:n,quality:Math.round(100*t.quality),compressedWidth:o.width,compressedHeight:o.height,success:function(t){return e(t.tempFilePath)},fail:r})}))]);case 2:return a=u.sent(),j.debug("Miniapp compressImage temp path",a),[4,this._normalizeLocalPath(a)];case 3:return s=u.sent(),[4,this._getFileSize(s)];case 4:return c=u.sent(),[2,{path:s,width:o.width,height:o.height,size:c,type:"image/jpeg"}]}}))}))},e.prototype.computeMd5=function(e){var t,r;return Cc(this,void 0,void 0,(function(){var n,o;return Sc(this,(function(i){switch(i.label){case 0:return"string"!=typeof e?[2,Promise.reject(new Error("MiniApp image processor requires file path string"))]:(n=null===(r=(t=this.runtime).getFileSystemManager)||void 0===r?void 0:r.call(t))?[4,this._normalizeLocalPath(e)]:[2,Promise.reject(new Error("Platform missing getFileSystemManager capability"))];case 1:return o=i.sent(),[4,new Promise((function(e,t){n.readFile({filePath:o,success:function(t){return e(t.data)},fail:t})}))];case 2:return[2,Zt(i.sent())]}}))}))},e.prototype._getFileSize=function(e){var t,r;return Cc(this,void 0,void 0,(function(){var n,o,i,a,s,c,u,l,d,h;return Sc(this,(function(p){switch(p.label){case 0:return(n=null===(r=(t=this.runtime).getFileSystemManager)||void 0===r?void 0:r.call(t))?[4,this._normalizeLocalPath(e)]:(j.warn("Miniapp getFileSize: no FileSystemManager available"),[2,0]);case 1:o=p.sent(),j.debug("Miniapp getFileSize paths","original: ".concat(e),"normalized: ".concat(o)),i=function(e){var t,r;return Sc(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,new Promise((function(t,r){n.getFileInfo({filePath:e,success:function(e){return t(e.size)},fail:r})}))];case 1:return(t=o.sent())>0?(j.debug("Miniapp getFileSize success via getFileInfo","path: ".concat(e,", size: ").concat(t)),[2,{value:t}]):[3,3];case 2:return r=o.sent(),j.debug("Miniapp getFileInfo failed for path",e,r),[3,3];case 3:return[2]}}))},a=0,s=o!==e?[o,e]:[e],p.label=2;case 2:return a<s.length?(c=s[a],[5,i(c)]):[3,5];case 3:if("object"==typeof(u=p.sent()))return[2,u.value];p.label=4;case 4:return a++,[3,2];case 5:return p.trys.push([5,7,,8]),[4,new Promise((function(e,t){n.readFile({filePath:o,success:function(t){return e(t.data)},fail:t})}))];case 6:return l=p.sent(),d=l.byteLength,j.debug("Miniapp getFileSize fallback via readFile","size: ".concat(d)),[2,d];case 7:return h=p.sent(),j.warn("Miniapp getFileSize: all methods failed","path: ".concat(e),h),[2,0];case 8:return[2]}}))}))},e.prototype._loadImageInfo=function(e){var t=this;return new Promise((function(r,n){t.runtime.getImageInfo({src:e,success:function(e){return r({width:e.width,height:e.height,type:e.type,path:e.path})},fail:n})}))},e.prototype._normalizeLocalPath=function(e){return Cc(this,void 0,void 0,(function(){var t,r,n;return Sc(this,(function(o){switch(o.label){case 0:return/^https?:\/\/tmp\//i.test(e)?(t=this._pathCache.get(e))?[2,t]:[4,this._loadImageInfo(e)]:[2,e];case 1:return r=o.sent(),n=r.path||e,/^https?:\/\/tmp\//i.test(n)?[4,this._materializeTempPath(n)]:[3,3];case 2:n=o.sent(),o.label=3;case 3:return this._pathCache.set(e,n),j.debug("Miniapp image path normalization result",e,n),[2,n]}}))}))},e.prototype._materializeTempPath=function(e){var t,r,n;return Cc(this,void 0,void 0,(function(){var o,i,a,s,c,u;return Sc(this,(function(l){switch(l.label){case 0:if(!(null==(o=null===(r=(t=this.runtime).getFileSystemManager)||void 0===r?void 0:r.call(t))?void 0:o.saveFile)||!(null===(n=this.runtime.env)||void 0===n?void 0:n.USER_DATA_PATH))return[2,e];i=e.match(/(\.[a-zA-Z0-9]+)(?:\?.*)?$/),a=i?i[1]:"",s="".concat(this.runtime.env.USER_DATA_PATH,"/em-image-").concat(Date.now(),"-").concat(Math.random().toString(36).slice(2)).concat(a),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,new Promise((function(t,r){var n;null===(n=o.saveFile)||void 0===n||n.call(o,{tempFilePath:e,filePath:s,success:function(e){return t(e.savedFilePath||s)},fail:r})}))];case 2:return c=l.sent(),j.debug("Miniapp temp image materialized to user data path",e,c),[2,c];case 3:return u=l.sent(),j.warn("Miniapp saveFile failed while materializing temp image path",u),[2,e];case 4:return[2]}}))}))},e}(),bc=function(){return bc=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},bc.apply(this,arguments)},Ac=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},Mc=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},wc=_e.getEnvInfo(),Uc=function(){function r(n){var u,l,d=this;this.name="connection",this.appKey="",this.dnsTotal=0,this.max_cache_length=100,this._compressorFailureCount=0,this._reportLogs=!1,this._reportInterval=V,this._isLogging=!1,this._initWithAppId=!1,this.uikitVersion="",this.lastHeartbeat=Date.now(),this.isDebug=n.isDebug||!1,this.isReport=!1,this.uploadPartEnable=!0,this.enableMd5Check=null!==(u=n.enableMd5Check)&&void 0!==u&&u,this.isHttpDNS=void 0===n.isHttpDNS||n.isHttpDNS,this.heartBeatWait=n.heartBeatWait||3e4,this.autoReconnectNumMax=n.autoReconnectNumMax||5,this.refreshDNSIntervals=this.autoReconnectNumMax<5?this.autoReconnectNumMax:5,this.delivery=n.delivery||!1,this.disconnectedReason=void 0,this.loginInfoCustomExt=void 0,this.https=_e.isUseHttps(n.https),this.dnsArr=["https://rs.easemob.com","https://rs.chat.rtnsvc.com","https://rs.chat.realtimemesh.com"].filter((function(e){return e.startsWith(d.https?"https":"")})),this.dnsIndex=0,this.restHosts=[],this.restTotal=0,this.restIndex=0,this.hostIndex=0,this.socketHost=[],this.hostTotal=0,this.times=1,this.autoReconnectNumTotal=0,this.domain="easemob.com",this.dnsTotal=this.dnsArr.length,"appKey"in n&&(this.appKey=n.appKey),"appId"in n&&(this.appId=n.appId,this._initWithAppId=!0),this.appName="",this.orgName="",this.token="",this.grantType="",this.apiUrl=n.apiUrl||"",this.url=n.url||"",this.version="4.24.3",this.deviceId=n.deviceId||"webim",this.isFixedDeviceId=null===(l=n.isFixedDeviceId)||void 0===l||l,this.osType=16,this.useOwnUploadFun=n.useOwnUploadFun||!1;var h=_e.getEnvInfo(),p=h.global;if(this._imageProcessor=h.platform===le.WEB?Rc:(null==p?void 0:p.getImageInfo)?function(e){return new Nc(e)}(p):null,this.isAutoLogin=n.isAutoLogin||!1,this.compressType=[0],this.encryptType=[0],this.clientResource="",this.expiresIn=0,this.expirationTime=0,this.useReplacedMessageContents=n.useReplacedMessageContents||!1,this.logOut=!0,this.context={jid:{appKey:"",clientResource:"",domain:"easemob.com",name:""},userId:"",appKey:"",appId:"",status:0,restTokenData:"",appName:"",orgName:"",root:{},accessToken:""},this._msgHash={},this._msgPromiseHash={},this._queues=[],this._load_msg_cache=[],this.unMSyncSendMsgMap=new Map,this.mr_cache={},this.reconnecting=!1,this._offlineMessagePullState=Ee.SYNC_INIT,this._offlineMessagePullQueue=[],this.uniPushConfig={},this.uniPush=null,this.isRegisterPush=!1,this.pushCertificateName="",this._compressor=null,void 0!==n.customOSPlatform){if("number"!=typeof n.customOSPlatform||n.customOSPlatform<1||n.customOSPlatform>100)throw Error("Invalid customOSPlatform: ".concat(n.customOSPlatform));this.customOSPlatform=n.customOSPlatform,this.deviceId=n.customDeviceName||this.deviceId}if(this._initWithAppId){if(this.appKey="","string"!=typeof this.appId||!this.appId)throw Error("Invalid appId: ".concat(this.appId))}else{if("string"!=typeof this.appKey||2!==this.appKey.split("#").length)throw Error("Invalid appKey: ".concat(this.appKey));this.devInfos=this.appKey.split("#"),this.orgName=this.devInfos[0],this.appName=this.devInfos[1]}this.listen=sn.bind(this),this.mSync=this.usePlugin(rn),this.eventHandler=this.usePlugin(on),Object.assign(r.prototype,e),Object.assign(r.prototype,t),Object.assign(r.prototype,o),Object.assign(r.prototype,i),Object.assign(r.prototype,a),Object.assign(r.prototype,s),Object.assign(r.prototype,c),this.dataReport=new In({appkey:this.appKey||"default#appkey",org:this.orgName,sdkVersion:this.version,deviceId:this.deviceId,isReport:this.isReport,uikitVersion:n.uikitVersion||""});var f=0,m=this;if(Object.defineProperty(_e,"ajaxUnconventionalErrorTimes",{set:function(e){0!==e&&(j.debug("rest api request fail times: ".concat(e)),(f=e)%5==0&&m.isHttpDNS&&(j.debug("refresh dns config when rest request fail."),zc.call(m,(function(){})).catch((function(e){j.error("refresh dns config error",e)}))))},get:function(){return f}}),this.isFixedDeviceId){var g=_e.getLocalDeviceInfo();g&&(this.clientResource=JSON.parse(g).deviceId)}j.debug("init SDK: Conn ".concat(this.version," ").concat(wc.platform))}return r.prototype.usePlugin=function(e,t){if("push"!==t)return t?void(this[t]=new e(this)):new e(this);e.config&&e.emPush?(this.uniPushConfig=e.config,this.uniPush=e.emPush):j.error("use push plugin failed","emPush",this.uniPush,"config",this.uniPushConfig)},r.prototype.listen=function(e){},r.prototype.addEventHandler=function(e,t){},r.prototype.removeEventHandler=function(e){},r.prototype.registerUser=function(e){return Ac(this,void 0,void 0,(function(){var t,r;return Mc(this,(function(n){switch(n.label){case 0:if(!e.username||!e.password)throw Error("Invalid parameter");n.label=1;case 1:return n.trys.push([1,5,,6]),t=this.dataReport.geOperateFun({uid:e.username,operationName:v.REGISTER}),this.isHttpDNS?(this.dnsIndex=0,[4,zc.call(this,t)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[4,Pc.call(this,e,{rpt:t})];case 4:return[2,n.sent()];case 5:throw r=n.sent(),e.error&&e.error(r),r;case 6:return[2]}}))}))},r.prototype.open=function(e){var t;return Ac(this,void 0,void 0,(function(){var r,n,o,i,a,s;return Mc(this,(function(c){switch(c.label){case 0:if(j.debug("open",e.user,"isLogout:",this.logOut),this._isLogging)throw n=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"Currently logging in, please wait."});if(!this.logOut)throw n=m.create({type:d.WEBIM_USER_ALREADY_LOGIN,message:"The user has logged in."});this.retryConnectTimes=0,this._isLogging=!0,c.label=1;case 1:if(c.trys.push([1,6,7,8]),"web"===wc.platform&&(r=_e.detectBrowser(),j.info("browser",r)),n=Hc.call(this,e))throw null===(t=this.onError)||void 0===t||t.call(this,n),n;return e.accessToken&&(this.token=e.accessToken),o=bc({},e),i=this.dataReport.geOperateFun({uid:e.user,operationName:v.LOGIN}),this.dnsIndex=0,this.isHttpDNS?[4,zc.call(this,i)]:[3,3];case 2:c.sent(),c.label=3;case 3:return j.initReport({report:this._reportLogs,reportInterval:this._reportInterval,connection:this}),[4,kc.call(this,o,{rpt:i})];case 4:return a=c.sent(),[4,Gc.call(this,i)];case 5:return c.sent(),j.debug("grantType",this.grantType),_e.listenNetwork(xc.bind(this),Bc.bind(this)),_e.listenBrowserVisibility((function(){j.debug("visibility: true")}),(function(){j.debug("visibility: false")})),[2,a];case 6:throw s=c.sent(),this._isLogging=!1,e.error&&e.error(s),j.error("login failed",s),s;case 7:return j.reportLog(),[7];case 8:return[2]}}))}))},r.prototype.isOpened=function(){return this.sock&&1===this.sock.readyState||!1},r.prototype.close=function(e){var t,r,n,o;void 0===e&&(e="inner:logout"),j.debug("call close"),j._stopReportLogs(),this.logOut=!0,this.disconnectedReason=void 0,this.reconnecting=!1,this.context.status=d.STATUS_CLOSING,e&&(null==e?void 0:e.startsWith("inner"))&&this.sendLogout(e),this.sock&&this.sock.close(),null===(t=this.unMSyncSendMsgMap)||void 0===t||t.clear(),this.stopHeartBeat(),this.rejectMessage(),this.context.status=d.STATUS_CLOSED,this._load_msg_cache=[],this._queues=[],this._msgHash={},this.mr_cache={},this.token="",this.context.accessToken="",this.isRegisterPush=!1,this.clearTokenTimeout(),null===(n=null===(r=null==this?void 0:this._localCache)||void 0===r?void 0:r.getInstance())||void 0===n||n.close(),this.connectionTimer&&clearTimeout(this.connectionTimer),this.provisionTimer&&clearTimeout(this.provisionTimer),this.probingTimer&&clearTimeout(this.probingTimer),null===(o=this._compressor)||void 0===o||o.shrink(),this._compressor=null,this._compressorFailureCount=0,Le.clearAll()},r.prototype.downloadAndParseCombineMessage=function(e){var t=this,r=e.url,n=e.secret;return new Promise((function(e,o){var i,a,s=_e.getEnvInfo(),c="web"!==s.platform&&"node"!==s.platform&&"quick_app"!==s.platform&&(null===(a=null===(i=s.global)||void 0===i?void 0:i.canIUse)||void 0===a?void 0:a.call(i,"getFileSystemManager")),u=function(r){var n=function(e){o({type:d.PARSE_FILE_ERROR,message:"Read file failed",data:e})},i=function(r){return Ac(t,void 0,void 0,(function(){var t,n,i,a,s,u,l,h,p,f,m,g,v;return Mc(this,(function(E){switch(E.label){case 0:for(t=c?new Uint8Array(r.data):new Uint8Array(r.target.result),n=0,i=0,a=2,s=t.subarray(n,n+a),u=_e.Uint8ArrayToString(s),j.debug("file header:",u),i+=a,l=0,h=2;h<t.length-1;h++)h%2==1&&(l^=t[h]);if(p=t.subarray(t.length-1,t.length),j.debug("checkResult:",l,p[0]===l),p[0]!==l)return[2,o({type:d.PARSE_FILE_ERROR,message:"File verification failed"})];if("cm"!==u)return[3,7];E.label=1;case 1:E.trys.push([1,5,,6]),f=[],m=function(){var e,r,o,s;return Mc(this,(function(c){switch(c.label){case 0:return n+=a,i+=a=4,e=t.subarray(n,n+a),n+=a,a=e.reduce((function(t,r,n){return t+(r<<8*(e.length-n-1))}),0),i+=a,r=t.subarray(n,n+a),o=(o=g.root.lookup("easemob.pb.Meta")).decode(r),[4,ut.call(g,o,0,!0,!0)];case 1:return s=c.sent(),f.push(s),[2]}}))},g=this,E.label=2;case 2:return i<t.length-1?[5,m()]:[3,4];case 3:return E.sent(),[3,2];case 4:return[2,e(f)];case 5:return v=E.sent(),o({type:d.PARSE_FILE_ERROR,message:"Parse file failed",data:v}),[3,6];case 6:return[3,8];case 7:return[2,o({type:d.PARSE_FILE_ERROR,message:"File verification failed"})];case 8:return[2]}}))}))};if(c){var a=s.global.getFileSystemManager(),u=r.tempFilePath;a.readFile({filePath:u,success:i,fail:n})}else if(r instanceof Blob){var l=new FileReader;l.readAsArrayBuffer(r),l.onerror=n,l.onload=i}},l=function(e){o({type:d.WEBIM_DOWNLOADFILE_ERROR,message:"Download failed, please try again",data:e})};c?s.global.downloadFile({url:r,success:u,fail:l}):_e.download.call(t,{url:r,headers:{Accept:"application/json"},onFileDownloadComplete:u,onFileDownloadError:l,secret:n,accessToken:t.context.accessToken})}))},r.prototype.getChatFilesUrl=function(){return"".concat(this.apiUrl,"/").concat(this.orgName,"/").concat(this.appName,"/chatfiles")},r.prototype.stopHeartBeat=function(){clearInterval(this.heartBeatID)},r.prototype.clear=function(){this.restTotal=0,this.restIndex=0,this.hostIndex=0,this.hostTotal=0},r.prototype.heartBeat=function(){},r.prototype.renewToken=function(e){var t=this,r=this.isOpened();return j.debug("isOpened",r),r?this.getTokenExpireTimestamp(e).then((function(r){var n=r.expire_timestamp,o=Date.now();return t.expirationTime=n,t.expiresIn=n-o,t.token=e,t.context.accessToken=e,t.clearTokenTimeout(),t.tokenExpireTimeCountDown(t.expiresIn),{status:!0,token:e,expire:n}})):Promise.reject({status:!1})},r.prototype.clearTokenTimeout=function(){j.info("clearTokenTimeout"),this.tokenWillExpireTimer&&clearTimeout(this.tokenWillExpireTimer),this.tokenExpiredTimer&&clearTimeout(this.tokenExpiredTimer),this.tokenWillExpireTimer=null,this.tokenExpiredTimer=null},r.prototype.tokenExpireTimeCountDown=function(e){var t=this;j.info("tokenExpireTimeCountDown",e),e>Math.pow(2,31)-1&&(e=Math.pow(2,31)-1),this.tokenWillExpireTimer=setTimeout((function(){var r;t.onTokenWillExpire&&t.onTokenWillExpire(),null===(r=t.eventHandler)||void 0===r||r.dispatch("onTokenWillExpire"),j.info("onTokenWillExpire",Math.floor(e-e/5))}),e-e/5),this.tokenExpiredTimer=setTimeout((function(){var e;j.info("onTokenExpired",0),t.onTokenExpired&&t.onTokenExpired(),null===(e=t.eventHandler)||void 0===e||e.dispatch("onTokenExpired"),t.close("inner:token expired")}),e)},r.prototype.compareTokenExpireTime=function(e,t){var r,n=Number(t)-Number(e);j.debug("compareTokenExpireTime",n),n<=this.expiresIn/5&&n>0?(this.onTokenWillExpire&&this.onTokenWillExpire(),null===(r=this.eventHandler)||void 0===r||r.dispatch("onTokenWillExpire"),j.info("onTokenWillExpire",n)):n<=0&&(this.closeByTokenExpired(),j.info("closeByTokenExpired",n))},r.prototype.closeByTokenExpired=function(){var e;j.info("closed By TokenExpired"),this.onTokenExpired&&this.onTokenExpired(),null===(e=this.eventHandler)||void 0===e||e.dispatch("onTokenExpired"),this.close("inner:token expired")},r.prototype.rejectMessage=function(){var e=this,t=Object.keys(this._msgHash);if(t.length>0){var r=m.create({type:d.MESSAGE_WEBSOCKET_DISCONNECTED,message:"websocket disconnected"});t.forEach((function(t){var n,o,i;(null===(n=e.unMSyncSendMsgMap)||void 0===n?void 0:n.has(t))||(e._msgHash[t].reject instanceof Function&&e._msgHash[t].reject(r),null===(i=null===(o=e._localCache)||void 0===o?void 0:o.getInstance())||void 0===i||i.updateLocalMessage(t,{serverMsgId:t,status:De.FAIL}),e._msgHash[t].fail instanceof Function&&e._msgHash[t].fail(r),e._msgHash[t].messageTimer&&clearTimeout(e._msgHash[t].messageTimer),delete e._msgHash[t])}))}},r.prototype.resetConnState=function(){this.mSync.stopHeartBeat(),this.times=1,this.autoReconnectNumTotal=0,this.hostIndex=0},r.prototype.reconnect=function(e){var t,r=this;if(this.logout)return j.warn("The user has already logged out when reconnecting");if(j.debug("socket reconnect readyState",this.sock.readyState),(0!==this.sock.readyState||e)&&(1!==this.sock.readyState||e)){j.info("reconnect: time",this.times),j.info("reconnect sock.readyState: ",this.sock.readyState),!1===this.reconnecting&&(this.reconnecting=!0),null===(t=this.eventHandler)||void 0===t||t.dispatch("onReconnecting"),this.rejectMessage(),this.isHttpDNS&&(this.hostIndex<this.socketHost.length-1?this.hostIndex++:this.hostIndex=this.socketHost.length-1);var n=1e3*_e.getRetryDelay(this.times);j.info("reconnect delay: ",n),setTimeout((function(){(1!==r.sock.readyState||e)&&(j.info("login sock.readyState: ",r.sock.readyState),r.sock.close(),jc.call(r).catch((function(e){j.error("reconnect websocket failed",e)})),r.times++)}),n),this.autoReconnectNumTotal++}},r.prototype.send=function(e){return Promise.resolve(null)},r.prototype.setLoginInfoCustomExt=function(e){if(j.debug("setLoginInfoCustomExt","params:",e),e){if("string"!=typeof e)throw new Error("ext must be a string");if(e.length>1024)throw new Error("ext length must be less than 1024")}this.loginInfoCustomExt=e},r.prototype.onShow=function(){var e=this;j.debug("execute onshow callback",this.lastHeartbeat),!this.logOut&&!this.reconnecting&&Date.now()-this.lastHeartbeat>2e3&&(j.debug("send ping"),this.mSync.sendUnreadDeal(),this.probingTimer&&clearTimeout(this.probingTimer),this.probingTimer=setTimeout((function(){j.error("Websocket connection timeout"),e.logOut||e.reconnecting||e.reconnect(!0)}),8e3))},r.prototype.sendLogout=function(e){void 0===e&&(e="logout");try{var t=this.mSync.generateLogout(e),r=Jt.call(this,t),n=r[0];if(r[1]){var o=this._getSock?this.mSync.base64transform(n):n;this.sock&&1===this.sock.readyState&&this.sock.send(o)}}catch(e){j.error("sendLogout failed",e)}},r._getSock=function(){},r}();function Lc(e,t){var r=t.rpt,n=t.isRetry,o=this.apiUrl+"/"+this.orgName+"/"+this.appName+"/users",i={requestName:E.RESISTER,requestUrl:o},a={headers:{"Content-Type":"application/json"},url:o,dataType:"json",data:JSON.stringify({username:e.username,password:e.password,nickname:e.nickname||""})};return _e.ajax(a,v.SDK_INTERNAL).then((function(e){var t=bc(bc({},e),{type:d.REQUEST_SUCCESS}),o=e.extraInfo,a=o.httpCode,s=o.elapse;return r({isEndApi:!0,isRetry:n,data:bc(bc({},{requestElapse:s,isSuccess:1,code:a}),i)}),t})).catch((function(e){var t=e.extraInfo,o=t.elapse,a=t.httpCode,s=t.errDesc;throw r({isRetry:n,data:bc(bc({},{requestElapse:o,isSuccess:0,code:a,codeDesc:s}),i)}),e}))}function Pc(e,t){return Ac(this,void 0,void 0,(function(){var r,n;return Mc(this,(function(o){switch(o.label){case 0:r=t.rpt,o.label=1;case 1:return o.trys.push([1,3,,7]),[4,Lc.call(this,e,t)];case 2:return[2,o.sent()];case 3:return!((n=o.sent()).message.includes("Open registration doesn't allow")||n.message.includes("username be unique")||n.message.includes("is not legal"))&&this.isHttpDNS&&this.restIndex+1<this.restTotal?(this.restIndex++,Kc.call(this),[4,Pc.call(this,e,{rpt:r})]):[3,5];case 4:return[2,o.sent()];case 5:throw j.error("retry signup failed",n),r({data:{isLastApi:1,isSuccess:0}}),n;case 6:return[3,7];case 7:return[2]}}))}))}function Dc(e,t){var r;return Ac(this,void 0,void 0,(function(){var n,o,i,a,s,c,u,l,d,h=this;return Mc(this,(function(p){switch(p.label){case 0:if(n=Hc.call(this,e))throw n;return j.debug("socket readyState",null===(r=this.sock)||void 0===r?void 0:r.readyState),o=t.rpt,i=t.isRetry,Fc.call(this,e),this.user=e.user,a=this.context.appName,s=this.context.orgName,c=this.apiUrl+"/"+s+"/"+a+"/token",e.accessToken?(j.debug("login with accessToken"),this.grantType="accessToken",this.token=e.accessToken,this.context.accessToken=e.accessToken,this.context.restTokenData=e.accessToken,[2,{accessToken:e.accessToken}]):[3,1];case 1:return e.agoraToken?(j.info("login with agoraToken"),this.grantType="agoraToken",this.token=e.agoraToken,this.context.accessToken=e.agoraToken,this.context.restTokenData=e.agoraToken,[2,{accessToken:e.agoraToken}]):[3,2];case 2:return j.info("login with password"),this.grantType="password",u={grant_type:"password",username:e.user,password:e.pwd,timestamp:+new Date},l=JSON.stringify(u),d={headers:{"Content-Type":"application/json"},url:c,dataType:"json",data:l,version:this.version},j.debug("start get token"),[4,_e.ajax(d,v.SDK_INTERNAL).then((function(e){j.debug("get token success"),h.token=e.access_token,h.context.restTokenData=e.access_token,h.context.accessToken=e.access_token,h.expiresIn=e.expires_in;var t=e.extraInfo,r=t.httpCode,n=t.elapse,a={requestName:E.LOGIN_BY_PWD,requestElapse:n,requestUrl:c,isSuccess:1,code:r};return o({isRetry:i,data:a}),{accessToken:e.access_token,duration:e.expires_in}})).catch((function(e){j.error("get token failed",e);var t=e.extraInfo,r=t.elapse,n=t.httpCode,a=t.errDesc,s={requestName:E.LOGIN_BY_PWD,requestElapse:r,requestUrl:c,isSuccess:0,code:n,codeDesc:a};throw o({isRetry:i,data:s}),e}))];case 3:return[2,p.sent()]}}))}))}function kc(e,t){var r;return Ac(this,void 0,void 0,(function(){var n,o,i;return Mc(this,(function(a){switch(a.label){case 0:n=t.rpt,a.label=1;case 1:return a.trys.push([1,3,,7]),[4,Dc.call(this,e,t)];case 2:return[2,a.sent()];case 3:return"invalid password"!==(o=a.sent()).message&&"user not found"!==o.message&&this.isHttpDNS&&this.restIndex+1<this.restTotal?(this.restIndex++,Kc.call(this),[4,kc.call(this,e,{rpt:n,isRetry:!0})]):[3,5];case 4:return[2,a.sent()];case 5:throw j.error("retry login failed",o),n({data:{isLastApi:1,isSuccess:0}}),this.clear(),i=void 0,o.error&&o.error_description?(i=m.create({type:d.WEBIM_CONNCTION_OPEN_USERGRID_ERROR,message:o.error_description,data:o}),this.onError&&this.onError(i),i):(i=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:null!==(r=o.message)&&void 0!==r?r:"login failed",data:o}),this.onError&&this.onError(i),i);case 6:return[3,7];case 7:return[2]}}))}))}function xc(){var e;j.debug("online"),this.onOnline&&this.onOnline(),null===(e=this.eventHandler)||void 0===e||e.dispatch("onOnline"),this.sock&&1!==this.sock.readyState&&(j.debug("sock.readyState:",this.sock.readyState),this.logOut||this.reconnecting||this.reconnect())}function Bc(){var e,t;j.debug("offline"),null===(e=this.sock)||void 0===e||e.close(),this.onOffline&&this.onOffline(),null===(t=this.eventHandler)||void 0===t||t.dispatch("onOffline")}function Gc(e){var t,r,n;return Ac(this,void 0,void 0,(function(){var o,i,a,s;return Mc(this,(function(c){switch(c.label){case 0:o=(new Date).getTime(),c.label=1;case 1:return c.trys.push([1,3,,7]),[4,jc.call(this,e)];case 2:return i=c.sent(),e&&e({data:{isLastApi:1,isSuccess:1,accessChannel:null===(t=this.socketHost[this.hostIndex])||void 0===t?void 0:t.channel}}),[2,i];case 3:if(a=c.sent(),j.error("connect to msync failed times:",this.retryConnectTimes,a),J.includes(a.type))throw e&&e({data:{isLastApi:1,isSuccess:0,accessChannel:null===(r=this.socketHost[this.hostIndex])||void 0===r?void 0:r.channel,codeDesc:this.disconnectedReason&&JSON.stringify(this.disconnectedReason)||a.message}}),a;return this.retryConnectTimes++,this.retryConnectTimes<3?(this.isHttpDNS&&(this.hostIndex<this.socketHost.length-1?this.hostIndex++:this.hostIndex=this.socketHost.length-1,qc.call(this)),a.type===d.REQUEST_TIMEOUT&&"provision timeout"===a.message||(s=(new Date).getTime()-o,null==e||e({isRetry:1!==this.retryConnectTimes,data:{requestUrl:this.url,requestName:E.CONNECT_WEBSOCKET,isSuccess:0,code:_.closed,requestElapse:s,codeDesc:this.disconnectedReason&&JSON.stringify(this.disconnectedReason)||"websocket close"}})),[4,Gc.call(this,e)]):[3,5];case 4:return c.sent(),[3,6];case 5:throw j.error("connect failed three times",a),e&&e({data:{isLastApi:1,isSuccess:0,accessChannel:null===(n=this.socketHost[this.hostIndex])||void 0===n?void 0:n.channel,codeDesc:this.disconnectedReason&&JSON.stringify(this.disconnectedReason)||a.message}}),a;case 6:return[3,7];case 7:return[2]}}))}))}function jc(e){var t=this,r=(new Date).getTime(),n="pending";return new Promise((function(o,i){var a;t._getSock?void 0===(a=t._getSock()).readyState&&(t.needSetReadyState=!0):(a=new WebSocket(t.url)).binaryType="arraybuffer",t.sock=a,t.connectionTimer&&clearTimeout(t.connectionTimer),t.connectionTimer=setTimeout((function(){t.disconnectedReason={type:d.REQUEST_TIMEOUT,message:"connection timeout"},a.close(),null==i||i(t.disconnectedReason)}),1e4),j.debug("start connect ws",t.url),t.connectionResolve=o,t.connectionReject=i;var s=function(){if(t.connectionTimer&&clearTimeout(t.connectionTimer),j.debug("websocket onOpen"),e){var n=(new Date).getTime()-r;e({isRetry:0!==t.retryConnectTimes,data:{requestUrl:t.url,requestName:E.CONNECT_WEBSOCKET,isSuccess:1,code:_.success,requestElapse:n}})}var o;o=t._getSock?_e.flow([t.mSync.generateProvision,t.mSync.base64transform])():t.mSync.generateProvision();try{t.provisionTimer&&clearTimeout(t.provisionTimer),t.provisionTimer=setTimeout((function(){j.error("provision timeout"),t.disconnectedReason=m.create({type:d.REQUEST_TIMEOUT,message:"provision timeout"}),a.close(),null==i||i(t.disconnectedReason)}),1e4),a.send(o)}catch(e){j.error("send provision message error",e);var s=m.create({type:d.SDK_RUNTIME_ERROR,message:"send message error",data:e});t.onError&&t.onError(s)}},c=function(e){t.connectionTimer&&clearTimeout(t.connectionTimer),setTimeout((function(){var r,o,a,s,c,u,l;if(j.debug("websocket onClose, isLogging:",t._isLogging,e),t.needSetReadyState&&(t.sock=bc(bc({},t.sock),{close:t.sock.close,send:t.sock.send,readyState:3})),t._isLogging)return null==i||i({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"}),void(n="rejected");if("rejected"!==n)if(n="rejected",t.logOut)t.clear(),t.resetConnState(),null===(o=null===(r=null==t?void 0:t._localCache)||void 0===r?void 0:r.getInstance())||void 0===o||o.close(),t.onClosed&&t.onClosed(),null===(a=t.eventHandler)||void 0===a||a.dispatch("onDisconnected",t.disconnectedReason),null==i||i(t.disconnectedReason||{type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"});else if(t.autoReconnectNumTotal<t.autoReconnectNumMax){t.reconnect();var h={type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"};t.onError&&t.onError(h),t.autoReconnectNumTotal%t.refreshDNSIntervals===0&&t.isHttpDNS&&(j.debug("refresh dns config when websocket close"),zc.call(t,(function(){})).catch((function(e){j.error("refresh dns config failed",e)})))}else null===(s=t.unMSyncSendMsgMap)||void 0===s||s.clear(),t.rejectMessage(),h={type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"},t.disconnectedReason=m.create({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"reconnection failed"}),t.onError&&t.onError(h),null===(u=null===(c=null==t?void 0:t._localCache)||void 0===c?void 0:c.getInstance())||void 0===u||u.close(),t.onClosed&&t.onClosed(),null===(l=t.eventHandler)||void 0===l||l.dispatch("onDisconnected",t.disconnectedReason),t.resetConnState(),t.reconnecting=!1,null==i||i(h),j.debug("reconnect fail");else j.debug("reject is null")}),0)},u=function(e){var r=t.mSync,n=r.decodeMSync,o=r.distributeMSync;_e.flow([n,o])(e)};"web"===wc.platform?(a.onopen=s,a.onclose=c,a.onmessage=u):(a.onOpen(s),a.onMessage(u),a.onClose(c),"undefined"!=typeof window&&window.WebSocket||a.onError((function(e){var r,o,a,s;if(t.connectionTimer&&clearTimeout(t.connectionTimer),j.debug("websocket onerror, isLogging:",t._isLogging,e),3!==t.sock.readyState&&(t.sock=bc(bc({},t.sock),{close:t.sock.close,send:t.sock.send,readyState:3})),t.onError&&t.onError({type:d.WEBIM_CONNECTION_ERROR,message:"on socket error",data:e}),t._isLogging)return null==i||i({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"}),void(n="rejected");if("rejected"!==n){if(n="rejected",!t.logOut)if(t.autoReconnectNumTotal<t.autoReconnectNumMax)j.debug("sock.onError reconnect",t.autoReconnectNumTotal,t.autoReconnectNumMax),t.reconnect(),t.autoReconnectNumTotal%t.refreshDNSIntervals===0&&t.isHttpDNS&&(j.debug("refresh dns config when websocket error"),zc.call(t,(function(){})).catch((function(e){j.error("refresh dns config failed",e)})));else{var c={type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"};t.disconnectedReason=m.create({type:d.WEBIM_CONNCTION_DISCONNECTED,message:"reconnection failed"}),null===(r=t.unMSyncSendMsgMap)||void 0===r||r.clear(),t.rejectMessage(),t.onError&&t.onError(c),null===(a=null===(o=null==t?void 0:t._localCache)||void 0===o?void 0:o.getInstance())||void 0===a||a.close(),t.onClosed&&t.onClosed(),null===(s=t.eventHandler)||void 0===s||s.dispatch("onDisconnected",t.disconnectedReason),t.resetConnState(),t.reconnecting=!1,null==i||i(c),j.info("reconnect fail")}}else j.debug("reject is null")})))}))}function Hc(e){if("object"!=typeof e||null===e)return m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the param is illegal"});if(!e.user||"string"!=typeof e.user){var t=m.create({type:d.WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR,message:"the user is empty or type is not string"});return j.debug("open params error",t),t}return!("agoraToken"in e)||e.agoraToken&&"string"==typeof e.agoraToken?!("accessToken"in e)||e.accessToken&&"string"==typeof e.accessToken?"accessToken"in e||"agoraToken"in e||e.pwd?void 0:(t=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the accessToken or pwd is illegal"}),j.debug("open params error",t),t):(t=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the accessToken is illegal"}),j.debug("open params error",t),t):(t=m.create({type:d.WEBIM_CONNCTION_OPEN_ERROR,message:"the agoraToken is illegal"}),j.debug("open params error",t),console.warn("agoraToken is deprecated, please use accessToken instead"),t)}function Fc(e){this.context.jid={appKey:this.appKey,name:e.user,domain:this.domain,clientResource:this.clientResource},this.context.root=this.root,this.context.userId=e.user,this.context.appKey=this.appKey,this.context.appName=this.appName,this.context.orgName=this.orgName}function Wc(e){var t=this,r=e.rpt,n=e.isRetry,o=this.dnsIndex<this.dnsTotal?this.dnsIndex:0,i="".concat(this.dnsArr[o],"/easemob/server.json");j.debug("call getHttpDNS: "+this.dnsIndex);var a={url:i,dataType:"json",type:"GET",data:{}};return this._initWithAppId?a.data={app_id:this.appId,sdk_version:"4.10.0",file_version:"1"}:a.data={app_key:wc.platform===le.WEB?encodeURIComponent(this.appKey):this.appKey},_e.ajax(a,v.SDK_INTERNAL).then((function(e){if(!e)throw m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"get DNS failed"});j.debug("getHttpDNS success");var o=e.rest.hosts,a=t.https?"https":"http";if(t._initWithAppId){if(!e.app_key)throw(c=m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"get DNS failed"})).extraInfo=e.extraInfo,c;t.appKey=e.app_key,t.context.appKey=t.appKey,t.devInfos=t.appKey.split("#"),t.orgName=t.devInfos[0],t.appName=t.devInfos[1],t.dataReport.updateAppKey(t.appKey)}if(!o)throw(c=m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"DNS hosts resolution failed",data:e.rest})).extraInfo=e.extraInfo,c;var s=o.filter((function(e){if(e.protocol===a)return e}));t.restHosts=s,t.restTotal=s.length;var c,u=e["msync-wx"].hosts;if(!u)throw(c=m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"DNS msync-wx resolution failed",data:e["msync-wx"]})).extraInfo=e.extraInfo,c;var l=u.filter((function(e){if(e.protocol===a)return e}));if(t.socketHost=l,t.hostTotal=l.length,t.isHttpDNS&&Kc.call(t),t.isHttpDNS&&qc.call(t),t._reportLogs="true"===e.enableReportLogs,t._reportInterval=Number(e.reportInterval||V),"true"===(null==e?void 0:e.enableDataReport)?(t.dataReport.setIsCollectDt(!0),t.dataReport.setIsReportDt(!0)):(t.dataReport.setIsReportDt(!1),t.dataReport.setIsCollectDt(!1)),"false"===(null==e?void 0:e.uploadinparts_enable)&&(t.uploadPartEnable=!1),void 0!==(null==e?void 0:e.enableMd5Check)&&(t.enableMd5Check="true"===e.enableMd5Check),e.extraInfo){var h=e.extraInfo,p=h.elapse,f=h.httpCode,g={requestUrl:i,requestName:E.GET_DNS,requestElapse:p,isSuccess:1,code:f};r&&r({isRetry:n,data:g})}})).catch((function(e){var t=e.extraInfo||{},o=t.elapse,a=t.httpCode,s=t.errDesc,c={requestUrl:i,requestName:E.GET_DNS,isSuccess:0,code:a,codeDesc:s,requestElapse:o};throw r&&r({isRetry:n,data:c}),m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:e.message,data:e})}))}function zc(e,t){return Ac(this,void 0,void 0,(function(){var r;return Mc(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,6]),[4,Wc.call(this,{rpt:e,isRetry:t})];case 1:case 3:return[2,n.sent()];case 2:return r=n.sent(),j.error("get DNS failed",r,"times:",this.dnsIndex),this.dnsIndex++,this.dnsIndex<this.dnsTotal?[4,zc.call(this,e,!0)]:[3,4];case 4:throw j.error("retryRequestDNS failed"),m.create({type:d.SERVER_GET_DNSLIST_FAILED,message:"get DNS failed",data:r});case 5:return[3,6];case 6:return[2]}}))}))}function qc(){var e=this.socketHost[this.hostIndex],t=e.domain,r=e.ip,n=e.port,o="";o=t||r,n&&"80"!==n&&"443"!==n&&(o+=":"+n),o&&(this.url="//"+o+"/websocket");var i=this.https?"wss:":"ws:";this.url=i+this.url}function Kc(){var e,t;if(this.restIndex>this.restTotal)return j.debug("restIndex > restTotal"),"";var r="",n=this.restHosts[this.restIndex],o=n.domain,i=n.ip,a=n.port,s=this.https?"https:":"http:";return i&&"undefined"!=typeof window&&"http:"===(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.protocol)?r=s+"//"+i+":"+a:(r=s+"//"+o,a&&"80"!==a&&"443"!==a&&(r+=":".concat(a)),"undefined"==typeof window||window.location||(r="https://"+o),"undefined"!=typeof window&&window.location&&"file:"===(null===(t=window.location)||void 0===t?void 0:t.protocol)&&(r="https://"+o)),"undefined"==typeof window&&(r=s+"//"+o),this.apiUrl=r,r}var Vc=_e.getEnvInfo(),Jc=Vc.global;h.util.Long=f(),h.configure();var Yc=h.Root.fromJSON({nested:{easemob:{nested:{pb:{nested:{MessageBody:{fields:{type:{type:"Type",id:1},from:{type:"JID",id:2},to:{type:"JID",id:3},contents:{rule:"repeated",type:"Content",id:4},ext:{rule:"repeated",type:"KeyValue",id:5},ackMessageId:{type:"uint64",id:6},msgConfig:{type:"MessageConfig",id:7},ackContent:{type:"string",id:8},meta:{type:"string",id:9},editMessageId:{type:"uint64",id:11},editScope:{type:"EditScope",id:12},stream:{type:"Stream",id:13}},nested:{Content:{fields:{type:{type:"Type",id:1},text:{type:"string",id:2},latitude:{type:"double",id:3},longitude:{type:"double",id:4},address:{type:"string",id:5},displayName:{type:"string",id:6},remotePath:{type:"string",id:7},secretKey:{type:"string",id:8},fileLength:{type:"int32",id:9},action:{type:"string",id:10},params:{rule:"repeated",type:"KeyValue",id:11},duration:{type:"int32",id:12},size:{type:"Size",id:13},thumbnailRemotePath:{type:"string",id:14},thumbnailSecretKey:{type:"string",id:15},thumbnailDisplayName:{type:"string",id:16},thumbnailFileLength:{type:"int32",id:17},thumbnailSize:{type:"Size",id:18},customEvent:{type:"string",id:19},customExts:{rule:"repeated",type:"KeyValue",id:20},buildingName:{type:"string",id:21},subType:{type:"SubType",id:22},title:{type:"string",id:23},summary:{type:"string",id:24},combineLevel:{type:"int32",id:25},imageType:{type:"int32",id:26}},nested:{Type:{values:{TEXT:0,IMAGE:1,VIDEO:2,LOCATION:3,VOICE:4,FILE:5,COMMAND:6,CUSTOM:7,COMBINE:8}},Size:{fields:{width:{type:"double",id:1},height:{type:"double",id:2}}},SubType:{values:{COMBINE:0,GIF:1,SUB_STREAM:10}}}},Type:{values:{NORMAL:0,CHAT:1,GROUPCHAT:2,CHATROOM:3,READ_ACK:4,DELIVER_ACK:5,RECALL:6,CHANNEL_ACK:7,EDIT:8}},EditScope:{values:{BODY:1,BODY_AND_EXT:2}},MessageConfig:{fields:{allowGroupAck:{type:"bool",id:1}}},Stream:{fields:{streamType:{type:"string",id:1},streamSeq:{type:"uint64",id:2},streamStatus:{type:"StreamStatus",id:3},streamError:{type:"uint32",id:4},streamFinishReason:{type:"int32",id:5}},nested:{StreamStatus:{values:{STREAM_START:0,STREAM_IN_PROGRESS:1,STREAM_COMPLETED:2,STREAM_FULL:3}}}}}},KeyValue:{oneofs:{value:{oneof:["varintValue","floatValue","doubleValue","stringValue"]}},fields:{key:{type:"string",id:1},type:{type:"ValueType",id:2},varintValue:{type:"int64",id:3},floatValue:{type:"float",id:4},doubleValue:{type:"double",id:5},stringValue:{type:"string",id:6}},nested:{ValueType:{values:{BOOL:1,INT:2,UINT:3,LLINT:4,FLOAT:5,DOUBLE:6,STRING:7,JSON_STRING:8}}}},JID:{fields:{appKey:{type:"string",id:1},name:{type:"string",id:2},domain:{type:"string",id:3},clientResource:{type:"string",id:4}}},ConferenceBody:{fields:{sessionId:{type:"string",id:1},operation:{type:"Operation",id:2},conferenceId:{type:"string",id:3},type:{type:"Type",id:4},content:{type:"string",id:5},network:{type:"string",id:6},version:{type:"string",id:7},identity:{type:"Identity",id:8},duration:{type:"string",id:9},peerName:{type:"string",id:10},endReason:{type:"EndReason",id:11},status:{type:"Status",id:12},isDirect:{type:"bool",id:13},controlType:{type:"StreamControlType",id:14},routeFlag:{type:"int32",id:15},routeKey:{type:"string",id:16}},nested:{Status:{fields:{errorCode:{type:"int32",id:1}}},Operation:{values:{JOIN:0,INITIATE:1,ACCEPT_INITIATE:2,ANSWER:3,TERMINATE:4,REMOVE:5,STREAM_CONTROL:6,MEDIA_REQUEST:7}},Type:{values:{VOICE:0,VIDEO:1}},Identity:{values:{CALLER:0,CALLEE:1}},EndReason:{values:{HANGUP:0,NORESPONSE:1,REJECT:2,BUSY:3,FAIL:4,UNSUPPORTED:5,OFFLINE:6}},StreamControlType:{values:{PAUSE_VOICE:0,RESUME_VOICE:1,PAUSE_VIDEO:2,RESUME_VIDEO:3}}}},MSync:{fields:{version:{type:"Version",id:1,options:{default:"MSYNC_V1"}},guid:{type:"JID",id:2},auth:{type:"string",id:3},compressAlgorimth:{type:"uint32",id:4},crypto:{type:"uint32",id:5},userAgent:{type:"string",id:6},pov:{type:"uint64",id:7},command:{type:"Command",id:8},deviceId:{type:"uint32",id:10},encryptType:{rule:"repeated",type:"EncryptType",id:11,options:{packed:!1}},encryptKey:{type:"string",id:12},payload:{type:"bytes",id:9},traceId:{type:"uint64",id:20}},nested:{Version:{values:{MSYNC_V1:0,MSYNC_V2:1}},Command:{values:{SYNC:0,UNREAD:1,NOTICE:2,PROVISION:3,LOGOUT:4}}}},EncryptType:{values:{ENCRYPT_NONE:0,ENCRYPT_AES_128_CBC:1,ENCRYPT_AES_256_CBC:2}},CommSyncUL:{fields:{meta:{type:"Meta",id:1},key:{type:"uint64",id:2},queue:{type:"JID",id:3},isRoam:{type:"bool",id:4},lastFullRoamKey:{type:"uint64",id:5}}},CommSyncDL:{fields:{status:{type:"Status",id:1},metaId:{type:"uint64",id:2},serverId:{type:"uint64",id:3},metas:{rule:"repeated",type:"Meta",id:4},nextKey:{type:"uint64",id:5},queue:{type:"JID",id:6},isLast:{type:"bool",id:7},timestamp:{type:"uint64",id:8},isRoam:{type:"bool",id:9}}},CommNotice:{fields:{queue:{type:"JID",id:1}}},CommUnreadUL:{fields:{}},CommUnreadDL:{fields:{status:{type:"Status",id:1},unread:{rule:"repeated",type:"MetaQueue",id:2},timestamp:{type:"uint64",id:3}}},MetaQueue:{fields:{queue:{type:"JID",id:1},n:{type:"uint32",id:2}}},Meta:{fields:{id:{type:"uint64",id:1},from:{type:"JID",id:2},to:{type:"JID",id:3},timestamp:{type:"uint64",id:4},ns:{type:"NameSpace",id:5},payload:{type:"bytes",id:6},routetype:{type:"RouteType",id:7},ext:{rule:"repeated",type:"KeyValue",id:8},meta:{type:"bytes",id:9},directedUsers:{rule:"repeated",type:"string",id:10},env:{type:"string",id:13}},nested:{NameSpace:{values:{STATISTIC:0,CHAT:1,MUC:2,ROSTER:3,CONFERENCE:4,NOTIFY:5,QUERY:6}},RouteType:{values:{ROUTE_ALL:0,ROUTE_ONLINE:1,ROUTE_DIRECT:2}}}},Status:{fields:{errorCode:{type:"ErrorCode",id:1},reason:{type:"string",id:2},redirectInfo:{rule:"repeated",type:"RedirectInfo",id:3}},nested:{ErrorCode:{values:{OK:0,FAIL:1,UNAUTHORIZED:2,MISSING_PARAMETER:3,WRONG_PARAMETER:4,REDIRECT:5,TOKEN_EXPIRED:6,PERMISSION_DENIED:7,NO_ROUTE:8,UNKNOWN_COMMAND:9,PB_PARSER_ERROR:10,BIND_ANOTHER_DEVICE:11,IM_FORBIDDEN:12,TOO_MANY_DEVICES:13,PLATFORM_LIMIT:14,USER_MUTED:15,ENCRYPT_DISABLE:16,ENCRYPT_ENABLE:17,DECRYPT_FAILURE:18,PERMISSION_DENIED_EXTERNAL:19}}}},RedirectInfo:{fields:{host:{type:"string",id:1},port:{type:"uint32",id:2}}},Provision:{fields:{osType:{type:"OsType",id:1},version:{type:"string",id:2},networkType:{type:"NetworkType",id:3},appSign:{type:"string",id:4},compressType:{rule:"repeated",type:"CompressType",id:5,options:{packed:!1}},encryptType:{rule:"repeated",type:"EncryptType",id:6,options:{packed:!1}},encryptKey:{type:"string",id:7},status:{type:"Status",id:8},deviceUuid:{type:"string",id:9},isManualLogin:{type:"bool",id:10},password:{type:"string",id:11},deviceName:{type:"string",id:12},resource:{type:"string",id:13},auth:{type:"string",id:14},serviceId:{type:"string",id:16},actionVersion:{type:"string",id:17},authToken:{type:"string",id:18},osCustomValue:{type:"uint32",id:19},sessionId:{type:"string",id:20},reason:{type:"string",id:21},protocolCompressType:{rule:"repeated",type:"CompressType",id:22},protocolCompressDirection:{type:"CompressDirection",id:23}},nested:{OsType:{values:{OS_IOS:0,OS_ANDROID:1,OS_LINUX:2,OS_OSX:3,OS_WIN:4,OS_CUSTOM:5,OS_OTHER:16}},NetworkType:{values:{NETWORK_NONE:0,NETWORK_WIFI:1,NETWORK_4G:2,NETWORK_3G:3,NETWORK_2G:4,NETWORK_WIRE:5}},CompressType:{values:{COMPRESS_NONE:0,COMPRESS_ZLIB:1,COMPRESS_LZ4:2}},CompressDirection:{values:{ONLY_UP:0,ONLY_DOWN:1,BI:2}}}},Logout:{fields:{sessionId:{type:"string",id:1},reason:{type:"string",id:2},status:{type:"Status",id:3}}},MUCBody:{fields:{mucId:{type:"JID",id:1},operation:{type:"Operation",id:2},from:{type:"JID",id:3},to:{rule:"repeated",type:"JID",id:4},setting:{type:"Setting",id:5},reason:{type:"string",id:6},isChatroom:{type:"bool",id:7},status:{type:"Status",id:8},isThread:{type:"bool",id:9},mucParentId:{type:"JID",id:10},mucName:{type:"string",id:11},eventInfo:{type:"EventInfo",id:12},mucMemberCount:{type:"int32",id:13},ext:{type:"string",id:14},leaveOtherRooms:{type:"bool",id:15},members:{rule:"repeated",type:"string",id:16}},nested:{Operation:{values:{CREATE:0,DESTROY:1,JOIN:2,LEAVE:3,APPLY:4,APPLY_ACCEPT:5,APPLY_DECLINE:6,INVITE:7,INVITE_ACCEPT:8,INVITE_DECLINE:9,KICK:10,GET_BLACKLIST:11,BAN:12,ALLOW:13,UPDATE:14,BLOCK:15,UNBLOCK:16,PRESENCE:17,ABSENCE:18,DIRECT_JOINED:19,ASSIGN_OWNER:20,ADD_ADMIN:21,REMOVE_ADMIN:22,ADD_MUTE:23,REMOVE_MUTE:24,UPDATE_ANNOUNCEMENT:25,DELETE_ANNOUNCEMENT:26,UPLOAD_FILE:27,DELETE_FILE:28,ADD_USER_WHITE_LIST:29,REMOVE_USER_WHITE_LIST:30,BAN_GROUP:31,REMOVE_BAN_GROUP:32,THREAD_CREATE:33,THREAD_DESTROY:34,THREAD_JOIN:35,THREAD_LEAVE:36,THREAD_KICK:37,THREAD_UPDATE:38,THREAD_PRESENCE:39,THREAD_ABSENCE:40,DISABLE_GROUP:41,ABLE_GROUP:42,SET_METADATA:43,DELETE_METADATA:44,GROUP_MEMBER_METADATA_UPDATE:45}},Setting:{fields:{name:{type:"string",id:1},desc:{type:"string",id:2},type:{type:"Type",id:3},maxUsers:{type:"int32",id:4},owner:{type:"string",id:5}},nested:{Type:{values:{PRIVATE_OWNER_INVITE:0,PRIVATE_MEMBER_INVITE:1,PUBLIC_JOIN_APPROVAL:2,PUBLIC_JOIN_OPEN:3,PUBLIC_ANONYMOUS:4}}}},Status:{fields:{errorCode:{type:"ErrorCode",id:1},description:{type:"string",id:2},chatroomInfo:{type:"string",id:3}},nested:{ErrorCode:{values:{OK:0,PERMISSION_DENIED:1,WRONG_PARAMETER:2,MUC_NOT_EXIST:3,USER_NOT_EXIST:4,UNKNOWN:5}}}},EventInfo:{fields:{eventType:{type:"EventType",id:1,options:{default:"EVENT_NONE"}},ext:{type:"string",id:2}},nested:{EventType:{values:{EVENT_NONE:0,CIRCLE_CHANNEL:1}}}}}},RosterBody:{fields:{operation:{type:"Operation",id:1},status:{type:"Status",id:2},from:{type:"JID",id:3},to:{rule:"repeated",type:"JID",id:4},reason:{type:"string",id:5},rosterVer:{type:"string",id:6},biDirection:{type:"bool",id:7}},nested:{Operation:{values:{GET_ROSTER:0,GET_BLACKLIST:1,ADD:2,REMOVE:3,ACCEPT:4,DECLINE:5,BAN:6,ALLOW:7,REMOTE_ACCEPT:8,REMOTE_DECLINE:9}},Status:{fields:{errorCode:{type:"ErrorCode",id:1},description:{type:"string",id:2}},nested:{ErrorCode:{values:{OK:0,USER_NOT_EXIST:1,USER_ALREADY_FRIEND:2,USER_ALREADY_BLACKLIST:3}}}}}},StatisticsBody:{fields:{operation:{type:"Operation",id:1},os:{type:"OsType",id:2},version:{type:"string",id:3},network:{type:"NetworkType",id:4},imTime:{type:"uint32",id:5},chatTime:{type:"uint32",id:6},location:{type:"string",id:7},reason:{type:"string",id:10}},nested:{Operation:{values:{INFORMATION:0,USER_REMOVED:1,USER_LOGIN_ANOTHER_DEVICE:2,USER_KICKED_BY_CHANGE_PASSWORD:3,USER_KICKED_BY_OTHER_DEVICE:4}},OsType:{values:{OS_IOS:0,OS_ANDROID:1,OS_LINUX:2,OS_OSX:3,OS_WIN:4,OS_CUSTOM:5,OS_OTHER:16}},NetworkType:{values:{NETWORK_NONE:0,NETWORK_WIFI:1,NETWORK_4G:2,NETWORK_3G:3,NETWORK_2G:4,NETWORK_WIRE:5}}}}}}}}}});Uc.prototype.root=Yc;var Xc=function(e){this.onOpen=Jc.onSocketOpen,this.onClose=Jc.onSocketClose,this.onMessage=Jc.onSocketMessage,this.onError=Jc.onSocketError,this.close=Jc.closeSocket,this.send=Jc.sendSocketMessage,this.connectSocket=Jc.connectSocket,this.readyState=void 0,this.offSocketOpen=Jc.offSocketOpen,this.offSocketMessage=Jc.offSocketMessage,this.offSocketError=Jc.offSocketError,this.offSocketClose=Jc.offSocketClose,this.connect=function(){this.offSocketOpen(),this.offSocketMessage(),this.offSocketClose(),this.offSocketError(),Jc.connectSocket({url:e.url,header:{"content-type":"application/json"},success:function(e){},fail:function(){}})}};Uc.prototype._getSock=function(){var e,t=this;return this.sock&&this.sock.close&&this.sock.close(),(e="zfb"===Vc.platform||"dd"===Vc.platform?new Xc(this):Jc.connectSocket({url:this.url,header:{"content-type":"application/json"},success:function(e){j.debug("socket connect success",e)},fail:function(e){j.debug("socket connect fail",e),t.reconnecting=!1,e.errMsg.indexOf("suspend")},complete:function(){}})).connect&&e.connect(),e},Uc.prototype.getUniqueId=_e.getUniqueId,Uc.prototype.deviceId="miniProgram_"+Vc.platform,Uc.prototype._localCache=void 0;var Qc=j.getLogger("defaultLogger");Qc.setConfig({useCache:!1,maxCache:3145728}),Qc.enableAll(),_e.ajax=_e.wxRequest;var Zc={connection:Uc,message:Ye,utils:_e,logger:Qc,statusCode:d}}(),n.default}()}));
|