!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()}(self,(function(){return function(){var e={188:function(e,t,r){var o,n,i;!function(a){"use strict";if(null!=t&&"number"!=typeof t.nodeType)e.exports=a();else if(null!=r.amdO)n=[],void 0===(i="function"==typeof(o=a)?o.apply(t,n):o)||(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 o,n,i=String(r),a=0,s=e,c="";i.charAt(0|a)||(s="=",a%1);c+=s.charAt(63&o>>8-a%1*8)){if((n=i.charCodeAt(a+=3/4))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return c},atob:function(r){var o=String(r).replace(/[=]+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,a=0,s=0,c="";i=o.charAt(s++);~i&&(n=a%4?64*n+i:i,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)i=e.indexOf(i);return c}}}))},720: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 o(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=o;var n={},i={};function a(e,t){var r,o,a;return t?(a=0<=(e>>>=0)&&e<256)&&(o=i[e])?o:(r=c(e,(0|e)<0?-1:0,!0),a&&(i[e]=r),r):(a=-128<=(e|=0)&&e<128)&&(o=n[e])?o:(r=c(e,e<0?-1:0,!1),a&&(n[e]=r),r)}function s(e,t){if(isNaN(e))return t?E:g;if(t){if(e<0)return E;if(e>=h)return R}else{if(e<=-f)return O;if(e+1>=f)return _}return e<0?s(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,o){return new r(e,t,o)}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||360)throw Error("interior hyphen");if(0===o)return l(e.substring(1),t,r).neg();for(var n=s(u(r,8)),i=g,a=0;a>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},I.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((i=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.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&&0==(e&1<=0},I.isOdd=function(){return 1==(1&this.low)},I.isEven=function(){return 0==(1&this.low)},I.equals=function(e){return o(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.ne=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.le=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.ge=I.greaterThanOrEqual,I.compare=function(e){if(o(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},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(y)},I.neg=I.negate,I.add=function(e){o(e)||(e=d(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,a=e.high>>>16,s=65535&e.high,u=e.low>>>16,l=0,p=0,h=0,f=0;return h+=(f+=i+(65535&e.low))>>>16,p+=(h+=n+u)>>>16,l+=(p+=r+s)>>>16,l+=t+a,c((h&=65535)<<16|(f&=65535),(l&=65535)<<16|(p&=65535),this.unsigned)},I.subtract=function(e){return o(e)||(e=d(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){if(this.isZero())return g;if(o(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,n=65535&this.high,i=this.low>>>16,a=65535&this.low,u=e.high>>>16,l=65535&e.high,p=e.low>>>16,h=65535&e.low,f=0,E=0,y=0,v=0;return y+=(v+=a*h)>>>16,E+=(y+=i*h)>>>16,y&=65535,E+=(y+=a*p)>>>16,f+=(E+=n*h)>>>16,E&=65535,f+=(E+=i*p)>>>16,E&=65535,f+=(E+=a*l)>>>16,f+=r*h+n*p+i*l+a*u,c((y&=65535)<<16|(v&=65535),(f&=65535)<<16|(E&=65535),this.unsigned)},I.mul=I.multiply,I.divide=function(e){if(o(e)||(e=d(e)),e.isZero())throw Error("division by zero");var r,n,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?E:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return E;if(e.gt(this.shru(1)))return v;i=E}else{if(this.eq(O))return e.eq(y)||e.eq(T)?O:e.eq(O)?y:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?y:T:(n=this.sub(e.mul(r)),i=r.add(n.div(e)));if(e.eq(O))return this.unsigned?E: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(n=this;n.gte(e);){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),l=a<=48?1:u(2,a-48),p=s(r),h=p.mul(e);h.isNegative()||h.gt(n);)h=(p=s(r-=l,this.unsigned)).mul(e);p.isZero()&&(p=y),i=i.add(p),n=n.sub(h)}return i},I.div=I.divide,I.modulo=function(e){return o(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))},I.mod=I.modulo,I.rem=I.modulo,I.not=function(){return c(~this.low,~this.high,this.unsigned)},I.and=function(e){return o(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return o(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return o(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<>>32-e,this.unsigned):c(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){if(o(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)},I.shru=I.shiftRightUnsigned,I.shr_u=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.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]},I.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,o){return o?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)}},969: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],o=0;o1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),o=new Array(123),n=0;n<64;)o[r[n]=n<26?n+65:n<52?n+71:n<62?n-4:n-59|43]=n++;t.encode=function(e,t,o){for(var n,i=null,a=[],s=0,c=0;t>2],n=(3&u)<<4,c=1;break;case 1:a[s++]=r[n|u>>4],n=(15&u)<<2,c=2;break;case 2:a[s++]=r[n|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[n],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 n,a=r,s=0,c=0;c1)break;if(void 0===(u=o[u]))throw Error(i);switch(s){case 0:n=u,s=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,s=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,s=3;break;case 3:t[r++]=(3&n)<<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)}},72:function(e){e.exports=o;var t,r=/\/|\./;function o(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),o[e]=t}o("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),o("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),o("timestamp",{Timestamp:t}),o("empty",{Empty:{fields:{}}}),o("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}}}}),o("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}}}}),o("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),o.get=function(e){return o[e]||null}},525:function(e,t,r){var o,n,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 o){for(var d=l?s[r][u]:s[r],p=e.resolvedType.values,h=Object.keys(p),f=0;f>>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":n.Long?l?a[r][u]=n.Long.fromValue(s[r][u]).unsigned=m:a[r]=n.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 n.LongBits(s[r][u].low>>>0,s[r][u].high>>>0).toNumber(m):a[r]=new n.LongBits(s[r].low>>>0,s[r].high>>>0).toNumber(m));break;case"bytes":"string"==typeof(l?s[r][u]:s[r])?l?n.base64.decode(s[r][u],a[r][u]=n.newBuffer(n.base64.length(s[r][u])),0):n.base64.decode(s[r],a[r]=n.newBuffer(n.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 o?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 p=!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":p=!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?n.Long.prototype.toString.call(a[r][u]):l.longs===Number?new n.LongBits(a[r][u].low>>>0,a[r][u].high>>>0).toNumber(p):a[r][u]:s[r]=l.longs===String?n.Long.prototype.toString.call(a[r]):l.longs===Number?new n.LongBits(a[r].low>>>0,a[r].high>>>0).toNumber(p):a[r];break;case"bytes":d?s[r][u]=l.bytes===String?n.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?n.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(){o=r(582),n=r(935)},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>>3,m=0,g=!1;m>>0).fork().uint32(8|n.mapKey[l.keyType])[l.keyType](m[g]),void 0===h?i[d].encode(f[m[g]],s.uint32(18).fork()).ldelim().ldelim():s.uint32(16|h)[p](f[m[g]]).ldelim()}else if(l.repeated){if(f&&f.length)if(l.packed&&void 0!==n.packed[p]){s.uint32((l.id<<3|2)>>>0).fork();for(var E=0;E>>0)).uint32((l.id<<3|4)>>>0):i[d].encode(f[y],s.uint32((l.id<<3|2)>>>0).fork()).ldelim():s.uint32((l.id<<3|h)>>>0)[p](f[y])}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===h?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|h)>>>0)[p](f))}return s}}}e.exports=i,i._configure=function(){o=r(582),n=r(696)}},582:function(e,t,r){e.exports=i;var o=r(998);((i.prototype=Object.create(o.prototype)).constructor=i).className="Enum";var n=r(476);function i(e,t,r,n,i){if(o.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=n,this.comments=i||{},this.reserved=void 0,t)for(var a=Object.keys(t),s=0;s0?0:2147483648,r,o);else if(isNaN(t))e(2143289344,r,o);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,r,o);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,r,o);else{var i=Math.floor(Math.log(t)/Math.LN2);e((n<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,o)}}function a(e,t,r){var o=e(t,r),n=2*(o>>31)+1,i=o>>>23&255,a=8388607&o;return 255===i?a?NaN:n*(1/0):0===i?1401298464324817e-60*n*a:n*Math.pow(2,i-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,o),e.readFloatLE=a.bind(null,n),e.readFloatBE=a.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),o=128===r[7];function n(e,o,n){t[0]=e,o[n]=r[0],o[n+1]=r[1],o[n+2]=r[2],o[n+3]=r[3],o[n+4]=r[4],o[n+5]=r[5],o[n+6]=r[6],o[n+7]=r[7]}function i(e,o,n){t[0]=e,o[n]=r[7],o[n+1]=r[6],o[n+2]=r[5],o[n+3]=r[4],o[n+4]=r[3],o[n+5]=r[2],o[n+6]=r[1],o[n+7]=r[0]}function a(e,o){return r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],r[3]=e[o+3],r[4]=e[o+4],r[5]=e[o+5],r[6]=e[o+6],r[7]=e[o+7],t[0]}function s(e,o){return r[7]=e[o],r[6]=e[o+1],r[5]=e[o+2],r[4]=e[o+3],r[3]=e[o+4],r[2]=e[o+5],r[1]=e[o+6],r[0]=e[o+7],t[0]}e.writeDoubleLE=o?n:i,e.writeDoubleBE=o?i:n,e.readDoubleLE=o?a:s,e.readDoubleBE=o?s:a}():function(){function t(e,t,r,o,n,i){var a=o<0?1:0;if(a&&(o=-o),0===o)e(0,n,i+t),e(1/o>0?0:2147483648,n,i+r);else if(isNaN(o))e(0,n,i+t),e(2146959360,n,i+r);else if(o>17976931348623157e292)e(0,n,i+t),e((a<<31|2146435072)>>>0,n,i+r);else{var s;if(o<22250738585072014e-324)e((s=o/5e-324)>>>0,n,i+t),e((a<<31|s/4294967296)>>>0,n,i+r);else{var c=Math.floor(Math.log(o)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(s=o*Math.pow(2,-c))>>>0,n,i+t),e((a<<31|c+1023<<20|1048576*s&1048575)>>>0,n,i+r)}}}function a(e,t,r,o,n){var i=e(o,n+t),a=e(o,n+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,o,4,0),e.readDoubleLE=a.bind(null,n,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 o(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 n(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)},939: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 o(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=o;var n={},i={};function a(e,t){var r,o,a;return t?(a=0<=(e>>>=0)&&e<256)&&(o=i[e])?o:(r=c(e,(0|e)<0?-1:0,!0),a&&(i[e]=r),r):(a=-128<=(e|=0)&&e<128)&&(o=n[e])?o:(r=c(e,e<0?-1:0,!1),a&&(n[e]=r),r)}function s(e,t){if(isNaN(e))return t?E:g;if(t){if(e<0)return E;if(e>=h)return R}else{if(e<=-f)return O;if(e+1>=f)return _}return e<0?s(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,o){return new r(e,t,o)}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||360)throw Error("interior hyphen");if(0===o)return l(e.substring(1),t,r).neg();for(var n=s(u(r,8)),i=g,a=0;a>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},I.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((i=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.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&&0==(e&1<=0},I.isOdd=function(){return 1==(1&this.low)},I.isEven=function(){return 0==(1&this.low)},I.equals=function(e){return o(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.ne=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.le=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.ge=I.greaterThanOrEqual,I.compare=function(e){if(o(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},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(y)},I.neg=I.negate,I.add=function(e){o(e)||(e=d(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,a=e.high>>>16,s=65535&e.high,u=e.low>>>16,l=0,p=0,h=0,f=0;return h+=(f+=i+(65535&e.low))>>>16,p+=(h+=n+u)>>>16,l+=(p+=r+s)>>>16,l+=t+a,c((h&=65535)<<16|(f&=65535),(l&=65535)<<16|(p&=65535),this.unsigned)},I.subtract=function(e){return o(e)||(e=d(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){if(this.isZero())return g;if(o(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,n=65535&this.high,i=this.low>>>16,a=65535&this.low,u=e.high>>>16,l=65535&e.high,p=e.low>>>16,h=65535&e.low,f=0,E=0,y=0,v=0;return y+=(v+=a*h)>>>16,E+=(y+=i*h)>>>16,y&=65535,E+=(y+=a*p)>>>16,f+=(E+=n*h)>>>16,E&=65535,f+=(E+=i*p)>>>16,E&=65535,f+=(E+=a*l)>>>16,f+=r*h+n*p+i*l+a*u,c((y&=65535)<<16|(v&=65535),(f&=65535)<<16|(E&=65535),this.unsigned)},I.mul=I.multiply,I.divide=function(e){if(o(e)||(e=d(e)),e.isZero())throw Error("division by zero");var r,n,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?E:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return E;if(e.gt(this.shru(1)))return v;i=E}else{if(this.eq(O))return e.eq(y)||e.eq(T)?O:e.eq(O)?y:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?y:T:(n=this.sub(e.mul(r)),i=r.add(n.div(e)));if(e.eq(O))return this.unsigned?E: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(n=this;n.gte(e);){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),l=a<=48?1:u(2,a-48),p=s(r),h=p.mul(e);h.isNegative()||h.gt(n);)h=(p=s(r-=l,this.unsigned)).mul(e);p.isZero()&&(p=y),i=i.add(p),n=n.sub(h)}return i},I.div=I.divide,I.modulo=function(e){return o(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))},I.mod=I.modulo,I.rem=I.modulo,I.not=function(){return c(~this.low,~this.high,this.unsigned)},I.and=function(e){return o(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return o(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return o(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<>>32-e,this.unsigned):c(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){if(o(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)},I.shru=I.shiftRightUnsigned,I.shr_u=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.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]},I.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,o){return o?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)}},365:function(e,t,r){e.exports=n;var o=r(935);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var i=n.zero=new n(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var a=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return i;var t=e<0;t&&(e=-e);var r=e>>>0,o=(e-r)/4294967296>>>0;return t&&(o=~o>>>0,r=~r>>>0,++r>4294967295&&(r=0,++o>4294967295&&(o=0))),new n(r,o)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if("string"==typeof e||e instanceof String){if(!o.Long)return n.fromNumber(parseInt(e,10));e=o.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):i},n.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},n.prototype.toLong=function(e){return o.Long?new o.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;n.fromHash=function(e){return e===a?i:new n((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)},n.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)},n.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},n.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},n.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}},435:function(e,t,r){e.exports=a;var o,n,i=r(286);function a(e,t,r,o,a,s){if(i.call(this,e,t,o,void 0,void 0,a,s),!n.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 n.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===o.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=n.decorateType(r).name:r&&"object"==typeof r&&(r=n.decorateEnum(r).name),function(o,i){n.decorateType(o.constructor).add(new a(i,e,t,r))}},a._configure=function(){o=r(696),n=r(935)}},339:function(e,t,r){"use strict";var o;function n(e){if(e)for(var t=Object.keys(e),r=0;r=t)return!0;return!1},l.isReservedName=function(e,t){if(e)for(var r=0;r0;){var o=e.shift();if(r.nested&&r.nested[o]){if(!((r=r.nested[o])instanceof l))throw Error("path conflicts with non-namespace objects")}else r.add(r=new l(o))}return t&&r.addJSON(t),r},l.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t-1)return o}else if(o instanceof l&&(o=o.lookup(e.slice(1),t,!0)))return o}else for(var n=0;n-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");var o=U();if(!_.test(o))throw H(o,"name");k("=");var n=new s(B(o),K(U()),t,r);X(n,(function(e){if("option"!==e)throw H(e);Q(n,e),k(";")}),(function(){ee(n)})),e.add(n)}(r);break;case"required":case"optional":case"repeated":Y(r,e);break;case"oneof":!function(e,t){if(!_.test(t=U()))throw H(t,"name");var r=new c(B(t));X(r,(function(e){"option"===e?(Q(r,e),k(";")):(P(e),Y(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||!R.test(e))throw H(e);P(e),Y(r,"optional")}})),e.add(r)}(e,t),!0;case"enum":return function(e,t){if(!_.test(t=U()))throw H(t,"name");var r=new u(t);X(r,(function(e){switch(e){case"option":Q(r,e),k(";");break;case"reserved":W(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!_.test(t))throw H(t,"name");k("=");var r=K(U(),!0),o={};X(o,(function(e){if("option"!==e)throw H(e);Q(o,e),k(";")}),(function(){ee(o)})),e.add(t,r,o.comment)}(r,e)}})),e.add(r)}(e,t),!0;case"service":return function(e,t){if(!_.test(t=U()))throw H(t,"service name");var r=new l(t);X(r,(function(e){if(!J(r,e)){if("rpc"!==e)throw H(e);!function(e,t){var r=t;if(!_.test(t=U()))throw H(t,"name");var o,n,i,a,s=t;if(k("("),k("stream",!0)&&(n=!0),!R.test(t=U()))throw H(t);if(o=t,k(")"),k("returns"),k("("),k("stream",!0)&&(a=!0),!R.test(t=U()))throw H(t);i=t,k(")");var c=new d(s,r,o,i,n,a);X(c,(function(e){if("option"!==e)throw H(e);Q(c,e),k(";")})),e.add(c)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!R.test(t=U()))throw H(t,"reference");var r=t;X(null,(function(t){switch(t){case"required":case"repeated":case"optional":Y(e,t,r);break;default:if(!x||!R.test(t))throw H(t);P(t),Y(e,"optional",r)}}))}(e,t),!0}return!1}function X(e,t,r){var o=b.line;if(e&&(e.comment=L(),e.filename=I.filename),k("{",!0)){for(var n;"}"!==(n=U());)t(n);k(";",!0)}else r&&r(),k(";"),e&&"string"!=typeof e.comment&&(e.comment=L(o))}function Y(e,t,r){var o=U();if("group"!==o){if(!R.test(o))throw H(o,"type");var n=U();if(!_.test(n))throw H(n,"name");n=B(n),k("=");var s=new a(n,K(U()),o,t,r);X(s,(function(e){if("option"!==e)throw H(e);Q(s,e),k(";")}),(function(){ee(s)})),e.add(s),x||!s.repeated||void 0===p.packed[o]&&void 0!==p.basic[o]||s.setOption("packed",!1,!0)}else!function(e,t){var r=U();if(!_.test(r))throw H(r,"name");var o=h.lcFirst(r);r===o&&(r=h.ucFirst(r)),k("=");var n=K(U()),s=new i(r);s.group=!0;var c=new a(o,n,r,t);c.filename=I.filename,X(s,(function(e){switch(e){case"option":Q(s,e),k(";");break;case"required":case"optional":case"repeated":Y(s,e);break;default:throw H(e)}})),e.add(s).add(c)}(e,t)}function Q(e,t){var r=k("(",!0);if(!R.test(t=U()))throw H(t,"name");var o=t;r&&(k(")"),o="("+o+")",t=w(),O.test(t)&&(o+=t,U())),k("="),Z(e,o)}function Z(e,t){if(k("{",!0))do{if(!_.test(M=U()))throw H(M,"name");"{"===w()?Z(e,t+"."+M):(k(":"),"{"===w()?Z(e,t+"."+M):$(e,t+"."+M,F(!0)))}while(!k("}",!0));else $(e,t,F(!0))}function $(e,t,r){e.setOption&&e.setOption(t,r)}function ee(e){if(k("[",!0)){do{Q(e,"option")}while(k(",",!0));k("]")}return e}for(;null!==(M=U());)switch(M){case"package":if(!D)throw H(M);q();break;case"import":if(!D)throw H(M);z();break;case"syntax":if(!D)throw H(M);V();break;case"option":if(!D)throw H(M);Q(G,M),k(";");break;default:if(J(G,M)){D=!1;continue}throw H(M)}return I.filename=null,{package:S,imports:C,weakImports:N,syntax:A,root:t}}I._configure=function(){o=r(869),n=r(685),i=r(192),a=r(286),s=r(435),c=r(735),u=r(582),l=r(447),d=r(484),p=r(696),h=r(935)}},444:function(e){var t=e.exports,r=t.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},o=t.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),o=r(e),n="";o&&(n=t.shift()+"/");for(var i=0;i0&&".."!==t[i-1]?t.splice(--i,2):o?t.splice(i,1):++i:"."===t[i]?t.splice(i,1):++i;return n+t.join("/")};t.resolve=function(e,t,n){return n||(t=o(t)),r(t)?t:(n||(e=o(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?o(e+"/"+t):t)}},997:function(e){e.exports=function(e,t,r){var o=r||8192,n=o>>>1,i=null,a=o;return function(r){if(r<1||r>n)return e(r);a+r>o&&(i=e(o),a=0);var s=t.call(i,a,a+=r);return 7&a&&(a=1+(7|a)),s}}},494:function(e,t,r){e.exports=s;var o,n,i=r(935);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&&console.warn(""),new s(new Uint8Array(e)))}:function(e){if(Array.isArray(e))return new s(e)};function l(){var e=new o(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 p(){if(this.pos+8>this.len)throw a(this,8);return new o(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)|0},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 n.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(){o=r(365),n=r(498);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 p.call(this)[e](!0)},sfixed64:function(){return p.call(this)[e](!1)}})}},685:function(e,t,r){e.exports=d;var o=r(476);((d.prototype=Object.create(o.prototype)).constructor=d).className="Root";var n,i,a,s=r(286),c=r(582),u=r(735),l=r(935);function d(e){o.call(this,"",e),this.deferred=[],this.files=[],this.names=[]}function p(){}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,o){"function"==typeof r&&(o=r,r=void 0);var n=this;if(!o)return l.asPromise(e,n,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(o){var r=o;o=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 o,a=i(t,n,r),s=0;if(a.imports)for(;s-1||(n.names.push(e),e in a&&u(e,a[e]))}u(s.name,s.pbJsonStr)},d.prototype.load=function e(t,r,o){"function"==typeof r&&(o=r,r=void 0);var n=this;if(!o)return l.asPromise(e,n,t,r);var s=o===p;function c(e,t){if(o){var r=o;if(o=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 o,a=i(t,n,r),u=0;if(a.imports)for(;u-1){var i=e.substring(r);i in a&&(e=i)}if(!(n.files.indexOf(e)>-1))if(n.files.push(e),e in a)s?u(e,a[e]):(++h,setTimeout((function(){--h,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++h,l.fetch(e,(function(r,i){--h,o&&(r?t?h||c(null,n):c(r):u(e,i))}))}var h=0;l.isString(t)&&(t=[t]);for(var f,m=0;m-1&&this.deferred.splice(t,1)}}else if(e instanceof c)h.test(e.name)&&delete e.parent[e.name];else if(e instanceof o){for(var r=0;r]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,o=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,n=/^ *[*/]+ */,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,p=1,h=null,f=null,m=0,g=!1,E=[],y=null;function v(e){return Error("illegal "+e+" (line "+p+")")}function T(t){return e.charAt(t)}function _(t,r){h=e.charAt(t++),m=p,g=!1;var o,s=t-(c?2:3);do{if(--s<0||"\n"===(o=e.charAt(s))){g=!0;break}}while(" "===o||"\t"===o);for(var u=e.substring(t,r).split(a),l=0;l0)return E.shift();if(y)return function(){var t="'"===y?o:r;t.lastIndex=u-1;var n=t.exec(e);if(!n)throw v("string");return u=t.lastIndex,S(y),y=null,l(n[1])}();var n,i,a,h,f;do{if(u===d)return null;for(n=!1;s.test(a=T(u));)if("\n"===a&&++p,++u===d)return null;if("/"===T(u)){if(++u===d)throw v("comment");if("/"===T(u))if(c){if(h=u,f=!1,R(u)){f=!0;do{if((u=O(u))===d)break;u++}while(R(u))}else u=Math.min(d,O(u)+1);f&&_(h,u),p++,n=!0}else{for(f="/"===T(h=u+1);"\n"!==T(++u);)if(u===d)return null;++u,f&&_(h,u-1),++p,n=!0}else{if("*"!==(a=T(u)))return"/";h=u+1,f=c||"*"===T(h);do{if("\n"===a&&++p,++u===d)throw v("comment");i=a,a=T(u)}while("*"!==i||"/"!==a);++u,f&&_(h,u-2),n=!0}}}while(n);var m=u;if(t.lastIndex=0,!t.test(T(m++)))for(;m-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}}}(this._oneofsArray[r].oneof);o[n]={get:a.getter,set:a.setter}}r&&Object.defineProperties(e.prototype,o)}}}),y.generateConstructor=function(e){return function(t){for(var r,o=0;o191&&o<224?i[a++]=(31&o)<<6|63&e[t++]:o>239&&o<365?(o=((7&o)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[a++]=55296+(o>>10),i[a++]=56320+(1023&o)):i[a++]=(15&o)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,i)),a=0);return n?(a&&n.push(String.fromCharCode.apply(String,i.slice(0,a))),n.join("")):String.fromCharCode.apply(String,i.slice(0,a))},t.write=function(e,t,r){for(var o,n,i=r,a=0;a>6|192,t[r++]=63&o|128):55296==(64512&o)&&56320==(64512&(n=e.charCodeAt(a+1)))?(o=65536+((1023&o)<<10)+(1023&n),++a,t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=63&o|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=63&o|128);return r-i}},935:function(e,t,r){var o=e.exports,n=r(889);o.LongBits=r(365),o.Long=r(939),o.pool=r(997),o.float=r(283),o.asPromise=r(728),o.EventEmitter=r(969),o.path=r(444),o.base64=r(440),o.utf8=r(498),o.compareFieldsById=function(e,t){return e.id-t.id},o.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),o=0;o-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},o.oneOfSetter=function(e){return function(t){for(var r=0;r=65536&&r<=1114111?(o.push(r>>18&7|240),o.push(r>>12&63|128),o.push(r>>6&63|128),o.push(63&r|128)):r>=2048&&r<=65535?(o.push(r>>12&15|224),o.push(r>>6&63|128),o.push(63&r|128)):r>=128&&r<=2047?(o.push(r>>6&31|192),o.push(63&r|128)):o.push(255&r);return o},o.byteToString=function(e){if("string"==typeof e)return e;for(var t="",r=e,o=0;o>>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 h(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=n.Buffer?function(){return(u.create=function(){return new(void 0)})()}:function(){return new u},u.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(u.alloc=n.pool(u.alloc,n.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(p,10,o.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=o.from(e);return this._push(p,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(p,t.length(),t)},u.prototype.bool=function(e){return this._push(l,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(h,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=o.from(e);return this._push(h,4,t.lo)._push(h,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var f=n.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var o=0;o>>0;if(!t)return this._push(l,1,0);if(n.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(){o=r(365),r(440),i=r(498)}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](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 o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};return function(){"use strict";r.r(o),r.d(o,{default:function(){return As}});var e={};r.r(e),r.d(e,{acceptContactInvite:function(){return ao},acceptInvitation:function(){return io},addContact:function(){return ro},addConversationMark:function(){return wo},addReaction:function(){return yo},addToBlackList:function(){return uo},addUsersToBlacklist:function(){return lo},addUsersToBlocklist:function(){return po},declineContactInvite:function(){return co},declineInvitation:function(){return so},deleteAllMessagesAndConversations:function(){return xo},deleteContact:function(){return no},deleteConversation:function(){return Vr},deleteReaction:function(){return vo},deleteSession:function(){return zr},fetchHistoryMessages:function(){return $r},fetchUserInfoById:function(){return Yr},getAllContacts:function(){return bo},getBlacklist:function(){return xr},getBlocklist:function(){return Gr},getContacts:function(){return Hr},getContactsWithCursor:function(){return Uo},getConversationlist:function(){return Kr},getHistoryMessages:function(){return to},getReactionDetail:function(){return Ro},getReactionList:function(){return To},getReactionlist:function(){return _o},getRoster:function(){return Br},getSelfIdsOnOtherPlatform:function(){return Do},getServerConversations:function(){return So},getServerConversationsByFilter:function(){return Lo},getServerPinnedConversations:function(){return No},getServerPinnedMessages:function(){return jo},getSessionList:function(){return Wr},getTokenExpireTimestamp:function(){return Zr},modifyMessage:function(){return Eo},pinConversation:function(){return Ao},pinMessage:function(){return Bo},recallMessage:function(){return go},removeConversationMark:function(){return ko},removeFromBlackList:function(){return ho},removeHistoryMessages:function(){return Io},removeRoster:function(){return oo},removeUserFromBlackList:function(){return fo},removeUserFromBlocklist:function(){return mo},reportMessage:function(){return Oo},setContactRemark:function(){return Mo},unbindPushToken:function(){return Fo},unpinMessage:function(){return Ho},updateCurrentUserNick:function(){return Qr},updateOwnUserInfo:function(){return Jr},updateUserInfo:function(){return Xr},uploadPushToken:function(){return Fr},uploadToken:function(){return jr}});var t={};r.r(t),r.d(t,{acceptGroupInvite:function(){return On},acceptGroupJoinRequest:function(){return vn},addUsersToGroupAllowlist:function(){return Qn},addUsersToGroupWhitelist:function(){return Yn},agreeInviteIntoGroup:function(){return Rn},agreeJoinGroup:function(){return yn},blockGroup:function(){return Vo},blockGroupMember:function(){return Gn},blockGroupMembers:function(){return Hn},blockGroupMessages:function(){return Jo},changeGroupOwner:function(){return en},changeOwner:function(){return $o},createGroup:function(){return zo},createGroupNew:function(){return qo},deleteGroupSharedFile:function(){return di},destroyGroup:function(){return pn},disableSendGroupMsg:function(){return Jn},dissolveGroup:function(){return dn},downloadGroupSharedFile:function(){return fi},enableSendGroupMsg:function(){return Xn},fetchGroupAnnouncement:function(){return ci},fetchGroupSharedFileList:function(){return pi},getGroup:function(){return Qo},getGroupAdmin:function(){return an},getGroupAllowlist:function(){return ri},getGroupBlacklist:function(){return zn},getGroupBlacklistNew:function(){return qn},getGroupBlocklist:function(){return Vn},getGroupInfo:function(){return tn},getGroupMemberAttributes:function(){return gi},getGroupMembersAttributes:function(){return Ei},getGroupMsgReadUser:function(){return si},getGroupMuteList:function(){return Ln},getGroupMutelist:function(){return Dn},getGroupSharedFilelist:function(){return hi},getGroupWhitelist:function(){return ti},getJoinedGroups:function(){return Zo},getMuted:function(){return kn},getPublicGroups:function(){return Yo},groupBlockMulti:function(){return Bn},groupBlockSingle:function(){return xn},inviteToGroup:function(){return mn},inviteUsersToGroup:function(){return gn},isGroupWhiteUser:function(){return oi},isInGroupAllowlist:function(){return ii},isInGroupMutelist:function(){return ai},isInGroupWhiteList:function(){return ni},joinGroup:function(){return En},leaveGroup:function(){return fn},listGroupMember:function(){return on},listGroupMembers:function(){return nn},listGroups:function(){return Xo},modifyGroup:function(){return rn},mute:function(){return bn},muteGroupMember:function(){return Un},quitGroup:function(){return hn},rejectGroupInvite:function(){return Sn},rejectGroupJoinRequest:function(){return _n},rejectInviteIntoGroup:function(){return In},rejectJoinGroup:function(){return Tn},removeAdmin:function(){return un},removeGroupAdmin:function(){return ln},removeGroupAllowlistMember:function(){return ei},removeGroupBlockMulti:function(){return Wn},removeGroupBlockSingle:function(){return jn},removeGroupMember:function(){return Nn},removeGroupMembers:function(){return Mn},removeGroupWhitelistMember:function(){return $n},removeMultiGroupMember:function(){return An},removeMute:function(){return Pn},removeSingleGroupMember:function(){return Cn},rmUsersFromGroupWhitelist:function(){return Zn},setAdmin:function(){return sn},setGroupAdmin:function(){return cn},setGroupMemberAttributes:function(){return mi},unblockGroupMember:function(){return Fn},unblockGroupMembers:function(){return Kn},unmuteGroupMember:function(){return wn},updateGroupAnnouncement:function(){return ui},uploadGroupSharedFile:function(){return li}});var n={};r.r(n),r.d(n,{addUsersToChatRoom:function(){return Ni},addUsersToChatRoomAllowlist:function(){return ra},addUsersToChatRoomWhitelist:function(){return ta},blockChatRoomMember:function(){return Wi},blockChatRoomMembers:function(){return qi},chatRoomBlockMulti:function(){return Ki},chatRoomBlockSingle:function(){return Fi},createChatRoom:function(){return vi},deleteChatRoomSharedFile:function(){return fa},destroyChatRoom:function(){return Ti},disableSendChatRoomMsg:function(){return $i},enableSendChatRoomMsg:function(){return ea},fetchChatRoomAnnouncement:function(){return da},fetchChatRoomSharedFileList:function(){return ma},getChatRoomAdmin:function(){return wi},getChatRoomAllowlist:function(){return sa},getChatRoomAttributes:function(){return Ea},getChatRoomBlacklist:function(){return Qi},getChatRoomBlacklistNew:function(){return Yi},getChatRoomBlocklist:function(){return Zi},getChatRoomDetails:function(){return _i},getChatRoomMuteList:function(){return Hi},getChatRoomMuted:function(){return Bi},getChatRoomMutelist:function(){return ji},getChatRoomSharedFilelist:function(){return ga},getChatRoomWhitelist:function(){return aa},getChatRooms:function(){return yi},getJoinedChatRooms:function(){return Ra},isChatRoomWhiteUser:function(){return ca},isInChatRoomAllowlist:function(){return ua},isInChatRoomMutelist:function(){return la},joinChatRoom:function(){return Ai},leaveChatRoom:function(){return bi},listChatRoomMember:function(){return Ui},listChatRoomMembers:function(){return Pi},modifyChatRoom:function(){return Ri},muteChatRoomMember:function(){return Di},quitChatRoom:function(){return Mi},removeChatRoomAdmin:function(){return Li},removeChatRoomAllowlistMember:function(){return ia},removeChatRoomAttribute:function(){return _a},removeChatRoomAttributes:function(){return Ta},removeChatRoomBlockMulti:function(){return Ji},removeChatRoomBlockSingle:function(){return zi},removeChatRoomMember:function(){return Ii},removeChatRoomMembers:function(){return Ci},removeChatRoomWhitelistMember:function(){return na},removeMultiChatRoomMember:function(){return Si},removeMuteChatRoomMember:function(){return xi},removeSingleChatRoomMember:function(){return Oi},rmUsersFromChatRoomWhitelist:function(){return oa},setChatRoomAdmin:function(){return ki},setChatRoomAttribute:function(){return va},setChatRoomAttributes:function(){return ya},unblockChatRoomMember:function(){return Vi},unblockChatRoomMembers:function(){return Xi},unmuteChatRoomMember:function(){return Gi},updateChatRoomAnnouncement:function(){return pa},uploadChatRoomSharedFile:function(){return ha}});var i={};r.r(i),r.d(i,{getPresenceStatus:function(){return ba},getSubscribedPresenceList:function(){return Aa},getSubscribedPresencelist:function(){return Ma},publishPresence:function(){return Sa},subscribePresence:function(){return Ca},unsubscribePresence:function(){return Na}});var a={};r.r(a),r.d(a,{clearRemindTypeForConversation:function(){return ka},getPushPerformLanguage:function(){return Ga},getSilentModeForAll:function(){return Pa},getSilentModeForConversation:function(){return La},getSilentModeForConversations:function(){return Da},getSilentModeRemindTypeConversations:function(){return Ba},setPushPerformLanguage:function(){return xa},setSilentModeForAll:function(){return Ua},setSilentModeForConversation:function(){return wa}});var s={};r.r(s),r.d(s,{changeChatThreadName:function(){return za},createChatThread:function(){return Fa},destroyChatThread:function(){return qa},getChatThreadDetail:function(){return $a},getChatThreadLastMessage:function(){return Qa},getChatThreadMembers:function(){return Va},getChatThreads:function(){return Ya},getJoinedChatThreads:function(){return Xa},joinChatThread:function(){return Wa},leaveChatThread:function(){return Ka},removeChatThreadMember:function(){return Ja}});var c={};r.r(c),r.d(c,{getSupportedLanguages:function(){return es},translateMessage:function(){return ts}});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(244),u.encoder=r(929),u.Reader=r(494),u.util=r(935),u.rpc=r(325),u.roots=r(889),u.verifier=r(216),u.tokenize=r(869),u.parse=r(845),u.common=r(72),u.ReflectionObject=r(998),u.Namespace=r(476),u.Root=r(685),u.Enum=r(582),u.Type=r(192),u.Field=r(286),u.OneOf=r(735),u.MapField=r(435),u.Service=r(447),u.Method=r(484),u.converter=r(525),u.decoder=r(888),u.Message=r(339),u.wrappers=r(834),u.types=r(696),u.util=r(935),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,p=u,h=r(720),f=r.n(h),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.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_NOT_FRIEND=221]="USER_NOT_FRIEND",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.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.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,E,y,v,T,_,R=function(){return R=Object.assign||function(e){for(var t,r=1,o=arguments.length;r0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]o;)a.push(n.substring(0,o)),i-=o,n=n.substring(o);a.push(n),s=0,c=a,d.label=1;case 1:if(!(s=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=o)){if(r0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]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:E.REST_UPLOAD_FILE_IN_PARTS})}return e.prototype.init=function(){var e,t,r,o;return te(this,void 0,void 0,(function(){var n,i,a,s,c,u,l,p,h,f,m,g,E,v,T;return re(this,(function(_){switch(_.label){case 0:return _.trys.push([0,4,,6]),[4,Q.call(this.connection)];case 1:return n=_.sent(),i=n.data||{},a=i.fileMaxSize,s=void 0===a?0:a,c=i.partMinSize,u=void 0===c?H:c,l=i.uuid,p=void 0===l?"":l,h=n.extraInfo,g=h.elapse,E=h.httpCode,T=h.url,this.partSize=u,this.uuid=p,F.size=u,B.debug("multipartInit success","uuid: ".concat(p),"fileMaxSize: ".concat(s),"partMinSize: ".concat(u)),this.file.size>s?[4,this.multipartAbort()]:[3,3];case 2:return _.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:T,requestName:y.REST_INIT_UPLOAD_TASK_IN_PARTS,requestElapse:g,requestMethod:"POST",isSuccess:1,code:E}}),this.upload(),[3,6];case 4:return f=_.sent(),m=(null==f?void 0:f.extraInfo)||{},g=m.elapse,E=m.httpCode,v=m.errDesc,T=m.url,this.rpt({data:{requestUrl:T,requestName:y.REST_INIT_UPLOAD_TASK_IN_PARTS,requestElapse:g,requestMethod:"POST",isSuccess:0,codeDesc:v,code:E}}),[4,this.multipartAbort()];case 5:return _.sent(),null===(o=null===(r=this.options)||void 0===r?void 0:r.onInitFail)||void 0===o||o.call(r),[3,6];case 6:return[2]}}))}))},e.prototype.upload=function(){var e,t,r;return te(this,void 0,void 0,(function(){var o,n,i,a,s,c,u=this;return re(this,(function(l){switch(l.label){case 0:(new FileReader).readAsArrayBuffer(this.file),o=this.file.size,n=Math.ceil(o/this.partSize),l.label=1;case 1:l.trys.push([1,7,,9]),i=function(t){var r,n,i,s;return re(this,(function(c){switch(c.label){case 0:return r=t*a.partSize,n=Math.min(o,r+a.partSize),i=null===(e=a.file)||void 0===e?void 0:e.slice(r,n),(s=Z.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,o=t.httpCode,n=t.url;u.rpt({data:{requestUrl:n,requestName:y.REST_UPLOAD_PART,requestElapse:r,isSuccess:1,requestMethod:"PUT",code:o}}),u.handleTask(s)})),s.catch((function(e){var t=(null==e?void 0:e.extraInfo)||{},r=t.elapse,o=t.httpCode,n=t.url,i=t.errDesc;u.rpt({data:{requestUrl:n,requestName:y.REST_UPLOAD_PART,requestElapse:r,isSuccess:0,requestMethod:"PUT",code:o,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 s0?"&":"?")+(p?p+"&":p)+"_v="+(new Date).getTime(),l=null,p=""}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){return o.dataReport&&t&&t!==E.SDK_INTERNAL&&o.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:ie({isSuccess:1,requestUrl:e.url,requestName:t,requestMethod:e.type},ye(r.extraInfo))}),t===E.SDK_INTERNAL&&(r.extraInfo.url=e.url),t!==E.SDK_INTERNAL&&delete r.extraInfo,"Object"===ce(r)?ie(ie({},r),{type:d.REQUEST_SUCCESS}):{data:r,type:d.REQUEST_SUCCESS}})).catch((function(n){var i,a;if(o.dataReport&&t&&t!==E.SDK_INTERNAL&&o.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:ie({isSuccess:0,requestUrl:e.url,requestName:t,requestMethod:e.type},ye(n.extraInfo))}),t===E.SDK_INTERNAL)if(n.extraInfo)n.extraInfo.url=e.url;else{var s={elapse:(new Date).getTime()-r,httpCode:null!==(a=null===(i=n.xhr)||void 0===i?void 0:i.status)&&void 0!==a?a:0,url:e.url};n.extraInfo=s}throw t!==E.SDK_INTERNAL&&delete n.extraInfo,n})):ue.call(this,e,t)}function ce(e){return Object.prototype.toString.call(e).slice(8,-1)}function ue(e,t){var r=this;return new Promise((function(r,o){var n=e.success||ae,i=e.error||ae,a=e.type||"POST",s=e.data||null,c="",u=(new Date).getTime(),l=_e.getEnvInfo();if("get"===a.toLowerCase()&&s){for(var p in s)s.hasOwnProperty(p)&&(c+=p+"="+s[p]+"&");c=c?c.slice(0,-1):c,e.url+=(e.url.indexOf("?")>0?"&":"?")+(c?c+"&":c)+"_v="+(new Date).getTime(),s=null,c=""}var h={url:e.url,data:e.data,method:a,headers:{},timeout:K,success:function(e){var a,s,c,l,d,p={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=p;var h=e.data;n(h),r(h)}else e.extraInfo=p,i(h=e),o(h),B.debug(t,"reject reason: ",h)},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 o({type:d.REQUEST_TIMEOUT,message:"Request Timeout",extraInfo:r}),void i({type:d.REQUEST_TIMEOUT,message:"Request Timeout",extraInfo:r});i(e),o(e),B.error(t,"fail reason:",e)}};if("zfb"===l.platform||"dd"===l.platform?h.headers=e.headers:h.header=e.headers,"dd"===l.platform)return dd.httpRequest(h);l.global.request(h)})).then((function(o){return r.dataReport&&t&&t!==E.SDK_INTERNAL&&r.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:ie({isSuccess:1,requestUrl:e.url,requestName:t,requestMethod:e.type},ye(o.extraInfo))}),t!==E.SDK_INTERNAL&&delete o.extraInfo,"Object"===ce(o)?ie(ie({},o),{type:d.REQUEST_SUCCESS}):{data:o,type:d.REQUEST_SUCCESS}})).catch((function(o){throw r.dataReport&&t&&t!==E.SDK_INTERNAL&&r.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:ie({isSuccess:0,requestUrl:e.url,requestName:t,requestMethod:e.type},ye(o.extraInfo))}),t!==E.SDK_INTERNAL&&delete o.extraInfo,o}))}function le(e,t){var r;return function(){for(var o=[],n=0;n1.5*h?new oe(this,{file:null===(n=null==e?void 0:e.file)||void 0===n?void 0:n.data,onFileUploadProgress:e.onFileUploadProgress||ae,onFileUploadComplete:e.onFileUploadComplete||ae,onFileUploadError:e.onFileUploadError||ae,onFileUploadCanceled:e.onFileUploadCanceled||ae,onInitFail:function(){ne.call(i,ie(ie({},e),{orgName:l,appName:p,operateName:t}))},thumbnailInfo:{width:e.thumbnailWidth,height:e.thumbnailHeight}}):ne.call(this,ie(ie({},e),{orgName:l,appName:p,operateName:t}))}else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_ERROR,message:"AppKey illegal"});else e.onFileUploadError&&e.onFileUploadError({type:d.WEBIM_UPLOADFILE_NO_LOGIN,message:"AccessToken cannot be empty"})}function Ee(e,t){e.onFileDownloadComplete=e.onFileDownloadComplete||ae,e.onFileDownloadError=e.onFileDownloadError||ae;var r=(new Date).getTime(),o=new XMLHttpRequest,n=this;o.addEventListener("load",(function(i){var a=(new Date).getTime()-r;n.dataReport&&t&&t===E.DOWN_GROUP_FILE&&n.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:{isSuccess:200===o.status?1:0,requestMethod:"POST",requestName:t,requestElapse:a,requestUrl:null==e?void 0:e.url,code:o.status,codeDesc:200===o.status?"":"download file error"}}),e.onFileDownloadComplete&&e.onFileDownloadComplete(o.response)}),!1),o.addEventListener("error",(function(i){var a=(new Date).getTime()-r;n.dataReport&&t&&t===E.DOWN_GROUP_FILE&&n.dataReport.geOperateFun({operationName:t})({isEndApi:!0,data:{isSuccess:0,requestMethod:"POST",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 i=e.method||"GET",a=e.responseType||"blob",s=e.mimeType||"text/plain; charset=x-user-defined";o.open(i,e.url),"undefined"!=typeof Blob?o.responseType=a:o.overrideMimeType(s);var c={"X-Requested-With":"XMLHttpRequest",Accept:"application/octet-stream","share-secret":e.secret,Authorization:"Bearer "+this.context.accessToken},u=e.headers||{};for(var l in u)c[l]=u[l];for(var l in c)c[l]&&o.setRequestHeader(l,c[l]);o.send(null)}function ye(e){void 0===e&&(e={});var t=e.elapse,r=void 0===t?0:t,o=e.httpCode,n=void 0===o?0:o,i=e.errDesc;return{requestElapse:r,code:n,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"}(de||(de={}));var ve,Te="localDeviceInfo",_e={autoIncrement:0,ajaxUnconventionalErrorTimes:0,ajax:se,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 o=r.files;if(o.length>0){var n=o.item(0);t.data=n,t.url=window.URL.createObjectURL(n),t.filename=(null==n?void 0:n.name)||""}}else{if("string"!=typeof e)throw Error("in IE fileInputId must be string");n=document.getElementById(e).value,t.url=n;var i=n.lastIndexOf("/"),a=n.lastIndexOf("\\"),s=Math.max(i,a);t.filename=s<0?n:n.substring(s+1)}var c=t.filename.lastIndexOf(".");return-1!==c&&(t.filetype=t.filename.substring(c+1).toLowerCase()),t},uploadFile:ge,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=[],o=0;oObject.prototype.toString.call(e).indexOf("Blob")?this.url+"?token=":window.URL.createObjectURL(e)},download:Ee,parseNotify:function(e){for(var t="",r=0;r0?setTimeout((function(){i(t-1)}),r||1e3):n(e)}))};i(t||3)}))},formatAttachUrl:function(e){return e&&"string"==typeof e?"".concat(this.apiUrl).concat(e.substr(e.indexOf("/",9))):""},Uint8ArrayToString:function(e){for(var t="",r=0;r0?d.bodies[0]:{},m={},g={},E=d.type?d.type:h.indexOf("@conference.easemob.com")>-1?"groupChat":"singleChat";E="chat"===E?"singleChat":E,u&&d.type&&(E=Se[d.type]);var y="";switch(f.type){case"txt":if(Object.prototype.hasOwnProperty.call(f,"subType")&&"sub_combine"===f.subType)y=Xe.call(this,{remotePath:null==f?void 0:f.url,secret:null==f?void 0:f.secret}),m={id:l,type:"combine",chatType:E,to:d.to,from:d.from,ext:d.ext,time:p,title:f.title||"",summary:f.summary||"",url:y||"",secret:f.secret||"",file_length:f.file_length||0,filename:f.filename||"",compatibleText:f.msg,combineLevel:f.combineLevel||0};else{var v=null===(r=null==d?void 0:d.meta)||void 0===r?void 0:r.edit_msg;if(m={id:l,type:"txt",chatType:E,msg:f.msg||"",to:d.to||"",from:d.from,time:p,ext:d.ext},v){var T=v.edit_time,_=v.operator,R=v.count;m.modifiedInfo={operationTime:T,operatorId:_,operationCount:R}}}break;case"img":y=this.useOwnUploadFun?null==f?void 0:f.url:Xe.call(this,{remotePath:null==f?void 0:f.url,secret:null==f?void 0:f.secret}),m={id:l,type:"img",chatType:E,to:d.to,from:d.from,time:p,ext:d.ext,width:(null===(o=f.size)||void 0===o?void 0:o.width)||0,height:(null===(n=f.size)||void 0===n?void 0:n.height)||0,thumb:this.useOwnUploadFun?"":"".concat(y,"&thumbnail=true"),thumb_secret:f.secret,secret:f.secret||"",url:y||"",file_length:f.file_length||0,file:{}};break;case"video":y=this.useOwnUploadFun?null==f?void 0:f.url:Xe.call(this,{remotePath:null==f?void 0:f.url,secret:null==f?void 0:f.secret}),m={id:l,type:"video",chatType:E,from:d.from,to:d.to,thumb:_e.formatAttachUrl.call(this,f.thumb),thumb_secret:f.thumb_secret||"",url:y||"",secret:f.secret||"",filename:f.filename,length:f.length||0,file:{},file_length:f.file_length||0,filetype:d.ext.file_type||"",ext:d.ext,time:p};break;case"loc":m={id:l,type:"loc",chatType:E,from:d.from,to:d.to,buildingName:f.buildingName||"",addr:f.addr,lat:f.lat,lng:f.lng,ext:d.ext,time:p};break;case"audio":y=this.useOwnUploadFun?null==f?void 0:f.url:Xe.call(this,{remotePath:null==f?void 0:f.url,secret:null==f?void 0:f.secret}),m={id:l,type:"audio",chatType:E,from:d.from,to:d.to,secret:f.secret||"",ext:d.ext,time:p,url:y||"",file:{},filename:f.filename,length:f.length||0,file_length:f.file_length||0,filetype:d.ext.file_type||""};break;case"file":y=this.useOwnUploadFun?null==f?void 0:f.url:Xe.call(this,{remotePath:null==f?void 0:f.url,secret:null==f?void 0:f.secret}),m={id:l,type:"file",chatType:E,from:d.from,to:d.to,ext:d.ext,time:p,url:y||"",secret:f.secret||"",file:{},filename:f.filename||"",file_length:f.file_length||0,filetype:d.ext.file_type||""};break;case"cmd":m={id:l,type:"cmd",chatType:E,from:d.from,to:d.to,ext:d.ext,time:p,action:f.action||""};break;case"custom":var O=f.customExts||{};s&&f.customExts&&(O={},f.customExts.map((function(e){O=Ie(Ie({},O),e)}))),m={id:l,type:"custom",chatType:E,from:d.from,to:d.to,ext:d.ext,time:p,customEvent:f.customEvent||"",customExts:O};break;case"combine":y=Xe.call(this,{remotePath:null==f?void 0:f.url,secret:null==f?void 0:f.secret}),m={id:l,type:"combine",chatType:E,msg:f.msg||"",to:d.to||"",from:d.from,time:p,ext:d.ext,title:f.title||"",summary:f.summary||"",url:y||"",compatibleText:f.text,combineLevel:f.combineLevel||0,secret:f.secret||"",filename:f.filename||"",file_length:f.file_length||0};break;default:B.error("unexpected message: ".concat(e))}if(d.msgConfig&&(g.msgConfig=d.msgConfig),null==d?void 0:d.meta){var I=d.meta;I.thread&&(g.chatThread={messageId:I.thread.msg_parent_id,parentId:I.thread.muc_parent_id,chatThreadName:I.thread.thread_name}),I.reaction&&(g.reactions=I.reaction),I.translations&&(g.translations=I.translations)}return Ie(Ie({},m),g)}var Ne,Ae=function(e){return"".concat(e.conversationType,"-").concat(e.conversationId)},Me=function(e){var t=e.isRecallSelfMsg,r=e.conversation,o=e.recalledMsgTime,n=r.unReadCount,i=void 0===n?0:n,a=r.unreadCountClearTimestamp;return t||(void 0===a?0:a)>o?i:i&&i>0?i-1:0},be=function(e){var t,r=0;if(0===e.length)return r;for(t=0;t0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]0,X=A.errorCode,Y=A.reason,Q={},Z=[],$=[],ee={},te="",re=0,oe=null,ne=null,M.ext&&(Q=Je(M.ext)),M.meta&&"string"==typeof M.meta&&((ae=JSON.parse(M.meta)).reaction&&(Z=ae.reaction).forEach((function(e){e.isAddedBySelf=e.state,delete e.state})),ae.translations&&($=ae.translations),ae.edit_msg&&(se=ae.edit_msg,ce=se.count,ue=se.operator,le=se.edit_time,de=se.sender,pe=se.send_time,ee={operationTime:le,operatorId:ue,operationCount:ce},te=de,re=pe),ae.thread&&"{}"!==JSON.stringify(ae.thread)&&(oe={messageId:ae.thread.msg_parent_id,parentId:ae.thread.muc_parent_id,chatThreadName:ae.thread.thread_name}),ae.thread_overview&&"{}"!==JSON.stringify(ae.thread_overview)&&(ne={id:ae.thread_overview.id,parentId:ae.thread_overview.muc_parent_id,name:ae.thread_overview.name,lastMessage:ae.thread_overview.last_message&&"{}"!==JSON.stringify(ae.thread_overview.last_message)?Ce.call(this,ae.thread_overview.last_message):null,createTimestamp:ae.thread_overview.create_timestamp,updateTimestamp:ae.thread_overview.update_timestamp,messageCount:ae.thread_overview.message_count||0})),b.type){case 0:return[3,1];case 1:return[3,7];case 2:return[3,10];case 3:return[3,13];case 4:return[3,16];case 5:return[3,19];case 6:return[3,22];case 7:return[3,23];case 8:return[3,26]}return[3,27];case 1:return Object.prototype.hasOwnProperty.call(b,"subType")&&0===b.subType?(ie=Xe.call(this,b),he={id:U,type:"combine",chatType:x,to:k,from:w,ext:Q,time:Number(L),onlineState:D,title:b.title||"",summary:b.summary||"",url:ie||"",secret:b.secretKey||"",file_length:b.fileLength||0,filename:b.displayName||"",compatibleText:b.text,combineLevel:b.combineLevel||0},z.msgConfig&&(he.msgConfig=z.msgConfig),Z.length>0&&(he.reactions=Z),oe&&(he.chatThread=oe),ne&&(he.chatThreadOverview=ne),"chatRoom"===x&&(he.priority=H,he.broadcast=W),q&&(he.isContentReplaced=q),V=he,G?[3,3]:[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(he,Ne.SUCCESS)]):[3,4];case 2:be.sent(),null===(o=this.eventHandler)||void 0===o||o.dispatch("onCombineMessage",he),be.label=3;case 3:return[3,28];case 4:return!(z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,data:b.text,ext:Q,sourceMsg:b.text,time:L,msgConfig:M.msgConfig,onlineState:D}).msgConfig&&delete M.msgConfig,z.error=J,z.errorText=Y,z.errorCode=X,!G&&this.onTextMessage&&this.onTextMessage(z),fe={id:U,type:"txt",chatType:x,msg:b.text,to:k,from:w,ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(fe.msgConfig=z.msgConfig),Z.length>0&&(fe.reactions=Z),oe&&(fe.chatThread=oe),ne&&(fe.chatThreadOverview=ne),$.length>0&&(fe.translations=$),ee.operationCount>0&&(fe.modifiedInfo=ee,M.type===Ot.EDIT&&(fe.from=te,fe.time=re)),"chatRoom"===x&&(fe.priority=H,fe.broadcast=W),q&&(fe.isContentReplaced=q),V=fe,G?[3,6]:[4,null===(i=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===i?void 0:i.storeMessage(fe,Ne.SUCCESS)];case 5:be.sent(),null===(a=this.eventHandler)||void 0===a||a.dispatch("onTextMessage",fe),be.label=6;case 6:return[3,28];case 7:return me=(null===(s=null==b?void 0:b.size)||void 0===s?void 0:s.width)||0,ge=(null===(c=null==b?void 0:b.size)||void 0===c?void 0:c.height)||0,ie=this.useOwnUploadFun?b.remotePath:Xe.call(this,b),!(z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,url:ie,secret:b.secretKey,filename:b.displayName,thumb:this.useOwnUploadFun?"":"".concat(ie,"&thumbnail=true"),thumb_secret:b.secretKey,file_length:b.fileLength||"",width:me,height:ge,filetype:b.filetype||"",accessToken:this.token,ext:Q,time:L,msgConfig:M.msgConfig,onlineState:D}).delay&&delete z.delay,!z.msgConfig&&delete M.msgConfig,z.error=J,z.errorText=Y,z.errorCode=X,!G&&this.onPictureMessage&&this.onPictureMessage(z),Ee={id:U,type:"img",chatType:x,from:w,to:k,url:ie||"",width:me,height:ge,secret:b.secretKey||"",thumb:this.useOwnUploadFun?"":"".concat(ie,"&thumbnail=true"),thumb_secret:b.secretKey,file_length:b.fileLength||0,ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(Ee.msgConfig=z.msgConfig),Z.length>0&&(Ee.reactions=Z),oe&&(Ee.chatThread=oe),ne&&(Ee.chatThreadOverview=ne),"chatRoom"===x&&(Ee.priority=H,Ee.broadcast=W),q&&(Ee.isContentReplaced=q),V=Ee,G?[3,9]:[4,null===(l=null===(u=this._localCache)||void 0===u?void 0:u.getInstance())||void 0===l?void 0:l.storeMessage(Ee,Ne.SUCCESS)];case 8:be.sent(),null===(d=this.eventHandler)||void 0===d||d.dispatch("onImageMessage",Ee),be.label=9;case 9:return[3,28];case 10:return ie=this.useOwnUploadFun?b.remotePath:Xe.call(this,b),!(z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,url:ie,secret:b.secretKey,filename:b.displayName,length:b.duration||"",file_length:b.fileLength||"",filetype:b.filetype||"",accessToken:this.token||"",ext:Q,time:L,msgConfig:M.msgConfig,onlineState:D}).delay&&delete z.delay,!z.msgConfig&&delete M.msgConfig,z.error=J,z.errorText=Y,z.errorCode=X,!G&&this.onVideoMessage&&this.onVideoMessage(z),ye={id:U,type:"video",chatType:x,from:w,to:k,url:ie,secret:b.secretKey,thumb:_e.formatAttachUrl.call(this,b.thumbnailRemotePath),thumb_secret:b.thumbnailSecretKey,filename:b.displayName,length:b.duration||0,file:{},file_length:b.fileLength||0,filetype:b.filetype||"",accessToken:this.token||"",ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(ye.msgConfig=z.msgConfig),Z.length>0&&(ye.reactions=Z),oe&&(ye.chatThread=oe),ne&&(ye.chatThreadOverview=ne),"chatRoom"===x&&(ye.priority=H,ye.broadcast=W),q&&(ye.isContentReplaced=q),V=ye,G?[3,12]:[4,null===(h=null===(p=this._localCache)||void 0===p?void 0:p.getInstance())||void 0===h?void 0:h.storeMessage(ye,Ne.SUCCESS)];case 11:be.sent(),null===(f=this.eventHandler)||void 0===f||f.dispatch("onVideoMessage",ye),be.label=12;case 12:return[3,28];case 13:return!(z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,addr:b.address,buildingName:b.buildingName,lat:b.latitude,lng:b.longitude,ext:Q,time:L,msgConfig:M.msgConfig,onlineState:D}).delay&&delete z.delay,!z.msgConfig&&delete M.msgConfig,z.error=J,z.errorText=Y,z.errorCode=X,!G&&this.onLocationMessage&&this.onLocationMessage(z),ve={id:U,type:"loc",chatType:x,from:w,to:k,buildingName:b.buildingName,addr:b.address,lat:b.latitude,lng:b.longitude,ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(ve.msgConfig=z.msgConfig),Z.length>0&&(ve.reactions=Z),oe&&(ve.chatThread=oe),ne&&(ve.chatThreadOverview=ne),"chatRoom"===x&&(ve.priority=H,ve.broadcast=W),q&&(ve.isContentReplaced=q),V=ve,G?[3,15]:[4,null===(g=null===(m=this._localCache)||void 0===m?void 0:m.getInstance())||void 0===g?void 0:g.storeMessage(ve,Ne.SUCCESS)];case 14:be.sent(),null===(E=this.eventHandler)||void 0===E||E.dispatch("onLocationMessage",ve),be.label=15;case 15:return[3,28];case 16:return ie=this.useOwnUploadFun?b.remotePath:Xe.call(this,b),!(z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,url:ie,secret:b.secretKey,filename:b.displayName,file_length:b.fileLength||"",accessToken:this.token||"",ext:Q,length:b.duration,time:L,msgConfig:M.msgConfig,onlineState:D}).delay&&delete z.delay,!z.msgConfig&&delete M.msgConfig,z.error=J,z.errorText=Y,z.errorCode=X,!G&&this.onAudioMessage&&this.onAudioMessage(z),Te={id:U,type:"audio",chatType:x,from:w,to:k,url:ie,secret:b.secretKey,file:{},filename:b.displayName,length:b.duration||0,file_length:b.fileLength||0,filetype:b.filetype||"",accessToken:this.token||"",ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(Te.msgConfig=z.msgConfig),Z.length>0&&(Te.reactions=Z),oe&&(Te.chatThread=oe),ne&&(Te.chatThreadOverview=ne),"chatRoom"===x&&(Te.priority=H,Te.broadcast=W),q&&(Te.isContentReplaced=q),V=Te,G?[3,18]:[4,null===(v=null===(y=this._localCache)||void 0===y?void 0:y.getInstance())||void 0===v?void 0:v.storeMessage(Te,Ne.SUCCESS)];case 17:be.sent(),null===(T=this.eventHandler)||void 0===T||T.dispatch("onAudioMessage",Te),be.label=18;case 18:return[3,28];case 19:return ie=this.useOwnUploadFun?b.remotePath:Xe.call(this,b),!(z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,url:ie,secret:b.secretKey,filename:b.displayName,file_length:b.fileLength,accessToken:this.token||"",ext:Q,time:L,msgConfig:M.msgConfig,onlineState:D}).delay&&delete z.delay,!z.msgConfig&&delete M.msgConfig,z.error=J,z.errorText=Y,z.errorCode=X,!G&&this.onFileMessage&&this.onFileMessage(z),Re={id:U,type:"file",chatType:x,from:w,to:k,url:ie,secret:b.secretKey,file:{},filename:b.displayName,length:b.duration||0,file_length:b.fileLength||0,filetype:b.filetype||"",accessToken:this.token||"",ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(Re.msgConfig=z.msgConfig),Z.length>0&&(Re.reactions=Z),oe&&(Re.chatThread=oe),ne&&(Re.chatThreadOverview=ne),"chatRoom"===x&&(Re.priority=H,Re.broadcast=W),q&&(Re.isContentReplaced=q),V=Re,G?[3,21]:[4,null===(R=null===(_=this._localCache)||void 0===_?void 0:_.getInstance())||void 0===R?void 0:R.storeMessage(Re,Ne.SUCCESS)];case 20:be.sent(),null===(O=this.eventHandler)||void 0===O||O.dispatch("onFileMessage",Re),be.label=21;case 21:return[3,28];case 22:return!(z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,action:b.action,ext:Q,time:L,msgConfig:M.msgConfig,onlineState:D}).msgConfig&&delete M.msgConfig,z.error=J,z.errorText=Y,z.errorCode=X,!G&&this.onCmdMessage&&this.onCmdMessage(z),Oe={id:U,type:"cmd",chatType:x,from:w,to:k,action:b.action,ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(Oe.msgConfig=z.msgConfig),Z.length>0&&(Oe.reactions=Z),oe&&(Oe.chatThread=oe),ne&&(Oe.chatThreadOverview=ne),"chatRoom"===x&&(Oe.priority=H,Oe.broadcast=W),q&&(Oe.isContentReplaced=q),V=Oe,G||null===(I=this.eventHandler)||void 0===I||I.dispatch("onCmdMessage",Oe),[3,28];case 23:return Ie={},Se={},M.contents[0].customExts&&(Ie=Je(M.contents[0].customExts)),M.contents[0].params&&(Se=Je(M.contents[0].params)),z={id:U,type:P,contentsType:Ve[b.type],from:w,to:k,customEvent:b.customEvent,params:Se,customExts:Ie,ext:Q,time:L,onlineState:D},!G&&this.onCustomMessage&&this.onCustomMessage(z),Ae={id:U,type:"custom",chatType:x,from:w,to:k,customEvent:b.customEvent,params:Se,customExts:Ie,ext:Q,time:Number(L),onlineState:D},z.msgConfig&&(Ae.msgConfig=z.msgConfig),Z.length>0&&(Ae.reactions=Z),oe&&(Ae.chatThread=oe),ne&&(Ae.chatThreadOverview=ne),ee.operationCount>0&&(Ae.modifiedInfo=ee,M.type===Ot.EDIT&&(Ae.from=te,Ae.time=re)),"chatRoom"===x&&(Ae.priority=H,Ae.broadcast=W),q&&(Ae.isContentReplaced=q),V=Ae,G?[3,25]:[4,null===(C=null===(S=this._localCache)||void 0===S?void 0:S.getInstance())||void 0===C?void 0:C.storeMessage(Ae,Ne.SUCCESS)];case 24:be.sent(),null===(N=this.eventHandler)||void 0===N||N.dispatch("onCustomMessage",Ae),be.label=25;case 25:return[3,28];case 26:return ie=Xe.call(this,b),Me={id:U,type:"combine",chatType:x,to:k,from:w,ext:Q,time:Number(L),onlineState:D,title:b.title||"",summary:b.summary||"",url:ie||"",secret:b.secretKey||"",file_length:b.fileLength||0,filename:b.displayName||"",compatibleText:b.text,combineLevel:b.combineLevel||0},z.msgConfig&&(Me.msgConfig=z.msgConfig),Z.length>0&&(Me.reactions=Z),oe&&(Me.chatThread=oe),ne&&(Me.chatThreadOverview=ne),"chatRoom"===x&&(Me.priority=H,Me.broadcast=W),q&&(Me.isContentReplaced=q),V=Me,!G&&this.eventHandler&&this.eventHandler.dispatch("onCombineMessage",Me),[3,28];case 27:return B.error("Unknow message type, message:",b),[3,28];case 28:return j?[2,V]:[2,z]}}))}))}function $e(e,t,r){if(this.delivery&&e!==t){var o=this.getUniqueId(),n=new We("delivery",o);n.set({ackId:r,to:e}),B.debug("send delivery ack"),this.send(n.body)}}var et=function(e,t,r,o,n){var i,a,s,c,u,l,d,p,h,m,g,E,y,v,T,_,R,O,I,S,C,N,A,M,b,U;return qe(this,void 0,void 0,(function(){var P,w,k,L,D,x,G,H,j,F,W,K,q,z,V,J,X,Y,Q,Z,$,ee,te,re,oe,ne,ie,ae,se,ce,ue,le,de,pe,he,fe,me,ge,Ee,ye;return ze(this,(function(ve){switch(ve.label){case 0:if(P=new(f())(e.timestamp.low,e.timestamp.high,e.timestamp.unsigned).toString(),w=this.root.lookup("easemob.pb.MessageBody"),k=w.decode(e.payload),L=3,D=!1,x=new(f())(e.id.low,e.id.high,e.id.unsigned).toString(),n&&e.from&&e.from.name===this.context.userId&&e.from.clientResource===this.clientResource&&k.type===Ot.CHATROOM)return[2,B.debug("Discard your own chat room message:",x)];if(e.meta&&e.meta.length){if(G=_e.parseNotify(e.meta),H=G.is_online,j=G.callback_replace,this.useReplacedMessageContents&&j&&(D=!0),H||0===H)switch(H){case 0:L=0;break;case 1:L=1;break;default:L=2}}else L=3;switch(F=k.ackMessageId?new(f())(k.ackMessageId.low,k.ackMessageId.high,k.ackMessageId.unsigned).toString():"",W="",K=Ye.call(this,e,k),q=Qe.call(this,e,k),B.debug("meta thirdMessage:",{metaId:x,metaNs:e.ns,type:k.type,from:K,to:q,contentType:null===(a=null===(i=k.contents)||void 0===i?void 0:i[0])||void 0===a?void 0:a.type,contentLen:null===(s=k.contents)||void 0===s?void 0:s.length}),k.type){case Ot.SINGLECHAT:return[3,1];case Ot.GROUPCHAT:return[3,2];case Ot.CHATROOM:return[3,3];case Ot.READ_ACK:return[3,4];case Ot.DELIVER_ACK:return[3,5];case Ot.RECALL:return[3,6];case Ot.CHANNEL_ACK:return[3,15];case Ot.EDIT:return[3,16]}return[3,20];case 1:return W="chat","agoraToken"===this.grantType&&(W="singleChat"),this.delivery&&!r&&K!==this.context.userId&&$e.call(this,K,q,x),[3,21];case 2:return W="groupchat","agoraToken"===this.grantType&&(W="groupChat"),[3,21];case 3:return W="chatroom","agoraToken"===this.grantType&&(W="chatRoom"),L=1,[3,21];case 4:return W="read_ack",z=void 0,k.ext[0]&&JSON.parse(k.ext[0].stringValue)?(z={id:x,type:"read",from:K,to:q,mid:F,groupReadCount:k.ext[0]&&JSON.parse(k.ext[0].stringValue),ackContent:k.ackContent,onlineState:L},this.onReadMessage&&this.onReadMessage(z),null===(c=this.eventHandler)||void 0===c||c.dispatch("onReadMessage",z),[2]):(z={id:x,type:"read",from:K,to:q,mid:F,onlineState:L},this.onReadMessage&&this.onReadMessage(z),null===(u=this.eventHandler)||void 0===u||u.dispatch("onReadMessage",z),[2]);case 5:return W="deliver_ack",this.onDeliveredMessage&&this.onDeliveredMessage({id:x,type:"delivery",from:K,to:q,mid:F,onlineState:L}),V={id:x,type:"delivery",from:K,to:q,mid:F,onlineState:L},null===(l=this.eventHandler)||void 0===l||l.dispatch("onDeliveredMessage",V),[2];case 6:return W="recall",J="",e.ext&&(J=(null===(d=Je(e.ext))||void 0===d?void 0:d.recallMessageExtensionInfo)||""),X={id:x,from:K||"admin",to:q,mid:F,ext:J,onlineState:L},Y=q===this.user?K:q,[4,null===(h=null===(p=this._localCache)||void 0===p?void 0:p.getInstance())||void 0===h?void 0:h.getMessageByServerMsgId(X.mid)];case 7:return(Q=ve.sent())?[4,null===(g=null===(m=this._localCache)||void 0===m?void 0:m.getInstance())||void 0===g?void 0:g.removeMsgByServerMsgId(X.mid)]:[3,9];case 8:ve.sent(),ve.label=9;case 9:return"singleChat"!==(null==Q?void 0:Q.chatType)&&"groupChat"!==(null==Q?void 0:Q.chatType)?[3,14]:(Z=(null==Q?void 0:Q.from)===this.user||""===(null==Q?void 0:Q.from),[4,null===(y=null===(E=this._localCache)||void 0===E?void 0:E.getInstance())||void 0===y?void 0:y.getConversationLastMessage(Y,Q.chatType)]);case 10:return $=ve.sent(),[4,null===(T=null===(v=this._localCache)||void 0===v?void 0:v.getInstance())||void 0===T?void 0:T.getConversationBySessionId(Ae({conversationId:Y,conversationType:Q.chatType}))];case 11:return(ee=ve.sent())?[4,null===(R=null===(_=this._localCache)||void 0===_?void 0:_.getInstance())||void 0===R?void 0:R.updateLocalConversation(Ae({conversationId:Y,conversationType:Q.chatType}),{lastMessageId:null==$?void 0:$.serverMsgId,unReadCount:Me({conversation:ee,isRecallSelfMsg:Z,recalledMsgTime:Q.time})})]:[3,13];case 12:ve.sent(),ve.label=13;case 13:ve.label=14;case 14:return this.onRecallMessage&&this.onRecallMessage(X),null===(O=this.eventHandler)||void 0===O||O.dispatch("onRecallMessage",X),[2];case 15:return this.onChannelMessage&&this.onChannelMessage({id:x,type:"channel",chatType:"singleChat",from:K,to:q,time:Number(P),onlineState:L}),te={id:x,type:"channel",chatType:"singleChat",from:K,to:q,time:Number(P),onlineState:L},null===(I=this.eventHandler)||void 0===I||I.dispatch("onChannelMessage",te),[2];case 16:return re={errorCode:0,reason:""},[4,Ze.call(this,{status:re,thirdMessage:k,msgBody:k.contents[0],msgId:x,type:W,from:K,to:q,time:P,onlineState:L,ignoreCallback:!0,format:!0,isContentReplaced:D})];case 17:return oe=ve.sent(),ne=!!e.to&&-1!==e.to.domain.indexOf("conference"),oe.chatType=ne?"groupChat":"singleChat",ie=k.editMessageId&&new(f())(k.editMessageId.low,k.editMessageId.high,k.editMessageId.unsigned).toString(),ae={},"txt"===oe.type?(se=oe.type,ce=oe.chatType,ue=oe.to,le=oe.from,de=oe.time,pe=oe.modifiedInfo,ae={id:ie,type:se,chatType:ce,to:ue,from:le,time:de,modifiedInfo:pe,msg:oe.msg},oe.translations&&(ae.translations=oe.translations)):"custom"===oe.type&&((ae=oe).id=ie,delete ae.onlineState),ae?[4,null===(C=null===(S=this._localCache)||void 0===S?void 0:S.getInstance())||void 0===C?void 0:C.getMessageByServerMsgId(ie)]:[3,19];case 18:"txt"===(null==(he=ve.sent())?void 0:he.type)&&"txt"===ae.type?null===(A=null===(N=this._localCache)||void 0===N?void 0:N.getInstance())||void 0===A||A.putMessageToDB(Ke(Ke({},he),{msg:ae.msg,modifiedInfo:ae.modifiedInfo,translations:ae.translations})):"custom"===(null==he?void 0:he.type)&&"custom"===ae.type&&(null===(b=null===(M=this._localCache)||void 0===M?void 0:M.getInstance())||void 0===b||b.putMessageToDB(Ke(Ke({},he),{modifiedInfo:ae.modifiedInfo,customEvent:ae.customEvent,customExts:ae.customExts,ext:ae.ext}))),ve.label=19;case 19:return"txt"!==oe.type&&"custom"!==oe.type||null===(U=this.eventHandler)||void 0===U||U.dispatch("onModifiedMessage",ae),[2];case 20:return B.error("unexpected message type: ".concat(k.type)),[2];case 21:fe="normal",ge=!1,"chat"===W.toLowerCase()||"singleChat"===W?me="singleChat":"groupchat"===W.toLowerCase()||"groupChat"===W?me="groupChat":(me="chatRoom",L=1,e.ext&&(Ee=Je(e.ext),ge=!!(null==Ee?void 0:Ee.is_broadcast),fe=0===Ee.chatroom_msg_tag?"high":2===Ee.chatroom_msg_tag?"low":"normal")),ye=0,ve.label=22;case 22:return ye0&&(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;n.operation="userRemove",null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatThreadChange",n)},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,n,i;o.type=t.isChatroom?"rmChatRoomMute":"rmGroupMute",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="unmuteAllMembers",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},31:function(){var e,r,n,i;o.type=t.isChatroom?"muteChatRoom":"muteGroup",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="muteAllMembers",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},30:function(){var e,r,n,i;o.type=t.isChatroom?"rmUserFromChatRoomWhiteList":"rmUserFromGroupWhiteList",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="removeAllowlistMember",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},29:function(){var e,r,n,i;o.type=t.isChatroom?"addUserToChatRoomWhiteList":"addUserToGroupWhiteList",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="addUserToAllowlist",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},28:function(){var e,r,n,i;o.type="deleteFile",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="deleteFile",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},27:function(){var e,r,n,i;o.type="uploadFile",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="uploadFile",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},26:function(){var e,r,n,i;o.type="deleteAnnouncement",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="deleteAnnouncement",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},25:function(){var e,r,n,i;o.type="updateAnnouncement",o.announcement=t.reason,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="updateAnnouncement",a.announcement=t.reason,t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},24:function(){var e,r,n,i;o.type="removeMute",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="unmuteMember",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},23:function(){var e,r,n,i;o.type="addMute",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="muteMember",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},22:function(){var e,r,n,i;o.type="removeAdmin",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="removeAdmin",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},21:function(){var e,r,n,i;o.type="addAdmin",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="setAdmin",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},20:function(){var e,r,n,i;o.type="changeOwner",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="changeOwner",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},19:function(){var e,r,n,i;o.type="direct_joined",o.groupName=t.mucName,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="directJoined",a.name=t.mucName,t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},18:function(){var e,r,n,i;o.type=t.isChatroom?"leaveChatRoom":"leaveGroup",c.onPresence&&c.onPresence(o);var s=t.mucMemberCount;s&&(a.memberCount=s),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="memberAbsence",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},17:function(){var e,r,n,i;t.isChatroom&&t.ext&&(a.ext=t.ext,o.ext=t.ext),o.type=t.isChatroom?"memberJoinChatRoomSuccess":"memberJoinPublicGroupSuccess",c.onPresence&&c.onPresence(o);var s=t.mucMemberCount;t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="memberPresence",s&&(a.memberCount=s),t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},16:function(){var e,r;o.type="unblock",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o)},15:function(){var e,r;o.type="block",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o)},14:function(){var e,r,n,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):rt.includes(e)?"true"===t||!0===t:t}));a.detail=o.detail={},Object.keys(l).forEach((function(e){var t=ot[e];if(t){var r=l[e];a.detail&&(a.detail[t]=r),o.detail&&(o.detail[t]=r)}}))}o.type="update",c.onPresence&&c.onPresence(o),u?null===(r=c.eventHandler)||void 0===r||r.dispatch("onChatroomChange",o):null===(n=c.eventHandler)||void 0===n||n.dispatch("onGroupChange",o),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,n,i;o.type="allow",o.reason=t.reason,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),t.reason&&(a.reason=t.reason),a.operation="unblockMember",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},12:function(){var e,r;o.type="ban",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o)},11:function(){var e,r;o.type="getBlackList",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o)},10:function(){var e,r,n,i;o.type="removedFromGroup",o.kicked=o.to,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="removeMember",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},9:function(){var e,r,n,i;o.type="invite_decline",o.kicked=o.to,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="rejectInvite",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},8:function(){var e,r,n,i;o.type="invite_accept",o.kicked=o.to,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="acceptInvite",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},7:function(){var e,r,n,i;o.type="invite",o.kicked=o.to,o.groupName=t.mucName,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="inviteToJoin",a.name=t.mucName,t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},6:function(){var e,r,n,i;o.type="joinPublicGroupDeclined",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="joinPublicGroupDeclined",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.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,n,i;o.type="joinPublicGroupSuccess",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="acceptRequest",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},4:function(){var e,r,n,i;o.type="joinGroupNotifications",o.reason=t.reason,c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),t.reason&&(a.reason=t.reason),a.operation="requestToJoin",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.dispatch("onChatroomEvent",a):null===(i=c.eventHandler)||void 0===i||i.dispatch("onGroupEvent",a)},3:function(){var e,r;o.type="leave",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o)},2:function(){var e,r;o.type="join",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o)},1:function(){var e,r,n,i;o.type="deleteGroupChat",c.onPresence&&c.onPresence(o),t.isChatroom?null===(e=c.eventHandler)||void 0===e||e.dispatch("onChatroomChange",o):null===(r=c.eventHandler)||void 0===r||r.dispatch("onGroupChange",o),a.operation="destroy",t.isChatroom?null===(n=c.eventHandler)||void 0===n||n.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 it,at=function(e){var t=this.root.lookup("easemob.pb.MUCBody").decode(e.payload),r=t.operation;B.debug("onMucMessage",t),nt.call(this,r,t)},st={handleRosterMsg:function(e){var t,r,o,n,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===(o=this.eventHandler)||void 0===o||o.dispatch("onContactAdded",c);break;case 5:c.type="unsubscribed",this.onContactRefuse&&this.onContactRefuse(c),null===(n=this.eventHandler)||void 0===n||n.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:B.error("handleRosterMsg:",s)}this.onPresence&&c.type&&this.onPresence(c)}},ct=function(e){var t,r,o,n,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);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===(o=this.eventHandler)||void 0===o||o.dispatch("onError",a);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===(n=this.eventHandler)||void 0===n||n.dispatch("onError",a);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);break;default:B.error("handleStatisticsMsg:",s)}};function ut(e){var t,r=[],o=[],n=e.data;n&&n.values&&n.values.forEach((function(e){Object.entries(e.status).forEach((function(e){o.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:o})})),this.onPresenceStatusChange&&this.onPresenceStatusChange(r),null===(t=this.eventHandler)||void 0===t||t.dispatch("onPresenceStatusChange",r)}function lt(e){var t=this;e.data.forEach((function(e){var r,o={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",o)}))}function dt(e){var t,r,o,n;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=Ce.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===(o=this.eventHandler)||void 0===o||o.dispatch("onChatThreadChange",a);break;case"delete":a.operation="destroy",null===(n=this.eventHandler)||void 0===n||n.dispatch("onChatThreadChange",a)}}}function pt(e){var t,r=e.data;if(r.resource!==this.clientResource){var o={operation:"deleteRoaming",conversationId:r.to,chatType:"chat"===r.chatType?"singleChat":"groupChat",resource:r.resource};null===(t=this.eventHandler)||void 0===t||t.dispatch("onMultiDeviceEvent",o)}}function ht(e){var t,r,o=e.data,n="";if(this.clientResource!==o.res){switch(o.op){case"del":n="deleteConversation";break;case"top":n="pinnedConversation";break;case"not_top":n="unpinnedConversation";break;case"mark":n="markConversation";break;case"mark_delete":n="unMarkConversation";break;case"pin":n="pin";break;case"pin_delete":n="unpin";break;default:return void B.error("unexpected conversation op:",o.op)}if("pin"!==n&&"unpin"!==n){var i={operation:n,conversationId:o.id,conversationType:"chat"===o.type?"singleChat":"groupChat",timestamp:o.ts};"markConversation"!==i.operation&&"unMarkConversation"!==i.operation||o.ext&&(i.conversationMark=it[o.ext]),null===(r=this.eventHandler)||void 0===r||r.dispatch("onMultiDeviceEvent",i)}else{var a=o.ext,s=o.from,c=o.id,u=o.type,l=o.ts,d={messageId:a||"",conversationId:s===this.user?c:s,conversationType:Se[u],operation:n,operatorId:s,time:l};null===(t=this.eventHandler)||void 0===t||t.dispatch("onMessagePinEvent",d)}}}function ft(e){var t,r=this;null===(t=e.values)||void 0===t||t.forEach((function(e){var t,o,n,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!==(o=e.data)&&void 0!==o?o:{}).length?"removeSilentModeForConversation":"setSilentModeForConversation",resource:e.operator_resource,conversationId:e.group,type:"groupChat",data:e.data},null===(n=r.eventHandler)||void 0===n||n.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"}(it||(it={}));var mt=function(e){var t=_e.parseNotify(e.payload);switch(t.type){case"presence":ut.call(this,t);break;case"reaction":lt.call(this,t);break;case"thread":dt.call(this,t);break;case"roaming_delete":pt.call(this,t);break;case"conv":ht.call(this,t);break;case"user_notification_mute":ft.call(this,t);break;default:B.error("unexpected notify type: ".concat(t.type))}},gt=2;function Et(){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 yt(){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 B.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 vt(){return yt.call(this)&&Et.call(this)}function Tt(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 _t(e){var t=e.data,r=void 0;return Object.keys(t.errorKeys).length>0&&Object.keys(t.errorKeys).forEach((function(e){var o=t.errorKeys[e];r=o.includes("is not part of you")?m.create({type:d.NO_PERMISSION,message:o}):o.includes("size of metadata for this single chatroom exceeds the user defined limit")||o.includes("total size of chatroom metadata for this app exceeds the user defined limit")||o.includes("is exceeding maximum limit")?m.create({type:d.MAX_LIMIT,message:o}):o.includes("is not Legal")?m.create({type:d.REQUEST_PARAMETER_ERROR,message:o}):o.includes("Failed to update userMetadata. Concurrent updates not allowed")?m.create({type:d.OPERATION_NOT_ALLOWED,message:o}):m.create({type:d.WEBIM_CONNCTION_AJAX_ERROR,message:o})})),r}function Rt(e){if("string"!=typeof e.deviceId||""===e.deviceId)throw Error('Invalid parameter: "deviceId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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};B.debug("Call uploadPushTokenToServer",e);var s=se.bind(this,a,E.UPLOAD_PUSH_TOKEN);return _e.retryPromise(s).then((function(e){var t=e.entities[0]||{};return{type:e.type,data:t}}))}var Ot,It,St,Ct=function(){return Ct=Object.assign||function(e){for(var t,r=1,o=arguments.length;r0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]0&&(null===(r=this.eventHandler)||void 0===r||r.dispatch("onMessage",c)),[2]}}))}))}function Lt(e,t){kt.call(this,e,t)}function Dt(e){var t;this._offlineMessagePullState===ve.SYNC_INIT&&(this._offlineMessagePullState=ve.SYNC_START,this._offlineMessagePullQueue=e.unread.reduce((function(e,t){return e.find((function(e){return e.name===t.queue.name}))||e.push(t.queue),e}),[]),null===(t=this.eventHandler)||void 0===t||t.dispatch("onOfflineMessageSyncStart"))}function xt(e){var t;if(this._offlineMessagePullState===ve.SYNC_START){var r=this._offlineMessagePullQueue.findIndex((function(t){return t.name===e.queue.name}));r>-1&&this._offlineMessagePullQueue.splice(r,1),0===this._offlineMessagePullQueue.length&&(this._offlineMessagePullState=ve.SYNC_FINISH,null===(t=this.eventHandler)||void 0===t||t.dispatch("onOfflineMessageSyncFinish"))}}function Gt(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)Jt.call(this);else{Dt.call(this,t),B.debug("pull unread message",t.unread);for(var o=0;o0){for(var r=Array.from(this.unMSyncSendMsgMap.keys()),o=0;o=30&&(B.debug("send heart beat"),Xt.call(e),e.lastHeartbeat=Date.now())}),this.heartBeatWait)}function Qt(){clearInterval(this.heartBeatID)}function Zt(){var e=this.root.lookup("easemob.pb.MSync"),t=e.decode([]);return t.version=this.version,t.encryptType=this.encryptType,t.command=1,e.encode(t).finish()}function $t(e,t){return e.some((function(e){return e.name===t.name}))}function er(e){var t=this.root.lookup("easemob.pb.CommNotice"),r=t.decode(e.payload),o=$t(this._queues,r.queue);B.debug("receive notice",t,this._queues);var n=$t(this.unSyncQueue,r.queue);o||n||this.clientResource===r.queue.clientResource&&r.queue.name===this.context.userId||(this._queues.push(r.queue),1===this._queues.length&&jt.call(this,r.queue))}function tr(e){return Nt(this,void 0,void 0,(function(){var t,r,o,n,i,a,s,c;return At(this,(function(u){if(t=_e.getEnvInfo(),r=this.root.lookup("easemob.pb.MSync"),"miniCore"===this.name){try{n=new Uint8Array(e.data),o=r.decode(n)}catch(e){throw new Error("decode message fail.")}return[2,o]}if("web"===t.platform||"zfb"===t.platform||"dd"===t.platform){for(i=Oe().atob(e.data),a=[],s=0,c=i.length;s0))return[3,23];if(clearTimeout(null===(t=this._msgHash[re])||void 0===t?void 0:t.messageTimer),!ee.status)return[3,22];if(0!==ee.status.errorCode)return[3,21];if(null==(oe=this._msgHash[re])?void 0:oe.isHandleChatroom){try{ne="join"===(null===(r=this._msgHash[re])||void 0===r?void 0:r.operation),(null===(o=this._msgHash[re])||void 0===o?void 0:o.resolve)instanceof Function&&ne&&this._msgHash[re].resolve({type:0,data:{action:"apply",id:this._msgHash[re].roomId,result:!0,user:this.context.userId}}),(null===(n=this._msgHash[re])||void 0===n?void 0:n.success)instanceof Function&&ne&&this._msgHash[re].success({type:0,data:{action:"apply",id:this._msgHash[re].roomId,result:!0,user:this.context.userId}}),(null===(i=this._msgHash[re])||void 0===i?void 0:i.resolve)instanceof Function&&!ne&&this._msgHash[re].resolve({type:0,data:{result:!0}}),(null===(a=this._msgHash[re])||void 0===a?void 0:a.success)instanceof Function&&!ne&&this._msgHash[re].success({type:0,data:{result:!0}}),S.has(re)&&(ie=S.get(re),De=ie.rpt,xe=ie.requestName,De({isEndApi:!0,data:{isSuccess:1,requestName:xe,requestMethod:"WEBSOCKET",requestUrl:this.url,code:T.success}}),S.delete(re))}catch(e){S.has(re)&&(ae=S.get(re),De=ae.rpt,xe=ae.requestName,De({isEndApi:!0,data:{isSuccess:0,requestName:xe,requestMethod:"WEBSOCKET",requestUrl:this.url,code:T.failed,codeDesc:"when executing success function error"}}),S.delete(re)),Be=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing success function error",data:e}),this.onError&&this.onError(Be),null===(s=this.eventHandler)||void 0===s||s.dispatch("onError",Be)}delete this._msgHash[re]}return!oe||oe.isHandleChatroom?[3,20]:(se=null,ce="",ue=0,le=null,this._msgHash[re].thirdMessage?(this._msgHash[re].thirdMessage.id=ee.serverId,this._msgHash[re].thirdMessage.timestamp=ee.timestamp,[4,et.call(this,this._msgHash[re].thirdMessage,ee.status,!0,!0)]):[3,2]);case 1:le=ze.sent(),ze.label=2;case 2:if(0===ee.metas.length)return[3,13];ze.label=3;case 3:switch(ze.trys.push([3,12,,13]),de=ee.metas[0],pe=ee.status,de.ns){case 1:return[3,4];case 5:return[3,9]}return[3,10];case 4:return this.useReplacedMessageContents?[4,et.call(this,de,pe,!0,!0)]:[3,8];case 5:return le=ze.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.getMessageByServerMsgId(re)];case 6:return(he=ze.sent())?[4,null===(p=null===(l=this._localCache)||void 0===l?void 0:l.getInstance())||void 0===p?void 0:p.putMessageToDB(Ct(Ct(Ct({},he),le),{id:re}))]:[3,8];case 7:ze.sent(),ze.label=8;case 8:return[3,11];case 9:return(fe=_e.parseNotify(ee.metas[0].payload)).edit_msg&&(me=fe.edit_msg,ge=me.count,Ee=me.operator,ye=me.edit_time,ve=me.sender,Te=me.send_time,se={operationTime:ye,operatorId:Ee,operationCount:ge},ce=ve,ue=Number(Te)),[3,11];case 10:return B.error("decode local meta error",de),[3,11];case 11:return[3,13];case 12:return Re=ze.sent(),Be=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:"decode local meta message error",data:Re}),this.onError&&this.onError(Be),null===(h=this.eventHandler)||void 0===h||h.dispatch("onError",Be),[3,13];case 13:I.has(re)&&(I.get(re).rpt({isEndApi:!0,data:{isSuccess:1,requestMethod:"WEBSOCKET",requestUrl:this.url,code:T.success,msgId:te}}),I.delete(re)),ze.label=14;case 14:return ze.trys.push([14,18,,19]),Oe={localMsgId:re,serverMsgId:te},se&&(this._msgHash[re].modifiedInfo=se,Ie=this._msgHash[re],Se=Ie.editMessageId,we=Ie.type,Ce=Ie.chatType,Ae=Ie.msg,Me=Ie.to,be=Ie.translations,Ue={id:Se,type:we,chatType:Ce,msg:Ae,modifiedInfo:se,to:Me,from:ce,time:Number(ue)},be&&(Ue.translations=be),Oe.message=Ue,null===(y=null===(E=null===(g=this._localCache)||void 0===g?void 0:g.getInstance())||void 0===E?void 0:E.getMessageByServerMsgId(Se))||void 0===y||y.then((function(e){var t,r;e&&"txt"===e.type&&(null===(r=null===(t=qe._localCache)||void 0===t?void 0:t.getInstance())||void 0===r||r.putMessageToDB(Ct(Ct({},e),{msg:Ue.msg,modifiedInfo:Ue.modifiedInfo,translations:Ue.translations})))}))),le&&(Oe.message=le),[4,null===(_=null===(v=this._localCache)||void 0===v?void 0:v.getInstance())||void 0===_?void 0:_.updateLocalMessage(re,{serverMsgId:te,status:Ne.SUCCESS})];case 15:return ze.sent(),(null===(R=this._msgHash[re])||void 0===R?void 0:R.success)instanceof Function?[4,this._msgHash[re].success(re,te)]:[3,17];case 16:ze.sent(),ze.label=17;case 17:return(null===(O=this._msgHash[re])||void 0===O?void 0:O.resolve)instanceof Function&&this._msgHash[re].resolve(Oe),[3,19];case 18:return Pe=ze.sent(),Be=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing success function error",data:Pe}),this.onError&&this.onError(Be),null===(C=this.eventHandler)||void 0===C||C.dispatch("onError",Be),[3,19];case 19:this.onReceivedMessage&&this.onReceivedMessage({id:re,mid:te,to:this._msgHash[re].to,time:0}),null===(N=this.eventHandler)||void 0===N||N.dispatch("onReceivedMessage",{id:re,mid:te,to:this._msgHash[re].to}),delete this._msgHash[re],ze.label=20;case 20:return[3,22];case 21:if(15===ee.status.errorCode)(null===(A=this._msgHash[re])||void 0===A?void 0:A.fail)instanceof Function&&this._msgHash[re].fail({type:d.SERVICE_NOT_ALLOW_MESSAGING_MUTE,reason:"you were muted"}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject({type:d.SERVICE_NOT_ALLOW_MESSAGING_MUTE,reason:"you were muted"}),null===(b=null===(M=this._localCache)||void 0===M?void 0:M.getInstance())||void 0===b||b.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL});else if(1===ee.status.errorCode){switch(we=void 0,ee.status.reason){case"blocked":we=d.PERMISSION_DENIED;break;case"group not found":we=d.GROUP_NOT_EXIST;break;case"not in group or chatroom":we=d.GROUP_NOT_JOINED;break;case"exceed recall time limit":we=d.MESSAGE_RECALL_TIME_LIMIT;break;case"message recall disabled":we=d.SERVICE_NOT_ENABLED;break;case"not in group or chatroom white list":we=d.SERVICE_NOT_ALLOW_MESSAGING;break;case"nonroster":we=d.USER_NOT_FRIEND,ee.status.reason="not contact";break;case"group is disabled":we=d.GROUP_IS_DISABLED,ee.status.reason="group is disabled";break;case"limit directed users":we=d.MAX_LIMIT;break;case"Sorry, edit limit reached":we=d.MAX_LIMIT,ee.status.reason="Modify message limit reached";break;case"Sorry, message does not exist":we=d.MODIFY_MESSAGE_NOT_EXIST,ee.status.reason="The message does not exist.";break;case"Sorry, You do not have permission":we=d.PERMISSION_DENIED,ee.status.reason="You do not have the modified permission.";break;case"Sorry, format is incorrect":we=d.MODIFY_MESSAGE_FORMAT_ERROR,ee.status.reason="The modify messaged format error.";break;case"Sorry, edit is not available":we=d.SERVICE_NOT_ENABLED,ee.status.reason="The message modify function is not activated.";break;case"Sorry, edit fail":we=d.MODIFY_MESSAGE_FAILED,ee.status.reason="Modify message failed.";break;default:ee.status.reason.includes("grpID")&&ee.status.reason.includes("does not exist!")?(we=d.CHATROOM_NOT_EXIST,ee.status.reason="The chat room dose not exist."):ee.status.reason.includes("username")&&ee.status.reason.includes("doesn't exist!")?we=d.USER_NOT_FOUND:"group member list is full!"===ee.status.reason?we=d.CHATROOM_MEMBERS_FULL:ee.status.reason.includes("can not join this group")&&ee.status.reason.includes("is in the blacklist")?(we=d.PERMISSION_DENIED,ee.status.reason="permission denied"):"can not operate this group, reason: group is disabled"===ee.status.reason?we=d.GROUP_IS_DISABLED:ee.status.reason.includes("moderation")?we=d.MESSAGE_MODERATION_BLOCKED:ee.status.reason.includes("group ID illegal, please check it")?(we=d.REQUEST_PARAMETER_ERROR,ee.status.reason="Invalid parameter"):we=ee.status.reason.includes("has create too many chatrooms")||ee.status.reason.includes("has joined too many chatrooms")?d.MAX_LIMIT:ee.status.reason.includes("auto create failed")?d.SERVER_BUSY:d.SERVER_UNKNOWN_ERROR}this._msgHash[re]&&((null===(U=this._msgHash[re])||void 0===U?void 0:U.isHandleChatroom)?(Ge=m.create({type:we,message:ee.status.reason||"",data:""}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].error instanceof Function&&this._msgHash[re].error(Ge),S.has(re)&&(ke=T.failed,we===d.CHATROOM_NOT_EXIST?ke=T.notFound:we===d.CHATROOM_MEMBERS_FULL&&(ke=T.reachLimit),Le=S.get(re),De=Le.rpt,xe=Le.requestName,De({isEndApi:!0,data:{isSuccess:0,requestName:xe,requestMethod:"WEBSOCKET",requestUrl:this.url,code:ke,codeDesc:ee.status.reason}}),S.delete(re))):(Ge=m.create({type:we,message:ee.status.reason||"",data:{id:re,mid:te}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail({type:we,reason:ee.status.reason?ee.status.reason:"",data:{id:re,mid:te}}),null===(w=null===(P=this._localCache)||void 0===P?void 0:P.getInstance())||void 0===w||w.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL})),delete this._msgHash[re])}else if(7===ee.status.errorCode)"sensitive words"===ee.status.reason&&this._msgHash[re]?(Ge=m.create({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"sensitive words",data:{id:re,mid:te}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,data:{id:re,mid:te,reason:"sensitive words"}}),null===(L=null===(k=this._localCache)||void 0===k?void 0:k.getInstance())||void 0===L||L.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL})):"blocked by mod_antispam"===ee.status.reason&&this._msgHash[re]?(Ge=m.create({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,message:"blocked by mod_antispam",data:{id:re,mid:te}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail({type:d.MESSAGE_INCLUDE_ILLEGAL_CONTENT,data:{id:re,mid:te,reason:"blocked by mod_antispam"}}),null===(x=null===(D=this._localCache)||void 0===D?void 0:D.getInstance())||void 0===x||x.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL})):"user is mute"===ee.status.reason&&this._msgHash[re]?(Ge=m.create({type:d.USER_MUTED_BY_ADMIN,message:"user is mute",data:{id:re,mid:te}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail(Ge),null===(H=null===(G=this._localCache)||void 0===G?void 0:G.getInstance())||void 0===H||H.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL})):"traffic limit"===ee.status.reason&&this._msgHash[re]?(Ge=m.create({type:d.MESSAGE_CURRENT_LIMITING,message:"traffic limit",data:{id:re,mid:te}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail(Ge),null===(F=null===(j=this._localCache)||void 0===j?void 0:j.getInstance())||void 0===F||F.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL})):"Sorry, data is too large"===ee.status.reason&&this._msgHash[re]&&(Ge=m.create({type:d.MESSAGE_SIZE_LIMIT,message:"Sorry, data is too large",data:{id:re,mid:te}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail(Ge),null===(K=null===(W=this._localCache)||void 0===W?void 0:W.getInstance())||void 0===K||K.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL}));else if(19===ee.status.errorCode)this._msgHash[re]&&(I.has(re)&&(I.get(re).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,codeDesc:ee.status.reason||"",msgId:te}}),I.delete(re)),Ge=m.create({type:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,message:ee.status.reason||"",data:{id:re,mid:te}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail({type:d.MESSAGE_EXTERNAL_LOGIC_BLOCKED,data:{id:re,mid:te,reason:ee.status.reason}}),null===(z=null===(q=this._localCache)||void 0===q?void 0:q.getInstance())||void 0===z||z.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL}));else if(this._msgHash[re]){I.has(re)&&(I.get(re).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.WEBIM_LOAD_MSG_ERROR,codeDesc:(null===(V=ee.status)||void 0===V?void 0:V.reason)||"",msgId:te}}),I.delete(re));try{Ge=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:(null===(J=ee.status)||void 0===J?void 0:J.reason)||"",data:{id:re,mid:te,reason:ee.status&&ee.status.reason}}),this._msgHash[re].reject instanceof Function&&this._msgHash[re].reject(Ge),null===(Y=null===(X=this._localCache)||void 0===X?void 0:X.getInstance())||void 0===Y||Y.updateLocalMessage(re,{serverMsgId:te,status:Ne.FAIL}),this._msgHash[re].fail instanceof Function&&this._msgHash[re].fail({type:d.WEBIM_LOAD_MSG_ERROR,data:{errorCode:ee.status&&ee.status.errorCode,reason:ee.status&&ee.status.reason}})}catch(e){Be=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"when executing fail function error",data:e}),this.onError&&this.onError(Be),null===(Q=this.eventHandler)||void 0===Q||Q.dispatch("onError",Be)}delete this._msgHash[re]}else I.has(re)&&(I.get(re).rpt({isEndApi:!0,data:{isSuccess:0,requestMethod:"WEBSOCKET",requestUrl:this.url,code:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,codeDesc:"on message error",msgId:te}}),I.delete(re)),Be=m.create({type:d.WEBIM_CONNCTION_CALLBACK_INNER_ERROR,message:"on message error"}),this.onError&&this.onError(Be),null===(Z=this.eventHandler)||void 0===Z||Z.dispatch("onError",Be);ze.label=22;case 22:return[2];case 23:if(ee.metas&&0!==ee.metas.length)try{Lt.call(this,ee.metas,ee.status)}catch(e){Be=m.create({type:d.WEBIM_LOAD_MSG_ERROR,message:"decode message error",data:e}),B.error("decode message error",e),this.onError&&this.onError(Be),null===($=this.eventHandler)||void 0===$||$.dispatch("onError",Be)}finally{ee.isLast?(B.debug("metas & CommSyncDLMessage.isLast",ee.isLast),He=-1,this._queues.some((function(e,t){return e.name===ee.name&&(He=t,!0)}))&&He>0&&this._queues.splice(He,1),this._queues.length>0&&jt.call(this,this._queues[0]),je=-1,this.unSyncQueue.some((function(e,t){return e.name===ee.queue.name&&(je=t,!0)}))&&this.unSyncQueue.splice(je,1),xt.call(this,ee)):ee.nextKey&&(Ke=new(f())(ee.nextKey.low,ee.nextKey.high,ee.nextKey.unsigned).toString(),B.debug("nexKey:",Ke,"this.nextKey:",this.nexKey),Ke!==this.nexKey&&(this.nexKey=Ke,qt.call(this,ee.nextKey,ee.queue)))}else ee.isLast?(B.debug("CommSyncDLMessage.isLast",ee.isLast),Fe=-1,this._queues.some((function(e,t){return e.name===ee.queue.name&&(Fe=t,!0)}))&&this._queues.splice(Fe,1),this._queues.length>0&&jt.call(this,this._queues[0]),We=-1,this.unSyncQueue.some((function(e,t){return e.name===ee.queue.name&&(We=t,!0)}))&&this.unSyncQueue.splice(We,1),xt.call(this,ee)):ee.nextKey&&(Ke=new(f())(ee.nextKey.low,ee.nextKey.high,ee.nextKey.unsigned).toString(),B.debug("nexKey:",Ke,"this.nextKey:",this.nexKey),Ke!==this.nexKey&&(this.nexKey=Ke,qt.call(this,ee.nextKey,ee.queue)));return[2]}}))}))}function nr(e){var t=[],r=this.root.lookup("easemob.pb.KeyValue"),o=[];for(var n in e){var i=r.decode(t);if(i.key=n,void 0!==e[n]){if("object"==typeof e[n])i.type=8,i.stringValue=JSON.stringify(e[n]);else if("string"==typeof e[n])i.type=7,i.stringValue=e[n];else if("boolean"==typeof e[n])i.type=1,i.varintValue=!0===e[n]?1:0;else if(Number.isInteger(e[n]))i.type=2,i.varintValue=e[n];else if("bigint"==typeof e[n]||"symbol"==typeof e[n]||"function"==typeof e[n]||Number.isNaN(e[n]))i.type=7,i.stringValue=e[n].toString();else{if("number"!=typeof e[n]||Number.isInteger(e[n]))continue;i.type=6,i.doubleValue=e[n]}o.push(i)}}return o}function ir(e){var t,r,o,n=[];if(this.root){var i,a=this.root.lookup("easemob.pb.MessageBody.Content").decode(n);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});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=nr.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 s=[];e.ext&&(s=nr.call(this,e.ext));var c=this.root.lookup("easemob.pb.MessageBody"),u=c.decode(n),l=e.from||this.context.jid.name;u.from={name:e.isBuildCombinedMsg?l:this.context.jid.name};var p=e.to.indexOf("/"),h=p>-1?e.to.substring(0,p):e.to;if(u.to={name:h},"channel"===e.type)u.type=Ot.CHANNEL_ACK;else if("recall"===e.type)u.type=Ot.RECALL,u.ackMessageId=e.ackId;else if("delivery"===e.type)u.type=Ot.DELIVER_ACK,u.ackMessageId=e.ackId;else if("read"===e.type)u.type=Ot.READ_ACK,u.ackMessageId=e.ackId,"groupChat"===i&&(u.msgConfig={allowGroupAck:!0},u.ackContent=e.ackContent);else if("chatRoom"===i)u.type=Ot.CHATROOM;else if("groupChat"===i){if(u.type=Ot.GROUPCHAT,e.msgConfig){var m=e.msgConfig.allowGroupAck;u.msgConfig={allowGroupAck:!!m}}}else"singleChat"===i&&(u.type=Ot.SINGLECHAT);e.editMessageId&&(u.type=Ot.EDIT,u.editMessageId=e.editMessageId),u.contents=[a],u.ext=s;var g=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);g&&(u.meta=g),u=c.encode(u).finish();var E=this.root.lookup("easemob.pb.Meta"),y=E.decode(n);y.id=e.id;var v="easemob.com";if("chatRoom"!==i&&"groupChat"!==i||(v="conference.easemob.com"),y.to={appKey:this.appKey,name:h,domain:v},p>-1&&(y.to.clientResource=e.to.substring(p+1,e.to.length)),"chatRoom"===i&&(y.ext=nr.call(this,function(e){return{chatroom_msg_tag:"high"===e.priority?0:"low"===e.priority?2:1}}(e))),"recall"===e.type&&e.metaExt&&(y.ext=nr.call(this,{recallMessageExtensionInfo:e.metaExt})),y.ns=1,y.payload=u,y.routetype=e.deliverOnlineOnly?1:0,"singleChat"!==i&&Array.isArray(e.receiverList)&&(null===(o=e.receiverList)||void 0===o?void 0:o.length)>0&&(y.directedUsers=e.receiverList,y.routetype=2),e.isBuildCombinedMsg)return y.timestamp=f().fromValue(e.time),E.encode(y).finish();var T=this.root.lookup("easemob.pb.CommSyncUL"),_=T.decode(n);_.meta=y,!e.isPing&&sr.call(this,e,y),_=T.encode(_).finish();var R=this.root.lookup("easemob.pb.MSync"),O=R.decode(n);return O.version=this.version,O.encryptType=this.encryptType,O.command=0,O.payload=_,R.encode(O).finish()}e.fail&&e.fail({type:d.WEBIM_CONNCTION_CLIENT_OFFLINE,message:"Not logged in"})}function ar(e){var t,r,o=this,n=Ct({},e);if(e.file)return n.accessToken=this.token,n.appKey=this.appKey,n.apiUrl=this.apiUrl,n.body&&n.body.url?ir.call(this,n):new Promise((function(t,r){var i=n.onFileUploadComplete;n.onFileUploadComplete=function(t){var r,a,s,c,u,l;if(t.entities[0]["file-metadata"]){var d=t.entities[0]["file-metadata"]["content-length"];n.file_length=d,n.filetype=t.entities[0]["file-metadata"]["content-type"],d>204800&&(n.thumbnail=!0)}var p="".concat(o.apiUrl,"/").concat(o.orgName,"/").concat(o.appName,"/chatfiles/").concat(t.entities[0].uuid);n.body={type:n.type||"file",secret:t.entities[0]["share-secret"],filename:n.file.filename||n.filename,url:p,length:n.length||0,filetype:n.filetype||n.file.filetype,file_length:(null===(a=null===(r=n.file)||void 0===r?void 0:r.data)||void 0===a?void 0:a.size)||0,size:{width:n.width||0,height:n.height||0}},n.file.url=t.uri,e.secret=t.entities[0]["share-secret"],t.url=e.url="".concat(p,"?em-redirect=true&share-secret=").concat(t.entities[0]["share-secret"]),e.file_length=n.file_length=(null===(c=null===(s=n.file)||void 0===s?void 0:s.data)||void 0===c?void 0:c.size)||0,"img"===n.type&&(e.thumb="".concat(e.url,"&thumbnail=true"),t.thumb="".concat(t.url,"&thumbnail=true")),"video"===n.type&&(e.thumb="".concat(e.url,"&vframe=true"),e.thumb_secret=t.entities[0]["share-secret"],t.thumb="".concat(t.url,"&vframe=true")),i instanceof Function&&i(t,n.id);var h=ir.call(o,n);I.size<=C&&I.set(n.id,{rpt:o.dataReport.geOperateFun({operationName:E.SEND_MSG})}),null===(l=null===(u=o._localCache)||void 0===u?void 0:u.getInstance())||void 0===l||l.storeMessage(e,Ne.INPROGRESS),pr.call(o,h)},_e.uploadFile.call(o,n,E.UPLOAD_MSG_ATTACH)}));if("combine"===e.type){n.accessToken=this.token,n.appKey=this.appKey,n.apiUrl=this.apiUrl;var i=n.onFileUploadComplete,a=n.onFileUploadError;return new Promise((function(t,r){var s,c,u,l;if((null===(s=e.messageList)||void 0===s?void 0:s.length)>300||0===(null===(c=e.messageList)||void 0===c?void 0:c.length))return o._msgHash[n.id].reject({type:d.MAX_LIMIT,message:"The number of combined messages exceeded the limit."});var p=Mt([],e.messageList,!0),h=0;if(p.forEach((function(e){(null==e?void 0:e.combineLevel)>h&&(h=null==e?void 0:e.combineLevel)})),n.combineLevel=h+1,n.combineLevel>10)return o._msgHash[n.id].reject({type:d.MAX_LIMIT,message:"The level of the merged message exceeded the limit."});var f=cr.call(o,p),m=function(t,r){var a,s,c,u,l,d,p="".concat(o.apiUrl,"/").concat(o.orgName,"/").concat(o.appName,"/chatfiles/").concat(t.entities[0].uuid),h=null===(a=t.entities[0])||void 0===a?void 0:a["share-secret"],f=p+"?em-redirect=true";h&&(f="".concat(f,"&share-secret=").concat(h)),i instanceof Function&&i({url:f,secret:h}),e.url=f,e.secret=h,n.url=f,n.secret=t.entities[0]["share-secret"],n.filename=(null===(s=n.file)||void 0===s?void 0:s.filename)||(null==r?void 0:r.fileName),n.file_length=(null===(u=null===(c=n.file)||void 0===c?void 0:c.data)||void 0===u?void 0:u.size)||(null==r?void 0:r.fileLength)||0,null===(d=null===(l=o._localCache)||void 0===l?void 0:l.getInstance())||void 0===d||d.storeMessage(e,Ne.INPROGRESS);var m=ir.call(o,n);pr.call(o,m)},g=_e.getEnvInfo();if("web"!==g.platform&&"node"!==g.platform&&"quick_app"!==g.platform&&(null===(l=null===(u=g.global)||void 0===u?void 0:u.canIUse)||void 0===l?void 0:l.call(u,"getFileSystemManager"))){var y=g.global.getFileSystemManager(),v="".concat(o.apiUrl,"/").concat(o.orgName,"/").concat(o.appName,"/chatfiles");y.writeFile({filePath:"".concat(g.global.env.USER_DATA_PATH,"/combine"),data:f.buffer,encoding:"binary",success:function(e){g.global.uploadFile({url:v,filePath:"".concat(g.global.env.USER_DATA_PATH,"/combine"),name:"file",header:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+n.accessToken},success:function(e){if(200===e.statusCode){B.debug("upload success",e);var t=JSON.parse(e.data);m(t,{fileName:"combine",fileLength:f.length})}else B.debug("upload fail"),n.onFileUploadError instanceof Function&&n.onFileUploadError(e),this._msgHash[n.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})},fail:function(t){B.debug("upload fail"),n.onFileUploadError instanceof Function&&n.onFileUploadError(e),this._msgHash[n.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:t})}})},fail:function(e){B.debug("write file fail",e),this._msgHash[n.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})}})}else{var T=new File([f],"combine",{type:"application/octet-stream"}),_={url:URL.createObjectURL(T),filename:n.id,data:T};n.file=_,n.onFileUploadComplete=function(e){m(e)},n.onFileUploadError=function(e){a instanceof Function&&a(e),o._msgHash[n.id].reject({type:d.WEBIM_UPLOADFILE_ERROR,message:"Failed to upload the merge message.Please try again",data:e})},_e.uploadFile.call(o,n,E.UPLOAD_MSG_ATTACH)}}))}"img"===e.type&&(n.body||(n.body=Ct(Ct({},n),{size:{width:n.width||0,height:n.height||0}}))),null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r||r.storeMessage(e,Ne.INPROGRESS);var s=ir.call(this,n);pr.call(this,s)}function sr(e,t){e.editMessageId||bt.includes(e.type)&&(this._msgHash[e.id].thirdMessage=t)}function cr(e){for(var t=Uint8Array.from("cm",(function(e){return e.charCodeAt(0)})),r=0;r>8*(3-c)&255;B.debug("message length:",s);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;r0){var v=t.translateMessage||t.translation.translateMessage;if(!v)throw new Error("there is no method to translate message");v.call(t,{text:e.msg,languages:e.msgConfig.languages}).then((function(r){var o,n,i,a=null===(o=r.data[0])||void 0===o?void 0:o.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===(n=t._localCache)||void 0===n?void 0:n.getInstance())||void 0===i||i.storeMessage(e,Ne.INPROGRESS);var s=ir.call(t,e);pr.call(t,s,e.id)})).catch((function(e){o(e)}))}else{g&&(null===(u=null===(c=t._localCache)||void 0===c?void 0:c.getInstance())||void 0===u||u.storeMessage(e,Ne.INPROGRESS));var T=ir.call(t,e);pr.call(t,T,e.id)}}))}function pr(e,t){var r,o=this;if(e.isHandleChatroom){if(!this.isOpened()){var n={data:"",type:d.WEBIM_CONNCTION_DISCONNECTED,message:"websocket has been disconnected"};if(S.has(e.id)){var i=S.get(e.id);(0,i.rpt)({isEndApi:!0,data:{isSuccess:0,requestName:i.requestName,requestMethod:"WEBSOCKET",requestUrl:this.url,code:T.disconnect,codeDesc:"websocket has been disconnected"}}),S.delete(e.id)}return Promise.reject(n)}return new Promise((function(r,n){var i;o._msgHash[e.id]=Ct(Ct({},e),{resolve:r,reject:n}),i="miniCore"===o.name?e.joinMsg:wt.call(o,e.joinMsg,t);var a=t&&setTimeout((function(){var t,r,n;if(o._msgHash[e.id]){var i={type:d.REQUEST_TIMEOUT,message:"request timeout"};null===(r=(t=o._msgHash[e.id]).reject)||void 0===r||r.call(t,i),clearTimeout(null===(n=o._msgHash[e.id])||void 0===n?void 0:n.messageTimer),delete o._msgHash[e.id],o.reconnecting||o.reconnect(!0)}}),W);o._msgHash[e.id].messageTimer=a,o.sock.send(i)}))}if(!this.isOpened())return null===(r=this.unMSyncSendMsgMap)||void 0===r||r.set(t,e),!this.logOut&&this.autoReconnectNumTotalg.UNKNOWOPERATION&&tg.REST_OPERATE&&tg.MSYNC_OPERATE&&tg.ROSTER_OPERATE&&tg.USER_OPERATE&&tg.GROUP_OPERATE&&t=e.eventQueue.length-1&&(e.eventQueue=[])}))},e.prototype.init=function(t){e.instance||(e.instance=this,Mr.init({biz:"im",token:"32f24ab2ddb74f508aa9286c356cec84",appId:t.appkey,debug:!1}),this.reportInit())},e.prototype.reportInit=function(){if(this.isCollectDt){var e=this.options,t=e.did,r=e.os,o=e.sdkVersion,n=e.deviceId;this.reportData(9674,{did:t,os:r,sdkVersion:o,deviceId:n})}},e.prototype.geOperateFun=function(e){var t=this;if(!this.isCollectDt)return function(){};var r=1,o=0,n="",i=Rr(),a=e.uid,s=e.operationName;a&&(this.uid=a);var c={uid:this.uid,operationId:"opr_".concat(_e.getUniqueId(),"_").concat(Ir()),requestid:"req_".concat(_e.getUniqueId(),"_").concat(Ir()),operationName:s};return function(e){var a,u,l,d;if(e.data.isSuccess?(o=0,n=""):(0===e.data.code&&(e.data.code=A),o=null!==(a=e.data.code)&&void 0!==a?a:o,n=null!==(u=e.data.codeDesc)&&void 0!==u?u:n),(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(Ir()),r=1),e.data.isLastApi){var p=Rr();e.data.requestElapse=p-i,e.data.requestMethod="",e.data.subrequestid="0",e.data.code=200===o?0:o,e.data.codeDesc=n}else e.data.requestName||(e.data.requestName=s);e.data.requestElapse||(e.data.requestElapse=Rr()-i),t.reportData.call(t,N,br(br(br(br({},Ur),c),e.data),{accessChannel:t.accessChannel,operationType:_r(s)})),e.isEndApi&&t.reportData.call(t,N,br(br(br({},c),Ur),{isSuccess:e.data.isSuccess,isLastApi:1,subrequestid:"0",requestMethod:"",code:200===o?0:o,codeDesc:n,requestElapse:e.data.requestElapse,accessChannel:t.accessChannel,operationType:_r(s)}))}},e.prototype.reportData=function(e,t){return r=this,o=void 0,i=function(){var r,o,n,i,a,s,c,u;return function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]0&&e.pageSize>0),c={url:"".concat(this.apiUrl,"/").concat(n,"/").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}),B.debug("Call getConversationlist"),se.call(this,c,E.GET_SESSION_LIST).then((function(e){return qr.call(t,e)}))}function qr(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=Ce.call(t,e.meta,{formatCustomExts:!1})):e.lastMessage=e.meta,delete e.meta})),e}function zr(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));if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r,o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s=o.jid;r="singleChat"===e.chatType?"chat":"groupChat";var c={url:"".concat(this.apiUrl,"/").concat(n,"/").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 B.debug("Call deleteSession",e),se.call(this,c,E.DELETE_SESSION)}var Vr=zr;function Jr(e,t){if(!vt.call(this)){var r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var o=this.context,n=o.orgName,i=o.appName,a=o.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),o=encodeURIComponent(e[t]);l.push(r+"="+o)}})),c=l.join("&")}var p={url:"".concat(this.apiUrl,"/").concat(n,"/").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 B.debug("Call updateOwnUserInfo",e),se.call(this,p,E.UPDATE_USER_INFO)}var Xr=Jr;function Yr(e,t){if(!vt.call(this)){var r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var o,n=this.context,i=n.orgName,a=n.appName,s=n.accessToken,c=[];if("string"==typeof e)c=[e];else{if("[object Array]"!==Object.prototype.toString.call(e))throw new Error("illegal params");c=e}o="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:o}),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return B.debug("Call fetchUserInfoById",e),se.call(this,u,E.GET_USER_INFO)}function Qr(e){if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/users/").concat(this.user),type:"PUT",dataType:"json",data:JSON.stringify({nickname:e}),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return B.debug("Call updateCurrentUserNick",e),se.call(this,a)}function Zr(e){if("string"!=typeof e||""===e)throw Error('Invalid parameter: "token"');var t=this.context,r=t.orgName,o=t.appName,n={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(o,"/sdk/users/").concat(this.user,"/token/expires"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json"}};return B.debug("Call getTokenExpireTimestamp",e),se.call(this,n,E.SDK_INTERNAL)}function $r(e){var t=this;return new Promise((function(r,o){if(!e.queue)throw Error('Invalid parameter: "specified"');if(!vt.call(t)){var n=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(n)}(function e(t){var n=this,i=t.count||20;eo.call(this,{count:i,isGroup:!!t.isGroup,queue:t.queue,start:t.start,format:t.format,success:function(o){if(o.msgs.length>=i||o.is_last){var a=o.msgs.splice(0,i).reverse();t.success&&t.success(a),r(a)}else e.call(n,wr(wr({},t),{start:null}))},fail:function(e){o(e),t.fail&&t.fail(e)}})}).call(t,e),B.debug("Call fetchHistoryMessages",e)}))}function eo(e){var t=this,r=e.queue,o=this.mr_cache[r]||(this.mr_cache[r]={msgs:[]}),n=this.context.userId,i=e.start||-1,a=e.count||20;if(o.msgs.length>=a||o.is_last)"function"==typeof e.success&&e.success(o);else{o&&o.next_key&&(i=o.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,p={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(n,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"},data:JSON.stringify(s),success:function(r){return kr(t,void 0,void 0,(function(){var t,n,i,a,s,c,u=this;return Lr(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(o),o.is_last=!0,o.next_key="",[2];n=t.msgs,i=n.length,o.is_last=t.is_last,o.next_key=t.next_key,a=function(t){return kr(u,void 0,void 0,(function(){var r,o,n,i,a;return Lr(this,(function(s){switch(s.label){case 0:for(r=[],t=Oe().atob(t),o=0,n=t.length;o18))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 vt.call(this)?(o=this.context,n=o.orgName,i=o.appName,a=o.userId,s="singleChat"===e.chatType?"userId":"groupId",c="singleChat"===e.chatType?"chat":"group",u=e.messageIds?"".concat(this.apiUrl,"/").concat(n,"/").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(n,"/").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"}},B.debug("Call removeHistoryMessages",e),[4,se.call(this,l)]):(r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(r)]);case 1:return p.sent(),[2]}}))}))}function So(e){var t=this;if(!vt.call(this)){var r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});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));var o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s={url:"".concat(this.apiUrl,"/").concat(n,"/").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},headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return B.debug("Call getServerConversations",e),new Promise((function(e,r){se.call(t,s,E.GET_SESSION_LIST).then((function(r){return kr(t,void 0,void 0,(function(){var t,o,n=this;return Lr(this,(function(i){switch(i.label){case 0:return t=Co.call(this,r),this._localCache?(o=t.data.conversations.map((function(e){return kr(n,void 0,void 0,(function(){var t,r,o,n;return Lr(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,Ne.SUCCESS,!0)];case 1:return i.sent(),[4,null===(n=null===(o=this._localCache)||void 0===o?void 0:o.getInstance())||void 0===n?void 0:n.updateLocalConversation(Ae({conversationId:e.conversationId,conversationType:e.conversationType}),{unReadCount:e.unReadCount})];case 2:return i.sent(),[2]}}))}))})),[4,Promise.all(o)]):[3,2];case 1:i.sent(),i.label=2;case 2:return e(t),[2]}}))}))})).catch((function(e){r(e)}))}))}function Co(e){var t=this,r=e.data,o=r.cursor,n=r.channel_infos,i=[];null==n||n.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=Ce.call(t,e.meta)).type&&"read"!==r.type&&"channel"!==r.type&&(r.chatType=Se[r.chatType]));var o={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&&(o.marks=e.marks.map((function(e){return it[e]}))),i.push(o)}));var a={conversations:i,cursor:o||""};return{type:e.type,data:a}}function No(e){var t=this;if(!vt.call(this)){var r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});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));var o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s={url:"".concat(this.apiUrl,"/").concat(n,"/").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},headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return B.debug("Call getServerPinnedConversations",e),se.call(this,s,E.GET_SESSION_LIST).then((function(e){return Co.call(t,e)}))}function Ao(e){return kr(this,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,u,l,p,h,f,g;return Lr(this,(function(y){if(!vt.call(this))return t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)];if(r=e.conversationId,o=e.conversationType,n=e.isPinned,i="singleChat"===o?"chat":"groupChat","string"!=typeof r||""===r)throw Error("Invalid parameter conversationId: ".concat(r));if(!["singleChat","groupChat"].includes(o))throw Error("Invalid parameter conversationType: ".concat(o));if("boolean"!=typeof n)throw Error("Invalid parameter isPinned: ".concat(n));return a=this.context,s=a.orgName,c=a.appName,u=a.accessToken,l=a.jid,p={type:i,to:r},h=n?"":"type=".concat(i,"&to=").concat(r,"&"),f="".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/user/").concat(this.user,"/user_channel/top?").concat(h,"resource=").concat(l.clientResource),g={url:f,type:n?"POST":"DELETE",dataType:"json",headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},n&&(g.data=JSON.stringify(p)),B.debug("Call pinConversation",e),[2,se.call(this,g,E.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 Mo(e){return kr(this,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,u,l;return Lr(this,(function(p){switch(p.label){case 0:if(t=e.userId,r=e.remark,!vt.call(this))return o=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(o)];if("string"!=typeof t||""===t)throw Error('Invalid parameter: "userId"');if("string"!=typeof r)throw Error('Invalid parameter: "remark"');return B.debug("Call setContactRemark",e),n=this.context,i=n.orgName,a=n.appName,s=n.accessToken,c=n.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,se.call(this,l,E.ROSTER_SET_CONTACT_REMARK)];case 1:return p.sent(),[2]}}))}))}function bo(){if(!vt.call(this)){var e=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(e)}var t=this.context,r=t.orgName,o=t.appName,n=t.accessToken,i={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(o,"/users/").concat(this.user,"/contacts/users?needReturnRemark=true"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+n}};return B.debug("Call getAllContacts"),se.call(this,i,E.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 Uo(e){if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}B.debug("Call getContactsWithCursor",e);var r=e||{},o=r.pageSize,n=void 0===o?20:o,i=r.cursor,a=void 0===i?"":i;if(n&&"number"!=typeof n)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));var s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,p={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(this.user,"/contacts?needReturnRemark=true&limit=").concat(n,"&cursor=").concat(a),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+l}};return se.call(this,p,E.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE).then((function(e){var t,r,o=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.contacts)||[],n=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.cursor)||"",i=o.map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:{cursor:n,contacts:i}}}))}function Po(e){return kr(this,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,u,l,p,h,f,g,y;return Lr(this,(function(v){switch(v.label){case 0:if(!vt.call(this))return t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)];if(B.debug("Call markConversation",e),o=(r=e||{}).conversations,n=void 0===o?[]:o,i=r.mark,a=r.isMarked,!Array.isArray(n))throw Error("Invalid parameter conversations");if(s=n.map((function(e){if(!e.conversationId||!["singleChat","groupChat"].includes(e.conversationType))throw Error("Invalid parameter conversations");return{to:e.conversationId,type:Dr[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,p=c.accessToken,h=c.userId,f=c.jid,g={mark:it[i],targets:s},y={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(h,"/user_channels/mark?resource=").concat(f.clientResource),dataType:"json",data:JSON.stringify(g),type:a?"Post":"Delete",headers:{Authorization:"Bearer "+p}},[4,se.call(this,y,E.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&&B.debug("markConversation has ignored conversations",r.map((function(e){return{conversationId:e.to,conversationType:Se[e.type]}})))}))];case 1:return v.sent(),[2]}}))}))}function wo(e){return kr(this,void 0,void 0,(function(){var t,r;return Lr(this,(function(o){return B.debug("Call addConversationMark",e),t=e.conversations,r=e.mark,[2,Po.call(this,{conversations:t,mark:r,isMarked:!0})]}))}))}function ko(e){return kr(this,void 0,void 0,(function(){var t,r;return Lr(this,(function(o){return B.debug("Call removeConversationMark",e),t=e.conversations,r=e.mark,[2,Po.call(this,{conversations:t,mark:r,isMarked:!1})]}))}))}function Lo(e){var t,r,o=this;if(!vt.call(this)){var n=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(n)}if(B.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,p=e.cursor,h=((null==e?void 0:e.filter)||{}).mark,f={url:u,type:"GET",dataType:"json",data:{limit:l||10,cursor:p||"",need_mark:!0,mark:it[h]},headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return se.call(this,f,E.GET_SESSION_LIST).then((function(e){return Co.call(o,e)}))}function Do(){if(!vt.call(this)){var e=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(e)}B.debug("Call getSelfIdsOnOtherPlatform");var t=this.context,r=t.orgName,o=t.appName,n=t.accessToken,i=t.userId,a=t.jid,s={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(o,"/users/").concat(i,"/resources"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+n,"Content-Type":"application/json"}};return se.call(this,s,E.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})),o=null==r?void 0:r.map((function(e){return"".concat(i,"/").concat(e.res)}));return{type:e.type,data:o}}))}function xo(){var e,t,r,o,n,i;return kr(this,void 0,void 0,(function(){var a,s,c,u,l,p,h,f,g;return Lr(this,(function(y){switch(y.label){case 0:return vt.call(this)?(B.debug("Call deleteAllMessagesAndConversations"),s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,p=s.userId,h=s.jid,f="".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/message/roaming/user/").concat(p,"/delete/all?resource=").concat(h.clientResource),g={url:f,type:"POST",dataType:"json",headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}},[4,se.call(this,g,E.REST_DELETE_MESSAGES_CONVERSATIONS)]):(a=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(a)]);case 1:return y.sent(),null===(t=null===(e=this._localCache)||void 0===e?void 0:e.getInstance())||void 0===t||t.clearConversationMap(),[4,null===(o=null===(r=this._localCache)||void 0===r?void 0:r.getInstance())||void 0===o?void 0:o.clearStoreData("conversationList")];case 2:return y.sent(),[4,null===(i=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===i?void 0:i.clearStoreData("message")];case 3:return y.sent(),[2]}}))}))}function Go(e){return kr(this,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,u,l,p,h,f,g,y;return Lr(this,(function(v){switch(v.label){case 0:if(!vt.call(this))return t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)];if(B.debug("Call setMessagePinStatus",e),o=(r=e||{}).conversationId,n=void 0===o?"":o,i=r.conversationType,a=r.messageId,s=r.isPinned,"string"!=typeof n||""===n)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,p=c.accessToken,h=c.userId,f=c.jid,g={to:n,type:Dr[i],pin_msg_id:a},y={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(h,"/user_channel/pin?resource=").concat(f.clientResource),dataType:"json",data:JSON.stringify(g),type:s?"Post":"Delete",headers:{Authorization:"Bearer "+p}},[4,se.call(this,y,E.REST_PIN_MESSAGE)];case 1:return v.sent(),[2]}}))}))}function Bo(e){return kr(this,void 0,void 0,(function(){var t,r,o,n;return Lr(this,(function(i){return B.debug("Call pinMessage",e),r=(t=e||{}).conversationType,o=t.conversationId,n=t.messageId,[2,Go.call(this,{conversationId:o,conversationType:r,messageId:n,isPinned:!0})]}))}))}function Ho(e){return kr(this,void 0,void 0,(function(){var t,r,o,n;return Lr(this,(function(i){return B.debug("Call unpinMessage",e),r=(t=e||{}).conversationType,o=t.conversationId,n=t.messageId,[2,Go.call(this,{conversationId:o,conversationType:r,messageId:n,isPinned:!1})]}))}))}function jo(e){var t=this;if(!vt.call(this)){var r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}B.debug("Call getServerPinnedMessages",e);var o=e.conversationId,n=e.conversationType,i=e.pageSize,a=e.cursor;if("string"!=typeof o||""===o)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,p={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/user/").concat(this.user,"/user_channel/pin"),type:"GET",dataType:"json",data:{to:o,type:Dr[n],limit:i||10,cursor:a||""},headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}};return se.call(this,p,E.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,o=e.pin_opt_at,n=e.pin_operator;return{message:Ce.call(t,r,{formatChatType:!0}),pinTime:o,operatorId:n}})),cursor:e.data.cursor||""}}}))}function Fo(){var e=this;B.debug("Call unbindPushToken");var t={deviceId:this.clientResource,deviceToken:"",notifierName:this.pushCertificateName};return Rt.call(this,t).then((function(t){return e.isRegisterPush=!1,t}))}var Wo=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},Ko=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]= 0 and "pageSize" should >= 0');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=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):"/users/".concat(this.user,"/joined_chatgroups?pagenum=").concat(e.pageNum,"&pagesize=").concat(e.pageSize),s={url:this.apiUrl+"/"+o+"/"+n+a,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 B.debug("Call getGroup",e),se.call(this,s,E.GET_USER_GROUP).then((function(e){var t=e.uri,r=e.entities,o=[];return t.includes("joined_chatgroups")||(r.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};o.push(t)})),e.entities=o),e}))}function $o(e){if("string"!=typeof e.groupId||"string"!=typeof e.newOwner)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r={newowner:e.newOwner},o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s=o.jid,c={url:"".concat(this.apiUrl,"/").concat(n,"/").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 B.debug("Call changeOwner",e),se.call(this,c,E.CHANGE_OWNER)}var en=$o;function tn(e){if("string"!=typeof e.groupId&&!Array.isArray(e.groupId))throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+o+"/"+n+"/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 B.debug("Call getGroupInfo",e),se.call(this,a,E.GET_GROUP_INFO)}function rn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={groupname:e.groupName,description:e.description,custom:e.ext},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call modifyGroup",e),se.call(this,u,E.MODIFY_GROUP)}function on(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');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r={pagenum:e.pageNum,pagesize:e.pageSize},o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s={url:this.apiUrl+"/"+n+"/"+i+"/chatgroups/"+e.groupId+"/users",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call listGroupMember",e),se.call(this,s,E.LIST_GROUP_MEMBER)}var nn=on;function an(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatgroups/"+a+"/admin",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getGroupAdmin",e),se.call(this,s,E.GET_GROUP_ADMIN)}function sn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={newadmin:e.username},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/admin?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 B.debug("Call setGroupAdmin",e),se.call(this,u,E.SET_GROUP_ADMIN)}var cn=sn;function un(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").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 B.debug("Call removeAdmin",e),se.call(this,u,E.REMOVE_GROUP_ADMIN)}var ln=un;function dn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call destroyGroup",e),se.call(this,c,E.DISSOLVE_GROUP)}var pn=dn;function hn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call quitGroup",e),se.call(this,c,E.QUIT_GROUP)}var fn=hn;function mn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=e.groupId,o={usernames:e.users},n=this.context,i=n.orgName,a=n.appName,s=n.accessToken,c=n.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatgroups/").concat(r,"/invite?resource=").concat(c.clientResource),type:"POST",data:JSON.stringify(o),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call inviteUsersToGroup",e),se.call(this,u,E.INVITE_TO_GROUP)}var gn=mn;function En(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call joinGroup",e),se.call(this,s,E.JOIN_GROUP)}function yn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=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(o,"/").concat(n,"/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 B.debug("Call agreeJoinGroup",e),se.call(this,u,E.AGREE_JOIN_GROUP)}var vn=yn;function Tn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=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(o,"/").concat(n,"/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 B.debug("Call rejectGroupJoinRequest",e),se.call(this,u,E.REJECT_JOIN_GROUP)}var _n=Tn;function Rn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={invitee:e.invitee,verifyResult:!0},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call acceptGroupInvite",e),se.call(this,u,E.AGREE_INVITE_GROUP)}var On=Rn;function In(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={invitee:e.invitee,verifyResult:!1},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call rejectGroupInvite",e),se.call(this,u,E.REJECT_INVITE_GROUP)}var Sn=In;function Cn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=e.groupId,o=e.username,n=this.context,i=n.orgName,a=n.appName,s=n.accessToken,c=n.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatgroups/").concat(r,"/users/").concat(o,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call removeGroupMember",e),se.call(this,u,E.REMOVE_GROUP_MEMBER)}var Nn=Cn;function An(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.users.join(","),u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call removeGroupMembers",e),se.call(this,u,E.MULTI_REMOVE_GROUP_MEMBER)}var Mn=An;function bn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=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(o,"/").concat(n,"/chatgroups/").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 B.debug("Call muteGroupMember",e),se.call(this,u,E.MUTE_GROUP_MEMBER)}var Un=bn;function Pn(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(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").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 B.debug("Call unmuteGroupMember",e),se.call(this,u,E.UNMUTE_GROUP_MEMBER)}var wn=Pn;function kn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatgroups/"+a+"/mute",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getGroupMuteList",e),se.call(this,s,E.GET_GROUP_MUTE_LIST)}var Ln=kn,Dn=kn;function xn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call blockGroupMember",e),se.call(this,u,E.BLOCK_GROUP_MEMBER)}var Gn=xn;function Bn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:e.usernames},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/blocks/users?resource=").concat(a.clientResource),data:JSON.stringify(c),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call blockGroupMembers",e),se.call(this,u,E.BLOCK_GROUP_MEMBERS)}var Hn=Bn;function jn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/blocks/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 B.debug("Call unblockGroupMember",e),se.call(this,u,E.UNBLOCK_GROUP_MEMBER)}var Fn=jn;function Wn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.usernames.join(","),u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/blocks/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 B.debug("Call unblockGroupMembers",e),se.call(this,u,E.UNBLOCK_GROUP_MEMBERS)}var Kn=Wn;function qn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatgroups/"+a+"/blocks/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getGroupBlacklist",e),se.call(this,s,E.GET_GROUP_BLACK_LIST)}var zn=qn,Vn=qn;function Jn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/ban?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call disableSendGroupMsg",e),se.call(this,c,E.DISABLED_SEND_GROUP_MSG)}function Xn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/ban?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call enableSendGroupMsg",e),se.call(this,c,E.ENABLE_SEND_GROUP_MSG)}function Yn(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={usernames:e.users},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/white/users?resource=").concat(a.clientResource),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call addUsersToGroupWhitelist",e),se.call(this,u,E.ADD_USERS_TO_GROUP_WHITE)}var Qn=Yn;function Zn(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/white/users/").concat(e.userName,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call removeGroupAllowlistMember",e),se.call(this,c,E.REMOVE_GROUP_WHITE_MEMBER)}var $n=Zn,ei=Zn;function ti(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatgroups/"+a+"/white/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getGroupAllowlist",e),se.call(this,s,E.GET_GROUP_WHITE_LIST)}var ri=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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.groupId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatgroups/"+a+"/white/users/"+e.userName,type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call isInGroupAllowlist",e),se.call(this,s,E.IS_IN_GROUP_WHITE_LIST)}var ni=oi,ii=oi;function ai(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.userId,s={url:this.apiUrl+"/"+o+"/"+n+"/sdk/chatgroups/"+e.groupId+"/mute/"+a,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i}};return B.debug("Call isInGroupMutelist",e),se.call(this,s).then((function(e){return{type:e.type,data:e.data}}))}function si(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+o+"/"+n+"/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 B.debug("Call getGroupMsgReadUser",e),se.call(this,a,E.GET_GROUP_MSG_READ_USER)}function ci(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.groupId,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(a,"/announcement"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call fetchGroupAnnouncement",e),se.call(this,s,E.GET_GROUP_ANN)}function ui(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("string"!=typeof e.announcement)throw Error('Invalid parameter: "announcement"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c={announcement:e.announcement},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(s,"/announcement?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 B.debug("Call updateGroupAnnouncement",e),se.call(this,u,E.UPDATE_GROUP_ANN)}function li(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if("object"!=typeof e.file)throw Error('Invalid parameter: "file"');if(vt.call(this)){var t=this.context,r=t.orgName,o=t.appName,n=t.accessToken,i=t.jid,a=e.groupId;ge.call(this,{uploadUrl:"".concat(this.apiUrl,"/").concat(r,"/").concat(o,"/chatgroups/").concat(a,"/share_files?resource=").concat(i.clientResource),onFileUploadProgress:e.onFileUploadProgress,onFileUploadComplete:e.onFileUploadComplete,onFileUploadError:e.onFileUploadError,onFileUploadCanceled:e.onFileUploadCanceled,accessToken:n,apiUrl:this.apiUrl,file:e.file,appKey:this.context.appKey},E.UPLOAD_GROUP_FILE),B.debug("Call uploadGroupSharedFile",e)}}function di(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.groupId,c=e.fileId,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call deleteGroupSharedFile",e),se.call(this,u,E.DELETE_GROUP_FILE)}function pi(e){if("string"!=typeof e.groupId||""===e.groupId)throw Error('Invalid parameter: "groupId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.pageNum||1,s=e.pageSize||10,c=e.groupId,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatgroups/").concat(c,"/share_files?pagenum=").concat(a,"&pagesize=").concat(s),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getGroupSharedFilelist",e),se.call(this,u,E.GET_GROUP_FILE_LIST)}var hi=pi;function fi(e){var t=this.context,r=t.orgName,o=t.appName,n=t.accessToken,i=this.apiUrl,a=e.groupId,s=e.fileId;Ee.call(this,{url:"".concat(i,"/").concat(r,"/").concat(o,"/chatgroups/").concat(a,"/share_files/").concat(s),onFileDownloadComplete:e.onFileDownloadComplete,onFileDownloadError:e.onFileDownloadError,accessToken:n,id:s,secret:e.secret},E.DOWN_GROUP_FILE),B.debug("Call downloadGroupSharedFile",e)}function mi(e){return Wo(this,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,u,l,p;return Ko(this,(function(h){switch(h.label){case 0:if(t=e.groupId,r=e.userId,o=e.memberAttributes,"string"!=typeof t||""===t)throw Error('Invalid parameter: "groupId"');if("string"!=typeof r||""===r)throw Error('Invalid parameter: "userId"');if("object"!=typeof o)throw Error('Invalid parameter: "memberAttributes"');return vt.call(this)?(i=this.context,a=i.orgName,s=i.appName,c=i.accessToken,u=i.jid,l={metaData:o},p={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(s,"/sdk/metadata/chatgroup/").concat(t,"/user/").concat(r,"?resource=").concat(u.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}},B.debug("Call setGroupMemberAttributes",e),[4,se.call(this,p,E.SET_GROUP_MEMBER_ATTRS)]):(n=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(n)]);case 1:return h.sent(),[2]}}))}))}function gi(e){var t=e.groupId,r=e.userId;return Ei.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 Ei(e){var t=e.groupId,r=e.userIds,o=e.keys,n=void 0===o?[]:o;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(n))throw Error('Invalid parameter: "keys"');if(!vt.call(this)){var i=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(i)}var a=this.context,s=a.orgName,c=a.appName,u=a.accessToken,l={targets:r,properties:n},p={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/metadata/chatgroup/").concat(t,"/get"),type:"POST",dataType:"json",data:JSON.stringify(l),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}};return B.debug("Call getGroupMembersAttributes",e),se.call(this,p,E.GET_GROUP_MEMBER_ATTR).then((function(e){return{type:e.type,data:(null==e?void 0:e.data)||{}}}))}function yi(e){var t=this;if("number"!=typeof e.pagenum||"number"!=typeof e.pagesize)throw Error("Invalid parameter");if(!vt.call(this)){var r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var o={pagenum:e.pagenum||1,pagesize:e.pagesize||20},n=this.context,i=n.orgName,a=n.appName,s=n.accessToken,c={url:this.apiUrl+"/"+i+"/"+a+"/chatrooms",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+s},data:o,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 B.debug("Call getChatRooms",e),se.call(this,c,E.GET_CHATROOM_LIST)}function vi(e){if("string"!=typeof e.name)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r={name:e.name,description:e.description,maxusers:e.maxusers,owner:this.user,members:e.members},o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s=o.jid,c={url:"".concat(this.apiUrl,"/").concat(n,"/").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 B.debug("Call createChatRoom",e),se.call(this,c,E.CREATE_CHATROOM)}function Ti(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call destroyChatRoom",e),se.call(this,s,E.DESTROY_CHATROOM)}function _i(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a={url:this.apiUrl+"/"+o+"/"+n+"/chatrooms/"+e.chatRoomId,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getChatRoomDetails",e),se.call(this,a,E.GET_CHATROOM_DETAIL)}function Ri(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=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(o,"/").concat(n,"/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 B.debug("Call modifyChatRoom",e),se.call(this,u,E.MODIFY_CHATROOM)}function Oi(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||"string"!=typeof e.username)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call removeChatRoomMember",e),se.call(this,u,E.REMOVE_CHATROOM_MEMBER)}var Ii=Oi;function Si(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||!Array.isArray(e.users))throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=e.chatRoomId,o=e.users.join(","),n=this.context,i=n.orgName,a=n.appName,s=n.accessToken,c=n.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatrooms/").concat(r,"/users/").concat(o,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call removeChatRoomMembers",e),se.call(this,u,E.MULTI_REMOVE_CHATROOM_MEMBER)}var Ci=Si;function Ni(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId||!Array.isArray(e.users))throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=e.chatRoomId,o={usernames:e.users},n=this.context,i=n.orgName,a=n.appName,s=n.accessToken,c=n.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(a,"/chatrooms/").concat(r,"/users?resource=").concat(c.clientResource),type:"POST",data:JSON.stringify(o),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call addUsersToChatRoom",e),se.call(this,u,E.ADD_USERS_TO_CHATROOM)}function Ai(e){var t=e.roomId,r=e.message,o=void 0===r?"":r,n=e.ext,i=void 0===n?"":n,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");if(!vt.call(this)){var l=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(l)}return B.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:o,success:c,error:u},"join")}function Mi(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error("Invalid parameter");if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}return B.debug("Call leaveChatRoom",e),this.logOut?Promise.reject({type:d.WEBIM_CONNECTION_CLOSED,message:"not login"}):this.mSync.handleChatRoom(e,"leave")}var bi=Mi;function Ui(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');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r={pagenum:e.pageNum,pagesize:e.pageSize},o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s={url:this.apiUrl+"/"+n+"/"+i+"/chatrooms/"+e.chatRoomId+"/users",dataType:"json",type:"GET",data:r,headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call listChatRoomMembers",e),se.call(this,s,E.LIST_CHATROOM_MEMBERS)}var Pi=Ui;function wi(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatrooms/"+a+"/admin",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getChatRoomAdmin",e),se.call(this,s,E.GET_CHATROOM_ADMIN)}function ki(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={newadmin:e.username},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/admin?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 B.debug("Call setChatRoomAdmin",e),se.call(this,u,E.SET_CHATROOM_ADMIN)}function Li(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call removeChatRoomAdmin",e),se.call(this,u,E.REMOVE_CHATROOM_ADMIN)}function Di(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=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(o,"/").concat(n,"/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 B.debug("Call muteChatRoomMember",e),se.call(this,u,E.MUTE_CHATROOM_MEMBER)}function xi(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call unmuteChatRoomMember",e),se.call(this,u,E.REMOVE_MUTE_CHATROOM_MEMBER)}var Gi=xi;function Bi(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatrooms/"+a+"/mute",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getChatRoomMutelist",e),se.call(this,s,E.GET_MUTE_CHATROOM_MEMBERS)}var Hi=Bi,ji=Bi;function Fi(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/blocks/users/").concat(c,"?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call blockChatRoomMember",e),se.call(this,u,E.SET_CHATROOM_MEMBER_TO_BLACK)}var Wi=Fi;function Ki(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:e.usernames},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/blocks/users?resource=").concat(a.clientResource),data:JSON.stringify(c),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Chat blockChatRoomMembers:",u),se.call(this,u,E.MULTI_SET_CHATROOM_MEMBER_TO_BLACK)}var qi=Ki;function zi(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.username,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/blocks/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 B.debug("Call unblockChatRoomMember",e),se.call(this,u,E.REMOVE_CHATROOM_MEMBER_BLACK)}var Vi=zi;function Ji(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c=e.usernames.join(","),u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/blocks/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 B.debug("Call unblockChatRoomMembers",e),se.call(this,u,E.MULTI_REMOVE_CHATROOM_MEMBER_BLACK)}var Xi=Ji;function Yi(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatrooms/"+a+"/blocks/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getChatRoomBlocklist",e),se.call(this,s,E.GET_CHATROOM_BLOCK_MEMBERS)}var Qi=Yi,Zi=Yi;function $i(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/ban?resource=").concat(a.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call disableSendChatRoomMsg",e),se.call(this,c,E.DISABLED_CHATROOM_SEND_MSG)}function ea(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/ban?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call enableSendChatRoomMsg",e),se.call(this,c,E.ENABLE_CHATROOM_SEND_MSG)}function ta(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!Array.isArray(e.users))throw Error('Invalid parameter: "users"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={usernames:e.users},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/white/users?resource=").concat(a.clientResource),type:"POST",data:JSON.stringify(c),dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call addUsersToChatRoomWhitelist",e),se.call(this,u,E.ADD_USERS_TO_CHATROOM)}var ra=ta;function oa(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.chatRoomId,c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/white/users/").concat(e.userName,"?resource=").concat(a.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call removeChatRoomAllowlistMember",e),se.call(this,c,E.REMOVE_CHATROOM_WHITE_USERS)}var na=oa,ia=oa;function aa(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+o+"/"+n+"/chatrooms/"+a+"/white/users",type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getChatRoomAllowlist",e),se.call(this,s,E.GET_CHATROOM_WHITE_USERS)}var sa=aa;function ca(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.chatRoomId,s={url:this.apiUrl+"/"+o+"/"+n+"/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 B.debug("Call isInChatRoomAllowlist",e),se.call(this,s,E.CHECK_CHATROOM_WHITE_USER)}var ua=ca;function la(e){if("string"!=typeof e.chatRoomId||""===e.chatRoomId)throw Error('Invalid parameter: "chatRoomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.userId,s={url:this.apiUrl+"/"+o+"/"+n+"/sdk/chatrooms/"+e.chatRoomId+"/mute/"+a,dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i}};return B.debug("Call isInChatRoomMutelist",e),se.call(this,s).then((function(e){return{type:e.type,data:e.data}}))}function da(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.roomId,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(a,"/announcement"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call fetchChatRoomAnnouncement",e),se.call(this,s,E.GET_CHATROOM_ANN)}function pa(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("string"!=typeof e.announcement)throw Error('Invalid parameter: "announcement"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.roomId,c={announcement:e.announcement},u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/chatrooms/").concat(s,"/announcement?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 B.debug("Call updateChatRoomAnnouncement:",e),se.call(this,u,E.UPDATE_CHATROOM_ANN)}function ha(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if("object"!=typeof e.file)throw Error('Invalid parameter: "file"');if(vt.call(this)){var t=this.context,r=t.orgName,o=t.appName,n=t.accessToken,i=t.jid,a=e.roomId;ge.call(this,{uploadUrl:"".concat(this.apiUrl,"/").concat(r,"/").concat(o,"/chatrooms/").concat(a,"/share_files?resource=").concat(i.clientResource),onFileUploadProgress:e.onFileUploadProgress,onFileUploadComplete:e.onFileUploadComplete,onFileUploadError:e.onFileUploadError,onFileUploadCanceled:e.onFileUploadCanceled,accessToken:n,apiUrl:this.apiUrl,file:e.file,appKey:this.context.appKey},E.UPLOAD_CHATROOM_FILE),B.debug("Call uploadChatRoomSharedFile",e)}}function fa(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"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.jid,s=e.roomId,c=e.fileId,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call deleteChatRoomSharedFile",e),se.call(this,u,E.DELETE_CHATROOM_FILE)}function ma(e){if("string"!=typeof e.roomId||""===e.roomId)throw Error('Invalid parameter: "roomId"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=e.roomId,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call fetchChatRoomSharedFileList",e),se.call(this,s,E.GET_CHATROOM_FILES)}var ga=ma;function Ea(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);if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=(r.jid,e.chatRoomId),s={keys:e.attributeKeys},c={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/metadata/chatroom/").concat(a),type:"POST",dataType:"json",data:JSON.stringify(s),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return B.debug("Call getChatRoomAttributes:",e),se.call(this,c,E.GET_CHATROOM_ATTR).then((function(e){return{data:e.data,type:e.type}}))}function ya(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);if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributes,u=e.autoDelete,l=void 0===u||u,p=e.isForced?"/forced":"",h={metaData:c,autoDelete:l?"DELETE":"NO_DELETE"},f={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/metadata/chatroom/").concat(s,"/user/").concat(a)+p,type:"PUT",dataType:"json",data:JSON.stringify(h),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"}};return B.debug("Call setChatRoomAttributes:",e),se.call(this,f,E.SET_CHATROOM_ATTR).then((function(e){return Tt(e)}))}function va(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);if(!vt.call(this)){var r=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var o=this.context,n=o.orgName,i=o.appName,a=o.accessToken,s=o.userId,c=e.chatRoomId,u=e.attributeKey,l=e.attributeValue,p=e.autoDelete,h=void 0===p||p,f=e.isForced?"/forced":"",g={metaData:(t={},t[u]=l,t),autoDelete:h?"DELETE":"NO_DELETE"},y={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(i,"/metadata/chatroom/").concat(c,"/user/").concat(s)+f,type:"PUT",dataType:"json",data:JSON.stringify(g),headers:{Authorization:"Bearer "+a,"Content-Type":"application/json"}};return B.debug("Call setChatRoomAttribute:",e),se.call(this,y,E.SET_CHATROOM_ATTR).then((function(e){var t=_t(e);if(t)throw t}))}function Ta(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);if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributeKeys,u=e.isForced?"/forced":"",l={keys:c},p={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call removeChatRoomAttributes:",e),se.call(this,p,E.DELETE_CHATROOM_ATTR).then((function(e){return Tt(e)}))}function _a(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);if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.accessToken,a=r.userId,s=e.chatRoomId,c=e.attributeKey,u=e.isForced?"/forced":"",l={keys:[c]},p={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call removeChatRoomAttribute:",e),se.call(this,p,E.DELETE_CHATROOM_ATTR).then((function(e){var t=_t(e);if(t)throw t}))}function Ra(e){var t=this,r=e||{},o=r.pageNum,n=r.pageSize;if(isNaN(o)||o<=0)throw Error("Invalid parameter pageNum:".concat(o));if(isNaN(n)||n<=0)throw Error("Invalid parameter pageSize:".concat(n));if(!vt.call(this)){var i=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(i)}var a={pagenum:o,pagesize:n,detail:!0},s=this.context,c=s.orgName,u=s.appName,l=s.accessToken,p={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 B.debug("Call getJoinedChatRooms",e),se.call(this,p,E.GET_USER_JOINED_CHATROOM).then((function(e){var r=(e.data||[]).map((function(e){var r=e.id,o=e.title,n=e.owner,i=e.created,a=e.description,s=e.max_users;return{id:r,name:o,owner:n.split("".concat(t.appKey,"_"))[1],created:i,description:a,maxusers:s}}));return{type:e.type,data:r}}))}var Oa=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},Ia=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]= 0 and "pageSize" should >= 0');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.orgName,n=r.appName,i=r.userId,a=r.accessToken,s={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(n,"/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 B.debug("Call getSubscribedPresenceList:",e),se.call(this,s).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}var Ma=Aa;function ba(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r={usernames:e.usernames},o=this.context,n=o.orgName,i=o.appName,a=o.userId,s=o.accessToken,c={url:"".concat(this.apiUrl,"/").concat(n,"/").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 B.debug("Call getPresenceStatus:",e),se.call(this,c).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function Ua(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,o=r.startTime,n=r.endTime;if(!(o instanceof Object&&Object.keys(o).length))throw Error('Invalid parameter: "options of startTime"');if(!o.hours||"number"!=typeof o.hours||!o.minutes||"number"!=typeof o.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(n instanceof Object&&Object.keys(n).length))throw Error('Invalid parameter: "options of endTime"');if(!n.hours||"number"!=typeof n.hours||!n.minutes||"number"!=typeof n.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}if(!vt.call(this)){var i=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(i)}var a=this.context,s=a.accessToken,c=a.orgName,u=a.appName,l=a.userId,p=a.jid,h={};switch(t){case 0:h={type:e.options.remindType};break;case 1:h={ignoreDuration:e.options.duration};break;case 2:var f=e.options;o=f.startTime,n=f.endTime,h={ignoreInterval:"".concat(o.hours,":").concat(o.minutes,"-").concat(n.hours,":").concat(n.minutes)}}var g={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(l,"/notification/user/").concat(l,"?resource=").concat(p.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(h),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call setSilentModeForAll:",e),se.call(this,g)}function Pa(e){if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.accessToken,n=r.orgName,i=r.appName,a=r.userId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(i,"/users/").concat(a,"/notification/user/").concat(a),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return B.debug("Call getSilentModeForAll:",e),se.call(this,s)}function wa(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,o=r.startTime,n=r.endTime;if(!(o instanceof Object&&Object.keys(o).length))throw Error('Invalid parameter: "options of startTime"');if(!o.hours||"number"!=typeof o.hours||!o.minutes||"number"!=typeof o.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(n instanceof Object&&Object.keys(n).length))throw Error('Invalid parameter: "options of endTime"');if(!n.hours||"number"!=typeof n.hours||!n.minutes||"number"!=typeof n.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}if(!vt.call(this)){var i=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(i)}var a=this.context,s=a.accessToken,c=a.orgName,u=a.appName,l=a.userId,p=a.jid,h="chatgroup",f={};switch(t){case 0:f={type:e.options.remindType};break;case 1:f={ignoreDuration:e.options.duration};break;case 2:var g=e.options;o=g.startTime,n=g.endTime,f={ignoreInterval:"".concat(o.hours,":").concat(o.minutes,"-").concat(n.hours,":").concat(n.minutes)}}"singleChat"===e.type&&(h="user");var E={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(l,"/notification/").concat(h,"/").concat(e.conversationId,"?resource=").concat(p.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(f),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call setSilentModeForConversation:",e),se.call(this,E)}function ka(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(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.accessToken,n=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(n,"/").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 "+o,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call clearRemindTypeForConversation:",e),se.call(this,u)}function La(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(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.accessToken,n=r.orgName,i=r.appName,a=r.userId,s="chatgroup";"singleChat"===e.type&&(s="user");var c={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(i,"/users/").concat(a,"/notification/").concat(s,"/").concat(e.conversationId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getSilentModeForConversation:",e),se.call(this,c)}function Da(e){if(!Array.isArray(e.conversationList))throw Error('Invalid parameter: "conversationList"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.accessToken,n=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(","):"",p={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(i,"/users/").concat(a,"/notification?user=").concat(u,"&group=").concat(l),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call getSilentModeForConversations:",e),se.call(this,p)}function xa(e){if("string"!=typeof e.language||!e.language)throw Error('Invalid parameter: "language"');if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r={translationLanguage:e.language},o=this.context,n=o.accessToken,i=o.orgName,a=o.appName,s=o.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 "+n,"Content-Type":"application/json"},success:e.success,error:e.error};return B.debug("Call setPushPerformLanguage:",e),se.call(this,c)}function Ga(e){if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,o=r.accessToken,n=r.orgName,i=r.appName,a=r.userId,s={url:"".concat(this.apiUrl,"/").concat(n,"/").concat(i,"/users/").concat(a,"/notification/language"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return B.debug("Call getPushPerformLanguage:",e),se.call(this,s)}function Ba(e){if(!vt.call(this)){var t=m.create({type:d.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}if("number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageSize"');var r=this.context,o=r.accessToken,n=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(n,"/").concat(i,"/users/").concat(a,"/notification/mute/type"),type:"GET",dataType:"json",data:s,headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return B.debug("Call getSilentModeRemindTypeConversations:",e),se.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 Ha=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},ja=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]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"),B.info("onTokenWillExpire",Math.floor(e/2))}),e/2),this.tokenExpiredTimer=setTimeout((function(){var e;B.info("onTokenExpired",0),t.onTokenExpired&&t.onTokenExpired(),null===(e=t.eventHandler)||void 0===e||e.dispatch("onTokenExpired"),t.close()}),e)},r.prototype.compareTokenExpireTime=function(e,t){var r,o=Number(t)-Number(e);B.debug("compareTokenExpireTime",o),o<=this.expiresIn/2&&o>0?(this.onTokenWillExpire&&this.onTokenWillExpire(),null===(r=this.eventHandler)||void 0===r||r.dispatch("onTokenWillExpire"),B.info("onTokenWillExpire",o)):o<=0&&(this.closeByTokenExpired(),B.info("closeByTokenExpired",o))},r.prototype.closeByTokenExpired=function(){var e;B.info("closed By TokenExpired"),this.onTokenExpired&&this.onTokenExpired(),null===(e=this.eventHandler)||void 0===e||e.dispatch("onTokenExpired"),this.close()},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 o,n,i;(null===(o=e.unMSyncSendMsgMap)||void 0===o?void 0:o.has(t))||(e._msgHash[t].reject instanceof Function&&e._msgHash[t].reject(r),null===(i=null===(n=e._localCache)||void 0===n?void 0:n.getInstance())||void 0===i||i.updateLocalMessage(t,{serverMsgId:t,status:Ne.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 B.warn("The user has already logged out when reconnecting");B.debug("socket reconnect readyState",this.sock.readyState),(this.sock.readyState!==ss.CONNECTING||e)&&(this.sock.readyState!==ss.OPEN||e)&&(B.info("reconnect: time",this.times),B.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.hostIndex1024)throw new Error("ext length must be less than 1024")}this.loginInfoCustomExt=e},r.prototype.onShow=function(){var e=this;B.debug("execute onshow callback",this.lastHeartbeat),!this.logOut&&!this.reconnecting&&Date.now()-this.lastHeartbeat>2e3&&(B.debug("send ping"),this.mSync.sendUnreadDeal(),this.probingTimer&&clearTimeout(this.probingTimer),this.probingTimer=setTimeout((function(){B.error("Websocket connection timeout"),e.logOut||e.reconnecting||e.reconnect(!0)}),8e3))},r._getSock=function(){},r}();function us(e,t){var r=t.rpt,o=t.isRetry,n=this.apiUrl+"/"+this.orgName+"/"+this.appName+"/users",i={requestName:y.RESISTER,requestUrl:n},a={headers:{"Content-type":"application/json"},url:n,dataType:"json",data:JSON.stringify({username:e.username,password:e.password,nickname:e.nickname||""})};return _e.ajax(a,E.SDK_INTERNAL).then((function(e){var t=rs(rs({},e),{type:d.REQUEST_SUCCESS}),n=e.extraInfo,a=n.httpCode,s=n.elapse;return r({isEndApi:!0,isRetry:o,data:rs(rs({},{requestElapse:s,isSuccess:1,code:a}),i)}),t})).catch((function(e){var t=e.extraInfo,n=t.elapse,a=t.httpCode,s=t.errDesc;throw r({isRetry:o,data:rs(rs({},{requestElapse:n,isSuccess:0,code:a,codeDesc:s}),i)}),e}))}function ls(e,t){return os(this,void 0,void 0,(function(){var r,o;return ns(this,(function(n){switch(n.label){case 0:r=t.rpt,n.label=1;case 1:return n.trys.push([1,3,,7]),[4,us.call(this,e,t)];case 2:return[2,n.sent()];case 3:return!((o=n.sent()).message.includes("Open registration doesn't allow")||o.message.includes("username be unique")||o.message.includes("is not legal"))&&this.isHttpDNS&&this.restIndex+1this.restTotal)return B.debug("restIndex > restTotal"),"";var r="",o=this.restHosts[this.restIndex],n=o.domain,i=o.ip,a=o.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+"//"+n,a&&"80"!==a&&"443"!==a&&(r+=":".concat(a)),"undefined"==typeof window||window.location||(r="https://"+n),"undefined"!=typeof window&&window.location&&"file:"===(null===(t=window.location)||void 0===t?void 0:t.protocol)&&(r="https://"+n)),"undefined"==typeof window&&(r=s+"//"+n),this.apiUrl=r,r}var Os=_e.getEnvInfo(),Is=Os.global;p.util.Long=f(),p.configure();var Ss=p.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}},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}},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}}}},Type:{values:{NORMAL:0,CHAT:1,GROUPCHAT:2,CHATROOM:3,READ_ACK:4,DELIVER_ACK:5,RECALL:6,CHANNEL_ACK:7,EDIT:8}},MessageConfig:{fields:{allowGroupAck:{type:"bool",id:1}}}}},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}},nested:{Version:{values:{MSYNC_V1:0,MSYNC_V2:1}},Command:{values:{SYNC:0,UNREAD:1,NOTICE:2,PROVISION:3}}}},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}},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},sessionId:{type:"string",id:20},reason:{type:"string",id:21}},nested:{OsType:{values:{OS_IOS:0,OS_ANDROID:1,OS_LINUX:2,OS_OSX:3,OS_WIN:4,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}}}},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}},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}},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_OTHER:16}},NetworkType:{values:{NETWORK_NONE:0,NETWORK_WIFI:1,NETWORK_4G:2,NETWORK_3G:3,NETWORK_2G:4,NETWORK_WIRE:5}}}}}}}}}});cs.prototype.root=Ss;var Cs=function(e){this.onOpen=Is.onSocketOpen,this.onClose=Is.onSocketClose,this.onMessage=Is.onSocketMessage,this.onError=Is.onSocketError,this.close=Is.closeSocket,this.send=Is.sendSocketMessage,this.connectSocket=Is.connectSocket,this.readyState=3,this.offSocketOpen=Is.offSocketOpen,this.offSocketMessage=Is.offSocketMessage,this.offSocketError=Is.offSocketError,this.offSocketClose=Is.offSocketClose,this.connect=function(){this.offSocketOpen(),this.offSocketMessage(),this.offSocketClose(),this.offSocketError(),Is.connectSocket({url:e.url,header:{"content-type":"application/json"},success:function(e){},fail:function(){}})}};cs.prototype._getSock=function(){var e,t=this;return this.sock&&this.sock.close&&this.sock.close(),(e="zfb"===Os.platform||"dd"===Os.platform?new Cs(this):Is.connectSocket({url:this.url,header:{"content-type":"application/json"},success:function(e){B.debug("socket connect success",e)},fail:function(e){B.debug("socket connect fail",e),t.reconnecting=!1,e.errMsg.indexOf("suspend")},complete:function(){}})).connect&&e.connect(),e},cs.prototype.getUniqueId=_e.getUniqueId,cs.prototype.deviceId="miniProgram_"+Os.platform,cs.prototype._localCache=void 0;var Ns=B.getLogger("defaultLogger");Ns.setConfig({useCache:!1,maxCache:3145728}),Ns.enableAll(),_e.ajax=_e.wxRequest;var As={connection:cs,message:We,utils:_e,logger:Ns,statusCode:d}}(),o}()}));