Files
tk-mini-program/unpackage/dist/build/mp-weixin/common/vendor.js
pengxiaolong 7116e57fc3 优化
2025-07-21 22:10:59 +08:00

34 lines
1.3 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
/**
* @vue/shared v3.4.21
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
function e(e,t){const n=new Set(e.split(","));return t?e=>n.has(e.toLowerCase()):e=>n.has(e)}const t={},n=[],i=()=>{},o=()=>!1,s=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),a=e=>e.startsWith("onUpdate:"),r=Object.assign,c=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},u=Object.prototype.hasOwnProperty,l=(e,t)=>u.call(e,t),d=Array.isArray,p=e=>"[object Map]"===I(e),h=e=>"[object Set]"===I(e),g=e=>"function"==typeof e,f=e=>"string"==typeof e,m=e=>"symbol"==typeof e,_=e=>null!==e&&"object"==typeof e,v=e=>(_(e)||g(e))&&g(e.then)&&g(e.catch),y=Object.prototype.toString,I=e=>y.call(e),M=e=>"[object Object]"===I(e),C=e=>f(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,S=e(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),E=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},T=/-(\w)/g,k=E((e=>e.replace(T,((e,t)=>t?t.toUpperCase():"")))),D=/\B([A-Z])/g,R=E((e=>e.replace(D,"-$1").toLowerCase())),O=E((e=>e.charAt(0).toUpperCase()+e.slice(1))),b=E((e=>e?`on${O(e)}`:"")),A=(e,t)=>!Object.is(e,t),L=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},P=e=>{const t=parseFloat(e);return isNaN(t)?e:t};function N(e){if(d(e)){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=f(i)?x(i):N(i);if(o)for(const e in o)t[e]=o[e]}return t}if(f(e)||_(e))return e}const w=/;(?![^(]*\))/g,U=/:([^]+)/,G=/\/\*[^]*?\*\//g;function x(e){const t={};return e.replace(G,"").split(w).forEach((e=>{if(e){const n=e.split(U);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function F(e){let t="";if(f(e))t=e;else if(d(e))for(let n=0;n<e.length;n++){const i=F(e[n]);i&&(t+=i+" ")}else if(_(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const B=(e,t)=>t&&t.__v_isRef?B(e,t.value):p(t)?{[`Map(${t.size})`]:[...t.entries()].reduce(((e,[t,n],i)=>(e[q(t,i)+" =>"]=n,e)),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map((e=>q(e)))}:m(t)?q(t):!_(t)||d(t)||M(t)?t:String(t),q=(e,t="")=>{var n;return m(e)?`Symbol(${null!=(n=e.description)?n:t})`:e},V="onShow",j="onHide",H="onLaunch",K="onError",z="onThemeChange",W="onPageNotFound",Y="onUnhandledRejection",$="onLoad",J="onReady",X="onUnload",Q="onInit",Z="onSaveExitState",ee="onResize",te="onBackPress",ne="onPageScroll",ie="onTabItemTap",oe="onReachBottom",se="onPullDownRefresh",ae="onShareTimeline",re="onShareChat",ce="onAddToFavorites",ue="onShareAppMessage",le="onNavigationBarButtonTap",de="onNavigationBarSearchInputClicked",pe="onNavigationBarSearchInputChanged",he="onNavigationBarSearchInputConfirmed",ge="onNavigationBarSearchInputFocusChanged",fe="virtualHostId";function me(e,t=null){let n;return(...i)=>(e&&(n=e.apply(t,i),e=null),n)}function _e(e,t){if(!f(t))return;const n=(t=t.replace(/\[(\d+)\]/g,".$1")).split(".");let i=n[0];return e||(e={}),1===n.length?e[i]:_e(e[i],n.slice(1).join("."))}function ve(e){let t={};return M(e)&&Object.keys(e).sort().forEach((n=>{const i=n;t[i]=e[i]})),Object.keys(t)?t:e}const ye=/:/g;const Ie=encodeURIComponent;function Me(e,t=Ie){const n=e?Object.keys(e).map((n=>{let i=e[n];return void 0===typeof i||null===i?i="":M(i)&&(i=JSON.stringify(i)),t(n)+"="+t(i)})).filter((e=>e.length>0)).join("&"):null;return n?`?${n}`:""}const Ce=[Q,$,V,j,X,te,ne,ie,oe,se,ae,ue,re,ce,Z,le,de,pe,he,ge];const Se=[V,j,H,K,z,W,Y,"onExit",Q,$,J,X,ee,te,ne,ie,oe,se,ae,ce,ue,re,Z,le,de,pe,he,ge],Ee=(()=>({onPageScroll:1,onShareAppMessage:2,onShareTimeline:4}))();function Te(e,t,n=!0){return!(n&&!g(t))&&(Se.indexOf(e)>-1||0===e.indexOf("on"))}let ke;const De=[];const Re=me(((e,t)=>t(e))),Oe=function(){};Oe.prototype={_id:1,on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n,_id:this._id}),this._id++},once:function(e,t,n){var i=this;function o(){i.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],o=[];if(i&&t){for(var s=i.length-1;s>=0;s--)if(i[s].fn===t||i[s].fn._===t||i[s]._id===t){i.splice(s,1);break}o=i}return o.length?n[e]=o:delete n[e],this}};var be=Oe;const Ae=["{","}"];const Le=/^(?:\d)+/,Pe=/^(?:\w)+/;const Ne="zh-Hans",we="zh-Hant",Ue="en",Ge=Object.prototype.hasOwnProperty,xe=(e,t)=>Ge.call(e,t),Fe=new class{constructor(){this._caches=Object.create(null)}interpolate(e,t,n=Ae){if(!t)return[e];let i=this._caches[e];return i||(i=function(e,[t,n]){const i=[];let o=0,s="";for(;o<e.length;){let a=e[o++];if(a===t){s&&i.push({type:"text",value:s}),s="";let t="";for(a=e[o++];void 0!==a&&a!==n;)t+=a,a=e[o++];const r=a===n,c=Le.test(t)?"list":r&&Pe.test(t)?"named":"unknown";i.push({value:t,type:c})}else s+=a}return s&&i.push({type:"text",value:s}),i}(e,n),this._caches[e]=i),function(e,t){const n=[];let i=0;const o=Array.isArray(t)?"list":(s=t,null!==s&&"object"==typeof s?"named":"unknown");var s;if("unknown"===o)return n;for(;i<e.length;){const s=e[i];switch(s.type){case"text":n.push(s.value);break;case"list":n.push(t[parseInt(s.value,10)]);break;case"named":"named"===o&&n.push(t[s.value])}i++}return n}(i,t)}};function Be(e,t){if(!e)return;if(e=e.trim().replace(/_/g,"-"),t&&t[e])return e;if("chinese"===(e=e.toLowerCase()))return Ne;if(0===e.indexOf("zh"))return e.indexOf("-hans")>-1?Ne:e.indexOf("-hant")>-1?we:(n=e,["-tw","-hk","-mo","-cht"].find((e=>-1!==n.indexOf(e)))?we:Ne);var n;let i=[Ue,"fr","es"];t&&Object.keys(t).length>0&&(i=Object.keys(t));const o=function(e,t){return t.find((t=>0===e.indexOf(t)))}(e,i);return o||void 0}class qe{constructor({locale:e,fallbackLocale:t,messages:n,watcher:i,formater:o}){this.locale=Ue,this.fallbackLocale=Ue,this.message={},this.messages={},this.watchers=[],t&&(this.fallbackLocale=t),this.formater=o||Fe,this.messages=n||{},this.setLocale(e||Ue),i&&this.watchLocale(i)}setLocale(e){const t=this.locale;this.locale=Be(e,this.messages)||this.fallbackLocale,this.messages[this.locale]||(this.messages[this.locale]={}),this.message=this.messages[this.locale],t!==this.locale&&this.watchers.forEach((e=>{e(this.locale,t)}))}getLocale(){return this.locale}watchLocale(e){const t=this.watchers.push(e)-1;return()=>{this.watchers.splice(t,1)}}add(e,t,n=!0){const i=this.messages[e];i?n?Object.assign(i,t):Object.keys(t).forEach((e=>{xe(i,e)||(i[e]=t[e])})):this.messages[e]=t}f(e,t,n){return this.formater.interpolate(e,t,n).join("")}t(e,t,n){let i=this.message;return"string"==typeof t?(t=Be(t,this.messages))&&(i=this.messages[t]):n=t,xe(i,e)?this.formater.interpolate(i[e],n).join(""):(console.warn(`Cannot translate the value of keypath ${e}. Use the value of keypath as default.`),e)}}function Ve(e){return function(){try{return e.apply(e,arguments)}catch(Yr){console.error(Yr)}}}let je=1;const He={};function Ke(e,t,n){if("number"==typeof e){const i=He[e];if(i)return i.keepAlive||delete He[e],i.callback(t,n)}return t}const ze="success",We="fail",Ye="complete";function $e(e,t={},{beforeAll:n,beforeSuccess:i}={}){M(t)||(t={});const{success:o,fail:s,complete:a}=function(e){const t={};for(const n in e){const i=e[n];g(i)&&(t[n]=Ve(i),delete e[n])}return t}(t),r=g(o),c=g(s),u=g(a),l=je++;return function(e,t,n,i=!1){He[e]={name:t,keepAlive:i,callback:n}}(l,e,(l=>{(l=l||{}).errMsg=function(e,t){return e&&-1!==e.indexOf(":fail")?t+e.substring(e.indexOf(":fail")):t+":ok"}(l.errMsg,e),g(n)&&n(l),l.errMsg===e+":ok"?(g(i)&&i(l,t),r&&o(l)):c&&s(l),u&&a(l)})),l}const Je="success",Xe="fail",Qe="complete",Ze={},et={};function nt(e,t){return function(n){return e(n,t)||n}}function it(e,t,n){let i=!1;for(let o=0;o<e.length;o++){const s=e[o];if(i)i=Promise.resolve(nt(s,n));else{const e=s(t,n);if(v(e)&&(i=Promise.resolve(e)),!1===e)return{then(){},catch(){}}}}return i||{then:e=>e(t),catch(){}}}function ot(e,t={}){return[Je,Xe,Qe].forEach((n=>{const i=e[n];if(!d(i))return;const o=t[n];t[n]=function(e){it(i,e,t).then((e=>g(o)&&o(e)||e))}})),t}function st(e,t){const n=[];d(Ze.returnValue)&&n.push(...Ze.returnValue);const i=et[e];return i&&d(i.returnValue)&&n.push(...i.returnValue),n.forEach((e=>{t=e(t)||t})),t}function at(e){const t=Object.create(null);Object.keys(Ze).forEach((e=>{"returnValue"!==e&&(t[e]=Ze[e].slice())}));const n=et[e];return n&&Object.keys(n).forEach((e=>{"returnValue"!==e&&(t[e]=(t[e]||[]).concat(n[e]))})),t}function rt(e,t,n,i){const o=at(e);if(o&&Object.keys(o).length){if(d(o.invoke)){return it(o.invoke,n).then((n=>t(ot(at(e),n),...i)))}return t(ot(o,n),...i)}return t(n,...i)}function ct(e,t){return(n={},...i)=>function(e){return!(!M(e)||![ze,We,Ye].find((t=>g(e[t]))))}(n)?st(e,rt(e,t,r({},n),i)):st(e,new Promise(((o,s)=>{rt(e,t,r({},n,{success:o,fail:s}),i)})))}function ut(e,t,n,i={}){const o=t+":fail";let s="";return s=n?0===n.indexOf(o)?n:o+" "+n:o,delete i.errCode,Ke(e,r({errMsg:s},i))}function lt(e,t,n,i){const o=function(e){e[0]}(t);if(o)return o}function dt(e,t,n,i){return n=>{const o=$e(e,n,i),s=lt(0,[n]);return s?ut(o,e,s):t(n,{resolve:t=>function(e,t,n){return Ke(e,r(n||{},{errMsg:t+":ok"}))}(o,e,t),reject:(t,n)=>ut(o,e,function(e){return!e||f(e)?e:e.stack?("undefined"!=typeof globalThis&&globalThis.harmonyChannel||console.error(e.message+"\n"+e.stack),e.message):e}(t),n)})}}function pt(e,t,n,i){return function(e,t){return(...e)=>{const n=lt(0,e);if(n)throw new Error(n);return t.apply(null,e)}}(0,t)}let ht=!1,gt=0,ft=0;const mt=pt(0,((e,t)=>{if(0===gt&&function(){var e,t;let n,i,o;{const s=(null===(e=wx.getWindowInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync(),a=(null===(t=wx.getDeviceInfo)||void 0===t?void 0:t.call(wx))||wx.getSystemInfoSync();n=s.windowWidth,i=s.pixelRatio,o=a.platform}gt=n,ft=i,ht="ios"===o}(),0===(e=Number(e)))return 0;let n=e/750*(t||gt);return n<0&&(n=-n),n=Math.floor(n+1e-4),0===n&&(n=1!==ft&&ht?.5:1),e<0?-n:n}));function _t(e,t){Object.keys(t).forEach((n=>{g(t[n])&&(e[n]=function(e,t){const n=t?e?e.concat(t):d(t)?t:[t]:e;return n?function(e){const t=[];for(let n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(n):n}(e[n],t[n]))}))}function vt(e,t){e&&t&&Object.keys(t).forEach((n=>{const i=e[n],o=t[n];d(i)&&g(o)&&c(i,o)}))}const yt=pt(0,((e,t)=>{f(e)&&M(t)?_t(et[e]||(et[e]={}),t):M(e)&&_t(Ze,e)})),It=pt(0,((e,t)=>{f(e)?M(t)?vt(et[e],t):delete et[e]:M(e)&&vt(Ze,e)}));const Mt=new class{constructor(){this.$emitter=new be}on(e,t){return this.$emitter.on(e,t)}once(e,t){return this.$emitter.once(e,t)}off(e,t){e?this.$emitter.off(e,t):this.$emitter.e={}}emit(e,...t){this.$emitter.emit(e,...t)}},Ct=pt(0,((e,t)=>(Mt.on(e,t),()=>Mt.off(e,t)))),St=pt(0,((e,t)=>(Mt.once(e,t),()=>Mt.off(e,t)))),Et=pt(0,((e,t)=>{d(e)||(e=e?[e]:[]),e.forEach((e=>{Mt.off(e,t)}))})),Tt=pt(0,((e,...t)=>{Mt.emit(e,...t)}));let kt,Dt,Rt;function Ot(e){try{return JSON.parse(e)}catch(Yr){}return e}const bt=[];function At(e,t){bt.forEach((n=>{n(e,t)})),bt.length=0}const Lt=ct(Pt="getPushClientId",function(e,t,n,i){return dt(e,t,0,i)}(Pt,((e,{resolve:t,reject:n})=>{Promise.resolve().then((()=>{void 0===Rt&&(Rt=!1,kt="",Dt="uniPush is not enabled"),bt.push(((e,i)=>{e?t({cid:e}):n(i)})),void 0!==kt&&At(kt,Dt)}))}),0,Nt));var Pt,Nt;const wt=[],Ut=/^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/,Gt=/^create|Manager$/,xt=["createBLEConnection"],Ft=["request","downloadFile","uploadFile","connectSocket"],Bt=["createBLEConnection"],qt=/^on|^off/;function Vt(e){return Gt.test(e)&&-1===xt.indexOf(e)}function jt(e){return Ut.test(e)&&-1===Bt.indexOf(e)}function Ht(e){return-1!==Ft.indexOf(e)}function Kt(e){return!(Vt(e)||jt(e)||function(e){return qt.test(e)&&"onPush"!==e}(e))}function zt(e,t){return Kt(e)&&g(t)?function(n={},...i){return g(n.success)||g(n.fail)||g(n.complete)?st(e,rt(e,t,r({},n),i)):st(e,new Promise(((o,s)=>{rt(e,t,r({},n,{success:o,fail:s}),i)})))}:t}Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e&&e()).then((()=>n))),(n=>t.resolve(e&&e()).then((()=>{throw n}))))});const Wt=["success","fail","cancel","complete"];const Yt=()=>{const e=g(getApp)&&getApp({allowDefault:!0});return e&&e.$vm?e.$vm.$locale:function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Be(n&&n.language?n.language:Ue)||Ue}return t}()},$t=[];"undefined"!=typeof global&&(global.getLocale=Yt);const Jt="__DC_STAT_UUID";let Xt;function Qt(e=wx){return function(t,n){Xt=Xt||e.getStorageSync(Jt),Xt||(Xt=Date.now()+""+Math.floor(1e7*Math.random()),wx.setStorage({key:Jt,data:Xt})),n.deviceId=Xt}}function Zt(e,t){if(e.safeArea){const n=e.safeArea;t.safeAreaInsets={top:n.top,left:n.left,right:e.windowWidth-n.right,bottom:e.screenHeight-n.bottom}}}function en(e,t){let n="",i="";switch(n=e.split(" ")[0]||t,i=e.split(" ")[1]||"",n=n.toLowerCase(),n){case"harmony":case"ohos":case"openharmony":n="harmonyos";break;case"iphone os":n="ios";break;case"mac":case"darwin":n="macos";break;case"windows_nt":n="windows"}return{osName:n,osVersion:i}}function tn(e,t){let n=e.deviceType||"phone";{const e={ipad:"pad",windows:"pc",mac:"pc"},i=Object.keys(e),o=t.toLowerCase();for(let t=0;t<i.length;t++){const s=i[t];if(-1!==o.indexOf(s)){n=e[s];break}}}return n}function nn(e){let t=e;return t&&(t=t.toLowerCase()),t}function on(e){return Yt?Yt():e}function sn(e){let t=e.hostName||"WeChat";return e.environment?t=e.environment:e.host&&e.host.env&&(t=e.host.env),t}const an={returnValue:(e,t)=>{Zt(e,t),Qt()(e,t),function(e,t){const{brand:n="",model:i="",system:o="",language:s="",theme:a,version:c,platform:u,fontSizeSetting:l,SDKVersion:d,pixelRatio:p,deviceOrientation:h}=e,{osName:g,osVersion:f}=en(o,u);let m=c,_=tn(e,i),v=nn(n),y=sn(e),I=h,M=p,C=d;const S=(s||"").replace(/_/g,"-"),E={appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(S),uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75",uniPlatform:"mp-weixin",deviceBrand:v,deviceModel:i,deviceType:_,devicePixelRatio:M,deviceOrientation:I,osName:g,osVersion:f,hostTheme:a,hostVersion:m,hostLanguage:S,hostName:y,hostSDKVersion:C,hostFontSizeSetting:l,windowTop:0,windowBottom:0,osLanguage:void 0,osTheme:void 0,ua:void 0,hostPackageName:void 0,browserName:void 0,browserVersion:void 0,isUniAppX:!1};r(t,E)}(e,t)}},rn=an,cn={args(e,t){let n=parseInt(e.current);if(isNaN(n))return;const i=e.urls;if(!d(i))return;const o=i.length;return o?(n<0?n=0:n>=o&&(n=o-1),n>0?(t.current=i[n],t.urls=i.filter(((e,t)=>!(t<n)||e!==i[n]))):t.current=i[0],{indicator:!1,loop:!1}):void 0}},un={args(e,t){t.alertText=e.title}},ln={returnValue:(e,t)=>{const{brand:n,model:i,system:o="",platform:s=""}=e;let a=tn(e,i),c=nn(n);Qt()(e,t);const{osName:u,osVersion:l}=en(o,s);t=ve(r(t,{deviceType:a,deviceBrand:c,deviceModel:i,osName:u,osVersion:l}))}},dn={returnValue:(e,t)=>{const{version:n,language:i,SDKVersion:o,theme:s}=e;let a=sn(e),c=(i||"").replace(/_/g,"-");const u={hostVersion:n,hostLanguage:c,hostName:a,hostSDKVersion:o,hostTheme:s,appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(c),isUniAppX:!1,uniPlatform:"mp-weixin",uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75"};r(t,u)}},pn={returnValue:(e,t)=>{Zt(e,t),t=ve(r(t,{windowTop:0,windowBottom:0}))}},hn={args(e){const t=getApp({allowDefault:!0})||{};t.$vm?Zo(K,e,t.$vm.$):(wx.$onErrorHandlers||(wx.$onErrorHandlers=[]),wx.$onErrorHandlers.push(e))}},gn={args(e){const t=getApp({allowDefault:!0})||{};if(t.$vm){if(e.__weh){const n=t.$vm.$[K];if(n){const t=n.indexOf(e.__weh);t>-1&&n.splice(t,1)}}}else{if(!wx.$onErrorHandlers)return;const t=wx.$onErrorHandlers.findIndex((t=>t===e));-1!==t&&wx.$onErrorHandlers.splice(t,1)}}},fn={args(){if(wx.__uni_console__){if(wx.__uni_console_warned__)return;wx.__uni_console_warned__=!0,console.warn("开发模式下小程序日志回显会使用 socket 连接,为了避免冲突,建议使用 SocketTask 的方式去管理 WebSocket 或手动关闭日志回显功能。[详情](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)")}}},mn=fn,_n={$on:Ct,$off:Et,$once:St,$emit:Tt,upx2px:mt,rpx2px:mt,interceptors:{},addInterceptor:yt,removeInterceptor:It,onCreateVueApp:function(e){if(ke)return e(ke);De.push(e)},invokeCreateVueAppHook:function(e){ke=e,De.forEach((t=>t(e)))},getLocale:Yt,setLocale:e=>{const t=g(getApp)&&getApp();if(!t)return!1;return t.$vm.$locale!==e&&(t.$vm.$locale=e,$t.forEach((t=>t({locale:e}))),!0)},onLocaleChange:e=>{-1===$t.indexOf(e)&&$t.push(e)},getPushClientId:Lt,onPushMessage:e=>{-1===wt.indexOf(e)&&wt.push(e)},offPushMessage:e=>{if(e){const t=wt.indexOf(e);t>-1&&wt.splice(t,1)}else wt.length=0},invokePushCallback:function(e){if("enabled"===e.type)Rt=!0;else if("clientId"===e.type)kt=e.cid,Dt=e.errMsg,At(kt,e.errMsg);else if("pushMsg"===e.type){const t={type:"receive",data:Ot(e.message)};for(let e=0;e<wt.length;e++){if((0,wt[e])(t),t.stopped)break}}else"click"===e.type&&wt.forEach((t=>{t({type:"click",data:Ot(e.message)})}))},__f__:function(e,t,...n){t&&n.push(t),console[e].apply(console,n)}};const vn=["qy","env","error","version","lanDebug","cloud","serviceMarket","router","worklet","__webpack_require_UNI_MP_PLUGIN__"],yn=["lanDebug","router","worklet"],In=wx.getLaunchOptionsSync?wx.getLaunchOptionsSync():null;function Mn(e){return(!In||1154!==In.scene||!yn.includes(e))&&(vn.indexOf(e)>-1||"function"==typeof wx[e])}function Cn(){const e={};for(const t in wx)Mn(t)&&(e[t]=wx[t]);return"undefined"!=typeof globalThis&&"undefined"==typeof requireMiniProgram&&(globalThis.wx=e),e}const Sn=["__route__","__wxExparserNodeId__","__wxWebviewId__"],En=(Tn={oauth:["weixin"],share:["weixin"],payment:["wxpay"],push:["weixin"]},function({service:e,success:t,fail:n,complete:i}){let o;Tn[e]?(o={errMsg:"getProvider:ok",service:e,provider:Tn[e]},g(t)&&t(o)):(o={errMsg:"getProvider:fail:服务["+e+"]不存在"},g(n)&&n(o)),g(i)&&i(o)});var Tn;const kn=Cn();kn.canIUse("getAppBaseInfo")||(kn.getAppBaseInfo=kn.getSystemInfoSync),kn.canIUse("getWindowInfo")||(kn.getWindowInfo=kn.getSystemInfoSync),kn.canIUse("getDeviceInfo")||(kn.getDeviceInfo=kn.getSystemInfoSync);let Dn=kn.getAppBaseInfo&&kn.getAppBaseInfo();Dn||(Dn=kn.getSystemInfoSync());const Rn=Dn?Dn.host:null,On=Rn&&"SAAASDK"===Rn.env?kn.miniapp.shareVideoMessage:kn.shareVideoMessage;var bn=Object.freeze({__proto__:null,createSelectorQuery:function(){const e=kn.createSelectorQuery(),t=e.in;return e.in=function(e){return e.$scope?t.call(this,e.$scope):t.call(this,function(e){const t=Object.create(null);return Sn.forEach((n=>{t[n]=e[n]})),t}(e))},e},getProvider:En,shareVideoMessage:On});const An={args(e,t){e.compressedHeight&&!t.compressHeight&&(t.compressHeight=e.compressedHeight),e.compressedWidth&&!t.compressWidth&&(t.compressWidth=e.compressedWidth)}};var Ln=Object.freeze({__proto__:null,compressImage:An,getAppAuthorizeSetting:{returnValue:function(e,t){const{locationReducedAccuracy:n}=e;t.locationAccuracy="unsupported",!0===n?t.locationAccuracy="reduced":!1===n&&(t.locationAccuracy="full")}},getAppBaseInfo:dn,getDeviceInfo:ln,getSystemInfo:an,getSystemInfoSync:rn,getWindowInfo:pn,offError:gn,onError:hn,onSocketMessage:mn,onSocketOpen:fn,previewImage:cn,redirectTo:{},showActionSheet:un});const Pn=Cn();var Nn=function(e,t,n=wx){const i=function(e){function t(e,t,n){return function(o){return t(i(e,o,n))}}function n(e,n,i={},o={},s=!1){if(M(n)){const a=!0===s?n:{};g(i)&&(i=i(n,a)||{});for(const r in n)if(l(i,r)){let t=i[r];g(t)&&(t=t(n[r],n,a)),t?f(t)?a[t]=n[r]:M(t)&&(a[t.name?t.name:r]=t.value):console.warn(`微信小程序 ${e} 暂不支持 ${r}`)}else if(-1!==Wt.indexOf(r)){const i=n[r];g(i)&&(a[r]=t(e,i,o))}else s||l(a,r)||(a[r]=n[r]);return a}return g(n)&&(g(i)&&i(n,{}),n=t(e,n,o)),n}function i(t,i,o,s=!1){return g(e.returnValue)&&(i=e.returnValue(t,i)),n(t,i,o,{},s||!1)}return function(t,o){const s=l(e,t);if(!s&&"function"!=typeof wx[t])return o;const a=s||g(e.returnValue)||Vt(t)||Ht(t),r=s||g(o);if(!s&&!o)return function(){console.error(`微信小程序 暂不支持${t}`)};if(!a||!r)return o;const c=e[t];return function(e,o){let s=c||{};g(c)&&(s=c(e));const a=[e=n(t,e,s.args,s.returnValue)];void 0!==o&&a.push(o);const r=wx[s.name||t].apply(wx,a);return(Vt(t)||Ht(t))&&r&&!r.__v_skip&&(r.__v_skip=!0),jt(t)?i(t,r,s.returnValue,Vt(t)):r}}}(t);return new Proxy({},{get:(t,o)=>l(t,o)?t[o]:l(e,o)?zt(o,e[o]):l(_n,o)?zt(o,_n[o]):zt(o,i(o,n[o]))})}(bn,Ln,Pn);let wn,Un;class Gn{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=wn,!e&&wn&&(this.index=(wn.scopes||(wn.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=wn;try{return wn=this,e()}finally{wn=t}}}on(){wn=this}off(){wn=this.parent}stop(e){if(this._active){let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0,this._active=!1}}}function xn(e){return new Gn(e)}function Fn(){return wn}class Bn{constructor(e,t,n,i){this.fn=e,this.trigger=t,this.scheduler=n,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,function(e,t=wn){t&&t.active&&t.effects.push(e)}(this,i)}get dirty(){if(2===this._dirtyLevel||3===this._dirtyLevel){this._dirtyLevel=1,Wn();for(let e=0;e<this._depsLength;e++){const t=this.deps[e];if(t.computed&&(t.computed.value,this._dirtyLevel>=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),Yn()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=Hn,t=Un;try{return Hn=!0,Un=this,this._runnings++,qn(this),this.fn()}finally{Vn(this),this._runnings--,Un=t,Hn=e}}stop(){var e;this.active&&(qn(this),Vn(this),null==(e=this.onStop)||e.call(this),this.active=!1)}}function qn(e){e._trackId++,e._depsLength=0}function Vn(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)jn(e.deps[t],e);e.deps.length=e._depsLength}}function jn(e,t){const n=e.get(t);void 0!==n&&t._trackId!==n&&(e.delete(t),0===e.size&&e.cleanup())}let Hn=!0,Kn=0;const zn=[];function Wn(){zn.push(Hn),Hn=!1}function Yn(){const e=zn.pop();Hn=void 0===e||e}function $n(){Kn++}function Jn(){for(Kn--;!Kn&&Qn.length;)Qn.shift()()}function Xn(e,t,n){if(t.get(e)!==e._trackId){t.set(e,e._trackId);const n=e.deps[e._depsLength];n!==t?(n&&jn(n,e),e.deps[e._depsLength++]=t):e._depsLength++}}const Qn=[];function Zn(e,t,n){$n();for(const i of e.keys()){let n;i._dirtyLevel<t&&(null!=n?n:n=e.get(i)===i._trackId)&&(i._shouldSchedule||(i._shouldSchedule=0===i._dirtyLevel),i._dirtyLevel=t),i._shouldSchedule&&(null!=n?n:n=e.get(i)===i._trackId)&&(i.trigger(),i._runnings&&!i.allowRecurse||2===i._dirtyLevel||(i._shouldSchedule=!1,i.scheduler&&Qn.push(i.scheduler)))}Jn()}const ei=(e,t)=>{const n=new Map;return n.cleanup=e,n.computed=t,n},ti=new WeakMap,ni=Symbol(""),ii=Symbol("");function oi(e,t,n){if(Hn&&Un){let t=ti.get(e);t||ti.set(e,t=new Map);let i=t.get(n);i||t.set(n,i=ei((()=>t.delete(n)))),Xn(Un,i)}}function si(e,t,n,i,o,s){const a=ti.get(e);if(!a)return;let r=[];if("clear"===t)r=[...a.values()];else if("length"===n&&d(e)){const e=Number(i);a.forEach(((t,n)=>{("length"===n||!m(n)&&n>=e)&&r.push(t)}))}else switch(void 0!==n&&r.push(a.get(n)),t){case"add":d(e)?C(n)&&r.push(a.get("length")):(r.push(a.get(ni)),p(e)&&r.push(a.get(ii)));break;case"delete":d(e)||(r.push(a.get(ni)),p(e)&&r.push(a.get(ii)));break;case"set":p(e)&&r.push(a.get(ni))}$n();for(const c of r)c&&Zn(c,4);Jn()}const ai=e("__proto__,__v_isRef,__isVue"),ri=new Set(Object.getOwnPropertyNames(Symbol).filter((e=>"arguments"!==e&&"caller"!==e)).map((e=>Symbol[e])).filter(m)),ci=ui();function ui(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=$i(this);for(let t=0,o=this.length;t<o;t++)oi(n,0,t+"");const i=n[t](...e);return-1===i||!1===i?n[t](...e.map($i)):i}})),["push","pop","shift","unshift","splice"].forEach((t=>{e[t]=function(...e){Wn(),$n();const n=$i(this)[t].apply(this,e);return Jn(),Yn(),n}})),e}function li(e){const t=$i(this);return oi(t,0,e),t.hasOwnProperty(e)}class di{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){const i=this._isReadonly,o=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return o;if("__v_raw"===t)return n===(i?o?qi:Bi:o?Fi:xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const s=d(e);if(!i){if(s&&l(ci,t))return Reflect.get(ci,t,n);if("hasOwnProperty"===t)return li}const a=Reflect.get(e,t,n);return(m(t)?ri.has(t):ai(t))?a:(i||oi(e,0,t),o?a:no(a)?s&&C(t)?a:a.value:_(a)?i?Hi(a):ji(a):a)}}class pi extends di{constructor(e=!1){super(!1,e)}set(e,t,n,i){let o=e[t];if(!this._isShallow){const t=Wi(o);if(Yi(n)||Wi(n)||(o=$i(o),n=$i(n)),!d(e)&&no(o)&&!no(n))return!t&&(o.value=n,!0)}const s=d(e)&&C(t)?Number(t)<e.length:l(e,t),a=Reflect.set(e,t,n,i);return e===$i(i)&&(s?A(n,o)&&si(e,"set",t,n):si(e,"add",t,n)),a}deleteProperty(e,t){const n=l(e,t);e[t];const i=Reflect.deleteProperty(e,t);return i&&n&&si(e,"delete",t,void 0),i}has(e,t){const n=Reflect.has(e,t);return m(t)&&ri.has(t)||oi(e,0,t),n}ownKeys(e){return oi(e,0,d(e)?"length":ni),Reflect.ownKeys(e)}}class hi extends di{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const gi=new pi,fi=new hi,mi=new pi(!0),_i=e=>e,vi=e=>Reflect.getPrototypeOf(e);function yi(e,t,n=!1,i=!1){const o=$i(e=e.__v_raw),s=$i(t);n||(A(t,s)&&oi(o,0,t),oi(o,0,s));const{has:a}=vi(o),r=i?_i:n?Qi:Xi;return a.call(o,t)?r(e.get(t)):a.call(o,s)?r(e.get(s)):void(e!==o&&e.get(t))}function Ii(e,t=!1){const n=this.__v_raw,i=$i(n),o=$i(e);return t||(A(e,o)&&oi(i,0,e),oi(i,0,o)),e===o?n.has(e):n.has(e)||n.has(o)}function Mi(e,t=!1){return e=e.__v_raw,!t&&oi($i(e),0,ni),Reflect.get(e,"size",e)}function Ci(e){e=$i(e);const t=$i(this);return vi(t).has.call(t,e)||(t.add(e),si(t,"add",e,e)),this}function Si(e,t){t=$i(t);const n=$i(this),{has:i,get:o}=vi(n);let s=i.call(n,e);s||(e=$i(e),s=i.call(n,e));const a=o.call(n,e);return n.set(e,t),s?A(t,a)&&si(n,"set",e,t):si(n,"add",e,t),this}function Ei(e){const t=$i(this),{has:n,get:i}=vi(t);let o=n.call(t,e);o||(e=$i(e),o=n.call(t,e)),i&&i.call(t,e);const s=t.delete(e);return o&&si(t,"delete",e,void 0),s}function Ti(){const e=$i(this),t=0!==e.size,n=e.clear();return t&&si(e,"clear",void 0,void 0),n}function ki(e,t){return function(n,i){const o=this,s=o.__v_raw,a=$i(s),r=t?_i:e?Qi:Xi;return!e&&oi(a,0,ni),s.forEach(((e,t)=>n.call(i,r(e),r(t),o)))}}function Di(e,t,n){return function(...i){const o=this.__v_raw,s=$i(o),a=p(s),r="entries"===e||e===Symbol.iterator&&a,c="keys"===e&&a,u=o[e](...i),l=n?_i:t?Qi:Xi;return!t&&oi(s,0,c?ii:ni),{next(){const{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:r?[l(e[0]),l(e[1])]:l(e),done:t}},[Symbol.iterator](){return this}}}}function Ri(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function Oi(){const e={get(e){return yi(this,e)},get size(){return Mi(this)},has:Ii,add:Ci,set:Si,delete:Ei,clear:Ti,forEach:ki(!1,!1)},t={get(e){return yi(this,e,!1,!0)},get size(){return Mi(this)},has:Ii,add:Ci,set:Si,delete:Ei,clear:Ti,forEach:ki(!1,!0)},n={get(e){return yi(this,e,!0)},get size(){return Mi(this,!0)},has(e){return Ii.call(this,e,!0)},add:Ri("add"),set:Ri("set"),delete:Ri("delete"),clear:Ri("clear"),forEach:ki(!0,!1)},i={get(e){return yi(this,e,!0,!0)},get size(){return Mi(this,!0)},has(e){return Ii.call(this,e,!0)},add:Ri("add"),set:Ri("set"),delete:Ri("delete"),clear:Ri("clear"),forEach:ki(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((o=>{e[o]=Di(o,!1,!1),n[o]=Di(o,!0,!1),t[o]=Di(o,!1,!0),i[o]=Di(o,!0,!0)})),[e,n,t,i]}const[bi,Ai,Li,Pi]=Oi();function Ni(e,t){const n=t?e?Pi:Li:e?Ai:bi;return(t,i,o)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(l(n,i)&&i in t?n:t,i,o)}const wi={get:Ni(!1,!1)},Ui={get:Ni(!1,!0)},Gi={get:Ni(!0,!1)},xi=new WeakMap,Fi=new WeakMap,Bi=new WeakMap,qi=new WeakMap;function Vi(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>I(e).slice(8,-1))(e))}function ji(e){return Wi(e)?e:Ki(e,!1,gi,wi,xi)}function Hi(e){return Ki(e,!0,fi,Gi,Bi)}function Ki(e,t,n,i,o){if(!_(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const s=o.get(e);if(s)return s;const a=Vi(e);if(0===a)return e;const r=new Proxy(e,2===a?i:n);return o.set(e,r),r}function zi(e){return Wi(e)?zi(e.__v_raw):!(!e||!e.__v_isReactive)}function Wi(e){return!(!e||!e.__v_isReadonly)}function Yi(e){return!(!e||!e.__v_isShallow)}function $i(e){const t=e&&e.__v_raw;return t?$i(t):e}function Ji(e){return Object.isExtensible(e)&&((e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})})(e,"__v_skip",!0),e}const Xi=e=>_(e)?ji(e):e,Qi=e=>_(e)?Hi(e):e;class Zi{constructor(e,t,n,i){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new Bn((()=>e(this._value)),(()=>to(this,2===this.effect._dirtyLevel?2:3))),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=n}get value(){const e=$i(this);return e._cacheable&&!e.effect.dirty||!A(e._value,e._value=e.effect.run())||to(e,4),eo(e),e.effect._dirtyLevel>=2&&to(e,2),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function eo(e){var t;Hn&&Un&&(e=$i(e),Xn(Un,null!=(t=e.dep)?t:e.dep=ei((()=>e.dep=void 0),e instanceof Zi?e:void 0)))}function to(e,t=4,n){const i=(e=$i(e)).dep;i&&Zn(i,t)}function no(e){return!(!e||!0!==e.__v_isRef)}function io(e){return function(e,t){if(no(e))return e;return new oo(e,t)}(e,!1)}class oo{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:$i(e),this._value=t?e:Xi(e)}get value(){return eo(this),this._value}set value(e){const t=this.__v_isShallow||Yi(e)||Wi(e);e=t?e:$i(e),A(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:Xi(e),to(this,4))}}function so(e){return no(e)?e.value:e}const ao={get:(e,t,n)=>so(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return no(o)&&!no(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function ro(e){return zi(e)?e:new Proxy(e,ao)}class co{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0}get value(){const e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return e=$i(this._object),t=this._key,null==(n=ti.get(e))?void 0:n.get(t);var e,t,n}}function uo(e,t,n){const i=e[t];return no(i)?i:new co(e,t,n)}function lo(e,t,n,i){try{return i?e(...i):e()}catch(o){ho(o,t,n)}}function po(e,t,n,i){if(g(e)){const o=lo(e,t,n,i);return o&&v(o)&&o.catch((e=>{ho(e,t,n)})),o}const o=[];for(let s=0;s<e.length;s++)o.push(po(e[s],t,n,i));return o}function ho(e,t,n,i=!0){const o=t?t.vnode:null;if(t){let i=t.parent;const o=t.proxy,s=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const t=i.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,o,s))return;i=i.parent}const a=t.appContext.config.errorHandler;if(a)return void lo(a,null,10,[e,o,s])}go(e,n,o,i)}function go(e,t,n,i=!0){console.error(e)}let fo=!1,mo=!1;const _o=[];let vo=0;const yo=[];let Io=null,Mo=0;const Co=Promise.resolve();let So=null;function Eo(e){const t=So||Co;return e?t.then(this?e.bind(this):e):t}function To(e){_o.length&&_o.includes(e,fo&&e.allowRecurse?vo+1:vo)||(null==e.id?_o.push(e):_o.splice(function(e){let t=vo+1,n=_o.length;for(;t<n;){const i=t+n>>>1,o=_o[i],s=Oo(o);s<e||s===e&&o.pre?t=i+1:n=i}return t}(e.id),0,e),ko())}function ko(){fo||mo||(mo=!0,So=Co.then(Ao))}function Do(e){d(e)?yo.push(...e):Io&&Io.includes(e,e.allowRecurse?Mo+1:Mo)||yo.push(e),ko()}function Ro(e,t,n=(fo?vo+1:0)){for(;n<_o.length;n++){const e=_o[n];e&&e.pre&&(_o.splice(n,1),n--,e())}}const Oo=e=>null==e.id?1/0:e.id,bo=(e,t)=>{const n=Oo(e)-Oo(t);if(0===n){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function Ao(e){mo=!1,fo=!0,_o.sort(bo);try{for(vo=0;vo<_o.length;vo++){const e=_o[vo];e&&!1!==e.active&&lo(e,null,14)}}finally{vo=0,_o.length=0,function(){if(yo.length){const e=[...new Set(yo)].sort(((e,t)=>Oo(e)-Oo(t)));if(yo.length=0,Io)return void Io.push(...e);for(Io=e,Mo=0;Mo<Io.length;Mo++)Io[Mo]();Io=null,Mo=0}}(),fo=!1,So=null,(_o.length||yo.length)&&Ao()}}function Lo(e,n,...i){if(e.isUnmounted)return;const o=e.vnode.props||t;let s=i;const a=n.startsWith("update:"),r=a&&n.slice(7);if(r&&r in o){const e=`${"modelValue"===r?"model":r}Modifiers`,{number:n,trim:a}=o[e]||t;a&&(s=i.map((e=>f(e)?e.trim():e))),n&&(s=i.map(P))}let c,u=o[c=b(n)]||o[c=b(k(n))];!u&&a&&(u=o[c=b(R(n))]),u&&po(u,e,6,s);const l=o[c+"Once"];if(l){if(e.emitted){if(e.emitted[c])return}else e.emitted={};e.emitted[c]=!0,po(l,e,6,s)}}function Po(e,t,n=!1){const i=t.emitsCache,o=i.get(e);if(void 0!==o)return o;const s=e.emits;let a={},c=!1;if(!g(e)){const i=e=>{const n=Po(e,t,!0);n&&(c=!0,r(a,n))};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}return s||c?(d(s)?s.forEach((e=>a[e]=null)):r(a,s),_(e)&&i.set(e,a),a):(_(e)&&i.set(e,null),null)}function No(e,t){return!(!e||!s(t))&&(t=t.slice(2).replace(/Once$/,""),l(e,t[0].toLowerCase()+t.slice(1))||l(e,R(t))||l(e,t))}let wo=null;function Uo(e){const t=wo;return wo=e,e&&e.type.__scopeId,t}const Go="components";function xo(e,t){return e&&(e[t]||e[k(t)]||e[O(k(t))])}const Fo={};function Bo(e,t,n){return qo(e,t,n)}function qo(e,n,{immediate:o,deep:s,flush:a,once:r,onTrack:u,onTrigger:l}=t){if(n&&r){const e=n;n=(...t)=>{e(...t),T()}}const p=qs,h=e=>!0===s?e:Ho(e,!1===s?1:void 0);let f,m,_=!1,v=!1;if(no(e)?(f=()=>e.value,_=Yi(e)):zi(e)?(f=()=>h(e),_=!0):d(e)?(v=!0,_=e.some((e=>zi(e)||Yi(e))),f=()=>e.map((e=>no(e)?e.value:zi(e)?h(e):g(e)?lo(e,p,2):void 0))):f=g(e)?n?()=>lo(e,p,2):()=>(m&&m(),po(e,p,3,[y])):i,n&&s){const e=f;f=()=>Ho(e())}let y=e=>{m=S.onStop=()=>{lo(e,p,4),m=S.onStop=void 0}},I=v?new Array(e.length).fill(Fo):Fo;const M=()=>{if(S.active&&S.dirty)if(n){const e=S.run();(s||_||(v?e.some(((e,t)=>A(e,I[t]))):A(e,I)))&&(m&&m(),po(n,p,3,[e,I===Fo?void 0:v&&I[0]===Fo?[]:I,y]),I=e)}else S.run()};let C;M.allowRecurse=!!n,"sync"===a?C=M:"post"===a?C=()=>Us(M,p&&p.suspense):(M.pre=!0,p&&(M.id=p.uid),C=()=>To(M));const S=new Bn(f,i,C),E=Fn(),T=()=>{S.stop(),E&&c(E.effects,S)};return n?o?M():I=S.run():"post"===a?Us(S.run.bind(S),p&&p.suspense):S.run(),T}function Vo(e,t,n){const i=this.proxy,o=f(e)?e.includes(".")?jo(i,e):()=>i[e]:e.bind(i,i);let s;g(t)?s=t:(s=t.handler,n=t);const a=Ks(this),r=qo(o,s.bind(i),n);return a(),r}function jo(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}function Ho(e,t,n=0,i){if(!_(e)||e.__v_skip)return e;if(t&&t>0){if(n>=t)return e;n++}if((i=i||new Set).has(e))return e;if(i.add(e),no(e))Ho(e.value,t,n,i);else if(d(e))for(let o=0;o<e.length;o++)Ho(e[o],t,n,i);else if(h(e)||p(e))e.forEach((e=>{Ho(e,t,n,i)}));else if(M(e))for(const o in e)Ho(e[o],t,n,i);return e}function Ko(){return{app:null,config:{isNativeTag:o,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let zo=0;let Wo=null;function Yo(e,t,n=!1){const i=qs||wo;if(i||Wo){const o=i?null==i.parent?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:Wo._context.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&g(t)?t.call(i&&i.proxy):t}}function $o(e,t){Xo(e,"a",t)}function Jo(e,t){Xo(e,"da",t)}function Xo(e,t,n=qs){const i=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Zo(t,i,n),n){let e=n.parent;for(;e&&e.parent;)e.parent.vnode.type.__isKeepAlive&&Qo(i,t,n,e),e=e.parent}}function Qo(e,t,n,i){const o=Zo(t,e,i,!0);as((()=>{c(i[t],o)}),n)}function Zo(e,t,n=qs,i=!1){if(n){(function(e){return Ce.indexOf(e)>-1})(e)&&(n=n.root);const o=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;Wn();const o=Ks(n),s=po(t,n,e,i);return o(),Yn(),s});return i?o.unshift(s):o.push(s),s}}const es=e=>(t,n=qs)=>(!Ys||"sp"===e)&&Zo(e,((...e)=>t(...e)),n),ts=es("bm"),ns=es("m"),is=es("bu"),os=es("u"),ss=es("bum"),as=es("um"),rs=es("sp"),cs=es("rtg"),us=es("rtc");function ls(e,t=qs){Zo("ec",e,t)}const ds=e=>e?Ws(e)?Xs(e)||e.proxy:ds(e.parent):null;const ps=r(Object.create(null),{$:function(e){return e},$el:e=>e.__$el||(e.__$el={}),$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ds(e.parent),$root:e=>ds(e.root),$emit:e=>e.emit,$options:e=>Is(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,To(e.update)}),$watch:e=>Vo.bind(e)}),hs=(e,n)=>e!==t&&!e.__isScriptSetup&&l(e,n),gs={get({_:e},n){const{ctx:i,setupState:o,data:s,props:a,accessCache:r,type:c,appContext:u}=e;let d;if("$"!==n[0]){const c=r[n];if(void 0!==c)switch(c){case 1:return o[n];case 2:return s[n];case 4:return i[n];case 3:return a[n]}else{if(hs(o,n))return r[n]=1,o[n];if(s!==t&&l(s,n))return r[n]=2,s[n];if((d=e.propsOptions[0])&&l(d,n))return r[n]=3,a[n];if(i!==t&&l(i,n))return r[n]=4,i[n];ms&&(r[n]=0)}}const p=ps[n];let h,g;return p?("$attrs"===n&&oi(e,0,n),p(e)):(h=c.__cssModules)&&(h=h[n])?h:i!==t&&l(i,n)?(r[n]=4,i[n]):(g=u.config.globalProperties,l(g,n)?g[n]:void 0)},set({_:e},n,i){const{data:o,setupState:s,ctx:a}=e;return hs(s,n)?(s[n]=i,!0):o!==t&&l(o,n)?(o[n]=i,!0):!l(e.props,n)&&(("$"!==n[0]||!(n.slice(1)in e))&&(a[n]=i,!0))},has({_:{data:e,setupState:n,accessCache:i,ctx:o,appContext:s,propsOptions:a}},r){let c;return!!i[r]||e!==t&&l(e,r)||hs(n,r)||(c=a[0])&&l(c,r)||l(o,r)||l(ps,r)||l(s.config.globalProperties,r)},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:l(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function fs(e){return d(e)?e.reduce(((e,t)=>(e[t]=null,e)),{}):e}let ms=!0;function _s(e){const t=Is(e),n=e.proxy,o=e.ctx;ms=!1,t.beforeCreate&&vs(t.beforeCreate,e,"bc");const{data:s,computed:a,methods:r,watch:c,provide:u,inject:l,created:p,beforeMount:h,mounted:f,beforeUpdate:m,updated:v,activated:y,deactivated:I,beforeDestroy:M,beforeUnmount:C,destroyed:S,unmounted:E,render:T,renderTracked:k,renderTriggered:D,errorCaptured:R,serverPrefetch:O,expose:b,inheritAttrs:A,components:L,directives:P,filters:N}=t;if(l&&function(e,t){d(e)&&(e=Es(e));for(const n in e){const i=e[n];let o;o=_(i)?"default"in i?Yo(i.from||n,i.default,!0):Yo(i.from||n):Yo(i),no(o)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e}):t[n]=o}}(l,o),r)for(const i in r){const e=r[i];g(e)&&(o[i]=e.bind(n))}if(s){const t=s.call(n,n);_(t)&&(e.data=ji(t))}if(ms=!0,a)for(const d in a){const e=a[d],t=g(e)?e.bind(n,n):g(e.get)?e.get.bind(n,n):i,s=!g(e)&&g(e.set)?e.set.bind(n):i,r=Qs({get:t,set:s});Object.defineProperty(o,d,{enumerable:!0,configurable:!0,get:()=>r.value,set:e=>r.value=e})}if(c)for(const i in c)ys(c[i],o,n,i);function w(e,t){d(t)?t.forEach((t=>e(t.bind(n)))):t&&e(t.bind(n))}if(function(){if(u){const e=g(u)?u.call(n):u;Reflect.ownKeys(e).forEach((t=>{!function(e,t){if(qs){let n=qs.provides;const i=qs.parent&&qs.parent.provides;i===n&&(n=qs.provides=Object.create(i)),n[e]=t,"app"===qs.type.mpType&&qs.appContext.app.provide(e,t)}}(t,e[t])}))}}(),p&&vs(p,e,"c"),w(ts,h),w(ns,f),w(is,m),w(os,v),w($o,y),w(Jo,I),w(ls,R),w(us,k),w(cs,D),w(ss,C),w(as,E),w(rs,O),d(b))if(b.length){const t=e.exposed||(e.exposed={});b.forEach((e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t})}))}else e.exposed||(e.exposed={});T&&e.render===i&&(e.render=T),null!=A&&(e.inheritAttrs=A),L&&(e.components=L),P&&(e.directives=P),e.ctx.$onApplyOptions&&e.ctx.$onApplyOptions(t,e,n)}function vs(e,t,n){po(d(e)?e.map((e=>e.bind(t.proxy))):e.bind(t.proxy),t,n)}function ys(e,t,n,i){const o=i.includes(".")?jo(n,i):()=>n[i];if(f(e)){const n=t[e];g(n)&&Bo(o,n)}else if(g(e))Bo(o,e.bind(n));else if(_(e))if(d(e))e.forEach((e=>ys(e,t,n,i)));else{const i=g(e.handler)?e.handler.bind(n):t[e.handler];g(i)&&Bo(o,i,e)}}function Is(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:a}}=e.appContext,r=s.get(t);let c;return r?c=r:o.length||n||i?(c={},o.length&&o.forEach((e=>Ms(c,e,a,!0))),Ms(c,t,a)):c=t,_(t)&&s.set(t,c),c}function Ms(e,t,n,i=!1){const{mixins:o,extends:s}=t;s&&Ms(e,s,n,!0),o&&o.forEach((t=>Ms(e,t,n,!0)));for(const a in t)if(i&&"expose"===a);else{const i=Cs[a]||n&&n[a];e[a]=i?i(e[a],t[a]):t[a]}return e}const Cs={data:Ss,props:Ds,emits:Ds,methods:ks,computed:ks,beforeCreate:Ts,created:Ts,beforeMount:Ts,mounted:Ts,beforeUpdate:Ts,updated:Ts,beforeDestroy:Ts,beforeUnmount:Ts,destroyed:Ts,unmounted:Ts,activated:Ts,deactivated:Ts,errorCaptured:Ts,serverPrefetch:Ts,components:ks,directives:ks,watch:function(e,t){if(!e)return t;if(!t)return e;const n=r(Object.create(null),e);for(const i in t)n[i]=Ts(e[i],t[i]);return n},provide:Ss,inject:function(e,t){return ks(Es(e),Es(t))}};function Ss(e,t){return t?e?function(){return r(g(e)?e.call(this,this):e,g(t)?t.call(this,this):t)}:t:e}function Es(e){if(d(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ts(e,t){return e?[...new Set([].concat(e,t))]:t}function ks(e,t){return e?r(Object.create(null),e,t):t}function Ds(e,t){return e?d(e)&&d(t)?[...new Set([...e,...t])]:r(Object.create(null),fs(e),fs(null!=t?t:{})):t}function Rs(e,t,n,i=!1){const o={},s={};e.propsDefaults=Object.create(null),Os(e,t,o,s);for(const a in e.propsOptions[0])a in o||(o[a]=void 0);n?e.props=i?o:Ki(o,!1,mi,Ui,Fi):e.type.props?e.props=o:e.props=s,e.attrs=s}function Os(e,n,i,o){const[s,a]=e.propsOptions;let r,c=!1;if(n)for(let t in n){if(S(t))continue;const u=n[t];let d;s&&l(s,d=k(t))?a&&a.includes(d)?(r||(r={}))[d]=u:i[d]=u:No(e.emitsOptions,t)||t in o&&u===o[t]||(o[t]=u,c=!0)}if(a){const n=$i(i),o=r||t;for(let t=0;t<a.length;t++){const r=a[t];i[r]=bs(s,n,r,o[r],e,!l(o,r))}}return c}function bs(e,t,n,i,o,s){const a=e[n];if(null!=a){const e=l(a,"default");if(e&&void 0===i){const e=a.default;if(a.type!==Function&&!a.skipFactory&&g(e)){const{propsDefaults:s}=o;if(n in s)i=s[n];else{const a=Ks(o);i=s[n]=e.call(null,t),a()}}else i=e}a[0]&&(s&&!e?i=!1:!a[1]||""!==i&&i!==R(n)||(i=!0))}return i}function As(e,i,o=!1){const s=i.propsCache,a=s.get(e);if(a)return a;const c=e.props,u={},p=[];let h=!1;if(!g(e)){const t=e=>{h=!0;const[t,n]=As(e,i,!0);r(u,t),n&&p.push(...n)};!o&&i.mixins.length&&i.mixins.forEach(t),e.extends&&t(e.extends),e.mixins&&e.mixins.forEach(t)}if(!c&&!h)return _(e)&&s.set(e,n),n;if(d(c))for(let n=0;n<c.length;n++){const e=k(c[n]);Ls(e)&&(u[e]=t)}else if(c)for(const t in c){const e=k(t);if(Ls(e)){const n=c[t],i=u[e]=d(n)||g(n)?{type:n}:r({},n);if(i){const t=ws(Boolean,i.type),n=ws(String,i.type);i[0]=t>-1,i[1]=n<0||t<n,(t>-1||l(i,"default"))&&p.push(e)}}}const f=[u,p];return _(e)&&s.set(e,f),f}function Ls(e){return"$"!==e[0]&&!S(e)}function Ps(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e){return e.constructor&&e.constructor.name||""}return""}function Ns(e,t){return Ps(e)===Ps(t)}function ws(e,t){return d(t)?t.findIndex((t=>Ns(t,e))):g(t)&&Ns(t,e)?0:-1}const Us=Do;function Gs(e){return e?zi(t=e)||Wi(t)||"__vInternal"in e?r({},e):e:null;var t}const xs=Ko();let Fs=0;function Bs(e,n,i){const o=e.type,s=(n?n.appContext:e.appContext)||xs,a={uid:Fs++,vnode:e,type:o,parent:n,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,scope:new Gn(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:n?n.provides:Object.create(s.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:As(o,s),emitsOptions:Po(o,s),emit:null,emitted:null,propsDefaults:t,inheritAttrs:o.inheritAttrs,ctx:t,data:t,props:t,attrs:t,slots:t,refs:t,setupState:t,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null,$uniElements:new Map,$templateUniElementRefs:[],$templateUniElementStyles:{},$eS:{},$eA:{}};return a.ctx={_:a},a.root=n?n.root:a,a.emit=Lo.bind(null,a),e.ce&&e.ce(a),a}let qs=null;const Vs=()=>qs||wo;let js,Hs;js=e=>{qs=e},Hs=e=>{Ys=e};const Ks=e=>{const t=qs;return js(e),e.scope.on(),()=>{e.scope.off(),js(t)}},zs=()=>{qs&&qs.scope.off(),js(null)};function Ws(e){return 4&e.vnode.shapeFlag}let Ys=!1;function $s(e,t=!1){t&&Hs(t);const{props:n}=e.vnode,i=Ws(e);Rs(e,n,i,t);const o=i?function(e){const t=e.type;e.accessCache=Object.create(null),e.proxy=Ji(new Proxy(e.ctx,gs));const{setup:n}=t;if(n){const t=e.setupContext=n.length>1?function(e){const t=t=>{e.exposed=t||{}};return{get attrs(){return function(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get:(t,n)=>(oi(e,0,"$attrs"),t[n])}))}(e)},slots:e.slots,emit:e.emit,expose:t}}(e):null,i=Ks(e);Wn();const o=lo(n,e,0,[e.props,t]);Yn(),i(),v(o)?o.then(zs,zs):function(e,t){g(t)?e.render=t:_(t)&&(e.setupState=ro(t));Js(e)}(e,o)}else Js(e)}(e):void 0;return t&&Hs(!1),o}function Js(e,t,n){const o=e.type;e.render||(e.render=o.render||i);{const t=Ks(e);Wn();try{_s(e)}finally{Yn(),t()}}}function Xs(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(ro(Ji(e.exposed)),{get:(t,n)=>n in t?t[n]:e.proxy[n],has:(e,t)=>t in e||t in ps}))}const Qs=(e,t)=>{const n=function(e,t,n=!1){let o,s;const a=g(e);return a?(o=e,s=i):(o=e.get,s=e.set),new Zi(o,s,a||!s,n)}(e,0,Ys);return n},Zs="3.4.21";function ea(e){return so(e)}const ta="[object Array]",na="[object Object]";function ia(e,t){const n={};return oa(e,t),sa(e,t,"",n),n}function oa(e,t){if((e=ea(e))===t)return;const n=I(e),i=I(t);if(n==na&&i==na)for(let o in t){const n=e[o];void 0===n?e[o]=null:oa(n,t[o])}else n==ta&&i==ta&&e.length>=t.length&&t.forEach(((t,n)=>{oa(e[n],t)}))}function sa(e,t,n,i){if((e=ea(e))===t)return;const o=I(e),s=I(t);if(o==na)if(s!=na||Object.keys(e).length<Object.keys(t).length)aa(i,n,e);else for(let a in e){const o=ea(e[a]),s=t[a],r=I(o),c=I(s);if(r!=ta&&r!=na)o!=s&&aa(i,(""==n?"":n+".")+a,o);else if(r==ta)c!=ta||o.length<s.length?aa(i,(""==n?"":n+".")+a,o):o.forEach(((e,t)=>{sa(e,s[t],(""==n?"":n+".")+a+"["+t+"]",i)}));else if(r==na)if(c!=na||Object.keys(o).length<Object.keys(s).length)aa(i,(""==n?"":n+".")+a,o);else for(let e in o)sa(o[e],s[e],(""==n?"":n+".")+a+"."+e,i)}else o==ta?s!=ta||e.length<t.length?aa(i,n,e):e.forEach(((e,o)=>{sa(e,t[o],n+"["+o+"]",i)})):aa(i,n,e)}function aa(e,t,n){e[t]=n}function ra(e){const t=e.ctx.__next_tick_callbacks;if(t&&t.length){const e=t.slice(0);t.length=0;for(let t=0;t<e.length;t++)e[t]()}}function ca(e,t){const n=e.ctx;if(!n.__next_tick_pending&&!function(e){return _o.includes(e.update)}(e))return Eo(t&&t.bind(e.proxy));let i;return n.__next_tick_callbacks||(n.__next_tick_callbacks=[]),n.__next_tick_callbacks.push((()=>{t?lo(t.bind(e.proxy),e,14):i&&i(e.proxy)})),new Promise((e=>{i=e}))}function ua(e,t){const n=typeof(e=ea(e));if("object"===n&&null!==e){let n=t.get(e);if(void 0!==n)return n;if(d(e)){const i=e.length;n=new Array(i),t.set(e,n);for(let o=0;o<i;o++)n[o]=ua(e[o],t)}else{n={},t.set(e,n);for(const i in e)l(e,i)&&(n[i]=ua(e[i],t))}return n}if("symbol"!==n)return e}function la(e){return ua(e,"undefined"!=typeof WeakMap?new WeakMap:new Map)}function da(e,t,n){if(!t)return;(t=la(t)).$eS=e.$eS||{},t.$eA=e.$eA||{};const i=e.ctx,o=i.mpType;if("page"===o||"component"===o){t.r0=1;const o=i.$scope,s=Object.keys(t),a=ia(t,n||function(e,t){const n=e.data,i=Object.create(null);return t.forEach((e=>{i[e]=n[e]})),i}(o,s));Object.keys(a).length?(i.__next_tick_pending=!0,o.setData(a,(()=>{i.__next_tick_pending=!1,ra(e)})),Ro()):ra(e)}}function pa(e,t,n){t.appContext.config.globalProperties.$applyOptions(e,t,n);const i=e.computed;if(i){const e=Object.keys(i);if(e.length){const n=t.ctx;n.$computedKeys||(n.$computedKeys=[]),n.$computedKeys.push(...e)}}delete t.ctx.$onApplyOptions}function ha(e,t=!1){const{setupState:n,$templateRefs:i,$templateUniElementRefs:o,ctx:{$scope:s,$mpPlatform:a}}=e;if("mp-alipay"===a)return;if(!s||!i&&!o)return;if(t)return i&&i.forEach((e=>ga(e,null,n))),void(o&&o.forEach((e=>ga(e,null,n))));const r="mp-baidu"===a||"mp-toutiao"===a,c=e=>{if(0===e.length)return[];const t=(s.selectAllComponents(".r")||[]).concat(s.selectAllComponents(".r-i-f")||[]);return e.filter((e=>{const i=function(e,t){const n=e.find((e=>e&&(e.properties||e.props).uI===t));if(n){const e=n.$vm;return e?Xs(e.$)||e:function(e){_(e)&&Ji(e);return e}(n)}return null}(t,e.i);return!(!r||null!==i)||(ga(e,i,n),!1)}))},u=()=>{if(i){const t=c(i);t.length&&e.proxy&&e.proxy.$scope&&e.proxy.$scope.setData({r1:1},(()=>{c(t)}))}};o&&o.length&&ca(e,(()=>{o.forEach((e=>{d(e.v)?e.v.forEach((t=>{ga(e,t,n)})):ga(e,e.v,n)}))})),s._$setRef?s._$setRef(u):ca(e,u)}function ga({r:e,f:t},n,i){if(g(e))e(n,{});else{const o=f(e),s=no(e);if(o||s)if(t){if(!s)return;d(e.value)||(e.value=[]);const t=e.value;if(-1===t.indexOf(n)){if(t.push(n),!n)return;n.$&&ss((()=>c(t,n)),n.$)}}else o?l(i,e)&&(i[e]=n):no(e)&&(e.value=n)}}const fa=Do;function ma(e,t){const n=e.component=Bs(e,t.parentComponent,null);return n.renderer=t.mpType?t.mpType:"component",n.ctx.$onApplyOptions=pa,n.ctx.$children=[],"app"===t.mpType&&(n.render=i),t.onBeforeSetup&&t.onBeforeSetup(n,t),$s(n),t.parentComponent&&n.proxy&&t.parentComponent.ctx.$children.push(Xs(n)||n.proxy),function(e){const t=Ma.bind(e);e.$updateScopedSlots=()=>Eo((()=>To(t)));const n=()=>{if(e.isMounted){const{next:t,bu:n,u:i}=e;Ca(e,!1),Ia(),n&&L(n),Ca(e,!0),da(e,va(e)),i&&fa(i)}else ss((()=>{ha(e,!0)}),e),da(e,va(e))},o=e.effect=new Bn(n,i,(()=>To(s)),e.scope),s=e.update=()=>{o.dirty&&o.run()};s.id=e.uid,Ca(e,!0),s()}(n),n.proxy}const _a=e=>{let t;for(const n in e)("class"===n||"style"===n||s(n))&&((t||(t={}))[n]=e[n]);return t};function va(e){const{type:t,vnode:n,proxy:i,withProxy:o,props:s,propsOptions:[a],slots:r,attrs:c,emit:u,render:l,renderCache:d,data:p,setupState:h,ctx:g,uid:f,appContext:{app:{config:{globalProperties:{pruneComponentPropsCache:m}}}},inheritAttrs:_}=e;let v;e.$uniElementIds=new Map,e.$templateRefs=[],e.$templateUniElementRefs=[],e.$templateUniElementStyles={},e.$ei=0,m(f),e.__counter=0===e.__counter?1:0;const y=Uo(e);try{if(4&n.shapeFlag){ya(_,s,a,c);const e=o||i;v=l.call(e,e,d,s,h,p,g)}else{ya(_,s,a,t.props?c:_a(c));const e=t;v=e.length>1?e(s,{attrs:c,slots:r,emit:u}):e(s,null)}}catch(I){ho(I,e,1),v=!1}return ha(e),Uo(y),v}function ya(e,t,n,i){if(t&&i&&!1!==e){const e=Object.keys(i).filter((e=>"class"!==e&&"style"!==e));if(!e.length)return;n&&e.some(a)?e.forEach((e=>{a(e)&&e.slice(9)in n||(t[e]=i[e])})):e.forEach((e=>t[e]=i[e]))}}const Ia=e=>{Wn(),Ro(),Yn()};function Ma(){const e=this.$scopedSlotsData;if(!e||0===e.length)return;const t=this.ctx.$scope,n=t.data,i=Object.create(null);e.forEach((({path:e,index:t,data:o})=>{const s=_e(n,e),a=f(t)?`${e}.${t}`:`${e}[${t}]`;if(void 0===s||void 0===s[t])i[a]=o;else{const e=ia(o,s[t]);Object.keys(e).forEach((t=>{i[a+"."+t]=e[t]}))}})),e.length=0,Object.keys(i).length&&t.setData(i)}function Ca({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}const Sa=function(e,t=null){g(e)||(e=r({},e)),null==t||_(t)||(t=null);const n=Ko(),i=new WeakSet,o=n.app={_uid:zo++,_component:e,_props:t,_container:null,_context:n,_instance:null,version:Zs,get config(){return n.config},set config(e){},use:(e,...t)=>(i.has(e)||(e&&g(e.install)?(i.add(e),e.install(o,...t)):g(e)&&(i.add(e),e(o,...t))),o),mixin:e=>(n.mixins.includes(e)||n.mixins.push(e),o),component:(e,t)=>t?(n.components[e]=t,o):n.components[e],directive:(e,t)=>t?(n.directives[e]=t,o):n.directives[e],mount(){},unmount(){},provide:(e,t)=>(n.provides[e]=t,o),runWithContext(e){const t=Wo;Wo=o;try{return e()}finally{Wo=t}}};return o};function Ea(e,t=null){("undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof my?my:void 0).__VUE__=!0;const n=Sa(e,t),o=n._context;o.config.globalProperties.$nextTick=function(e){return ca(this.$,e)};const s=e=>(e.appContext=o,e.shapeFlag=6,e),a=function(e,t){return ma(s(e),t)},r=function(e){return e&&function(e){const{bum:t,scope:n,update:i,um:o}=e;t&&L(t);{const t=e.parent;if(t){const n=t.ctx.$children,i=Xs(e)||e.proxy,o=n.indexOf(i);o>-1&&n.splice(o,1)}}n.stop(),i&&(i.active=!1),o&&fa(o),fa((()=>{e.isUnmounted=!0}))}(e.$)};return n.mount=function(){e.render=i;const t=ma(s({type:e}),{mpType:"app",mpInstance:null,parentComponent:null,slots:[],props:null});return n._instance=t.$,t.$app=n,t.$createComponent=a,t.$destroyComponent=r,o.$appInstance=t,t},n.unmount=function(){},n}function Ta(e,t,n,i){g(t)&&Zo(e,t.bind(n),i)}function ka(e,t,n){!function(e,t,n){const i=e.mpType||n.$mpType;!i||"component"===i||"page"===i&&"component"===t.renderer||Object.keys(e).forEach((i=>{if(Te(i,e[i],!1)){const o=e[i];d(o)?o.forEach((e=>Ta(i,e,n,t))):Ta(i,o,n,t)}}))}(e,t,n)}function Da(e,t,n){return e[t]=n}function Ra(e,...t){const n=this[e];return n?n(...t):(console.error(`method ${e} not found`),null)}function Oa(e){const t=e.config.errorHandler;return function(n,i,o){t&&t(n,i,o);const s=e._instance;if(!s||!s.proxy)throw n;s[K]?s.proxy.$callHook(K,n):go(n,0,i&&i.$.vnode,!1)}}function ba(e,t){return e?[...new Set([].concat(e,t))]:t}let Aa;const La="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pa=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Na(){const e=Nn.getStorageSync("uni_id_token")||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((i=t[1],decodeURIComponent(Aa(i).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(o){throw new Error("获取当前用户信息出错,详细错误信息为:"+o.message)}var i;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}function wa(e){const t=e.config;var n;t.errorHandler=Re(e,Oa),n=t.optionMergeStrategies,Se.forEach((e=>{n[e]=ba}));const i=t.globalProperties;!function(e){e.uniIDHasRole=function(e){const{role:t}=Na();return t.indexOf(e)>-1},e.uniIDHasPermission=function(e){const{permission:t}=Na();return this.uniIDHasRole("admin")||t.indexOf(e)>-1},e.uniIDTokenValid=function(){const{tokenExpired:e}=Na();return e>Date.now()}}(i),i.$set=Da,i.$applyOptions=ka,i.$callMethod=Ra,Nn.invokeCreateVueAppHook(e)}Aa="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Pa.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,i,o="",s=0;s<e.length;)t=La.indexOf(e.charAt(s++))<<18|La.indexOf(e.charAt(s++))<<12|(n=La.indexOf(e.charAt(s++)))<<6|(i=La.indexOf(e.charAt(s++))),o+=64===n?String.fromCharCode(t>>16&255):64===i?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}:atob;const Ua=Object.create(null);function Ga(e){delete Ua[e]}function xa(e){if(!e)return;const[t,n]=e.split(",");return Ua[t]?Ua[t][parseInt(n)]:void 0}var Fa={install(e){wa(e),e.config.globalProperties.pruneComponentPropsCache=Ga;const t=e.mount;e.mount=function(n){const i=t.call(e,n),o=function(){const e="createApp";if("undefined"!=typeof global&&void 0!==global[e])return global[e];if("undefined"!=typeof my)return my[e]}();return o?o(i):"undefined"!=typeof createMiniProgramApp&&createMiniProgramApp(i),i}}};function Ba(e){return f(e)?e:function(e){let t="";if(!e||f(e))return t;for(const n in e)t+=`${n.startsWith("--")?n:R(n)}:${e[n]};`;return t}(N(e))}function qa(e,t){const n=Vs(),o=n.ctx,s=void 0===t||"mp-weixin"!==o.$mpPlatform&&"mp-qq"!==o.$mpPlatform&&"mp-xhs"!==o.$mpPlatform||!f(t)&&"number"!=typeof t?"":"_"+t,a="e"+n.$ei+++s,c=o.$scope;if(!e)return delete c[a],a;const u=c[a];return u?u.value=e:c[a]=function(e,t){const n=e=>{var o;(o=e).type&&o.target&&(o.preventDefault=i,o.stopPropagation=i,o.stopImmediatePropagation=i,l(o,"detail")||(o.detail={}),l(o,"markerId")&&(o.detail="object"==typeof o.detail?o.detail:{},o.detail.markerId=o.markerId),M(o.detail)&&l(o.detail,"checked")&&!l(o.detail,"value")&&(o.detail.value=o.detail.checked),M(o.detail)&&(o.target=r({},o.target,o.detail)));let s=[e];t&&t.ctx.$getTriggerEventDetail&&"number"==typeof e.detail&&(e.detail=t.ctx.$getTriggerEventDetail(e.detail)),e.detail&&e.detail.__args__&&(s=e.detail.__args__);const a=n.value,c=()=>po(function(e,t){if(d(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n&&n.call(e),e._stopped=!0},t.map((e=>t=>!t._stopped&&e(t)))}return t}(e,a),t,5,s),u=e.target,p=!!u&&(!!u.dataset&&"true"===String(u.dataset.eventsync));if(!Va.includes(e.type)||p){const t=c();if("input"===e.type&&(d(t)||v(t)))return;return t}setTimeout(c)};return n.value=e,n}(e,n),a}const Va=["tap","longpress","longtap","transitionend","animationstart","animationiteration","animationend","touchforcechange"];const ja=function(e,t=null){return e&&(e.mpType="app"),Ea(e,t).use(Fa)};const Ha=["externalClasses"];const Ka=/_(.*)_worklet_factory_/;function za(e,t){const n=e.$children;for(let o=n.length-1;o>=0;o--){const e=n[o];if(e.$scope._$vueId===t)return e}let i;for(let o=n.length-1;o>=0;o--)if(i=za(n[o],t),i)return i}const Wa=["createSelectorQuery","createIntersectionObserver","selectAllComponents","selectComponent"];function Ya(e,t){const n=e.ctx;n.mpType=t.mpType,n.$mpType=t.mpType,n.$mpPlatform="mp-weixin",n.$scope=t.mpInstance,Object.defineProperties(n,{[fe]:{get(){const e=this.$scope.data[fe];return void 0===e?"":e}}}),n.$mp={},n._self={},e.slots={},d(t.slots)&&t.slots.length&&(t.slots.forEach((t=>{e.slots[t]=!0})),e.slots.d&&(e.slots.default=!0)),n.getOpenerEventChannel=function(){return t.mpInstance.getOpenerEventChannel()},n.$hasHook=$a,n.$callHook=Ja,e.emit=function(e,t){return function(n,...i){const o=t.$scope;if(o&&n){const e={__args__:i};o.triggerEvent(n,e)}return e.apply(this,[n,...i])}}(e.emit,n)}function $a(e){const t=this.$[e];return!(!t||!t.length)}function Ja(e,t){"mounted"===e&&(Ja.call(this,"bm"),this.$.isMounted=!0,e="m");const n=this.$[e];return n&&((e,t)=>{let n;for(let i=0;i<e.length;i++)n=e[i](t);return n})(n,t)}const Xa=[$,V,j,X,ee,ie,oe,se,ce];function Qa(e,t=new Set){if(e){Object.keys(e).forEach((n=>{Te(n,e[n])&&t.add(n)}));{const{extends:n,mixins:i}=e;i&&i.forEach((e=>Qa(e,t))),n&&Qa(n,t)}}return t}function Za(e,t,n){-1!==n.indexOf(t)||l(e,t)||(e[t]=function(e){return this.$vm&&this.$vm.$callHook(t,e)})}const er=[J];function tr(e,t,n=er){t.forEach((t=>Za(e,t,n)))}function nr(e,t,n=er){Qa(t).forEach((t=>Za(e,t,n)))}const ir=me((()=>{const e=[],t=g(getApp)&&getApp({allowDefault:!0});if(t&&t.$vm&&t.$vm.$){const n=t.$vm.$.appContext.mixins;if(d(n)){const t=Object.keys(Ee);n.forEach((n=>{t.forEach((t=>{l(n,t)&&!e.includes(t)&&e.push(t)}))}))}}return e}));const or=[V,j,K,z,W,Y];function sr(e,t){const n=e.$,i={globalData:e.$options&&e.$options.globalData||{},$vm:e,onLaunch(t){this.$vm=e;const i=n.ctx;this.$vm&&i.$scope&&i.$callHook||(Ya(n,{mpType:"app",mpInstance:this,slots:[]}),i.globalData=this.globalData,e.$callHook(H,t))}},o=wx.$onErrorHandlers;o&&(o.forEach((e=>{Zo(K,e,n)})),o.length=0),function(e){const t=io(function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Be(n&&n.language?n.language:Ue)||Ue}return t}());Object.defineProperty(e,"$locale",{get:()=>t.value,set(e){t.value=e}})}(e);const s=e.$.type;tr(i,or),nr(i,s);{const e=s.methods;e&&r(i,e)}return i}function ar(e,t){if(g(e.onLaunch)){const t=wx.getLaunchOptionsSync&&wx.getLaunchOptionsSync();e.onLaunch(t)}g(e.onShow)&&wx.onAppShow&&wx.onAppShow((e=>{t.$callHook("onShow",e)})),g(e.onHide)&&wx.onAppHide&&wx.onAppHide((e=>{t.$callHook("onHide",e)}))}const rr=["eO","uR","uRIF","uI","uT","uP","uS"];function cr(e){e.properties||(e.properties={}),r(e.properties,function(e,t=!1){const n={};if(!t){let e=function(e){const t=Object.create(null);e&&e.forEach((e=>{t[e]=!0})),this.setData({$slots:t})};rr.forEach((e=>{n[e]={type:null,value:""}})),n.uS={type:null,value:[]},n.uS.observer=e}return e.behaviors&&e.behaviors.includes("wx://form-field")&&(e.properties&&e.properties.name||(n.name={type:null,value:""}),e.properties&&e.properties.value||(n.value={type:null,value:""})),n}(e),function(e){const t={};return e&&e.virtualHost&&(t.virtualHostStyle={type:null,value:""},t.virtualHostClass={type:null,value:""},t.virtualHostHidden={type:null,value:""},t[fe]={type:null,value:""}),t}(e.options))}const ur=[String,Number,Boolean,Object,Array,null];function lr(e,t){const n=function(e){return d(e)&&1===e.length?e[0]:e}(e);return-1!==ur.indexOf(n)?n:null}function dr(e,t){return(t?function(e){const t={};M(e)&&Object.keys(e).forEach((n=>{-1===rr.indexOf(n)&&(t[n]=e[n])}));return t}(e):xa(e.uP))||{}}function pr(e){const t=function(){const e=this.properties.uP;e&&(this.$vm?function(e,t){const n=$i(t.props),i=xa(e)||{};hr(n,i)&&(!function(e,t,n,i){const{props:o,attrs:s,vnode:{patchFlag:a}}=e,r=$i(o),[c]=e.propsOptions;let u=!1;if(!(i||a>0)||16&a){let i;Os(e,t,o,s)&&(u=!0);for(const s in r)t&&(l(t,s)||(i=R(s))!==s&&l(t,i))||(c?!n||void 0===n[s]&&void 0===n[i]||(o[s]=bs(c,r,s,void 0,e,!0)):delete o[s]);if(s!==r)for(const e in s)t&&l(t,e)||(delete s[e],u=!0)}else if(8&a){const n=e.vnode.dynamicProps;for(let i=0;i<n.length;i++){let a=n[i];if(No(e.emitsOptions,a))continue;const d=t[a];if(c)if(l(s,a))d!==s[a]&&(s[a]=d,u=!0);else{const t=k(a);o[t]=bs(c,r,t,d,e,!1)}else d!==s[a]&&(s[a]=d,u=!0)}}u&&si(e,"set","$attrs")}(t,i,n,!1),o=t.update,_o.indexOf(o)>-1&&function(e){const t=_o.indexOf(e);t>vo&&_o.splice(t,1)}(t.update),t.update());var o}(e,this.$vm.$):"m"===this.properties.uT&&function(e,t){const n=t.properties,i=xa(e)||{};hr(n,i,!1)&&t.setData(i)}(e,this))};e.observers||(e.observers={}),e.observers.uP=t}function hr(e,t,n=!0){const i=Object.keys(t);if(n&&i.length!==Object.keys(e).length)return!0;for(let o=0;o<i.length;o++){const n=i[o];if(t[n]!==e[n])return!0}return!1}function gr(e,t){e.data={},e.behaviors=function(e){const t=e.behaviors;let n=e.props;n||(e.props=n=[]);const i=[];return d(t)&&t.forEach((e=>{i.push(e.replace("uni://","wx://")),"uni://form-field"===e&&(d(n)?(n.push("name"),n.push("modelValue")):(n.name={type:String,default:""},n.modelValue={type:[String,Number,Boolean,Array,Object,Date],default:""}))})),i}(t)}function fr(e,{parse:t,mocks:n,isPage:i,isPageInProject:o,initRelation:s,handleLink:a,initLifetimes:c}){e=e.default||e;const u={multipleSlots:!0,addGlobalClass:!0,pureDataPattern:/^uP$/};d(e.mixins)&&e.mixins.forEach((e=>{_(e.options)&&r(u,e.options)})),e.options&&r(u,e.options);const p={options:u,lifetimes:c({mocks:n,isPage:i,initRelation:s,vueOptions:e}),pageLifetimes:{show(){this.$vm&&this.$vm.$callHook("onPageShow")},hide(){this.$vm&&this.$vm.$callHook("onPageHide")},resize(e){this.$vm&&this.$vm.$callHook("onPageResize",e)}},methods:{__l:a}};var h,g,f,m;return gr(p,e),cr(p),pr(p),function(e,t){Ha.forEach((n=>{l(t,n)&&(e[n]=t[n])}))}(p,e),h=p.methods,g=e.wxsCallMethods,d(g)&&g.forEach((e=>{h[e]=function(t){return this.$vm[e](t)}})),f=p.methods,(m=e.methods)&&Object.keys(m).forEach((e=>{const t=e.match(Ka);if(t){const n=t[1];f[e]=m[e],f[n]=m[n]}})),t&&t(p,{handleLink:a}),p}let mr,_r;function vr(){return getApp().$vm}function yr(e,t){const{parse:n,mocks:i,isPage:o,initRelation:s,handleLink:a,initLifetimes:r}=t,c=fr(e,{mocks:i,isPage:o,isPageInProject:!0,initRelation:s,handleLink:a,initLifetimes:r});!function({properties:e},t){d(t)?t.forEach((t=>{e[t]={type:String,value:""}})):M(t)&&Object.keys(t).forEach((n=>{const i=t[n];if(M(i)){let t=i.default;g(t)&&(t=t());const o=i.type;i.type=lr(o),e[n]={type:i.type,value:t}}else e[n]={type:lr(i)}}))}(c,(e.default||e).props);const u=c.methods;return u.onLoad=function(e){var t;return this.options=e,this.$page={fullPath:(t=this.route+Me(e),function(e){return 0===e.indexOf("/")}(t)?t:"/"+t)},this.$vm&&this.$vm.$callHook($,e)},tr(u,Xa),nr(u,e),function(e,t){if(!t)return;Object.keys(Ee).forEach((n=>{t&Ee[n]&&Za(e,n,[])}))}(u,e.__runtimeHooks),tr(u,ir()),n&&n(c,{handleLink:a}),c}const Ir=Page,Mr=Component;function Cr(e){const t=e.triggerEvent,n=function(n,...i){return t.apply(e,[(o=n,k(o.replace(ye,"-"))),...i]);var o};try{e.triggerEvent=n}catch(i){e._triggerEvent=n}}function Sr(e,t,n){const i=t[e];t[e]=i?function(...e){return Cr(this),i.apply(this,e)}:function(){Cr(this)}}Page=function(e){return Sr($,e),Ir(e)},Component=function(e){Sr("created",e);return e.properties&&e.properties.uP||(cr(e),pr(e)),Mr(e)};var Er=Object.freeze({__proto__:null,handleLink:function(e){const t=e.detail||e.value,n=t.vuePid;let i;n&&(i=za(this.$vm,n)),i||(i=this.$vm),t.parent=i},initLifetimes:function({mocks:e,isPage:t,initRelation:n,vueOptions:i}){return{attached(){let o=this.properties;!function(e,t){if(!e)return;const n=e.split(","),i=n.length;1===i?t._$vueId=n[0]:2===i&&(t._$vueId=n[0],t._$vuePid=n[1])}(o.uI,this);const s={vuePid:this._$vuePid};n(this,s);const a=this,r=t(a);let c=o;this.$vm=function(e,t){mr||(mr=vr().$createComponent);const n=mr(e,t);return Xs(n.$)||n}({type:i,props:dr(c,r)},{mpType:r?"page":"component",mpInstance:a,slots:o.uS||{},parentComponent:s.parent&&s.parent.$,onBeforeSetup(t,n){!function(e,t){Object.defineProperty(e,"refs",{get(){const e={};return function(e,t,n){e.selectAllComponents(t).forEach((e=>{const t=e.properties.uR;n[t]=e.$vm||e}))}(t,".r",e),t.selectAllComponents(".r-i-f").forEach((t=>{const n=t.properties.uR;n&&(e[n]||(e[n]=[]),e[n].push(t.$vm||t))})),e}})}(t,a),function(e,t,n){const i=e.ctx;n.forEach((n=>{l(t,n)&&(e[n]=i[n]=t[n])}))}(t,a,e),function(e,t){Ya(e,t);const n=e.ctx;Wa.forEach((e=>{n[e]=function(...t){const i=n.$scope;if(i&&i[e])return i[e].apply(i,t)}}))}(t,n)}}),r||function(e){const t=e.$options;d(t.behaviors)&&t.behaviors.includes("uni://form-field")&&e.$watch("modelValue",(()=>{e.$scope&&e.$scope.setData({name:e.name,value:e.modelValue})}),{immediate:!0})}(this.$vm)},ready(){this.$vm&&(this.$vm.$callHook("mounted"),this.$vm.$callHook(J))},detached(){var e;this.$vm&&(Ga(this.$vm.$.uid),e=this.$vm,_r||(_r=vr().$destroyComponent),_r(e))}}},initRelation:function(e,t){e.triggerEvent("__l",t)},isPage:function(e){return!!e.route},mocks:["__route__","__wxExparserNodeId__","__wxWebviewId__"]});const Tr=function(e){return App(sr(e))},kr=(Dr=Er,function(e){return Component(yr(e,Dr))});var Dr;const Rr=function(e){return function(t){return Component(fr(t,e))}}(Er),Or=function(e){ar(sr(e),e)},br=function(e){const t=sr(e),n=g(getApp)&&getApp({allowDefault:!0});if(!n)return;e.$.ctx.$scope=n;const i=n.globalData;i&&Object.keys(t.globalData).forEach((e=>{l(i,e)||(i[e]=t.globalData[e])})),Object.keys(t).forEach((e=>{l(n,e)||(n[e]=t[e])})),ar(t,e)};wx.createApp=global.createApp=Tr,wx.createPage=kr,wx.createComponent=Rr,wx.createPluginApp=global.createPluginApp=Or,wx.createSubpackageApp=global.createSubpackageApp=br;
/*!
* pinia v2.1.7
* (c) 2023 Eduardo San Martin Morote
* @license MIT
*/
let Ar;const Lr=e=>Ar=e,Pr=Symbol();function Nr(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var wr,Ur;(Ur=wr||(wr={})).direct="direct",Ur.patchObject="patch object",Ur.patchFunction="patch function";const Gr=()=>{};function xr(e,t,n,i=Gr){e.push(t);const o=()=>{const n=e.indexOf(t);n>-1&&(e.splice(n,1),i())};return!n&&Fn()&&function(e){wn&&wn.cleanups.push(e)}(o),o}function Fr(e,...t){e.slice().forEach((e=>{e(...t)}))}const Br=e=>e();function qr(e,t){e instanceof Map&&t instanceof Map&&t.forEach(((t,n)=>e.set(n,t))),e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const i=t[n],o=e[n];Nr(o)&&Nr(i)&&e.hasOwnProperty(n)&&!no(i)&&!zi(i)?e[n]=qr(o,i):e[n]=i}return e}const Vr=Symbol();const{assign:jr}=Object;function Hr(e,t,n,i){const{state:o,actions:s,getters:a}=t,r=n.state.value[e];let c;return c=Kr(e,(function(){r||(n.state.value[e]=o?o():{});const t=function(e){const t=d(e)?new Array(e.length):{};for(const n in e)t[n]=uo(e,n);return t}(n.state.value[e]);return jr(t,s,Object.keys(a||{}).reduce(((t,i)=>(t[i]=Ji(Qs((()=>{Lr(n);const t=n._s.get(e);return a[i].call(t,t)}))),t)),{}))}),t,n,i,!0),c}function Kr(e,t,n={},i,o,s){let a;const r=jr({actions:{}},n),c={deep:!0};let u,l,d,p=[],h=[];const g=i.state.value[e];let f;function m(t){let n;u=l=!1,"function"==typeof t?(t(i.state.value[e]),n={type:wr.patchFunction,storeId:e,events:d}):(qr(i.state.value[e],t),n={type:wr.patchObject,payload:t,storeId:e,events:d});const o=f=Symbol();Eo().then((()=>{f===o&&(u=!0)})),l=!0,Fr(p,n,i.state.value[e])}s||g||(i.state.value[e]={}),io({});const _=s?function(){const{state:e}=n,t=e?e():{};this.$patch((e=>{jr(e,t)}))}:Gr;function v(t,n){return function(){Lr(i);const o=Array.from(arguments),s=[],a=[];let r;Fr(h,{args:o,name:t,store:y,after:function(e){s.push(e)},onError:function(e){a.push(e)}});try{r=n.apply(this&&this.$id===e?this:y,o)}catch(c){throw Fr(a,c),c}return r instanceof Promise?r.then((e=>(Fr(s,e),e))).catch((e=>(Fr(a,e),Promise.reject(e)))):(Fr(s,r),r)}}const y=ji({_p:i,$id:e,$onAction:xr.bind(null,h),$patch:m,$reset:_,$subscribe(t,n={}){const o=xr(p,t,n.detached,(()=>s())),s=a.run((()=>Bo((()=>i.state.value[e]),(i=>{("sync"===n.flush?l:u)&&t({storeId:e,type:wr.direct,events:d},i)}),jr({},c,n))));return o},$dispose:function(){a.stop(),p=[],h=[],i._s.delete(e)}});i._s.set(e,y);const I=(i._a&&i._a.runWithContext||Br)((()=>i._e.run((()=>(a=xn()).run(t)))));for(const S in I){const t=I[S];if(no(t)&&(!no(C=t)||!C.effect)||zi(t))s||(!g||Nr(M=t)&&M.hasOwnProperty(Vr)||(no(t)?t.value=g[S]:qr(t,g[S])),i.state.value[e][S]=t);else if("function"==typeof t){const e=v(S,t);I[S]=e,r.actions[S]=t}}var M,C;return jr(y,I),jr($i(y),I),Object.defineProperty(y,"$state",{get:()=>i.state.value[e],set:e=>{m((t=>{jr(t,e)}))}}),i._p.forEach((e=>{jr(y,a.run((()=>e({store:y,app:i._a,pinia:i,options:r}))))})),g&&s&&n.hydrate&&n.hydrate(y.$state,g),u=!0,l=!0,y}var zr,Wr,Yr;(Yr=zr||(zr={})).UNIAPP="uniapp",Yr.REACT_NATIVE="rn",Yr.COCOS="cocos",Yr.UNKNOWN="unknown";let $r=class e{constructor(){this.framework=null,this.methods={[zr.UNIAPP]:this.isUniApp,[zr.REACT_NATIVE]:this.isReactNative,[zr.COCOS]:this.isCocos};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.framework=n;break}this.framework=this.framework||zr.UNKNOWN,this.framework}static currentFramework(){return this.instance||(this.instance=new e),this.instance.framework}isUniApp(){try{return"function"==typeof Nn.getSystemInfoSync}catch(Yr){return!1}}isReactNative(){try{return"object"==typeof navigator&&"ReactNative"===navigator.product}catch(Yr){return!1}}isTaro(){try{return void 0!==process.env.TARO_ENV}catch(Yr){return!1}}isCocos(){try{return void 0!==cc.sys.localStorage}catch(Yr){return!1}}},Jr=class{static init(e){$r.currentFramework()===zr.REACT_NATIVE&&(this.validate(e),this.platform=e.platform,this.asyncStorage=e.asyncStorage)}static validate(e){if(!e)throw new Error("'reactNativeOptions' is missing when calling GoEasy.getInstance()");if(!e.platform)throw new Error("'platform' is missing in GoEasy 'reactNativeOptions'");if(!e.asyncStorage)throw new Error("'asyncStorage' is missing in GoEasy 'reactNativeOptions'")}};!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.RECONNECTED="reconnected",e.EXPIRED_RECONNECTED="reconnected",e.CONNECT_FAILED="connect_failed"}(Wr||(Wr={}));const Xr="2.13.17";var Qr,Zr;!function(e){e.PRIVATE="private",e.GROUP="group",e.SYSTEM="system",e.CS="cs"}(Qr||(Qr={})),function(e){e.NEW="new",e.SENDING="sending",e.SUCCESS="success",e.FAIL="fail"}(Zr||(Zr={}));let ec=class{},tc=class{constructor(e,t){this.id=e,this.data=t}},nc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};var ic;!function(e){e.MP_WX="mp-wx",e.MP_WGAME="mp-wgame",e.MP_BYTE="mp-byte",e.MP_BAIDU="mp-baidu",e.MP_ALI="mp-ali",e.BROWSER="browser",e.NODE="node",e.UNI_IOS="uni-ios",e.UNI_ANDROID="uni-android",e.COCOS_IOS="cocos-ios",e.COCOS_ANDROID="cocos-android",e.RN_IOS="rn-ios",e.RN_ANDROID="rn-android",e.UNKNOWN="unknown"}(ic||(ic={}));let oc=class e{constructor(){this.platform=null,this.methods={[ic.BROWSER]:this.isBrowser,[ic.MP_WX]:this.isMPWX,[ic.MP_WGAME]:this.isMPWeGame,[ic.MP_BYTE]:this.isMPByte,[ic.MP_BAIDU]:this.isMPBaidu,[ic.MP_ALI]:this.isMPAli,[ic.NODE]:this.isNode,[ic.UNI_IOS]:this.isUniAppIOS,[ic.UNI_ANDROID]:this.isUniAppAndroid,[ic.COCOS_IOS]:this.isCocosIOS,[ic.COCOS_ANDROID]:this.isCocosAndroid,[ic.RN_IOS]:this.isRNiOS,[ic.RN_ANDROID]:this.isRNAndroid};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.platform=n;break}this.platform=this.platform||ic.UNKNOWN,this.platform}static currentPlatform(){return this.instance||(this.instance=new e),e.instance.platform}isBrowser(){return"undefined"!=typeof navigator&&"Taro"!==navigator.product&&"ReactNative"!==navigator.product&&"undefined"==typeof GameGlobal&&("undefined"==typeof cc||null!==cc.sys.browserType)&&"undefined"==typeof my&&"undefined"==typeof tt&&"undefined"==typeof swan}isMPWX(){return"object"==typeof Pn&&"function"==typeof Pn.getSystemInfoSync&&"undefined"==typeof WebSocket&&"undefined"==typeof XMLHttpRequest&&"undefined"==typeof plus&&"undefined"==typeof tt}isMPWeGame(){return"object"==typeof GameGlobal}isMPByte(){return"object"==typeof tt&&"function"==typeof tt.getSystemInfoSync}isMPBaidu(){return"object"==typeof swan&&"function"==typeof swan.getSystemInfoSync}isMPAli(){return"object"==typeof my&&"function"==typeof my.getSystemInfoSync}isNode(){try{return"node"===process.release.name}catch(Yr){return!1}}isUniAppIOS(){try{return"ios"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Yr){return!1}}isUniAppAndroid(){try{return"android"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Yr){return!1}}isCocosIOS(){try{return"iOS"===cc.sys.os}catch(Yr){return!1}}isCocosAndroid(){try{return"Android"===cc.sys.os}catch(Yr){return!1}}isRNiOS(){try{return"ios"===Jr.platform.OS}catch(Yr){return!1}}isRNAndroid(){try{return"android"===Jr.platform.OS}catch(Yr){return!1}}},sc=class{};sc.type=ic,sc.current=oc.currentPlatform();let ac=class{onFrontend(e){this.onFrontendCallback=e}},rc=class extends ac{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){"object"==typeof plus&&(plus.globalEvent.addEventListener("resume",(()=>{this.runningBackend=!1,this.runningBackend,this.onFrontendCallback&&this.onFrontendCallback()}),!1),plus.globalEvent.addEventListener("pause",(()=>{this.runningBackend=!0,this.runningBackend}),!1))}isBackend(){return this.runningBackend}support(){const e=oc.currentPlatform();return[ic.UNI_IOS,ic.UNI_ANDROID].includes(e)}},uc=class extends ac{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){Pn.onAppShow((()=>{this.runningBackend=!1})),Pn.onAppHide((()=>{this.runningBackend=!0}))}isBackend(){return this.runningBackend}support(){return oc.currentPlatform()===ic.MP_WX}};const lc=new class{constructor(){[new rc,new uc].forEach((e=>{if(e.support())return this.checker=e,void this.checker.startCheck()}))}isBackend(){return this.checker&&this.checker.isBackend()}onFrontend(e){this.checker.onFrontend(e)}};var dc,pc,hc=Object.freeze({__proto__:null,runStatus:lc});!function(e){e.authorize="authorize",e.manualDisconnect="manualDisconnect",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.publish="publish",e.ack="ack",e.historyMessages="historyMessages",e.hereNow="hereNow",e.hereNowByUserIds="hereNowByUserIds",e.PUBSUB_PRESENCE_SUBSCRIBE="PUBSUB_PRESENCE_SUBSCRIBE",e.PUBSUB_PRESENCE_UNSUBSCRIBE="PUBSUB_PRESENCE_UNSUBSCRIBE",e.PUBSUB_PRESENCE_HERENOW="PUBSUB_PRESENCE_HERENOW",e.imLastConversations="imLastConversations",e.markPrivateMessageAsRead="markPrivateMessageAsRead",e.markGroupMessageAsRead="markGroupMessageAsRead",e.imGroupOnlineCount="imGroupOnlineCount",e.imHereNow="imHereNow",e.imGroupHereNow="imGroupHereNow",e.publishIM="publishIM",e.subscribeUserPresence="subscribeUserPresence",e.unsubscribeUserPresence="unsubscribeUserPresence",e.subscribeGroupPresence="subscribeGroupPresence",e.unsubscribeGroupPresence="unsubscribeGroupPresence",e.removeConversation="removeConversation",e.topConversation="topConversation",e.imData="imData",e.subscribeGroups="subscribeGroups",e.unsubscribeGroup="unsubscribeGroup",e.IM_DELETE_MESSAGE="IM_DELETE_MESSAGE",e.IM_HISTORY="IM_HISTORY",e.IM_HISTORY_CHANGE="IM_HISTORY_CHANGE",e.IM_RECALL_MESSAGE="IM_RECALL_MESSAGE",e.IM_MARK_AS_READ="IM_MARK_AS_READ",e.CS_PENDING_CONVERSATION="CS_PENDING_CONVERSATION",e.CS_ACCEPT="CS_ACCEPT",e.CS_END="CS_END",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENTS="CS_AGENTS",e.CS_CUSTOMER_STATUS="CS_CUSTOMER_STATUS",e.CS_MY_TEAMS="CS_MY_TEAMS",e.CS_ONLINE="CS_ONLINE",e.CS_OFFLINE="CS_OFFLINE",e.CS_LIVE_SESSION="CS_LIVE_SESSION",e.CS_QUIT_LIVE="CS_QUIT_LIVE",e.SET_IOS_BADGE="SET_IOS_BADGE",e.MD_CMD="MD_CMD"}(dc||(dc={})),function(e){e[e.connect=3e3]="connect",e[e.reconnectionDelayMax=3e3]="reconnectionDelayMax",e[e.commonQuerySingle=2500]="commonQuerySingle",e[e.commonQueryTotal=12e3]="commonQueryTotal",e[e.commonRequestSingle=1700]="commonRequestSingle",e[e.commonRequestTotal=12e3]="commonRequestTotal",e[e.commonInfiniteSingle=1700]="commonInfiniteSingle",e[e.commonInfiniteTotal=864e5]="commonInfiniteTotal"}(pc||(pc={}));let gc=class{static onSuccess(e,t){nc.isFunction(e.onSuccess)&&e.onSuccess(t)}static onFailed(e,t){if(!nc.isObject(e)||!nc.isFunction(e.onFailed))throw t;e.onFailed(t)}};function fc(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{c(i.next(e))}catch(t){s(t)}}function r(e){try{c(i.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var mc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _c(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})})),t}var vc={exports:{}};!function(){function e(t){if(t)return function(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}(t)}vc.exports=e,e.prototype.on=e.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},e.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<i.length;o++)if((n=i[o])===t||n.fn===t){i.splice(o,1);break}return this},e.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var i=0,o=(n=n.slice(0)).length;i<o;++i)n[i].apply(this,t);return this},e.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},e.prototype.hasListeners=function(e){return!!this.listeners(e).length}}();var yc=vc.exports,Ic={exports:{}},Mc="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(Mc){var Cc=new Uint8Array(16);Ic.exports=function(){return Mc(Cc),Cc}}else{var Sc=new Array(16);Ic.exports=function(){for(var e,t=0;t<16;t++)!(3&t)&&(e=4294967296*Math.random()),Sc[t]=e>>>((3&t)<<3)&255;return Sc}}for(var Ec=[],Tc=0;Tc<256;++Tc)Ec[Tc]=(Tc+256).toString(16).substr(1);var kc,Dc,Rc=function(e,t){var n=t||0,i=Ec;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")},Oc=Ic.exports,bc=Rc,Ac=0,Lc=0,Pc=Ic.exports,Nc=Rc,wc=function(e,t,n){var i=t&&n||0,o=t||[],s=(e=e||{}).node||kc,a=void 0!==e.clockseq?e.clockseq:Dc;if(null==s||null==a){var r=Oc();null==s&&(s=kc=[1|r[0],r[1],r[2],r[3],r[4],r[5]]),null==a&&(a=Dc=16383&(r[6]<<8|r[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:Lc+1,l=c-Ac+(u-Lc)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>Ac)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ac=c,Lc=u,Dc=a;var d=(1e4*(268435455&(c+=122192928e5))+u)%4294967296;o[i++]=d>>>24&255,o[i++]=d>>>16&255,o[i++]=d>>>8&255,o[i++]=255&d;var p=c/4294967296*1e4&268435455;o[i++]=p>>>8&255,o[i++]=255&p,o[i++]=p>>>24&15|16,o[i++]=p>>>16&255,o[i++]=a>>>8|128,o[i++]=255&a;for(var h=0;h<6;++h)o[i+h]=s[h];return t||bc(o)},Uc=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||Pc)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[i+s]=o[s];return t||Nc(o)},Gc=Uc;Gc.v1=wc,Gc.v4=Uc;var xc=Gc;let Fc=class{support(){return!0}getParams(){return this.params}setData(e){this.active=e.a,this.data=e.d}preConnect(e){}postConnect(){}},Bc=class{static initModule(e){e.support()&&this.modules.set(e.name,e)}static getParams(){return fc(this,void 0,void 0,(function*(){let e={};for(const[t,n]of this.modules)e[t]=(yield n.getParams())||null;return e}))}static setDatas(e){Object.keys(e).forEach((t=>{this.modules.get(t).setData(e[t])}))}static preConnect(e){this.modules.forEach(((t,n)=>{t.preConnect(e)}))}static postConnect(){this.modules.forEach(((e,t)=>{e.postConnect()}))}};Bc.Module=Fc,Bc.modules=new Map;const qc=yc;let Vc=class{constructor(){this.emitter=new qc}on(e,t){return this.emitter.on(e,t),this}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}fire(e,t){return this.emitter.emit(e,t),this}},jc=class{constructor(){this.eventDriver=new Vc}on(e,t){this.eventDriver.on(e,t)}off(e,t){this.eventDriver.off(e,t)}fire(e,t){this.eventDriver.fire(e,t)}},Hc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};const Kc=yc;let zc=class{constructor(){this.emitter=new Kc}on(e,t){if(!Hc.isString(e))throw Error("event require a string.");if(!Hc.isFunction(t))throw Error("callback must be a function");this.emitter.on(e,t)}fire(e,t){this.emitter.emit(e,t)}off(e,t){this.emitter.off(e,t)}},Wc=class{static init(e,t,n,i,o,s){this.Socket=e,this.N=t,this.Member=n,this.v=i,this.Platform=o,this.GModules=s}};const Yc=xc;let $c=class{static get(){return Yc.v1().replace(/-/g,"")}};var Jc,Xc;(Xc=Jc||(Jc={})).WRITE="WRITE",Xc.READ="READ",Xc.NONE="NONE";let Qc=class{constructor(e){this.permission=Jc.NONE,this.singleTimeout=0,this.totalTimeout=0,this.startTime=0,this.complete=!1,this.retried=0,this.unique=!1,this.uuid=$c.get(),this.name=e.name,this.params=e.params,this.permission=e.permission,this.totalTimeout=e.totalTimeout,this.singleTimeout=e.singleTimeout,e.unique&&(this.unique=e.unique),this.success=t=>{this.complete||(this.end(),e.success(t))},this.fail=t=>{this.complete||(this.end(),e.fail(t))}}start(){this.startTime=Date.now(),this.initAutoTimeout()}end(){this.complete=!0,clearTimeout(this.timeoutHandler)}initAutoTimeout(){this.timeoutHandler=setTimeout((()=>{this.complete||this.fail({resultCode:408,content:"Host unreachable or timeout"})}),this.totalTimeout)}},Zc=class e extends Fc{static init(){return this.module=new e,this.module.name=this.GN_MODULE_NAME,this.module}static setRegId(e,t){if(e){this.module.regIdPromise=e;let n=t;this.module.params={v:{npv:n}}}}preConnect(e){this.wxmpId=e.wxmpId}getParams(){return fc(this,void 0,void 0,(function*(){if(this.params=this.params||{},this.regIdPromise)try{const e=new Promise(((e,t)=>{setTimeout((()=>t("timeout")),1e3)}));this.params.regId=yield Promise.race([this.regIdPromise,e])}catch(Yr){console.warn("Failed to register the Manufacturers Push service:"+JSON.stringify(Yr))}return this.params.wxmpId=this.wxmpId,this.params}))}};Zc.GN_MODULE_NAME="GN";let eu=class e{static init(e){this.allowNotification=!0===e;let t=Zc.init();Bc.initModule(t),this.supportAppNotification()&&(this.uniappPlugin=Nn.requireNativePlugin("GoEasy-Uniapp"),this.uniappPlugin?(this.regIdPromise=this.askRegId(),this.v=this.uniappPlugin.v(),Zc.setRegId(this.regIdPromise,this.v)):console.warn("No GoEasy-Uniapp Native Plugin."),this.setClientBadge(0))}static addAssembler(e){this.payloadAssemblers.push(e)}static assemblePayload(e){let t=this.payloadAssemblers.find((t=>t.support(e)));return t?t.assemble(e):e}static createLocalNotification(t,n,i,o,s){lc.isBackend()&&(i.g=1,"undefined"!=typeof plus&&(o?(this.uniappPlugin&&this.uniappPlugin.playSound(o),plus.push.createMessage(n,JSON.stringify(i),{title:t,sound:"none"})):plus.push.createMessage(n,JSON.stringify(i),{title:t}),"+1"===s&&this.setClientBadge(e.badge+1)))}static setBadge(t){if(!Number.isInteger(t.badge)||t.badge<0)gc.onFailed(t,"badge must be an integer greater than or equal to 0.");else if(e.supportAppNotification())if(this.uniappPlugin&&oc.currentPlatform()===ic.UNI_IOS){let e=new Qc({name:dc.SET_IOS_BADGE,params:{badge:t.badge},unique:!0,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,permission:Jc.WRITE,success:()=>{gc.onSuccess(t),this.setClientBadge(t.badge)},fail:e=>{gc.onFailed(t,e.content)}});Wc.Socket.e(e)}else gc.onSuccess(t),this.setClientBadge(t.badge)}static setClientBadge(t){"vivo"!==plus.device.vendor&&(e.badge=t,plus.runtime.setBadgeNumber(t))}static askRegId(){let e=null,t=0;const n=()=>new Promise(((i,o)=>{this.uniappPlugin.regId((e=>{i(e)}),(i=>{if(!(1e6===i.data.code&&t<=10))return clearTimeout(e),o(i);e=setTimeout((()=>{t++,this.regIdPromise=n()}),3500)}))}));return n()}static getRegIdPromise(){return this.regIdPromise}static supportAppNotification(){const e=oc.currentPlatform();return this.allowNotification&&(e===ic.UNI_ANDROID||e===ic.UNI_IOS)}static listenPlusClickNotification(){plus.push.addEventListener("click",(e=>{try{if(e){const t="string"==typeof e.payload?JSON.parse(e.payload):e.payload;if(this.availableIntent(t)){let e=this.assemblePayload(t);plus.push.clear(),this.onClickNotificationCallback(e)}}}catch(t){}}))}static availableIntent(e){return e&&Object.keys(e).length&&e.g&&1===parseInt(e.g)}static getIntentData(){this.uniappPlugin.getIntentData((e=>{if(!this.availableIntent(e))return;let t=this.assemblePayload(e);const n=oc.currentPlatform();plus.push.clear(),n===ic.UNI_ANDROID&&this.uniappPlugin.clearAll(),this.onClickNotificationCallback(t)}))}static listenClick(){this.listenPlusClickNotification();const e=oc.currentPlatform();this.uniappPlugin&&e===ic.UNI_ANDROID&&(this.getIntentData(),lc.onFrontend((()=>{this.getIntentData()})))}static onClickNotification(t){if(e.supportAppNotification()){if(!nc.isFunction(t))throw new Error("The arguments must be a function.");null===this.onClickNotificationCallback?(this.onClickNotificationCallback=t,this.listenClick()):console.warn("The onClickNotification event has been listened on. Please do not listen to it more than once.")}else console.warn("The current environment doesn't support or allowNotification is false.")}};function tu(...e){}eu.uniappPlugin=null,eu.v=null,eu.regIdPromise=null,eu.onClickNotificationCallback=null,eu.payloadAssemblers=new Array;const nu=new class{validateId(e,t){if(nc.isEmpty(e))throw{code:400,content:` ${t} is required.`};if(!nc.isString(e))throw{code:400,content:`TypeError: ${t} require string.`}}validateIdArray(e,t){if(!Array.isArray(e)||0===e.length)throw{code:400,content:`TypeError: ${t} require array.`};if(e.length>100)throw{code:400,content:`${t} is over max length 100.`};for(let n=0;n<e.length;n++){if(!nc.isStringOrNumber(e[n]))throw{code:400,content:`TypeError: ${t} item require string or number.`};if(nc.isNumber(e[n])&&(e[n]=e[n].toString()),0==e[n].length)throw{code:400,content:`${t} has empty item.`}}if(Array.from(new Set(e)).length<e.length)throw{code:400,content:`Duplicate element in ${t}`}}validateChannel(e,t){if(nc.isEmpty(e))throw{code:400,content:` ${t} is required.`};if(!nc.isStringOrNumber(e))throw{code:400,content:`TypeError: ${t} require string or number.`}}validateChannelArray(e,t){this.validateIdArray(e,t)}validateChannelAndChannels(e,t){let n=!nc.isEmpty(e),i=!nc.isEmpty(t);if(!n&&!i)throw{code:400,content:"channel is required."};if(n&&i)throw{code:400,content:"subscribe to either channel or channels, not both."};n&&this.validateChannel(e,"channel"),i&&this.validateChannelArray(t,"channels")}validateCallbackOptions(e){if(!nc.isObject(e))throw{code:400,content:"bad parameters"}}validateNotification(e){function t(e,t,n){if(!(nc.isString(e[t])&&e[t].length<=n))throw{code:400,content:`notification.${t} must be a string of no more than ${n} characters`}}function n(e,t,n,i){let o=e[t];if(nc.isObject(o)&&nc.isDef(o[n])){let e={code:400,content:`notification.vendorOptions.${t}.${n} require a ${i}}`},s=o[n];if("string"===i&&!nc.isString(s))throw e;if("number"===i&&!nc.isNumber(s))throw e}}if(!nc.isObject(e))throw{code:400,content:"TypeError: notification requires an object."};{if(t(e,"title",32),t(e,"body",50),nc.isDef(e.sound)&&!nc.isString(e.sound))throw{code:400,content:"notification.sound must be a string"};if(nc.isDef(e.badge)&&!nc.isString(e.badge))throw{code:400,content:"notification.badge must be a string"};e.badge=e.badge||"0";let i=e.vendorOptions;nc.isObject(i)&&(n(i,"huawei","category","string"),n(i,"xiaomi","channel_id","string"),n(i,"oppo","channel_id","string"),n(i,"vivo","classification","number"),n(i,"vivo","category","string"))}}validateValIsEmpty(e,t){if(nc.isUndef(e)||nc.isEmpty(e))throw{code:400,content:`${t} is empty`}}validateWXMPTemplateMsg(e){if(nc.isObject(e)){if(!nc.isString(e.template_id))throw{code:400,content:"template_id must be string."};if(!nc.isEmpty(e.url)&&!nc.isString(e.url))throw{code:400,content:"url must be string"};if(!(nc.isEmpty(e.miniprogram)||nc.isString(e.miniprogram.appid)&&nc.isString(e.miniprogram.pagepath)))throw{code:400,content:"miniprogram.appid and miniprogram.pagepath must be strings."};if(!nc.isObject(e.data))throw{code:400,content:"data requires an object."}}else if(nc.isPrimitive(e))throw{code:400,content:"wxmpTemplateMsg must be an object."}}validateObject(e,t){if(nc.isUndef(e)||!nc.isObject(e))throw{code:400,content:t+" must be an object."}}validateString(e,t){if(nc.isUndef(e)||!nc.isString(e))throw{code:400,content:t+" must be a string."}}};function iu(e){if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;let t=e instanceof Array?[]:{};for(let n in e)"object"==typeof e[n]?t[n]=iu(e[n]):t[n]=e[n];return t}let ou=class{publish(e){nc.isFunction(e.onFailed)||(e.onFailed=tu),nc.isFunction(e.onSuccess)||(e.onSuccess=tu),this.validate(e),e.channel=e.channel.toString();let t={channel:e.channel,content:e.message,nt:e.notification,at:e.accessToken,guid:$c.get(),q:e.qos};e.wxmpTemplateMsg&&(t.wxmpTemplateMsg=iu(e.wxmpTemplateMsg),t.wxmpTemplateMsg.data=JSON.stringify(t.wxmpTemplateMsg.data));let n=new Qc({name:dc.publish,params:t,unique:!0,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,permission:Jc.WRITE,success:function(t){e.onSuccess({code:200,content:"ok"})},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});Wc.Socket.e(n)}validate(e){if(nu.validateChannel(e.channel,"channel"),nc.isEmpty(e.message))throw{code:400,content:"message is required."};if(!nc.isString(e.message))throw{code:400,content:"TypeError: message requires string."};if(e.message.length>1e4)throw{code:400,content:"Message over max length 10000."};if(e.qos&&!(e.qos in[0,1]))throw{code:400,content:"Qos must be 0 or 1."};e.wxmpTemplateMsg&&nu.validateWXMPTemplateMsg(e.wxmpTemplateMsg),nc.isDef(e.notification)&&nu.validateNotification(e.notification)}},su=class{constructor(e){if(this.options=e,this.channels=e.channels||[e.channel],!nc.isEmpty(e.channel)){let t=e.channel.toString();this.channels=[t]}nc.isEmpty(e.channels)||(this.channels=e.channels.toString().split(","))}};var au,ru,cu;!function(e){e.message="message",e.imMessage="imMessage",e.userPresence="userPresence",e.groupPresence="groupPresence",e.PS_PRESENCE_EVENT="PS_PRESENCE_EVENT",e.IM_MSG_READ="IM_MSG_READ",e.IM_MSG_DELETED="IM_MSG_DELETED",e.IM_MSG_RECALLED="IM_MSG_RECALLED",e.CS_ONLINE_CHANGED="CS_ONLINE_CHANGED"}(au||(au={})),function(e){e.CONNECTED="CONNECTED",e.RECONNECTED="RECONNECTED",e.DISCONNECTED="DISCONNECTED",e.LOST="LOST",e.EXPIRED_RECONNECTED="EXPIRED_RECONNECTED",e.NEW_MESSAGE="NEW_MESSAGE",e.CONNECTING="CONNECTING"}(ru||(ru={}));let uu=class{constructor(){this.subscriptions=[],Wc.Socket.onMessage(au.message,this.onNewMessage.bind(this)),Wc.Socket.on(ru.EXPIRED_RECONNECTED,this.expiredResubscribe.bind(this)),Wc.Socket.on(ru.RECONNECTED,this.resubscribePresenceChannel.bind(this))}expiredResubscribe(){this.subscriptions.forEach((e=>{this.doSubscribe(e,!1)}))}resubscribePresenceChannel(){this.subscriptions.forEach((e=>{let t=e.options;t.presence&&t.presence.enable&&this.doSubscribe(e,!0)}))}onNewMessage(e){if(e.n.indexOf("_presence")>-1)return;e.a&&Wc.Socket.sendAck("ack",{i:e.i,c:e.n});let t={time:e.t,channel:e.n,content:e.c};this.createNotification(e),this.findSubscriptionByChannel(t.channel).options.onMessage(t)}createNotification(e){const t=Wc.N.supportAppNotification();if(!nc.isObject(e.nt)||!t)return;const n={ch:e.n,ctt:e.c};Wc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}subscribe(e){if(nu.validateChannelAndChannels(e.channel,e.channels),nc.isDef(e.presence)){let t=e.presence.enable;if(!nc.isBoolean(t))throw{code:400,content:"Subscription failed. presence.enable must be a boolean"};if(t&&!Wc.Socket.user().id)throw{code:400,content:"Subscription failed. If presence is enable, the id must be specified when calling the connect method"}}let t=new su(e);this.doSubscribe(t,!1).then((()=>{this.subscriptions.push(t),gc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{gc.onFailed(e,{code:t.resultCode,content:t.content})}))}doSubscribe(e,t){let n=e.options;return new Promise(((i,o)=>{let s=new Qc({name:dc.subscribe,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{channels:e.channels,accessToken:n.accessToken,presence:n.presence,resubscribe:t},success:()=>{i()},fail:e=>{o(e)}});Wc.Socket.e(s)}))}unsubscribe(e){nu.validateChannel(e.channel,"channel"),e.channel=e.channel.toString();const t=this.findSubscriptionByChannel(e.channel);if(!t)return void e.onFailed({code:400,content:"channel["+e.channel+"] is not subscribed"});let n=new Qc({name:dc.unsubscribe,params:{channel:e.channel,presence:t.options.presence},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{e.onSuccess({code:200,content:"ok"}),this.removeChannel(e.channel)},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});Wc.Socket.e(n)}removeChannel(e){for(let t=this.subscriptions.length-1;t>=0;t--){const n=this.subscriptions[t].channels,i=n.indexOf(e);if(i>-1){n.splice(i,1),0===n.length&&this.subscriptions.splice(t,1);break}}}findSubscriptionByChannel(e){let t=!1,n=null;for(let i=this.subscriptions.length-1;i>=0;i--){let o=this.subscriptions[i].channels;for(let s=0;s<o.length;s++)if(o[s]==e){t=!0,n=this.subscriptions[i];break}if(t)break}return n}},lu=class{get(e){nc.isFunction(e.onSuccess)||(e.onSuccess=tu),nc.isFunction(e.onFailed)||(e.onFailed=tu),nu.validateChannel(e.channel,"channel"),e.channel=e.channel.toString();let t=new Qc({name:dc.historyMessages,permission:Jc.READ,params:e,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:t=>{e.onSuccess({code:t.resultCode||t.code||200,content:t.content})},fail:t=>{e.onFailed({code:t.resultCode||t.code,content:t.content})}});Wc.Socket.e(t)}},du=class{constructor(){this.channelPresenceMap=new Map,this.onPresenceEvent=e=>{let t=this.channelPresenceMap.get(e.channel);null==t||t.onPresence(e)},this.expireAllChannelPresences=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.expire()}))},this.resubscribe=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.subscribed()&&e.doSubscribe()}))},Wc.Socket.on(ru.LOST,this.expireAllChannelPresences),Wc.Socket.on(ru.RECONNECTED,this.resubscribe),Wc.Socket.onMessage(au.PS_PRESENCE_EVENT,this.onPresenceEvent)}hereNow(e){nu.validateChannel(e.channel,"channel");let t,n=this.channelPresenceMap.get(e.channel.toString());n&&n.queryPromise?(e.limit&&e.limit>n.membersLimit&&n.doQuery(e.limit),t=n.queryPromise):t=hu(e.channel,e.limit),t.then((t=>{e.onSuccess(t)})).catch((t=>{e.onFailed(t)}))}subscribe(e){if(nu.validateChannel(e.channel,"channel"),nc.isUndef(e.onPresence)||!nc.isFunction(e.onPresence))throw{code:400,content:"Subscription Presence failed. onPresence callback function is required"};let t=e.channel.toString(),n=this.channelPresenceMap.get(t);n||(n=new pu(t),this.channelPresenceMap.set(t,n)),n.subscribe(e)}unsubscribe(e){nu.validateChannel(e.channel,"channel");let t=e.channel.toString();if(this.channelPresenceMap.get(t)){let n=new Qc({name:dc.PUBSUB_PRESENCE_UNSUBSCRIBE,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{channel:t},success:n=>{this.channelPresenceMap.delete(t),e.onSuccess()},fail:t=>{e.onFailed(t)}});Wc.Socket.e(n)}else e.onSuccess()}},pu=class{constructor(e){this.membersLimit=10,this.queried=!1,this.channel=e}onPresence(e){return fc(this,void 0,void 0,(function*(){this.queried?this.update(e):yield this.queryPromise,this.on({channel:this.channel,action:e.action,member:e.member,time:e.time,amount:this.amount,members:this.membersByLimit()})}))}membersByLimit(){return this.members.slice(0,this.membersLimit)}subscribe(e){return fc(this,void 0,void 0,(function*(){if(e.membersLimit&&(this.membersLimit=Math.min(e.membersLimit,300)),!this.subscribed())try{yield this.doSubscribe()}catch(t){return void e.onFailed(t)}this.on=e.onPresence,e.onSuccess()}))}doSubscribe(){return this.doQuery(this.membersLimit),new Promise(((e,t)=>{let n=new Qc({name:dc.PUBSUB_PRESENCE_SUBSCRIBE,permission:Jc.READ,params:{channel:this.channel},singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{e()},fail:e=>{t(e)}});Wc.Socket.e(n)}))}doQuery(e){this.queryPromise=hu(this.channel,e),this.queryPromise.then((e=>{this.members=e.content.members,this.amount=e.content.amount,this.queried=!0})).catch((e=>{throw e}))}update(e){if(["join","back"].includes(e.action))this.members.unshift(e.member);else if(["leave","timeout"].includes(e.action)){let t=this.members.findIndex((t=>t.id===e.member.id));t>-1&&this.members.splice(t,1)}this.amount=e.amount}expire(){this.queried=!1,this.queryPromise=null}subscribed(){return void 0!==this.on}};function hu(e,t){return t||(t=10),new Promise(((n,i)=>{let o={channel:e,limit:t},s=new Qc({name:dc.PUBSUB_PRESENCE_HERENOW,permission:Jc.READ,params:o,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:e=>{n(e)},fail:e=>{i(e)}});Wc.Socket.e(s)}))}let gu=class e{constructor(){this.publisher=new ou,this.subscriber=new uu,this.presence2=new du,this.histories=new lu}static init(){this.instance=new e}publish(e){this.publisher.publish(e)}subscribe(e){this.subscriber.subscribe(e)}unsubscribe(e){this.subscriber.unsubscribe(e)}subscribePresence(e){this.presence2.subscribe(e)}unsubscribePresence(e){this.presence2.unsubscribe(e)}history(e){this.histories.get(e)}hereNow(e){this.presence2.hereNow(e)}},fu=class e extends Fc{static init(){return this.module=new e,this.module.name=this.GWS_MODULE_NAME,this.initGN(),this.module}static initGN(){eu.addAssembler(new class{assemble(e){return{channel:e.ch,content:e.ctt}}support(e){return!!e.ch}})}postConnect(){gu.init()}static check(){if(!this.module)throw{code:400,content:"PubSub not initialized. Please include 'PUBSUB' in the 'modules' during GoEasy initialization."}}};fu.GWS_MODULE_NAME="GWS";let mu=class{constructor(){}};!function(e){e.aliYun="ALI",e.qiNiu="QN",e.tencent="TX",e.s3="S3"}(cu||(cu={}));let _u=new class extends mu{constructor(){super()}upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{Nn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.tempFilePath||t.fullPath||t.path}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(e);Nn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=this.getTempFilePath(e);if("undefined"!=typeof plus)plus.io.resolveLocalFileSystemURL(i,(e=>{e.file((e=>{let i=new plus.io.FileReader;i.onloadend=e=>{const n=Nn.base64ToArrayBuffer(e.target.result.split(",")[1]);t(n)},i.onerror=function(e){n(e)},i.readAsDataURL(e)}))}),(e=>{n("Resolve file URL failed: "+e.message)}));else if("undefined"!=typeof FileReader){const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e.file)}else if("object"==typeof Pn&&Pn.canIUse("getFileSystemManager"))try{const e=Pn.getFileSystemManager().readFileSync(i);t(e)}catch(o){n(o)}}))}};const vu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):new Promise(((n,i)=>{Pn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))}))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file||e.fileRes;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));Pn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{try{t(Pn.getFileSystemManager().readFileSync(e))}catch(i){n(i)}}))}},yu=new class extends mu{constructor(){super()}upload(e,t){return new Promise(((n,i)=>{try{const o=new XMLHttpRequest,s=e.storageLocation===cu.s3,a=s?"PUT":"POST",r=s?e.url:e.host;o.open(a,r,!0);for(let t in e.headers)o.setRequestHeader(t,e.headers[t]);o.upload.onprogress=function(e){t&&t(e)},o.upload.onloadstart=function(e){t&&t(e)},o.upload.onloadend=function(e){t&&t(e)};let c=new FormData;for(let t in e.parameters)"fileRes"==t?c.append("file",e.parameters[t]):c.append(t,e.parameters[t]);const u=s?e.file:c;o.send(u),o.onreadystatechange=function(){4==o.readyState&&(o.status>=200&&o.status<300||304==o.status?(s&&(e.url=e.url.split("?")[0]),n()):i({code:o.status,content:o.responseText}))}}catch(o){i({code:500,content:o})}}))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e)}))}},Iu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{my.uploadFile({url:e.host,filePath:this.getTempFilePath(e),fileType:"image",name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));my.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{my.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail(e){n(e)}})}))}},Mu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{swan.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));swan.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{swan.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail:e=>{n(e)}})}))}};let Cu=class{constructor(e,t,n){this.storageLocation=e,this.url=t,this.name=n}};const Su=new class{constructor(){this.uploader={[zr.UNIAPP]:_u,[ic.MP_WX]:vu,[ic.BROWSER]:yu,[ic.MP_ALI]:Iu,[ic.MP_BAIDU]:Mu,[zr.REACT_NATIVE]:yu,[ic.MP_BYTE]:vu}}upload(e,t){return fc(this,void 0,void 0,(function*(){const n=$r.currentFramework(),i=oc.currentPlatform(),o=n===zr.UNKNOWN?i:n;let s=this.uploader[o];return yield s.upload(e,t),new Cu(e.storageLocation,e.url,e.newFileName)}))}};let Eu=class{resolve(e){return new Promise(((t,n)=>{let i=new Qc({name:"uploadToken",params:{filename:e},permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail(e){n(e.content)},success(e){200===e.code?t(e.content):n(e.content)}});Wc.Socket.e(i)}))}},Tu=class{constructor(e,t,n,i,o,s,a){this.storageLocation=e,this.host=t,this.headers=n,this.parameters=i,this.file=o,this.newFileName=s,this.url=a}},ku=class{constructor(){}newFileName(e){return e&&e.newFilename||""}},Du=new class extends ku{constructor(){super()}url(e){return e.host+"/"+e.dir+"/"+this.newFileName(e)}build(e,t,n){let i,o=this.newFileName(e);return i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200",fileRes:t},n&&(i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200","Content-Disposition":"attachment;filename="+t.name,fileRes:t}),new Tu(cu.aliYun,e.host,null,i,t,o,this.url(e))}},Ru=new class extends ku{constructor(){super()}url(e){return e.host+"/"+e.key}build(e,t,n){let i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,fileRes:t};return n&&(i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,"Content-Disposition":`attachment;filename=${t.name}`,fileRes:t}),new Tu(cu.tencent,e.host,null,i,t,e.key,this.url(e))}},Ou=new class extends ku{constructor(){super()}url(e){return e.uploadUrl}build(e,t,n){const i={file:t};return new Tu(cu.s3,null,{"Content-Type":"application/octet-stream"},i,t,t.name,this.url(e))}},bu=class{constructor(){this.uploadTokenResolver=new Eu}builder(e){if(e===cu.aliYun)return Du;if(e===cu.tencent)return Ru;if(e===cu.s3)return Ou;throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e)}build(e,t,n){return fc(this,void 0,void 0,(function*(){try{let i=yield this.uploadTokenResolver.resolve(t),o=this.builder(i.vendor).build(i,e,n);return Promise.resolve(o)}catch(i){return Promise.reject(i)}}))}},Au=class{constructor(){this.requestBuilder=new bu,this.fileUploader=Su}upload(e,t,n,i){return fc(this,void 0,void 0,(function*(){try{let o=yield this.requestBuilder.build(e,t,i);return this.fileUploader.upload(o,n)}catch(o){return Promise.reject(o)}}))}};var Lu,Pu,Nu,wu;!function(e){e.MESSAGE_SENDING="IM_INTERNAL_MESSAGE_SENDING",e.MESSAGE_SEND_SUCCESS="IM_INTERNAL_MESSAGE_SEND_SUCCESS",e.MESSAGE_SEND_FAILED="IM_INTERNAL_MESSAGE_SEND_FAILED",e.MESSAGE_RECEIVED="IM_INTERNAL_MESSAGE_RECEIVED",e.MESSAGE_RECALLED="IM_INTERNAL_MESSAGE_RECALLED",e.MAX_MESSAGE_CHANGED="IM_INTERNAL_MAX_MESSAGE_CHANGED",e.MAX_MESSAGE_DELETED="IM_INTERNAL_MAX_MESSAGE_DELETED",e.UNREAD_AMOUNT_CHANGED="IM_INTERNAL_UNREAD_MESSAGE_CHANGED",e.CS_ONLINE_SUCCESS="CS_ONLINE_SUCCESS",e.CS_OFFLINE_SUCCESS="CS_OFFLINE_SUCCESS",e.CS_ACCEPTED="CS_ACCEPTED",e.CS_ENDED="CS_ENDED",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENT_MESSAGE_RECEIVED="CS_AGENT_MESSAGE_RECEIVED"}(Lu||(Lu={}));let Uu=class{clearUseLessAttribute(){delete this.buildOptions}isOtherSent(){return this.senderId!==Wc.Socket.user().id}getToData(){return this.buildOptions.createOptions.to.data}},Gu=class{};!function(e){e.TEXT="text",e.IMAGE="image",e.FILE="file",e.VIDEO="video",e.AUDIO="audio"}(Pu||(Pu={}));let xu=class extends Gu{constructor(){super(...arguments),this.goEasyUploader=new Au}improve(e){let t=e.message;return new Promise(((e,n)=>{let i,o,s=t.buildOptions.createOptions;t.type===Pu.VIDEO?(o=t.payload,i=o.video.name):(o=t.payload,i=o.name),this.goEasyUploader.upload(s.file,i,s.onProgress,t.type===Pu.FILE).then((n=>{n.storageLocation!==cu.s3&&(n.url=encodeURI(n.url)),this.setPayload(n,t),e()})).catch((e=>{n(e)}))}))}setPayload(e,t){t.payload.url=e.url}},Fu=class extends xu{setPayload(e,t){let n,i=t.payload;switch(i.video.url=e.url,i.video.name=e.name,i.thumbnail.height>200&&(i.thumbnail.height=200,i.thumbnail.width=200*i.video.width/i.video.height),e.storageLocation){case cu.aliYun:n="?x-oss-process=video/snapshot,t_0000,f_jpg,h_"+i.thumbnail.height+",m_fast,ar_auto";break;case cu.tencent:n="?ci-process=snapshot&time=1&format=jpg&height="+i.thumbnail.height;break;case cu.s3:n="?process=video&height="+i.thumbnail.height;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail.url=e.url+n}},Bu=class extends xu{setPayload(e,t){let n,i=t.payload;i.url=e.url;const o=i.height>200?200:i.height;switch(e.storageLocation){case cu.aliYun:n="?x-oss-process=image/resize,m_lfit,h_"+o;break;case cu.tencent:n=`?imageMogr2/thumbnail/x${o}`;break;case cu.s3:n=`?process=image&height=${o}`;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail=e.url+n}},qu=class{constructor(){this.improvers={[Pu.FILE]:new xu,[Pu.AUDIO]:new xu,[Pu.IMAGE]:new Bu,[Pu.VIDEO]:new Fu}}improve(e){let t=this.improvers[e.message.type];if(t)try{return t.improve(e)}catch(n){return Promise.reject(n)}return Promise.resolve()}},Vu=class e extends jc{static init(){this.i=new e}},ju=class{constructor(e,t,n,i,o){this.validate(e),this.mt=e.type,this.to=t.id.toString(),this.d=JSON.stringify(t.data),this.p=JSON.stringify(e.payload),n&&(this.nt=n),o&&(this.at=o),i&&(this.wxmpTemplateMsg=iu(i),this.wxmpTemplateMsg.data=JSON.stringify(this.wxmpTemplateMsg.data));let s=t.type;if(this.t=s,s===Qr.CS){let t=e;this.tid=t.teamId}this.guid=e.messageId}validate(e){if(e.type===Pu.TEXT&&JSON.stringify(e.payload).length>3072)throw Error("message-length limit 3kb")}},Hu=class{constructor(){this.payloadImprover=new qu}send(e){this.validate(e);let t=e.message,n=e.accessToken,i=t.buildOptions,o=i.createOptions,s=o.notification,a=o.wxmpTemplateMsg,r=o.to;r.data||(r.data={}),t.status=Zr.SENDING;let c=i.complete,u=this.payloadImprover.improve(e);Promise.all([c,u]).then((()=>fc(this,void 0,void 0,(function*(){if(o.beforeSend){const e=JSON.parse(JSON.stringify(t));yield o.beforeSend(e)}this.doSend(t,r,s,a,n,e)})))).catch((n=>{t.status=Zr.FAIL,gc.onFailed(e,{code:n&&n.code||400,content:n&&n.content||n})}))}doSend(e,t,n,i,o,s){let a=new ju(e,t,n,i,o);Vu.i.fire(Lu.MESSAGE_SENDING,e);let r=new Qc({name:dc.publishIM,params:a,unique:!0,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:t=>{e.status=Zr.FAIL,Vu.i.fire(Lu.MESSAGE_SEND_FAILED,e),gc.onFailed(s,{code:t.resultCode,content:t.content})},success:t=>{if(e.status=Zr.SUCCESS,e.timestamp=t.content.timestamp,e.messageId=JSON.stringify(t.content.id),e.scene()===Qr.CS){let n=e;n.customerId()!==Wc.Socket.user().id&&(n.sessionId=t.content.sessionId)}e.clearUseLessAttribute(),Vu.i.fire(Lu.MESSAGE_SEND_SUCCESS,e),gc.onSuccess(s,e)}});Wc.Socket.e(r)}validate(e){let t=e.message;if(!(t instanceof Uu))throw new Error("it is invalid message");if(t.status!==Zr.NEW)throw new Error("Please create a new message, a message can only be sent once")}},Ku=class{insert(e,t){let n=this.binarySearch(e,t);if(n>=0)e.splice(n,1,t);else{let i=-n-1;e.splice(i,0,t)}}binarySearch(e,t){let n=0,i=e.length-1;for(;n<=i;){let o=i+n>>1,s=this.compare(t,e[o]);if(s>0)n=o+1;else{if(!(s<0))return o;i=o-1}}return-n-1}},zu=class e{constructor(e){this.messages=new Array,this.allLoaded=!1,this.target=e}all(){return this.messages}sliceOverLengthMessages(){this.messages.length>e.CACHE_MAX_LENGTH&&(this.messages=this.messages.slice(-e.CACHE_MAX_LENGTH),!0===this.allLoaded&&(this.allLoaded=!1))}getMaxMessage(){return this.messages[this.messages.length-1]}loadLocalMessages(e,t){let n=[],i=this.messages.length;if(t){if(i>0){let o=this.messages[0].timestamp,s=this.messages[i-1].timestamp;if(t>=o&&t<=s)for(let a=i-1;a>=0;a--){let i=this.messages[a];if(i.timestamp<t){if(!(n.length<e))break;n.unshift(i)}}}}else n=this.messages.slice(-e);return n}cacheServerMessages(t,n){let i=this.messages[0];this.messages.length<e.CACHE_MAX_LENGTH&&(!t.lastTimestamp||this.messages.length>0&&i.timestamp===t.lastTimestamp)&&(n.forEach((t=>{e.sortedInserter.insert(this.messages,t)})),n.length<t.limit&&(this.allLoaded=!0))}findMessageByTime(e){return this.messages.find((t=>e===t.timestamp))}findMessagesByTimes(e){let t=[];return e.forEach((e=>{let n=this.findMessageByTime(e);nc.isDef(n)&&t.push(n)})),t}existsMessage(e){return this.findMessageIndexById(e)>-1}findMessageIndexById(e){return this.messages.findIndex((t=>e===t.messageId))}deleteMessage(e){let t=this.findMessageIndexById(e);t>=0&&this.messages.splice(t,1)}recallMessage(e){return e.times.map((e=>this.findMessageByTime(e))).filter((e=>nc.isDef(e))).map((t=>(t.recalled=!0,t.recaller=e.recaller,t)))}isEmpty(){return 0===this.messages.length}deleteMessages(e){e.forEach((e=>{this.deleteMessage(e.messageId)}))}saveMessage(t){e.sortedInserter.insert(this.messages,t),this.deleteGroupConversationMessage(),this.sliceOverLengthMessages()}deleteGroupConversationMessage(){this.target.scene===Qr.GROUP&&this.messages.length>=2&&1===this.messages[0].x&&this.messages.shift()}maxSuccessMessageTime(){for(let e=this.messages.length-1;e>=0;e--)if(this.messages[e].status===Zr.SUCCESS)return this.messages[e].timestamp;return 0}minTime(){return this.isEmpty()?0:this.messages[0].timestamp}correctPosition(e){this.deleteMessage(e.messageId),this.saveMessage(e)}};zu.CACHE_MAX_LENGTH=200,zu.sortedInserter=new class extends Ku{compare(e,t){let n=e.timestamp-t.timestamp;return n>0?1:0===n?0:-1}};let Wu=class e{constructor(e,t,n){this.scene=e,this.id=t,nc.isDef(n)&&(this.teamId=n)}toString(){return Qr.PRIVATE===this.scene||Qr.GROUP===this.scene?this.scene+"#"+this.id:this.scene+"#"+this.id+"#"+this.teamId}customerId(){if(Qr.CS===this.scene)return this.id===this.teamId?Wc.Socket.user().id:this.id}static byScene(t,n,i){return new e(t,n,i)}static byIMMessage(t){let n,i,o=t.scene();if(o===Qr.PRIVATE){let e=t.senderId,n=t.targetId();i=Wc.Socket.user().id===e?n:e}else if(o===Qr.GROUP)i=t.targetId();else{if(o!==Qr.CS)throw{code:400,content:`scene ${o} not exists`};i=t.targetId(),n=t.teamId}return new e(o,i,n)}static byMessageReadRemoteEvent(t){let n,i=t.scene,o=t.targetId,s=t.markerId,a=t.teamId;return i===Qr.PRIVATE?n=Wc.Socket.user().id===s?o:s:i===Qr.GROUP?n=o:i===Qr.CS&&(n=o===a?s===Wc.Socket.user().id?a:s:s===Wc.Socket.user().id?o:a),new e(i,n,a)}static byIMMessageDeletedEvent(t){let n=t.scene,i=t.deleterId;if(n===Qr.PRIVATE){let o=Wc.Socket.user().id===i?t.targetId:i;return new e(n,o)}if(n===Qr.GROUP)return new e(n,t.targetId)}static byConversationDTO(e){let t=e.lastMessage;return this.byIMMessage(t)}static byConversationId(t,n){let i;if(t===Qr.PRIVATE){let e=n.split(":",2);i=e[0]===Wc.Socket.user().id?e[1]:e[0]}else i=n;return new e(t,i)}},Yu=class{constructor(e){this.times=new Array;let t=e[0],n=Wu.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{e.status===Zr.SUCCESS&&this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e<t?-1:e==t?0:1))}},$u=class{static deleteServerMessages(e){let t=new Yu(e);return t.times.length<0?Promise.resolve():new Promise(((e,n)=>{let i=new Qc({name:dc.IM_DELETE_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:t=>{200===t.code?e(t):n(t)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}static validate(e){let t=e.messages;for(let n=0;n<t.length;n++){let e=t[n];if(e.status===Zr.SENDING)throw{code:400,content:"message["+n+"] is '"+e.status+"' and cannot be deleted"}}}},Ju=class{constructor(e,t,n,i,o){this.scene=e,this.id=t,this.after=n,this.min=i,this.teamId=o}},Xu=class{constructor(e,t,n,i){this.id=e,this.scene=t,this.lastTimestamp=n,this.teamId=i}},Qu=class extends Uu{constructor(){super(...arguments),this.read=!1}scene(){return Qr.PRIVATE}targetId(){return this.receiverId}},Zu=class extends Uu{scene(){return Qr.GROUP}targetId(){return this.groupId}},el=class extends Uu{constructor(){super(...arguments),this.accepted=!1}scene(){return Qr.CS}targetId(){return Wc.Socket.user().id===this.customerId()?this.teamId:this.customerId()}sendByCustomer(){return this.to===this.teamId}customerId(){return this.sendByCustomer()?this.senderId:this.to}isOtherSent(){return Wc.Socket.user().id===this.customerId()?this.senderId!==Wc.Socket.user().id:this.senderId===this.customerId()}};!function(e){e.ACCEPT="CS_ACCEPT",e.END="CS_END",e.TRANSFER="CS_TRANSFER"}(Nu||(Nu={}));let tl=class{build(e){let t,n=e.t;n===Qr.PRIVATE?(t=new Qu,t.read=!1,t.receiverId=e.r):n===Qr.GROUP?(t=new Zu,t.groupId=e.r,t.senderData=e.d?JSON.parse(e.d):{}):n===Qr.CS&&(t=new el,t.to=e.r,t.teamId=e.tid,t.senderData=e.d?JSON.parse(e.d):{},t.accepted=e.accepted,t.customerId()!==Wc.Socket.user().id&&(t.sessionId=e.sessionId)),t.senderId=e.s,t.messageId=e.i,t.timestamp=e.ts,t.type=e.mt;let i=e.p;if(nc.isDef(i))if(n===Qr.CS&&t.type===Nu.TRANSFER){let e=JSON.parse(i);e.transferTo.data=JSON.parse(e.transferTo.data),t.payload=e}else t.payload=JSON.parse(i);let o=e.rc;return nc.isDef(o)&&!0===o?(t.recalled=o,t.recaller=e.recaller):t.recalled=!1,t.status=Zr.SUCCESS,t}},nl=class{constructor(){this.builder=new tl}sync(e,t,n,i,o){let s=new Ju(e,t,n,i,o);return new Promise(((e,t)=>{let n=new Qc({name:dc.IM_HISTORY_CHANGE,params:s,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;e(n)}});Wc.Socket.e(n)}))}loadServerMessages(e,t){return new Promise(((n,i)=>{let o=new Qc({name:dc.IM_HISTORY,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{i(e)},success:t=>{let i=t.content;i.messages=this.convertServerMessages(e,i.messages),n(i)}});Wc.Socket.e(o)}))}convertServerMessages(e,t){let n=[],i=e.scene,o=e.id;return t.forEach((t=>{if(t.t=i,Qr.PRIVATE===i)t.r=t.s===Wc.Socket.user().id?o:Wc.Socket.user().id;else if(Qr.GROUP===i)t.r=o;else if(Qr.CS===i){let n=e.customerId(),i=e.teamId;n===Wc.Socket.user().id?t.r=i:t.r=n}let s=this.builder.build(t);n.push(s)})),n}updateServerOffsets(e,t){return fc(this,void 0,void 0,(function*(){let n=new Xu(t.id,t.scene,e,t.teamId);return new Promise(((e,t)=>{let i=new Qc({name:dc.IM_MARK_AS_READ,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{e(t)},fail:e=>{t(e)}});Wc.Socket.e(i)}))}))}};nl.instance=new nl;let il=class{constructor(){this.offsetMap=new Map,this.markingTime=0,this.userId=Wc.Socket.user().id}updateOffset(e,t){let n=this.offsetMap.get(e);return nc.isDef(n)?t>n&&(this.offsetMap.set(e,t),!0):(this.offsetMap.set(e,t),!0)}updateUserOffsets(e){e.forEach((e=>{let t=e.userId,n=e.offset;this.updateOffset(t,n)}))}updateMyOffset(e){return this.updateOffset(this.userId,e)}myOffset(){return this.getOffset(this.userId)}getOffset(e){return this.offsetMap.get(e)||0}},ol=class{constructor(e,t,n,i,o){this.id=e,this.scene=t,this.lastTimestamp=n,this.limit=i,this.teamId=o}},sl=class{constructor(e){this.history=e}pre(){this.oldLastMessage=this.history.getMaxMessage(),this.oldUnreadAmount=this.history.unreadAmount(),this.oldLastMessage&&(this.oldLastMessageRecalled=this.oldLastMessage.recalled,this.oldLastMessageRead=this.oldLastMessage.read,this.oldLastMessageStatus=this.oldLastMessage.status)}post(){let e,t,n,i=this.history.unreadAmount(),o=this.history.getMaxMessage();o&&(n=o.status,e=o.read,t=o.recalled);let s=this.history.target;this.oldLastMessage!==o||this.oldLastMessageRead!==e||this.oldLastMessageRecalled!==t||this.oldLastMessageStatus!==n?o?Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,o):Vu.i.fire(Lu.MAX_MESSAGE_DELETED,s):this.oldUnreadAmount!==i&&Vu.i.fire(Lu.UNREAD_AMOUNT_CHANGED,s)}},al=class{constructor(e,t,n,i){this.scene=e,this.conversationId=t,this.recaller=n,this.times=i}},rl=class{static init(){this.eventCenter=new zc}static on(e,t){this.eventCenter.on(e,t)}static fire(e,t){this.eventCenter.fire(e,t)}static off(e,t){this.eventCenter.off(e,t)}};!function(e){e.PRIVATE_MESSAGE_RECEIVED="PRIVATE_MESSAGE_RECEIVED",e.GROUP_MESSAGE_RECEIVED="GROUP_MESSAGE_RECEIVED",e.SYSTEM_MESSAGE_RECEIVED="SYSTEM_MESSAGE_RECEIVED",e.CONVERSATIONS_UPDATED="CONVERSATIONS_UPDATED",e.HISTORY_EXPIRED="HISTORY_EXPIRED",e.USER_PRESENCE="USER_PRESENCE",e.GROUP_PRESENCE="GROUP_PRESENCE",e.MESSAGE_DELETED="MESSAGE_DELETED",e.MESSAGE_READ="MESSAGE_READ",e.MESSAGE_RECALLED="MESSAGE_RECALLED",e.CS_MESSAGE_RECEIVED="CS_MESSAGE_RECEIVED",e.PENDING_CONVERSATIONS_UPDATED="PENDING_CONVERSATIONS_UPDATED"}(wu||(wu={}));let cl=class{constructor(e){this.expiredTime=0,this.remoteHistory=nl.instance,this.target=e,this.userOffsets=new il,this.messageCache=new zu(e)}initMaxMessageAndOffsets(e,t){this.existsMessage(e)||(this.messageCache.saveMessage(e),t.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!1)})))}existsMessage(e){return this.messageCache.existsMessage(e.messageId)}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){return this.expiredTime>0&&!this.messageCache.isEmpty()&&(yield this.updateByServerChange()),nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return fc(this,void 0,void 0,(function*(){let n=this.messageCache.loadLocalMessages(t,e);if(!1===this.messageCache.allLoaded&&n.length!==t){let i=t-n.length,o=n[0]?n[0].timestamp:e,s=new ol(this.target.id.toString(),this.target.scene,o,i,this.target.teamId),a=yield this.remoteHistory.loadServerMessages(this.target,s),r=a.messages;n=r.concat(n),this.messageCache.cacheServerMessages(s,r),a.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),this.userOffsets.offsetMap.forEach(((e,t)=>{this.markLocalMessagesRead(r,t,e,!1)}))}return n}))}deleteMessages(e){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let t=e.messages;yield $u.deleteServerMessages(t),this.messageCache.deleteMessages(t),gc.onSuccess(e)}))))}))}syncDeletedMessage(e,t){this.aopUnreadAmountMaxMessage((()=>{this.doSyncDeletedMessage(e,t)}))}doSyncDeletedMessage(e,t){if(e===Wc.Socket.user().id){let e=this.messageCache.findMessagesByTimes(t);this.messageCache.deleteMessages(e),e.length>0&&rl.fire(wu.MESSAGE_DELETED,e)}}recallMessages(e){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){this.doRecall(e)}))))}))}doRecall(e){let t=this.messageCache.recallMessage(e);t.length>0&&rl.fire(wu.MESSAGE_RECALLED,t)}expire(){this.messageCache.isEmpty()||(this.expiredTime=this.messageCache.maxSuccessMessageTime())}updateByServerChange(){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let e=yield this.remoteHistory.sync(this.target.scene,this.target.id,this.expiredTime,this.messageCache.minTime(),this.target.teamId);e.userOffsets.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!0)}));let t=e.deletedMessageTimes;t.length>0&&this.doSyncDeletedMessage(Wc.Socket.user().id,t);let n=e.recalledMessages;n.length>0&&n.forEach((e=>{let t=new al(this.target.scene,this.target.id,e.recaller,e.times);this.doRecall(t)})),this.expiredTime=0}))))}))}markRead(){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let e=this.messageCache.maxSuccessMessageTime();e>this.userOffsets.myOffset()&&(this.userOffsets.markingTime=e,yield this.remoteHistory.updateServerOffsets(e,this.target),e===this.userOffsets.markingTime&&this.markLocalMessagesRead(this.messageCache.all(),Wc.Socket.user().id,e,!0))}))))}))}syncMarkedMessage(e){this.aopUnreadAmountMaxMessage((()=>{this.markLocalMessagesRead(this.messageCache.all(),e.markerId,e.time,!0)}))}onMessageSending(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e)}))}onMessageSendSuccess(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.correctPosition(e),this.markLocalMessagesRead(this.messageCache.all(),Wc.Socket.user().id,e.timestamp,!0)}))}onMessageSendFailed(e){this.getMaxMessage()===e&&Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,e)}onMessageReceived(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e),this.markLocalMessagesRead(this.messageCache.all(),e.senderId,e.timestamp,!0)}))}aopUnreadAmountMaxMessage(e,t){return fc(this,void 0,void 0,(function*(){try{let t=new sl(this);t.pre(),yield e(),t.post()}catch(n){gc.onFailed(t,n)}}))}markLocalMessagesRead(e,t,n,i){if(this.userOffsets.updateOffset(t,n),this.isOtherUserId(t)){let t=this.markMySentRead(e,n);i&&t.length>0&&rl.fire(wu.MESSAGE_READ,t)}else t===Wc.Socket.user().id&&this.markOthersSentRead(e,n)}markOthersSentRead(e,t){if(this.target.scene===Qr.PRIVATE)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.isOtherSent()&&i.timestamp<=t){if(i.read)break;i.read=!0}}}markMySentRead(e,t){let n=new Array;if(this.target.scene===Qr.PRIVATE)for(let i=e.length-1;i>=0;i--){let o=e[i];if(!o.isOtherSent()&&o.timestamp<=t&&o.status===Zr.SUCCESS){if(o.read)break;o.read=!0,n.push(o)}}return n}isOtherUserId(e){if(this.target.scene===Qr.CS){let t=this.target.customerId();return Wc.Socket.user().id===t?e!==Wc.Socket.user().id:e===t}return e!==Wc.Socket.user().id}unreadAmount(e){let t=0,n=this.userOffsets.myOffset(),i=this.messageCache.all();for(const o of i)o.isOtherSent()&&!1===o.recalled&&o.timestamp>n&&(t+=1);return t}getMaxMessage(e){return this.messageCache.getMaxMessage()}maxTime(e){let t=this.getMaxMessage();return nc.isDef(t)?t.timestamp:0}},ul=class{constructor(e,t){this.teamId=e,this.customerId=t}},ll=class{},dl=class{constructor(e,t,n){this.teamId=e,this.teamData=JSON.stringify(t),this.agentData=JSON.stringify(n)}},pl=class{constructor(e){this.teamId=e}},hl=class{constructor(e){this.teamId=e}};var gl={exports:{}},fl=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ml=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],_l=function(e){var t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));for(var o=fl.exec(e||""),s={},a=14;a--;)s[ml[a]]=o[a]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s},vl={exports:{}},yl={exports:{}},Il=1e3,Ml=6e4,Cl=36e5,Sl=24*Cl,El=function(e,t){t=t||{};var n,i=typeof e;if("string"===i&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"days":case"day":case"d":return n*Sl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Cl;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ml;case"seconds":case"second":case"secs":case"sec":case"s":return n*Il;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===i&&!1===isNaN(e))return t.long?Tl(n=e,Sl,"day")||Tl(n,Cl,"hour")||Tl(n,Ml,"minute")||Tl(n,Il,"second")||n+" ms":function(e){return e>=Sl?Math.round(e/Sl)+"d":e>=Cl?Math.round(e/Cl)+"h":e>=Ml?Math.round(e/Ml)+"m":e>=Il?Math.round(e/Il)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Tl(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,i=+new Date,s=i-(n||i);e.diff=s,e.prev=n,e.curr=i,n=i;for(var a=new Array(arguments.length),r=0;r<a.length;r++)a[r]=arguments[r];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var c=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(function(n,i){if("%%"===n)return n;c++;var o=t.formatters[i];if("function"==typeof o){var s=a[c];n=o.call(e,s),a.splice(c,1),c--}return n})),t.formatArgs.call(e,a),(o.log||t.log||console.log.bind(console)).apply(e,a)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,i=0;for(n in e)i=(i<<5)-i+e.charCodeAt(n),i|=0;return t.colors[Math.abs(i)%t.colors.length]}(e),o.destroy=i,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function i(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=yl.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var i=("string"==typeof e?e:"").split(/[\s,]+/),o=i.length;for(n=0;n<o;n++)i[n]&&("-"===(e=i[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var s=t.instances[n];s.enabled=t.enabled(s.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,i;for(n=0,i=t.skips.length;n<i;n++)if(t.skips[n].test(e))return!1;for(n=0,i=t.names.length;n<i;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=El,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(0,yl.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(n){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=yl.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var i="color: "+this.color;e.splice(1,0,i,"color: inherit");var o=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(s=o))})),e.splice(s,0,i)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(n){}},t.load=n,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(n())}(vl,vl.exports);var kl=_l,Dl=vl.exports("socket.io-client:url"),Rl=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Dl("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Dl("parse %s",e),n=kl(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port,n.href=n.protocol+"://"+i+(t&&t.port===n.port?"":":"+n.port),n},Ol={},bl={}.toString,Al=Array.isArray||function(e){return"[object Array]"==bl.call(e)};!function(e){vl.exports("socket.io-parser");var t=vc.exports,n=Al;function i(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=i,e.Decoder=s;var o=e.ERROR+'"encode error"';function s(){this.reconstructor=null}function a(t){return{type:e.ERROR,data:"parser error: "+t}}i.prototype.encode=function(t,n){n([function(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var i=function(e){try{return JSON.stringify(e)}catch(t){return!1}}(t.data);if(!1===i)return o;n+=i}return n}(t)])},t(s.prototype),s.prototype.add=function(t){var i;if("string"!=typeof t)throw new Error("Unknown type: "+t);i=function(t){var i=0,o={type:Number(t.charAt(0))};if(null==e.types[o.type])return a("unknown packet type "+o.type);if(e.BINARY_EVENT===o.type||e.BINARY_ACK===o.type){for(var s="";"-"!==t.charAt(++i)&&(s+=t.charAt(i),i!=t.length););if(s!=Number(s)||"-"!==t.charAt(i))throw new Error("Illegal attachments");o.attachments=Number(s)}if("/"===t.charAt(i+1))for(o.nsp="";++i&&","!==(c=t.charAt(i))&&(o.nsp+=c,i!==t.length););else o.nsp="/";var r=t.charAt(i+1);if(""!==r&&Number(r)==r){for(o.id="";++i;){var c;if(null==(c=t.charAt(i))||Number(c)!=c){--i;break}if(o.id+=t.charAt(i),i===t.length)break}o.id=Number(o.id)}if(t.charAt(++i)){var u=function(e){try{return JSON.parse(e)}catch(t){return!1}}(t.substr(i));if(!1===u||o.type!==e.ERROR&&!n(u))return a("invalid payload");o.data=u}return o}(t),this.emit("decoded",i)},s.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}(Ol);var Ll={exports:{}},Pl={},Nl={},wl=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var i in e)n.call(e,i)&&t.push(i);return t},Ul=Al,Gl=Object.prototype.toString,xl="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Gl.call(Blob),Fl="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Gl.call(File),Bl=function e(t){if(!t||"object"!=typeof t)return!1;if(Ul(t)){for(var n=0,i=t.length;n<i;n++)if(e(t[n]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(t)||"function"==typeof ArrayBuffer&&t instanceof ArrayBuffer||xl&&t instanceof Blob||Fl&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return e(t.toJSON(),!0);for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&e(t[o]))return!0;return!1},ql=function(e,t,n){var i=!1;return n=n||Vl,o.count=e,0===e?t():o;function o(e,s){if(o.count<=0)throw new Error("after called too many times");--o.count,e?(i=!0,t(e),t=n):0!==o.count||i||t(null,s)}};function Vl(){}var jl,Hl,Kl,zl=String.fromCharCode;function Wl(e){for(var t,n,i=[],o=0,s=e.length;o<s;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<s?56320==(64512&(n=e.charCodeAt(o++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),o--):i.push(t);return i}function Yl(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function $l(e,t){return zl(e>>t&63|128)}function Jl(e,t){if(!(4294967168&e))return zl(e);var n="";return 4294965248&e?4294901760&e?!(4292870144&e)&&(n=zl(e>>18&7|240),n+=$l(e,12),n+=$l(e,6)):(Yl(e,t)||(e=65533),n=zl(e>>12&15|224),n+=$l(e,6)):n=zl(e>>6&31|192),n+zl(63&e|128)}function Xl(){if(Kl>=Hl)throw Error("Invalid byte index");var e=255&jl[Kl];if(Kl++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function Ql(e){var t,n;if(Kl>Hl)throw Error("Invalid byte index");if(Kl==Hl)return!1;if(t=255&jl[Kl],Kl++,!(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|Xl())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|Xl()<<6|Xl())>=2048)return Yl(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|Xl()<<12|Xl()<<6|Xl())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var Zl={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,i=Wl(e),o=i.length,s=-1,a="";++s<o;)a+=Jl(i[s],n);return a},decode:function(e,t){var n=!1!==(t=t||{}).strict;jl=Wl(e),Hl=jl.length,Kl=0;for(var i,o=[];!1!==(i=Ql(n));)o.push(i);return function(e){for(var t,n=e.length,i=-1,o="";++i<n;)(t=e[i])>65535&&(o+=zl((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=zl(t);return o}(o)}},ed=void 0!==ed?ed:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,td=function(){try{return 2===new Blob(["hi"]).size}catch(Yr){return!1}}(),nd=td&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(Yr){return!1}}(),id=ed&&ed.prototype.append&&ed.prototype.getBlob;function od(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function sd(e,t){t=t||{};var n=new ed;return od(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function ad(e,t){return new Blob(od(e),t||{})}"undefined"!=typeof Blob&&(sd.prototype=Blob.prototype,ad.prototype=Blob.prototype);var rd=td?nd?Blob:ad:id?sd:void 0;!function(e){var t=wl,n=Bl,i=ql,o=Zl;e.protocol=3;var s=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},a=t(s),r={type:"error",data:"parser error"},c=rd;e.encodePacket=function(e,t,n,i){"function"==typeof t&&(i=t,t=!1),"function"==typeof n&&(i=n,n=null),void 0===e.data||e.data.buffer||e.data;var a=s[e.type];return void 0!==e.data&&(a+=n?o.encode(String(e.data),{strict:!1}):String(e.data)),i(""+a)},e.decodePacket=function(e,t,n){if(void 0===e)return r;if("string"==typeof e){if(n&&!1===(e=function(e){try{e=o.decode(e,{strict:!1})}catch(t){return!1}return e}(e)))return r;var i=e.charAt(0);return Number(i)==i&&a[i]?e.length>1?{type:a[i],data:e.substring(1)}:{type:a[i]}:r}i=new Uint8Array(e)[0];var s=sliceBuffer(e,1);return c&&"blob"===t&&(s=new c([s])),{type:a[i],data:s}},e.encodePayload=function(t,o,s){"function"==typeof o&&(s=o,o=null);var a=n(t);if(!t.length)return s("0:");!function(t){for(var n=new Array(t.length),r=i(t.length,(function(e,t){return s(t.join(""))})),c=function(t,i,s){!function(t,n){e.encodePacket(t,!!a&&o,!0,(function(e){n(null,function(e){return e.length+":"+e}(e))}))}(i,(function(e,i){n[t]=i,s(e,n)}))},u=0;u<t.length;u++)c(u,t[u],r)}(t)},e.decodePayload=function(t,n,i){var o;if("function"==typeof n&&(i=n,n=null),""===t)return i(r,0,1);for(var s,a,c="",u=0,l=t.length;u<l;u++){var d=t.charAt(u);if(":"===d){if(""===c||c!=(s=Number(c)))return i(r,0,1);if(c!=(a=t.substr(u+1,s)).length)return i(r,0,1);if(a.length){if(o=e.decodePacket(a,n,!0),r.type===o.type&&r.data===o.data)return i(r,0,1);if(!1===i(o,u+s,l))return}u+=s,c=""}else c+=d}return""!==c?i(r,0,1):void 0}}(Nl);var cd=Nl,ud=ld;function ld(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}(0,vc.exports)(ld.prototype),ld.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},ld.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},ld.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},ld.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},ld.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},ld.prototype.onData=function(e){var t=cd.decodePacket(e,this.socket.binaryType);this.onPacket(t)},ld.prototype.onPacket=function(e){this.emit("packet",e)},ld.prototype.onClose=function(){this.readyState="closed",this.emit("close")};var dd,pd={encode:function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},decode:function(e){for(var t={},n=e.split("&"),i=0,o=n.length;i<o;i++){var s=n[i].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}},hd=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},gd="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),fd={},md=0,_d=0;function vd(e){var t="";do{t=gd[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function yd(){var e=vd(+new Date);return e!==dd?(md=0,dd=e):e+"."+vd(md++)}for(;_d<64;_d++)fd[gd[_d]]=_d;yd.encode=vd,yd.decode=function(e){var t=0;for(_d=0;_d<e.length;_d++)t=64*t+fd[e.charAt(_d)];return t};var Id=yd,Md={exports:{}};try{Md.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Yr){Md.exports=!1}var Cd=Md.exports,Sd=ud,Ed=pd,Td=Nl,kd=hd,Dd=Id,Rd=vl.exports("engine.io-client:polling"),Od=Ad,bd=null!=new function(e){var t=e.xdomain,n=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Cd))return new XMLHttpRequest}catch(o){}try{if("undefined"!=typeof XDomainRequest&&!n&&i)return new XDomainRequest}catch(o){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(o){}}({xdomain:!1}).responseType;function Ad(e){var t=e&&e.forceBase64;bd&&!t||(this.supportsBinary=!1),Sd.call(this,e)}kd(Ad,Sd),Ad.prototype.name="polling",Ad.prototype.doOpen=function(){this.poll()},Ad.prototype.pause=function(e){var t=this;function n(){Rd("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var i=0;this.polling&&(Rd("we are currently polling - waiting to pause"),i++,this.once("pollComplete",(function(){Rd("pre-pause polling complete"),--i||n()}))),this.writable||(Rd("we are currently writing - waiting to pause"),i++,this.once("drain",(function(){Rd("pre-pause writing complete"),--i||n()})))}else n()},Ad.prototype.poll=function(){Rd("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},Ad.prototype.onData=function(e){var t=this;Rd("polling got data %s",e),Td.decodePayload(e,this.socket.binaryType,(function(e,n,i){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():Rd('ignoring poll - transport state "%s"',this.readyState))},Ad.prototype.doClose=function(){var e=this;function t(){Rd("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(Rd("transport open - closing"),t()):(Rd("transport not open - deferring close"),this.once("open",t))},Ad.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};Td.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,n)}))},Ad.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=Dd()),this.supportsBinary||e.sid||(e.b64=1),e=Ed.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e};var Ld,Pd=Od,Nd=xd,wd=/\n/g,Ud=/\\n/g;function Gd(){}function xd(e){if(Pd.call(this,e),this.query=this.query||{},!Ld){var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==mc?mc:{};Ld=t.___eio=t.___eio||[]}this.index=Ld.length;var n=this;Ld.push((function(e){n.onData(e)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){n.script&&(n.script.onerror=Gd)}),!1)}hd(xd,Pd),xd.prototype.supportsBinary=!1,xd.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),Pd.prototype.doClose.call(this)},xd.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},xd.prototype.doWrite=function(e,t){var n=this;if(!this.form){var i,o=document.createElement("form"),s=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=a,o.method="POST",o.setAttribute("accept-charset","utf-8"),s.name="d",o.appendChild(s),document.body.appendChild(o),this.form=o,this.area=s}function r(){c(),t()}function c(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(t){n.onError("jsonp polling iframe removal error",t)}try{var e='<iframe src="javascript:0" name="'+n.iframeId+'">';i=document.createElement(e)}catch(t){(i=document.createElement("iframe")).name=n.iframeId,i.src="javascript:0"}i.id=n.iframeId,n.form.appendChild(i),n.iframe=i}this.form.action=this.uri(),c(),e=e.replace(Ud,"\\\n"),this.area.value=e.replace(wd,"\\n");try{this.form.submit()}catch(u){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&r()}:this.iframe.onload=r};var Fd,Bd,qd=ud,Vd=Nl,Hd=pd,Kd=hd,zd=Id,Wd=vl.exports("engine.io-client:websocket");(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&("undefined"!=typeof WebSocket?Fd=WebSocket:"undefined"!=typeof self&&(Fd=self.WebSocket||self.MozWebSocket));var Yd=Fd||Bd;(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&"undefined"==typeof GameGlobal||(Yd=function(e){var t=this;if(t.onopen=function(){},t.onclose=function(){},t.onmessage=function(e){},t.onerror=function(e){},"object"==typeof tt&&tt.getSystemInfo){let n=tt.connectSocket({url:e});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(){t.onclose()}))}else if("undefined"!=typeof my)my.connectSocket({url:e}),t.send=function(e){my.sendSocketMessage({data:e})},t.close=function(e){my.closeSocket()},my.onSocketOpen((function(e){t.onopen()})),my.onSocketError((function(e){t.onerror(e)})),my.onSocketMessage((function(e){t.onmessage(e)})),my.onSocketClose((e=>{t.onclose(e)}));else if("undefined"!=typeof swan)swan.connectSocket({url:e}),t.send=function(e){swan.sendSocketMessage({data:e})},t.close=function(e){swan.closeSocket()},swan.onSocketOpen((function(e){t.onopen()})),swan.onSocketError((function(e){t.onerror(e)})),swan.onSocketMessage((function(e){t.onmessage(e)})),swan.onSocketClose((e=>{t.onclose(e)}));else if(void 0!==Nn){var n=Nn.connectSocket({url:e,complete:()=>{}});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(e){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(e){t.onclose()}))}else{var i=Pn.connectSocket({url:e});t.send=function(e){i.send({data:e})},t.close=function(e){i.close({code:1e3})},i.onOpen((function(){t.onopen()})),i.onError((function(e){t.onerror(e)})),i.onMessage((function(e){t.onmessage(e)})),i.onClose((function(e){t.onclose(e)}))}});var $d=Jd;function Jd(e){e&&e.forceBase64&&(this.supportsBinary=!1),(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Fd&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Yd=Bd)),qd.call(this,e)}Kd(Jd,qd),Jd.prototype.name="websocket",Jd.prototype.supportsBinary=!1,Jd.prototype.doOpen=function(){if(this.check()){var e,t,n=this.uri();if((void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(e=this.protocols),(t=void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,"object"==typeof navigator&&"ReactNative"===navigator.product&&(t={}),this.extraHeaders&&(t.headers=this.extraHeaders),this.localAddress&&(t.localAddress=this.localAddress),"undefined"!=typeof cc&&"Windows"===cc.sys.os)cc.resources.load("cacert",((e,t)=>{const i=t.nativeUrl;this.ws=new Yd(n,[],i),this.ws.binaryType="arraybuffer",this.addEventListeners()}));else{try{void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new Yd(n,e):new Yd(n):new Yd(n,e,t):this.ws=new Yd(n)}catch(i){return this.emit("error",i)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}}},Jd.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},Jd.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,i=0,o=n;i<o;i++)!function(e){Vd.encodePacket(e,t.supportsBinary,(function(i){if(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket){if(!t.usingBrowserWebSocket){var o={};e.options&&(o.compress=e.options.compress),t.perMessageDeflate&&("string"==typeof i?Buffer.byteLength(i):i.length)<t.perMessageDeflate.threshold&&(o.compress=!1)}try{t.usingBrowserWebSocket?t.ws.send(i):t.ws.send(i,o)}catch(s){Wd("websocket closed before onclose event")}}else try{t.ws.send(i)}catch(s){Wd("websocket closed before onclose event")}--n||(t.emit("flush"),setTimeout((function(){t.writable=!0,t.emit("drain")}),0))}))}(e[i])},Jd.prototype.onClose=function(){qd.prototype.onClose.call(this)},Jd.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},Jd.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=zd()),this.supportsBinary||(e.b64=1),(e=Hd.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},Jd.prototype.check=function(){return!(!Yd||"__initialize"in Yd&&this.name===Jd.prototype.name)};var Xd=Nd,Qd=$d;Pl.polling=function(e){var t=!1,n=!1;if(e.jsonp,"undefined"!=typeof location){var i="https:"===location.protocol,o=location.port;o||(o=i?443:80),t=e.hostname!==location.hostname||o!==e.port,n=e.secure!==i}return e.xdomain=t,e.xscheme=n,new Xd(e)},Pl.websocket=Qd;var Zd=[].indexOf,ep=function(e,t){if(Zd)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},tp=Pl,np=vc.exports,ip=vl.exports("engine.io-client:socket"),op=ep,sp=Nl,ap=_l,rp=pd,cp=up;function up(e,t){if(!(this instanceof up))return new up(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=ap(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ap(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=rp.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}up.priorWebsocketSuccess=!1,np(up.prototype),up.protocol=sp.protocol,up.Socket=up,up.Transport=ud,up.transports=Pl,up.parser=Nl,up.prototype.createTransport=function(e){ip('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=sp.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new tp[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},up.prototype.open=function(){var e;if(this.rememberUpgrade&&up.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(n){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},up.prototype.setTransport=function(e){ip("setting transport %s",e.name);var t=this;this.transport&&(ip("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},up.prototype.probe=function(e){ip('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,i=this;function o(){if(i.onlyBinaryUpgrades){var o=!this.supportsBinary&&i.transport.supportsBinary;n=n||o}n||(ip('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(ip('probe transport "%s" pong',e),i.upgrading=!0,i.emit("upgrading",t),!t)return;up.priorWebsocketSuccess="websocket"===t.name,ip('pausing current transport "%s"',i.transport.name),i.transport.pause((function(){n||"closed"!==i.readyState&&(ip("changing transport and sending upgrade packet"),l(),i.setTransport(t),t.send([{type:"upgrade"}]),i.emit("upgrade",t),t=null,i.upgrading=!1,i.flush())}))}else{ip('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,i.emit("upgradeError",s)}})))}function s(){n||(n=!0,l(),t.close(),t=null)}function a(n){var o=new Error("probe error: "+n);o.transport=t.name,s(),ip('probe transport "%s" failed because of error: %s',e,n),i.emit("upgradeError",o)}function r(){a("transport closed")}function c(){a("socket closed")}function u(e){t&&e.name!==t.name&&(ip('"%s" works - aborting "%s"',e.name,t.name),s())}function l(){t.removeListener("open",o),t.removeListener("error",a),t.removeListener("close",r),i.removeListener("close",c),i.removeListener("upgrading",u)}up.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",a),t.once("close",r),this.once("close",c),this.once("upgrading",u),t.open()},up.prototype.onOpen=function(){if(ip("socket open"),this.readyState="open",up.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){ip("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},up.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(ip('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else ip('packet received with socket readyState "%s"',this.readyState)},up.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},up.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},up.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){ip("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},up.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},up.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},up.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(ip("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},up.prototype.write=up.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},up.prototype.sendPacket=function(e,t,n,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof n&&(i=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:e,data:t,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}},up.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?i():t()})):this.upgrading?i():t()}function t(){e.onClose("forced close"),ip("socket closing - telling transport to close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function i(){e.once("upgrade",n),e.once("upgradeError",n)}return this},up.prototype.onError=function(e){ip("socket error %j",e),up.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},up.prototype.onClose=function(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(ip('socket close with reason: "%s"',e),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)},up.prototype.filterUpgrades=function(e){for(var t=[],n=0,i=e.length;n<i;n++)~op(this.transports,e[n])&&t.push(e[n]);return t},Ll.exports=cp,Ll.exports.parser=Nl;var lp={exports:{}},dp=function(e,t){for(var n=[],i=(t=t||0)||0;i<e.length;i++)n[i-t]=e[i];return n},pp=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}},hp=[].slice,gp=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var n=hp.call(arguments,2);return function(){return t.apply(e,n.concat(hp.call(arguments)))}};!function(e){var t=Ol,n=vc.exports,i=dp,o=pp,s=gp,a=(vl.exports("socket.io-client:socket"),pd),r=Bl;e.exports=l;var c={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},u=n.prototype.emit;function l(e,t,n){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}n(l.prototype),l.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[o(e,"open",s(this,"onopen")),o(e,"packet",s(this,"onpacket")),o(e,"close",s(this,"onclose"))]}},l.prototype.open=l.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},l.prototype.send=function(){var e=i(arguments);return e.unshift("message"),this.emit.apply(this,e),this},l.prototype.emit=function(e){if(c.hasOwnProperty(e))return u.apply(this,arguments),this;var n=i(arguments),o={type:(void 0!==this.flags.binary?this.flags.binary:r(n))?t.BINARY_EVENT:t.EVENT,data:n,options:{}};return o.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof n[n.length-1]&&(this.ids,this.acks[this.ids]=n.pop(),o.id=this.ids++),this.connected?this.packet(o):this.sendBuffer.push(o),this.flags={},this},l.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},l.prototype.onopen=function(){if("/"!==this.nsp)if(this.query){var e="object"==typeof this.query?a.encode(this.query):this.query;this.packet({type:t.CONNECT,query:e})}else this.packet({type:t.CONNECT})},l.prototype.onclose=function(e){this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},l.prototype.onpacket=function(e){var n=e.nsp===this.nsp,i=e.type===t.ERROR&&"/"===e.nsp;if(n||i)switch(e.type){case t.CONNECT:this.onconnect();break;case t.EVENT:case t.BINARY_EVENT:this.onevent(e);break;case t.ACK:case t.BINARY_ACK:this.onack(e);break;case t.DISCONNECT:this.ondisconnect();break;case t.ERROR:this.emit("error",e.data)}},l.prototype.onevent=function(e){var t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?u.apply(this,t):this.receiveBuffer.push(t)},l.prototype.ack=function(e){var n=this,o=!1;return function(){if(!o){o=!0;var s=i(arguments);n.packet({type:r(s)?t.BINARY_ACK:t.ACK,id:e,data:s})}}},l.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(e.id,e.data,t.apply(this,e.data),delete this.acks[e.id]):e.id},l.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},l.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)u.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},l.prototype.ondisconnect=function(){this.nsp,this.destroy(),this.onclose("io server disconnect")},l.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},l.prototype.close=l.prototype.disconnect=function(){return this.connected&&(this.nsp,this.packet({type:t.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},l.prototype.compress=function(e){return this.flags.compress=e,this},l.prototype.binary=function(e){return this.flags.binary=e,this}}(lp);var fp=mp;function mp(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}mp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},mp.prototype.reset=function(){this.attempts=0},mp.prototype.setMin=function(e){this.ms=e},mp.prototype.setMax=function(e){this.max=e},mp.prototype.setJitter=function(e){this.jitter=e};class _p{static init(e,t,n){this.host=e,(void 0!==t&&!1===t||!0===n)&&(this.https=!1)}static isMP(){return[ic.MP_WX,ic.MP_ALI,ic.MP_BYTE,ic.MP_WGAME,ic.MP_BAIDU].includes(oc.currentPlatform())}static uri(){let e="http";return this.https&&(e+="s"),e+"://"+this.index()+this.host}static index(){return 0==this.i?this.i=Math.floor(Math.random()*this.max)+1:this.i=this.i%this.max+1,this.i}}_p.i=0,_p.max=5,_p.https=!0;var vp=_c(Object.freeze({__proto__:null,URIResolver:_p})),yp=_c(hc),Ip=Ll.exports,Mp=lp.exports,Cp=vc.exports,Sp=Ol,Ep=pp,Tp=gp,kp=(vl.exports("socket.io-client:manager"),ep),Dp=fp;const{URIResolver:Rp}=vp;var Op=yp.runStatus,bp=Object.prototype.hasOwnProperty,Ap=Lp;function Lp(e,t){if(!(this instanceof Lp))return new Lp(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Dp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||Sp;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}Lp.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)bp.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Lp.prototype.updateSocketIds=function(){for(var e in this.nsps)bp.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Lp.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Cp(Lp.prototype),Lp.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Lp.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Lp.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Lp.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Lp.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Lp.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Lp.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Lp.prototype.open=Lp.prototype.connect=function(e,t){if(this.readyState,~this.readyState.indexOf("open"))return this;this.uri,this.engine=Ip(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=Ep(n,"open",(function(){i.onopen(),e&&e()})),s=Ep(n,"error",(async function(t){if(i.uri=Rp.uri(),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()}));if(!1!==this._timeout){var a=this._timeout,r=setTimeout((function(){o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",a)}),a);this.subs.push({destroy:function(){clearTimeout(r)}})}return this.subs.push(o),this.subs.push(s),this},Lp.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Ep(e,"data",Tp(this,"ondata"))),this.subs.push(Ep(e,"ping",Tp(this,"onping"))),this.subs.push(Ep(e,"pong",Tp(this,"onpong"))),this.subs.push(Ep(e,"error",Tp(this,"onerror"))),this.subs.push(Ep(e,"close",Tp(this,"onclose"))),this.subs.push(Ep(this.decoder,"decoded",Tp(this,"ondecoded")))},Lp.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Lp.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Lp.prototype.ondata=function(e){this.decoder.add(e)},Lp.prototype.ondecoded=function(e){this.emit("packet",e)},Lp.prototype.onerror=function(e){this.emitAll("error",e)},Lp.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new Mp(this,e,t),this.nsps[e]=n;var i=this;n.on("connecting",o),n.on("connect",(function(){n.id=i.generateId(e)})),this.autoConnect&&o()}function o(){~kp(i.connecting,n)||i.connecting.push(n)}return n},Lp.prototype.destroy=function(e){var t=kp(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Lp.prototype.packet=function(e){var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var i=0;i<n.length;i++)t.engine.write(n[i],e.options);t.encoding=!1,t.processPacketQueue()})))},Lp.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Lp.prototype.cleanup=function(){for(var e=this.subs.length,t=0;t<e;t++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},Lp.prototype.close=Lp.prototype.disconnect=function(){this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},Lp.prototype.onclose=function(e){this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},Lp.prototype.reconnect=function(){if(Op.isBackend(),this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();this.reconnecting=!0;var n=setTimeout((function(){if(Op.isBackend())return e.reconnecting=!1,e.reconnect(),void e.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...");e.skipReconnect||(e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):e.onreconnect()})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},Lp.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var n=Rl,i=Ol,o=Ap;vl.exports("socket.io-client"),e.exports=t=a;var s=t.managers={};function a(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,a=n(e),r=a.source,c=a.id,u=a.path,l=s[c]&&u in s[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||l?i=o(r,t):(s[c]||(s[c]=o(r,t)),i=s[c]),a.query&&!t.query&&(t.query=a.query),i.socket(a.path,t)}t.protocol=i.protocol,t.connect=a,t.Manager=Ap,t.Socket=lp.exports}(gl,gl.exports);const Pp=gl.exports;class Np{constructor(){this.io=Pp,this.status=Wr.DISCONNECTED,this.permissions=[Jc.NONE],this.connectedObservers=[],this.disconnectedObservers=[]}connect(){this.status=Wr.CONNECTING}socketio(){return this.io}on(e,t){this.io.on(e,t)}disconnect(){this.io.disconnect()}getStatus(){return this.status}addConnectedObserver(e){nc.isFunction(e)&&this.connectedObservers.push(e)}addDisconnectedObserver(e){nc.isFunction(e)&&this.disconnectedObservers.push(e)}notify(e,t){for(let n=0;n<e.length;n++)e[n](t)}}class wp extends Np{constructor(e){super(),this.reconnectingObservers=[],this.addReconnectingObserver(e.onReconnecting),this.addDisconnectedObserver(e.onDisconnected)}connect(e){super.connect(),this.io=this.io.connect(e.uri,e.opts),this.initListener()}initListener(){this.io.on("connect",(()=>{this.status=Wr.CONNECTED,this.notify(this.connectedObservers)})),this.io.on("reconnecting",(e=>{this.status=Wr.CONNECTING,this.notify(this.reconnectingObservers,e)})),this.io.on("disconnect",(()=>{this.status=Wr.DISCONNECTED,this.notify(this.disconnectedObservers)})),this.io.on("connect_error",(function(e){}))}addReconnectingObserver(e){this.reconnectingObservers.push(e)}}class Up{static get(e){const t=encodeURIComponent(e)+"=",n=document.cookie.split("; ");for(const i of n)if(i.startsWith(t))return decodeURIComponent(i.substring(t.length));return null}static set(e,t,n,i,o="/",s=!1){let a=encodeURIComponent(e)+"="+encodeURIComponent(t);n instanceof Date&&(a+="; expires="+n.toGMTString()),o&&(a+="; path="+o),i&&(a+="; domain="+i),s&&(a+="; secure"),document.cookie=a}static remove(e,t,n="/",i=!1){Up.set(e,"",new Date(0),t,n,i)}}class Gp{asyncGet(e){let t=this.get(e);return Promise.resolve(t)}asyncPut(e,t){return this.put(e,t),Promise.resolve()}get(e){let t=this.doGet(e);return t=JSON.parse(t),t}put(e,t){this.doPut(e,JSON.stringify(t))}}class xp extends Gp{constructor(){super(),this.domain=null,this.domain="undefined"!=typeof location&&/^(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/.test(location.host)?location.host.split(".").slice(-2).join("."):null}doGet(e){return Up.get(e)||null}doPut(e,t){const n=new Date(2030,12,31,0,0,0,0),i=this.domain;Up.set(e,t,n,i)}remove(e){const t=this.domain;Up.remove(e,t)}support(){return"undefined"!=typeof navigator&&!0===navigator.cookieEnabled}}class Fp extends Gp{doGet(e){return localStorage.getItem(e)||null}doPut(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}support(){return!("undefined"!=typeof GameGlobal||"undefined"==typeof localStorage||!localStorage.setItem)}}class Bp extends Gp{doGet(e){return Nn.getStorageSync(e)||null}doPut(e,t){Nn.setStorageSync(e,t)}remove(e){Nn.removeStorageSync(e)}support(){return!("object"!=typeof Nn||!Nn.getStorageSync)}}class qp extends Gp{doGet(e){return cc.sys.localStorage.getItem(e)||null}doPut(e,t){cc.sys.localStorage.setItem(e,t)}remove(e){cc.sys.localStorage.removeItem(e)}support(){return"undefined"!=typeof cc&&void 0!==cc.sys.localStorage}}class Vp extends Gp{doGet(e){return Pn.getStorageSync(e)||null}doPut(e,t){Pn.setStorageSync(e,t)}remove(e){Pn.removeStorageSync(e)}support(){return!("object"!=typeof Pn||!Pn.getStorageSync||"undefined"!=typeof tt)}}class jp extends Gp{asyncGet(e){return fc(this,void 0,void 0,(function*(){const t=yield Jr.asyncStorage.getItem(e);return JSON.parse(t)}))}asyncPut(e,t){return Jr.asyncStorage.setItem(e,JSON.stringify(t))}doPut(e,t){throw new Error("Method not implemented.")}remove(e){Jr.asyncStorage.removeItem(e)}support(){return $r.currentFramework()===zr.REACT_NATIVE}doGet(e){throw new Error("Method not implemented.")}}class Hp extends Gp{doGet(e){const t=my.getStorageSync({key:e}).data||null;return"string"==typeof JSON.parse(t)?JSON.parse(t):t}doPut(e,t){my.setStorageSync({key:e,data:JSON.stringify(t)})}remove(e){my.removeStorageSync({key:e})}support(){return!("undefined"==typeof my||!my.getStorageSync)}}class Kp extends Gp{doGet(e){return tt.getStorageSync(e)||null}doPut(e,t){tt.setStorageSync(e,t)}remove(e){tt.removeStorageSync(e)}support(){return!("object"!=typeof tt||!tt.getStorageSync)}}class zp extends Gp{doGet(e){return swan.getStorageSync(e)||null}doPut(e,t){swan.setStorageSync(e,t)}remove(e){swan.removeStorageSync(e)}support(){return!("undefined"==typeof swan||!swan.getStorageSync)}}class Wp{constructor(){this.supportedStorage=null;const e=Wp.storages;e.push(new Bp),e.push(new qp),e.push(new Fp),e.push(new Vp),e.push(new jp),e.push(new Hp),e.push(new zp),e.push(new Kp),e.push(new xp),this.dispatch(),this.supportedStorage}static localStorage(){return this.instance.supportedStorage}dispatch(){for(let e of Wp.storages)if(e.support()){this.supportedStorage=e;break}}}Wp.storages=new Array,Wp.instance=new Wp;class Yp{static get(){return fc(this,void 0,void 0,(function*(){let e,t=Wp.localStorage();return null!==t&&(e=yield t.asyncGet(Yp.SM_KEY)),e}))}static put(e){return fc(this,void 0,void 0,(function*(){var t=Wp.localStorage();let n=e.sm;null!==t&&n&&t.asyncPut(Yp.SM_KEY,n)}))}}Yp.SM_KEY="GE-SM";class $p{static e(e,t){let n="";for(let s=0;s<e.length;s++)n+=(i=e.charCodeAt(s),o=void 0,(o=i)>=32&&o<=126?String.fromCharCode(function(e){let n=e+t;return n>126?n-126+32:n}(i)):String.fromCharCode(i));var i,o;return n}}class Jp{static initRNUniqueId(){if($r.currentFramework()===zr.REACT_NATIVE){let e=Jr.platform,t=e.constants,n={os:e.OS};return"android"===n.os?n.f=t.Fingerprint:n.v=e.Version,JSON.stringify(n)}return null}static initPlusDeviceId(){return new Promise(((e,t)=>{"undefined"!=typeof plus?plus.device.getInfo({success:t=>{e(t.uuid)},fail:e=>{t(e)}}):e(null)}))}static getVideoCard(){var e;if(oc.currentPlatform()===ic.BROWSER&&"undefined"!=typeof document){const t=document.createElement("canvas"),n=null!==(e=t.getContext("webgl"))&&void 0!==e?e:t.getContext("experimental-webgl");if(n&&"getExtension"in n){let e=0,t=0;if(navigator.userAgent.indexOf("Firefox")>-1)t=n.VENDOR,e=n.RENDERER;else{let i=n.getExtension("WEBGL_debug_renderer_info");if(!i)return null;t=i.UNMASKED_VENDOR_WEBGL,e=i.UNMASKED_RENDERER_WEBGL}const i={vendor:(n.getParameter(t)||"").toString(),renderer:(n.getParameter(e)||"").toString()};return JSON.stringify(i)}}return null}static z(){return fc(this,void 0,void 0,(function*(){const e={p:oc.currentPlatform(),f:$r.currentFramework(),vc:this.getVideoCard(),rfp:this.initRNUniqueId()};return $p.e(JSON.stringify(e),5)}))}}class Xp{constructor(e){this.rocketsBuffer=new Set,this.socket=e,this.socket.addConnectedObserver(this.onSocketConnected.bind(this))}emit(e){this.socket.status!==Wr.DISCONNECTED?(e.start(),this.doEmit(e)):e.fail({resultCode:"409",content:"Please connect first"})}doEmit(e){if(!e.complete)if(this.socket.status!==Wr.CONNECT_FAILED)if(this.isConnected())if(this.hasPermission(e)){let t=setTimeout((()=>{this.doEmit(e)}),e.singleTimeout);e.unique&&(e.params.retried=e.retried),this.socket.socketio().emit(e.name,e.params,(n=>{clearTimeout(t),200===n.resultCode||200==n.code?e.success(n):e.fail(n)})),e.retried++}else e.fail({resultCode:401,content:"No permission"});else this.isConnecting()&&this.rocketsBuffer.add(e);else e.fail({resultCode:408,content:"Failed to connect GoEasy."})}hasPermission(e){return!!this.socket.permissions.find((t=>t===e.permission))}isConnected(){return[Wr.CONNECTED,Wr.RECONNECTED,Wr.EXPIRED_RECONNECTED,Wr.DISCONNECTING].includes(this.socket.status)}isConnecting(){return[Wr.CONNECTING,Wr.RECONNECTING].includes(this.socket.status)}onSocketConnected(){this.emitBuffer()}emitBuffer(){Array.from(this.rocketsBuffer).forEach((e=>{this.rocketsBuffer.delete(e),this.doEmit(e)}))}}class Qp extends jc{static init(){Qp.i=new Qp}static fire(e,t){this.i.fire(e,t)}static on(e,t){this.i.on(e,t)}static off(e,t){this.i.off(e,t)}}class Zp extends Np{constructor(e,t){super(),this.ioSocket=null,this.sid=null,this.anonymous=!1,this.userId=null,this.artifactVersion=Xr,this.vname=null,this.uri=null,this.ioOpts=null,this.reconnectingTimes=0,this.messageObservers=new Map,this.connectFailedObservers=[],this.connectingObservers=[],this.expiredReconnectedObservers=[],this.options=e,this.ioSocket=new wp({onDisconnected:this.onIoDisconnected.bind(this),onReconnecting:this.onIoReconnecting.bind(this)}),this.ioSocketEmitter=new Xp(this.ioSocket),this.ioSocket.addConnectedObserver(this.onIoReconnected.bind(this)),this.initOptions(t),this.connect()}initUserId(){let e=this.connectOptions.id;nc.isEmpty(e)?this.anonymous=!0:this.userId=e.toString()}socketio(){return this.ioSocket.socketio()}extendOptions(){let e=this.connectOptions;if(nc.isNull(e.data)||nc.isDef(e.data)&&!nc.isObject(e.data))throw{code:400,content:"TypeError: data requires an object."};if((nc.isDef(e.data)?String(e.data).length:0)>300&&nc.isObject(e)&&nc.isFunction(e.onFailed))throw{code:400,content:"user.data-length limit 300 byte."};if(nc.isObject(e.wxmpId)){if(nc.isEmpty(e.wxmpId.appid))throw{code:400,content:"wxmpId.appid is required."};if(nc.isEmpty(e.wxmpId.openid))throw{code:400,content:"wxmpId.openid is required. requires string."}}else if(nc.isPrimitive(e.wxmpId))throw{code:400,content:"TypeError: wxmpId requires an object."}}initUriAndOpts(){let e=this.options;_p.init(e.host,e.forceTLS,e.supportOldBrowser),this.uri=_p.uri();let t=["websocket"];!0===e.supportOldBrowser&&t.push("polling"),this.ioOpts={transports:t,timeout:pc.connect,reconnectionDelayMax:pc.reconnectionDelayMax}}onIoReconnected(){this.status===Wr.RECONNECTING&&this.authorize()}sendAck(e,t){this.ioSocket.io.emit(e,t)}initOptions(e){this.connectOptions=e,this.addConnectedObserver(e.onSuccess),this.addConnectFailedObserver(e.onFailed),this.addConnectingObserver(e.onProgress),this.initUserId()}connect(){this.initUriAndOpts(),this.extendOptions(),super.connect(),this.onConnecting(),this.ioSocket.connect({uri:this.uri,opts:this.ioOpts}),this.authorize()}disconnect(){return new Promise(((e,t)=>{this.status=Wr.DISCONNECTING;let n=()=>{this.ioSocket.disconnect(),this.status=Wr.DISCONNECTED,Qp.fire(ru.DISCONNECTED),e()};const i=Bc.modules.get("GN");if(i&&(i.params.regId||this.connectOptions.wxmpId)){let e=e=>{t(e)},i=new Qc({name:dc.manualDisconnect,params:{},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e,success:n});Wc.Socket.e(i)}else n()}))}authorize(){return fc(this,void 0,void 0,(function*(){let e=this.connectOptions,t={appkey:this.options.appkey,userId:this.userId,userData:JSON.stringify(e.data),otp:e.otp,artifactVersion:this.artifactVersion,sid:this.sid,mP:yield Bc.getParams(),a:this.anonymous,z:yield Jp.z(),sm:yield Yp.get(),c:{n:this.vname,v:this.artifactVersion}};JSON.stringify(t);let n=new Qc({name:dc.authorize,params:t,permission:Jc.NONE,singleTimeout:pc.commonInfiniteSingle,totalTimeout:pc.commonInfiniteTotal,success:e=>{this.onAuthorizeSuccess(e)},fail:e=>{this.onAuthorizeFailed(e)}});this.ioSocketEmitter.emit(n)}))}onConnecting(){Qp.fire(ru.CONNECTING,this.reconnectingTimes),this.notify(this.connectingObservers,this.reconnectingTimes)}onIoReconnecting(){this.reconnectingTimes++,this.status==Wr.CONNECTED||this.status==Wr.EXPIRED_RECONNECTED||this.status==Wr.RECONNECTING?this.status=Wr.RECONNECTING:this.status=Wr.CONNECTING,this.onConnecting()}onIoDisconnected(){this.status!==Wr.DISCONNECTING&&(this.status=Wr.RECONNECTING,Qp.fire(ru.LOST),this.notify(this.disconnectedObservers))}onAuthorizeSuccess(e){Yp.put(e),Bc.setDatas(e.mD),this.status===Wr.RECONNECTING?this.sid!==e.sid?(this.status=Wr.EXPIRED_RECONNECTED,this.sid=e.sid,Qp.fire(ru.EXPIRED_RECONNECTED),this.notify(this.expiredReconnectedObservers)):(this.status=Wr.RECONNECTED,Qp.fire(ru.RECONNECTED)):(this.status=Wr.CONNECTED,this.sid=e.sid),e.enablePublish&&(this.permissions.find((e=>e==Jc.WRITE))||this.permissions.push(Jc.WRITE)),e.enableSubscribe&&(this.permissions.find((e=>e==Jc.READ))||this.permissions.push(Jc.READ)),this.reconnectingTimes=0,Qp.fire(ru.CONNECTED),this.notify(this.connectedObservers)}onAuthorizeFailed(e){this.ioSocket.disconnect(),this.status=Wr.CONNECT_FAILED;let t={code:e.resultCode||408,content:e.content||"Host unreachable or timeout"};this.notify(this.connectFailedObservers,t)}addConnectingObserver(e){nc.isFunction(e)&&this.connectingObservers.push(e)}addConnectFailedObserver(e){nc.isFunction(e)&&this.connectFailedObservers.push(e)}addExpiredReconnectedObserver(e){nc.isFunction(e)&&this.expiredReconnectedObservers.push(e)}onMessage(e,t){this.ioSocket.io._callbacks.hasOwnProperty("$"+e)||this.ioSocket.io.on(e,t)}user(){let e=this.connectOptions;return e?{id:e.id,data:e.data}:null}}class eh{constructor(e){this.guidList=[],this.socket=e}offMessage(e,t){Qp.off(ru.NEW_MESSAGE+"_"+e,t)}onMessage(e,t){Qp.on(ru.NEW_MESSAGE+"_"+e,t),this.socket.onMessage(e,(t=>{this.fire(e,t)}))}fire(e,t){let n=this.filter(t);n&&Qp.fire(ru.NEW_MESSAGE+"_"+e,n)}filter(e){if("string"==typeof e&&(e=JSON.parse(e)),e.i){if(this.guidList.findIndex((t=>t===e.i))>-1)return;this.guidList.unshift(e.i),this.guidList.length>300&&this.guidList.pop()}return e}}class th{static init(e){this.i=new th(e)}constructor(e){this.goeasyOptions=e}static connect(e,t){if(this.status()!==Wr.DISCONNECTED&&nc.isObject(e)&&nc.isFunction(e.onFailed))return void e.onFailed({code:408,content:"It is already connected, don't try again until disconnect() is called. "});this.confirmUserIdAndData(e),Qp.init();let n=this.i;Bc.preConnect(e),n.socket=new Zp(n.goeasyOptions,e),n.socket.vname=t,n.emitter=new Xp(n.socket),n.messageListener=new eh(n.socket),Bc.postConnect()}static confirmUserIdAndData(e){if(Bc.modules.get("GIM"))nu.validateId(e.id,"id"),nu.validateObject(e.data,"data");else if("string"==typeof e.id&&e.id.length>60)throw{code:400,content:"id over max length 60"}}static e(e){this.i.emitter.emit(e)}static sendAck(e,t){this.i.socket.sendAck(e,t)}static status(){return this.i&&this.i.socket?this.i.socket.getStatus():Wr.DISCONNECTED}static on(e,t){Qp.on(e,t)}static off(e,t){Qp.off(e,t)}static offMessage(e,t){this.i.messageListener.offMessage(e,t)}static onMessage(e,t){this.i.messageListener.onMessage(e,t)}static disconnect(e){this.status()===Wr.CONNECTED||this.status()===Wr.RECONNECTED?this.i.socket.disconnect().then((()=>{gc.onSuccess(e)})).catch((t=>{gc.onFailed(e,t)})):gc.onFailed(e,{code:408,content:"Host unreachable or timeout"})}static user(){return this.i.socket.user()}}th.EVENT=ru;class nh{static getInstance(){return nh.instance||(nh.instance=new nh),nh.instance}constructor(){this.synchronized=!0,this.onlineChanged=e=>{e.online?this.teamIds.add(e.teamId):this.teamIds.delete(e.teamId)},this.onDisconnected=()=>{this.queryMyTeamPromise=null,this.teamIds=null},this.onConnected=()=>{this.synchronized&&(this.queryMyTeamPromise=this.queryTeams())},th.on(th.EVENT.LOST,this.onDisconnected),th.on(th.EVENT.RECONNECTED,this.onConnected),th.onMessage(au.CS_ONLINE_CHANGED,this.onlineChanged)}queryTeams(){return this.queryMyTeamPromise||(this.queryMyTeamPromise=new Promise(((e,t)=>{let n=new Qc({name:dc.CS_MY_TEAMS,params:{},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{this.teamIds=new Set(t.content),this.synchronized=!0,e(this.teamIds)}});Wc.Socket.e(n)}))),this.queryMyTeamPromise}myTeams(){if(this.synchronized&&this.queryMyTeamPromise)return this.teamIds;throw"please query team first."}isOnline(e,t){return fc(this,void 0,void 0,(function*(){yield this.queryTeams(),gc.onSuccess(t,this.teamIds.has(e))}))}online(e,t){if(!nc.isObject(t.agentData)||!nc.isObject(t.teamData))throw{code:400,content:"agentData and teamData require an object"};let n=new dl(e,t.teamData,t.agentData),i=new Qc({name:dc.CS_ONLINE,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{this.teamIds.add(e),gc.onSuccess(t),Vu.i.fire(Lu.CS_ONLINE_SUCCESS)}});Wc.Socket.e(i)}offline(e,t){let n=new pl(e),i=new Qc({name:dc.CS_OFFLINE,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{this.teamIds.delete(e),gc.onSuccess(t),Vu.i.fire(Lu.CS_OFFLINE_SUCCESS)}});Wc.Socket.e(i)}agents(e,t){let n=new hl(e),i=new Qc({name:dc.CS_AGENTS,params:n,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{e.content.forEach((e=>{e.data=JSON.parse(e.data)})),gc.onSuccess(t,e)}});Wc.Socket.e(i)}}class ih{constructor(e){this.onMessageReceived=e=>{let t=ih.session;if(e.scene()===Qr.CS&&t.liveOptions){let n=e,i=t.liveOptions.customerId;t.teamId===n.teamId&&n.customerId()===i&&(t.tryUpdateStatus(n),t.liveOptions.onNewMessage(n))}},this.teamId=e,Vu.i.on(Lu.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_ACCEPTED,this.onMessageReceived),Vu.i.on(Lu.CS_ENDED,this.onMessageReceived),Vu.i.on(Lu.CS_TRANSFER,this.onMessageReceived),th.on(ru.DISCONNECTED,ih.destroy)}static live(e,t){return fc(this,void 0,void 0,(function*(){let n=t.customerId;nu.validateId(n,"customerId");let i=new ul(e,n);yield nh.getInstance().queryTeams();let o=new Qc({name:dc.CS_LIVE_SESSION,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{ih.destroy(),this.session=new ih(e),this.session.liveOptions=t;let i=n.content.customerStatus;"ACCEPTED"===i.status&&(i.agent.data=JSON.parse(i.agent.data)),this.session.status=i,this.session.liveOptions.onStatusUpdated(this.session.status),gc.onSuccess(t)}});Wc.Socket.e(o)}))}customerId(){return this.liveOptions.customerId}static isMyCustomer(e){let t=ih.session;if(t&&t.teamId===e.teamId&&t.customerId()===e.customerId()){let n=nh.getInstance().myTeams(),i=t.status.agent;return n.has(e.teamId)&&(!i||i.id===Wc.Socket.user().id)}return!0}static isMyMessage(e){let t=Wu.byIMMessage(e);return e.type===Nu.TRANSFER&&e.payload.transferTo.id===Wc.Socket.user().id||this.isMyCustomer(t)}static quit(e){let t=ih.session;if(t){let n=t.liveOptions.customerId;nu.validateId(n,"customerId");let i=new ul(t.teamId,n),o=new Qc({name:dc.CS_QUIT_LIVE,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:t=>{gc.onFailed(e,t)},success:t=>{ih.destroy(),gc.onSuccess(e)}});Wc.Socket.e(o)}}tryUpdateStatus(e){if("FREE"!==this.status.status&&this.status.sessionId>e.sessionId)return;let t;switch(e.type){case Nu.ACCEPT:t=new ll,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=new tc(e.senderId,e.senderData);break;case Nu.END:t=new ll,t.status="FREE";break;case Nu.TRANSFER:t=new ll,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=e.payload.transferTo;break;default:"FREE"===this.status.status&&(t=new ll,t.status="PENDING",t.start=e.timestamp,t.sessionId=e.sessionId)}t&&(this.status=t,this.liveOptions.onStatusUpdated(t))}}ih.destroy=()=>{let e=ih.session;e&&(Vu.i.off(Lu.CS_AGENT_MESSAGE_RECEIVED,e.onMessageReceived),Vu.i.off(Lu.CS_ACCEPTED,e.onMessageReceived),Vu.i.off(Lu.CS_ENDED,e.onMessageReceived),Vu.i.off(Lu.CS_TRANSFER,e.onMessageReceived),th.off(ru.DISCONNECTED,ih.destroy),ih.session=null)};class oh extends cl{constructor(e){super(e),this.unread=0,this.markingAmount=0}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){return nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return fc(this,void 0,void 0,(function*(){let n=new ol(this.target.id.toString(),this.target.scene,e,t,this.target.teamId),i=yield this.remoteHistory.loadServerMessages(this.target,n);return i.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),i.messages}))}deleteMessages(e){return fc(this,void 0,void 0,(function*(){gc.onFailed(e,"Delete CS message is not supported yet")}))}initMaxMessageAndOffsets(e,t){t.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),(nc.isUndef(this.acceptedMaxMessage)||this.acceptedMaxMessage.timestamp<e.timestamp)&&this.increaseUnreadAmount(e),this.saveAcceptedMessage(e)}initPendingMaxMessageAndOffsets(e,t){t.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),this.savePendingMessage(e)}savePendingMessage(e){this.pendingMaxMessage?this.pendingMaxMessage.timestamp<e.timestamp&&(this.pendingMaxMessage=e):this.pendingMaxMessage=e}saveAcceptedMessage(e){this.acceptedMaxMessage?this.acceptedMaxMessage.timestamp<e.timestamp&&(this.acceptedMaxMessage=e):this.acceptedMaxMessage=e}onMessageSending(e){this.saveAcceptedMessage(e),Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,e)}onMessageSendSuccess(e){this.saveAcceptedMessage(e),this.userOffsets.updateOffset(e.senderId,e.timestamp),this.acceptedMaxMessage===e&&Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,e)}onMessageSendFailed(e){this.acceptedMaxMessage===e&&Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,e)}onMessageReceived(e){ih.isMyMessage(e)&&(!e.accepted||e.senderId!==Wc.Socket.user().id&&e.type===Nu.ACCEPT?this.savePendingMessage(e):this.saveAcceptedMessage(e),this.userOffsets.updateOffset(e.senderId,e.timestamp),this.increaseUnreadAmount(e),Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,e))}increaseUnreadAmount(e){(e.sendByCustomer()||e.type===Nu.TRANSFER&&e.senderId!==Wc.Socket.user().id)&&this.userOffsets.myOffset()<e.timestamp&&e.accepted&&(this.unread+=1)}markRead(){return fc(this,void 0,void 0,(function*(){let e=this.maxAcceptedMessageTime();ih.isMyCustomer(this.target)&&this.preMark(e)&&(yield this.remoteHistory.updateServerOffsets(e,this.target),this.postMark(e))}))}preMark(e){let t=this.userOffsets.myOffset();return e>this.userOffsets.markingTime&&e>t&&(this.userOffsets.markingTime=e,this.markingAmount=this.unread,!0)}postMark(e){e===this.userOffsets.markingTime&&(this.unread-=this.markingAmount,this.markingAmount=0,this.userOffsets.updateOffset(Wc.Socket.user().id,e),Vu.i.fire(Lu.UNREAD_AMOUNT_CHANGED,this.target))}syncMarkedMessage(e){}getMaxMessage(e){return e?this.acceptedMaxMessage:this.pendingMaxMessage}unreadAmount(e){return e?this.unread:0}existsMessage(e){return this.acceptedMaxMessage&&this.acceptedMaxMessage.messageId===e.messageId||this.pendingMaxMessage&&this.pendingMaxMessage.messageId===e.messageId}maxAcceptedMessageTime(){return this.acceptedMaxMessage?this.acceptedMaxMessage.timestamp:0}maxTime(e){let t=this.getMaxMessage(e);return t?t.timestamp:0}}class sh extends cl{constructor(e){super(e)}deleteMessages(e){return fc(this,void 0,void 0,(function*(){gc.onFailed(e,"Delete CS message is not supported yet")}))}}class ah{static validateMessageArray(e){if(!nc.isArray(e)||nc.isEmpty(e))throw{code:400,content:"messages requires non empty array"};if(e.length>20)throw{code:400,content:"The maximum number of messages is 20"};let t=Wu.byIMMessage(e[0]);for(let n=0;n<e.length;n++){let i=e[n];if(!(i instanceof Uu))throw{code:400,content:"message["+n+"] is not a correct message"};if(n>0){let e=Wu.byIMMessage(i);if(e.scene!==t.scene||e.id!==t.id)throw{code:400,content:"each message must be from the same friend or group"}}}}}class rh{static init(){return rh.instance=new rh,rh.instance}constructor(){this.map=new Map,this.onMessageSending=e=>{let t=Wu.byIMMessage(e);this.findOrCreateHistory(t).onMessageSending(e)},this.onMessageSendSuccess=e=>{let t=Wu.byIMMessage(e);this.findHistory(t).onMessageSendSuccess(e)},this.onMessageSendFailed=e=>{let t=Wu.byIMMessage(e);this.findHistory(t).onMessageSendFailed(e)},this.onMessageReceived=e=>{let t=Wu.byIMMessage(e),n=this.findOrCreateHistory(t);n.expiredTime>0&&(this.map.delete(t.toString()),n=this.findOrCreateHistory(t)),n.onMessageReceived(e)},this.onRemoteMarkRead=e=>{let t=Wu.byMessageReadRemoteEvent(e),n=this.findHistory(t);n&&n.syncMarkedMessage(e)},this.onRemoteMessageDeleted=e=>{let t=Wu.byIMMessageDeletedEvent(e),n=this.findHistory(t);n&&n.syncDeletedMessage(e.deleterId,e.times)},this.onMessageRecalled=e=>{let t=Wu.byConversationId(e.scene,e.conversationId),n=this.findHistory(t);n&&n.recallMessages(e)},this.onDisconnected=()=>{this.map.forEach(((e,t)=>{e.expire()}))},this.onReconnected=()=>{rl.fire(wu.HISTORY_EXPIRED)},this.destroy=()=>{},this.initialListeners()}initialListeners(){Vu.i.on(Lu.MESSAGE_SENDING,this.onMessageSending),Vu.i.on(Lu.MESSAGE_SEND_SUCCESS,this.onMessageSendSuccess),Vu.i.on(Lu.MESSAGE_SEND_FAILED,this.onMessageSendFailed),Vu.i.on(Lu.MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_ACCEPTED,this.onMessageReceived),Vu.i.on(Lu.CS_ENDED,this.onMessageReceived),Vu.i.on(Lu.CS_TRANSFER,this.onMessageReceived),Vu.i.on(Lu.MESSAGE_RECALLED,this.onMessageRecalled),th.onMessage(au.IM_MSG_READ,this.onRemoteMarkRead),th.onMessage(au.IM_MSG_DELETED,this.onRemoteMessageDeleted),th.on(th.EVENT.LOST,this.onDisconnected),th.on(th.EVENT.RECONNECTED,this.onReconnected)}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){let n=this.queryToTarget(e,t),i=this.findOrCreateHistory(n);i.expiredTime>0&&(this.map.delete(n.toString()),i=this.findOrCreateHistory(n));let o=yield i.loadHistory(e.lastTimestamp,e.limit);gc.onSuccess(e,{code:200,content:o})}))}queryToTarget(e,t){if(nc.isDef(e.userId))return new Wu(Qr.PRIVATE,e.userId);if(nc.isDef(e.groupId))return new Wu(Qr.GROUP,e.groupId);if(nc.isDef(e.type)){if(!Object.values(Qr).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Qr));if(nc.isUndef(e.id))throw new Error("If type is not empty, id is required.");return Qr.CS==e.type&&nc.isUndef(t)&&(t=e.id),new Wu(e.type,e.id,t)}throw new Error("incorrect query options.")}privateMarkAsRead(e){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.userId))throw new Error("userId could not be empty.");let t=Wu.byScene(Qr.PRIVATE,e.userId);yield this.markAsRead(t,e)}))}groupMarkAsRead(e){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.groupId))throw new Error("groupId could not be empty.");let t=Wu.byScene(Qr.GROUP,e.groupId);yield this.markAsRead(t,e)}))}markMessageAsRead(e,t){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.id))throw new Error("id could not be empty.");if(!Object.values(Qr).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Qr));Qr.CS==e.type&&nc.isUndef(t)&&(t=e.id);let n=Wu.byScene(e.type,e.id,t);yield this.markAsRead(n,e)}))}markAsRead(e,t){return fc(this,void 0,void 0,(function*(){let n=this.findHistory(e);n&&(yield n.markRead()),gc.onSuccess(t)}))}deleteMessage(e){return fc(this,void 0,void 0,(function*(){this.validateMessageArray(e.messages),$u.validate(e);let t=e.messages[0],n=Wu.byIMMessage(t),i=this.findHistory(n);if(!i)throw{code:400,content:"No message that could be deleted"};yield i.deleteMessages(e)}))}findOrCreateHistory(e){let t=this.findHistory(e);return t||(t=e.scene===Qr.CS?Wc.Socket.user().id===e.customerId()?new sh(e):new oh(e):new cl(e),this.map.set(e.toString(),t),t)}static get(e){return rh.instance.findOrCreateHistory(e)}findHistory(e){return this.map.get(e.toString())}validateMessageArray(e){ah.validateMessageArray(e)}}class ch{constructor(e){this.top=!1,this.data=null,this.dataLoaded=!1,this.target=e}toDto(){let e=this.target.scene,t=this.target.id,n=new ec;return e===Qr.PRIVATE?n.userId=t:e===Qr.GROUP?n.groupId=t:e===Qr.CS&&(n.id=this.target.teamId),n.type=e,n.lastMessage=this.getMaxMessage(),n.unread=this.getUnreadAmount(),n.top=this.top,n.data=this.data,n}getMaxMessage(){return rh.get(this.target).getMaxMessage()}getUnreadAmount(){return rh.get(this.target).unreadAmount()}maxMessageTime(){return rh.get(this.target).maxTime()}}class uh extends ch{constructor(e){super(e),this.accepted=!1}toDto(){let e=new ec,t=this.target.scene,n=this.target.id,i=this.target.teamId;return e.id=n,e.teamId=i,e.type=t,e.lastMessage=this.getMaxMessage(),e.unread=this.getUnreadAmount(),e.top=this.top,e.data=this.data,e.ended=this.isEnded(),e}isEnded(){let e=this.getMaxMessage(),t=e.type,n=e.payload;return t===Nu.END||t===Nu.TRANSFER&&n.transferTo.id!==Wc.Socket.user().id}getMaxMessage(){return rh.get(this.target).getMaxMessage(this.accepted)}getUnreadAmount(){return rh.get(this.target).unreadAmount(this.accepted)}maxMessageTime(){return rh.get(this.target).maxTime(this.accepted)}}class lh{constructor(e,t,n,i){this.type=e,this.top=t,this.targetId=n,this.teamId=i}}class dh{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class ph{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class hh{top(e,t){let n=new lh(e.scene,t,e.id,e.teamId);return new Promise(((e,t)=>{let i=new Qc({name:dc.topConversation,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:n=>{200===n.code?e(n):t(n)},fail:e=>{t(e)}});Wc.Socket.e(i)}))}remove(e){let t=new dh(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Qc({name:dc.removeConversation,params:t,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{200==t.code?e(t):n(t)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}query(e){return new Promise(((t,n)=>{let i=new Qc({name:e,params:{},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{n(e)},success:e=>fc(this,void 0,void 0,(function*(){t(e)}))});Wc.Socket.e(i)}))}loadData(e){let t=new ph(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Qc({name:dc.imData,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:t=>{let n=JSON.parse(t.content);e(n)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}}hh.instance=new hh;class gh{constructor(){this.list=new Array,this.builder=new tl,this.remoteConversations=hh.instance,this.synchronized=!1,Vu.i.on(Lu.MAX_MESSAGE_CHANGED,this.onMaxMessageChanged.bind(this)),Vu.i.on(Lu.UNREAD_AMOUNT_CHANGED,this.onUnreadMessageChanged.bind(this)),Vu.i.on(Lu.MAX_MESSAGE_DELETED,this.onMaxMessageDeleted.bind(this))}onUnreadMessageChanged(e){this.findConversation(e)&&this.fireUpdated()}fireUpdated(){this.debounce(this.triggerUpdate.bind(this))}triggerUpdate(){let e=this.loadLocalConversations(),t=this.getUpdatedEventName();rl.fire(t,{unreadTotal:e.content.unreadTotal,conversations:e.content.conversations})}getUpdatedEventName(){return wu.CONVERSATIONS_UPDATED}latestConversations(e){return fc(this,void 0,void 0,(function*(){this.synchronized||(yield this.loadServerConversations());let t=this.loadLocalConversations();gc.onSuccess(e,t)}))}loadServerConversations(){return fc(this,void 0,void 0,(function*(){let e=this.rocketName(),t=yield this.remoteConversations.query(e);this.convertAbbrConversation(t.content),this.synchronized=!0}))}rocketName(){return dc.imLastConversations}convertAbbrConversation(e){let t=e;for(const n of t){let e=n.t,t=n.top,i=n.d?JSON.parse(n.d):{},o=n.userOffsets;n.lmsg.t=e;let s=n.lmsg,a=this.builder.build(s),r=Wu.byIMMessage(a),c=this.findConversation(r);nc.isUndef(c)?(c=this.buildByAbbr(n,a),this.insertOne(c)):(c.top=t,c.data=i),r.scene===Qr.GROUP&&(a.x=1),rh.get(r).initMaxMessageAndOffsets(a,o),this.correctPosition(c)}}onMaxMessageDeleted(e){this.removeConversation(e)}onMaxMessageChanged(e){return fc(this,void 0,void 0,(function*(){if(e.scene()===Qr.CS){let t=e;if(Wc.Socket.user().id!=t.customerId()&&(!1===t.accepted||t.type===Nu.ACCEPT&&t.senderId!=Wc.Socket.user().id))return}yield this.saveOrUpdateConversation(e)}))}saveOrUpdateConversation(e){return fc(this,void 0,void 0,(function*(){let t=e.status,n=Wu.byIMMessage(e),i=this.findConversation(n);nc.isUndef(i)&&t!==Zr.FAIL&&(i=this.buildByMessage(e),this.insertOne(i),t===Zr.SUCCESS&&(i.data=yield this.remoteConversations.loadData(n),i.dataLoaded=!0)),t===Zr.SENDING&&(i.data=e.getToData(),i.dataLoaded=!0),i&&i.dataLoaded&&(this.correctPosition(i),this.fireUpdated())}))}debounce(e){clearTimeout(this.timer),this.timer=setTimeout((()=>{e()}),500)}loadLocalConversations(){let e=0,t=new Array;for(const n of this.list)if(n.dataLoaded&&n.getMaxMessage()){e+=n.getUnreadAmount();let i=n.toDto();t.push(i)}return{code:200,content:{unreadTotal:e,conversations:t}}}findConversationIndex(e){return this.list.findIndex((t=>e.toString()===t.target.toString()))}findConversation(e){let t=this.findConversationIndex(e);return this.list[t]}removeLocalConversation(e){let t=this.findConversationIndex(e.target);this.list.splice(t,1)}insertOne(e){gh.sortedInserter.insert(this.list,e),this.list.length>gh.CONVERSATIONS_MAX_LENGTH&&0===this.list[this.list.length-1].getUnreadAmount()&&this.list.pop()}correctPosition(e){this.removeLocalConversation(e),this.insertOne(e)}removeConversation(e){let t=this.findConversation(e);t&&(this.removeLocalConversation(t),this.fireUpdated())}top(e,t,n){return fc(this,void 0,void 0,(function*(){if(!nc.isBoolean(t))throw new Error("top must be boolean.");let i=this.findConversation(e);if(!i)throw new Error("conversation does not exist.");i.top!=t&&(yield this.remoteConversations.top(e,t),i.top=t,this.correctPosition(i)),this.fireUpdated(),gc.onSuccess(n)}))}remove(e,t){return fc(this,void 0,void 0,(function*(){let n=this.findConversation(e);if(!n)throw new Error("conversation does not exist.");if(n instanceof uh&&!n.isEnded())throw new Error("CS conversation can only be deleted after it ends");yield this.remoteConversations.remove(e),this.removeLocalConversation(n),this.fireUpdated(),gc.onSuccess(t)}))}buildByAbbr(e,t){let n,i=Wu.byIMMessage(t);if(e.t===Qr.CS){let e=t;Wc.Socket.user().id===e.customerId()?n=new ch(i):(n=new uh(i),n.accepted=e.accepted)}else n=new ch(i);return n.dataLoaded=!0,n.top=e.top,n.data=e.d?JSON.parse(e.d):{},n}buildByMessage(e){let t,n=Wu.byIMMessage(e);if(e.scene()===Qr.CS){let i=e;Wc.Socket.user().id===i.customerId()?t=new ch(n):(t=new uh(n),t.accepted=i.accepted)}else t=new ch(n);return t}}gh.CONVERSATIONS_MAX_LENGTH=200,gh.sortedInserter=new class extends Ku{compare(e,t){let n;if(e.top==t.top){let i=e.maxMessageTime();n=t.maxMessageTime()-i}else n=e.top?-1:1;return 0===n?0:n>0?1:-1}};class fh extends Fc{static init(){return this.module=new fh,this.module.name=this.GIM_MODULE_NAME,this.initGN(),this.module}static initGN(){eu.addAssembler(new class{assemble(e){let t={messageId:e.id,timestamp:e.tm,type:e.t,senderId:e.sid,toType:e.tt};return e.tt===Qr.GROUP&&(t.groupId=e.gid),t}support(e){return!!e.sid}})}postConnect(){vg.init()}static check(){if(!this.module)throw{code:400,content:"IM not initialized. Please include 'IM' in the 'modules' during GoEasy initialization."}}}fh.GIM_MODULE_NAME="GIM";class mh extends gh{constructor(){super(),this.expired=!1,Vu.i.on(Lu.CS_ONLINE_SUCCESS,this.onCSOnlineSuccess.bind(this)),Vu.i.on(Lu.CS_OFFLINE_SUCCESS,this.onCSOfflineSuccess.bind(this)),th.on(th.EVENT.LOST,this.onDisconnected.bind(this)),th.on(th.EVENT.RECONNECTED,this.onConnected.bind(this))}onMaxMessageChanged(e){return fc(this,void 0,void 0,(function*(){if(e.scene()===Qr.CS){let t=e;if(t.customerId()!=Wc.Socket.user().id&&(!1===t.accepted||t.type===Nu.ACCEPT))if(Nu.ACCEPT===e.type){let t=Wu.byIMMessage(e);this.removeConversation(t)}else yield this.saveOrUpdateConversation(e)}}))}latestConversations(e){const t=Object.create(null,{latestConversations:{get:()=>super.latestConversations}});return fc(this,void 0,void 0,(function*(){let n=this.synchronized;yield t.latestConversations.call(this,e),this.list.length>0&&!n&&this.fireUpdated()}))}onUnreadMessageChanged(e){}onCSOnlineSuccess(){return fc(this,void 0,void 0,(function*(){yield this.loadServerConversations(),this.fireUpdated()}))}onCSOfflineSuccess(){this.list=[],this.fireUpdated()}getUpdatedEventName(){return wu.PENDING_CONVERSATIONS_UPDATED}rocketName(){return dc.CS_PENDING_CONVERSATION}convertAbbrConversation(e){return fc(this,void 0,void 0,(function*(){let t=e;for(const e of t){e.lastMessage.t=Qr.CS;let t=e.customerData,n=e.lastMessage,i=e.userOffsets,o=t?JSON.parse(t):{},s=this.builder.build(n),a=Wu.byIMMessage(s),r=this.findConversation(a);nc.isUndef(r)&&(r=new uh(a),r.accepted=s.accepted,r.dataLoaded=!0,this.insertOne(r)),r.top=!1,r.data=o,rh.get(a).initPendingMaxMessageAndOffsets(s,i),this.correctPosition(r)}}))}onDisconnected(){this.expired=!0}onConnected(){return fc(this,void 0,void 0,(function*(){this.expired&&fh.module&&fh.module.active&&(this.expired=!1,this.list=[],yield this.loadServerConversations(),this.fireUpdated())}))}}class _h{constructor(){this.conversations=new gh,this.pendingConversations=new mh}latestConversations(e){this.conversations.latestConversations(e)}latestPendingConversations(e){this.pendingConversations.latestConversations(e)}topPrivateConversation(e){let t=Wu.byScene(Qr.PRIVATE,e.userId);this.conversations.top(t,e.top,e)}topGroupConversation(e){let t=Wu.byScene(Qr.GROUP,e.groupId);this.conversations.top(t,e.top,e)}topConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Wu.byConversationDTO(t);this.conversations.top(n,e.top,e)}removePrivateConversation(e){let t=Wu.byScene(Qr.PRIVATE,e.userId);this.conversations.remove(t,e)}removeGroupConversation(e){let t=Wu.byScene(Qr.GROUP,e.groupId);this.conversations.remove(t,e)}removeConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Wu.byConversationDTO(t);this.conversations.remove(n,e)}validateConversationDTO(e){if(!(e instanceof ec))throw new Error("Incorrect conversation object.");{let t=e.lastMessage;if(t instanceof el&&t.customerId()!==Wc.Socket.user().id&&!1===t.accepted)throw new Error("pending conversation cannot be topped or removed.")}}}class vh{constructor(){this.builder=new tl,Wc.Socket.onMessage(au.imMessage,this.onMessageReceived.bind(this))}onMessageReceived(e){if(e.t!==Qr.CS){let t=this.builder.build(e);this.sendAck(t);let n=Wu.byIMMessage(t),i=n.scene;rh.get(n).existsMessage(t)||(this.createNotification(e),Vu.i.fire(Lu.MESSAGE_RECEIVED,t),i===Qr.PRIVATE?rl.fire(wu.PRIVATE_MESSAGE_RECEIVED,t):i===Qr.GROUP&&rl.fire(wu.GROUP_MESSAGE_RECEIVED,t))}}sendAck(e){Wc.Socket.sendAck("imAck",{publishGuid:e.messageId})}createNotification(e){const t=Wc.N.supportAppNotification();if(!nc.isObject(e.nt)||e.s===Wc.Socket.user().id||!t)return;let n={id:e.i,tm:e.ts,t:e.mt,sid:e.s,tt:e.t};n.tt===Qr.GROUP&&(n.gid=e.r),Wc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}}class yh{constructor(){this.subscribedGroups=[],Wc.Socket.on(ru.EXPIRED_RECONNECTED,this.expiredResubscribeGroups.bind(this))}expiredResubscribeGroups(){this.subscribedGroups.forEach((e=>fc(this,void 0,void 0,(function*(){yield this.doSubscribeGroup(e)}))))}subscribe(e){let t=e.groupIds;nu.validateIdArray(t,"groupIds");let n=new Ih(t,e.accessToken);this.doSubscribeGroup(n).then((()=>{this.subscribedGroups.push(n),gc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{gc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to subscribe group message"})}))}doSubscribeGroup(e){return new Promise(((t,n)=>{let i=e.groupIds.toString().split(","),o=new Qc({name:dc.subscribeGroups,params:{groupIds:i,at:e.accessToken},permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{t()},fail:e=>{n(e)}});Wc.Socket.e(o)}))}unsubscribe(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Qc({name:dc.unsubscribeGroup,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{this.deleteSubscriptionByGroupId(e.groupId),gc.onSuccess(e,{code:200,content:"ok"})},fail:t=>{gc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to unsubscribe group message"})}});Wc.Socket.e(t)}deleteSubscriptionByGroupId(e){this.subscribedGroups=this.subscribedGroups.filter((t=>{const n=t.groupIds.findIndex((t=>t==e));return n>-1&&t.groupIds.splice(n,1),t.groupIds.length>0}))}}class Ih{constructor(e,t){this.groupIds=e,this.accessToken=t}}class Mh{constructor(){this.newMessageReceived=e=>{let t=null;e.c&&(t=JSON.parse(e.c)),t&&t.events&&t.events.map((e=>{let n=e.userData?JSON.parse(e.userData):{},i={time:e.time,action:e.action,groupOnlineCount:t.userAmount,groupId:t.groupId,id:e.userId,data:n};rl.fire(wu.GROUP_PRESENCE,i)}))},th.onMessage(au.groupPresence,this.newMessageReceived)}presence(e){nu.validateIdArray(e.groupIds,"groupIds"),e.groupIds.toString().split(",");let t={groupIds:e.groupIds};this.emitRocket(dc.subscribeGroupPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),pc.commonRequestSingle,pc.commonRequestTotal)}unPresence(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.emitRocket(dc.unsubscribeGroupPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),pc.commonRequestSingle,pc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let a=new Qc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Wc.Socket.e(a)}}class Ch{get(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Qc({name:dc.imGroupOnlineCount,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:function(t){gc.onFailed(e,t||{code:408,content:"Failed to query online group users"})},success:function(t){200==t.code?gc.onSuccess(e,t):gc.onFailed(e,t)}});Wc.Socket.e(t)}}class Sh{doHereNow(e,t,n){let i=new Qc({name:e,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{gc.onFailed(n,e)},success:e=>{let t=e.content;e.content=t.map((e=>{let t=e.userData?JSON.parse(e.userData):{};return{id:e.userId,data:t}})),gc.onSuccess(n,e)}});Wc.Socket.e(i)}}class Eh extends Sh{hereNow(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.doHereNow(dc.imGroupHereNow,t,e)}}class Th{constructor(){this.newMessageReceived=e=>{let t=[];e.c&&(t=JSON.parse(e.c).events||[]),t.map((e=>{let t=e.userData?JSON.parse(e.userData):{},n={time:e.time,action:e.action,id:e.userId,data:t};rl.fire(wu.USER_PRESENCE,n)}))},th.onMessage(au.userPresence,this.newMessageReceived)}presence(e){nu.validateIdArray(e.userIds,"userIds"),e.userIds.toString().split(",");let t={userIds:e.userIds};this.emitRocket(dc.subscribeUserPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),pc.commonRequestSingle,pc.commonRequestTotal)}unPresence(e){nu.validateId(e.userId,"userId"),e.userId=e.userId.toString();let t={userId:e.userId};this.emitRocket(dc.unsubscribeUserPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),pc.commonRequestSingle,pc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let a=new Qc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Wc.Socket.e(a)}}class kh extends Sh{hereNow(e){let t=e.userIds;nu.validateIdArray(t,"userIds"),t.toString().split(","),this.doHereNow(dc.imHereNow,e,e)}}const Dh=new class{fileExtension(e,t){if(nc.isString(e))try{let n=e.split(t);return n[n.length-1]}catch(n){throw Error(n)}}};class Rh{}class Oh extends Rh{constructor(){super(...arguments),this.contentType="",this.name="",this.size=0,this.url=""}}class bh extends Oh{constructor(){super(...arguments),this.width=0,this.height=0}}class Ah{build(e){this.validate(e.createOptions);let t=this.create();return this.setPayload(e,t),t}}class Lh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Ph extends Lh{create(){return new bh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.path||n.tempFilePath,s=nc.isEmpty(n.name)||void 0===n.name?o:n.name;i.name="wx-image."+Dh.fileExtension(s,"."),i.contentType="image/"+Dh.fileExtension(s,"."),i.url=o,i.size=n.size,e.complete=new Promise(((e,t)=>{Pn.getImageInfo({src:i.url,success(t){i.width=t.width,i.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Nh extends Oh{constructor(){super(...arguments),this.duration=0}}class wh extends Lh{create(){return new Nh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.tempFilePath,s=nc.isEmpty(n.name)||null==n.name?o:n.name,a=n.duration,r=n.fileSize;i.url=o,i.size=r,i.duration=a/1e3,i.name="wx-audio."+Dh.fileExtension(s,"."),i.contentType="audio/"+Dh.fileExtension(s,"."),e.complete=Promise.resolve()}validate(e){super.validate(e)}}class Uh extends Rh{constructor(){super(...arguments),this.text=""}}class Gh extends Ah{create(){return new Uh}setPayload(e,t){let n=t,i=e.createOptions;n.text=i.text,e.complete=Promise.resolve()}validate(e){if(nc.isEmpty(e.text))throw{code:400,content:"text is empty"};if(!nc.isString(e.text))throw{code:400,content:"TypeError: text requires string."};if(""===e.text.trim())throw{code:400,content:"text is empty"};if(e.text.length>2500)throw{code:400,content:"Message text over max length 2500"}}}class xh extends Rh{constructor(){super(...arguments),this.video=new Bh,this.thumbnail=new Fh}}class Fh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType=""}initURL(e){oc.currentPlatform()===ic.BROWSER&&this.htmlUrl(e)}htmlUrl(e){let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.url=t.toDataURL("image/png")}}class Bh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType="",this.size=0,this.duration=0}}class qh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,thumbTempFilePath:l,width:d,name:p=""}=n,h=nc.isEmpty(p)?u:p;o.contentType="video/"+Dh.fileExtension(h,"."),o.name="wx-video."+Dh.fileExtension(h,"."),o.url=u,o.width=s.width=d,o.height=s.height=r,o.size=c,o.duration=a,s.url=l,s.contentType="image/jpg",s.name="wx-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Vh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.fullPath||i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class jh extends Vh{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size;let o=nc.isEmpty(i.name)||void 0===i.name?i.path:i.name;n.contentType="image/"+Dh.fileExtension(o,"."),n.name="uni-image."+Dh.fileExtension(o,"."),e.complete=new Promise(((e,t)=>{Nn.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Hh extends Vh{create(){return new Nh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file,s=o.tempFilePath,a=nc.isEmpty(o.name)||null==o.name?s:o.name;i.url=s,i.name="uni-audio."+Dh.fileExtension(a,"."),i.contentType="audio/"+Dh.fileExtension(a,"."),e.complete=new Promise(((e,t)=>{Nn.getFileInfo({filePath:s,success:o=>{let a=o.size;if(i.size=a,0===a)e();else if(nc.isDef(n.file.duration))i.duration=n.file.duration/1e3,e();else{const n=Nn.createInnerAudioContext();n.src=s,n.onCanplay((function(o){o.errCode?(n.destroy(),t(o)):(i.duration=n.duration,n.destroy(),e())})),n.onError((i=>{n.destroy(),-99===i.errCode?e():t(i)}))}},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Kh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,width:l,name:d=""}=n,p=nc.isEmpty(d)?u:d;o.size=c,o.width=l,o.height=r,o.url=u,o.duration=a,o.contentType="video/"+Dh.fileExtension(p,"."),o.name="uni-video."+Dh.fileExtension(p,"."),s.url=u,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="uni-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class zh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file,o=window.URL||window.webkitURL;n.url=o.createObjectURL(i),n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>524288e3)throw Error("message-length limit 30mib")}}class Wh extends zh{create(){return new bh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=new Image;s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onload=function(){i.width=s.width,i.height=s.height,o.revokeObjectURL(s.src),e()},s.onerror=function(e){o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["gif","jpg","png","jpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported image.")}}class Yh extends zh{create(){return new Nh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=document.createElement("audio");s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onloadedmetadata=()=>{i.duration=s.duration,o.revokeObjectURL(s.src),e()},s.onerror=e=>{o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["mp3","ogg","wav","wma","ape","acc","mpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported audio.")}}class $h extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,a=window.URL||window.webkitURL,r=document.createElement("video");r.src=a.createObjectURL(n),o.size=n.size,o.name=n.name,o.contentType=n.type,o.url=r.src,s.name=n.name,s.contentType="image/jpg",e.complete=new Promise(((e,t)=>{r.onloadedmetadata=()=>{o.duration=r.duration,o.width=r.videoWidth,o.height=r.videoHeight,s.width=r.videoWidth,s.height=r.videoHeight,s.url=this.getThumbnailUrl(r),a.revokeObjectURL(r.src),e()},r.onerror=function(e){a.revokeObjectURL(r.src),t(e)}}))}getThumbnailUrl(e){let t=document.createElement("canvas");return t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),t.toDataURL("image/png")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>31457280)throw Error("message-length limit 30mib");let t=["avi","mov","rmvb","rm","flv","mp4","3gp","quicktime"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported video.")}}class Jh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,tempVideoThumbPath:l,width:d}=n;o.size=c,o.width=d,o.height=r,o.url=u,o.duration=a,o.contentType="video/mp4",o.name="ali-video.mp4",s.url=l,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="ali-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Xh extends Ah{create(){return new Oh}setPayload(e,t){e.complete=Promise.reject("Alipay not support file message.")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Qh extends Xh{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{my.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="ali-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Zh extends Xh{create(){return new Nh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="ali-audio."+Dh.fileExtension(o,"."),n.contentType="audio/"+Dh.fileExtension(o,"."),n.duration=i.duration,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class eg extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,thumbTempFilePath:l,width:d}=n;o.size=c,o.width=d,o.height=r,o.url=u,o.duration=a,o.contentType="video/"+Dh.fileExtension(u,"."),o.name="baidu-video."+Dh.fileExtension(u,"."),s.url=l,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/"+Dh.fileExtension(l,"."),s.name="baidu-thumbnail."+Dh.fileExtension(u,"."),e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class tg extends Ah{create(){return new Oh}setPayload(e,t){e.complete=Promise.reject("Baidu app not support file message.")}validate(e){}}class ng extends tg{create(){return new Nh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="baidu-audio."+Dh.fileExtension(o,"."),n.contentType="audio/"+Dh.fileExtension(o,"."),n.duration=i.duration/1e3,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class ig extends tg{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{swan.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="baidu-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class og extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,type:s,size:a,name:r}=i;n.url=decodeURIComponent(o),n.name=r,n.size=a,n.contentType=s,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class sg extends og{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,fileSize:s,type:a,fileName:r,width:c,height:u}=i;n.url=o,n.size=s,n.contentType=a,n.name=r,n.width=c,n.height=u,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class ag extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file;const i=t,{video:o,thumbnail:s}=i,{uri:a,type:r,fileSize:c,fileName:u,duration:l,height:d,width:p}=n;o.size=c,o.width=p,o.height=d,o.url=a,o.duration=l,o.contentType=r,o.name=u,s.url=a,s.name="rn-thumbnail.jpg",s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class rg extends og{create(){return new Nh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file;const{uri:s,name:a,duration:r,size:c}=o;i.url=s,i.duration=Number((r/1e3).toFixed(2)),i.size=c,i.name=a||"rn-audio."+Dh.fileExtension(s,"."),i.contentType="audio/"+Dh.fileExtension(s,"."),n.file={uri:s,type:i.contentType,name:i.name},e.complete=Promise.resolve()}validate(e){super.validate(e)}}class cg extends Rh{}class ug extends Ah{create(){return new cg}setPayload(e,t){let n=e.createOptions;t.payload=n.payload,e.complete=Promise.resolve()}validate(e){let t=e.type,n=e.payload;if(nc.isEmpty(t))throw Error("type is empty.");if(!nc.isString(t))throw Error("type require a string");if(nc.isEmpty(n))throw Error("payload is empty.");if(!nc.isPlainObject(n)&&!nc.isStringOrNumber(n))throw Error("payload require object | string | number.")}}class lg{constructor(e,t){this.type=e,this.createOptions=t}}class dg{constructor(){this.framework=$r.currentFramework(),this.platform=oc.currentPlatform(),this.payloadBuilders={[zr.UNIAPP]:{image:new jh,file:new Vh,audio:new Hh,video:new Kh,text:new Gh},[ic.MP_WX]:{image:new Ph,file:new Lh,audio:new wh,video:new qh,text:new Gh},[ic.BROWSER]:{image:new Wh,file:new zh,audio:new Yh,video:new $h,text:new Gh},[ic.MP_ALI]:{image:new Qh,file:new Xh,audio:new Zh,video:new Jh,text:new Gh},[ic.MP_BAIDU]:{image:new ig,file:new tg,audio:new ng,video:new eg,text:new Gh},[zr.REACT_NATIVE]:{image:new sg,file:new og,audio:new rg,video:new ag,text:new Gh},[ic.MP_BYTE]:{image:new Ph,file:new Lh,audio:new wh,video:new qh,text:new Gh}}}buildMessage(e,t){const n=this.framework===zr.UNKNOWN?this.platform:this.framework;let i=this.payloadBuilders[n][e],o=new lg(e,t);if(i){let e=i.build(o);o.payload=e}else{let e=(new ug).build(o);o.payload=e.payload}let s=this.build(o);return o.complete.then((()=>{gc.onSuccess(t,s)})).catch((e=>{gc.onFailed(t,e)})),s}build(e){let t,n=e.type,i=e.payload,o=e.createOptions,s=o.to,a=s.type;return this.validate(o),a===Qr.GROUP?(t=new Zu,t.groupId=s.id.toString(),t.senderData=Wc.Socket.user().data):a===Qr.PRIVATE?(t=new Qu,t.read=!1,t.receiverId=s.id.toString()):a===Qr.CS&&(t=new el,t.to=s.id.toString(),t.teamId=s.id.toString(),t.senderData=Wc.Socket.user().data),t.senderId=Wc.Socket.user().id,t.messageId=$c.get(),t.payload=i,t.timestamp=Date.now(),t.type=n,t.recalled=!1,t.status=Zr.NEW,t.buildOptions=e,t}validate(e){const t=e.to;if(!t)throw new Error("message require property to.");if(!nc.isObject(t))throw new Error("TypeError: to requires an object.");if(!nc.isObject(t.data))throw new Error("TypeError: to.data requires an object.");if(!t.type||t.type!==Qr.GROUP&&t.type!==Qr.PRIVATE&&t.type!==Qr.CS)throw new Error("message require property to.type");if(nu.validateId(t.id,"to.id"),Wc.Socket.user().id===t.id)throw new Error("to.id can not be the same as your id.");nc.isDef(e.notification)&&nu.validateNotification(e.notification),e.wxmpTemplateMsg&&nu.validateWXMPTemplateMsg(e.wxmpTemplateMsg)}}class pg extends vh{onMessageReceived(e){if(e.t===Qr.CS){let t=this.builder.build(e);this.sendAck(t);let n=Wu.byIMMessage(t);rh.get(n).existsMessage(t)||(t.customerId()===Wc.Socket.user().id?(this.createNotification(e),Vu.i.fire(Lu.MESSAGE_RECEIVED,t),rl.fire(wu.CS_MESSAGE_RECEIVED,t)):nh.getInstance().queryTeams().then((()=>{ih.isMyMessage(t)&&this.createNotification(e),Vu.i.fire(Lu.CS_AGENT_MESSAGE_RECEIVED,t)})))}}}class hg{constructor(e){this.times=new Array;let t=e[0],n=Wu.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e<t?-1:e==t?0:1))}}class gg{constructor(){this.onRemoteRecalled=e=>{Vu.i.fire(Lu.MESSAGE_RECALLED,e)},th.onMessage(au.IM_MSG_RECALLED,this.onRemoteRecalled)}recallMessage(e){return fc(this,void 0,void 0,(function*(){ah.validateMessageArray(e.messages),this.validate(e);let t=e.messages;yield this.recallServerMessages(t);let n=t[0],i=n.scene(),o=this.toConversationId(i,n.senderId,n.targetId()),s={id:Wc.Socket.user().id,data:Wc.Socket.user().data},a=t.map((e=>e.timestamp)),r=new al(i,o,s,a);Vu.i.fire(Lu.MESSAGE_RECALLED,r),gc.onSuccess(e)}))}toConversationId(e,t,n){if(Qr.PRIVATE===e)return o=n,(i=t).localeCompare(o)>0?`${i}:${o}`:`${o}:${i}`;var i,o;if(Qr.GROUP===e)return n;throw{code:400,content:`scene: ${e} not support`}}recallServerMessages(e){let t=new hg(e);return 0===t.times.length?Promise.resolve():new Promise(((e,n)=>{let i=new Qc({name:dc.IM_RECALL_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{n(e)},success:t=>{200===t.code?e(t):n(t)}});Wc.Socket.e(i)}))}validate(e){let t=e.messages;for(let n=0;n<t.length;n++){let e=t[n];if(e.scene()===Qr.CS)throw{code:400,content:"Recall CS message is not supported yet."};if(e.status!==Zr.SUCCESS)throw{code:400,content:"message["+n+"] is '"+e.status+"' and cannot be recalled"};if(e.recalled)throw{code:400,content:"message["+n+"] has been recalled"};if(e.senderId!==Wc.Socket.user().id)throw{code:400,content:"it is not allowed to recall messages sent by others"}}}}class fg{constructor(){this.map=new Map}getData(e){return this.map.get(e)}setData(e,t){this.map.set(e,t)}}class mg{constructor(){this.dataCache=new fg}static init(){this.i=new mg}getData(...e){return fc(this,void 0,void 0,(function*(){let t=[],n=new Map;return e.forEach((e=>{let i=this.dataCache.getData(e);i?n.set(e,i):t.push(e)})),0===t.length||(yield this.fetchData(...t)).forEach(((e,t)=>{this.dataCache.setData(t,e),n.set(t,e)})),Promise.resolve(n)}))}fetchData(...e){return new Promise(((t,n)=>{let i=new Qc({name:dc.MD_CMD,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{name:"GET",data:{ids:e}},success:e=>{if(200===e.code){const n=new Map;e.content.forEach((e=>{n.set(e.id,e.data)})),t(n)}else n(e)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}setData(e,t){this.dataCache.setData(e,t)}}class _g{constructor(){Vu.i.on(Lu.MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.MESSAGE_SENDING,this.onMessageSending)}onMessageSending(e){let t=Wu.byIMMessage(e);t.scene===Qr.PRIVATE&&mg.i.setData(t.id,e.getToData())}onMessageReceived(e){if(Wu.byIMMessage(e).scene===Qr.GROUP){let t=e;mg.i.setData(t.senderId,t.senderData)}}}class vg{constructor(){this._iMReceiver=new vh,this.csMessageReceiver=new pg,this.memberDataUpdator=new _g,this._userHereNow=new kh,this.goEasyUploader=new Au,this._groupHereNow=new Eh,this._groupOnlineCount=new Ch,this.groupMessageSubscriber=new yh,this.messageBuilder=new dg,this.messageSender=new Hu,this.recaller=new gg,this._groupPresenceSubscriber=new Mh,this._userPresenceSubscriber=new Th,this.conversations=new _h,this.histories=rh.init()}static init(){Vu.init(),rl.init(),vg.instance=new vg}static i(){if(vg.instance)return vg.instance;throw Error("Please connect first.")}validateModules(){if(th.status()===Wr.DISCONNECTED)throw Error("Please call connect() first.");fh.check()}catch(e,t){return fc(this,void 0,void 0,(function*(){try{this.validateModules(),nu.validateCallbackOptions(t),yield e()}catch(n){gc.onFailed(t,n)}}))}on(e,t){rl.on(e,t)}off(e,t){rl.off(e,t)}createTextMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.TEXT,e)}createImageMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.IMAGE,e)}createFileMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.FILE,e)}createAudioMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.AUDIO,e)}createVideoMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.VIDEO,e)}createCustomMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(e.type,e)}sendMessage(e){this.catch((()=>{this.messageSender.send(e)}),e)}recallMessage(e){this.catch((()=>{this.recaller.recallMessage(e)}),e)}deleteMessage(e){this.catch((()=>{this.histories.deleteMessage(e)}),e)}markGroupMessageAsRead(e){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.groupMarkAsRead(e)}))),e)}markPrivateMessageAsRead(e){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.privateMarkAsRead(e)}))),e)}markMessageAsRead(e,t){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.markMessageAsRead(e,t)}))),e)}latestConversations(e){this.validateModules(),this.conversations.latestConversations(e)}removePrivateConversation(e){this.catch((()=>this.conversations.removePrivateConversation(e)),e)}removeGroupConversation(e){this.catch((()=>this.conversations.removeGroupConversation(e)),e)}topPrivateConversation(e){this.catch((()=>this.conversations.topPrivateConversation(e)),e)}topGroupConversation(e){this.catch((()=>this.conversations.topGroupConversation(e)),e)}history(e,t){this.catch((()=>{this.histories.loadHistory(e,t)}),e)}subscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.presence(e)),e)}unsubscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.unPresence(e)),e)}hereNow(e){this.catch((()=>this._userHereNow.hereNow(e)),e)}subscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.subscribe(e)),e)}unsubscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.unsubscribe(e)),e)}subscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.presence(e)),e)}unsubscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.unPresence(e)),e)}groupHereNow(e){this.catch((()=>this._groupHereNow.hereNow(e)),e)}groupOnlineCount(e){this.catch((()=>this._groupOnlineCount.get(e)),e)}latestPendingConversations(e){this.validateModules(),this.conversations.latestPendingConversations(e)}topConversation(e){this.validateModules(),this.conversations.topConversation(e)}removeConversation(e){this.validateModules(),this.conversations.removeConversation(e)}}class yg{constructor(e,t){this.customerId=e,this.teamId=t}}class Ig{constructor(e,t){this.teamId=e;let n=new tc(t.id.toString(),JSON.stringify(t.data));this.customer=n}}class Mg{constructor(e,t,n){this.customerId=e,this.teamId=t,this.agentId=n}}class Cg{constructor(e,t){this.customerId=e,this.teamId=t}}class Sg{constructor(e){this.builder=new tl,this.teamId=e}accept(e,t){let n=t.customer;if(nc.isUndef(n))throw{code:400,content:"customer is required."};nu.validateId(n.id,"customer.id");let i=n.data;if(nc.isUndef(i)||!nc.isObject(i))throw{code:400,content:"customer data must be non-empty object."};let o=new Ig(e,n),s=new Qc({name:dc.CS_ACCEPT,params:o,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_ACCEPTED,n),gc.onSuccess(t)}});Wc.Socket.e(s)}end(e,t){nu.validateId(t.id,"id");let n=t.id.toString(),i=new Cg(n,e),o=new Qc({name:dc.CS_END,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_ENDED,n),gc.onSuccess(t)}});Wc.Socket.e(o)}queryCustomerStatus(e,t){return fc(this,void 0,void 0,(function*(){nu.validateId(t.id,"id");let n=yield this.doCustomerStatus(e,t.id);this.activeCustomerStatus=n,this.activeCustomerStatusOptions=t,gc.onSuccess(t,n)}))}doCustomerStatus(e,t){let n=t.toString(),i=new yg(n,e);return new Promise(((e,t)=>{let n=new Qc({name:dc.CS_CUSTOMER_STATUS,params:i,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;n.agent&&(n.agent.data=JSON.parse(n.agent.data)),e(n)}});Wc.Socket.e(n)}))}transfer(e,t){nu.validateId(t.customerId,"customerId"),nu.validateId(t.agentId,"agentId");let n=t.customerId.toString(),i=t.agentId.toString(),o=new Mg(n,e,i),s=new Qc({name:dc.CS_TRANSFER,params:o,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_TRANSFER,n),gc.onSuccess(t)}});Wc.Socket.e(s)}}class Eg{createTextMessage(e,t){let n=vg.i().createTextMessage(t);this.extendProps(e,n)}createImageMessage(e,t){let n=vg.i().createImageMessage(t);this.extendProps(e,n)}createFileMessage(e,t){let n=vg.i().createFileMessage(t);this.extendProps(e,n)}createAudioMessage(e,t){let n=vg.i().createAudioMessage(t);this.extendProps(e,n)}createVideoMessage(e,t){let n=vg.i().createVideoMessage(t);this.extendProps(e,n)}createCustomMessage(e,t){let n=vg.i().createCustomMessage(t);this.extendProps(e,n)}extendProps(e,t){if(t.scene()===Qr.CS){let n=t;n.teamId=e,n.accepted=!0}}}class Tg{constructor(e){this.teamId=e,this.agentStatus=nh.getInstance(),this.conversationHandler=new Sg(e),this.messageCreator=new Eg}catch(e,t){return fc(this,void 0,void 0,(function*(){try{nu.validateCallbackOptions(t),yield e()}catch(n){gc.onFailed(t,n)}}))}isOnline(e){this.catch((()=>{this.agentStatus.isOnline(this.teamId,e)}),e)}online(e){this.catch((()=>{this.agentStatus.online(this.teamId,e)}),e)}offline(e){this.catch((()=>{this.agentStatus.offline(this.teamId,e)}),e)}customerStatus(e){this.catch((()=>{this.conversationHandler.queryCustomerStatus(this.teamId,e)}),e)}accept(e){this.catch((()=>{this.conversationHandler.accept(this.teamId,e)}),e)}end(e){this.catch((()=>{this.conversationHandler.end(this.teamId,e)}),e)}history(e){vg.i().history(e,this.teamId)}markMessageAsRead(e){vg.i().markMessageAsRead(e,this.teamId)}createTextMessage(e){this.messageCreator.createTextMessage(this.teamId,e)}createImageMessage(e){this.messageCreator.createImageMessage(this.teamId,e)}createFileMessage(e){this.messageCreator.createFileMessage(this.teamId,e)}createAudioMessage(e){this.messageCreator.createAudioMessage(this.teamId,e)}createVideoMessage(e){this.messageCreator.createVideoMessage(this.teamId,e)}createCustomMessage(e){this.messageCreator.createCustomMessage(this.teamId,e)}transfer(e){this.catch((()=>{this.conversationHandler.transfer(this.teamId,e)}),e)}agents(e){this.catch((()=>{this.agentStatus.agents(this.teamId,e)}),e)}liveSession(e){this.catch((()=>{ih.live(this.teamId,e)}),e)}quitLiveSession(e){this.catch((()=>{ih.quit(e)}),e)}listenCustomer(e){let t={customerId:e.id,onNewMessage:e.onNewMessage,onStatusUpdated:e.onStatusUpdated,onFailed:e.onFailed,onSuccess:e.onSuccess};this.catch((()=>{ih.live(this.teamId,t)}),e)}cancelListenCustomer(e){this.catch((()=>{ih.quit(e)}),e)}}class kg{static team(e){nu.validateId(e,"teamId");let t=this.teams.get(e);return t||(t=new Tg(e.toString()),this.teams.set(e.toString(),t)),t}}kg.teams=new Map;class Dg{constructor(e){this.id=e}isOnline(e){kg.team(this.id).isOnline(e)}online(e){kg.team(this.id).online(e)}offline(e){kg.team(this.id).offline(e)}customerStatus(e){kg.team(this.id).customerStatus(e)}accept(e){kg.team(this.id).accept(e)}end(e){kg.team(this.id).end(e)}history(e){kg.team(this.id).history(e)}markMessageAsRead(e){kg.team(this.id).markMessageAsRead(e)}createTextMessage(e){kg.team(this.id).createTextMessage(e)}createImageMessage(e){kg.team(this.id).createImageMessage(e)}createFileMessage(e){kg.team(this.id).createFileMessage(e)}createAudioMessage(e){kg.team(this.id).createAudioMessage(e)}createVideoMessage(e){kg.team(this.id).createVideoMessage(e)}createCustomMessage(e){kg.team(this.id).createCustomMessage(e)}transfer(e){kg.team(this.id).transfer(e)}agents(e){kg.team(this.id).agents(e)}liveSession(e){kg.team(this.id).liveSession(e)}quitLiveSession(e){kg.team(this.id).quitLiveSession(e)}listenCustomer(e){kg.team(this.id).listenCustomer(e)}cancelListenCustomer(e){kg.team(this.id).cancelListenCustomer(e)}}class Rg{static getInstance(e){return this.init(e),Rg}static init(e){if(this.getConnectionStatus()!==Wr.DISCONNECTED)throw new Error("Initialization failed. Please disconnect and try again.");this.validateOptions(e),Jr.init(e.reactNativeOptions),this.options=e,th.init(e),e.allowNotification&&eu.init(e.allowNotification),e.modules&&(e.modules.includes("PUBSUB")&&Bc.initModule(fu.init()),e.modules.includes("IM")&&Bc.initModule(fh.init())),mg.init(),Wc.init(th,eu,mg,Xr,sc,Bc)}static setBadge(e){eu.setBadge(e)}static connect(e){th.connect(e,"JS")}static disconnect(e){th.disconnect(e)}static getConnectionStatus(){return th.status()}static validateOptions(e){let t="";if(!nc.isObject(e))throw t="options is require an object.",Error(t);if(!nc.isPrimitive(e.appkey)||0==e.appkey.length)throw t="Invalid options:'appkey' is empty.",Error(t);if(!nc.isPrimitive(e.host)||0==e.host.length)throw t="Invalid options:'host' is empty.",Error(t);if(!nc.isArray(e.modules))throw t="Invalid options: 'modules' must be nonempty array",Error(t);if(!e.modules.includes("im")&&!e.modules.includes("pubsub"))throw t="Invalid options: 'modules' must include at least one of 'im' or 'pubsub'.",Error(t);e.modules=e.modules.map((e=>e.toUpperCase()))}static onClickNotification(e){eu.onClickNotification(e)}static c(e){e.init(Wc.Socket,Wc.N,Wc.Member,Wc.v,Wc.Platform,Bc)}}Rg.version=Xr,Rg.IM_EVENT=wu,Rg.IM_SCENE=Qr,Rg.im=class{static on(e,t){vg.i().on(e,t)}static off(e,t){vg.i().off(e,t)}static createTextMessage(e){return vg.i().createTextMessage(e)}static createImageMessage(e){return vg.i().createImageMessage(e)}static createFileMessage(e){return vg.i().createFileMessage(e)}static createAudioMessage(e){return vg.i().createAudioMessage(e)}static createVideoMessage(e){return vg.i().createVideoMessage(e)}static createCustomMessage(e){return vg.i().createCustomMessage(e)}static sendMessage(e){vg.i().sendMessage(e)}static recallMessage(e){vg.i().recallMessage(e)}static deleteMessage(e){vg.i().deleteMessage(e)}static markGroupMessageAsRead(e){vg.i().markGroupMessageAsRead(e)}static markPrivateMessageAsRead(e){vg.i().markPrivateMessageAsRead(e)}static latestConversations(e){vg.i().latestConversations(e)}static removePrivateConversation(e){vg.i().removePrivateConversation(e)}static removeGroupConversation(e){vg.i().removeGroupConversation(e)}static topPrivateConversation(e){vg.i().topPrivateConversation(e)}static topGroupConversation(e){vg.i().topGroupConversation(e)}static history(e){vg.i().history(e)}static subscribeUserPresence(e){vg.i().subscribeUserPresence(e)}static unsubscribeUserPresence(e){vg.i().unsubscribeUserPresence(e)}static hereNow(e){vg.i().hereNow(e)}static subscribeGroup(e){vg.i().subscribeGroup(e)}static unsubscribeGroup(e){vg.i().unsubscribeGroup(e)}static subscribeGroupPresence(e){vg.i().subscribeGroupPresence(e)}static unsubscribeGroupPresence(e){vg.i().unsubscribeGroupPresence(e)}static groupHereNow(e){vg.i().groupHereNow(e)}static groupOnlineCount(e){vg.i().groupOnlineCount(e)}static markMessageAsRead(e){vg.i().markMessageAsRead(e)}static csteam(e){return new Dg(e)}static pendingConversations(e){vg.i().latestPendingConversations(e)}static topConversation(e){vg.i().topConversation(e)}static removeConversation(e){vg.i().removeConversation(e)}},Rg.pubsub=class{static publish(e){this.catch((()=>{gu.instance.publish(e)}),e)}static subscribe(e){this.catch((()=>{gu.instance.subscribe(e)}),e)}static unsubscribe(e){this.catch((()=>{gu.instance.unsubscribe(e)}),e)}static subscribePresence(e){this.catch((()=>{gu.instance.subscribePresence(e)}),e)}static unsubscribePresence(e){this.catch((()=>{gu.instance.unsubscribePresence(e)}),e)}static history(e){this.catch((()=>{gu.instance.history(e)}),e)}static hereNow(e){this.catch((()=>{gu.instance.hereNow(e)}),e)}static catch(e,t){try{if(fu.check(),[Wr.DISCONNECTED,Wr.DISCONNECTING,Wr.CONNECT_FAILED].includes(Wc.Socket.status()))throw new Error("Please call connect() first.");e()}catch(n){gc.onFailed(t,n)}}};var Og="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function bg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ag={exports:{}};window,Ag.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/Users/chrisftian/Documents/projects/cos-sdk/cos-wx-sdk-v5/dist",n(n.s=8)}([function(e,t,n){function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){c=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function s(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
s=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(N){d=function(e,t,n){return e[t]=n}}function p(e,t,n,i){var s=t&&t.prototype instanceof y?t:y,a=Object.create(s.prototype),r=new L(i||[]);return o(a,"_invoke",{value:R(e,n,r)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(i){return{type:"throw",arg:i}}}t.wrap=p;var g="suspendedStart",f="suspendedYield",m="executing",_="completed",v={};function y(){}function I(){}function M(){}var C={};d(C,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(P([])));E&&E!==n&&i.call(E,c)&&(C=E);var T=M.prototype=y.prototype=Object.create(C);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function D(e,t){function n(o,s,a,c){var u=h(e[o],e,s);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==r(d)&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(d).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(u.arg)}var s;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,o){n(e,i,t,o)}))}return s=s?s.then(o,o):o()}})}function R(t,n,i){var o=g;return function(s,a){if(o===m)throw Error("Generator is already running");if(o===_){if("throw"===s)throw a;return{value:e,done:!0}}for(i.method=s,i.arg=a;;){var r=i.delegate;if(r){var c=O(r,i);if(c){if(c===v)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===g)throw o=_,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=m;var u=h(t,n,i);if("normal"===u.type){if(o=i.done?_:f,u.arg===v)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(o=_,i.method="throw",i.arg=u.arg)}}}function O(t,n){var i=n.method,o=t.iterator[i];if(o===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),v;var s=h(o,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,v;var a=s.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){for(;++o<t.length;)if(i.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(r(t)+" is not iterable")}return I.prototype=M,o(T,"constructor",{value:M,configurable:!0}),o(M,"constructor",{value:I,configurable:!0}),I.displayName=d(M,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===I||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,M):(e.__proto__=M,d(e,l,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},k(D.prototype),d(D.prototype,u,(function(){return this})),t.AsyncIterator=D,t.async=function(e,n,i,o,s){void 0===s&&(s=Promise);var a=new D(p(e,n,i,o),s);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(T),d(T,l,"Generator"),d(T,c,(function(){return this})),d(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(i,o){return r.type="throw",r.arg=t,n.next=i,o&&(n.method="next",n.arg=e),!!o}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],r=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var s=o;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=t,s?(this.method="next",this.next=s.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function a(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var c=n(10),u=n(13),l=n(14),d=l.btoa,p=Pn.getFileSystemManager(),h=n(2),g=n(15),f=g.XMLParser,m=g.XMLBuilder,_=new f({ignoreDeclaration:!0,ignoreAttributes:!0,parseTagValue:!1,trimValues:!1}),v=new m,y=function e(t){if(R(t))for(var n in t){var i=t[n];"string"==typeof i?"#text"===n&&delete t[n]:Array.isArray(i)?i.forEach((function(t){e(t)})):R(i)&&e(i)}};function I(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function M(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&n.push(t?I(i).toLowerCase():i);return n.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}var C=["cache-control","content-disposition","content-encoding","content-length","content-md5","content-type","expect","expires","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","transfer-encoding","pic-operations"],S=function(){},E=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t};function T(e){return b(e,(function(e){return"object"===r(e)&&null!==e?T(e):e}))}function k(e,t){return O(t,(function(n,i){e[i]=t[i]})),e}function D(e){return e instanceof Array}function R(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function b(e,t){var n=D(e)?[]:{};for(var i in e)e.hasOwnProperty(i)&&(n[i]=t(e[i],i));return n}var A,L,P=function(e,t){if(t=k({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};t&&"object"===r(t)&&(function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}(),F.each({"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-traffic-limit":"TrafficLimit","x-cos-mime-limit":"MimeLimit","x-cos-forbid-overwrite":"ForbidOverwrite","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext","Pic-Operations":"PicOperations"},(function(e,i){void 0!==t[e]&&(n[i]=t[e])})),t.Headers=E(n))}return t},N=function(e){return new Promise((function(t,n){p.readFile({filePath:e,success:function(e){t(e.data)},fail:function(e){n((null==e?void 0:e.errMsg)||"")}})}))},w=(A=s().mark((function e(t,n,i){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("postObject"!==t){e.next=4;break}i(),e.next=21;break;case 4:if("putObject"!==t){e.next=20;break}if(void 0!==n.Body||!n.FilePath){e.next=17;break}return e.prev=6,e.next=9,N(n.FilePath);case 9:n.Body=e.sent,e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(6),n.Body=void 0,i({error:"readFile error, ".concat(e.t0)}),e.abrupt("return");case 17:void 0!==n.Body?(n.ContentLength=n.Body.byteLength,i(null,n.ContentLength)):i({error:"missing param Body"}),e.next=21;break;case 20:n.FilePath?p.stat({path:n.FilePath,success:function(e){var t=e.stats;n.FileStat=t,n.FileStat.FilePath=n.FilePath;var o=t.isDirectory()?0:t.size;n.ContentLength=o=o||0,i(null,o)},fail:function(e){i(e)}}):i({error:"missing param FilePath"});case 21:case"end":return e.stop()}}),e,null,[[6,12]])})),L=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=A.apply(e,t);function s(e){a(o,n,i,s,r,"next",e)}function r(e){a(o,n,i,s,r,"throw",e)}s(void 0)}))},function(e,t,n){return L.apply(this,arguments)}),U=function(e){return Date.now()+(e||0)},G=function(e,t){if(!e||!t)return-1;e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.length<n;)e.push("0");for(;t.length<n;)t.push("0");for(var i=0;i<n;i++){var o=parseInt(e[i]),s=parseInt(t[i]);if(o>s)return 1;if(o<s)return-1}return 0},x=function(){var e={},t={};Pn.canIUse("getAppBaseInfo")&&(e=Pn.getAppBaseInfo()||{}),Pn.canIUse("getDeviceInfo")&&(t=Pn.getDeviceInfo()||{});var n=e.SDKVersion,i=(t.platform,G(n,"2.10.0")>=0);return function(){return i}}(),F={noop:S,formatParams:P,apiWrapper:function(e,t){return function(n,i){var o,s=this;if("function"==typeof n&&(i=n,n={}),n=P(e,n),s.options.EnableReporter)if("sliceUploadFile"===n.calledBySdk||"sliceCopyFile"===n.calledBySdk)o=n.tracker&&n.tracker.generateSubTracker({apiName:e});else if(["uploadFile","uploadFiles"].includes(e))o=null;else{var a=0;n.Body&&(a="string"==typeof n.Body?n.Body.length:n.Body.size||n.Body.byteLength||0);var r=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate.");o=new h({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:n.Bucket,region:n.Region,apiName:e,realApi:e,accelerate:r,fileKey:n.Key,fileSize:a,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})}n.tracker=o;var c=function(e){return e&&e.headers&&(e.headers["x-ci-request-id"]&&(e.RequestId=e.headers["x-ci-request-id"]),e.headers["x-cos-request-id"]&&(e.RequestId=e.headers["x-cos-request-id"]),e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},u=function(e,t){o&&o.report(e,t),i&&i(c(e),c(t))},l=function(){if("getService"!==e&&"abortUploadTask"!==e){var t=function(e,t){var n=t.Bucket,i=t.Region,o=t.Key;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!i)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e||"uploadFile"===e){if(!n)return"Bucket";if(!i)return"Region";if(!o)return"Key"}return!1}(e,n);if(t)return"missing param "+t;if(n.Region){if(n.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(n.Region))return"Region format error.";!s.options.CompatibilityMode&&-1===n.Region.indexOf("-")&&"yfb"!==n.Region&&"default"!==n.Region&&n.Region}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!s.options.AppId)return'Bucket should format as "test-1250000000".';n.Bucket=n.Bucket+"-"+s.options.AppId}n.AppId&&delete n.AppId}n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}}(),d=["getAuth","getObjectUrl"].includes(e);if(!d&&!i)return new Promise((function(e,o){if(i=function(t,n){t?o(t):e(n)},l)return u({error:l});t.call(s,n,u)}));if(l)return u({error:l});var p=t.call(s,n,u);return d?p:void 0}},xml2json:function(e){var t=_.parse(e);return y(t),t},json2xml:function(e){return v.build(e)},md5:c,clearKey:E,fileSlice:function(e,t,n,i){e?p.readFile({filePath:e,position:t,length:n-t,success:function(e){i(e.data)},fail:function(){i(null)}}):i(null)},getBodyMd5:function(e,t,n){n=n||S,e&&t&&t instanceof ArrayBuffer?F.getFileMd5(t,(function(e,t){n(t)})):n()},getFileMd5:function(e,t){var n=c(e);return t&&t(n),n},binaryBase64:function(e){var t,n,i,o="";for(t=0,n=e.length/2;t<n;t++)i=parseInt(e[2*t]+e[2*t+1],16),o+=String.fromCharCode(i);return d(o)},extend:k,isArray:D,isInArray:function(e,t){for(var n=!1,i=0;i<e.length;i++)if(t===e[i]){n=!0;break}return n},makeArray:function(e){return D(e)?e:[e]},each:O,map:b,filter:function(e,t){var n=D(e),i=n?[]:{};for(var o in e)e.hasOwnProperty(o)&&t(e[o],o)&&(n?i.push(e[o]):i[o]=e[o]);return i},clone:T,attr:function(e,t,n){return e&&t in e?e[t]:n},uuid:function(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},camSafeUrlEncode:I,throttleOnProgress:function(e,t){var n,i,o=this,s=0,a=0,r=Date.now();function c(){if(i=0,t&&"function"==typeof t){n=Date.now();var o,c=Math.max(0,Math.round((a-s)/((n-r)/1e3)*100)/100)||0;o=0===a&&0===e?1:Math.floor(a/e*100)/100||0,r=n,s=a;try{t({loaded:a,total:e,speed:c,percent:o})}catch(u){}}}return function(t,n){if(t&&(a=t.loaded,e=t.total),n)clearTimeout(i),c();else{if(i)return;i=setTimeout(c,o.options.ProgressInterval)}}},getFileSize:w,getFileSizeByPath:function(e){return new Promise((function(t,n){p.stat({path:e,success:function(e){var n=e.stats,i=n.isDirectory()?0:n.size;t(i)},fail:function(e){n((null==e?void 0:e.errMsg)||"")}})}))},getSkewTime:U,obj2str:function(e,t){var n,i,o,s=[],a=M(e);for(n=0;n<a.length;n++)o=void 0===e[i=a[n]]||null===e[i]?"":""+e[i],i=t?I(i).toLowerCase():I(i),o=I(o)||"",s.push(i+"="+o);return s.join("&")},getAuth:function(e){var t,n=(e=e||{}).SecretId,i=e.SecretKey,o=e.KeyTime,s=(e.method||e.Method||"get").toLowerCase(),a=T(e.Query||e.params||{}),r=function(e){var t={};for(var n in e){var i=n.toLowerCase();(i.indexOf("x-cos-")>-1||i.indexOf("x-ci-")>-1||C.indexOf(i)>-1)&&(t[n]=e[n])}return t}(T(e.Headers||e.headers||{})),c=e.Key||"";e.UseRawKey?t=e.Pathname||e.pathname||"/"+c:0!==(t=e.Pathname||e.pathname||c).indexOf("/")&&(t="/"+t);var l=!1!==e.ForceSignHost;if(!r.Host&&!r.host&&e.Bucket&&e.Region&&l&&(r.Host=e.Bucket+".cos."+e.Region+".myqcloud.com"),n&&i){var d=Math.round(U(e.SystemClockOffset)/1e3)-1,p=d,h=e.Expires||e.expires;p+=void 0===h?900:1*h||0;var g=n,f=o||d+";"+p,m=o||d+";"+p,_=M(r,!0).join(";").toLowerCase(),v=M(a,!0).join(";").toLowerCase(),y=u.HmacSHA1(m,i).toString(),I=[s,t,F.obj2str(a,!0),F.obj2str(r,!0),""].join("\n"),S=["sha1",f,u.SHA1(I).toString(),""].join("\n");return["q-sign-algorithm=sha1","q-ak="+g,"q-sign-time="+f,"q-key-time="+m,"q-header-list="+_,"q-url-param-list="+v,"q-signature="+u.HmacSHA1(S,y).toString()].join("&")}},compareVersion:G,canFileSlice:x,isCIHost:function(e){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(e)},error:function(e,t){var n=e;return e.message=e.message||null,"string"==typeof t?(e.error=t,e.message=t):"object"===r(t)&&null!==t&&(k(e,t),(t.code||t.name)&&(e.code=t.code||t.name),t.message&&(e.message=t.message),t.stack&&(e.stack=t.stack)),"function"==typeof Object.defineProperty&&(Object.defineProperty(e,"name",{writable:!0,enumerable:!1}),Object.defineProperty(e,"message",{enumerable:!0})),e.name=t&&t.name||e.name||e.code||"Error",e.code||(e.code=e.name),e.error||(e.error=T(n)),e},getSourceParams:function(e){var t=this.options.CopySourceParser;if(t)return t(e);var n=e.match(/^([^.]+-\d+)\.cos(v6|-cdc|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/);return n?{Bucket:n[1],Region:n[3],Key:n[7]}:null},encodeBase64:function(e,t){var n=l.encode(e);return t&&(n=n.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),n},simplifyPath:function(e){var t,n=[],o=i(e.split("/"));try{for(o.s();!(t=o.n()).done;){var s=t.value;".."===s?n.length&&n.pop():s.length&&"."!==s&&n.push(s)}}catch(a){o.e(a)}finally{o.f()}return"/"+n.join("/")},arrayBufferToString:function(e){return new TextDecoder("utf-8").decode(e)},parseResBody:function(e){var t;if(e&&"string"==typeof e){var n=e.trim(),i=0===n.indexOf("<"),o=0===n.indexOf("{");if(i)t=F.xml2json(e)||{};else if(o)try{var s=e.replace(/\n/g," "),a=JSON.parse(s);t="[object Object]"===Object.prototype.toString.call(a)?a:e}catch(r){t=e}else t=e}else t=e||{};return t}};e.exports=F},function(e,t,n){const i=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o="["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",s=new RegExp("^"+o+"$");t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s<o;s++)e[i[s]]="strict"===n?[t[i[s]]]:t[i[s]]}},t.getValue=function(e){return t.isExist(e)?e:""},t.isName=function(e){return!(null==s.exec(e))},t.getAllMatches=function(e,t){const n=[];let i=t.exec(e);for(;i;){const o=[];o.startIndex=t.lastIndex-i[0].length;const s=i.length;for(let e=0;e<s;e++)o.push(i[e]);n.push(o),i=t.exec(e)}return n},t.nameRegexp=o},function(e,t,n){function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
o=function(){return t};var e,t={},n=Object.prototype,s=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},r="function"==typeof Symbol?Symbol:{},c=r.iterator||"@@iterator",u=r.asyncIterator||"@@asyncIterator",l=r.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(N){d=function(e,t,n){return e[t]=n}}function p(e,t,n,i){var o=t&&t.prototype instanceof y?t:y,s=Object.create(o.prototype),r=new L(i||[]);return a(s,"_invoke",{value:R(e,n,r)}),s}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(i){return{type:"throw",arg:i}}}t.wrap=p;var g="suspendedStart",f="suspendedYield",m="executing",_="completed",v={};function y(){}function I(){}function M(){}var C={};d(C,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(P([])));E&&E!==n&&s.call(E,c)&&(C=E);var T=M.prototype=y.prototype=Object.create(C);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function D(e,t){function n(o,a,r,c){var u=h(e[o],e,a);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==i(d)&&s.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,r,c)}),(function(e){n("throw",e,r,c)})):t.resolve(d).then((function(e){l.value=e,r(l)}),(function(e){return n("throw",e,r,c)}))}c(u.arg)}var o;a(this,"_invoke",{value:function(e,i){function s(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(s,s):s()}})}function R(t,n,i){var o=g;return function(s,a){if(o===m)throw Error("Generator is already running");if(o===_){if("throw"===s)throw a;return{value:e,done:!0}}for(i.method=s,i.arg=a;;){var r=i.delegate;if(r){var c=O(r,i);if(c){if(c===v)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===g)throw o=_,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=m;var u=h(t,n,i);if("normal"===u.type){if(o=i.done?_:f,u.arg===v)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(o=_,i.method="throw",i.arg=u.arg)}}}function O(t,n){var i=n.method,o=t.iterator[i];if(o===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),v;var s=h(o,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,v;var a=s.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(s.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(i(t)+" is not iterable")}return I.prototype=M,a(T,"constructor",{value:M,configurable:!0}),a(M,"constructor",{value:I,configurable:!0}),I.displayName=d(M,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===I||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,M):(e.__proto__=M,d(e,l,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},k(D.prototype),d(D.prototype,u,(function(){return this})),t.AsyncIterator=D,t.async=function(e,n,i,o,s){void 0===s&&(s=Promise);var a=new D(p(e,n,i,o),s);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(T),d(T,l,"Generator"),d(T,c,(function(){return this})),d(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&s.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(i,o){return r.type="throw",r.arg=t,n.next=i,o&&(n.method="next",n.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],r=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),u=s.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function s(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){s(a,i,o,r,c,"next",e)}function c(e){s(a,i,o,r,c,"throw",e)}r(void 0)}))}}function r(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,u(i.key),i)}}function u(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=i(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}var l=n(3),d=null,p=function(e){return!e||e<0?0:(e/1e3).toFixed(3)},h=function(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},g=function(){return new Promise((function(e){if(Pn.canIUse("getNetworkType"))try{Pn.getNetworkType({success:function(t){e(t.networkType)}})}catch(t){e("can_not_get_network_type")}else e("can_not_get_network_type")}))},f=function(){var e={devicePlatform:"can_not_get_system_info",wxVersion:"can_not_get_system_info",wxSystem:"can_not_get_system_info",wxSdkVersion:"can_not_get_system_info"},t={},n={};Pn.canIUse("getAppBaseInfo")&&(t=Pn.getAppBaseInfo()||{}),Pn.canIUse("getDeviceInfo")&&(n=Pn.getDeviceInfo()||{});var i=t.SDKVersion||"can_not_get_system_info",o=t.version||"can_not_get_system_info",s=n.platform||"can_not_get_system_info",a=n.system||"can_not_get_system_info";return Object.assign(e,{devicePlatform:s,wxVersion:o,wxSystem:a,wxSdkVersion:i}),e}();function m(e){return e.replace(/([A-Z])/g,"_$1").toLowerCase()}function _(e){var t,n={},i=["sdkVersionName","sdkVersionCode","osName","networkType","requestName","requestResult","bucket","region","appid","accelerate","url","host","requestPath","userAgent","httpMethod","httpSize","httpSpeed","httpTookTime","httpMd5","httpSign","httpFullTime","httpDomain","partNumber","httpRetryTimes","customId","traceId","realApi"],o=[].concat(i,["errorNode","errorCode","errorName","errorMessage","errorRequestId","errorHttpCode","errorServiceName","errorType","fullError"]),s="Success"===e.requestResult?i:o;for(var a in e)s.includes(a)&&(n[m(a)]=e[a]);return n.request_name=e.realApi?(t=e.realApi,["putObject","sliceUploadFile","uploadFile","uploadFiles"].includes(t)?"UploadTask":"getObject"===t?"DownloadTask":["putObjectCopy","sliceCopyFile"].includes(t)?"CopyTask":t):e.requestName,n}var v=function(){function e(t){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var i=t.parent,o=t.traceId,s=t.bucket,a=t.region,c=t.apiName,u=t.realApi,p=t.httpMethod,g=t.fileKey,m=t.fileSize,_=t.accelerate,v=t.customId,y=t.delay,I=t.deepTracker,M=t.Beacon,C=t.clsReporter,S=s&&s.substr(s.lastIndexOf("-")+1)||"";this.parent=i,this.deepTracker=I,this.delay=y,C&&!this.clsReporter&&(this.clsReporter=C),this.params=(r(n={sdkVersionName:"cos-wx-sdk-v5",sdkVersionCode:l.version,osName:f.devicePlatform,networkType:"",requestName:c||"",requestResult:"",realApi:u,bucket:s,region:a,accelerate:_,httpMethod:p,url:"",host:"",httpDomain:"",requestPath:g||"",errorType:"",errorCode:"",errorName:"",errorMessage:"",errorRequestId:"",errorHttpCode:0,errorServiceName:"",errorNode:"",httpTookTime:0,httpSize:m||0,httpMd5:0,httpSign:0,httpFullTime:0,httpSpeed:0,size:m||0},"httpMd5",0),r(n,"httpSign",0),r(n,"httpFull",0),r(n,"name",c||""),r(n,"tookTime",0),r(n,"md5StartTime",0),r(n,"md5EndTime",0),r(n,"signStartTime",0),r(n,"signEndTime",0),r(n,"httpStartTime",0),r(n,"httpEndTime",0),r(n,"startTime",(new Date).getTime()),r(n,"endTime",0),r(n,"traceId",o||h()),r(n,"appid",S),r(n,"partNumber",0),r(n,"httpRetryTimes",0),r(n,"customId",v||""),r(n,"partTime",0),n),M&&(this.beacon=function(e,t){if(!d){if("function"!=typeof e)throw new Error("Beacon not found");d=new e({appkey:"0WEB05PY6MHRGK0U",versionCode:l.version,channelID:"mp_sdk",openid:"openid",unionid:"unid",strictMode:!1,delay:t,sessionDuration:6e4})}return d}(M,y))}var t,n,i,s;return t=e,n=[{key:"formatResult",value:(s=a(o().mark((function e(t,n){var i,s,a,r,c,u,l,d,h,f,m,_,v,y,I,M,C,S,E,T,k,D,R,O,b,A,L;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=(new Date).getTime(),e.next=3,g();case 3:if(m=e.sent,_=t?(null==t||null===(i=t.error)||void 0===i||null===(s=i.error)||void 0===s?void 0:s.Code)||"Error":"",v=t&&((null==t||null===(a=t.error)||void 0===a||null===(r=a.error)||void 0===r?void 0:r.Message)||(null==t||null===(c=t.error)||void 0===c?void 0:c.error)||(null==t?void 0:t.error))||"",y=v,I=t?null==t||null===(u=t.error)||void 0===u?void 0:u.statusCode:n.statusCode,M=t?null==t||null===(l=t.error)||void 0===l||null===(d=l.error)||void 0===d?void 0:d.Resource:"",C=t?(null==t||null===(h=t.error)||void 0===h?void 0:h.RequestId)||"":(null==n?void 0:n.RequestId)||"",S=t?C?"Server":"Client":"","getObject"===this.params.requestName&&(this.params.httpSize=n?n.headers&&n.headers["content-length"]:0),E="sliceUploadFile"===this.params.realApi,T="sliceCopyFile"===this.params.realApi,E||T?(k=this.params.httpSize/1024/this.params.partTime,Object.assign(this.params,{httpSpeed:k<0?0:k.toFixed(3)})):(D=f-this.params.startTime,R=this.params.httpEndTime-this.params.httpStartTime,O=this.params.httpSize/1024/(R/1e3),b=this.params.md5EndTime-this.params.md5StartTime,A=this.params.signEndTime-this.params.signStartTime,this.parent&&(this.parent.addParamValue("httpTookTime",p(R)),this.parent.addParamValue("httpFullTime",p(D)),this.parent.addParamValue("httpMd5",p(b)),this.parent.addParamValue("httpSign",p(A)),["multipartUpload","uploadPartCopy","putObjectCopy"].includes(this.params.requestName)&&this.parent.addParamValue("partTime",p(R))),Object.assign(this.params,{httpFullTime:p(D),httpMd5:p(b),httpSign:p(A),httpTookTime:p(R),httpSpeed:O<0?0:O.toFixed(3)})),Object.assign(this.params,{networkType:m,requestResult:t?"Failure":"Success",errorType:S,errorCode:_,errorHttpCode:I,errorName:y,errorMessage:v,errorServiceName:M,errorRequestId:C}),!t||_&&v||(this.params.fullError=t?JSON.stringify(t):""),"getObject"===this.params.name&&(this.params.size=n?n.headers&&n.headers["content-length"]:-1),this.params.url){try{L=/^http(s)?:\/\/(.*?)\//.exec(this.params.url),this.params.host=L[2]}catch(o){this.params.host=this.params.url}this.params.httpDomain=this.params.host}case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"report",value:(i=a(o().mark((function e(t,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.beacon||this.clsReporter){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.formatResult(t,n);case 4:i=_(this.params),this.beacon&&this.sendEventsToBeacon(i),this.clsReporter&&this.sendEventsToCLS(i);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setParams",value:function(e){Object.assign(this.params,e)}},{key:"addParamValue",value:function(e,t){this.params[e]=(+this.params[e]+ +t).toFixed(3)}},{key:"sendEventsToBeacon",value:function(e){if("sliceUploadFile"!==this.params.requestName&&"sliceUploadFile"!==this.params.realApi||this.deepTracker){var t="qcloud_track_cos_sdk";0===this.delay?this.beacon&&this.beacon.onDirectUserAction(t,e):this.beacon&&this.beacon.onUserAction(t,e)}}},{key:"sendEventsToCLS",value:function(e){var t=!(0!==this.delay);this.clsReporter.log(e,t)}},{key:"generateSubTracker",value:function(t){return Object.assign(t,{parent:this,deepTracker:this.deepTracker,traceId:this.params.traceId,bucket:this.params.bucket,region:this.params.region,accelerate:this.params.accelerate,fileKey:this.params.requestPath,customId:this.params.customId,delay:this.params.delay,clsReporter:this.clsReporter}),new e(t)}}],n&&c(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.exports=v},function(e){e.exports=JSON.parse('{"name":"cos-wx-sdk-v5","version":"1.8.0","description":"小程序 SDK for [腾讯云对象存储服务](https://cloud.tencent.com/product/cos)","main":"dist/cos-wx-sdk-v5.min.js","scripts":{"prettier":"prettier --write src demo/demo-sdk.js demo/test.js demo/ciDemo","dev":"cross-env NODE_ENV=development node build.js --mode=development","build":"cross-env NODE_ENV=production node build.js --mode=production","sts.js":"node server/sts.js","postinstall":"patch-package"},"repository":{"type":"git","url":"http://github.com/tencentyun/cos-wx-sdk-v5.git"},"author":"carsonxu","license":"ISC","dependencies":{"fast-xml-parser":"4.5.0","mime":"^2.4.6"},"devDependencies":{"@babel/core":"7.17.9","@babel/preset-env":"7.16.11","babel-loader":"8.2.5","body-parser":"^1.18.3","cross-env":"^7.0.3","express":"^4.17.1","patch-package":"^8.0.0","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.2","terser-webpack-plugin":"4.2.3","webpack":"4.46.0","webpack-cli":"4.10.0"}}')},function(e,t,n){const i=n(1),o={allowBooleanAttributes:!1,unpairedTags:[]};function s(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function a(e,t){const n=t;for(;t<e.length;t++)if("?"!=e[t]&&" "!=e[t]);else{const i=e.substr(n,t-n);if(t>5&&"xml"===i)return g("InvalidXml","XML declaration allowed only at the start of the document.",m(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function r(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t<e.length;t++)if("<"===e[t])n++;else if(">"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}t.validate=function(e,t){t=Object.assign({},o,t);const n=[];let c=!1,u=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=a(e,o),o.err)return o}else{if("<"!==e[o]){if(s(e[o]))continue;return g("InvalidChar","char '"+e[o]+"' is not expected.",m(e,o))}{let f=o;if(o++,"!"===e[o]){o=r(e,o);continue}{let _=!1;"/"===e[o]&&(_=!0,o++);let v="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)v+=e[o];if(v=v.trim(),"/"===v[v.length-1]&&(v=v.substring(0,v.length-1),o--),d=v,!i.isName(d)){let t;return t=0===v.trim().length?"Invalid space after '<'.":"Tag '"+v+"' is an invalid name.",g("InvalidTag",t,m(e,o))}const y=l(e,o);if(!1===y)return g("InvalidAttr","Attributes for '"+v+"' have open quote.",m(e,o));let I=y.value;if(o=y.index,"/"===I[I.length-1]){const n=o-I.length;I=I.substring(0,I.length-1);const i=p(I,t);if(!0!==i)return g(i.err.code,i.err.msg,m(e,n+i.err.line));c=!0}else if(_){if(!y.tagClosed)return g("InvalidTag","Closing tag '"+v+"' doesn't have proper closing.",m(e,o));if(I.trim().length>0)return g("InvalidTag","Closing tag '"+v+"' can't have attributes or invalid starting.",m(e,f));if(0===n.length)return g("InvalidTag","Closing tag '"+v+"' has not been opened.",m(e,f));{const t=n.pop();if(v!==t.tagName){let n=m(e,t.tagStartPos);return g("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+v+"'.",m(e,f))}0==n.length&&(u=!0)}}else{const i=p(I,t);if(!0!==i)return g(i.err.code,i.err.msg,m(e,o-I.length+i.err.line));if(!0===u)return g("InvalidXml","Multiple possible root nodes found.",m(e,o));-1!==t.unpairedTags.indexOf(v)||n.push({tagName:v,tagStartPos:f}),c=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=r(e,o);continue}if("?"!==e[o+1])break;if(o=a(e,++o),o.err)return o}else if("&"===e[o]){const t=h(e,o);if(-1==t)return g("InvalidChar","char '&' is not expected.",m(e,o));o=t}else if(!0===u&&!s(e[o]))return g("InvalidXml","Extra text at the end",m(e,o));"<"===e[o]&&o--}}}var d;return c?1==n.length?g("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",m(e,n[0].tagStartPos)):!(n.length>0)||g("InvalidXml","Invalid '"+JSON.stringify(n.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):g("InvalidXml","Start tag expected.",1)};const c='"',u="'";function l(e,t){let n="",i="",o=!1;for(;t<e.length;t++){if(e[t]===c||e[t]===u)""===i?i=e[t]:i!==e[t]||(i="");else if(">"===e[t]&&""===i){o=!0;break}n+=e[t]}return""===i&&{value:n,index:t,tagClosed:o}}const d=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function p(e,t){const n=i.getAllMatches(e,d),o={};for(let i=0;i<n.length;i++){if(0===n[i][1].length)return g("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",_(n[i]));if(void 0!==n[i][3]&&void 0===n[i][4])return g("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",_(n[i]));if(void 0===n[i][3]&&!t.allowBooleanAttributes)return g("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",_(n[i]));const e=n[i][2];if(!f(e))return g("InvalidAttr","Attribute '"+e+"' is an invalid name.",_(n[i]));if(o.hasOwnProperty(e))return g("InvalidAttr","Attribute '"+e+"' is repeated.",_(n[i]));o[e]=1}return!0}function h(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let n=/\d/;for("x"===e[t]&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(";"===e[t])break;return-1}return t}function g(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function f(e){return i.isName(e)}function m(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function _(e){return e.startIndex+e[1].length}},function(e,t){e.exports=function(e){return"function"==typeof e?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1}},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){n(e).push(t)},e.off=function(e,t){for(var i=n(e),o=i.length-1;o>=0;o--)t===i[o]&&i.splice(o,1)},e.emit=function(e,t){for(var i=n(e).map((function(e){return e})),o=0;o<i.length;o++)i[o](t)}};e.exports.init=n,e.exports.EventProxy=function(){n(this)}},function(e,t,n){var i,o,s=n(0),a="cos_sdk_upload_cache",r=function(){try{i.length?Pn.setStorageSync(a,JSON.stringify(i)):Pn.removeStorageSync(a)}catch(e){}},c=function(){if(!i){i=function(){try{var e=JSON.parse(Pn.getStorageSync(a))}catch(t){}return e||(e=[]),e}();for(var e=!1,t=Math.round(Date.now()/1e3),n=i.length-1;n>=0;n--){var o=i[n][2];(!o||o+2592e3<t)&&(i.splice(n,1),e=!0)}e&&r()}},u=function(){o||(o=setTimeout((function(){r(),o=null}),400))},l={using:{},setUsing:function(e){l.using[e]=!0},removeUsing:function(e){delete l.using[e]},getFileId:function(e,t,n,i){return e.FilePath&&e.size&&e.lastModifiedTime&&t?s.md5([e.FilePath].join("::"))+"-"+s.md5([e.size,e.mode,e.lastAccessedTime,e.lastModifiedTime,t,n,i].join("::")):null},getCopyFileId:function(e,t,n,i,o){var a=t["content-length"],r=t.etag||"",c=t["last-modified"];return e&&n?s.md5([e,a,r,c,n,i,o].join("::")):null},getUploadIdList:function(e){if(!e)return null;c();for(var t=[],n=0;n<i.length;n++)i[n][0]===e&&t.push(i[n][1]);return t.length?t:null},saveUploadId:function(e,t,n){if(c(),e){for(var o=e.substr(0,e.indexOf("-")+1),s=i.length-1;s>=0;s--){var a=i[s];(a[0]===e&&a[1]===t||e!==a[0]&&0===a[0].indexOf(o))&&i.splice(s,1)}i.unshift([e,t,Math.round(Date.now()/1e3)]),i.length>n&&i.splice(n),u()}},removeUploadId:function(e){c(),delete l.using[e];for(var t=i.length-1;t>=0;t--)i[t][1]===e&&i.splice(t,1);u()}};e.exports=l},function(e,t,n){var i=n(9);e.exports=i},function(e,t,n){var i=n(0),o=n(6),s=n(25),a=n(26),r=n(32),c=n(3),u={SecretId:"",SecretKey:"",SecurityToken:"",StartTime:0,ExpiredTime:0,ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1048576,SliceSize:1048576,CopyChunkParallelLimit:20,CopyChunkSize:10485760,CopySliceSize:10485760,MaxPartNumber:1e4,ProgressInterval:1e3,UploadQueueSize:1e4,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,HttpDNSServiceId:"",SimpleUploadMethod:"postObject",AutoSwitchHost:!1,CopySourceParser:null,ObjectKeySimplifyCheck:!0,DeepTracker:!1,TrackerDelay:5e3,CustomId:"",BeaconReporter:null,ClsReporter:null},l=function(e){if(this.options=i.extend(i.clone(u),e||{}),this.options.FileParallelLimit=Math.max(1,this.options.FileParallelLimit),this.options.ChunkParallelLimit=Math.max(1,this.options.ChunkParallelLimit),this.options.ChunkRetryTimes=Math.max(0,this.options.ChunkRetryTimes),this.options.ChunkSize=Math.max(1048576,this.options.ChunkSize),this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit),this.options.CopyChunkSize=Math.max(1048576,this.options.CopyChunkSize),this.options.CopySliceSize=Math.max(0,this.options.CopySliceSize),this.options.MaxPartNumber=Math.max(1024,Math.min(1e4,this.options.MaxPartNumber)),this.options.Timeout=Math.max(0,this.options.Timeout),this.options.EnableReporter=this.options.BeaconReporter||this.options.ClsReporter,this.options.AppId,this.options.SecretId&&this.options.SecretId.indexOf(" "),this.options.SecretKey&&this.options.SecretKey.indexOf(" "),this.options.ForcePathStyle)throw new Error("ForcePathStyle is not supported");o.init(this),s.init(this)};a.init(l,s),r.init(l,s),l.util={md5:i.md5,xml2json:i.xml2json,json2xml:i.json2xml,encodeBase64:i.encodeBase64},l.getAuthorization=i.getAuth,l.version=c.version,e.exports=l},function(e,t,n){(function(e){var t;function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){var o="input is invalid type",s="object"===("undefined"==typeof window?"undefined":i(window)),a=s?window:{};a.JS_MD5_NO_WINDOW&&(s=!1),!s&&"object"===("undefined"==typeof self?"undefined":i(self))&&(a=self);var r,c=!a.JS_MD5_NO_COMMON_JS&&"object"===i(e)&&e.exports,u=n(12),l=!a.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[128,32768,8388608,-2147483648],h=[0,8,16,24],g=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),m=[];if(l){var _=new ArrayBuffer(68);r=new Uint8Array(_),m=new Uint32Array(_)}!a.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!l||!a.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===i(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});var v=function(e){return function(t){return new y(!0).update(t)[e]()}};function y(e){if(e)m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m,this.buffer8=r;else if(l){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}y.prototype.update=function(e){if(!this.finalized){var t,n=i(e);if("string"!==n){if("object"!==n)throw o;if(null===e)throw o;if(!l||e.constructor!==ArrayBuffer&&"ArrayBuffer"!==e.constructor.name){if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw o}else e=new Uint8Array(e);t=!0}for(var s,a,r=0,c=e.length,u=this.blocks,d=this.buffer8;r<c;){if(this.hashed&&(this.hashed=!1,u[0]=u[16],u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),t)if(l)for(a=this.start;r<c&&a<64;++r)d[a++]=e[r];else for(a=this.start;r<c&&a<64;++r)u[a>>2]|=e[r]<<h[3&a++];else if(l)for(a=this.start;r<c&&a<64;++r)(s=e.charCodeAt(r))<128?d[a++]=s:s<2048?(d[a++]=192|s>>6,d[a++]=128|63&s):s<55296||s>=57344?(d[a++]=224|s>>12,d[a++]=128|s>>6&63,d[a++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++r)),d[a++]=240|s>>18,d[a++]=128|s>>12&63,d[a++]=128|s>>6&63,d[a++]=128|63&s);else for(a=this.start;r<c&&a<64;++r)(s=e.charCodeAt(r))<128?u[a>>2]|=s<<h[3&a++]:s<2048?(u[a>>2]|=(192|s>>6)<<h[3&a++],u[a>>2]|=(128|63&s)<<h[3&a++]):s<55296||s>=57344?(u[a>>2]|=(224|s>>12)<<h[3&a++],u[a>>2]|=(128|s>>6&63)<<h[3&a++],u[a>>2]|=(128|63&s)<<h[3&a++]):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++r)),u[a>>2]|=(240|s>>18)<<h[3&a++],u[a>>2]|=(128|s>>12&63)<<h[3&a++],u[a>>2]|=(128|s>>6&63)<<h[3&a++],u[a>>2]|=(128|63&s)<<h[3&a++]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},y.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=p[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},y.prototype.hash=function(){var e,t,n,i,o,s,a=this.blocks;this.first?t=((t=((e=((e=a[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(i=((i=(-1732584194^2004318071&e)+a[1]-117830708)<<12|i>>>20)+e|0)&(-271733879^e))+a[2]-1126478375)<<17|n>>>15)+i|0)&(i^e))+a[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((i=this.h3)^t&(n^i))+a[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[1]-389564586)<<12|i>>>20)+e|0)&(e^t))+a[2]+606105819)<<17|n>>>15)+i|0)&(i^e))+a[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(i^t&(n^i))+a[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[5]+1200080426)<<12|i>>>20)+e|0)&(e^t))+a[6]-1473231341)<<17|n>>>15)+i|0)&(i^e))+a[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+a[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[9]-1958414417)<<12|i>>>20)+e|0)&(e^t))+a[10]-42063)<<17|n>>>15)+i|0)&(i^e))+a[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+a[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[13]-40341101)<<12|i>>>20)+e|0)&(e^t))+a[14]-1502002290)<<17|n>>>15)+i|0)&(i^e))+a[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[1]-165796510)<<5|e>>>27)+t|0)^t))+a[6]-1069501632)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[11]+643717713)<<14|n>>>18)+i|0)^i))+a[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[5]-701558691)<<5|e>>>27)+t|0)^t))+a[10]+38016083)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[15]-660478335)<<14|n>>>18)+i|0)^i))+a[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[9]+568446438)<<5|e>>>27)+t|0)^t))+a[14]-1019803690)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[3]-187363961)<<14|n>>>18)+i|0)^i))+a[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[13]-1444681467)<<5|e>>>27)+t|0)^t))+a[2]-51403784)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[7]+1735328473)<<14|n>>>18)+i|0)^i))+a[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[5]-378558)<<4|e>>>28)+t|0))+a[8]-2022574463)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[11]+1839030562)<<16|n>>>16)+i|0))+a[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[1]-1530992060)<<4|e>>>28)+t|0))+a[4]+1272893353)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[7]-155497632)<<16|n>>>16)+i|0))+a[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[13]+681279174)<<4|e>>>28)+t|0))+a[0]-358537222)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[3]-722521979)<<16|n>>>16)+i|0))+a[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[9]-640364487)<<4|e>>>28)+t|0))+a[12]-421815835)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[15]+530742520)<<16|n>>>16)+i|0))+a[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[0]-198630844)<<6|e>>>26)+t|0)|~n))+a[7]+1126891415)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[14]-1416354905)<<15|n>>>17)+i|0)|~e))+a[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[12]+1700485571)<<6|e>>>26)+t|0)|~n))+a[3]-1894986606)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[10]-1051523)<<15|n>>>17)+i|0)|~e))+a[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[8]+1873313359)<<6|e>>>26)+t|0)|~n))+a[15]-30611744)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[6]-1560198380)<<15|n>>>17)+i|0)|~e))+a[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[4]-145523070)<<6|e>>>26)+t|0)|~n))+a[11]-1120210379)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[2]+718787259)<<15|n>>>17)+i|0)|~e))+a[9]-343485551)<<21|t>>>11)+n|0,this.first?(this.h0=e+1732584193|0,this.h1=t-271733879|0,this.h2=n-1732584194|0,this.h3=i+271733878|0,this.first=!1):(this.h0=this.h0+e|0,this.h1=this.h1+t|0,this.h2=this.h2+n|0,this.h3=this.h3+i|0)},y.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return d[e>>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15]+d[t>>4&15]+d[15&t]+d[t>>12&15]+d[t>>8&15]+d[t>>20&15]+d[t>>16&15]+d[t>>28&15]+d[t>>24&15]+d[n>>4&15]+d[15&n]+d[n>>12&15]+d[n>>8&15]+d[n>>20&15]+d[n>>16&15]+d[n>>28&15]+d[n>>24&15]+d[i>>4&15]+d[15&i]+d[i>>12&15]+d[i>>8&15]+d[i>>20&15]+d[i>>16&15]+d[i>>28&15]+d[i>>24&15]},y.prototype.toString=y.prototype.hex,y.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},y.prototype.array=y.prototype.digest,y.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},y.prototype.buffer=y.prototype.arrayBuffer,y.prototype.base64=function(){for(var e,t,n,i="",o=this.array(),s=0;s<15;)e=o[s++],t=o[s++],n=o[s++],i+=f[e>>>2]+f[63&(e<<4|t>>>4)]+f[63&(t<<2|n>>>6)]+f[63&n];return e=o[s],i+(f[e>>>2]+f[e<<4&63]+"==")};var I=function(){var e=v("hex");e.getCtx=e.create=function(){return new y},e.update=function(t){return e.create().update(t)};for(var t=0;t<g.length;++t){var n=g[t];e[n]=v(n)}return e}();c?e.exports=I:(a.md5=I,u&&(void 0===(t=function(){return I}.call(I,n,I,e))||(e.exports=t)))}()}).call(this,n(11)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t){var n,i,o,s,a,r,c,u,l,d=d||function(e){var t={},n=t.lib={},i=function(){},o=n.Base={extend:function(e){i.prototype=this;var t=new i;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=n.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||r).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var o=0;o<e;o++)t[i+o>>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(i+o)%4*8;else if(65535<n.length)for(o=0;o<e;o+=4)t[i+o>>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i<t;i+=4)n.push(4294967296*e.random()|0);return new s.init(n,t)}}),a=t.enc={},r=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i<e;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i<e;i++)n.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},l=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,r=o/(4*a);if(t=(r=t?e.ceil(r):e.max((0|r)-this._minBufferSize,0))*a,o=e.min(4*t,o),t){for(var c=0;c<t;c+=a)this._doProcessBlock(i,c);c=i.splice(0,t),n.sigBytes-=o}return new s.init(c,o)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});n.Hasher=l.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new d.HMAC.init(e,n).finalize(t)}}});var d=t.algo={};return t}(Math);i=(a=(n=d).lib).WordArray,o=a.Hasher,s=[],a=n.algo.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],a=n[2],r=n[3],c=n[4],u=0;80>u;u++){if(16>u)s[u]=0|e[t+u];else{var l=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=l<<1|l>>>31}l=(i<<5|i>>>27)+c+s[u],l=20>u?l+(1518500249+(o&a|~o&r)):40>u?l+(1859775393+(o^a^r)):60>u?l+((o&a|o&r|a&r)-1894007588):l+((o^a^r)-899497514),c=r,r=a,a=o<<30|o>>>2,o=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+r|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=o._createHelper(a),n.HmacSHA1=o._createHmacHelper(a),l=(u=d).enc.Utf8,u.algo.HMAC=u.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=l.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,r=s.words,c=0;c<n;c++)a[c]^=1549556828,r[c]^=909522486;o.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}}),c=(r=d).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,i=this._map;e.clamp();for(var o=[],s=0;s<n;s+=3)for(var a=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,r=0;r<4&&s+.75*r<n;r++)o.push(i.charAt(a>>>6*(3-r)&63));var c=i.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,i=n.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(t=o)}for(var s=[],a=0,r=0;r<t;r++)if(r%4){var u=n.indexOf(e.charAt(r-1))<<r%4*2,l=n.indexOf(e.charAt(r))>>>6-r%4*2;s[a>>>2]|=(u|l)<<24-a%4*8,a++}return c.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.exports=d},function(e,t){var n,i,o,s,a,r,c,u,l,d,p,h,g,f,m,_,v,y,I,M=(i=(n=n||{}).Base64,s=function(e){for(var t={},n=0,i=e.length;n<i;n++)t[e.charAt(n)]=n;return t}(o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),a=String.fromCharCode,r=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?a(192|t>>>6)+a(128|63&t):a(224|t>>>12&15)+a(128|t>>>6&63)+a(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return a(240|t>>>18&7)+a(128|t>>>12&63)+a(128|t>>>6&63)+a(128|63&t)},c=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,u=function(e){return e.replace(c,r)},l=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[o.charAt(n>>>18),o.charAt(n>>>12&63),t>=2?"=":o.charAt(n>>>6&63),t>=1?"=":o.charAt(63&n)].join("")},d=n.btoa?function(e){return n.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,l)},p=function(e){return d(u(e))},h=function(e,t){return t?p(String(e)).replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,""):p(String(e))},g=new RegExp(["[À-ß][€-¿]","[à-ï][€-¿]{2}","[ð-÷][€-¿]{3}"].join("|"),"g"),f=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return a(55296+(t>>>10))+a(56320+(1023&t));case 3:return a((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return a((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},m=function(e){return e.replace(g,f)},_=function(e){var t=e.length,n=t%4,i=(t>0?s[e.charAt(0)]<<18:0)|(t>1?s[e.charAt(1)]<<12:0)|(t>2?s[e.charAt(2)]<<6:0)|(t>3?s[e.charAt(3)]:0),o=[a(i>>>16),a(i>>>8&255),a(255&i)];return o.length-=[0,0,2,1][n],o.join("")},v=n.atob?function(e){return n.atob(e)}:function(e){return e.replace(/[\s\S]{1,4}/g,_)},y=function(e){return m(v(e))},{VERSION:"2.1.9",atob:v,btoa:d,fromBase64:I=function(e){return y(String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))},toBase64:h,utob:u,encode:h,encodeURI:function(e){return h(e,!0)},btou:m,decode:I,noConflict:function(){var e=n.Base64;return n.Base64=i,e}});e.exports=M},function(e,t,n){const i=n(4),o=n(16),s=n(23);e.exports={XMLParser:o,XMLValidator:i,XMLBuilder:s}},function(e,t,n){const{buildOptions:i}=n(17),o=n(18),{prettify:s}=n(22),a=n(4);e.exports=class{constructor(e){this.externalEntities={},this.options=i(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=a.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new o(this.options);n.addExternalEntities(this.externalEntities);const i=n.parseXml(e);return this.options.preserveOrder||void 0===i?i:s(i,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},function(e,t){const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};t.buildOptions=function(e){return Object.assign({},n,e)},t.defaultOptions=n},function(e,t,n){const i=n(1),o=n(19),s=n(20),a=n(21),r=n(5);function c(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const i=t[n];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:e[i]}}}function u(e,t,n,i,o,s,a){if(void 0!==e&&(this.options.trimValues&&!i&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return null==i?e:typeof i!=typeof e||i!==e?i:this.options.trimValues||e.trim()===e?M(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function l(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const d=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function p(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=i.getAllMatches(e,d),o=n.length,s={};for(let e=0;e<o;e++){const i=this.resolveNameSpace(n[e][1]);if(this.ignoreAttributesFn(i,t))continue;let o=n[e][4],a=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),"__proto__"===a&&(a="#__proto__"),void 0!==o){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);const e=this.options.attributeValueProcessor(i,o,t);s[a]=null==e?o:typeof e!=typeof o||e!==o?e:M(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[a]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=s,e}return s}}const h=function(e){const t=new o("!xml");let n=t,i="",a="";for(let r=0;r<e.length;r++)if("<"===e[r])if("/"===e[r+1]){const t=v(e,">",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&(i=this.saveTextToParentTag(i,n,a));const s=a.substring(a.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=a.lastIndexOf(".",a.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=a.lastIndexOf("."),a=a.substring(0,c),n=this.tagsNodeStack.pop(),i="",r=t}else if("?"===e[r+1]){let t=y(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,a),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new o(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,a,t.tagName)),this.addChild(n,e,a)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=v(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);i=this.saveTextToParentTag(i,n,a),n.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=s(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=v(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);i=this.saveTextToParentTag(i,n,a);let s=this.parseTextData(o,n.tagname,a,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):n.add(this.options.textNodeName,s),r=t+2}else{let s=y(e,r,this.options.removeNSPrefix),c=s.tagName;const u=s.rawTagName;let l=s.tagExp,d=s.attrExpPresent,p=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&i&&"!xml"!==n.tagname&&(i=this.saveTextToParentTag(i,n,a,!1));const h=n;if(h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(n=this.tagsNodeStack.pop(),a=a.substring(0,a.lastIndexOf("."))),c!==t.tagname&&(a+=a?"."+c:c),this.isItStopNode(this.options.stopNodes,a,c)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),a=a.substr(0,a.length-1),l=c):l=l.substr(0,l.length-1),r=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))r=s.closeIndex;else{const n=this.readStopNodeData(e,u,p+1);if(!n)throw new Error(`Unexpected end of ${u}`);r=n.i,t=n.tagContent}const i=new o(c);c!==l&&d&&(i[":@"]=this.buildAttributesMap(l,a,c)),t&&(t=this.parseTextData(t,c,a,!0,d,!0,!0)),a=a.substr(0,a.lastIndexOf(".")),i.add(this.options.textNodeName,t),this.addChild(n,i,a)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),a=a.substr(0,a.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const e=new o(c);c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,a,c)),this.addChild(n,e,a),a=a.substr(0,a.lastIndexOf("."))}else{const e=new o(c);this.tagsNodeStack.push(n),c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,a,c)),this.addChild(n,e,a),n=e}i="",r=p}}else i+=e[r];return t.child};function g(e,t,n){const i=this.options.updateTag(t.tagname,n,t[":@"]);!1===i||("string"==typeof i?(t.tagname=i,e.addChild(t)):e.addChild(t))}const f=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function m(e,t,n,i){return e&&(void 0===i&&(i=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,i))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function _(e,t,n){const i="*."+n;for(const o in e){const n=e[o];if(i===n||t===n)return!0}return!1}function v(e,t,n,i){const o=e.indexOf(t,n);if(-1===o)throw new Error(i);return o+t.length-1}function y(e,t,n,i=">"){const o=function(e,t,n=">"){let i,o="";for(let s=t;s<e.length;s++){let t=e[s];if(i)t===i&&(i="");else if('"'===t||"'"===t)i=t;else if(t===n[0]){if(!n[1])return{data:o,index:s};if(e[s+1]===n[1])return{data:o,index:s}}else"\t"===t&&(t=" ");o+=t}}(e,t+1,i);if(!o)return;let s=o.data;const a=o.index,r=s.search(/\s/);let c=s,u=!0;-1!==r&&(c=s.substring(0,r),s=s.substring(r+1).trimStart());const l=c;if(n){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),u=c!==o.data.substr(e+1))}return{tagName:c,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:l}}function I(e,t,n){const i=n;let o=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const s=v(e,">",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,0===o))return{tagContent:e.substring(i,n),i:s};n=s}else if("?"===e[n+1])n=v(e,"?>",n+1,"StopNode is not closed.");else if("!--"===e.substr(n+1,3))n=v(e,"--\x3e",n+3,"StopNode is not closed.");else if("!["===e.substr(n+1,2))n=v(e,"]]>",n,"StopNode is not closed.")-2;else{const i=y(e,n,">");i&&((i&&i.tagName)===t&&"/"!==i.tagExp[i.tagExp.length-1]&&o++,n=i.closeIndex)}}function M(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&a(e,n)}return i.isExist(e)?e:""}e.exports=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=c,this.parseXml=h,this.parseTextData=u,this.resolveNameSpace=l,this.buildAttributesMap=p,this.isItStopNode=_,this.replaceEntitiesValue=f,this.readStopNodeData=I,this.saveTextToParentTag=m,this.addChild=g,this.ignoreAttributesFn=r(this.options.ignoreAttributes)}}},function(e,t,n){e.exports=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}},function(e,t,n){const i=n(1);function o(e,t){let n="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)n+=e[t];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const i=e[t++];let o="";for(;t<e.length&&e[t]!==i;t++)o+=e[t];return[n,o,t]}function s(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function a(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function r(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function c(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function u(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function l(e){if(i.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}e.exports=function(e,t){const n={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let i=1,d=!1,p=!1,h="";for(;t<e.length;t++)if("<"!==e[t]||p)if(">"===e[t]){if(p?"-"===e[t-1]&&"-"===e[t-2]&&(p=!1,i--):i--,0===i)break}else"["===e[t]?d=!0:h+=e[t];else{if(d&&a(e,t))t+=7,[entityName,val,t]=o(e,t+1),-1===val.indexOf("&")&&(n[l(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(d&&r(e,t))t+=8;else if(d&&c(e,t))t+=8;else if(d&&u(e,t))t+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}i++,h=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}},function(e,t){const n=/^[-+]?0x[a-fA-F0-9]+$/,i=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const o={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(e,t={}){if(t=Object.assign({},o,t),!e||"string"!=typeof e)return e;let s=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(s))return e;if(t.hex&&n.test(s))return Number.parseInt(s,16);{const n=i.exec(s);if(n){const i=n[1],o=n[2];let r=(a=n[3])&&-1!==a.indexOf(".")?("."===(a=a.replace(/0+$/,""))?a="0":"."===a[0]?a="0"+a:"."===a[a.length-1]&&(a=a.substr(0,a.length-1)),a):a;const c=n[4]||n[6];if(!t.leadingZeros&&o.length>0&&i&&"."!==s[2])return e;if(!t.leadingZeros&&o.length>0&&!i&&"."!==s[1])return e;{const n=Number(s),a=""+n;return-1!==a.search(/[eE]/)||c?t.eNotation?n:e:-1!==s.indexOf(".")?"0"===a&&""===r||a===r||i&&a==="-"+r?n:e:o?r===a||i+r===a?n:e:s===a||s===i+a?n:e}}return e}var a}},function(e,t,n){function i(e,t,n){let r;const c={};for(let u=0;u<e.length;u++){const l=e[u],d=o(l);let p="";if(p=void 0===n?d:n+"."+d,d===t.textNodeName)void 0===r?r=l[d]:r+=""+l[d];else{if(void 0===d)continue;if(l[d]){let e=i(l[d],t,p);const n=a(e,t);l[":@"]?s(e,l[":@"],p,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==c[d]&&c.hasOwnProperty(d)?(Array.isArray(c[d])||(c[d]=[c[d]]),c[d].push(e)):t.isArray(d,p,n)?c[d]=[e]:c[d]=e}}}return"string"==typeof r?r.length>0&&(c[t.textNodeName]=r):void 0!==r&&(c[t.textNodeName]=r),c}function o(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const e=t[n];if(":@"!==e)return e}}function s(e,t,n,i){if(t){const o=Object.keys(t),s=o.length;for(let a=0;a<s;a++){const s=o[a];i.isArray(s,n+"."+s,!0,!0)?e[s]=[t[s]]:e[s]=t[s]}}}function a(e,t){const{textNodeName:n}=t,i=Object.keys(e).length;return 0===i||!(1!==i||!e[n]&&"boolean"!=typeof e[n]&&0!==e[n])}t.prettify=function(e,t){return i(e,t)}},function(e,t,n){const i=n(24),o=n(5),s={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function a(e){this.options=Object.assign({},s,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=o(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=u),this.processTextOrObjNode=r,this.options.format?(this.indentate=c,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function r(e,t,n,i){const o=this.j2x(e,n+1,i.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}function c(e){return this.options.indentBy.repeat(e)}function u(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}a.prototype.build=function(e){return this.options.preserveOrder?i(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},a.prototype.j2x=function(e,t,n){let i="",o="";const s=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(void 0===e[a])this.isAttribute(a)&&(o+="");else if(null===e[a])this.isAttribute(a)?o+="":"?"===a[0]?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t);else if("object"!=typeof e[a]){const n=this.isAttribute(a);if(n&&!this.ignoreAttributesFn(n,s))i+=this.buildAttrPairStr(n,""+e[a]);else if(!n)if(a===this.options.textNodeName){let t=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(t)}else o+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let s="",r="";for(let c=0;c<i;c++){const i=e[a][c];if(void 0===i);else if(null===i)"?"===a[0]?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof i)if(this.options.oneListGroup){const e=this.j2x(i,t+1,n.concat(a));s+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(r+=e.attrStr)}else s+=this.processTextOrObjNode(i,a,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(a,i);e=this.replaceEntitiesValue(e),s+=e}else s+=this.buildTextValNode(i,a,"",t)}this.options.oneListGroup&&(s=this.buildObjectNode(s,a,r,t)),o+=s}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const t=Object.keys(e[a]),n=t.length;for(let o=0;o<n;o++)i+=this.buildAttrPairStr(t[o],""+e[a][t[o]])}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:i,val:o}},a.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},a.prototype.buildObjectNode=function(e,t,n,i){if(""===e)return"?"===t[0]?this.indentate(i)+"<"+t+n+"?"+this.tagEndChar:this.indentate(i)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,s="";return"?"===t[0]&&(s="?",o=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===s.length?this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(i)+"<"+t+n+s+this.tagEndChar+e+this.indentate(i)+o:this.indentate(i)+"<"+t+n+s+">"+e+o}},a.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},a.prototype.buildTextValNode=function(e,t,n,i){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(i)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),""===o?this.indentate(i)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(i)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}},a.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e},e.exports=a},function(e,t){function n(e,t,r,c){let u="",l=!1;for(let d=0;d<e.length;d++){const p=e[d],h=i(p);if(void 0===h)continue;let g="";if(g=0===r.length?h:`${r}.${h}`,h===t.textNodeName){let e=p[h];s(g,t)||(e=t.tagValueProcessor(h,e),e=a(e,t)),l&&(u+=c),u+=e,l=!1;continue}if(h===t.cdataPropName){l&&(u+=c),u+=`<![CDATA[${p[h][0][t.textNodeName]}]]>`,l=!1;continue}if(h===t.commentPropName){u+=c+`\x3c!--${p[h][0][t.textNodeName]}--\x3e`,l=!0;continue}if("?"===h[0]){const e=o(p[":@"],t),n="?xml"===h?"":c;let i=p[h][0][t.textNodeName];i=0!==i.length?" "+i:"",u+=n+`<${h}${i}${e}?>`,l=!0;continue}let f=c;""!==f&&(f+=t.indentBy);const m=c+`<${h}${o(p[":@"],t)}`,_=n(p[h],t,g,f);-1!==t.unpairedTags.indexOf(h)?t.suppressUnpairedNode?u+=m+">":u+=m+"/>":_&&0!==_.length||!t.suppressEmptyNode?_&&_.endsWith(">")?u+=m+`>${_}${c}</${h}>`:(u+=m+">",_&&""!==c&&(_.includes("/>")||_.includes("</"))?u+=c+t.indentBy+_+c:u+=_,u+=`</${h}>`):u+=m+"/>",l=!0}return u}function i(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const i=t[n];if(e.hasOwnProperty(i)&&":@"!==i)return i}}function o(e,t){let n="";if(e&&!t.ignoreAttributes)for(let i in e){if(!e.hasOwnProperty(i))continue;let o=t.attributeValueProcessor(i,e[i]);o=a(o,t),!0===o&&t.suppressBooleanAttributes?n+=` ${i.substr(t.attributeNamePrefix.length)}`:n+=` ${i.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function s(e,t){let n=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let i in t.stopNodes)if(t.stopNodes[i]===e||t.stopNodes[i]==="*."+n)return!0;return!1}function a(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const i=t.entities[n];e=e.replace(i.regex,i.val)}return e}e.exports=function(e,t){let i="";return t.format&&t.indentBy.length>0&&(i="\n"),n(e,t,"",i)}},function(e,t,n){var i=n(7),o=n(0),s={};e.exports.transferToTaskMethod=function(e,t){s[t]=e[t],e[t]=function(e,n){e.SkipTask?s[t].call(this,e,n):this._addTask(t,e,n)}},e.exports.init=function(e){var t,n,a=[],r={},c=0,u=0,l=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),t},d=(n=function(){t=0,e.emit("task-list-update",{list:o.map(a,l)}),e.emit("list-update",{list:o.map(a,l)})},function(){t||(t=setTimeout(n))}),p=function(){if(!(a.length<=e.options.UploadQueueSize)){for(var t=0;t<u&&t<a.length&&a.length>e.options.UploadQueueSize;){var n="waiting"===a[t].state||"checking"===a[t].state||"uploading"===a[t].state;a[t]&&n?t++:(r[a[t].id]&&delete r[a[t].id],a.splice(t,1),u--)}d()}},h=function t(){if(!(c>=e.options.FileParallelLimit)){for(;a[u]&&"waiting"!==a[u].state;)u++;if(!(u>=a.length)){var n=a[u];u++,c++,n.state="checking",n.params.onTaskStart&&n.params.onTaskStart(l(n)),!n.params.UploadData&&(n.params.UploadData={});var i=o.formatParams(n.api,n.params);s[n.api].call(e,i,(function(i,o){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=i?"error":"success",i&&(n.error=i),c--,d(),t(),n.callback&&n.callback(i,o),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),p())})),d(),setTimeout(t)}}},g=function(t,n){var o=r[t];if(o){var s=o&&"waiting"===o.state,a=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===n&&"canceled"!==o.state||"paused"===n&&s||"paused"===n&&a){if("paused"===n&&o.params.Body&&"function"==typeof o.params.Body.pipe)return;o.state=n,e.emit("inner-kill-task",{TaskId:t,toState:n});try{var u=o&&o.params&&o.params.UploadData.UploadId}catch(l){}"canceled"===n&&u&&i.removeUsing(u),d(),a&&(c--,h()),"canceled"===n&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}p()}};e._addTasks=function(t){o.each(t,(function(t){e._addTask(t.api,t.params,t.callback,!0)})),d()},e._addTask=function(t,n,i,s){var c="postObject"===e.options.SimpleUploadMethod?"postObject":"putObject";"sliceUploadFile"!==t||o.canFileSlice()||(t=c),n=o.formatParams(t,n);var u=o.uuid();n.TaskId=u,n.onTaskReady&&n.onTaskReady(u);var l={params:n,callback:i,api:t,index:a.length,id:u,Bucket:n.Bucket,Region:n.Region,Key:n.Key,FilePath:n.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null},g=n.onHashProgress;n.onHashProgress=function(t){e._isRunningTask(l.id)&&(l.hashPercent=t.percent,g&&g(t),d())};var f=n.onProgress;return n.onProgress=function(t){e._isRunningTask(l.id)&&("checking"===l.state&&(l.state="uploading"),l.loaded=t.loaded,l.size=t.total,l.speed=t.speed,l.percent=t.percent,f&&f(t),d())},o.getFileSize(t,n,(function(e,t){e?i(e):(r[u]=l,a.push(l),l.size=t,!s&&d(),h(),p())})),u},e._isRunningTask=function(e){var t=r[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return o.map(a,l)},e.cancelTask=function(e){g(e,"canceled")},e.pauseTask=function(e){g(e,"paused")},e.restartTask=function(e){var t=r[e];!t||"paused"!==t.state&&"error"!==t.state||(t.state="waiting",d(),u=Math.min(u,t.index),h())},e.isUploadRunning=function(){return c||u<a.length}}},function(e,t,n){var i=n(27),o=n(0),s=n(28);function a(e){var t={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},n={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},i=(e&&e.AccessControlList||{}).Grant;i&&(i=o.isArray(i)?i:[i]);var s={READ:0,WRITE:0,FULL_CONTROL:0};return i&&i.length&&o.each(i,(function(i){"qcs::cam::anyone:anyone"===i.Grantee.ID||"http://cam.qcloud.com/groups/global/AllUsers"===i.Grantee.URI?s[i.Permission]=1:i.Grantee.ID!==e.Owner.ID&&t[n[i.Permission]].push('id="'+i.Grantee.ID+'"')})),s.FULL_CONTROL||s.WRITE&&s.READ?t.ACL="public-read-write":s.READ?t.ACL="public-read":t.ACL="private",o.each(n,(function(e){t[e]=r(t[e].join(","))})),t}function r(e){var t,n,i=e.split(","),o={};for(t=0;t<i.length;)o[n=i[t].trim()]?i.splice(t,1):(o[n]=!0,i[t]=n,t++);return i.join(",")}function c(e){var t=e.bucket,n=t.substr(0,t.lastIndexOf("-")),i=t.substr(t.lastIndexOf("-")+1),s=e.domain,a=e.region,r=e.object;s||(s=["cn-south","cn-south-2","cn-north","cn-east","cn-southwest","sg"].indexOf(a)>-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(s="{Bucket}."+s)),s=(s=s.replace(/\{\{AppId\}\}/gi,i).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,a).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,i).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,a).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(s)||(s="https://"+s),"/"===s.slice(-1)&&(s=s.slice(0,-1));var c=s;return e.ForcePathStyle&&(c+="/"+t),c+="/",r&&(c+=o.camSafeUrlEncode(r).replace(/%2F/g,"/")),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}var u=function(e){if(!e.Bucket||!e.Region)return"";var t=void 0===e.UseAccelerate?this.options.UseAccelerate:e.UseAccelerate;return(e.Url||c({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:e.Bucket,region:t?"accelerate":e.Region})).replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1")};function l(e,t){var n=o.clone(e.Headers),i="";o.each(n,(function(e,t){(""===e||["content-type","cache-control"].indexOf(t.toLowerCase())>-1)&&delete n[t],"host"===t.toLowerCase()&&(i=e)}));var s=!1!==e.ForceSignHost;!i&&e.SignHost&&s&&(n.Host=e.SignHost);var a=!1,r=function(e,n){a||(a=!0,n&&n.XCosSecurityToken&&!n.SecurityToken&&((n=o.clone(n)).SecurityToken=n.XCosSecurityToken,delete n.XCosSecurityToken),t&&t(e,n))},c=this,u=e.Bucket||"",l=e.Region||"",d="name/cos:PostObject"!==e.Action&&e.Key?e.Key:"";c.options.ForcePathStyle&&u&&(d=u+"/"+d);var p="/"+d,h={},g=e.Scope;if(!g){var f=e.Action||"",m=e.ResourceKey||e.Key||"";g=e.Scope||[{action:f,bucket:u,region:l,prefix:m}]}var _=o.md5(JSON.stringify(g));c._StsCache=c._StsCache||[],function(){var e,t;for(e=c._StsCache.length-1;e>=0;e--){t=c._StsCache[e];var n=Math.round(o.getSkewTime(c.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n<t.StartTime||n>=t.ExpiredTime)c._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===_){h=t;break}}}();var v=function(){var t="";h.StartTime&&e.Expires?t=h.StartTime+";"+(h.StartTime+1*e.Expires):h.StartTime&&h.ExpiredTime&&(t=h.StartTime+";"+h.ExpiredTime);var i={Authorization:o.getAuth({SecretId:h.TmpSecretId,SecretKey:h.TmpSecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,SystemClockOffset:c.options.SystemClockOffset,KeyTime:t,ForceSignHost:s}),SecurityToken:h.SecurityToken||h.XCosSecurityToken||"",Token:h.Token||"",ClientIP:h.ClientIP||"",ClientUA:h.ClientUA||"",SignFrom:"client"};r(null,i)},y=function(e){if(e.Authorization){var t=!1,n=e.Authorization;if(n)if(n.indexOf(" ")>-1)t=!1;else if(n.indexOf("q-sign-algorithm=")>-1&&n.indexOf("q-ak=")>-1&&n.indexOf("q-sign-time=")>-1&&n.indexOf("q-key-time=")>-1&&n.indexOf("q-url-param-list=")>-1)t=!0;else try{(n=atob(n)).indexOf("a=")>-1&&n.indexOf("k=")>-1&&n.indexOf("t=")>-1&&n.indexOf("r=")>-1&&n.indexOf("b=")>-1&&(t=!0)}catch(i){}if(!t)return o.error(new Error("getAuthorization callback params format error"))}else{if(!e.TmpSecretId)return o.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!e.TmpSecretKey)return o.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!e.SecurityToken&&!e.XCosSecurityToken)return o.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!e.ExpiredTime)return o.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(e.ExpiredTime&&10!==e.ExpiredTime.toString().length)return o.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(e.StartTime&&10!==e.StartTime.toString().length)return o.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(h.ExpiredTime&&h.ExpiredTime-o.getSkewTime(c.options.SystemClockOffset)/1e3>60)v();else if(c.options.getAuthorization)c.options.getAuthorization.call(c,{Bucket:u,Region:l,Method:e.Method,Key:d,Pathname:p,Query:e.Query,Headers:n,Scope:g,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s},(function(e){"string"==typeof e&&(e={Authorization:e});var t=y(e);if(t)return r(t);e.Authorization?r(null,e):((h=e||{}).Scope=g,h.ScopeKey=_,c._StsCache.push(h),v())}));else{if(!c.options.getSTS)return function(){var t="";if(c.options.StartTime&&e.Expires){if(10!==c.options.StartTime.toString().length)return r(o.error(new Error('params "StartTime" should be 10 digits')));t=c.options.StartTime+";"+(c.options.StartTime+1*e.Expires)}else if(c.options.StartTime&&c.options.ExpiredTime){if(10!==c.options.StartTime.toString().length)return r(o.error(new Error('params "StartTime" should be 10 digits')));if(10!==c.options.ExpiredTime.toString().length)return r(o.error(new Error('params "ExpiredTime" should be 10 digits')));t=c.options.StartTime+";"+1*c.options.ExpiredTime}var i={Authorization:o.getAuth({SecretId:e.SecretId||c.options.SecretId,SecretKey:e.SecretKey||c.options.SecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,KeyTime:t,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s}),SecurityToken:c.options.SecurityToken||c.options.XCosSecurityToken,SignFrom:"client"};return r(null,i),i}();c.options.getSTS.call(c,{Bucket:u,Region:l},(function(e){(h=e||{}).Scope=g,h.ScopeKey=_,h.TmpSecretId||(h.TmpSecretId=h.SecretId),h.TmpSecretKey||(h.TmpSecretKey=h.SecretKey);var t=y(h);if(t)return r(t);c._StsCache.push(h),v()}))}return""}function d(e){var t=this,n=!1,i=!1,s=!1,a=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var r=e.error.Code,c=e.error.Message;("RequestTimeTooSkewed"===r||"AccessDenied"===r&&"Request has expired"===c)&&(s=!0)}catch(p){}if(e){if(s&&a){var u=Date.parse(a);this.options.CorrectClockSkew&&Math.abs(o.getSkewTime(this.options.SystemClockOffset)-u)>=3e4&&(this.options.SystemClockOffset=u-Date.now(),n=!0)}else{if(5===Math.floor(e.statusCode/100))return{canRetry:!0,networkError:!1};if("timeout"===e.message)return{canRetry:!0,networkError:t.options.AutoSwitchHost}}if(e.statusCode){var l=Math.floor(e.statusCode/100),d=(null==e?void 0:e.headers)&&(null==e?void 0:e.headers["x-cos-request-id"]);[3,4,5].includes(l)&&!d&&(n=t.options.AutoSwitchHost,i=!0)}else n=!0,i=t.options.AutoSwitchHost}return{canRetry:n,networkError:i}}function p(e){var t=e.requestUrl,n=e.clientCalcSign,i=e.networkError;return!!this.options.AutoSwitchHost&&!!t&&!!n&&!!i&&/^https?:\/\/[^\/]*\.cos\.[^\/]*\.myqcloud\.com(\/.*)?$/.test(t)&&!/^https?:\/\/[^\/]*\.cos\.accelerate\.myqcloud\.com(\/.*)?$/.test(t)}function h(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=o.clearKey(e.qs),e.headers&&(e.headers=o.clearKey(e.headers)),e.qs&&(e.qs=o.clearKey(e.qs));var i=o.clone(e.qs);e.action&&(i[e.action]="");var s=e.url||e.Url,a=e.SignHost||u.call(this,{Bucket:e.Bucket,Region:e.Region,Url:s}),r=e.tracker;!function o(s){var c=n.options.SystemClockOffset;e.SwitchHost&&(a=a.replace(/myqcloud.com/,"tencentcos.cn")),r&&r.setParams({signStartTime:(new Date).getTime(),httpRetryTimes:s-1}),l.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:i,Headers:e.headers,SignHost:a,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:n.options.ForceSignHost},(function(i,a){i?t(i):(r&&r.setParams({signEndTime:(new Date).getTime(),httpStartTime:(new Date).getTime()}),e.AuthData=a,g.call(n,e,(function(i,u){var l=!1,h=!1;if(i){var g=d.call(n,i);l=g.canRetry||c!==n.options.SystemClockOffset,h=g.networkError}if(r&&r.setParams({httpEndTime:(new Date).getTime()}),i&&s<4&&l){e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,e.headers["x-cos-security-token"]&&delete e.headers["x-cos-security-token"],e.headers["x-ci-security-token"]&&delete e.headers["x-ci-security-token"]);var f=p.call(n,{requestUrl:(null==i?void 0:i.url)||"",clientCalcSign:"client"===(null==a?void 0:a.SignFrom),networkError:h});e.SwitchHost=f,e.headers["x-cos-sdk-retry"]="true",o(s+1)}else t(i,u)})))}))}(1)}function g(e,t){var n=this,s=e.TaskId;if(!s||n._isRunningTask(s)){var a=e.Bucket,r=e.Region,u=e.Key,l=e.method||"GET",d=e.url||e.Url,p=e.body,h=e.json,g=e.rawBody,f=e.dataType,m=n.options.HttpDNSServiceId;n.options.UseAccelerate&&(r="accelerate"),d=d||c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:a,region:r,object:u}),e.SwitchHost&&(d=d.replace(/myqcloud.com/,"tencentcos.cn"));var _=u?d:"";e.action&&(d=d+"?"+e.action),e.qsStr&&(d=d.indexOf("?")>-1?d+"&"+e.qsStr:d+"?"+e.qsStr);var v={method:l,url:d,headers:e.headers,qs:e.qs,filePath:e.filePath,body:p,json:h,httpDNSServiceId:m,dataType:f},y="x-cos-security-token";o.isCIHost(d)&&(y="x-ci-security-token"),v.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(v.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(v.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(v.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(v.headers[y]=e.AuthData.SecurityToken),v.headers&&(v.headers=o.clearKey(v.headers)),v=o.clearKey(v),e.onProgress&&"function"==typeof e.onProgress&&(v.onProgress=function(t){if(!s||n._isRunningTask(s)){var i=t?t.loaded:0;e.onProgress({loaded:i,total:t.total})}}),this.options.Timeout&&(v.timeout=this.options.Timeout),n.options.ForcePathStyle&&(v.pathStyle=n.options.ForcePathStyle),n.emit("before-send",v);var I,M=v.url.includes("accelerate."),C=v.qs?Object.keys(v.qs).map((function(e){return"".concat(e,"=").concat(v.qs[e])})).join("&"):"",S=C?v.url+"?"+C:v.url;e.tracker&&(e.tracker.setParams({url:S,httpMethod:v.method,accelerate:M,httpSize:(null===(I=v.body)||void 0===I?void 0:I.size)||0}),e.tracker.parent&&!e.tracker.parent.params.url&&e.tracker.parent.setParams({url:_,accelerate:M}));var E=i(v,(function(e,i,a){if("abort"!==e){var r,c=function(e,a){if(s&&n.off("inner-kill-task",T),!r){r=!0;var c={};i&&i.statusCode&&(c.statusCode=i.statusCode),i&&i.headers&&(c.headers=i.headers),e?(v.url&&(c.url=v.url),v.method&&(c.method=v.method),e=o.extend(e||{},c),t(e,null)):(a=o.extend(a||{},c),t(null,a)),E=null}};if(e)c({error:e});else{var u=i.statusCode,l=2===Math.floor(u/100);if(g){if(l)return c(null,{body:a});if(a instanceof ArrayBuffer){var d=o.arrayBufferToString(a),p=o.parseResBody(d);return c({error:p.Error||p})}}var h=o.parseResBody(a);l?h.Error?c({error:h.Error}):c(null,h):c({error:h.Error||h})}}})),T=function e(t){t.TaskId===s&&(E&&E.abort&&E.abort(),n.off("inner-kill-task",e))};s&&n.on("inner-kill-task",T)}}var f={getService:function(e,t){"function"==typeof e&&(t=e,e={});var n="https:",i=this.options.ServiceDomain,s=e.Region;i?(i=i.replace(/\{\{Region\}\}/gi,s||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(i)||(i=n+"//"+i),"/"===i.slice(-1)&&(i=i.slice(0,-1))):i=s?n+"//cos."+s+".myqcloud.com":n+"//service.cos.myqcloud.com",i.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1"),h.call(this,{Action:"name/cos:GetService",url:i,method:"GET",headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Buckets&&n.ListAllMyBucketsResult.Buckets.Bucket||[];i=o.isArray(i)?i:[i];var s=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Owner||{};t(null,{Buckets:i,Owner:s,statusCode:n.statusCode,headers:n.headers})}))},putBucket:function(e,t){var n=this,i="";if(e.BucketAZConfig){var s={BucketAZConfig:e.BucketAZConfig};i=o.json2xml({CreateBucketConfiguration:s})}h.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,body:i,tracker:e.tracker},(function(i,o){if(i)return t(i);var s=c({protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,isLocation:!0});t(null,{Location:s,statusCode:o.statusCode,headers:o.headers})}))},headBucket:function(e,t){h.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD",tracker:e.tracker},(function(e,n){t(e,n)}))},getBucket:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n.marker=e.Marker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,h.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListBucketResult||{},s=i.Contents||[],a=i.CommonPrefixes||[];s=o.isArray(s)?s:[s],a=o.isArray(a)?a:[a];var r=o.clone(i);o.extend(r,{Contents:s,CommonPrefixes:a,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},deleteBucket:function(e,t){h.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAcl:function(e,t){var n=e.Headers,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),a=s.Grants||s.Grant;a=o.isArray(a)?a:[a],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:a},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=r(n[t]))})),h.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:i,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketAcl:function(e,t){h.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},r=i.AccessControlList.Grant||[];r=o.isArray(r)?r:[r];var c=a(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:r,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=o.clone(o.isArray(n)?n:[n]),o.each(n,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[n],e[t]=o.isArray(i)?i:[i]}))}));var i={CORSRule:n};e.ResponseVary&&(i.ResponseVary=e.ResponseVary);var s=o.json2xml({CORSConfiguration:i}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"cors",headers:a,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketCors:function(e,t){h.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var i={CORSRules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.CORSConfiguration||{},a=s.CORSRules||s.CORSRule||[];a=o.clone(o.isArray(a)?a:[a]);var r=s.ResponseVary;o.each(a,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[t],e[n]=o.isArray(i)?i:[i]}))})),t(null,{CORSRules:a,ResponseVary:r,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketCors:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},getBucketLocation:function(e,t){h.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location",tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},getBucketPolicy:function(e,t){h.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t({ErrorStatus:"Access Denied"}):e.statusCode&&405===e.statusCode?t({ErrorStatus:"Method Not Allowed"}):e.statusCode&&404===e.statusCode?t({ErrorStatus:"Policy Not Found"}):t(e);var i={};try{i=JSON.parse(n.body)}catch(o){}t(null,{Policy:i,statusCode:n.statusCode,headers:n.headers})}))},putBucketPolicy:function(e,t){var n=e.Policy,i=n;try{"string"==typeof n?n=JSON.parse(i):i=JSON.stringify(n)}catch(a){t({error:"Policy format error"})}var s=e.Headers;s["Content-Type"]="application/json",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:i,headers:s,json:!0,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},deleteBucketPolicy:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},putBucketTagging:function(e,t){var n=e.Tagging||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"tagging",headers:a,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketTagging:function(e,t){h.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketTagging:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||e.Rules||[];n=o.clone(n);var i=o.json2xml({LifecycleConfiguration:{Rule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"lifecycle",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLifecycle:function(e,t){h.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var i={Rules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=[];try{s=n.LifecycleConfiguration.Rule||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Rules:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketLifecycle:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketVersioning:function(e,t){if(e.VersioningConfiguration){var n=e.VersioningConfiguration||{},i=o.json2xml({VersioningConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"versioning",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param VersioningConfiguration"})},getBucketVersioning:function(e,t){h.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning",tracker:e.tracker},(function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)}))},putBucketReplication:function(e,t){var n=o.clone(e.ReplicationConfiguration),i=o.json2xml({ReplicationConfiguration:n});i=(i=i.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"replication",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketReplication:function(e,t){h.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var i={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)}))},deleteBucketReplication:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketWebsite:function(e,t){if(e.WebsiteConfiguration){var n=o.clone(e.WebsiteConfiguration||{}),i=n.RoutingRules||n.RoutingRule||[];i=o.isArray(i)?i:[i],delete n.RoutingRule,delete n.RoutingRules,i.length&&(n.RoutingRules={RoutingRule:i});var s=o.json2xml({WebsiteConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"website",headers:a,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param WebsiteConfiguration"})},getBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.WebsiteConfiguration||{};if(s.RoutingRules){var a=o.clone(s.RoutingRules.RoutingRule||[]);a=o.makeArray(a),s.RoutingRules=a}t(null,{WebsiteConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketReferer:function(e,t){if(e.RefererConfiguration){var n=o.clone(e.RefererConfiguration||{}),i=n.DomainList||{},s=i.Domains||i.Domain||[];(s=o.isArray(s)?s:[s]).length&&(n.DomainList={Domain:s});var a=o.json2xml({RefererConfiguration:n}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(a)),h.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"referer",headers:r,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param RefererConfiguration"})},getBucketReferer:function(e,t){h.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchRefererConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.RefererConfiguration||{};if(s.DomainList){var a=o.makeArray(s.DomainList.Domain||[]);s.DomainList={Domains:a}}t(null,{RefererConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},putBucketDomain:function(e,t){var n=(e.DomainConfiguration||{}).DomainRule||e.DomainRule||[];n=o.clone(n);var i=o.json2xml({DomainConfiguration:{DomainRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"domain",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketDomain:function(e,t){h.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.DomainConfiguration.DomainRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{DomainRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketDomain:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketOrigin:function(e,t){var n=(e.OriginConfiguration||{}).OriginRule||e.OriginRule||[];n=o.clone(n);var i=o.json2xml({OriginConfiguration:{OriginRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"origin",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketOrigin:function(e,t){h.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.OriginConfiguration.OriginRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{OriginRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketOrigin:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLogging:function(e,t){var n=o.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(n)),h.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:n,action:"logging",headers:i,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLogging:function(e,t){h.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging",tracker:e.tracker},(function(e,n){if(e)return t(e);delete n.BucketLoggingStatus._xmlns,t(null,{BucketLoggingStatus:n.BucketLoggingStatus,statusCode:n.statusCode,headers:n.headers})}))},putBucketInventory:function(e,t){var n=o.clone(e.InventoryConfiguration);if(n.OptionalFields){var i=n.OptionalFields||[];n.OptionalFields={Field:i}}if(n.Destination&&n.Destination.COSBucketDestination&&n.Destination.COSBucketDestination.Encryption){var s=n.Destination.COSBucketDestination.Encryption;Object.keys(s).indexOf("SSECOS")>-1&&(s["SSE-COS"]=s.SSECOS,delete s.SSECOS)}var a=o.json2xml({InventoryConfiguration:n}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(a)),h.call(this,{Action:"name/cos:PutBucketInventory",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"inventory",qs:{id:e.Id},headers:r,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketInventory:function(e,t){h.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.InventoryConfiguration;if(i&&i.OptionalFields&&i.OptionalFields.Field){var s=i.OptionalFields.Field;o.isArray(s)||(s=[s]),i.OptionalFields=s}if(i.Destination&&i.Destination.COSBucketDestination&&i.Destination.COSBucketDestination.Encryption){var a=i.Destination.COSBucketDestination.Encryption;Object.keys(a).indexOf("SSE-COS")>-1&&(a.SSECOS=a["SSE-COS"],delete a["SSE-COS"])}t(null,{InventoryConfiguration:i,statusCode:n.statusCode,headers:n.headers})}))},listBucketInventory:function(e,t){h.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{"continuation-token":e.ContinuationToken},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListInventoryConfigurationResult,s=i.InventoryConfiguration||[];s=o.isArray(s)?s:[s],delete i.InventoryConfiguration,o.each(s,(function(e){if(e&&e.OptionalFields&&e.OptionalFields.Field){var t=e.OptionalFields.Field;o.isArray(t)||(t=[t]),e.OptionalFields=t}if(e.Destination&&e.Destination.COSBucketDestination&&e.Destination.COSBucketDestination.Encryption){var n=e.Destination.COSBucketDestination.Encryption;Object.keys(n).indexOf("SSE-COS")>-1&&(n.SSECOS=n["SSE-COS"],delete n["SSE-COS"])}})),i.InventoryConfigurations=s,o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))},deleteBucketInventory:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAccelerate:function(e,t){if(e.AccelerateConfiguration){var n={AccelerateConfiguration:e.AccelerateConfiguration||{}},i=o.json2xml(n),s={"Content-Type":"application/xml"};s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Interface:"putBucketAccelerate",Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"accelerate",headers:s,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param AccelerateConfiguration"})},getBucketAccelerate:function(e,t){h.call(this,{Interface:"getBucketAccelerate",Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate",tracker:e.tracker},(function(e,n){e||!n.AccelerateConfiguration&&(n.AccelerateConfiguration={}),t(e,n)}))},getObject:function(e,t){if(this.options.ObjectKeySimplifyCheck&&"/"===o.simplifyPath(e.Key))t(o.error(new Error("The Getobject Key is illegal")));else{var n=e.Query||{},i=e.QueryString||"",s=e.tracker;s&&s.setParams({signStartTime:(new Date).getTime()}),n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,h.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,qsStr:i,rawBody:!0,dataType:e.DataType,tracker:s},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0}):t(n)}t(null,{Body:i.body,ETag:o.attr(i.headers,"etag",""),statusCode:i.statusCode,headers:i.headers})}))}},headObject:function(e,t){h.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,tracker:e.tracker},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0,statusCode:s}):t(n)}i.ETag=o.attr(i.headers,"etag",""),t(null,i)}))},listObjectVersions:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,h.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListVersionsResult||{},s=i.DeleteMarker||[];s=o.isArray(s)?s:[s];var a=i.Version||[];a=o.isArray(a)?a:[a];var r=o.clone(i);delete r.DeleteMarker,delete r.Version,o.extend(r,{DeleteMarkers:s,Versions:a,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},putObject:function(e,t){var n=this,i=e.ContentLength,a=o.throttleOnProgress.call(n,i,e.onProgress),r=e.Headers;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]=""),r["Content-Type"]||r["content-type"]||(r["Content-Type"]=s.getType(e.Key)||"application/octet-stream");var u=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5,l=e.tracker;u&&l&&l.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(u,e.Body,(function(s){s&&(l&&l.setParams({md5EndTime:(new Date).getTime()}),n.options.UploadCheckContentMd5&&(r["Content-MD5"]=o.binaryBase64(s)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(r["x-cos-meta-md5"]=s)),void 0!==e.ContentLength&&(r["Content-Length"]=e.ContentLength),a(null,!0),h.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:e.Query,body:e.Body,onProgress:a,tracker:l},(function(s,r){if(s)return a(null,!0),t(s);a({loaded:i,total:i},!0);var u=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:n.options.UseAccelerate?"accelerate":e.Region,object:e.Key});u=u.substr(u.indexOf("://")+3),r.Location=u,r.ETag=o.attr(r.headers,"etag",""),t(null,r)}))}))},postObject:function(e,t){var n=this,i={},s=e.FilePath;if(s){for(var a in i["Cache-Control"]=e.CacheControl,i["Content-Disposition"]=e.ContentDisposition,i["Content-Encoding"]=e.ContentEncoding,i["Content-MD5"]=e.ContentMD5,i["Content-Length"]=e.ContentLength,i["Content-Type"]=e.ContentType,i.Expect=e.Expect,i.Expires=e.Expires,i["x-cos-acl"]=e.ACL,i["x-cos-grant-read"]=e.GrantRead,i["x-cos-grant-write"]=e.GrantWrite,i["x-cos-grant-full-control"]=e.GrantFullControl,i["x-cos-storage-class"]=e.StorageClass,i["x-cos-mime-limit"]=e.MimeLimit,i["x-cos-traffic-limit"]=e.TrafficLimit,i["x-cos-forbid-overwrite"]=e.ForbidOverwrite,i["x-cos-server-side-encryption-customer-algorithm"]=e.SSECustomerAlgorithm,i["x-cos-server-side-encryption-customer-key"]=e.SSECustomerKey,i["x-cos-server-side-encryption-customer-key-MD5"]=e.SSECustomerKeyMD5,i["x-cos-server-side-encryption"]=e.ServerSideEncryption,i["x-cos-server-side-encryption-cos-kms-key-id"]=e.SSEKMSKeyId,i["x-cos-server-side-encryption-context"]=e.SSEContext,delete i["Content-Length"],delete i["content-length"],e)a.indexOf("x-cos-meta-")>-1&&(i[a]=e[a]);var r=o.throttleOnProgress.call(n,i["Content-Length"],e.onProgress);h.call(this,{Action:"name/cos:PostObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:i,qs:e.Query,filePath:s,TaskId:e.TaskId,onProgress:r,tracker:e.tracker},(function(i,o){if(r(null,!0),i)return t(i);if(o&&o.headers){var a=o.headers,u=a.etag||a.Etag||a.ETag||"",l=s.substr(s.lastIndexOf("/")+1),d=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key.replace(/\$\{filename\}/g,l),isLocation:!0});return t(null,{Location:d,statusCode:o.statusCode,headers:a,ETag:u})}t(null,o)}))}else t({error:"missing param FilePath"})},deleteObject:function(e,t){h.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e){var i=e.statusCode;return i&&204===i?t(null,{statusCode:i}):i&&404===i?t(null,{BucketNotFound:!0,statusCode:i}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectAcl:function(e,t){var n={};e.VersionId&&(n.versionId=e.VersionId),h.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},r=i.AccessControlList&&i.AccessControlList.Grant||[];r=o.isArray(r)?r:[r];var c=a(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:r,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putObjectAcl:function(e,t){var n=e.Headers,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),a=s.Grants||s.Grant;a=o.isArray(a)?a:[a],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:a},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=r(n[t]))})),h.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:i,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},optionsObject:function(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,h.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var i=n.headers||{};t(null,{AccessControlAllowOrigin:i["access-control-allow-origin"],AccessControlAllowMethods:i["access-control-allow-methods"],AccessControlAllowHeaders:i["access-control-allow-headers"],AccessControlExposeHeaders:i["access-control-expose-headers"],AccessControlMaxAge:i["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})}))},putObjectCopy:function(e,t){var n=e.Headers;!n["Cache-Control"]&&n["cache-control"]&&(n["Cache-Control"]="");var i=e.CopySource||"",s=o.getSourceParams.call(this,i);if(s){var a=s.Bucket,r=s.Region,c=decodeURIComponent(s.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:a,region:r,prefix:c},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyObjectResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},deleteMultipleObject:function(e,t){var n=e.Objects||[],i=e.Quiet;n=o.isArray(n)?n:[n];var s=o.json2xml({Delete:{Object:n,Quiet:i||!1}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s));var r=o.map(n,(function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}}));h.call(this,{Scope:r,method:"POST",Bucket:e.Bucket,Region:e.Region,body:s,action:"delete",headers:a,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.DeleteResult||{},s=i.Deleted||[],a=i.Error||[];s=o.isArray(s)?s:[s],a=o.isArray(a)?a:[a];var r=o.clone(i);o.extend(r,{Error:a,Deleted:s,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var i=e.RestoreRequest||{},s=o.json2xml({RestoreRequest:i});n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:s,action:"restore",headers:n,tracker:e.tracker},(function(e,n){t(e,n)}))}else t({error:"missing param RestoreRequest"})},putObjectTagging:function(e,t){var n=e.Tagging||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Interface:"putObjectTagging",Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:s,action:"tagging",headers:a,VersionId:e.VersionId,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectTagging:function(e,t){h.call(this,{Interface:"getObjectTagging",Action:"name/cos:GetObjectTagging",method:"GET",Key:e.Key,Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteObjectTagging:function(e,t){h.call(this,{Interface:"deleteObjectTagging",Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},appendObject:function(e,t){h.call(this,{Action:"name/cos:AppendObject",method:"POST",Bucket:e.Bucket,Region:e.Region,action:"append",Key:e.Key,body:e.Body,qs:{position:e.Position},headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},uploadPartCopy:function(e,t){var n=e.CopySource||"",i=o.getSourceParams.call(this,n);if(i){var s=i.Bucket,a=i.Region,r=decodeURIComponent(i.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:s,region:a,prefix:r},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyPartResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},multipartInit:function(e,t){var n=e.Headers,i=e.tracker;n["Cache-Control"]||n["cache-control"]||(n["Cache-Control"]=""),n["Content-Type"]||n["content-type"]||(n["Content-Type"]=s.getType(e.Key)||"application/octet-stream"),h.call(this,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:i},(function(e,n){return e?(i&&i.parent&&i.parent.setParams({errorNode:"multipartInit"}),t(e)):(n=o.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,o.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)}))},multipartUpload:function(e,t){var n=this;o.getFileSize("multipartUpload",e,(function(){var i=e.tracker,s=n.options.UploadCheckContentMd5;s&&i&&i.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(s,e.Body,(function(a){a&&(e.Headers["Content-MD5"]=o.binaryBase64(a),s&&i&&i.setParams({md5EndTime:(new Date).getTime()})),i&&i.setParams({partNumber:e.PartNumber}),h.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null,tracker:i},(function(e,n){if(e)return i&&i.parent&&i.parent.setParams({errorNode:"multipartUpload"}),t(e);t(null,{ETag:o.attr(n.headers,"etag",{}),statusCode:n.statusCode,headers:n.headers})}))}))}))},multipartComplete:function(e,t){for(var n=this,i=e.UploadId,s=e.Parts,a=e.tracker,r=0,u=s.length;r<u;r++)0!==s[r].ETag.indexOf('"')&&(s[r].ETag='"'+s[r].ETag+'"');var l=o.json2xml({CompleteMultipartUpload:{Part:s}}),d=e.Headers;d["Content-Type"]="application/xml",d["Content-MD5"]=o.binaryBase64(o.md5(l)),h.call(this,{Action:"name/cos:CompleteMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{uploadId:i},body:l,headers:d,tracker:a},(function(i,s){if(i)return a&&a.parent&&a.parent.setParams({errorNode:"multipartComplete"}),t(i);var r=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:n.options.UseAccelerate?"accelerate":e.Region,object:e.Key,isLocation:!0}),u=s.CompleteMultipartUploadResult||{},l=o.extend(u,{Location:r,statusCode:s.statusCode,headers:s.headers});t(null,l)}))},multipartList:function(e,t){var n={};n.delimiter=e.Delimiter,n["encoding-type"]=e.EncodingType,n.prefix=e.Prefix||"",n["max-uploads"]=e.MaxUploads,n["key-marker"]=e.KeyMarker,n["upload-id-marker"]=e.UploadIdMarker,n=o.clearKey(n);var i=e.tracker;i&&i.setParams({signStartTime:(new Date).getTime()}),h.call(this,{Action:"name/cos:ListMultipartUploads",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"uploads",tracker:i},(function(e,n){if(e)return i&&i.parent&&i.parent.setParams({errorNode:"multipartList"}),t(e);if(n&&n.ListMultipartUploadsResult){var s=n.ListMultipartUploadsResult.Upload||[],a=n.ListMultipartUploadsResult.CommonPrefixes||[];a=o.isArray(a)?a:[a],s=o.isArray(s)?s:[s],n.ListMultipartUploadsResult.Upload=s,n.ListMultipartUploadsResult.CommonPrefixes=a}var r=o.clone(n.ListMultipartUploadsResult||{});o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},multipartListPart:function(e,t){var n={},i=e.tracker;n.uploadId=e.UploadId,n["encoding-type"]=e.EncodingType,n["max-parts"]=e.MaxParts,n["part-number-marker"]=e.PartNumberMarker,h.call(this,{Action:"name/cos:ListParts",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n,tracker:i},(function(e,n){if(e)return i&&i.parent&&i.parent.setParams({errorNode:"multipartListPart"}),t(e);var s=n.ListPartsResult||{},a=s.Part||[];a=o.isArray(a)?a:[a],s.Part=a;var r=o.clone(s);o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},multipartAbort:function(e,t){var n={};n.uploadId=e.UploadId,h.call(this,{Action:"name/cos:AbortMultipartUpload",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},request:function(e,t){h.call(this,{method:e.Method,Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:e.Action,headers:e.Headers,qs:e.Query,body:e.Body,Url:e.Url,rawBody:e.RawBody,dataType:e.DataType,tracker:e.tracker},(function(e,n){if(e)return t(e);n&&n.body&&(n.Body=n.body,delete n.body),t(e,n)}))},getObjectUrl:function(e,t){var n=this,i=void 0===e.UseAccelerate?n.options.UseAccelerate:e.UseAccelerate,s=c({ForcePathStyle:n.options.ForcePathStyle,protocol:e.Protocol||n.options.Protocol,domain:e.Domain||n.options.Domain,bucket:e.Bucket,region:i?"accelerate":e.Region,object:e.Key}),a="";e.Query&&(a+=o.obj2str(e.Query)),e.QueryString&&(a+=(a?"&":"")+e.QueryString);var r=s;if(void 0!==e.Sign&&!e.Sign)return a&&(r+="?"+a),t(null,{Url:r}),r;var d=u.call(this,{Bucket:e.Bucket,Region:e.Region,UseAccelerate:e.UseAccelerate,Url:s}),p=l.call(this,{Action:"PUT"===(e.Method||"").toUpperCase()?"name/cos:PutObject":"name/cos:GetObject",Bucket:e.Bucket||"",Region:e.Region||"",Method:e.Method||"get",Key:e.Key,Expires:e.Expires,Headers:e.Headers,Query:e.Query,SignHost:d,ForceSignHost:!1!==e.ForceSignHost&&n.options.ForceSignHost},(function(e,n){if(t)if(e)t(e);else{var i=s;i+="?"+(n.Authorization.indexOf("q-signature")>-1?(o=n.Authorization,r=o.match(/q-url-param-list.*?(?=&)/g)[0],c="q-url-param-list="+encodeURIComponent(r.replace(/q-url-param-list=/,"")).toLowerCase(),u=new RegExp(r,"g"),o.replace(u,c)):"sign="+encodeURIComponent(n.Authorization)),n.SecurityToken&&(i+="&x-cos-security-token="+n.SecurityToken),n.ClientIP&&(i+="&clientIP="+n.ClientIP),n.ClientUA&&(i+="&clientUA="+n.ClientUA),n.Token&&(i+="&token="+n.Token),a&&(i+="&"+a),setTimeout((function(){t(null,{Url:i})}))}var o,r,c,u}));return p?(r+="?"+p.Authorization+(p.SecurityToken?"&x-cos-security-token="+p.SecurityToken:""),a&&(r+="&"+a)):a&&(r+="?"+a),r},getAuth:function(e){return o.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Bucket:e.Bucket,Region:e.Region,Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(f,"postObject"),t.transferToTaskMethod(f,"putObject"),o.each(f,(function(t,n){e.prototype[n]=o.apiWrapper(n,t)}))}},function(e,t){function n(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}var i=function(e,t){var i,o,s,a=[],r=function(e,t){var i=[];for(var o in e)e.hasOwnProperty(o)&&i.push(t?n(o).toLowerCase():o);return i.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}(e);for(i=0;i<r.length;i++)s=void 0===e[o=r[i]]||null===e[o]?"":""+e[o],o=t?n(o).toLowerCase():n(o),s=n(s)||"",a.push(o+"="+s);return a.join("&")};e.exports=function(e,t){var n,o=e.filePath,s=e.headers||{},a=e.url||e.Url,r=e.method,c=e.onProgress,u=e.httpDNSServiceId,l=function(e,n){var i=n.header,o={};if(i)for(var s in i)i.hasOwnProperty(s)&&(o[s.toLowerCase()]=i[s]);t(e,{statusCode:n.statusCode,headers:o},n.data)};if(o){var d,p=a.match(/^(https?:\/\/[^/]+\/)([^/]*\/?)(.*)$/);e.pathStyle?(d=decodeURIComponent(p[3]||""),a=p[1]+p[2]):(d=decodeURIComponent(p[2]+p[3]||""),a=p[1]);var h={key:d,success_action_status:200,Signature:s.Authorization},g=["Cache-Control","Content-Type","Content-Disposition","Content-Encoding","Expires","x-cos-storage-class","x-cos-security-token","x-ci-security-token"];for(var f in e.headers)e.headers.hasOwnProperty(f)&&(f.indexOf("x-cos-meta-")>-1||g.indexOf(f)>-1)&&(h[f]=e.headers[f]);s["x-cos-acl"]&&(h.acl=s["x-cos-acl"]),!h["Content-Type"]&&(h["Content-Type"]=""),(n=Pn.uploadFile({url:a,method:r,name:"file",header:s,filePath:o,formData:h,timeout:e.timeout,success:function(e){l(null,e)},fail:function(e){l(e.errMsg,e)}})).onProgressUpdate((function(e){c&&c({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend,progress:e.progress/100})}))}else{var m=e.qs&&i(e.qs)||"";m&&(a+=(a.indexOf("?")>-1?"&":"?")+m),s["Content-Length"]&&delete s["Content-Length"];var _={url:a,method:r,header:s,dataType:"text",data:e.body,responseType:e.dataType||"text",timeout:e.timeout,redirect:"manual",success:function(e){l(null,e)},fail:function(e){l(e.errMsg,e)}};u&&Object.assign(_,{enableHttpDNS:!0,httpDNSServiceId:u}),n=Pn.request(_)}return n}},function(e,t,n){let i=n(29);e.exports=new i(n(30),n(31))},function(e,t,n){function i(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e<arguments.length;e++)this.define(arguments[e]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}i.prototype.define=function(e,t){for(let n in e){let i=e[n].map((function(e){return e.toLowerCase()}));n=n.toLowerCase();for(let e=0;e<i.length;e++){const o=i[e];if("*"!==o[0]){if(!t&&o in this._types)throw new Error('Attempt to change mapping for "'+o+'" extension from "'+this._types[o]+'" to "'+n+'". Pass `force=true` to allow this, otherwise remove "'+o+'" from the list of extensions for "'+n+'".');this._types[o]=n}}if(t||!this._extensions[n]){const e=i[0];this._extensions[n]="*"!==e[0]?e:e.substr(1)}}},i.prototype.getType=function(e){let t=(e=String(e)).replace(/^.*[/\\]/,"").toLowerCase(),n=t.replace(/^.*\./,"").toLowerCase(),i=t.length<e.length;return(n.length<t.length-1||!i)&&this._types[n]||null},i.prototype.getExtension=function(e){return(e=/^\s*([^;\s]*)/.test(e)&&RegExp.$1)&&this._extensions[e.toLowerCase()]||null},e.exports=i},function(e,t){e.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}},function(e,t){e.exports={"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}},function(e,t,n){function i(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
i=function(){return t};var e,t={},n=Object.prototype,s=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},r="function"==typeof Symbol?Symbol:{},c=r.iterator||"@@iterator",u=r.asyncIterator||"@@asyncIterator",l=r.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(N){d=function(e,t,n){return e[t]=n}}function p(e,t,n,i){var o=t&&t.prototype instanceof y?t:y,s=Object.create(o.prototype),r=new L(i||[]);return a(s,"_invoke",{value:R(e,n,r)}),s}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(i){return{type:"throw",arg:i}}}t.wrap=p;var g="suspendedStart",f="suspendedYield",m="executing",_="completed",v={};function y(){}function I(){}function M(){}var C={};d(C,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(P([])));E&&E!==n&&s.call(E,c)&&(C=E);var T=M.prototype=y.prototype=Object.create(C);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function D(e,t){function n(i,a,r,c){var u=h(e[i],e,a);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==o(d)&&s.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,r,c)}),(function(e){n("throw",e,r,c)})):t.resolve(d).then((function(e){l.value=e,r(l)}),(function(e){return n("throw",e,r,c)}))}c(u.arg)}var i;a(this,"_invoke",{value:function(e,o){function s(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(s,s):s()}})}function R(t,n,i){var o=g;return function(s,a){if(o===m)throw Error("Generator is already running");if(o===_){if("throw"===s)throw a;return{value:e,done:!0}}for(i.method=s,i.arg=a;;){var r=i.delegate;if(r){var c=O(r,i);if(c){if(c===v)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===g)throw o=_,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=m;var u=h(t,n,i);if("normal"===u.type){if(o=i.done?_:f,u.arg===v)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(o=_,i.method="throw",i.arg=u.arg)}}}function O(t,n){var i=n.method,o=t.iterator[i];if(o===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),v;var s=h(o,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,v;var a=s.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(s.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(o(t)+" is not iterable")}return I.prototype=M,a(T,"constructor",{value:M,configurable:!0}),a(M,"constructor",{value:I,configurable:!0}),I.displayName=d(M,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===I||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,M):(e.__proto__=M,d(e,l,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},k(D.prototype),d(D.prototype,u,(function(){return this})),t.AsyncIterator=D,t.async=function(e,n,i,o,s){void 0===s&&(s=Promise);var a=new D(p(e,n,i,o),s);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(T),d(T,l,"Generator"),d(T,c,(function(){return this})),d(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&s.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(i,o){return r.type="throw",r.arg=t,n.next=i,o&&(n.method="next",n.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],r=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),u=s.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){s(a,i,o,r,c,"next",e)}function c(e){s(a,i,o,r,c,"throw",e)}r(void 0)}))}}var r=n(7),c=n(33),u=n(6).EventProxy,l=n(0),d=n(2);function p(e,t){var n=e.TaskId,i=e.Bucket,o=e.Region,s=e.Key,a=e.StorageClass,d=this,p={},f=e.FileSize,m=e.SliceSize,_=Math.ceil(f/m),v=0,y=l.throttleOnProgress.call(d,f,e.onHashProgress),I=function(t,n){var i=t.length;return 0===i?n(null,!0):i>_||i>1&&Math.max(t[0].Size,t[1].Size)!==m?n(null,!1):void function o(s){if(s<i){var a=t[s];r=a.PartNumber,c=function(e,t){t&&t.ETag===a.ETag&&t.Size===a.Size?o(s+1):n(null,!1)},u=m*(r-1),d=Math.min(u+m,f),h=d-u,p[r]?c(null,{PartNumber:r,ETag:p[r],Size:h}):l.fileSlice(e.FilePath,u,d,(function(e){try{var t=l.getFileMd5(e)}catch(i){return c(i)}var n='"'+t+'"';p[r]=n,v+=h,c(null,{PartNumber:r,ETag:n,Size:h}),y({loaded:v,total:f})}))}else n(null,!0);var r,c,u,d,h}(0)},M=new u;M.on("error",(function(e){if(d._isRunningTask(n))return t(e)})),M.on("upload_id_available",(function(e){var n={},i=[];l.each(e.PartList,(function(e){n[e.PartNumber]=e}));for(var o=1;o<=_;o++){var s=n[o];s?(s.PartNumber=o,s.Uploaded=!0):s={PartNumber:o,ETag:null,Uploaded:!1},i.push(s)}e.PartList=i,t(null,e)})),M.on("no_available_upload_id",(function(){if(d._isRunningTask(n)){var r=l.extend({Bucket:i,Region:o,Key:s,Headers:l.clone(e.Headers),Query:l.clone(e.Query),StorageClass:a,calledBySdk:"sliceUploadFile",tracker:e.tracker},e);d.multipartInit(r,(function(e,i){if(d._isRunningTask(n)){if(e)return M.emit("error",e);var o=i.UploadId;if(!o)return t({Message:"no upload id"});M.emit("upload_id_available",{UploadId:o,PartList:[]})}}))}})),M.on("has_and_check_upload_id",(function(t){t=t.reverse(),c.eachLimit(t,1,(function(t,a){d._isRunningTask(n)&&(r.using[t]?a():g.call(d,{Bucket:i,Region:o,Key:s,UploadId:t,tracker:e.tracker},(function(e,i){if(d._isRunningTask(n)){if(e)return r.removeUsing(t),M.emit("error",e);var o=i.PartList;o.forEach((function(e){e.PartNumber*=1,e.Size*=1,e.ETag=e.ETag||""})),I(o,(function(e,i){if(d._isRunningTask(n))return e?M.emit("error",e):void(i?a({UploadId:t,PartList:o}):a())}))}})))}),(function(e){d._isRunningTask(n)&&(y(null,!0),e&&e.UploadId?M.emit("upload_id_available",e):M.emit("no_available_upload_id"))}))})),M.on("seek_local_avail_upload_id",(function(t){var a=r.getFileId(e.FileStat,e.ChunkSize,i,s),c=r.getUploadIdList(a);a&&c?function a(u){if(u>=c.length)M.emit("has_and_check_upload_id",t);else{var p=c[u];if(!l.isInArray(t,p))return r.removeUploadId(p),void a(u+1);r.using[p]?a(u+1):g.call(d,{Bucket:i,Region:o,Key:s,UploadId:p,tracker:e.tracker},(function(e,t){d._isRunningTask(n)&&(e?(r.removeUploadId(p),a(u+1)):M.emit("upload_id_available",{UploadId:p,PartList:t.PartList}))}))}}(0):M.emit("has_and_check_upload_id",t)})),M.on("get_remote_upload_id_list",(function(){h.call(d,{Bucket:i,Region:o,Key:s,tracker:e.tracker},(function(t,o){if(d._isRunningTask(n)){if(t)return M.emit("error",t);var c=l.filter(o.UploadList,(function(e){return e.Key===s&&(!a||e.StorageClass.toUpperCase()===a.toUpperCase())})).reverse().map((function(e){return e.UploadId||e.UploadID}));if(c.length)M.emit("seek_local_avail_upload_id",c);else{var u,p=r.getFileId(e.FileStat,e.ChunkSize,i,s);p&&(u=r.getUploadIdList(p))&&l.each(u,(function(e){r.removeUploadId(e)})),M.emit("no_available_upload_id")}}}))})),M.emit("get_remote_upload_id_list")}function h(e,t){var n=this,i=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key,calledBySdk:e.calledBySdk||"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartList(o,(function(n,s){if(n)return t(n);i.push.apply(i,s.Upload||[]),"true"===s.IsTruncated?(o.KeyMarker=s.NextKeyMarker,o.UploadIdMarker=s.NextUploadIdMarker,e()):t(null,{UploadList:i})}))}()}function g(e,t){var n=this,i=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId,calledBySdk:"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartListPart(o,(function(n,s){if(n)return t(n);i.push.apply(i,s.Part||[]),"true"===s.IsTruncated?(o.PartNumberMarker=s.NextPartNumberMarker,e()):t(null,{PartList:i})}))}()}function f(e,t){var n=this,i=e.TaskId,o=e.Bucket,s=e.Region,a=e.Key,r=e.UploadData,u=e.FileSize,d=e.SliceSize,p=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),h=e.FilePath,g=Math.ceil(u/d),f=0,_=e.ServerSideEncryption,v=l.filter(r.PartList,(function(e){return e.Uploaded&&(f+=e.PartNumber>=g&&u%d||d),!e.Uploaded})),y=e.onProgress;c.eachLimit(v,p,(function(t,c){if(n._isRunningTask(i)){var l=t.PartNumber,p=Math.min(u,t.PartNumber*d)-(t.PartNumber-1)*d,g=0;m.call(n,{TaskId:i,Bucket:o,Region:s,Key:a,SliceSize:d,FileSize:u,PartNumber:l,ServerSideEncryption:_,FilePath:h,UploadData:r,onProgress:function(e){f+=e.loaded-g,g=e.loaded,y({loaded:f,total:u})},tracker:e.tracker},(function(e,o){n._isRunningTask(i)&&(e?f-=g:(f+=p-g,t.ETag=o.ETag),y({loaded:f,total:u}),c(e||null,o))}))}}),(function(e){if(n._isRunningTask(i))return e?t(e):void t(null,{UploadId:r.UploadId,SliceList:r.PartList})}))}function m(e,t){var n=this,i=e.TaskId,o=e.Bucket,s=e.Region,a=e.Key,r=e.FileSize,u=e.FilePath,d=1*e.PartNumber,p=e.SliceSize,h=e.ServerSideEncryption,g=e.UploadData,f=n.options.ChunkRetryTimes+1,m=e.Headers||{},_=p*(d-1),v=p,y=_+p;y>r&&(v=(y=r)-_);var I=["x-cos-traffic-limit","x-cos-mime-limit"],M={};l.each(m,(function(e,t){I.indexOf(t)>-1&&(M[t]=e)})),l.fileSlice(u,_,y,(function(r){var u=l.getFileMd5(r),p=u?l.binaryBase64(u):null,m=g.PartList[d-1];c.retry(f,(function(t){n._isRunningTask(i)&&n.multipartUpload({TaskId:i,Bucket:o,Region:s,Key:a,ContentLength:v,PartNumber:d,UploadId:g.UploadId,ServerSideEncryption:h,Body:r,Headers:M,onProgress:e.onProgress,ContentMD5:p,calledBySdk:"sliceUploadFile",tracker:e.tracker},(function(e,o){if(n._isRunningTask(i))return e?t(e):(m.Uploaded=!0,t(null,o))}))}),(function(e,o){if(n._isRunningTask(i))return t(e,o)}))}))}function _(e,t){var n=e.Bucket,i=e.Region,o=e.Key,s=e.UploadId,a=e.SliceList,r=this,u=this.options.ChunkRetryTimes+1,l=a.map((function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));c.retry(u,(function(t){r.multipartComplete({Bucket:n,Region:i,Key:o,UploadId:s,Parts:l,calledBySdk:"sliceUploadFile",Headers:e.Headers||{},tracker:e.tracker},t)}),(function(e,n){t(e,n)}))}function v(e,t){var n=e.Bucket,i=e.Region,o=e.Key,s=e.AbortArray,a=e.AsyncLimit||1,r=this,u=0,l=new Array(s.length);c.eachLimit(s,a,(function(t,s){var a=u;if(o&&o!==t.Key)return l[a]={error:{KeyNotMatch:!0}},void s(null);var c=t.UploadId||t.UploadID;r.multipartAbort({Bucket:n,Region:i,Key:t.Key,Headers:e.Headers,UploadId:c},(function(e){var o={Bucket:n,Region:i,Key:t.Key,UploadId:c};l[a]={error:e,task:o},s(null)})),u++}),(function(e){if(e)return t(e);for(var n=[],i=[],o=0,s=l.length;o<s;o++){var a=l[o];a.task&&(a.error?i.push(a.task):n.push(a.task))}return t(null,{successList:n,errorList:i})}))}function y(){return(y=a(i().mark((function e(t,n){var s,a,r,c,u,p,h,g,f,m,_,v;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this,a=void 0===t.SliceSize?s.options.SliceSize:t.SliceSize,r=[],e.prev=3,e.next=6,l.getFileSizeByPath(t.FilePath);case 6:c=e.sent,e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),n({error:e.t0}),e.abrupt("return");case 13:u={TaskId:""},s.options.EnableReporter&&(p=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate."),h=c>a?"sliceUploadFile":"putObject",t.tracker=new d({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:t.Bucket,region:t.Region,apiName:"uploadFile",realApi:h,fileKey:t.Key,fileSize:c,accelerate:p,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})),l.each(t,(function(e,t){"object"!==o(e)&&"function"!=typeof e&&(u[t]=e)})),g=t.onTaskReady,t.onTaskReady=function(e){u.TaskId=e,g&&g(e)},f=t.onFileFinish,m=function(e,i){t.tracker&&t.tracker.report(e,i),f&&f(e,i,u),n&&n(e,i)},_="postObject"===s.options.SimpleUploadMethod?"postObject":"putObject",v=c>a?"sliceUploadFile":_,r.push({api:v,params:t,callback:m}),s._addTasks(r);case 24:case"end":return e.stop()}}),e,this,[[3,9]])})))).apply(this,arguments)}function I(){return I=a(i().mark((function e(t,n){var s,r,c,u,p,h,g,f,m,_,v;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this,r=void 0===t.SliceSize?s.options.SliceSize:t.SliceSize,c=0,u=0,p=l.throttleOnProgress.call(s,u,t.onProgress),h=t.files.length,g=t.onFileFinish,f=Array(h),m=function(e,t,i){p(null,!0),g&&g(e,t,i),f[i.Index]={options:i,error:e,data:t},--h<=0&&n&&n(null,{files:f})},_=[],v=function(){return t.files.map((function(e,t){return new Promise((n=a(i().mark((function n(a){var h,g,f,v,y,I,M,C,S,E,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return h=0,n.prev=1,n.next=4,l.getFileSizeByPath(e.FilePath);case 4:h=n.sent,n.next=9;break;case 7:n.prev=7,n.t0=n.catch(1);case 9:g={Index:t,TaskId:""},c+=h,s.options.EnableReporter&&(f=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate."),v=h>r?"sliceUploadFile":"putObject",e.tracker=new d({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:e.Bucket,region:e.Region,apiName:"uploadFiles",realApi:v,fileKey:e.Key,fileSize:h,accelerate:f,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})),l.each(e,(function(e,t){"object"!==o(e)&&"function"!=typeof e&&(g[t]=e)})),y=e.onTaskReady,e.onTaskReady=function(e){g.TaskId=e,y&&y(e)},I=0,M=e.onProgress,e.onProgress=function(e){u=u-I+e.loaded,I=e.loaded,M&&M(e),p({loaded:u,total:c})},C=e.onFileFinish,S=function(t,n){e.tracker&&e.tracker.report(t,n),C&&C(t,n),m&&m(t,n,g)},E="postObject"===s.options.SimpleUploadMethod?"postObject":"putObject",T=h>r?"sliceUploadFile":E,_.push({api:T,params:e,callback:S}),a(!0);case 24:case"end":return n.stop()}}),n,null,[[1,7]])}))),function(e){return n.apply(this,arguments)}));var n}))},e.next=13,Promise.all(v());case 13:s._addTasks(_);case 14:case"end":return e.stop()}}),e,this)}))),I.apply(this,arguments)}function M(e,t){var n=e.TaskId,i=e.Bucket,o=e.Region,s=e.Key,a=e.CopySource,r=e.UploadId,u=1*e.PartNumber,l=e.CopySourceRange,d=this.options.ChunkRetryTimes+1,p=this;c.retry(d,(function(t){p.uploadPartCopy({TaskId:n,Bucket:i,Region:o,Key:s,CopySource:a,UploadId:r,PartNumber:u,CopySourceRange:l,onProgress:e.onProgress,tracker:e.tracker,calledBySdk:e.calledBySdk},(function(e,n){t(e||null,n)}))}),(function(e,n){return t(e,n)}))}var C={sliceUploadFile:function(e,t){var n=this;if(!l.canFileSlice())return e.SkipTask=!0,void("postObject"===n.options.SimpleUploadMethod?n.postObject(e,t):n.putObject(e,t));var i,o,s=new u,a=e.TaskId,c=e.Bucket,d=e.Region,h=e.Key,g=e.FilePath,m=e.ChunkSize||e.SliceSize||n.options.ChunkSize,v=e.AsyncLimit,y=e.StorageClass,I=e.ServerSideEncryption,M=e.onHashProgress,C=e.tracker;C&&C.setParams({chunkSize:m}),s.on("error",(function(i){if(n._isRunningTask(a)){var o={UploadId:e.UploadData.UploadId||"",err:i,error:i};return t(o)}})),s.on("upload_complete",(function(n){var i=l.extend({UploadId:e.UploadData.UploadId||""},n);t(null,i)})),s.on("upload_slice_complete",(function(t){var u={};l.each(e.Headers,(function(e,t){var n=t.toLowerCase();0!==n.indexOf("x-cos-meta-")&&"pic-operations"!==n||(u[t]=e)})),_.call(n,{Bucket:c,Region:d,Key:h,UploadId:t.UploadId,SliceList:t.SliceList,Headers:u,tracker:C},(function(e,c){if(n._isRunningTask(a)){if(r.removeUsing(t.UploadId),e)return o(null,!0),s.emit("error",e);r.removeUploadId(t.UploadId),o({loaded:i,total:i},!0),s.emit("upload_complete",c)}}))})),s.on("get_upload_data_finish",(function(t){var u=r.getFileId(e.FileStat,e.ChunkSize,c,h);u&&r.saveUploadId(u,t.UploadId,n.options.UploadIdCacheLimit),r.setUsing(t.UploadId),o(null,!0),f.call(n,{TaskId:a,Bucket:c,Region:d,Key:h,FilePath:g,FileSize:i,SliceSize:m,AsyncLimit:v,ServerSideEncryption:I,UploadData:t,onProgress:o,tracker:C},(function(e,t){if(n._isRunningTask(a))return e?(o(null,!0),s.emit("error",e)):void s.emit("upload_slice_complete",t)}))})),s.on("get_file_size_finish",(function(){if(o=l.throttleOnProgress.call(n,i,e.onProgress),e.UploadData.UploadId)s.emit("get_upload_data_finish",e.UploadData);else{var t=l.extend({TaskId:a,Bucket:c,Region:d,Key:h,Headers:e.Headers,StorageClass:y,FilePath:g,FileSize:i,SliceSize:m,onHashProgress:M,tracker:C},e);t.FileSize=i,p.call(n,t,(function(t,i){if(n._isRunningTask(a)){if(t)return s.emit("error",t);e.UploadData.UploadId=i.UploadId,e.UploadData.PartList=i.PartList,s.emit("get_upload_data_finish",e.UploadData)}}))}})),i=e.ContentLength,delete e.ContentLength,!e.Headers&&(e.Headers={}),l.each(e.Headers,(function(t,n){"content-length"===n.toLowerCase()&&delete e.Headers[n]})),function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],o=1048576,s=0;s<t.length&&!(i/(o=1024*t[s]*1024)<=n.options.MaxPartNumber);s++);e.ChunkSize=e.SliceSize=m=Math.max(m,o)}(),0===i?(e.Body="",e.ContentLength=0,e.SkipTask=!0,n.putObject(e,(function(e,n){if(e)return t(e);t(null,n)}))):s.emit("get_file_size_finish")},abortUploadTask:function(e,t){var n=e.Bucket,i=e.Region,o=e.Key,s=e.UploadId,a=e.Level||"task",r=e.AsyncLimit,c=this,l=new u;if(l.on("error",(function(e){return t(e)})),l.on("get_abort_array",(function(s){v.call(c,{Bucket:n,Region:i,Key:o,Headers:e.Headers,AsyncLimit:r,AbortArray:s},(function(e,n){if(e)return t(e);t(null,n)}))})),"bucket"===a)h.call(c,{Bucket:n,Region:i,calledBySdk:"abortUploadTask"},(function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])}));else if("file"===a){if(!o)return t({error:"abort_upload_task_no_key"});h.call(c,{Bucket:n,Region:i,Key:o,calledBySdk:"abortUploadTask"},(function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])}))}else{if("task"!==a)return t({error:"abort_unknown_level"});if(!s)return t({error:"abort_upload_task_no_id"});if(!o)return t({error:"abort_upload_task_no_key"});l.emit("get_abort_array",[{Key:o,UploadId:s}])}},uploadFile:function(e,t){return y.apply(this,arguments)},uploadFiles:function(e,t){return I.apply(this,arguments)},sliceCopyFile:function(e,t){var n=new u,i=this,o=e.Bucket,s=e.Region,a=e.Key,d=e.CopySource,p=l.getSourceParams.call(this,d);if(p){var h=p.Bucket,f=p.Region,m=decodeURIComponent(p.Key),_=void 0===e.CopySliceSize?i.options.CopySliceSize:e.CopySliceSize;_=Math.max(0,_);var v,y,I=e.CopyChunkSize||this.options.CopyChunkSize,C=this.options.CopyChunkParallelLimit,S=this.options.ChunkRetryTimes+1,E=0,T=0,k={},D={},R={};n.on("copy_slice_complete",(function(n){l.each(e.Headers,(function(e,t){t.toLowerCase().indexOf("x-cos-meta-")}));var u=l.map(n.PartList,(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));c.retry(S,(function(t){i.multipartComplete({Bucket:o,Region:s,Key:a,UploadId:n.UploadId,Parts:u,tracker:e.tracker,calledBySdk:"sliceCopyFile"},t)}),(function(e,i){if(r.removeUsing(n.UploadId),e)return y(null,!0),t(e);r.removeUploadId(n.UploadId),y({loaded:v,total:v},!0),t(null,i)}))})),n.on("get_copy_data_finish",(function(u){var p=r.getCopyFileId(d,k,I,o,a);p&&r.saveUploadId(p,u.UploadId,i.options.UploadIdCacheLimit),r.setUsing(u.UploadId);var h=l.filter(u.PartList,(function(e){return e.Uploaded&&(T+=e.PartNumber>=E&&v%I||I),!e.Uploaded}));c.eachLimit(h,C,(function(t,n){var r=t.PartNumber,l=t.CopySourceRange,p=t.end-t.start,h=0;c.retry(S,(function(t){M.call(i,{Bucket:o,Region:s,Key:a,CopySource:d,UploadId:u.UploadId,PartNumber:r,CopySourceRange:l,tracker:e.tracker,calledBySdk:"sliceCopyFile",onProgress:function(e){T+=e.loaded-h,h=e.loaded,y({loaded:T,total:v})}},t)}),(function(e,i){if(e)return n(e);y({loaded:T,total:v}),T+=p-h,t.ETag=i.ETag,n(e||null,i)}))}),(function(e){if(e)return r.removeUsing(u.UploadId),y(null,!0),t(e);n.emit("copy_slice_complete",u)}))})),n.on("get_chunk_size_finish",(function(){var c=function(){i.multipartInit({Bucket:o,Region:s,Key:a,Headers:R,tracker:e.tracker,calledBySdk:"sliceCopyFile"},(function(i,o){if(i)return t(i);e.UploadId=o.UploadId,n.emit("get_copy_data_finish",{UploadId:e.UploadId,PartList:e.PartList})}))},u=r.getCopyFileId(d,k,I,o,a),p=r.getUploadIdList(u);if(!u||!p)return c();!function t(u){if(u>=p.length)return c();var d=p[u];if(r.using[d])return t(u+1);g.call(i,{Bucket:o,Region:s,Key:a,UploadId:d,tracker:e.tracker,calledBySdk:"sliceCopyFile"},(function(i,o){if(i)r.removeUploadId(d),t(u+1);else{if(r.using[d])return t(u+1);var s={},a=0;l.each(o.PartList,(function(e){var t=parseInt(e.Size),n=a+t-1;s[e.PartNumber+"|"+a+"|"+n]=e.ETag,a+=t})),l.each(e.PartList,(function(e){var t=s[e.PartNumber+"|"+e.start+"|"+e.end];t&&(e.ETag=t,e.Uploaded=!0)})),n.emit("get_copy_data_finish",{UploadId:d,PartList:e.PartList})}}))}(0)})),n.on("get_file_size_finish",(function(){var o;if(function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o<t.length&&!(v/(n=1024*t[o]*1024)<=i.options.MaxPartNumber);o++);e.ChunkSize=I=Math.max(I,n),E=Math.ceil(v/I);for(var s=[],a=1;a<=E;a++){var r=(a-1)*I,c=a*I<v?a*I-1:v-1,u={PartNumber:a,start:r,end:c,CopySourceRange:"bytes="+r+"-"+c};s.push(u)}e.PartList=s}(),(o="Replaced"===e.Headers["x-cos-metadata-directive"]?e.Headers:D)["x-cos-storage-class"]=e.Headers["x-cos-storage-class"]||D["x-cos-storage-class"],o=l.clearKey(o),"ARCHIVE"===D["x-cos-storage-class"]||"DEEP_ARCHIVE"===D["x-cos-storage-class"]){var s=D["x-cos-restore"];if(!s||'ongoing-request="true"'===s)return void t({error:"Unrestored archive object is not allowed to be copied"})}delete o["x-cos-copy-source"],delete o["x-cos-metadata-directive"],delete o["x-cos-copy-source-If-Modified-Since"],delete o["x-cos-copy-source-If-Unmodified-Since"],delete o["x-cos-copy-source-If-Match"],delete o["x-cos-copy-source-If-None-Match"],n.emit("get_chunk_size_finish")})),i.headObject({Bucket:h,Region:f,Key:m,tracker:e.tracker,calledBySdk:"sliceCopyFile"},(function(o,s){if(o)o.statusCode&&404===o.statusCode?t({ErrorStatus:m+" Not Exist"}):t(o);else if(void 0!==(v=e.FileSize=s.headers["content-length"])&&v)if(e.tracker&&e.tracker.setParams({httpSize:v}),y=l.throttleOnProgress.call(i,v,e.onProgress),v<=_)e.Headers["x-cos-metadata-directive"]||(e.Headers["x-cos-metadata-directive"]="Copy"),i.putObjectCopy(Object.assign(e,{calledBySdk:"sliceCopyFile"}),(function(e,n){if(e)return y(null,!0),t(e);y({loaded:v,total:v},!0),t(e,n)}));else{var a=s.headers;k=a,D={"Cache-Control":a["cache-control"],"Content-Disposition":a["content-disposition"],"Content-Encoding":a["content-encoding"],"Content-Type":a["content-type"],Expires:a.expires,"x-cos-storage-class":a["x-cos-storage-class"]},l.each(a,(function(e,t){var n="x-cos-meta-";0===t.indexOf(n)&&t.length>11&&(D[t]=e)})),n.emit("get_file_size_finish")}else t({error:'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.'})}))}else t({error:"CopySource format error"})}};e.exports.init=function(e,t){t.transferToTaskMethod(C,"sliceUploadFile"),l.each(C,(function(t,n){e.prototype[n]=l.apiWrapper(n,t)}))}},function(e,t){var n={eachLimit:function(e,t,n,i){if(i=i||function(){},!e.length||t<=0)return i();var o=0,s=0,a=0;!function r(){if(o>=e.length)return i();for(;a<t&&s<e.length;)a+=1,n(e[(s+=1)-1],(function(t){t?(i(t),i=function(){}):(a-=1,(o+=1)>=e.length?i():r())}))}()},retry:function(e,t,n){e<1?n():function i(o){t((function(t,s){t&&o<e?i(o+1):n(t,s)}))}(1)}};e.exports=n}]);const Lg=bg(Ag.exports);var Pg={exports:{}};Pg.exports=function(){function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function t(e){if(Array.isArray(e))return e}function n(e,t,n){t=c(t);var i=e;if(!(t=l()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))||"object"!=typeof t&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=i))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,y(i.key),i)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){var n,i,o,s,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return o=!(i=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return i=e.done,e},e:function(e){o=!0,n=e},f:function(){try{i||null==a.return||a.return()}finally{if(o)throw n}}};if(Array.isArray(e)||(a=M(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),s=0,{s:t=function(){},n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!e})()}function d(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)),i}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e,t){if(null==e)return{};var n,i=function(e,t){if(null==e)return{};var n,i={};for(n in e)if({}.hasOwnProperty.call(e,n)){if(0<=t.indexOf(n))continue;i[n]=e[n]}return i}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),s=0;s<o.length;s++)n=o[s],0<=t.indexOf(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}function m(e,t){return(m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _(e,n){return t(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,s,a,r=[],c=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=s.call(n)).done)&&(r.push(i.value),r.length!==t);c=!0);}catch(l){u=!0,o=l}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return r}}(e,n)||M(e,n)||p()}function v(t){return function(t){if(Array.isArray(t))return e(t)}(t)||d(t)||M(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return"symbol"==typeof(e=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);if("object"!=typeof(t=t.call(e,"string")))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e))?e:e+""}function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function M(t,n){var i;if(t)return"string"==typeof t?e(t,n):"Map"===(i="Object"===(i={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:i)||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?e(t,n):void 0}function C(e){var t="function"==typeof Map?new Map:void 0;return function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){var i;return l()?Reflect.construct.apply(null,arguments):((i=[null]).push.apply(i,t),t=new(e.bind.apply(e,i)),n&&m(t,n.prototype),t)}(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)}(e)}var S={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",ROOM_CUSTOM_DATA_RECEIVED:"onRoomCustomDataReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",MESSAGE_REACTIONS_UPDATED:"onMessageReactionsUpdated",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",MY_FOLLOWERS_LIST_UPDATED:"onMyFollowersListUpdated",MY_FOLLOWING_LIST_UPDATED:"onMyFollowingListUpdated",MUTUAL_FOLLOWERS_LIST_UPDATED:"onMutualFollowersListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",ALL_RECEIVE_MESSAGE_OPT_UPDATED:"onAllReceiveMessageOptUpdated",SERVER_CONFIG_UPDATED:"onServerConfigUpdated"},E={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_ROOM:"Room",GRP_LIVE:"Live",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",RECEIVE_WITH_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_MSG_EXCEPT_AT:"NotReceiveMsgExceptAt",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3,IOS_OFFLINE_PUSH_NO_SOUND:"push.no_sound",IOS_OFFLINE_PUSH_DEFAULT_SOUND:"default"},T={NEW_INVITATION_RECEIVED:"newInvitationReceived",INVITEE_ACCEPTED:"ts_invitee_accepted",INVITEE_REJECTED:"ts_invitee_rejected",INVITATION_CANCELLED:"ts_invitation_cancelled",INVITATION_TIMEOUT:"ts_invitation_timeout",INVITATION_MODIFIED:"ts_invitation_modified",ACTION_TYPE_UNKNOWN:0,ACTION_TYPE_INVITE:1,ACTION_TYPE_CANCEL_INVITE:2,ACTION_TYPE_ACCEPT_INVITE:3,ACTION_TYPE_REJECT_INVITE:4,ACTION_TYPE_INVITE_TIMEOUT:5},k=s((function e(){i(this,e),this.cache=[],this.options=null}),[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&0<this.middlewares.length)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),D=s((function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;i(this,e),this.high=t,this.low=n}),[{key:"equal",value:function(e){return null!==e&&this.low===e.low&&this.high===e.high}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),R={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",BACKUP_WEB:"wss://*w4c.my-cpaas.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",BACKUP_WEB:"wss://*w4c.my-cpaas.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT0:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",BACKUP_WEB:"wss://*w4s.my-cpaas.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT0:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",BACKUP_WEB:"wss://*w4k.my-cpaas.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT0:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",BACKUP_WEB:"wss://*w4g.my-cpaas.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT0:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",BACKUP_WEB:"wss://*w4i.my-cpaas.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{DEFAULT0:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",BACKUP_WEB:"wss://*w4j.my-cpaas.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT0:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",BACKUP_WEB:"wss://*w4u.my-cpaas.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT0:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",BACKUP_WEB:"wss://*w4y.my-cpaas.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},O={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},b="1.7.3",A=537048168,L="CHINA",P={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){this.CURRENT=R.PRODUCTION[0<arguments.length&&void 0!==arguments[0]?arguments[0]:L]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GRP:"group_open_http_svc",GRP_AV:"group_open_avchatroom_http_svc",GRP_COMMUNITY:"million_group_open_http_svc",GRP_ATTR:"group_open_attr_http_svc",FD:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GRP_NO_AUTH:"group_open_http_noauth_svc",BIG_GRP_POLLING:"group_open_long_polling_http_svc",BIG_GRP_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MSG:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate",IM_OPEN_SPEECH:"im_open_speech",MSG_SEARCH:"message_search",GRP_SEARCH:"group_search",GRP_MEMBER_SEARCH:"group_member_search",USER_SEARCH:"user_search",FOLLOW:"follow",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},N={SEARCH_GRP_SNS:new D(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new D(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new D(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new D(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new D(0,Math.pow(2,6)).toString(),USER_STATUS:new D(0,Math.pow(2,7)).toString(),CONV_MARK:new D(0,Math.pow(2,9)).toString(),CONV_GROUP:new D(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new D(0,Math.pow(2,11)).toString(),MSG_EXT:new D(0,Math.pow(2,13)).toString(),GRP_COUNTER:new D(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new D(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new D(Math.pow(2,7)).toString(),PLUGIN_CS:new D(Math.pow(2,8)).toString(),PLUGIN_PUSH:new D(Math.pow(2,9)).toString(),PLUGIN_BOT:new D(Math.pow(2,10)).toString(),MSG_REACTION:new D(Math.pow(2,16)).toString(),FOLLOW:new D(Math.pow(2,20)).toString()},w="group_profile",U=["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],G=["Role","JoinTime","MsgSeq","MsgFlag"],x="web.sdk.qcloud.com",F="web.sdk.cloud.tencent.cn",B="web.sdk.tencent.cn";P.HOST.setCurrent(L);for(var q,V=void 0!==Pn&&"function"==typeof Pn.getSystemInfoSync&&Boolean(Pn.getSystemInfoSync().fontSizeSetting),j=V&&"function"==typeof Pn.createGamePortal,H="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),K="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),z="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),W="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),Y="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,$=void 0!==Nn&&"undefined"==typeof window&&"function"==typeof Nn.requireNativePlugin,J=V&&"object"===I(Pn.miniapp),X=void 0!==Nn,Q=V||H||K||z||W||$||Y,Z="undefined"==typeof window&&!Q&&void 0!==Og&&void 0!==Og.NativeScriptGlobals,ee=void 0!==Og&&(void 0!==Og.nativeModuleProxy||void 0!==Og.ReactNative),te=void 0!==Nn?!Q:"undefined"!=typeof window&&!Q&&!ee,ne=H?qq:K?tt:z?swan:W?my:V?Pn:$?Nn:Y?jd:{},ie=te&&window&&window.navigator&&window.navigator.userAgent||"",oe=(Y="WEB",/(micromessenger|webbrowser)/i.test(ie)?Y="WEB":H?Y="QQ_MP":K?Y="TT_MP":z?Y="BAIDU_MP":W?Y="ALI_MP":V?Y=J?"DONUT_NATIVE_APP":"WX_MP":$?Y="UNI_NATIVE_APP":Z?Y="NS_NATIVE_APP":ee&&(Y="RN_NATIVE_APP"),O[Y]),se=(J=/iPad/i.test(ie),Z=/iPhone/i.test(ie)&&!J,Y=/iPod/i.test(ie),Z||J||Y),ae=(Z=ie.match(/OS (\d+)_/i))&&Z[1]?Z[1]:null,re=/Android/i.test(ie),ce=(J=ie.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(Y=J[1]&&parseFloat(J[1]),Z=J[2]&&parseFloat(J[2]),Y&&Z?parseFloat(J[1]+"."+J[2]):Y||null):null,ue=(J=!(Z=/Edge/i.test(ie))&&/Chrome/i.test(ie),/MSIE/.test(ie)||-1<ie.indexOf("Trident")&&-1<ie.indexOf("rv:11.0")),le=Y=!(Y=(Y=/MSIE\s(\d+)\.\d/.exec(ie))&&parseFloat(Y[1]))&&/Trident\/7.0/i.test(ie)&&/rv:11.0/.test(ie)?11:Y,de=(Y=/Safari/i.test(ie)&&!J&&!re&&!Z,/Windows/i.test(ie)),pe=/MAC OS X/i.test(ie),he=te&&"undefined"!=typeof Worker&&!ue,ge=re||se,fe=te&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,me="undefined"!=typeof window&&void 0!==window.navigator&&(J=window.navigator.standalone,!(!se||J||Y)),_e="undefined"!=typeof console?console:void 0!==Og&&Og.console?Og.console:"undefined"!=typeof window&&window.console?window.console:{},ve=function(){},ye=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Ie=ye.length;Ie--;)q=ye[Ie],console[q]||(_e[q]=ve);function Me(){var e=new Date;return e.setTime(ke()),e}function Ce(){Te=0}function Se(){return Math.floor(ke()/1e3)}var Ee=_e,Te=0,ke=function(){return(new Date).getTime()+Te},De=0;function Re(){return Vt()?"%c Chat %c":"Chat"}function Oe(){var e=Me();return e.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){var t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(e.getMilliseconds())}var be={arguments2String:function(e){var t="";if(1===e.length)t=e[0];else for(var n=0,i=e.length;n<i;n++){if(dt(e[n]))try{t+=pt(e[n])?JSON.stringify(e[n],["message","code"]):JSON.stringify(e[n])}catch(o){t+=o?o.message:"";break}else t+=e[n];t+=" "}return t},_exec:function(e,t){Vt()?Ee[e](Re(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Oe(),t):Ee[e]("".concat(Re()," ").concat(Oe()," ").concat(t))},d:function(){var e;De<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;De<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;De<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;De<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;De<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;De<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+De+" to "+e),De=e},getLevel:function(){return De}},Ae={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},Le={NICK:"".concat(Z="Tag_Profile_IM_","Nick"),GENDER:"".concat(Z,"Gender"),BIRTHDAY:"".concat(Z,"BirthDay"),LOCATION:"".concat(Z,"Location"),SELFSIGNATURE:"".concat(Z,"SelfSignature"),ALLOWTYPE:"".concat(Z,"AllowType"),LANGUAGE:"".concat(Z,"Language"),AVATAR:"".concat(Z,"Image"),MESSAGESETTINGS:"".concat(Z,"MsgSettings"),ADMINFORBIDTYPE:"".concat(Z,"AdminForbidType"),LEVEL:"".concat(Z,"Level"),ROLE:"".concat(Z,"Role")},Pe={GROUP:"".concat("Tag_SNS_IM_","Group"),REMARK:"".concat("Tag_SNS_IM_","Remark"),ADDSOURCE:"".concat("Tag_SNS_IM_","AddSource"),ADDWORDING:"".concat("Tag_SNS_IM_","Wording"),ADDTIME:"".concat("Tag_SNS_IM_","AddTime")},Ne={UNKNOWN:"".concat(J="Gender_Type_","Unknown"),FEMALE:"".concat(J,"Female"),MALE:"".concat(J,"Male")},we={NONE:"".concat("AdminForbid_Type_","None"),SEND_OUT:"".concat("AdminForbid_Type_","SendOut")},Ue={NEED_CONFIRM:"".concat("AllowType_Type_","NeedConfirm"),ALLOW_ANY:"".concat("AllowType_Type_","AllowAny"),DENY_ANY:"".concat("AllowType_Type_","DenyAny")},Ge="JoinedSuccess",xe="WaitAdminApproval",Fe="@TOPIC#_",Be=Object.prototype.hasOwnProperty;function qe(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(We(e)){for(var t in e)if(Be.call(e,t))return!1;return!0}return!!(Ve(e)||je(e)||He(e))&&0===e.size}function Ve(e){return"map"===ht(e)}function je(e){return"set"===ht(e)}function He(e){return"file"===ht(e)}function Ke(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"===I(e)&&e.constructor===Number)}function ze(e){return null!==e&&"object"===I(e)}function We(e){if("object"===I(e)&&null!==e){if(null===(e=Object.getPrototypeOf(e)))return 1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t}}function Ye(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===ht(e)}function $e(e){return Ye(e)&&0<e.length}function Je(e){return"function"==typeof e}function Xe(e){return"filelist"===ht(e)}function Qe(e){return"string"==typeof e&&(e=e[0],!/[^a-zA-Z0-9]/.test(e))}function Ze(e,t,n,i){if(!dt(e)||!dt(t))return 0;for(var o,s=0,a=Object.keys(t),r=0,c=a.length;r<c;r++)if(o=a[r],!(lt(t[o])||n&&n.includes(o)))if(dt(e[o])&&dt(t[o]))s+=Ze(e[o],t[o],n,i);else{if(i&&i.includes(t[o]))continue;e[o]!==t[o]&&(e[o]=t[o],s+=1)}return s}function et(e,t){var n,i=new Map,o=a(e.entries());try{for(o.s();!(n=o.n()).done;){var s=_(n.value,2),r=s[0],c=s[1];c&&i.set(r,t?JSON.stringify(c):JSON.parse(JSON.stringify(c)))}}catch(u){o.e(u)}finally{o.f()}return i}function nt(e){if(0===e.length)return 0;for(var t=0,n=0,i="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)n+=e[t++].charCodeAt[t]<=255?1:!1===i?3:2;return n}function it(e){return e=e||99999999,Math.round(Math.random()*e)}function ot(){for(var e="",t=32;0<t;--t)e+=gt[Math.floor(Math.random()*ft)];return e}function st(e,t){for(var n in e)if(e[n]===t)return 1}function at(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")}function rt(e){if(0===Object.getOwnPropertyNames(e).length)return Object.create(null);var t,n,i=Array.isArray(e)?[]:Object.create(null);for(n in e)null!==e[n]?void 0!==e[n]?(t=I(e[n]),0<=["string","number","function","boolean"].indexOf(t)?i[n]=e[n]:i[n]=rt(e[n])):i[n]=void 0:i[n]=null;return i}var ct=["url"],ut=function(e){return"string"==typeof e},lt=function(e){return void 0===e},dt=function(e){return Ye(e)||ze(e)},pt=function(e){return e instanceof Error},ht=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},gt=(Date.now||(Date.now=function(){return(new Date).getTime()}),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),ft=gt.length,mt={};function _t(e,t){var n;return!(!Ye(e)||!Ye(t))&&(n=!1,t.forEach((function(t){var i=t.key,o=(t=t.value,e.find((function(e){return e.key===i})));o?o.value!==t&&(o.value=t,n=!0):(e.push({key:i,value:t}),n=!0)})),n)}function vt(e){return qe(e)?[]:e.filter((function(e){return!0===e.isModified}))}function yt(e){if(We(e)&&We(e.webhookInfo)){var t=[];if(e.webhookInfo.disableCloudMessagePreHook&&t.push("ForbidBeforeSendMsgCallback"),e.webhookInfo.disableCloudMessagePostHook&&t.push("ForbidAfterSendMsgCallback"),0!==t.length)return t}}function It(e){return qe(e)?[]:e.filter((function(e){return!1===e.isModified}))}function Mt(e){return e===E.GRP_AVCHATROOM}function Ct(e){var t=e.type;return e=e.groupID,t===E.GRP_COMMUNITY||"".concat(e).startsWith("@TGS#_")&&!"".concat(e).includes(Fe)}function St(e){return"".concat(e).startsWith("@TGS#_")&&"".concat(e).includes(Fe)}function Et(e){return ut(e)&&e.slice(0,3)===E.CONV_C2C}function Tt(e){return ut(e)&&e.slice(0,5)===E.CONV_GROUP}function kt(e){return ut(e)&&e===E.CONV_SYSTEM}function Dt(e,t){var n={};return Object.keys(e).forEach((function(i){n[i]=t(e[i],i)})),n}function Rt(e){return ee?Promise.resolve({width:0,height:0}):Q?new Promise((function(t,n){ne.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):ue&&9===le?Promise.resolve({width:0,height:0}):new Promise((function(t,n){var i=new Image;i.onload=function(){t({width:this.width,height:this.height}),i=null},i.onerror=function(){t({width:0,height:0}),i=null},i.src=e}))}function Ot(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function bt(){var e=re?"android":se?"ios":de?"windows":pe?"mac":"unknown";if(Q)try{var t=ne.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(n){}return e}function At(e,t){e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.length<n;)e.push("0");for(;t.length<n;)t.push("0");for(var i=0;i<n;i++){var o=parseInt(e[i]),s=parseInt(t[i]);if(s<o)return 1;if(o<s)return-1}return 0}function Lt(e){var t=void 0===(t=e.originUrl)?void 0:t,n=e.originWidth,i=e.originHeight,o=(e=void 0===(e=e.min)?198:e,{url:void 0,width:0,height:0});return((n=parseInt(n))<=(i=parseInt(i))?n:i)<=e?(o.url=t,o.width=n,o.height=i):(i<=n?(o.width=Math.ceil(n*e/i),o.height=e):(o.width=e,o.height=Math.ceil(i*e/n)),i=t&&-1<t.indexOf("?")?"".concat(t,"&"):"".concat(t,"?"),o.url="".concat(i,198===e?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")),lt(t)?f(o,ct):o}function Pt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n<e.length;n++)e[n].setType(n)}function Nt(e){return(e=e.servcmd).slice(e.indexOf(".")+1)}function wt(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function Ut(e,t){return e.includes(t)}function Gt(e,t){return e.includes(t)}function xt(e){return e.split(Fe)[0]}function Ft(e,t,n){if(lt(t))return"";switch(e){case E.MSG_TEXT:return t.text;case E.MSG_IMAGE:return n?"[Image]":"[图片]";case E.MSG_LOCATION:return n?"[Location]":"[位置]";case E.MSG_AUDIO:return n?"[Voice]":"[语音]";case E.MSG_VIDEO:return n?"[Video]":"[视频]";case E.MSG_FILE:return n?"[File]":"[文件]";case E.MSG_CUSTOM:return n?"[Custom Messages]":"[自定义消息]";case E.MSG_GRP_TIP:return n?"[Group Notification]":"[群提示消息]";case E.MSG_GRP_SYS_NOTICE:return n?"[Group System Message]":"[群系统通知]";case E.MSG_FACE:return n?"[Animated Sticker]":"[动画表情]";case E.MSG_MERGER:return n?"[Chat Record]":"[聊天记录]";default:return""}}function Bt(e){return e===E.MSG_TEXT||e===E.MSG_CUSTOM||e===E.MSG_LOCATION||e===E.MSG_FACE}function qt(e){var t=[];if(ut(e)){var n=e.length;if(0!==n)for(var i=n-1;0<=i;i--)"1"===e[i]&&t.push(Math.pow(2,n-i-1))}return t}function Vt(){return!ue&&!Q}function jt(e){return"the length of userIDList cannot exceed ".concat(e)}function Ht(e){var t;if(Ye(e)&&0!==e.length)return t=0,e.forEach((function(e){t+=e})),t.toFixed(0)}function Kt(e){var t;if(Ye(e)&&0!==e.length)return t=0,e.forEach((function(e){t+=e})),(t/e.length).toFixed(0)}function zt(e,t,n){t=!(1<arguments.length&&void 0!==t)||t,n=!(2<arguments.length&&void 0!==n)||n;var i=Date.now();return t?n?"".concat(i-e," ms"):"".concat(Math.round((i-e)/1e3)," s"):n?i-e:Math.round((i-e)/1e3)}function Wt(e){return!!(e&&1<e)}function Yt(e,t,n,i){var o,s,a;return void 0===t||(o=!0,t.required&&qe(e)&&(be.e("[".concat(n,'] Missing required params: "').concat(i,'".')),o=!1),qe(e)||(s=ht(e))===(a=t.type.toLowerCase())||"asyncfunction"===s&&"function"===a||(be.e("[".concat(n,'] Invalid params: type check failed for "').concat(i,'". Expected ').concat(t.type,".")),o=!1),t.validator&&!t.validator(e,n,i)&&(be.e("[".concat(n,'] Invalid params: custom validator check failed for "').concat(i,'".')),o=!1),o)}function $t(e){return!(!e||!(Et(e)||Tt(e)||kt(e))&&((e=Gn("InvalidConversationID",e))&&be.w(e),1))}function Jt(e){""!==e.desc&&""!==Gn("API_REFER")&&be.w("[".concat(e.api,"] | ").concat(e.paramName," | ").concat(e.desc,", ").concat(Gn("API_REFER")).concat(e.api))}function Xt(){return Gn("StringRequiredLog")}function Qt(e){return Gn("NonEmptyStringRequiredLog",e)}function Zt(){return Gn("NumberRequiredLog")}function en(){return Gn("UndefinedNotAllowedLog")}function tn(){return Gn("FileRequiredLog")}function nn(){return Gn("FunctionRequiredLog")}function on(){return Gn("ArrayRequiredLog")}function sn(){return Gn("NonEmptyArrayLog")}function an(){return Gn("CallbackMissingLog")}function rn(){return Gn("PositiveIntegerRequiredLog")}function cn(e,t){return Gn("StringNotLongerThanLog",e,t)}function un(e,t){return Gn("NumberGreaterThanLog",e,t)}function ln(e,t){return Gn("NumberGreaterOrEqualLog",e,t)}function dn(e){return Gn("KeyValueStringRequiredLog",e)}function pn(){return Gn("PlainObjectRequiredLog")}function hn(){return Gn("NonEmptyContentRequiredLog")}function gn(){return Gn("FileNotSelectedLog")}function fn(){return Gn("MessageInstanceRequiredLog")}function mn(){return Gn("NonAnonymousFunctionLog")}function _n(){return Gn("MessageExtensionNotAvailableLog")}function vn(){return Gn("MessageReactionRequiredLog")}function yn(e,t){return Gn("ContainsUnsupportedTypeLog",e,t)}function In(e,t,n,i){var o=i.allowUndefined,s=i.allowEmpty;return i=i.maxLength,lt(e)?!!o||(Jt({api:t,paramName:n,desc:en()}),!1):Ye(e)?!(0===e.length&&(Jt({api:t,paramName:n,desc:sn()}),!s)||i&&e.length>i&&(Jt({api:t,paramName:n,desc:Gn("MaximumArrayLengthLog",n,i)}),1)):(Jt({api:t,paramName:n,desc:on()}),!1)}function Mn(e,t,n,i){var o=i.allowUndefined,s=i.min;return i=i.max,lt(e)?!!o||(Jt({api:t,paramName:n,desc:en()}),!1):Ke(e)?Ke(s)&&e<s?(Jt({api:t,paramName:n,desc:0===s?ln(n,s):un(n,s-1)}),!1):!(Ke(i)&&i<e&&(Jt({api:t,paramName:n,desc:Gn("MaximumNumberLog",n,i)}),1)):(Jt({api:t,paramName:n,desc:Zt()}),!1)}function Cn(e){return{code:0,data:e||{}}}function Sn(e){return Promise.resolve(Cn(e))}function En(e){var t,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return e instanceof Bn?(n&&null!==Vn&&Vn.emit(S.ERROR,e),Promise.reject(e)):e instanceof Error?(t=new Bn({code:qn.UNCAUGHT_ERROR}),n&&null!==Vn&&Vn.emit(S.ERROR,t),Promise.reject(t)):lt(e)||lt(e.code)?Promise.reject(new Bn({code:qn.UNCAUGHT_ERROR})):(t=new Bn(e),n&&null!==Vn&&Vn.emit(S.ERROR,t),Promise.reject(t))}var Tn="unSend",kn="success",Dn="fail",Rn="notStart",On="pending",bn="resolved",An="rejected",Ln={type:"Boolean",required:!0},wn={type:"number",required:!0},Un={keywordListForMsg:{type:"Array",required:!1,validator:function(e,t,n){return In(e,t,n,{allowUndefined:!0,allowEmpty:!0,maxLength:5})}},keywordListExceptMsg:{type:"Array",required:!0,validator:function(e,t,n){return In(e,t,n,{allowUndefined:!1,allowEmpty:!1,maxLength:5})}},keywordListMatchType:{type:"String",required:!1,validator:function(e,t,n){return!e||"or"===e||"and"===e||Jt({api:t,paramName:n,desc:"".concat(e," is invalid match type")})}},cursor:{type:"String",required:!1},count:{type:"Number",required:!1,validator:function(e,t,n){return Mn(e,t,n,{allowUndefined:!0,min:1,max:100})}},groupTypeList:{type:"Array",required:!1,validator:function(e,t,n){var i;return!e||!(!In(e,t,n,{allowUndefined:!0,allowEmpty:!0})||(i=[E.GRP_PUBLIC,E.GRP_COMMUNITY,E.GRP_WORK,E.GRP_MEETING],0<e.filter((function(e){return-1===i.indexOf(e)})).length&&(Jt({api:t,paramName:n,desc:yn(n,"group")}),1)))}}},Gn=null,xn={hookGetAPITips:function(e){Gn=e},login:{userID:Y={type:"String",required:!0},userSig:Y},addToBlacklist:{userIDList:Z={type:"Array",required:!0}},removeFromBlacklist:{userIDList:Z},on:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Jt({api:t,paramName:n,desc:Qt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Jt({api:t,paramName:n,desc:nn()}),!1):(""===e.name&&Jt({api:t,paramName:n,desc:mn()}),!0)}}],once:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Jt({api:t,paramName:n,desc:Qt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Jt({api:t,paramName:n,desc:nn()}),!1):(""===e.name&&Jt({api:t,paramName:n,desc:mn()}),!0)}}],off:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Jt({api:t,paramName:n,desc:Qt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Jt({api:t,paramName:n,desc:nn()}),!1):(""===e.name&&Jt({api:t,paramName:n,desc:mn()}),!0)}}],sendMessage:[g({name:"message"},J={type:"Object",required:!0})],setMessageExtensions:[g(g({name:"message"},J),{},{validator:function(e,t,n){return e.status===kn&&!0===e.isSupportExtension||(Jt({api:t,paramName:n,desc:_n()}),!1)}}),g({name:"extensions"},Z)],getMessageExtensions:[g(g({name:"message"},J),{},{validator:function(e,t,n){return e.status===kn&&!0===e.isSupportExtension||(Jt({api:t,paramName:n,desc:_n()}),!1)}})],deleteMessageExtensions:[g(g({name:"message"},J),{},{validator:function(e,t,n){return e.status===kn&&!0===e.isSupportExtension||(Jt({api:t,paramName:n,desc:_n()}),!1)}})],addMessageReaction:[g(g({name:"message"},J),{},{validator:function(e,t,n){return e.status===kn||(Jt({api:t,paramName:n,desc:vn()}),!1)}}),g({name:"reactionID"},Y)],removeMessageReaction:[g(g({name:"message"},J),{},{validator:function(e,t,n){return e.status===kn||(Jt({api:t,paramName:n,desc:vn()}),!1)}}),g({name:"reactionID"},Y)],getMessageReactions:{messageList:g({},Z)},getAllUserListOfMessageReaction:{message:g(g({},J),{},{validator:function(e,t,n){return e.status===kn||(Jt({api:t,paramName:n,desc:vn()}),!1)}}),reactionID:g({},Y),nextSeq:{type:"Number"},count:{type:"Number"}},getMessageList:{conversationID:g(g({},Y),{},{validator:$t}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e,t,n){return!(!lt(e)&&!/^[1-9][0-9]*$/.test(e)&&(Jt({api:t,paramName:n,desc:rn()}),1))}}},getMessageListHopping:{conversationID:g(g({},Y),{},{validator:$t}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(e,t,n){return!(!lt(e)&&0!==e&&1!==e&&(Jt({api:t,paramName:n,desc:Gn("0Or1RequiredLog")}),1))}},count:{type:"Number",validator:function(e,t,n){return!(!lt(e)&&!/^[1-9][0-9]*$/.test(e)&&(Jt({api:t,paramName:n,desc:rn}),1))}}},setMessageRead:{conversationID:g(g({},Y),{},{validator:$t})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(e,t,n){return!e||-1!==[E.READ_ALL_C2C_MSG,E.READ_ALL_GROUP_MSG,E.READ_ALL_MSG].indexOf(e)||(Jt({api:t,paramName:n,desc:Gn("ValidScopeRequired")}),!1)}}},getConversationProfile:[g(g({name:"conversationID"},Y),{},{validator:$t})],clearHistoryMessage:[g(g({name:"conversationID"},Y),{},{validator:$t})],pinConversation:{conversationID:g(g({},Y),{},{validator:$t}),isPinned:g({},Ln)},setConversationDraft:{conversationID:g(g({},Y),{},{validator:$t}),draftText:{type:"String",validator:function(e,t,n){return!!ut(e)||(Jt({api:t,paramName:n,desc:Xt()}),!1)}}},setConversationCustomData:{conversationIDList:g({},Z),customData:{type:"String",validator:function(e,t,n){return ut(e)?!(256<e.length&&(Jt({api:t,paramName:n,desc:cn(n,256)}),1)):(Jt({api:t,paramName:n,desc:Xt()}),!1)}}},markConversation:{conversationIDList:g({},Z),markType:{type:"number",validator:function(e,t,n){return Ke(e)?e<=0?(Jt({api:t,paramName:n,desc:un(n,0)}),!1):!(e>=Math.pow(2,64)&&(Jt({api:t,paramName:n,desc:Gn("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(Jt({api:t,paramName:n,desc:Zt()}),!1)}},enableMark:g({},Ln)},createConversationGroup:{conversationIDList:g({},Z),groupName:g(g({},Y),{},{validator:function(e,t,n){return!(!e||32<e.length&&(Jt({api:t,paramName:n,desc:cn(n,32)}),1))}})},deleteConversationGroup:[g({name:"groupName"},Y)],renameConversationGroup:{oldName:g({},Y),newName:g(g({},Y),{},{validator:function(e,t,n){return!(!e||32<e.length&&(Jt({api:t,paramName:n,desc:cn(n,32)}),1))}})},addConversationsToGroup:{conversationIDList:g({},Z),groupName:g({},Y)},deleteConversationsFromGroup:{conversationIDList:g({},Z),groupName:g({},Y)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:Y,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Z},createGroup:{name:Y},joinGroup:{groupID:Y,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[g({name:"groupID"},Y)],handleApplication:{message:J,handleAction:Y,handleMessage:{type:"String"}},changeGroupOwner:{groupID:Y,newOwnerID:Y},updateGroupProfile:{groupID:Y,muteAllMembers:{type:"Boolean"}},dismissGroup:[g({name:"groupID"},Y)],searchGroupByID:[g({name:"groupID"},Y)],getGroupOnlineMemberCount:[g({name:"groupID"},Y)],initGroupAttributes:{groupID:Y,groupAttributes:g(g({},J),{},{validator:function(e,t,n){var i=!0;return Object.keys(e).forEach((function(o){if(!ut(e[o]))return Jt({api:t,paramName:n,desc:dn("value")}),i=!1})),i}})},setGroupAttributes:{groupID:Y,groupAttributes:g(g({},J),{},{validator:function(e,t,n){var i=!0;return Object.keys(e).forEach((function(o){if(!ut(e[o]))return Jt({api:t,paramName:n,desc:dn("value")}),i=!1})),i}})},deleteGroupAttributes:{groupID:Y,keyList:{type:"Array",validator:function(e,t,n){var i;return lt(e)||!Ye(e)?(Jt({api:t,paramName:n,desc:on()}),!1):!!qe(e)||(i=!0,e.forEach((function(e){if(!ut(e))return Jt({api:t,paramName:n,desc:Gn("StringArrayRequiredLog")}),i=!1})),i)}}},getGroupAttributes:{groupID:Y,keyList:{type:"Array",validator:function(e,t,n){var i;return lt(e)||!Ye(e)?(Jt({api:t,paramName:n,desc:on()}),!1):!!qe(e)||(i=!0,e.forEach((function(e){if(!ut(e))return Jt({api:t,paramName:n,desc:dn("key")}),i=!1})),i)}}},setGroupCounters:{groupID:Y,counters:J},increaseGroupCounter:{groupID:Y,key:Y,value:wn},decreaseGroupCounter:{groupID:Y,key:Y,value:wn},getGroupCounters:{groupID:Y},getGroupMemberList:{groupID:Y,count:{type:"Number"}},getGroupMemberProfile:{groupID:Y,userIDList:Z,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:Y,userIDList:Z},setGroupMemberRole:{groupID:Y,userID:Y,role:Y},setGroupMemberMuteTime:{groupID:Y,userID:Y,muteTime:{type:"Number",validator:function(e){return 0<=e}}},setGroupMemberNameCard:{groupID:Y,userID:{type:"String"},nameCard:{type:"String",validator:function(e,t,n){return ut(e)?(e.length,!0):(Jt({api:t,paramName:n,desc:Xt()}),!1)}}},setGroupMemberCustomField:{groupID:Y,userID:{type:"String"},memberCustomField:Z},deleteGroupMember:{groupID:Y},markGroupMemberList:{groupID:Y,markType:{type:"number",validator:function(e,t,n){return Ke(e)?!(e<1e3&&(Jt({api:t,paramName:n,desc:ln(n,1e3)}),1)):(Jt({api:t,paramName:n,desc:Zt()}),!1)}},userIDList:g({},Z),enableMark:g({},Ln)},createTextMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){return We(e)?ut(e.text)?0!==e.text.length||(Jt({api:t,paramName:"payload.text",desc:hn()}),!1):(Jt({api:t,paramName:"payload.text",desc:Xt()}),!1):(Jt({api:t,paramName:n,desc:pn()}),!1)}})},createTextAtMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){return We(e)?ut(e.text)?0===e.text.length?(Jt({api:t,paramName:"payload.text",desc:hn()}),!1):!(e.atUserList&&!Ye(e.atUserList)&&(Jt({api:t,paramName:"payload.atUserList",desc:on()}),1)):(Jt({api:t,paramName:"payload.text",desc:Xt()}),!1):(Jt({api:t,paramName:n,desc:pn()}),!1)}})},createCustomMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){return We(e)?e.data&&!ut(e.data)?(Jt({api:t,paramName:"payload.data",desc:Xt()}),!1):e.description&&!ut(e.description)?(Jt({api:t,paramName:"payload.description",desc:Xt()}),!1):!(e.extension&&!ut(e.extension)&&(Jt({api:t,paramName:"payload.extension",desc:Xt()}),1)):(Jt({api:t,paramName:"payload",desc:pn()}),!1)}})},createImageMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){if(!We(e))return Jt({api:t,paramName:n,desc:pn()}),!1;if(lt(e.file))return Jt({api:t,paramName:"payload.file",desc:en()}),!1;if(te){if(!(e.file instanceof HTMLInputElement||He(e.file)))return We(e.file)&&void 0!==Nn?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Jt({api:t,paramName:"payload.file",desc:gn()}),!1):(Jt({api:t,paramName:"payload.file",desc:tn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Jt({api:t,paramName:"payload.file",desc:gn()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:an()}),!0}}})},createAudioMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){return!!We(e)||(Jt({api:t,paramName:n,desc:pn()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:an()}),!0}}},createVideoMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){if(!We(e))return Jt({api:t,paramName:n,desc:pn()}),!1;if(lt(e.file))return Jt({api:t,paramName:"payload.file",desc:en()}),!1;if(te){if(!(e.file instanceof HTMLInputElement||He(e.file)))return We(e.file)&&void 0!==Nn?!!He(e.file.tempFile)||(Jt({api:t,paramName:"payload.file",desc:gn()}),!1):(Jt({api:t,paramName:"payload.file",desc:tn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Jt({api:t,paramName:"payload.file",desc:gn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:an()}),!0}}},createFaceMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){return We(e)?Ke(e.index)?!!ut(e.data)||(Jt({api:t,paramName:"payload.data",desc:Xt()}),!1):(Jt({api:t,paramName:"payload.index",desc:Zt()}),!1):(Jt({api:t,paramName:n,desc:pn()}),!1)}})},createFileMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){if(!We(e))return Jt({api:t,paramName:n,desc:pn()}),!1;if(lt(e.file))return Jt({api:t,paramName:"payload.file",desc:en()}),!1;if(te){if(!(e.file instanceof HTMLInputElement||He(e.file)))return We(e.file)&&void 0!==Nn?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Jt({api:t,paramName:"payload.file",desc:gn()}),!1):(Jt({api:t,paramName:"payload.file",desc:tn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Jt({api:t,paramName:"payload.file",desc:gn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:an()}),!0}}},createLocationMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){return We(e)?ut(e.description)?Ke(e.longitude)?!!Ke(e.latitude)||(Jt({api:t,paramName:"payload.latitude",desc:Zt()}),!1):(Jt({api:t,paramName:"payload.longitude",desc:Zt()}),!1):(Jt({api:t,paramName:"payload.description",desc:Xt()}),!1):(Jt({api:t,paramName:n,desc:pn()}),!1)}})},createMergerMessage:{to:Y,conversationType:Y,payload:g(g({},J),{},{validator:function(e,t,n){var i;return qe(e.messageList)?(Jt({api:t,paramName:"payload.messageList",desc:sn()}),!1):qe(e.compatibleText)?(Jt({api:t,paramName:"payload.compatibleText",desc:Qt("compatibleText")}),!1):(i=!1,e.messageList.forEach((function(e){e.status===Dn&&(i=!0)})),!i||(Jt({api:t,paramName:"payload.messageList",desc:Gn("MergeFailedMessageLog")}),!1))}})},revokeMessage:[g(g({name:"message"},J),{},{validator:function(e,t,n){return qe(e)?(Jt({api:t,paramName:n,desc:fn()}),!1):e.conversationType===E.CONV_SYSTEM?(Jt({api:t,paramName:n,desc:Gn("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(Jt({api:t,paramName:n,desc:Gn("MessageRevokedLog")}),!1)}})],deleteMessage:[g(g({name:"messageList"},Z),{},{validator:function(e,t,n){return!qe(e)||(Jt({api:t,paramName:n,desc:sn()}),!1)}})],translateText:{sourceTextList:Z,sourceLanguage:Y,targetLanguage:Y},convertVoiceToText:{message:g(g({},J),{},{validator:function(e,t,n){return qe(e)?(Jt({api:t,paramName:n,desc:fn()}),!1):e.type===E.MSG_AUDIO&&e.status===kn||(Jt({api:t,paramName:n,desc:Gn("AudioMessageRequiredLog")}),!1)}})},modifyMessage:[g(g({name:"message"},J),{},{validator:function(e,t,n){return qe(e)?(Jt({api:t,paramName:n,desc:fn()}),!1):e.conversationType===E.CONV_SYSTEM?(Jt({api:t,paramName:n,desc:Gn("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(Jt({api:t,paramName:n,desc:Gn("OnlineMessageNotSupportLog")}),!1)}})],searchCloudMessages:{keywordList:Un.keywordListForMsg,keywordListMatchType:Un.keywordListMatchType,cursor:Un.cursor,senderUserIDList:{type:"Array",required:!1,validator:function(e,t,n){return In(e,t,n,{allowUndefined:!0,allowEmpty:!0,maxLength:5})}},messageTypeList:{type:"Array",required:!1,validator:function(e,t,n){var i;return!e||!(!In(e,t,n,{allowUndefined:!0,allowEmpty:!0})||(i=[E.MSG_TEXT,E.MSG_IMAGE,E.MSG_AUDIO,E.MSG_FILE,E.MSG_VIDEO,E.MSG_LOCATION,E.MSG_CUSTOM,E.MSG_MERGER],0<e.filter((function(e){return-1===i.indexOf(e)})).length&&(Jt({api:t,paramName:n,desc:yn(n,"message")}),1)))}},conversationID:{type:"String",required:!1,validator:function(e){return!e||$t(e)}},timePosition:{type:"number",required:!1,validator:function(e,t,n){return Mn(e,t,n,{allowUndefined:!0,min:0})}},timePeriod:{type:"number",required:!1,validator:function(e,t,n){return Mn(e,t,n,{allowUndefined:!0,min:0})}}},searchCloudUsers:{keywordList:Un.keywordListExceptMsg,keywordListMatchType:Un.keywordListMatchType,cursor:Un.cursor,count:Un.count,miniBirthday:{type:"Number",required:!1,validator:function(e,t,n){return Mn(e,t,n,{allowUndefined:!0,min:0})}},maxBirthday:{type:"Number",required:!1,validator:function(e,t,n){return Mn(e,t,n,{allowUndefined:!0,min:0})}},gender:{type:"String",required:!1,validator:function(e,t,n){return!e||e===E.GENDER_FEMALE||e===E.GENDER_MALE||Jt({api:t,paramName:n,desc:"".concat(e," is invalid match type")})}}},searchCloudGroups:{keywordList:Un.keywordListExceptMsg,keywordListMatchType:Un.keywordListMatchType,cursor:Un.cursor,count:Un.count,groupTypeList:Un.groupTypeList},searchCloudGroupMembers:{keywordList:Un.keywordListExceptMsg,keywordListMatchType:Un.keywordListMatchType,cursor:Un.cursor,count:Un.count,groupTypeList:Un.groupTypeList,groupIDList:{type:"Array",required:!1,validator:function(e,t,n){return In(e,t,n,{allowUndefined:!0,allowEmpty:!0})}}},getUserProfile:{userIDList:{type:"Array",validator:function(e,t,n){return Ye(e)?(0===e.length&&Jt({api:t,paramName:n,desc:sn()}),!0):(Jt({api:t,paramName:n,desc:on()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e,t,n){return!!lt(e)||!!Ye(e)||(Jt({api:t,paramName:n,desc:on()}),!1)}}},setSelfStatus:{customStatus:{type:"String",validator:function(e,t,n){return!!ut(e)||(Jt({api:t,paramName:n,desc:Xt()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return Ye(e)?0!==e.length||(Jt({api:t,paramName:n,desc:sn()}),!1):(Jt({api:t,paramName:n,desc:on()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return Ye(e)?0!==e.length||(Jt({api:t,paramName:n,desc:sn()}),!1):(Jt({api:t,paramName:n,desc:on()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return!e||!!Ye(e)||(Jt({api:t,paramName:n,desc:on()}),!1)}}},addFriend:{to:Y,source:{type:"String",required:!0,validator:function(e,t,n){return!(!e||(e.startsWith("AddSource_Type_")?8<e.replace("AddSource_Type_","").length&&(Jt({api:t,paramName:n,desc:cn("keyword",8)}),1):(Jt({api:t,paramName:n,desc:Gn("SourcePrefixLog")}),1)))}},remark:{type:"String",required:!1,validator:function(e,t,n){return!(ut(e)&&96<e.length&&(Jt({api:t,paramName:n,desc:cn(n,96)}),1))}}},deleteFriend:{userIDList:Z},checkFriend:{userIDList:Z},getFriendProfile:{userIDList:Z},updateFriend:{userID:Y,remark:{type:"String",required:!1,validator:function(e,t,n){return!(ut(e)&&96<e.length&&(Jt({api:t,paramName:n,desc:cn(n,96)}),1))}},friendCustomField:{type:"Array",required:!1,validator:function(e,t,n){var i;return!e||(Ye(e)?(i=!0,e.forEach((function(e){return ut(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?ut(e.value)?8<e.key.replace("Tag_SNS_Custom_","").length?(Jt({api:t,paramName:n,desc:cn("keyword",8)}),i=!1):void 0:(Jt({api:t,paramName:n,desc:dn("value")}),i=!1):(Jt({api:t,paramName:n,desc:Gn("FriendCustomFieldPrefixLog")}),i=!1)})),i):(Jt({api:t,paramName:n,desc:on()}),!1))}}},acceptFriendApplication:{userID:Y},refuseFriendApplication:{userID:Y},deleteFriendApplication:{userID:Y},createFriendGroup:{name:Y},deleteFriendGroup:{name:Y},addToFriendGroup:{name:Y,userIDList:Z},removeFromFriendGroup:{name:Y,userIDList:Z},renameFriendGroup:{oldName:Y,newName:Y},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e,t,n){return Ye(e)?0!==e.length||(Jt({api:t,paramName:n,desc:sn()}),!1):(Jt({api:t,paramName:n,desc:on()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e,t,n){return Ye(e)?0!==e.length||(Jt({api:t,paramName:n,desc:sn()}),!1):(Jt({api:t,paramName:n,desc:on()}),!1)}}],createTopicInCommunity:{groupID:Y,topicName:Y},deleteTopicFromCommunity:{groupID:Y,topicIDList:{type:"Array",validator:function(e,t,n){return!e||!!Ye(e)||(Jt({api:t,paramName:n,desc:on()}),!1)}}},updateTopicProfile:{groupID:Y,topicID:Y},getTopicList:{groupID:Y,topicIDList:{type:"Array",validator:function(e,t,n){return!e||!!Ye(e)||(Jt({api:t,paramName:n,desc:on()}),!1)}}},followUser:[g({name:"userIDList"},Z)],unfollowUser:[g({name:"userIDList"},Z)],getMyFollowingList:[g(g({name:"startIndex"},Y),{},{required:!1})],getMyFollowersList:[g(g({name:"startIndex"},Y),{},{required:!1})],getMutualFollowersList:[g(g({name:"startIndex"},Y),{},{required:!1})],getUserFollowInfo:[g(g({name:"userIDList"},Z),{},{required:!1})],checkFollowType:[g({name:"userIDList"},Z)],addSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Jt({api:t,paramName:n,desc:Qt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Jt({api:t,paramName:n,desc:nn()}),!1):(""===e.name&&Jt({api:t,paramName:n,desc:mn()}),!0)}}],removeSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Jt({api:t,paramName:n,desc:Qt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Jt({api:t,paramName:n,desc:nn()}),!1):(""===e.name&&Jt({api:t,paramName:n,desc:mn()}),!0)}}],invite:{userID:Y},inviteSync:[g(g({},J),{},{validator:function(e,t,n){return We(e)?!!ut(e.userID)||(Jt({api:t,paramName:"options.userID",desc:Xt()}),!1):(Jt({api:t,paramName:"options",desc:pn()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:nn()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:nn()}),!0}}],inviteInGroup:{groupID:Y,inviteeList:Z},inviteInGroupSync:[g(g({},J),{},{validator:function(e,t,n){return We(e)?ut(e.groupID)?!!Ye(e.inviteeList)||(Jt({api:t,paramName:"options.inviteeList",desc:on()}),!1):(Jt({api:t,paramName:"options.groupID",desc:Xt()}),!1):(Jt({api:t,paramName:"options",desc:pn()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:nn()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return lt(e)&&Jt({api:t,paramName:n,desc:nn()}),!0}}],accept:{inviteID:Y},reject:{inviteID:Y},getSignalingInfo:[g(g({name:"message"},J),{},{validator:function(e,t,n){return!qe(e)||(Jt({api:t,paramName:n,desc:fn()}),!1)}})],modifyInvitation:{inviteID:Y,data:Y}},Fn={login:1,logout:1,getLoginUser:1,getServerTime:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,isReady:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,convertVoiceToText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,setConversationDraft:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,setMessageRemindType:1,setAllReceiveMessageOpt:1,getAllReceiveMessageOpt:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,searchCloudMessages:1,searchCloudUsers:1,searchCloudGroups:1,searchCloudGroupMembers:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,followUser:1,unfollowUser:1,getMyFollowingList:1,getMyFollowersList:1,getMutualFollowersList:1,getUserFollowInfo:1,checkFollowType:1,callExperimentalAPI:1,addSignalingListener:1,removeSignalingListener:1,invite:1,inviteSync:1,inviteInGroup:1,inviteInGroupSync:1,cancel:1,accept:1,reject:1,getSignalingInfo:1,modifyInvitation:1},Bn=(u(ri,C(Error)),s(ri)),qn={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MSG_SEND_FAIL:2100,MSG_SEND_FAIL_NOT_IN_AV:2101,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_F_IS_EMPTY:2108,MSG_ONPROGRESS_ERR:2109,MSG_REVOKE_FAIL:2110,MSG_DELETE_FAIL:2111,MSG_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MSG_LIST_EMPTY:2114,MSG_SEND_GRP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GRP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,VOICE_TO_TEXT_FAIL:2118,UNSUPPORTED_VOICE_FORMAT:2119,MSG_I_SELECT_F_FIRST:2251,MSG_I_TYPES_LIMIT:2252,MSG_I_SIZE_LIMIT:2253,MSG_A_UPLOAD_FAIL:2300,MSG_A_SIZE_LIMIT:2301,MSG_V_UPLOAD_FAIL:2350,MSG_V_SIZE_LIMIT:2351,MSG_V_TYPES_LIMIT:2352,MSG_F_UPLOAD_FAIL:2400,MSG_F_SELECT_F_FIRST:2401,MSG_F_SIZE_LIMIT:2402,MSG_F_URL_IS_EMPTY:2403,MSG_MERGER_TYPE_INVALID:2450,MSG_MERGER_KEY_INVALID:2451,MSG_MERGER_DOWNLOAD_FAIL:2452,MSG_FORWARD_TYPE_INVALID:2453,MSG_FORWARD_INVALID_ELEMENTS:2454,MSG_MODIFY_CONFLICT:2480,MSG_MODIFY_DISABLED_IN_AV:2481,CONV_NOT_FOUND:2500,USER_OR_GRP_NOT_FOUND:2501,CONV_UN_RECORDED_TYPE:2502,INVALID_CONV_ID:2503,ILLEGAL_GRP_TYPE:2600,ILLEGAL_GRP_ID:2602,CANNOT_FIND_GRP:2603,CANNOT_CHANGE_OWNER_IN_AV:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,MEMBER_NOT_IN_GRP:2623,JOIN_GRP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AV:2661,CANNOT_JOIN_NON_AV_WITHOUT_LOGIN:2662,NOT_OWNER:2681,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,OPERATION_NOT_SUPPORTED_IN_AV:2687,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GRP_EXISTED:2710,FRIEND_GRP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,NO_PROTOCOL:2997,NO_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,NO_USE:3122,PROFANITY_FOUND:3123,OPTIONS_IS_EMPTY:3153,MSG_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022,SIGNALING_INVALID_INVITE_ID:8010,SIGNALING_NO_PERMISSION:8011,SIGNALING_ALREADY_EXISTS:8012,INVALID_CANCEL_MESSAGE:8020},Vn=null,jn=(wn=s((function e(t){i(this,e),this._m=t,this._n=""}),[{key:"isLoggedIn",value:function(){return this._m.get(12).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.get(12).isOversea()}},{key:"isPrivateNetWork",value:function(){var e=this._m.get(12);return e.isPrivateNetWork()&&!e.getFileDownloadProxy()}},{key:"getFileDownloadProxy",value:function(){return this._m.get(12).getFileDownloadProxy()}},{key:"getDownloadFileAuthKey",value:function(){return this._m.get(12).getDownloadFileAuthKey()}},{key:"getMyUserID",value:function(){return this._m.get(12).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.get(12).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.get(12).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.get(12).isIntl()}},{key:"isUsingChatCore",value:function(){return this._m.get(12).isUsingChatCore()}},{key:"isDevMode",value:function(){return this._m.get(12).isDevMode()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"getPlatform",value:function(){return oe}},{key:"getCloudConfig",value:function(e){return this._m.get(23).getCloudConfig(e)}},{key:"emitOEvt",value:function(e,t){this._m.getOEmitInst().emit(e,t)}},{key:"emitIEvt",value:function(e,t){this._m.getIEmitInst().emit(e,t)}},{key:"getIEmitInst",value:function(){return this._m.getIEmitInst()}},{key:"req",value:function(e){return this._m.get(20).req(e)}},{key:"canIUse",value:function(e){return this._m.get(27).canIUse(e)}},{key:"getErrMsg",value:function(e,t,n){return this._m.getErrMsg(e,t,n)}},{key:"warn",value:function(e,t,n){(e=this.getErrMsg(e,t,n))&&be.w(e)}},{key:"noUse",value:function(e){var t=qn.NO_USE;return En({code:t,message:this.getErrMsg(t,e)})}}]),{LOGIN:"wslogin",LOGOUT:"wslogout",HELLO:"wshello",KICK_OTHER:"KickOther",SYNC_UNREAD_MSG:"getmsg",SEND_C2C_MSG:"sendmsg",SEND_GRP_MSG:"send_group_msg",GET_USER_PROFILE:"portrait_get_all",UPDATE_MY_PROFILE:"portrait_set",GET_BL:"black_list_get",ADD_TO_BL:"black_list_add",RM_FROM_BL:"black_list_delete",GET_FD_LIST:"friend_get",GET_FD_PROFILE:"friend_get_specified",CHECK_FD:"friend_check",DEL_FD:"friend_delete",ADD_FD:"friend_add",UPDATE_FD:"friend_update",RESPOND_FD_APPLICATION:"friend_response",GET_FD_APPLICATION_LIST:"pendency_get",DEL_FD_APPLICATION:"pendency_delete",REFUSE_FD_APPLICATION:"pendency_refuse",REPORT_FD_APPLICATION:"pendency_report",GET_FD_GRP_LIST:"group_get",CREATE_FD_GRP:"group_add",DEL_FD_GRP:"group_delete",UPDATE_FD_GRP:"group_update",REVOKE_C2C_MSG:"msgwithdraw",SET_C2C_MSG_READ:"msgreaded",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_C2C_ROAMING_MSG:"getroammsg",GET_C2C_PEER_READ_TIME:"get_peer_read_time",DEL_C2C_MSG:"delete_c2c_msg_ramble",MODIFY_C2C_MSG:"modify_c2c_msg",MODIFY_C2C_MSG_EXT:"set_key_values",GET_C2C_MSG_EXT:"get_key_values",ADD_C2C_MSG_REACTION:"reaction_add",RM_C2C_MSG_REACTION:"reaction_del",GET_C2C_MSG_REACTIONS:"reaction_multi_stat",GET_C2C_MSG_REACTION_USER_LIST:"reaction_iterate",PAGING_GET_CONV_LIST:"page_get",DEL_CONV:"batch_delete",CLEAR_HISTORY_MSG:"clear_msg",PIN_CONV:"top",DEL_GROUP_AT_TIPS:"deletemsg",SET_CONV_CUSTOM_DATA:"set_conv_custom_data",MARK_CONV:"mark_contact",CREATE_CONV_GRP:"create_contact_group",DEL_CONV_GRP:"del_contact_group",RENAME_CONV_GRP:"update_contact_group",ADD_CONV_TO_GRP:"add_conv_to_group",DEL_CONV_FROM_GRP:"del_conv_from_group",GET_CONV_GRP_LIST:"get_contact_group",SEARCH_CONV_GRP_MARK:"search_contact_group",GET_GRP_LIST:"get_joined_group_list",GET_GRP_PROFILE:"get_group_self_member_info",CREATE_GRP:"create_group",DISMISS_GRP:"destroy_group",UPDATE_GRP_PROFILE:"modify_group_base_info",APPLY_JOIN_GRP:"apply_join_group",APPLY_JOIN_GRP_NOAUTH:"apply_join_group_noauth",QUIT_GRP:"quit_group",SEARCH_GRP:"get_group_public_info",CHANGE_GRP_OWNER:"change_group_owner",HANDLE_GRP_APPLICATION:"handle_apply_join_group",HANDLE_INVITE_JOIN_GRP:"handle_invite_join_permission_group",HANDLE_GRP_INVITATION:"handle_invite_join_group",REVOKE_GRP_MSG:"group_msg_recall",SET_GRP_MSG_READ:"msg_read_report",SET_ALL_MSG_READ:"read_all_unread_msg",GET_GRP_ROAMING_MSG:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",GET_GRP_RECEIPTS_BY_USERS:"get_group_msg_receipts_by_users",GET_GRP_PENDENCY:"get_pendency",DEL_GRP_SYSTEM_NOTICE:"deletemsg",AV_POLLING:"get_msg",AV_NOAUTH_POLLING:"get_msg_noauth",GET_ONLINE_MBR_NUM:"get_online_member_num",DEL_GRP_MSG:"delete_group_ramble_msg_by_seq",MODIFY_GRP_MSG:"modify_group_msg",SET_GRP_ATTR:"set_group_attr",MODIFY_GRP_ATTR:"modify_group_attr",DEL_GRP_ATTR:"delete_group_attr",CLEAR_GRP_ATTR:"clear_group_attr",GET_GRP_ATTR:"get_group_attr",MODIFY_GRP_MSG_EXT:"group_set_key_values",GET_GRP_MSG_EXT:"group_get_key_values",GET_GRP_NOTIFY:"batch_get_group_notify",UPDATE_GRP_COUNTER:"update_group_counter",GET_GRP_COUNTER:"get_group_counter",ADD_GRP_MSG_REACTION:"group_reaction_add",RM_GRP_MSG_REACTION:"group_reaction_del",GET_GRP_MSG_REACTIONS:"group_reaction_multi_stat",GET_GRP_MSG_REACTION_USER_LIST:"group_reaction_iterate",GET_GRP_MBR_LIST:"get_group_member_info",GET_AV_MBR_LIST:"get_members",GET_GRP_MBR_PROFILE:"get_specified_group_member_info",ADD_GRP_MBR:"add_group_member",DEL_GRP_MBR:"delete_group_member",BAN_AV_MBR:"ban_group_member",MODIFY_GRP_MBR_INFO:"modify_group_member_info",MARK_AV_MBR_INFO:"modify_user_info",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",SIMPLE_COS_PRE_SIG:"simple_sig",GET_IMAGE_INFO:"get_imageinfo",GET_IP:"get_final_ip",VIDEO_COVER:"video_cover",SSO_STAT:"tim_web_report_v2",PING:"alive",MSG_PUSH:"msg_push",CS:"query",GRP_CS:"query_grp",MBR_CS:"query_grp_member",USER_CS:"query_user",MULTI_MSG_PUSH:"multi_msg_push_ws",MSG_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",UPLOAD_MERGER_MSG:"save_relay_json_msg",DOWNLOAD_MERGER_MSG:"get_relay_json_msg",FETCH_CLOUD_CTRL_CONFIG:"fetch_config",PUSHED_CLOUD_CTRL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",OVERLOAD_NOTIFY:"notify2",CREATE_TOPIC:"create_topic",DEL_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUB_USER_STATUS:"ws_status_subscribe",UNSUB_USER_STATUS:"ws_status_unsubscribe",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PUSH_REPORT:"uniapp_sdk_report",GET_PROFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",VOICE_TO_TEXT:"ws_sentence_recognition",FOLLOW:"follow_add",UNFOLLOW:"follow_delete",GET_FOLLOW:"follow_get",GET_FOLLOW_INFO:"follow_get_info",CHECK_FOLLOW_TYPE:"follow_check",SET_ALL_RECEIVE_MSG_OPT:"ws_set_do_not_disturb",GET_ALL_RECEIVE_MSG_OPT:"ws_get_do_not_disturb"}),Hn="networkRTT",Kn="messageE2EDelay",zn="sendMessageC2C",Wn="sendMessageGroup",Yn="sendMessageGroupAV",$n="sendMessageRichMedia",Jn="cosUpload",Xn="messageReceivedGroup",Qn="messageReceivedGroupAVPush",Zn="messageReceivedGroupAVPull",ei=r(r(r(r(r(r(r(r(r(r({},Hn,2),Kn,3),zn,4),Wn,5),Yn,6),$n,7),Xn,8),Qn,9),Zn,10),Jn,11),ti={info:4,warning:5,error:6},ni={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},ii={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16,tui_key_features:16},oi=s(ai,[{key:"updateTimeStamp",value:function(){this.timestamp=ke()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e,t=this,n=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this._sentFlag||(this._netMonitorModule&&(e=this._netMonitorModule.getNetworkType(),this.setNetworkType(e)),e=ke(),0===this.costTime&&(this.costTime=e-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(e)),n?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){t._sentFlag=!0,t._eventStatModule&&t._eventStatModule.pushIn(t)}),0))}},{key:"setError",value:function(e){var t;return e instanceof Error?this._sentFlag||(t=!0,(t=this._netMonitorModule?this._netMonitorModule.isOnline():t)?(e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message)):this.setCode(qn.NO_NETWORK),this.setLevel("error")):be.w("".concat(this._n,".setError value not instanceof Error, please check!")),this}},{key:"setCode",value:function(e){return lt(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),Ke(e)?this.code=e:be.w("".concat(this._n,".setCode value not a number, please check!"),e,I(e))),this}},{key:"setMessage",value:function(e){return lt(e)||this._sentFlag||(Ke(e)&&(this.message=e.toString()),ut(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return lt(e)||this._sentFlag||(this.level=ti[e]),this}},{key:"setMoreMessage",value:function(e){return qe(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){return lt(e)?be.w("".concat(this._n,".setNetworkType value is undefined, please check!")):(e=ni[e.toLowerCase()],lt(e)||(this.networkType=e)),this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){return this.uiPlatform=e,this}},{key:"setExtension",value:function(e){return this.extension=e,this}},{key:"setEventType",value:function(e){return this.eventType=e,this}}],[{key:"bindEventStatModule",value:function(e){ai.prototype._eventStatModule=e}},{key:"bindNetMonitorModule",value:function(e){ai.prototype._netMonitorModule=e}}]),si=s((function e(t){i(this,e),this.type=E.MSG_TEXT,this.content={text:t.text||""}}),[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]);function ai(e){i(this,ai),this._n="SSOLogData",this.eventType=ii[e]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=e,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=ke()}function ri(e){i(this,ri),t=n(this,ri);var t,o=e.code,s=e.message;return e=e.data,t.code=o,s?t.message=s:t._getErrMsg&&(t.message=t._getErrMsg(t.code)),t.data=e||{},t}function ci(e,t,n,i){var o;return i=3<arguments.length&&void 0!==i?i:[],e&&(o=e,t&&(e.startsWith("http://")?o=e.replace(/^http:\/\/[^/]+/,t):e.startsWith("https://")&&(o=e.replace(/^https:\/\/[^/]+/,t))),n&&-1===o.indexOf("authKey=")&&di(o,i)?(-1<o.indexOf("?")?"".concat(o,"&authKey="):"".concat(o,"?authKey=")).concat(n):o)}function ui(e,t,n){var i=2<arguments.length&&void 0!==n?n:[];return n=t[0].content||t[0].payload,e===E.MSG_IMAGE?n.imageInfoArray.forEach((function(e){di(e.imageUrl,i)&&(e.imageUrl=li(e.imageUrl))})):e===E.MSG_VIDEO?(di(n.snapshotUrl,i)&&(n.snapshotUrl=li(n.snapshotUrl),n.thumbUrl=li(n.thumbUrl)),di(n.remoteVideoUrl,i)&&(n.remoteVideoUrl=li(n.remoteVideoUrl))):e===E.MSG_AUDIO?di(n.remoteAudioUrl,i)&&(n.remoteAudioUrl=li(n.remoteAudioUrl)):e===E.MSG_FILE?di(n.fileUrl,i)&&(n.fileUrl=li(n.fileUrl)):e===E.MSG_MERGER&&(e=(n=t[0].content||t[0].payload).downloadKey,n=void 0===(n=n.messageList)?[]:n,qe(void 0===e?"":e))&&n.forEach((function(e){ui(e.messageBody[0].type,e.messageBody,i)})),t}function li(e){if(!e)return e;if(-1===e.indexOf("authKey="))return e;for(var t=(e=e.split("?"))[1].split("&"),n=0,i=0;i<t.length;i++)if(-1<t[i].indexOf("authKey=")){n=i;break}return t.splice(n,1),0<t.length?"".concat(e[0],"?").concat(t.join("&")):e[0]}function di(e,t){var n=!1;if(e){var i=(e=e.match(/:\/\/([0-9]?\.)?(.[^/:]+)/))&&e[2]||"";if(i.includes("rich-dev"))return 1;for(var o=0;o<t.length;o++)if(i.endsWith(t[o])){n=!0;break}}return n}var pi=s((function e(t,n,o,s){i(this,e),this._imageMemoryURL="",this._fileDownloadProxy=n,this._authKey=o,this._fileDNList=s,Q||ee?this.createImageDataASURL(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=E.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||Ae.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()}),[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=it(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.imageUrl||t.url||"",this.url=ci(t.url||e._imageMemoryURL,e._fileDownloadProxy,e._authKey,e._fileDNList)},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(t){t&&(this.imageUrl=ci(t,e._fileDownloadProxy,e._authKey,e._fileDNList))},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t,n=0,i=null;n<=2;)t=lt(e)||lt(e[n])?{type:0,size:0,width:0,height:0,url:""}:e[n],(i=new this._ImageInfoModel(t)).setSizeType(n+1),i.setType(n),this.addImageInfo(i),n++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,n=this.content.imageInfoArray.length,i=0;i<n;i++)t=this.content.imageInfoArray[i],e[i].size&&(t.size=e[i].size),e[i].url&&t.setImageUrl(e[i].url),e[i].width&&(t.width=e[i].width),e[i].height&&(t.height=e[i].height)}},{key:"_autoFixUrl",value:function(){for(var e=this.content.imageInfoArray.length,t="",n="",i=["http","https"],o=null,s=0;s<e;s++)this.content.imageInfoArray[s].url&&""!==(o=this.content.imageInfoArray[s]).imageUrl&&(n=o.imageUrl.slice(0,o.imageUrl.indexOf("://")+1),t=o.imageUrl.slice(o.imageUrl.indexOf("://")+1),i.indexOf(n)<0&&(n="https:"),this.content.imageInfoArray[s].setImageUrl([n,t].join("")))}},{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=Ae[e.toUpperCase()]||Ae.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&0<e.files.length&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURL",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){3<=this.content.imageInfoArray.length||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=void 0===(t=(n=e[0]).width)?0:t,n=void 0===(n=n.height)?0:n;0!==t&&0!==n&&(Pt(e),Object.assign(e[2],Lt({originWidth:t,originHeight:n,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size}}]),hi=s((function e(t){i(this,e),this.type=E.MSG_FACE,this.content=t||null}),[{key:"sendable",value:function(){return null!==this.content}}]),gi=s((function e(t,n,o,s){i(this,e),this.type=E.MSG_AUDIO,this._percent=0,this._fileDownloadProxy=n,this._authKey=o,this._fileDNList=s,this.content={downloadFlag:2,second:t.second,size:t.size,url:ci(t.url,this._fileDownloadProxy,this._authKey,this._fileDNList),remoteAudioUrl:ci(t.url||"",this._fileDownloadProxy,this._authKey,this._fileDNList),uuid:t.uuid}}),[{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=ci(e,this._fileDownloadProxy,this._authKey,this._fileDNList)}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),fi={from:!0,groupID:!0,groupName:!0,to:!0},mi=s((function e(t){i(this,e),this.type=E.MSG_GRP_TIP,this.content={},this._initContent(t)}),[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"remarkInfo":case"memberExtraInfo":case"onlineMemberInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;case"operatorInfo":t.content.operatorInfo={},t._initOperatorInfo(e[n]);break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[n]);break;case"memberNum":t.content[n]=e[n],t.content.memberCount=e[n];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[n]);break;default:t.content[n]=e[n]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var i=t[n];fi[i]&&(this.content.groupProfile[i]=e[i])}}},{key:"_initOperatorInfo",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var i=t[n];this.content.operatorInfo[i]=e[i]}}},{key:"_updateMemberList",value:function(e){qe(this.content.memberList)?this.content.memberList=e:this.content.memberList.forEach((function(t){e.forEach((function(e){t.userID===e.userID&&Object.assign(t,e)}))}))}},{key:"_initNewGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var i=t[n];this.content.newGroupProfile[i]="muteAllMembers"!==i?e[i]:1===e[i]}}}]),_i={from:!0,groupID:!0,groupName:!0,to:!0,groupType:!0},vi=s((function e(t){i(this,e),this.type=E.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)}),[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"memberInfoList":break;case"remarkInfo":t.content.handleMessage=e[n];break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;default:t.content[n]=e[n]}}))}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var i=t[n];_i[i]&&("groupName"===i?this.content.groupProfile.name=e[i]:this.content.groupProfile[i]=e[i])}}}]),yi=s((function e(t,n,o,s){i(this,e),this.type=E.MSG_FILE,this._percent=0;var a=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:ci(t.url||t.fileUrl,n,o,s)||"",uuid:t.uuid,fileName:a.name||"",fileSize:a.size||0}}),[{key:"_getFileInfo",value:function(e){var t,n;return lt(e.fileName)||lt(e.fileSize)?(t=e.file.files[0],$&&(t.path&&-1!==t.path.indexOf(".")&&(n=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase(),t.type=n,t.name||(t.name="".concat(it(999999),".").concat(n))),t.name||(t.type="",t.name=t.path.slice(t.path.lastIndexOf("/")+1).toLowerCase()),t.suffix&&(t.type=t.suffix),t.url||(t.url=t.path)),{size:t.size,name:t.name}):{size:e.fileSize,name:e.fileName}}},{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&""!==this.content.fileName&&0!==this.content.fileSize}}]),Ii=s((function e(t){i(this,e),this.type=E.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}),[{key:"setData",value:function(e){return this.content.data=e,this}},{key:"setDescription",value:function(e){return this.content.description=e,this}},{key:"setExtension",value:function(e){return this.content.extension=e,this}},{key:"sendable",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),Mi=s((function e(t,n,o,s){i(this,e),this.type=E.MSG_VIDEO,this._percent=0,this._fileDownloadProxy=n,this._authKey=o,this._fileDNList=s,this.content={remoteVideoUrl:ci(t.remoteVideoUrl||t.videoUrl||"",this._fileDownloadProxy,this._authKey,this._fileDNList),videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:ci(t.videoUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:ci(t.thumbUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),snapshotUrl:ci(t.thumbUrl,this._fileDownloadProxy,this._authKey,this._fileDNList)}}),[{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=ci(e,this._fileDownloadProxy,this._authKey,this._fileDNList))}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth;e=e.snapshotHeight,qe(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),qe(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),qe(e)||(this.content.thumbHeight=this.content.snapshotHeight=Number(e))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),Ci=s((function e(t){i(this,e),this.type=E.MSG_LOCATION;var n=t.description,o=t.longitude;t=t.latitude,this.content={description:n,longitude:o,latitude:t}}),[{key:"sendable",value:function(){return!0}}]),Si=s((function e(t,n,o,s){var a,r;i(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID?(this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",t.messageBody?this.messageBody=JSON.parse(JSON.stringify(t.messageBody)):this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType?t.conversationType.startsWith(E.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(E.CONV_GROUP)&&(this.receiverGroupID=t.to):t.receiverGroupID?this.receiverGroupID=t.receiverGroupID:t.receiverUserID&&(this.receiverUserID=t.receiverUserID),this.messageReceiver=t.to||t.messageReceiver):(this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[],a=t.elements[0].type,r=t.elements[0].content,this._patchRichMediaPayload(a,r),this._updateRichMediaDownloadUrl(a,r,n,o,s),a===E.MSG_MERGER?this.messageBody.push({type:a,payload:new Ei(r,n,o,s).content}):this.messageBody.push({type:a,payload:r}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random))}),[{key:"_patchRichMediaPayload",value:function(e,t){e===E.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===E.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===E.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===E.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(e,t,n,i,o){(n||i)&&(e===E.MSG_IMAGE?t.imageInfoArray.forEach((function(e){e.imageUrl=ci(e.imageUrl,n,i,o),e.url=ci(e.url,n,i,o)})):e===E.MSG_VIDEO?(t.remoteVideoUrl=ci(t.remoteVideoUrl,n,i,o),t.videoUrl=ci(t.videoUrl,n,i,o),t.thumbUrl=ci(t.thumbUrl,n,i,o),t.snapshotUrl=ci(t.thumbUrl,n,i,o),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===E.MSG_AUDIO?(t.remoteAudioUrl=ci(t.remoteAudioUrl,n,i,o),t.url=ci(t.url,n,i,o)):e===E.MSG_FILE&&(t.fileUrl=ci(t.fileUrl,n,i,o)))}}]),Ei=s((function e(t,n,o,s){var a,r,c,u,l,d,p;i(this,e),this.type=E.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey?(r=t.downloadKey,c=t.pbDownloadKey,u=t.title,l=t.abstractList,d=t.compatibleText,a=t.version,this.content.downloadKey=r,this.content.pbDownloadKey=c,this.content.title=u,this.content.abstractList=l,this.content.compatibleText=d,this.content.version=a||0):qe(t.messageList)?1===t.layersOverLimit&&(this.content.layersOverLimit=!0):(r=t.messageList,c=t.title,u=t.abstractList,l=t.compatibleText,d=t.version,p=[],r.forEach((function(e){qe(e)||(e=new Si(e,n,o,s),p.push(e))})),this.content.messageList=p,this.content.title=c,this.content.abstractList=u,this.content.compatibleText=l,this.content.version=d||0)}),[{key:"sendable",value:function(){return!qe(this.content.messageList)||!qe(this.content.downloadKey)}}]),Ti={1:E.MSG_PRIORITY_HIGH,2:E.MSG_PRIORITY_NORMAL,3:E.MSG_PRIORITY_LOW,4:E.MSG_PRIORITY_LOWEST},ki=s((function e(t){i(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||E.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:it(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this.hasRiskContent=Wt(t.checkResult),this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||kn,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!!t.messageVersion,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||Se()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this._cmConfigID=t.customModerationConfigurationID,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||"",this.revokerInfo=t.revokerInfo||{userID:"",nick:"",avatar:""},this.revokeReason=t.revokeReason||"",this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t)}),[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){null!==e&&(ut(e.nick)&&(this.nick=e.nick),ut(e.avatar)&&(this.avatar=e.avatar),We(e=e.messageFromAccountExtraInformation))&&ut(e.nameCard)&&(this.nameCard=e.nameCard)}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==E.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(E.MSG_AT_ALL))})),Ye(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(E.MSG_AT_ALL)}))}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:"reInitialize",value:function(e){e&&(this.status=this.from?kn:Tn,!this.from)&&(this.from=e),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&(!0===this._relayFlag||"function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===E.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){var t,n,i;0===this.clientSequence&&e&&(this.clientSequence=!!e&&(void 0===mt[e]&&(t="3".concat((i=new Date).getHours()).slice(-2),n="0".concat(i.getMinutes()).slice(-2),i="0".concat(i.getSeconds()).slice(-2),mt[e]=parseInt([t,n,i,"0001"].join("")),i=n=t=null,be.l("autoIncrementIndex start index:".concat(mt[e]))),mt[e]++)),0===this.sequence&&this.conversationType===E.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===E.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,n=this.conversationType;n!==E.CONV_SYSTEM?(e=n===E.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=e?"".concat(n).concat(e):null):this.conversationID=E.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof si||e instanceof pi||e instanceof hi||e instanceof gi||e instanceof yi||e instanceof Mi||e instanceof mi||e instanceof vi||e instanceof Ii||e instanceof Ci||e instanceof Ei}},{key:"setElement",value:function(e,t,n,i){var o=this;if(this.isElement(e))this._elements=[e];else{var s=function(e){if(e.type&&e.content)switch(e.type){case E.MSG_TEXT:o.setTextElement(e.content);break;case E.MSG_IMAGE:o.setImageElement(e.content,t,n,i);break;case E.MSG_AUDIO:o.setAudioElement(e.content,t,n,i);break;case E.MSG_FILE:o.setFileElement(e.content,t,n,i);break;case E.MSG_VIDEO:o.setVideoElement(e.content,t,n,i);break;case E.MSG_CUSTOM:o.setCustomElement(e.content);break;case E.MSG_LOCATION:o.setLocationElement(e.content);break;case E.MSG_GRP_TIP:o.setGroupTipElement(e.content);break;case E.MSG_GRP_SYS_NOTICE:o.setGroupSystemNoticeElement(e.content);break;case E.MSG_FACE:o.setFaceElement(e.content);break;case E.MSG_MERGER:o.setMergerElement(e.content,t,n,i)}};if(Ye(e))for(var a=0;a<e.length;a++)s(e[a]);else s(e)}this._initProxy()}},{key:"clearElement",value:function(){this._elements.length=0}},{key:"setTextElement",value:function(e){e="string"==typeof e?e:e.text,e=new si({text:e}),this._elements.push(e)}},{key:"setImageElement",value:function(e,t,n,i){e=new pi(e,t,n,i),this._elements.push(e)}},{key:"setAudioElement",value:function(e,t,n,i){e=new gi(e,t,n,i),this._elements.push(e)}},{key:"setFileElement",value:function(e,t,n,i){e=new yi(e,t,n,i),this._elements.push(e)}},{key:"setVideoElement",value:function(e,t,n,i){e=new Mi(e,t,n,i),this._elements.push(e)}},{key:"setLocationElement",value:function(e){e=new Ci(e),this._elements.push(e)}},{key:"setCustomElement",value:function(e){e=new Ii(e),this._elements.push(e)}},{key:"setGroupTipElement",value:function(e){var t,n={},i=e.operationType;qe(e.memberInfoList)?e.operatorInfo&&(n=e.operatorInfo):i!==E.GRP_TIP_MBR_JOIN&&i!==E.GRP_TIP_MBR_KICKED_OUT&&i!==E.GRP_TIP_MBR_SET_ADMIN&&i!==E.GRP_TIP_MBR_CANCELED_ADMIN||(n=e.memberInfoList[0]),qe(e.memberExtraInfo)||(t=e.memberExtraInfo.reason,e.msgMemberInfo.forEach((function(e){e.reason=t}))),i=n.nick,n=n.avatar,ut(i)&&(this.nick=i),ut(n)&&(this.avatar=n),i=new mi(e),this._elements.push(i)}},{key:"setGroupSystemNoticeElement",value:function(e){e=new vi(e),this._elements.push(e)}},{key:"setFaceElement",value:function(e){e=new hi(e),this._elements.push(e)}},{key:"setMergerElement",value:function(e,t,n,i){e=new Ei(e,t,n,i),this._elements.push(e)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setRelayFlag",value:function(e){this._relayFlag=e}},{key:"_computePriority",value:function(e){if(!lt(e)){if(ut(e)&&-1!==Object.values(Ti).indexOf(e))return e;if(Ke(e)&&(e=""+e,-1!==Object.keys(Ti).indexOf(e)))return Ti[e]}return E.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(e){var t=e.nick;e=e.avatar,ut(t)&&(this.nick=t),ut(e)&&(this.avatar=e)}},{key:"setNameCard",value:function(e){ut(e)&&(this.nameCard=e)}},{key:"initC2CReadReceiptInfo",value:function(e){var t=e.readReceiptSentByPeer;e=void 0===(e=e.timestamp)?0:e,this.conversationType===E.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===(void 0===t?void 0:t),this.readReceiptInfo.timestamp=e)}}]),Di=["sound","FCMChannelID"],Ri=["ignoreIOSBadge","disableVoipPush","enableIOSBackgroundNotification"],Oi={HonorImportance:{range:["LOW","NORMAL"],defaultValue:void 0},MeizuNotifyType:{range:[0,1],defaultValue:void 0}},bi={enableIOSBackgroundNotification:{range:[!0,!1],defaultValue:!1},interruptionLevel:{range:["passive","active","time-sensitive","critical"],defaultValue:"active"}};function Ai(e,t){for(var n in t){var i,o;Object.prototype.hasOwnProperty.call(t,n)&&(i=(o=t[n]).range,o=o.defaultValue,e[n]=i.includes(e[n])?e[n]:o)}return e}function Li(e){if(We(e))return{pushFlag:!0===e.disablePush?1:0,title:e.title||"",desc:e.description||"",ext:e.extension||"",apnsInfo:(n=(t=e).apnsInfo,i=void 0!==(i=t.ignoreIOSBadge)&&i,t=t.disableVoipPush,o=(n=Ai(void 0===n?{}:n,bi)).ignoreIOSBadge,s=n.disableVoipPush,a=n.enableIOSBackgroundNotification,n=f(n,Ri),o=!0===o||!0===i?1:0,i=void 0,lt(t)||(i=!1===t?1:0),lt(s)||(i=!1===s?1:0),g(g({},n),{},{badgeMode:o,isVoipPush:i,contentAvailable:a?1:0})),androidInfo:(s=void 0===(s=(t=e).androidInfo)?{}:s,t=t.androidOPPOChannelID,t=s.OPPOChannelID||(void 0===t?"":t),s=Ai(s,Oi),n=void 0===(n=s.sound)?"":n,o=void 0===(o=s.FCMChannelID)?"":o,g(g({},f(s,Di)),{},{Sound:-1===(n=(s=n).lastIndexOf("."))?s:s.slice(0,n),OPPOChannelID:t,GoogleChannelID:o}))};var t,n,i,o,s,a}u(Ui,wn);var Pi=s(Ui,[{key:"onNewMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,i=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,s=(e=e.isSyncingEnded,i=(n||be.l("".concat(this._n,".onNewMessage C2CPairUnreadList:"),o,"C2CRemainingUnreadList:",i),t=this._assembly({dataList:t,C2CRemainingUnreadList:i,C2CPairUnreadList:o,isInstantMessage:n})).conversationOptionsList,o=t.messageList,t=t.isUnreadC2CMessage,0<(s=vt(o)).length&&this.emitOEvt(S.MESSAGE_MODIFIED,s),this.get(11).onNewMessage({conversationOptionsList:i,isInstantMessage:n,isUnreadC2CMessage:t,isSyncingEnded:e}),It(o));n&&0<s.length&&this.emitOEvt(S.MESSAGE_RECEIVED,s),o.length=0}},{key:"_assembly",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,i=e.C2CPairUnreadList,o=e.isInstantMessage,s=null,a=[],r=[],c={},u=this.get(26),l=!1,d=this.get(11),p=this.get(4),h=(e=this.get(17),this.getFileDownloadProxy()),g=this.getDownloadFileAuthKey(),f=e.getFileDNList(),m=0,_=t.length;m<_;m++)if(this._isC2CNotice(t[m]))this._noticeFromUnreadDBList.push(t[m].eventArray[0].c2CNotifyMsgArray[0]);else{var v=t[m],y=(v.currentUser=this.getMyUserID(),v.conversationType=E.CONV_C2C,v.isSystemMessage=!!v.isSystemMessage,(lt(v.nick)||lt(v.avatar))&&(l=!0),(s=new ki(v)).setElement(v.elements,h,g,f),s.setNickAndAvatar({nick:v.nick,avatar:v.avatar}),s.conversationID);if(o){if(this._msgFromUnreadDBMap.get(s.ID))continue;var I,M,C=!1,S=(s.from!==this.getMyUserID()?(M=d.getLatestMessageSentByPeer(y))&&(I=M.nick,M=M.avatar,l?s.setNickAndAvatar({nick:I,avatar:M}):I===s.nick&&M===s.avatar||(C=!0)):(I=d.getLatestMessageSentByMe(y))&&(M=I.nick,S=I.avatar,M===s.nick&&S===s.avatar||(d.modifyMessageSentByMe({conversationID:y,latestNick:s.nick,latestAvatar:s.avatar}),p.mockOnNickAvatarModified(s.nick,s.avatar))),1===t[m].isModified);if(d.isMessageSentByCurrentInstance(s)?s.isModified=S:S=!1,0===v.msgLifeTime)s._onlineOnlyFlag=!0,d.isMessageSentByCurrentInstance(s)||r.push(s);else{if(!d.pushIntoMessageList(r,s,S))continue;C&&(d.modifyMessageSentByPeer({conversationID:y,latestNick:s.nick,latestAvatar:s.avatar}),d.updateUserProfileSpecifiedKey({conversationID:y,nick:s.nick,avatar:s.avatar}))}o&&0<s.clientTime&&u.addMessageDelay(s.clientTime)}else this._msgFromUnreadDBMap.set(s.ID,s);if(0!==v.msgLifeTime){if(!1===s._onlineOnlyFlag){if(Ke(C=d.getLastMessageTime(y))&&s.time<C)continue;o&&(lt(c[y])?(v=0,"in"!==s.flow||s._isExcludedFromUnreadCount||(v=1),c[y]=a.push({conversationID:y,unreadCount:v,type:s.conversationType,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1):(v=c[y],a[v].type=s.conversationType,a[v].subType=s.conversationSubType,a[v].lastMessage=s._isExcludedFromLastMessage?"":s,"in"!==s.flow||s._isExcludedFromUnreadCount||a[v].unreadCount++))}}else s._onlineOnlyFlag=!0}this._handleNoticeFromUnreadDB();var T=!1;if(Ye(i)&&0<i.length)for(var k=0,D=i.length;k<D;k++)!function(e){if(i[e].from!==E.CONV_SYSTEM){T=!0;var t=a.find((function(t){return t.conversationID==="".concat(E.CONV_C2C).concat(i[e].from)}));t?t.unreadCount=i[e].unreadCount:a.push({conversationID:"".concat(E.CONV_C2C).concat(i[e].from),unreadCount:i[e].unreadCount,type:E.CONV_C2C})}}(k);if(Ye(n))for(var R=0,O=n.length;R<O;R++)!function(e){a.find((function(t){return t.conversationID==="".concat(E.CONV_C2C).concat(n[e].from)}))||a.push({conversationID:"".concat(E.CONV_C2C).concat(n[e].from),type:E.CONV_C2C,lastMsgTime:n[e].lastMsgTime})}(R);return{conversationOptionsList:a,messageList:r,isUnreadC2CMessage:T}}},{key:"getMessageListFromUnreadDB",value:function(){return v(this._msgFromUnreadDBMap.values())}},{key:"_isC2CNotice",value:function(e){return!(!Ye(e=e.eventArray)||10!==e[0].event)}},{key:"_handleNoticeFromUnreadDB",value:function(){var e,t=this._noticeFromUnreadDBList.length;0!==t&&(be.l("".concat(this._n,"._handleNoticeFromUnreadDB count:").concat(t)),e=[],this._noticeFromUnreadDBList.forEach((function(t){t.hasOwnProperty("c2cMessageRevokedNotify")&&e.push(t)})),this.onMsgRevoked({dataList:e}),this._noticeFromUnreadDBList.length=0,e.length=0)}},{key:"onMsgRevoked",value:function(e,t){var n,i=this,o=this.get(11),s=[];e.dataList.forEach((function(e){e.c2cMessageRevokedNotify&&(e=e.c2cMessageRevokedNotify.revokedInfos,lt(e)||e.forEach((function(e){var t=i.getMyUserID()===e.from?"".concat(E.CONV_C2C).concat(e.to):"".concat(E.CONV_C2C).concat(e.from);n=o.revoke(t,e.sequence,e.random);var a,r=e.revokerInfo&&e.revokerInfo.revoker,c=e.revokerInfo&&e.revokerInfo.reason||"";n?a=n:(a={conversationID:t,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(a.ID="".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)),e.time&&(a.time=e.time)),a&&(a.revoker=r,a.revokeReason=c,a.revokerInfo={userID:r,nick:"",avatar:""},s.push(a))})))})),0!==s.length&&(be.l("".concat(this._n,".onMsgRevoked count:").concat(s.length," updateUnreadCount:").concat(t)),o.onMessageRevoked(s,t),o.updateRevokerInfo(s).then((function(e){i.emitOEvt(S.MESSAGE_REVOKED,e)})))}},{key:"onMsgReadReceipt",value:function(e){var t=this;e.dataList.forEach((function(e){var n;qe(e.c2cMessageReadReceipt)||(n=e.c2cMessageReadReceipt.to,e.c2cMessageReadReceipt.uinPairReadArray.forEach((function(e){e=e.peerReadTime;var i=(be.l("".concat(t._n,".onMsgReadReceipt to:").concat(n," peerReadTime:").concat(e)),"".concat(E.CONV_C2C).concat(n)),o=t.get(11);o.recordPeerReadTime(i,e),o.updateMsgIsPeerReadProp(i,e)})))}))}},{key:"onMsgReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n;qe(e.c2cMessageReadNotice)||(n=t.get(11),e.c2cMessageReadNotice.uinPairReadArray.forEach((function(e){var i=e.from;e=e.peerReadTime,be.l("".concat(t._n,".onMsgReadNotice from:").concat(i," lastReadTime:").concat(e)),i="".concat(E.CONV_C2C).concat(i),n.updateIsReadAfterReadReport({conversationID:i,lastMessageTime:e}),n.updateUnreadCount(i)})))}))}},{key:"onMsgModified",value:function(e){be.l("".concat(this._n,".onMsgModified options:"),e);var t=this.get(11);e.dataList.forEach((function(e){t.onMessageModified(g(g({},e),{},{conversationType:E.CONV_C2C}))}))}},{key:"onReadReceiptList",value:function(e){be.l("".concat(this._n,".onReadReceiptList options:"),e),this.get(11).updateReadReceiptInfo(e.dataList)}},{key:"sendMessage",value:function(e,t){return e=this._createC2CMessagePack(e,t),this.req(e)}},{key:"_createC2CMessagePack",value:function(e,t){var n=null,i=(t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly)&&(n?n.disablePush=!0:n={disablePush:!0}),""),o=(ut(e.cloudCustomData)&&0<e.cloudCustomData.length&&(i=e.cloudCustomData),[]),s=(We(t)&&We(t.messageControlInfo)&&(s=(r=t.messageControlInfo).excludedFromUnreadCount,a=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===s&&o.push("NoUnread"),!0===a&&o.push("NoLastMsg"),!0===r)&&o.push("NoMsgCheck"),this.isOnlineMessage(e,t)?0:void 0),a=JSON.parse(JSON.stringify(e.getElements())),r=this.get(17).getFileDNList();return{P:jn.SEND_C2C_MSG,data:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:ui(e.type,a,r),cloudCustomData:i,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:s,nick:e.nick,avatar:e.avatar,offlinePushInfo:Li(n),messageControlInfo:0!==s?o:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0,cmConfigID:e._cmConfigID,forbidCallbackControl:yt(t)}}}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.req({P:jn.REVOKE_C2C_MSG,data:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var t=e.to;return e=e.keyList,be.l("".concat(this._n,".deleteMessage toAccount:").concat(t," count:").concat(e.length)),this.req({P:jn.DEL_C2C_MSG,data:{fromAccount:this.getMyUserID(),to:t,keyList:e}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,i=void 0===(i=e.version)?0:i,o=e.sequence,s=e.random,a=e.time,r=e.payload,c=e.type,u=e.cloudCustomData,l=void(e=e._elements);return Bt(c)&&(1<e.length&&e.splice(0,1,{type:c,content:r}),l=e),this.req({P:jn.MODIFY_C2C_MSG,data:{from:t,to:n,version:i,sequence:o,random:s,time:a,elements:l,cloudCustomData:u}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,i=e.lastMessageTime,o="".concat(this._n,".").concat("setMessageRead"),s=(e="convID:".concat(n," lastMessageTime:").concat(i),be.l("".concat(o," ").concat(e)),Ke(i)||this.warn("DoNotModifyLastTime"),new oi("setMessageRead"));return s.setMessage(e),this.req({P:jn.SET_C2C_MSG_READ,data:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:i,receipt:1}]}}}).then((function(){s.end(),be.l("".concat(o," ok"));var e=t.get(11);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:i}),e.updateUnreadCount(n),Cn()})).catch((function(e){return s.setError(e).end(),be.l("".concat(o," failed. error:"),e),En(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".").concat("getRoamingMessage"),i=e.peerAccount,o=e.conversationID,s=e.count,a=e.lastMessageTime,r=(e=e.messageKey,"peerAccount:".concat(i," count:").concat(s||15," lastMessageTime:").concat(a||0," messageKey:").concat(e)),c=(be.l("".concat(n," ").concat(r)),new oi("getRoamingMessage"));return this.req({P:jn.GET_C2C_ROAMING_MSG,data:{peerAccount:i,count:s||15,lastMessageTime:a||0,messageKey:e}}).then((function(e){var i=(e=e.data).complete,s=e.messageList,a=e.messageKey,u=(e=e.lastMessageTime,lt(s)?be.l("".concat(n," ok. complete:").concat(i," but messageList is undefined!")):be.l("".concat(n," ok. complete:").concat(i," count:").concat(s.length)),c.setMessage("".concat(r," complete:").concat(i," length:").concat(s.length)).end(),t.get(11)),l=((i=1===i)&&u.setCompleted(o),[]);return s=u.onRoamingMessage(s,o,!0,l),u.modifyMessageList(o),u.updateIsRead(o),u.updateRoamingMsgKeyAndTime(o,a,e),a=u.getPeerReadTime(o),be.l("".concat(n," update isPeerRead property. convID:").concat(o," peerReadTime:").concat(a)),a?u.updateMsgIsPeerReadProp(o,a):(e=o.replace(E.CONV_C2C,""),t.getRemotePeerReadTime([e]).then((function(){u.updateMsgIsPeerReadProp(o,u.getPeerReadTime(o))}))),a="",0<s.length?a=s[0].ID:(e=u.getLocalOldestMessage(o))&&(a=e.ID),be.l("".concat(n," nextReqID:").concat(a," storedMsgCount:").concat(s.length)),{nextReqID:a,storedMessageList:s,assembledMessageList:l,isPullingCompleted:i}})).catch((function(e){return c.setMessage(r).setError(e).end(),be.w("".concat(n," failed. error:"),e),En(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".").concat("getRoamingMessagesHopping"),i=e.peerAccount,o=void 0===(o=e.time)?0:o,s=e.count,a=e.direction,r="".concat(E.CONV_C2C).concat(i),c="peerAccount:".concat(i," count:").concat(s," time:").concat(o," direction:").concat(a),u=(be.l("".concat(n," ").concat(c)),new oi("getRoamingMessagesHopping"));return this.req({P:jn.GET_C2C_ROAMING_MSG,data:{peerAccount:i,count:s+1,lastMessageTime:o,direction:a}}).then((function(e){var i=(e=e.data).complete,o=void 0===(o=e.messageList)?[]:o,s=(e=e.lastMessageTime,"complete:".concat(i," count:").concat(o.length)),l=(be.l("".concat(n," ok. ").concat(s)),u.setMessage("".concat(c," ").concat(s)).end(),1!==i&&(1===a?o.pop():o.shift()),t.get(11));return s=l.onRoamingMessage(o,r,!1),t._modifyMessageList(r,s),o=t._computeResult({complete:i,lastMessageTime:e,resultList:s}),l.storeHoppingMessageList(o.messageList),i=l.getPeerReadTime(r),be.l("".concat(n," update isPeerRead property. convID:").concat(r," peerReadTime:").concat(i)),i?l.updateMsgIsPeerReadProp(r,i):(e=r.replace(E.CONV_C2C,""),t.getRemotePeerReadTime([e]).then((function(){l.updateMsgIsPeerReadProp(r,l.getPeerReadTime(r))}))),Cn(o)})).catch((function(e){return u.setMessage(c).setError(e).end(),be.w("".concat(n," failed. error:"),e),En(e)}))}},{key:"_computeResult",value:function(e){var t=void 0===(t=e.complete)?0:t,n=e.lastMessageTime;return e={messageList:v(void 0===(e=e.resultList)?[]:e),isCompleted:!1,nextMessageTime:""},1===t?e.isCompleted=!0:e.nextMessageTime=n,e}},{key:"_modifyMessageList",value:function(e,t){if(e=this.get(11).getLocalConversation(e))for(var n=e.userProfile.nick,i=e.userProfile.avatar,o=(e=this.get(4).getNickAndAvatarByUserID(this.getMyUserID())).nick,s=e.avatar,a=t.length-1;0<=a;a--){var r=t[a];"in"===r.flow&&(r.nick!==n&&r.setNickAndAvatar({nick:n}),r.avatar!==i)&&r.setNickAndAvatar({avatar:i}),"out"===r.flow&&(r.nick!==o&&r.setNickAndAvatar({nick:o}),r.avatar!==s)&&r.setNickAndAvatar({avatar:s})}}},{key:"getRemotePeerReadTime",value:function(e){var t,n=this,i="".concat(this._n,".").concat("getRemotePeerReadTime");return qe(e)?Promise.resolve():(t=new oi("getRemotePeerReadTime"),be.l("".concat(i," userIDList:").concat(e)),this.req({P:jn.GET_C2C_PEER_READ_TIME,data:{userIDList:e}}).then((function(o){var s=o.data.peerReadTimeList;be.l("".concat(i," ok. peerReadTimeList:").concat(s));for(var a="",r=n.get(11),c=0;c<e.length;c++)a+="".concat(e[c],"-").concat(s[c]," "),0<s[c]&&r.recordPeerReadTime("".concat(E.CONV_C2C).concat(e[c]),s[c]);t.setMessage(a).end()})).catch((function(e){t.setError(e).end(),be.w("".concat(i," failed. error:"),e)})))}},{key:"sendReadReceipt",value:function(e){var t,n=e[0].conversationID.replace(E.CONV_C2C,""),i=new oi("sendReadReceipt"),o=(i.setMessage("peerAccount:".concat(n)),this.getMyUserID());return 0===(e=e.filter((function(e){return e.from!==o&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}))).length?En({code:qn.READ_RECEIPT_MSG_LIST_EMPTY}):(t="".concat(this._n,".").concat("sendReadReceipt"),be.l("".concat(t,". peerAccount:").concat(n," length:").concat(e.length)),this.req({P:jn.SEND_C2C_READ_RECEIPT,data:{peerAccount:n,messageInfoList:e}}).then((function(e){return i.end(),be.l("".concat(t," ok")),Cn()})).catch((function(e){return i.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)})))}},{key:"getReadReceiptList",value:function(e){var t=e[0].conversationID.replace(E.CONV_C2C,"");return be.l("".concat(this._n,".getReadReceiptList peerAccount:").concat(t," msgCount:").concat(e.length)),Sn({messageList:e})}},{key:"getMessageExtensions",value:function(e,t){return be.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.req({P:jn.GET_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return be.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),this.req({P:jn.MODIFY_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),extensionList:t,operateType:n}})}},{key:"getMessageKey",value:function(e){var t=e.clientSequence,n=e.random;return e=e.time,"".concat(t,"_").concat(n,"_").concat(e)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._msgFromUnreadDBMap.clear(),this._noticeFromUnreadDBList.length=0}}]),Ni={A2KEY_AND_TINYID_UPDATED:"_inner".concat(1),CLOUD_CONFIG:"_inner".concat(2),PROFILE_UPDATED:"_inner".concat(3),CONV_SYNC_COMPLETED:"_inner".concat(4),C2C_UNREAD_HANDLE_COMPLETED:"_inner".concat(5)},wi=s((function e(t){i(this,e),this._convM=t,this._map=new Map,this._n="MsgListHandler",this._latestMsgSentByPeerMap=new Map,this._latestMsgSentByMeMap=new Map,this._hoppingMsgMap=new Map,this.TOPIC_MSG_LIMIT=1e3,this._convM.getIEmitInst().on(Ni.CLOUD_CONFIG,this._onCloudConfig,this)}),[{key:"_onCloudConfig",value:function(){var e=this._convM.getCloudConfig("topic_msg_limit");lt(e)||(this.TOPIC_MSG_LIMIT=Number(e)),be.l("".concat(this._n,"._onCloudConfig topicMsgLimit:").concat(this.TOPIC_MSG_LIMIT))}},{key:"onCheckTimer",value:function(e){if(e%20==0&&0<this._map.size){var t,n=a(this._map);try{for(n.s();!(t=n.n()).done;){var i=_(t.value,2),o=i[0],s=i[1];o.includes(Fe)&&s.size>=this.TOPIC_MSG_LIMIT&&this._convM.clearMemMsg(o,!0)}}catch(r){n.e(r)}finally{n.f()}}}},{key:"pushIn",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,i=!0,o=(this._map.has(n)||this._map.set(n,new Map),this._getUniqueIDOfMsg(e));if(this._map.get(n).has(o)){var s=this._map.get(n).get(o);if(!t||!0===s.isModified)return!1}return this._map.get(n).set(o,e),this._setLatestMsgSentByPeer(n,e),this._setLatestMsgSentByMe(n,e),i}},{key:"unshift",value:function(e,t){var n;if(Ye(e)?0<e.length&&(n=e[0].conversationID,this._unshiftMultipleMsgs(e,t)):(n=e.conversationID,this._unshiftSingleMsg(e,t)),n){var i=Array.from(this._map.get(n).values());if(0!==(e=i.length)){for(var o=e-1;0<=o;o--)if("out"===i[o].flow){this._setLatestMsgSentByMe(n,i[o]);break}if(n.startsWith(E.CONV_C2C))for(var s=e-1;0<=s;s--)if("in"===i[s].flow){this._setLatestMsgSentByPeer(n,i[s]);break}}}}},{key:"_unshiftSingleMsg",value:function(e,t){var n,i,o=e.conversationID,s=this._getUniqueIDOfMsg(e);this._map.has(o)?(n=this._map.get(o),i=Array.from(n),n.has(s)||(i.unshift([s,e]),this._map.set(o,new Map(i)),t.push(e))):(this._map.set(o,new Map),this._map.get(o).set(s,e),t.push(e))}},{key:"_unshiftMultipleMsgs",value:function(e,t){for(var n=e.length,i=[],o=e[0].conversationID,s=this._map.get(o),a=this._map.has(o)?Array.from(s):[],r=0;r<n;r++){var c=this._getUniqueIDOfMsg(e[r]);s&&s.has(c)||(i.push([c,e[r]]),t.push(e[r]))}this._map.set(o,new Map(i.concat(a)))}},{key:"remove",value:function(e){var t=e.conversationID;e=this._getUniqueIDOfMsg(e),this._map.has(t)&&this._map.get(t).delete(e)}},{key:"revoke",value:function(e,t,n){var i;return this._map.has(e)?(i=this._map.get(e),this._updateMsgIsRevoked(i,t,n)):this._hoppingMsgMap.has(e)?(i=this._hoppingMsgMap.get(e),this._updateMsgIsRevoked(i,t,n)):null}},{key:"_updateMsgIsRevoked",value:function(e,t,n){var i,o=a(e);try{for(o.s();!(i=o.n()).done;){var s=_(i.value,2)[1];if(s.sequence===t&&(lt(n)||s.random===n))return s.isRevoked||(s.isRevoked=!0),s}}catch(r){o.e(r)}finally{o.f()}}},{key:"removeByConvID",value:function(e){var t=this._map.has(e);be.l("".concat(this._n,".removeByConvID convID:").concat(e," has:").concat(t)),t&&(this._map.delete(e),this._latestMsgSentByPeerMap.delete(e),this._latestMsgSentByMeMap.delete(e))}},{key:"findMessage",value:function(e){return this._findMsg(e,this._map)||this._findMsg(e,this._hoppingMsgMap)}},{key:"_findMsg",value:function(e,t){var n,i=null,o=a(t);try{for(o.s();!(n=o.n()).done;)for(var s=v(_(n.value,2)[1].values()),r=s.length,c=0;c<r;c++)if(s[c].ID===e){i=s[c];break}}catch(u){o.e(u)}finally{o.f()}return i}},{key:"updateMsgIsPeerReadProp",value:function(e,t){var n,i=[];return this._map.has(e)?(n=this._map.get(e),i=this._updateMsgIsPeerReadProp(n,t)):this._hoppingMsgMap.has(e)&&(n=this._hoppingMsgMap.get(e),i=this._updateMsgIsPeerReadProp(n,t)),be.l("".concat(this._n,".updateMsgIsPeerReadProp convID:").concat(e," peerReadTime:").concat(t," count:").concat(i.length)),i}},{key:"_updateMsgIsPeerReadProp",value:function(e,t){var n,i=[],o=a(e);try{for(o.s();!(n=o.n()).done;){var s=_(n.value,2)[1];s.time<=t&&!s.isPeerRead&&"out"===s.flow&&(s.isPeerRead=!0,i.push(s))}}catch(r){o.e(r)}finally{o.f()}return i}},{key:"updateMsgIsModifiedProp",value:function(e){var t=e.conversationID;this._map.has(t)&&(e=this._getUniqueIDOfMsg(e),t=this._map.get(t).get(e))&&(t.isModified=!0)}},{key:"hasLocalMsgList",value:function(e){return this._map.has(e)}},{key:"getLocalMsgList",value:function(e){return this.hasLocalMsgList(e)?v(this._map.get(e).values()):[]}},{key:"getLocalMaxSeq",value:function(e){return this.hasLocalMsgList(e)?(e=v(this._map.get(e).values()).map((function(e){return e.sequence})),Math.max.apply(Math,v(e))):0}},{key:"getLocalMaxTime",value:function(e){return this.hasLocalMsgList(e)?(e=v(this._map.get(e).values()).map((function(e){return e.time})),Math.max.apply(Math,v(e))):0}},{key:"hasLocalMsg",value:function(e,t){for(var n=!1,i=this.getLocalMsgList(e),o=i.length,s=0;s<o;s++)i[s].ID===t&&(n=!0);return n}},{key:"getLocalMsg",value:function(e,t){for(var n=null,i=this.getLocalMsgList(e),o=i.length,s=0;s<o;s++)if(i[s].ID===t){n=i[s];break}return n}},{key:"getLocalLastMsg",value:function(e){for(var t=this.getLocalMsgList(e),n=void 0,i=t.length-1;0<=i;i--)if(t[i].status===kn){n=t[i];break}return n}},{key:"getLocalSecondLastMsg",value:function(e){return(e=this.getLocalMsgList(e))[e.length-2]}},{key:"getLocalOldestMsg",value:function(e){return this.getLocalMsgList(e)[0]}},{key:"_setLatestMsgSentByPeer",value:function(e,t){e.startsWith(E.CONV_C2C)&&"in"===t.flow&&this._latestMsgSentByPeerMap.set(e,t)}},{key:"_setLatestMsgSentByMe",value:function(e,t){"out"===t.flow&&this._latestMsgSentByMeMap.set(e,t)}},{key:"getLatestMsgSentByPeer",value:function(e){return this._latestMsgSentByPeerMap.get(e)}},{key:"getLatestMsgSentByMe",value:function(e){return this._latestMsgSentByMeMap.get(e)}},{key:"modifyMsgSentByPeer",value:function(e){var t=e.conversationID,n=e.latestNick,i=e.latestAvatar;if(!qe(e=this._map.get(t))){var o=Array.from(e.values());if(0!==(e=o.length)){for(var s=null,a=0,r=!1,c=e-1;0<=c;c--)"in"===o[c].flow&&((s=o[c]).nick!==n&&(s.setNickAndAvatar({nick:n}),r=!0),s.avatar!==i&&(s.setNickAndAvatar({avatar:i}),r=!0),r)&&(a+=1);be.l("".concat(this._n,".modifyMsgSentByPeer convID:").concat(t," count:").concat(a))}}}},{key:"modifyMsgSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,i=e.latestAvatar;if(!qe(e=this._map.get(t))){var o=Array.from(e.values());if(0!==(e=o.length)){for(var s=null,a=0,r=!1,c=e-1;0<=c;c--)"out"===o[c].flow&&((s=o[c]).nick!==n&&(s.setNickAndAvatar({nick:n}),r=!0),s.avatar!==i&&(s.setNickAndAvatar({avatar:i}),r=!0),r)&&(a+=1);be.l("".concat(this._n,".modifyMsgSentByMe convID:").concat(t," count:").concat(a))}}}},{key:"getTopicConvIDList",value:function(e){return v(this._map.keys()).filter((function(t){return t.startsWith("".concat(E.CONV_GROUP).concat(e))}))}},{key:"onMsgModified",value:function(e,t){var n,i,o,s;return(this._map.has(e)||this._hoppingMsgMap.has(e))&&(n="".concat(this._n,".onMsgModified"),o=this._getUniqueIDOfMsg(t),s=!!(i=this._getTargetMsg(e,o)),be.l("".concat(n," convID:").concat(e," uniqueID:").concat(o," has:").concat(s)),s)?(e=t.messageVersion,o=t.elements,s=t.cloudCustomData,t=t.checkResult,be.l("".concat(n," localVersion:").concat(i.version," remoteVersion:").concat(e)),i.version<e?(i.version=e,i._elements=JSON.parse(JSON.stringify(o)),i.payload=i._elements[0].content,i.type=i._elements[0].type,i.cloudCustomData=s,i.isModified=!0,i.hasRiskContent=Wt(t),{isUpdated:!0,message:i}):{isUpdated:!1,message:i}):{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMsg",value:function(e){var t=e.from,n=e.to,i=e.random,o=e.sequence;return e=e.time,"".concat(t,"-").concat(n,"-").concat(i,"-").concat(o,"-").concat(e)}},{key:"_getTargetMsg",value:function(e,t){if(this._map.has(e))return this._map.get(e).get(t);var n=void 0;if(this._hoppingMsgMap.has(e))for(var i=v(this._hoppingMsgMap.get(e).values()),o=0;o<i.length;o++)if(this._getUniqueIDOfMsg(i[o])===t){n=i[o];break}return n}},{key:"storeHoppingMsgList",value:function(e){if(0!==e.length){var t=e[0].conversationID,n=e.length;this._hoppingMsgMap.has(t)||this._hoppingMsgMap.set(t,new Map);for(var i=this._hoppingMsgMap.get(t),o=0;o<n;o++){var s=e[o];i.has(s.ID)||i.set(s.ID,s)}}}},{key:"getHoppingMsg",value:function(e,t){if(this._hoppingMsgMap.has(e))return this._hoppingMsgMap.get(e).get(t)}},{key:"reset",value:function(){this._map.clear(),this._latestMsgSentByPeerMap.clear(),this._latestMsgSentByMeMap.clear(),this._hoppingMsgMap.clear()}}]);function Ui(e){return i(this,Ui),(e=n(this,Ui,[e]))._n="C2CModule",e._msgFromUnreadDBMap=new Map,e._noticeFromUnreadDBList=[],e}function Gi(e){this.mixin(e)}function xi(e,t,n){return lt(e)?{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:n&&e.ID||e instanceof ki?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:Ft(e.type,e.payload,t),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:g(g({},e),{},{messageForShow:Ft(e.type,e.payload,t)})}function Fi(e,t){return qe(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",avatar:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:Ft(e.type,e.payload,t),nick:e.nick||"",avatar:e.avatar||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}}function Bi(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return"";for(var i,o,s=0,a=0;o=t.charAt(a++);~o&&(i=s%4?64*i+o:o,s++%4)&&(n+=String.fromCharCode(255&i>>(-2*s&6))))o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);try{return decodeURIComponent(escape(n))}catch(r){return""}}Gi.mixin=function(e){(e=e.prototype||e)._isReady=!1,e.ready=function(e){if(e)return this._isReady?void(1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},e.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&0<t.length&&t.forEach((function(e){e.call(this)}),e)}),1)},e.resetReady=function(){this._isReady=!1,this._readyQueue=[]},e.isReady=function(){return this._isReady}};var qi=["jpg","jpeg","gif","png","bmp","image","webp"],Vi=["mp4","quicktime","mov"],ji=s((function e(t){var n=this;i(this,e),qe(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||E.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||E.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],qe(t.profileCustomField))||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})}))}),[{key:"validate",value:function(e){var t,n=!0,i="";if(qe(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,a=0;a<o;a++){if(s=e.profileCustomField[a],!ut(s.key)||-1===s.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!ut(s.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if("profileCustomField"===t)continue;if(qe(e[t])&&!ut(e[t])&&!Ke(e[t])){i="key:"+t+", invalid value:"+e[t],n=!1;continue}switch(t){case"nick":ut(e[t])||(n=!(i="nick must be a string")),500<nt(e[t])&&(i="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(nt(e[t])," bytes"),n=!1);break;case"gender":st(Ne,e.gender)||(i="key:gender, invalid value:"+e.gender,n=!1);break;case"birthday":Ke(e.birthday)||(n=!(i="birthday must be a number"));break;case"location":ut(e.location)||(n=!(i="location must be a string"));break;case"selfSignature":ut(e.selfSignature)||(n=!(i="selfSignature must be a string"));break;case"allowType":st(Ue,e.allowType)||(i="key:allowType, invalid value:"+e.allowType,n=!1);break;case"language":Ke(e.language)||(n=!(i="language must be a number"));break;case"avatar":ut(e.avatar)||(n=!(i="avatar must be a string"));break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n=!(i="messageSettings must be 0 or 1"));break;case"adminForbidType":st(we,e.adminForbidType)||(i="key:adminForbidType, invalid value:"+e.adminForbidType,n=!1);break;case"level":Ke(e.level)||(n=!(i="level must be a number"));break;case"role":Ke(e.role)||(n=!(i="role must be a number"));break;default:i="unknown key:"+t+" "+e[t],n=!1}}return{valid:n,tips:i}}}]),Hi=s((function e(t){i(this,e),this.MAX_LENGTH=t,this.map=new Map}),[{key:"set",value:function(e){var t;this.map.size>=this.MAX_LENGTH&&(t=this.map.entries().next().value[0],this.map.delete(t)),this.map.set(e,1)}},{key:"has",value:function(e){return this.map.has(e)}},{key:"delete",value:function(e){this.has(e)&&this.map.delete(e)}},{key:"reset",value:function(){this.map.clear()}}]),Ki=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],zi=s((function e(t){i(this,e),this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._initGroup(t)}),[{key:"memberNum",get:function(){return this.memberCount},set:function(e){}},{key:"maxMemberNum",get:function(){return this.maxMemberCount},set:function(e){}},{key:"_initGroup",value:function(e){for(var t in e)Ki.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?this[t]=e[t]:this.isSupportTopic=1===e[t]):this.updateSelfInfo(e[t]))}},{key:"updateGroup",value:function(e){var t=this;(e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0),e=JSON.parse(JSON.stringify(e))).lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),lt(e.muteAllMembers)||("On"===e.muteAllMembers?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&_t(this.groupCustomField,e.groupCustomField),lt(e.memberNum)||(this.memberCount=e.memberNum),lt(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),lt(e.isSupportTopic)||(this.isSupportTopic=Ke(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),Ze(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),Ye(e.members)&&0<e.members.length&&e.members.forEach((function(e){e.userID===t.selfInfo.userID&&Ze(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){e={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList},Ze(this.selfInfo,g({},e),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),Wi=s((function e(t,n){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2];i(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=xi(t.lastMessage,n,o),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark=t.remark||"",this.isPinned=t.isPinned||!1,this.messageRemindType=t.messageRemindType,this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this.draftText=t.draftText||"",this._initProfile(t),this.subType=this.groupProfile?this.groupProfile.type:""}),[{key:"toAccount",get:function(){return this.conversationID.startsWith(E.CONV_C2C)?this.conversationID.replace(E.CONV_C2C,""):this.conversationID.startsWith(E.CONV_GROUP)?this.conversationID.replace(E.CONV_GROUP,""):""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),lt(this.userProfile)&&this.type===E.CONV_C2C?this.userProfile=new ji({userID:e.conversationID.replace("C2C","")}):lt(this.groupProfile)&&this.type===E.CONV_GROUP&&(this.groupProfile=new zi({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations;e=e.isUnreadC2CMessage,lt(t)||(Mt(this.subType)?this.unreadCount=0:n&&this.type===E.CONV_GROUP||n&&this.type===E.CONV_TOPIC||e&&this.type===E.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=xi(e)}},{key:"updateGroupAtInfoList",value:function(e){var n;this._isNeedMergeGroupAtInfo(e)||(-1!==(n=(t(n=e.groupAtType)||d(n)||M(n)||p()).slice(0)).indexOf(E.CONV_AT_ME)&&-1!==n.indexOf(E.CONV_AT_ALL)&&(n=[E.CONV_AT_ALL_AT_ME]),n={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence},this.groupAtInfoList.push(n))}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t,n=e.groupID,i=e.sequence;return!!Ct({groupID:n})&&(t=!1,this.groupAtInfoList.forEach((function(n){n.messageSequence===i&&(-1<n.atTypeArray.indexOf(E.CONV_AT_ME)&&-1<e.groupAtType.indexOf(E.CONV_AT_ALL)&&(n.atTypeArray=[E.CONV_AT_ALL_AT_ME]),-1<n.atTypeArray.indexOf(E.CONV_AT_ALL)&&-1<e.groupAtType.indexOf(E.CONV_AT_ME)&&(n.atTypeArray=[E.CONV_AT_ALL_AT_ME],n.__random=e.__random,n.__sequence=e.__sequence),t=!0)})),t)}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return 1<=this.unreadCount&&(--this.unreadCount,!0)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence;return e=e.time,this.type===E.CONV_C2C&&t===this.lastMessage.lastSequence&&e===this.lastMessage.lastTime||this.type===E.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}},{key:"setDraftText",value:function(e){this.draftText=e}}]),Yi=r(r(r({},E.MSG_REMIND_ACPT_AND_NOTE,0),E.MSG_REMIND_DISCARD,1),E.MSG_REMIND_ACPT_NOT_NOTE,2),$i=s((function e(t){i(this,e),this._convM=t,this._n="MsgRemindHandler"}),[{key:"onAllRcvMsgOptNotify",value:function(e){e=this._handleResult(e),this._convM.emitOEvt(S.ALL_RECEIVE_MESSAGE_OPT_UPDATED,e)}},{key:"getC2CMsgRemindType",value:function(e){var t=this,n="".concat(this._n,".getC2CMsgRemindType");return this._convM.req({P:jn.GET_C2C_PEER_MUTE_NOTIFICATIONS,data:{toAccount:this._convM.getMyUserID(),userIDList:e}}).then((function(i){be.l("".concat(n," ok. userIDList:").concat(e)),i=i.data.muteFlagList,t._convM.onC2CMsgRemindTypeFetched(i)})).catch((function(e){be.e("".concat(n," failed. error:"),e)}))}},{key:"set",value:function(e){return e.groupID?this._setGroupMsgRemindType(e):Ye(e.userIDList)?this._setC2CMsgRemindType(e):void 0}},{key:"_setGroupMsgRemindType",value:function(e){var t=this,n="".concat(this._n,".").concat("_setGroupMsgRemindType"),i=e.groupID,o=e.messageRemindType,s="groupID:".concat(i," messageRemindType:").concat(o),a=new oi("_setGroupMsgRemindType"),r=(a.setMessage(s),this._get(7));return r?r.modifyGroupMemberInfo({groupID:i,messageRemindType:o,userID:this._convM.getMyUserID()}).then((function(){a.end(),be.l("".concat(n," ok. ").concat(s));var i=t.onGroupMsgRemindTypeUpdated(e);return t._convM.onTotalUnreadCountUpdate(),Cn(i)})).catch((function(e){return a.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)})):En({code:qn.NO_MODULE})}},{key:"onGroupMsgRemindTypeUpdated",value:function(e){var t,n,i=e.groupID,o=(e=e.messageRemindType,be.l("".concat(this._n,".onGroupMsgRemindTypeUpdated groupID:").concat(i," messageRemindType:").concat(e)),this._get(7).getLocalGroupProfile(i));return o&&(o.selfInfo.messageRemindType=e),St(i)?(t=xt(n=i),(n=this._get(10).getLocalTopic(t,n))&&n.updateSelfInfo({messageRemindType:e})&&this._convM.emitOEvt(S.TOPIC_UPDATED,{groupID:t,topic:n}),{topic:n}):(this._convM.patchMsgRemindType({ID:i,isC2CConversation:!1,messageRemindType:e})&&this._emitConvUpdate(),{group:o})}},{key:"_setC2CMsgRemindType",value:function(e){var t=this,n="".concat(this._n,".").concat("_setC2CMsgRemindType"),i=e.userIDList,o=e.messageRemindType,s=i.slice(0,30),a=(e=Yi[o]||0,"userIDList:".concat(s," messageRemindType:").concat(o)),r=new oi("_setC2CMsgRemindType");return r.setMessage(a),this._convM.req({P:jn.SET_C2C_PEER_MUTE_NOTIFICATIONS,data:{userIDList:s,muteFlag:e}}).then((function(e){r.end(),e=e.data.errorList;var i=[],c=[],u=(Ye(e)&&e.forEach((function(e){i.push(e.userID),c.push({userID:e.userID,code:e.errorCode})})),e=s.filter((function(e){return-1===i.indexOf(e)})),be.l("".concat(n," ok. ").concat(a," successUserIDList:").concat(e," failureUserIDList:").concat(JSON.stringify(c))),0);return e.forEach((function(e){t._convM.patchMsgRemindType({ID:e,isC2CConversation:!0,messageRemindType:o})&&(u+=1)})),1<=u&&t._emitConvUpdate(),s.length=i.length=0,t._convM.onTotalUnreadCountUpdate(),Sn({successUserIDList:e.map((function(e){return{userID:e}})),failureUserIDList:c})})).catch((function(e){return r.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"_get",value:function(e){return this._convM.get(e)}},{key:"_emitConvUpdate",value:function(){this._convM.emitConvUpdate(!0,!1)}},{key:"setAllRcvMsgOpt",value:function(e){var t="".concat(this._n,".").concat("setAllRcvMsgOpt"),n=void 0===(n=e.messageRemindType)?E.MSG_REMIND_ACPT_NOT_NOTE:n,i=void 0===(i=e.isRepeated)||i,o=void 0===(o=(s=this._calcStartAndEndTime(e)).startTime)?0:o,s=void 0===(s=s.endTime)?0:s,a=(e=JSON.stringify(e),new oi("setAllRcvMsgOpt"));return a.setMessage(e),be.l("".concat(t," options:").concat(e)),this._convM.req({P:jn.SET_ALL_RECEIVE_MSG_OPT,data:{messageRemindType:Yi[n],startTime:o,endTime:s,isRepeated:i?1:0}}).then((function(e){return a.end(),be.l("".concat(t," ok.")),Cn(e)})).catch((function(e){return a.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))}},{key:"_calcStartAndEndTime",value:function(e){var t=void 0===(t=e.startHour)?0:t,n=void 0===(n=e.startMinute)?0:n,i=void 0===(i=e.startSecond)?0:i,o=void 0===(o=e.duration)?0:o,s=(e=void 0===(e=e.isRepeated)||e,(r=new Date).getFullYear()),a=r.getMonth(),r=r.getDate();return{startTime:s=Math.round(new Date(s,a,r,t,n,i).getTime()/1e3),endTime:e&&86400<=o?s+86400:s+o}}},{key:"getAllRcvMsgOpt",value:function(){var e=this,t="".concat(this._n,".").concat("getAllRcvMsgOpt"),n=new oi("getAllRcvMsgOpt");return this._convM.req({P:jn.GET_ALL_RECEIVE_MSG_OPT,data:{toAccount:this._convM.getMyUserID()}}).then((function(i){return i=i.data,n.setMessage(JSON.stringify(i)).end(),be.l("".concat(t," ok. data:").concat(JSON.stringify(i))),Cn(i=e._handleResult(i))})).catch((function(e){return n.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))}},{key:"_handleResult",value:function(e){var t=e.messageRemindType,n=e.startTime,i=e.endTime,o=(e=e.isRepeated,E.MSG_REMIND_ACPT_AND_NOTE);return 1===t&&(o=E.MSG_REMIND_DISCARD),{messageRemindType:o=2===t?E.MSG_REMIND_ACPT_NOT_NOTE:o,startTime:n,endTime:i,isRepeated:1===e}}},{key:"reset",value:function(){be.l("".concat(this._n,".reset"))}}]),Ji=s((function e(t){i(this,e),this._convM=t,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=Rn}),[{key:"setConvCustomData",value:function(e){var t=this,n="".concat(this._n,".").concat("setConvCustomData"),i=e.conversationIDList,o=e.customData,s=(be.l("".concat(n," options:"),e),new oi("setConvCustomData")),a=(s.setMessage(JSON.stringify(e)),{fromAccount:this._getMyUserID(),itemList:[]}),r=[],c=[];return i.forEach((function(e){var n;return t._hasLocalConv(e)?Et(e)||Tt(e)?(n={operationType:2,contactItem:void 0,customMark:o},Et(e)?n.contactItem={type:1,toAccount:e.replace(E.CONV_C2C,"")}:Tt(e)&&(n.contactItem={type:2,groupID:e.replace(E.CONV_GROUP,"")}),void a.itemList.push(n)):(t._onConvIDInvalid(c,e),!0):(t._onConvNotFound(c,e),!0)})),c.length===i.length?Sn({successConversationIDList:r,failureConversationIDList:c}):this._convM.req({P:jn.SET_CONV_CUSTOM_DATA,data:a}).then((function(e){var i,a,u;return s.end(),be.l("".concat(n," ok")),Ye(e=e.data.resultItem)&&(u=!1,e.forEach((function(e){i=t._concatConvID(e.contactItem),0===e.resultCode?(r.push(i),(a=t._getLocalConv(i))&&a.customData!==o&&(a.customData=o,u=!0)):c.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===u)&&t._emitConvUpdate(),Cn({successConversationIDList:r,failureConversationIDList:c})})).catch((function(e){return s.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"markConv",value:function(e){var t,n,i,o,s,a,r,c,u,l,d=this;return this._convM.canIUse(N.CONV_MARK)?(t="".concat(this._n,".").concat("markConv"),n=e.conversationIDList,i=e.markType,o=e.enableMark,be.l("".concat(t," options:"),e),s=new oi("markConv"),a=void s.setMessage(JSON.stringify(e)),r=void 0,e=this._getFlagBit(i),!0===o?r=[e]:a=[e],c={fromAccount:this._getMyUserID(),itemList:[]},u=[],l=[],n.forEach((function(e){var t;return d._hasLocalConv(e)?Et(e)||Tt(e)?(t={operationType:1,contactItem:void 0,clearMark:a,setMark:r},Et(e)?t.contactItem={type:1,toAccount:e.replace(E.CONV_C2C,"")}:Tt(e)&&(t.contactItem={type:2,groupID:e.replace(E.CONV_GROUP,"")}),void c.itemList.push(t)):(d._onConvIDInvalid(l,e),!0):(d._onConvNotFound(l,e),!0)})),l.length===n.length?Sn({successConversationIDList:u,failureConversationIDList:l}):this._convM.req({P:jn.MARK_CONV,data:c}).then((function(e){var n,a,r;return s.end(),be.l("".concat(t," ok")),Ye(e=e.data.resultItem)&&(r=!1,e.forEach((function(e){var t;n=d._concatConvID(e.contactItem),0===e.resultCode?(u.push(n),(a=d._getLocalConv(n))&&(t=a.markList.indexOf(i),!0===o?-1===t&&(a.markList.push(i),r=!0):-1!==t&&(a.markList.splice(t,1),r=!0))):l.push({conversationID:n,code:e.resultCode,message:e.resultInfo})})),!0===r)&&d._emitConvUpdate(),Cn({successConversationIDList:u,failureConversationIDList:l})})).catch((function(e){return s.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._convM.noUse("markConv")}},{key:"getLocalConvGroupList",value:function(){var e=this;return be.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===An?this.getRemoteConvGroupList().then((function(){return Cn(v(e._convGroupMap.values()))})):Sn(v(this._convGroupMap.values()))}},{key:"searchConvGroupAndMark",value:function(e,t){var n=this,i="".concat(this._n,".searchConvGroupAndMark"),o=[];return e.forEach((function(e){1===t?o.push({type:1,toAccount:e}):2===t&&o.push({type:2,groupID:e})})),be.l("".concat(i," type:").concat(t," list:"),e),this._convM.req({P:jn.SEARCH_CONV_GRP_MARK,data:{fromAccount:this._getMyUserID(),contactItem:o}}).then((function(e){var t=(e=e.data).contactItem;e=e.groupItem,be.l("".concat(i," ok. contactItem:"),t,"groupItem:",e),n._fillConvGroupMap(e),n._handleContactItem(t),n._emitConvUpdate()})).catch((function(e){be.w("".concat(i," failed. error:"),e)}))}},{key:"_fillConvGroupMap",value:function(e){var t=this;Ye(e)&&e.forEach((function(e){var n=e.convGroupID;e=e.groupName,t._convGroupMap.set(n,e)}))}},{key:"_handleContactItem",value:function(e){var t,n=this;Ye(e)&&e.forEach((function(e){var i=[],o=e.standardMark,s=e.customData,a=e.convGroupIDList;Ye(a)&&a.forEach((function(e){n._convGroupMap.has(e)&&i.push(n._convGroupMap.get(e))})),t=n._concatConvID(e),(t=n._getLocalConv(t))&&(t.markList=qt(o),t.customData=s||"",t.conversationGroupList=[].concat(i))}))}},{key:"getRemoteConvGroupList",value:function(){var e=this,t="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=On,this._convM.req({P:jn.GET_CONV_GRP_LIST,data:{fromAccount:this._getMyUserID(),startIndex:this._startIndex}}).then((function(n){var i=(n=n.data).completeFlag,o=n.contactItem,s=void 0===(s=n.nextStartIndex)?0:s;if(n=n.groupItem,e._startIndex=s,be.l("".concat(t," completeFlag:").concat(i," nextStartIndex:").concat(s,", groupItem:"),n,"contactItem:",o),e._fillConvGroupMap(n),e._handleContactItem(o),0===i)return e.getRemoteConvGroupList();1===i&&(e._pagingStatus=bn,e._emitConvUpdate(),e._emitConvGroupListUpdate())})).catch((function(n){e._pagingStatus=An,be.w("".concat(t," failed. error:"),n)}))}},{key:"createConvGroup",value:function(e){var t,n,i,o,s,a,r=this;return this._convM.canIUse(N.CONV_GROUP)?(t="".concat(this._n,".").concat("createConvGroup"),be.l("".concat(t," options:"),e),(n=new oi("createConvGroup")).setMessage(JSON.stringify(e)),i=e.groupName,e=e.conversationIDList,o={fromAccount:this._getMyUserID(),itemList:[{groupName:i,contactItem:[]}]},s=[],a=[],e.forEach((function(e){return r._hasLocalConv(e)?Et(e)||Tt(e)?void(Et(e)?o.itemList[0].contactItem.push({type:1,toAccount:e.replace(E.CONV_C2C,"")}):Tt(e)&&o.itemList[0].contactItem.push({type:2,groupID:e.replace(E.CONV_GROUP,"")})):(r._onConvIDInvalid(a,e),!0):(r._onConvNotFound(a,e),!0)})),a.length===e.length?Sn({successConversationIDList:s,failureConversationIDList:a}):this._convM.req({P:jn.CREATE_CONV_GRP,data:o}).then((function(e){n.end(),be.l("".concat(t," ok"));var o,c,u,l=(e=e.data.groupResultItem[0]).groupItem;return e=e.resultItem,We(l)&&(r._convGroupMap.set(l.convGroupID,l.groupName),r._emitConvGroupListUpdate()),Ye(e)&&(u=!1,e.forEach((function(e){o=r._concatConvID(e.contactItem),0===e.resultCode?(s.push(o),(c=r._getLocalConv(o))&&-1===c.conversationGroupList.indexOf(i)&&(c.conversationGroupList.push(i),u=!0)):a.push({conversationID:o,code:e.resultCode,message:e.resultInfo})})),!0===u)&&(r._emitConvUpdate(),r._emitConvGroupListUpdate()),Cn({successConversationIDList:s,failureConversationIDList:a})})).catch((function(e){return n.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._convM.noUse("createConvGroup")}},{key:"deleteConvGroup",value:function(e){var t,n,i=this;return this._convM.canIUse(N.CONV_GROUP)?(t="".concat(this._n,".").concat("deleteConvGroup"),be.l("".concat(t," groupName:").concat(e)),(n=new oi("deleteConvGroup")).setMessage(e),this._convM.req({P:jn.DEL_CONV_GRP,data:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(o){var s;n.end(),be.l("".concat(t," ok")),Ye(o=o.data.groupItem)&&(s=!1,o.forEach((function(e){i._convGroupMap.has(e.convGroupID)&&(i._convGroupMap.delete(e.convGroupID),s=!0)})),!0===s)&&i._emitConvGroupListUpdate(),i._eraseFromConversationGroupList([e])})).catch((function(e){return n.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._convM.noUse("deleteConvGroup")}},{key:"renameConvGroup",value:function(e){var t,n,i,o,s=this;return this._convM.canIUse(N.CONV_GROUP)?(t="".concat(this._n,".").concat("renameConvGroup"),be.l("".concat(t," options:"),e),(n=new oi("renameConvGroup")).setMessage(JSON.stringify(e)),i=e.oldName,o=e.newName,this._convM.req({P:jn.RENAME_CONV_GRP,data:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:i,newName:o}}}).then((function(e){n.end(),be.l("".concat(t," ok")),e=e.data.updateGroupResult.convGroupID,s._convGroupMap.set(e,o),s._emitConvGroupListUpdate(),e=s._convM.getLocalConvList();var a,r,c=!1;e.forEach((function(e){a=e.conversationGroupList,-1!==(r=a.indexOf(i))&&(a.splice(r,1,o),c=!0)})),!0===c&&s._emitConvUpdate()})).catch((function(e){return n.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._convM.noUse("renameConvGroup")}},{key:"addConvsToGroup",value:function(e){var t,n,i,o,s,a,r,c=this;return this._convM.canIUse(N.CONV_GROUP)?(t="".concat(this._n,".").concat("addConvsToGroup"),be.l("".concat(t," options:"),e),(n=new oi("addConvsToGroup")).setMessage(JSON.stringify(e)),i=e.conversationIDList,o=e.groupName,s={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:o,updateItem:[]}},a=[],r=[],i.forEach((function(e){return c._hasLocalConv(e)?Et(e)||Tt(e)?void(Et(e)?s.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(E.CONV_C2C,"")}}):Tt(e)&&s.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(E.CONV_GROUP,"")}})):(c._onConvIDInvalid(r,e),!0):(c._onConvNotFound(r,e),!0)})),r.length===i.length?Sn({successConversationIDList:a,failureConversationIDList:r}):this._convM.req({P:jn.ADD_CONV_TO_GRP,data:s}).then((function(e){var i,s,u;return n.end(),be.l("".concat(t," ok")),Ye(e=e.data.updateGroupResult.contactResultItem)&&(u=!1,e.forEach((function(e){i=c._concatConvID(e.contactItem),0===e.resultCode?(s=c._getLocalConv(i))&&-1===s.conversationGroupList.indexOf(o)&&(s.conversationGroupList.push(o),a.push(i),u=!0):r.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===u)&&(c._emitConvUpdate(),c._emitConvInGroupUpdate(o)),Cn({successConversationIDList:a,failureConversationIDList:r})})).catch((function(e){return n.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._convM.noUse("addConvsToGroup")}},{key:"deleteConvsFromGroup",value:function(e){var t,n,i,o,s,a,r,c=this,u="deleteConvsFromGroup";return this._convM.canIUse(N.CONV_GROUP)?(t="".concat(this._n,".").concat(u),be.l("".concat(t," options:"),e),(n=new oi(u)).setMessage(JSON.stringify(e)),i=e.conversationIDList,o=e.groupName,s={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:o,updateItem:[]}},a=[],r=[],i.forEach((function(e){return c._hasLocalConv(e)?Et(e)||Tt(e)?void(Et(e)?s.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(E.CONV_C2C,"")}}):Tt(e)&&s.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(E.CONV_GROUP,"")}})):(c._onConvIDInvalid(r,e),!0):(c._onConvNotFound(r,e),!0)})),r.length===i.length?Sn({successConversationIDList:a,failureConversationIDList:r}):this._convM.req({P:jn.DEL_CONV_FROM_GRP,data:s}).then((function(e){var i,s,u;return n.end(),be.l("".concat(t," ok")),Ye(e=e.data.updateGroupResult.contactResultItem)&&(u=!1,e.forEach((function(e){var t;i=c._concatConvID(e.contactItem),0===e.resultCode?(s=c._getLocalConv(i))&&-1!==(t=s.conversationGroupList.indexOf(o))&&(s.conversationGroupList.splice(t,1),a.push(i),u=!0):r.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===u)&&(c._emitConvUpdate(),c._emitConvInGroupUpdate(o)),Cn({successConversationIDList:a,failureConversationIDList:r})})).catch((function(e){return n.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._convM.noUse(u)}},{key:"onConvMarkUpdated",value:function(e){var t,n,i=this;qe(e)||(be.l("".concat(this._n,".onConvMarkUpdated markItemList:"),e),n=!1,e.forEach((function(e){var o=e.recentContactItem,s=e.optType,a=e.standardMark;e=e.customMark,t=i._concatConvID(o),(t=i._getLocalConv(t))&&(1===s?n=i._diffStandardMark(t,a):2===s?n=i._diffCustomMark(t,e):3===s&&(o=i._diffStandardMark(t,a),s=i._diffCustomMark(t,e),n=o||s))})),!0===n&&this._emitConvUpdate())}},{key:"_diffStandardMark",value:function(e,t){t=qt(t);var n=!1;return!0!==function(e,t){if(e!==t){if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1}return!0}(e.markList,t)&&(e.markList=t,n=!0),n}},{key:"_diffCustomMark",value:function(e,t){var n=!1;return e.customData!==t&&void 0!==t&&(e.customData=t,n=!0),n}},{key:"onConvGroupCreated",value:function(e){var t=this,n=(be.l("".concat(this._n,".onConvGroupCreated resultList:"),e),!1),i=!1;Ye(e)&&(e.forEach((function(e){var o,s,a=(s=e.msgGroupItem).groupID,r=s.groupName;t._convGroupMap.get(a)!==r&&(t._convGroupMap.set(a,r),i=!0),Ye(s=e.msgRecentContactItem)&&s.forEach((function(e){o=t._concatConvID(e),(o=t._getLocalConv(o))&&-1===o.conversationGroupList.indexOf(r)&&(o.conversationGroupList.push(r),n=!0)}))})),!0===n&&this._emitConvUpdate(),!0===i)&&this._emitConvGroupListUpdate()}},{key:"onConvGroupDeleted",value:function(e){var t,n=this,i=(be.l("".concat(this._n,".onConvGroupDeleted groupItemList:"),e),[]);Ye(e)&&(t=!1,e.forEach((function(e){var o=e.groupID;e=e.groupName,n._convGroupMap.has(o)&&(n._convGroupMap.delete(o),t=!0,i.push(e))})),!0===t)&&this._emitConvGroupListUpdate(),this._eraseFromConversationGroupList(i)}},{key:"_eraseFromConversationGroupList",value:function(e){qe(e)||(this._convM.getLocalConvList().forEach((function(t){t.conversationGroupList=t.conversationGroupList.filter((function(t){return!e.includes(t)}))})),this._emitConvUpdate())}},{key:"onConvGroupNameUpdated",value:function(e){be.l("".concat(this._n,".onConvGroupNameUpdated options:"),e);var t,n,i,o=e.groupID,s=e.groupName,a=e.oldGroupName;this._convGroupMap.get(o)!==s&&(this._convGroupMap.set(o,s),this._emitConvGroupListUpdate(),e=this._convM.getLocalConvList(),i=!1,e.forEach((function(e){t=e.conversationGroupList,-1!==(n=t.indexOf(a))&&(t.splice(n,1,s),i=!0)})),!0===i)&&this._emitConvUpdate()}},{key:"onConvInGroupUpdated",value:function(e){var t,n,i,o=this,s=(be.l("".concat(this._n,".onConvInGroupUpdated options:"),e),e.oldGroupName);Ye(e=e.recentContactUpdateGroupItem)&&(i=!1,e.forEach((function(e){var a=e.contactOptType;e=e.recentContactItem,t=o._concatConvID(e),(t=o._getLocalConv(t))&&(n=t.conversationGroupList.indexOf(s),1===a?-1===n&&(t.conversationGroupList.push(s),i=!0):2===a&&-1!==n&&(t.conversationGroupList.splice(n,1),i=!0))})),!0===i)&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(s))}},{key:"onConvAddedToOrDeletedFromGroup",value:function(e){var t,n,i=this,o=(be.l("".concat(this._n,".onConvAddedToOrDeletedFromGroup options:"),e),e.msgRecentContactItem),s=(e=e.msgRecentContactUpdateContactItem,o=this._concatConvID(o),this._getLocalConv(o));s&&Ye(e)&&(n=!1,e.forEach((function(e){var o=e.groupOptType;e=e.recentContactGroupItem.groupName,t=s.conversationGroupList.indexOf(e),1===o?-1===t&&(s.conversationGroupList.push(e),n=!0):2===o&&-1!==t&&(s.conversationGroupList.splice(t,1),n=!0),!0===n&&i._emitConvInGroupUpdate(e)})),!0===n)&&this._emitConvUpdate()}},{key:"onConvGroupListSynced",value:function(e){Ye(e)&&0!==e.length&&(be.l("".concat(this._n,".onConvGroupListSynced groupItem:"),e),this._fillConvGroupMap(e))}},{key:"getConvGroupListByID",value:function(e){var t,n=this;if(!qe(e))return t=[],e.forEach((function(e){n._convGroupMap.has(e)&&t.push(n._convGroupMap.get(e))})),t}},{key:"_onConvNotFound",value:function(e,t){e.push({conversationID:t,code:qn.CONV_NOT_FOUND,message:this._convM.getErrMsg(qn.CONV_NOT_FOUND)})}},{key:"_onConvIDInvalid",value:function(e,t){e.push({conversationID:t,code:qn.INVALID_CONV_ID,message:this._convM.getErrMsg(qn.INVALID_CONV_ID)})}},{key:"_getFlagBit",value:function(e){for(var t=e.toString(2),n=t.length,i=n-1;0<=i;i--)if("1"===t[i])return n-i-1}},{key:"_concatConvID",value:function(e){var t,n=e.type,i=e.to,o=e.groupID;return e=e.userID,1===n?lt(e)?lt(i)||(t="".concat(E.CONV_C2C).concat(i)):t="".concat(E.CONV_C2C).concat(e):2===n&&(t="".concat(E.CONV_GROUP).concat(o)),t}},{key:"_getMyUserID",value:function(){return this._convM.getMyUserID()}},{key:"_getLocalConv",value:function(e){return this._convM.getLocalConversation(e)}},{key:"_hasLocalConv",value:function(e){return this._convM.hasLocalConversation(e)}},{key:"_emitConvUpdate",value:function(){this._convM.emitConvUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._convM.emitOEvt(S.CONVERSATION_GROUP_LIST_UPDATED,v(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(e){var t={groupName:e,conversationList:[]},n=this._convM.getLocalConvList();t.conversationList=n.filter((function(t){return t.conversationGroupList.includes(e)})),this._convM.emitOEvt(S.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=Rn}}]),Xi=(u(Do,wn),s(Do,[{key:"_initListeners",value:function(){var e=this.getIEmitInst();e.on(Ni.A2KEY_AND_TINYID_UPDATED,this._init,this),e.on(Ni.PROFILE_UPDATED,this._onProfileUpdated,this),e.on(Ni.CLOUD_CONFIG,this._onCloudConfig,this)}},{key:"_init",value:function(){var e=this,t=(be.l("".concat(this._n,"._init")),this.get(13).getItem("conversationMap")),n=this.isIntl(),i=this.isUsingChatCore();if(t){for(var o=t.length,s=0;s<o;s++){var a=t[s];if(a){if(this._isNonExistentAccount(a.conversationID))continue;if(a.groupProfile&&Mt(a.groupProfile.type))continue}this._convMap.set(a.conversationID,new Wi(t[s],n,i))}this.emitConvUpdate(!0,!1)}this.ready((function(){0<e._tmpGroupList.length&&(e.updateConvGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConvList()}},{key:"_isNonExistentAccount",value:function(e){var t;return"@TLS#ERROR"===(t=e.startsWith(E.CONV_C2C)?e.replace(E.CONV_C2C,""):t)||"@TLS#NOT_FOUND"===t}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&this._msgListHandler.onCheckTimer(e)}},{key:"onMessageSent",value:function(e){this._onSendOrRcvMsg({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrRcvMsg(e)}},{key:"_onSendOrRcvMsg",value:function(e){var t=this,n=e.conversationOptionsList,i=void 0===(i=e.isInstantMessage)||i,o=void 0!==(o=e.isUnreadC2CMessage)&&o,s=void 0===(s=e.updateUnreadCount)||s,a=void 0!==(a=e.isSyncingEnded)&&a;this._isReady?0!==n.length?(!0===i&&this._checkNewConv(n),this._updateLocalConvList({conversationOptionsList:n,isInstantMessage:i,isUnreadC2CMessage:o,isFromGetConversations:!1,updateUnreadCount:s}),i||(this._convIDFromUnreadDBMap=new Map([].concat(v(this._convIDFromUnreadDBMap),v(n.map((function(e){return[e.conversationID,1]}))))),this._diffAndDeleteConv(),a&&this.emitIEvt(Ni.C2C_UNREAD_HANDLE_COMPLETED)),0<n.filter((function(e){return!t._isConvNeedShow(e.conversationID)})).length||this.emitConvUpdate()):a&&this.emitIEvt(Ni.C2C_UNREAD_HANDLE_COMPLETED):this.ready((function(){t._onSendOrRcvMsg(e)}))}},{key:"updateConvGroupProfile",value:function(e){var t,n=this;Ye(e)&&0===e.length||(0!==this._convMap.size?(t=!1,e.forEach((function(e){var i="".concat(E.CONV_GROUP).concat(e.groupID);n._convMap.has(i)&&(t=!0,(i=n._convMap.get(i)).groupProfile=JSON.parse(JSON.stringify(e)),i.lastMessage.lastSequence<e.nextMessageSeq&&(i.lastMessage.lastSequence=e.nextMessageSeq-1),i.subType||(i.subType=e.type))})),t&&this.emitConvUpdate(!0,!1)):this._tmpGroupList=e)}},{key:"onMessageRevoked",value:function(e,t){var n,i,o,s=this;0!==e.length&&(n=null,i=!1,o=[],e.forEach((function(e){(n=s._convMap.get(e.conversationID))&&(t&&n.reduceUnreadCount()&&(i=n.type!==E.CONV_TOPIC),n.type===E.CONV_TOPIC?o.push(e):n.isLastMessageRevoked({sequence:e.sequence,time:e.time})&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),i=!0))})),this.get(10).onMessageRevoked(o),i)&&this.emitConvUpdate(!0,!1)}},{key:"updateRevokerInfo",value:function(e){for(var t=new Set,n=0;n<e.length;n++){var i=e[n].revoker;t.add(i)}var o=v(t),s=this.get(4);return new Promise((function(t){s.getUserProfile({userIDList:o}).then((function(n){if(!Ye(n=n.data)||0===n.length)return t(e);var i,o={},s=a(n);try{for(s.s();!(i=s.n()).done;){var r=i.value,c=r.userID,u=r.nick,l=r.avatar;o[c]={nick:u,avatar:l}}}catch(d){s.e(d)}finally{s.f()}e.forEach((function(e){var t=e.revoker;o[t]&&(e.revokerInfo.nick=o[t].nick||"",e.revokerInfo.avatar=o[t].avatar||"")})),t(e)})).catch((function(){t(e)}))}))}},{key:"isLastMessageRevoked",value:function(e){var t=!1,n=e.conversationID,i=e.sequence,o=e.time,s=this._convMap.get(n);return s&&(t=s.type===E.CONV_TOPIC?this.get(10).isLastMessageRevoked({topicID:n.replace(E.CONV_GROUP,""),sequence:i}):s.isLastMessageRevoked({sequence:i,time:o})),be.l("".concat(this._n,".isLastMessageRevoked options:"),e,"ret:".concat(t)),t}},{key:"onMessageDeleted",value:function(e){var t=this;if(0!==e.length){var n=null;e.forEach((function(e){(n=t._msgListHandler.getLocalMsg(e.conversationID,e.ID))&&(n.isDeleted=!0),e!==n&&(e.isDeleted=!0)})),e=e[0].conversationID;for(var i=this._msgListHandler.getLocalMsgList(e),o={},s=i.length-1;0<=s;s--)if(!i[s].isDeleted){o=i[s];break}var a,r=this._convMap.get(e);r&&(a=!1,r.lastMessage.lastSequence===o.sequence&&r.lastMessage.lastTime===o.time||(qe(o)&&(o=void 0),r.updateLastMessage(o),r.type!==E.CONV_TOPIC&&(a=!0),be.l("".concat(this._n,".onMessageDeleted. update convID:").concat(e," with lastMessage:"),r.lastMessage)),e.startsWith(E.CONV_C2C)&&this.updateUnreadCount(e),a)&&this.emitConvUpdate(!0,!1)}}},{key:"onMessageModified",value:function(e){var t="".concat(this._n,".onMessageModified"),n=e.conversationType,i=e.from,o=e.to,s=e.time,a=e.sequence,r=e.elements,c=e.cloudCustomData,u=e.messageVersion,l=this.getMyUserID(),d="".concat(n).concat(o),p=(n=(o===l&&n===E.CONV_C2C&&(d="".concat(n).concat(i)),l=this._msgListHandler.onMsgModified(d,e)).isUpdated,l=l.message,!0===n&&this.emitOEvt(S.MESSAGE_MODIFIED,[l]),this._isTopicConv(d));return null===l?be.l("".concat(t," message is null! options:"),e):be.l("".concat(t," isUpdated:").concat(n," isTopicMessage:").concat(p," from:").concat(i," to:").concat(o," sequence:").concat(l.sequence," time:").concat(l.time)),p?this.get(10).onMessageModified(e):(n=this._convMap.get(d))&&(i=n.lastMessage)&&i.lastTime===s&&i.lastSequence===a&&i.version!==u&&(be.l("".concat(t," convID:").concat(d," lastMessage updated")),i.type=r[0].type,i.payload=r[0].content,i.messageForShow=Ft(i.type,i.payload,this.isIntl()),i.cloudCustomData=c,i.version=u,this.emitConvUpdate(!0,!1)),l}},{key:"onNewGroupAtTips",value:function(e){var t=this,n=(e=e.dataList,null);e.forEach((function(e){e.groupAtTips?n=e.groupAtTips:e.elements?n=g(g({},e.elements),{},{sync:!0}):e.groupAtType&&(n=g(g({},e),{},{sync:!0})),n.__random=e.random,n.__sequence=e.clientSequence,t._tmpGroupAtTipsList.push(n)})),be.l("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e,t=this;0!==this._tmpGroupAtTipsList.length&&(e=!1,this._tmpGroupAtTipsList.forEach((function(n){var i=n.groupID,o=n.from,s=void 0===(s=n.topicID)?void 0:s,a=void 0!==(a=n.sync)&&a;o!==t.getMyUserID()&&(lt(s)?(o=t._convMap.get("".concat(E.CONV_GROUP).concat(i)))&&(o.updateGroupAtInfoList(n),e=!0):((i=t._convMap.get("".concat(E.CONV_GROUP).concat(s)))&&(i.updateGroupAtInfoList(n),t.get(10).onAtInfoUpdated({topicID:s,groupAtInfoList:i.groupAtInfoList})),qe(i)&&a&&(t.updateTopicConversation([{conversationID:"".concat(E.CONV_GROUP).concat(s),type:E.CONV_TOPIC}]),t._convMap.get("".concat(E.CONV_GROUP).concat(s)).updateGroupAtInfoList(n))))})),e&&this.emitConvUpdate(!0,!1),this._tmpGroupAtTipsList.length=0)}},{key:"_checkNewConv",value:function(e){var t=this,n=[],i=[];e.forEach((function(e){t._convMap.has(e.conversationID)||(e.type===E.CONV_C2C?n.push(e.conversationID.replace(E.CONV_C2C,"")):e.type===E.CONV_GROUP&&i.push(e.conversationID.replace(E.CONV_GROUP,"")))})),0<n.length&&(this._onNewC2CConv(n),n=null),0<i.length&&(this._onNewGroupConv(i),i=null)}},{key:"_onNewC2CConv",value:function(e){var t=this.get(6);return Promise.all([t.getRemotePeerReadTime(e),this._msgRemindHandler.getC2CMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,1)])}},{key:"_onNewGroupConv",value:function(e){var t=this.get(7);return t?Promise.all([t.getMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,2)]):Promise.resolve()}},{key:"_setStorageConvList",value:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=this.getLocalConvList().filter((function(e){return e.type===E.CONV_C2C||e.type===E.CONV_GROUP&&e.lastMessage.type!==E.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.get(13).setItem("conversationMap",t,e)}},{key:"emitConvUpdate",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.getLocalConvList();t&&(t=this.get(7))&&t.updateGroupLastMessage(n),e&&(this.get(12).isPartialUpdatedConvs()?(this._diffConvMap(this._convMapForDiff,this._convMap),0<this._partialUpdatedConvMap.size&&(this.emitOEvt(S.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate(),this._convMapForDiff.clear(),this._convMapForDiff=et(this._convMap,!0)),0===this._convMapForDiff.size&&(this._convMapForDiff=et(this._convMap,!0))):(this.emitOEvt(S.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate()))}},{key:"_diffConvMap",value:function(e,t){var n,i=a(t);try{for(i.s();!(n=i.n()).done;){var o=_(n.value,2),s=o[0],r=o[1];e.has(s)&&JSON.stringify(r)===e.get(s)||this._partialUpdatedConvMap.set(s,r)}}catch(c){i.e(c)}finally{i.f()}}},{key:"getPartialUpdatedConvs",value:function(){var e=v(et(this._partialUpdatedConvMap,!1).values());return this._partialUpdatedConvMap.clear(),e}},{key:"getLocalConvList",value:function(){var e=this;return v(this._convMap.values()).filter((function(t){return e._isConvNeedShow(t.conversationID)}))}},{key:"getLocalConversation",value:function(e){return this._convMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._convMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._msgListHandler.getLocalOldestMsg(e)}},{key:"syncConvList",value:function(){var e=this,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],n="syncConvList",i=new oi(n);return this._pagingStatus===Rn&&this._convMap.clear(),this._pagingGetConvList(t).then((function(t){var o=Kt(e._pagingGetCostList),s=Ht(e._pagingGetCostList);return e._pagingGetCostList.length=0,e._pagingStatus=bn,e._diffAndDeleteConv(),e.emitConvUpdate(!0,!1),e._setStorageConvList(),e._handleC2CPeerReadTime(),e.emitIEvt(Ni.CONV_SYNC_COMPLETED),s="count:".concat(e._convMap.size," sum:").concat(s," avg:").concat(o),be.l("".concat(e._n,".").concat(n,". ").concat(s)),i.setMessage(s).end(),t})).catch((function(t){return e._pagingStatus=An,i.setMessage(e._pagingTs).setError(t).end(),En(t)}))}},{key:"_diffAndDeleteConv",value:function(){var e,t=this;this._isSyncCompleted()&&(e=[],this._convMap.forEach((function(n,i){!t._pagingConvIDMap.has(i)&&t._convIDFromUnreadDBMap.has(i)&&(t._convMap.delete(i),e.push(i))})),be.l("".concat(this._n,"._diffAndDeleteConv list:").concat(e)),e=null)}},{key:"_pagingGetConvList",value:function(){var e=this,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],n="".concat(this._n,"._pagingGetConvList"),i=(be.l("".concat(n," incrementalPullFlag:").concat(t," ts:").concat(this._pagingTs," startIdx:").concat(this._pagingStartIdx)+" pinnedTs:".concat(this._pagingPinnedTs," pinnedStartIdx:").concat(this._pagingPinnedStartIdx)),Date.now());return this._pagingStatus=On,this.req({P:jn.PAGING_GET_CONV_LIST,data:{fromAccount:this.getMyUserID(),timeStamp:t?this._pagingTs:0,startIndex:t?this._pagingStartIdx:0,pinnedTimeStamp:t?this._pagingPinnedTs:0,pinnedStartIndex:t?this._pagingPinnedStartIdx:0,orderType:1}}).then((function(t){var o=(t=t.data).completeFlag,s=void 0===(s=t.conversations)?[]:s,a=t.timeStamp,r=t.startIndex,c=t.pinnedTimeStamp,u=t.pinnedStartIndex;if(t=t.groupItem,e._pagingGetCostList.push(zt(i,!1)),be.l("".concat(n," ok. completeFlag:").concat(o," count:").concat(s.length," cost:").concat(zt(i))),e._convGroupHandler.onConvGroupListSynced(t),0<s.length&&(t=e._getConvOptions(s),e._pagingConvIDMap=new Map([].concat(v(e._pagingConvIDMap),v(t.map((function(e){return[e.conversationID,1]}))))),e._updateLocalConvList({conversationOptionsList:t,isFromGetConversations:!0,updateUnreadCount:!0}),e.isLoggedIn())&&e.emitConvUpdate(),!e._isReady){if(!e.isLoggedIn())return Sn();e.triggerReady()}return e._pagingTs=a,e._pagingStartIdx=r,e._pagingPinnedTs=c,e._pagingPinnedStartIdx=u,1!==o?e._pagingGetConvList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),Sn())})).catch((function(t){throw!e.isLoggedIn()||e._isReady||(be.w("".concat(n," failed. error:"),t),e.triggerReady()),t}))}},{key:"_updateLocalConvList",value:function(e){var t=e.isFromGetConversations,n=Date.now();e=this._getTmpConvListMapping(e).newConvList,this._convMap=new Map(this._sortConvList(v(this._convMap))),t||this._updateUserOrGroupProfile(e),be.l("".concat(this._n,"._updateLocalConvList cost:").concat(zt(n)))}},{key:"_getTmpConvListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,i=e.isInstantMessage,o=e.isUnreadC2CMessage,s=void 0!==o&&o,a=e.updateUnreadCount,r=[],c=[],u=this.get(7),l=this.get(8),d=this.isIntl(),p=this.isUsingChatCore(),h=0,g=t.length;h<g;h++){var f=new Wi(t[h],d,p),m=f.conversationID,_=f.type;if(!this._isNonExistentAccount(m)){if(this._convMap.has(m)){var v=this._convMap.get(m);if(n&&_!==E.CONV_TOPIC){this._convMap.set(m,f),_===E.CONV_C2C?f.unreadCount=v.unreadCount:_===E.CONV_GROUP&&(f.groupProfile=JSON.parse(JSON.stringify(v.groupProfile)));continue}var y=["unreadCount","allowType","adminForbidType","payload"],I=(!1===i&&y.push("lastMessage"),"boolean"==typeof i&&y.push("isPinned"),t[h].lastMessage),M=!lt(I);M||t[h].type===E.CONV_TOPIC||this._onLastMsgNotExist(t[h]),lt(i)&&M&&null===v.lastMessage.payload&&(v.lastMessage.payload=I.payload),qe(v.lastMessage.revoker)||(v.lastMessage.revoker=null),Ze(v,f,y,[null,void 0,"",0,NaN]),!0===a&&v.updateUnreadCount({nextUnreadCount:f.unreadCount,isFromGetConversations:n,isUnreadC2CMessage:s}),i&&M&&(I.payload&&(v.lastMessage.payload=I.payload),v.type===E.CONV_GROUP)&&(v.lastMessage.nameCard=I.nameCard,v.lastMessage.nick=I.nick),M&&v.lastMessage.cloudCustomData!==I.cloudCustomData&&(v.lastMessage.cloudCustomData=I.cloudCustomData||"")}else _===E.CONV_GROUP&&u?(y=f.groupProfile.groupID,(M=u.getLocalGroupProfile(y))&&(f.groupProfile=M,!0===a)&&f.updateUnreadCount({nextUnreadCount:0})):_===E.CONV_C2C&&(v=m.replace(E.CONV_C2C,""),l)&&l.isMyFriend(v)&&(f.remark=l.getFriendRemark(v)),r.push(f),this._convMap.set(m,f);this._convMap.get(m).type===E.CONV_TOPIC&&c.push(this._convMap.get(m))}}for(var C=this.get(10),S=0,T=c.length;S<T;S++){var k,D=(k=c[S]).conversationID;qe(k=k.groupAtInfoList)||C.onAtInfoUpdated({topicID:D.replace(E.CONV_GROUP,""),groupAtInfoList:k})}return{newConvList:r}}},{key:"_onLastMsgNotExist",value:function(e){new oi("lastMsgNotExist").setMessage(JSON.stringify(e)).end()}},{key:"_sortConvList",value:function(e){var t=[],n=[],i=[],o=[];return e.forEach((function(e){(!0===e[1].isPinned?qe(e[1].lastMessage.lastTime)?n:t:qe(e[1].lastMessage.lastTime)?o:i).push(e)})),t.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})).concat(n).concat(i.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime}))).concat(o)}},{key:"_sortConvListAndEmitEvent",value:function(){this._convMap=new Map(this._sortConvList(v(this._convMap))),this.emitConvUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var t,n,i,o,s=this;0!==e.length&&(t=[],n=[],i=this.get(4),o=this.get(7),e.forEach((function(e){var i;e.type===E.CONV_C2C?t.push(e.toAccount):e.type===E.CONV_GROUP&&(i=e.toAccount,o.hasLocalGroup(i)?e.groupProfile=o.getLocalGroupProfile(i):n.push(i))})),be.l("".concat(this._n,"._updateUserOrGroupProfile userIDList:").concat(t," groupIDList:").concat(n)),0<t.length&&i.getUserProfile({userIDList:t}).then((function(e){Ye(e=e.data)?e.forEach((function(e){s._doUpdateUserProfile("".concat(E.CONV_C2C).concat(e.userID),e)})):s._doUpdateUserProfile("".concat(E.CONV_C2C).concat(e.userID),e)})),0<n.length)&&o.getGroupProfileAdvance({groupIDList:n,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e=e.data.successGroupList;var t=!1;e.forEach((function(e){var n="".concat(E.CONV_GROUP).concat(e.groupID);s._convMap.has(n)&&(Ze((n=s._convMap.get(n)).groupProfile,e,[],[null,void 0,"",0,NaN]),!n.subType&&e.type&&(n.subType=e.type),t=!0)})),t&&s.emitConvUpdate()}))}},{key:"_doUpdateUserProfile",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t,this.emitConvUpdate())}},{key:"_getConvOptions",value:function(e){var t=this,n=[],i=(e=e.filter((function(e){var n=e.type;return e=e.userID,1===n&&!t._isNonExistentAccount(e)||2===n})),this.getMyUserID());return e=e.map((function(e){var o;return lt(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type?(o={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar},n.push(o),{conversationID:"".concat(E.CONV_C2C).concat(e.userID),type:E.CONV_C2C,lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?t._amendLayersOverLimitProp(e.lastMsg.elements[0].content,e.lastMsg.elements[0].type):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===i&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},unreadCount:0,userProfile:new ji(o),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,customData:e.customMark||"",markList:qt(e.standardMark),conversationGroupList:t._convGroupHandler.getConvGroupListByID(e.contactGroupId),remark:e.friendRemark||"",messageRemindType:t._transMsgRemindType(e.messageRemindType)}):{conversationID:"".concat(E.CONV_GROUP).concat(e.groupID),type:E.CONV_GROUP,lastMessage:g(g({lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount},t._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new zi({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage,type:e.groupType,nextMessageSeq:e.nextMessageSeq}),unreadCount:t._computeGroupUnreadCount(e),peerReadTime:0,isPinned:1===e.isPinned,version:0,customData:e.customMark||"",markList:qt(e.standardMark),conversationGroupList:t._convGroupHandler.getConvGroupListByID(e.contactGroupId),messageRemindType:t._transMsgRemindType(e.messageRemindType)}})),0<n.length&&this.get(4).onConvProfileUpdated(n),e}},{key:"_transMsgRemindType",value:function(e){var t="";return 0===e?t=E.MSG_REMIND_ACPT_AND_NOTE:1===e?t=E.MSG_REMIND_DISCARD:2===e?t=E.MSG_REMIND_ACPT_NOT_NOTE:3===e&&(t=E.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),t}},{key:"_computeGroupUnreadCount",value:function(e){var t;return 0<(t=(void 0===(t=e.unreadCount)?0:t)-(void 0===(e=e.noUnreadCount)?0:e))?t:0}},{key:"_patchTypeAndPayload",value:function(e){var t=(e=e.lastMsg).event,n=void 0===(n=e.elements)?[]:n;return e=void 0===(e=e.groupTips)?{}:e,lt(void 0===t?void 0:t)||qe(e)?{type:n[0]?n[0].type:null,payload:n[0]?this._amendLayersOverLimitProp(n[0].content,n[0].type):null}:((t=new ki(e)).setElement({type:E.MSG_GRP_TIP,content:g(g({},e.elements),{},{groupProfile:e.groupProfile})}),n=JSON.parse(JSON.stringify(t.payload)),t=null,{type:E.MSG_GRP_TIP,payload:n})}},{key:"_amendLayersOverLimitProp",value:function(e,t){var n=this.getFileDownloadProxy(),i=this.getDownloadFileAuthKey(),o=this.get(17).getFileDNList(),s=e.layersOverLimit,a=null;return t===E.MSG_IMAGE&&(a=new pi(e,n,i,o)),t===E.MSG_VIDEO&&(a=new Mi(e,n,i,o)),t===E.MSG_SOUND&&(a=new gi(e,n,i,o)),t===E.MSG_FILE&&((a=new yi(e,n,i,o)).content.url=void 0),0===s?e.layersOverLimit=!1:1===s&&(e.layersOverLimit=!0),a&&Object.assign(e,a.content),e}},{key:"getLocalMessageList",value:function(e){return this._msgListHandler.getLocalMsgList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof ki&&this._msgListHandler.remove(e)}},{key:"onConvDeleted",value:function(e){Ye(e)&&(e=e.map((function(e){var t=e.type,n=e.userID;return e=e.groupID,1===t?"".concat(E.CONV_C2C).concat(n):2===t?"".concat(E.CONV_GROUP).concat(e):void 0})),be.l("".concat(this._n,".onConvDeleted convIDList:").concat(e)),this.deleteLocalConvList(e))}},{key:"onConvPinnedStatus",value:function(e,t){var n,i=this;Ye(e)&&(n=!1,e.forEach((function(e){var o,s=e.type,a=e.userID;e=e.groupID,1===s?o=i.getLocalConversation("".concat(E.CONV_C2C).concat(a)):2===s&&(o=i.getLocalConversation("".concat(E.CONV_GROUP).concat(e))),o&&(be.l("".concat(i._n,".onConvPinnedStatus convID:").concat(o.conversationID," localPinned:").concat(o.isPinned," remotePinned:").concat(t)),t?o.isPinned||(o.isPinned=!0,n=!0):o.isPinned&&(o.isPinned=!1,n=!0))})),n)&&this._sortConvListAndEmitEvent()}},{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,i=e.nextReqMessageID,o=(e=e.count,"".concat(this._n,".getMessageList")),s="";if((r=this.getLocalConversation(n))&&r.groupProfile&&(s=r.groupProfile.type),Mt(s))return be.l("".concat(o," not available in ").concat(s,". convID:").concat(n)),Sn({messageList:[],nextReqMessageID:"",isCompleted:!0});(lt(e)||15<e)&&(e=15),i||this._isMeInCommunity(n)||this.clearMemMsg(n);var a=this._computeRemainingCount({conversationID:n,nextReqMessageID:i}),r=this._completedMap.has(n);return be.l("".concat(o," convID:").concat(n," isEverCleared:").concat(this._isEverCleared(n)," nextReqMessageID:").concat(i)+" remainingCount:".concat(a," count:").concat(e," isCompleted:").concat(r)),this._needGetHistory({conversationID:n,remainingCount:a,count:e})?this.getHistoryMessages({conversationID:n,nextReqMessageID:i,count:20}).then((function(e){var i=e.nextReqID,s=e.storedMessageList,r=e.assembledMessageList,c=(e=e.isPullingCompleted,t._completedMap.has(n)),u=s,l=(0<a&&(u=t._msgListHandler.getLocalMsgList(n).slice(0,s.length+a)),{nextReqMessageID:void 0,messageList:void 0,isCompleted:void 0});return t._isEverCleared(n)?(l.nextReqMessageID=i,l.messageList=r,l.isCompleted=e):(l.nextReqMessageID=c?"":i,l.messageList=u,l.isCompleted=c),s=l.messageList.filter((function(e){return e.isRevoked}))||[],r=l.messageList.map((function(e){return e.sequence})),be.l("".concat(o," ret.nextReqMessageID:").concat(l.nextReqMessageID," ret.isCompleted:").concat(l.isCompleted," sequenceList:"),r),Ye(s)&&0!==s.length?t.updateRevokerInfo(s).then((function(e){return e.forEach((function(e){var t=e.revokerInfo;l.messageList=l.messageList.map((function(n){return n.ID===e.ID&&t&&(n.revokeReason=t.reason||"",n.revokerInfo={userID:t.revoker||n.revoker,nick:t.nick,avatar:t.avatar}),n}))})),Cn(l)})):Cn(l)})):(this.modifyMessageList(n),Sn(s=this._getMsgListFromMem({conversationID:n,nextReqMessageID:i,count:e})))}},{key:"_isEverCleared",value:function(e){return this._everClearedMap.has(e)}},{key:"_getMsgListFromMem",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,i=(e=e.count,"".concat(this._n,"._getMsgListFromMem")),o=this._msgListHandler.getLocalMsgList(t),s=o.length,a=Et(t),r=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]};return n?(r=a?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence+""===n})))>e?(c.messageList=o.slice(r-e,r),c.nextReqMessageID=a?o[r-e].ID:o[r-e].sequence+""):(c.messageList=o.slice(0,r),c.isCompleted=!0):e<s?(c.messageList=o.slice(r=s-e,s),c.nextReqMessageID=a?o[r].ID:o[r].sequence+""):(c.messageList=o.slice(0,s),c.isCompleted=!0),e=c.messageList.map((function(e){return e.sequence})),be.l("".concat(i," convID:").concat(t)+" ret.nextReqMessageID:".concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," sequenceList:").concat(e)),c}},{key:"getMessageListHopping",value:function(e){var t,n,i=e.conversationID,o=e.sequence,s=e.time,a=e.count;return e=void 0===(e=e.direction)?0:e,(lt(a)||15<a)&&(a=15),i.startsWith(E.CONV_C2C)?(t=this.get(6),n=i.replace(E.CONV_C2C,""),t.getRoamingMessagesHopping({peerAccount:n,time:s,count:a,direction:e})):i.startsWith(E.CONV_GROUP)?(t=this.get(7),n=i.replace(E.CONV_GROUP,""),t.getRoamingMessagesHopping({groupID:n,sequence:o,count:a,direction:e})):void 0}},{key:"_computeRemainingCount",value:function(e){var t,n=e.conversationID,i=e.nextReqMessageID,o=(e=this._msgListHandler.getLocalMsgList(n)).length;return be.l("".concat(this._n,"._computeRemainingCount convID:").concat(n," nextReqMessageID:").concat(i," length:").concat(o)),i?(t=0,Et(n)?t=e.findIndex((function(e){return e.ID===i})):Tt(n)&&(t=-1!==i.indexOf("-")?e.findIndex((function(e){return e.ID===i})):e.findIndex((function(e){return e.sequence+""===i}))),-1===t?0:t):o}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,i=(e=e.count,this.getLocalConversation(t)),o="";return i&&i.groupProfile&&(o=i.groupProfile.type),!(kt(t)||Mt(o)||!this._isEverCleared(t)&&(i=n<=e&&!this._completedMap.has(t),be.l("".concat(this._n,"._needGetHistory convID:").concat(t," ret:").concat(i)),!i))}},{key:"_isTopicConv",value:function(e){return St(e=e.replace(E.CONV_GROUP,""))}},{key:"getHistoryMessages",value:function(e){var t,n,i,o,s,a,r=e.conversationID,c=e.count;return e=e.nextReqMessageID,r===E.CONV_SYSTEM?Sn():(c=20<c?20:15,t=null,Et(r)?(a=0,n="",i=!1,s=this._roamingMsgKeyAndTimeMap.has(r),e&&(i=!0,s?(a=this._roamingMsgKeyAndTimeMap.get(r).lastMessageTime,n=this._roamingMsgKeyAndTimeMap.get(r).messageKey):(o=this._msgListHandler.findMessage(e))&&(a=o.time,be.l("".concat(this._n,".getHistoryMessages convID:").concat(r," isRelayInfoExisted:").concat(s," lastMessageTime:").concat(a)))),(t=this.get(6)).getRoamingMessage({conversationID:r,peerAccount:r.replace(E.CONV_C2C,""),count:c,lastMessageTime:i?a:0,messageKey:i?n:""})):Tt(r)?(t=this.get(7))?(o=r.replace(E.CONV_GROUP,""),s=null,this._convMap.has(r)&&!St(o)&&(s=this._convMap.get(r).lastMessage),a=0,e?a=Number(e):s&&(a=s.lastSequence),t.getRoamingMessage({conversationID:r,groupID:o,count:c,sequence:a})):En({code:qn.NO_MODULE}):Sn())}},{key:"patchConvLastMessage",value:function(e){var t,n,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=this.getLocalConversation(e);o&&(t=(n=o.lastMessage).messageForShow,n=n.payload,qe(t)||qe(n)||i)&&0!==(t=this._msgListHandler.getLocalMsgList(e)).length&&(n=t[t.length-1],be.l("".concat(this._n,".patchConvLastMessage bForceUpdate:").concat(i," convID:").concat(e," payload:"),n.payload),o.updateLastMessage(n))}},{key:"onRoamingMessage",value:function(){var e,t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],o=3<arguments.length?arguments[3]:void 0,s=(c=1<arguments.length?arguments[1]:void 0).startsWith(E.CONV_C2C)?E.CONV_C2C:E.CONV_GROUP,a=null,r=[],c=[],u=0,l=n.length,d=s===E.CONV_GROUP,p=this.getFileDownloadProxy(),h=this.getDownloadFileAuthKey(),f=Ye(o),m=this.get(17).getFileDNList(),_=function(){d?--u:++u},v=function(){return d?l<=u:u<l};for(u=d?n.length-1:0,l=d?0:n.length;v();_())1!==n[u].isPlaceMessage&&((a=new ki(n[u])).to=n[u].to,s!==E.CONV_GROUP||lt(n[u].topicID)||(a.to=n[u].topicID),a.isSystemMessage=!!n[u].isSystemMessage,a.conversationType=s,e=4===n[u].event?{type:E.MSG_GRP_TIP,content:g(g({},n[u].elements),{},{groupProfile:n[u].groupProfile})}:n[u].elements,d||a.setNickAndAvatar({nick:n[u].nick,avatar:n[u].avatar}),qe(e)?((t=new oi("emptyMessageBody")).setMessage("from:".concat(a.from," to:").concat(a.to," sequence:").concat(a.sequence," event:").concat(n[u].event)),t.setLevel("warning").end()):(a.setElement(e,p,h,m),a.reInitialize(this.getMyUserID()),r.push(a),f&&o.push(a)));return _=v=null,i?(this._msgListHandler.unshift(r,c),r=null,c):r}},{key:"findMessage",value:function(e){return this._msgListHandler.findMessage(e)}},{key:"_isMeInCommunity",value:function(e){var t=!0;return this._isTopicConv(e)&&(e=xt(e.replace(E.CONV_GROUP,"")),this.get(7).hasLocalGroup(e)||(t=!1,be.l("".concat(this._n,"._isMeInCommunity groupID:").concat(e," ret:").concat(t)))),t}},{key:"deleteTopicRoamingInfo",value:function(e){var t=this;Ct({groupID:e})&&this._msgListHandler.getTopicConvIDList(e).forEach((function(e){t.clearMemMsg(e)}))}},{key:"deleteGroupRoamingInfo",value:function(e){e="".concat(E.CONV_GROUP).concat(e),0<this._msgListHandler.getLocalMsgList(e).length&&this.clearMemMsg(e)}},{key:"setMessageRead",value:function(e){var t=e.conversationID,n=this.getLocalConversation(t);if(e="".concat(this._n,".setMessageRead"),be.l("".concat(e," convID:").concat(t," unreadCount:").concat(n?n.unreadCount:0)),!n)return Sn();if(n.type!==E.CONV_GROUP&&n.type!==E.CONV_TOPIC||qe(n.groupAtInfoList)||this.deleteGroupAtTips(t),0===n.unreadCount)return Sn();var i=this._msgListHandler.getLocalLastMsg(t),o=n.lastMessage.lastTime,s=(o<(s=this._msgListHandler.getLocalMaxTime(t))&&(be.l("".concat(e," update lastMessageTime from ").concat(o," to ").concat(s)),o=s),this._msgListHandler.getLocalMaxSeq(t)),a=n.lastMessage.lastSequence,r=(a<s&&(be.l("".concat(e," update lastMessageSeq from ").concat(a," to ").concat(s)),a=s),n.type===E.CONV_TOPIC&&lt(i)&&(e=this.get(10),i=xt(s=t.replace(E.CONV_GROUP,"")),e=e.getLocalTopic(i,s))&&(a=e.nextMessageSeq-1),null);switch(n.type){case E.CONV_C2C:return(r=this.get(6))?r.setMessageRead({conversationID:t,lastMessageTime:o}):En({code:qn.NO_MODULE});case E.CONV_GROUP:case E.CONV_TOPIC:return(r=this.get(7))?r.setMessageRead({conversationID:t,lastMessageSeq:a}):En({code:qn.NO_MODULE});case E.CONV_SYSTEM:return n.unreadCount=0,this.emitConvUpdate(!0,!1),Sn();default:return Sn()}}},{key:"setAllMessageRead",value:function(){var e,t=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i="setAllMessageRead",o="".concat(this._n,".").concat(i),s=(n.scope||(n.scope=E.READ_ALL_MSG),be.l("".concat(o," options:"),n),this._createSetAllMessageReadPack(n));return 0===s.readAllC2CMessage&&0===s.groupMessageReadInfoList.length?Sn():(e=new oi(i),this.req({P:jn.SET_ALL_MSG_READ,data:s}).then((function(i){return i=i.data,i=t._handleAllMsgRead(i),e.setMessage("scope:".concat(n.scope," failureGroups:").concat(JSON.stringify(i))).end(),Sn()})).catch((function(t){return e.setError(t).end(),be.w("".concat(o," failed. error:"),t),En({code:t&&t.code?t.code:qn.MSG_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})})))}},{key:"setConvCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConv",value:function(e){return this._convGroupHandler.markConv(e)}},{key:"getConvGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConvGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConvGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConvGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConvsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConvsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConvMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConvGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConvGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConvGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConvInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConvAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConvLastMessageSeq",value:function(e){var t=this._msgListHandler.getLocalLastMsg(e.conversationID);return e=e.lastMessage.lastSequence,t&&e<t.sequence?t.sequence:e}},{key:"_getConvLastMessageTime",value:function(e){var t=this._msgListHandler.getLocalLastMsg(e.conversationID);return e=e.lastMessage.lastTime,t&&e<t.time?t.time:e}},{key:"_createSetAllMessageReadPack",value:function(e){var t,n={readAllC2CMessage:0,groupMessageReadInfoList:[]},i=e.scope,o=a(this._convMap);try{for(o.s();!(t=o.n()).done;){var s,r=_(t.value,2)[1];if(0<r.unreadCount)if(r.type===E.CONV_C2C&&0===n.readAllC2CMessage){if(i===E.READ_ALL_MSG)n.readAllC2CMessage=1;else if(i===E.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else r.type!==E.CONV_GROUP||i!==E.READ_ALL_GROUP_MSG&&i!==E.READ_ALL_MSG||(s=this._getConvLastMessageSeq(r),n.groupMessageReadInfoList.push({groupID:r.groupProfile.groupID,messageSequence:s}))}}catch(c){o.e(c)}finally{o.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMsgRead(e)}},{key:"_handleAllMsgRead",value:function(e){var t=e.groupMessageReadInfoList;return e=e.readAllC2CMessage,t=this._parseGroupReadInfo(t),1<=this._updateAllConvUnreadCount({readAllC2CMessage:e})&&this.emitConvUpdate(!0,!1),t}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,i=e.length;n<i;n++){var o=(r=e[n]).groupID,s=r.sequence,a=r.retCode,r=r.lastMessageSeq;lt(a)?this._remoteGroupReadSeqMap.set(o,r):(this._remoteGroupReadSeqMap.set(o,s),0!==a&&t.push("".concat(o,"-").concat(s,"-").concat(a)))}return t}},{key:"_updateAllConvUnreadCount",value:function(e){var t,n=e.readAllC2CMessage,i=0,o=a(this._convMap);try{for(o.s();!(t=o.n()).done;){var s,r,c,u,l=_(t.value,2),d=l[0],p=l[1];1<=p.unreadCount&&(1===n&&p.type===E.CONV_C2C?(s=this._getConvLastMessageTime(p),this.updateIsReadAfterReadReport({conversationID:d,lastMessageTime:s})):p.type===E.CONV_GROUP&&(r=d.replace(E.CONV_GROUP,""),this._remoteGroupReadSeqMap.has(r))&&(c=this._remoteGroupReadSeqMap.get(r),u=this._getConvLastMessageSeq(p),this.updateIsReadAfterReadReport({conversationID:d,remoteReadSequence:c}),c<=u)&&this._remoteGroupReadSeqMap.delete(r),this.updateUnreadCount(d,!1))&&(i+=1)}}catch(h){o.e(h)}finally{o.f()}return i}},{key:"isRemoteRead",value:function(e){var t,n=e.conversationID,i=(e=e.sequence,n.replace(E.CONV_GROUP,"")),o=!1;return this._remoteGroupReadSeqMap.has(i)&&(e<=(t=this._remoteGroupReadSeqMap.get(i))&&(o=!0,be.l("".concat(this._n,".isRemoteRead convID:").concat(n," msgSeq:").concat(e," remoteReadSeq:").concat(t))),t+10<=e)&&this._remoteGroupReadSeqMap.delete(i),o}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,i=e.lastMessageTime,o=this._msgListHandler.getLocalMsgList(t);if(0!==o.length)for(var s,a=o.length-1;0<=a;a--)if(s=o[a],!(i&&s.time>i||n&&s.sequence>n)){if("in"===s.flow&&s.isRead)break;s.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=!1,o=this.getLocalConversation(e),s=this._msgListHandler.getLocalMsgList(e);if(o)return(t=o.unreadCount)!==(s=s.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length)&&(o.unreadCount=s,i=!0,be.l("".concat(this._n,".updateUnreadCount from ").concat(t," to ").concat(s,", convID:").concat(e)),!0===n)&&this.emitConvUpdate(!0,!1),i&&o.type===E.CONV_TOPIC&&(t=o.unreadCount,s=this.get(10),n=e.replace(E.CONV_GROUP,""),s.onUnreadCountUpdatedFromConv(n,t)),i}},{key:"clearGroupAtInfoList",value:function(e){var t,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=this.getLocalConversation(e);i&&0<i.groupAtInfoList.length&&(i.clearGroupAtInfoList(),be.l("".concat(this._n,".clearGroupAtInfoList convID:").concat(e)),i.type===E.CONV_TOPIC&&(i=i.groupAtInfoList,t=this.get(10),e=e.replace(E.CONV_GROUP,""),t.onAtInfoUpdated({topicID:e,groupAtInfoList:i})),!0===n)&&this.emitConvUpdate(!0,!1)}},{key:"updateReadReceiptInfo",value:function(e){var t,n,i,o=this,s=void 0===(r=e.userID)?void 0:r,a=void 0===(r=e.groupID)?void 0:r,r=e.readReceiptList,c=void 0===(e=e.timestamp)?0:e;qe(r)||(t=[],lt(s)?lt(a)||(n="".concat(E.CONV_GROUP).concat(a),r.forEach((function(e){var i=e.tinyID,s=e.clientTime,r=e.random,c=e.readCount;e=e.unreadCount,i="".concat(i,"-").concat(s,"-").concat(r),s=o._msgListHandler.getLocalMsg(n,i)||o._msgListHandler.getHoppingMsg(n,i),r={groupID:a,messageID:i,readCount:0,unreadCount:0},s&&(Ke(c)&&(s.readReceiptInfo.readCount=c,r.readCount=c),Ke(e)&&(s.readReceiptInfo.unreadCount=e,r.unreadCount=e),t.push(r))}))):(i="".concat(E.CONV_C2C).concat(s),r.forEach((function(e){var n=e.tinyID,a=e.clientTime;e=e.random,n="".concat(n,"-").concat(a,"-").concat(e),(a=o._msgListHandler.getLocalMsg(i,n)||o._msgListHandler.getHoppingMsg(i,n))&&!a.readReceiptInfo.isPeerRead&&(a.readReceiptInfo.isPeerRead=!0,a.readReceiptInfo.timestamp=c,t.push({userID:s,messageID:n,isPeerRead:!0,timestamp:c}))}))),0<t.length&&this.emitOEvt(S.MESSAGE_READ_RECEIPT_RECEIVED,t))}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!kt(t.type)){for(var i=[],o=0,s=n.length;o<s;o++)"in"!==n[o].flow?"out"!==n[o].flow||n[o].isRead||n[o].setIsRead(!0):i.push(n[o]);var a=0;a=t.type===E.CONV_C2C?(e=i.slice(-t.unreadCount).filter((function(e){return e.isRevoked})).length,i.length-t.unreadCount-e):i.length-t.unreadCount;for(var r=0;r<a&&!i[r].isRead;r++)i[r].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var t,n,i,o=this,s="".concat(this._n,".deleteGroupAtTips"),a=(be.l("".concat(s)),this._convMap.get(e));return a&&0!==(t=a.groupAtInfoList).length?(a=void 0,e.startsWith(E.CONV_GROUP)&&(a=e.replace(E.CONV_GROUP,"")),n=v(t),(Ct({groupID:a})||St(a))&&0===(n=t.filter((function(e){return!e.atTypeArray.includes(E.CONV_AT_ALL)}))).length?(this.clearGroupAtInfoList(e,!1),Promise.resolve()):(i=this.getMyUserID(),this.req({P:jn.DEL_GROUP_AT_TIPS,data:{messageListToDelete:n.map((function(e){return{from:e.from,to:i,messageSeq:e.__sequence,messageRandom:e.__random,groupID:lt(e.topicID)?e.groupID:e.topicID}}))}}).then((function(){return be.l("".concat(s," ok. count:").concat(t.length)),o.clearGroupAtInfoList(e,!1),Promise.resolve()})).catch((function(e){return be.e("".concat(s," failed. error:"),e),En(e)})))):Promise.resolve()}},{key:"appendToMessageList",value:function(e){return this._msgListHandler.pushIn(e)}},{key:"setMessageRandom",value:function(e){this._sll.set(e.random)}},{key:"deleteMessageRandom",value:function(e){this._sll.delete(e.random)}},{key:"pushIntoMessageList",value:function(e,t,n){return!(!this._msgListHandler.pushIn(t,n)||this._sll.has(t.random)&&!n||(e.push(t),0))}},{key:"revoke",value:function(e,t,n){return this._msgListHandler.revoke(e,t,n)}},{key:"getPeerReadTime",value:function(e){return this._peerReadTimeMap.get(e)}},{key:"recordPeerReadTime",value:function(e,t){(!this._peerReadTimeMap.has(e)||this._peerReadTimeMap.get(e)<t)&&this._peerReadTimeMap.set(e,t)}},{key:"updateMsgIsPeerReadProp",value:function(e,t){var n;e.startsWith(E.CONV_C2C)&&0<t&&(0<(n=this._msgListHandler.updateMsgIsPeerReadProp(e,t)).length&&this.emitOEvt(S.MESSAGE_READ_BY_PEER,n),this._convMap.has(e))&&!qe(n=this._convMap.get(e).lastMessage)&&n.fromAccount===this.getMyUserID()&&n.lastTime<=t&&!n.isPeerRead&&(n.isPeerRead=!0,this.emitConvUpdate(!0,!1))}},{key:"updateMsgIsModifiedProp",value:function(e){this._msgListHandler.updateMsgIsModifiedProp(e)}},{key:"setCompleted",value:function(e){be.l("".concat(this._n,".setCompleted convID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMsgKeyAndTime",value:function(e,t,n){this._roamingMsgKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"getConvList",value:function(e){var t,n=this,i="".concat(this._n,".").concat("getConvList"),o="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._convMap.size,", options:").concat(JSON.stringify(e));return be.l("".concat(i,". ").concat(o)),this._pagingStatus===An?((t=new oi("getConvList")).setMessage(o),this.syncConvList().then((function(){return t.end(),Cn({conversationList:n._getConvList(e),isSyncCompleted:n._isSyncCompleted()})})).catch((function(e){return t.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)}))):(o=this._getConvList(e),be.l("".concat(i,". returned conversation count:").concat(o.length)),Sn({conversationList:o,isSyncCompleted:this._isSyncCompleted()}))}},{key:"_getConvList",value:function(e){var t,n,i,o,s,a=this;return lt(e)?this.getLocalConvList():Ye(e)?0===e.length?[]:this.getLocalConvList().filter((function(t){return e.includes(t.conversationID)})):We(e)?(t=e.type,n=e.markType,i=e.groupName,o=e.hasUnreadCount,s=e.hasGroupAtInfo,this.getLocalConvList().filter((function(e){return a._filterType(e,t)&&a._filterMarkType(e,n)&&a._filterGroupName(e,i)&&a._filterUnreadCount(e,o)&&a._filterGroupAtInfo(e,s)}))):[]}},{key:"_filterType",value:function(e,t){return t!==E.CONV_C2C&&t!==E.CONV_GROUP||e.type===t}},{key:"_filterGroupName",value:function(e,t){return!ut(t)||(""===t?0===e.conversationGroupList.length:e.conversationGroupList.includes(t))}},{key:"_filterMarkType",value:function(e,t){return!Ke(t)||(0===t?0===e.markList.length:e.markList.includes(t))}},{key:"_filterUnreadCount",value:function(e,t){var n=!0;return!0===t?n=1<=e.unreadCount:!1===t&&(n=0===e.unreadCount),n}},{key:"_filterGroupAtInfo",value:function(e,t){var n=!0;return!0===t?n=1<=e.groupAtInfoList.length:!1===t&&(n=0===e.groupAtInfoList.length),n}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=a(this._convMap);try{for(t.s();!(e=t.n()).done;){var n=_(e.value,2),i=n[0],o=n[1];o.type===E.CONV_C2C&&this.recordPeerReadTime(i,o.peerReadTime)}}catch(s){t.e(s)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){var e=this.get(7);return!e||e.isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){var e=this.get(7);return e?e.getLocalGroupList().length:0}},{key:"_hasLocalGroup",value:function(e){var t=this.get(7);return!!t&&t.hasLocalGroup(e.replace(E.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this,i=!1;if(this._convMap.has(e)?t=this._convMap.get(e):(t=new Wi({conversationID:e,type:Et(e)?E.CONV_C2C:E.CONV_GROUP},this.isIntl(),this.isUsingChatCore()),i=!0),t._isInfoCompleted||t.type===E.CONV_SYSTEM)return Sn({conversation:t});if(Tt(e)){if(!this.get(7))return En({code:qn.NO_MODULE});if(!this._hasLocalGroup(e))return Sn({conversation:t})}var o="".concat(this._n,".").concat("getConversationProfile"),s=new oi("getConversationProfile");return be.l("".concat(o,". convID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._getUserOrGroupProfile(t).then((function(a){s.setMessage("convID:".concat(e," unreadCount:").concat(a.data.conversation.unreadCount)).end();var r,c=n.get(8);if(c&&t.type===E.CONV_C2C&&(r=e.replace(E.CONV_C2C,""),c.isMyFriend(r))&&(c=c.getFriendRemark(r),t.remark!==c)&&(t.remark=c,be.l("".concat(o,". convID:").concat(e," patch remark:").concat(t.remark))),be.l("".concat(o," ok. isNewConv:").concat(i," convID:").concat(e)),i){if(t.type===E.CONV_C2C)return n._onNewC2CConv([e.replace(E.CONV_C2C,"")]).then((function(){return Sn({conversation:t})}));if(t.type===E.CONV_GROUP)return n._onNewGroupConv([e.replace(E.CONV_GROUP,"")]).then((function(){return Sn({conversation:t})}))}return a})).catch((function(t){return s.setError(t).setMessage("convID:".concat(e)).end(),be.e("".concat(o," failed. error:"),t),En(t)}))}},{key:"_getUserOrGroupProfile",value:function(e){var t=this;return e.type===E.CONV_C2C?this.get(4).getUserProfile({userIDList:[e.toAccount]}).then((function(n){return 0===(n=n.data).length?En({code:qn.USER_OR_GRP_NOT_FOUND}):(e.userProfile=n[0],e._isInfoCompleted=!0,t._insertConvAfterTopmost(e),Sn({conversation:e}))})):this.get(7).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._insertConvAfterTopmost(e),Sn({conversation:e})}))}},{key:"_insertConvAfterTopmost",value:function(e){var t,n;e instanceof Wi&&!this._convMap.has(e.conversationID)&&(n=(t=v(this._convMap)).findIndex((function(e){return!1===e[1].isPinned})),t.splice(n,0,[e.conversationID,e]),this._convMap=new Map(t),this._setStorageConvList(),this.emitConvUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;n===t.getMyUserID()?t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar}):(n=t._convMap.get("".concat(E.CONV_C2C).concat(n)))&&(n.userProfile=e)}))}},{key:"_onCloudConfig",value:function(e){"0"===this.getCloudConfig("pull_on_invite")&&(this._bPullOnInvite=!1),be.l("".concat(this._n,"._onCloudConfig bPullOnInvite:").concat(this._bPullOnInvite))}},{key:"disableMsgPullOnInvite",value:function(){this._bPullOnInvite=!1}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===bn}},{key:"_errorLog",value:function(e,t,n,i){var o=new Error("Params validate failed."),s="".concat(this.getErrMsg("API_REFER")).concat(e);throw be.w("[".concat(e,"] | ").concat(t," | ").concat(this.getErrMsg(n,i),", ").concat(s)),be.e("[".concat(e,"] Invalid ").concat(t,": type check failed for ").concat(t,".")),o}},{key:"_isValidConvID",value:function(e){return Et(e)||Tt(e)||kt(e)}},{key:"deleteConversation",value:function(e){var t=this,n="deleteConversation";return ut(e)||ze(e)||this._errorLog(n,"options","StringOrObjectRequiredLog"),ut(e)?(this._isValidConvID(e)||this._errorLog(n,"options","InvalidConversationID",e),be.l("".concat(this._n,".").concat(n," convID:").concat(e)),this.deleteConvList({conversationIDList:[e],flag:1})):(Ye(e.conversationIDList)||this._errorLog(n,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(n,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach((function(e){t._isValidConvID(e)||t._errorLog(n,"conversationIDList","InvalidConversationID",e)})),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(n,"clearHistoryMessage","BooleanRequiredLog"),100<e.conversationIDList.length&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConvList(e))}},{key:"deleteConvList",value:function(e){var t=void 0===(t=e.conversationIDList)?[]:t,n=void 0===(n=e.clearHistoryMessage)||n,i=void 0===(e=e.flag)?0:e,o="".concat(this._n,".").concat("deleteConvList"),s=(e="convIDList:".concat(t," clearHistoryMessage:").concat(n),be.l("".concat(o," ").concat(e)),new oi("deleteConvList"));return s.setMessage(e),Promise.all([this.rmLocalOnlyConvList(t),this.rmLocalAndRemoteConvList(t,n)]).then((function(e){return s.end(),0===(e=[].concat(v(e[0]),v(e[1]))).length?En(new Bn({code:qn.CONV_NOT_FOUND})):(be.l("".concat(o," ok")),Sn(1===i?{conversationID:e[0]}:{conversationIDList:e}))})).catch((function(e){return s.setError(e).end(),be.e("".concat(o," failed. error:"),e),En(e)}))}},{key:"rmLocalOnlyConvList",value:function(e){var t=this;return e.filter((function(e){var n;return!!t._convMap.has(e)&&((n=t.getLocalConversation(e).type)!==E.CONV_GROUP||t._hasLocalGroup(e)?n===E.CONV_SYSTEM&&(t.get(7).deleteGroupSystemNotice({messageList:t._msgListHandler.getLocalMsgList(e)}),t.deleteLocalConv(e),!0):(t.deleteLocalConv(e),!0))}))}},{key:"rmLocalAndRemoteConvList",value:function(e,t){var n=this,i={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:t?1:0};return e.forEach((function(e){var t;n._convMap.has(e)&&((t=n.getLocalConversation(e).type)===E.CONV_C2C?i.conversationList.push({toAccount:e.replace(t,""),type:1}):t===E.CONV_GROUP&&n._hasLocalGroup(e)&&i.conversationList.push({toGroupID:e.replace(t,""),type:2}))})),0===i.conversationList.length?[]:this.req({P:jn.DEL_CONV,data:i}).then((function(e){var t=[];return 0<e.data.resultList.length&&e.data.resultList.map((function(e){0===e.code&&(e=1===e.type?"".concat(E.CONV_C2C).concat(e.to):"".concat(E.CONV_GROUP).concat(e.groupID),t.push(e))})),n.deleteLocalConvList(t),t}))}},{key:"setConvDraft",value:function(e){var t=e.conversationID,n=(e=e.draftText,"".concat(this._n,".").concat("setConvDraft"));return be.l("".concat(n," convID:").concat(t," draftText:").concat(e)),this._convMap.has(t)?((n=this._convMap.get(t)).setDraftText(e),this.emitConvUpdate(),Sn({code:0,conversation:n})):En({code:qn.CONV_NOT_FOUND})}},{key:"clearHistoryMessage",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._convMap.has(e))return En({code:qn.CONV_NOT_FOUND});var i=this._convMap.get(e).type;if(i===E.CONV_C2C)n.type=1,n.toAccount=e.replace(E.CONV_C2C,"");else{if(i!==E.CONV_GROUP)return i===E.CONV_SYSTEM?(this.get(7).deleteGroupSystemNotice({messageList:this._msgListHandler.getLocalMsgList(e)}),Sn({conversationID:e})):En({code:qn.CONV_UN_RECORDED_TYPE});n.type=2,n.toGroupID=e.replace(E.CONV_GROUP,"")}var o="".concat(this._n,".").concat("clearHistoryMessage"),s=new oi("clearHistoryMessage");return s.setMessage("convID:".concat(e)),be.l("".concat(o,". convID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.req({P:jn.CLEAR_HISTORY_MSG,data:n})})).then((function(){s.end(),be.l("".concat(o," ok")),t.clearMemMsg(e);var n=t.getLocalConversation(e);return n&&(n.updateLastMessage(),t._sortConvListAndEmitEvent()),Sn({conversationID:e})})).catch((function(e){return s.setError(e).end(),be.e("".concat(o," failed. error:"),e),En(e)}))}},{key:"pinConversation",value:function(e){var t,n,i,o=this,s=e.conversationID,a=e.isPinned,r=this.getLocalConversation(s);return r&&r.isPinned===a?Sn({conversationID:s}):kt(s)?(r&&(r.isPinned=a),this._sortConvListAndEmitEvent(),Sn({conversationID:s})):(e=null,Et(s)?e={type:1,toAccount:s.replace(E.CONV_C2C,"")}:Tt(s)&&(e={type:2,groupID:s.replace(E.CONV_GROUP,"")}),null===e?En({code:qn.INVALID_CONV_ID}):(t="".concat(this._n,".").concat("pinConversation"),n="convID:".concat(s," isPinned:").concat(a),(i=new oi("pinConversation")).setMessage(n),be.l("".concat(t,". ").concat(n)),this.req({P:jn.PIN_CONV,data:{fromAccount:this.getMyUserID(),operationType:!0===a?1:2,itemList:[e]}}).then((function(){return i.end(),be.l("".concat(t," ok")),r?r.isPinned!==a&&(r.isPinned=a):o._convMap.set(s,new Wi({conversationID:s,type:Et(s)?E.CONV_C2C:E.CONV_GROUP,isPinned:a},o.isIntl(),o.isUsingChatCore())),o._sortConvListAndEmitEvent(),Cn({conversationID:s})})).catch((function(e){return i.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))))}},{key:"setMessageRemindType",value:function(e){return this._msgRemindHandler.set(e)}},{key:"patchMsgRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,i=e.messageRemindType,o=!1;return(n=this.getLocalConversation("".concat(n?E.CONV_C2C:E.CONV_GROUP).concat(t)))&&n.messageRemindType!==i&&(n.messageRemindType=i,o=!0),be.l("".concat(this._n,".patchMsgRemindType options:"),e,"ret:".concat(o)),o}},{key:"onC2CMsgRemindTypeFetched",value:function(e){var t,n=this;Ye(e)&&0<e.length&&(t=0,e.forEach((function(e){var i=e.userID;e=e.muteFlag,e=n._transMsgRemindType(e),!0===n.patchMsgRemindType({ID:i,isC2CConversation:!0,messageRemindType:e})&&(t+=1)})),be.l("".concat(this._n,".onC2CMsgRemindTypeFetched updateCount:").concat(t)),1<=t)&&this.emitConvUpdate(!0,!1)}},{key:"onC2CMsgRemindTypeSynced",value:function(e){var t=this,n="".concat(this._n,".onC2CMsgRemindTypeSynced");e.dataList.forEach((function(e){var i;qe(e.muteNotificationsSync)||(i=(e=e.muteNotificationsSync).to,e=e.muteFlag,e=t._transMsgRemindType(e),t.patchMsgRemindType({ID:i,isC2CConversation:!(i=0),messageRemindType:e})&&(i+=1),be.l("".concat(n," updateCount:").concat(i)),1<=i&&t.emitConvUpdate(!0,!1))}))}},{key:"onGroupMsgRemindTypeUpdated",value:function(e){this._msgRemindHandler.onGroupMsgRemindTypeUpdated(e)}},{key:"deleteLocalConv",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this._convMap.has(e);be.l("".concat(this._n,".deleteLocalConv convID:").concat(e," has:").concat(n)),n&&(this._convMap.delete(e),this._convMapForDiff.delete(e),this.clearMemMsg(e),this._setStorageConvList(!0),t)&&(n=!this._isTopicConv(e),this.emitConvUpdate(n,!1))}},{key:"pullMsgOnInvite",value:function(e){var t,n,i,o,s,a=this.get(7);a&&(t="".concat(this._n,".pullMsgOnInvite"),be.l("".concat(t," flag:").concat(this._bPullOnInvite)),this._bPullOnInvite)&&(s=this.getLocalLastMessage(e),n=this.getLocalSecondLastMessage(e),o=i=1,s&&(i=s.sequence),n&&(o=n.sequence),s=a.getGroupRemoteLastSeq(e.replace(E.CONV_GROUP,"")),be.l("".concat(t," convID:").concat(e," localLastSeq:").concat(i," localSecondLastSeq:").concat(o," remoteLastSeq:").concat(s)),this.clearMemMsg(e),1<i-o?this._recursiveGetMsgList([],e,!1,i,o):1<s-i&&this._recursiveGetMsgList([],e,!0,s,i))}},{key:"_recursiveGetMsgList",value:function(e,t,n,i,o,s){var a=this;this.getMessageList({conversationID:t,nextReqMessageID:s}).then((function(s){var r=(s=s.data).messageList,c=s.isCompleted,u=(s=s.nextReqMessageID,r.filter((function(e){return n?e.sequence>o&&e.sequence<=i:e.sequence>o&&e.sequence<i})));e.unshift.apply(e,v(u)),!c&&0<r.length&&r[0].sequence>o&&e.length<60?a._recursiveGetMsgList(e,t,n,i,o,s):a._emitMsgReceived(t,e)}))}},{key:"_emitMsgReceived",value:function(e,t){var n,i,o=this;0<t.length&&(t=t.filter((function(e,t,n){return t===n.findIndex((function(t){return t.sequence===e.sequence}))})),n=this.hasLocalConversation(e),i=t.map((function(e){return e.sequence})),be.l("".concat(this._n,"._emitMsgReceived convID:").concat(e," has:").concat(n," count:").concat(i.length," sequenceList:"),i),this.emitOEvt(S.MESSAGE_RECEIVED,t),n?this.patchConvLastMessage(e,!0):this.getConversationProfile(e).then((function(){o.patchConvLastMessage(e,!0)})))}},{key:"deleteLocalConvList",value:function(e){var t=this,n=!1;e.forEach((function(e){t._convMap.has(e)&&(t.deleteLocalConv(e,!1),n=!0)})),be.l("".concat(this._n,".deleteLocalConvList convID:").concat(e," isConvIDExisted:").concat(n)),n&&this.emitConvUpdate(!0,!1)}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._msgListHandler.hasLocalMsg(e.conversationID,e.ID)&&!this._sll.has(e.random))}},{key:"modifyMessageList",value:function(e){var t,n;e.startsWith(E.CONV_C2C)&&this._convMap.has(e)&&(n=this._convMap.get(e),t=Date.now(),this._msgListHandler.modifyMsgSentByPeer({conversationID:e,latestNick:n.userProfile.nick,latestAvatar:n.userProfile.avatar}),n=this.get(4).getNickAndAvatarByUserID(this.getMyUserID()),this._msgListHandler.modifyMsgSentByMe({conversationID:e,latestNick:n.nick,latestAvatar:n.avatar}),be.l("".concat(this._n,".modifyMessageList convID:").concat(e," cost:").concat(zt(t))))}},{key:"updateUserProfileSpecifiedKey",value:function(e){be.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick;e=e.avatar,this._convMap.has(t)&&(t=this._convMap.get(t).userProfile,ut(n)&&t.nick!==n&&(t.nick=n),ut(e)&&t.avatar!==e&&(t.avatar=e),this.emitConvUpdate(!0,!1))}},{key:"_onMyProfileModified",value:function(e){var t=this,n=this.getLocalConvList(),i=Date.now();n.forEach((function(n){t.modifyMessageSentByMe(g({conversationID:n.conversationID},e))})),be.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost:").concat(zt(i)))}},{key:"modifyMessageSentByMe",value:function(e){this._msgListHandler.modifyMsgSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._msgListHandler.getLatestMsgSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._msgListHandler.modifyMsgSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._msgListHandler.getLatestMsgSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._msgListHandler.pushIn(t)||this._sll.has(t.random)||(e.push(t),0))}},{key:"getLocalLastMessage",value:function(e){return this._msgListHandler.getLocalLastMsg(e)}},{key:"getLocalSecondLastMessage",value:function(e){return this._msgListHandler.getLocalSecondLastMsg(e)}},{key:"checkAndPatchRemark",value:function(){var e,t,n=this.get(8);0!==this._convMap.size&&n&&0!==(e=v(this._convMap.values()).filter((function(e){return e.type===E.CONV_C2C}))).length&&(t=0,e.forEach((function(e){var i=e.conversationID.replace(E.CONV_C2C,"");n.isMyFriend(i)&&(i=n.getFriendRemark(i),e.remark!==i)&&(e.remark=i,t+=1)})),be.l("".concat(this._n,".checkAndPatchRemark. c2cConvCount:").concat(e.length," patchedCount:").concat(t)),0<t)&&this.emitConvUpdate(!0,!1)}},{key:"updateTopicConversation",value:function(e){this._updateLocalConvList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===E.CONV_C2C?n=this._m.get(6):t.conversationType===E.CONV_GROUP&&(n=this._m.get(7)),n?n.sendReadReceipt(e):En({code:qn.NO_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===E.CONV_C2C?n=this._m.get(6):t.conversationType===E.CONV_GROUP&&(n=this._m.get(7)),n?n.getReadReceiptList(e):En({code:qn.NO_MODULE})}},{key:"getLastMessageTime",value:function(e){return(e=this.getLocalConversation(e))?e.lastMessage.lastTime:0}},{key:"getTotalUnreadCount",value:function(){var e=this.getLocalConvList(),t=0;return e.forEach((function(e){e.type===E.CONV_SYSTEM||""!==e.messageRemindType&&e.messageRemindType!==E.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount)})),t}},{key:"onTotalUnreadCountUpdate",value:function(){var e=this.getTotalUnreadCount();this._convTotalUnreadCount!==e&&(be.l("".concat(this._n,".onTotalUnreadCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOEvt(S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"_isConvNeedShow",value:function(e){var t,n;return e=this.getLocalConversation(e),!(!lt(e)&&(t=e.type===E.CONV_TOPIC,n=e.type===E.CONV_GROUP&&e.groupProfile.type===E.GRP_ROOM,e=e.type===E.CONV_GROUP&&e.groupProfile.type===E.GRP_LIVE,t||n||e))}},{key:"setAllRcvMsgOpt",value:function(e){return this._msgRemindHandler.setAllRcvMsgOpt(e)}},{key:"getAllRcvMsgOpt",value:function(){return this._msgRemindHandler.getAllRcvMsgOpt()}},{key:"onAllRcvMsgOptNotify",value:function(e){this._msgRemindHandler.onAllRcvMsgOptNotify(e)}},{key:"clearUnreadCount",value:function(e){(e=this.getLocalConversation(e))&&0<e.unreadCount&&(e.unreadCount=0,this.emitConvUpdate(!0,!1))}},{key:"storeHoppingMessageList",value:function(e){this._msgListHandler.storeHoppingMsgList(e)}},{key:"clearMemMsg",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];be.l("".concat(this._n,".clearMemMsg convID:").concat(e," isOverLimit:").concat(t)),this._msgListHandler.removeByConvID(e),this._completedMap.delete(e),this._roamingMsgKeyAndTimeMap.delete(e),this._everClearedMap.set(e,1)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._setStorageConvList(!0),this._pagingStatus=Rn,this._msgListHandler.reset(),this._msgRemindHandler.reset(),this._roamingMsgKeyAndTimeMap.clear(),this._sll.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._convMap.clear(),this._pagingTs=0,this._pagingStartIdx=0,this._pagingPinnedTs=0,this._pagingPinnedStartIdx=0,this._remoteGroupReadSeqMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this._pagingConvIDMap.clear(),this._convIDFromUnreadDBMap.clear(),this._pagingGetCostList.length=0,this._convMapForDiff.clear(),this._partialUpdatedConvMap.clear(),this._everClearedMap.clear(),this._bPullOnInvite=!0,this._convGroupHandler.reset(),this.resetReady()}}])),Qi=s((function e(t){i(this,e),this._grpM=t,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4}),[{key:"onCheckTimer",value:function(e){e%1==0&&0<this._cachedGroupTipsMap.size&&this._check()}},{key:"_check",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var i=e._checkCountMap.get(n),o=e._grpM.hasLocalGroup(n);be.l("".concat(e._n,"._check groupID:").concat(n," hasLocalGroup:").concat(o," checkCount:").concat(i)),o?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._grpM.deleteUnjoinedAVChatRoom(n)):i>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++i)}))}},{key:"onNewGroupTips",value:function(e){be.l("".concat(this._n,".onNewGroupTips options:").concat(JSON.stringify(e.dataList)));var t=(e=this._assembly(e)).eventDataList,n=e.result;0<(e=e.AVChatRoomMessageList).length&&this._grpM.onAVChatRoomMessage(e),0<n.length&&(this._grpM.emitOEvt(S.MESSAGE_RECEIVED,n),this._handleTips(n)),0<t.length&&(this._grpM.updateNextMessageSeq(t),this._grpM.get(11).onNewMessage({conversationOptionsList:t,isInstantMessage:!0}))}},{key:"_assembly",value:function(e){for(var t=e.event,n=e.dataList,i=null,o=[],s=[],a={},r=[],c=0,u=n.length;c<u;c++){var l=rt(n[c]);if(6===t){if(this._grpM.isGroupAttributesUpdatedNotice(l))continue;if(this._grpM.isGroupCountersNotice(l))continue}var d=(m=l.groupProfile).groupID,p=void 0===(p=m.communityType)?0:p,h=void 0===(h=m.topicID)?void 0:h,f=m.invisible,m=void 0===(m=m.groupType)?void 0:m,_=void 0;if((y=this._grpM.isMessageFromTopic(p,h))&&(_=E.CONV_TOPIC,l.to=h),(v=this._grpM.hasLocalGroup(d))||!this._grpM.isUnjoinedAVChatRoom(d))if(v||y)if(this._grpM.isMessageFromOrToAVChatroom(d))l.event=t,r.push(l);else if(l.currentUser=this._grpM.getMyUserID(),l.conversationType=E.CONV_GROUP,(i=new ki(l)).setElement({type:E.MSG_GRP_TIP,content:g(g({},l.elements),{},{groupProfile:l.groupProfile})}),i.isSystemMessage=!1,1!==f){var v=this._grpM.get(11),y=(f=(y=i).conversationID,y.sequence);if(6===t)i._onlineOnlyFlag=!0,s.push(i);else if(!v.pushIntoNoticeResult(s,i))continue;this._grpM.isMessageFromCommunityOfTopic(p,h)||6===t&&v.getLocalConversation(f)||(6!==t&&this._qualityStat(i),p=v.isRemoteRead({conversationID:f,sequence:y}),lt(a[f])?(h=0,"in"!==i.flow||i._isExcludedFromUnreadCount||i._onlineOnlyFlag||p||(h=1),a[f]=o.push({conversationID:f,unreadCount:h,type:lt(_)?i.conversationType:_,subType:i.conversationSubType,lastMessage:i._isExcludedFromLastMessage?"":i})-1):(o[v=a[f]].type=i.conversationType,o[v].subType=i.conversationSubType,o[v].lastMessage=i._isExcludedFromLastMessage?"":i,"in"!==i.flow||i._isExcludedFromUnreadCount||i._onlineOnlyFlag||p||o[v].unreadCount++))}else this._qualityStat(i);else this._cacheAndCompare({groupID:d,event:t,item:l,groupType:m})}return{eventDataList:o,result:s,AVChatRoomMessageList:r}}},{key:"_qualityStat",value:function(e){this._grpM.get(26).addMessageSequence({key:Xn,message:e})}},{key:"_handleTips",value:function(e){var t=this;e.forEach((function(e){switch(e.payload.operationType){case 1:t._onNewMemberComeIn(e);break;case 2:t._onMemberQuit(e);break;case 3:t._onMemberKickedOut(e);break;case 4:t._onMemberSetAdmin(e);break;case 5:t._onMemberCancelledAdmin(e);break;case 6:t._onGroupProfileModified(e);break;case 7:t._onMemberInfoModified(e);break;case 8:t._onTopicProfileUpdated(e);break;default:be.w("".concat(t._n,"._handleTips unknown operationType:").concat(e.payload.operationType))}}))}},{key:"_onNewMemberComeIn",value:function(e){var t=(e=e.payload).memberNum;e=e.groupProfile.groupID,(e=this._grpM.getLocalGroupProfile(e))&&Ke(t)&&e.memberCount!==t&&(e.memberCount=t,this._updateConvGroupProfile(e))}},{key:"_onMemberQuit",value:function(e){var t=(n=e.payload).memberNum,n=n.groupProfile.groupID,i=this._grpM.getLocalGroupProfile(n);i&&Ke(t)&&i.memberCount!==t&&(i.memberCount=t,this._updateConvGroupProfile(i)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(n,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var t=(n=e.payload).memberNum,n=n.groupProfile.groupID,i=this._grpM.getLocalGroupProfile(n);i&&Ke(t)&&i.memberCount!==t&&(i.memberCount=t,this._updateConvGroupProfile(i)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(n,e.payload.userIDList)}},{key:"_updateConvGroupProfile",value:function(e){this._grpM.get(11).updateConvGroupProfile([e])}},{key:"_onMemberSetAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=(e=e.payload.userIDList,this._grpM.getGroupMemberHandler());e.forEach((function(e){(e=n.getLocalGroupMemberInfo(t,e))&&e.updateRole(E.GRP_MBR_ROLE_ADMIN)}))}},{key:"_onMemberCancelledAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=(e=e.payload.userIDList,this._grpM.getGroupMemberHandler());e.forEach((function(e){(e=n.getLocalGroupMemberInfo(t,e))&&e.updateRole(E.GRP_MBR_ROLE_MEMBER)}))}},{key:"_onGroupProfileModified",value:function(e){var t=this,n=(e=e.payload).newGroupProfile,i=e.groupProfile,o=e.operatorInfo,s=(e=i.groupID,this._grpM.getLocalGroupProfile(e));Object.keys(n).forEach((function(e){switch(e){case"ownerID":t._ownerChanged(s,n);break;case"groupName":s.name=n[e];break;default:s[e]=n[e]}})),lt(o)||Object.keys(o).forEach((function(e){var t;"nameCard"===e?s.updateSelfInfo({nameCard:o[e]}):"role"===e&&(t="",400===o[e]?t=E.GRP_MBR_ROLE_OWNER:300===o[e]?t=E.GRP_MBR_ROLE_ADMIN:200===o[e]&&(t=E.GRP_MBR_ROLE_MEMBER),s.updateSelfInfo({role:t}))})),i=!s.isSupportTopic,this._grpM.emitGroupListUpdate(!0,i)}},{key:"_ownerChanged",value:function(e,t){e=e.groupID;var n=this._grpM.getLocalGroupProfile(e),i=this._grpM.getMyUserID();i===t.ownerID&&(n.updateGroup({selfInfo:{role:E.GRP_MBR_ROLE_OWNER}}),n=(t=this._grpM.getGroupMemberHandler()).getLocalGroupMemberInfo(e,i),i=this._grpM.getLocalGroupProfile(e).ownerID,t=t.getLocalGroupMemberInfo(e,i),n&&n.updateRole(E.GRP_MBR_ROLE_OWNER),t)&&t.updateRole(E.GRP_MBR_ROLE_MEMBER)}},{key:"_onMemberInfoModified",value:function(e){var t=e.to,n=(i=e.payload).groupProfile,i=i.memberList,o=n.groupID,s=(St(t)&&this._updateTopicMuteTime(e),this._grpM.getGroupMemberHandler());i.forEach((function(e){var t=s.getLocalGroupMemberInfo(o,e.userID);t&&Ke(e.muteTime)&&t.updateMuteUntil(e.muteTime)}))}},{key:"_updateTopicMuteTime",value:function(e){var t=e.to,n=(e=e.payload).groupProfile,i=void 0===(e=e.memberList)?[]:e,o=(e=this._grpM.get(10),n=n.groupID,e.getLocalTopic(n,t));if(o){for(var s=!1,a=0;a<i.length;a++){var r=i[a];if(r.userID===this._grpM.getMyUserID()&&0<=r.muteTime){o.updateSelfInfo({muteTime:r.muteTime}),s=!0;break}}s&&this._grpM.emitOEvt(S.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:"_onTopicProfileUpdated",value:function(e){var t=(n=e.payload).groupProfile.groupID,n=n.newTopicInfo;this._grpM.get(10).onTopicProfileUpdated(g({groupID:t,topicID:e.to},n))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e,t){var n=this,i=this._cachedGroupTipsMap.get(e)||[];be.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(e," groupType:").concat(t," count:").concat(i.length)),i.forEach((function(e){n.onNewGroupTips(e)})),this._deleteCachedGroupTips(e)}},{key:"_cacheAndCompare",value:function(e){var t=e.groupID,n=e.event,i=e.item;e=e.groupType,be.l("".concat(this._n,"._cacheAndCompare groupID:").concat(t," groupType:").concat(e)),this._cacheGroupTips(t,{event:n,dataList:[i]}),n={groupID:t,type:e},e===E.GRP_AVCHATROOM?this._grpM.hasLocalGroup(t)?this._notifyCachedGroupTips(t,e):this._grpM.setUnjoinedAVChatRoom(t):(this._grpM.updateGroupMap([n]),this._notifyCachedGroupTips(t,e)),this._checkCountMap.has(t)||this._checkCountMap.set(t,0)}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear()}}]),Zi=s((function e(t){i(this,e),this._grpM=t,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this.PAGING_GRP_COUNT_LIMIT=200,this._pagingStatus=Rn,this._pagingGetCostList=[],t.getIEmitInst().on(Ni.A2KEY_AND_TINYID_UPDATED,this.syncGroupList,this)}),[{key:"onCheckTimer",value:function(e){e%1==0&&0<this._cachedGroupMessageMap.size&&this._check()}},{key:"_check",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var i=e._checkCountMap.get(n),o=e._grpM.hasLocalGroup(n);be.l("".concat(e._n,"._check groupID:").concat(n," hasLocalGroup:").concat(o," checkCount:").concat(i)),o?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._grpM.deleteUnjoinedAVChatRoom(n)):i>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++i)}))}},{key:"updateLastMsg",value:function(e){var t="".concat(this._n,".updateLastMsg");if(0!==this._grpM.getGroupMap().size){for(var n,i,o,s,a=!1,r=e.length,c=0;c<r;c++)(n=e[c]).type===E.CONV_GROUP&&0!==n.lastMessage.lastSequence&&null!==n.lastMessage.payload&&(i=n.conversationID.split(/^GROUP/)[1],i=this._grpM.getLocalGroupProfile(i))&&(o=i.lastMessage,s=n.lastMessage,JSON.stringify(o)!==JSON.stringify(s))&&(i.lastMessage=g({},n.lastMessage),a=!0);be.l("".concat(t," convCount:").concat(r," groupCount:").concat(this._grpM.getLocalGroupList().length," isUpdated:").concat(a)),a&&(this._grpM.sortLocalGroupList(),this._grpM.emitGroupListUpdate(!0,!1))}else this.tempConversationList=e}},{key:"onNewMessage",value:function(e){var t,n=(t=this._assembly(e)).conversationOptionsList,i=t.messageList;0<(0<(0<(t=t.AVChatRoomMessageList).length&&this._grpM.onAVChatRoomMessage(t),t=vt(i)).length&&this._grpM.emitOEvt(S.MESSAGE_MODIFIED,t),0<n.length&&(this._grpM.get(11).onNewMessage({conversationOptionsList:n,isInstantMessage:!1!==e.isInstantMessage,updateUnreadCount:!1!==e.updateUnreadCount}),this._grpM.updateNextMessageSeq(n)),t=It(i)).length&&this._grpM.emitOEvt(S.MESSAGE_RECEIVED,t),i.length=0}},{key:"_assembly",value:function(e){var t=e.dataList,n=e.event,i=e.isInstantMessage,o=null,s=[],a=[],r=[],c={},u=this._grpM.getFileDownloadProxy(),l=this._grpM.getDownloadFileAuthKey(),d=this._grpM.get(17).getFileDNList(),p=t.length;1<p&&t.sort((function(e,t){return e.sequence-t.sequence}));for(var h=this._grpM.get(11),g=this._grpM.get(4),f=0;f<p;f++){var m,_=rt(t[f]),v=(C=_.groupProfile).groupID,y=void 0===(y=C.communityType)?0:y,I=void 0===(I=C.topicID)?void 0:I,M=C.invisible,C=void 0===(C=C.groupType)?void 0:C,S=void 0,T=this._grpM.isMessageFromTopic(y,I),k=(T&&(S=E.CONV_TOPIC,_.to=I),this._grpM.hasLocalGroup(v));!k&&this._grpM.isUnjoinedAVChatRoom(v)||(k||T?this._grpM.isMessageFromOrToAVChatroom(v)?(_.event=n,r.push(_)):(_.currentUser=this._grpM.getMyUserID(),_.conversationType=E.CONV_GROUP,_.isSystemMessage=!!_.isSystemMessage,(o=new ki(_)).setElement(_.elements,u,l,d),1!==M?(k=1===t[f].isModified,h.isMessageSentByCurrentInstance(o)?o.isModified=k:k=!1,1===_.onlineOnlyFlag?(o._onlineOnlyFlag=!0,h.isMessageSentByCurrentInstance(o)||a.push(o)):this._grpM.isMessageFromCommunityOfTopic(y,I)?a.push(o):(o.from===this._grpM.getMyUserID()&&(T=h.getLatestMessageSentByMe(o.conversationID))&&(M=T.nick,y=T.avatar,M===o.nick&&y===o.avatar||(h.modifyMessageSentByMe({conversationID:m,latestNick:o.nick,latestAvatar:o.avatar}),g.mockOnNickAvatarModified(o.nick,o.avatar))),h.pushIntoMessageList(a,o,k)&&(this._qualityStat(i,o),m=(I=o).conversationID,T=I.sequence,M=h.isRemoteRead({conversationID:m,sequence:T}),lt(c[m])?(y=0,"in"!==o.flow||o._isExcludedFromUnreadCount||M||(y=1),c[m]=s.push({conversationID:m,unreadCount:y,type:lt(S)?o.conversationType:S,subType:o.conversationSubType,lastMessage:o._isExcludedFromLastMessage?"":o})-1):(s[k=c[m]].type=lt(S)?o.conversationType:S,s[k].subType=o.conversationSubType,s[k].lastMessage=o._isExcludedFromLastMessage?"":o,"in"!==o.flow||o._isExcludedFromUnreadCount||M||s[k].unreadCount++)))):this._qualityStat(i,o)):this._cacheAndCompare({groupID:v,event:n,item:_,groupType:C}))}return{conversationOptionsList:s,messageList:a,AVChatRoomMessageList:r}}},{key:"_qualityStat",value:function(e,t){var n=this._grpM.get(26);n.addMessageSequence({key:Xn,message:t}),e&&0<t.clientTime&&n.addMessageDelay(t.clientTime)}},{key:"onMsgRevoked",value:function(e,t){var n=this,i=this._grpM.get(11),o=[],s=[];e.dataList.forEach((function(e){var t=e.elements.revokedInfos,n=e.revokerInfo,a=e.groupProfile,r=!1;a&&(r=Ct({groupID:a.groupID})||!qe(a.topicID)),lt(t)||t.forEach((function(e){var t,c=qe(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID),u=i.getLocalConversation(c),l=e.revokerInfo&&e.revokerInfo.revoker||n&&n.revoker,d=n&&n.reason||"";u&&Mt(u.type)?t={conversationID:c,sequence:e.sequence,ID:"".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)}:(u=i.revoke(c,e.sequence,e.random))?t=u:(t={conversationID:c,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(t.ID="".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)),e.time&&(t.time=e.time)),t&&(t.revoker=l,t.revokeReason=d,t.revokerInfo={userID:l,nick:"",avatar:""},(r?(t.revokerInfo.nick=a.nick,t.revokerInfo.avatar=a.avatar,o):s).push(t))}))})),0===s.length&&0===o.length||(i.onMessageRevoked([].concat(o,s),t),0<o.length&&this._grpM.emitOEvt(S.MESSAGE_REVOKED,o),0<s.length&&i.updateRevokerInfo(s).then((function(e){n._grpM.emitOEvt(S.MESSAGE_REVOKED,e)})))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(v(this._grpM.getGroupMap())),n=0,i=e.length;n<i;n++)t.delete(e[n].groupID);this._grpM.hasJoinedAVChatRoom()&&this._grpM.getJoinedAVChatRoom().forEach((function(e){t.delete(e)})),this._grpM.getGroupMap().forEach((function(e,n){e.isSupportTopic&&t.delete(n)}));for(var o=v(t.keys()),s=0,a=o.length;s<a;s++)this._grpM.deleteGroup(o[s])}},{key:"syncGroupList",value:function(){var e,t,n=this,i=0<arguments.length&&void 0!==arguments[0]&&arguments[0],o=(this._pagingStatus===Rn&&this._grpM.clearGroupMap(),v(U)),s=this.PAGING_GRP_COUNT_LIMIT,a=[];return!0===i?this._pagingGetGroupListWithTopic({limit:s,offset:0,groupBaseInfoFilter:o,groupList:a}):(i="syncGroupList",e="".concat(this._n,".").concat(i),t=new oi(i),this._pagingGetGroupList({limit:s,offset:0,groupBaseInfoFilter:o,groupList:a}).then((function(){var i=Kt(n._pagingGetCostList),o=Ht(n._pagingGetCostList),s=(n._pagingGetCostList.length=0,n._pagingStatus=bn,n._groupListTreeShaking(a),n._grpM.updateGroupMap(a),n._grpM.getLocalGroupList().length);return s="count:".concat(s," sum:").concat(o," avg:").concat(i),be.l("".concat(e," ok. ").concat(s)),t.setMessage(s).end(),n.tempConversationList&&(n.updateLastMsg(n.tempConversationList),n.tempConversationList=null),n._grpM.emitGroupListUpdate(!0,!0),Cn({groupList:n._grpM.getLocalGroupList()})})).catch((function(i){return n._pagingStatus=An,t.setError(i).end(),be.e("".concat(e," failed. error:"),i),En(i)})))}},{key:"getGroupList",value:function(){var e,t=this,n="".concat(this._n,".").concat("getGroupList");return be.l("".concat(n," pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===An||this._pagingStatus===Rn?this.syncGroupList().then((function(){return Cn({groupList:t._grpM.getLocalGroupList(),isSyncCompleted:t.isPagingGetCompleted()})})).catch((function(e){return be.e("".concat(n," failed. error:"),e),En(e)})):(e=this._grpM.getLocalGroupList(),be.l("".concat(n,". returned group count:").concat(e.length)),Sn({groupList:e,isSyncCompleted:this.isPagingGetCompleted()}))}},{key:"isPagingGetCompleted",value:function(){return this._pagingStatus===bn}},{key:"_pagingGetGroupList",value:function(e){var t=this,n="".concat(this._n,".").concat("_pagingGetGroupList"),i=void 0!==(c=e.isCommunityRelay)&&c,o=e.limit,s=e.offset,a=e.groupBaseInfoFilter,r=e.groupList,c=void 0,u=(i&&(c=E.GRP_COMMUNITY,a.push("AtInfoList")),Date.now());return this._grpM.req({P:jn.GET_GRP_LIST,data:{type:c,memberAccount:this._grpM.getMyUserID(),limit:o,offset:s,responseFilter:{groupBaseInfoFilter:a,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then((function(e){var c=void 0===(c=(e=e.data).groups)?[]:c,l=(e=e.totalCount,r.push.apply(r,v(c)),t._handleGroupAtInfoWithoutTopic(i,c),!((c=s+o)<e));return e="offset:".concat(s," limit:").concat(o," total:").concat(e," isCompleted:").concat(l," ")+"current:".concat(r.length," isCommunityRelay:").concat(i),t._pagingGetCostList.push(zt(u,!1)),be.l("".concat(n," ok. ").concat(e," cost:").concat(zt(u))),i||l?!i&&l?(be.l("".concat(n," start to get community list")),s=0,t._pagingGetGroupList({limit:o,offset:s,groupBaseInfoFilter:a,groupList:r,isCommunityRelay:!0})):i&&!l?(s=c,t._pagingGetGroupList({limit:o,offset:s,groupBaseInfoFilter:a,groupList:r,isCommunityRelay:!0})):Cn({groupList:r}):(s=c,t._pagingGetGroupList({limit:o,offset:s,groupBaseInfoFilter:a,groupList:r}))})).catch((function(e){return 10018===e.code?(be.w("".concat(t.logPrefix," response size exceeds the limit, request count:").concat(o)),o=50,t._pagingGetGroupList({limit:o,offset:s,groupBaseInfoFilter:a,groupList:r,isCommunityRelay:i})):i?(11e3===e.code&&be.l("".concat(n," ok. community unavailable")),Sn({groupList:r})):En(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._n,"._pagingGetGroupListWithTopic"),i=e.limit,o=e.offset,s=e.groupBaseInfoFilter,a=e.groupList,r=Date.now();return this._grpM.req({P:jn.GET_GRP_LIST,data:{type:E.GRP_COMMUNITY,memberAccount:this._grpM.getMyUserID(),limit:i,offset:o,responseFilter:{groupBaseInfoFilter:s,selfInfoFilter:v(G)},isSupportTopic:1,needAppDefineData:1}}).then((function(e){var c=(e=e.data).groups,u=(e=e.totalCount,a.push.apply(a,v(void 0===c?[]:c)),!((c=o+i)<e));return be.l("".concat(n," ok. offset:").concat(o," limit:").concat(i," totalCount:").concat(e," isCompleted:").concat(u," currentCount:").concat(a.length," cost:").concat(zt(r))),u?(t._grpM.updateGroupMap(a),t._grpM.emitGroupListUpdate(!0,!1),Cn({groupList:e=t._grpM.getLocalGroupList().filter((function(e){return!0===e.isSupportTopic}))})):(o=c,t._pagingGetGroupListWithTopic({limit:i,offset:o,groupBaseInfoFilter:s,groupList:a}))})).catch((function(e){return 10018===e.code?(be.w("".concat(t.logPrefix," response size exceeds the limit, request count:").concat(i)),i=50,t._pagingGetGroupListWithTopic({limit:i,offset:o,groupBaseInfoFilter:s,groupList:a})):En(e)}))}},{key:"_cacheGroupMessage",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:"_deleteCachedGroupMessage",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:"_notifyCachedGroupMessage",value:function(e,t){var n=this,i=this._cachedGroupMessageMap.get(e)||[];be.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(e," groupType:").concat(t," count:").concat(i.length)),i.forEach((function(e){n.onNewMessage(e)})),this._deleteCachedGroupMessage(e)}},{key:"_cacheAndCompare",value:function(e){var t=e.groupID,n=e.event,i=e.item;e=e.groupType,be.l("".concat(this._n,"._cacheAndCompare groupID:").concat(t," groupType:").concat(e)),this._cacheGroupMessage(t,{event:n,dataList:[i]}),n={groupID:t,type:e},e===E.GRP_AVCHATROOM?this._grpM.hasLocalGroup(t)?this._notifyCachedGroupMessage(t,e):this._grpM.setUnjoinedAVChatRoom(t):(this._grpM.updateGroupMap([n]),this._notifyCachedGroupMessage(t,e)),this._checkCountMap.has(t)||this._checkCountMap.set(t,0)}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,t){var n=this;e&&0!==t.length&&t.forEach((function(e){var t=e.groupID,i=(e=e.groupAtInfoList,[]);lt(e)||(e.forEach((function(e){i.push(g(g({},e),{},{groupID:t}))})),n._grpM.get(11).onNewGroupAtTips({dataList:i}))}))}},{key:"setPagingGroupCount",value:function(e){lt(e)||(this.PAGING_GRP_COUNT_LIMIT=parseInt(e,10))}},{key:"reset",value:function(){this.PAGING_GRP_COUNT_LIMIT=200,this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._pagingStatus=Rn,this._pagingGetCostList=[]}}]),eo=s((function e(t){i(this,e),this._grpM=t,this._n="GroupAttributesHandler",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._grpM.getIEmitInst().on(Ni.CLOUD_CONFIG,this._onCloudConfig,this)}),[{key:"_onCloudConfig",value:function(){var e=this._grpM.getCloudConfig("grp_attr_cache_time");lt(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"isGroupAttributesUpdatedNotice",value:function(e){var t=e.to,n=(e=e.elements.newGroupProfile,!lt(e)&&!qe(e.groupAttributeOption));return n&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:e.groupAttributeOption}),n}},{key:"_onGroupAttributesUpdated",value:function(e){var t,n=this,i=e.groupID,o=(e=e.groupAttributeOption).mainSequence,s=e.isWithChangedAttributeInfo,a=void 0===(a=e.groupAttributeList)?[]:a;e=e.operationType,be.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(i," isWithChangedAttributeInfo:").concat(s," operationType:").concat(e)),lt(e)||(this._groupAttributesCopy=this._getCachedAttributes({groupID:i}),0!=(t=o-this._getLocalGroupAttributes(i).localMainSequence)&&(1===s&&1==t?(this._refreshCachedGroupAttributes({groupID:i,remoteMainSequence:o,groupAttributeList:a,operationType:e}),this._emitGroupAttributesUpdated(i)):this._hasLocalGroupAttributes(i)&&(s=this._getLocalGroupAttributes(i).avChatRoomKey,this._getGroupAttributes({groupID:i,avChatRoomKey:s}).then((function(){n._emitGroupAttributesUpdated(i)})))))}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID;e=void 0===(e=e.avChatRoomKey)?void 0:e,this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:e}),be.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(e))}},{key:"initGroupAttributes",value:function(e){var t=this,n=e.groupID,i=e.groupAttributes,o=(e=this._getLocalGroupAttributes(n)).remoteMainSequence,s=(e=e.avChatRoomKey,new oi("initGroupAttributes"));return s.setMessage("groupID:".concat(n," avChatRoomKey:").concat(e," mainSequence:").concat(o)),this._grpM.req({P:jn.SET_GRP_ATTR,data:{groupID:n,avChatRoomKey:e,mainSequence:o,groupAttributeList:this._transformGroupAttributes(i)}}).then((function(e){be.l("".concat(t._n,".").concat("initGroupAttributes"," ok. groupID:").concat(n));var o=(e=e.data).mainSequence;return(e=v(e.groupAttributeList)).forEach((function(e){e.value=i[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:e,operationType:1}),t._emitGroupAttributesUpdated(n),s.end(),Cn({groupAttributes:i})})).catch((function(e){return s.setError(e).end(),En(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupAttributes"),i=e.groupID,o=e.groupAttributes,s=(e=this._getLocalGroupAttributes(i)).remoteMainSequence,a=e.avChatRoomKey,r=e.attributes,c=((e=this._transformGroupAttributes(o)).forEach((function(e){var t=e.key;e.sequence=0,r.has(t)&&(e.sequence=r.get(t).sequence)})),new oi("setGroupAttributes"));return c.setMessage("groupID:".concat(i," groupAttributes:").concat(JSON.stringify(o))),be.l("".concat(n,". groupID:").concat(i," mainSequence:").concat(s)),this._grpM.req({P:jn.MODIFY_GRP_ATTR,data:{groupID:i,avChatRoomKey:a,mainSequence:s,groupAttributeList:e}}).then((function(e){be.l("".concat(n," ok."));var s=(e=e.data).mainSequence;return(e=v(e.groupAttributeList)).forEach((function(e){e.value=o[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:i}),t._refreshCachedGroupAttributes({groupID:i,remoteMainSequence:s,groupAttributeList:e,operationType:2}),t._emitGroupAttributesUpdated(i),c.end(),Cn({groupAttributes:o})})).catch((function(e){return c.setError(e).end(),En(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,i=(e=void 0===(e=e.keyList)?[]:e,(r=this._getLocalGroupAttributes(n)).remoteMainSequence),o=r.avChatRoomKey,s=r.attributes,a=v(s.keys()),r=jn.CLEAR_GRP_ATTR,c=3,u=(o={groupID:n,avChatRoomKey:o,mainSequence:i},[]),l=(0<e.length&&(a=[],r=jn.DEL_GRP_ATTR,c=4,e.forEach((function(e){var t=0;s.has(e)&&(t=s.get(e).sequence,a.push(e)),u.push({key:e,sequence:t})})),o.groupAttributeList=u),new oi("deleteGroupAttributes"));return l.setMessage("groupID:".concat(n," mainSequence:").concat(i," keyList:").concat(e," proto:").concat(r)),this._grpM.req({P:r,data:o}).then((function(e){return be.l("".concat(t._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(n)),e=e.data.mainSequence,t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:e,groupAttributeList:u,operationType:c}),t._emitGroupAttributesUpdated(n),l.end(),Cn({keyList:a})})).catch((function(e){return l.setError(e).end(),En(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupAttributes"),i=e.groupID,o=(r=this._getLocalGroupAttributes(i)).avChatRoomKey,s=r.lastUpdateTime,a=r.localMainSequence,r=r.remoteMainSequence,c=new oi("getGroupAttributes");return c.setMessage("groupID:".concat(i," localMainSequence:").concat(a," remoteMainSequence:").concat(r," keyList:").concat(e.keyList)),Date.now()-s>=this.CACHE_EXPIRE_TIME||a<r?this._getGroupAttributes({groupID:i,avChatRoomKey:o}).then((function(o){return c.setMoreMessage("get attributes from remote. count:".concat(o.length)).end(),be.l("".concat(n," from remote. groupID:").concat(i)),Cn({groupAttributes:o=t._getCachedAttributes(e)})})).catch((function(e){return c.setError(e).end(),En(e)})):(c.setMoreMessage("get attributes from cache").end(),be.l("".concat(n," from cache. groupID:").concat(i)),Sn({groupAttributes:s=this._getCachedAttributes(e)}))}},{key:"_getGroupAttributes",value:function(e){var t=this,n=0;return lt(e.avChatRoomKey)||(n=1),this._grpM.req({P:jn.GET_GRP_ATTR,data:g(g({},e),{},{groupType:n})}).then((function(n){be.l("".concat(t._n,"._getGroupAttributes ok. groupID:").concat(e.groupID));var i=(n=n.data).mainSequence,o=v(n=n.groupAttributeList);return lt(i)||t._refreshCachedGroupAttributes({groupID:e.groupID,remoteMainSequence:i,groupAttributeList:o,operationType:5}),n})).catch((function(e){return En(e)}))}},{key:"_refreshCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.remoteMainSequence,i=e.groupAttributeList;if(e=e.operationType,this._hasLocalGroupAttributes(t)){var o=this._getLocalGroupAttributes(t),s=o.localMainSequence;if(5===e||n-s==1)o.remoteMainSequence=n,o.localMainSequence=n,o.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:o,groupAttributeList:i,operationType:e});else{if(s===n)return;o.remoteMainSequence=n}this._groupAttributesMap.set(t,o),i="operationType:".concat(e," localMainSequence:").concat(s," remoteMainSequence:").concat(n),be.l("".concat(this._n,"._refreshCachedGroupAttributes. ").concat(i))}}},{key:"_getCachedAttributes",value:function(e){var t=e.groupID,n=(e=void 0===(e=e.keyList)?[]:e,{});if(this._hasLocalGroupAttributes(t)){var i=this._getLocalGroupAttributes(t).attributes;if(0<e.length)e.forEach((function(e){i.has(e)&&(n[e]=i.get(e).value)}));else{var o,s=a(i.keys());try{for(s.s();!(o=s.n()).done;){var r=o.value;n[r]=i.get(r).value}}catch(c){s.e(c)}finally{s.f()}}}return n}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList;3!==(e=e.operationType)?4!==e?(1===e&&t.attributes.clear(),n.forEach((function(e){var n=e.key,i=e.value;e=e.sequence,t.attributes.set(n,{value:i,sequence:e})}))):n.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(e){return this._groupAttributesMap.has(e)}},{key:"_getLocalGroupAttributes",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getCachedAttributes({groupID:e}),n=(i=this._computeAttrChangedInfo(t)).updatedKeyList,i=i.deletedKeyList;be.l("".concat(this._n,"._emitGroupAttributesUpdated update:").concat(n.length,", delete:").concat(i.length)),0===n.length&&0===i.length||this._grpM.emitOEvt(S.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:n,deletedKeyList:i})}},{key:"_computeAttrChangedInfo",value:function(e){var t=this,n=[],i=[];return Object.keys(e).forEach((function(i){e[i]!==t._groupAttributesCopy[i]&&n.push(i)})),Object.keys(this._groupAttributesCopy).forEach((function(t){lt(e[t])&&i.push(t)})),this._groupAttributesCopy={},{updatedKeyList:n,deletedKeyList:i}}},{key:"deleteLocalGroupAttributes",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),to=s((function e(t){i(this,e),this._grpM=t,this._n="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._grpM.getIEmitInst().on(Ni.CLOUD_CONFIG,this._onCloudConfig,this)}),[{key:"_onCloudConfig",value:function(){var e=this._grpM.getCloudConfig("grp_counter_expire_time");lt(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(e){var t=e.to,n=!1;return qe(e=e.elements.groupCounterInfo)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:e}),n=!0),n}},{key:"_onGroupCountersUpdated",value:function(e){var t=this,n=e.groupID;e.groupCounterInfo.forEach((function(e){var i=e.type,o=e.groupCounterSeq;e=void 0===(e=e.counterList)?[]:e,0!==i&&2!==i||(t._updateLocalGroupCounters({groupID:n,groupCounterSeq:o,counterList:e}),e.forEach((function(e){t._grpM.emitOEvt(S.GROUP_COUNTER_UPDATED,{groupID:n,key:e.key,value:e.value})}))),1===i&&t._deleteLocalGroupCounters({groupID:n,groupCounterSeq:o,counterList:e})})),be.l("".concat(this._n,"._onGroupCountersUpdated groupID:").concat(n))}},{key:"initGroupCountersCache",value:function(e){var t=e.groupID;e=e.avChatRoomKey,this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:e}),be.l("".concat(this._n,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(e))}},{key:"setGroupCounters",value:function(e){var t,n,i,o,s;return this._grpM.canIUse(N.GRP_COUNTER)?(t="".concat(this._n,".").concat("setGroupCounters"),n=e.groupID,e=e.counters,e=this._convertObjectToList(e),i=this._getLocalGroupCounters(n).avChatRoomKey,o="groupID:".concat(n," count:").concat(e.length),(s=new oi("setGroupCounters")).setMessage("".concat(o)),be.l("".concat(t,". ").concat(o)),this._updateGroupCounters({groupID:n,counterList:e,avChatRoomKey:i,mode:"Set"}).then((function(e){return s.end(),be.l("".concat(t," ok.")),Cn({counters:e})})).catch((function(e){return s.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._grpM.noUse("setGroupCounters")}},{key:"increaseGroupCounter",value:function(e){var t,n,i,o,s,a,r="increaseGroupCounter";return this._grpM.canIUse(N.GRP_COUNTER)?(t="".concat(this._n,".").concat(r),n=e.groupID,i=e.key,e=e.value,o=this._getLocalGroupCounters(n).avChatRoomKey,s="groupID:".concat(n," key:").concat(i," value:").concat(e),(a=new oi(r)).setMessage("".concat(s)),be.l("".concat(t,". ").concat(s)),this._updateGroupCounters({groupID:n,counterList:[{key:i,value:e}],avChatRoomKey:o,mode:"Increase"}).then((function(e){return a.end(),be.l("".concat(t," ok.")),Cn({counters:e})})).catch((function(e){return a.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._grpM.noUse(r)}},{key:"decreaseGroupCounter",value:function(e){var t,n,i,o,s,a,r="decreaseGroupCounter";return this._grpM.canIUse(N.GRP_COUNTER)?(t="".concat(this._n,".").concat(r),n=e.groupID,i=e.key,e=e.value,o=this._getLocalGroupCounters(n).avChatRoomKey,s="groupID:".concat(n," key:").concat(i," value:").concat(e),(a=new oi(r)).setMessage("".concat(s)),be.l("".concat(t,". ").concat(s)),this._updateGroupCounters({groupID:n,counterList:[{key:i,value:e}],avChatRoomKey:o,mode:"Decrease"}).then((function(e){return a.end(),be.l("".concat(t," ok.")),Cn({counters:e})})).catch((function(e){return a.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._grpM.noUse(r)}},{key:"getGroupCounters",value:function(e){var t=this;if(!this._grpM.canIUse(N.GRP_COUNTER))return this._grpM.noUse("getGroupCounters");var n="".concat(this._n,".").concat("getGroupCounters"),i=e.groupID,o=void 0===(e=e.keyList)?[]:e,s=(e=this._getLocalGroupCounters(i)).avChatRoomKey,a=(e=e.lastUpdateTime,new oi("getGroupCounters"));return a.setMessage("groupID:".concat(i)),Date.now()-e>=this.EXPIRE_TIME?this._getRemoteGroupCounters({groupID:i,avChatRoomKey:s}).then((function(e){return a.setMoreMessage("from remote. count:".concat(e.length)).end(),be.l("".concat(n," from remote. groupID:").concat(i)),Cn({counters:e=t._getLocalCounters(i,o)})})).catch((function(e){return a.setError(e).end(),En(e)})):(a.setMoreMessage("from cache").end(),be.l("".concat(n," from cache. groupID:").concat(i)),Sn({counters:e=this._getLocalCounters(i,o)}))}},{key:"_getRemoteGroupCounters",value:function(e){var t=this;return this._grpM.req({P:jn.GET_GRP_COUNTER,data:g({},e)}).then((function(n){var i=void 0===(i=(n=n.data).counterList)?[]:i;return n=n.groupCounterSeq,t._updateLocalGroupCounters({groupID:e.groupID,counterList:i,groupCounterSeq:n}),be.l("".concat(t._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),i})).catch((function(e){return En(e)}))}},{key:"_convertObjectToList",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_updateGroupCounters",value:function(e){var t="".concat(this._n,"._updateGroupCounters"),n=e.groupID,i=e.avChatRoomKey,o=e.mode;return be.l("".concat(t,". groupID:").concat(n," avChatRoomKey:").concat(i," mode:").concat(o)),this._grpM.req({P:jn.UPDATE_GRP_COUNTER,data:g({},e)}).then((function(e){be.l("".concat(t," ok.")),e=e.data.counterList;var n={};return(void 0===e?[]:e).forEach((function(e){var t=e.key;e=e.value,n[t]=e})),n})).catch((function(e){return En(e)}))}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var t,n,i,o=e.groupID,s=void 0===(s=e.counterList)?[]:s;e=e.groupCounterSeq,this._hasLocalGroupCounters(o)&&(i=this._getLocalGroupCounters(o),t=i.counters,n=i.avChatRoomKey,i=i.groupCounterSeq,0<e&&e<i||(s.forEach((function(e){var n=e.key;e=e.value,t.set(n,e)})),this._groupCountersMap.set(o,{lastUpdateTime:Date.now(),groupCounterSeq:e,counters:t,avChatRoomKey:n})))}},{key:"_deleteLocalGroupCounters",value:function(e){var t,n,i=e.groupID,o=void 0===(o=e.counterList)?[]:o;e=e.groupCounterSeq,this._hasLocalGroupCounters(i)&&(n=this._getLocalGroupCounters(i),t=n.counters,n=n.avChatRoomKey,o.forEach((function(e){t.delete(e.key)})),this._groupCountersMap.set(i,{lastUpdateTime:Date.now(),groupCounterSeq:e,counters:t,avChatRoomKey:n}))}},{key:"_getLocalCounters",value:function(e,t){var n={};if(this._hasLocalGroupCounters(e)){var i=this._getLocalGroupCounters(e).counters;if(0<t.length)t.forEach((function(e){i.has(e)&&(n[e]=i.get(e))}));else{var o,s=a(i.keys());try{for(s.s();!(o=s.n()).done;){var r=o.value;n[r]=i.get(r)}}catch(c){s.e(c)}finally{s.f()}}}return n}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),no=s((function e(t){i(this,e);var n=t.manager,o=t.groupID,s=t.onInit,a=t.onSuccess;t=t.onFail,this._n="Polling",this._manager=n,this._grpM=n._grpM,this._onInit=s,this._onSuccess=a,this._onFail=t,this._groupID=o,this._timeoutID=-1,this._isRunning=!1,this._proto=jn.AV_POLLING}),[{key:"start",value:function(){var e=this._grpM.isLoggedIn();e||(this._proto=jn.AV_NOAUTH_POLLING),be.l("".concat(this._n,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(e)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var e=this,t=this._onInit(this._groupID);this._grpM.req({P:this._proto,data:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(-1<e._timeoutID&&clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(-1<e._timeoutID&&clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:"stop",value:function(){be.l("".concat(this._n,".stop")),-1<this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:"getPollingTimerID",value:function(){return this._timeoutID}}]),io={3:!0,4:!0,5:!0,6:!0,17:!0,20:!0,21:!0,100:!0},oo=s((function e(t){i(this,e),this._grpM=t,this._n="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this._seqSll=new Hi(200),this._IDSll=new Hi(100),this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}),[{key:"hasJoinedAVChatRoom",value:function(){var e=[];return 0<(e=0<this._joinedGroupMap.size?v(this._joinedGroupMap.values()).filter((function(e){return e.type===E.GRP_AVCHATROOM})):e).length}},{key:"getJoinedLiveList",value:function(){var e=[];return 0<this._joinedGroupMap.size?v(this._joinedGroupMap.values()).filter((function(e){return e.type===E.GRP_LIVE})):e}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return 0<this._joinedGroupMap.size?v(this._joinedGroupMap.keys()):[]}},{key:"_updatedata",value:function(e){var t=this._pollingRequestInfoMap.get(e);return e===v(this._pollingInstanceMap.keys())[0]?g(g({},t),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):g(g({},t),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(e,t){var n,i=(c=t.data).key,o=c.nextSeq,s=c.rspMsgList,a=c.errorCode,r=c.nextBroadcastSeq,c=c.broadcastMessageList;0!==a?(a=this._pollingRequestInfoMap.get(e),n=new oi("longPollingAVError"),a=a?"".concat(a.key,"-").concat(a.startSeq):"requestInfo is undefined",n.setMessage("".concat(e,"-").concat(a,"-").concat(t.errorInfo)).setCode(t.errorCode).end(!0)):this.checkJoinedAVChatRoomByID(e)&&(ut(i)&&Ke(o)&&this._pollingRequestInfoMap.set(e,{key:i,startSeq:o}),Ke(r)&&r>this._startBroadcastSeq&&(this._startBroadcastSeq=r),Ye(s)&&0<s.length?(s.forEach((function(e){e.to=e.groupID})),this.onMessage(s,e)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(c))}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e,t){if(Ye(e)&&0!==e.length){var n="".concat(this._n,".onMessage"),i=(t&&(n+=" groupID:".concat(t)),0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL),null),o=[],s=this._get(11),a=this._get(26),r=e.length,c=(1<r&&e.sort((function(e,t){return e.sequence-t.sequence})),this._get(12).isUnlimitedAVChatRoom()),u=!1;be.getLevel()<=0&&(t=e.map((function(e){return e.sequence})),be.l("".concat(n," count:").concat(t.length," sequenceList:").concat(t)),t.length=0);for(var l=0;l<r;l++){var d=this.restoreMessageFromSimplified(e[l]);if(io[d.event]){if(6===d.event){if(this._grpM.isGroupAttributesUpdatedNotice(d))continue;if(this._grpM.isGroupCountersNotice(d))continue}if(20!==d.event)if(21!==d.event)if(100!==d.event){i=this.packMessage(d,d.event);var p=1===d.isModified;if(u=1===d.isHistoryMessage,!c){if(this._seqSll.has(i.sequence))continue;this._seqSll.set(i.sequence)}var h=this._IDSll.has(i.ID);h?be.w("".concat(n," ID:").concat(i.ID," has:").concat(h)):(this._IDSll.set(i.ID),h=!1,!u&&this._isMessageSentByCurrentInstance(i)?p&&(h=!0,i.isModified=p,s.updateMsgIsModifiedProp(i)):h=!0,h&&(i.conversationType===E.CONV_SYSTEM&&5===i.payload.operationType&&this._onGroupDismissed(i.payload.groupProfile.groupID),u||i.conversationType===E.CONV_SYSTEM||(p=i.conversationID.replace(E.CONV_GROUP,""),this._pollingInstanceMap.has(p)?this._grpM.isLoggedIn()&&a.addMessageSequence({key:Zn,message:i}):(i.type!==E.MSG_GRP_TIP&&0<i.clientTime&&a.addMessageDelay(i.clientTime),a.addMessageSequence({key:Qn,message:i}))),o.push(i)))}else this.onRoomCustomData(d);else this._get(34).onMessageReactionNotify({event:21,dataList:d.elements.messageReactionNotifyList});else this.handleMessageRevokedNotice(d)}else be.w("".concat(n,". unknown event:").concat(d.event))}0!==o.length&&(0<(t=vt(o)).length&&this._grpM.emitOEvt(S.MESSAGE_MODIFIED,t),u||0<(t=this.packConversationOption(o)).length&&s.onNewMessage({conversationOptionsList:t,isInstantMessage:!0}),this._checkMessageStacked(o),0<(t=It(o)).length&&this._grpM.emitOEvt(S.MESSAGE_RECEIVED,t),o.length=0)}}},{key:"handleMessageRevokedNotice",value:function(e){var t=this,n=e.groupID,i=e.elements.revokeMsgList,o=e.revokerInfo,s=[];i.forEach((function(e){var t=e.tinyID,i=e.clientTime,a=e.random;e=e.sequence,t={conversationID:"".concat(E.CONV_GROUP).concat(n),ID:"".concat(t,"-").concat(i,"-").concat(a),revoker:o.revoker,revokeReason:o.reason||"",revokerInfo:{userID:o.revoker,nick:"",avatar:""},sequence:e},s.push(t)})),0!==s.length&&this._get(11).updateRevokerInfo(s).then((function(e){t._grpM.emitOEvt(S.MESSAGE_REVOKED,e)}))}},{key:"isBroadcastOrNormal",value:function(e){return 3===e||17===e}},{key:"isGroupTip",value:function(e){return 4===e||6===e}},{key:"isGroupSystemNotice",value:function(e){return 5===e}},{key:"restoreGroupTipElements",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=void 0===(t=e.operatorInfo)?{}:t,n=e.operatorID,i=void 0===(i=e.userIDList)?[]:i,o=e.operationType,s=(Ke(e.groupJoinType)||1!==o&&2!==o||(e.groupJoinType=2===o?0:1),o=t.userID,t.avatar);return t=t.nick,e.operatorInfo={userID:void 0===o?n:o,avatar:void 0===s?"":s,nick:void 0===t?"":t},n=i.map((function(e){return{userID:e}})),e.memberInfoList=e.memberInfoList||n,e}},{key:"restoreMessageFromSimplified",value:function(e){var t,n,i,o=e.event;return this.isBroadcastOrNormal(o)&&(e.cloudCustomData=e.cloudCustomData||"",e.elements=e.elements.map((function(e){var t;return e.type===E.MSG_CUSTOM&&(t=e.content,e.content=g({data:"",description:"",extension:""},void 0===t?{}:t)),e}))),(this.isGroupTip(o)||this.isGroupSystemNotice(o))&&(e.from=e.from||"@TIM#SYSTEM"),this.isGroupTip(o)&&(e.elements=this.restoreGroupTipElements(e.elements),n=(i=void 0===(i=e.elements)?{}:i).operationType,t=i.operatorInfo,1===n)&&(n=[{userID:(void 0===t?{}:t).userID}],i.memberInfoList=i.memberInfoList||n),this.isGroupSystemNotice(o)&&(i=(t=e.elements).memberInfoList,n=t.operatorInfo,e.elements.memberInfoList=g({userID:e.elements.operatorID,avatar:"",nick:""},i=i||(void 0===n?{}:n)),e.elements=g({authentication:"",remarkInfo:"",messageKey:1e3*e.time},e.elements),o=Object.keys(e.elements).filter((function(e){return"operatorInfo"!==e})).reduce((function(t,n){return g(g({},t),{},r({},n,e.elements[n]))}),{}),e.elements=o),e}},{key:"_onGroupDismissed",value:function(e){be.l("".concat(this._n,"._onGroupDismissed groupID:").concat(e)),this._grpM.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t="MessageStacked";100<=(e=e.length)&&(this._grpM.warn(t,e),this._reportMessageStackedCount<5)&&(new oi(t).setMessage("count:".concat(e," groupID:").concat(v(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1)}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._get(11).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._grpM.getMyUserID(),e.conversationType=5===t?E.CONV_SYSTEM:E.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new ki(e),i=(e=this.packElements(e,t),t=this._grpM.getFileDownloadProxy(),this._grpM.getDownloadFileAuthKey()),o=this._get(17).getFileDNList();return n.setElement(e,t,i,o),n}},{key:"packElements",value:function(e,t){return 4===t||6===t?(this._updateMemberCountByGroupTips(e),{type:E.MSG_GRP_TIP,content:g(g({},e.elements),{},{groupProfile:e.groupProfile})}):5===t?{type:E.MSG_GRP_SYS_NOTICE,content:g(g({},e.elements),{},{groupProfile:g(g({},e.groupProfile),{},{groupID:e.groupID})})}:e.elements}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n<e.length;n++){var i,o=e[n],s=o.conversationID;t.has(s)?"in"===((i=t.get(s)).lastMessage=o).flow&&i.unreadCount++:t.set(s,{conversationID:o.conversationID,unreadCount:"out"===o.flow?0:1,type:o.conversationType,subType:o.conversationSubType,lastMessage:o})}return v(t.values())}},{key:"_updateMemberCountByGroupTips",value:function(e){var t,n,i,o=e.groupProfile.groupID;qe(e=void 0===(e=e.elements.onlineMemberInfo)?void 0:e)||(t=void 0===(t=e.onlineMemberNum)?0:t,e=void 0===(e=e.expireTime)?this.DEFAULT_EXPIRE_TIME:e,n=this._onlineMemberCountMap.get(o)||{},i=Date.now(),qe(n)?Object.assign(n,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:i,memberCount:t,expireTime:e}):(n.latestUpdateTime=i,n.memberCount=t),this._onlineMemberCountMap.set(o,n))}},{key:"_onBroadcastMessage",value:function(e){if(!qe(e)){for(var t=[],n=e.length,i=null,o=0;o<n;o++){var s=this.restoreMessageFromSimplified(e[o]);io[s.event]?((i=this.packMessage(s,s.event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(i.ID)||(t.push(i),this._broadcastMessageIDMap.set(i.ID,1))):be.w("".concat(this._n,"._onBroadcastMessage unknown event:").concat(s.event))}0<t.length&&this._grpM.emitOEvt(S.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){var t;this._pollingInstanceMap.has(e)?(t=this._pollingInstanceMap.get(e)).isRunning()||t.start():((t=new no({manager:this,groupID:e,onInit:this._updatedata.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)})).start(),this._pollingInstanceMap.set(e,t),be.l("".concat(this._n,".start groupID:").concat(e)))}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck(e.group).then((function(){var n=e.longPollingKey,i=e.group,o=i.groupID;return t._joinedGroupMap.set(o,i),t._grpM.updateGroupMap([i]),t._grpM.deleteUnjoinedAVChatRoom(o),t._grpM.emitGroupListUpdate(!0,!1),lt(n)?Sn({status:Ge,group:i}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,i=e.group,o=e.startSeq,s=i.groupID;return t._pollingRequestInfoMap.set(s,{key:n,startSeq:void 0===o?0:o}),t.start(s),t._grpM.isLoggedIn()?Sn({status:Ge,group:i}):Sn({status:Ge})}))}},{key:"_preCheck",value:function(e){if(!this._get(12).isUnlimitedAVChatRoom()&&this.hasJoinedAVChatRoom()&&e.type!==E.GRP_LIVE){var t=(e=_(this._joinedGroupMap.entries().next().value,2))[0];if(e=e[1],this._grpM.isLoggedIn()&&e.selfInfo.role!==E.GRP_MBR_ROLE_OWNER&&e.ownerID!==this._grpM.getMyUserID())return this._grpM.quitGroup(t);this._grpM.deleteLocalGroupAndConversation(t),this.reset(t)}return Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,i="".concat(this._n,".").concat("joinWithoutAuth"),o=new oi("joinWithoutAuth");return this._grpM.req({P:jn.APPLY_JOIN_GRP_NOAUTH,data:e}).then((function(e){if(e=e.data.longPollingKey,o.setMessage("groupID:".concat(n," longPollingKey:").concat(e)).end(!0),lt(e))return En({code:qn.CANNOT_JOIN_NON_AV_WITHOUT_LOGIN});be.l("".concat(i," ok. groupID:").concat(n)),t._get(11).setCompleted("".concat(E.CONV_GROUP).concat(n));var s=new zi({groupID:n});return t.startRunLoop({group:s,longPollingKey:e}),Cn({status:Ge})})).catch((function(e){return be.e("".concat(i," failed. groupID:").concat(n," error:"),e),o.setError(e).setMessage("groupID:".concat(n)).end(!0),En(e)})).finally((function(){t._grpM.get(14).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return qe(t)||n-t.lastSyncTime>1e3*t.expireTime&&1e4<n-t.latestUpdateTime&&3e3<n-t.lastReqTime?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return Cn({memberCount:e.memberCount})})).catch((function(e){return En(e)}))):Sn({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".").concat("_getGroupOnlineMemberCount"),i=new oi("_getGroupOnlineMemberCount");return this._grpM.requestOnlineCount(e).then((function(i){var o=t._onlineMemberCountMap.get(e)||{},s=void 0===(s=(i=i.data).memberCount)?0:s,a=(i=void 0===(i=i.expireTime)?t.DEFAULT_EXPIRE_TIME:i,be.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(s," expireTime:").concat(i)),Date.now());return qe(o)&&(o.lastReqTime=a),t._onlineMemberCountMap.set(e,Object.assign(o,{lastSyncTime:a,latestUpdateTime:a,memberCount:s,expireTime:i})),{memberCount:s}})).catch((function(t){return be.w("".concat(n," failed. error:"),t),i.setCode(t.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(t))).end(),Promise.reject(t)}))}},{key:"_get",value:function(e){return this._grpM.get(e)}},{key:"setPollingInterval",value:function(e){lt(e)||(Ke(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){lt(e)||(Ke(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){lt(e)||(Ke(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"setPollingSimplifiedMessage",value:function(e){lt(e)||"0"!==e&&"1"!==e||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"onAVChatRoomMemberBanned",value:function(e){e=e.payload.groupProfile.groupID,be.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(e)),this._grpM.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"restartPolling",value:function(){be.l("".concat(this._n,".restartPolling count:").concat(this._pollingInstanceMap.size));var e,t=a(this._pollingInstanceMap.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.stop(),n.start()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getPollingTimerID",value:function(e){var t;return this._pollingInstanceMap.has(e)?(t=this._pollingInstanceMap.get(e).getPollingTimerID(),be.l("".concat(this._n,".getPollingTimerID groupID:").concat(e," timerID:").concat(t)),t):-1}},{key:"hasPollingInstance",value:function(e){return this._pollingInstanceMap.has(e)}},{key:"onRoomCustomData",value:function(e){var t=e.groupID,n=e.sequence,i=e.time;e=(e=e.elements)&&e.content,this._get(30).onRoomCustomDataReceived(e),be.l("".concat(this._n,".onRoomCustomData groupID:").concat(t," sequence:").concat(n," time:").concat(i," data:").concat(e))}},{key:"reset",value:function(e){if(e){be.l("".concat(this._n,".reset groupID:").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{be.l("".concat(this._n,".reset all"));var n,i=a(this._pollingInstanceMap.values());try{for(i.s();!(n=i.n()).done;)n.value.stop()}catch(o){i.e(o)}finally{i.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this._seqSll.reset(),this._IDSll.reset(),this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),so=s((function e(t){i(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this.isOnline=!1,this.updateMember(t)}),[{key:"updateMember",value:function(e){lt(e.onlineStatus)||(this.isOnline="Online"===e.onlineStatus);var t=[null,void 0,"",0,NaN];e.memberCustomField&&_t(this.memberCustomField,e.memberCustomField),Ze(this,e,["memberCustomField","marks","onlineStatus"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){lt(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){lt(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&_t(this.memberCustomField,e)}}]),ao=s((function e(t){i(this,e),this._grpM=t,this._n="GroupMemberHandler",this.groupMemberListMap=new Map,this.DEFAULT_MEMBER_INFO_FILTER=["Role","JoinTime","NameCard","ShutUpUntil","OnlineStatus"],this._grpM.getIEmitInst().on(Ni.PROFILE_UPDATED,this._onProfileUpdated,this)}),[{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,i=0;i<n.length;i++)!function(){var e=n[i];t.groupMemberListMap.forEach((function(t){t.has(e.userID)&&t.get(e.userID).updateMember({nick:e.nick,avatar:e.avatar})}))}()}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(e){var t,n=this,i=e.groupID,o=void 0===(o=e.role)?void 0:o,s=void 0===(c=e.offset)?0:c,a=void 0===(c=e.count)?15:c,r=(e=void 0===(c=e.filter)?void 0:c,"".concat(this._n,".").concat("getGroupMemberList")),c=this._grpM.hasLocalGroup(i);if(be.l("".concat(r," groupID:").concat(i," role:").concat(o," offset:").concat(s," count:").concat(a," hasLocalGroup:").concat(c)),!c)return Sn({memberList:[],offset:0});if(this._grpM.getLocalGroupProfile(i).type===E.GRP_AVCHATROOM){if(this._grpM.canIUse(N.AV_MBR_LIST))return this._getAVChatRoomMemberList({groupID:i,offset:s,filter:e});this._grpM.warn("LiveOnlineMember")}o!==E.GRP_MBR_ROLE_ADMIN&&o!==E.GRP_MBR_ROLE_OWNER&&o!==E.GRP_MBR_ROLE_MEMBER||(t=o);var u=new oi("getGroupMemberList"),l=0,d=(c={groupID:i,limit:100<a?100:a,memberRoleFilter:t?[t]:void 0,memberInfoFilter:this.DEFAULT_MEMBER_INFO_FILTER},Ct({groupID:i})?c.next="".concat(s):l=(c.offset=s)+a,[]);return this._grpM.req({P:jn.GET_GRP_MBR_LIST,data:c}).then((function(e){var t=(e=e.data).members,o=e.memberNum;return e=e.next,lt(e=void 0===e?void 0:e)||(l=qe(e)?0:e),Ye(t)&&0!==t.length?(n._grpM.hasLocalGroup(i)&&(n._grpM.getLocalGroupProfile(i).memberNum=o),d=n._updateLocalGroupMemberMap(i,t),n._grpM.get(4).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Le.NICK,Le.AVATAR]})):(l=0,Promise.resolve([]))})).then((function(e){return Ye(e=e.data)&&0!==e.length?(e=e.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}})),n._updateLocalGroupMemberMap(i,e),d.length<a&&(l=0),u.setMessage("groupID:".concat(i," offset:").concat(s," count:").concat(a)).end(),be.l("".concat(r," ok.")),Cn({memberList:d,offset:l})):Sn({memberList:[],offset:l})})).catch((function(e){return u.setError(e).end(),be.e("".concat(r," failed. error:"),e),En(e)}))}},{key:"_getAVChatRoomMemberList",value:function(e){var t=this,n=e.groupID,i=e.offset,o=(e=e.filter,"".concat(this._n,".").concat("_getAVChatRoomMemberList")),s=new oi("_getAVChatRoomMemberList");return s.setMessage("groupID:".concat(n," offset:").concat(i," filter:").concat(e)),this._grpM.req({P:jn.GET_AV_MBR_LIST,data:{groupID:n,offset:i,filter:e}}).then((function(e){var i=void 0===(i=(e=e.data).memberList)?[]:i;return e=void 0===(e=e.offset)?0:e,s.end(),be.l("".concat(o," ok. member count:").concat(i.length,", next request timestamp:").concat(e)),i=i.map((function(e){return g(g({},e),{},{onlineStatus:"Online"})})),Cn({memberList:i=t._updateLocalGroupMemberMap(n,i),offset:e})})).catch((function(e){return s.setError(e).end(),be.e("".concat(o," failed. error:"),e),En(e)}))}},{key:"getGroupMemberProfile",value:function(e){var t,n=this,i="getGroupMemberProfile",o="".concat(this._n,".").concat(i),s="groupID:".concat(e.groupID),a=(5<e.userIDList.length?s+=" userIDList.length:".concat(e.userIDList.length):s+=" userIDList:".concat(e.userIDList),be.l("".concat(o," ").concat(s)),50<e.userIDList.length&&(e.userIDList=e.userIDList.slice(0,50)),e.groupID),r=e.userIDList;return(o=this._grpM.getLocalGroupProfile(a))&&Mt(o.type)?En({code:o=qn.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(o,i)}):((t=new oi(i)).setMessage(s),this._getGroupMemberProfileAdvance(g(g({},e),{},{userIDList:r})).then((function(e){return Ye(e=e.data.members)&&0!==e.length?(n._updateLocalGroupMemberMap(a,e),n._grpM.get(4).getUserProfile({userIDList:e.map((function(e){return e.userID})),tagList:[Le.NICK,Le.AVATAR]})):Sn([])})).then((function(e){return e=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}})),n._updateLocalGroupMemberMap(a,e),e=r.filter((function(e){return n.hasLocalGroupMember(a,e)})).map((function(e){return n.getLocalGroupMemberInfo(a,e)})),t.end(),Cn({memberList:e})})))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("addGroupMember"),i=e.groupID,o=this._grpM.getLocalGroupProfile(i),s=o.type,a=new oi("addGroupMember");return a.setMessage("groupID:".concat(i," groupType:").concat(s)),Mt(s)?(s=new Bn({code:qn.CANNOT_ADD_MEMBER_IN_AV}),a.setError(s).end(),En(s)):(e.userIDList=e.userIDList.map((function(e){return{userID:e}})),be.l("".concat(n," groupID:").concat(i)),this._grpM.req({P:jn.ADD_GRP_MBR,data:e}).then((function(i){i=i.data.members;var s=(be.l("".concat(n," ok")),i.filter((function(e){return 1===e.result})).map((function(e){return e.userID}))),r=i.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),c=i.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),u=(i=i.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),"groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(s,", ")+"failureUserIDList:".concat(r,", ")+"existedUserIDList:".concat(c,", ")+"overLimitUserIDList:".concat(i));return a.setMoreMessage(u).end(),0===s.length?Cn({successUserIDList:s,failureUserIDList:r,existedUserIDList:c,overLimitUserIDList:i}):(t._updateConvGroupProfile(o),Cn({successUserIDList:s,failureUserIDList:r,existedUserIDList:c,overLimitUserIDList:i,group:o}))})).catch((function(e){return a.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)})))}},{key:"deleteGroupMember",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("deleteGroupMember"),s=e.groupID,a=e.userIDList,r=this._grpM.getLocalGroupProfile(s);return lt(r)?En({code:qn.CANNOT_FIND_GRP}):Mt(r.type)?this._grpM.canIUse(N.AV_BAN_MBR)?this._banAVChatRoomMember(e):this._grpM.noUse("deleteGroupMember"):(t="groupID:".concat(s," ").concat(5<a.length?"userIDList.length:".concat(a.length):"userIDList:".concat(a)),be.l("".concat(o," groupID:").concat(s," userIDList:"),a),(n=new oi("deleteGroupMember")).setMessage(t),this._grpM.req({P:jn.DEL_GRP_MBR,data:e}).then((function(){return n.end(),be.l("".concat(o," ok")),i._updateConvGroupProfile(r),i.deleteLocalGroupMembers(s,a),Cn({group:r,userIDList:a})})).catch((function(e){return n.setError(e).end(),be.e("".concat(o," failed. error:"),e),En(e)})))}},{key:"_updateConvGroupProfile",value:function(e){this._grpM.get(11).updateConvGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,n="".concat(this._n,".").concat("_banAVChatRoomMember"),i=e.groupID,o=e.userIDList,s="groupID:".concat(i," ").concat(5<o.length?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),a=new oi("_banAVChatRoomMember"),r=(a.setMessage(s),be.l("".concat(n," groupID:").concat(i," userIDList:"),o),this._grpM.getLocalGroupProfile(i));return lt(e.duration)||0===e.duration?En({code:qn.BAN_DURATION_INVALID}):this._grpM.req({P:jn.BAN_AV_MBR,data:e}).then((function(){return a.end(),be.l("".concat(n," ok")),t.deleteLocalGroupMembers(i,o),Cn({group:r,userIDList:o})})).catch((function(e){return a.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"setGroupMemberMuteTime",value:function(e){var t,n,i=this,o=e.groupID,s=e.userID,a=(e=e.muteTime,"".concat(this._n,".").concat("setGroupMemberMuteTime"));return s===this._grpM.getMyUserID()?En({code:qn.CANNOT_MUTE_SELF}):(t="groupID:".concat(o," userID:").concat(s," muteTime:").concat(e),be.l("".concat(a," ").concat(t)),(n=new oi("setGroupMemberMuteTime")).setMessage(t),this.modifyGroupMemberInfo({groupID:o,userID:s,muteTime:e}).then((function(e){return n.end(),be.l("".concat(a," ok")),Cn({group:i._grpM.getLocalGroupProfile(o),member:e})})).catch((function(e){return n.setError(e).end(),be.e("".concat(a," failed. error:"),e),En(e)})))}},{key:"setGroupMemberRole",value:function(e){var t,n,i="".concat(this._n,".").concat("setGroupMemberRole"),o=e.groupID,s=e.userID,a=(e=e.role,"groupID:".concat(o," userID:").concat(s," role:").concat(e)),r=this._grpM.getLocalGroupProfile(o);return r&&r.selfInfo.role!==E.GRP_MBR_ROLE_OWNER?En({code:qn.NOT_OWNER}):(t=[E.GRP_MBR_ROLE_ADMIN,E.GRP_MBR_ROLE_MEMBER],Ct({groupID:o})&&t.push(E.GRP_MBR_ROLE_CUSTOM),t.indexOf(e)<0?En({code:qn.INVALID_MEMBER_ROLE}):s===this._grpM.getMyUserID()?En({code:qn.CANNOT_SET_SELF_MEMBER_ROLE}):((n=new oi("setGroupMemberRole")).setMessage(a),be.l("".concat(i," ").concat(a)),this.modifyGroupMemberInfo({groupID:o,userID:s,role:e}).then((function(e){return n.end(),be.l("".concat(i," ok")),Cn({group:r,member:e})})).catch((function(e){return n.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)}))))}},{key:"_filterProfanity",value:function(e,t){var n,i=this._grpM.get(29);return!i||(n=(i=i.filterText(t[e],"group_member_profile")).isAllowedToSend,i=i.modifiedText,!0===n&&(t[e]=i,!0))}},{key:"setGroupMemberNameCard",value:function(e){var t,n,i,o,s,a=this,r="setGroupMemberNameCard",c="".concat(this._n,".").concat(r);return e.nameCard&&!1===this._filterProfanity("nameCard",e)?En({code:qn.PROFANITY_FOUND}):(t=e.groupID,o=e.userID,n=void 0===o?this._grpM.getMyUserID():o,i=e.nameCard,o="groupID:".concat(t," userID:").concat(n," nameCard:").concat(i),be.l("".concat(c," ").concat(o)),(e=this._grpM.getLocalGroupProfile(t))&&Mt(e.type)?En({code:e=qn.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(e,r)}):((s=new oi(r)).setMessage(o),this.modifyGroupMemberInfo({groupID:t,userID:n,nameCard:i}).then((function(e){be.l("".concat(c," ok")),s.end();var o=a._grpM.getLocalGroupProfile(t);return n===a._grpM.getMyUserID()&&o&&o.setSelfNameCard(i),Cn({group:o,member:e})})).catch((function(e){return s.setError(e).end(),be.e("".concat(c," failed. error:"),e),En(e)}))))}},{key:"setGroupMemberCustomField",value:function(e){var t,n=this,i="setGroupMemberCustomField",o="".concat(this._n,".").concat(i),s=e.groupID,a=void 0===(a=e.userID)?this._grpM.getMyUserID():a,r=(e=e.memberCustomField,"groupID:".concat(s," userID:").concat(a," memberCustomField:").concat(JSON.stringify(e))),c=(be.l("".concat(o," ").concat(r)),this._grpM.getLocalGroupProfile(s));return c&&Mt(c.type)?En({code:c=qn.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(c,i)}):((t=new oi(i)).setMessage(r),this.modifyGroupMemberInfo({groupID:s,userID:a,memberCustomField:e}).then((function(e){return t.end(),be.l("".concat(o," ok")),Cn({group:n._grpM.getLocalGroupProfile(s),member:e})})).catch((function(e){return t.setError(e).end(),be.e("".concat(o," failed. error:"),e),En(e)})))}},{key:"modifyGroupMemberInfo",value:function(e){var t=this,n=e.groupID,i=e.userID,o=void 0;return St(n)&&(n=xt(o=n)),this._grpM.req({P:jn.MODIFY_GRP_MBR_INFO,data:g(g({},e),{},{groupID:n,topicID:o})}).then((function(){var o;return t.hasLocalGroupMember(n,i)?(o=t.getLocalGroupMemberInfo(n,i),lt(e.muteTime)||o.updateMuteUntil(e.muteTime),lt(e.role)||o.updateRole(e.role),lt(e.nameCard)||o.updateNameCard(e.nameCard),lt(e.memberCustomField)||o.updateMemberCustomField(e.memberCustomField),o):(o=t._grpM.getLocalGroupProfile(n))&&!Mt(o.type)?t.getGroupMemberProfile({groupID:n,userIDList:[i]}).then((function(e){return _(e.data.memberList,1)[0]})):void 0}))}},{key:"markGroupMemberList",value:function(e){var t="".concat(this._n,".").concat("markGroupMemberList"),n=e.groupID,i=e.markType,o=e.enableMark,s=void 0===(e=e.userIDList)?[]:e,a=(e="groupID:".concat(n," markType:").concat(i," enableMark:").concat(o," userIDList count:").concat(s.length),be.l("".concat(t," ").concat(e)),2),r=[],c=(!0===o&&(a=1),o=v(s),500<s.length&&(o=s.slice(0,500),be.w("".concat(t," ").concat(jt(500)))),o.forEach((function(e){r.push({userID:e,markType:[i]})})),o=null,new oi("markGroupMemberList"));return c.setMessage(e),this._grpM.req({P:jn.MARK_AV_MBR_INFO,data:{groupID:n,operationType:a,memberList:r}}).then((function(e){e=e.data.memberList;var n=[],i=[];return(e=void 0===e?[]:e).length===s.length?n.push.apply(n,v(s)):(e.forEach((function(e){n.push(e.userID)})),s.forEach((function(e){n.includes(e)||i.push(e)}))),e="success count:".concat(n.length," fail count:").concat(i.length),c.setMessage(e).end(),be.l("".concat(t," ok. ").concat(e)),Cn({successUserIDList:n,failureUserIDList:i})})).catch((function(e){return c.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this._grpM.req({P:jn.GET_GRP_MBR_PROFILE,data:g(g({},e),{},{memberInfoFilter:e.memberInfoFilter||this.DEFAULT_MEMBER_INFO_FILTER})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return Ye(t)&&0!==t.length?t.map((function(t){return n.hasLocalGroupMember(e,t.userID)?n.getLocalGroupMemberInfo(e,t.userID).updateMember(t):n.setLocalGroupMember(e,new so(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).set(t.userID,t):(t=(new Map).set(t.userID,t),this.groupMemberListMap.set(e,t))}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),ro=[17,18,20],co=s((function e(t){i(this,e),this._grpM=t,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map}),[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,i=(e=e.isInstantMessage,(be.d("".concat(this._n,".onReceiveSystemNotice count:").concat(t.length)),t=this._assembly({notifiesList:t,isInstantMessage:e})).eventDataList);t=t.result,0<i.length&&(this._grpM.get(11).onNewMessage({conversationOptionsList:i,isInstantMessage:e}),this._onReceivedGroupSystemNotice({result:t,isInstantMessage:e})),e?0<t.length&&this._grpM.emitOEvt(S.MESSAGE_RECEIVED,t):!0===n&&this._clearGroupSystemNotice()}},{key:"_assembly",value:function(e){var t=e.notifiesList,n=e.isInstantMessage,i=null,o=t.length,s=0,a=[],r={conversationID:E.CONV_SYSTEM,unreadCount:0,type:E.CONV_SYSTEM,subType:null,lastMessage:null};for(s=0;s<o;s++){var c=t[s],u=(l=c.groupProfile).communityType,l=void 0===(l=l.topicID)?void 0:l,d=void 0===(d=(p=c.elements).topicIDList)?void 0:d,p=p.operationType;if(!(2!==(void 0===u?0:u)||qe(l)&&qe(d))){if(ro.includes(p)){this._handleTopicSystemNotice(c);continue}qe(l)||(c.to=l)}15!==c.elements.operationType&&(c.currentUser=this._grpM.getMyUserID(),c.conversationType=E.CONV_SYSTEM,c.conversationID=E.CONV_SYSTEM,(i=new ki(c)).setElement({type:E.MSG_GRP_SYS_NOTICE,content:g(g({},c.elements),{},{groupProfile:g({},c.groupProfile)})}),i.isSystemMessage=!0,(1===i.sequence&&1===i.random||2===i.sequence&&2===i.random)&&(i.sequence=it(),i.random=it(),i.generateMessageID(),be.l("".concat(this._n,"._assembly regenerate ID:").concat(i.ID))),this._grpM.get(11).pushIntoNoticeResult(a,i))&&(n?r.unreadCount++:i.setIsRead(!0),r.subType=i.conversationSubType)}return r.lastMessage=a[a.length-1],{eventDataList:0<a.length?[r]:[],result:a}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)})),t=e._grpM.get(11).getLocalMessageList(E.CONV_SYSTEM);var n=[];t.forEach((function(t){var i=(s=t.payload).operatorID,o=s.operationType,s=s.groupProfile;1===o&&(o="".concat(i,"_").concat(s.groupID,"_").concat(s.to),i=e.pendencyMap.get(o))&&Ke(i.handled)&&0!==i.handled&&n.push(t)})),e.deleteGroupSystemNotice({messageList:n})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._n,".deleteGroupSystemNotice");return Ye(e.messageList)&&0!==e.messageList.length?(be.l("".concat(n," ")+e.messageList.map((function(e){return e.ID}))),this._grpM.req({P:jn.DEL_GRP_SYSTEM_NOTICE,data:{messageListToDelete:e.messageList.map((function(e){return{from:E.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){be.l("".concat(n," ok"));var i=t._grpM.get(11);return e.messageList.forEach((function(e){i.deleteLocalMessage(e)})),Cn()})).catch((function(e){return be.e("".concat(n," error:"),e),En(e)}))):Sn()}},{key:"_getPendencyList",value:function(){var e=this,t=(i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).type,n=i.startTime,i=i.limit;return this._grpM.req({P:jn.GET_GRP_PENDENCY,data:{type:void 0===t?void 0:t,startTime:void 0===n?0:n,limit:void 0===i?20:i,handleAccount:this._grpM.getMyUserID()}}).then((function(t){var n=t.data.pendencyList;return 0!==t.data.nextStartTime?e._getPendencyList({startTime:t.data.nextStartTime}).then((function(e){return[].concat(v(n),v(e))})):n}))}},{key:"getGroupApplicationList",value:function(){var e=this;return this._getPendencyList().then((function(t){return e._getPendencyList({type:E.GRP_COMMUNITY}).then((function(n){return t.push.apply(t,v(n)),e._handlePendencyResult(t)})).catch((function(n){return e._handlePendencyResult(t)}))}))}},{key:"_handlePendencyResult",value:function(e){var t=this,n=[];return e.forEach((function(e){t.pendencyMap.set("".concat(e.from,"_").concat(e.groupID,"_").concat(e.to),e),0===e.handled&&n.push({applicant:e.from,applicantNick:e.fromUserNickName,groupName:e.groupName,groupID:e.groupID,authentication:e.authentication,messageKey:e.time,applicationType:e.applicationType,userID:e.userID,note:e.note})})),Sn({applicationList:n})}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:case 3:case 6:case 11:case 12:case 15:break;case 2:t._onApplyJoinGroup(e);break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._grpM.onAVChatRoomMemberBanned(e)}}))}},{key:"_onApplyJoinGroup",value:function(e){var t=this,n=(e=e.payload.groupProfile).groupID,i=(e=e.groupType,this._grpM.hasLocalGroup(n));be.l("".concat(this._n,"._onApplyJoinGroup groupID:").concat(n," groupType:").concat(e," hasGroup:").concat(i)),i||Mt(e)||this._grpM.getGroupProfile({groupID:n}).then((function(e){(e=e.data.group)&&(t._grpM.updateGroupMap([e]),e=!e.isSupportTopic,t._grpM.emitGroupListUpdate(!0,e))}))}},{key:"_onMemberKicked",value:function(e){e=e.payload.groupProfile.groupID,this._grpM.hasLocalGroup(e)&&this._grpM.deleteLocalGroupAndConversation(e)}},{key:"_onGroupDismissed",value:function(e){e=e.payload.groupProfile.groupID;var t=(this._grpM.hasLocalGroup(e)&&this._grpM.deleteLocalGroupAndConversation(e),this._grpM._AVChatRoomHandler);t&&t.checkJoinedAVChatRoomByID(e)&&t.reset(e)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;e=this._grpM.hasLocalGroup(n),be.l("".concat(this._n,"._onInviteGroup groupID:").concat(n," hasGroup:").concat(e)),this._grpM.getGroupProfile({groupID:n}).then((function(){t._grpM.emitGroupListUpdate(),t._grpM.get(11).pullMsgOnInvite("".concat(E.CONV_GROUP).concat(n))}))}},{key:"_onQuitGroup",value:function(e){var t=(e=e.payload.groupProfile).groupID,n=(e=e.groupType,this._grpM.hasLocalGroup(t));be.l("".concat(this._n,"._onQuitGroup groupID:").concat(t," groupType:").concat(e," hasGroup:").concat(n)),n&&this._grpM.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=(e=e.payload.groupProfile).to;e=e.groupID,(e=this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(e,t))&&e.updateRole(E.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=(e=e.payload.groupProfile).to;e=e.groupID,(e=this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(e,t))&&e.updateRole(E.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID;e=e.payload.messageRemindType,this._grpM.get(11).onGroupMsgRemindTypeUpdated({groupID:t,messageRemindType:e})}},{key:"_handleTopicSystemNotice",value:function(e){var t=(n=e.groupProfile).groupID,n=n.topicID,i=(e=e.elements).operationType,o=e.topicIDList,s=(e=e.messageRemindType,this._grpM.get(10));17===i?s.onTopicCreated({groupID:t,topicID:n}):18===i?s.onTopicDeleted({groupID:t,topicIDList:o}):20===i&&s.onMessageRemindTypeUpdated({groupID:t,topicID:n,messageRemindType:e})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),uo=["relayFlag"],lo=(u(ko,wn),s(ko,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count"),i=this.getCloudConfig("polling_simplified_msg"),o=this.getCloudConfig("paging_grp_count");be.l("".concat(this._n,"._onCloudConfig pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)+" pollingSimplifiedMessage:".concat(i," pagingGroupCount:").concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(i),this._commonGroupHandler.setPagingGroupCount(o)}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t,n=this;return e.conversationType!==E.CONV_GROUP||(t=St(e.to)?xt(e.to):e.to,this.hasLocalGroup(t))?Sn():this.getGroupProfile({groupID:t}).then((function(i){return i=i.data.group.type,be.l("".concat(n._n,".guardForAVChatRoom. groupID:").concat(t," type:").concat(i)),i===E.GRP_AVCHATROOM?En(new Bn({code:i=qn.MSG_SEND_FAIL_NOT_IN_AV,message:n.getErrMsg(i,e.from,t),data:{message:e}})):Sn()}))}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewMessage",value:function(e){this._commonGroupHandler.onNewMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t,n=this;Ye(e)&&(t=this.get(10),e.forEach((function(e){var i=e.conversationID.replace(E.CONV_GROUP,"");St(i)&&t.updateUnreadCountAndLastMsg(i,e.lastMessage),n.groupMap.has(i)&&(n.groupMap.get(i).nextMessageSeq=e.lastMessage.sequence+1)})))}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler.onNewGroupTips(e)}},{key:"onMsgRevoked",value:function(e){this._commonGroupHandler.onMsgRevoked(e,!(1<arguments.length&&void 0!==arguments[1])||arguments[1])}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onMsgReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n;e=e.elements.groupMessageReadNotice,lt(e)||(n=t.get(11),e.forEach((function(e){var i=e.groupID,o=void 0===(o=e.topicID)?void 0:o,s=(e=e.lastMessageSeq,be.l("".concat(t._n,".onMsgReadNotice groupID:").concat(i," lastMessageSeq:").concat(e)),i="".concat(E.CONV_GROUP).concat(i),!0);qe(o)||(i="".concat(E.CONV_GROUP).concat(o),s=!1),n.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:e}),n.updateUnreadCount(i,s),n.clearGroupAtInfoList(i,s)})))}))}},{key:"onReadReceiptList",value:function(e){var t=this;be.l("".concat(this._n,".onReadReceiptList options:"),e),e.dataList.forEach((function(e){var n=e.groupProfile,i=(e=e.elements,n=n.groupID,t.get(11));e=e.readReceiptList,i.updateReadReceiptInfo({groupID:n,readReceiptList:e})}))}},{key:"onMsgModified",value:function(e){be.l("".concat(this._n,".onMsgModified options:"),e);var t=this.get(11);e.dataList.forEach((function(e){t.onMessageModified(g(g({},e),{},{conversationType:E.CONV_GROUP,to:e.topicID||e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new zi(e))}},{key:"clearGroupMap",value:function(){this.groupMap.clear()}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,i=this.get(11);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new zi(e)),i.deleteGroupRoamingInfo(t))}));var o,s=this.getMyUserID(),r=a(this.groupMap);try{for(r.s();!(o=r.n()).done;){var c=_(o.value,2)[1];c.selfInfo.userID=s,"Owner"===c.selfInfo.role&&(c.ownerID=s)}}catch(u){r.e(u)}finally{r.f()}}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return v(this.groupMap.values()).filter((function(e){return e.type!==E.GRP_ROOM&&e.type!==E.GRP_LIVE}))}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=v(this.groupMap).filter((function(e){return(e=_(e,2))[0],!qe(e[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(v(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler.updateLastMsg(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();e&&this.emitOEvt(S.GROUP_LIST_UPDATED),t&&(e=JSON.parse(JSON.stringify(n)),this.get(11).updateConvGroupProfile(e))}},{key:"getMyNameCardByGroupID",value:function(e){return(e=this.getLocalGroupProfile(e))?e.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return this._commonGroupHandler.isPagingGetCompleted()}},{key:"getMsgRemindType",value:function(e){var t=this;return Ye(e)&&0!==e.length&&0!==(e=e.filter((function(e){return!Mt(t.getLocalGroupProfile(e).type)}))).length?(be.l("".concat(this._n,".getMsgRemindType groupIDList:").concat(e)),this.getGroupProfileAdvance({groupIDList:e,responseFilter:{memberInfoFilter:["MsgFlag"]}}).then((function(e){e=e.data.successGroupList;var n=t.get(11);e.forEach((function(e){n.onGroupMsgRemindTypeUpdated({groupID:e.groupID,messageRemindType:Ye(e.members)?e.members[0].messageRemindType:""})}))}))):Promise.resolve()}},{key:"getGroupList",value:function(){return this._commonGroupHandler.getGroupList()}},{key:"syncCommunityWithTopic",value:function(){return this._commonGroupHandler.syncGroupList(!0)}},{key:"getGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupProfile"),i=new oi("getGroupProfile"),o=e.groupID,s=e.groupCustomFieldFilter;return be.l("".concat(n," groupID:").concat(o)),s={groupIDList:[o],responseFilter:{groupBaseInfoFilter:v(U),groupCustomFieldFilter:s,memberInfoFilter:[].concat(v(G),["NameCard"])}},this.getGroupProfileAdvance(s).then((function(e){var s=(e=e.data).successGroupList;return e=e.failureGroupList,be.l("".concat(n," ok")),0<e.length?En(e[0]):((e=Mt(s[0].type)&&!t.hasLocalGroup(o)?new zi(s[0]):(t.updateGroupMap(s),t.getLocalGroupProfile(o))).isSupportTopic||t.get(11).updateConvGroupProfile([e]),i.setMessage("groupID:".concat(o," type:").concat(e.type," muteAllMembers:").concat(e.muteAllMembers," ownerID:").concat(e.ownerID)).end(),Cn({group:e}))})).catch((function(t){return i.setError(t).setMessage("groupID:".concat(e.groupID)).end(),be.e("".concat(n," failed. error:"),t),En(t)}))}},{key:"getGroupProfileAdvance",value:function(e){var t,n="".concat(this._n,".getGroupProfileAdvance"),i=(Ye(s=e.groupIDList)&&50<s.length&&(this.warn("GetGroupProfileLimit"),s.length=50),[]),o=[],s=(s.forEach((function(e){(Ct({groupID:e})?o:i).push(e)})),[]);return 0<i.length&&(t=this._getGroupProfileAdvance(g(g({},e),{},{groupIDList:i})),s.push(t)),0<o.length&&(t=this._getGroupProfileAdvance(g(g({},e),{},{groupIDList:o,relayFlag:0<i.length})),s.push(t)),Promise.all(s).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,v(e.successGroupList)),n.push.apply(n,v(e.failureGroupList))})),Cn({successGroupList:t,failureGroupList:n})})).catch((function(e){return be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,i=void 0!==n&&n,o=f(e,uo);return this.req({P:jn.GET_GRP_PROFILE,data:o}).then((function(e){return be.l("".concat(t._n,"._getGroupProfileAdvance ok. options:"),o),{successGroupList:(e=e.data.groups).filter((function(e){return lt(e.errorCode)||0===e.errorCode})),failureGroupList:e.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new Bn({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return i&&Ct({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:En(t)}))}},{key:"createGroup",value:function(e){var t=this,n=[E.GRP_PUBLIC,E.GRP_WORK,E.GRP_MEETING,E.GRP_AVCHATROOM,E.GRP_COMMUNITY],i="".concat(this._n,".").concat("createGroup"),o=e.type,s=e.groupID;if(e.name&&!1===this._filterProfanity("name",e))return En({code:qn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return En({code:qn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return En({code:qn.PROFANITY_FOUND});if(!n.includes(o))return En({code:qn.ILLEGAL_GRP_TYPE});if(!Ct({type:o})){if(!qe(s)&&Ct({groupID:s}))return En({code:qn.ILLEGAL_GRP_ID});e.isSupportTopic=void 0}if(Mt(o)&&!lt(e.memberList)&&0<e.memberList.length&&(e.memberList=void 0),this._canIUseJoinOption(o)||lt(e.joinOption)||(e.joinOption=void 0),Ct({type:o})){if(!qe(s)&&!Ct({groupID:s}))return En({code:qn.ILLEGAL_GRP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var a=new oi("createGroup"),r=(be.l("".concat(i," options:"),e),null),c=[];return this.req({P:jn.CREATE_GRP,data:g(g({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(n){var o,s,u,l=(n=n.data).groupID,d=void 0===(n=n.overLimitUserIDList)?[]:n;return r=l,c=d,n="groupType:".concat(e.type," groupID:").concat(l," overLimitUserIDList:").concat(d),a.setMessage(n).end(),be.l("".concat(i," ok. ").concat(n)),e.type===E.GRP_AVCHATROOM||e.type===E.GRP_COMMUNITY&&1===e.isSupportTopic||(qe(e.memberList)||qe(d)||(e.memberList=e.memberList.filter((function(e){return-1===d.indexOf(e.userID)}))),t.updateGroupMap([g(g({},e),{},{groupID:l})]),n=t.get(2),u="",o=0,e.type===E.GRP_COMMUNITY?(u=t.isIntl()?"Create Community":"创建社群",o=1):u=t.isIntl()?"Create Group":"创建群组",s=t.get(4).getMyNick(),u=n.createCustomMessage({to:l,conversationType:E.CONV_GROUP,payload:{data:JSON.stringify({businessID:"group_create",content:u,cmd:o,opUser:s||t.getMyUserID(),version:4})}}),n.sendMessageInstance(u),t.emitGroupListUpdate()),t.getGroupProfile({groupID:l})})).then((function(e){var t=(n=(e=e.data.group).selfInfo).nameCard,n=n.joinTime;return e.updateSelfInfo({nameCard:t,joinTime:n,messageRemindType:E.MSG_REMIND_ACPT_AND_NOTE,role:E.GRP_MBR_ROLE_OWNER}),Cn({group:e,overLimitUserIDList:c})})).catch((function(n){var o;return a.setMessage("groupType:".concat(e.type)).setError(n).end(),10010===n.code||10007===n.code?(t._silentlyGetGroupProfile(n.code,r),t.updateGroupMap([g(g({},e),{},{groupID:r})]),(o=t.getLocalGroupProfile(r)).selfInfo.role=E.GRP_MBR_ROLE_OWNER,Cn({group:o,overLimitUserIDList:c})):(be.e("".concat(i," failed. error:"),n),En(n))}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("dismissGroup"),i="groupID:".concat(e),o=new oi("dismissGroup");return o.setMessage(i),be.l("".concat(n," ").concat(i)),this.req({P:jn.DISMISS_GRP,data:{groupID:e}}).then((function(){return o.end(),be.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Cn({groupID:e})})).catch((function(e){return o.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"updateGroupProfile",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("updateGroupProfile");return this.hasLocalGroup(e.groupID)&&(t=this.getLocalGroupProfile(e.groupID).type,this._canIUseJoinOption(t)||lt(e.joinOption)||(be.w("".concat(o," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)),lt(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&!1===this._filterProfanity("name",e)||e.introduction&&!1===this._filterProfanity("introduction",e)||e.notification&&!1===this._filterProfanity("notification",e)?En({code:qn.PROFANITY_FOUND}):((n=new oi("updateGroupProfile")).setMessage(JSON.stringify(e)),be.l("".concat(o," groupID:").concat(e.groupID)),this.req({P:jn.UPDATE_GRP_PROFILE,data:e}).then((function(){return n.end(),be.l("".concat(o," ok")),i.hasLocalGroup(e.groupID)&&i.groupMap.get(e.groupID).updateGroup(e),Cn({group:i.groupMap.get(e.groupID)})})).catch((function(e){return n.setError(e).end(),be.l("".concat(o," failed. error:"),e),En(e)})))}},{key:"_filterProfanity",value:function(e,t){var n,i=this.get(29);return!i||(n=(i=i.filterText(t[e],w)).isAllowedToSend,i=i.modifiedText,!0===n&&(t[e]=i,!0))}},{key:"joinGroup",value:function(e){var t,n=this,i=e.groupID,o="".concat(this._n,".joinGroup");return this.deleteUnjoinedAVChatRoom(i),this.hasLocalGroup(i)?this.isLoggedIn()?(t=new oi("applyJoinGroup"),this.getGroupProfile({groupID:i}).then((function(){return t.setMessage("groupID:".concat(i," joinedStatus:").concat(E.JOIN_STATUS_ALREADY_IN_GROUP)).end(),Sn({status:E.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(s){return t.setMessage("groupID:".concat(i," unjoined")).end(),be.w("".concat(o," ").concat(i," was unjoined, now join!")),n.groupMap.delete(i),n.applyJoinGroup(e)}))):Sn({status:E.JOIN_STATUS_ALREADY_IN_GROUP}):(be.l("".concat(o," groupID:").concat(i)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e))}},{key:"applyJoinGroup",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("applyJoinGroup"),s=e.groupID;return qe(e.applyMessage)||!1!==this._filterProfanity("applyMessage",e)?(t=new oi("applyJoinGroup"),e=g({},e),(n=this.canIUse(N.AV_HISTORY_MSG))&&(e.historyMessageFlag=1),this.get(11).deleteTopicRoamingInfo(s),this.req({P:jn.APPLY_JOIN_GRP,data:e}).then((function(e){var a=(e=e.data).joinedStatus,r=e.longPollingKey,c=e.startSeq,u=e.avChatRoomFlag,l=e.avChatRoomKey,d=e.messageList;switch(e="groupID:".concat(s," joinedStatus:").concat(a," longPollingKey:").concat(r," startSeq:").concat(c)+" avChatRoomFlag:".concat(u," canGetAVChatRoomHistoryMsg:").concat(n,",")+" historyMsgCount:".concat(qe(d)?0:d.length),t.setMessage(e).end(),be.l("".concat(o," ok. ").concat(e)),a){case xe:return Cn({status:xe});case Ge:return i.getGroupProfile({groupID:s}).then((function(e){return e=e.data.group,i._handleJoinResult({group:e,avChatRoomFlag:u,longPollingKey:r,startSeq:c,avChatRoomKey:l,messageList:d})})).catch((function(e){var t;return 10010===e.code||10007===e.code?(i._silentlyGetGroupProfile(e.code,s),t=new zi({groupID:s}),i.updateGroupMap([t]),i._handleJoinResult({group:t,avChatRoomFlag:u,longPollingKey:r,startSeq:c,avChatRoomKey:l,messageList:d})):(be.e("".concat(o," failed. error:"),e),En(e))}));default:var p=new Bn({code:qn.JOIN_GRP_FAIL});return be.e("".concat(o," failed. error:"),p),En(p)}})).catch((function(e){return t.setMessage("groupID:".concat(s)).setError(e).end(),be.e("".concat(o," failed. error:"),e),En(e)}))):En({code:qn.PROFANITY_FOUND})}},{key:"_handleJoinResult",value:function(e){var t=this,n=e.group,i=e.avChatRoomFlag,o=e.longPollingKey,s=e.startSeq,a=e.avChatRoomKey,r=e.messageList,c=n.groupID;return 1===i?(this.get(11).setCompleted("".concat(E.CONV_GROUP).concat(c)),this._groupAttributesHandler.initGroupAttributesCache({groupID:c,avChatRoomKey:a}),this._groupCountersHandler.initGroupCountersCache({groupID:c,avChatRoomKey:a}),(e=lt(o)?this._AVChatRoomHandler.handleJoinResult({group:n}):this._AVChatRoomHandler.startRunLoop({group:n,longPollingKey:o,startSeq:s})).then((function(){t._onAVChatRoomHistoryMessage(r,c)})),e):(this.emitGroupListUpdate(!0,!1),Cn({status:Ge,group:n}))}},{key:"quitGroup",value:function(e){var t,n=this,i="".concat(this._n,".").concat("quitGroup"),o="groupID:".concat(e),s=(be.l("".concat(i," ").concat(o)),this.checkJoinedAVChatRoomByID(e));return s||this.hasLocalGroup(e)?s&&!this.isLoggedIn()?(be.l("".concat(i," anonymously ok. ").concat(o)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),Sn({groupID:e})):((t=new oi("quitGroup")).setMessage(o),this.req({P:jn.QUIT_GRP,data:{groupID:e}}).then((function(){return t.end(),be.l("".concat(i," ok")),n.deleteLocalGroupAndConversation(e),s&&n._AVChatRoomHandler.reset(e),n._groupAttributesHandler.deleteLocalGroupAttributes(e),Cn({groupID:e})})).catch((function(e){return t.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)}))):En({code:qn.MEMBER_NOT_IN_GRP})}},{key:"searchGroupByID",value:function(e){var t="".concat(this._n,".").concat("searchGroupByID"),n={groupIDList:[e]},i=new oi("searchGroupByID");return i.setMessage("groupID:".concat(e)),be.l("".concat(t," groupID:").concat(e)),this.req({P:jn.SEARCH_GRP,data:n}).then((function(e){if(0!==(e=e.data.groupProfile)[0].errorCode)throw new Bn({code:e[0].errorCode,message:e[0].errorInfo});return i.end(),be.l("".concat(t," ok")),Cn({group:new zi(e[0])})})).catch((function(e){return i.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"changeGroupOwner",value:function(e){var t,n=this,i="".concat(this._n,".").concat("changeGroupOwner");return this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===E.GRP_AVCHATROOM?En({code:qn.CANNOT_CHANGE_OWNER_IN_AV}):e.newOwnerID===this.getMyUserID()?En({code:qn.CANNOT_CHANGE_OWNER_TO_SELF}):((t=new oi("changeGroupOwner")).setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),be.l("".concat(i," groupID:").concat(e.groupID)),this.req({P:jn.CHANGE_GRP_OWNER,data:e}).then((function(){t.end(),be.l("".concat(i," ok"));var o,s=e.groupID,a=e.newOwnerID,r=(n.groupMap.get(s).ownerID=a,n._groupMemberHandler.getLocalGroupMemberList(s));return r instanceof Map&&(o=r.get(n.getMyUserID()),lt(o)||(o.updateRole("Member"),n.groupMap.get(s).selfInfo.role="Member"),o=r.get(a),lt(o)||o.updateRole("Owner")),n.emitGroupListUpdate(!0,!1),Cn({group:n.groupMap.get(s)})})).catch((function(e){return t.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)})))}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,n,i,o,s,a=this,r="".concat(this._n,".").concat("handleGroupApplication"),c=e.handleAction,u=e.handleMessage,l=e.message,d=e.application,p=(l?(t=l.payload.operatorID,n=l.payload.groupProfile.groupID,i=l.payload.authentication,o=l.payload.messageKey):d&&(t=d.applicant,n=d.groupID,i=d.authentication,o=d.messageKey),jn.HANDLE_GRP_APPLICATION),h=(d&&2===d.applicationType&&(p=jn.HANDLE_INVITE_JOIN_GRP,s=d.userID),new oi("handleGroupApplication"));return h.setMessage("groupID:".concat(n)),be.l("".concat(r," groupID:").concat(n)),this.req({P:p,data:{handleAction:c,handleMessage:u,applicant:t,invitee:s,groupID:n,authentication:i,messageKey:o}}).then((function(){return h.end(),be.l("".concat(r," ok")),l&&a._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Cn({group:a.getLocalGroupProfile(n)})})).catch((function(e){return h.setError(e).end(),be.e("".concat(r," failed. error"),e),En(e)}))}},{key:"handleGroupInvitation",value:function(e){var t=this,n="".concat(this._n,".").concat("handleGroupInvitation"),i=(a=e.message.payload).groupProfile.groupID,o=a.authentication,s=a.messageKey,a=a.operatorID,r=e.handleAction,c=new oi("handleGroupInvitation");return c.setMessage("groupID:".concat(i," inviter:").concat(a," handleAction:").concat(r)),be.l("".concat(n," groupID:").concat(i," inviter:").concat(a," handleAction:").concat(r)),this.req({P:jn.HANDLE_GRP_INVITATION,data:g(g({},e),{},{inviter:a,groupID:i,authentication:o,messageKey:s})}).then((function(){return c.end(),be.l("".concat(n," ok")),t._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Cn({group:t.getLocalGroupProfile(i)})})).catch((function(e){return c.setError(e).end(),be.e("".concat(n," failed. error"),e),En(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".getGroupOnlineMemberCount"),i=this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e),o=this.hasLocalGroup(e);if(be.l("".concat(n," groupID:").concat(e," isAVChatRoom:").concat(i," has:").concat(o)),i)return this._AVChatRoomHandler.getGroupOnlineMemberCount(e);if(!o)return Sn({memberCount:0});if(i=Date.now(),this._onlineMemberCountMap.has(e)){if(i-(o=this._onlineMemberCountMap.get(e)).lastReqTime<=6e4)return Sn({memberCount:o.memberCount});o.lastReqTime=i}return this.requestOnlineCount(e).then((function(i){return i=void 0===(i=i.data.memberCount)?0:i,t._onlineMemberCountMap.set(e,{lastReqTime:Date.now(),memberCount:i}),be.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(i)),Sn({memberCount:i})})).catch((function(e){return be.w("".concat(n," failed. error:"),e),Promise.reject(e)}))}},{key:"requestOnlineCount",value:function(e){return this.req({P:jn.GET_ONLINE_MBR_NUM,data:{groupID:e}})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e),n=(be.l("".concat(this._n,".deleteLocalGroupAndConversation groupID:").concat(e," isJoinedAVChatRoom:").concat(t)),this.get(11)),i="".concat(E.CONV_GROUP).concat(e);t&&(this.stopMessageLongPolling({groupID:e}),n.deleteLocalConv(i)),Ct({groupID:e})&&(t=this.getLocalGroupProfile(e))&&!0===t.isSupportTopic&&this.get(10).deleteTopicListInCommunity(e),n.clearUnreadCount(i),n.setCompleted(i),this._deleteLocalGroup(e),this._onlineMemberCountMap.delete(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this._groupMemberHandler.deleteGroupMemberList(e)}},{key:"sendMessage",value:function(e,t){return Ye(e._receiverList)&&0<e._receiverList.length&&!this.canIUse(N.MSG_TO_SPECIFIED_GRP_MBR)?this.noUse("Targeted Group Message"):(e=this.createGroupMessagePack(e,t),this.req(e))}},{key:"createGroupMessagePack",value:function(e,t){var n=null,i=(t&&t.offlinePushInfo&&(n=t.offlinePushInfo),""),o=(ut(e.cloudCustomData)&&0<e.cloudCustomData.length&&(i=e.cloudCustomData),[]),s=void(We(t)&&We(t.messageControlInfo)&&(s=(r=t.messageControlInfo).excludedFromUnreadCount,a=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===s&&o.push("NoUnread"),!0===a&&o.push("NoLastMsg"),!0===r)&&o.push("NoMsgCheck")),a=(Ye(e._receiverList)&&0<e._receiverList.length&&(s=e._receiverList,50<e._receiverList.length)&&(s=e._receiverList.slice(0,50),this.warn("ReceiverListLimit")),this.isOnlineMessage(e,t)?1:0),r=JSON.parse(JSON.stringify(e.getElements())),c=this.get(17).getFileDNList(),u=e.getGroupAtInfoList();return r={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:ui(e.type,r,c),cloudCustomData:i,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==E.MSG_TEXT||qe(u)?void 0:u,onlineOnlyFlag:a,clientTime:e.clientTime,offlinePushInfo:Li(n),messageControlInfo:0==a?o:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:s,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0,cmConfigID:e._cmConfigID,forbidCallbackControl:yt(t)},St(e.to)&&(r.groupID=xt(e.to),r.topicID=e.to),{P:jn.SEND_GRP_MSG,data:r}}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return St(e.to)&&(t.groupID=xt(e.to),t.topicID=e.to),this.req({P:jn.REVOKE_GRP_MSG,data:t})}},{key:"deleteMessage",value:function(e){var t=e.to;return e=e.keyList,be.l("".concat(this._n,".deleteMessage groupID:").concat(t," count:").concat(e.length)),e={groupID:t,deleter:this.getMyUserID(),keyList:e},St(t)&&(e.groupID=xt(t),e.topicID=t),this.req({P:jn.DEL_GRP_MSG,data:e})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,i=e.payload,o=e.type,s=void 0===(s=e.version)?0:s,a=e.cloudCustomData,r=(e=e._elements,t),c=void 0;return t=void(St(t)&&(r=xt(t),c=t)),Bt(o)&&(1<e.length&&e.splice(0,1,{type:o,content:i}),t=e),this.req({P:jn.MODIFY_GRP_MSG,data:{groupID:r,topicID:c,sequence:n,version:s,elements:t,cloudCustomData:a}})}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".").concat("getRoamingMessage"),i=e.conversationID,o=e.groupID,s=(e=e.sequence,new oi("getRoamingMessage")),a=0,r=void 0;return St(o)&&(o=xt(r=o)),this._computeLastSequence({groupID:o,topicID:r,sequence:e}).then((function(e){return a=e,be.l("".concat(n," groupID:").concat(o," startSequence:").concat(a)),t.req({P:jn.GET_GRP_ROAMING_MSG,data:{groupID:o,count:21,sequence:a,topicID:r}})})).then((function(e){var c=(l=e.data).messageList,u=l.complete,l=void 0===(l=l.invisibleSequenceList)?[]:l,d=(e=void 0===(e=e.data.nextSequence)?0:e,lt(c)?be.l("".concat(n," ok. complete:").concat(u," nextSequence:").concat(e," but messageList is undefined!")):be.l("".concat(n," ok. complete:").concat(u," nextSequence:").concat(e," count:").concat(c.length)),s.setMessage("groupID:".concat(o," topicID:").concat(r," startSequence:").concat(a," complete:").concat(u," nextSequence:").concat(e)).end(),t.get(11)),p=[],h=[];return qe(c)||(p=d.onRoamingMessage(c,i,!0,h),d.updateIsRead(i),d.patchConvLastMessage(i)),(c=2===u||e<1)&&(d.setCompleted(i),e=""),be.l("".concat(n," isPullingCompleted:").concat(c," nextReqID:").concat(e," storedMsgCount:").concat(p.length)+" invisibleSeqCount:".concat(l.length)),{nextReqID:e+"",storedMessageList:p,assembledMessageList:h,isPullingCompleted:c}})).catch((function(e){return s.setError(e).setMessage("groupID:".concat(o," topicID:").concat(r," startSequence:").concat(a)).end(),be.w("".concat(n," failed. error:"),e),En(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(E.CONV_GROUP,"")}},{key:"getReadReceiptList",value:function(e){var t,n="".concat(this._n,".").concat("getReadReceiptList"),i=this._getGroupIDOfMessage(e[0]),o=this.getMyUserID(),s=e.filter((function(e){return e.from===o&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));return be.l("".concat(n," groupID:").concat(i," sequenceList:").concat(JSON.stringify(s))),0===s.length?Sn({messageList:e}):((t=new oi("getReadReceiptList")).setMessage("groupID:".concat(i)),this.req({P:jn.GET_READ_RECEIPT,data:{groupID:i,sequenceList:s}}).then((function(i){return t.end(),be.l("".concat(n," ok")),Ye(i=i.data.readReceiptList)&&i.forEach((function(t){e.forEach((function(e){0===t.code&&t.sequence===e.sequence&&(e.readReceiptInfo.readCount=t.readCount,e.readReceiptInfo.unreadCount=t.unreadCount)}))})),Cn({messageList:e})})).catch((function(e){return t.setError(e).end(),be.w("".concat(n," failed. error:"),e),En(e)})))}},{key:"sendReadReceipt",value:function(e){var t="".concat(this._n,".").concat("sendReadReceipt"),n=this._getGroupIDOfMessage(e[0]),i=new oi("sendReadReceipt"),o=(i.setMessage("groupID:".concat(n)),this.getMyUserID());return 0===(e=e.filter((function(e){return e.from!==o&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}))).length?En({code:qn.READ_RECEIPT_MSG_LIST_EMPTY}):(be.l("".concat(t,". sequenceList:").concat(JSON.stringify(e))),this.req({P:jn.SEND_READ_RECEIPT,data:{groupID:n,sequenceList:e}}).then((function(e){return i.end(),be.l("".concat(t," ok")),Cn()})).catch((function(e){return i.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)})))}},{key:"getReadReceiptDetail",value:function(e){var t=this,n=e.message,i=e.filter,o=e.cursor,s=(e=e.count,this._getGroupIDOfMessage(n)),a=n.ID,r=(n=n.sequence,"".concat(this._n,".").concat("getReadReceiptDetail")),c=this._receiptDetailCompleteMap.get(a)||!1,u=0!==i&&1!==i?0:i,l=(i=ut(o)?o:"",o=!Ke(e)||e<=0||100<=e?100:e,e="groupID:".concat(s," sequence:").concat(n," cursor:").concat(i," filter:").concat(u," completeFlag:").concat(c),be.l("".concat(r," ").concat(e)),{cursor:"",isCompleted:!1,messageID:a,unreadUserIDList:[],readUserIDList:[]}),d=new oi("getReadReceiptDetail");return d.setMessage(e),this.req({P:jn.GET_READ_RECEIPT_DETAIL,data:{groupID:s,sequence:n,flag:u,cursor:i,count:o}}).then((function(e){d.end();var n=(e=e.data).cursor,i=e.isCompleted,o=e.unreadUserIDList;return e=e.readUserIDList,l.cursor=n,1===i&&(l.isCompleted=!0,t._receiptDetailCompleteMap.set(a,!0)),0===u?l.readUserIDList=e.map((function(e){return e.userID})):1===u&&(l.unreadUserIDList=o.map((function(e){return e.userID}))),be.l("".concat(r," ok")),Cn(l)})).catch((function(e){return d.setError(e).end(),be.w("".concat(r," failed. error:"),e),En(e)}))}},{key:"getGroupReceiptsByUsers",value:function(e){var t="".concat(this._n,".").concat("getGroupReceiptsByUsers"),n=e.groupID,i=(e=void 0===(e=e.dataList)?[]:e,"groupID:".concat(n," dataList length:").concat(e.length));return be.l("".concat(t," ").concat(i)),0===e.length&&be.w("".concat(t," dataList is empty.")),this.req({P:jn.GET_GRP_RECEIPTS_BY_USERS,data:{groupID:n,dataList:e}}).then((function(e){return e=void 0===(e=e.data.dataList)?[]:e,be.l("".concat(t," ok.")),Cn({dataList:e})})).catch((function(e){return be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".").concat("getRoamingMessagesHopping"),i=e.groupID,o=e.count,s=e.sequence,a=e.direction,r=void 0;return lt(s)&&1===a?Sn({messageList:[],isCompleted:!0,nextMessageSeq:""}):(St(i)&&(i=xt(r=i)),this._computeReqSeqHopping({groupID:i,topicID:r,sequence:s}).then((function(c){lt(s)||1!==a||(c=s+o-1);var u="".concat(r?"topicID:".concat(r):"groupID:".concat(i)," sequence:").concat(s," reqSeq:").concat(c," direction:").concat(a),l=(be.l("".concat(n," ").concat(u)),new oi("getRoamingMessagesHopping"));return t.req({P:jn.GET_GRP_ROAMING_MSG,data:{groupID:i,topicID:r,count:o,sequence:c}}).then((function(i){var o=void 0===(o=(i=i.data).messageList)?[]:o,r=i.complete,c=void 0===(c=i.nextSequence)?0:c,d=(i=void 0===(i=i.invisibleSequenceList)?[]:i,"complete:".concat(r," nextSequence:").concat(c," remoteMsgCount:").concat(o.length," invisibleSequenceList:").concat(i)),p=(l.setMessage("".concat(u," ").concat(d)).end(),be.l("".concat(n," ok. ").concat(d)),d="".concat(E.CONV_GROUP).concat(e.groupID),t.get(11));return d=p.onRoamingMessage(o,d,!1),o=t._computeResult({groupID:e.groupID,direction:a,sequence:s,remoteMessageList:o,processedMessageList:d,complete:r,nextSequence:c,invisibleSequenceList:i}),p.storeHoppingMessageList(o.messageList),Cn(o)})).catch((function(e){return l.setError(e).setMessage("groupID:".concat(i," sequence:").concat(s," count:").concat(o)).end(),be.w("".concat(n," failed. error:"),e),En(e)}))})))}},{key:"_computeReqSeqHopping",value:function(e){var t=this,n=e.groupID,i=void 0===(i=e.topicID)?void 0:i;return 0<(e=void 0===(e=e.sequence)?void 0:e)?Promise.resolve(e):lt(i)?this.getGroupProfileAdvance({groupIDList:[n],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}}).then((function(e){var i=0;return qe(e=e.data.successGroupList)||(i=e[0].nextMessageSeq-1),be.l("".concat(t._n,"._computeReqSeqHopping groupID:").concat(n," lastSequence:").concat(i," from remote")),i})).catch((function(e){return En(e)})):Promise.resolve(0)}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""},n=e.groupID,i=e.direction,o=e.sequence,s=void 0===(s=e.remoteMessageList)?[]:s,a=void 0===(a=e.processedMessageList)?[]:a,r=e.complete,c=e.nextSequence;if(e=e.invisibleSequenceList,0===i)return t.nextMessageSeq=c,(2===r||c<1)&&(t.isCompleted=!0,t.nextMessageSeq=""),t.messageList=a,t;if(1===i){if(qe(s)){if(qe(e))return t.isCompleted=!0,t.nextMessageSeq="",t;t.nextMessageSeq=e[0]+1}else r=s[0].sequence,c=e[0]||0,t.nextMessageSeq=c<r?r+1:c+1;return a.forEach((function(e){e.sequence>=o&&t.messageList.push(e)})),(Ct({groupID:n})||St(n))&&0===t.messageList.length&&s[0].sequence<o&&(t.isCompleted=!0,t.nextMessageSeq=""),t}}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,i=e.lastMessageSeq,o="".concat(this._n,".").concat("setMessageRead"),s=(e="convID:".concat(n," lastMessageSeq:").concat(i),be.l("".concat(o," ").concat(e)),Ke(i)||this.warn("DoNotModifyLastSeq"),new oi("setMessageRead")),a=(s.setMessage(e),n.replace(E.CONV_GROUP,"")),r=void 0;return St(a)&&(a=xt(r=a)),this.req({P:jn.SET_GRP_MSG_READ,data:{groupID:a,topicID:r,messageReadSeq:i}}).then((function(){s.end(),be.l("".concat(o," ok"));var e,c=t.get(11),u=(c.updateIsReadAfterReadReport({conversationID:n,lastMessageSeq:i}),!0);return!lt(r)&&(u=!1,e=t.get(10).getLocalTopic(a,r))&&e.updateSelfInfo({readedSequence:i}),c.updateUnreadCount(n,u),Cn()})).catch((function(e){return s.setError(e).end(),be.l("".concat(o," failed. error:"),e),En(e)}))}},{key:"_computeLastSequence",value:function(e){var t=e.groupID,n=void 0===(n=e.topicID)?void 0:n;return 0<(e=e.sequence)?Promise.resolve(e):lt(n)?this.getGroupLastSequence(t):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t="".concat(this._n,".").concat("getGroupLastSequence"),n=new oi("getGroupLastSequence"),i=0,o="",s="groupID:".concat(e);if(this.hasLocalGroup(e)){var a=this.getLocalGroupProfile(e),r=a.lastMessage;if(0<r.lastSequence&&!1===r.onlineOnlyFlag)return i=r.lastSequence,o="".concat(s,", ").concat(i," from group.lastMessage.lastSequence"),be.l("".concat(t," ").concat(o)),n.setMessage(o).end(),Promise.resolve(i);if(1<a.nextMessageSeq)return i=a.nextMessageSeq-1,o="".concat(s,", ").concat(i," from group.nextMessageSeq"),be.l("".concat(t," ").concat(o)),n.setMessage(o).end(),Promise.resolve(i)}return(r=this.get(11).getLocalConversation("GROUP".concat(e)))&&r.lastMessage.lastSequence&&!1===r.lastMessage.onlineOnlyFlag?(i=r.lastMessage.lastSequence,o="".concat(s,", ").concat(i," from conversation.lastMessage.lastSequence"),be.l("".concat(t," ").concat(o)),n.setMessage(o).end(),Promise.resolve(i)):this.getGroupProfileAdvance({groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}}).then((function(e){return qe(e=e.data.successGroupList)?be.w("".concat(t," ").concat(s,", empty successGroupList")):(i=e[0].nextMessageSeq-1,o="".concat(s,", ").concat(i," from remote"),be.l("".concat(t," ").concat(o))),n.setMessage(o).end(),i})).catch((function(e){return n.setError(e).setMessage(s).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.hasJoinedAVChatRoom()}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.getJoinedAVChatRoom()}},{key:"getGroupRemoteLastSeq",value:function(e){return(e=this.getLocalGroupProfile(e))?e.nextMessageSeq-1:1}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==E.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e,t){var n;qe(e)||(be.l("".concat(this._n,"._onAVChatRoomHistoryMessage groupID:").concat(t," count:").concat(e.length)),n=[],e.forEach((function(e){n.push(g(g({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(n,t))}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler.onMessage(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:"")}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"isGroupAttributesUpdatedNotice",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"isMessageFromTopic",value:function(e,t){return 2===e&&!qe(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return 2===e&&qe(t)}},{key:"getMessageExtensions",value:function(e,t){return be.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.req({P:jn.GET_GRP_MSG_EXT,data:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return be.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),this.req({P:jn.MODIFY_GRP_MSG_EXT,data:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"_genNotifyReqList",value:function(e){for(var t,n,i,o,s=[],a=0,r=e.length;a<r;a++)t=e[a],o=this.getLocalGroupProfile(t).type,n=this._getGroupLastRevokedTime(t),i=1e3*ke(),o={notifyType:1,limit:20,type:Ct({type:o,groupID:t})?E.GRP_COMMUNITY:void 0,groupID:t,beginTime:n,endTime:i},s.push(o);return s}},{key:"getNotice",value:function(e){var t=this,n="".concat(this._n,".getNotice");0!==(e=e.filter((function(e){var n;return!!t.hasLocalGroup(e)&&(n=(e=t.getLocalGroupProfile(e)).type,e=e.isSupportTopic,!Mt(n))&&!e}))).length&&(be.l("".concat(n," list:").concat(e)),this.req({P:jn.GET_GRP_NOTIFY,data:{notifyReqList:this._genNotifyReqList(e)}}).then((function(e){e=e.data.notifyRspList;var i,o,s=[];Ye(e)&&(i={dataList:[]},o="".concat(n," ok."),e.forEach((function(e){var n=e.nextRevokedTime,a=e.groupID,r=e.notifyList;o+=" groupID:".concat(a," nextRevokedTime:").concat(n," count:").concat(r.length,"\n"),i.dataList.push({elements:{revokedInfos:t._genRevokedInfos(e)}}),0!==n?(t._setGroupLastRevokedTime(a,n),s.push(a)):t._setGroupLastRevokedTime(a,1e3*ke())})),be.l(o),t.onMsgRevoked(i,!1)),0<s.length&&t.getNotice(s)})).catch((function(e){be.e("".concat(n," failed. error:"),e)})))}},{key:"_genRevokedInfos",value:function(e){var t=e.notifyList,n=e.groupID,i=[];return Ye(t)&&t.forEach((function(e){i.push({groupID:n,sequence:e.sequence,random:e.random,revokerInfo:g({},e.revokerInfo)})})),i}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"getGroupMemberHandler",value:function(){return this._groupMemberHandler}},{key:"getGroupMemberList",value:function(e){return this._groupMemberHandler.getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._groupMemberHandler.getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._groupMemberHandler.addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._groupMemberHandler.deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._groupMemberHandler.setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._groupMemberHandler.setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._groupMemberHandler.setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._groupMemberHandler.setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._groupMemberHandler.markGroupMemberList(e)}},{key:"modifyGroupMemberInfo",value:function(e){return this._groupMemberHandler.modifyGroupMemberInfo(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){var t;return e&&(t=this.getLocalGroupProfile(e))&&Mt(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return e===E.GRP_PUBLIC||Ct({type:e})}},{key:"_silentlyGetGroupProfile",value:function(e,t){var n=setTimeout(this.getGroupProfile.bind(this,{groupID:t}),3e3);this._timeoutIDs.push(n),be.l("".concat(this._n,"._silentlyGetGroupProfile errorCode:").concat(e," groupID:").concat(t," timeoutIDs:").concat(this._timeoutIDs))}},{key:"_clearTimeoutIDs",value:function(){this._timeoutIDs.forEach((function(e){e&&clearTimeout(e)})),this._timeoutIDs=[]}},{key:"startMessageLongPolling",value:function(e){var t,n=e.groupID,i=e.longPollingKey,o=(e=void 0===(e=e.longPollingSequence)?1:e,this.get(12).isUnlimitedAVChatRoom());if(!qe(i))return this._AVChatRoomHandler.hasPollingInstance(n)&&this.stopMessageLongPolling({groupID:n}),t=this._AVChatRoomHandler.getJoinedLiveList(),!o&&0<t.length&&this.stopMessageLongPolling({groupID:t[0]}),o=new zi({groupID:n,type:E.GRP_LIVE}),be.l("".concat(this._n,".startMessageLongPolling groupID:").concat(n," longPollingKey:").concat(i," longPollingSequence:").concat(e)),this._AVChatRoomHandler.startRunLoop({group:o,longPollingKey:i,startSeq:e});console.warn("".concat(this._n,".startMessageLongPolling longPollingKey is empty."))}},{key:"stopMessageLongPolling",value:function(e){e=e.groupID;var t=this.get(11);return this._AVChatRoomHandler.reset(e),this._deleteLocalGroup(e),t.deleteLocalConv("".concat(E.CONV_GROUP).concat(e)),be.l("".concat(this._n,".stopMessageLongPolling ok, groupID:").concat(e)),Sn({groupID:e})}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._onlineMemberCountMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler.reset(),this._groupMemberHandler.reset(),this._clearTimeoutIDs()}}])),po=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],ho=s((function e(t,n){i(this,e),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=Fi(t.lastMessage,n),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)}),[{key:"_initTopic",value:function(e){for(var t in e)po.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){this.unreadCount=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=Fi(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){lt(e.selfInfo)||this.updateSelfInfo(e.selfInfo),lt(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),Ze(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return 0===Ze(this.selfInfo,e,[],[""])}},{key:"reduceUnreadCount",value:function(){return 1<=this.unreadCount&&(--this.unreadCount,!0)}},{key:"isLastMessageRevoked",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),go=(u(To,wn),s(To,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");lt(e)||(this.TOPIC_CACHE_TIME=Number(e)),lt(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOEvt(S.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,i=e.topicIDList;(void 0===i?[]:i).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOEvt(S.TOPIC_DELETED,e)}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID;(n=this.getLocalTopic(t,n))&&(n.updateTopic(e),this.emitOEvt(S.TOPIC_UPDATED,{groupID:t,topic:n}))}},{key:"onTopicLatestMsg",value:function(e){var t,n,i=(e=e||{}).topicLatestMessage;e=e.excludedUnreadSequenceList,qe(i)||(t=i.groupProfile.topicID,i.conversationType=E.CONV_GROUP,i.to=t,(n=new ki(i)).setElement(i.elements),this.updateUnreadCountAndLastMsg(t,n,e))}},{key:"onMessageRemindTypeUpdated",value:function(e){var t,n=e.groupID,i=e.topicID,o=(e=e.messageRemindType,this.getLocalTopic(n,i));o&&((t=o.updateSelfInfo({messageRemindType:e}))&&this.emitOEvt(S.TOPIC_UPDATED,{groupID:n,topic:o}),be.l("".concat(this._n,".onMessageRemindTypeUpdated topicID:").concat(i," messageRemindType:").concat(e," isUpdated:").concat(t)))}},{key:"onAtInfoUpdated",value:function(e){var t=e.topicID,n=(e=e.groupAtInfoList,xt(t));(t=this.getLocalTopic(n,t))&&!lt(e)&&(t.updateGroupAtInfoList(e),this.emitOEvt(S.TOPIC_UPDATED,{groupID:n,topic:t}))}},{key:"onUnreadCountUpdatedFromConv",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=xt(e);(e=this.getLocalTopic(n,e))&&e.unreadCount!==t&&(e.updateUnreadCount(t),0===t&&e.updateSelfInfo({readedSequence:e.lastMessage.lastSequence}),this.emitOEvt(S.TOPIC_UPDATED,{groupID:n,topic:e}))}},{key:"onMessageSent",value:function(e){var t,n,i=e.groupID,o=e.topicID;e=e.lastMessage,(o=this.getLocalTopic(i,o))&&(n=(t=void 0===(t=e.sequence)?0:t)+1)>o.nextMessageSeq&&(o.updateNextMessageSeq(n),o.updateLastMessage(e),o.updateSelfInfo({readedSequence:t}),o.updateUnreadCount(0),this.emitOEvt(S.TOPIC_UPDATED,{groupID:i,topic:o}))}},{key:"onMessageModified",value:function(e){var t,n=e.to,i=e.time,o=e.sequence,s=e.elements,a=e.cloudCustomData,r=e.messageVersion,c=xt(n),u=this.getLocalTopic(c,n);u&&(t=u.lastMessage,be.d("".concat(this._n,".onMessageModified topicID:").concat(n," lastMessage:"),JSON.stringify(t),"options:",JSON.stringify(e)),t)&&(null===t.payload||t.lastTime===i&&t.lastSequence===o&&t.version!==r)&&(t.type=s[0].type,t.payload=s[0].content,t.messageForShow=Ft(t.type,t.payload,this.isIntl()),t.cloudCustomData=a,t.version=r,t.lastSequence=o,t.lastTime=i,this.emitOEvt(S.TOPIC_UPDATED,{groupID:c,topic:u}))}},{key:"onMessageRevoked",value:function(e){var t,n,i,o=this;0!==e.length&&(n=t=null,i=!1,e.forEach((function(e){var s=e.to;n=xt(s),(t=o.getLocalTopic(n,s))&&(t.reduceUnreadCount()&&(i=!0),t.isLastMessageRevoked(e)&&(t.setLastMessageRevoked(!0),t.setLastMessageRevoker(e.revoker),i=!0),(s=t.selfInfo.excludedUnreadSequenceList||[]).push(e.sequence),t.updateSelfInfo({excludedUnreadSequenceList:s}))})),i)&&this.emitOEvt(S.TOPIC_UPDATED,{groupID:n,topic:t})}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,n=(e=e.sequence,xt(t));return n=this.getLocalTopic(n,t),t=!1,n?n.isLastMessageRevoked({sequence:e}):t}},{key:"updateUnreadCountAndLastMsg",value:function(e,t,n){var i,o=xt(e),s=this.getLocalTopic(o,e);s&&(i=s.selfInfo.excludedUnreadSequenceList||[],lt(n)||(i=n),t._isExcludedFromUnreadCount&&i.push(t.sequence),s.updateSelfInfo({excludedUnreadSequenceList:i}),be.l("".concat(this._n,".updateUnreadCountAndLastMsg seq:").concat(t.sequence," lastSeq:").concat(s.lastMessage.lastSequence)),t.sequence>s.lastMessage.lastSequence)&&(s.updateLastMessage(t),n=t.sequence+1,s.updateNextMessageSeq(n),i=this._computeUnreadCount(s),s.updateUnreadCount(i),(t=this.get(11).getLocalConversation("".concat(E.CONV_GROUP).concat(e)))&&t.updateUnreadCount({nextUnreadCount:i,isFromGetConversations:!0}),this.emitOEvt(S.TOPIC_UPDATED,{groupID:o,topic:s}))}},{key:"getJoinedCommunityList",value:function(){return this.get(7).syncCommunityWithTopic()}},{key:"createTopicInCommunity",value:function(e){var t,n=this,i="".concat(this._n,".").concat("createTopicInCommunity"),o=e.topicID;return lt(o)||St(o)?e.topicName&&!1===this._filterProfanity("topicName",e)||e.introduction&&!1===this._filterProfanity("introduction",e)||e.notification&&!1===this._filterProfanity("notification",e)?En({code:qn.PROFANITY_FOUND}):(t=new oi("createTopicInCommunity"),this.req({P:jn.CREATE_TOPIC,data:g({},e)}).then((function(o){return o=o.data.topicID,t.setMessage("topicID:".concat(o)).end(),be.l("".concat(i," ok. topicID:").concat(o)),n._updateTopicMap([g(g({},e),{},{topicID:o})]),Cn({topicID:o})})).catch((function(e){return t.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)}))):En({code:qn.ILLEGAL_TOPIC_ID})}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),i=e.groupID,o=(e=void 0===(e=e.topicIDList)?[]:e,new oi("deleteTopicFromCommunity"));return o.setMessage("groupID:".concat(i," topicIDList:").concat(e)),this.req({P:jn.DEL_TOPIC,data:{groupID:i,topicIDList:e}}).then((function(e){e=e.data.resultList;var s=[],a=[];return(void 0===e?[]:e).forEach((function(e){var t=e.topicID,n=e.errorCode;e=e.errorInfo,0===n?s.push({topicID:t}):a.push({topicID:t,code:n,message:e})})),e="success count:".concat(s.length,", fail count:").concat(a.length),o.setMoreMessage(e).end(),be.l("".concat(n," ok. ").concat(e)),s.forEach((function(e){t._deleteLocalTopic(i,e.topicID)})),Cn({successTopicList:s,failureTopicList:a})})).catch((function(e){return o.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"updateTopicProfile",value:function(e){var t,n=this,i="".concat(this._n,".").concat("updateTopicProfile");return be.l("".concat(i," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e)||e.introduction&&!1===this._filterProfanity("introduction",e)||e.notification&&!1===this._filterProfanity("notification",e)?En({code:qn.PROFANITY_FOUND}):((t=new oi("updateTopicProfile")).setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),lt(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:jn.UPDATE_TOPIC_PROFILE,data:g({},e)}).then((function(){return t.end(),be.l("".concat(i," ok")),n._updateTopicMap([e]),Cn({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return t.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)})))}},{key:"getTopicList",value:function(e){var t=this,n="".concat(this._n,".").concat("getTopicList"),i=e.groupID,o=0===(e=void 0===(e=e.topicIDList)?[]:e).length,s=new oi("getTopicList");if(s.setMessage("groupID:".concat(i)),this._getTopicTimeMap.has(i)){var a=(r=this._getTopicTimeMap.get(i)).isGetAll,r=r.time;if((a||!a&&!o)&&Date.now()-r<1e3*this.TOPIC_CACHE_TIME&&(a=this._getLocalTopicList(i,e),o||a.length===e.length))return s.setMoreMessage("from cache, topic count:".concat(a.length)).end(),be.l("".concat(n," groupID:").concat(i," from cache, topic count:").concat(a.length)),Sn({successTopicList:a,failureTopicList:[]})}return this.req({P:jn.GET_TOPIC_LIST,data:{groupID:i,topicIDList:e}}).then((function(e){e=e.data.topicInfoList;var a=[],r=[],c=[];return(void 0===e?[]:e).forEach((function(e){var t=e.topic,n=e.selfInfo,i=e.errorCode,o=(e=e.errorInfo,t.topicID);0===i?(a.push(g(g({},t),{},{selfInfo:n})),r.push(o)):c.push({topicID:o,code:i,message:e})})),t._updateTopicMap(a),t._handleTopicAtInfo(a),e="success count:".concat(r.length,", fail count:").concat(c.length),s.setMoreMessage(e).end(),be.l("".concat(n," groupID:").concat(i," from remote, ").concat(e)),e=[],qe(r)||(t._getTopicTimeMap.set(i,{time:Date.now(),isGetAll:o}),e=t._getLocalTopicList(i,r)),Cn({successTopicList:e,failureTopicList:c})})).catch((function(e){return s.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var n=null;return this._topicMap.has(e)?this._topicMap.get(e).get(t):n}},{key:"_getLocalTopicList",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=[];return(e=this._topicMap.get(e))&&(n=v(e.values())),0===t.length?n:n.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&this._topicMap.get(e).has(t)&&(this._topicMap.get(e).delete(t),be.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];e.forEach((function(e){var i=e.groupID,o=e.topicID,s=null;t._topicMap.has(i)||t._topicMap.set(i,new Map),t._topicMap.get(i).has(o)?(s=t._topicMap.get(i).get(o)).updateTopic(e):(t._getTopicLastMessage(e),s=new ho(e,t.isIntl()),t._topicMap.get(i).set(o,s)),e=t._computeUnreadCount(s),s.updateUnreadCount(e),n.push({conversationID:"".concat(E.CONV_GROUP).concat(o),type:E.CONV_TOPIC,unreadCount:e})})),0<n.length&&this.get(11).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;lt(e)?v(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=v(this._topicMap.keys()),n=[],i=this.get(11);t.forEach((function(t){var o=[],s=e._getLocalTopicList(t);i.deleteTopicRoamingInfo(t),s.forEach((function(t){var n=void 0===(n=t.lastMessage.lastTime)?0:n;Date.now()-1e3*n<1e3*e.TOPIC_LAST_ACTIVE_TIME&&o.push(t.topicID)})),0<o.length&&n.push({groupID:t,topicIDList:o})})),be.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t,n,i,o=this;0!==e.length&&(n=5<(t=e.shift()).topicIDList.length?"topicIDList.length:".concat(t.topicIDList.length):"topicIDList:".concat(t.topicIDList),(i=new oi("relayGetTopicList")).setMessage(n),be.l("".concat(this._n,"._relayGetTopicList. ").concat(n)),this.getTopicList(t).then((function(){i.end(),o._relayGetTopicList(e)})).catch((function(t){i.setError(t).end(),o._relayGetTopicList(e)})))}},{key:"_handleTopicAtInfo",value:function(e){var t=this;0!==e.length&&e.forEach((function(e){var n=e.groupID,i=e.topicID,o=(e=e.groupAtInfoList,[]);lt(e)||(e.forEach((function(e){o.push(g(g({},e),{},{groupID:n,topicID:i}))})),t.get(11).onNewGroupAtTips({dataList:o}))}))}},{key:"_getTopicLastMessage",value:function(e){var t;lt(e.lastMsg)||(t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,avatar:e.lastMsg.avatar,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:qe(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker},e.lastMessage=t)}},{key:"deleteTopicListInCommunity",value:function(e){var t=this,n=this._getLocalTopicList(e),i=this.get(11);n.forEach((function(n){n=n.topicID,t._deleteLocalTopic(e,n),t._getTopicTimeMap.delete(e),i.deleteLocalConv("".concat(E.CONV_GROUP).concat(n))}))}},{key:"_computeUnreadCount",value:function(e){var t,n=(o=e.selfInfo).excludedUnreadSequenceList,i=o.readedSequence,o=e.nextMessageSeq-e.selfInfo.readedSequence-1;return Ye(n)&&(t=0,n.forEach((function(n){i<n&&n<=e.nextMessageSeq-1&&(t+=1)})),1<=t)&&(o-=t),o<0?0:o}},{key:"_filterProfanity",value:function(e,t){var n,i=this.get(29);return!i||(n=(i=i.filterText(t[e],w)).isAllowedToSend,i=i.modifiedText,!0===n&&(t[e]=i,!0))}},{key:"getMessageExtensions",value:function(e,t){be.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t));var n=xt(e.to);return this.req({P:jn.GET_GRP_MSG_EXT,data:{groupID:n,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=(be.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),xt(e.to));return this.req({P:jn.MODIFY_GRP_MSG_EXT,data:{groupID:i,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}])),fo=s((function e(t){i(this,e),this._userM=t,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}),[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getUserProfile"),i=e.userIDList;e.fromAccount=this._userM.getMyAccount(),100<i.length&&(be.w("".concat(n," ").concat(jt(100))),i.length=100);for(var o,s=[],a=[],r=0,c=i.length;r<c;r++)o=i[r],this._userM.isMyFriend(o)&&this._contains(o)?a.push(this._getProfileFromMap(o)):s.push(o);if(0===s.length)return Sn(a);e.toAccount=s;var u=e.bFromGetMyProfile||!1,l=[],d=(e.toAccount.forEach((function(e){l.push({toAccount:e,standardSequence:0,customSequence:0})})),e.userItem=l,new oi("getUserProfile"));return d.setMessage(5<i.length?"userIDList.length:".concat(i.length):"userIDList:".concat(i)),this._userM.req({P:jn.GET_USER_PROFILE,data:e}).then((function(e){return d.end(),be.i("".concat(n," ok")),e=t._handleResponse(e).concat(a),Cn(u?e[0]:e)})).catch((function(e){return d.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"getMyProfile",value:function(){var e,t=this._userM.getMyAccount(),n="".concat(this._n,".getMyProfile");return be.l("".concat(n," myAccount:").concat(t)),this._fill(),this._contains(t)?(e=this._getProfileFromMap(t),be.d("".concat(n," from cache, myProfile:").concat(JSON.stringify(e))),Sn(e)):this.getUserProfile({fromAccount:t,userIDList:[t],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!Ye(t))return[];for(var n=[],i=(e=Date.now(),0),o=t.length;i<o;i++){var s=(a=t[i]).to,a=a.profileItem;"@TLS#NOT_FOUND"!==s&&""!==s&&(s=this._update(s,this._getLatestProfileFromResponse(s,a)).latestProfile,n.push(s))}return be.l("".concat(this._n,"._handleResponse cost:").concat(zt(e))),n}},{key:"_getLatestProfileFromResponse",value:function(e,t){var n={userID:e,profileCustomField:[]};if(!qe(t))for(var i=0,o=t.length;i<o;i++)if(-1<t[i].tag.indexOf("Tag_Profile_Custom"))n.profileCustomField.push({key:t[i].tag,value:t[i].value});else switch(t[i].tag){case Le.NICK:n.nick=t[i].value;break;case Le.GENDER:n.gender=t[i].value;break;case Le.BIRTHDAY:n.birthday=t[i].value;break;case Le.LOCATION:n.location=t[i].value;break;case Le.SELFSIGNATURE:n.selfSignature=t[i].value;break;case Le.ALLOWTYPE:n.allowType=t[i].value;break;case Le.LANGUAGE:n.language=t[i].value;break;case Le.AVATAR:n.avatar=t[i].value;break;case Le.MESSAGESETTINGS:n.messageSettings=t[i].value;break;case Le.ADMINFORBIDTYPE:n.adminForbidType=t[i].value;break;case Le.LEVEL:n.level=t[i].value;break;case Le.ROLE:n.role=t[i].value;break;default:be.w("".concat(this._n,"._getLatestProfileFromResponse unknown tag:"),t[i].tag,t[i].value)}return n}},{key:"updateMyProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateMyProfile");if(e.nick&&!1===this._userM.filterProfanity("nick",e))return En({code:qn.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userM.filterProfanity("selfSignature",e))return En({code:qn.PROFANITY_FOUND});var i=new oi("updateMyProfile"),o=(i.setMessage(JSON.stringify(e)),(new ji).validate(e));if(!o.valid)return i.setCode(qn.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(o.tips)).end(),be.e("".concat(n," info:").concat(o.tips)),En({code:qn.UPDATE_PROFILE_INVALID_PARAM});var s,a,r=[];for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&("profileCustomField"===s?e.profileCustomField.forEach((function(e){r.push({tag:e.key,value:e.value})})):r.push({tag:Le[s.toUpperCase()],value:e[s]}));return 0===r.length?(o=new Bn({code:qn.UPDATE_PROFILE_NO_KEY}),i.setError(o).end(),be.e("".concat(n," failed. error:"),o),En(o)):(a=this._userM.getMyAccount(),this._userM.req({P:jn.UPDATE_MY_PROFILE,data:{fromAccount:a,profileItem:r}}).then((function(o){i.end(),be.i("".concat(n," ok"));var s=(r=t._update(a,e)).isProfileUpdated,r=r.latestProfile;return!0===s&&t._userM.emitOEvt(S.PROFILE_UPDATED,[r]),Sn(r)})).catch((function(e){return i.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)})))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!qe(t)){var n=t.length;be.d("".concat(this._n,".onProfileModified count:").concat(n," dataList:"),e.dataList);for(var i=[],o=0;o<n;o++){var s=t[o].userID,a=(s=this._update(s,this._getLatestProfileFromResponse(s,t[o].profileList))).isProfileUpdated;s=s.latestProfile,!0===a&&i.push(s)}0<i.length&&(this._userM.emitIEvt(Ni.PROFILE_UPDATED,i),this._userM.emitOEvt(S.PROFILE_UPDATED,i))}}},{key:"_fill",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,i=e.length;n<i;n++)t-e[n].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(e[n].userID,e[n]);be.l("".concat(this._n,"._fill from cache, size:").concat(this.accountProfileMap.size))}}},{key:"_update",value:function(e,t){var n,i=!1,o=Date.now();return this._contains(e)?(n=this._getProfileFromMap(e),t.profileCustomField&&!0===_t(n.profileCustomField,t.profileCustomField)&&(n.lastUpdatedTime=o,i=!0),0<Ze(n,t,["profileCustomField"])&&(n.lastUpdatedTime=o,i=!0)):(n=new ji(t),!this._userM.isMyFriend(e)&&e!==this._userM.getMyAccount()||(n.lastUpdatedTime=o,i=!0,this.accountProfileMap.set(e,n))),this._flush(e===this._userM.getMyAccount()),!0===i&&be.l("".concat(this._n,"._update account:").concat(e," isUpdated:").concat(i)),{isProfileUpdated:i,latestProfile:n}}},{key:"_flush",value:function(e){var t=v(this.accountProfileMap.values()),n=this._userM.getStorageModule();be.d("".concat(this._n,"._flush length:").concat(t.length," flushAtOnce:").concat(e)),n.setItem(this.TAG,t,e)}},{key:"_contains",value:function(e){return this.accountProfileMap.has(e)}},{key:"_getProfileFromMap",value:function(e){return this.accountProfileMap.get(e)}},{key:"_getCachedProfiles",value:function(){var e=this._userM.getStorageModule().getItem(this.TAG);return qe(e)?[]:e}},{key:"onConvProfileUpdated",value:function(e){for(var t,n,i=[],o=0,s=e.length;o<s;o++)n=(t=e[o]).userID,this._userM.isMyFriend(n)&&(this._contains(n)?0<Ze(this._getProfileFromMap(n),t)&&i.push(n):i.push(t.userID));0!==i.length&&(be.l("".concat(this._n,".onConvProfileUpdated toAccountList:").concat(i)),this.getUserProfile({userIDList:i}))}},{key:"getNickAndAvatarByUserID",value:function(e){return this._contains(e)?{nick:(e=this._getProfileFromMap(e)).nick,avatar:e.avatar}:{nick:"",avatar:""}}},{key:"getUserNickAndAvatar",value:function(e){var t,n=this,i=v(new Set(e)),o=(be.l("".concat(this._n,".getUserNickAndAvatar userIDList.length:").concat(e.length," uniqueUserIDList.length:").concat(i.length)),[]);return 0===e.length?Promise.resolve(o):(e=this._createUserIDListGroup(i),t=[],e.forEach((function(e){t.push(n.getUserProfile({userIDList:e}))})),Promise.all(t).then((function(e){return e.forEach((function(e){e=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}})),o.push.apply(o,v(e))})),o})))}},{key:"_createUserIDListGroup",value:function(e){for(var t=[],n=0;n<e.length;)t.push(e.slice(n,n+=100));return t}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),mo=s((function e(t){i(this,e)})),_o=s((function e(t){i(this,e),this._userM=t,this._n="BlacklistHandler",this._blacklistMap=new Map,this._startIndex=0}),[{key:"getLocalBlacklist",value:function(){return v(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._n,".getBlacklist"),n={fromAccount:this._userM.getMyAccount(),maxLimited:100,startIndex:this._startIndex},i=new oi("getBlacklist");return this._userM.req({P:jn.GET_BL,data:n}).then((function(n){var o=(n=n.data).blackListItem,s=(n=n.startIndex,qe(o)?0:o.length);i.setMessage("count:".concat(s)).end(),be.i("".concat(t," ok")),e._startIndex=n,e._handleResponse(o,!0),e._userM.emitOEvt(S.BLACKLIST_UPDATED,v(e._blacklistMap.keys())),0!==e._startIndex&&e.getBlacklist()})).catch((function(e){return i.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))}},{key:"addBlacklist",value:function(e){var t,n,i=this,o=new oi("addToBlacklist"),s="".concat(this._n,".addBlacklist"),a=this._userM.getMyAccount();return 1===e.userIDList.length&&e.userIDList[0]===a?(n=this._userM.getErrMsg(t=qn.CANNOT_ADD_SELF_TO_BLACKLIST),o.setCode(t).setMessage(n).end(),n=new Bn({code:t}),be.e("".concat(s," failed. error:"),n),En(n)):(e.userIDList.includes(a)&&(e.userIDList=e.userIDList.filter((function(e){return e!==a}))),e.fromAccount=this._userM.getMyAccount(),e.toAccount=e.userIDList,this._userM.req({P:jn.ADD_TO_BL,data:e}).then((function(t){return o.setMessage(5<e.userIDList.length?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),be.i("".concat(s," ok")),i._handleResponse(t.resultItem,!0),Cn(v(i._blacklistMap.keys()))})).catch((function(e){return o.setError(e).end(),be.e("".concat(s," failed. error:"),e),En(e)})))}},{key:"_handleResponse",value:function(e,t){if(!qe(e))for(var n,i,o,s=0,a=e.length;s<a;s++)i=e[s].to,o=e[s].resultCode,!lt(o)&&0!==o||(t?((n=this._blacklistMap.has(i)?this._blacklistMap.get(i):new mo).userID=i,qe(e[s].addBlackTimeStamp)||(n.timeStamp=e[s].addBlackTimeStamp),this._blacklistMap.set(i,n)):this._blacklistMap.has(i)&&(n=this._blacklistMap.get(i),this._blacklistMap.delete(i)));be.l("".concat(this._n,"._handleResponse total:").concat(this._blacklistMap.size," bAdd:").concat(t))}},{key:"deleteBlacklist",value:function(e){var t=this,n="".concat(this._n,".deleteBlacklist"),i=new oi("removeFromBlacklist");return e.fromAccount=this._userM.getMyAccount(),e.toAccount=e.userIDList,this._userM.req({P:jn.RM_FROM_BL,data:e}).then((function(o){return i.setMessage(5<e.userIDList.length?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),be.i("".concat(n," ok")),t._handleResponse(o.data.resultItem,!1),Cn(v(t._blacklistMap.keys()))})).catch((function(e){return i.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"onAccountDeleted",value:function(e){for(var t=0,n=e.length;t<n;t++){var i=e[t];this._blacklistMap.has(i)&&this._blacklistMap.delete(i)}var o=e.length;0<o&&(be.l("".concat(this._n,".onAccountDeleted count:").concat(o," ").concat(o<30?"userIDList:".concat(e):"")),this._userM.emitOEvt(S.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],i=0,o=e.length;i<o;i++)t=e[i],this._blacklistMap.has(t)||(this._blacklistMap.set(t,new mo({userID:t})),n.push(t));0<n.length&&(be.l("".concat(this._n,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userM.emitOEvt(S.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this._startIndex=0}}]),vo=s((function e(t){i(this,e),this._userM=t,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userM.getIEmitInst().on(Ni.CLOUD_CONFIG,this._onCloudConfig,this)}),[{key:"_onCloudConfig",value:function(){var e=this._userM.getCloudConfig("status_query_count"),t=this._userM.getCloudConfig("status_sub_count"),n=this._userM.getCloudConfig("status_unsub_count");be.l("".concat(this._n,"._onCloudConfig statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),lt(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),lt(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),lt(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){e=e.dataList;var t=this._userM.getMyUserID(),n=this._userM.get(12);e=e.map((function(e){var i=e.to,o=e.statusType;return e=Bi(e=e.customStatus),i===t&&n.setCustomStatus(e),{userID:i,statusType:o,customStatus:e}})),be.l("".concat(this._n,".onUserStatusUpdated list:").concat(JSON.stringify(e))),this._userM.emitOEvt(S.USER_STATUS_UPDATED,e)}},{key:"setSelfStatus",value:function(e){var t,n,i=this,o="".concat(this._n,".setSelfStatus");return!1===this._userM.filterProfanity("customStatus",e)?En({code:qn.PROFANITY_FOUND}):(t=new oi("setSelfStatus"),n=e.customStatus,this._userM.req({P:jn.SET_SELF_STATUS,data:{customStatus:n}}).then((function(e){return t.setMessage("customStatus:".concat(n)).end(),be.l("".concat(o," ok. customStatus:").concat(n)),i._userM.get(12).setCustomStatus(n),Cn({userID:i._userM.getMyUserID(),statusType:1,customStatus:n})})).catch((function(e){return t.setError(e).end(),be.e("".concat(o," failed. error:"),e),En(e)})))}},{key:"getUserStatus",value:function(e){var t="".concat(this._n,".").concat("getUserStatus"),n=void 0===(e=e.userIDList)?[]:e,i=(e=this._userM.getMyUserID(),v(n)),o=void 0,s=i.indexOf(e);if(-1<s&&(i.splice(s,1),o={userID:e,statusType:1,customStatus:this._userM.get(12).getCustomStatus()}),0===i.length)return Sn({successUserList:[o],failureUserList:[]});if(!this._userM.canIUse(N.USER_STATUS))return this._userM.noUse("getUserStatus");i.length>this.MAX_QUERY_USER_COUNT&&(be.w("".concat(t," ").concat(jt(this.MAX_QUERY_USER_COUNT))),i=n.slice(0,this.MAX_QUERY_USER_COUNT));var a=new oi("getUserStatus");return this._userM.req({P:jn.GET_USER_STATUS,data:{userIDList:i}}).then((function(e){var i=void 0===(i=(e=e.data).successUserList)?[]:i,s=(e=void 0===(e=e.failureUserList)?[]:e,i=i.map((function(e){return{userID:e.userID,statusType:e.statusType,customStatus:Bi(e=e.customStatus)}})),e=e.map((function(e){var t=e.userID,n=e.invalidUserID,i=e.errorCode;return e=e.errorInfo,{userID:qe(n)?t:n,code:i,message:e}})),lt(o)||i.unshift(o),"userID count:".concat(n.length,", success count:").concat(i.length,", fail count:").concat(e.length));return a.setMessage("".concat(s)).end(),be.l("".concat(t," ok. ").concat(s,".")),Cn({successUserList:i,failureUserList:e})})).catch((function(e){return a.setMessage("userID count:".concat(n.length)).setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))}},{key:"subscribeUserStatus",value:function(e){var t,n,i,o,s="subscribeUserStatus";return this._userM.canIUse(N.USER_STATUS)?(t="".concat(this._n,".").concat(s),(n=v(e=void 0===(e=e.userIDList)?[]:e)).length>this.MAX_SUBSCRIBE_USER_COUNT&&(be.w("".concat(t," ").concat(jt(this.MAX_SUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_SUBSCRIBE_USER_COUNT)),i=new oi(s),o="userID count:".concat(e.length),be.l("".concat(t," ").concat(o)),this._userM.req({P:jn.SUB_USER_STATUS,data:{userIDList:n}}).then((function(e){return e=(void 0===(e=e.data.failureUserList)?[]:e).map((function(e){var t=e.userID,n=e.invalidUserID,i=e.errorCode;return e=e.errorInfo,{userID:qe(n)?t:n,code:i,message:e}})),i.setMessage("".concat(o," fail count:").concat(e.length)).end(),be.l("".concat(t," ok. fail count:").concat(e.length,".")),Cn({failureUserList:e})})).catch((function(e){return i.setMessage(o).setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._userM.noUse(s)}},{key:"unsubscribeUserStatus",value:function(e){var t,n,i,o,s="unsubscribeUserStatus";return this._userM.canIUse(N.USER_STATUS)?(t="".concat(this._n,".").concat(s),n=v(e=void 0===(e=(e||{}).userIDList)?[]:e),e.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(be.w("".concat(t," ").concat(jt(this.MAX_UNSUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT)),i=new oi(s),o="userID count:".concat(e.length),be.l("".concat(t," ").concat(o)),e={userIDList:n},0===n.length&&(e.userIDList=void 0,e.unsubscribeAll=1),this._userM.req({P:jn.UNSUB_USER_STATUS,data:e}).then((function(e){return e=(void 0===(e=e.data.failureUserList)?[]:e).map((function(e){var t=e.userID,n=e.invalidUserID,i=e.errorCode;return e=e.errorInfo,{userID:qe(n)?t:n,code:i,message:e}})),i.setMessage("".concat(o," fail count:").concat(e.length)).end(),be.l("".concat(t," ok. fail count:").concat(e.length,".")),Cn({failureUserList:e})})).catch((function(e){return i.setMessage("".concat(o)).setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._userM.noUse(s)}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),yo=(u(Eo,wn),s(Eo,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"mockOnNickAvatarModified",value:function(e,t){be.l("".concat(this._n,"._mockOnNickAvatarModified nick:").concat(e," avatar:").concat(t)),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:Le.NICK,value:e},{tag:Le.AVATAR,value:t}]}]})}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t,n;qe(e=e.dataList)||(t=[],e.forEach((function(e){e.blackListDelAccount&&t.push.apply(t,v(e.blackListDelAccount))})),0<t.length&&this._blacklistHandler.onAccountDeleted(t),n=[],e.forEach((function(e){e.blackListAddAccount&&n.push.apply(n,v(e.blackListAddAccount))})),0<n.length&&this._blacklistHandler.onAccountAdded(n))}},{key:"onConvProfileUpdated",value:function(e){this._profileHandler.onConvProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyNick",value:function(){return this._profileHandler.getNickAndAvatarByUserID(this.getMyUserID()).nick}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.get(13)}},{key:"filterProfanity",value:function(e,t){var n,i=this.get(29);return!i||(n=(i=i.filterText(t[e],"user_profile")).isAllowedToSend,i=i.modifiedText,!0===n&&(t[e]=i,!0))}},{key:"isMyFriend",value:function(e){var t=this.get(8);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getUserNickAndAvatar",value:function(e){return this._profileHandler.getUserNickAndAvatar(e)}},{key:"getLocalBlacklist",value:function(){return Sn(this._blacklistHandler.getLocalBlacklist())}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}])),Io=s((function e(t,n){i(this,e),this._m=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="3.5.5",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=n.unlimitedAVChatRoom,this._scene=n.scene||"",this._oversea=n.oversea,this._instanceID=n.instanceID,this._statusInstanceID=0,this._isDevMode=n.devMode,this._isTestEnv=n.testEnv,this._proxyServer=n.proxyServer,this._fileUploadProxy=n.fileUploadProxy,this._fileDownloadProxy=n.fileDownloadProxy,this._applicationID=0,this._isPartialUpdatedConvs=n.partialUpdatedConversations,this._isIndependentDomainDisabled=n.disableIndependentDomain,this._isUsingChatCore=!1,this._uiPlatform=0,this._authKey="",this._customLoginInfo=""}),[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isTestEnv",value:function(){return this._isTestEnv}},{key:"isPartialUpdatedConvs",value:function(){return this._isPartialUpdatedConvs}},{key:"isIndependentDomainDisabled",value:function(){return this._isIndependentDomainDisabled}},{key:"isSingaporeSite",value:function(){return 2e7<=this._SDKAppID&&this._SDKAppID<3e7||172e7<=this._SDKAppID&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return 3e7<=this._SDKAppID&&this._SDKAppID<4e7||173e7<=this._SDKAppID&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return 4e7<=this._SDKAppID&&this._SDKAppID<5e7||174e7<=this._SDKAppID&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return 5e7<=this._SDKAppID&&this._SDKAppID<6e7||175e7<=this._SDKAppID&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return 6e7<=this._SDKAppID&&this._SDKAppID<7e7||176e7<=this._SDKAppID&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return 7e7<=this._SDKAppID&&this._SDKAppID<8e7||177e7<=this._SDKAppID&&this._SDKAppID<178e7}},{key:"isIndonesiaSite",value:function(){return 8e7<=this._SDKAppID&&this._SDKAppID<9e7||178e7<=this._SDKAppID&&this._SDKAppID<179e7}},{key:"isIntl",value:function(){return 0===(e=this._SDKAppID)||2e7<=e&&e<9e7||172e7<=e&&e<179e7;var e}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"isUsingChatCore",value:function(){return this._isUsingChatCore}},{key:"setUsingChatCore",value:function(e){this._isUsingChatCore=e}},{key:"getUIPlatform",value:function(){return this._uiPlatform}},{key:"setUIPlatform",value:function(e){this._uiPlatform=e}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return fe?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"setApplicationID",value:function(e){this._applicationID=e}},{key:"getApplicationID",value:function(){return this._applicationID}},{key:"setDowloadFileAuthKey",value:function(e){this._authKey=e}},{key:"getDownloadFileAuthKey",value:function(){return this._authKey}},{key:"setCustomLoginInfo",value:function(e){this._customLoginInfo=e}},{key:"getCustomLoginInfo",value:function(){return this._customLoginInfo}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,i=!1,o=[];Q&&(o=Object.keys(ne));for(var s=0,a=(o=te?X?Object.keys(Nn):Object.keys(window):o).length;s<a;s++)if(o[s].toLowerCase().includes("uikit")){e=!0;break}o=null;var r,c=(Q&&!Je(ne.createGamePortal)&&Je(getApp)&&!lt(getApp())&&We(r=getApp().globalData)&&!0===r.isTUIKit&&(t=!0),!0===this._m.get(13).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))&&(n=!0),null);if(V&&!K&&void 0===Nn&&__wxConfig&&(c=__wxConfig.pages),H&&void 0===Nn&&__qqConfig&&(c=__qqConfig.pages),Ye(c)&&0<c.length){for(var u=0,l=c.length;u<l;u++)if(c[u].toLowerCase().includes("tui")){i=!0;break}c=null}return e||t||n||i}},{key:"reset",value:function(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}]),Mo={"k-vue2-pc":1,"k-vue2-h5":2,"k-vue2-h5-uni":3,"k-vue2-app-uni":4,"k-vue2-mp-uni":5,"k-vue2-pc-uni":6,"k-vue3-pc":7,"k-vue3-h5":8,"k-vue3-h5-uni":9,"k-vue3-app-uni":10,"k-vue3-mp-uni":11,"k-vue3-pc-uni":12,"k-rn":13},Co=(u(So,wn),s(So,[{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}},{key:"getPushModule",value:function(){var e=void 0,t=this.get(36),n=this.get(28);return t.canIUseTIMPush()?e=t:n.canIUseOfflinePush()&&(e=n),e}},{key:"login",value:function(e){if(this.isLoggedIn())return n=this.getMyUserID(),(n=this.getErrMsg("RepeatLogin",n))&&be.w(n),Sn({actionStatus:"OK",errorCode:0,errorInfo:n,repeatLogin:!0});if(Date.now()-this._lastLoginTs<=15e3)return this.warn("LoggingIn",e.userID),En({code:qn.REPEAT_LOGIN});be.l("".concat(this._n,".login userID:").concat(e.userID));var t,n=this._checkLoginInfo(e);return 0!==n.code?En(n):(n=this.get(12),t=e.userID,e=e.userSig,n.setUserID(t),n.setUserSig(e),this.get(20).updateProtocolConfig(),this._login())}},{key:"_login",value:function(){var e=this,t=this.get(12),n=t.getScene(),i=0,o=n,s=(n&&n.startsWith("k-")&&(o=Mo[n],n="tuikit"),new oi("login")),a=(s.setMessage("".concat(o)).setMoreMessage("identifier:".concat(this.getMyUserID())),"tuikit"===n),r=0,c=(X?r=a?3===o||4===o||5===o||6===o?31:9===o||10===o||11===o||12===o?32:4:3:Q?r=j?36:"tuikit"===n?12:11:te?r=fe?"flutter_web_uikit"===n?21:20:this._isReactUIKit()?ge?25:24:a?1===o||2===o?29:7===o||8===o?30:ge?17:14:ge?16:13:13===o&&(r=38),s.setUIPlatform(r),t.setUIPlatform(r),(a=this.getPushModule())&&(this._isWebUniapp=a.getUniAppPlatform(),o=this._getStatusInstanceID(),t.setStatusInstanceID(o),this.get(20).updateProtocolConfig(),i=a.getDeviceBrand()),"".concat(this._n,"._login"));return this._lastLoginTs=Date.now(),this.req({P:jn.LOGIN,data:{deviceBrand:i,isWebUniapp:this._isWebUniapp,customInfo:t.getCustomLoginInfo()}}).then((function(i){e._lastLoginTs=0;var o=Date.now(),a=null,r=(f=i.data).a2Key,u=f.tinyID,l=f.helloInterval,d=f.instanceID,p=f.timeStamp,h=void 0===(h=f.customStatus)?"":h,g=f.purchaseBits,f=void 0===(f=f.authKey)?"":f,m=1e3*p,_=o-s.getStartTs();if(_=m+parseInt(_/2)-o,o=s.getStartTs()+_,s.start(o),o=m,Te=_,(m=new Date).setTime(o),be.i("baseTime from server:".concat(m," offset:").concat(Te)),u){if(r)return o=e.get(21).getSocketID(),m=Bi(h),h="socketID:".concat(o," scene:").concat(n," helloInterval:").concat(l," instanceID:").concat(d," timeStamp:").concat(p)+" offset:".concat(_," customStatus:").concat(m," isWebUniapp:").concat(e._isWebUniapp),be.l("".concat(c," ok. ").concat(h)),p=o="",V&&Je(ne.getAccountInfoSync)&&(_=ne.getAccountInfoSync().miniProgram)&&(o=_.appId,p=_.envVersion),s.setMoreMessage("".concat(h," href:").concat(te?window.location.href:""," mpAppId:").concat(o," envVersion:").concat(p," authKey:").concat(f)).end(),t.setA2Key(r),t.setTinyID(u),t.setStatusInstanceID(d),t.setCustomStatus(m),t.setDowloadFileAuthKey(f),g&&e.get(27).onPushedConfig({errorCode:0,expiredTime:0,purchaseBits:g}),e.get(20).updateProtocolConfig(),e.emitIEvt(Ni.A2KEY_AND_TINYID_UPDATED),e._helloInterval=l,e.triggerReady(),(_=e.getPushModule())&&(Nn.setStorageSync("timUniAppInstanceID",d),_.init()),e._fetchCloudControlConfig(),e.get(29).init(),i;a=new Bn({code:qn.NO_A2KEY})}else a=new Bn({code:qn.NO_TINYID});throw s.setError(a).end(),a})).catch((function(t){return s.setError(t).end(!0),e._m.setNotReadyReason(qn.LOGIN_FAILED),be.e("".concat(c," failed. error:"),t),e._lastLoginTs=0,e._m.onLoginFailed(),En(t)}))}},{key:"logout",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n="".concat(this._n,".logout"),i=this.isLoggedIn();return be.i("".concat(n," type:").concat(t," isLoggedIn:").concat(i," isWebUniapp:").concat(this._isWebUniapp)),i?(new oi("logout").setMessage("identifier:".concat(this.getMyUserID())).end(!0),0===t&&this._m.setNotReadyReason(qn.LOGGED_OUT),this.req({P:jn.LOGOUT,data:{type:t,isWebUniapp:this._isWebUniapp}}).then((function(){return e.resetReady(),Sn({})})).catch((function(t){return be.e("".concat(n," error:"),t),e.resetReady(),Sn({})}))):En({code:qn.USER_NOT_LOGGED_IN})}},{key:"getLoginUser",value:function(){return this.isLoggedIn()?this.getMyUserID():""}},{key:"_fetchCloudControlConfig",value:function(){this.get(23).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return Nn.getStorageSync("timUniAppInstanceID")||0}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.req({P:jn.HELLO,data:{isWebUniapp:this._isWebUniapp}}).catch((function(t){be.w("".concat(e._n,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return qe(this.get(12).getSDKAppID())?t=qn.NO_SDKAPPID:qe(e.userID)?t=qn.NO_IDENTIFIER:qe(e.userSig)&&(t=qn.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return te&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new oi("kickedOut").setMessage("type:".concat(E.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),be.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOEvt(S.KICKED_OUT,{type:E.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(qn.KICKED_OUT_MULT_ACCOUNT),t._m.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new oi("kickedOut").setMessage("type:".concat(E.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),be.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOEvt(S.KICKED_OUT,{type:E.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(qn.KICKED_OUT_MULT_DEVICE),t._m.reset()}))}},{key:"onUserSigExpired",value:function(){new oi("kickedOut").setMessage(E.KICKED_OUT_USERSIG_EXPIRED).end(!0),be.w("".concat(this._n,".onUserSigExpired userID:").concat(this.getMyUserID())),0!==this.get(12).getStatusInstanceID()&&(this.emitOEvt(S.KICKED_OUT,{type:E.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(qn.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){new oi("kickedOut").setMessage("type:".concat(E.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),be.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.get(12).getStatusInstanceID()&&(this.emitOEvt(S.KICKED_OUT,{type:E.KICKED_OUT_REST_API}),this._m.setNotReadyReason(qn.KICKED_OUT_REST_API),this._m.reset(),this.get(21).onRestApiKickedOut())}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]));function So(e){return i(this,So),(e=n(this,So,[e]))._n="SignModule",e._helloInterval=120,e._lastLoginTs=0,e._lastWsHelloTs=0,e._isWebUniapp=0,Gi.mixin(e),e}function Eo(e){return i(this,Eo),(e=n(this,Eo,[e]))._n="UserModule",e._profileHandler=new fo(e),e._blacklistHandler=new _o(e),e._userStatusHandler=new vo(e),e.getIEmitInst().on(Ni.A2KEY_AND_TINYID_UPDATED,e.onContextUpdated,e),e}function To(e){return i(this,To),(e=n(this,To,[e]))._n="TopicModule",e._topicMap=new Map,e._getTopicTimeMap=new Map,e.TOPIC_CACHE_TIME=300,e.TOPIC_LAST_ACTIVE_TIME=3600,e.getIEmitInst().on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function ko(e){return i(this,ko),(e=n(this,ko,[e]))._n="GroupModule",e._commonGroupHandler=new Zi(e),e._groupAttributesHandler=new eo(e),e._groupCountersHandler=new to(e),e._AVChatRoomHandler=new oo(e),e._groupTipsHandler=new Qi(e),e._groupSystemNoticeHandler=new co(e),e._groupMemberHandler=new ao(e),e.groupMap=new Map,e._unjoinedAVChatRoomList=new Map,e._receiptDetailCompleteMap=new Map,e._onlineMemberCountMap=new Map,e._timeoutIDs=[],e.getIEmitInst().on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function Do(e){return i(this,Do),(e=n(this,Do,[e]))._n="ConvModule",Gi.mixin(e),e._msgListHandler=new wi(e),e._msgRemindHandler=new $i(e),e._convGroupHandler=new Ji(e),e._sll=new Hi(100),e._pagingStatus=Rn,e._pagingTs=0,e._pagingStartIdx=0,e._pagingPinnedTs=0,e._pagingPinnedStartIdx=0,e._pagingConvIDMap=new Map,e._convIDFromUnreadDBMap=new Map,e._convMap=new Map,e._tmpGroupList=[],e._tmpGroupAtTipsList=[],e._peerReadTimeMap=new Map,e._completedMap=new Map,e._roamingMsgKeyAndTimeMap=new Map,e._remoteGroupReadSeqMap=new Map,e._convTotalUnreadCount=0,e._pagingGetCostList=[],e._convMapForDiff=new Map,e._partialUpdatedConvMap=new Map,e._everClearedMap=new Map,e._bPullOnInvite=!0,e._initListeners(),e}function Ro(){return null}function Oo(e){var t=e.get(12);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:ke()}}var bo=s((function e(t){i(this,e),this._m=t,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}),[{key:"_errorTolerantHandle",value:function(){Q||"undefined"!=typeof window&&this._canIUseCookies()||(this.getItem=Ro,this.setItem=Ro,this.removeItem=Ro,this.clear=Ro)}},{key:"onCheckTimer",value:function(e){e%20==0&&0!==this._storageQueue.size&&this._doFlush()}},{key:"_doFlush",value:function(){try{var e,t=a(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=_(e.value,2),i=n[0],o=n[1];this._setStorageSync(this._getKey(i),o)}}catch(s){t.e(s)}finally{t.f()}this._storageQueue.clear()}catch(s){be.w("".concat(this._n,"._doFlush error:"),s)}}},{key:"_getPrefix",value:function(){var e=this._m.get(12);return"TIM_".concat(e.getSDKAppID(),"_").concat(e.getUserID(),"_")}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"getItem",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(i){return be.w("".concat(this._n,".getItem error:"),i),{}}}},{key:"setItem",value:function(e,t){var n;2<arguments.length&&void 0!==arguments[2]&&arguments[2]?(n=3<arguments.length&&void 0!==arguments[3]&&!arguments[3]?e:this._getKey(e),this._setStorageSync(n,t)):this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{Q?ne.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){be.w("".concat(this._n,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(i){be.w("".concat(this._n,".removeItem error:"),i)}}},{key:"getSize",value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"b";try{var i={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(i,"leftSize",{enumerable:!0,get:function(){return i.limitSize-i.size}}),Q&&(i.limitSize=1024*ne.getStorageInfoSync().limitSize),e)i.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(Q)ne.getStorageInfoSync().keys.forEach((function(e){i.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}));else if(this._canIUseCookies())for(var o in localStorage)localStorage.hasOwnProperty(o)&&(i.size+=localStorage.getItem(o).length+o.length);return this._convertUnit(i)}catch(s){be.w("".concat(this._n," error:"),s)}}},{key:"_convertUnit",value:function(e){var t,n={},i=e.unit;for(t in n.unit=i,e)"number"==typeof e[t]&&("kb"===i.toLowerCase()?n[t]=Math.round(e[t]/1024):"mb"===i.toLowerCase()?n[t]=Math.round(e[t]/1024/1024):n[t]=e[t]);return n}},{key:"_setStorageSync",value:function(e,t){Q?W?my.setStorageSync({key:e,data:t}):ne.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return Q?W?my.getStorageSync({key:e}).data:ne.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){Q?W?my.removeStorageSync({key:e}):ne.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return"undefined"!=typeof window&&navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._doFlush()}}]),Ao=s((function e(t){i(this,e),this._n="SSOLogBody",this._report=[]}),[{key:"pushIn",value:function(e){be.d("".concat(this._n,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;Ye(e)&&0!==e.length&&(be.d("".concat(this._n,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,v(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),Lo=(u(Uo,wn),s(Uo,[{key:"reportAtOnce",value:function(){this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.get(13),n=t.getItem(this.TAG,!1);!qe(n)&&Je(n.forEach)&&(be.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),i=this.getCloudConfig("evt_rpt_sdkappid_bl"),o=this.getCloudConfig("evt_rpt_tinyid_wl");lt(e)||(this.MIN_THRESHOLD=Number(e)),lt(t)||(this.WAITING_TIME=Number(t)),lt(n)||(this.REPORT_LEVEL=n.split(",").map((function(e){return Number(e)}))),lt(i)||(this.REPORT_SDKAPPID_BLACKLIST=i.split(",").map((function(e){return Number(e)}))),lt(o)||(this.REPORT_TINYID_WHITELIST=o.split(","))}},{key:"pushIn",value:function(e){e instanceof oi&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD)&&this._report()}},{key:"onCheckTimer",value:function(){Date.now()<this._lastReportTime+this.WAITING_TIME||this._reportBody.isEmpty()||this._report()}},{key:"_filterLogs",value:function(e){var t=this,n=(i=this.get(12)).getSDKAppID(),i=i.getTinyID();return Ut(this.REPORT_SDKAPPID_BLACKLIST,n)&&!Gt(this.REPORT_TINYID_WHITELIST,i)?[]:e.filter((function(e){return t.REPORT_LEVEL.includes(e.level)}))}},{key:"_report",value:function(){var e,t,n=this;this._reportBody.isEmpty()||(e=this._reportBody.getLogsInMemory(),0!==(t=this._filterLogs(e)).length?(t={header:Oo(this),event:t},this.req({P:jn.SSO_STAT,data:g({},t)}).then((function(){n._lastReportTime=Date.now()})).catch((function(t){be.w("".concat(n._n,"._report failed. error:"),t),n._lastReportTime=Date.now(),n._reportBody.backfill(e),n._reportBody.getLogsNumInMemory()>n.MAX_THRESHOLD&&n._flushAtOnce()}))):this._lastReportTime=Date.now())}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),i="".concat(this._n,"._flushAtOnce");qe(t)?(be.l("".concat(i," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):((n=n.concat(t)).length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),be.l("".concat(i," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1))}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}])),Po="none",No="online",wo=s((function e(t){i(this,e),this._m=t,this._networkType=No,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(Ni.A2KEY_AND_TINYID_UPDATED,this._startRN,this)}),[{key:"_startRN",value:function(){var e,t=this;ee&&(e=this._m.get(18).getPlugin("chat-network-monitor"))&&(this._removeListener=e.addEventListener((function(e){var n=e.isConnected;e=e.type,t._networkType!==e&&t._onNetworkStatusChange({isConnected:void 0!==n&&n,networkType:e})})))}},{key:"start",value:function(){var e=this,t="".concat(this._n,".start");Q?(ne.getNetworkType({success:function(n){e._networkType=n.networkType||n.subtype||"",n.networkType===Po?be.w("".concat(t," no network, please check!")):be.i("".concat(t," networkType:").concat(n.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),ne.onNetworkStatusChange(this._mpNetworkStatusCallback)):te&&(this._networkType=No,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:No})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Po})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=(e=e.networkType,"".concat(this._n,"._onNetworkStatusChange")),i=!1,o="previous:".concat(this._networkType," current:").concat(e);t?(be.i("".concat(n," ").concat(o)),this._networkType!==e&&(i=!0,this._networkType=e,this._m.get(21).reConnect(!0))):this._networkType!==e&&(i=!0,this._networkType=e,be.w("".concat(n," no network, please check!")),this._m.get(21).offline()),i&&new oi("networkChange").setMessage("isConnected:".concat(t," ").concat(o)).end()}},{key:"isOnline",value:function(){return this._networkType!==Po}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),Q?null!==this._mpNetworkStatusCallback&&(ne.offNetworkStatusChange&&ne.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null):te?(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null)):ee&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}]);function Uo(e){i(this,Uo),(e=n(this,Uo,[e]))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new Ao,e.MIN_THRESHOLD=20,e.MAX_THRESHOLD=100,e.WAITING_TIME=6e4,e.REPORT_LEVEL=[4,5,6],e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._lastReportTime=Date.now();var t=e.getIEmitInst();return t.on(Ni.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,e),t.on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function Go(e,t){return e(t={exports:{}},t.exports),t.exports}var xo=Go((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,i,s,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");return i=new o(i,s||e,a),s=n?n+t:t,e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],i]:e._events[s].push(i):(e._events[s]=i,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function r(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),r.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},r.prototype.listeners=function(e){e=n?n+e:e;var t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,o=t.length,s=new Array(o);i<o;i++)s[i]=t[i].fn;return s},r.prototype.listenerCount=function(e){return e=n?n+e:e,(e=this._events[e])?e.fn?1:e.length:0},r.prototype.emit=function(e,t,i,o,s,a){var r=n?n+e:e;if(!this._events[r])return!1;var c,u=this._events[r],l=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,o),!0;case 5:return u.fn.call(u.context,t,i,o,s),!0;case 6:return u.fn.call(u.context,t,i,o,s,a),!0}for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];u.fn.apply(u.context,c)}else for(var d,p=u.length,h=0;h<p;h++)switch(u[h].once&&this.removeListener(e,u[h].fn,void 0,!0),l){case 1:u[h].fn.call(u[h].context);break;case 2:u[h].fn.call(u[h].context,t);break;case 3:u[h].fn.call(u[h].context,t,i);break;case 4:u[h].fn.call(u[h].context,t,i,o);break;default:if(!c)for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];u[h].fn.apply(u[h].context,c)}return!0},r.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},r.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},r.prototype.removeListener=function(e,t,i,o){if(e=n?n+e:e,this._events[e])if(t){var s=this._events[e];if(s.fn)s.fn!==t||o&&!s.once||i&&s.context!==i||a(this,e);else{for(var r=0,c=[],u=s.length;r<u;r++)(s[r].fn!==t||o&&!s[r].once||i&&s[r].context!==i)&&c.push(s[r]);c.length?this._events[e]=1===c.length?c[0]:c:a(this,e)}}else a(this,e);return this},r.prototype.removeAllListeners=function(e){return e?(e=n?n+e:e,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=n,e.exports=r.EventEmitter=r})),Fo=["rich.my-imcloud.com","imrich.qcloud.com"],Bo=["requestSnapshotUrl"],qo=(u(zo,wn),s(zo,[{key:"_init",value:function(){this._fileDownloadProxy=this.getFileDownloadProxy(),this._authKey=this.getDownloadFileAuthKey();var e=this.get(18);this.TIMUploadPlugin=e.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin?this._initUploaderMethod():(this.COSSDK=e.getPlugin(e=Q?"cos-wx-sdk":"cos-js-sdk"),this.COSSDK?(this._getAuthorizationKey(),this.warn("CosReplacement",e)):this.warn("PluginUndetected"))}},{key:"_onCloudConfig",value:function(){var e=this,t="".concat(this._n,"._onCloudConfig"),n=this.getCloudConfig("upload_size_limit"),i=this.getCloudConfig("simple_cos"),o=this.getCloudConfig("file_dn_list");if(be.l("".concat(t," uploadSizeLimit:").concat(n," simpleCos:").concat(i)),!lt(n))try{var s=JSON.parse(n);this.UPLOAD_SIZE_LIMIT={A:s.a?1048576*parseInt(s.a):this.UPLOAD_SIZE_LIMIT.A,F:s.f?1048576*parseInt(s.f):this.UPLOAD_SIZE_LIMIT.F,I:s.i?1048576*parseInt(s.i):this.UPLOAD_SIZE_LIMIT.I,V:s.v?1048576*parseInt(s.v):this.UPLOAD_SIZE_LIMIT.V}}catch(a){}if(lt(i)||(this.isSimpleCos="1"===i),!lt(o))try{JSON.parse(o).forEach((function(t){e._fileDNList.includes(t)||e._fileDNList.push(t)}))}catch(a){}}},{key:"_getAuthorizationKey",value:function(){var e=this,t="".concat(this._n,".").concat("_getAuthorizationKey"),n=new oi("_getAuthorizationKey"),i=Math.ceil(Date.now()/1e3);this.req({P:jn.COS_SIGN,data:{duration:this.expiredTimeLimit}}).then((function(o){o=o.data;var s=(be.l("".concat(t," ok. data:"),o),o.expiredTime-i);n.setMessage("requestId:".concat(o.requestId," requestTime:").concat(i," expiredTime:").concat(o.expiredTime," diff:").concat(s,"s")).end(),!Q&&o.region&&(e.region=o.region),e.appid=o.appid,e.bucketName=o.bucketName,e.ciUrl=o.ciUrl,e.directory=o.directory,e.downloadUrl=o.downloadUrl,e.uploadUrl=o.uploadUrl,e.cosOptions={secretId:o.secretId,secretKey:o.secretKey,sessionToken:o.sessionToken,expiredTime:o.expiredTime},be.l("".concat(t," ok. region:").concat(e.region," bucketName:").concat(e.bucketName)),e._initUploaderMethod()})).catch((function(e){n.setError(e).end(),be.w("".concat(t," failed. error:"),e)}))}},{key:"_getCosPreSigUrl",value:function(e){var t=this,n="".concat(this._n,".").concat("_getCosPreSigUrl"),i=Math.ceil(Date.now()/1e3),o=new oi("_getCosPreSigUrl"),s={uploadMethod:e.uploadMethod,platform:this.getPlatform(),SDKAppID:this.getSDKAppID(),userID:e.userID,conversationType:e.conversationType,uploadConfig:[{fileID:1,fileType:e.fileType,fileName:e.fileName}]},a=jn.SIMPLE_COS_PRE_SIG;return this.isSimpleCos||(s={fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration},a=jn.COS_PRE_SIG),this.req({P:a,data:s}).then((function(e){t.tryCount=0,e=e.data||{};var s,a,r=(be.l("".concat(n," ok. isSimpleCos:").concat(t.isSimpleCos," data:"),e),"");return r=t.isSimpleCos?(s=(a=e.preSig[0]).uploadUrl,a=a.fileKey,"uploadIP:".concat(e.uploadIP," uploadUrl:").concat(s," fileKey:").concat(a," cost:").concat(zt(i))):"requestId:".concat(e.requestId," expiredTime:").concat(e.expiredTime," diff:").concat(e.expiredTime-i,"s"),o.setMessage(r).end(),e})).catch((function(i){return-1===i.code&&(i.code=qn.COS_GET_SIG_FAIL),o.setError(i).end(),be.w("".concat(n," failed. error:"),i),t.tryCount<1?(t.tryCount++,t._getCosPreSigUrl(e)):(t.tryCount=0,En({code:qn.COS_GET_SIG_FAIL}))}))}},{key:"_initUploaderMethod",value:function(){var e=this;this.TIMUploadPlugin?(this.timUploadPlugin=new this.TIMUploadPlugin,this._cosUploadMethod=function(t,n){e.timUploadPlugin.uploadFile(t,n)}):this.appid&&(this.cos=Q?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=Q?function(t,n){e.cos.postObject(t,n)}:function(t,n){e.cos.uploadFiles(t,n)})}},{key:"onCheckTimer",value:function(e){!this.COSSDK||this.TIMUploadPlugin||this.isLoggedIn()&&e%60==0&&Math.ceil(Date.now()/1e3)>=this.cosOptions.expiredTime-120&&this._getAuthorizationKey()}},{key:"getFileDNList",value:function(){return this._fileDNList}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(!0===e._relayFlag)return Promise.resolve();var t=this.get(26);switch(e.type){case E.MSG_IMAGE:return t.addTotalCount(Jn),this._uploadImage(e);case E.MSG_FILE:return t.addTotalCount(Jn),this._uploadFile(e);case E.MSG_AUDIO:return t.addTotalCount(Jn),this._uploadAudio(e);case E.MSG_VIDEO:return t.addTotalCount(Jn),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var t=this,n=this.get(2),i=e.getElements()[0],o=n.getMessageOption(e.clientSequence);return this.doUploadImage({file:o.payload.file,to:o.to,message:e,onProgress:function(e){if(i.updatePercent(e),Je(o.onProgress))try{o.onProgress(e)}catch(t){return En({code:qn.MSG_ONPROGRESS_ERR})}}}).then((function(n){var o=n.location,s=n.fileType,a=n.fileSize,r=n.width,c=n.height,u=n.smallImageUrl,l=n.smallImageWidth,d=n.smallImageHeight,p=n.largeImageUrl,h=n.largeImageWidth,f=n.largeImageHeight,m=n.imageInfoArray;n=t.isPrivateNetWork()?o:at(o),i.updateImageFormat(s);var _,v,y={size:a,url:n,width:r,height:c};if(m&&0<m.length)for(var I=0;I<m.length;I++){var M=m[I];1===M.type?_=M:2===M.type?v=M:y=g(g({},y),M)}else v=u&&p?(_={url:u,width:l,height:d},{url:p,width:h,height:f}):(_=Lt({originUrl:n,originWidth:r,originHeight:c,min:198}),Lt({originUrl:n,originWidth:r,originHeight:c,min:720}));return i.updateImageInfoArray([g({},y),g({},v),g({},_)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,n=this.get(2),i=e.getElements()[0],o=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:o.payload.file,to:o.to,message:e,onProgress:function(e){if(i.updatePercent(e),Je(o.onProgress))try{o.onProgress(e)}catch(t){return En({code:qn.MSG_ONPROGRESS_ERR})}}}).then((function(n){var o=n=n.location;return t.isPrivateNetWork()||(o=ci(o=at(n),t._fileDownloadProxy,t._authKey,t._fileDNList)),i.updateFileUrl(o),e}))}},{key:"_uploadAudio",value:function(e){var t=this,n=this.get(2),i=e.getElements()[0],o=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:o.payload.file,to:o.to,message:e,onProgress:function(e){if(i.updatePercent(e),Je(o.onProgress))try{o.onProgress(e)}catch(t){return En({code:qn.MSG_ONPROGRESS_ERR})}}}).then((function(n){return n=n.location,n=t.isPrivateNetWork()?n:at(n),i.updateAudioUrl(n),e}))}},{key:"_uploadVideo",value:function(e){var t=this,n=this.get(2),i=e.getElements()[0],o=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:o.payload.file,to:o.to,message:e,onProgress:function(e){if(i.updatePercent(e),Je(o.onProgress))try{o.onProgress(e)}catch(t){return En({code:qn.MSG_ONPROGRESS_ERR})}}}).then((function(n){var o=n.location;return n=n.snapshotInfo,o=t.isPrivateNetWork()?o:at(o),i.updateVideoUrl(o),qe(n)||i.updateSnapshotInfo(n),e}))}},{key:"_checkSizeError",value:function(e){var t="";return"A"===e?t="audio":"I"===e?t="image":"V"===e?t="video":"F"===e&&(t="file"),En({code:qn["MSG_".concat(e,"_SIZE_LIMIT")],message:this.getErrMsg("UploadSizeLimit",t,"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576,"MB"))})}},{key:"doUploadImage",value:function(e){var t,n,i=this;return!e.file||this._isEmptyFileList(e.file.files)?En({code:qn.MSG_I_SELECT_F_FIRST}):!0!==(t=this._checkImageType(e.file))||!0!==(t=this._checkImageSize(e.file))?t:(n=null,this._setUploadFileType(1),this.uploadByCOS(e).then((function(t){if(n=t,i.isPrivateNetWork())return Rt(s);if(Ye(n.imageInfoArray)){var o=n.imageInfoArray.find((function(e){return 3===e.type}));if(o)return o}var s;return ee?{width:e.file.width,height:e.file.height}:(s=at(t.location),i.COSSDK?Rt(s):Rt(s=ci(s,i._fileDownloadProxy,i._authKey,i._fileDNList)))})).then((function(e){return n.width=e.width,n.height=e.height,Promise.resolve(n)})))}},{key:"_checkImageType",value:function(e){var t="";return t=Q?e.url.slice(e.url.lastIndexOf(".")+1):ee?e.type.split("/")[1]:e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),0<=qi.indexOf(t.toLowerCase())||En({code:qn.MSG_I_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){return 0===(e=(Q||ee?e:e.files[0]).size)?En({code:qn.MSG_F_IS_EMPTY}):e<this.UPLOAD_SIZE_LIMIT.I||this._checkSizeError("I")}},{key:"doUploadFile",value:function(e){return!e.file||this._isEmptyFileList(e.file.files)?En({code:qn.MSG_F_SELECT_F_FIRST}):e.file.files[0].size>this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?En({code:qn.MSG_F_IS_EMPTY}):(this._setUploadFileType(255),this.uploadByCOS(e))}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):0===e.file.videoFile.size?En({code:qn.MSG_F_IS_EMPTY}):-1===Vi.indexOf(e.file.videoFile.type)?En({code:qn.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(2),Q||ee?this.handleVideoUpload(g(g({},e),{},{file:e.file.videoFile})):te?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,i){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){i(new Bn({code:qn.MSG_V_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):0===e.file.size?En({code:qn.MSG_F_IS_EMPTY}):(this._setUploadFileType(3),this.uploadByCOS(e)):En({code:qn.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t,n,i,o,s=this;return Je(this._cosUploadMethod)?this.timUploadPlugin?this._uploadWithPreSigUrl(e):(t=new oi("upload"),n="".concat(this._n,".uploadByCOS"),i=Date.now(),o=this._getFile(e),new Promise((function(a,r){var c=Q?s._createCosOptionsWXMiniApp(e):s._createCosOptionsWeb(e),u=s;s._cosUploadMethod(c,(function(e,c){var l,d,p=Object.create(null);c?e||Ye(c.files)&&c.files[0].error?(l=new Bn({code:qn.MSG_F_UPLOAD_FAIL}),t.setError(l).end(),be.l("".concat(n," failed. error:"),c.files[0].error),403===c.files[0].error.statusCode&&s._getAuthorizationKey(),r(l)):(p.fileName=o.name,p.fileSize=o.size,p.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),p.location=(Q?c:c.files[0].data).Location,l=Date.now()-i,c=u._formatFileSize(o.size),d=u._formatSpeed(1e3*o.size/l),c="size:".concat(c," time:").concat(l,"ms speed:").concat(d),be.l("".concat(n," success. name:").concat(o.name," ").concat(c)),a(p),(d=s.get(26)).addCost(Jn,l),d.addFileSize(Jn,o.size),t.setMessage(c).end()):(p=new Bn({code:qn.MSG_F_UPLOAD_FAIL}),t.setError(p).end(),be.w("".concat(n," failed. error:"),e),403===e.statusCode&&s._getAuthorizationKey(),r(p))}))}))):(this.warn("PluginUndetected"),En({code:qn.COS_UNDETECTED}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._n,"._uploadWithPreSigUrl"),i=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(o,s){var a=new oi("upload"),r=e.requestSnapshotUrl,c=void 0===r?void 0:r,u=f(e,Bo),l=Date.now();t._cosUploadMethod(u,(function(r,d){if(r||403===d.statusCode)a.setError(new Bn(r)).end(),h={HttpStatusCode:9999,CostTime:zt(l,!1),error:r,url:e.url},d.data&&d.data.uploadIP&&(h.uploadIP=d.data.uploadIP),t._uploadSSOLog(h),be.l("".concat(n," failed, error:"),r),s(new Bn({code:qn.MSG_F_UPLOAD_FAIL}));else{var p=Object.create(null),h=d.data.location||"",g=(t.isPrivateNetWork()||0!==h.indexOf("https://")&&0!==h.indexOf("http://")||(h=h.split("//")[1]),p.fileName=i.name,p.fileSize=i.size,p.fileType=i.type.slice(i.type.indexOf("/")+1).toLowerCase(),p.location=h,r=zt(l,!1),h=t._formatFileSize(i.size),t._formatSpeed(1e3*i.size/r));if(h="size:".concat(h," time:").concat(r,"ms speed:").concat(g," res:").concat(JSON.stringify(d.data)),be.l("".concat(n," ok. name:").concat(i.name," ").concat(h)),a.setMessage(h).end(),g={HttpStatusCode:d.statusCode,FileSize:i.size,CostTime:r,url:e.url},(d.data&&d.data.uploadIP&&(g.uploadIP=d.data.uploadIP),t._uploadSSOLog(g),h=t.get(26)).addCost(Jn,r),h.addFileSize(Jn,i.size),g=[],u.thumbUrl&&u.largeUrl&&g.push.apply(g,[t._getSmallImageInfoByUrl(u.thumbUrl,p),t._getLargeImageInfoByUrl(u.largeUrl,p)]),1===t.uploadFileType&&t.isSimpleCos&&!t.isPrivateNetWork()&&(g.push(t._getImageInfoArray(u.downloadUrl,p)),d.data.uploadIP)&&g.push(t._getDownloadIP(u.downloadUrl.split("//")[1].split("/")[0],p)),c&&g.push(t._getSnapshotInfoByUrl(c,p)),0<g.length)return Promise.all(g).then((function(){o(p)}));o(p)}}))}))}))}},{key:"_getDownloadIP",value:function(e,t){var n="".concat(this._n,"._getDownloadIP"),i=Date.now();return this.req({P:jn.GET_IP,data:{domainName:e}}).then((function(e){var o;e.data&&e.data.ip&&(be.l("".concat(n," ok. downloadIP:").concat(e.data.ip," cost:").concat(zt(i))),(o=t.location.split("/"))[0]=e.data.ip,t.location=o.join("/"))})).catch((function(e){}))}},{key:"_getImageInfoArray",value:function(e,t){var n=this,i="".concat(this._n,"._getImageInfoArray"),o=Date.now();return this.req({P:jn.GET_IMAGE_INFO,data:{imageUrl:e}}).then((function(e){return e=e.data||{},be.l("".concat(i," ok. data: ").concat(JSON.stringify(e)," cost:").concat(zt(o))),t.imageInfoArray=e.imageInfoArray,e})).catch((function(i){t.imageInfoArray=void 0,n._uploadSSOLog({HttpStatusCode:1e4,CostTime:zt(o,!1),url:e})}))}},{key:"_uploadSSOLog",value:function(e){var t,n;this.isSimpleCos&&((t=new oi).setEventType(18),e.error&&t.setError(new Bn(e.error)),n="HttpStatusCode:".concat(e.HttpStatusCode,"|CosRequestId:").concat(e.CosRequestId||"","|")+"FileAlreadyExist:".concat(e.FileAlreadyExist||0,"|FileSize:").concat(e.FileSize||0,"|CostTime:").concat(e.CostTime),e.uploadIP&&(n+="|FinalIP:".concat(e.uploadIP)),t.setMessage("OK").setMoreMessage(e.url).setExtension(n).end())}},{key:"_getRawOrUploadProxyUrl",value:function(e){var t=this.get(12).getFileUploadProxy(),n=e;return t?e.replace(/^https:\/\/[^/]+/,t):n}},{key:"_getFile",value:function(e){return Ye(e.file.files)||Xe(e.file.files)?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?wt(e/1024,1)+"KB/s":wt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),n=(n=t.name).slice(n.lastIndexOf("."));return n=this._genFileName("".concat(it(999999)).concat(n)),{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),Body:t}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){be.w("onProgress callback error:",n)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),n=this._genFileName(t.name);return t=t.url,{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),FilePath:t,onProgress:function(t){if(be.l(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){be.w("onProgress callback error:",n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t,n=this,i="",o="",s=0,a=this._getFile(e);return s=Q||ee?(i=e.message.type===E.MSG_FILE?(t=(t=a.name).slice(t.lastIndexOf(".")),this._genFileName("".concat(it(999999)).concat(t))):this._genFileName(a.name),o=a.url,1):(t=(t=a.name).slice(t.lastIndexOf(".")),i=this._genFileName("".concat(it(999999)).concat(t)),o=a,0),this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:i,uploadMethod:s,duration:this.duration,userID:e.message.from,conversationType:Et(e.message.conversationID)?1:2}).then((function(t){var s=(l=n.isSimpleCos?t.preSig[0]:t).uploadUrl,a=l.downloadUrl,r=void 0===(r=l.requestSnapshotUrl)?void 0:r,c=l.thumbUrl,u=l.largeUrl,l=l.fileKey;return t=void 0===(t=t.uploadIP)?"":t,{url:n._getRawOrUploadProxyUrl(s),fileType:n.uploadFileType,fileName:i,resources:o,downloadUrl:a,requestSnapshotUrl:r,thumbUrl:c,largeUrl:u,fileKey:l,uploadIP:!n.isPrivateNetWork()&&t,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){be.w("onProgress callback error:",n),be.e(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(Ot(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,t){var n=this,i="_getSnapshotInfoByUrl",o=new oi(i);return this.req({P:jn.VIDEO_COVER,data:{platform:this.getPlatform(),coverName:this._genFileName(it(99999)),requestSnapshotUrl:e}}).then((function(e){var s;return e=(e.data||{}).snapshotUrl,be.l("".concat(n._n,".").concat(i," ok. snapshotUrl:").concat(e)),o.setMessage("snapshotUrl:".concat(e)).end(),qe(e)?{}:Rt(s=ci(e,n._fileDownloadProxy,n._authKey,n._fileDNList)).then((function(e){t.snapshotInfo={snapshotUrl:s,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return be.w("".concat(n._n,".").concat(i," failed. error:"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"_getSmallImageInfoByUrl",value:function(e,t){return Rt(ci(e,this._fileDownloadProxy,this._authKey,this._fileDNList)).then((function(n){t.smallImageUrl=e,t.smallImageWidth=n.width,t.smallImageHeight=n.height}))}},{key:"_getLargeImageInfoByUrl",value:function(e,t){return Rt(ci(e,this._fileDownloadProxy,this._authKey,this._fileDNList)).then((function(n){t.largeImageUrl=e,t.largeImageWidth=n.width,t.largeImageHeight=n.height}))}},{key:"_isEmptyFileList",value:function(e){return!(!Xe(e)||0!==e.length)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset"))}}])),Vo=["downloadKey","pbDownloadKey","messageList"],jo=s((function e(t){i(this,e),this._n="MergerMessageHandler",this._msgM=t}),[{key:"uploadMergerMessage",value:function(e,t){var n="".concat(this._n,".").concat("uploadMergerMessage"),i=(be.d("".concat(n," message:"),e,"messageBytes:".concat(t)),e=JSON.parse(JSON.stringify(e.payload)).messageList).length,o=this._msgM.get(17).getFileDNList(),s=new oi("uploadMergerMessage");return e.forEach((function(e){ui(e.messageBody[0].type,e.messageBody,o)})),this._msgM.req({P:jn.UPLOAD_MERGER_MSG,data:{messageList:e}}).then((function(e){be.d("".concat(n," ok. response:"),e.data);var o={pbDownloadKey:o=(e=e.data).pbDownloadKey,downloadKey:e=e.downloadKey,messageNumber:i};return s.setMessage("".concat(i,"-").concat(t,"-").concat(e)).end(),o})).catch((function(e){throw be.w("".concat(n," failed. error:"),e),s.setError(e).end(),e}))}},{key:"downloadMergerMessage",value:function(e){var t=this,n="".concat(this._n,".").concat("downloadMergerMessage"),i=(be.d("".concat(n," message:"),e),e.payload.downloadKey),o=this._msgM.getFileDownloadProxy(),s=this._msgM.getDownloadFileAuthKey(),a=new oi("downloadMergerMessage");return a.setMessage("downloadKey:".concat(i)),this._msgM.req({P:jn.DOWNLOAD_MERGER_MSG,data:{downloadKey:i}}).then((function(i){be.d("".concat(n," ok. response:"),i.data);var r,c,u=t._msgM.get(17).getFileDNList();return Je(e.clearElement)?((r=e.payload).downloadKey,r.pbDownloadKey,r.messageList,r=f(r,Vo),e.clearElement(),e.setElement({type:e.type,content:g({messageList:i.data.messageList},r)},o,s,u)):(c=[],i.data.messageList.forEach((function(e){qe(e)||(e=new Si(e,o,s,u),c.push(e))})),e.payload.messageList=c,e.payload.downloadKey="",e.payload.pbDownloadKey=""),a.end(),e})).catch((function(e){throw be.w("".concat(n," failed. key:").concat(i," error:"),e),a.setError(e).end(),e}))}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===E.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var i=null,o=(t&&(t.offlinePushInfo&&(i=t.offlinePushInfo),!0===t.onlineUserOnly)&&(i?i.disablePush=!0:i={disablePush:!0}),[]),s=(We(t)&&We(t.messageControlInfo)&&(s=(r=t.messageControlInfo).excludedFromUnreadCount,a=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===s&&o.push("NoUnread"),!0===a&&o.push("NoLastMsg"),!0===r)&&o.push("NoMsgCheck"),""),a=(ut(e.cloudCustomData)&&0<e.cloudCustomData.length&&(s=e.cloudCustomData),n.pbDownloadKey),r=n.downloadKey,c=(n=n.messageNumber,(l=e.payload).title),u=l.abstractList,l=l.compatibleText,d=(d=this._msgM.get(6))&&d.isOnlineMessage(e,t)?0:void 0;return{P:jn.SEND_C2C_MSG,data:{fromAccount:this._msgM.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:a,downloadKey:r,title:c,abstractList:u,compatibleText:l,messageNumber:n}}],cloudCustomData:s,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:d,offlinePushInfo:Li(i),messageControlInfo:0!==d?o:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var i=null,o=(t&&t.offlinePushInfo&&(i=t.offlinePushInfo),[]),s=(We(t)&&We(t.messageControlInfo)&&(s=(r=t.messageControlInfo).excludedFromUnreadCount,a=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===s&&o.push("NoUnread"),!0===a&&o.push("NoLastMsg"),!0===r)&&o.push("NoMsgCheck"),""),a=(ut(e.cloudCustomData)&&0<e.cloudCustomData.length&&(s=e.cloudCustomData),n.pbDownloadKey),r=n.downloadKey,c=(n=n.messageNumber,(l=e.payload).title),u=l.abstractList,l=l.compatibleText,d=this._msgM.get(7);return t=d&&d.isOnlineMessage(e,t)?1:0,{P:jn.SEND_GRP_MSG,data:{fromAccount:this._msgM.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:a,downloadKey:r,title:c,abstractList:u,compatibleText:l,messageNumber:n}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:s,onlineOnlyFlag:t,offlinePushInfo:Li(i),clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||d.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0==t?o:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}}]),Ho={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MSG_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},Ko=[qn.MSG_ONPROGRESS_ERR,qn.MSG_I_SELECT_F_FIRST,qn.MSG_I_TYPES_LIMIT,qn.MSG_F_IS_EMPTY,qn.MSG_I_SIZE_LIMIT,qn.MSG_F_SELECT_F_FIRST,qn.MSG_F_SIZE_LIMIT,qn.MSG_V_SIZE_LIMIT,qn.MSG_V_TYPES_LIMIT,qn.MSG_A_UPLOAD_FAIL,qn.MSG_A_SIZE_LIMIT,qn.COS_UNDETECTED];function zo(e){i(this,zo),(e=n(this,zo,[e]))._n="UploadModule",e.TIMUploadPlugin=null,e.timUploadPlugin=null,e.COSSDK=null,e._cosUploadMethod=null,e.expiredTimeLimit=600,e.appid=0,e.bucketName="",e.ciUrl="",e.directory="",e.downloadUrl="",e.uploadUrl="",e.region="ap-shanghai",e.cos=null,e.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},e.uploadFileType="",e.duration=900,e.tryCount=0,e.UPLOAD_SIZE_LIMIT={A:20971520,F:104857600,I:20971520,V:104857600},e.isSimpleCos=!1,e._fileDownloadProxy="",e._authKey="",e._fileDNList=Fo;var t=e.getIEmitInst();return t.on(Ni.A2KEY_AND_TINYID_UPDATED,e._init,e),t.on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function Wo(e){var t=!1;return Object.values(Ho).includes(e)&&(t=!0),120001<=e&&e<=13e4||10100<=e&&e<=10200||t}u(as,wn);var Yo=s(as,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new ki(e));return e=ut(e.payload)?e.payload:e.payload.text,e=new si({text:e}),t=this._getNickAndAvatarByUserID(t),n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new ki(e));if(Q){if(He(o=e.payload.file))return void this.warn("FileUnsupportedInMP","createImageMessage");var i=o.tempFiles[0].path||o.tempFiles[0].tempFilePath,o={url:i,name:i.slice(i.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:i.slice(i.lastIndexOf(".")+1).toLowerCase()};e.payload.file=o}else ee?(o={url:(i=e.payload.file).uri,name:i.fileName,size:i.fileSize||1,type:i.type,width:i.width,height:i.height},e.payload.file=o):te&&(He(e.payload.file)?(i=e.payload.file,e.payload.file={files:[i]}):We(e.payload.file)&&void 0!==Nn&&(o=e.payload.file.tempFiles[0],e.payload.file={files:[o]}));return i=this.get(17).getFileDNList(),o=new pi({imageFormat:Ae.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file},this.getFileDownloadProxy(),this.getDownloadFileAuthKey(),i),i=this._getNickAndAvatarByUserID(t),n.setElement(o),n.setNickAndAvatar(i),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var t=e.payload.file,n=(Q&&(n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()},e.payload.file=n),ee&&(n={url:t.uri,name:t.uri.slice(t.uri.lastIndexOf("/")+1),size:t.fileSize||1,second:Math.floor(t.duration/1e3),type:t.uri.slice(t.uri.lastIndexOf(".")+1).toLowerCase()},e.payload.file=n,qe(t.uri))&&this.warn("VoiceFileInRN"),this.getMyUserID()),i=(e.currentUser=n,e.senderTinyID=this.getMyTinyID(),this.get(17).getFileDNList()),o=new ki(e);return t=new gi({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size||1,url:t.tempFilePath||t.uri,uuid:this._generateUUID(e.payload.file)},this.getFileDownloadProxy(),this.getDownloadFileAuthKey(),i),i=this._getNickAndAvatarByUserID(n),o.setElement(t),o.setNickAndAvatar(i),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0,{});if(Q){if(W)return void this.warn("VideoUnsupportedInAlipay");if(He(e.payload.file))return void this.warn("FileUnsupportedInMP","createVideoMessage");Ye((i=e.payload.file).tempFiles)&&(i=i.tempFiles[0]),n.url=i.tempFilePath,n.name=i.tempFilePath.slice(i.tempFilePath.lastIndexOf("/")+1),n.size=i.size||1,n.second=i.duration||0,n.type=i.tempFilePath.slice(i.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else ee?(i=e.payload.file,n.url=i.uri,n.name=i.fileName,n.size=i.fileSize||1,n.second=i.duration||0,n.type=i.type.split("/")[1]):te&&(He(e.payload.file)?(i=e.payload.file,e.payload.file.files=[i]):We(e.payload.file)&&void 0!==Nn&&(i=e.payload.file.tempFile,e.payload.file.files=[i]),i=e.payload.file,n.url=window.URL.createObjectURL(i.files[0]),n.name=i.files[0].name,n.size=i.files[0].size||1,n.second=i.files[0].duration||0,n.type=i.files[0].type.split("/")[1]);e.payload.file.videoFile=n;var i=this.get(17).getFileDNList(),o=new ki(e);return n=new Mi({videoFormat:n.type,videoSecond:wt(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile,"jpg"),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:"jpg"},this.getFileDownloadProxy(),this.getDownloadFileAuthKey(),i),i=this._getNickAndAvatarByUserID(t),o.setElement(n),o.setNickAndAvatar(i),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new ki(e));return e=new Ii({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),t=this._getNickAndAvatarByUserID(t),n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new ki(e));return e=new hi(e.payload),t=this._getNickAndAvatarByUserID(t),n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),t=this._getNickAndAvatarByUserID(t),new ki(e));return e=new Ei(e.payload),n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n.setRelayFlag(!0),n}},{key:"createForwardMessage",value:function(e){var t,n,i=e.to,o=e.conversationType,s=e.priority,a=e.payload,r=e.needReadReceipt,c=e.receiverList;return Ye(a._elements)?(t=this.getMyUserID(),n=this._getNickAndAvatarByUserID(t),a.type===E.MSG_GRP_TIP?En({code:qn.MSG_FORWARD_TYPE_INVALID}):(o={to:i,conversationType:o,conversationID:"".concat(o).concat(i),priority:s,isPlaceMessage:0,status:Tn,currentUser:t,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||a.cloudCustomData||"",needReadReceipt:r,receiverList:c,isSupportExtension:e.isSupportExtension||!1},(i=new ki(o)).setElement(a._elements[0]),i.setNickAndAvatar(n),i.setNameCard(this._getNameCardByGroupID(a)),i.setRelayFlag(!0),i)):En({code:qn.MSG_FORWARD_INVALID_ELEMENTS})}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(Q){if(!V&&!H&&!$)return;var t=ne.getSystemInfoSync().SDKVersion;if(V&&At(t,"2.5.0")<0)return void this.warn("WXChooseMessageFile");if(H&&At(t,"1.18.0")<0)return void this.warn("QQChooseMessageFile")}te||$?He(e.payload.file)?(t=e.payload.file,e.payload.file={files:[t]}):We(e.payload.file)&&void 0!==Nn&&(i=(t=e.payload.file).tempFiles,t=t.files,n=null,Ye(i)?n=i[0]:Ye(t)&&(n=t[0]),e.payload.file={files:[n]}):V||H?(t=g(g({},(i=e.payload.file.tempFiles)[0]),{},{url:i[0].path}),e.payload.file={files:[t]}):ee&&(i=g(g({},n=e.payload.file),{},{url:n.uri}),e.payload.file={files:[i]}),t=this.getMyUserID();var n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new ki(e)),i=new yi({uuid:this._generateUUID(e.payload.file),file:e.payload.file});return t=this._getNickAndAvatarByUserID(t),n.setElement(i),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new ki(e));return e=new Ci(e.payload),t=this._getNickAndAvatarByUserID(t),n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onNoModule",value:function(){return En({code:qn.NO_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n=this;if(!1===this.get(29).filterMessage(e,t))return e.hasRiskContent=!0,this._onSendMessageFailed(e,new Bn({code:qn.PROFANITY_FOUND}));var i,o,s,a,r=null;if(e.conversationType===E.CONV_C2C)r=this.get(6);else{if(e.conversationType!==E.CONV_GROUP)return En({code:qn.MSG_INVALID_CONV_TYPE});r=this.get(7)}return r?(o="".concat(this._n,".sendMessageInstance"),s=this.get(11),a=r.isOnlineMessage(e,t),this.get(17).upload(e).then((function(){return n._getSendMessageSpecifiedKey(e)===$n&&n.get(26).addSuccessCount(Jn),n._guardForGroup(e).then((function(){if(!e.isSendable())return En({code:qn.MSG_F_URL_IS_EMPTY});n._addSendMessageTotalCount(e),i=Date.now();var o=function(e){var t="utf-8";te&&document&&(t=document.charset.toLowerCase());var n,i=0,o=e.length;if("utf-8"===t||"utf8"===t)for(var s=0;s<o;s++)(n=e.codePointAt(s))<=127?i+=1:n<=2047?i+=2:n<=65535?i+=3:(i+=4,s++);else if("utf-16"===t||"utf16"===t)for(var a=0;a<o;a++)(n=e.codePointAt(a))<=65535?i+=2:(i+=4,a++);else i=e.replace(/[^\x00-\xff]/g,"aa").length;return i}(JSON.stringify(e));return e.type===E.MSG_MERGER&&11264<o?n._mergerMessageHandler.uploadMergerMessage(e,o).then((function(i){return i=n._mergerMessageHandler.createMergerMessagePack(e,t,i),n.req(i)})):(s.setMessageRandom(e),r.sendMessage(e,t))})).then((function(r){var c=(r=r.data).time,u=r.sequence,l=r.readReceiptCode;return r=r.messageDropReason,Ke(l)&&0!==l&&(new oi("sendMessageWithReceipt").setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(u," readReceiptCode:").concat(l)).end(),be.w("".concat(o," readReceiptCode:").concat(l," message:").concat(n.getErrMsg(l)))),r&&(l=new oi("messageDropReason"),r="from:".concat(e.from," to:").concat(e.to," sequence:").concat(u," messageDropReason:").concat(r),l.setMessage(r).end(),be.w("".concat(o," ").concat(r))),n._addSendMessageSuccessCount(e,i),n._messageOptionsMap.delete(e.clientSequence),!0===e.isResend&&(l=s.findMessage(e.ID))&&(be.l("".concat(o," resend ok. ID:").concat(l.ID)),s.deleteLocalMessage(l)),e.status=kn,e.time=c,r=!1,e.conversationType===E.CONV_GROUP?e.sequence=u:e.conversationType===E.CONV_C2C&&(l=s.getLatestMessageSentByMe(e.conversationID))&&(c=l.nick,u=l.avatar,c===e.nick&&u===e.avatar||(r=!0)),r&&s.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),!0===a?e._onlineOnlyFlag=!0:(s.appendToMessageList(e),l=e,We(t)&&We(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,l=""),!0===t.messageControlInfo.excludedFromUnreadCount)&&(e._isExcludedFromUnreadCount=!0),c=e.conversationType,St(e.to)&&(c=E.CONV_TOPIC,n.get(10).onMessageSent({groupID:xt(e.to),topicID:e.to,lastMessage:l})),s.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:c,subType:e.conversationSubType,lastMessage:l}]})),e._relayFlag||"TIMImageElem"!==e.type||Pt(e.payload.imageInfoArray),Cn({message:e})}))})).catch((function(t){return n._onSendMessageFailed(e,t,a)}))):this._onNoModule()}},{key:"_guardForGroup",value:function(e){if(e.conversationType!==E.CONV_GROUP)return Promise.resolve();var t=this.get(7);if(!t)return this._onNoModule();if(Ct({groupID:e.to})){var n=t.getLocalGroupProfile(e.to);if(n&&n.isSupportTopic)return En({code:qn.MSG_SEND_GRP_WITH_TOPIC_FAIL})}return t.guardForAVChatRoom(e)}},{key:"_onSendMessageFailed",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i="".concat(this._n,"._onSendMessageFailed"),o=(e.status=Dn,80001!==t.code&&80004!==t.code||(e.hasRiskContent=!0),this.get(11)),s=(o.deleteMessageRandom(e),10100<=t.code&&t.code<=10200||120001<=t.code&&t.code<=13e4);return n||s||!0===o.appendToMessageList(e)&&be.l("".concat(i," message stored, ID:").concat(e.ID)),this._addSendMessageFailCountOnUser(e,t),n=new oi("sendMessage"),s="head.seq:".concat(t.data.headSeq," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to),te&&("connection"in navigator&&(o=navigator.connection,s+=" downlink:".concat(o.downlink," effectiveType:").concat(o.effectiveType," rtt:").concat(o.rtt)),"memory"in window.performance)&&(o=window.performance.memory,s+=" usedJSHeapSize:".concat(o.usedJSHeapSize," totalJSHeapSize:").concat(o.totalJSHeapSize," jsHeapSizeLimit:").concat(o.jsHeapSizeLimit)),n.setMessage(s).setError(t).end(),be.e("".concat(i," ").concat(s," error:"),t),En(new Bn({code:t&&t.code?t.code:qn.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([E.MSG_IMAGE,E.MSG_AUDIO,E.MSG_VIDEO,E.MSG_FILE].includes(e.type))return $n;if(e.conversationType===E.CONV_C2C)return zn;if(e.conversationType===E.CONV_GROUP){var t=this.get(7);if(t&&(t=t.getLocalGroupProfile(e.to)))return Mt(e=t.type)?Yn:Wn}}},{key:"_addSendMessageTotalCount",value:function(e){(e=this._getSendMessageSpecifiedKey(e))&&this.get(26).addTotalCount(e)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n;(e=this._getSendMessageSpecifiedKey(e))&&((n=this.get(26)).addSuccessCount(e),n.addCost(e,zt(t,!1)))}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){t=void 0===(t=t.code)?-1:t;var n,i=this.get(26);(e=this._getSendMessageSpecifiedKey(e))===$n&&(n=!1,n=!!Ko.includes(t)||n)?i.addFailedCountOfUserSide(Jn):Wo(t)&&e&&i.addFailedCountOfUserSide(e)}},{key:"resendMessage",value:function(e,t){return e.isResend=!0,e.status=Tn,this.sendMessageInstance(e,t)}},{key:"revokeMessage",value:function(e){var t,n,i=this,o=null;return e.conversationType===E.CONV_C2C?o=this.get(6):e.conversationType===E.CONV_GROUP&&(o=this.get(7)),o?((t=new oi("revokeMessage")).setMessage("type:".concat(e.type," from:").concat(e.from," to:").concat(e.to)),n="".concat(this._n,".").concat("revokeMessage"),o.revokeMessage(e).then((function(o){return qe(o=o.data.recallRetList)||0===o[0].retCode?(be.i("".concat(n," ok. ID:").concat(e.ID)),e.isRevoked=!0,t.end(),i.get(11).onMessageRevoked([e]),Cn({message:e})):(o=new Bn({code:o[0].retCode,data:{message:e}}),t.setCode(o.code).setMoreMessage(o.message).end(),En(o))})).catch((function(i){t.setError(i).end();var o=new Bn({code:i&&i.code?i.code:qn.MSG_REVOKE_FAIL,message:i&&i.message?i.message:void 0,data:{message:e}});return be.w("".concat(n," failed. error:"),i),En(o)}))):this._onNoModule()}},{key:"deleteMessage",value:function(e){var t=this,n=null,i=e[0],o=i.conversationID,s="",a=[],r=[];if(i.conversationType===E.CONV_C2C)n=this.get(6),s=o.replace(E.CONV_C2C,""),e.forEach((function(e){e&&e.status===kn&&e.conversationID===o&&(e._onlineOnlyFlag||a.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),r.push(e))}));else if(i.conversationType===E.CONV_GROUP)n=this.get(7),s=o.replace(E.CONV_GROUP,""),e.forEach((function(e){e&&e.status===kn&&e.conversationID===o&&(e._onlineOnlyFlag||a.push("".concat(e.sequence)),r.push(e))}));else if(i.conversationType===E.CONV_SYSTEM)return En({code:qn.CANNOT_DELETE_GRP_SYSTEM_NOTICE});if(!n)return this._onNoModule();if(0===a.length)return this._onMessageDeleted(r);30<a.length&&(a=a.slice(0,30),r=r.slice(0,30));var c=new oi("deleteMessage"),u=(c.setMessage("to:".concat(s," count:").concat(a.length)),"".concat(this._n,".").concat("deleteMessage"));return n.deleteMessage({to:s,keyList:a}).then((function(e){return c.end(),be.i("".concat(u," ok")),t._onMessageDeleted(r)})).catch((function(e){return c.setError(e).end(),be.w("".concat(u," failed. error:"),e),En(e=new Bn({code:e&&e.code?e.code:qn.MSG_DELETE_FAIL,message:e&&e.message?e.message:void 0}))}))}},{key:"_onMessageDeleted",value:function(e){return this.get(11).onMessageDeleted(e),Sn({messageList:e})}},{key:"translateText",value:function(e){var t="".concat(this._n,".").concat("translateText"),n=e.sourceTextList,i=e.sourceLanguage,o=(e=e.targetLanguage,new oi("translateText"));return o.setMessage("sourceLanguage:".concat(i," targetLanguage:").concat(e)),this.req({P:jn.TRANSLATE_TEXT,data:{sourceTextList:n,source:i||"auto",target:e,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var n=(e=e.data).error,i=e.requestID;if(e=e.translatedTextList,0===n.code)return o.end(),be.i("".concat(t," ok. requestID:").concat(i)),Cn({translatedTextList:e});throw g(g({},n),{},{requestID:i})})).catch((function(e){return o.setCode(e.code).setMoreMessage(e.requestID).end(),be.w("".concat(t," failed. error:"),e),En({code:e.code||qn.TRANSLATE_TEXT_FAIL,message:e.message})}))}},{key:"convertVoiceToText",value:function(e){var t,n,i,o=e.message,s=(e=e.language,o.payload.url);return(o.from===this.getMyUserID()&&"out"===o.flow&&(s=o.payload.remoteAudioUrl),o=/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/).test(s)?(o=o.exec(s)[1]||"mp3",t="16k_zh-PY",e?"zh (cmn-Hans-CN)"===e?t="16k_zh":"en-US"===e?t="16k_en":"yue-Hant-HK"===e?t="16k_yue":"ja-JP"===e&&(t="16k_ja"):t="16k_zh-PY",e="serviceType:".concat(t," url:").concat(s),n="".concat(this._n,".").concat("convertVoiceToText"),be.i("".concat(n," ").concat(e)),(i=new oi("convertVoiceToText")).setMessage(e),this.req({P:jn.VOICE_TO_TEXT,data:{url:s,language:t,SDKAppID:this.getSDKAppID(),format:o}}).then((function(e){var t=(e=e.data).error,o=e.requestID;if(e=e.result,0===t.code)return i.end(),be.i("".concat(n," ok. requestID:").concat(o)),Cn({result:e});throw g(g({},t),{},{requestID:o})})).catch((function(e){return i.setCode(e.code).setMoreMessage(e.requestID||"").end(),be.w("".concat(n," failed. error:"),e),En({code:qn.VOICE_TO_TEXT_FAIL})}))):En({code:qn.UNSUPPORTED_VOICE_FORMAT})}},{key:"modifyRemoteMessage",value:function(e){var t=this;if(!1===this.get(29).filterMessage(e))return e.hasRiskContent=!0,En({code:qn.PROFANITY_FOUND,data:{message:e}});var n=null,i=e.conversationType,o=e.to;if(i===E.CONV_C2C)n=this.get(6);else if(i===E.CONV_GROUP){if(!(n=this.get(7)))return this._onNoModule();if(n.isMessageFromOrToAVChatroom(o))return En({code:qn.MSG_MODIFY_DISABLED_IN_AV,data:{message:e}})}var s=new oi("modifyMessage"),a=(s.setMessage("to:".concat(o)),"".concat(this._n,".modifyRemoteMessage"));return n.modifyRemoteMessage(e).then((function(n){return s.end(),be.i("".concat(a," ok")),Cn({message:n=t._onModifyRemoteMessageResp(e,n.data)})})).catch((function(n){var i;return s.setCode(n.code).setMoreMessage(n.message).end(),be.w("".concat(a," failed. error:"),n),20027===n.code?(i=t._onModifyRemoteMessageResp(e,n.data),En({code:qn.MSG_MODIFY_CONFLICT,data:{message:i}})):En({code:n.code,message:n.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){be.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,i=e.from,o=e.to,s=e.random,a=e.sequence,r=(e=e.time,t.elements),c=t.messageVersion;return t=void 0===(t=t.cloudCustomData)?"":t,this.get(11).onMessageModified({conversationType:n,from:i,to:o,time:e,random:s,sequence:a,elements:r,cloudCustomData:t,messageVersion:c})}},{key:"_generateUUID",value:function(e,t){var n=this.get(12);return n="".concat(n.getSDKAppID(),"-").concat(n.getUserID(),"-").concat(ot()),t?"".concat(n,".").concat(t):(e=(t=e.name||e.value||e.url||e.tempFilePath)&&t.slice(t.lastIndexOf(".")+1))?"".concat(n,".").concat(e):n}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.get(4).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===E.CONV_GROUP){var t=this.get(7);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]),$o=(u(ss,wn),s(ss,[{key:"onMsgExtNotify",value:function(e){var t=this,n=(e=e.dataList).messageInfo,i=e.operateType,o=e.operateResultList,s=e.tinyID,a=(e=e.globalSequence,n.clientTime),r=(n=n.random,"".concat(s,"-").concat(a,"-").concat(n)),c=[],u=[],l=(be.l("".concat(this._n,".onMsgExtNotify messageID:").concat(r," operateType:").concat(i," globalSequence:").concat(e)),this._updateGlobalSeq(r,e),!1),d=!1;o.forEach((function(e){var n=void 0===(n=e.extensions)?[]:n,o=e.clearSequence;1===i?(l=!0,n.forEach((function(e){c.push({key:e.key,value:e.value})})),t._updateLocalExt(r,n)):2===i?(d=!0,n.forEach((function(e){u.push(e.key)})),t._updateLocalExt(r,n)):3===i&&(d=!0,t._hasLocalExt(r)&&t._getLocalExt(r).forEach((function(e,t){e.seq<=o&&!qe(e.value)&&u.push(t)})),t._clearLocalExt(r,o))})),l&&this.emitOEvt(S.MESSAGE_EXTENSIONS_UPDATED,{messageID:r,extensions:c}),d&&this.emitOEvt(S.MESSAGE_EXTENSIONS_DELETED,{messageID:r,keyList:u})}},{key:"setMessageExtensions",value:function(e,t){var n,i,o,s,a,r,c,u="setMessageExtensions";return this.canIUse(N.MSG_EXT)?(n="".concat(this._n,".").concat(u),i=e.ID,o=e.conversationID,s=e.sequence,a=e.time,r=v(t),20<t.length&&(r=t.slice(0,20),be.w("".concat(n,". the length of extensions cannot exceed 20."))),t="convID:".concat(o," messageID:").concat(i," sequence:").concat(s," time:").concat(a," count:").concat(r.length),(c=new oi(u)).setMessage(t),be.l("".concat(n," ").concat(t)),this._modifyMsgExts(e,r).then((function(e){var t=e.resultList,i=e.successCount;return e=e.failureCount,i="successCount:".concat(i," failCount:").concat(e),c.setMoreMessage(i).end(),be.l("".concat(n," ok. ").concat(i)),Cn({extensions:t})})).catch((function(e){return c.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))):this.noUse(u)}},{key:"getMessageExtensions",value:function(e){var t,n,i,o,s,a,r,c=this,u="getMessageExtensions";return this.canIUse(N.MSG_EXT)?(t="".concat(this._n,".").concat(u),n=e.ID,s=e.conversationID,i=e.sequence,o=e.time,s="convID:".concat(s," messageID:").concat(n," sequence:").concat(i," time:").concat(o),(a=new oi(u)).setMessage(s),r=void be.l("".concat(t," ").concat(s)),this.getMsgExtsMap.has(n)&&(r=this._getGlobalSeq(n)),this._getMsgExts(e,r).then((function(e){return a.end(),be.l("".concat(t," ok. extCount:").concat(e.length)),lt(r)&&0<e.length&&c.getMsgExtsMap.set(n,1),Cn({extensions:e})})).catch((function(e){return a.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this.noUse(u)}},{key:"deleteMessageExtensions",value:function(e,t){var n,i,o,s,a,r,c,u="deleteMessageExtensions";return this.canIUse(N.MSG_EXT)?(n="".concat(this._n,".").concat(u),i=[],o=3,qe(t)||(o=2,t.forEach((function(e){i.push({key:e,value:"",seq:0})}))),t=e.ID,r=e.conversationID,s=e.sequence,a=e.time,r="convID:".concat(r," messageID:").concat(t," sequence:").concat(s," time:").concat(a," operateType:").concat(o),(c=new oi(u)).setMessage(r),be.l("".concat(n," ").concat(r)),this._modifyMsgExts(e,i,o).then((function(e){var t=e.resultList,i=e.successCount,s=(e=e.failureCount,"");return 2===o&&(s="success count:".concat(i," fail count:").concat(e)),c.setMoreMessage("".concat(s)).end(),be.l("".concat(n," ok. ").concat(s)),Cn({extensions:t})})).catch((function(e){return c.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))):this.noUse(u)}},{key:"_modifyMsgExts",value:function(e,t){var n=this,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=St(e.to)?E.CONV_TOPIC:e.conversationType,s=void 0,a=(3!==i&&(s=this._getReqExts(e,t)),null);switch(o){case E.CONV_C2C:a=this.get(6);break;case E.CONV_GROUP:a=this.get(7);break;case E.CONV_TOPIC:a=this.get(10);break;default:return En({code:qn.NO_MODULE})}return a.modifyMsgExts(e,s,i).then((function(t){var i=(t=t.data).extensions,o=(t=t.seq,[]),s=0,a=0,r=[];return(i=qe(i)?[]:i).forEach((function(e){var t=e.errorCode,n=(e=e.extension).key,i=e.value;e=e.seq,o.push({code:t,key:n,value:i}),0===t?s++:a++,r.push({key:n,value:i,seq:e})})),n._updateGlobalSeq(e.ID,t),0<r.length&&(n._updateLocalExt(e.ID,r),r=null),{resultList:o,successCount:s,failureCount:a}})).catch((function(e){return En(e)}))}},{key:"_getReqExts",value:function(e,t){var n,i=[];return this._hasLocalExt(e.ID)?(n=this._getLocalExt(e.ID),t.forEach((function(e){var t=e.key,o=(e=e.value,0);n.has(t)&&(o=n.get(t).seq),i.push({key:t,value:e,seq:o})}))):t.forEach((function(e){var t=e.key;e=e.value,i.push({key:t,value:e,seq:0})})),i}},{key:"_getMsgExts",value:function(e,t){var n=this,i="".concat(this._n,"._getMsgExts"),o=e.ID,s=null;switch(St(e.to)?E.CONV_TOPIC:e.conversationType){case E.CONV_C2C:s=this.get(6);break;case E.CONV_GROUP:s=this.get(7);break;case E.CONV_TOPIC:s=this.get(10);break;default:return En({code:qn.NO_MODULE})}return s.getMessageExtensions(e,t).then((function(t){var s=(t=t.data).extensions,a=t.completeFlag,r=t.globalSequence;return t=t.clearSequence,s=qe(s)?[]:s,be.l("".concat(i," ok. completeFlag:").concat(a," globalSequence:").concat(r," clearSequence:").concat(t," count:").concat(s.length)),n._updateLocalExt(o,s),n._clearLocalExt(o,t),n._updateGlobalSeq(o,r),1!==a?(t=s.slice(-1)[0].seq+1,n._getMsgExts(e,t)):n._getLocalExtList(o)})).catch((function(e){return En(e)}))}},{key:"_hasLocalExt",value:function(e){return this.msgExtMap.has(e)}},{key:"_getLocalExt",value:function(e){return this.msgExtMap.get(e)}},{key:"_updateLocalExt",value:function(e,t){this._hasLocalExt(e)||this.msgExtMap.set(e,new Map);var n=this._getLocalExt(e);t.forEach((function(e){var t=e.key,i=e.value;e=e.seq,n.set(t,{value:void 0===i?"":i,seq:e})}))}},{key:"_clearLocalExt",value:function(e,t){var n;t<=0||!this._hasLocalExt(e)||(n=this._getLocalExt(e)).forEach((function(e,i){e.seq<=t&&n.delete(i)}))}},{key:"_getLocalExtList",value:function(e){var t=[];return this._hasLocalExt(e)&&this._getLocalExt(e).forEach((function(e,n){qe(e=e.value)||t.push({key:n,value:e})})),t}},{key:"_getGlobalSeq",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSeq",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this.msgExtMap.clear(),this.globalSeqMap.clear(),this.getMsgExtsMap.clear()}}])),Jo=(u(os,wn),s(os,[{key:"onReactionNotifyList",value:function(e){var t=this;(void 0===(e=(e||{}).dataList)?[]:e).forEach((function(e){var n=e.C2CMessageInfo,i=void 0===(i=e.groupMessageInfo)?{}:i,o=(e=void 0===(e=e.reactionList)?[]:e,i=(n=g(g({},void 0===n?{}:n),i)).tinyID,n.clientTime),s=(n=n.random,i="".concat(i,"-").concat(o,"-").concat(n),[]);e.forEach((function(e){lt(e.userIDList)&&(e.userIDList=[],e.count=0),s.push.apply(s,v(e.userIDList))})),be.l("".concat(t._n,".onReactionNotifyList messageID:").concat(i," reactionList:").concat(e.length)),t._handleReactionSummary([{messageID:i,reactionList:e}],s).then((function(e){t.emitOEvt(S.MESSAGE_REACTIONS_UPDATED,g({},e[0]))}))}))}},{key:"onReactionNotify",value:function(e){var t=(e=e.dataList||{}).C2CMessageInfo,n=void 0===(n=e.groupMessageInfo)?{}:n,i=e.reactionID,o=(e=e.operateType,n=(t=g(g({},void 0===t?{}:t),n)).tinyID,t.clientTime);t=t.random,n="".concat(n,"-").concat(o,"-").concat(t),be.l("".concat(this._n,".onReactionNotify messageID:").concat(n," reactionID:").concat(i," operateType:").concat(e)),1===e?this._addReactedByMyselfMap(n,i):this._removeReactedByMyselfMap(n,i),o="".concat(n,"-").concat(i),this._reactionInfoMap.has(o)&&((t=this._reactionInfoMap.get(o)).reactedByMyself=1===e,this.emitOEvt(S.MESSAGE_REACTIONS_UPDATED,{messageID:n,reactionList:[t]}))}},{key:"addMessageReaction",value:function(e,t){var n,i,o,s,a=this,r="addMessageReaction";return this.canIUse(N.MSG_REACTION)?(n="".concat(this._n,".").concat(r),s=e.ID,i=e.conversationID,i="convID:".concat(i," messageID:").concat(s," reactionID:").concat(t),(o=new oi(r)).setMessage(i),be.l("".concat(n," ").concat(i)),s=this._createReactionOperationPack(e,t,1),this._addReactedByMyselfMap(e.ID,t),this.req(s).then((function(){return o.end(),be.l("".concat(n," ok.")),Cn()})).catch((function(i){return a._removeReactedByMyselfMap(e.ID,t),o.setError(i).end(),be.e("".concat(n," failed. error:"),i),En(i)}))):this.noUse(r)}},{key:"removeMessageReaction",value:function(e,t){var n,i,o,s,a="removeMessageReaction";return this.canIUse(N.MSG_REACTION)?(n="".concat(this._n,".").concat(a),s=e.ID,i=e.conversationID,i="convID:".concat(i," messageID:").concat(s," reactionID:").concat(t),(o=new oi(a)).setMessage(i),be.l("".concat(n," ").concat(i)),s=this._createReactionOperationPack(e,t,2),this._removeReactedByMyselfMap(e.ID,t),this.req(s).then((function(){return o.end(),be.l("".concat(n," ok.")),Cn()})).catch((function(e){return o.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))):this.noUse(a)}},{key:"getMessageReactions",value:function(e){var t,n,i,o,s,a,r=this,c="getMessageReactions";return this.canIUse(N.MSG_REACTION)?(t="".concat(this._n,".").concat(c),n=e.messageList,a=e.maxUserCountPerReaction,i=n[0].conversationID,i="convID:".concat(i," maxUserCountPerReaction:").concat(a," msgCount:").concat(n.length),(o=new oi(c)).setMessage(i),be.l("".concat(t," ").concat(i)),s=new Map,a=this._createReactionSummaryPack(g(g({},e),{},{messageIDMap:s})),this.req(a).then((function(e){e=e.data.resultList;var t=[],n=[];return(void 0===e?[]:e).forEach((function(e){var i=void 0===(i=e.messageKey)?void 0:i,o=void 0===(o=e.messageSequence)?void 0:o;e=void 0===(e=e.reactionList)?[]:e,o=lt(i)?s.get(o):s.get(i),t.push({messageID:o,reactionList:e}),e.forEach((function(e){n.push.apply(n,v(e.userIDList))}))})),r._handleReactionSummary(t,n)})).then((function(e){return o.end(),be.l("".concat(t," ok.")),s.clear(),Cn({resultList:e})})).catch((function(e){return o.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this.noUse(c)}},{key:"getAllUserListOfMessageReaction",value:function(e){var t,n,i,o,s,a,r,c,u=this,l="getAllUserListOfMessageReaction";return this.canIUse(N.MSG_REACTION)?(t="".concat(this._n,".").concat(l),s=e.message,n=e.reactionID,i=e.nextSeq,o=e.count,c=s.ID,s=s.conversationID,s="convID:".concat(s," messageID:").concat(c," reactionID:").concat(n," nextSeq:").concat(i," count:").concat(o),(a=new oi(l)).setMessage(s),be.l("".concat(t," ").concat(s)),r={userList:[],nextSeq:0,isCompleted:!1},c=this._createReactionUserListPack(e),this.req(c).then((function(e){var t=void 0===(t=(e=e.data).userIDList)?[]:t;return e=void 0===(e=e.nextSeq)?0:e,r.nextSeq=e,r.isCompleted=0===e,u.get(4).getUserNickAndAvatar(t)})).then((function(e){return r.userList=e,a.end(),be.l("".concat(t," ok.")),Cn(r)})).catch((function(e){return a.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this.noUse(l)}},{key:"_createReactionOperationPack",value:function(e,t,n){var i,o,s=void 0;return t={reactionID:t,userIDList:[this.getMyUserID()]},e.conversationType===E.CONV_C2C&&(i=this.get(6),s=1===n?jn.ADD_C2C_MSG_REACTION:jn.RM_C2C_MSG_REACTION,t.from=e.from,t.to=e.to,t.messageKey=i.getMessageKey(e)),e.conversationType===E.CONV_GROUP&&(i=void 0,o=e.to,St(e.to)&&(o=xt(i=e.to)),s=1===n?jn.ADD_GRP_MSG_REACTION:jn.RM_GRP_MSG_REACTION,t.groupID=o,t.topicID=i,t.messageSequence=e.sequence),{P:s,data:t}}},{key:"_createReactionSummaryPack",value:function(e){var t,n,i,o=e.messageList,s=void 0===(s=e.maxUserCountPerReaction)?10:s,a=e.messageIDMap,r=void 0,c=void 0;return(e=o[0]).conversationType===E.CONV_C2C&&(t=this.get(6),n=o.map((function(e){var n=t.getMessageKey(e);return a.set(n,e.ID),n})),r=jn.GET_C2C_MSG_REACTIONS,c={from:e.from,to:e.to,messageKeyList:n,count:s}),e.conversationType===E.CONV_GROUP&&(n=void 0,i=e.to,St(e.to)&&(i=xt(n=e.to)),e=o.map((function(e){return a.set(e.sequence,e.ID),e.sequence})),r=jn.GET_GRP_MSG_REACTIONS,c={groupID:i,topicID:n,messageSequenceList:e,count:s}),{P:r,data:c}}},{key:"_createReactionUserListPack",value:function(e){var t=e.message,n=e.reactionID,i=e.nextSeq,o=void 0;return n={reactionID:n,nextSeq:void 0===i?0:i,count:100<(e=void 0===(e=e.count)?100:e)?100:e},t.conversationType===E.CONV_C2C&&(i=this.get(6),o=jn.GET_C2C_MSG_REACTION_USER_LIST,n.from=t.from,n.to=t.to,n.messageKey=i.getMessageKey(t)),t.conversationType===E.CONV_GROUP&&(e=void 0,i=t.to,St(t.to)&&(i=xt(e=t.to)),o=jn.GET_GRP_MSG_REACTION_USER_LIST,n.groupID=i,n.topicID=e,n.messageSequence=t.sequence),{P:o,data:n}}},{key:"_handleReactionSummary",value:function(e,t){var n=this;return this.get(4).getUserNickAndAvatar(t).then((function(t){var i=[];return e.forEach((function(e){var o=[];e.reactionList.forEach((function(i){var s=i.reactionID,a=i.count,r=i.userIDList,c=(i=void 0===(i=i.reactedByMyself)?void 0:i,[]);r.forEach((function(e){t.forEach((function(t){e===t.userID&&c.push(t)}))})),r={reactionID:s,totalUserCount:a,partialUserList:c,reactedByMyself:n._computeReactedByMyself({reactedByMyself:i,messageID:e.messageID,reactionID:s})},o.push(r),lt(i)&&!n._reactedByMyselfMap.has(e.messageID)&&(a="".concat(e.messageID,"-").concat(s),n._reactionInfoMap.set(a,r))})),i.push({messageID:e.messageID,reactionList:o})})),i}))}},{key:"_addReactedByMyselfMap",value:function(e,t){this._reactedByMyselfMap.has(e)||this._reactedByMyselfMap.set(e,[]),-1===(e=this._reactedByMyselfMap.get(e)).indexOf(t)&&e.push(t)}},{key:"_removeReactedByMyselfMap",value:function(e,t){this._reactedByMyselfMap.has(e)&&-1<(t=(e=this._reactedByMyselfMap.get(e)).indexOf(t))&&e.splice(t,1)}},{key:"_computeReactedByMyself",value:function(e){var t=e.reactedByMyself,n=e.messageID;return e=e.reactionID,lt(t)?!!this._reactedByMyselfMap.has(n)&&this._reactedByMyselfMap.get(n).includes(e):1===t}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._reactedByMyselfMap.clear(),this._reactionInfoMap.clear()}}])),Xo=(u(is,wn),s(is,[{key:"sendMessage",value:function(e){var t=this,n=this._createMsg(e);if(null===n)return En({code:qn.MSG_SEND_FAIL});this._addSendMessageTotalCount(n);var i=Date.now();return this.get(11).setMessageRandom(n),this._sendComboMessage(n,e).then((function(e){var o=(e=e.data).time,s=e.sequence;return Ke(e=e.readReceiptCode)&&0!==e&&(new oi("sendMessageWithReceipt").setMessage("from:".concat(n.from," to:").concat(n.to," sequence:").concat(s," readReceiptCode:").concat(e)).end(),be.w("".concat(t._n,".sendMessage readReceiptCode:").concat(e," message:").concat(t.getErrMsg(e)))),t._addSendMessageSuccessCount(n,i),e=t.get(11),n.status=kn,n.time=o,n.conversationType===E.CONV_GROUP&&(n.sequence=s),e.appendToMessageList(n),o=n,!0===n._isExcludedFromLastMessage&&(o=""),e.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:o}]}),Cn({message:n})})).catch((function(e){return t._onSendMessageFailed(n,e)}))}},{key:"_sendComboMessage",value:function(e,t){var n=this._m.get(20),i="";return e.conversationType===E.CONV_C2C&&(i="".concat(P.NAME.OPEN_IM,".").concat(jn.SEND_C2C_MSG)),e.conversationType===E.CONV_GROUP&&(i="".concat(P.NAME.GRP,".").concat(jn.SEND_GRP_MSG)),n.sendComboMessage({servcmd:i,data:t})}},{key:"_createMsg",value:function(e){var t="".concat(this._n,"._createMsg"),n=null;try{var i,o=this.getMyUserID(),s={};s.senderTinyID=this.getMyTinyID(),s.currentUser=o,s.from=e.From_Account||o,e.GroupId?(s.conversationID="".concat(E.CONV_GROUP).concat(e.GroupId),s.conversationType=E.CONV_GROUP,s.to=e.GroupId):e.To_Account&&(s.conversationID="".concat(E.CONV_C2C).concat(e.To_Account),s.conversationType=E.CONV_C2C,s.to=e.To_Account),s.time=e.MsgTimeStamp||0,s.random=e.Random||e.MsgRandom||0,s.priority=e.MsgPriority,ut(e.CloudCustomData)&&0<e.CloudCustomData.length&&(s.cloudCustomData=e.CloudCustomData),Ye(e.SendMsgControl)&&(s.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(s.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg"))&&(s.messageControlInfo.excludedFromLastMessage=1),s.conversationType===E.CONV_GROUP&&Ye(e.To_Account)&&0<e.To_Account.length&&(i=e.To_Account,50<e.To_Account.length&&(i=e.To_Account.slice(0,50),be.w("".concat(t," To_Account must be less than or equal to 50."))),s.receiverList=v(i),e.To_Account=v(i)),1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(s.needReadReceipt=!0),1===e.SupportMessageExtension&&(s.isSupportExtension=!0),(n=new ki(s)).status=Tn,e.MsgClientTime=n.clientTime,n.conversationType===E.CONV_C2C&&(e.MsgSeq=n.sequence);for(var a,r=e.MsgBody.length,c=0;c<r;c++)"TIMTextElem"===(a=e.MsgBody[c]).MsgType?n.setTextElement(a.MsgContent.Text):"TIMCustomElem"===a.MsgType?n.setCustomElement({data:a.MsgContent.Data||"",description:a.MsgContent.Desc||"",extension:a.MsgContent.Ext||""}):"TIMFaceElem"===a.MsgType&&n.setFaceElement({index:a.MsgContent.Index,data:a.MsgContent.Data});var u=n.getElements();n.payload=u[0].content,n.type=u[0].type}catch(l){n=null,be.e("".concat(t," failed. error:"),l)}return n}},{key:"_onSendMessageFailed",value:function(e,t){e.status=Dn,this.get(11).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new oi("sendMessage"),i="head.seq:".concat(t.data.headSeq," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to);return n.setMessage(i).setError(t).end(),be.e("".concat(this._n,"._onSendMessageFailed ").concat(i," error:"),t),En(new Bn({code:t&&t.code?t.code:qn.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){return e.conversationType===E.CONV_C2C?zn:e.conversationType===E.CONV_GROUP&&(e=this.get(7).getLocalGroupProfile(e.to))?Mt(e=e.type)?Yn:Wn:void 0}},{key:"_addSendMessageTotalCount",value:function(e){(e=this._getSendMessageSpecifiedKey(e))&&this.get(26).addTotalCount(e)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n;(e=this._getSendMessageSpecifiedKey(e))&&((n=this.get(26)).addSuccessCount(e),n.addCost(e,zt(t,!1)))}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){t=void 0===(t=t.code)?-1:t;var n=this.get(26);e=this._getSendMessageSpecifiedKey(e),Wo(t)&&e&&n.addFailedCountOfUserSide(e)}}])),Qo=(u(ns,wn),s(ns,[{key:"registerPlugin",value:function(e){var t=this,n="0";Object.keys(e).forEach((function(i){t.plugins[i]=e[i],"tim-upload-plugin"===i&&"function"==typeof e[i].getVersion&&(n=e[i].getVersion())})),new oi("registerPlugin").setMessage("".concat(Object.keys(e))).setMoreMessage("version:".concat(n)).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){}}])),Zo=(u(ts,wn),s(ts,[{key:"_init",value:function(){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var t=this,n=e.cookie,i=e.syncFlag,o=e.isOnlineSync,s="".concat(this._n,"._startSync"),a=(be.l("".concat(s," options:"),e),new oi("syncUnread"));a.setMessage(JSON.stringify(e)),this.req({P:jn.SYNC_UNREAD_MSG,data:{cookie:n,syncFlag:i,isOnlineSync:o}}).then((function(e){var n=(i=e.data).cookie,i=i.syncFlag,o="$cookie:".concat(n," syncFlag:").concat(i);be.l("".concat(s," ok. ").concat(o)),t._cookie=n,a.setMoreMessage(o).end(),qe(n)||(0===i||1===i?(t._dispatch(g(g({},e.data),{},{isSyncingEnded:!1})),t._startSync({cookie:n,syncFlag:i,isOnlineSync:0})):2===i&&t._dispatch(g(g({},e.data),{},{isSyncingEnded:!0})))})).catch((function(e){a.setError(e).end(),be.e("".concat(s," failed. error:"),e)}))}},{key:"_dispatch",value:function(e){e.eventArray&&this.get(20).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}}),this.get(6).onNewMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList,isSyncingEnded:e.isSyncingEnded})}},{key:"syncOnNeed",value:function(){be.l("".concat(this._n,".syncOnNeed cookie:").concat(this._cookie)),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"syncOnReconnected",value:function(){be.l("".concat(this._n,".syncOnReconnected cookie:").concat(this._cookie)),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}])),es={req:{toAccount:"To_Account",fromAccount:"From_Account",to:"To_Account",from:"From_Account",groupID:"GroupId",groupAtUserID:"GroupAt_Account",extension:"Ext",data:"Data",description:"Desc",elements:"MsgBody",sizeType:"Type",downloadFlag:"Download_Flag",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",videoUrl:"",imageUrl:"URL",fileUrl:"Url",uuid:"UUID",priority:"MsgPriority",receiverUserID:"To_Account",receiverGroupID:"GroupId",messageSender:"SenderId",messageReceiver:"ReceiverId",nick:"From_AccountNick",avatar:"From_AccountHeadurl",messageNumber:"MsgNum",pbDownloadKey:"PbMsgKey",downloadKey:"JsonMsgKey",applicationType:"PendencyType",userIDList:"To_Account",groupNameList:"GroupName",userID:"To_Account",groupAttributeList:"GroupAttr",mainSequence:"AttrMainSeq",avChatRoomKey:"BytesKey",attributeControl:"AttrControl",sequence:"seq",messageControlInfo:"SendMsgControl",updateSequence:"UpdateSeq",clientTime:"MsgClientTime",sequenceList:"MsgSeqList",topicID:"TopicId",customData:"CustomString",isSupportTopic:"SupportTopic",isWebUniapp:"is_web_uniapp",isSupportExtension:"SupportMessageExtension",messageSequence:"MsgSeq",messageKey:"MsgKey",startSequence:"startSeq",simplifiedMessage:"DownsizeFlag",isRelayMessage:"IsRelayMsg",reactionID:"Reaction",messageSequenceList:"MsgSeqList",messageKeyList:"MsgKeyList",cmConfigID:"CustomModerationConfigID"},res:{MsgPriority:"priority",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",Download_Flag:"downloadFlag",GroupId:"groupID",Member_Account:"userID",MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",MsgSeq:"sequence",MsgRandom:"random",MsgTime:"time",MsgTimeStamp:"time",MsgContent:"content",MsgBody:"elements",From_AccountNick:"nick",From_AccountHeadurl:"avatar",GroupWithdrawInfoArray:"revokedInfos",GroupReadInfoArray:"groupMessageReadNotice",LastReadMsgSeq:"lastMessageSeq",WithdrawC2cMsgNotify:"c2cMessageRevokedNotify",C2cWithdrawInfoArray:"revokedInfos",C2cReadedReceipt:"c2cMessageReadReceipt",ReadC2cMsgNotify:"c2cMessageReadNotice",LastReadTime:"peerReadTime",MsgRand:"random",MsgType:"type",MsgShow:"messageShow",NextMsgSeq:"nextMessageSeq",FaceUrl:"avatar",ProfileDataMod:"profileModify",Profile_Account:"userID",ValueBytes:"value",ValueNum:"value",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgFrom_AccountExtraInfo:"messageFromAccountExtraInformation",Operator_Account:"operatorID",OpType:"operationType",ReportType:"operationType",UserId:"userID",User_Account:"userID",List_Account:"userIDList",MsgOperatorMemberExtraInfo:"operatorInfo",MsgMemberExtraInfo:"memberInfoList",ImageUrl:"avatar",NickName:"nick",MsgGroupNewInfo:"newGroupProfile",MsgAppDefinedData:"groupCustomField",Owner_Account:"ownerID",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupNotification:"notification",GroupApplyJoinOption:"joinOption",MsgKey:"messageKey",GroupInfo:"groupProfile",ShutupTime:"muteTime",Desc:"description",Ext:"extension",GroupAt_Account:"groupAtUserID",MsgNum:"messageNumber",PbMsgKey:"pbDownloadKey",JsonMsgKey:"downloadKey",MsgModifiedFlag:"isModified",PendencyItem:"applicationItem",PendencyType:"applicationType",AddTime:"time",AddSource:"source",AddWording:"wording",ProfileImImage:"avatar",PendencyAdd:"friendApplicationAdded",FrienPencydDel_Account:"friendApplicationDeletedUserIDList",Peer_Account:"userID",GroupAttr:"groupAttributeList",GroupAttrAry:"groupAttributeList",AttrMainSeq:"mainSequence",seq:"sequence",GroupAttrOption:"groupAttributeOption",BytesChangedKeys:"changedKeyList",GroupAttrInfo:"groupAttributeList",GroupAttrSeq:"mainSequence",PushChangedAttrValFlag:"isWithChangedAttributeInfo",SubKeySeq:"sequence",Val:"value",MsgGroupFromCardName:"senderNameCard",MsgGroupFromNickName:"senderNick",C2cNick:"peerNick",C2cImage:"peerAvatar",SendMsgControl:"messageControlInfo",NoLastMsg:"excludedFromLastMessage",NoUnread:"excludedFromUnreadCount",UpdateSeq:"updateSequence",MuteNotifications:"muteFlag",MsgClientTime:"clientTime",TinyId:"tinyID",GroupMsgReceiptList:"readReceiptList",ReadNum:"readCount",UnreadNum:"unreadCount",TopicId:"topicID",MillionGroupFlag:"communityType",SupportTopic:"isSupportTopic",MsgTopicNewInfo:"newTopicInfo",ShutupAll:"muteAllMembers",CustomString:"customData",TopicFaceUrl:"avatar",TopicIntroduction:"introduction",TopicNotification:"notification",TopicIdArray:"topicIDList",MsgVersion:"messageVersion",C2cMsgModNotifys:"c2cMessageModified",GroupMsgModNotifys:"groupMessageModified",ApplyJoinOption:"joinOption",MsgFlag:"messageRemindType",AtInfoList:"groupAtInfoList",AtFlagList:"groupAtType",AtMsgSeq:"sequence",BanDuration:"duration",BanDescription:"reason",NotVisible:"invisible",BytesTag:"tag",BytesValue:"value",RptBytesValue:"value",LatestSeq:"globalSequence",ClearSeq:"clearSequence",SupportMessageExtension:"isSupportExtension",ExtensionList:"extensions",GroupCounter:"counterList",Revoker_Account:"revoker",MsgExtensionNotify:"messageExtensionNotify",ExtensionC2cMsgInfo:"messageInfo",ExtensionGroupMsgInfo:"messageInfo",MsgOptType:"operateType",SetKVInfo:"operateResultList",DeleteKVInfo:"operateResultList",ClearKVInfo:"operateResultList",MsgKeyValue:"extensions",ClearMsgSeq:"clearSequence",MsgLastSeq:"globalSequence",InviteJoinOption:"inviteOption",MemberList_Account:"inviteeList",MsgMemberExtraInfoList:"inviteeInfoList",E:"event",GInf:"groupProfile",MCT:"clientTime",MR:"random",MP:"priority",MTS:"time",GId:"groupID",MS:"sequence",CCD:"cloudCustomData",F_Account:"from",F_Hd:"avatar",F_NN:"nick",GN:"groupName",GT:"groupType",IsSys:"isSystemMessage",OpInf:"operatorInfo",Img:"avatar",NN:"nick",OnlineInf:"onlineMemberInfo",ET:"expireTime",Num:"onlineMemberNum",Opt:"operationType",O_Account:"operatorID",RT:"operationType",UDF:"userDefinedField",L_Account:"userIDList",IsPlaceMsg:"isPlaceMessage",MsgCheckResult:"checkResult",Results:"resultList",Reaction:"reactionID",Reaction_Account:"userIDList",MsgReactionNotifyList:"messageReactionNotifyList",MsgReactionNotify:"messageReactionNotify",MsgReactionSummary:"reactionList",C2CMsgInfo:"C2CMessageInfo",GroupMsgInfo:"groupMessageInfo",int32_err_code:"errorCode",str_err_msg:"errorMsg",MsgDropReason:"messageDropReason",ReactedByMe:"reactedByMyself",Level:"messageRemindType",PeerReadTime:"timestamp",NoUnreadSeqList:"excludedUnreadSequenceList",NewMsg:"topicLatestMessage"},ignoreKeyWord:["C2C","ID","USP"]};function ts(e){return i(this,ts),(e=n(this,ts,[e]))._n="SyncUnreadMsgModule",e._cookie="",e._onlineSyncFlag=!1,e.getIEmitInst().on(Ni.A2KEY_AND_TINYID_UPDATED,e._init,e),e}function ns(e){return i(this,ns),(e=n(this,ns,[e]))._n="PluginModule",e.plugins={},e}function is(e){return i(this,is),(e=n(this,is,[e]))._n="ComboMsgModule",e}function os(e){return i(this,os),(e=n(this,os,[e]))._n="MsgReactionModule",e._reactedByMyselfMap=new Map,e._reactionInfoMap=new Map,e}function ss(e){return i(this,ss),(e=n(this,ss,[e]))._n="MsgExtModule",e.msgExtMap=new Map,e.globalSeqMap=new Map,e.getMsgExtsMap=new Map,e}function as(e){return i(this,as),(e=n(this,as,[e]))._n="MessageModule",e._messageOptionsMap=new Map,e._mergerMessageHandler=new jo(e),e}function rs(e,t){if("string"==typeof e||Array.isArray(e))return t=Object.assign({pascalCase:!1},t),0===(e=Array.isArray(e)?e.map((function(e){return e.trim()})).filter((function(e){return e.length})).join("-"):e.trim()).length?"":1===e.length?t.pascalCase?e.toUpperCase():e.toLowerCase():(e=e=(e=e!==e.toLowerCase()?cs(e):e).replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(e,t){return t.toUpperCase()})).replace(/\d+(\w|$)/g,(function(e){return e.toUpperCase()})),t.pascalCase?e.charAt(0).toUpperCase()+e.slice(1):e);throw new TypeError("Expected the input to be `string | string[]`")}var cs=function(e){for(var t=!1,n=!1,i=!1,o=0;o<e.length;o++){var s=e[o];t&&/[a-zA-Z]/.test(s)&&s.toUpperCase()===s?(e=e.slice(0,o)+"-"+e.slice(o),i=n,n=!(t=!1),o++):n&&i&&/[a-zA-Z]/.test(s)&&s.toLowerCase()===s?(e=e.slice(0,o-1)+"-"+e.slice(o-1),i=n,t=!(n=!1)):(t=s.toLowerCase()===s&&s.toUpperCase()!==s,i=n,n=s.toUpperCase()===s&&s.toLowerCase()!==s)}return e};function us(e,t){var n=0;return function e(t,i){var o,s,a,r;return 100<++n?(n--,t):Ye(t)?(o=t.map((function(t){return ze(t)?e(t,i):t})),n--,o):ze(t)?(s=t,a=function(e,t){if(!Qe(t))return!1;if(t!==rs(t))for(var n=0;n<es.ignoreKeyWord.length&&!t.includes(es.ignoreKeyWord[n]);n++);var o;return lt(i[t])?(o=t)[0].toUpperCase()+rs(o).slice(1):i[t]},r=Object.create(null),Object.keys(s).forEach((function(e){var t=a(s[e],e);t&&(r[t]=s[e])})),o=Dt(o=r,(function(t,n){return Ye(t)||ze(t)?e(t,i):t})),n--,o):void 0}(e,t)}for(var ls=String.fromCharCode,ds=function(e){var t=0|e.charCodeAt(0);if(55296<=t)if(t<56320)if(56320<=(e=0|e.charCodeAt(1))&&e<=57343){if(65535<(t=(t<<10)+e-56613888|0))return ls(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533;else t<=57343&&(t=65533);return t<=2047?ls(192|t>>>6,128|63&t):ls(224|t>>>12,128|t>>>6&63,128|63&t)},ps=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,ds),n=0|t.length,i=new Uint8Array(n),o=0;o<n;o=o+1|0)i[o]=0|t.charCodeAt(o);return i},hs=s((function e(t){i(this,e);var n,o,s=(this._handler=t).getURL();this._socket=null,this._workerSocket=null,this._id=it(),this._handler.getIsWorkerEnabled()?(n=URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen", extensions: _socket.extensions }); }; _socket.onclose = function(e) { postMessage({ callback: "onOpen", e: { code: e.code, reason: e.reason } }); }; _socket.onmessage = function(e) { postMessage({ callback: "onMessage", data: e.data }); }; _socket.onerror = function(e) { postMessage({ callback: "onError", e: { isTrusted: "true" } }); }; } else if (event.data.cmd === "sendMessage") { if (_socket !== null) { _socket.send(event.data.data); } } else if (event.data.cmd === "stop") { if (_socket !== null) { _socket.close(event.data.code); _socket = null; } }};'],{type:"application/javascript; charset=utf-8"})),this._workerSocket=new Worker(n),(o=this)._workerSocket.onmessage=function(e){var t=(i=e.data).callback,n=i.e,i=i.extensions;"onOpen"===t?o._onOpen(i):"onClose"===t?o._onClose(n):"onError"===t?o._onError(n):"onMessage"===t&&o._onMessage(e.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:s})):Q?W?(ne.connectSocket({url:s,header:{"content-type":"application/json"}}),ne.onSocketClose(this._onClose.bind(this)),ne.onSocketOpen(this._onOpen.bind(this)),ne.onSocketMessage(this._onMessage.bind(this)),ne.onSocketError(this._onError.bind(this))):(this._socket=ne.connectSocket({url:s,header:{"content-type":"application/json"},complete:function(){}}),this._socket.onClose(this._onClose.bind(this)),this._socket.onOpen(this._onOpen.bind(this)),this._socket.onMessage(this._onMessage.bind(this)),this._socket.onError(this._onError.bind(this))):(this._socket=new WebSocket(s),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this,this._socket.extensions),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this)),this._canIUseBinaryFrame=t.canIUseBinaryFrame()}),[{key:"getID",value:function(){return this._id}},{key:"_onOpen",value:function(e){this._handler.onOpen({id:this._id,res:JSON.stringify(e)})}},{key:"_onClose",value:function(e){this._handler.onClose({id:this._id,e:e})}},{key:"_onMessage",value:function(e){e=this._canIUseBinaryFrame?this._isAppCompressedData(e.data)?this._handler.inflate(e.data):function(e){for(var t=new Uint8Array(e),n="",i=0,o=t.length;i<o;){var s=t[i],a=0,r=0;if(s<=127?(a=0,r=255&s):s<=223?(a=1,r=31&s):s<=239?(a=2,r=15&s):s<=244&&(a=3,r=7&s),0<o-i-a)for(var c=0;c<a;)r=r<<6|63&(s=t[i+c+1]),c+=1;else r=65533,a=o-i;n+=String.fromCodePoint(r),i+=a+1}return n}(e.data):e.data,this._handler.onMessage({data:e})}},{key:"_isAppCompressedData",value:function(e){return 67===(e=new Uint8Array(e))[0]&&79===e[1]&&77===e[2]&&80===e[3]}},{key:"_onError",value:function(e){this._handler.onError({id:this._id,e:e})}},{key:"setIsWorkerEnabled",value:function(e){this._isWorkerEnabled=!0}},{key:"close",value:function(e){this._workerSocket&&(this._workerSocket.postMessage({cmd:"stop",code:e}),this._workerSocket.terminate(),this._workerSocket=null),W?(ne.offSocketClose(),ne.offSocketMessage(),ne.offSocketOpen(),ne.offSocketError(),ne.closeSocket()):this._socket&&(Q?(this._socket.onClose((function(){})),this._socket.onOpen((function(){})),this._socket.onMessage((function(){})),this._socket.onError((function(){}))):(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),z?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}},{key:"send",value:function(e){this._workerSocket?this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?ps(e.data).buffer:e.data}):W?ne.sendSocketMessage({data:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket&&(Q?this._socket.send({data:this._canIUseBinaryFrame?ps(e.data).buffer:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket.send(this._canIUseBinaryFrame?ps(e.data):e.data))}}]),gs=["keyMap"],fs=["keyMap"],ms="connected",_s="connecting",vs="disconnected",ys=s((function e(t){i(this,e),this._chM=t,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=vs,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=it(),this._startTs=0,this._reConnectFlag=!1,this._nextPingTs=0,this._reConnectCount=0,this.MAX_RECONNECT_COUNT=3,this._socketID=-1,this._random=0,this._socket=null,this._url="",this._onOpenTs=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0,this._currentSite=L,this._setWebsocketHost(),this._initConnection()}),[{key:"_setWebsocketHost",value:function(){var e=this._chM.get(12);this._currentSite=L,this._chM.isOversea()&&(this._currentSite="OVERSEA"),e.isSingaporeSite()?this._currentSite="SINGAPORE":e.isKoreaSite()?this._currentSite="KOREA":e.isGermanySite()?this._currentSite="GERMANY":e.isIndiaSite()?this._currentSite="IND":e.isJapanSite()?this._currentSite="JPN":e.isUSASite()?this._currentSite="USA":e.isIndonesiaSite()&&(this._currentSite="INDONESIA"),P.HOST.setCurrent(this._currentSite)}},{key:"_initConnection",value:function(){var e=this._chM.get(12).getSDKAppID()+"",t=this._chM.get(12).isIndependentDomainDisabled();qe(e=(lt(P.HOST.CURRENT.BACKUP)?this._url=P.HOST.CURRENT.DEFAULT:""===this._url?this._url=t?P.HOST.CURRENT.DEFAULT:P.HOST.CURRENT.DEFAULT0.replace("*",e):-1<this._url.indexOf(e)?this._url=P.HOST.CURRENT.DEFAULT:this._url===P.HOST.CURRENT.DEFAULT?this._url=P.HOST.CURRENT.IPV6:this._url===P.HOST.CURRENT.IPV6?this._url=te?this._genRandomDomain():P.HOST.CURRENT.BACKUP:this._isWebBackupUrl(this._url)||this._url===P.HOST.CURRENT.BACKUP?this._url=this._canIUseAnyCast()?P.HOST.CURRENT.ANYCAST:P.HOST.CURRENT.DEFAULT:this._url===P.HOST.CURRENT.ANYCAST&&(P.HOST.CURRENT.ANYCAST="",this._url=P.HOST.CURRENT.DEFAULT),t=this._chM.get(12)).getProxyServer())||(this._url=e),t.isTestEnv()&&(this._url=R.TEST[this._currentSite].DEFAULT),this._connect(),this._nextPingTs=0}},{key:"_genRandomDomain",value:function(){var e=Math.floor(10001*Math.random())+1e4;return P.HOST.CURRENT.BACKUP_WEB.replace("*",e)}},{key:"_isWebBackupUrl",value:function(e){return e.includes("my-cpaas.com")}},{key:"_canIUseAnyCast",value:function(){return te&&P.HOST.CURRENT.ANYCAST}},{key:"onCheckTimer",value:function(e){e%1==0&&(this._checkPromiseMap(),this._checkNativeAppWS())}},{key:"_checkPromiseMap",value:function(){var e=this;0!==this._promiseMap.size&&this._promiseMap.forEach((function(t,n){var i=t.reject,o=t.timestamp,s=(t=t.headSeq,15e3);-1!==n.indexOf(jn.LOGIN)?s=9e4:-1!==n.indexOf(jn.PING)&&(s=3e3),Date.now()-o>=s&&(be.l("".concat(e._n,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),i(new Bn({code:qn.NETWORK_TIMEOUT,data:{headSeq:t}})),e._chM.onRequestTimeout())}))}},{key:"_checkNativeAppWS",value:function(){$&&!this.isConnected()&&this._reConnect()}},{key:"onOpen",value:function(e){var t,n;this._readyState!==vs&&(this._onOpenTs=Date.now(),n=e.id,e=e.res,this._socketID=n,t=zt(this._startTs,!1),n="socketID:".concat(n," res:").concat(e),be.l("".concat(this._n,"._onOpen cost:").concat(t," ms. ").concat(n)),new oi("wsOnOpen").setMessage(t).setCostTime(t).setMoreMessage(n).end(),this._readyState=ms,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._chM.onReconnected(),this._reConnectFlag=!1),this._chM.onOpen())}},{key:"onClose",value:function(e){var t=new oi("wsOnClose"),n=e.id,i=(e=e.e,"sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(e.code," reason:").concat(e.reason)),o=0;0!==this._onOpenTs&&(o=Date.now()-this._onOpenTs),t.setMessage(o).setCostTime(o).setMoreMessage(i).setCode(e.code).end(!0),be.l("".concat(this._n,"._onClose ").concat(i," onlineTime:").concat(o)),n===this._socketID&&(this._readyState=vs,o<1e3?this._chM.onReconnectFailed():this._chM.onClose())}},{key:"onError",value:function(e){var t=e.id,n=(e=e.e,"sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID));new oi("wsOnError").setMessage(e.errMsg||JSON.stringify(e,["message","code"])).setMoreMessage(n).setLevel("error").end(!0),be.w("".concat(this._n,"._onError"),e,n),t===this._socketID&&(this._readyState=vs,this._chM.onError())}},{key:"onMessage",value:function(e){var t,n,i,o,s,a;try{t=JSON.parse(e.data)}catch(r){new oi("jsonParseError").setMessage(e.data).end()}t&&t.head&&(e=this._getRequestIDFromHead(t.head),n=t.body,this._chM.get(30).isTRTCCommand(e)||(a=Nt(t.head),n=function e(t,n){var i,o,s;return Ye(t)?t.map((function(t){return ze(t)?e(t,n):t})):ze(t)?(i=t,o=function(e,t){return lt(n[t])?rs(t):n[t]},s={},Object.keys(i).forEach((function(e){s[o(i[e],e)]=i[e]})),Dt(s,(function(t){return Ye(t)||ze(t)?e(t,n):t}))):void 0}(t.body,this._getResKeyMap(a))),be.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(n)," requestID:").concat(e," has:").concat(this._promiseMap.has(e))),this._setNextPingTs(),this._promiseMap.has(e)?(i=(a=this._promiseMap.get(e)).resolve,o=a.reject,s=a.timestamp,a=a.headSeq,this._promiseMap.delete(e),this._calcRTT(s),n.errorCode&&0!==n.errorCode?(this._chM.onErrorCodeNotZero(n),o(new Bn({code:n.errorCode,message:n.errorInfo||"",data:e.includes(jn.MODIFY_C2C_MSG)||e.includes(jn.MODIFY_GRP_MSG)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData,headSeq:a}:{headSeq:a}}))):i(Cn(n))):this._chM.onMessage({head:t.head,body:n}))}},{key:"_calcRTT",value:function(e){e=Date.now()-e,this._chM.get(26).addRTT(e)}},{key:"_connect",value:function(){this._readyState!==_s&&this._readyState!==ms&&(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=_s,this._socket=new hs(this),this._socketID=this._socket.getID(),be.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new oi("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end())}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=bt(),t=((W||V&&"windows"===e||$)&&(this._canIUseBinaryFrame=!1),-1),n=("ios"===e?t=ae||-1:"android"===e&&(t=ce||-1),this._chM.get(12)),i=this._chM.getPlatform(),o=n.getSDKAppID();return n=n.getInstanceID(),o="sdkappid=".concat(o,"&instanceid=").concat(n,"&random=").concat(this._getRandom(),"&platform=").concat(i,"&host=").concat(e)+"&version=".concat(t,"&sdkversion=").concat("3.5.5"),j&&(o+="&isminigame=1"),this._chM.canIUseInflate()&&(o+="&compress=gzip"),(this._canIUseBinaryFrame?"".concat(this._url,"/binfo?"):"".concat(this._url,"/info?")).concat(o)}},{key:"_closeConnection",value:function(e){be.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=vs)}},{key:"_resend",value:function(){var e=this;if(be.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),0<this._promiseMap.size&&this._promiseMap.forEach((function(t,n){var i=t.uplinkData,o=t.resolve;t=t.reject,-1!==n.indexOf(jn.AV_POLLING)?e._promiseMap.delete(n):(e._promiseMap.set(n,{resolve:o,reject:t,timestamp:Date.now(),uplinkData:i}),e._execute(n,i))})),0<this._simpleRequestMap.size){var t,n=a(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var i=_(t.value,2),o=i[0],s=i[1];this._execute(o,s)}}catch(r){n.e(r)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this,n=(e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.head.cs=this._calcCheckSum(e.head.servcmd,e.body),e.keyMap,f(e,gs)),i=this._getRequestIDFromHead(e.head),o=JSON.stringify(n);return new Promise((function(s,a){t._promiseMap.set(i,{resolve:s,reject:a,timestamp:Date.now(),uplinkData:o,headSeq:e.head.seq}),be.d("".concat(t._n,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(i," readyState:").concat(t._readyState)),t._readyState!==ms?t._reConnect():(t._execute(i,o),t._chM.get(26).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var t=f(e,fs);e=this._getRequestIDFromHead(e.head),t=JSON.stringify(t),this._readyState!==ms?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(e,t):be.l("".concat(this._n,".simplySend. simpleRequestMap is full, drop request!")),this._reConnect()):this._execute(e,t)}},{key:"_execute",value:function(e,t){this._socket.send({data:t,fail:Q?this._onSendFail.bind(this):void 0,requestID:e})}},{key:"_onSendFail",value:function(e){be.l("".concat(this._n,"._onSendFail requestID:").concat(e)),this._chM.onSendFail()}},{key:"_getSequence",value:function(){var e;if(this._startSequence<2415919103)return e=this._startSequence,this._startSequence+=1,2415919103===this._startSequence&&(this._startSequence=it()),e}},{key:"_getRequestIDFromHead",value:function(e){return e.servcmd+e.seq}},{key:"_getResKeyMap",value:function(e){return e=this._chM.getKeyMap(e),g(g({},es.res),e.res)}},{key:"_reConnect",value:function(){this._readyState!==ms&&this._readyState!==_s&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var e="".concat(this._n,".forcedReconnect");be.l("".concat(e," count:").concat(this._reConnectCount," readyState:").concat(this._readyState)),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(4001),this._initConnection()):(this._reConnectCount=0,this._chM.get(15).isOnline()?(be.w("".concat(e," disconnected from wsserver but network is ok, continue...")),this._closeConnection(4001),this._initConnection()):this._chM.onReconnectFailed())}},{key:"getReconnectFlag",value:function(){return this._reConnectFlag}},{key:"_setNextPingTs",value:function(){this._nextPingTs=$?Date.now()+5e3:Date.now()+1e4}},{key:"getNextPingTs",value:function(){return this._nextPingTs}},{key:"isConnected",value:function(){return this._readyState===ms}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"getSocketID",value:function(){return this._socketID}},{key:"inflate",value:function(e){if(this._chM.canIUseInflate())return this._chM.get(37).inflate(e)}},{key:"setIsWorkerEnabled",value:function(e){be.l("".concat(this._n,".setIsWorkerEnabled flag:").concat(e)),this._isWorkerEnabled=e}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&he}},{key:"_getRandom",value:function(){return 0===this._random&&(this._random=Math.random()),this._random}},{key:"_resetRandom",value:function(){this._random=0}},{key:"_calcCheckSum",value:function(e,t){if(-1!==e.indexOf(jn.PING)||-1!==e.indexOf(jn.LOGIN)||-1!==e.indexOf(jn.LOGOUT)||-1!==e.indexOf(jn.AV_POLLING)||-1!==e.indexOf(jn.AV_NOAUTH_POLLING))return 0;for(var n=ps(JSON.stringify(t)),i=4294967295,o=0,s=n.length;o<s;o++){i^=n[o];for(var a=0;a<8;a++)1&~i?i>>>=1:i=i>>>1^3988292384}return(4294967295^i)>>>0}},{key:"close",value:function(){be.l("".concat(this._n,".close")),this._closeConnection(4e3),this._promiseMap.clear(),this._startSequence=it(),this._readyState=vs,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),Is=function(e,t,n){return new Promise((function(i,o){var s,a,r="application/x-www-form-urlencoded;charset=UTF-8";Q?ne.request({url:t,data:n,method:e,timeout:3e3,header:{"content-type":r},success:function(e){e&&e.data&&e.data.NetCheckInfo&&be.l("".concat("getconninfo ok in"," miniapp. ret:"),e.data),i()},fail:function(){o(new Bn({code:qn.NETWORK_ERROR}))}}):(s=new XMLHttpRequest,a=setTimeout((function(){s.abort(),o(new Bn({code:qn.NETWORK_TIMEOUT}))}),3e3),s.onreadystatechange=function(){4===s.readyState&&(a&&clearTimeout(a),200===s.status||304===s.status?(s.responseText&&-1<s.responseText.indexOf("NetCheckInfo")&&be.l("".concat("getconninfo ok in"," web. ret:"),JSON.parse(s.responseText)),i()):o(new Bn({code:qn.NETWORK_ERROR})))},s.open(e,t,!0),s.setRequestHeader("Content-type",r),n?s.send(n):s.send())}))},Ms=(u(Ls,wn),s(Ls,[{key:"onCheckTimer",value:function(e){this._socketHandler&&(this.isLoggedIn()?(0<this._timerForNotLoggedIn&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.get(20).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.get(20).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==E.NET_STATE_CONNECTED&&e.head.servcmd.includes(jn.SSO_STAT)?(this.reConnect(),this.isPrivateNetWork()?Promise.resolve():this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=P.HOST.CURRENT.STAT;return t="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),e=JSON.stringify(e.body),Is("POST",t,e)}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED),this.reConnect()}},{key:"onError",value:function(){Q&&!$&&this.warn("DomainNameInMP"),this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.get(20).getKeyMap(e)}},{key:"onRequestTimeout",value:function(){3e4<=Date.now()-this._lastDiagnoseTS&&this.diagnose()}},{key:"onSendFail",value:function(){this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}},{key:"onReconnected",value:function(){be.l("".concat(this._n,".onReconnected cost:").concat(zt(this._disconnectedTS,!0,!0))),this._m.restartTimer(),this.get(20).onReconnected(zt(this._disconnectedTS,!1,!1)),this._disconnectedTS=0,this._emitNetStateChangeEvent(E.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){be.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=!1,n=(this._socketHandler&&(t=this._socketHandler.getReconnectFlag()),"forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t));be.l("".concat(this._n,".reConnect ").concat(n)),this._fatalErrorFlag||!this._socketHandler||!0!==e&&this._previousState===E.NET_STATE_CONNECTING&&t||(this._socketHandler.forcedReconnect(),this._emitNetStateChangeEvent(E.NET_STATE_CONNECTING))}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(be.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),e===E.NET_STATE_DISCONNECTED&&0===this._disconnectedTS&&(this._disconnectedTS=Date.now(),this.diagnose()),this._previousState=e,this.emitOEvt(S.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e,t=this;!0!==this._probing&&(this._probing=!0,e=this.get(20).getProtocolData({P:jn.PING}),this.send(e).then((function(){t._probing=!1})).catch((function(e){t._probing=!1;var n=t.get(15).isOnline();be.w("".concat(t._n,"._ping failed. bOnline:").concat(n," error:"),e),e&&60002===e.code?(new oi("error").setMessage("code:".concat(e.code," message:").concat(e.message)).end(),t._fatalErrorFlag=!0,t._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)):n?t.reConnect():t._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)})))}},{key:"_checkNextPing",value:function(){this._socketHandler&&this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping()}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),-1<this._timerForNotLoggedIn&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"canIUseInflate",value:function(){return this._m.canIUseInflate()}},{key:"getSocketID",value:function(){if(this._socketHandler)return this._socketHandler.getSocketID()}},{key:"diagnose",value:function(){this.isPrivateNetWork()||(this._lastDiagnoseTS=Date.now(),this._diagnoseBySSO(),this._diagnoseByCDN())}},{key:"_diagnoseBySSO",value:function(){var e=this,t=this._socketHandler.getURL(),n=t.split("/")[2];n.startsWith("ws")&&(t=t.slice(t.indexOf("info?")+5),n="https://".concat(n,"/v3/netcheck/getconninfo?").concat(t,"&reqtime=").concat(Date.now()),Is("GET",n).catch((function(t){be.w("".concat(e._n,"._diagnoseBySSO failed. error:"),t)})))}},{key:"_diagnoseByCDN",value:function(){var e=this,t=(t=this._socketHandler.getURL()).slice(t.indexOf("info?")+5);t="https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?".concat(t,"&reqtime=").concat(Date.now()),Is("GET",t).catch((function(t){be.w("".concat(e._n,"._diagnoseByCDN failed. error:"),t)}))}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._previousState=E.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3),this._disconnectedTS=0,this._lastDiagnoseTS=0}}])),Cs=["a2","tinyid"],Ss=["a2","tinyid"],Es=s((function e(t){i(this,e),this._n="PHandler",this._sessionM=t,this._map=new Map,this._fillMap()}),[{key:"_fillMap",value:function(){this._map.clear();var e=this._sessionM.genCommonHead(),t=this._sessionM.genCosSpecifiedHead(),n=this._sessionM.genSSOReportHead();this._map.set(jn.LOGIN,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0,customInfo:""},keyMap:{req:{deviceBrand:"InstType"},res:{InstId:"instanceID",HelloInterval:"helloInterval",RichMsgAuthKey:"authKey"}}}),this._map.set(jn.LOGOUT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.LOGOUT)}),body:{type:0,isWebUniapp:0},keyMap:{req:{type:"wslogout_type"}}}),this._map.set(jn.HELLO,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.HELLO)}),body:{isWebUniapp:0},keyMap:{res:{NewInstInfo:"newInstanceInfo"}}}),this._map.set(jn.KICK_OTHER,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.STAT_SERVICE,".").concat(jn.KICK_OTHER)}),body:{}}),this._map.set(jn.COS_SIGN,{head:g(g({},t),{},{servcmd:"".concat(P.NAME.IM_COS_SIGN,".").concat(jn.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{req:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},res:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}),this._map.set(jn.COS_PRE_SIG,{head:g(g({},t),{},{servcmd:"".concat(P.NAME.CUSTOM_UPLOAD,".").concat(jn.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{req:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},res:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}),this._map.set(jn.SIMPLE_COS_PRE_SIG,{head:g(g({},t),{},{servcmd:"".concat(P.NAME.CUSTOM_UPLOAD,".").concat(jn.SIMPLE_COS_PRE_SIG)}),body:{uploadMethod:0,platform:2,SDKAppID:0,userID:"",conversationType:1,uploadConfig:[{fileID:1,fileType:1,fileName:""}]},keyMap:{req:{platform:"uint32_platform",SDKAppID:"uint32_sdkappid",userID:"str_user_id",uploadMethod:"uint32_upload_method",conversationType:"uint32_scene",uploadConfig:"rpt_upload_object",fileID:"uint32_file_id",fileType:"uint32_file_type",fileName:"str_file_name"},res:{str_final_ip:"uploadIP",rpt_pre_sig:"preSig",uint32_file_id:"fileID",uint32_exist_flag:"existFlag",str_download_url:"downloadUrl",str_upload_url:"uploadUrl",str_snapshot_url:"requestSnapshotUrl",str_file_key:"fileKey"}}}),this._map.set(jn.GET_IMAGE_INFO,{head:g(g({},t),{},{servcmd:"".concat(P.NAME.CUSTOM_UPLOAD,".").concat(jn.GET_IMAGE_INFO)}),body:{imageUrl:""},keyMap:{req:{imageUrl:"str_image_url"},res:{rpt_msg_image_info:"imageInfoArray",uint32_image_type:"type",str_url:"url",uint32_width:"width",uint32_height:"height",str_image_format:"imageFormat"}}}),this._map.set(jn.GET_IP,{head:g(g({},t),{},{servcmd:"".concat(P.NAME.CUSTOM_UPLOAD,".").concat(jn.GET_IP)}),body:{domainName:""},keyMap:{req:{domainName:"str_domain"},res:{str_final_ip:"ip"}}}),this._map.set(jn.VIDEO_COVER,{head:g(g({},t),{},{servcmd:"".concat(P.NAME.CUSTOM_UPLOAD,".").concat(jn.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{req:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},res:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}),this._map.set(jn.FETCH_COMMERCIAL_CONFIG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_CONFIG_MANAGER,".").concat(jn.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{req:{SDKAppID:"uint32_sdkappid"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(jn.PUSHED_COMMERCIAL_CONFIG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_CONFIG_MANAGER,".").concat(jn.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(jn.FETCH_CLOUD_CTRL_CONFIG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_CONFIG_MANAGER,".").concat(jn.FETCH_CLOUD_CTRL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{req:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(jn.PUSHED_CLOUD_CTRL_CONFIG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_CONFIG_MANAGER,".").concat(jn.PUSHED_CLOUD_CTRL_CONFIG)}),body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(jn.OVERLOAD_NOTIFY,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OVERLOAD_PUSH,".").concat(jn.OVERLOAD_NOTIFY)}),body:{},keyMap:{res:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}),this._map.set(jn.SYNC_UNREAD_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.SYNC_UNREAD_MSG)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1,needCachedMsg:1},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},res:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}),this._map.set(jn.GET_PROFANITY_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_MSG_AUDIT_MGR,".").concat(jn.GET_PROFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{req:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},res:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}),this._map.set(jn.SEND_C2C_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.SEND_C2C_MSG)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:"",interruptionLevel:"active",contentAvailable:0},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:"",MeizuNotifyType:void 0}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance",MeizuNotifyType:"MeiZuNoticeMsgType"}}}),this._map.set(jn.SEND_GRP_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.SEND_GRP_MSG)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:"",interruptionLevel:"active",contentAvailable:0},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:"",MeizuNotifyType:void 0}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance",MeizuNotifyType:"MeiZuNoticeMsgType"},res:{MsgTime:"time",MsgSeq:"sequence"}}}),this._map.set(jn.REVOKE_C2C_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.REVOKE_C2C_MSG)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{req:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}),this._map.set(jn.REVOKE_GRP_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.REVOKE_GRP_MSG)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{req:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}),this._map.set(jn.GET_C2C_ROAMING_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.GET_C2C_ROAMING_MSG)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{req:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},res:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}),this._map.set(jn.MODIFY_C2C_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.MODIFY_C2C_MSG)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(jn.GET_GRP_ROAMING_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_ROAMING_MSG)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{req:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},res:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList",NextReqMsgSeq:"nextSequence"}}}),this._map.set(jn.SET_C2C_MSG_READ,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.SET_C2C_MSG_READ)}),body:{C2CMsgReaded:void 0},keyMap:{req:{lastMessageTime:"LastedMsgTime"}}}),this._map.set(jn.SET_C2C_PEER_MUTE_NOTIFICATIONS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{req:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}),this._map.set(jn.GET_C2C_PEER_MUTE_NOTIFICATIONS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{toAccount:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Peer_Account"},res:{MuteNotificationsList:"muteFlagList"}}}),this._map.set(jn.SET_GRP_MSG_READ,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.SET_GRP_MSG_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{req:{messageReadSeq:"MsgReadedSeq"}}}),this._map.set(jn.SET_ALL_MSG_READ,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.SET_ALL_MSG_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{req:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},res:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}),this._map.set(jn.DEL_C2C_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.DEL_C2C_MSG)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{req:{keyList:"MsgKeyList"}}}),this._map.set(jn.DEL_GRP_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.DEL_GRP_MSG)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{req:{deleter:"Deleter_Account",keyList:"Seqs"}}}),this._map.set(jn.TRANSLATE_TEXT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_TRANSLATE,".").concat(jn.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{req:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},res:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(jn.VOICE_TO_TEXT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_SPEECH,".").concat(jn.VOICE_TO_TEXT)}),body:{url:"",SDKAppID:0,format:"",sourceType:0,language:""},keyMap:{req:{url:"BytesUrl",SDKAppID:"Uint32Sdkappid",format:"BytesVoiceFormat",sourceType:"Uint64SourceType",language:"BytesEngServiceType"},res:{BytesRequestid:"requestID",BytesResult:"result",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(jn.MODIFY_GRP_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.MODIFY_GRP_MSG)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(jn.GET_READ_RECEIPT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequence:"MsgSeq"}}}),this._map.set(jn.SEND_C2C_READ_RECEIPT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{req:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}),this._map.set(jn.SEND_READ_RECEIPT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}),this._map.set(jn.GET_READ_RECEIPT_DETAIL,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{req:{sequence:"MsgSeq",count:"Num"},res:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}),this._map.set(jn.GET_GRP_RECEIPTS_BY_USERS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_RECEIPTS_BY_USERS)}),body:{groupID:"",dataList:void 0},keyMap:{req:{dataList:"MemberReadMsgList",sequence:"MsgSeq",userIDList:"MemberList_Account"},res:{MsgReadList:"dataList",Read_Account:"userID",Read_Time:"readTime"}}}),this._map.set(jn.MODIFY_C2C_MSG_EXT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.MODIFY_C2C_MSG_EXT)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(jn.GET_C2C_MSG_EXT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.GET_C2C_MSG_EXT)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}),this._map.set(jn.MODIFY_GRP_MSG_EXT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.MODIFY_GRP_MSG_EXT)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(jn.GET_GRP_MSG_EXT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.GET_GRP_MSG_EXT)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}),this._map.set(jn.ADD_C2C_MSG_REACTION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.ADD_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(jn.RM_C2C_MSG_REACTION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.RM_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(jn.GET_C2C_MSG_REACTIONS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.GET_C2C_MSG_REACTIONS)}),body:{from:void 0,to:void 0,messageKeyList:void 0,count:void 0}}),this._map.set(jn.GET_C2C_MSG_REACTION_USER_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.GET_C2C_MSG_REACTION_USER_LIST)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,count:void 0}}),this._map.set(jn.ADD_GRP_MSG_REACTION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.ADD_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(jn.RM_GRP_MSG_REACTION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.RM_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(jn.GET_GRP_MSG_REACTIONS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.GET_GRP_MSG_REACTIONS)}),body:{groupID:void 0,topicID:void 0,messageSequenceList:void 0,count:void 0},keyMap:{res:{MsgSeq:"messageSequence"}}}),this._map.set(jn.GET_GRP_MSG_REACTION_USER_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM_MSG_EXT,".").concat(jn.GET_GRP_MSG_REACTION_USER_LIST)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,nextSeq:void 0,count:void 0}}),this._map.set(jn.GET_C2C_PEER_READ_TIME,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.GET_C2C_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{req:{userIDList:"To_Account"},res:{ReadTime:"peerReadTimeList"}}}),this._map.set(jn.PAGING_GET_CONV_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.PAGING_GET_CONV_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:15,assistFlag:31},keyMap:{req:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},res:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID",C2cRemark:"friendRemark",MsgRecvOption:"messageRemindType",GroupIgnoredUnreadSeqCount:"noUnreadCount",GroupNextMsgSeq:"nextMessageSeq"}}}),this._map.set(jn.DEL_CONV,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.DEL_CONV)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{req:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},res:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}),this._map.set(jn.CLEAR_HISTORY_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.CLEAR_HISTORY_MSG)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{req:{toGroupID:"ToGroupid"}}}),this._map.set(jn.PIN_CONV,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.PIN_CONV)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{req:{itemList:"RecentContactItem"}}}),this._map.set(jn.DEL_GROUP_AT_TIPS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.DEL_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(jn.SET_CONV_CUSTOM_DATA,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.MARK_CONV)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(jn.MARK_CONV,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.MARK_CONV)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(jn.CREATE_CONV_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.CREATE_CONV_GRP)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"GroupContactItem",groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(jn.DEL_CONV_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.DEL_CONV_GRP)}),body:{fromAccount:"",groupName:void 0},keyMap:{res:{GroupId:"convGroupID"}}}),this._map.set(jn.RENAME_CONV_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{req:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},res:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}),this._map.set(jn.ADD_CONV_TO_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}}}),this._map.set(jn.DEL_CONV_FROM_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0}}),this._map.set(jn.GET_CONV_GRP_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.GET_CONV_GRP_LIST)}),body:{fromAccount:"",startIndex:void 0},keyMap:{res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}),this._map.set(jn.SEARCH_CONV_GRP_MARK,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.RECENT_CONTACT,".").concat(jn.SEARCH_CONV_GRP_MARK)}),body:{fromAccount:"",contactItem:void 0},keyMap:{req:{groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList",ContactResultItem:"contactItem"}}}),this._map.set(jn.GET_USER_PROFILE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.PROFILE,".").concat(jn.GET_USER_PROFILE)}),body:{fromAccount:"",userItem:[]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(jn.UPDATE_MY_PROFILE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.PROFILE,".").concat(jn.UPDATE_MY_PROFILE)}),body:{fromAccount:"",profileItem:[{tag:Le.NICK,value:""},{tag:Le.GENDER,value:""},{tag:Le.ALLOWTYPE,value:""},{tag:Le.AVATAR,value:""}]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(jn.GET_BL,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.GET_BL)}),body:{fromAccount:"",startIndex:0,maxLimited:30}}),this._map.set(jn.ADD_TO_BL,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.ADD_TO_BL)}),body:{fromAccount:"",toAccount:[]}}),this._map.set(jn.RM_FROM_BL,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.RM_FROM_BL)}),body:{fromAccount:"",toAccount:[]}}),this._map.set(jn.SET_SELF_STATUS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.SET_SELF_STATUS)}),body:{customStatus:""}}),this._map.set(jn.GET_USER_STATUS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{res:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}),this._map.set(jn.SUB_USER_STATUS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.SUB_USER_STATUS)}),body:{userIDList:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(jn.UNSUB_USER_STATUS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.UNSUB_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(jn.GET_FD_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.GET_FD_LIST)}),body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{res:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}),this._map.set(jn.ADD_FD,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.ADD_FD)}),body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{req:{source:"AddSource",wording:"AddWording",type:"AddType"},res:{ResultItem:"resultList"}}}),this._map.set(jn.UPDATE_FD,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.UPDATE_FD)}),body:{fromAccount:"",updateItem:void 0},keyMap:{req:{snsItem:"SnsItem"},res:{ResultItem:"resultList"}}}),this._map.set(jn.DEL_FD,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.DEL_FD)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"DeleteType"},res:{ResultItem:"resultList"}}}),this._map.set(jn.GET_FD_PROFILE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.GET_FD_PROFILE)}),body:{fromAccount:"",userIDList:void 0},keyMap:{res:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}),this._map.set(jn.CHECK_FD,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.CHECK_FD)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"CheckType"},res:{InfoItem:"resultList"}}}),this._map.set(jn.GET_FD_APPLICATION_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.GET_FD_APPLICATION_LIST)}),body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{res:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}),this._map.set(jn.RESPOND_FD_APPLICATION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.RESPOND_FD_APPLICATION)}),body:{fromAccount:"",responseFriendItem:[]},keyMap:{req:{tag:"TagName",action:"ResponseAction"},res:{ResultItem:"resultList"}}}),this._map.set(jn.DEL_FD_APPLICATION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.DEL_FD_APPLICATION)}),body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{req:{type:"PendencyType",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(jn.REPORT_FD_APPLICATION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.REPORT_FD_APPLICATION)}),body:{fromAccount:"",latestTimeStamp:""},keyMap:{req:{latestTimeStamp:"LatestPendencyTimeStamp"}}}),this._map.set(jn.CREATE_FD_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.CREATE_FD_GRP)}),body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{req:{groupName:"GroupName",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(jn.DEL_FD_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.DEL_FD_GRP)}),body:{fromAccount:"",nameList:void 0},keyMap:{req:{nameList:"GroupName"}}}),this._map.set(jn.GET_FD_GRP_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.GET_FD_GRP_LIST)}),body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{res:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}),this._map.set(jn.UPDATE_FD_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FD,".").concat(jn.UPDATE_FD_GRP)}),body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{req:{oldName:"GroupOldName",newName:"GroupNewName"},res:{UpdateType:"type",ResultItem:"resultList"}}}),this._map.set(jn.GET_GRP_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_LIST)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0,needAppDefineData:1},keyMap:{req:{memberAccount:"Member_Account"},res:{GroupIdList:"groups",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime",AppDefinedData:"groupCustomField"}}}),this._map.set(jn.GET_GRP_PROFILE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_PROFILE)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:void 0,groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{req:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(jn.CREATE_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.CREATE_GRP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0,inviteOption:void 0},keyMap:{req:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},res:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}),this._map.set(jn.DISMISS_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.DISMISS_GRP)}),body:{groupID:void 0}}),this._map.set(jn.UPDATE_GRP_PROFILE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.UPDATE_GRP_PROFILE)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{req:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},res:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(jn.APPLY_JOIN_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.APPLY_JOIN_GRP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{req:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},res:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}),this._map.set(jn.APPLY_JOIN_GRP_NOAUTH,(e.a2,e.tinyid,{head:g(g({},f(e,Cs)),{},{servcmd:"".concat(P.NAME.BIG_GRP_NO_AUTH,".").concat(jn.APPLY_JOIN_GRP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{req:{applyMessage:"ApplyMsg"},res:{HugeGroupFlag:"avChatRoomFlag"}}})),this._map.set(jn.QUIT_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.QUIT_GRP)}),body:{groupID:void 0}}),this._map.set(jn.SEARCH_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.SEARCH_GRP)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}}}),this._map.set(jn.CHANGE_GRP_OWNER,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.CHANGE_GRP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{req:{newOwnerID:"NewOwner_Account"}}}),this._map.set(jn.HANDLE_GRP_APPLICATION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.HANDLE_GRP_APPLICATION)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(jn.HANDLE_INVITE_JOIN_GRP,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.HANDLE_INVITE_JOIN_GRP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}),this._map.set(jn.HANDLE_GRP_INVITATION,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.HANDLE_GRP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(jn.GET_GRP_PENDENCY,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_PENDENCY)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{req:{handleAccount:"Handle_Account"},res:{To_Account:"userID",ApplyInviteMsg:"note"}}}),this._map.set(jn.DEL_GRP_SYSTEM_NOTICE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.DEL_GRP_SYSTEM_NOTICE)}),body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(jn.AV_POLLING,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.BIG_GRP_POLLING,".").concat(jn.AV_POLLING)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}),this._map.set(jn.AV_NOAUTH_POLLING,(e.a2,e.tinyid,{head:g(g({},f(e,Ss)),{},{servcmd:"".concat(P.NAME.BIG_GRP_POLLING_NO_AUTH,".").concat(jn.AV_POLLING)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}})),this._map.set(jn.GET_ONLINE_MBR_NUM,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_ONLINE_MBR_NUM)}),body:{groupID:void 0},keyMap:{res:{OnlineMemberNum:"memberCount"}}}),this._map.set(jn.SET_GRP_ATTR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.SET_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(jn.MODIFY_GRP_ATTR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.MODIFY_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(jn.DEL_GRP_ATTR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.DEL_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key"}}}),this._map.set(jn.CLEAR_GRP_ATTR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.CLEAR_GRP_ATTR)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}),this._map.set(jn.GET_GRP_ATTR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_ATTR,".").concat(jn.GET_GRP_ATTR)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{req:{avChatRoomKey:"Key",groupType:"GroupType"}}}),this._map.set(jn.GET_GRP_NOTIFY,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_NOTIFY)}),body:{notifyReqList:[]},keyMap:{req:{notifyReqList:"NotifyReqList"},res:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList",NotifyRspList:"notifyRspList"}}}),this._map.set(jn.UPDATE_GRP_COUNTER,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.UPDATE_GRP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{req:{counterList:"GroupCounter"}}}),this._map.set(jn.GET_GRP_COUNTER,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{req:{keyList:"GroupCounterKeys"}}}),this._map.set(jn.CREATE_TOPIC,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_COMMUNITY,".").concat(jn.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{req:{avatar:"FaceUrl"}}}),this._map.set(jn.DEL_TOPIC,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_COMMUNITY,".").concat(jn.DEL_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{req:{topicIDList:"TopicIdList"},res:{DestroyResultItem:"resultList"}}}),this._map.set(jn.UPDATE_TOPIC_PROFILE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_COMMUNITY,".").concat(jn.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{req:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}),this._map.set(jn.GET_TOPIC_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_COMMUNITY,".").concat(jn.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{req:{topicIDList:"TopicIdList"},res:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence"}}}),this._map.set(jn.GET_GRP_MBR_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_MBR_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}),this._map.set(jn.GET_AV_MBR_LIST,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_AV,".").concat(jn.GET_AV_MBR_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{req:{offset:"Timestamp",filter:"Mark"},res:{NextTimestamp:"offset"}}}),this._map.set(jn.GET_GRP_MBR_PROFILE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.GET_GRP_MBR_PROFILE)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}),this._map.set(jn.ADD_GRP_MBR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.ADD_GRP_MBR)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{req:{userID:"Member_Account",userIDList:"MemberList"},res:{MemberList:"members"}}}),this._map.set(jn.DEL_GRP_MBR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.DEL_GRP_MBR)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{req:{userIDList:"MemberToDel_Account"}}}),this._map.set(jn.BAN_AV_MBR,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.BAN_AV_MBR)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{req:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}),this._map.set(jn.MODIFY_GRP_MBR_INFO,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP,".").concat(jn.MODIFY_GRP_MBR_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{req:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}),this._map.set(jn.MARK_AV_MBR_INFO,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_AV,".").concat(jn.MARK_AV_MBR_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{req:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},res:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}),this._map.set(jn.CS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.MSG_SEARCH,".").concat(jn.CS)}),body:{keywordList:void 0,keywordListMatchType:"or",account:void 0,groupID:void 0,count:100,cursor:void 0,messageTypeList:void 0,senderUserIDList:void 0,startTime:void 0,endTime:void 0},keyMap:{req:{keywordListMatchType:"MatchType",account:"PeerAccount",groupID:"GroupID",messageTypeList:"MsgTypeList",senderUserIDList:"SendUserIDList",keywords:"Keywords",keywordMatchType:"KeywordMatchType",count:"Count",miniBirthday:"UserBirthStart",maxBirthday:"UserBirthEnd",gender:"UserGenderType",groupTypeList:"GroupType",groupIDList:"GroupIdList"},res:{GroupID:"groupID",UserID:"userID",ErrorCode:"code",ErrorInfo:"message",TotalCount:"totalCount",Count:"messageCount",LastMsgTime:"lastMessageTime",ConversationMsgs:"searchResult",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer",MsgSeq:"sequence",ReqMsgSeq:"sequence",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgContent:"content",ClientSeq:"clientSequence",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList",Users:"userList",ProfileItems:"profileItems",StrValue:"value",IntValue:"value",Groups:"groupList",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupOwnerUserID:"ownerID",GroupOwnerUserName:"ownerNick",GroupOwnerTinyID:"ownerTinyID",GroupMemberNum:"memberNum",GroupName:"name",GroupType:"type",GroupMembers:"groupMemberList",GroupMemberUserID:"userID",GroupMemberTinyID:"userTinyID",GroupMemberUserName:"nick",GroupMemberNameCard:"nameCard"}}}),this._map.set(jn.USER_CS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.USER_SEARCH,".").concat(jn.CS)}),body:{keywords:void 0,keywordMatchType:0,miniBirthday:void 0,maxBirthday:void 0,gender:void 0,count:20,cursor:void 0}}),this._map.set(jn.GRP_CS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_SEARCH,".").concat(jn.CS)}),body:{keywords:void 0,keywordMatchType:0,groupType:void 0,count:20,cursor:void 0}}),this._map.set(jn.MBR_CS,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.GRP_MEMBER_SEARCH,".").concat(jn.CS)}),body:{keywords:void 0,keywordMatchType:0,groupType:void 0,groupIDList:void 0,count:20,cursor:void 0}}),this._map.set(jn.SSO_STAT,{head:g(g({},n),{},{servcmd:"".concat(P.NAME.IM_OPEN_STAT,".").concat(jn.SSO_STAT)}),body:{header:{},event:[],quality:[]},keyMap:{req:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}),this._map.set(jn.PING,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.HEARTBEAT,".").concat(jn.PING)}),body:{}}),this._map.set(jn.MSG_PUSH,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_PUSH,".").concat(jn.MSG_PUSH)}),body:{},keyMap:{res:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}),this._map.set(jn.MULTI_MSG_PUSH,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_PUSH,".").concat(jn.MULTI_MSG_PUSH)}),body:{},keyMap:{res:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}),this._map.set(jn.MSG_PUSH_ACK,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OPEN_IM,".").concat(jn.MSG_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{req:{sessionData:"SessionData"}}}),this._map.set(jn.STATUS_FORCE_OFFLINE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{res:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}),this._map.set(jn.DOWNLOAD_MERGER_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_LONG_MSG,".").concat(jn.DOWNLOAD_MERGER_MSG)}),body:{downloadKey:""},keyMap:{res:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}),this._map.set(jn.UPLOAD_MERGER_MSG,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_LONG_MSG,".").concat(jn.UPLOAD_MERGER_MSG)}),body:{messageList:[]},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}),this._map.set(jn.FOLLOW,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FOLLOW,".").concat(jn.FOLLOW)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"FollowItem"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(jn.UNFOLLOW,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FOLLOW,".").concat(jn.UNFOLLOW)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(jn.GET_FOLLOW_INFO,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FOLLOW,".").concat(jn.GET_FOLLOW_INFO)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{FollowInfo:"followInfoList",To_Account:"userID",FollowerCount:"followersCount",FollowingCount:"followingCount",MutualFollowingCount:"mutualFollowersCount"}}}),this._map.set(jn.GET_FOLLOW,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FOLLOW,".").concat(jn.GET_FOLLOW)}),body:{fromAccount:"",type:1,nextCursor:"",count:500},keyMap:{req:{type:"FollowType",nextCursor:"StartCursor",count:"WantNum"},res:{FollowItem:"resultList",To_Account:"userID",ProfileItem:"profileList"}}}),this._map.set(jn.CHECK_FOLLOW_TYPE,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.FOLLOW,".").concat(jn.CHECK_FOLLOW_TYPE)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(jn.SET_TOKEN,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0,notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:""},keyMap:{req:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns",notificationStatus:"NotificationStatus",deviceModel:"DeviceModel",systemVersion:"SystemVersion",pushVersion:"PushPluginVersion"}}}),this._map.set(jn.STAT_FOREGROUND,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.STAT_FOREGROUND)}),body:{isWebUniapp:0}}),this._map.set(jn.STAT_BACKGROUND,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_OPEN_STATUS,".").concat(jn.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{req:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}),this._map.set(jn.PUSH_REPORT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.OFFLINE_PUSH_REPORT,".").concat(jn.PUSH_REPORT)}),body:{eventList:[]},keyMap:{req:{eventList:"UinappPushEvents",type:"EventType",time:"EventTime",pushId:"ClickExt"}}}),this._map.set(jn.SET_ALL_RECEIVE_MSG_OPT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_MSG_LOGIC,".").concat(jn.SET_ALL_RECEIVE_MSG_OPT)}),body:{startTime:0,endTime:0,isRepeated:0,messageRemindType:0},keyMap:{req:{messageRemindType:"Level"}}}),this._map.set(jn.GET_ALL_RECEIVE_MSG_OPT,{head:g(g({},e),{},{servcmd:"".concat(P.NAME.IM_MSG_LOGIC,".").concat(jn.GET_ALL_RECEIVE_MSG_OPT)}),body:{toAccount:void 0}})}},{key:"has",value:function(e){return this._map.has(e)}},{key:"get",value:function(e){return this._map.get(e)}},{key:"update",value:function(){this._fillMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(be.w("".concat(this._n,".getKeyMap unknown P:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.P,n=e.data;if(e=this.get(t),t=null,n){var i,o=this._simpleDeepCopy(e),s=(o=this._updateService(n,o)).body,a=Object.create(null);for(i in s)if(Object.prototype.hasOwnProperty.call(s,i)){if(a[i]=s[i],void 0===n[i])continue;a[i]=n[i]}o.body=a,t=this._getUplinkData(o)}else t=this._getUplinkData(e);return t}},{key:"_getUplinkData",value:function(e){var t=Nt((e=this._dataCleaner(e)).head);return t=us(e.body,this._getReqKeyMap(t)),e.body=t,e}},{key:"_updateService",value:function(e,t){var n,i,o=Nt(t.head);return this._isFromGroupRequest(t)&&(n=e.type,i=e.groupID,e=void 0===(e=e.groupIDList)?[]:e,lt(i=void 0===i?void 0:i)&&(i=e[0]||""),Ct({type:n,groupID:i}))&&(t.head.servcmd="".concat(P.NAME.GRP_COMMUNITY,".").concat(o)),t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(P.NAME.GRP)||e.head.servcmd.includes(P.NAME.GRP_ATTR)}},{key:"_getReqKeyMap",value:function(e){return e=this.getKeyMap(e),g(g({},es.req),e.req)}},{key:"_dataCleaner",value:function(e){var t,n=Array.isArray(e)?[]:Object.create(null);for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&Qe(t)&&null!==e[t]&&void 0!==e[t]&&("object"!==I(e[t])?n[t]=e[t]:n[t]=this._dataCleaner.bind(this)(e[t]));return n}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),i={},o=0,s=n.length;o<s;o++)Ye(e[t=n[o]])?i[t]=Array.from(e[t]):ze(e[t])?i[t]=this._simpleDeepCopy(e[t]):i[t]=e[t];return i}}]),Ts=[jn.MSG_PUSH_ACK],ks=s((function e(t){i(this,e),this._sessionM=t,this._n="MsgDispatcher",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._onC2CMsgArray.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._onGroupMsgArray.bind(this)),this._eventHandlerMap.set("groupTips",this._onGroupTips.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._onC2CNotifyMsgArray.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._onC2CReadReceiptArray.bind(this)),this._eventHandlerMap.set("profileModify",this._onProfileModified.bind(this)),this._eventHandlerMap.set("friendListMod",this._onRelationChainModified.bind(this)),this._eventHandlerMap.set("recentContactMod",this._onRecentContact.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._onAllMsgRead.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._onC2CMsgModified.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._onGroupMsgModified.bind(this)),this._eventHandlerMap.set("userStatusList",this._onUserStatusList.bind(this)),this._eventHandlerMap.set("messageExtensionNotify",this._onMsgExtNotify.bind(this)),this._eventHandlerMap.set("messageReactionNotifyList",this._onMsgReactionNotifyList.bind(this)),this._eventHandlerMap.set("messageReactionNotify",this._onMsgReactionNotify.bind(this)),this._eventHandlerMap.set("followChangeList",this._onFollowNotify.bind(this)),this._keys=v(this._eventHandlerMap.keys())}),[{key:"_onC2CMsgArray",value:function(e){var t=this._sessionM.get(6);e.dataList.forEach((function(e){var t;1===e.isSyncMessage&&(t=e.from,e.from=e.to,e.to=t)})),1===e.needSync&&this._sessionM.get(19).syncOnNeed(),t.onNewMessage({dataList:e.dataList,isInstantMessage:!0})}},{key:"_onC2CMsgModified",value:function(e){this._sessionM.get(6).onMsgModified(e)}},{key:"_onGroupMsgArray",value:function(e){var t=this._sessionM.get(7);t&&t.onNewMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}},{key:"_onGroupMsgModified",value:function(e){var t=this._sessionM.get(7);t&&t.onMsgModified(e)}},{key:"_onGroupTips",value:function(e){var t=this._sessionM.get(7);if(t){var n=e.event,i=e.dataList,o=e.isInstantMessage,s=void 0===o||o,a=e.isSyncingEnded;switch(n){case 4:case 6:t.onNewGroupTips({event:n,dataList:i});break;case 5:for(var r=0;r<i.length;r++)if(Ye(i[r].elements.revokedInfos))t.onMsgRevoked({dataList:i});else if(Ye(i[r].elements.groupMessageReadNotice))t.onMsgReadNotice({dataList:i});else{if(!Ye(i[r].elements.readReceiptList)){t.onNewGroupSystemNotice({dataList:i,isInstantMessage:s,isSyncingEnded:a});break}t.onReadReceiptList({dataList:i})}break;case 12:this._sessionM.get(11).onNewGroupAtTips({dataList:i});break;default:be.l("".concat(this._n,"._onGroupTips unknown event:").concat(n," dataList:"),i)}}}},{key:"_onC2CNotifyMsgArray",value:function(e){var t,n=this,i=e.dataList;Ye(i)&&(t=this._sessionM.get(6),i.forEach((function(e){var o,s;We(e)&&(e.hasOwnProperty("kickoutMsgNotify")?(o=(s=e.kickoutMsgNotify).kickType,s=void 0===(s=s.newInstanceInfo)?{}:s,1===o?n._sessionM.onMultipleAccountKickedOut(s):2===o?n._sessionM.onMultipleDeviceKickedOut(s):3===o&&n._sessionM.onRestApiKickedOut(s)):e.hasOwnProperty("c2cMessageRevokedNotify")?t&&t.onMsgRevoked({dataList:i},!0):e.hasOwnProperty("c2cMessageReadReceipt")?t&&t.onMsgReadReceipt({dataList:i}):e.hasOwnProperty("c2cMessageReadNotice")?t&&t.onMsgReadNotice({dataList:i}):e.hasOwnProperty("muteNotificationsSync")&&n._sessionM.get(11).onC2CMsgRemindTypeSynced({dataList:i}))})))}},{key:"_onC2CReadReceiptArray",value:function(e){this._sessionM.get(6).onReadReceiptList(e)}},{key:"_onProfileModified",value:function(e){this._sessionM.get(4).onProfileModified({dataList:e.dataList});var t=this._sessionM.get(8);t&&t.onFriendProfileModified({dataList:e.dataList})}},{key:"_onRelationChainModified",value:function(e){this._sessionM.get(4).onRelationChainModified({dataList:e.dataList});var t=this._sessionM.get(8);t&&t.onRelationChainModified({dataList:e.dataList})}},{key:"_onRecentContact",value:function(e){var t;Ye(e=e.dataList)&&(t=this._sessionM.get(11))&&e.forEach((function(e){var n,i,o=e.pushType;1===o?(n=e.recentContactDeleteItem,t.onConvDeleted(n.recentContactList)):2===o?(n=e.recentContactTopItem,t.onConvPinnedStatus(n.recentContactList,!0)):3===o?(n=e.recentContactTopItem,t.onConvPinnedStatus(n.recentContactList,!1)):4===o?(n=e.recentContactMarkContact,t.onConvMarkUpdated(n.recentContactMarkContactItem)):5===o?(n=e.recentContactCreateContactGroup,t.onConvGroupCreated(n.msgContactGroupContactItem)):6===o?(n=e.recentContactDelContactGroup,t.onConvGroupDeleted(n.msgGroupItem)):7===o&&(o=(n=e.recentContactUpdateContactGroup).updateType,e=n.msgUpdateGroup,n=n.msgUpdateContact,1===o?1===(i=e.updateGroupType)?t.onConvGroupNameUpdated(e):2===i&&t.onConvInGroupUpdated(e):2===o&&t.onConvAddedToOrDeletedFromGroup(n))}))}},{key:"_onAllMsgRead",value:function(e){e=e.dataList;var t=this._sessionM.get(11);t&&t.onPushedAllMessageRead(e)}},{key:"_onUserStatusList",value:function(e){this._sessionM.get(4).onUserStatusUpdated(e)}},{key:"_onMsgExtNotify",value:function(e){this._sessionM.get(3).onMsgExtNotify(e)}},{key:"_onMsgReactionNotifyList",value:function(e){this._sessionM.get(34).onReactionNotifyList(e)}},{key:"_onMsgReactionNotify",value:function(e){this._sessionM.get(34).onReactionNotify(e)}},{key:"_onFollowNotify",value:function(e){this._sessionM.get(35).onFollowNotify(e)}},{key:"_onTopicLatestMsg",value:function(e){this._sessionM.get(10).onTopicLatestMsg(e)}},{key:"onMessage",value:function(e){var t=this,n=e.body;if(this._filterMsgFromIMOpenPush(e)){var i,o=n.eventArray,s=n.isInstantMessage,a=n.isSyncingEnded,r=n.needSync;if(Ye(o))for(var c,u,l,d=0,p=o.length;d<p;d++)100!==(l=(c=o[d]).event)?24!==l?26!==l?(i=Object.keys(c).find((function(e){return-1!==t._keys.indexOf(e)})))?(u=14===l?{readAllC2CMessage:c[i],groupMessageReadInfoList:c.groupMessageReadNotice||[]}:16===l?{userID:c.userID,timestamp:c.timestamp,readReceiptList:c[i]}:c[i],this._eventHandlerMap.get(i)({event:l,dataList:u,isInstantMessage:s,isSyncingEnded:a,needSync:r})):be.l("".concat(this._n,".onMessage unknown eventItem:"),c):this._onTopicLatestMsg(c):this._onAllRcvMsgOptNotify(c):this._onRoomCustomData(c.content)}}},{key:"_onRoomCustomData",value:function(e){this._sessionM.get(30).onRoomCustomDataReceived(e),be.l("".concat(this._n,"._onRoomCustomData data:").concat(e))}},{key:"_onAllRcvMsgOptNotify",value:function(e){this._sessionM.get(11).onAllRcvMsgOptNotify(e)}},{key:"_filterMsgFromIMOpenPush",value:function(e){var t=e.head,n=(e=e.body,t=t.servcmd,!1);return!(n=lt(t)?n:t.includes(P.NAME.IM_CONFIG_MANAGER)||t.includes(P.NAME.OVERLOAD_PUSH)||t.includes(P.NAME.STAT_SERVICE))||(t.includes(jn.PUSHED_CLOUD_CTRL_CONFIG)?this._sessionM.get(23).onPushedConfig(e):t.includes(jn.PUSHED_COMMERCIAL_CONFIG)?this._sessionM.get(27).onPushedConfig(e):t.includes(jn.OVERLOAD_NOTIFY)?this._sessionM.onPushedServerOverload(e):t.includes(jn.KICK_OTHER)&&(n=Date.now(),this._sessionM.reLoginOnKickOther(),e=new oi("kickOther"),n-=t=this._sessionM.get(1).getLastWsHelloTs(),e.setMessage("last wshello time:".concat(t," diff:").concat(n,"ms")).end()),!1)}}]),Ds=[{cmd:jn.GET_GRP_PROFILE,interval:1,count:8},{cmd:jn.UPDATE_GRP_PROFILE,interval:1,count:8},{cmd:jn.GET_AV_MBR_LIST,interval:3,count:1},{cmd:jn.GET_GRP_PENDENCY,interval:1,count:15},{cmd:jn.GET_TOPIC_LIST,interval:1,count:10},{cmd:jn.SET_GRP_ATTR,interval:5,count:10},{cmd:jn.MODIFY_GRP_ATTR,interval:5,count:10},{cmd:jn.DEL_GRP_ATTR,interval:5,count:10},{cmd:jn.CLEAR_GRP_ATTR,interval:5,count:10},{cmd:jn.GET_GRP_ATTR,interval:5,count:20},{cmd:jn.UPDATE_GRP_COUNTER,interval:5,count:20},{cmd:jn.GET_GRP_COUNTER,interval:5,count:20},{cmd:jn.SET_ALL_MSG_READ,interval:1,count:1},{cmd:jn.GET_USER_STATUS,interval:5,count:20},{cmd:jn.SUB_USER_STATUS,interval:5,count:20},{cmd:jn.UNSUB_USER_STATUS,interval:5,count:20},{cmd:jn.CS,interval:5,count:20},{cmd:jn.GRP_CS,interval:5,count:20},{cmd:jn.MBR_CS,interval:5,count:20},{cmd:jn.USER_CS,interval:5,count:20},{cmd:jn.CHECK_FOLLOW_TYPE,interval:5,count:20},{cmd:jn.GET_GRP_ROAMING_MSG,interval:1,count:20},{cmd:jn.GET_C2C_ROAMING_MSG,interval:1,count:20}],Rs=new Map,Os=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],bs=0,As=Os.length;bs<As;bs++)Rs.set(bs,Os[bs]);function Ls(e){return i(this,Ls),(e=n(this,Ls,[e]))._n="ChannelModule",e._socketHandler=new ys(e),e._probing=!1,e._isAppShowing=!0,e._previousState=E.NET_STATE_CONNECTED,e._timerForNotLoggedIn=-1,e._timerForNotLoggedIn=setInterval(e.onCheckTimer.bind(e),1e3),e._fatalErrorFlag=!1,e._disconnectedTS=0,e._lastDiagnoseTS=0,e}function Ps(e){for(var t,n,i=e,o="",s=0,a=(i=e.length%8!=0?"0".repeat(8-e.length%8)+e:i).length;s<a;s+=8)t=parseInt(i.slice(s,s+4),2),n=parseInt(i.slice(s+4,s+8),2),o+=Rs.get(t)+Rs.get(n);return o}function Ns(e){var t;return e<0||53<e?NaN:(t=0|1073741824*Math.random(),30<e?t+1073741824*(0|Math.random()*(1<<e-30)):t>>>30-e)}function ws(e,t){for(var n=e.toString(16),i=t-n.length,o="0";0<i;i>>>=1,o+=o)1&i&&(n=o+n);return n}u(Da,wn);var Us=s(Da,[{key:"_init",value:function(){this._updateCmdFreqLimitMap(Ds)}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");lt(e)||(e=JSON.parse(e),this._updateCmdFreqLimitMap(e))}},{key:"_updateCmdFreqLimitMap",value:function(e){var t=this;e.forEach((function(e){t._cmdFreqLimitMap.set(e.cmd,{interval:e.interval,count:e.count})}))}},{key:"updateProtocolConfig",value:function(){this._pHandler.update()}},{key:"req",value:function(e){be.d("".concat(this._n,".req options:"),e);var t,n,i=e.P;return this._pHandler.has(i)?(t=(e=this.getProtocolData(e)).head.servcmd,this._isFreqOverLimit(t)?En({code:n=qn.OVER_FREQUENCY_LIMIT,message:this.getErrMsg(n,this._getCmd(t))}):this._isServerOverload(t)?En({code:n=qn.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrMsg(n,this._getCmd(t))}):(n=this.get(21),Ts.includes(i)?n.simplySend(e):n.send(e))):(be.w("".concat(this._n,".req unknown P:").concat(i)),En({code:qn.NO_PROTOCOL}))}},{key:"getKeyMap",value:function(e){return this._pHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:A,websdkversion:b,a2:e.getA2Key()||void 0,tinyid:e.getTinyID()||void 0,status_instid:e.getStatusInstanceID(),sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getA2Key()?void 0:e.getUserID(),usersig:e.getA2Key()?void 0:e.getUserSig(),sdkability:75689843,sdkability_ext:Ps(""),cappid:e.getApplicationID(),cs:0}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:A,websdkversion:b,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Ps(""),cappid:e.getApplicationID(),cs:0}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:A,websdkversion:b,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Ps(""),cappid:e.getApplicationID(),cs:0}}},{key:"getProtocolData",value:function(e){return this._pHandler.getProtocolData(e)}},{key:"trans",value:function(e){var t=e.servcmd;return e=e.data,t={head:g(g({},this.genCommonHead()),{},{servcmd:t}),body:e},this.get(21).send(t)}},{key:"sendComboMessage",value:function(e){var t=e.servcmd;return e=e.data,t={head:g(g({},this.genCommonHead()),{},{servcmd:t}),body:e},this.get(21).send(t)}},{key:"onErrorCodeNotZero",value:function(e){var t,n=e.errorCode;n===qn.HELLO_ANSWER_KICKED_OUT&&(t=e.kickType,e=void 0===(e=e.newInstanceInfo)?{}:e,1===t?this.onMultipleAccountKickedOut(e):2===t?this.onMultipleDeviceKickedOut(e):3===t&&this.onRestApiKickedOut(e)),n!==qn.MSG_A2KEY_EXPIRED&&n!==qn.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.get(21).reConnect())}},{key:"onMessage",value:function(e){var t=(n=e.body).needAck,n=n.sessionData;1===(void 0===t?0:t)&&this._sendACK(n),this._msgDispatcher.onMessage(e)}},{key:"onReconnected",value:function(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){be.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){be.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e,t,n,i=this,o="".concat(this._n,"._reLogin");this.isLoggedIn()&&(e=0,(t=this.get(1).getPushModule())&&(e=t.getUniAppPlatform()),n=new oi("reLogin"),this.req({P:jn.LOGIN,data:{isWebUniapp:e,customInfo:this.get(12).getCustomLoginInfo()}}).then((function(e){var t=(e=e.data).instanceID,s=(e=e.customStatus,i.get(12)),a=Bi(e),r=(s.setStatusInstanceID(t),i.get(21)),c=r.getSocketID();c="socketID:".concat(c," instanceID:").concat(t," customStatus:").concat(a),n.setMessage(c).end(!0),be.l("".concat(o," ok. ").concat(c)),s.getCustomStatus()!==a&&i.get(4).onUserStatusUpdated({dataList:[{to:i.getMyUserID(),statusType:E.USER_STATUS_ONLINE,customStatus:e}]}),r.diagnose(),i.get(11).syncConvList(i._incrementalPullContactFlag).then((function(){be.l("".concat(o,", sync conv list ok.")),i.get(25).start()})),((t=i.get(7))&&t.updateLocalMainSequenceOnReconnected(),c=i.get(10)).resetGetTopicTime(),c.getTopicListOnReconnected(),(s=i.get(35))&&s.clearCacheOnReconnected(),(a=i.get(8))&&a.updateCacheOnReconnected()})))}},{key:"onMultipleAccountKickedOut",value:function(e){this.get(1).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.get(1).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.get(1).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.get(1).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.req({P:jn.MSG_PUSH_ACK,data:{sessionData:e}})}},{key:"_isFreqOverLimit",value:function(e){var t,n,i,o;return e=e.split(".")[1],!!this._cmdFreqLimitMap.has(e)&&(!this._cmdReqInfoMap.has(e)||(t=(n=this._cmdFreqLimitMap.get(e)).count,n=n.interval,i=(o=this._cmdReqInfoMap.get(e)).startTime,o=o.requestCount,Date.now()-i>1e3*n)?(this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1):(this._cmdReqInfoMap.set(e,{startTime:i,requestCount:o+=1}),t<o))}},{key:"_isServerOverload",value:function(e){var t,n;return!!this._serverOverloadInfoMap.has(e)&&(t=(n=this._serverOverloadInfoMap.get(e)).overloadTime,n=n.waitingTime,Date.now()-t<=1e3*n||(this._serverOverloadInfoMap.delete(e),!1))}},{key:"_getCmd",value:function(e){var t="";if(e.includes(".")){var n,i=e.split(".")[1];for(n in jn)if(jn[n]===i){t=n;break}}return t}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand;e=e.waitingTime,this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:e}),be.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(e,"s cmd:").concat(this._getCmd(t)))}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._updateCmdFreqLimitMap(Ds),this._cmdReqInfoMap.clear(),this._serverOverloadInfoMap.clear(),this._incrementalPullContactFlag=!0}}]),Gs=(u(ka,wn),s(ka,[{key:"getCloudConfig",value:function(e){return lt(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"getServerConfig",value:function(e){var t={code:0,data:""};return!lt(e)&&this._cloudConfig.has(e)&&(t.data=this._cloudConfig.get(e)),Promise.resolve(t)}},{key:"_canFetch",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var e,t=this,n="".concat(this._n,".fetchConfig"),i=this._canFetch();be.l("".concat(n," canFetch:").concat(i)),i&&(e=new oi("fetchCloudCtrlConfig"),i=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({P:jn.FETCH_CLOUD_CTRL_CONFIG,data:{SDKAppID:i,version:this._version}}).then((function(i){t._isFetching=!1;var o=(s=i.data).version,s=s.cloudControlConfig;e.setMessage("version:".concat(t._version," newVersion:").concat(o," config:").concat(s)).end(),be.l("".concat(n," ok")),t._parse(i.data)})).catch((function(i){t._isFetching=!1,e.setError(i).end(),be.l("".concat(n," failed. error:"),i),t._setExpiredTime(12e4)})))}},{key:"onPushedConfig",value:function(e){be.l("".concat(this._n,".onPushedConfig config:"),e),new oi("pushedCloudCtrlConfig").setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parse(e)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"_parse",value:function(e){var t=this,n="".concat(this._n,"._parse"),i=e.errorCode,o=e.errorMessage,s=e.cloudControlConfig,a=e.version,r=e.expiredTime;if(0===i){if(this._version!==a){var c=null;try{c=JSON.parse(s)}catch(u){this.isPrivateNetWork()||be.e("".concat(n," failed. config:"),s)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach((function(e){t._cloudConfig.set(e,c[e])})),this._version=a,this.emitIEvt(Ni.CLOUD_CONFIG),this.emitOEvt(S.SERVER_CONFIG_UPDATED,{config:c}))}this._setExpiredTime(1e3*r)}else lt(i)?(be.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTime(36e5)):(be.e("".concat(n," errorCode:").concat(i," errorMessage:").concat(o)),this._setExpiredTime(12e4))}},{key:"_setExpiredTime",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}])),xs=(u(Ta,wn),s(Ta,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,t,n,i,o=this,s=this._getLocalConvList().filter((function(e){return e.type===E.CONV_GROUP&&e.groupProfile.type!==E.GRP_AVCHATROOM})),a=this.get(11),r=[];s.forEach((function(s){var c=s.conversationID;s=s.lastMessage,e=c.replace(E.CONV_GROUP,""),t=a.getLocalLastMessage(c),s&&0!==s.lastSequence&&t&&(n=s.lastSequence,t=t.sequence,i=n-t,0<t)&&1<=i&&i<300?o._recoverGroupMsg({groupID:e,localLastMessageSequence:t,remoteLastMessageSequence:n}):r.push(e)})),this._getGroupNotice(r)}},{key:"_recoverC2CChat",value:function(){var e,t,n,i=this,o=this._getLocalConvList().filter((function(e){return e.type===E.CONV_C2C})),s=this.get(11),a=[Promise.resolve()],r=[];o.forEach((function(o){var c=o.conversationID;o=o.lastMessage,e=s.getLocalLastMessage(c),o&&0!==o.lastTime&&e&&(t=o.lastTime,e=e.time,n=t-e,0<e)&&1<=n&&n<=600&&(a.push(i._recoverC2CMsg({conversationID:c,localLastMessageTime:e,remoteLastMessageTime:t})),r.push(c))})),Promise.all(a).then((function(){be.l("".concat(i._n,"._recoverC2CChat all done, convIDList:"),r),i.get(19).syncOnReconnected()}))}},{key:"_getLocalConvList",value:function(){return this.get(11).getLocalConvList()}},{key:"_recoverGroupMsg",value:function(e){var t=this,n="".concat(this._n,".").concat("_recoverGroupMsg"),i=(be.l("".concat(n," options:"),e),e.groupID),o=e.localLastMessageSequence,s=e.remoteLastMessageSequence,a=JSON.stringify(e),r=new oi("_recoverGroupMsg");r.setMessage(a),this._getGroupRoamingMsg({groupID:i,sequence:o}).then((function(e){var c=(e=e.data).complete,u=e.messageList;if(!lt(u)){e=u[0].sequence;var l=u.map((function(e){return e.sequence})),d=(l="".concat(a," complete:").concat(c," sequenceList:").concat(l),be.l("".concat(n," ").concat(l)),e!==o&&e<s&&2!==c&&t._recoverGroupMsg({groupID:i,localLastMessageSequence:e,remoteLastMessageSequence:s}),r.setMessage(l).end(),t.get(7));1<u.length&&u.sort((function(e,t){return e.sequence-t.sequence}));for(var p=!1,h=0,g=u.length;h<g;h++)if(u[h].from===E.CONV_SYSTEM){p=!0;break}if(p)for(var f=0,m=u.length;f<m;f++){var _=u[f];_.from!==E.CONV_SYSTEM?d.onNewMessage({dataList:[_],isInstantMessage:!1,updateUnreadCount:!1}):d.onNewGroupTips({event:_.event,dataList:[_]})}else d.onNewMessage({dataList:u,isInstantMessage:!1,updateUnreadCount:!1})}})).catch((function(e){r.setError(e).end(),be.w("".concat(n," failed. error:"),e)}))}},{key:"_getGroupNotice",value:function(e){var t=e.length;if(be.l("".concat(this._n,"._getGroupNotice length:").concat(t)),0!==t){var n=this.get(7);if(t<=10)n.getNotice(e);else{var i=Math.floor(t/10);5<=i&&(i=5);for(var o=0;o<=i;o++)n.getNotice(e.slice(10*o,10*(o+1)))}}}},{key:"_getGroupRoamingMsg",value:function(e){var t=e.groupID;return e=e.sequence,this.req({P:jn.GET_GRP_ROAMING_MSG,data:{groupID:t,count:this.PULL_LIMIT_COUNT,sequence:e+this.PULL_LIMIT_COUNT-1}})}},{key:"_recoverC2CMsg",value:function(e){var t=this,n="".concat(this._n,".").concat("_recoverC2CMsg"),i=(be.l("".concat(n," options:"),e),e.conversationID),o=e.localLastMessageTime,s=e.remoteLastMessageTime,a=JSON.stringify(e),r=new oi("_recoverC2CMsg");return r.setMessage(a),this._getC2CRoamingMsg({conversationID:i,time:o}).then((function(e){var o=(e=e.data).complete;if(e=e.messageList,!lt(e)){var c=e.length;if(t.get(6).onNewMessage({dataList:e,isInstantMessage:!0}),c=e[c-1].time,e=e.map((function(e){return e.random})),e="".concat(a," complete:").concat(o," randomList:").concat(e),be.l("".concat(n," ").concat(e)),r.setMessage(e).end(),c<s&&1!==o)return t._recoverC2CMsg({conversationID:i,localLastMessageTime:c,remoteLastMessageTime:s})}})).catch((function(e){r.setError(e).end(),be.w("".concat(n," failed. error:"),e)}))}},{key:"_getC2CRoamingMsg",value:function(e){var t=e.conversationID;return e=e.time,this.req({P:jn.GET_C2C_ROAMING_MSG,data:{peerAccount:t.replace(E.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:e,direction:1}})}},{key:"reset",value:function(){be.l("".concat(this._n,".reset"))}}])),Fs=s((function e(){i(this,e),this._n="AvgE2EDelay",this._e2eDelayArray=[]}),[{key:"addMessageDelay",value:function(e){0<=(e=Se()-e)&&this._e2eDelayArray.push(e)}},{key:"_calcAvg",value:function(e,t){var n;return 0===t?0:(n=0,e.forEach((function(e){n+=e})),wt(n/t,1))}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,i=e.max;return t.filter((function(e){return n<=e&&e<i})).length}},{key:"_calcPercent",value:function(e,t){return 100<(e=wt(e/t*100,2))?100:e}},{key:"_checkE2EDelayException",value:function(e,t){var n,i,o,s=e.filter((function(e){return t<e}));0<s.length&&(n=s.length,i=Math.min.apply(Math,v(s)),o=Math.max.apply(Math,v(s)),s=this._calcAvg(s,n),50<(e=wt(n/e.length*100,2)))&&new oi("messageE2EDelayException").setMessage("count:".concat(n," min:").concat(i," max:").concat(o," avg:").concat(s," percent:").concat(e)).setLevel("warning").end()}},{key:"getStatResult",value:function(){var e,t,n,i,o,s,a=this._e2eDelayArray.length;return 0===a?null:(e=v(this._e2eDelayArray),t=this._calcCountWithLimit({e2eDelayArray:e,min:0,max:1}),n=this._calcCountWithLimit({e2eDelayArray:e,min:1,max:3}),i=this._calcPercent(t,a),o=this._calcPercent(n,a),s=this._calcAvg(e,a),this._checkE2EDelayException(e,3),e.length=0,this.reset(),{totalCount:a,countLessThan1Second:t,percentOfCountLessThan1Second:i,countLessThan3Second:n,percentOfCountLessThan3Second:o,avgDelay:s})}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),Bs=s((function e(){i(this,e),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}),[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(e){this._rttArray.push(e)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(e){return e.length}},{key:"_calcSuccessRateOfRequest",value:function(e,t){return 0===t?0:100<(e=wt(e/t*100,2))?100:e}},{key:"_calcAvg",value:function(e,t){var n;return 0===t?0:(n=0,e.forEach((function(e){n+=e})),parseInt(n/t))}},{key:"_calcMax",value:function(){return Math.max.apply(Math,v(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,v(this._rttArray))}},{key:"getStatResult",value:function(){var e,t,n=this._calcTotalCount(),i=v(this._rttArray);return 0===n?null:(e=this._calcRTTCount(i),t=this._calcSuccessRateOfRequest(e,n),i=this._calcAvg(i,e),be.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(i)),this.reset(),{totalCount:n,rttCount:e,successRateOfRequest:t,avgRTT:i})}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),qs=s((function e(){i(this,e),this._map=new Map}),[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(lt(e)||!this._map.has(e)||(this._map.get(e).totalCount+=1,0))}},{key:"addSuccessCount",value:function(e){return!(lt(e)||!this._map.has(e)||(this._map.get(e).successCount+=1,0))}},{key:"addFailedCountOfUserSide",value:function(e){return!(lt(e)||!this._map.has(e)||(this._map.get(e).failedCountOfUserSide+=1,0))}},{key:"addCost",value:function(e,t){return!(lt(e)||!this._map.has(e)||(this._map.get(e).costArray.push(t),0))}},{key:"addFileSize",value:function(e,t){return!(lt(e)||!this._map.has(e)||(this._map.get(e).fileSizeArray.push(t),0))}},{key:"_calcSuccessRateOfBusiness",value:function(e){return lt(e)||!this._map.has(e)?-1:100<(e=wt((e=this._map.get(e)).successCount/e.totalCount*100,2))?100:e}},{key:"_calcSuccessRateOfPlatform",value:function(e){var t;return lt(e)||!this._map.has(e)?-1:(t=this._map.get(e),100<(e=wt(e=this._calcSuccessCountOfPlatform(e)/t.totalCount*100,2))?100:e)}},{key:"_calcTotalCount",value:function(e){return lt(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return lt(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){return lt(e)||!this._map.has(e)?-1:(e=this._map.get(e)).successCount+e.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return lt(e)||!this._map.has(e)?-1:e===Jn?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t,n=this._map.get(e).costArray.length;return 0===n?0:(t=0,this._map.get(e).costArray.forEach((function(e){t+=e})),parseInt(t/n))}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t,n,i,o,s,a=this._calcTotalCount(e);return 0===a?null:(t=this._calcSuccessCountOfBusiness(e),n=this._calcSuccessRateOfBusiness(e),i=this._calcSuccessCountOfPlatform(e),o=this._calcSuccessRateOfPlatform(e),s=this._calcAvg(e),this.reset(e),{totalCount:a,successCountOfBusiness:t,successRateOfBusiness:n,successCountOfPlatform:i,successRateOfPlatform:o,avgValue:s})}},{key:"reset",value:function(e){lt(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),Vs=s((function e(){i(this,e),this._lastMap=new Map,this._currentMap=new Map}),[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:"addMessageSequence",value:function(e){var t,n,i,o=e.key,s=e.message;return!(lt(o)||!this._lastMap.has(o)||!this._currentMap.has(o)||(t=s.conversationID,s=s.sequence,t=t.replace(E.CONV_GROUP,""),0!==this._lastMap.get(o).size&&this._lastMap.get(o).has(t)&&(i=(n=this._lastMap.get(o).get(t)).length-1,s>n[0])&&s<n[i]?(n.push(s),n.sort(),this._lastMap.get(o).set(t,n)):this._addCurrentMap(e),0))}},{key:"_addCurrentMap",value:function(e){var t=e.key,n=(e=e.message).conversationID;e=e.sequence,n=n.replace(E.CONV_GROUP,""),this._currentMap.get(t).has(n)||this._currentMap.get(t).set(n,[]),this._currentMap.get(t).get(n).push(e)}},{key:"_copyData",value:function(e){if(!lt(e)){this._lastMap.set(e,new Map);var t,n=this._lastMap.get(e),i=a(this._currentMap.get(e));try{for(i.s();!(t=i.n()).done;){var o=_(t.value,2),s=o[0],r=o[1];n.set(s,r)}}catch(c){i.e(c)}finally{i.f()}n=null,this._currentMap.set(e,new Map)}}},{key:"getStatResult",value:function(e){var t,n,i;return lt(this._currentMap.get(e))||lt(this._lastMap.get(e))?null:0===this._lastMap.get(e).size?(this._copyData(e),null):(n=t=0,this._lastMap.get(e).forEach((function(e,i){var o=(e=v(e.values())).length;e=e[o-1]-e[0]+1,t+=e,n+=o})),0===t?null:(100<(i=wt(n/t*100,2))&&(i=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:i}))}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),js=(u(Ea,wn),s(Ea,[{key:"_onLoginSuccess",value:function(){var e=this,t=(this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems),this.get(13)),n=t.getItem(this.TAG,!1);!qe(n)&&Je(n.forEach)&&(be.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");lt(e)||(this.REPORT_INTERVAL=Number(e)),lt(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),lt(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||be.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||be.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||be.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||be.w("".concat(this._n,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||be.w("".concat(this._n,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||be.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var t={},n=ni[this.get(15).getNetworkType()];switch(lt(n)&&(n=8),n={qualityType:ei[e],timestamp:ke(),networkType:n,extension:""},e){case Hn:t=this._avgRTT.getStatResult();break;case Kn:t=this._avgE2EDelay.getStatResult();break;case zn:case Wn:case Yn:case $n:case Jn:t=this._rateMessageSent.getStatResult(e);break;case Xn:case Qn:case Zn:t=this._rateMessageReceived.getStatResult(e)}return null===t?null:g(g({},n),t)}},{key:"_report",value:function(e){var t=this,n=[],i=null,o=(lt(e)?this._qualityItems.forEach((function(e){null!==(i=t._getQualityItem(e))&&(i.reportIndex=t.reportIndex,i.wholePeriod=t.wholePeriod,n.push(i))})):null!==(i=this._getQualityItem(e))&&(i.reportIndex=this.reportIndex,i.wholePeriod=this.wholePeriod,n.push(i)),be.d("".concat(this._n,"._report"),n),0<this._statInfoArr.length&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]),e=this.get(12)).getSDKAppID();e=e.getTinyID(),0<(n=Ut(this.REPORT_SDKAPPID_BLACKLIST,o)&&!Gt(this.REPORT_TINYID_WHITELIST,e)?[]:n).length&&this._doReport(n)}},{key:"_doReport",value:function(e){var t=this,n={header:Oo(this),quality:e};this.req({P:jn.SSO_STAT,data:g({},n)}).then((function(){t.reportIndex++,t.wholePeriod=!1})).catch((function(n){be.w("".concat(t._n,"._doReport failed. error:"),n),t._statInfoArr=t._statInfoArr.concat(e),t._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._statInfoArr,i="".concat(this._n,"._flushAtOnce");qe(t)?(be.l("".concat(i," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):(10<(n=n.concat(t)).length&&(n=n.slice(0,10)),be.l("".concat(i," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)),this._statInfoArr=[]}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}])),Hs=s((function e(t){i(this,e),qe(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.time=t.time||0,this.source=t.source||"",this.wording=t.wording||"",this.type=t.type||"")})),Ks=s((function e(t){i(this,e),this._snsM=t,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSeq=0,this._map=new Map,this._unreadCount=0}),[{key:"updateCacheOnReconnected",value:function(){this._startTime=0,this._currentSeq=0,this.getApplicationList()}},{key:"getLocalApplicationList",value:function(){return{friendApplicationList:v(this._map.values()),unreadCount:this._unreadCount}}},{key:"_onApplicationListUpdated",value:function(){this._snsM.emitOEvt(S.FRIEND_APPLICATION_LIST_UPDATED,{friendApplicationList:v(this._map.values()),unreadCount:this._unreadCount})}},{key:"onApplicationRead",value:function(){this._unreadCount=0,this._onApplicationListUpdated()}},{key:"onApplicationAdded",value:function(e,t){var n,i,o=this;qe(e)||(n="",n=t===this._snsM.getMyUserID()?E.SNS_APPLICATION_SENT_BY_ME:E.SNS_APPLICATION_SENT_TO_ME,i=!1,e.forEach((function(e){var t="".concat(e.userID,"_").concat(n);n!==E.SNS_APPLICATION_SENT_TO_ME||o._map.has(t)||(o._unreadCount+=1),o._map.set(t,new Hs(g(g({},e),{},{type:n}))),i=!0})),i&&this._onApplicationListUpdated())}},{key:"onApplicationDeleted",value:function(e){qe(e)||(this._startTime=0,this._currentSeq=0,this.getApplicationList())}},{key:"getApplicationList",value:function(){var e=this,t="".concat(this._n,".").concat("getApplicationList"),n=new oi("getApplicationList");return this._snsM.req({P:jn.GET_FD_APPLICATION_LIST,data:{applicationType:E.SNS_APPLICATION_TYPE_BOTH,fromAccount:this._snsM.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSeq}}).then((function(i){var o=(i=i.data).resultList,s=i.unreadCount,a=i.startTime,r=(i=i.currentSequence,e._startTime=a,e._currentSeq=i,e._unreadCount=s,Ye(o)?o.length:0);r="applicationCount:".concat(r," unreadCount:").concat(s," startTime:").concat(a," currentSequence:").concat(i),n.setMessage(r).end(),be.i("".concat(t," ok. ").concat(r)),e._map.clear(),Ye(o)&&o.forEach((function(t){var n=t.userID,i=t.type;t=new Hs(t),e._map.set("".concat(n,"_").concat(i),t)})),e._onApplicationListUpdated()})).catch((function(e){return n.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"deleteApplication",value:function(e){var t,n="".concat(this._n,".").concat("deleteApplication"),i=e.userID,o=e.type;return o&&(o===E.SNS_APPLICATION_SENT_BY_ME||o===E.SNS_APPLICATION_SENT_TO_ME)||(o=E.SNS_APPLICATION_SENT_TO_ME),this._map.has("".concat(i,"_").concat(o))?((t=new oi("deleteApplication")).setMessage("userID:".concat(i," type:").concat(o)),this._snsM.req({P:jn.DEL_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),userIDList:[i],type:o}}).then((function(e){var s=(r=(e=e.data.resultList)[0]).to,a=r.resultCode,r=r.resultInfo;return t.setMoreMessage("resultList:".concat(JSON.stringify(e))).end(),be.i("".concat(n," ok. userID:").concat(i," type:").concat(o)),0===a?Cn():En({userID:s,code:a,message:r})})).catch((function(e){return t.setError(e).end(),be.w("".concat(n," failed. error:"),e),En(e)}))):En({code:qn.FRIEND_APPLICATION_NOT_EXIST})}},{key:"acceptApplication",value:function(e){var t="".concat(this._n,".").concat("acceptApplication"),n=e.userID,i=e.remark,o=e.tag,s=e.type,a=(s&&(s===E.SNS_APPLICATION_AGREE||s===E.SNS_APPLICATION_AGREE_AND_ADD)||(s=E.SNS_APPLICATION_AGREE_AND_ADD),new oi("acceptApplication"));return a.setMessage("userID:".concat(n," type:").concat(s)),this._snsM.req({P:jn.RESPOND_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:n,remark:i,tag:o,action:s}]}}).then((function(e){a.end();var i=(e=e.data.resultList[0]).resultCode;if(e=e.resultInfo,0!==i)return En({code:i,message:e});be.i("".concat(t," ok. userID:").concat(n," type:").concat(s))})).catch((function(e){return a.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"refuseApplication",value:function(e){var t="".concat(this._n,".").concat("refuseApplication"),n=e.userID,i=new oi("refuseApplication");return i.setMessage("userID:".concat(n)),this._snsM.req({P:jn.RESPOND_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:n,action:"Response_Action_Reject"}]}}).then((function(e){i.end();var o=(e=e.data.resultList[0]).resultCode;if(e=e.resultInfo,0!==o)return En({code:o,message:e});be.i("".concat(t," ok. userID:").concat(n))})).catch((function(e){return i.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"setApplicationRead",value:function(){var e=this,t="".concat(this._n,".").concat("setApplicationRead"),n=new oi("setApplicationRead");return this._snsM.req({P:jn.REPORT_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),latestTimeStamp:wt(ke()/1e3,0)}}).then((function(i){n.end(),be.i("".concat(t," ok")),e._unreadCount=0})).catch((function(e){return n.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"reset",value:function(){this._maxLimited=100,this._startTime=0,this._currentSeq=0,this._unreadCount=0,this._map.clear()}}]),zs=s((function e(t,n){i(this,e),this.userID=t,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var o={},s=[];if(o.userID=t,!qe(n))for(var a,r="",c=0,u=n.length;c<u;c++)if(r=n[c].tag,a=n[c].value,-1<r.indexOf("Tag_SNS_Custom"))this.friendCustomField.push({key:r,value:a});else if(-1<r.indexOf("Tag_Profile_Custom"))s.push({key:r,value:a});else switch(r){case Le.NICK:o.nick=a;break;case Le.GENDER:o.gender=a;break;case Le.BIRTHDAY:o.birthday=a;break;case Le.LOCATION:o.location=a;break;case Le.SELFSIGNATURE:o.selfSignature=a;break;case Le.ALLOWTYPE:o.allowType=a;break;case Le.LANGUAGE:o.language=a;break;case Le.AVATAR:o.avatar=a;break;case Le.MESSAGESETTINGS:o.messageSettings=a;break;case Le.ADMINFORBIDTYPE:o.adminForbidType=a;break;case Le.LEVEL:o.level=a;break;case Le.ROLE:o.role=a;break;case Pe.REMARK:this.remark=a;break;case Pe.ADDTIME:this.addTime=a;break;case Pe.GROUP:this.groupList=JSON.parse(JSON.stringify(a));break;case Pe.ADDSOURCE:this.source=a;break;case Pe.ADDWORDING:break;default:be.l("snsProfileItem unknown tag->",n[c].tag)}this.profile=new ji(g(g({},o),{},{profileCustomField:s}))}),[{key:"validate",value:function(e){var t,n=!0,i="";if(qe(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,a=0;a<o;a++){if(s=e.profileCustomField[a],!ut(s.key)||-1===s.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!ut(s.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if("profileCustomField"===t)continue;if(qe(e[t])&&!ut(e[t])&&!Ke(e[t])){i="key:"+t+", invalid value:"+e[t],n=!1;continue}switch(t){case"nick":ut(e[t])||(n=!(i="nick must be a string")),500<nt(e[t])&&(i="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(nt(e[t])," bytes"),n=!1);break;case"gender":st(Ne,e.gender)||(i="key:gender, invalid value:"+e.gender,n=!1);break;case"birthday":Ke(e.birthday)||(n=!(i="birthday must be a number"));break;case"location":ut(e.location)||(n=!(i="location must be a string"));break;case"selfSignature":ut(e.selfSignature)||(n=!(i="selfSignature must be a string"));break;case"allowType":st(Ue,e.allowType)||(i="key:allowType, invalid value:"+e.allowType,n=!1);break;case"language":Ke(e.language)||(n=!(i="language must be a number"));break;case"avatar":ut(e.avatar)||(n=!(i="avatar must be a string"));break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n=!(i="messageSettings must be 0 or 1"));break;case"adminForbidType":st(we,e.adminForbidType)||(i="key:adminForbidType, invalid value:"+e.adminForbidType,n=!1);break;case"level":Ke(e.level)||(n=!(i="level must be a number"));break;case"role":Ke(e.role)||(n=!(i="role must be a number"));break;default:i="unknown key:"+t+" "+e[t],n=!1}}return{valid:n,tips:i}}},{key:"update",value:function(e){var t=this,n="",i="",o=[];this.friendCustomField.forEach((function(e){o.push(e.key)}));for(var s=0,a=e.length;s<a;s++)!function(){if(n=e[s].tag,i=e[s].value,-1<n.indexOf("Tag_SNS_Custom"))-1<o.indexOf(n)?t.friendCustomField.forEach((function(e){e.key===n&&(e.value=i)})):t.friendCustomField.push({key:n,value:i});else if(-1<n.indexOf("Tag_Profile_Custom")){var a=!1;t.profile.profileCustomField.forEach((function(e){e.key===n&&(e.value=i,a=!0)})),a||t.profile.profileCustomField.push({key:n,value:i})}else switch(n){case Le.NICK:t.profile.nick=i;break;case Le.GENDER:t.profile.gender=i;break;case Le.BIRTHDAY:t.profile.birthday=i;break;case Le.LOCATION:t.profile.location=i;break;case Le.SELFSIGNATURE:t.profile.selfSignature=i;break;case Le.ALLOWTYPE:t.profile.allowType=i;break;case Le.LANGUAGE:t.profile.language=i;break;case Le.AVATAR:t.profile.avatar=i;break;case Le.MESSAGESETTINGS:t.profile.messageSettings=i;break;case Le.ADMINFORBIDTYPE:t.profile.adminForbidType=i;break;case Le.LEVEL:t.profile.level=i;break;case Le.ROLE:t.profile.role=i;break;case Pe.REMARK:t.remark=i;break;case Pe.ADDTIME:t.addTime=i;break;case Pe.GROUP:t.groupList=JSON.parse(JSON.stringify(i));break;case Pe.ADDSOURCE:t.source=i;break;case Pe.ADDWORDING:break;default:be.d("snsProfileItem unkown tag->",e[s].tag)}}();this.timestamp=Date.now(),o.length=0}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){-1<(e=this.groupList.indexOf(e))&&(this.groupList.splice(e,1),this.count=this.groupList.length)}}]),Ws=s((function e(t){i(this,e),this._snsM=t,this._n="FriendHandler",this._map=new Map,this._startIdx=0,this._standardSeq=0,this._customSeq=0,this._expirationTime=18e4}),[{key:"updateCacheOnReconnected",value:function(){this._startIdx=0,this._standardSeq=0,this._customSeq=0,this.pagingGetFriendList()}},{key:"getLocalFriendList",value:function(){return v(this._map.values())}},{key:"getFriendRemark",value:function(e){return this._map.has(e)?this._map.get(e).remark:""}},{key:"onFriendProfileModified",value:function(e){var t,n=this;qe(e=e.dataList)||(t=this._snsM.get(11),e.forEach((function(e){var i,o=e.userID;e=e.profileList,n.isMyFriend(o)&&(be.l("".concat(n._n,".onFriendProfileModified. friend account:").concat(o,", profileList:").concat(JSON.stringify(e))),(i=n._map.get(o)).update(e),t.modifyMessageSentByPeer({conversationID:"".concat(E.CONV_C2C).concat(o),latestNick:i.profile.nick,latestAvatar:i.profile.avatar}))})),this._onFriendListUpdated())}},{key:"onFriendAdded",value:function(e){var t=this;0!==e.length&&(be.l("".concat(this._n,".onFriendAdded userIDList:").concat(e)),e.forEach((function(e){t._map.set(e,new zs(e))})),this.getFriendProfile({userIDList:e}).then((function(n){e.forEach((function(e){var n=t._map.get(e);0<n.groupList.length&&t._snsM.updateWhenFriendAdded({nameList:n.groupList,userID:e})})),t._onFriendListUpdated()})))}},{key:"onFriendDeleted",value:function(e){var t=this;0!==e.length&&(be.l("".concat(this._n,".onFriendDeleted userIDList:").concat(e)),e.forEach((function(e){var n=t._map.get(e);0<n.groupList.length&&t._snsM.updateWhenFriendDeleted({nameList:n.groupList,userID:e}),t._map.delete(e)})),this._onFriendListUpdated())}},{key:"_onFriendListUpdated",value:function(){this._snsM.emitOEvt(S.FRIEND_LIST_UPDATED),this._snsM.get(11).checkAndPatchRemark()}},{key:"getFriendProfile",value:function(e){var t,n=this,i="".concat(this._n,".").concat("getFriendProfile"),o=(e=e.userIDList,[]),s=[],a=[];return e.forEach((function(e){var t;n._map.has(e)?(t=n._map.get(e),Date.now()-t.timestamp<n._expirationTime?s.push(t):a.push(e)):o.push({userID:e,code:qn.NOT_MY_FRIEND,message:n._snsM.getErrMsg(qn.NOT_MY_FRIEND)})})),0===a.length?(be.i("".concat(i," newUserIDList is empty")),Sn({friendList:s,failureUserIDList:o})):((t=new oi("getFriendProfile")).setMessage("userIDList:".concat(a)),be.i("".concat(i," userIDList:").concat(a)),this._snsM.req({P:jn.GET_FD_PROFILE,data:{fromAccount:this._snsM.getMyUserID(),userIDList:a}}).then((function(e){return t.end(),be.i("".concat(i," ok")),e.data.resultList.forEach((function(e){var t,i=e.to,a=e.resultCode,r=e.resultInfo;e=e.tagValueList,lt(a)||0===a?(n._map.has(i)?(t=n._map.get(i)).update(e):(t=new zs(i,e),n._map.set(i,t)),s.push(t)):o.push({userID:i,code:a,message:r})})),Cn({friendList:s,failureUserIDList:o})})).catch((function(e){return t.setError(e).end(),be.w("".concat(i," failed. error:"),e),En(e)})))}},{key:"isMyFriend",value:function(e){return this._map.has(e)}},{key:"pagingGetFriendList",value:function(){var e=this,t="".concat(this._n,".").concat("getFriendList"),n=new oi("getFriendList"),i=Date.now();this._snsM.req({P:jn.GET_FD_LIST,data:{fromAccount:this._snsM.getMyUserID(),startIndex:this._startIdx,standardSequence:this._standardSeq,customSequence:this._customSeq}}).then((function(o){var s=(o=o.data).friendCount,a=o.resultList,r=o.nextStartIndex,c=o.standardSequence,u=o.customSequence;o=o.completeFlag,e._startIdx=r,e._standardSeq=c,e._customSeq=u,s="friendCount:".concat(s," nextStartIndex:").concat(r," standardSequence:").concat(c," ")+"customSequence:".concat(u," completeFlag:").concat(o," cost:").concat(zt(i)),n.setMessage(s).end(),be.i("".concat(t," ok."),s),qe(a)||a.forEach((function(t){var n=t.to;t=t.tagValueList,e._map.set(n,new zs(n,t))})),0===o?e.pagingGetFriendList():(e._snsM.emitOEvt(S.FRIEND_LIST_UPDATED),e._pagingGetFriendProfile())})).catch((function(e){return n.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"_pagingGetFriendProfile",value:function(){var e=this,t=v(this._map.keys()),n=this._snsM.get(4),i=t.length,o=i<=100?1:Math.ceil(i/100);be.l("".concat(this._n,"._pagingGetFriendProfile friendCount:").concat(i," pageCount:").concat(o));for(var s=0;s<o;s++)n.getUserProfile({userIDList:t.slice(100*s,100*(s+1))}).then((function(t){t.data.forEach((function(t){var n=e._map.get(t.userID);n&&n.updateProfile(t)})),e._onFriendListUpdated()}))}},{key:"addFriend",value:function(e){var t,n,i,o,s,a,r,c=this,u="".concat(this._n,".").concat("addFriend");return e.wording&&!1===this._snsM.filterProfanity("wording",e)?En({code:qn.PROFANITY_FOUND}):(t=e.to,n=e.source,i=e.type,o=e.wording,s=e.remark,e=e.groupName,(a=i)&&(a===E.SNS_ADD_TYPE_SINGLE||a===E.SNS_ADD_TYPE_BOTH)||(a=E.SNS_ADD_TYPE_BOTH),(r=new oi("addFriend")).setMessage("to:".concat(t," source:").concat(n," type:").concat(a)),this._snsM.req({P:jn.ADD_FD,data:{fromAccount:this._snsM.getMyUserID(),addFriendItem:[{to:t,source:n,wording:o,remark:s,groupName:e}],type:a}}).then((function(e){e=e.data.resultList;var t=(r.setMoreMessage("resultList:".concat(JSON.stringify(e))).end(),e=e[0]).to,n=e.resultCode;return e=e.resultInfo,be.i("".concat(u," ok. to:").concat(t," type:").concat(a," code:").concat(n)),lt(n)||0===n?Cn({userID:t,code:0}):30539===n?Cn({userID:t,code:n,message:c._snsM.getErrMsg(n)}):En({userID:t,code:n,message:c._snsM.getErrMsg(n)||e})})).catch((function(e){return r.setError(e).end(),be.w("".concat(u," failed. error:"),e),En(e)})))}},{key:"deleteFriend",value:function(e){var t,n=this,i="".concat(this._n,".").concat("deleteFriend"),o=e.userIDList,s=(e=e.type,1e3<o.length&&(be.w("".concat(i," ").concat(jt(1e3))),o.length=1e3),[]),a=[],r=[];return o.forEach((function(e){n._map.has(e)?r.push(e):s.push({userID:e,code:qn.NOT_MY_FRIEND,message:n._snsM.getErrMsg(qn.NOT_MY_FRIEND)})})),0===r.length?Sn({successUserIDList:a,failureUserIDList:s}):((o=e)&&(o===E.SNS_DELETE_TYPE_SINGLE||o===E.SNS_DELETE_TYPE_BOTH)||(o=E.SNS_DELETE_TYPE_BOTH),(t=new oi("deleteFriend")).setMessage("userIDList:".concat(r," type:").concat(o)),this._snsM.req({P:jn.DEL_FD,data:{fromAccount:this._snsM.getMyUserID(),userIDList:r,type:o}}).then((function(e){return t.end(),be.i("".concat(i," ok")),qe(e=e.data.resultList)||e.forEach((function(e){var t=e.to,n=e.resultCode;e=e.resultInfo,lt(n)||0===n?a.push({userID:t}):s.push({userID:t,code:n,message:e})})),Cn({successUserIDList:a,failureUserIDList:s})})).catch((function(e){return t.setError(e).end(),be.w("".concat(i," error:"),e),En(e)})))}},{key:"updateFriend",value:function(e){var t,n,i,o=this,s=e.userID,a=e.remark,r=e.friendCustomField;return this._map.has(s)?(t="".concat(this._n,".").concat("updateFriend"),(n=new oi("updateFriend")).setMessage("userID:".concat(s," remark:").concat(a," friendCustomField:").concat(r)),i=[],lt(a)||i.push({tag:Pe.REMARK,value:a}),Ye(r)&&0<r.length&&r.forEach((function(e){i.push({tag:e.key,value:e.value})})),this._snsM.req({P:jn.UPDATE_FD,data:{fromAccount:this._snsM.getMyUserID(),updateItem:[{to:s,snsItem:i}]}}).then((function(e){n.end(),be.i("".concat(t," ok"));var i=(e=e.data.resultList[0]).to,s=e.resultCode;return e=e.resultInfo,lt(s)||0===s?((i=o._map.get(i))&&(lt(a)||(i.remark=a),Ye(r)&&0<r.length&&_t(i.friendCustomField,r),o._onFriendListUpdated()),Cn(i)):En({code:s,message:e})})).catch((function(e){return n.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))):En({code:qn.NOT_MY_FRIEND})}},{key:"checkFriend",value:function(e){var t="".concat(this._n,".").concat("checkFriend"),n=e.userIDList,i=e.type,o=(i&&(i===E.SNS_CHECK_TYPE_SINGLE||i===E.SNS_CHECK_TYPE_BOTH)||(i=E.SNS_CHECK_TYPE_BOTH),new oi("checkFriend"));return o.setMessage("userIDList:".concat(n," type:").concat(i)),this._snsM.req({P:jn.CHECK_FD,data:{fromAccount:this._snsM.getMyUserID(),userIDList:n,type:i}}).then((function(e){o.end(),be.i("".concat(t," ok. userIDList:").concat(n," type:").concat(i));var s=[],a=[];return Ye(e=e.data.resultList)&&e.forEach((function(e){var t=e.to,n=e.relation,i=e.resultCode;e=e.resultInfo,lt(i)||0===i?s.push({userID:t,code:0,relation:n}):a.push({userID:t,code:i,message:e})})),Cn({successUserIDList:s,failureUserIDList:a})})).catch((function(e){return o.setError(e).end(),be.w("".concat(t," failed. error:"),e),En(e)}))}},{key:"onAddedToFriendGroup",value:function(e){var t=this,n=e.name;e=e.userIDList,be.l("".concat(this._n,".onAddedToFriendGroup groupName:").concat(n," userIDList:").concat(e)),n&&!qe(e)&&e.forEach((function(e){t._map.has(e)&&t._map.get(e).addToGroupList(n)}))}},{key:"onRemovedFromFriendGroup",value:function(e){var t=this,n=e.name;e=e.userIDList,be.l("".concat(this._n,".onRemovedFromFriendGroup groupName:").concat(n," userIDList:").concat(e)),n&&!qe(e)&&e.forEach((function(e){t._map.has(e)&&t._map.get(e).removeFromGroupList(n)}))}},{key:"reset",value:function(){this._map.clear(),this._startIdx=0,this._standardSeq=0,this._customSeq=0}}]),Ys=s((function e(t){i(this,e),qe(t)||(this.name=t.name||"",this.userIDList=t.userIDList||[],this.count=this.userIDList.length||0)}),[{key:"addToUserIDList",value:function(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}},{key:"removeFromUserIDList",value:function(e){-1<(e=this.userIDList.indexOf(e))&&(this.userIDList.splice(e,1),this.count=this.userIDList.length)}}]),$s=s((function e(t){i(this,e),this._snsM=t,this._n="FriendGroupHandler",this._map=new Map}),[{key:"updateCacheOnReconnected",value:function(){this.getGroupList()}},{key:"getLocalGroupList",value:function(){return v(this._map.values())}},{key:"_onGroupListUpdated",value:function(){var e=v(this._map.values());this._snsM.emitOEvt(S.FRIEND_GROUP_LIST_UPDATED,e)}},{key:"getGroupList",value:function(){var e=this,t="".concat(this._n,".").concat("getGroupList"),n=new oi("getGroupList");return this._snsM.req({P:jn.GET_FD_GRP_LIST,data:{fromAccount:this._snsM.getMyUserID()}}).then((function(i){n.end(),qe(i=i.data.resultList)?be.i("".concat(t," ok. count:0")):(be.i("".concat(t," ok. count:").concat(i.length)),e._map.clear(),i.forEach((function(t){var n=new Ys(t);e._map.set(t.name,n)})),e._onGroupListUpdated())})).catch((function(e){return n.setError(e).end(),be.w("".concat(t," error:"),e),En(e)}))}},{key:"createGroup",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("createGroup"),s=e.name;return e=e.userIDList,this._map.has(s)?En({code:qn.FRIEND_GRP_EXISTED}):(t="name:".concat(s," userIDList:").concat(e),(n=new oi("createGroup")).setMessage(t),this._snsM.req({P:jn.CREATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),groupName:[s],userIDList:Ye(e)?e:void 0}}).then((function(e){n.end(),be.l("".concat(o," ok. ").concat(t)),e=e.data.resultList;var a=[],r=[];return e&&e.forEach((function(e){var t=e.to,n=e.resultCode,i=e.resultInfo;lt(n)||0===n?a.push(t):(t={userID:e.to,code:n,message:i},r.push(t))})),e=new Ys({name:s,userIDList:a}),i._map.set(s,e),i._snsM.onAddedToFriendGroup({name:s,userIDList:a}),i._onGroupListUpdated(),Cn({friendGroup:e,failureUserIDList:r})})).catch((function(e){return n.setError(e).end(),be.w("".concat(o," failed. error:"),e),En(e)})))}},{key:"deleteGroup",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("deleteGroup"),s=e.name;return this._map.has(s)?(t="name:".concat(s),(n=new oi("deleteGroup")).setMessage(t),this._snsM.req({P:jn.DEL_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),nameList:[s]}}).then((function(e){n.end(),be.l("".concat(o," ok. ").concat(t));var a=i._map.get(s);return a&&(i._snsM.onRemovedFromFriendGroup({name:s,userIDList:a.userIDList}),i._map.delete(s),a.userIDList.length=0),i._onGroupListUpdated(),Cn(a)})).catch((function(e){return n.setError(e).end(),be.w("".concat(o," failed. error:"),e),En(e)}))):this._onGroupNotExist()}},{key:"renameGroup",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("renameGroup"),s=e.oldName,a=e.newName;return this._map.has(s)?(t="oldName:".concat(s," newName:").concat(a),(n=new oi("renameGroup")).setMessage(t),this._snsM.req({P:jn.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,newName:a}}).then((function(){var e;return n.end(),be.l("".concat(o," ok. ").concat(t)),i._map.has(s)?((e=i._map.get(s)).name=a,i._map.delete(s),i._map.set(a,e),i._snsM.onRemovedFromFriendGroup({name:s,userIDList:e.userIDList}),i._snsM.onAddedToFriendGroup({name:a,userIDList:e.userIDList}),i._onGroupListUpdated(),Cn(e)):Cn()})).catch((function(e){return n.setError(e).end(),be.w("".concat(o," failed. error:"),e),En(e)}))):this._onGroupNotExist()}},{key:"addToGroup",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("addToGroup"),s=e.name;return e=e.userIDList,this._map.has(s)?(t="name:".concat(s," userIDList:").concat(e),(n=new oi("addToGroup")).setMessage(t),this._snsM.req({P:jn.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:e.filter((function(e){return i._snsM.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Add"}}))}}).then((function(e){return n.end(),be.l("".concat(o," ok. ").concat(t)),i._onGroupUpdated(s,e)})).catch((function(e){return n.setError(e).end(),be.w("".concat(o," failed. error:"),e),En(e)}))):this._onGroupNotExist()}},{key:"removeFromGroup",value:function(e){var t,n,i=this,o="".concat(this._n,".").concat("removeFromGroup"),s=e.name;return e=e.userIDList,this._map.has(s)?(t="name:".concat(s," userIDList:").concat(e),(n=new oi("removeFromGroup")).setMessage(t),this._snsM.req({P:jn.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:e.filter((function(e){return i._snsM.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Delete"}}))}}).then((function(e){return n.end(),be.l("".concat(o," ok. ").concat(t)),i._onGroupUpdated(s,e)})).catch((function(e){return n.setError(e).end(),be.w("".concat(o," failed. error:"),e),En(e)}))):this._onGroupNotExist()}},{key:"_onGroupUpdated",value:function(e,t){t=t.data.resultList;var n=this._map.get(e),i=[],o=[],s=[];return Ye(t)&&t.forEach((function(e){var t=e.to,a=e.resultCode,r=e.resultInfo,c=e.type;0===a?"Update_Type_Add"===c?n&&(n.addToUserIDList(t),o.push(t)):"Update_Type_Delete"===c&&n&&(n.removeFromUserIDList(t),s.push(t)):i.push({to:e.to,code:a,message:r})})),be.l("".concat(this._n,"._onGroupUpdated name:").concat(e," userIDList:").concat(n.userIDList)),0<o.length&&this._snsM.onAddedToFriendGroup({name:e,userIDList:o}),0<s.length&&this._snsM.onRemovedFromFriendGroup({name:e,userIDList:s}),Cn({friendGroup:n,failureUserIDList:i})}},{key:"updateWhenFriendAdded",value:function(e){var t=this,n=e.nameList,i=e.userID;be.l("".concat(this._n,".updateWhenFriendAdded userID:").concat(i," nameList:").concat(n)),qe(n)||n.forEach((function(e){t._map.has(e)&&t._map.get(e).addToUserIDList(i)}))}},{key:"updateWhenFriendDeleted",value:function(e){var t=this,n=e.nameList,i=e.userID;be.l("".concat(this._n,".updateWhenFriendDeleted userID:").concat(i," nameList:").concat(n)),qe(n)||n.forEach((function(e){t._map.has(e)&&t._map.get(e).removeFromUserIDList(i)}))}},{key:"_onGroupNotExist",value:function(e){return En({code:qn.FRIEND_GRP_NOT_EXIST})}},{key:"reset",value:function(){this._map.clear()}}]),Js=(u(Sa,wn),s(Sa,[{key:"onContextUpdated",value:function(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getGroupList(),this._friendApplicationHandler.getApplicationList()}},{key:"onRelationChainModified",value:function(e){var t,n,i,o,s,a,r=this;qe(e=e.dataList)||(t=[],n=[],i=[],s=!(o=[]),a="",e.forEach((function(e){var c;3!==e.pushType&&4!==e.pushType||!e.from||(a=e.from),e.friendAddAccount&&(t.push.apply(t,v(e.friendAddAccount)),o.push.apply(o,v(e.friendAddAccount))),e.friendDelAccount&&n.push.apply(n,v(e.friendDelAccount)),e.friendApplicationAdded&&i.push.apply(i,v(e.friendApplicationAdded)),e.friendApplicationDeletedUserIDList&&o.push.apply(o,v(e.friendApplicationDeletedUserIDList)),e.reportTime&&7===e.pushType&&(s=!0),e.friendUpInfo&&(c={dataList:[]},e.friendUpInfo.forEach((function(e){c.dataList.push({userID:e.friendAccount,profileList:v(e.sns)})})),r.onFriendProfileModified(c))})),s&&this._friendApplicationHandler.onApplicationRead(),this._friendApplicationHandler.onApplicationAdded(i,a),this._friendApplicationHandler.onApplicationDeleted(o),this._friendHandler.onFriendAdded(t),this._friendHandler.onFriendDeleted(n))}},{key:"isMyFriend",value:function(e){return this._friendHandler.isMyFriend(e)}},{key:"filterProfanity",value:function(e,t){var n,i=this.get(29);return!i||(n=(i=i.filterText(t[e],"sns")).isAllowedToSend,i=i.modifiedText,!0===n&&(t[e]=i,!0))}},{key:"onFriendProfileModified",value:function(e){this._friendHandler.onFriendProfileModified(e)}},{key:"getLocalFriendList",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=this._friendHandler.getLocalFriendList();return e?Sn(t):t}},{key:"getFriendRemark",value:function(e){return this._friendHandler.getFriendRemark(e)}},{key:"getFriendList",value:function(){return this._friendHandler.pagingGetFriendList()}},{key:"addFriend",value:function(e){return this._friendHandler.addFriend(e)}},{key:"deleteFriend",value:function(e){return this._friendHandler.deleteFriend(e)}},{key:"checkFriend",value:function(e){return this._friendHandler.checkFriend(e)}},{key:"getFriendProfile",value:function(e){return this._friendHandler.getFriendProfile(e)}},{key:"updateFriend",value:function(e){return this._friendHandler.updateFriend(e)}},{key:"onAddedToFriendGroup",value:function(e){this._friendHandler.onAddedToFriendGroup(e)}},{key:"onRemovedFromFriendGroup",value:function(e){this._friendHandler.onRemovedFromFriendGroup(e)}},{key:"getLocalFriendApplicationList",value:function(){return Sn(this._friendApplicationHandler.getLocalApplicationList())}},{key:"deleteFriendApplication",value:function(e){return this._friendApplicationHandler.deleteApplication(e)}},{key:"refuseFriendApplication",value:function(e){return this._friendApplicationHandler.refuseApplication(e)}},{key:"acceptFriendApplication",value:function(e){return this._friendApplicationHandler.acceptApplication(e)}},{key:"setFriendApplicationRead",value:function(e){return this._friendApplicationHandler.setApplicationRead(e)}},{key:"getLocalFriendGroupList",value:function(){return Sn(this._friendGroupHandler.getLocalGroupList())}},{key:"createFriendGroup",value:function(e){return this._friendGroupHandler.createGroup(e)}},{key:"deleteFriendGroup",value:function(e){return this._friendGroupHandler.deleteGroup(e)}},{key:"addToFriendGroup",value:function(e){return this._friendGroupHandler.addToGroup(e)}},{key:"removeFromFriendGroup",value:function(e){return this._friendGroupHandler.removeFromGroup(e)}},{key:"renameFriendGroup",value:function(e){return this._friendGroupHandler.renameGroup(e)}},{key:"updateWhenFriendAdded",value:function(e){this._friendGroupHandler.updateWhenFriendAdded(e)}},{key:"updateWhenFriendDeleted",value:function(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}},{key:"updateCacheOnReconnected",value:function(){be.l("".concat(this._n,".updateCacheOnReconnected")),this._friendHandler.updateCacheOnReconnected(),this._friendGroupHandler.updateCacheOnReconnected(),this._friendApplicationHandler.updateCacheOnReconnected()}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}])),Xs=(u(Ca,wn),s(Ca,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&he}},{key:"startWorkerTimer",value:function(){be.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){be.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){var e,t;he&&(e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"})),this._workerTimer=new Worker(e),(t=this)._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,be.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()})}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("enable_worker");be.l("".concat(this._n,"._onCloudConfig enableWorker:").concat(e)),lt(e)||"1"===e?!this._isWorkerEnabled&&he&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&he&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){be.l("".concat(this._n,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null,this._timerID=-1)}},{key:"getTimerID",value:function(){return this._timerID}},{key:"reset",value:function(){be.l("".concat(this._n,".reset"))}}])),Qs=s((function e(t){i(this,e),this._commercialConfigM=t,this._n="PurchasedFeatureHandler",this._isCSPluginReported=!1,this._featureMap=new Map}),[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&1<=e.length&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._featureMap.clear();for(var t,n=e.length-1,i=0;0<=n;n--,i++)t=(i<32?new D(0,Math.pow(2,i)):new D(Math.pow(2,i-32),0)).toString(),"1"===e[n]?this._featureMap.set(t,!0):this._featureMap.set(t,!1)}else be.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._featureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,i=!0,o=t.length-1,s=0;0<=o;o--,s++)if("1"===t.charAt(o)&&(n=(s<32?new D(0,Math.pow(2,s)):new D(Math.pow(2,s-32),0)).toString(),!this._featureMap.get(n))){i=!1;break}return be.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," key:").concat(n," ret:").concat(i)),Sn({enabled:i})}},{key:"isFeatureEnabledForStat",value:function(e){for(var t=parseInt(e).toString(2),n=t.length-1,i=0;0<=n;n--,i++)if("1"===t.charAt(n)){if(o=(i<32?new D(0,Math.pow(2,i)):new D(Math.pow(2,i-32),0)).toString(),!this._featureMap.get(o))break;var o,s="",a=0;o===N.PLUGIN_TRANSLATE?(s="plugin_translate",a=16):o===N.PLUGIN_VOICE_TO_TEXT?(s="plugin_voice_to_text",a=17):o===N.PLUGIN_CS?(s="plugin_cs",a=14):o===N.PLUGIN_PUSH?(s="plugin_push",a=13):o===N.PLUGIN_BOT?(s="plugin_bot",a=15):o===N.MSG_REACTION&&(s="plugin_emoji_reaction",a=18),""!==s&&(o=this._commercialConfigM.get(12).getUIPlatform(),new oi(s).setCode(a).setUIPlatform(o).end(),be.l("".concat(this._n,".isFeatureEnabledForStat ").concat(s," code:").concat(a," uiPlatform:").concat(o)))}}},{key:"isCSPluginEnabled",value:function(){var e;this._isCSPluginReported||(e=this._commercialConfigM.get(12).getUIPlatform(),new oi("plugin_search").setCode(6).setUIPlatform(e).end(),this._isCSPluginReported=!0)}},{key:"clear",value:function(){this._featureMap.clear(),this._isCSPluginReported=!1}}]),Zs=s((function e(t){i(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Qs(this)}),[{key:"_canFetch",value:function(){return this.get(12).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e,t,n=this,i=this._canFetch(),o="".concat(this._n,".fetchConfig");be.l("".concat(o," canFetch:").concat(i)),i&&(e=new oi("fetchCommercialConfig"),i=this.get(12).getSDKAppID(),t=this.get(20),this._isFetching=!0,t.req({P:jn.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:i}}).then((function(t){e.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),be.l("".concat(o," ok.")),n._parseConfig(t.data),n._isFetching=!1})).catch((function(t){e.setError(t).end(),n._isFetching=!1})))}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));be.l("".concat(t)),new oi("pushedCommercialConfig").setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,i=e.errorMessage,o=e.purchaseBits,s=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(o),this._expiredTime=Date.now()+1e3*s):lt(n)?(be.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(be.e("".concat(t," errorCode:").concat(n," errorMessage:").concat(i)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"canIUse",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"isFeatureEnabled",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:"isFeatureEnabledForStat",value:function(e){this._purchasedFeatureHandler.isFeatureEnabledForStat(e)}},{key:"isCSPluginEnabled",value:function(){this._purchasedFeatureHandler.isCSPluginEnabled()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),ea=(u(Ma,wn),s(Ma,[{key:"registerPlugin",value:function(e){var t,n,i,o,s,a,r,c,u,l,d,p,h;$?(this._offlinePushPlugin=e["tim-offline-push-plugin"],t=(h=e.offlinePushConfig||{}).huaweiBusinessID,n=h.xiaomiBusinessID,i=h.xiaomiAppID,o=h.xiaomiAppKey,s=h.meizuBusinessID,a=h.meizuAppID,r=h.meizuAppKey,c=h.vivoBusinessID,u=h.oppoBusinessID,l=h.oppoAppKey,d=h.oppoAppSecret,p=h.honorBusinessID,h=h.iosBusinessID,this._androidPushConfig.huaweiPushBussinessId=t,this._androidPushConfig.xiaomiPushBussinessId=n,this._androidPushConfig.xiaomiPushAppId=i,this._androidPushConfig.xiaomiPushAppKey=o,this._androidPushConfig.meizuPushBussinessId=s,this._androidPushConfig.meizuPushAppId=a,this._androidPushConfig.meizuPushAppKey=r,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=u,this._androidPushConfig.oppoPushAppKey=l,this._androidPushConfig.oppoPushAppSecret=d,this._androidPushConfig.honorPushBussinessId=p,new oi("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!lt(this._offlinePushPlugin))).end(!0),be.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=h,this._setAppShowListener()):this.warn("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e,t=this,n="".concat(this._n,".").concat("_getDeviceToken");Je(this._offlinePushPlugin.getDeviceToken)?(e="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID),be.l("".concat(n," start. ").concat(e)),new oi("_getDeviceToken").setMessage("".concat(e)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(i){var o,s,a,r,c=new oi("getDeviceTokenRes"),u=i.code,l=i.msg;0===u?(o=(r=i.data).deviceToken,s=r.deviceBrand,a=r.deviceType,r=r.bussinessId,t._deviceToken=o,t._businessID=r||t._iosBusinessID,e="deviceToken:".concat(o,", deviceBrand:").concat(s||a,", businessID:").concat(t._businessID),be.l("".concat(n," ok. ").concat(e)),c.setMessage(e).end(!0),t._setToken()):(c.setMessage("code:".concat(u,", msg:").concat(l)).end(!0),be.e("".concat(n," failed. error:"),i))}))):be.e("".concat(n," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return $&&!lt(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");lt(this._offlinePushPlugin)?be.e("".concat(t," offlinePushPlugin is undefined")):Je(this._offlinePushPlugin.setAppShowListener)?(new oi("_setAppShowListener").end(!0),be.l("".concat(t," start")),this._offlinePushPlugin.setAppShowListener((function(n){n=(n||{}).appShow,new oi("setAppShowListenerRes").setMessage("appShow:".concat(n)).end(!0),be.l("".concat(t," ok. appShow:").concat(n)),e._m.isReady()&&(0===n?(e._getConvUnreadCount(),e._onBackground()):1===n&&e._onForeground())}))):be.e("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!lt(this._offlinePushPlugin)&&Je(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType,be.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var e="".concat(this._n,"._setToken"),t=this.get(12),n=1,i="",o="",s=(qe(this._deviceToken)&&(n=0),this.getUniAppPlatform()),a=this.getDeviceBrand(),r=(s===O.IOS||s===O.IPAD||s===O.MAC?o=this._deviceToken:s===O.ANDROID&&(i=this._deviceToken),new oi("offlinePushSetToken"));return s="deviceToken:".concat(o||i,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(a,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(n,", platform:").concat(s),r.setMessage("".concat(s)),be.l("".concat(e," ").concat(s)),this.req({P:jn.SET_TOKEN,data:{tokenID:i,pushMsg:n,sdkAppID:t.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:a,deviceToken:o,isWebUniapp:this._isWebUniapp}}).then((function(t){return r.end(),be.l("".concat(e," ok")),t})).catch((function(t){return r.setError(t).end(),be.e("".concat(e," failed. error:"),t),En(t)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach((function(t){t.type===E.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===E.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new oi("_onBackground");this.req({P:jn.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(i){return n.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),be.l("".concat(t," ok")),i})).catch((function(e){n.setError(e).end(),be.e("".concat(t," failed. error:"),e)}))}},{key:"_onForeground",value:function(){var e="".concat(this._n,".").concat("_onForeground"),t=new oi("_onForeground");this.req({P:jn.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then((function(n){return t.end(),be.l("".concat(e," ok")),n})).catch((function(n){t.setError(n).end(),be.e("".concat(e," failed. error:"),n)}))}},{key:"getUniAppPlatform",value:function(){var e=Nn.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?O.IOS:"android"===e?O.ANDROID:1002===t?O.IPAD:1001===t?O.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,be.l("".concat(this._n,".reset"))}}])),ta=(u(Ia,wn),s(Ia,[{key:"registerPlugin",value:function(e){var t,n,i;$?(t="".concat(this._n,".").concat("registerPlugin"),this._pushPlugin=e["tim-push"],this._getDeviceInfo(),n=(i=e.pushConfig||{}).androidConfig,i=i.iOSConfig,ze(n)&&(this._androidPushConfig=n[this._deviceInfo.packageName]),n=(i||{}).iOSBusinessID,this._iOSBusinessID=n,i=!lt(this._pushPlugin),new oi("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:".concat(i)).end(!0),be.l("".concat(t," ok. pushConfig:").concat(JSON.stringify(e.pushConfig))),i?(this._setAppShowListener(),this._setPushEventReportListener()):be.e("".concat(t," ").concat(this._pluginName," is undefined"))):this.warn("TIMPushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._reportEventCacheList(),this._getDeviceToken(),this.get(27).isFeatureEnabledForStat(Math.pow(2,41))}},{key:"_reportEventCacheList",value:function(){var e=this,t="".concat(this._n,".").concat("_reportEventCacheList");Je(this._pushPlugin.getPushEventCacheList)?(new oi("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList((function(n){var i=n.code,o=n.data.eventList,s=new oi("getPushEventCacheListRes");if(s.setCode(i),0!==i)s.setMessage("res:".concat(JSON.stringify(n))).end(!0),be.e("".concat(t," failed. error:").concat(JSON.stringify(n)));else{i=o.length<10?"eventList:".concat(JSON.stringify(o)):"eventList.length:".concat(o.length),be.l("".concat(t," ok. ").concat(i)),s.setMessage(i).end(!0);for(var a=g(g({},n.data),{},{eventList:[]});0<o.length;)a.eventList=o.splice(0,40),e._pushReport(a)}}))):be.e("".concat(this._pluginName,".getPushEventCacheList is not a function"))}},{key:"_getDeviceToken",value:function(){var e,t=this,n="".concat(this._n,".").concat("_getDeviceToken");Je(this._pushPlugin.getDeviceToken)?(e="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig)," iOSBusinessID:").concat(this._iOSBusinessID),be.l("".concat(n," start. ").concat(e)),new oi("_getDeviceToken").setMessage("".concat(e)).end(!0),this._pushPlugin.getDeviceToken(this._androidPushConfig,(function(i){var o,s,a,r=i.code,c=i.msg,u=new oi("getDeviceTokenRes");u.setCode(r),0===r?(o=(r=i.data).deviceToken,s=r.deviceBrand,a=r.deviceType,r=r.bussinessId,t._deviceToken=o,t._businessID=r||t._iOSBusinessID,e="deviceToken:".concat(o," deviceBrand:").concat(s||a," businessID:").concat(t._businessID),be.l("".concat(n," ok. ").concat(e)),u.setMessage(e).end(!0),t._setToken()):(u.setMessage(c).end(!0),be.e("".concat(n," failed. error:").concat(JSON.stringify(i))))}))):be.e("".concat(this._pluginName,".getDeviceToken is not a function"))}},{key:"_getDeviceInfo",value:function(){var e,t,n,i,o="".concat(this._n,".").concat("_getDeviceInfo");Je(this._pushPlugin.getDeviceInfo)?(i=(e=this._pushPlugin.getDeviceInfo()).code,t=e.data,(n=new oi("_getDeviceInfo")).setCode(i),0===i?(this._deviceInfo=g(g({},this._deviceInfo),t),this._deviceInfo.pushVersion||(this._deviceInfo.pushVersion="1.0.1"),i="deviceInfo:".concat(JSON.stringify(this._deviceInfo)),be.l("".concat(o," ok. ").concat(i)),n.setMessage(i).end(!0)):(n.setMessage("deviceInfoRes:".concat(JSON.stringify(e))).end(!0),be.e("".concat(o," failed. error:").concat(JSON.stringify(e))))):be.e("".concat(this._pluginName,".getDeviceInfo is not a function"))}},{key:"canIUseTIMPush",value:function(){return $&&!lt(this._pushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");Je(this._pushPlugin.setAppShowListener)?(new oi("_setAppShowListener").end(!0),be.l("".concat(t," start")),this._pushPlugin.setAppShowListener((function(n){n=(n||{}).appShow,new oi("setAppShowListenerRes").setMessage("appShow:".concat(n)).end(!0),be.l("".concat(t," ok. appShow:").concat(n)),e._m.isReady()&&(0===n?(e._getConvUnreadCount(),e._onBackground()):1===n&&e._onForeground())}))):be.e("".concat(this._pluginName,".setAppShowListener is not a function"))}},{key:"_setPushEventReportListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setPushEventReportListener");Je(this._pushPlugin.setPushEventReportListener)?(new oi("_setPushEventReportListener").end(!0),this._pushPlugin.setPushEventReportListener((function(n){var i=n.code,o=n.data,s=o.eventList,a=new oi("setPushEventReportListenerRes");a.setCode(i),0===i?(i="eventList:".concat(JSON.stringify(s)),be.l("".concat(t," ok. ").concat(i)),a.setMessage(i).end(!0),e._m.isReady()&&Ye(s)&&0<s.length&&e._pushReport(o)):(a.setMessage("res:".concat(JSON.stringify(n))).end(!0),be.e("".concat(t," failed. error:").concat(JSON.stringify(n))))}))):be.e("".concat(this._pluginName,".setPushEventReportListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!lt(this._pushPlugin)&&Je(this._pushPlugin.getDeviceType))return e=(this._pushPlugin.getDeviceType()||{}).deviceType,be.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var e="".concat(this._n,".").concat("_setToken"),t=this.get(12),n=1,i="",o="",s=(qe(this._deviceToken)&&(n=0),this.getUniAppPlatform()),a=this.getDeviceBrand(),r=(s===O.IOS||s===O.IPAD||s===O.MAC?o=this._deviceToken:s===O.ANDROID&&(i=this._deviceToken),s=g({tokenID:i,pushMsg:n,sdkAppID:t.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:a,deviceToken:o,isWebUniapp:this._isWebUniapp},this._deviceInfo),new oi("_setToken"));i="data:".concat(JSON.stringify(s)),r.setMessage("".concat(i)),be.l("".concat(e," ").concat(i)),this.req({P:jn.SET_TOKEN,data:s}).then((function(){r.end(),be.w("".concat(e," ok"))})).catch((function(t){r.setError(t).end(),be.e("".concat(e," failed. error:"),t),En(t)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach((function(t){t.type===E.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===E.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new oi("_onBackground");this.req({P:jn.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(){n.setMessage("c2cUnreadCount:".concat(e._c2cUnreadCount," groupUnreadCount:").concat(e._groupUnreadCount)).end(),be.l("".concat(t," ok"))})).catch((function(e){n.setError(e).end(),be.e("".concat(t," failed. error:"),e)}))}},{key:"_onForeground",value:function(){var e="".concat(this._n,".").concat("_onForeground"),t=new oi("_onForeground");this.req({P:jn.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then((function(){t.end(),be.l("".concat(e," ok"))})).catch((function(n){t.setError(n).end(),be.e("".concat(e," failed. error:"),n)}))}},{key:"_pushReport",value:function(e){var t=this,n="".concat(this._n,".").concat("_pushReport"),i=new oi("_pushReport");this.req({P:jn.PUSH_REPORT,data:{eventList:e.eventList}}).then((function(){i.end(),t._notifyReportSuccess(e)})).catch((function(e){i.setError(e).end(),be.e("".concat(n," failed. error:"),e)}))}},{key:"_notifyReportSuccess",value:function(e){!lt(this._pushPlugin)&&Je(this._pushPlugin.notifyReportSuccess)&&(this._pushPlugin.notifyReportSuccess(e),be.l("".concat(this._n,"._notifyReportSuccess ok")))}},{key:"getUniAppPlatform",value:function(){var e=Nn.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?O.IOS:"android"===e?O.ANDROID:1002===t?O.IPAD:1001===t?O.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,be.l("".concat(this._n,".reset"))}}])),na=(u(ya,wn),s(ya,[{key:"init",value:function(){var e=this.get(18).getPlugin("tim-profanity-filter-plugin");e&&(this._plugin=new e({logger:be,isArray:Ye,isMap:Ve,isDevMode:this.isDevMode()}),this._getLexicon())}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(this._plugin&&this._canIUseLexicon&&(!t||!t.messageControlInfo||!0!==t.messageControlInfo.excludedFromContentModeration)){t=e.type;var i=e.conversationType;if(t===E.MSG_TEXT||t===E.MSG_CUSTOM){var o,s="".concat(this._n,".filterMessage");if(be.l("".concat(s)),t===E.MSG_TEXT){if(i===E.CONV_C2C?o="c2c_text_message":i===E.CONV_GROUP&&(o="group_text_message"),!this._isConfigOn(o))return n;var a=(r=this._plugin.filter(e.payload.text)).type,r=r.modifiedText;1===a?n=!1:2===a&&(e.payload.text=r)}else if(t===E.MSG_CUSTOM){if(i===E.CONV_C2C?o="c2c_custom_message":i===E.CONV_GROUP&&(o="group_custom_message"),!this._isConfigOn(o))return n;a=this._plugin.filter(e.payload.data),r=this._plugin.filter(e.payload.description),t=this._plugin.filter(e.payload.extension),1===a.type||1===r.type||1===t.type?n=!1:(2===a.type&&(e.payload.data=a.modifiedText),2===r.type&&(e.payload.description=r.modifiedText),2===t.type&&(e.payload.extension=t.modifiedText))}be.l("".concat(s," done. isAllowedToSend:").concat(n))}}return n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),i={isAllowedToSend:!0,modifiedText:e};return this._plugin&&this._canIUseLexicon&&this._isConfigOn(t)&&(be.l("".concat(n)),e=(t=this._plugin.filter(e)).type,t=t.modifiedText,1===e?i.isAllowedToSend=!1:2===e&&(i.modifiedText=t),be.l("".concat(n," done. ret:"),i)),i}},{key:"_getLexicon",value:function(){var e=this,t=new oi("profanityFilter"),n="".concat(this._n,"._getLexicon");this._isFetching=!0,this.req({P:jn.GET_PROFANITY_LIST,data:{startIndex:this._startIndex,version:this._version}}).then((function(i){var o=(i=i.data).errorInfo,s=i.filterConfig,a=i.lexicon,r=i.strToken,c=i.completeFlag,u=i.nextStartIndex,l=i.version,d=(i=i.expiredTime,o.errorCode),p=o.errorMessage;return 0!==d?(e._isFetching=!1,be.w("".concat(n," failed. error:"),o),void t.setCode(d).setMessage(p).end()):(e._onFilterConfig(s),e._getToken(r),1===c?(be.l("".concat(n," done. version:").concat(l," expiredTime:").concat(i)),e._version=l,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*i,void e._plugin.onLexiconCompleted(a)):(e._startIndex=u,e._plugin.onLexiconSliced(a),void e._getLexicon()))})).catch((function(i){t.setError(i).end(),e._isFetching=!1,be.l("".concat(n," failed. error:"),i)}))}},{key:"_onFilterConfig",value:function(e){var t=this;qe(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(n){t._filterConfigMap.set(n,e[n])})),be.l("".concat(this._n,"._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys())," values:").concat(Array.from(this._filterConfigMap.values()))))}},{key:"_isConfigOn",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:"_getToken",value:function(e){if(ut(e)){var t=e.length,n="";if(t%2==0)for(var i=0;i<=t-1;i+=2)n=(n+=e[i+1])+e[i];else{for(var o=0;o<t-1;o+=2)n=(n+=e[o+1])+e[o];n+=e[t-1]}this._plugin.onToken(n)}}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._plugin&&(this._plugin.reset(),this._plugin=null),this._filterConfigMap.clear(),this._startIndex=0,this._version=0,this._canIUseLexicon=!1,this._isFetching=!1,this._expiredTime=0}}])),ia=s((function e(t){i(this,e),this._m=t,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*","live_engine_srv.*","live_engine_http_srv.*","live_engine_pk.*","trtc_ai_service.*","call_engine_srv.*"],this._TRTCCommandMap=new Map,this._setTRTCCommandMap(),this._m.getIEmitInst().on(Ni.CLOUD_CONFIG,this._onCloudConfig,this)}),[{key:"_onCloudConfig",value:function(){var e=this,t=this._m.get(23).getCloudConfig("rtc_cmd");lt(t)||((t=JSON.parse(t)).forEach((function(t){e._TRTCCommandList.includes(t)||e._TRTCCommandList.push(t)})),this._setTRTCCommandMap())}},{key:"_setTRTCCommandMap",value:function(){for(var e,t=0,n=this._TRTCCommandList.length;t<n;t++)e=this._TRTCCommandList[t].split(".")[0],this._TRTCCommandMap.set(e,1)}},{key:"onRoomCustomDataReceived",value:function(e){this._m.getOEmitInst().emit(S.ROOM_CUSTOM_DATA_RECEIVED,e)}},{key:"sendTRTCCustomData",value:function(e){var t=e.serviceCommand,n=(e=e.data,"".concat(P.NAME.TUIROOM_SVR,".*"));return lt(t)||(n=t),this._isValidServiceCommand(n)?this._trans({servcmd:n,data:e}):En({code:qn.INVALID_TRTC_CMD})}},{key:"_trans",value:function(e){be.d("".concat(this._n,"._trans. options:").concat(JSON.stringify(e)));var t=e.servcmd;return e=e.data,this._m.get(20).trans({servcmd:t,data:ut(e)?JSON.parse(e):e})}},{key:"_isValidServiceCommand",value:function(e){return e.endsWith(".*")?this._TRTCCommandList.includes(e):(e=e.split(".")[0],this._TRTCCommandMap.has(e))}},{key:"isTRTCCommand",value:function(e){return e=e.split(".")[0],this._TRTCCommandMap.has(e)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset"))}}]),oa=s((function e(t){i(this,e),this._m=t,this._n="ErrMsgModule",this.TIM_ERROR_ASSISTANCE="tim_error_assistance",this.STORAGE_EXPIRES_TIME=6048e5,this.CURRENT_DOMAIN=x,this._map=new Map,this._init()}),[{key:"_init",value:function(){var e,t=this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE,!1);if(t){try{e=JSON.parse(t)}catch(n){this._getStorageModule().removeItem(this.TIM_ERROR_ASSISTANCE,!1),be.w("".concat(this._n,"._init error:"),n)}e&&(this._needToUpdate(e)?this._fetch():this._fillMap(e.message))}else this._fetch()}},{key:"_needToUpdate",value:function(e){var t=e.localSavedTime;return e=e.localSavedVersion,t=t&&(new Date).getTime()-t>=this.STORAGE_EXPIRES_TIME,e=!e||"3.5.5"!==e,be.l("".concat(this._n,"._needToUpdate isTimeout:").concat(t," isDifferentVersion:").concat(e)),t||e}},{key:"_fetch",value:function(){this._m.get(12).isPrivateNetWork()||this._fetchWithRetry()}},{key:"_fetchWithRetry",value:function(){var e=this;this._fetchAdapter().catch((function(){e.CURRENT_DOMAIN!==B&&(e._generateCurrentDomain(),e._fetchWithRetry())}))}},{key:"_generateCurrentDomain",value:function(){this.CURRENT_DOMAIN===x?this.CURRENT_DOMAIN=F:this.CURRENT_DOMAIN===F&&(this.CURRENT_DOMAIN=B)}},{key:"_fetchAdapter",value:function(){var e="https://".concat(this.CURRENT_DOMAIN,"/im/download/error-message/v3/0.0.7/tim-error-message.txt"),t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetchAdapter ok in"),i=this;return new Promise((function(o,s){var a,r;Q?ne.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){i._fillAndSave(e.data),be.l("".concat(n," mini program.")),o()},fail:function(e){s(e)}}):(a=new XMLHttpRequest,r=setTimeout((function(){a.abort()}),3e3),a.onreadystatechange=function(){4===a.readyState&&(r&&clearTimeout(r),200===a.status||304===a.status?(be.l("".concat(n," browser.")),i._fillAndSave(a.responseText),o()):s(a.status))},a.onerror=function(e){s(e)},a.open("GET",e,!0),a.setRequestHeader("Content-type",t),a.send())}))}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"3.5.5"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.get(13)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,i=e.split(";\n"),o=i.length,s=new RegExp(/'/g),a=0;a<o;a++)if(n=i[a].indexOf(":"),t=i[a].slice(0,n),n=i[a].slice(n+1,i[a].length),!t.startsWith("//")){if(lt(n))continue;this._map.set(t,n.replace(s,""))}}},{key:"get",value:function(e){var t=e.isIntl,n=e.key,i=e.replacement1;return e=e.replacement2,t="".concat(n,t?"_en":"_cn"),!this._map.has(t)&&this._map.has(n)&&(t=n),n="",this._map.has(t)&&(n=this._map.get(t),lt(i)||(n=n.replace("$replacement1",i)),lt(e)||(n=n.replace("$replacement2",e))),n}},{key:"reset",value:function(){be.l("".concat(this._n,".reset"))}}]),sa=s((function e(t){i(this,e),this._n="RemoteSignalingHandler",this._sigM=t}),[{key:"onNewMessageList",value:function(e){var t=this;e.forEach((function(e){var n=t.getPayloadData(e);n&&t._handleActionType(n,e)}))}},{key:"onMessageModified",value:function(e){var t=this;e.forEach((function(e){var n=t.getPayloadData(e);n&&t._onInvitationModified(n,e)}))}},{key:"getPayloadData",value:function(e){var t="".concat(this._n,".getPayloadData");e=e.payload.data;try{return JSON.parse(e)}catch(n){return be.e("".concat(t," JSON parse error. signalingData:").concat(e)),null}}},{key:"_handleActionType",value:function(e,t){switch(e.actionType){case T.ACTION_TYPE_INVITE:this._onNewInvitationReceived(e,t);break;case T.ACTION_TYPE_REJECT_INVITE:this._onInviteeRejected(e);break;case T.ACTION_TYPE_ACCEPT_INVITE:this._onInviteeAccepted(e);break;case T.ACTION_TYPE_CANCEL_INVITE:this._onInvitationCancelled(e);break;case T.ACTION_TYPE_INVITE_TIMEOUT:this._onInvitationTimeout(e)}}},{key:"_genBaseEmitData",value:function(e){return{inviteID:e.inviteID,inviter:e.inviter,groupID:e.groupID,data:e.data||""}}},{key:"_onNewInvitationReceived",value:function(e,t){var n="".concat(this._n,"._onNewInvitationReceived"),i=e.inviteID,o=e.inviteeList,s=e.groupID,a=e.inviter,r=this._sigM.getMyUserID(),c=o.includes(r),u=e.timeout,l=(Me().getTime()-1e3*t.time)/1e3;0<u&&0<l&&l<u&&(u-=l),n="".concat(n," myselfIncluded:").concat(c," groupID:").concat(s," signalObj:").concat(JSON.stringify(e)),be.l("".concat(n," timeout:").concat(u,"s delta:").concat(l,"s")),!(s&&c||!s)||(n=this._sigM.getInviteInfo(i))&&n===e||(n||this._sigM.setInviteInfo(i,g(g({},e),{},{message:t})),this._sigM.emitEvent(T.NEW_INVITATION_RECEIVED,g(g({},this._genBaseEmitData(e)),{},{inviteeList:o})),a!==r&&this._sigM.startTimer(g(g({},e),{},{timeout:u})))}},{key:"_onInviteeRejected",value:function(e){var t="".concat(this._n,"._onInviteeRejected"),n=e.inviteID,i=e.inviter,o=e.groupID,s=this._sigM.hasInviteInfo(n);be.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(s," inviter:").concat(i," groupID:").concat(o)),s&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(T.INVITEE_REJECTED,g(g({},this._genBaseEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInviteeAccepted",value:function(e){var t="".concat(this._n,"._onInviteeAccepted"),n=e.inviteID,i=e.inviter,o=e.groupID,s=this._sigM.hasInviteInfo(n);be.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(s," inviter:").concat(i," groupID:").concat(o)),s&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(T.INVITEE_ACCEPTED,g(g({},this._genBaseEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInvitationCancelled",value:function(e){var t="".concat(this._n,"._onInvitationCancelled"),n=e.inviteID,i=e.inviter,o=e.groupID,s=this._sigM.hasInviteInfo(n);be.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(s," inviter:").concat(i," groupID:").concat(o)),s&&(this._sigM.deleteInviteInfo(n),this._sigM.emitEvent(T.INVITATION_CANCELLED,this._genBaseEmitData(e)))}},{key:"_onInvitationTimeout",value:function(e){var t="".concat(this._n,"._onInvitationTimeout"),n=e.inviteID,i=e.inviter,o=e.groupID,s=e.inviteeList,a=this._sigM.hasInviteInfo(n);be.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(a," inviter:").concat(i," groupID:").concat(o," data:").concat(e.data)),a&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(T.INVITATION_TIMEOUT,g(g({},this._genBaseEmitData(e)),{},{inviteeList:s,isSelfTimeout:!1})))}},{key:"_onInvitationModified",value:function(e,t){var n="".concat(this._n,"._onInvitationModified"),i=e.inviteID,o=e.data,s=this._sigM.hasInviteInfo(i);be.l("".concat(n," inviteID:").concat(i," hasInviteID:").concat(s," data:").concat(o)),s&&(this._sigM.setInviteInfo(i,g(g({},e),{},{message:t})),this._sigM.emitEvent(T.INVITATION_MODIFIED,{inviteID:i,data:o}))}}]),aa=s((function e(t){i(this,e),this._n="LocalSignalingHandler",this._sigM=t}),[{key:"generateInviteID",value:function(){var e,t=(t=ws)((e=Ns)(32),8)+"-"+t(e(16),4)+"-"+t(16384|e(12),4)+"-"+t(32768|e(14),4)+"-"+t(e(48),12);return be.l("".concat(this._n,".generateInviteID inviteID:").concat(t)),t}},{key:"createInviteInfo",value:function(e){var t=this.generateInviteID(),n=(e=this.createInviteCustomData(g(g({},e),{},{inviteID:t}))).groupID,i=e.inviteeList;return n=n||i[0],{customData:e,message:this._sigM.createSignaling(e,n),inviteID:t}}},{key:"_genBaseCustomData",value:function(e){var t=e.data,n=e.inviteID;return{businessID:1,timeout:0,data:void 0===t?"":t,inviteID:void 0===n?"":n,groupID:void 0===(e=e.groupID)?"":e}}},{key:"createInviteCustomData",value:function(e){var t=e.userID,n=void 0===(n=e.timeout)?0:n,i=void 0===(i=e.groupID)?"":i,o=this._sigM.getMyUserID();return o=g(g({},this._genBaseCustomData(e)),{},{actionType:T.ACTION_TYPE_INVITE,inviter:o,inviteeList:i?e.inviteeList:[t],timeout:n}),be.l("".concat(this._n,".createInviteCustomData customData:"),o),o}},{key:"createCancelCustomData",value:function(e){var t,n="".concat(this._n,".createCancelCustomData"),i=e.inviteID,o=this._sigM.getMyUserID(),s=(i=this._sigM.getInviteInfo(i)).inviteeList,a=i.groupID;return(i=i.inviter)===o?t=g(g({},this._genBaseCustomData(e)),{},{actionType:T.ACTION_TYPE_CANCEL_INVITE,groupID:a,inviter:o,inviteeList:s}):be.e("".concat(n," unmatched inviter:").concat(i," and my userID:").concat(o)),be.l("".concat(n," customData:"),t),t}},{key:"createAcceptCustomData",value:function(e){var t,n="".concat(this._n,".createAcceptCustomData"),i=e.inviteID,o=this._sigM.getMyUserID(),s=this._sigM.getInviteInfo(i),a=s.inviter,r=s.groupID;return s.inviteeList.includes(o)?t=g(g({},this._genBaseCustomData(e)),{},{actionType:T.ACTION_TYPE_ACCEPT_INVITE,groupID:r,inviter:a,inviteeList:[o]}):be.e("".concat(n," userID:").concat(o," not in inviteeList. inviteID:").concat(i," groupID:").concat(r)),be.l("".concat(n," customData:"),t),t}},{key:"createRejectCustomData",value:function(e){var t,n="".concat(this._n,".createRejectCustomData"),i=e.inviteID,o=this._sigM.getMyUserID(),s=this._sigM.getInviteInfo(i),a=s.inviter,r=s.groupID;return s.inviteeList.includes(o)?t=g(g({},this._genBaseCustomData(e)),{},{actionType:T.ACTION_TYPE_REJECT_INVITE,groupID:r,inviter:a,inviteeList:[o]}):be.e("".concat(n," userID:").concat(o," not in inviteeList. inviteID:").concat(i," groupID:").concat(r)),be.l("".concat(n," customData:"),t),t}},{key:"createTimeoutCustomData",value:function(e){var t="".concat(this._n,".createTimeoutCustomData"),n=e.inviteeList,i=e.inviter,o=void 0!==(o=e.isInviter)&&o,s=this._sigM.getMyUserID();return e=g(g({},this._genBaseCustomData(e)),{},{actionType:T.ACTION_TYPE_INVITE_TIMEOUT,inviter:i,inviteeList:o?n:[s]}),be.l("".concat(t," customData:"),e),e}}]),ra=s((function e(t){i(this,e),this._n="HistorySignalingHandler",this._sigM=t,this.COUNT=20,this.EXPIRED_TIME=300,this._map=new Map,this._relatedToMeMap=new Map}),[{key:"setCloudConfig",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:20,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:300;this.COUNT=e,this.EXPIRED_TIME=t,be.l("".concat(this._n,".setCloudConfig count:").concat(e,", time:").concat(t))}},{key:"getHistorySignaling",value:function(){var e=this,t=this._sigM.get(11).getLocalConvList();qe(t)||(this._getC2CSignalingList(),t=this._getValidGroupConvList(t),this._getGroupSignalingList(t).then((function(t){e._handleSignalingList(t)})))}},{key:"_getC2CSignalingList",value:function(){var e=this._sigM.get(6).getMessageListFromUnreadDB();e=this._sigM.filterMessageList(e),this._getRelatedToMeMap(e)}},{key:"_getGroupSignalingList",value:function(e){var t=this;return 0===(e=this._createPromiseList(e)).length?Promise.resolve(this._sortSignaling(this._relatedToMeMap)):this._concurrentGetMessageList(e).then((function(e){var n=new Map;return e.forEach((function(e){e=e.list,e=t._getRelatedToMeMap(e),n=new Map([].concat(v(n),v(e)))})),t._sortSignaling(n)}))}},{key:"_handleSignalingList",value:function(e){qe(e)||this._sigM.onNewMessageList(e)}},{key:"_getValidGroupConvList",value:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var o=(a=e[n]).type,s=a.unreadCount,a=a.lastMessage;o=o===E.CONV_GROUP,a=this._isNotExpired(a),o&&s&&a&&t.push(e[n])}return t}},{key:"_isNotExpired",value:function(e){return!(!e||!e.lastTime)&&e.lastTime>Se()-this.EXPIRED_TIME}},{key:"_createPromiseList",value:function(e){for(var t=[],n=0;n<e.length;n++){var i=(o=e[n]).conversationID,o=(o=o.unreadCount)<this.COUNT?o:this.COUNT;this._map.set(i,{msgCount:o,list:[]}),o=this._sigM.get(11).getMessageList({conversationID:i}),t.push(o)}return t}},{key:"_concurrentGetMessageList",value:function(e){var t=this,n=[];return Promise.all(e).then((function(e){for(var i=0;i<e.length;i++){var o=(s=e[i]).code,s=s.data;0===o&&0!==s.messageList.length&&(t._handleMessageList(s.messageList),o=t._relayGetMessageList(s))&&n.push(o)}return 0<n.length?t._concurrentGetMessageList(n):t._map}))}},{key:"_relayGetMessageList",value:function(e){var t,n=e.messageList,i=e.nextReqMessageID;return e=e.isCompleted,0===n.length||(n=n[0].conversationID,0===(t=this._map.get(n).msgCount))||e?null:this._sigM.get(11).getMessageList({conversationID:n,nextReqMessageID:i,count:t})}},{key:"_handleMessageList",value:function(e){var t=e.length,n=e[0].conversationID,i=(o=this._map.get(n)).msgCount,o=o.list;this._map.set(n,{msgCount:0<i-t?i-t:0,list:o.concat(this._sigM.filterMessageList(e))})}},{key:"_getRelatedToMeMap",value:function(e){for(var t=0;t<e.length;t++){var n=e[t];this._saveRelatedToMe(n)}return this._relatedToMeMap}},{key:"_saveRelatedToMe",value:function(e){var t,n=(t=this._sigM.getPayloadData(e)||{}).actionType,i=void 0===(t=t.inviteID)?"":t;switch(void 0===n?"":n){case T.ACTION_TYPE_INVITE:this._setHistoryInvite(e);break;case T.ACTION_TYPE_REJECT_INVITE:case T.ACTION_TYPE_ACCEPT_INVITE:this._updateHistoryInvite(e);break;case T.ACTION_TYPE_CANCEL_INVITE:this._delHistoryInvite(i);break;case T.ACTION_TYPE_INVITE_TIMEOUT:this._updateHistoryInvite(e)}}},{key:"_setHistoryInvite",value:function(e){var t=this._sigM.getPayloadData(e)||{},n=void 0===(n=t.inviteID)?"":n,i=void 0===(i=t.inviteeList)?[]:i,o=void 0===(o=t.timeout)?0:o,s=this._sigM.getMyUserID();i.includes(s)&&(i=Se()-e.time,0<o&&o<i&&0!==o||this._relatedToMeMap.set(n,g(g({},t),{},{messageList:[e]})))}},{key:"_delHistoryInvite",value:function(e){this._relatedToMeMap.has(e)&&this._relatedToMeMap.delete(e)}},{key:"_updateHistoryInvite",value:function(e){var t=void 0===(t=(o=this._sigM.getPayloadData(e)||{}).inviteID)?"":t,n=void 0===(o=o.inviteeList)?[]:o;if(this._relatedToMeMap.has(t)){for(var i=(o=this._relatedToMeMap.get(t)).inviteeList,o=o.messageList,s=0;s<n.length;s++){var a=n[s];i.includes(a)&&i.splice(i.indexOf(a),1)}0===i.length?this._delHistoryInvite(t):o.push(e)}else this._delHistoryInvite(t)}},{key:"_sortSignaling",value:function(e){var t=[];return e.forEach((function(e){t=[].concat(v(t),v(e.messageList))})),t.sort((function(e,t){return e.time-t.time}))}},{key:"reset",value:function(){this._map.clear(),this._relatedToMeMap.clear()}}]),ca=s((function e(t,n){i(this,e),this.businessID=t.businessID||1,this.inviteID=t.inviteID,this.groupID=t.groupID||"",this.inviter=t.inviter||"",this.inviteeList=t.inviteeList||[],this.data=t.data||"",this.actionType=t.actionType||T.ACTION_TYPE_INVITE,this.timeout=t.timeout||0})),ua=["message"],la=["message"],da=(u(va,wn),s(va,[{key:"onC2CUnreadHandleCompleted",value:function(){this._isC2CUnreadHandleCompleted=!0,this._isCloudConfigCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onConvSyncCompleted",value:function(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isCloudConfigCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onCloudConfig",value:function(){this._isCloudConfigCompleted=!0;var e=this.getCloudConfig("history_s_count"),t=this.getCloudConfig("history_s_time");lt(e)||(e=Number(e)),lt(t)||(t=Number(t)),this._historySignalingHandler.setCloudConfig(e,t),this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"_isListenerExisted",value:function(){return-1<this._m.getOEmitInst().eventNames().indexOf(T.NEW_INVITATION_RECEIVED)}},{key:"onReady",value:function(){this._isSyncCompleted=!0;var e=this._isListenerExisted();be.l("".concat(this._n,".onReady. isListenerExisted: ").concat(e)),e&&this._historySignalingHandler.getHistorySignaling()}},{key:"onNewMessageList",value:function(e){if(0<(e=this.filterMessageList(e)).length)return this._remoteSignalingHandler.onNewMessageList(e)}},{key:"onMessageModified",value:function(e){if(0<(e=this.filterMessageList(e)).length)return this._remoteSignalingHandler.onMessageModified(e)}},{key:"hasInviteInfo",value:function(e){return this._inviteInfoMap.has(e)}},{key:"getInviteInfo",value:function(e){return this._inviteInfoMap.get(e)}},{key:"setInviteInfo",value:function(e,t){var n=t.message;t=f(t,ua),be.l("".concat(this._n,".setInviteInfo inviteID:").concat(e," data:"),t),this._inviteInfoMap.set(e,g(g({},t),{},{message:n}))}},{key:"deleteInviteInfo",value:function(e){this.hasInviteInfo(e)&&(be.l("".concat(this._n,".deleteInviteInfo inviteID:").concat(e,".")),this._inviteInfoMap.delete(e))}},{key:"updateInviteInfo",value:function(e){var t="".concat(this._n,".updateInviteInfo"),n=e.inviteID,i=e.inviter,o=e.inviteeList;e=e.groupID,be.l("".concat(t," inviteID:").concat(n," inviter:").concat(i," groupID:").concat(e)),e&&this.hasInviteInfo(n)&&(i=o[0],(e=this.getInviteInfo(n).inviteeList).includes(i)&&(e.splice(e.indexOf(i),1),be.l("".concat(t," remove ").concat(i,". localInviteeList.length:").concat(e.length))),0!==e.length)||this.deleteInviteInfo(n)}},{key:"canIUseSignaling",value:function(){return this._canIUseSignaling}},{key:"emitEvent",value:function(e,t){this.emitOEvt(e,t)}},{key:"addSignalingListener",value:function(e,t,n){this._canIUseSignaling||(this._canIUseSignaling=!0),this._m.getOEmitInst().on(e,t,n)}},{key:"removeSignalingListener",value:function(e,t,n){this._m.getOEmitInst().off(e,t,n),this._isListenerExisted()||(this._canIUseSignaling=!1)}},{key:"invite",value:function(e){var t=this,n="".concat(this._n,".").concat("invite"),i=this._localSignalingHandler.createInviteInfo(e),o=i.message,s=i.customData,a=i.inviteID;return be.l("".concat(n," options:").concat(JSON.stringify(e)," inviteID:").concat(a)),this.sendSignaling(o,e).then((function(e){return e&&0===e.code?(t.setInviteInfo(a,g(g({},s),{},{message:o})),t.startTimer(g(g({},s),{},{inviteID:a})),g(g({},e),{},{inviteID:a})):e})).catch((function(e){return En(e)}))}},{key:"inviteSync",value:function(e,t,n){var i=this,o="".concat(this._n,".").concat("inviteSync"),s=this._localSignalingHandler.createInviteInfo(e),a=s.message,r=s.customData,c=s.inviteID;return be.l("".concat(o," options:").concat(JSON.stringify(e)," inviteID:").concat(c)),this.sendSignaling(a,e).then((function(e){if(e&&0===e.code)return i.setInviteInfo(c,g(g({},r),{},{message:a})),i.startTimer(g(g({},r),{},{inviteID:c})),t&&t({inviteID:c}),{inviteID:c};n&&n(0===e.code,e.message||"")})).catch((function(e){return n&&n(e.code,e.message),En(e)})),c}},{key:"_handleImResponse",value:function(e,t,n){t&&0===t.code&&(this._isHandling=!1,n?this.deleteInviteInfo(e.inviteID):this.updateInviteInfo(e))}},{key:"cancel",value:function(e){var t=this,n="".concat(this._n,".").concat("cancel");if(be.l("".concat(n," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return En({code:qn.INVALID_CANCEL_MESSAGE});this._isHandling=!0;var i,o=this._localSignalingHandler.createCancelCustomData(e);return o?(n=o.groupID,i=o.inviteeList,n=n||i[0],i=this.createSignaling(o,n),this.sendSignaling(i,e).then((function(n){return t._handleImResponse(o,n,!0),0===n.code?g(g({},n),{},{inviteID:e.inviteID}):n})).catch((function(e){return En(e)}))):(this._isHandling=!1,En({code:qn.SIGNALING_NO_PERMISSION}))}},{key:"accept",value:function(e){var t=this,n="".concat(this._n,".").concat("accept");if(be.l("".concat(n," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return En({code:qn.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var i=this._localSignalingHandler.createAcceptCustomData(e);return i?(n=this.createSignaling(i),this.sendSignaling(n,e).then((function(n){return t._handleImResponse(i,n),0===n.code?g(g({},n),{},{inviteID:e.inviteID}):n})).catch((function(e){return En(e)}))):(this._isHandling=!1,En({code:qn.SIGNALING_NO_PERMISSION}))}},{key:"reject",value:function(e){var t=this,n="".concat(this._n,".").concat("reject");if(be.l("".concat(n," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return En({code:qn.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var i=this._localSignalingHandler.createRejectCustomData(e);return i?(n=this.createSignaling(i),this.sendSignaling(n,e).then((function(n){return t._handleImResponse(i,n,!0),0===n.code?g(g({},n),{},{inviteID:e.inviteID}):n})).catch((function(e){return En(e)}))):(this._isHandling=!1,En({code:qn.SIGNALING_NO_PERMISSION}))}},{key:"getSignalingInfo",value:function(e){var t="".concat(this._n,".getSignalingInfo"),n=e.ID,i=e.from,o=e.to,s=this._filterSignaling(e),a=null;return s&&(e=this.getPayloadData(e),a=new ca(e)),e=s?"actionType:".concat(a.actionType):"",be.l("".concat(t," messageID:").concat(n," from:").concat(i," to:").concat(o," ")+"".concat(e," isSignaling:").concat(s)),a}},{key:"modifyInvitation",value:function(e){var t,n,i,o,s=this,a=e.inviteID;return e=e.data,this.hasInviteInfo(a)?(t=this.getInviteInfo(a),n=t.message,i=f(t,la),o=n.payload.data,i.data=e,n.payload.data=JSON.stringify(i),this.get(2).modifyRemoteMessage(n).then((function(e){return s.hasInviteInfo(a)&&s.setInviteInfo(a,g(g({},i),{},{message:n})),e})).catch((function(e){return n.payload.data=o,En(e)}))):En({code:qn.SIGNALING_INVALID_INVITE_ID})}},{key:"_genMsgCtrlInfo",value:function(){var e=void 0===(e=(o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).data)?"":e,t=o.onlineUserOnly,n=void 0===(n=o.inviteID)?"":n,i=o.offlinePushInfo,o=o.actionType,s={_onlineOnlyFlag:!1};return n={onlineUserOnly:(s=n&&this.getInviteInfo(n)?this.getInviteInfo(n).message:s)._onlineOnlyFlag||t||!1,offlinePushInfo:i,messageControlInfo:{excludedFromContentModeration:!0,excludedFromUnreadCount:!1,excludedFromLastMessage:!1}},o===T.ACTION_TYPE_INVITE_TIMEOUT?(s=!!e.match(/excludeTimeoutSignalingFromHistoryMessage/),n.messageControlInfo.excludedFromUnreadCount=s,n.messageControlInfo.excludedFromLastMessage=s):(t=!!e.match(/excludeFromHistoryMessage/),i=!!e.match(/excludeOriginalSignalingFromHistoryMessage/),n.messageControlInfo.excludedFromUnreadCount=t||i,n.messageControlInfo.excludedFromLastMessage=t||i),n}},{key:"sendSignaling",value:function(e,t){var n=this;return this.get(2).sendMessageInstance(e,this._genMsgCtrlInfo(t)).catch((function(e){return n._isHandling=!1,En(e)}))}},{key:"filterMessageList",value:function(e){var t=this;return e.filter((function(e){return t._filterSignaling(e)}))}},{key:"getPayloadData",value:function(e){return this._remoteSignalingHandler.getPayloadData(e)}},{key:"createSignaling",value:function(e,t){var n=e.groupID,i=e.inviter;return t={to:t||n||i,conversationType:n?E.CONV_GROUP:E.CONV_C2C,priority:E.MSG_PRIORITY_HIGH,payload:{data:JSON.stringify(e)}},i=this.get(2).createCustomMessage(t),be.l("".concat(this._n,".createSignaling. message:"),i),i}},{key:"_filterSignaling",value:function(e){var t,n,i=!1;return e.type&&e.type===E.MSG_CUSTOM&&(t=e.cloudCustomData,e=void 0===(e=e.payload.data)?"":e,t=(void 0===t?"":t).match(/"type":"tsignaling"/),n=e.match(/inviteID/),e=e.match(/actionType/),i=t||n&&e),!!i}},{key:"startTimer",value:function(e){var t,n,i,o=this,s="".concat(this._n,".startTimer"),a=e.timeout,r=e.inviteID,c=e.inviter,u=e.groupID,l=c===this.getMyUserID();be.l("".concat(s," timeout:").concat(a," isInviter:").concat(l," groupID:").concat(u)),a<=0||(t=l?a+5:a,n=1,i=setInterval((function(){var a=o._hasLocalInviteInfo(e,l);n<t&&a?++n:(a&&o._sendTimeoutNotice(r,l),be.l("".concat(s," end.")),clearInterval(i))}),1e3))}},{key:"_hasLocalInviteInfo",value:function(e,t){var n,i,o=e.inviteID;return e=e.groupID,!!this.hasInviteInfo(o)&&(n="".concat(this._n,"._hasLocalInviteInfo"),i=this.getInviteInfo(o).inviteeList,be.l("".concat(n," inviteID:").concat(o," inviteeList:").concat(i," groupID:").concat(e)),!e||(t?0<i.length:0<i.length&&i.includes(this.getMyUserID())))}},{key:"_getReceiver",value:function(e,t){var n=t.groupID,i=t.inviteeList;return t=t.inviter,e?n||i[0]:n||t}},{key:"_sendTimeoutNotice",value:function(e,t){var n=this,i=this.getInviteInfo(e),o=this._getReceiver(t,i),s=(be.l("".concat(this._n,"._sendTimeoutNotice inviteID:").concat(e," to:").concat(o," isInviter:").concat(t)),this._localSignalingHandler.createTimeoutCustomData(g(g({},i),{},{isInviter:t}))),a=this.createSignaling(s,o);return this.sendSignaling(a,s).then((function(i){var o,r,c;i&&0===i.code&&(i=s.data,o=s.groupID,r=s.inviteeList,c=s.inviter,n.emitEvent(T.INVITATION_TIMEOUT,{data:i,groupID:o,inviteID:e,inviteeList:r,inviter:c,isSelfTimeout:!0,message:a}),t?n.deleteInviteInfo(e):n.updateInviteInfo(s))}))}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._inviteInfoMap.clear(),this._canIUseSignaling=!1,this._isHandling=!1,this._historySignalingHandler.reset(),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this._isCloudConfigCompleted=!1}}])),pa=["followDiffList"],ha=["from"],ga={NONE:0,FOLLOWERS:1,FOLLOWING:2,MUTUAL:3},fa=(u(_a,wn),s(_a,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("follow_req_count");lt(e)||(e=Number(e),this.DEFAULT_COUNT=e>this.MAX_COUNT?this.MAX_COUNT:e,this._clearFollowList())}},{key:"clearCacheOnReconnected",value:function(){this._clearFollowList()}},{key:"onFollowNotify",value:function(e){var t=this;e=e.dataList||[],be.l("".concat(this._n,".onFollowNotify followChangeList:").concat(e.length)),e.forEach((function(e){var n=void 0===(n=e.followDiffList)?[]:n,i=(e=f(e,pa)).from,o=f(e,ha);n.forEach((function(e){var n=e.isAdd,s=(e=void 0===(e=e.followType)?0:e,t._initFollowInfo());1===n?(o.userID=i,s[e].userInfoList.push(o),s[e].isAdd=!0):(s[e].userInfoList.push(i),s[e].isAdd=!1),t._emitEvent(s)}))}))}},{key:"_initFollowInfo",value:function(){var e={};return Object.values(ga).forEach((function(t){t!==ga.NONE&&(e[t]={userInfoList:[],isAdd:!1})})),e}},{key:"_emitEvent",value:function(e){var t=this;Object.keys(e).forEach((function(n){n=Number(n);var i=e[n];0<i.userInfoList.length&&(n===ga.FOLLOWERS&&(t._clearFollowList(ga.FOLLOWERS),t.emitOEvt(S.MY_FOLLOWERS_LIST_UPDATED,i)),n===ga.FOLLOWING&&(t._clearFollowList(ga.FOLLOWING),t.emitOEvt(S.MY_FOLLOWING_LIST_UPDATED,i)),n===ga.MUTUAL)&&(t._clearFollowList(ga.MUTUAL),t.emitOEvt(S.MUTUAL_FOLLOWERS_LIST_UPDATED,i))}))}},{key:"followUser",value:function(e){var t,n,i;return this.canIUse(N.FOLLOW)?(t="".concat(this._n,".").concat("followUser"),n="userIDList:".concat(e.length),(i=new oi("followUser")).setMessage(n),be.l("".concat(t," ").concat(n)),this.req({P:jn.FOLLOW,data:{fromAccount:this.getMyUserID(),userIDList:e.map((function(e){return{userID:e}}))}}).then((function(e){return i.end(),be.l("".concat(t," ok.")),Cn(e.data.resultList)})).catch((function(e){return i.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this.noUse("followUser")}},{key:"unfollowUser",value:function(e){var t,n,i;return this.canIUse(N.FOLLOW)?(t="".concat(this._n,".").concat("unfollowUser"),n="userIDList:".concat(e.length),(i=new oi("unfollowUser")).setMessage(n),be.l("".concat(t," ").concat(n)),this.req({P:jn.UNFOLLOW,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then((function(e){return i.end(),be.l("".concat(t," ok.")),Cn(e.data.resultList)})).catch((function(e){return i.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this.noUse("unfollowUser")}},{key:"getMyFollowersList",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n="getMyFollowersList";if(!this.canIUse(N.FOLLOW))return this.noUse(n);var i=t||this.FIRST_PAGE_INDEX;if(this._myFollowersList.has(i)){var o=(a=this._myFollowersList.get(i)).resultList,s=a.nextCursor,a=a.lastUpdateTime;if(Date.now()-a<this.MAX_CATCH_TIME&&0<o.length)return be.l("".concat(this._n,".").concat(n," nextCursor:").concat(t," from local.")),Sn({resultList:o,nextCursor:s})}return this._getFollowList(t,ga.FOLLOWERS).then((function(o){return e._myFollowersList.set(i,g(g({},o),{},{lastUpdateTime:Date.now()})),be.l("".concat(e._n,".").concat(n," nextCursor:").concat(t," from remote.")),Cn(o)}))}},{key:"getMyFollowingList",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n="getMyFollowingList";if(!this.canIUse(N.FOLLOW))return this.noUse(n);var i=t||this.FIRST_PAGE_INDEX;if(this._myFollowingList.has(i)){var o=(a=this._myFollowingList.get(i)).resultList,s=a.nextCursor,a=a.lastUpdateTime;if(Date.now()-a<this.MAX_CATCH_TIME&&0<o.length)return be.l("".concat(this._n,".").concat(n," nextCursor:").concat(t," from local.")),Sn({resultList:o,nextCursor:s})}return this._getFollowList(t,ga.FOLLOWING).then((function(o){return e._myFollowingList.set(i,g(g({},o),{},{lastUpdateTime:Date.now()})),be.l("".concat(e._n,".").concat(n," nextCursor:").concat(t," from remote.")),Cn(o)}))}},{key:"getMutualFollowersList",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n="getMutualFollowersList";if(!this.canIUse(N.FOLLOW))return this.noUse(n);var i=t||this.FIRST_PAGE_INDEX;if(this._myMutualFollowersList.has(i)){var o=(a=this._myMutualFollowersList.get(i)).resultList,s=a.nextCursor,a=a.lastUpdateTime;if(Date.now()-a<this.MAX_CATCH_TIME&&0<o.length)return be.l("".concat(this._n,".").concat(n," nextCursor:").concat(t," from local.")),Sn({resultList:o,nextCursor:s})}return this._getFollowList(t,ga.MUTUAL).then((function(o){return e._myMutualFollowersList.set(i,g(g({},o),{},{lastUpdateTime:Date.now()})),be.l("".concat(e._n,".").concat(n," nextCursor:").concat(t," from remote.")),Cn(o)}))}},{key:"_getFollowList",value:function(e,t){var n=this,i=new oi("_getFollowList");return i.setMessage("nextCursor:".concat(e," type:").concat(t)),this.req({P:jn.GET_FOLLOW,data:{fromAccount:this.getMyUserID(),count:this.DEFAULT_COUNT,nextCursor:e,type:t}}).then((function(e){i.end();var t=void 0===(t=(e=e.data).resultList)?[]:t,o=(e=void 0===(e=e.nextCursor)?"":e,[]);return t.forEach((function(e){var t=e.userID,i=e.followTime;e=e.profileList,o.push(g({userID:t,followTime:i},n._handleProfileItem(void 0===e?[]:e)))})),{resultList:o,nextCursor:e}})).catch((function(e){return i.setError(e).end(),be.e("".concat(n._n,"._getFollowList failed. error:"),e),En(e)}))}},{key:"_handleProfileItem",value:function(e){var t={};return e.forEach((function(e){switch(e.tag){case Le.NICK:t.nick=e.value;break;case Le.GENDER:t.gender=e.value;break;case Le.BIRTHDAY:t.birthday=e.value;break;case Le.LOCATION:t.location=e.value;break;case Le.SELFSIGNATURE:t.selfSignature=e.value;break;case Le.ALLOWTYPE:t.allowType=e.value;break;case Le.LANGUAGE:t.language=e.value;break;case Le.AVATAR:t.avatar=e.value;break;case Le.MESSAGESETTINGS:t.messageSettings=e.value;break;case Le.ADMINFORBIDTYPE:t.adminForbidType=e.value;break;case Le.LEVEL:t.level=e.value;break;case Le.ROLE:t.role=e.value;break;default:t[e.tag]=e.value}})),t}},{key:"getUserFollowInfo",value:function(e){var t,n,i;return this.canIUse(N.FOLLOW)?(n=!1,lt(e)&&(e=[this.getMyUserID()],n=!0),t="".concat(this._n,".").concat("getUserFollowInfo"),n="userIDList:".concat(e.length," isGetMyFollowInfo:").concat(n),(i=new oi("getUserFollowInfo")).setMessage(n),be.l("".concat(t," ").concat(n)),this.req({P:jn.GET_FOLLOW_INFO,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then((function(e){i.end(),be.l("".concat(t," ok.")),e=e.data.followInfoList;var n=[];return(void 0===e?[]:e).forEach((function(e){var t=e.followersCount,i=e.followingCount;e=e.mutualFollowersCount,n.push({followersCount:t,followingCount:i,mutualFollowersCount:e})})),Cn(n)})).catch((function(e){return i.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this.noUse("getUserFollowInfo")}},{key:"checkFollowType",value:function(e){if(!this.canIUse(N.FOLLOW))return this.noUse("checkFollowType");100<e.length&&(e=e.slice(0,100),be.w("".concat(t," ").concat(jt(100))));var t="".concat(this._n,".").concat("checkFollowType"),n="userIDList length:".concat(e.length," "),i=new oi("checkFollowType");return i.setMessage(n),be.l("".concat(t," ").concat(n)),this.req({P:jn.CHECK_FOLLOW_TYPE,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then((function(e){i.end(),be.l("".concat(t," ok.")),e=e.data.resultList;var n=[];return(void 0===e?[]:e).forEach((function(e){var t=e.userID;e=e.followType,n.push({userID:t,followType:e})})),Cn(n)})).catch((function(e){return i.setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))}},{key:"_clearFollowList",value:function(e){lt(e)?(this._myFollowersList.clear(),this._myFollowingList.clear(),this._myMutualFollowersList.clear()):e!==ga.FOLLOWERS?e!==ga.FOLLOWING?e===ga.MUTUAL&&this._myMutualFollowersList.clear():this._myFollowingList.clear():this._myFollowersList.clear()}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._clearFollowList()}}])),ma=Go((function(e,t){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t,n,i=Array.prototype.slice.call(arguments,1);i.length;){var o=i.shift();if(o){if("object"!==I(o))throw new TypeError(o+"must be non-object");for(var s in o)t=o,n=s,Object.prototype.hasOwnProperty.call(t,n)&&(e[s]=o[s])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,i,o){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),o);else for(var s=0;s<i;s++)e[o+s]=t[n+s]},flattenChunks:function(e){for(var t,n,i,o=0,s=0,a=e.length;s<a;s++)o+=e[s].length;for(i=new Uint8Array(o),s=t=0,a=e.length;s<a;s++)n=e[s],i.set(n,t),t+=n.length;return i}},o={arraySet:function(e,t,n,i,o){for(var s=0;s<i;s++)e[o+s]=t[n+s]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(n)}));function _a(e){return i(this,_a),(e=n(this,_a,[e]))._n="FollowModule",e._myFollowersList=new Map,e._myFollowingList=new Map,e._myMutualFollowersList=new Map,e.MAX_CATCH_TIME=6e5,e.FIRST_PAGE_INDEX=ot(),e.DEFAULT_COUNT=500,e.MAX_COUNT=1e3,e.getIEmitInst().on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function va(e){i(this,va),(e=n(this,va,[e]))._n="SignalingModule",e._inviteInfoMap=new Map,e._canIUseSignaling=!1,e._isHandling=!1,e._remoteSignalingHandler=new sa(e),e._localSignalingHandler=new aa(e),e._historySignalingHandler=new ra(e),e._isC2CUnreadHandleCompleted=!1,e._isConvSyncCompleted=!1,e._isSyncCompleted=!1,e._isCloudConfigCompleted=!1;var t=e.getIEmitInst();return t.on(Ni.C2C_UNREAD_HANDLE_COMPLETED,e.onC2CUnreadHandleCompleted,e),t.on(Ni.CONV_SYNC_COMPLETED,e.onConvSyncCompleted,e),t.on(Ni.CLOUD_CONFIG,e.onCloudConfig,e),e}function ya(e){return i(this,ya),(e=n(this,ya,[e]))._n="ProfanityFilterModule",e._plugin=null,e._filterConfigMap=new Map,e._startIndex=0,e._version=0,e._canIUseLexicon=!1,e._isFetching=!1,e._expiredTime=0,e}function Ia(e){var t;return i(this,Ia),(t=n(this,Ia,[e]))._m=e,t._n="TIMPushModule",t._pluginName="TIMPush",t._pushPlugin=void 0,t._androidPushConfig={},t._deviceToken="",t._businessID=0,t._iOSBusinessID=0,t._c2cUnreadCount=0,t._groupUnreadCount=0,t._isWebUniapp=0,t._deviceInfo={notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:"1.0.1",packageName:""},t}function Ma(e){var t;return i(this,Ma),(t=n(this,Ma,[e]))._m=e,t._n="OfflinePushModule",t._offlinePushPlugin=void 0,t._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},t._deviceToken="",t._businessID=0,t._iosBusinessID=0,t._c2cUnreadCount=0,t._groupUnreadCount=0,t._isWebUniapp=0,t}function Ca(e){return i(this,Ca),(e=n(this,Ca,[e]))._n="WorkerTimerModule",e._isWorkerEnabled=!0,e._workerTimer=null,e._timerID=-1,e._init(),e.getIEmitInst().on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function Sa(e){return i(this,Sa),(e=n(this,Sa,[e]))._n="SnsModule",e._friendHandler=new Ws(e),e._friendApplicationHandler=new Ks(e),e._friendGroupHandler=new $s(e),e.getIEmitInst().on(Ni.A2KEY_AND_TINYID_UPDATED,e.onContextUpdated,e),e}function Ea(e){i(this,Ea),(e=n(this,Ea,[e]))._n="QualityStatModule",e.TAG="im-ssolog-quality-stat",e.reportIndex=0,e.wholePeriod=!1,e._qualityItems=[Hn,Kn,zn,Wn,Yn,$n,Jn,Xn,Qn,Zn],e._messageSentItems=[zn,Wn,Yn,$n,Jn],e._messageReceivedItems=[Xn,Qn,Zn],e.REPORT_INTERVAL=120,e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._statInfoArr=[],e._avgRTT=new Bs,e._avgE2EDelay=new Fs,e._rateMessageSent=new qs,e._rateMessageReceived=new Vs;var t=e.getIEmitInst();return t.on(Ni.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,e),t.on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function Ta(e){return i(this,Ta),(e=n(this,Ta,[e]))._n="RecoverMsgModule",e.PULL_LIMIT_COUNT=15,e}function ka(e){return i(this,ka),(e=n(this,ka,[e]))._n="CloudControlModule",e._cloudConfig=new Map,e._expiredTime=0,e._version=0,e._isFetching=!1,e}function Da(e){return i(this,Da),(e=n(this,Da,[e]))._n="SessionModule",e._platform=e.getPlatform(),e._pHandler=new Es(e),e._msgDispatcher=new ks(e),e._cmdFreqLimitMap=new Map,e._cmdReqInfoMap=new Map,e._serverOverloadInfoMap=new Map,e._incrementalPullContactFlag=!0,e._init(),e.getIEmitInst().on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function Ra(e,t,n,i){for(var o=65535&e,s=e>>>16&65535,a=0;0!==n;){for(n-=a=2e3<n?2e3:n;s=s+(o=o+t[i++]|0)|0,--a;);o%=65521,s%=65521}return o|s<<16}function Oa(e,t,n,i){var o=Aa,s=i+n;e^=-1;for(var a=i;a<s;a++)e=e>>>8^o[255&(e^t[a])];return~e}function ba(e,t,n,i,o,s,a,r){var c,u,l,d,p,h,g,f,m,_=r.bits,v=0,y=0,I=0,M=0,C=0,S=0,E=0,T=0,k=0,D=0,R=null,O=0,b=new ma.Buf16(16),A=new ma.Buf16(16),L=null,P=0;for(v=0;v<=15;v++)b[v]=0;for(y=0;y<i;y++)b[t[n+y]]++;for(C=_,M=15;1<=M&&0===b[M];M--);if(M<C&&(C=M),0===M)o[s++]=20971520,o[s++]=20971520,r.bits=1;else{for(I=1;I<M&&0===b[I];I++);for(C<I&&(C=I),v=T=1;v<=15;v++)if((T=(T<<1)-b[v])<0)return-1;if(0<T&&(0===e||1!==M))return-1;for(A[1]=0,v=1;v<15;v++)A[v+1]=A[v]+b[v];for(y=0;y<i;y++)0!==t[n+y]&&(a[A[t[n+y]]++]=y);if(h=0===e?(R=L=a,19):1===e?(R=La,O-=257,L=Pa,P-=257,256):(R=Na,L=wa,-1),v=I,p=s,E=y=D=0,l=-1,d=(k=1<<(S=C))-1,1===e&&852<k||2===e&&592<k)return 1;for(;;){for(m=a[y]<h?(f=0,a[y]):a[y]>h?(f=L[P+a[y]],R[O+a[y]]):(f=96,0),c=1<<(g=v-E),I=u=1<<S;o[p+(D>>E)+(u-=c)]=g<<24|f<<16|m,0!==u;);for(c=1<<v-1;D&c;)c>>=1;if(D=0!==c?(D&c-1)+c:0,y++,0==--b[v]){if(v===M)break;v=t[n+a[y]]}if(C<v&&(D&d)!==l){for(p+=I,T=1<<(S=v-(E=0===E?C:E));S+E<M&&!((T-=b[S+E])<=0);)S++,T<<=1;if(k+=1<<S,1===e&&852<k||2===e&&592<k)return 1;o[l=D&d]=C<<24|S<<16|p-s}}0!==D&&(o[p+D]=v-E<<24|64<<16),r.bits=C}return 0}ma.assign,ma.shrinkBuf,ma.setTyped,ma.Buf8,ma.Buf16,ma.Buf32;var Aa=function(){for(var e=[],t=0;t<256;t++){for(var n=t,i=0;i<8;i++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e}(),La=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Pa=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Na=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],wa=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function Ua(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Ga(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new ma.Buf16(320),this.work=new ma.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function xa(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new ma.Buf32(852),t.distcode=t.distdyn=new ma.Buf32(592),t.sane=1,t.back=-1,0):-2}function Fa(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,xa(e)):-2}function Ba(e,t){var n,i;return!e||!e.state||(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t))?-2:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,Fa(e))}function qa(e,t){var n;return e?(n=new Ga,(e.state=n).window=null,0!==(n=Ba(e,t))&&(e.state=null),n):-2}var Va,ja,Ha=!0;function Ka(e,t,n,i){var o;return null===(e=e.state).window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new ma.Buf8(e.wsize)),i>=e.wsize?(ma.arraySet(e.window,t,n-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):((o=e.wsize-e.wnext)>i&&(o=i),ma.arraySet(e.window,t,n-i,o,e.wnext),(i-=o)?(ma.arraySet(e.window,t,n-i,i,0),e.wnext=i,e.whave=e.wsize):(e.wnext+=o,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=o))),0}var za={inflateReset:Fa,inflateReset2:Ba,inflateResetKeep:xa,inflateInit:function(e){return qa(e,15)},inflateInit2:qa,inflate:function(e,t){var n,i,o,s,a,r,c,u,l,d,p,h,g,f,m,_,v,y,I,M,C,S,E,T,k=0,D=new ma.Buf8(4),R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(n=e.state).mode&&(n.mode=13),a=e.next_out,o=e.output,c=e.avail_out,s=e.next_in,i=e.input,r=e.avail_in,u=n.hold,l=n.bits,d=r,p=c,S=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap)n.mode=13;else{for(;l<16;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(2&n.wrap&&35615===u)D[n.check=0]=255&u,D[1]=u>>>8&255,n.check=Oa(n.check,D,2,0),l=u=0,n.mode=2;else if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31)e.msg="incorrect header check",n.mode=30;else if(8!=(15&u))e.msg="unknown compression method",n.mode=30;else{if(l-=4,C=8+(15&(u>>>=4)),0===n.wbits)n.wbits=C;else if(C>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<C,e.adler=n.check=1,n.mode=512&u?10:12,l=u=0}}break;case 2:for(;l<16;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(n.flags=u,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&(D[0]=255&u,D[1]=u>>>8&255,n.check=Oa(n.check,D,2,0)),l=u=0,n.mode=3;case 3:for(;l<32;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}n.head&&(n.head.time=u),512&n.flags&&(D[0]=255&u,D[1]=u>>>8&255,D[2]=u>>>16&255,D[3]=u>>>24&255,n.check=Oa(n.check,D,4,0)),l=u=0,n.mode=4;case 4:for(;l<16;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&(D[0]=255&u,D[1]=u>>>8&255,n.check=Oa(n.check,D,2,0)),l=u=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&(D[0]=255&u,D[1]=u>>>8&255,n.check=Oa(n.check,D,2,0)),l=u=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((h=(h=n.length)>r?r:h)&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),ma.arraySet(n.head.extra,i,s,h,C)),512&n.flags&&(n.check=Oa(n.check,i,h,s)),r-=h,s+=h,n.length-=h),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===r)break e;for(h=0;C=i[s+h++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C)),C&&h<r;);if(512&n.flags&&(n.check=Oa(n.check,i,h,s)),r-=h,s+=h,C)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===r)break e;for(h=0;C=i[s+h++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C)),C&&h<r;);if(512&n.flags&&(n.check=Oa(n.check,i,h,s)),r-=h,s+=h,C)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;l<16;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(u!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}l=u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;l<32;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}e.adler=n.check=Ua(u),l=u=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=r,n.hold=u,n.bits=l,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last)u>>>=7&l,l-=7&l,n.mode=27;else{for(;l<3;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}switch(n.last=1&u,--l,3&(u>>>=1)){case 0:n.mode=14;break;case 1:O=b=void 0;var O,b=n;if(Ha){for(Va=new ma.Buf32(512),ja=new ma.Buf32(32),O=0;O<144;)b.lens[O++]=8;for(;O<256;)b.lens[O++]=9;for(;O<280;)b.lens[O++]=7;for(;O<288;)b.lens[O++]=8;for(ba(1,b.lens,0,288,Va,0,b.work,{bits:9}),O=0;O<32;)b.lens[O++]=5;ba(2,b.lens,0,32,ja,0,b.work,{bits:5}),Ha=!1}if(b.lencode=Va,b.lenbits=9,b.distcode=ja,b.distbits=5,n.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}u>>>=2,l-=2}break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&u,l=u=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(h=n.length){if(0===(h=c<(h=r<h?r:h)?c:h))break e;ma.arraySet(o,i,s,h,a),r-=h,s+=h,c-=h,a+=h,n.length-=h}else n.mode=12;break;case 17:for(;l<14;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(n.nlen=257+(31&u),u>>>=5,l-=5,n.ndist=1+(31&u),u>>>=5,l-=5,n.ncode=4+(15&u),u>>>=4,l-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;l<3;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}n.lens[R[n.have++]]=7&u,u>>>=3,l-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},S=ba(0,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;_=(k=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,v=65535&k,!((m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(v<16)u>>>=m,l-=m,n.lens[n.have++]=v;else{if(16===v){for(T=m+2;l<T;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(u>>>=m,l-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}C=n.lens[n.have-1],h=3+(3&u),u>>>=2,l-=2}else if(17===v){for(T=m+3;l<T;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}C=0,h=3+(7&(u>>>=m)),u>>>=3,l=l-m-3}else{for(T=m+7;l<T;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}C=0,h=11+(127&(u>>>=m)),u>>>=7,l=l-m-7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;h--;)n.lens[n.have++]=C}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,E={bits:n.lenbits},S=ba(1,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},S=ba(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,S){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=r&&258<=c){e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=r,n.hold=u,n.bits=l,H=q=U=w=N=P=L=A=ie=ne=te=ee=Z=Q=X=J=$=Y=W=z=K=j=V=B=F=void 0;var A,L,P,N,w,U,G=e,x=p,F=G.state,B=G.next_in,q=G.input,V=B+(G.avail_in-5),j=G.next_out,H=G.output,K=j-(x-G.avail_out),z=j+(G.avail_out-257),W=F.dmax,Y=F.wsize,$=F.whave,J=F.wnext,X=F.window,Q=F.hold,Z=F.bits,ee=F.lencode,te=F.distcode,ne=(1<<F.lenbits)-1,ie=(1<<F.distbits)-1;t:do{for(Z<15&&(Q+=q[B++]<<Z,Z+=8,Q+=q[B++]<<Z,Z+=8),A=ee[Q&ne];;){if(Q>>>=L=A>>>24,Z-=L,0==(L=A>>>16&255))H[j++]=65535&A;else{if(!(16&L)){if(!(64&L)){A=ee[(65535&A)+(Q&(1<<L)-1)];continue}if(32&L){F.mode=12;break t}G.msg="invalid literal/length code",F.mode=30;break t}for(P=65535&A,(L&=15)&&(Z<L&&(Q+=q[B++]<<Z,Z+=8),P+=Q&(1<<L)-1,Q>>>=L,Z-=L),Z<15&&(Q+=q[B++]<<Z,Z+=8,Q+=q[B++]<<Z,Z+=8),A=te[Q&ie];;){if(Q>>>=L=A>>>24,Z-=L,!(16&(L=A>>>16&255))){if(!(64&L)){A=te[(65535&A)+(Q&(1<<L)-1)];continue}G.msg="invalid distance code",F.mode=30;break t}if(N=65535&A,Z<(L&=15)&&(Q+=q[B++]<<Z,(Z+=8)<L)&&(Q+=q[B++]<<Z,Z+=8),(N+=Q&(1<<L)-1)>W){G.msg="invalid distance too far back",F.mode=30;break t}if(Q>>>=L,Z-=L,N>(L=j-K)){if((L=N-L)>$&&F.sane){G.msg="invalid distance too far back",F.mode=30;break t}if(U=X,(w=0)===J){if(w+=Y-L,L<P){for(P-=L;H[j++]=X[w++],--L;);w=j-N,U=H}}else if(J<L){if(w+=Y+J-L,(L-=J)<P){for(P-=L;H[j++]=X[w++],--L;);if(w=0,J<P){for(P-=L=J;H[j++]=X[w++],--L;);w=j-N,U=H}}}else if(w+=J-L,L<P){for(P-=L;H[j++]=X[w++],--L;);w=j-N,U=H}for(;2<P;)H[j++]=U[w++],H[j++]=U[w++],H[j++]=U[w++],P-=3;P&&(H[j++]=U[w++],1<P)&&(H[j++]=U[w++])}else{for(w=j-N;H[j++]=H[w++],H[j++]=H[w++],H[j++]=H[w++],2<(P-=3););P&&(H[j++]=H[w++],1<P)&&(H[j++]=H[w++])}break}}break}}while(B<V&&j<z);B-=P=Z>>3,Q&=(1<<(Z-=P<<3))-1,G.next_in=B,G.next_out=j,G.avail_in=B<V?V-B+5:5-(B-V),G.avail_out=j<z?z-j+257:257-(j-z),F.hold=Q,F.bits=Z,a=e.next_out,o=e.output,c=e.avail_out,s=e.next_in,i=e.input,r=e.avail_in,u=n.hold,l=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;_=(k=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,v=65535&k,!((m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(_&&!(240&_)){for(y=m,I=_,M=v;_=(k=n.lencode[M+((u&(1<<y+I)-1)>>y)])>>>16&255,v=65535&k,!(y+(m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}u>>>=y,l-=y,n.back+=y}if(u>>>=m,l-=m,n.back+=m,n.length=v,0===_){n.mode=26;break}if(32&_){n.back=-1,n.mode=12;break}if(64&_){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&_,n.mode=22;case 22:if(n.extra){for(T=n.extra;l<T;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;_=(k=n.distcode[u&(1<<n.distbits)-1])>>>16&255,v=65535&k,!((m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(!(240&_)){for(y=m,I=_,M=v;_=(k=n.distcode[M+((u&(1<<y+I)-1)>>y)])>>>16&255,v=65535&k,!(y+(m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}u>>>=y,l-=y,n.back+=y}if(u>>>=m,l-=m,n.back+=m,64&_){e.msg="invalid distance code",n.mode=30;break}n.offset=v,n.extra=15&_,n.mode=24;case 24:if(n.extra){for(T=n.extra;l<T;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===c)break e;if(n.offset>(h=p-c)){if((h=n.offset-h)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}g=h>n.wnext?(h-=n.wnext,n.wsize-h):n.wnext-h,h>n.length&&(h=n.length),f=n.window}else f=o,g=a-n.offset,h=n.length;for(c-=h=c<h?c:h,n.length-=h;o[a++]=f[g++],--h;);0===n.length&&(n.mode=21);break;case 26:if(0===c)break e;o[a++]=n.length,c--,n.mode=21;break;case 27:if(n.wrap){for(;l<32;){if(0===r)break e;r--,u|=i[s++]<<l,l+=8}if(p-=c,e.total_out+=p,n.total+=p,p&&(e.adler=n.check=(n.flags?Oa:Ra)(n.check,o,p,a-p)),p=c,(n.flags?u:Ua(u))!==n.check){e.msg="incorrect data check",n.mode=30;break}l=u=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;l<32;){if(0===r)break e;r--,u+=i[s++]<<l,l+=8}if(u!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}l=u=0}n.mode=29;case 29:S=1;break e;case 30:S=-3;break e;case 31:return-4;default:return-2}return e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=r,n.hold=u,n.bits=l,(n.wsize||p!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&Ka(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,n.total+=p,n.wrap&&p&&(e.adler=n.check=(n.flags?Oa:Ra)(n.check,o,p,e.next_out-p)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==d&&0===p||4===t)&&0===S?-5:S},inflateEnd:function(e){var t;return e&&e.state?((t=e.state).window&&(t.window=null),e.state=null,0):-2},inflateGetHeader:function(e,t){return e&&e.state&&2&(e=e.state).wrap?((e.head=t).done=!1,0):-2},inflateSetDictionary:function(e,t){var n,i=t.length;return!e||!e.state||0!==(n=e.state).wrap&&11!==n.mode?-2:11===n.mode&&Ra(1,t,i,0)!==n.check?-3:Ka(e,t,i,i)?(n.mode=31,-4):(n.havedict=1,0)},inflateInfo:"pako inflate (from Nodeca project)"},Wa=!0,Ya=!0;try{String.fromCharCode.apply(null,[0])}catch(Cr){Wa=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(Cr){Ya=!1}for(var $a=new ma.Buf8(256),Ja=0;Ja<256;Ja++)$a[Ja]=252<=Ja?6:248<=Ja?5:240<=Ja?4:224<=Ja?3:192<=Ja?2:1;function Xa(e,t){for(var n,i,o=t||e.length,s=new Array(2*o),a=0,r=0;r<o;)if((n=e[r++])<128)s[a++]=n;else if(4<(i=$a[n]))s[a++]=65533,r+=i-1;else{for(n&=2===i?31:3===i?15:7;1<i&&r<o;)n=n<<6|63&e[r++],i--;1<i?s[a++]=65533:n<65536?s[a++]=n:(n-=65536,s[a++]=55296|n>>10&1023,s[a++]=56320|1023&n)}var c=s,u=a;if(u<65534&&(c.subarray&&Ya||!c.subarray&&Wa))return String.fromCharCode.apply(null,ma.shrinkBuf(c,u));for(var l="",d=0;d<u;d++)l+=String.fromCharCode(c[d]);return l}function Qa(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Za(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}$a[254]=$a[254]=1;var er={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},tr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},nr=Object.prototype.toString;function ir(e){if(!(this instanceof ir))return new ir(e);this.options=ma.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;if(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits)&&(t.windowBits=-15),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qa,this.strm.avail_out=0,(e=za.inflateInit2(this.strm,t.windowBits))!==er.Z_OK)throw new Error(tr[e]);if(this.header=new Za,za.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=function(e){for(var t,n,i,o,s=e.length,a=0,r=0;r<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new ma.Buf8(a),r=o=0;o<a;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(t.dictionary):"[object ArrayBuffer]"===nr.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(e=za.inflateSetDictionary(this.strm,t.dictionary))!==er.Z_OK)throw new Error(tr[e])}function or(e,t){if((t=new ir(t)).push(e,!0),t.err)throw t.msg||tr[t.err];return t.result}ir.prototype.push=function(e,t){var n,i,o,s,a,r=this.strm,c=this.options.chunkSize,u=this.options.dictionary,l=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?er.Z_FINISH:er.Z_NO_FLUSH,"string"==typeof e?r.input=function(e){for(var t=new ma.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t}(e):"[object ArrayBuffer]"===nr.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(0===r.avail_out&&(r.output=new ma.Buf8(c),r.next_out=0,r.avail_out=c),(n=(n=za.inflate(r,er.Z_NO_FLUSH))===er.Z_NEED_DICT&&u?za.inflateSetDictionary(this.strm,u):n)===er.Z_BUF_ERROR&&!0===l&&(n=er.Z_OK,l=!1),n!==er.Z_STREAM_END&&n!==er.Z_OK)return this.onEnd(n),!(this.ended=!0);!r.next_out||0!==r.avail_out&&n!==er.Z_STREAM_END&&(0!==r.avail_in||i!==er.Z_FINISH&&i!==er.Z_SYNC_FLUSH)||("string"===this.options.to?(o=function(e,t){for(var n=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+$a[e[n]]>t?n:t}(r.output,r.next_out),s=r.next_out-o,a=Xa(r.output,o),r.next_out=s,r.avail_out=c-s,s&&ma.arraySet(r.output,r.output,o,s,0),this.onData(a)):this.onData(ma.shrinkBuf(r.output,r.next_out))),0===r.avail_in&&0===r.avail_out&&(l=!0)}while((0<r.avail_in||0===r.avail_out)&&n!==er.Z_STREAM_END);return(i=n===er.Z_STREAM_END?er.Z_FINISH:i)===er.Z_FINISH?(n=za.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===er.Z_OK):i!==er.Z_SYNC_FLUSH||(this.onEnd(er.Z_OK),!(r.avail_out=0))},ir.prototype.onData=function(e){this.chunks.push(e)},ir.prototype.onEnd=function(e){e===er.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ma.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Ln={};var sr=((0,ma.assign)(Ln,{Inflate:ir,inflate:or,inflateRaw:function(e,t){return(t=t||{}).raw=!0,or(e,t)},ungzip:or},er),Ln),ar=s((function e(t){i(this,e),this._m=t,this._n="InflateModule",this._bLogForInflateOK=!1,this._bLogForInflateError=!1}),[{key:"inflate",value:function(e){e=new Uint8Array(e).slice(4);var t,n=Date.now();try{t=sr.inflate(e,{to:"string"}),this._bLogForInflateOK||(this._bLogForInflateOK=!0,new oi("inflateOK").end())}catch(o){return this._bLogForInflateError?void 0:(this._bLogForInflateError=!0,void new oi("inflateError").setMessage(o).end())}e=e.length+4;var i=t.length;return be.d("inflate ok. zipped:".concat(e," unzipped:").concat(i)+" compression ratio:".concat(Math.round(100*(i-e)/i),"% cost:").concat(Date.now()-n)),t}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._bLogForInflateOK=!1,this._bLogForInflateError=!1}}]),rr="Message",cr="User",ur="Group",lr="GroupMember",dr=["count"],pr=["conversationID","timePosition","timePeriod"],hr=["miniBirthday","maxBirthday"],gr=r(r(r(r({},rr,jn.CS),cr,jn.USER_CS),ur,jn.GRP_CS),lr,jn.MBR_CS),fr=(u(Ir,wn),s(Ir,[{key:"searchCloudMessages",value:function(e){return this.search(rr,e)}},{key:"searchCloudUsers",value:function(e){return this.search(cr,e)}},{key:"searchCloudGroups",value:function(e){return this.search(ur,e)}},{key:"searchCloudGroupMembers",value:function(e){return this.search(lr,e)}},{key:"search",value:function(e,t){var n=this,i="searchCloud".concat(e,"s"),o="".concat(this._n,".").concat(i);if(!t)return En({code:qn.OPTIONS_IS_EMPTY,message:this.getErrMsg(qn.OPTIONS_IS_EMPTY,i)});var s=t.keywordList,a=$e(s),r=t.count;if(t.count&&(r=parseInt(r)),e===rr&&!a&&!$e(t.senderUserIDList)&&!$e(t.messageTypeList)||e!==rr&&!a)throw be.e("[".concat(i,'] Missing required params: "keywordList".')),new Error("Params validate failed.");var c=Date.now(),u=new oi(i),l="keywordList:".concat(s," keywordListMatchType:").concat(t.keywordListMatchType," cursor:").concat(t.cursor," count:").concat(r);return be.l("".concat(o," ").concat(l)),this.req({P:gr[e],data:this._genParams(e,t)}).then((function(i){var s=(a=i.data).code,a=a.message;if(0!==s)return 60020===(r=s)?r="SearchUnable":e!==rr&&27003===s?r="SearchParamsError":e!==rr&&60018===s&&(r="SearchOverLimit"),r=n.getErrMsg(r)||a,a=new Bn({code:s,message:r}),u.setMessage(l).setError(a).end(),En(a);n.get(27).isCSPluginEnabled(),a=void 0===(r=(s=i.data).cursor)?"":r;var r=s.totalCount;return s="totalCount:".concat(r," cost:").concat(zt(c)),Cn({searchResultList:(be.l("".concat(o," ok. cursor:").concat(a," ").concat(s)),u.setMessage("".concat(l," ").concat(s)).end(),s=n._genRes(e,t,i.data)),cursor:a,totalCount:r})})).catch((function(e){return u.setMessage(l).setError(e).end(),En(e)}))}},{key:"_genParams",value:function(e,t){var n=t.count,i=f(t,dr);return n&&(i.count=parseInt(n)),e===rr?this._genMsgParams(i):(n=t.keywordList,t=t.keywordListMatchType,i.keywords=n,i.keywordMatchType="and"===t?1:0,e===cr?this._genUserParams(i):i)}},{key:"_genMsgParams",value:function(e){var t=e.conversationID,n=e.timePosition,i=e.timePeriod;return e=f(e,pr),lt(t)||(Et(t)&&(e.account=t.replace(E.CONV_C2C,"")),Tt(t)&&(e.groupID=t.replace(E.CONV_GROUP,""))),Ke(i)&&0<i&&(Ke(n)&&0<n?e.startTime=n-i:e.startTime=Se()-i),e.startTime&&e.startTime<0&&(e.startTime=void 0),Ke(n)&&0<n&&(e.endTime=n),e}},{key:"_genUserParams",value:function(e){var t=e.miniBirthday,n=e.maxBirthday;return e=f(e,hr),Ke(t)&&(e.miniBirthday=parseInt(t),Ke(n)||(e.maxBirthday=4294967295)),Ke(n)&&(e.maxBirthday=parseInt(n)),e}},{key:"_genRes",value:function(e,t,n){switch(e){case rr:return this._genMsgRes(n.searchResult,!t.conversationID);case cr:return this._genUserRes(n.userList);case ur:return this._genGrpRes(n.groupList);case lr:return this._genMemberRes(n.groupMemberList);default:return[]}}},{key:"_genMsgRes",value:function(e,t){var n=this.get(11);return Ye(e)&&0!==e.length?e.map((function(e){var i=e.groupID,o=e.userID,s=e.messageCount,a=(e=void 0===(e=e.messageList)?[]:e,{conversationID:o=i?"".concat(E.CONV_GROUP).concat(i):"".concat(E.CONV_C2C).concat(o),messageCount:s,messageList:[]});return t&&1<s||0<(s=e.filter((function(e){return!!e}))).length&&(e=n.onRoamingMessage(s,o,!1),i&&e.reverse(),a.messageList=e,a.messageCount=e.length),a})):[]}},{key:"_genUserRes",value:function(e){var t=this.get(4)._profileHandler;if(!Ye(e))return[];for(var n=[],i=0,o=e.length;i<o;i++){var s=(a=e[i]).userID,a=a.profileItems;"@TLS#NOT_FOUND"!==s&&""!==s&&(s=t._update(s,t._getLatestProfileFromResponse(s,a)).latestProfile,n.push(s))}return n}},{key:"_genGrpRes",value:function(e){if(!Ye(e))return[];for(var t=[],n=0,i=e.length;n<i;n++)e[n]&&e[n].groupID&&t.push(new zi(e[n]));return t}},{key:"_genMemberRes",value:function(e){if(!Ye(e))return[];for(var t,n,i,o,s,a,r=new Map,c=0,u=e.length;c<u;c++)e[c]&&e[c].userID&&e[c].groupID&&(n=(t=e[c]).groupID,o=t.name,s=t.type,a=t.avatar,i=t.nick,o={groupID:n,name:o,type:s,avatar:a},s={userID:t.userID,nick:i,nameCard:t.nameCard},r.has(n)?((a=r.get(n)).memberList.push(s),r.set(n,a)):r.set(n,{groupInfo:o,memberList:[s]}));return v(r.values())}}])),mr=s((function e(t){var n=this;i(this,e);var o,s=new oi("sdkConstruct"),a=(this._n="ModuleManager",this._isReady=!1,this._reason=qn.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._map=new Map,this._optionalModuleMap=new Map,this._codeMsgForTUIMap=new Map,this._iEmitter=null,this._oEmitter=null,this._checkCount=0,this._checkTimer=-1,this._map.set(12,new Io(this,t)),this._map.set(37,new ar(this)),this._map.set(15,new wo(this)),this._map.set(27,new Zs(this)),this._map.set(23,new Gs(this)),this._map.set(24,new Xs(this)),this._map.set(26,new js(this)),this._map.set(21,new Ms(this)),this._map.set(20,new Us(this)),this._map.set(1,new Co(this)),this._map.set(2,new Yo(this)),this._map.set(3,new $o(this)),this._map.set(34,new Jo(this)),this._map.set(31,new Xo(this)),this._map.set(4,new yo(this)),this._map.set(6,new Pi(this)),this._map.set(11,new Xi(this)),this._map.set(7,new lo(this)),this._map.set(10,new go(this)),this._map.set(13,new bo(this)),this._map.set(32,new oa(this)),this._map.set(14,new Lo(this)),this._map.set(17,new qo(this)),this._map.set(18,new Qo(this)),this._map.set(19,new Zo(this)),this._map.set(25,new xs(this)),this._map.set(8,new Js(this)),this._map.set(28,new ea(this)),this._map.set(36,new ta(this)),this._map.set(29,new na(this)),this._map.set(30,new ia(this)),this._map.set(33,new da(this)),this._map.set(35,new fa(this)),this._map.set(38,new fr(this)),this._eventThrottleMap=new Map,this._eventThrottling=t.eventThrottling,this._map.get(12).isPartialUpdatedConvs()&&(this._eventThrottling=!1),We(t.modules)?(Object.keys(t.modules).forEach((function(e){o=t.modules[e],"group-module"===e?n._map.set(7,new o(n)):"relationship-module"===e?n._map.set(8,new o(n)):"signaling-module"===e?n._map.set(33,new o(n)):"follow-module"===e?n._map.set(35,new o(n)):"cloud-search-module"===e&&n._map.set(38,new o(n)),n._optionalModuleMap.set(e,1)})),this._map.get(12).setUsingChatCore(!0)):this._map.has(7)||this._map.get(12).setUsingChatCore(!0),t.instanceID),r=t.SDKAppID,c=this._map.get(12).isIntl(),u=this._map.get(12).isUsingChatCore();a="instanceID:".concat(a," SDKAppID:").concat(r," isIntl:").concat(c," isUsingChatCore:").concat(u," host:").concat(bt())+" isIOSWebView:".concat(me," platform:").concat(oe," canIUseInflate:").concat(this.canIUseInflate())+" workerAvailable:".concat(he," eventThrottling:").concat(this._eventThrottling," UserAgent:").concat(ie),oi.bindEventStatModule(this._map.get(14)),oi.bindNetMonitorModule(this._map.get(15)),s.setMessage("".concat(a," ").concat(function(){var e="";if(Q)try{var t=ne.getSystemInfoSync(),n=t.model,i=t.version,o=t.system,s=t.platform,a=t.SDKVersion;e="model:".concat(n," version:").concat(i," system:").concat(o," platform:").concat(s," SDKVersion:").concat(a)}catch(r){e=""}return e}())).end(),be.i("SDK ".concat(a)),Bn.prototype._getErrMsg=this.getErrMsg.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}),[{key:"_startTimer",value:function(){var e=this._map.get(24),t=e.isWorkerEnabled();be.l("".concat(this._n,".startTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3)),be.l("".concat(this._n,"._startMainThreadTimer seed:").concat(this._checkTimer))}},{key:"stopTimer",value:function(){var e=this._map.get(24),t=e.isWorkerEnabled();be.l("".concat(this._n,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){be.l("".concat(this._n,"._stopMainThreadTimer")),0<this._checkTimer&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){be.l("".concat(this._n,"._stopMainThreadSocket"));var e=this._map.get(21);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){be.l("".concat(this._n,"._startMainThreadSocket"));var e=this._map.get(21);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){be.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){be.l("".concat(this._n,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=a(this._map);try{for(t.s();!(e=t.n()).done;){var n=_(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(i){t.e(i)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._map.get(1)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:"_onModuleReady",value:function(){var e,t,n=!0;this._readyList.forEach((function(e){e.isReady()||(n=!1)})),n&&!this._isReady&&(this._isReady=!0,this._oEmitter.emit(S.SDK_READY),e=Date.now()-this._startLoginTs,be.w("SDK is ready. cost ".concat(e," ms")),this._startLoginTs=Date.now(),t=this._ssoLogForReady.getStartTs()+Te,this._ssoLogForReady.setMessage(e).start(t).end())}},{key:"login",value:function(){0===this._startLoginTs&&(Ce(),this._startLoginTs=Date.now(),this._startTimer(),this._map.get(15).start(),this._ssoLogForReady=new oi("sdkReady"),this._reason=qn.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOEmitInst",value:function(){return null===this._oEmitter&&(this._oEmitter=new xo,e=this._oEmitter,Vn=e,this._oEmitter._emit=this._oEmitter.emit,this._oEmitter.emit=function(e,t){var n,i,o=this;this._canIUseSignaling()&&(e===S.MESSAGE_RECEIVED&&this.get(33).onNewMessageList(t),e===S.MESSAGE_MODIFIED)&&this.get(33).onMessageModified(t),e===S.CONVERSATION_LIST_UPDATED||e===S.FRIEND_LIST_UPDATED||e===S.GROUP_LIST_UPDATED||e===S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?!1!==this._eventThrottling?this._eventThrottleMap.has(e)?(n=Date.now())-(i=this._eventThrottleMap.get(e)).last<=1e3?(-1<i.timeoutID&&clearTimeout(i.timeoutID),i.timeoutID=setTimeout((function(){i.last=Date.now(),o._oEmitter._emit.apply(o._oEmitter,[e,{name:e,data:o._getEventData(e)}])}),1e3)):(i.last=n,this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:this._getEventData(e)}])):(this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:this._getEventData(e)}])):this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:this._getEventData(e)}]):this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:t}])}.bind(this)),this._oEmitter;var e}},{key:"_canIUseSignaling",value:function(){var e=this.get(33);return!!e&&e.canIUseSignaling()}},{key:"_getEventData",value:function(e){return e===S.CONVERSATION_LIST_UPDATED?this._map.get(12).isPartialUpdatedConvs()?this._map.get(11).getPartialUpdatedConvs():this._map.get(11).getLocalConvList():e===S.FRIEND_LIST_UPDATED?this._map.get(8).getLocalFriendList(!1):e===S.GROUP_LIST_UPDATED?this._map.get(7).getLocalGroupList():e===S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._map.get(11).getTotalUnreadCount():e===S.CONVERSATION_ID_LIST_UPDATED?this._map.get(11).getUpdatedConvIDList():void 0}},{key:"getIEmitInst",value:function(){return null===this._iEmitter&&(this._iEmitter=new xo,this._iEmitter._emit=this._iEmitter.emit,this._iEmitter.emit=function(e,t){e=We(t)&&t.data?[e,{name:e,data:t.data}]:[e,{name:e,data:t}],this._iEmitter._emit.apply(this._iEmitter,e)}.bind(this)),this._iEmitter}},{key:"hasModule",value:function(e){return this._map.has(e)}},{key:"get",value:function(e){return this._map.get(e)}},{key:"canIUseModule",value:function(e){return!this._map.get(12).isUsingChatCore()||this._optionalModuleMap.has(e)}},{key:"canIUseInflate",value:function(){return!!this._map.get(37)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.get(12).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"getErrMsg",value:function(e,t,n){return this._map.get(32).get({key:e,replacement1:t,replacement2:n,isIntl:this.isIntl()})}},{key:"warn",value:function(e,t,n){(e=this.getErrMsg(e,t,n))&&be.w(e)}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);be.w("Oops! ".concat(t)),new oi("error").setMessage(t).setLevel("error").end(),this.getOEmitInst().emit(S.ERROR,e)}},{key:"restartTimer",value:function(){be.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer();var e=this.get(7);e&&e.restartPolling()}},{key:"getTimerID",value:function(){var e=this._map.get(24);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(e){return this._map.get(7).getPollingTimerID(e)}},{key:"statTUIKeyFeatures",value:function(e){var t=e.code,n=t+(e=void 0===(e=e.msg)?"":e);this._codeMsgForTUIMap.has(n)||(this._codeMsgForTUIMap.set(n,1),n=this.get(12).getUIPlatform(),new oi("tui_key_features").setCode(t).setMessage(e).setUIPlatform(n).end())}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),Ce();var e,t=a(this._map);try{for(t.s();!(e=t.n()).done;){var n=_(e.value,2)[1];n.reset&&n.reset()}}catch(r){t.e(r)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._oEmitter.emit(S.SDK_NOT_READY);var i,o=a(this._eventThrottleMap);try{for(o.s();!(i=o.n()).done;){var s=_(i.value,2)[1];-1<s.timeoutID&&clearTimeout(s.timeoutID)}}catch(r){o.e(r)}finally{o.f()}this._eventThrottleMap.clear(),this._codeMsgForTUIMap.clear()}}]),_r=s((function e(t){i(this,e),this._funcMap=new Map,this._m=t,this._n="SafetyCallback",this._reportCount=0}),[{key:"defense",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var i=null;return this._funcMap.get(e).has(t)?i=this._funcMap.get(e).get(t):(i=this._pack(e,t,n),this._funcMap.get(e).set(t,i)),i}},{key:"defenseOnce",value:function(e,t){return"function"!=typeof t?null:this._pack(e,t,2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.warn("ListenerFnNotFound",e),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&!!this._funcMap.has(e)&&!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)}},{key:"_pack",value:function(e,t,n){var i=this;return function(){try{t.apply(n,Array.from(arguments))}catch(a){var o=Object.values(S).indexOf(e),s="CallbackError";-1!==o&&(o=Object.keys(S)[o],i._m.warn(s,o,a)),i._reportCount<5&&(new oi(s).setMessage("eventName:".concat(e)).setMoreMessage(a.message).end(),i._reportCount+=1)}}}},{key:"destroy",value:function(){this._funcMap.clear()}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._reportCount=0}}]),vr=s((function e(t){i(this,e),t={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Ot(),devMode:t.devMode||!1,testEnv:t.testEnv||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0,eventThrottling:!1!==t.eventThrottling,partialUpdatedConversations:!0===t.partialUpdatedConversations,disableIndependentDomain:!0===t.disableIndependentDomain,modules:t.modules||void 0},this._m=new mr(t),this._safetyCallbackFactory=new _r(this._m)}),[{key:"onError",value:function(e){this._m.onError(e)}},{key:"login",value:function(e){return this._m.login(),this._get(1).login(e)}},{key:"logout",value:function(){var e=this;return this._get(1).logout().then((function(t){return e._safetyCallbackFactory.reset(),e._m.reset(),t}))}},{key:"getLoginUser",value:function(){return this._get(1).getLoginUser()}},{key:"getServerTime",value:function(){return ke()}},{key:"isReady",value:function(){return this._m.isReady()}},{key:"isIntl",value:function(){return this._m.isIntl()}},{key:"getNotReadyReason",value:function(){return this._m.getNotReadyReason()}},{key:"getErrMsg",value:function(e,t,n){return this._m.getErrMsg(e,t,n)}},{key:"_get",value:function(e){return this._m.get(e)}},{key:"destroy",value:function(){var e=this,t=this._get(12),n=t.getSDKAppID();return be.w("destroy ".concat(n," ").concat(t.getInstanceID())),this.logout().finally((function(){e._safetyCallbackFactory.destroy(),e._m.stopTimer(),e._get(24).terminate(),e._get(21).dealloc(),e._m.getOEmitInst().emit(S.SDK_DESTROY,{SDKAppID:n})}))}},{key:"on",value:function(e,t,n){be.d("on","eventName:".concat(e)),this._m.getOEmitInst().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){be.d("once","eventName:".concat(e)),this._m.getOEmitInst().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,i){be.d("off","eventName:".concat(e));var o=this._safetyCallbackFactory.find(e,t);null!==o&&(this._m.getOEmitInst().off(e,o,n,i),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){(lt(e["tim-push"])?lt(e["tim-offline-push-plugin"])?this._get(18):this._get(28):this._get(36)).registerPlugin(e)}},{key:"setLogLevel",value:function(e){var t;e<=0&&((t=this.getErrMsg("TIM_ASCII_ART"))&&console.log(t),(t=this.getErrMsg("API_REFER"))&&(Vt()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",t):console.log("IM SDK API ->",t)),(t=this.getErrMsg("DOCS_GUIDE"))&&console.log(t),t=this.getErrMsg("IOS_WEBVIEW_WARNING"),me)&&t&&console.warn(t),be.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._get(2).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._get(2).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._get(2).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._get(2).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._get(2).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._get(2).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._get(2).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._get(2).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==E.MSG_MERGER?En({code:qn.MSG_MERGER_TYPE_INVALID}):qe(e.payload.downloadKey)?En({code:qn.MSG_MERGER_KEY_INVALID}):this._get(2).downloadMergerMessage(e).catch((function(e){return En({code:qn.MSG_MERGER_DOWNLOAD_FAIL})}))}},{key:"createForwardMessage",value:function(e){return this._get(2).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof ki?this._get(2).sendMessageInstance(e,t):En({code:qn.MSG_INSTANCE_REQUIRED})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._get(31).sendMessage(t):"handleGroupInvitation"===e?this._get(7).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._get(27).isFeatureEnabled(t):"isFeatureEnabledForStat"===e?this._get(27).isFeatureEnabledForStat(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._get(30).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"===e?(this._get(12).setApplicationID(t),void this._get(20).updateProtocolConfig()):"getServerConfig"===e?this._get(23).getServerConfig(t):"canIUseModule"===e?this._m.canIUseModule(t):"startMessageLongPolling"===e?this._get(7).startMessageLongPolling(t):"stopMessageLongPolling"===e?this._get(7).stopMessageLongPolling(t):"disableMessagePullOnInvite"===e?this._get(11).disableMsgPullOnInvite(t):"clearLocalMessage"===e?this._get(11).clearMemMsg(t,!1):"setCustomLoginInfo"===e?this._get(12).setCustomLoginInfo(t):"statTUIKeyFeatures"===e?this._m.statTUIKeyFeatures(t):"getGroupReceiptsByUsers"===e?this._get(7).getGroupReceiptsByUsers(t):En({code:qn.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._get(2).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof ki?this._get(2).resendMessage(e,t):En({code:qn.MSG_INSTANCE_REQUIRED})}},{key:"deleteMessage",value:function(e){return this._get(2).deleteMessage(e)}},{key:"translateText",value:function(e){return this._get(2).translateText(e)}},{key:"convertVoiceToText",value:function(e){return this._get(2).convertVoiceToText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._get(3).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._get(3).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._get(3).deleteMessageExtensions(e,t)}},{key:"addMessageReaction",value:function(e,t){return this._get(34).addMessageReaction(e,t)}},{key:"removeMessageReaction",value:function(e,t){return this._get(34).removeMessageReaction(e,t)}},{key:"getMessageReactions",value:function(e){return this._get(34).getMessageReactions(e)}},{key:"getAllUserListOfMessageReaction",value:function(e){return this._get(34).getAllUserListOfMessageReaction(e)}},{key:"modifyMessage",value:function(e){return this._get(2).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._get(11).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._get(11).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._get(11).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._get(11).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){var t=this._get(7);return t?t.getReadReceiptDetail(e):En({code:qn.NO_MODULE})}},{key:"findMessage",value:function(e){return this._get(11).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._get(11).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._get(11).getConvList(e)}},{key:"getConversationProfile",value:function(e){return this._get(11).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._get(11).deleteConversation(e)}},{key:"setConversationDraft",value:function(e){return this._get(11).setConvDraft(e)}},{key:"clearHistoryMessage",value:function(e){return this._get(11).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._get(11).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._get(11).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._get(11).setMessageRemindType(e)}},{key:"setAllReceiveMessageOpt",value:function(e){return this._get(11).setAllRcvMsgOpt(e)}},{key:"getAllReceiveMessageOpt",value:function(){return this._get(11).getAllRcvMsgOpt()}},{key:"getTotalUnreadMessageCount",value:function(){return this._get(11).getTotalUnreadCount()}},{key:"setConversationCustomData",value:function(e){return this._get(11).setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._get(11).markConv(e)}},{key:"getConversationGroupList",value:function(){return this._get(11).getConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._get(11).createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._get(11).deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._get(11).renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._get(11).addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._get(11).deleteConvsFromGroup(e)}},{key:"searchCloudMessages",value:function(e){var t=this._get(38);return t?t.searchCloudMessages(e):En({code:qn.NO_MODULE})}},{key:"searchCloudUsers",value:function(e){var t=this._get(38);return t?t.searchCloudUsers(e):En({code:qn.NO_MODULE})}},{key:"searchCloudGroups",value:function(e){var t=this._get(38);return t?t.searchCloudGroups(e):En({code:qn.NO_MODULE})}},{key:"searchCloudGroupMembers",value:function(e){var t=this._get(38);return t?t.searchCloudGroupMembers(e):En({code:qn.NO_MODULE})}},{key:"getMyProfile",value:function(){return this._get(4).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._get(4).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._get(4).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._get(4).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._get(4).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._get(4).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._get(4).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._get(4).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._get(4).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._get(4).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._get(8);return e?e.getLocalFriendList():En({code:qn.NO_MODULE})}},{key:"addFriend",value:function(e){var t=this._get(8);return t?t.addFriend(e):En({code:qn.NO_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._get(8);return t?t.deleteFriend(e):En({code:qn.NO_MODULE})}},{key:"checkFriend",value:function(e){var t=this._get(8);return t?t.checkFriend(e):En({code:qn.NO_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._get(8);return t?t.getFriendProfile(e):En({code:qn.NO_MODULE})}},{key:"updateFriend",value:function(e){var t=this._get(8);return t?t.updateFriend(e):En({code:qn.NO_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._get(8);return e?e.getLocalFriendApplicationList():En({code:qn.NO_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._get(8);return t?t.acceptFriendApplication(e):En({code:qn.NO_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._get(8);return t?t.refuseFriendApplication(e):En({code:qn.NO_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._get(8);return t?t.deleteFriendApplication(e):En({code:qn.NO_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._get(8);return e?e.setFriendApplicationRead():En({code:qn.NO_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._get(8);return e?e.getLocalFriendGroupList():En({code:qn.NO_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._get(8);return t?t.createFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._get(8);return t?t.deleteFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._get(8);return t?t.addToFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._get(8);return t?t.removeFromFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._get(8);return t?t.renameFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"followUser",value:function(e){var t=this._get(35);return t?t.followUser(e):En({code:qn.NO_MODULE})}},{key:"unfollowUser",value:function(e){var t=this._get(35);return t?t.unfollowUser(e):En({code:qn.NO_MODULE})}},{key:"getMyFollowersList",value:function(e){var t=this._get(35);return t?t.getMyFollowersList(e):En({code:qn.NO_MODULE})}},{key:"getMyFollowingList",value:function(e){var t=this._get(35);return t?t.getMyFollowingList(e):En({code:qn.NO_MODULE})}},{key:"getMutualFollowersList",value:function(e){var t=this._get(35);return t?t.getMutualFollowersList(e):En({code:qn.NO_MODULE})}},{key:"getUserFollowInfo",value:function(e){var t=this._get(35);return t?t.getUserFollowInfo(e):En({code:qn.NO_MODULE})}},{key:"checkFollowType",value:function(e){var t=this._get(35);return t?t.checkFollowType(e):En({code:qn.NO_MODULE})}},{key:"getGroupList",value:function(){var e=this._get(7);return e?e.getGroupList():En({code:qn.NO_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._get(7);return t?t.getGroupProfile(e):En({code:qn.NO_MODULE})}},{key:"createGroup",value:function(e){var t=this._get(7);return t?t.createGroup(e):En({code:qn.NO_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._get(7);return t?t.dismissGroup(e):En({code:qn.NO_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._get(7);return t?t.updateGroupProfile(e):En({code:qn.NO_MODULE})}},{key:"joinGroup",value:function(e){var t=this._get(7);return t?t.joinGroup(e):En({code:qn.NO_MODULE})}},{key:"quitGroup",value:function(e){var t=this._get(7);return t?t.quitGroup(e):En({code:qn.NO_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._get(7);return t?t.searchGroupByID(e):En({code:qn.NO_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._get(7);return t?t.getGroupOnlineMemberCount(e):En({code:qn.NO_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._get(7);return t?t.changeGroupOwner(e):En({code:qn.NO_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._get(7);return e?e.getGroupApplicationList():En({code:qn.NO_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._get(7);return t?t.handleGroupApplication(e):En({code:qn.NO_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._get(7);return t?t.initGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._get(7);return t?t.setGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._get(7);return t?t.deleteGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._get(7);return t?t.getGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._get(7);return t?t.setGroupCounters(e):En({code:qn.NO_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._get(7);return t?t.increaseGroupCounter(e):En({code:qn.NO_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._get(7);return t?t.decreaseGroupCounter(e):En({code:qn.NO_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._get(7);return t?t.getGroupCounters(e):En({code:qn.NO_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._get(7);return t?t.getGroupMemberList(e):En({code:qn.NO_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._get(7);return t?t.getGroupMemberProfile(e):En({code:qn.NO_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._get(7);return t?t.addGroupMember(e):En({code:qn.NO_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._get(7);return t?t.deleteGroupMember(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._get(7);return t?t.setGroupMemberMuteTime(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._get(7);return t?t.setGroupMemberRole(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._get(7);return t?t.setGroupMemberNameCard(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._get(7);return t?t.setGroupMemberCustomField(e):En({code:qn.NO_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._get(7);return t?t.markGroupMemberList(e):En({code:qn.NO_MODULE})}},{key:"getJoinedCommunityList",value:function(){return this._get(10).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._get(10).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._get(10).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._get(10).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._get(10).getTopicList(e)}},{key:"addSignalingListener",value:function(e,t,n){var i=this._get(33);i&&i.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"removeSignalingListener",value:function(e,t,n){var i,o=this._safetyCallbackFactory.find(e,t);null!==o&&(i=this._get(33))&&(i.removeSignalingListener(e,o,n),this._safetyCallbackFactory.delete(e,t))}},{key:"invite",value:function(e){var t=this._get(33);return t?t.invite(e):En({code:qn.NO_MODULE})}},{key:"inviteSync",value:function(e,t,n){var i=this._get(33);return i?i.inviteSync(e,t,n):""}},{key:"inviteInGroup",value:function(e){var t=this._get(33);return t?t.invite(e):En({code:qn.NO_MODULE})}},{key:"inviteInGroupSync",value:function(e,t,n){var i=this._get(33);return i?i.inviteSync(e,t,n):""}},{key:"cancel",value:function(e){var t=this._get(33);return t?t.cancel(e):En({code:qn.NO_MODULE})}},{key:"accept",value:function(e){var t=this._get(33);return t?t.accept(e):En({code:qn.NO_MODULE})}},{key:"reject",value:function(e){var t=this._get(33);return t?t.reject(e):En({code:qn.NO_MODULE})}},{key:"getSignalingInfo",value:function(e){var t=this._get(33);return t?t.getSignalingInfo(e):null}},{key:"modifyInvitation",value:function(e){var t=this._get(33);return t?t.modifyInvitation(e):En({code:qn.NO_MODULE})}}]),yr={login:1,logout:1,getLoginUser:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1,isReady:1,addSignalingListener:1,removeSignalingListener:1,callExperimentalAPI:1};function Ir(e){return i(this,Ir),(e=n(this,Ir,[e]))._n="CSModule",e}var Mr={};return(Un={}).create=function(e){var t,n,i,o="TencentCloudChat.create",s=0;if(Ke(i=e.SDKAppID))s=i;else if(s=parseInt(i),isNaN(i))return be.e("".concat(o," failed. Failed to parse the SDKAppID, please check the arguments")),null;return s&&Mr[s]?Mr[s]:(be.l("".concat(o)),(i=new vr(g(g({},e),{},{SDKAppID:s}))).on(S.SDK_DESTROY,(function(e){Mr[e.data.SDKAppID]=null,delete Mr[e.data.SDKAppID]})),t=i,n=Object.create(null),Object.keys(Fn).forEach((function(e){var i;t[e]&&(i=new k,n[e]=function(){var n=Array.from(arguments);return i.use((function(n,i){a=e;var o,s,a=!(!(o=t).isReady()&&1!==yr[a])||(s={code:s=o.getNotReadyReason(),message:"".concat(o.getErrMsg(s)," | ").concat(a," | ").concat(o.getErrMsg(qn.SDK_IS_NOT_READY))},o.onError(s),s);return!0===a?i():En(a)})).use((function(t,n){if(!0===function(e,t,n){if(void 0===t)return!0;var i=!0;if(We(t))Object.keys(t).forEach((function(o){var s=1===e.length?e[0][o]:void 0;i=!!Yt(s,t[o],n,o)&&i}));else if(Ye(t))for(var o=0;o<t.length;o++)i=!!Yt(e[o],t[o],n,t[o].name)&&i;if(i)return i;throw new Error("Params validate failed.")}(t,xn[e],e))return n()})).use((function(n,i){return t[e].apply(t,n)})),i.run(n)})})),e=n,Mr[s]=e,xn.hookGetAPITips(i.getErrMsg.bind(i)),be.l("".concat(o," ok")),e)},Un.TYPES=E,Un.EVENT=S,Un.TSignaling=T,Un.VERSION="3.5.5",be.l("TencentCloudChat.VERSION:".concat(Un.VERSION)),Un}();const Ng=bg(Pg.exports);var wg={exports:{}};wg.exports=function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){a(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){if(null==e)return{};var n,i,o=function(e,t){if(null==e)return{};var n,i,o={},s=Object.keys(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=void 0!==Og?Og:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},u=void 0!==Pn&&"function"==typeof Pn.getSystemInfoSync&&Boolean(Pn.getSystemInfoSync().fontSizeSetting),l="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),d="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),p="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),h="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),g=void 0!==Nn&&"undefined"==typeof window&&"function"==typeof Nn.requireNativePlugin,f=g&&"ios"===Nn.getDeviceInfo().platform.toLocaleLowerCase(),m=(g&&Nn.getDeviceInfo().platform.toLocaleLowerCase(),u||l||d||p||h||g),_=void 0!==c&&(void 0!==c.nativeModuleProxy||void 0!==c.ReactNative),v=l?qq:d?tt:p?swan:h?my:u?Pn:g?Nn:{},y=function(e){if("object"!==n(e)||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var i=t;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return t===i};function I(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(y(e)){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1}var M=function(){function e(){i(this,e),this._n="WebRequest"}return s(e,[{key:"request",value:function(e,n){var i=this,o="".concat(this._n,".request"),s=e.downloadUrl||"",a=(e.method||"PUT").toUpperCase(),r=e.url;if(console.log("%c tim-upload-plugin %c","background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent","".concat(o," URL:").concat(r)),e.qs){var c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"=";return I(e)?"":y(e)?Object.keys(e).map((function(i){var o=encodeURIComponent(i)+n;return Array.isArray(e[i])?e[i].map((function(e){return o+encodeURIComponent(e)})).join(t):o+encodeURIComponent(e[i])})).filter(Boolean).join(t):void 0}(e.qs);c&&(r+="".concat(-1===r.indexOf("?")?"?":"&").concat(c))}var u=new XMLHttpRequest;u.open(a,r,!0),u.responseType=e.dataType||"text";var l=e.headers||{};if(e.uploadByIP&&(l=t(t({},l),{},{host:e.uploadIP})),!I(l))for(var d in l)l.hasOwnProperty(d)&&"content-length"!==d.toLowerCase()&&"user-agent"!==d.toLowerCase()&&"origin"!==d.toLowerCase()&&"host"!==d.toLowerCase()&&u.setRequestHeader(d,l[d]);return u.onload=function(){if(200===u.status)n(null,i._xhrRes(u,i._xhrBody(u,s,e.uploadByIP&&e.uploadIP),l));else{if(e.uploadIP&&-1===e.url.indexOf(e.uploadIP))return e.url=(o=e.url,a=e.uploadIP,o.replace(/^http(s)?:\/\/(.*?)\//,"https://".concat(a,"/"))),e.uploadByIP=!0,i.request(e,n);var t={code:u.status,message:JSON.stringify(u.responseText)};n(t,i._xhrRes(u,i._xhrBody(u,s,e.uploadByIP&&e.uploadIP),l))}var o,a},u.onerror=function(t){var o=i._xhrBody(u,s,e.uploadByIP&&e.uploadIP),a={code:u.status,message:JSON.stringify(u.responseText)};o||u.statusText||0!==u.status||(t.message="CORS blocked or network error"),n(a,i._xhrRes(u,o)),a=null},e.onProgress&&u.upload&&(u.upload.onprogress=function(t){var n=t.total,i=t.loaded,o=Math.floor(100*i/n);e.onProgress({total:n,loaded:i,percent:(o>=100?100:o)/100})}),u.send(e.resources),u}},{key:"_xhrRes",value:function(e,t){var n={};return e.getAllResponseHeaders().trim().split("\n").forEach((function(e){if(e){var t=e.indexOf(":"),i=e.substr(0,t).trim().toLowerCase(),o=e.substr(t+1).trim();n[i]=o}})),{statusCode:e.status,statusMessage:e.statusText,headers:n,data:t}}},{key:"_xhrBody",value:function(e,t,n){return 200===e.status&&t?{location:t,uploadIP:n}:{response:e.responseText,uploadIP:n}}}]),e}(),C=["unknown","image","video","audio","log"],S=["name"],E=function(){function e(){i(this,e)}return s(e,[{key:"request",value:function(e,n){var i=this,o=e.resources,s=void 0===o?"":o,a=e.headers,c=void 0===a?{}:a,u=e.url,l=e.downloadUrl,d=void 0===l?"":l,p=u,g=null,m=d.match(/^(https?:\/\/[^/]+\/)([^/]*\/?)(.*)$/),_=decodeURIComponent(m[3]),y=_.indexOf("?")>-1?_.split("?")[0]:_,I={key:e.fileKey?e.fileKey:y,success_action_status:200,"Content-Type":""},M={};if(f){var E=u.split("?sign=");if(E.length>1){var T=E[1];p="".concat(E[0],"?sign=").concat(encodeURIComponent("".concat(T))),M.sign=decodeURIComponent(T),M.signature=decodeURIComponent(T)}}var k={url:p,header:c,name:"file",filePath:s,formData:t(t({},I),M),timeout:e.timeout||3e5};if(h){var D=k;D.name,k=t(t({},r(D,S)),{},{fileName:"file",fileType:C[e.fileType]})}return(g=v.uploadFile(t(t({},k),{},{success:function(e){i._handleResponse({response:e,downloadUrl:d,callback:n})},fail:function(e){i._handleResponse({response:e,downloadUrl:d,callback:n})}}))).onProgressUpdate&&g.onProgressUpdate((function(t){e.onProgress&&e.onProgress({total:t.totalBytesExpectedToSend,loaded:t.totalBytesSent,percent:Math.floor(t.progress)/100})})),g}},{key:"_handleResponse",value:function(e){var n=e.downloadUrl,i=e.response,o=e.callback,s=i.header,a={};if(s)for(var r in s)s.hasOwnProperty(r)&&(a[r.toLowerCase()]=s[r]);var c=+i.statusCode;200===c?o(null,{statusCode:c,headers:a,data:t(t({},i.data),{},{location:n})}):o({code:c,message:JSON.stringify(i.data)},{statusCode:c,headers:a,data:void 0})}}]),e}(),T=function(){function e(){i(this,e)}return s(e,[{key:"request",value:function(e,t){var n=this,i=e.resources,o=void 0===i?"":i,s=e.fileKey,a=void 0===s?"":s,r=e.url,c=e.downloadUrl,u=void 0===c?"":c,l=new FormData;l.append("key",a),l.append("success_action_status",200),l.append("file",{uri:o,type:"application/octet-stream",name:"uploaded_file"}),fetch(r,{method:"POST",headers:{"Content-Type":"multipart/form-data"},body:l}).then((function(e){n._handleResponse({response:e,downloadUrl:u,callback:t})})).catch((function(e){n._handleResponse({response:e,downloadUrl:u,callback:t})}))}},{key:"_handleResponse",value:function(e){var t=e.downloadUrl,n=e.response,i=e.callback,o=n.headers,s=n.status,a=o&&o.map||{};200===s?i(null,{statusCode:200,headers:a,data:{location:t}}):i({code:s,message:JSON.stringify(n)},{statusCode:s,headers:a,data:void 0})}}]),e}();return function(){function e(){i(this,e),this.retry=1,this.tryCount=0,this.systemClockOffset=0,this.httpRequest=m?new E:_?new T:new M,console.log("TIMUploadPlugin.VERSION: ".concat("1.4.2"))}return s(e,[{key:"uploadFile",value:function(e,t){var n=this;return this.httpRequest.request(e,(function(i,o){i&&n.tryCount<n.retry&&n.allowRetry(i)?(n.tryCount++,n.uploadFile(e,t)):(n.tryCount=0,t(i,o))}))}},{key:"allowRetry",value:function(e){var t=!1,n=!1;if(e){var i=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var o=e.error&&e.error.Code,s=e.error&&e.error.Message;("RequestTimeTooSkewed"===o||"AccessDenied"===o&&"Request has expired"===s)&&(n=!0)}catch(c){}if(n&&i){var a=Date.now(),r=Date.parse(i);Math.abs(a+this.systemClockOffset-r)>=3e4&&(this.systemClockOffset=r-a,t=!0)}else 5===Math.floor(e.statusCode/100)&&(t=!0)}return t}}],[{key:"getVersion",value:function(){return"1.4.2"}}]),e}()}();const Ug=bg(wg.exports);var Gg={exports:{}};Gg.exports=function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(o=void 0,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i.key,"string"))?o:String(o)),i)}var o}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,s,a,r=[],c=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=s.call(n)).done)&&(r.push(i.value),r.length!==t);c=!0);}catch(l){u=!0,o=l}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return r}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=s(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){c=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(c)throw a}}}}var c,u,l=function(){for(var e=" \t\r\n~!@#$%^&*()_+-=【】、{}|;':\",。、《》?αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩①②③④⑤⑥⑦⑧⑨⑩⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇≈≡≠=≤≥<>≮≯∷±+-×÷/∫∮∝∞∧∨∑∏∪∩∈∵∴⊥∥∠⌒⊙≌∽√§№☆★○●◎◇◆□℃‰€■△▲※→←↑↓〓¤°#&@\︿_ ̄―♂♀┌┍┎┐┑┒┓─┄┈├┝┞┟┠┡┢┣│┆┊┬┭┮┯┰┱┲┳┼┽┾┿╀╁╂╃└┕┖┗┘┙┚┛━┅┉┤┥┦┧┨┩┪┫┃┇┋┴┵┶┷┸┹┺┻╋╊╉╈╇╆╅╄",t=new Map,n=0,i=e.length;n<i;n++)t.set(e.charCodeAt(0),!0);return t}(),d=function(){function t(n){e(this,t);var i,s=n.input,a=n.isArray,r=n.isMap;this._trieTree={},a(s)?i=s:r(s)&&(i=o(s.keys()),this._map=s);for(var c=0,u=i.length;c<u;c++)if(i[c]){for(var l=this._trieTree,d=i[c],p=0,h=d.length;p<h;p++)l[d[p]]||(l[d[p]]={}),l=l[d[p]];l.isEnd=!0}}return n(t,[{key:"filter",value:function(e){var t=e.text,n=e.replacingEnabled;if(0===Object.keys(this._trieTree).length)return{isMatched:!1,modifiedText:t};for(var i=this._trieTree,o=t.toLowerCase(),s="",a=!1,r=o.length,c=0;c<r;c++)if(!0!==l.get(o.charCodeAt(c))){for(var u=0,d="",p=!1,h=c;h<r;h++){if(!i[o[h]]){i=this._trieTree;break}if(d+=o[h],i[o[h]].isEnd){p=!0,u=h-c,i=this._trieTree;break}i=i[o[h]]}if(u>1&&(c+=u),p){if(a=!0,!n)break;var g=this._map.get(d)||"*";s=t.replace(new RegExp(d,"gi"),g)}}return{isMatched:a,modifiedText:s}}},{key:"reset",value:function(){this._trieTree={},this._map=null}}]),t}(),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==Og?Og:"undefined"!=typeof self?self:{},h={},g=(c=function(e,t){var n,i,o,s,a,r,c,u,l,d,g,f,m;e.exports=(r=r||function(e){var t;if("undefined"!=typeof window&&window.crypto&&(t=window.crypto),!t&&"undefined"!=typeof window&&window.msCrypto&&(t=window.msCrypto),!t&&void 0!==p&&p.crypto&&(t=p.crypto),!t)try{t=h}catch(m){}var n=function(){if(t){if("function"==typeof t.getRandomValues)try{return t.getRandomValues(new Uint32Array(1))[0]}catch(m){}if("function"==typeof t.randomBytes)try{return t.randomBytes(4).readInt32LE()}catch(m){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),o={},s=o.lib={},a=s.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},r=s.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes,o=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<o;s++){var a=n[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(s=0;s<o;s+=4)t[i+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i<e;i+=4)t.push(n());return new r.init(t,e)}}),c=o.enc={},u=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var s=t[o>>>2]>>>24-o%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new r.init(n,t/2)}},l=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var s=t[o>>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new r.init(n,t)}},d=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},g=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new r.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,i=this._data,o=i.words,s=i.sigBytes,a=this.blockSize,c=s/(4*a),u=(c=t?e.ceil(c):e.max((0|c)-this._minBufferSize,0))*a,l=e.min(4*u,s);if(u){for(var d=0;d<u;d+=a)this._doProcessBlock(o,d);n=o.splice(0,u),i.sigBytes-=l}return new r.init(n,l)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(s.Hasher=g.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new f.HMAC.init(e,n).finalize(t)}}}),o.algo={});return o}(Math),a=(s=r).lib.WordArray,s.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,i=this._map;e.clamp();for(var o=[],s=0;s<n;s+=3)for(var a=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,r=0;r<4&&s+.75*r<n;r++)o.push(i.charAt(a>>>6*(3-r)&63));var c=i.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<n.length;o++)i[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var r=e.indexOf(s);-1!==r&&(t=r)}return function(e,t,n){for(var i=[],o=0,s=0;s<t;s++)if(s%4){var r=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=r<<24-o%4*8,o++}return a.create(i,o)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,o=e[i];e[i]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var s=this._hash.words,r=e[t+0],c=e[t+1],h=e[t+2],g=e[t+3],f=e[t+4],m=e[t+5],_=e[t+6],v=e[t+7],y=e[t+8],I=e[t+9],M=e[t+10],C=e[t+11],S=e[t+12],E=e[t+13],T=e[t+14],k=e[t+15],D=s[0],R=s[1],O=s[2],b=s[3];D=u(D,R,O,b,r,7,a[0]),b=u(b,D,R,O,c,12,a[1]),O=u(O,b,D,R,h,17,a[2]),R=u(R,O,b,D,g,22,a[3]),D=u(D,R,O,b,f,7,a[4]),b=u(b,D,R,O,m,12,a[5]),O=u(O,b,D,R,_,17,a[6]),R=u(R,O,b,D,v,22,a[7]),D=u(D,R,O,b,y,7,a[8]),b=u(b,D,R,O,I,12,a[9]),O=u(O,b,D,R,M,17,a[10]),R=u(R,O,b,D,C,22,a[11]),D=u(D,R,O,b,S,7,a[12]),b=u(b,D,R,O,E,12,a[13]),O=u(O,b,D,R,T,17,a[14]),D=l(D,R=u(R,O,b,D,k,22,a[15]),O,b,c,5,a[16]),b=l(b,D,R,O,_,9,a[17]),O=l(O,b,D,R,C,14,a[18]),R=l(R,O,b,D,r,20,a[19]),D=l(D,R,O,b,m,5,a[20]),b=l(b,D,R,O,M,9,a[21]),O=l(O,b,D,R,k,14,a[22]),R=l(R,O,b,D,f,20,a[23]),D=l(D,R,O,b,I,5,a[24]),b=l(b,D,R,O,T,9,a[25]),O=l(O,b,D,R,g,14,a[26]),R=l(R,O,b,D,y,20,a[27]),D=l(D,R,O,b,E,5,a[28]),b=l(b,D,R,O,h,9,a[29]),O=l(O,b,D,R,v,14,a[30]),D=d(D,R=l(R,O,b,D,S,20,a[31]),O,b,m,4,a[32]),b=d(b,D,R,O,y,11,a[33]),O=d(O,b,D,R,C,16,a[34]),R=d(R,O,b,D,T,23,a[35]),D=d(D,R,O,b,c,4,a[36]),b=d(b,D,R,O,f,11,a[37]),O=d(O,b,D,R,v,16,a[38]),R=d(R,O,b,D,M,23,a[39]),D=d(D,R,O,b,E,4,a[40]),b=d(b,D,R,O,r,11,a[41]),O=d(O,b,D,R,g,16,a[42]),R=d(R,O,b,D,_,23,a[43]),D=d(D,R,O,b,I,4,a[44]),b=d(b,D,R,O,S,11,a[45]),O=d(O,b,D,R,k,16,a[46]),D=p(D,R=d(R,O,b,D,h,23,a[47]),O,b,r,6,a[48]),b=p(b,D,R,O,v,10,a[49]),O=p(O,b,D,R,T,15,a[50]),R=p(R,O,b,D,m,21,a[51]),D=p(D,R,O,b,S,6,a[52]),b=p(b,D,R,O,g,10,a[53]),O=p(O,b,D,R,M,15,a[54]),R=p(R,O,b,D,c,21,a[55]),D=p(D,R,O,b,y,6,a[56]),b=p(b,D,R,O,k,10,a[57]),O=p(O,b,D,R,_,15,a[58]),R=p(R,O,b,D,E,21,a[59]),D=p(D,R,O,b,f,6,a[60]),b=p(b,D,R,O,C,10,a[61]),O=p(O,b,D,R,h,15,a[62]),R=p(R,O,b,D,I,21,a[63]),s[0]=s[0]+D|0,s[1]=s[1]+R|0,s[2]=s[2]+O|0,s[3]=s[3]+b|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var s=e.floor(i/4294967296),a=i;n[15+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(n.length+1),this._process();for(var r=this._hash,c=r.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,i,o,s,a){var r=e+(t&n|~t&i)+o+a;return(r<<s|r>>>32-s)+t}function l(e,t,n,i,o,s,a){var r=e+(t&i|n&~i)+o+a;return(r<<s|r>>>32-s)+t}function d(e,t,n,i,o,s,a){var r=e+(t^n^i)+o+a;return(r<<s|r>>>32-s)+t}function p(e,t,n,i,o,s,a){var r=e+(n^(t|~i))+o+a;return(r<<s|r>>>32-s)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),u=(c=r).lib,l=u.WordArray,d=u.Hasher,g=c.algo,f=[],m=g.SHA1=d.extend({_doReset:function(){this._hash=new l.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],s=n[2],a=n[3],r=n[4],c=0;c<80;c++){if(c<16)f[c]=0|e[t+c];else{var u=f[c-3]^f[c-8]^f[c-14]^f[c-16];f[c]=u<<1|u>>>31}var l=(i<<5|i>>>27)+r+f[c];l+=c<20?1518500249+(o&s|~o&a):c<40?1859775393+(o^s^a):c<60?(o&s|o&a|s&a)-1894007588:(o^s^a)-899497514,r=a,a=s,s=o<<30|o>>>2,o=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+r|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=d.clone.call(this);return e._hash=this._hash.clone(),e}}),c.SHA1=d._createHelper(m),c.HmacSHA1=d._createHmacHelper(m),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),i=2;i<=n;i++)if(!(t%i))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var i=2,o=0;o<64;)t(i)&&(o<8&&(a[o]=n(e.pow(i,.5))),c[o]=n(e.pow(i,1/3)),o++),i++}();var u=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],s=n[2],a=n[3],r=n[4],l=n[5],d=n[6],p=n[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var g=u[h-15],f=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,m=u[h-2],_=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[h]=f+u[h-7]+_+u[h-16]}var v=i&o^i&s^o&s,y=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),I=p+((r<<26|r>>>6)^(r<<21|r>>>11)^(r<<7|r>>>25))+(r&l^~r&d)+c[h]+u[h];p=d,d=l,l=r,r=a+I|0,a=s,s=o,o=i,i=I+(y+v)|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+r|0,n[5]=n[5]+l|0,n[6]=n[6]+d|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(i/4294967296),n[15+(o+64>>>9<<4)]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),function(){var e=r,t=e.lib.WordArray,n=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o+=2){var s=t[o>>>2]>>>16-o%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var n=e.length,i=[],o=0;o<n;o++)i[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return t.create(i,2*n)}},n.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],s=0;s<n;s+=2){var a=i(t[s>>>2]>>>16-s%4*8&65535);o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var n=e.length,o=[],s=0;s<n;s++)o[s>>>1]|=i(e.charCodeAt(s)<<16-s%2*16);return t.create(o,2*n)}}}(),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,i=[],o=0;o<n;o++)i[o>>>2]|=e[o]<<24-o%4*8;t.call(this,i,n)}else t.apply(this,arguments)}).prototype=e}}(),
/** @preserve
(c) 2012 by C<><43>dric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function(){var e=r,t=e.lib,n=t.WordArray,i=t.Hasher,o=e.algo,s=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),d=n.create([1352829926,1548603684,1836072691,2053994217,0]),p=o.RIPEMD160=i.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,o=e[i];e[i]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var r,p,y,I,M,C,S,E,T,k,D,R=this._hash.words,O=l.words,b=d.words,A=s.words,L=a.words,P=c.words,N=u.words;for(C=r=R[0],S=p=R[1],E=y=R[2],T=I=R[3],k=M=R[4],n=0;n<80;n+=1)D=r+e[t+A[n]]|0,D+=n<16?h(p,y,I)+O[0]:n<32?g(p,y,I)+O[1]:n<48?f(p,y,I)+O[2]:n<64?m(p,y,I)+O[3]:_(p,y,I)+O[4],D=(D=v(D|=0,P[n]))+M|0,r=M,M=I,I=v(y,10),y=p,p=D,D=C+e[t+L[n]]|0,D+=n<16?_(S,E,T)+b[0]:n<32?m(S,E,T)+b[1]:n<48?f(S,E,T)+b[2]:n<64?g(S,E,T)+b[3]:h(S,E,T)+b[4],D=(D=v(D|=0,N[n]))+k|0,C=k,k=T,T=v(E,10),E=S,S=D;D=R[1]+y+T|0,R[1]=R[2]+I+k|0,R[2]=R[3]+M+C|0,R[3]=R[4]+r+S|0,R[4]=R[0]+p+E|0,R[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,s=o.words,a=0;a<5;a++){var r=s[a];s[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function h(e,t,n){return e^t^n}function g(e,t,n){return e&t|~e&n}function f(e,t,n){return(e|~t)^n}function m(e,t,n){return e&n|t&~n}function _(e,t,n){return e^(t|~n)}function v(e,t){return e<<t|e>>>32-t}e.RIPEMD160=i._createHelper(p),e.HmacRIPEMD160=i._createHmacHelper(p)}(),function(){var e=r,t=e.lib.Base,n=e.enc.Utf8;e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var i=e.blockSize,o=4*i;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),r=s.words,c=a.words,u=0;u<i;u++)r[u]^=1549556828,c[u]^=909522486;s.sigBytes=a.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})}(),function(){var e=r,t=e.lib,n=t.Base,i=t.WordArray,o=e.algo,s=o.SHA1,a=o.HMAC,c=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=a.create(n.hasher,e),s=i.create(),r=i.create([1]),c=s.words,u=r.words,l=n.keySize,d=n.iterations;c.length<l;){var p=o.update(t).finalize(r);o.reset();for(var h=p.words,g=h.length,f=p,m=1;m<d;m++){f=o.finalize(f),o.reset();for(var _=f.words,v=0;v<g;v++)h[v]^=_[v]}s.concat(p),u[0]++}return s.sigBytes=4*l,s}});e.PBKDF2=function(e,t,n){return c.create(n).compute(e,t)}}(),function(){var e=r,t=e.lib,n=t.Base,i=t.WordArray,o=e.algo,s=o.MD5,a=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,o=this.cfg,s=o.hasher.create(),a=i.create(),r=a.words,c=o.keySize,u=o.iterations;r.length<c;){n&&s.update(n),n=s.update(e).finalize(t),s.reset();for(var l=1;l<u;l++)n=s.finalize(n),s.reset();a.concat(n)}return a.sigBytes=4*c,a}});e.EvpKDF=function(e,t,n){return a.create(n).compute(e,t)}}(),function(){var e=r,t=e.lib.WordArray,n=e.algo,i=n.SHA256,o=n.SHA224=i.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}});e.SHA224=i._createHelper(o),e.HmacSHA224=i._createHmacHelper(o)}(),function(){var e=r,t=e.lib,n=t.Base,i=t.WordArray,o=e.x64={};o.Word=n.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=n.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],o=0;o<t;o++){var s=e[o];n.push(s.high),n.push(s.low)}return i.create(n,this.sigBytes)},clone:function(){for(var e=n.clone.call(this),t=e.words=this.words.slice(0),i=t.length,o=0;o<i;o++)t[o]=t[o].clone();return e}})}(),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.x64.Word,a=t.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,n=0;n<24;n++){c[e+5*t]=(n+1)*(n+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,a=0;a<24;a++){for(var r=0,d=0,p=0;p<7;p++){if(1&o){var h=(1<<p)-1;h<32?d^=1<<h:r^=1<<h-32}128&o?o=o<<1^113:o<<=1}l[a]=s.create(r,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=s.create()}();var p=a.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var n=this._state,i=this.blockSize/2,o=0;o<i;o++){var s=e[t+2*o],a=e[t+2*o+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(R=n[o]).high^=a,R.low^=s}for(var r=0;r<24;r++){for(var p=0;p<5;p++){for(var h=0,g=0,f=0;f<5;f++)h^=(R=n[p+5*f]).high,g^=R.low;var m=d[p];m.high=h,m.low=g}for(p=0;p<5;p++){var _=d[(p+4)%5],v=d[(p+1)%5],y=v.high,I=v.low;for(h=_.high^(y<<1|I>>>31),g=_.low^(I<<1|y>>>31),f=0;f<5;f++)(R=n[p+5*f]).high^=h,R.low^=g}for(var M=1;M<25;M++){var C=(R=n[M]).high,S=R.low,E=c[M];E<32?(h=C<<E|S>>>32-E,g=S<<E|C>>>32-E):(h=S<<E-32|C>>>64-E,g=C<<E-32|S>>>64-E);var T=d[u[M]];T.high=h,T.low=g}var k=d[0],D=n[0];for(k.high=D.high,k.low=D.low,p=0;p<5;p++)for(f=0;f<5;f++){var R=n[M=p+5*f],O=d[M],b=d[(p+1)%5+5*f],A=d[(p+2)%5+5*f];R.high=O.high^~b.high&A.high,R.low=O.low^~b.low&A.low}R=n[0];var L=l[r];R.high^=L.high,R.low^=L.low}},_doFinalize:function(){var t=this._data,n=t.words,o=(this._nDataBytes,8*t.sigBytes),s=32*this.blockSize;n[o>>>5]|=1<<24-o%32,n[(e.ceil((o+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,r=this.cfg.outputLength/8,c=r/8,u=[],l=0;l<c;l++){var d=a[l],p=d.high,h=d.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(p)}return new i.init(u,r)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});t.SHA3=o._createHelper(p),t.HmacSHA3=o._createHmacHelper(p)}(Math),function(){var e=r,t=e.lib.Hasher,n=e.x64,i=n.Word,o=n.WordArray,s=e.algo;function a(){return i.create.apply(i,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var l=s.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],s=n[2],a=n[3],r=n[4],l=n[5],d=n[6],p=n[7],h=i.high,g=i.low,f=o.high,m=o.low,_=s.high,v=s.low,y=a.high,I=a.low,M=r.high,C=r.low,S=l.high,E=l.low,T=d.high,k=d.low,D=p.high,R=p.low,O=h,b=g,A=f,L=m,P=_,N=v,w=y,U=I,G=M,x=C,F=S,B=E,q=T,V=k,j=D,H=R,K=0;K<80;K++){var z,W,Y=u[K];if(K<16)W=Y.high=0|e[t+2*K],z=Y.low=0|e[t+2*K+1];else{var $=u[K-15],J=$.high,X=$.low,Q=(J>>>1|X<<31)^(J>>>8|X<<24)^J>>>7,Z=(X>>>1|J<<31)^(X>>>8|J<<24)^(X>>>7|J<<25),ee=u[K-2],te=ee.high,ne=ee.low,ie=(te>>>19|ne<<13)^(te<<3|ne>>>29)^te>>>6,oe=(ne>>>19|te<<13)^(ne<<3|te>>>29)^(ne>>>6|te<<26),se=u[K-7],ae=se.high,re=se.low,ce=u[K-16],ue=ce.high,le=ce.low;W=(W=(W=Q+ae+((z=Z+re)>>>0<Z>>>0?1:0))+ie+((z+=oe)>>>0<oe>>>0?1:0))+ue+((z+=le)>>>0<le>>>0?1:0),Y.high=W,Y.low=z}var de,pe=G&F^~G&q,he=x&B^~x&V,ge=O&A^O&P^A&P,fe=b&L^b&N^L&N,me=(O>>>28|b<<4)^(O<<30|b>>>2)^(O<<25|b>>>7),_e=(b>>>28|O<<4)^(b<<30|O>>>2)^(b<<25|O>>>7),ve=(G>>>14|x<<18)^(G>>>18|x<<14)^(G<<23|x>>>9),ye=(x>>>14|G<<18)^(x>>>18|G<<14)^(x<<23|G>>>9),Ie=c[K],Me=Ie.high,Ce=Ie.low,Se=j+ve+((de=H+ye)>>>0<H>>>0?1:0),Ee=_e+fe;j=q,H=V,q=F,V=B,F=G,B=x,G=w+(Se=(Se=(Se=Se+pe+((de+=he)>>>0<he>>>0?1:0))+Me+((de+=Ce)>>>0<Ce>>>0?1:0))+W+((de+=z)>>>0<z>>>0?1:0))+((x=U+de|0)>>>0<U>>>0?1:0)|0,w=P,U=N,P=A,N=L,A=O,L=b,O=Se+(me+ge+(Ee>>>0<_e>>>0?1:0))+((b=de+Ee|0)>>>0<de>>>0?1:0)|0}g=i.low=g+b,i.high=h+O+(g>>>0<b>>>0?1:0),m=o.low=m+L,o.high=f+A+(m>>>0<L>>>0?1:0),v=s.low=v+N,s.high=_+P+(v>>>0<N>>>0?1:0),I=a.low=I+U,a.high=y+w+(I>>>0<U>>>0?1:0),C=r.low=C+x,r.high=M+G+(C>>>0<x>>>0?1:0),E=l.low=E+B,l.high=S+F+(E>>>0<B>>>0?1:0),k=d.low=k+V,d.high=T+q+(k>>>0<V>>>0?1:0),R=p.low=R+H,p.high=D+j+(R>>>0<H>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(i+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),function(){var e=r,t=e.x64,n=t.Word,i=t.WordArray,o=e.algo,s=o.SHA512,a=o.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=s._createHelper(a),e.HmacSHA384=s._createHmacHelper(a)}(),r.lib.Cipher||function(){var e=r,t=e.lib,n=t.Base,i=t.WordArray,o=t.BufferedBlockAlgorithm,s=e.enc,a=(s.Utf8,s.Base64),c=e.algo.EvpKDF,u=t.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?v:m}return function(t){return{encrypt:function(n,i,o){return e(i).encrypt(t,n,i,o)},decrypt:function(n,i,o){return e(i).decrypt(t,n,i,o)}}}}()}),l=(t.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),e.mode={}),d=t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var e=d.extend();function t(e,t,n){var i,o=this._iv;o?(i=o,this._iv=void 0):i=this._prevBlock;for(var s=0;s<n;s++)e[t+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(e,n){var i=this._cipher,o=i.blockSize;t.call(this,e,n,o),i.encryptBlock(e,n),this._prevBlock=e.slice(n,n+o)}}),e.Decryptor=e.extend({processBlock:function(e,n){var i=this._cipher,o=i.blockSize,s=e.slice(n,n+o);i.decryptBlock(e,n),t.call(this,e,n,o),this._prevBlock=s}}),e}(),h=(e.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,o=n-e.sigBytes%n,s=o<<24|o<<16|o<<8|o,a=[],r=0;r<o;r+=4)a.push(s);var c=i.create(a,o);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},g=(t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:p,padding:h}),reset:function(){var e;u.reset.call(this);var t=this.cfg,n=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(i,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),f=(e.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?i.create([1398893684,1701076831]).concat(n).concat(t):t).toString(a)},parse:function(e){var t,n=a.parse(e),o=n.words;return 1398893684==o[0]&&1701076831==o[1]&&(t=i.create(o.slice(2,4)),o.splice(0,4),n.sigBytes-=16),g.create({ciphertext:n,salt:t})}},m=t.SerializableCipher=n.extend({cfg:n.extend({format:f}),encrypt:function(e,t,n,i){i=this.cfg.extend(i);var o=e.createEncryptor(n,i),s=o.finalize(t),a=o.cfg;return g.create({ciphertext:s,key:n,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(n,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),_=(e.kdf={}).OpenSSL={execute:function(e,t,n,o){o||(o=i.random(8));var s=c.create({keySize:t+n}).compute(e,o),a=i.create(s.words.slice(t),4*n);return s.sigBytes=4*t,g.create({key:s,iv:a,salt:o})}},v=t.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:_}),encrypt:function(e,t,n,i){var o=(i=this.cfg.extend(i)).kdf.execute(n,e.keySize,e.ivSize);i.iv=o.iv;var s=m.encrypt.call(this,e,t,o.key,i);return s.mixIn(o),s},decrypt:function(e,t,n,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var o=i.kdf.execute(n,e.keySize,e.ivSize,t.salt);return i.iv=o.iv,m.decrypt.call(this,e,t,o.key,i)}})}(),r.mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,n,i){var o,s=this._iv;s?(o=s.slice(0),this._iv=void 0):o=this._prevBlock,i.encryptBlock(o,0);for(var a=0;a<n;a++)e[t+a]^=o[a]}return e.Encryptor=e.extend({processBlock:function(e,n){var i=this._cipher,o=i.blockSize;t.call(this,e,n,o,i),this._prevBlock=e.slice(n,n+o)}}),e.Decryptor=e.extend({processBlock:function(e,n){var i=this._cipher,o=i.blockSize,s=e.slice(n,n+o);t.call(this,e,n,o,i),this._prevBlock=s}}),e}(),r.mode.ECB=((o=r.lib.BlockCipherMode.extend()).Encryptor=o.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),o.Decryptor=o.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),o),r.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,i=4*t,o=i-n%i,s=n+o-1;e.clamp(),e.words[s>>>2]|=o<<24-s%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126={pad:function(e,t){var n=4*t,i=n-e.sigBytes%n;e.concat(r.lib.WordArray.random(i-1)).concat(r.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.mode.OFB=(i=(n=r.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._keystream;o&&(s=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(s,0);for(var a=0;a<i;a++)e[t+a]^=s[a]}}),n.Decryptor=i,n),r.pad.NoPadding={pad:function(){},unpad:function(){}},function(){var e=r,t=e.lib.CipherParams,n=e.enc.Hex;e.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var i=n.parse(e);return t.create({ciphertext:i})}}}(),function(){var e=r,t=e.lib.BlockCipher,n=e.algo,i=[],o=[],s=[],a=[],c=[],u=[],l=[],d=[],p=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var g=r^r<<1^r<<2^r<<3^r<<4;g=g>>>8^255&g^99,i[n]=g,o[g]=n;var f=e[n],m=e[f],_=e[m],v=257*e[g]^16843008*g;s[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,u[n]=v,v=16843009*_^65537*m^257*f^16843008*n,l[g]=v<<24|v>>>8,d[g]=v<<16|v>>>16,p[g]=v<<8|v>>>24,h[g]=v,n?(n=f^e[e[e[_^f]]],r^=e[e[r]]):n=r=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],f=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,o=4*((this._nRounds=n+6)+1),s=this._keySchedule=[],a=0;a<o;a++)a<n?s[a]=t[a]:(u=s[a-1],a%n?n>6&&a%n==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=g[a/n|0]<<24),s[a]=s[a-n]^u);for(var r=this._invKeySchedule=[],c=0;c<o;c++){if(a=o-c,c%4)var u=s[a];else u=s[a-4];r[c]=c<4||a<=4?u:l[i[u>>>24]]^d[i[u>>>16&255]]^p[i[u>>>8&255]]^h[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,d,p,h,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,o,s,a,r){for(var c=this._nRounds,u=e[t]^n[0],l=e[t+1]^n[1],d=e[t+2]^n[2],p=e[t+3]^n[3],h=4,g=1;g<c;g++){var f=i[u>>>24]^o[l>>>16&255]^s[d>>>8&255]^a[255&p]^n[h++],m=i[l>>>24]^o[d>>>16&255]^s[p>>>8&255]^a[255&u]^n[h++],_=i[d>>>24]^o[p>>>16&255]^s[u>>>8&255]^a[255&l]^n[h++],v=i[p>>>24]^o[u>>>16&255]^s[l>>>8&255]^a[255&d]^n[h++];u=f,l=m,d=_,p=v}f=(r[u>>>24]<<24|r[l>>>16&255]<<16|r[d>>>8&255]<<8|r[255&p])^n[h++],m=(r[l>>>24]<<24|r[d>>>16&255]<<16|r[p>>>8&255]<<8|r[255&u])^n[h++],_=(r[d>>>24]<<24|r[p>>>16&255]<<16|r[u>>>8&255]<<8|r[255&l])^n[h++],v=(r[p>>>24]<<24|r[u>>>16&255]<<16|r[l>>>8&255]<<8|r[255&d])^n[h++],e[t]=f,e[t+1]=m,e[t+2]=_,e[t+3]=v},keySize:8});e.AES=t._createHelper(f)}(),function(){var e=r,t=e.lib,n=t.WordArray,i=t.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;n<56;n++){var i=s[n]-1;t[n]=e[i>>>5]>>>31-i%32&1}for(var o=this._subKeys=[],r=0;r<16;r++){var u=o[r]=[],l=c[r];for(n=0;n<24;n++)u[n/6|0]|=t[(a[n]-1+l)%28]<<31-n%6,u[4+(n/6|0)]|=t[28+(a[n+24]-1+l)%28]<<31-n%6;for(u[0]=u[0]<<1|u[0]>>>31,n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var d=this._invSubKeys=[];for(n=0;n<16;n++)d[n]=o[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,n){this._lBlock=e[t],this._rBlock=e[t+1],p.call(this,4,252645135),p.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),p.call(this,1,1431655765);for(var i=0;i<16;i++){for(var o=n[i],s=this._lBlock,a=this._rBlock,r=0,c=0;c<8;c++)r|=u[c][((a^o[c])&l[c])>>>0];this._lBlock=a,this._rBlock=s^r}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,p.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function h(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}e.DES=i._createHelper(d);var g=o.TripleDES=i.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(i)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(g)}(),function(){var e=r,t=e.lib.StreamCipher,n=e.algo,i=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,i=this._S=[],o=0;o<256;o++)i[o]=o;o=0;for(var s=0;o<256;o++){var a=o%n,r=t[a>>>2]>>>24-a%4*8&255;s=(s+i[o]+r)%256;var c=i[o];i[o]=i[s],i[s]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,n=this._j,i=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[n],e[n]=s,i|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,i}e.RC4=t._createHelper(i);var s=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(),
/** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/
r.mode.CTRGladman=function(){var e=r.lib.BlockCipherMode.extend();function t(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,n=e>>8&255,i=255&e;255===t?(t=0,255===n?(n=0,255===i?i=0:++i):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=i}return e}var n=e.Encryptor=e.extend({processBlock:function(e,n){var i,o=this._cipher,s=o.blockSize,a=this._iv,r=this._counter;a&&(r=this._counter=a.slice(0),this._iv=void 0),0===((i=r)[0]=t(i[0]))&&(i[1]=t(i[1]));var c=r.slice(0);o.encryptBlock(c,0);for(var u=0;u<s;u++)e[n+u]^=c[u]}});return e.Decryptor=n,e}(),function(){var e=r,t=e.lib.StreamCipher,n=e.algo,i=[],o=[],s=[],a=n.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)o[n]^=i[n+4&7];if(t){var s=t.words,a=s[0],r=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),d=u>>>16|4294901760&l,p=l<<16|65535&u;for(o[0]^=u,o[1]^=d,o[2]^=l,o[3]^=p,o[4]^=u,o[5]^=d,o[6]^=l,o[7]^=p,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var o=0;o<4;o++)i[o]=16711935&(i[o]<<8|i[o]>>>24)|4278255360&(i[o]<<24|i[o]>>>8),e[t+o]^=i[o]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],a=65535&i,r=i>>>16,c=((a*a>>>17)+a*r>>>15)+r*r,u=((4294901760&i)*i|0)+((65535&i)*i|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),r.mode.CTR=function(){var e=r.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0);var a=s.slice(0);n.encryptBlock(a,0),s[i-1]=s[i-1]+1|0;for(var r=0;r<i;r++)e[t+r]^=a[r]}});return e.Decryptor=t,e}(),function(){var e=r,t=e.lib.StreamCipher,n=e.algo,i=[],o=[],s=[],a=n.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)i[o]^=n[o+4&7];if(t){var s=t.words,a=s[0],r=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),d=u>>>16|4294901760&l,p=l<<16|65535&u;for(i[0]^=u,i[1]^=d,i[2]^=l,i[3]^=p,i[4]^=u,i[5]^=d,i[6]^=l,i[7]^=p,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var o=0;o<4;o++)i[o]=16711935&(i[o]<<8|i[o]>>>24)|4278255360&(i[o]<<24|i[o]>>>8),e[t+o]^=i[o]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],a=65535&i,r=i>>>16,c=((a*a>>>17)+a*r>>>15)+r*r,u=((4294901760&i)*i|0)+((65535&i)*i|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),r.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},r)},c(u={exports:{}},u.exports),u.exports);return function(){function t(n){e(this,t);var i=n.isArray,o=n.isMap,s=n.isDevMode;this._isArray=i,this._isMap=o,this._isDevMode=s,this._interceptProfanityList=[],this._interceptFilter=null,this._interceptRegExpList=[],this._replacingProfanityMap=new Map,this._replacingFilter=null,this._replacingRegExpMap=new Map,this._key="",this._iv="",this._decryptOptions=void 0,this._n="TIMProfanityFilterPlugin",!0===s&&console.log("".concat(this._n,".VERSION:").concat("1.1.0"))}return n(t,[{key:"onToken",value:function(e){this._key=g.enc.Utf8.parse(e.slice(0,32)),this._iv=this._key,this._decryptOptions={iv:this._iv,mode:g.mode.CBC,padding:g.pad.Pkcs7}}},{key:"onLexiconSliced",value:function(e){if(this._isArray(e)&&0!==e.length){var t,n,i,o=r(e);try{for(o.s();!(i=o.n()).done;){var s=i.value,a=s.filterType,c=s.profanityType,u=s.profanity,l=s.replacement;t=this._getDecryptedString(u),n=this._getDecryptedString(l),1===a?1===c?this._interceptProfanityList.push(t):2===c&&this._interceptRegExpList.push(t):2===a&&(1===c?this._replacingProfanityMap.set(t,n):2===c&&this._replacingRegExpMap.set(t,n))}}catch(d){o.e(d)}finally{o.f()}}}},{key:"_getDecryptedString",value:function(e){var t=g.AES.decrypt(e,this._key,this._decryptOptions);return g.enc.Utf8.stringify(t).toLowerCase()}},{key:"onLexiconCompleted",value:function(e){this.onLexiconSliced(e),this._interceptFilter=new d({input:this._interceptProfanityList,isArray:this._isArray,isMap:this._isMap}),this._replacingFilter=new d({input:this._replacingProfanityMap,isArray:this._isArray,isMap:this._isMap}),!0===this._isDevMode&&(console.log("".concat(this._n," _interceptProfanityList ->"),this._interceptProfanityList),console.log("".concat(this._n," _interceptRegExpList ->"),this._interceptRegExpList),console.log("".concat(this._n," _replacingProfanityMap ->"),this._replacingProfanityMap),console.log("".concat(this._n," _replacingRegExpMap ->"),this._replacingRegExpMap))}},{key:"filter",value:function(e){var t={type:0,modifiedText:e};if("string"!=typeof e)return!0===this._isDevMode&&console.warn("".concat(this._n,".filter invalid params, string required!")),t;if(!0===this._interceptFilter.filter({text:e,replacingEnabled:!1}).isMatched)return t.type=1,t;for(var n=!1,o=0,s=this._interceptRegExpList.length;o<s;o++)if(new RegExp(this._interceptRegExpList[o],"gi").test(e.toLowerCase())){n=!0;break}if(n)return t.type=1,t;var a=this._replacingFilter.filter({text:e,replacingEnabled:!0});!0===a.isMatched&&(t.type=2,t.modifiedText=a.modifiedText);var c,u=t.modifiedText,l=null,d=r(this._replacingRegExpMap);try{for(d.s();!(c=d.n()).done;){var p=i(c.value,2),h=p[0],g=p[1];l=new RegExp(h,"gi"),u=u.replace(l,g)}}catch(f){d.e(f)}finally{d.f()}return u!==e&&(t.type=2,t.modifiedText=u),t}},{key:"reset",value:function(){this._isArray=null,this._isMap=null,this._interceptProfanityList.length=0,this._interceptRegExpList.length=0,this._replacingProfanityMap.clear(),this._replacingRegExpMap.clear(),this._key="",this._iv="",this._decryptOptions={},this._interceptFilter&&this._interceptFilter.reset(),this._replacingFilter&&this._replacingFilter.reset()}}]),t}()}();const xg=bg(Gg.exports);function Fg(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}function Bg(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{c(i.next(e))}catch(t){s(t)}}function r(e){try{c(i.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class qg{constructor(e){return qg.instance||(qg.instance=this,this.engine=e,this.events={},this.bindIMEvents()),qg.instance}addEvent(e,t){this.events[e]||(this.events[e]=new Map),this.events[e].set(t,1)}removeEvents(){Object.keys(this.events).forEach((e=>{this.events[e].clear()})),this.events={}}dispatch(e,t){if(this.events[e])for(const n of this.events[e].keys())n.call(this,t)}bindIMEvents(){this.engine.chat.on(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.on(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.on(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.on(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.on(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.on(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.on(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.on(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.on(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this)}unbindIMEvents(){this.engine.chat.off(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.off(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.off(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.off(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.off(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.off(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.off(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.off(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.off(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this),qg.instance=null}onSDKReady(e){this.dispatch(this.engine.EVENT.SDK_READY,e.data)}onSDKNotReady(e){this.dispatch(this.engine.EVENT.SDK_NOT_READY,e.data)}onKickedOut(e){this.dispatch(this.engine.EVENT.KICKED_OUT,e.data)}onNetStateChange(e){this.dispatch(this.engine.EVENT.NET_STATE_CHANGE,e.data)}onReceiveMessage(e){this.dispatch(this.engine.EVENT.MESSAGE_RECEIVED,e.data)}onMessageModified(e){this.dispatch(this.engine.EVENT.MESSAGE_MODIFIED,e.data)}onMessageRevoked(e){this.dispatch(this.engine.EVENT.MESSAGE_REVOKED,e.data)}onMessageReadByPeer(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_BY_PEER,e.data)}onMessageReadReceiptReceived(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,e.data)}onMessageReactionsUpdated(e){this.dispatch(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,e.data)}onConversationListUpdated(e){this.dispatch(this.engine.EVENT.CONVERSATION_LIST_UPDATED,e.data)}onTotalMessageCountUpdated(e){this.dispatch(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,e.data)}onProfileUpdated(e){this.dispatch(this.engine.EVENT.PROFILE_UPDATED,e.data)}onBlacklistUpdated(e){this.dispatch(this.engine.EVENT.BLACKLIST_UPDATED,e.data)}onUserStatusUpdated(e){this.dispatch(this.engine.EVENT.USER_STATUS_UPDATED,e.data)}onGroupListUpdated(e){this.dispatch(this.engine.EVENT.GROUP_LIST_UPDATED,e.data)}onGroupAttributesUpdated(e){this.dispatch(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,e.data)}onGroupCounterUpdated(e){this.dispatch(this.engine.EVENT.GROUP_COUNTER_UPDATED,e.data)}onFriendListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_LIST_UPDATED,e.data)}onFriendApplicationListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,e.data)}}var Vg,jg,Hg,Kg,zg,Wg,Yg,$g,Jg;!function(e){e.TUIStore="TUIStore",e.TUITranslate="TUITranslate",e.TUIConversation="TUIConversation",e.TUIChat="TUIChat",e.TUIGroup="TUIGroup",e.TUIUser="TUIUser",e.TUIFriend="TUIFriend",e.TUIReport="TUIReport"}(Vg||(Vg={})),function(e){e.APP="application",e.CONV="conversation",e.CHAT="chat",e.GRP="group",e.USER="user",e.FRIEND="friend",e.SEARCH="search",e.CUSTOM="custom"}(jg||(jg={})),function(e){e[e.UNSUB_USER=-1]="UNSUB_USER"}(Hg||(Hg={})),function(e){e.BUSINESS_ID="user_typing_status",e[e.STATUS_START=1]="STATUS_START",e[e.STATUS_END=0]="STATUS_END",e[e.VERSION=1]="VERSION",e[e.ACTION_START_ID=14]="ACTION_START_ID",e[e.ACTION_END_ID=0]="ACTION_END_ID",e.ACTION_START="EIMAMSG_InputStatus_Ing",e.ACTION_END="EIMAMSG_InputStatus_End",e[e.NEED_TYPING=1]="NEED_TYPING"}(Kg||(Kg={})),function(e){e.ADD="add",e.REMOVE="remove"}(zg||(zg={})),function(e){e[e.MSG_MODIFY_CONFLICT=2480]="MSG_MODIFY_CONFLICT",e[e.MSG_MODIFY_DISABLED_IN_AVCHATROOM=2481]="MSG_MODIFY_DISABLED_IN_AVCHATROOM",e[e.MODIFY_MESSAGE_NOT_EXIST=20026]="MODIFY_MESSAGE_NOT_EXIST"}(Wg||(Wg={})),function(e){e[e.NOT_INIT=-1e5]="NOT_INIT",e[e.INVALID_CONV_ID=-100001]="INVALID_CONV_ID",e[e.CONV_ID_SAME=-100002]="CONV_ID_SAME",e[e.CONV_NOT_EXIST=-100003]="CONV_NOT_EXIST",e[e.GET_MSG_LIST_ERROR=-100004]="GET_MSG_LIST_ERROR",e[e.MISMATCH_TYPE_AND_PAYLOAD=-100005]="MISMATCH_TYPE_AND_PAYLOAD"}(Yg||(Yg={})),function(e){e.MSG_MODIFY_CONFLICT="MODIFY_MESSAGE_ERROR,修改消息发生冲突, data.message 是最新的消息",e.MSG_MODIFY_DISABLED_IN_AVCHATROOM="MODIFY_MESSAGE_ERROR,不支持修改直播群消息.",e.MODIFY_MESSAGE_NOT_EXIST="MODIFY_MESSAGE_ERROR,消息不存在."}($g||($g={})),function(e){e.NOT_INIT="TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。",e.INVALID_CONV_ID="会话 ID 无效",e.CONV_ID_SAME="您切换的是同一个会话 ID",e.CONV_NOT_EXIST="会话不存在",e.GET_MSG_LIST_ERROR="Chat SDK is not ready.",e.MISMATCH_TYPE_AND_PAYLOAD="type 与 payload 不匹配."}(Jg||(Jg={}));const Xg={logout:1,destroy:1},Qg=function(e){return void 0===e},Zg=function(e){return e.startsWith("_")},ef=function(e){return/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(e)},tf=function(e){return e&&function(e){if("string"==typeof e)try{return!!JSON.parse(e)}catch(t){return!1}return!1}(e)?JSON.parse(e):e},nf=function(e){let t="";return t=e>=1048576?`${(e/1048576).toFixed(2)} Mb`:e>=1024?`${(e/1024).toFixed(2)} Kb`:`${e.toFixed(2)}B`,t},of={"[TUIEmoji_Expect]":"emoji_0@2x.png","[TUIEmoji_Blink]":"emoji_1@2x.png","[TUIEmoji_Guffaw]":"emoji_2@2x.png","[TUIEmoji_KindSmile]":"emoji_3@2x.png","[TUIEmoji_Haha]":"emoji_4@2x.png","[TUIEmoji_Cheerful]":"emoji_5@2x.png","[TUIEmoji_Smile]":"emoji_6@2x.png","[TUIEmoji_Sorrow]":"emoji_7@2x.png","[TUIEmoji_Speechless]":"emoji_8@2x.png","[TUIEmoji_Amazed]":"emoji_9@2x.png","[TUIEmoji_Complacent]":"emoji_10@2x.png","[TUIEmoji_Lustful]":"emoji_11@2x.png","[TUIEmoji_Stareyes]":"emoji_12@2x.png","[TUIEmoji_Giggle]":"emoji_13@2x.png","[TUIEmoji_Daemon]":"emoji_14@2x.png","[TUIEmoji_Rage]":"emoji_15@2x.png","[TUIEmoji_Yawn]":"emoji_16@2x.png","[TUIEmoji_TearsLaugh]":"emoji_17@2x.png","[TUIEmoji_Silly]":"emoji_18@2x.png","[TUIEmoji_Wail]":"emoji_19@2x.png","[TUIEmoji_Kiss]":"emoji_20@2x.png","[TUIEmoji_Trapped]":"emoji_21@2x.png","[TUIEmoji_Fear]":"emoji_22@2x.png","[TUIEmoji_BareTeeth]":"emoji_23@2x.png","[TUIEmoji_FlareUp]":"emoji_24@2x.png","[TUIEmoji_Tact]":"emoji_25@2x.png","[TUIEmoji_Shit]":"emoji_26@2x.png","[TUIEmoji_ShutUp]":"emoji_27@2x.png","[TUIEmoji_Sigh]":"emoji_28@2x.png","[TUIEmoji_Hehe]":"emoji_29@2x.png","[TUIEmoji_Silent]":"emoji_30@2x.png","[TUIEmoji_Skull]":"emoji_31@2x.png","[TUIEmoji_Mask]":"emoji_32@2x.png","[TUIEmoji_Beer]":"emoji_33@2x.png","[TUIEmoji_Cake]":"emoji_34@2x.png","[TUIEmoji_RedPacket]":"emoji_35@2x.png","[TUIEmoji_Bombs]":"emoji_36@2x.png","[TUIEmoji_Ai]":"emoji_37@2x.png","[TUIEmoji_Celebrate]":"emoji_38@2x.png","[TUIEmoji_Bless]":"emoji_39@2x.png","[TUIEmoji_Flower]":"emoji_40@2x.png","[TUIEmoji_Watermelon]":"emoji_41@2x.png","[TUIEmoji_Cow]":"emoji_42@2x.png","[TUIEmoji_Fool]":"emoji_43@2x.png","[TUIEmoji_Surprised]":"emoji_44@2x.png","[TUIEmoji_Askance]":"emoji_45@2x.png","[TUIEmoji_Monster]":"emoji_46@2x.png","[TUIEmoji_Pig]":"emoji_47@2x.png","[TUIEmoji_Coffee]":"emoji_48@2x.png","[TUIEmoji_Ok]":"emoji_49@2x.png","[TUIEmoji_Heart]":"emoji_50@2x.png","[TUIEmoji_Sun]":"emoji_51@2x.png","[TUIEmoji_Moon]":"emoji_52@2x.png","[TUIEmoji_Star]":"emoji_53@2x.png","[TUIEmoji_Rich]":"emoji_54@2x.png","[TUIEmoji_Fortune]":"emoji_55@2x.png","[TUIEmoji_857]":"emoji_56@2x.png","[TUIEmoji_666]":"emoji_57@2x.png","[TUIEmoji_Prohibit]":"emoji_58@2x.png","[TUIEmoji_Convinced]":"emoji_59@2x.png","[TUIEmoji_Knife]":"emoji_60@2x.png","[TUIEmoji_Like]":"emoji_61@2x.png"},sf={"[TUIEmoji_Smile]":"[微笑]","[TUIEmoji_Expect]":"[期待]","[TUIEmoji_Blink]":"[眨眼]","[TUIEmoji_Guffaw]":"[大笑]","[TUIEmoji_KindSmile]":"[姨母笑]","[TUIEmoji_Haha]":"[哈哈哈]","[TUIEmoji_Cheerful]":"[愉快]","[TUIEmoji_Speechless]":"[无语]","[TUIEmoji_Amazed]":"[惊讶]","[TUIEmoji_Sorrow]":"[悲伤]","[TUIEmoji_Complacent]":"[得意]","[TUIEmoji_Silly]":"[傻了]","[TUIEmoji_Lustful]":"[色]","[TUIEmoji_Giggle]":"[憨笑]","[TUIEmoji_Kiss]":"[亲亲]","[TUIEmoji_Wail]":"[大哭]","[TUIEmoji_TearsLaugh]":"[哭笑]","[TUIEmoji_Trapped]":"[困]","[TUIEmoji_Mask]":"[口罩]","[TUIEmoji_Fear]":"[恐惧]","[TUIEmoji_BareTeeth]":"[龇牙]","[TUIEmoji_FlareUp]":"[发怒]","[TUIEmoji_Yawn]":"[打哈欠]","[TUIEmoji_Tact]":"[机智]","[TUIEmoji_Stareyes]":"[星星眼]","[TUIEmoji_ShutUp]":"[闭嘴]","[TUIEmoji_Sigh]":"[叹气]","[TUIEmoji_Hehe]":"[呵呵]","[TUIEmoji_Silent]":"[收声]","[TUIEmoji_Surprised]":"[惊喜]","[TUIEmoji_Askance]":"[白眼]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[便便]","[TUIEmoji_Monster]":"[怪兽]","[TUIEmoji_Daemon]":"[恶魔]","[TUIEmoji_Rage]":"[恶魔怒]","[TUIEmoji_Fool]":"[衰]","[TUIEmoji_Pig]":"[猪]","[TUIEmoji_Cow]":"[牛]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[骷髅]","[TUIEmoji_Bombs]":"[炸弹]","[TUIEmoji_Coffee]":"[咖啡]","[TUIEmoji_Cake]":"[蛋糕]","[TUIEmoji_Beer]":"[啤酒]","[TUIEmoji_Flower]":"[花]","[TUIEmoji_Watermelon]":"[瓜]","[TUIEmoji_Rich]":"[壕]","[TUIEmoji_Heart]":"[爱心]","[TUIEmoji_Moon]":"[月亮]","[TUIEmoji_Sun]":"[太阳]","[TUIEmoji_Star]":"[星星]","[TUIEmoji_RedPacket]":"[红包]","[TUIEmoji_Celebrate]":"[庆祝]","[TUIEmoji_Bless]":"[福]","[TUIEmoji_Fortune]":"[发]","[TUIEmoji_Convinced]":"[服]","[TUIEmoji_Prohibit]":"[禁]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[刀]","[TUIEmoji_Like]":"[赞]"},af={enabledMessageReadReceipt:Math.pow(2,5),enabledEmojiPlugin:Math.pow(2,48),enabledOnlineStatus:Math.pow(2,7),enabledCustomerServicePlugin:Math.pow(2,40),enabledTranslationPlugin:Math.pow(2,38),enabledVoiceToText:Math.pow(2,39)},rf=["messageList","conversationList","newMessageList"],cf=["translateTextInfo","voiceToTextInfo"],uf=void 0!==Pn&&"function"==typeof Pn.getSystemInfoSync&&Boolean(Pn.getSystemInfoSync().fontSizeSetting),lf=void 0!==Nn&&"undefined"==typeof window,df=uf||lf,pf=(void 0!==Nn||"undefined"!=typeof window)&&!df,hf=uf?Pn:void 0!==Nn?Nn:window,gf=pf&&window&&window.navigator&&window.navigator.userAgent||"",ff=/Android/i.test(gf),mf=/(?:Windows Phone)/.test(gf),_f=/(?:SymbianOS)/.test(gf),vf=/iPad/i.test(gf)||/iPhone/i.test(gf)||/iPod/i.test(gf),yf=ff||mf||_f||vf,If=pf&&!yf;class Mf{constructor(){this.global=hf,this.isOfficial=!1}static getInstance(){return Mf.instance||(Mf.instance=new Mf),Mf.instance}initOfficial(e){this.isOfficial=e}getPlatform(){let e="";return If?e="pc":yf?e="h5":uf?e="wechat":lf&&!uf&&(e="app"),e}}class Cf{constructor(){this.EVENT=Ng.EVENT,this.TYPES=Ng.TYPES,this.loginStatusPromise=new Map,this.userID="",this.isInited=!1}static getInstance(){return Cf.instance||(Cf.instance=new Cf),Cf.instance}mount(e,t){this[e]=t}login(e){const{chat:t,SDKAppID:n,userID:i}=e,o=1400187352===n||1400188366===n;return this.createChat(e),this.userID=i,Mf.getInstance().initOfficial(o),this.TUIStore.update(jg.APP,"isOfficial",o),this.TUIStore.update(jg.APP,"SDKVersion",Ng.VERSION),this.eventCenter=new qg(this),this.eventCenter.removeEvents(),this.resetStore(),this.initService(),t&&t.isReady()?(console.log("TUIChatEngine.login ok, from TUICore."),this.TUIUser.getUserProfile(),this.checkCommercialAbility(),Promise.resolve({})):(this.registerPlugin(e),this.eventCenter.addEvent(this.EVENT.SDK_READY,(()=>{this.onSDKReady()})),this.eventCenter.addEvent(this.EVENT.SDK_NOT_READY,(()=>{this.onSDKNotReady()})),this.loginChat(e))}logout(){return this.userID="",this.isInited=!1,this.resetStore(),this.chat.logout()}isReady(){var e;return(null===(e=this.chat)||void 0===e?void 0:e.isReady())||!1}setLogLevel(e){this.chat?this.chat.setLogLevel(e):console.warn("TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。")}destroy(){return this.eventCenter.unbindIMEvents(),this.isInited=!1,this.resetStore(),this.chat.destroy()}getMyUserID(){return this.userID}resetStore(){this.TUIStore.reset(jg.CHAT),this.TUIStore.reset(jg.CONV),this.TUIStore.reset(jg.GRP),this.TUIStore.reset(jg.USER),this.TUIStore.reset(jg.SEARCH),this.TUIStore.reset(jg.FRIEND),this.TUIStore.reset(jg.CUSTOM),console.log("TUIChatEngine.resetStore ok.")}initService(){this.TUIChat.init(),this.TUIConversation.init(),this.TUIUser.init(),this.initOptionalServices(),this.isInited=!0,console.log("TUIChatEngine.initService ok.")}initOptionalServices(){const e=Ng.VERSION.split(".");e[0]>3||3===e[0]&&e[1]>=3&&e[2]>0?(!0===this.chat.callExperimentalAPI("canIUseModule",["group-module"])&&this.TUIGroup.init(),!0===this.chat.callExperimentalAPI("canIUseModule",["relationship-module"])&&this.TUIFriend.init()):(this.TUIGroup.init(),this.TUIFriend.init())}createChat(e){const{chat:t}=e,n=Fg(e,["chat"]);Qg(t)?this.chat=Ng.create(Object.assign(Object.assign({},n),{scene:"chat-uikit-engine"})):this.chat=t}loginChat(e){const{userID:t,userSig:n}=e;return new Promise(((e,i)=>{this.chat.login({userID:t,userSig:n}).then((t=>{console.log("TUIChatEngine.loginChat ok."),this.checkCommercialAbility(),t.data.repeatLogin&&this.chat.isReady()&&e(t),this.loginStatusPromise.set("login",{resolve:e,reject:i,imResponse:t})})).catch((e=>{i(e)}))}))}registerPlugin(e){const{useUploadPlugin:t=!1,useProfanityFilterPlugin:n=!1,TIMPush:i,pushConfig:o,TUIOfflinePush:s,offlinePushConfig:a}=e;!0===t&&this.chat.registerPlugin({"tim-upload-plugin":Ug}),!0===n&&this.chat.registerPlugin({"tim-profanity-filter-plugin":xg}),!lf||uf||Qg(i)||Qg(o)||this.chat.registerPlugin({"tim-push":i,pushConfig:o}),!lf||uf||Qg(s)||Qg(a)||this.chat.registerPlugin({"tim-offline-push-plugin":s,offlinePushConfig:a})}onSDKReady(){if(this.loginStatusPromise.has("login")){const e=this.loginStatusPromise.get("login");e.resolve(e.imResponse),this.TUIUser.getUserProfile()}this.loginStatusPromise.delete("login")}onSDKNotReady(){this.loginStatusPromise.has("login")&&this.loginStatusPromise.get("login").reject(new Error("sdk not ready")),this.loginStatusPromise.delete("login"),this.resetStore()}checkCommercialAbility(){Object.keys(af).forEach((e=>{const t=af[e];this.chat.callExperimentalAPI("isCommercialAbilityEnabled",t).then((t=>{const{enabled:n=!1}=t.data;this.TUIStore.update(jg.APP,e,n)}))}))}}class Sf{constructor(){this.defaultStore={enabledMessageReadReceipt:!1,enabledEmojiPlugin:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enabledVoiceToText:!1,enableTyping:!0,enableConversationDraft:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1,translateTextMessage:!1}},this.store={enabledEmojiPlugin:!1,enabledMessageReadReceipt:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enabledVoiceToText:!1,enableTyping:!0,enableConversationDraft:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1,translateTextMessage:!1}}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class Ef{constructor(){this.defaultStore={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"},this.store={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"}}update(e,t){"userStatusList"===e?this.updateUserStatusList(t):this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateUserStatusList(e){0!==e.length?e.forEach((e=>{const{userID:t,statusType:n=0,customStatus:i=""}=e;n===Hg.UNSUB_USER?this.store.userStatusList.delete(t):this.store.userStatusList.set(t,{statusType:n,customStatus:i})})):this.store.userStatusList.clear()}}class Tf{getEngine(){return Cf.getInstance()}}const kf=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(e)){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1},Df=["[图片]","[语音]","[视频]","[文件]","[位置]","[地理位置]","[动画表情]","[自定义消息]","[群提示消息]","[聊天记录]"];class Rf extends Tf{constructor(e){super(),this.initProxy(e),this.isMuted=this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_ACPT_NOT_NOTE||this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_DISCARD,this.operationType=0,this._conversation=e}initProxy(e){Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}updateProperties(e){Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}updateOperationType(e){this.operationType=e}getConversation(){return this._conversation}deleteConversation(){return this.getEngine().TUIConversation.deleteConversation(this.conversationID)}pinConversation(){return this.getEngine().TUIConversation.pinConversation({conversationID:this.conversationID,isPinned:!this.isPinned})}muteConversation(){const e=this.getEngine(),t={messageRemindType:!0===this.isMuted?e.TYPES.MSG_REMIND_ACPT_AND_NOTE:e.TYPES.MSG_REMIND_ACPT_NOT_NOTE};if(this.type===e.TYPES.CONV_C2C){const n=this.conversationID.replace(e.TYPES.CONV_C2C,"");t.userIDList=[n]}else if(this.type===e.TYPES.CONV_GROUP){const n=this.conversationID.replace(e.TYPES.CONV_GROUP,"");t.groupID=n}return e.TUIConversation.muteConversation(t)}getAvatar(){var e,t,n,i,o,s;const a=this.getEngine();let r="";switch(this.type){case a.TYPES.CONV_C2C:r=ef(null===(e=this.userProfile)||void 0===e?void 0:e.avatar)?null===(t=this.userProfile)||void 0===t?void 0:t.avatar:"https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_16.png";break;case a.TYPES.CONV_GROUP:r=ef(null===(n=this.groupProfile)||void 0===n?void 0:n.avatar)?null===(i=this.groupProfile)||void 0===i?void 0:i.avatar:"https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.png";break;case a.TYPES.CONV_SYSTEM:r=ef(null===(o=this.groupProfile)||void 0===o?void 0:o.avatar)?null===(s=this.groupProfile)||void 0===s?void 0:s.avatar:"https://web.sdk.qcloud.com/component/TUIKit/assets/group_avatar.png"}return r}getShowName(){var e,t,n,i;const o=this.getEngine();let s="";switch(this.type){case o.TYPES.CONV_C2C:s=this.remark||(null===(e=this.userProfile)||void 0===e?void 0:e.nick)||(null===(t=this.userProfile)||void 0===t?void 0:t.userID)||"";break;case o.TYPES.CONV_GROUP:s=(null===(n=this.groupProfile)||void 0===n?void 0:n.name)||(null===(i=this.groupProfile)||void 0===i?void 0:i.groupID)||"";break;case o.TYPES.CONV_SYSTEM:s=o.TUITranslate.t("系统通知")}return s}getGroupAtInfo(){const e=this.getEngine(),t=e.TUITranslate.t.bind(e.TUITranslate),n=[`[${t("TUIConversation.有人@我")}]`,`[${t("TUIConversation.@所有人")}]`,`[${t("TUIConversation.@所有人")}][${t("TUIConversation.有人@我")}]`];let i="";for(let o=0;o<this.groupAtInfoList.length;o++)this.groupAtInfoList[o].atTypeArray[0]&&this.unreadCount>0&&(i=n[this.groupAtInfoList[o].atTypeArray[0]-1]);return i}getLastMessage(e){return"time"===e?this.getLastMessageTime():"text"===e?this.getLastMessageText():(console.warn(`ConversationModel.getLastMessage key:${e} is invalid.`),null)}getLastMessageTime(){var e;const t=this.getEngine();let n="";return(null===(e=this.lastMessage)||void 0===e?void 0:e.lastTime)>0&&(n=function(e,t){const n=36e5,i=24*n,o=7*i,s=(new Date).getTime()-e;let a="";if(s<0)return a;const r=s/6e4,c=s/n,u=s/i,l=s/o;if(l>=1&&l<=4)a=` ${parseInt(`${l}`,10)} ${t("time.周")}${t("time.前")}`;else if(u>=1&&u<=6)a=` ${parseInt(`${u}`,10)} ${t("time.天")}${t("time.前")}`;else if(c>=1&&c<=23)a=` ${parseInt(`${c}`,10)} ${t("time.小时")}${t("time.前")}`;else if(r>=1&&r<=59)a=` ${parseInt(`${r}`,10)} ${t("time.分钟")}${t("time.前")}`;else if(s>=0&&s<=6e4)a=`${t("time.刚刚")}`;else{const t=new Date;t.setTime(e),a=`${t.getFullYear()}-${t.getMonth()+1<10?`0${t.getMonth()+1}`:t.getMonth()+1}-${t.getDate()<10?`0${t.getDate()}`:t.getDate()}`}return a}(1e3*this.lastMessage.lastTime,t.TUITranslate.t.bind(t.TUITranslate))),n}getLastMessageText(){var e;if(this.draftText)return tf(this.draftText).abstract;const t=this.getEngine(),n=t.TUITranslate.t.bind(t.TUITranslate);if(4===this.operationType)return n("TUIConversation.您已被群管理员移出群聊");if(5===this.operationType)return n("TUIConversation.该群聊已被解散");if(8===this.operationType)return n("TUIConversation.您已退出该群聊");const i=this._conversation,{lastMessage:o}=this;let s="",a="";const r=i.unreadCount>0&&i.messageRemindType===t.TYPES.MSG_REMIND_ACPT_NOT_NOTE?`[${i.unreadCount>99?"99+":i.unreadCount}${n("TUIConversation.条")}]`:"";if(i.type===t.TYPES.CONV_GROUP)if(o.fromAccount===t.getMyUserID())s=n("TUIConversation.我");else{const e=o.fromAccount;s=t.TUIFriend.getFriendRemark([e])[e]||o.nameCard||o.nick||e}if(o.type===t.TYPES.MSG_TEXT)a=this.decodeTextMessage(o.payload.text);else if(o.type===t.TYPES.MSG_CUSTOM){const i=tf(null===(e=null==o?void 0:o.payload)||void 0===e?void 0:e.data);if(1===(null==i?void 0:i.businessID))return a=t.TUIChat.messageHandler.handleCallKitSignaling(o),a;a=Df.includes(o.messageForShow)?n(`TUIChat.${o.messageForShow}`):o.messageForShow}else a=Df.includes(o.messageForShow)?n(`TUIChat.${o.messageForShow}`):o.messageForShow;return o.isRevoked&&(a=n("TUIChat.撤回了一条消息")),i.type===t.TYPES.CONV_GROUP&&o.type===t.TYPES.MSG_GRP_TIP?a:`${r}${s?`${s}:`:""}${a}`}decodeTextMessage(e){if(kf(e))return e;const t=/(\[.+?\])/g;let n=e;if(t.test(e)){const i=this.getEngine(),o=i.TUITranslate.t.bind(i.TUITranslate);n=e.replace(t,(e=>{const t=o(`Emoji.${e}`);return uf||!t||t.startsWith("Emoji.")?sf[e]||e:t}))}return n}}class Of{constructor(){this.defaultStore={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null,operationTypeMap:new Map},this.store={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null,operationTypeMap:new Map}}update(e,t){switch(e){case"conversationList":this.updateConversationList(t);break;case"operationTypeMap":this.updateOperationTypeMap(t);break;default:this.store[e]=t}}getData(e){return this.store[e]}getModel(e){return this.store.conversationList.find((t=>t.conversationID===e))}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateConversationList(e){const t=[];e.forEach((e=>{let n=e;e instanceof Rf?n.updateProperties(e):n=new Rf(e);const i=this.getOperationType(e);n.updateOperationType(i),t.push(n)})),this.store.conversationList=t}updateOperationTypeMap(e){const{conversationID:t,operationType:n=0}=e;this.store.operationTypeMap.set(t,n)}getOperationType(e){const{conversationID:t}=e;return this.store.operationTypeMap.get(t)||0}}class bf extends Tf{constructor(e){super(),this.messageHandlers={[this.getEngine().TYPES.MSG_TEXT]:e=>this.getEngine().TUIChat.messageHandler.handleTextMessage(e),[this.getEngine().TYPES.MSG_FACE]:e=>this.getEngine().TUIChat.messageHandler.handleFaceMessage(e),[this.getEngine().TYPES.MSG_LOCATION]:e=>this.getEngine().TUIChat.messageHandler.handleLocationMessage(e),[this.getEngine().TYPES.MSG_IMAGE]:e=>this.getEngine().TUIChat.messageHandler.handleImageMessage(e),[this.getEngine().TYPES.MSG_AUDIO]:e=>this.getEngine().TUIChat.messageHandler.handleAudioMessage(e),[this.getEngine().TYPES.MSG_VIDEO]:e=>this.getEngine().TUIChat.messageHandler.handleVideoMessage(e),[this.getEngine().TYPES.MSG_FILE]:e=>this.getEngine().TUIChat.messageHandler.handleFileMessage(e),[this.getEngine().TYPES.MSG_CUSTOM]:e=>this.getEngine().TUIChat.messageHandler.handleCustomMessage(e),[this.getEngine().TYPES.MSG_MERGER]:e=>this.getEngine().TUIChat.messageHandler.handleMergeMessage(e),[this.getEngine().TYPES.MSG_GRP_TIP]:e=>this.getEngine().TUIChat.messageHandler.handleGroupTipsMessage(e)},this._message=e,this._signalingInfo=void 0,this.progress=0,this.reactionList=[],this.initProperties(e)}initProperties(e){Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}updateProperties(e){this._message=e,Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}getMessage(){return this._message}modifyMessage(e){return e.type&&this._message.type!==e.type&&!e.payload?Promise.reject({code:Yg.MISMATCH_TYPE_AND_PAYLOAD,message:Jg.MISMATCH_TYPE_AND_PAYLOAD}):(this._message.type=e.type||this._message.type,this._message.payload=e.payload||this._message.payload,this._message.cloudCustomData=e.cloudCustomData||this._message.cloudCustomData,this.getEngine().TUIChat.modifyMessage(this._message))}revokeMessage(){return this.getEngine().TUIChat.revokeMessage(this._message)}resendMessage(){return this.getEngine().TUIChat.resendMessage(this._message)}deleteMessage(){return this.getEngine().TUIChat.deleteMessage([this._message])}quoteMessage(){return this.getEngine().TUIChat.quoteMessage(this._message)}replyMessage(){return this.getEngine().TUIChat.replyMessage(this._message)}setMessageExtensions(e){return this.getEngine().TUIChat.setMessageExtensions(this._message,e)}getMessageExtensions(){return this.getEngine().TUIChat.getMessageExtensions(this._message)}deleteMessageExtensions(e){return this.getEngine().TUIChat.deleteMessageExtensions(this._message,e)}getSignalingInfo(){return this.type!==this.getEngine().TYPES.MSG_CUSTOM?null:Qg(this._signalingInfo)?(this._signalingInfo=this.getEngine().chat.getSignalingInfo(this._message),this._signalingInfo):this._signalingInfo}getMessageContent(){const e=this.messageHandlers[this.type];if(Qg(e))return{};if(this.type===this.getEngine().TYPES.MSG_GRP_TIP)return e(this._message);const t=this.getEngine().TUIFriend.getFriendRemark([this.from]);return Object.assign(Object.assign({},e(this._message)),{showName:t[this.from]||this.nameCard||this.nick||this.from})}sendForwardMessage(e){return this.getEngine().TUIChat.sendForwardMessage(e,[this._message])}}class Af{constructor(){this.defaultStore={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0,voiceToTextInfo:void 0,userInfo:{}},this.store={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0,voiceToTextInfo:void 0,userInfo:{}}}update(e,t){switch(e){case"messageList":this.updateMessageList(t);break;case"translateTextInfo":this.updateTranslateTextInfo(t);break;case"voiceToTextInfo":this.updateVoiceToTextInfo(t);break;default:this.store[e]=t}}getData(e){return this.store[e]}getModel(e){return this.store.messageList.find((t=>t.ID===e))}reset(e=[]){const t=e.filter((e=>!cf.includes(e)));this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==t?void 0:t.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateMessageList(e){const t=[];e.forEach((e=>{let n=e;e instanceof bf||(n=this.getModel(e.ID),n?n.updateProperties(e):n=new bf(e)),t.push(n)})),this.store.messageList=t}updateTranslateTextInfo(e){this.updateBykey("translateTextInfo",e)}updateVoiceToTextInfo(e){this.updateBykey("voiceToTextInfo",e)}updateBykey(e,t){const{conversationID:n,messageID:i,visible:o=!1}=t;this.store[e]||(this.store[e]=new Map),this.store[e].has(n)||this.store[e].set(n,[]);const s=this.store[e].get(n)||[];let a=!0;for(let r=0;r<s.length;r++)if(s[r].messageID===i){s[r].visible=o,a=!1;break}a&&s.push({messageID:i,visible:o}),this.store[e].set(n,s)}}class Lf{constructor(e){this.groupAttributes={},this.groupCounters={},this.initProxy(e)}initProxy(e){Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}}class Pf{constructor(){this.defaultStore={currentGroupID:"",currentGroup:{},currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[],isCompleted:!1,offset:0},this.store={currentGroupID:"",currentGroup:void 0,currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[],isCompleted:!1,offset:0}}update(e,t){switch(e){case"groupList":this.updateGroupList(t);break;case"currentGroup":this.store.currentGroup=t instanceof Lf?t:new Lf(t);break;default:this.store[e]=t}}getData(e){if("groupSystemNoticeList"===e){const e=[...this.store.groupSystemNoticeList];return this.store.groupSystemNoticeList.length=0,e}return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateGroupList(e){this.store.groupList=e.map((e=>e instanceof Lf?e:new Lf(e)))}}class Nf{constructor(){this.store={}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(this.store={}),this.store=Object.assign(Object.assign({},this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:void 0})),{}))}}class wf{constructor(){this.defaultStore={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0},this.store={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class Uf{constructor(){this.defaultStore={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1},this.store={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==e?void 0:e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class Gf{constructor(){this.storeMap={[jg.APP]:new Sf,[jg.USER]:new Ef,[jg.CONV]:new Of,[jg.CHAT]:new Af,[jg.GRP]:new Pf,[jg.FRIEND]:new wf,[jg.SEARCH]:new Uf},this.task={}}static getInstance(){return Gf.instance||(Gf.instance=new Gf),Gf.instance}watch(e,t){this.task[e]||(this.task[e]={});const n=this.task[e];Object.keys(t).forEach((i=>{const o=t[i];n[i]||(n[i]=new Map),n[i].set(o,1),this.notifyOnWatch(e,i,o)}))}unwatch(e,t){if(!this.task[e])return;const n=this.task[e];Object.keys(t).forEach((e=>{var i;null===(i=n[e])||void 0===i||i.delete(t[e])}))}update(e,t,n){var i;e!==jg.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new Nf),null===(i=this.storeMap[e])||void 0===i||i.update(t,n),this.notify(e,t)}getData(e,t){var n;return e!==jg.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new Nf),null===(n=this.storeMap[e])||void 0===n?void 0:n.getData(t)}getConversationModel(e){var t;return null===(t=this.storeMap[jg.CONV])||void 0===t?void 0:t.getModel(e)}getMessageModel(e){var t;return null===(t=this.storeMap[jg.CHAT])||void 0===t?void 0:t.getModel(e)}reset(e,t=[],n=!1){if(e in this.storeMap){const i=this.storeMap[e];0===t.length&&(t=Object.keys(null==i?void 0:i.store)),i.reset(t),n&&t.forEach((t=>{this.notify(e,t)}))}}notifyOnWatch(e,t,n){const i=this.getData(e,t);rf.indexOf(t)>-1&&0===i.length||n&&n.call(this,i)}notify(e,t){if(!this.task[e])return;const n=this.task[e];if(n[t]){const i=n[t],o=this.getData(e,t);for(const[e]of i.entries())e.call(this,o)}}}function xf(e){return(xf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ff(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bf(e){var t=function(e){if("object"!=xf(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=xf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xf(t)?t:t+""}function qf(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Bf(i.key),i)}}function Vf(e,t,n){return t&&qf(e.prototype,t),n&&qf(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function jf(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hf(e,t){return(Hf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Kf(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Hf(e,t)}function zf(e,t){if(t&&("object"==xf(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return jf(e)}function Wf(e){return(Wf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Yf(e,t,n){return(t=Bf(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Jf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Xf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jf(Object(n),!0).forEach((function(t){Yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Qf={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},Zf=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ff(this,e),this.init(t,n)}return Vf(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Qf,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,i){return i&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Xf(Xf({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),em=function(){function e(){Ff(this,e),this.observers={}}return Vf(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,n)})),this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(n))}))}}]),e}();function tm(){var e,t,n=new Promise((function(n,i){e=n,t=i}));return n.resolve=e,n.reject=t,n}function nm(e){return null==e?"":""+e}function im(e,t,n){function i(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var s="string"!=typeof t?[].concat(t):t.split(".");s.length>1;){if(o())return{};var a=i(s.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return o()?{}:{obj:e,k:i(s.shift())}}function om(e,t,n){var i=im(e,t,Object);i.obj[i.k]=n}function sm(e,t){var n=im(e,t),i=n.obj,o=n.k;if(i)return i[o]}function am(e,t,n){for(var i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?"string"==typeof e[i]||e[i]instanceof String||"string"==typeof t[i]||t[i]instanceof String?n&&(e[i]=t[i]):am(e[i],t[i],n):e[i]=t[i]);return e}function rm(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var cm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function um(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return cm[e]})):e}var lm="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,dm=[" ",",","?","!",";"];function pm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var i=t.split(n),o=e,s=0;s<i.length;++s){if(!o)return;if("string"==typeof o[i[s]]&&s+1<i.length)return;if(void 0===o[i[s]]){for(var a=2,r=i.slice(s,s+a).join(n),c=o[r];void 0===c&&i.length>s+a;)a++,c=o[r=i.slice(s,s+a).join(n)];if(void 0===c)return;if(null===c)return null;if(t.endsWith(r)){if("string"==typeof c)return c;if(r&&"string"==typeof c[r])return c[r]}var u=i.slice(s+a).join(n);return u?pm(c,u,n):void 0}o=o[i[s]]}return o}}function hm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function gm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hm(Object(n),!0).forEach((function(t){Yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var fm=function(){Kf(t,em);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Wf(e);if(t){var o=Wf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return zf(this,n)}}(t);function t(n){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Ff(this,t),i=e.call(this),lm&&em.call(jf(i)),i.data=n||{},i.options=o,void 0===i.options.keySeparator&&(i.options.keySeparator="."),void 0===i.options.ignoreJSONStructure&&(i.options.ignoreJSONStructure=!0),i}return Vf(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,s=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."));var r=sm(this.data,a);return r||!s||"string"!=typeof n?r:pm(this.data&&this.data[e]&&this.data[e][t],n,o)}},{key:"addResource",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},s=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,a=[e,t];n&&(a=a.concat(s?n.split(s):n)),e.indexOf(".")>-1&&(i=t,t=(a=e.split("."))[1]),this.addNamespaces(t),om(this.data,a,i),o.silent||this.emit("added",e,t,n,i)}},{key:"addResources",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in n)"string"!=typeof n[o]&&"[object Array]"!==Object.prototype.toString.apply(n[o])||this.addResource(e,t,o,n[o],{silent:!0});i.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,i,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(i=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var r=sm(this.data,a)||{};i?am(r,n,o):r=gm(gm({},r),n),om(this.data,a,r),s.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?gm(gm({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),t}(),mm={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,i,o){var s=this;return e.forEach((function(e){s.processors[e]&&(t=s.processors[e].process(t,n,i,o))})),t}};function _m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function vm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_m(Object(n),!0).forEach((function(t){Yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ym={},Im=function(){Kf(t,em);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Wf(e);if(t){var o=Wf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return zf(this,n)}}(t);function t(n){var i,o,s,a,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ff(this,t),i=e.call(this),lm&&em.call(jf(i)),o=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],s=n,a=jf(i),o.forEach((function(e){s[e]&&(a[e]=s[e])})),i.options=r,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=Zf.create("translator"),i}return Vf(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],s=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var i=dm.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===i.length)return!0;var o=new RegExp("(".concat(i.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),s=!o.test(e);if(!s){var a=e.indexOf(n);a>0&&!o.test(e.substring(0,a))&&(s=!0)}return s}(e,n,i));if(s&&!a){var r=e.match(this.interpolator.nestingRegexp);if(r&&r.length>0)return{key:e,namespaces:o};var c=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),e=c.join(i)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,n,i){var o=this;if("object"!==xf(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),"object"===xf(n)&&(n=vm({},n)),n||(n={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var s=void 0!==n.returnDetails?n.returnDetails:this.options.returnDetails,a=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,r=this.extractFromKey(e[e.length-1],n),c=r.key,u=r.namespaces,l=u[u.length-1],d=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(p){var h=n.nsSeparator||this.options.nsSeparator;return s?{res:"".concat(l).concat(h).concat(c),usedKey:c,exactUsedKey:c,usedLng:d,usedNS:l}:"".concat(l).concat(h).concat(c)}return s?{res:c,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:l}:c}var g=this.resolve(e,n),f=g&&g.res,m=g&&g.usedKey||c,_=g&&g.exactUsedKey||c,v=Object.prototype.toString.apply(f),y=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,I=!this.i18nFormat||this.i18nFormat.handleAsObject;if(I&&f&&"string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f&&["[object Number]","[object Function]","[object RegExp]"].indexOf(v)<0&&("string"!=typeof y||"[object Array]"!==v)){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,f,vm(vm({},n),{},{ns:u})):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");return s?(g.res=M,g):M}if(a){var C="[object Array]"===v,S=C?[]:{},E=C?_:m;for(var T in f)if(Object.prototype.hasOwnProperty.call(f,T)){var k="".concat(E).concat(a).concat(T);S[T]=this.translate(k,vm(vm({},n),{joinArrays:!1,ns:u})),S[T]===k&&(S[T]=f[T])}f=S}}else if(I&&"string"==typeof y&&"[object Array]"===v)(f=f.join(y))&&(f=this.extendTranslation(f,e,n,i));else{var D=!1,R=!1,O=void 0!==n.count&&"string"!=typeof n.count,b=t.hasDefaultValue(n),A=O?this.pluralResolver.getSuffix(d,n.count,n):"",L=n["defaultValue".concat(A)]||n.defaultValue;!this.isValidLookup(f)&&b&&(D=!0,f=L),this.isValidLookup(f)||(R=!0,f=c);var P=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&R?void 0:f,N=b&&L!==f&&this.options.updateMissing;if(R||D||N){if(this.logger.log(N?"updateKey":"missingKey",d,l,c,N?L:f),a){var w=this.resolve(c,vm(vm({},n),{},{keySeparator:!1}));w&&w.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var U=[],G=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&G&&G[0])for(var x=0;x<G.length;x++)U.push(G[x]);else"all"===this.options.saveMissingTo?U=this.languageUtils.toResolveHierarchy(n.lng||this.language):U.push(n.lng||this.language);var F=function(e,t,i){var s=b&&i!==f?i:P;o.options.missingKeyHandler?o.options.missingKeyHandler(e,l,t,s,N,n):o.backendConnector&&o.backendConnector.saveMissing&&o.backendConnector.saveMissing(e,l,t,s,N,n),o.emit("missingKey",e,l,t,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&O?U.forEach((function(e){o.pluralResolver.getSuffixes(e,n).forEach((function(t){F([e],c+t,n["defaultValue".concat(t)]||L)}))})):F(U,c,L))}f=this.extendTranslation(f,e,n,g,i),R&&f===c&&this.options.appendNamespaceToMissingKey&&(f="".concat(l,":").concat(c)),(R||D)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(l,":").concat(c):c,D?f:void 0):this.options.parseMissingKeyHandler(f))}return s?(g.res=f,g):f}},{key:"extendTranslation",value:function(e,t,n,i,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,vm(vm({},this.options.interpolation.defaultVariables),n),i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(vm(vm({},n),{interpolation:vm(vm({},this.options.interpolation),n.interpolation)}));var a,r="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(r){var c=e.match(this.interpolator.nestingRegexp);a=c&&c.length}var u=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(u=vm(vm({},this.options.interpolation.defaultVariables),u)),e=this.interpolator.interpolate(e,u,n.lng||this.language,n),r){var l=e.match(this.interpolator.nestingRegexp);a<(l&&l.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&i&&i.res&&(n.lng=i.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return o&&o[0]===i[0]&&!n.context?(s.logger.warn("It seems you are nesting recursively key: ".concat(i[0]," in key: ").concat(t[0])),null):s.translate.apply(s,i.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,p="string"==typeof d?[d]:d;return null!=e&&p&&p.length&&!1!==n.applyPostProcessor&&(e=mm.handle(p,e,t,this.options&&this.options.postProcessPassResolved?vm({i18nResolved:i},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,i,o,s,a=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var c=a.extractFromKey(e,r),u=c.key;n=u;var l=c.namespaces;a.options.fallbackNS&&(l=l.concat(a.options.fallbackNS));var d=void 0!==r.count&&"string"!=typeof r.count,p=d&&!r.ordinal&&0===r.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==r.context&&("string"==typeof r.context||"number"==typeof r.context)&&""!==r.context,g=r.lngs?r.lngs:a.languageUtils.toResolveHierarchy(r.lng||a.language,r.fallbackLng);l.forEach((function(e){a.isValidLookup(t)||(s=e,!ym["".concat(g[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(s)&&(ym["".concat(g[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(g.join(", "),'" won\'t get resolved as namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach((function(n){if(!a.isValidLookup(t)){o=n;var s,c=[u];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(c,u,n,e,r);else{var l;d&&(l=a.pluralResolver.getSuffix(n,r.count,r));var g="".concat(a.options.pluralSeparator,"zero");if(d&&(c.push(u+l),p&&c.push(u+g)),h){var f="".concat(u).concat(a.options.contextSeparator).concat(r.context);c.push(f),d&&(c.push(f+l),p&&c.push(f+g))}}for(;s=c.pop();)a.isValidLookup(t)||(i=s,t=a.getResource(n,e,s,r))}})))}))}})),{res:t,usedKey:n,exactUsedKey:i,usedLng:o,usedNS:s}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,i):this.resourceStore.getResource(e,t,n,i)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),t}();function Mm(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Cm=function(){function e(t){Ff(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Zf.create("languageUtils")}return Vf(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Mm(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Mm(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Mm(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var i=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(i)||(t=i)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var i=n.getLanguagePartFromCode(e);if(n.isSupportedCode(i))return t=i;t=n.options.supportedLngs.find((function(e){return e===i?e:e.indexOf("-")<0&&i.indexOf("-")<0?void 0:0===e.indexOf(i)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],s=function(e){e&&(n.isSupportedCode(e)?o.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&s(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&s(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&s(this.getLanguagePartFromCode(e))):"string"==typeof e&&s(this.formatLanguageCode(e)),i.forEach((function(e){o.indexOf(e)<0&&s(n.formatLanguageCode(e))})),o}}]),e}(),Sm=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Em={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},Tm=["v1","v2","v3"],km={zero:0,one:1,two:2,few:3,many:4,other:5},Dm=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ff(this,e),this.languageUtils=t,this.options=i,this.logger=Zf.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},Sm.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:Em[e.fc]}}))})),n)}return Vf(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(n){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.getRule(e,n);return i?this.shouldUseIntlApi()?i.resolvedOptions().pluralCategories.sort((function(e,t){return km[e]-km[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):i.numbers.map((function(i){return t.getSuffix(e,i,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.getRule(e,n);return i?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(i.select(t)):this.getSuffixRetroCompatible(i,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,i=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[i];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return n.options.prepend&&o.toString()?n.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?s():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}},{key:"shouldUseIntlApi",value:function(){return!Tm.includes(this.options.compatibilityJSON)}}]),e}();function Rm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Om(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rm(Object(n),!0).forEach((function(t){Yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bm(e,t,n){var i,o,s,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],c=(i=t,void 0!==(s=sm(e,o=n))?s:sm(i,o));return!c&&r&&"string"==typeof n&&void 0===(c=pm(e,n,a))&&(c=pm(t,n,a)),c}var Am=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ff(this,e),this.logger=Zf.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Vf(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:um,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?rm(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?rm(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?rm(t.nestingPrefix):t.nestingPrefixEscaped||rm("$t("),this.nestingSuffix=t.nestingSuffix?rm(t.nestingSuffix):t.nestingSuffixEscaped||rm(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,i){var o,s,a,r=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(r.formatSeparator)<0){var o=bm(t,c,e,r.options.keySeparator,r.options.ignoreJSONStructure);return r.alwaysFormat?r.format(o,void 0,n,Om(Om(Om({},i),t),{},{interpolationkey:e})):o}var s=e.split(r.formatSeparator),a=s.shift().trim(),u=s.join(r.formatSeparator).trim();return r.format(bm(t,c,a,r.options.keySeparator,r.options.ignoreJSONStructure),u,n,Om(Om(Om({},i),t),{},{interpolationkey:a}))};this.resetRegExp();var d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i&&i.interpolation&&void 0!==i.interpolation.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return r.escapeValue?u(r.escape(e)):u(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){var n=o[1].trim();if(void 0===(s=l(n)))if("function"==typeof d){var c=d(e,o,i);s="string"==typeof c?c:""}else if(i&&Object.prototype.hasOwnProperty.call(i,n))s="";else{if(p){s=o[0];continue}r.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),s=""}else"string"==typeof s||r.useRawValueToEscape||(s=nm(s));var u=t.safeValue(s);if(e=e.replace(o[0],u),p?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=r.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,i,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function r(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var i=e.split(new RegExp("".concat(n,"[ ]*{"))),s="{".concat(i[1]);e=i[0];var a=(s=this.interpolate(s,o)).match(/'/g),r=s.match(/"/g);(a&&a.length%2==0&&!r||r.length%2!=0)&&(s=s.replace(/'/g,'"'));try{o=JSON.parse(s),t&&(o=Om(Om({},t),o))}catch(c){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),c),"".concat(e).concat(n).concat(s)}return delete o.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var c=[];(o=(o=Om({},a)).replace&&"string"!=typeof o.replace?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;var u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var l=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=l.shift(),c=l,u=!0}if((i=t(r.call(this,n[1].trim(),o),o))&&n[0]===e&&"string"!=typeof i)return i;"string"!=typeof i&&(i=nm(i)),i||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),i=""),u&&(i=c.reduce((function(e,t){return s.format(e,t,a.lng,Om(Om({},a),{},{interpolationkey:n[1].trim()}))}),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}]),e}();function Lm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Pm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lm(Object(n),!0).forEach((function(t){Yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nm(e){var t={};return function(n,i,o){var s=i+JSON.stringify(o),a=t[s];return a||(a=e(i,o),t[s]=a),a(n)}}var wm=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ff(this,e),this.logger=Zf.create("formatter"),this.options=t,this.formats={number:Nm((function(e,t){var n=new Intl.NumberFormat(e,Pm({},t));return function(e){return n.format(e)}})),currency:Nm((function(e,t){var n=new Intl.NumberFormat(e,Pm(Pm({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:Nm((function(e,t){var n=new Intl.DateTimeFormat(e,Pm({},t));return function(e){return n.format(e)}})),relativetime:Nm((function(e,t){var n=new Intl.RelativeTimeFormat(e,Pm({},t));return function(e){return n.format(e,t.range||"day")}})),list:Nm((function(e,t){var n=new Intl.ListFormat(e,Pm({},t));return function(e){return n.format(e)}}))},this.init(t)}return Vf(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Nm(t)}},{key:"format",value:function(e,t,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce((function(e,t){var s=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var i=e.split("(");t=i[0].toLowerCase().trim();var o=i[1].substring(0,i[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach((function(e){if(e){var t=function(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return $f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.split(":")),i=t[0],o=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[i.trim()]||(n[i.trim()]=o),"false"===o&&(n[i.trim()]=!1),"true"===o&&(n[i.trim()]=!0),isNaN(o)||(n[i.trim()]=parseInt(o,10))}}))}return{formatName:t,formatOptions:n}}(t),a=s.formatName,r=s.formatOptions;if(i.formats[a]){var c=e;try{var u=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},l=u.locale||u.lng||o.locale||o.lng||n;c=i.formats[a](e,l,Pm(Pm(Pm({},r),o),u))}catch(d){i.logger.warn(d)}return c}return i.logger.warn("there was no format function for ".concat(a)),e}),e)}}]),e}();function Um(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Gm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Um(Object(n),!0).forEach((function(t){Yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Um(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var xm=function(){Kf(t,em);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Wf(e);if(t){var o=Wf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return zf(this,n)}}(t);function t(n,i,o){var s,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Ff(this,t),s=e.call(this),lm&&em.call(jf(s)),s.backend=n,s.store=i,s.services=o,s.languageUtils=o.languageUtils,s.options=a,s.logger=Zf.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=a.maxParallelReads||10,s.readingCalls=0,s.maxRetries=a.maxRetries>=0?a.maxRetries:5,s.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(o,a.backend,a),s}return Vf(t,[{key:"queueLoad",value:function(e,t,n,i){var o=this,s={},a={},r={},c={};return e.forEach((function(e){var i=!0;t.forEach((function(t){var r="".concat(e,"|").concat(t);!n.reload&&o.store.hasResourceBundle(e,t)?o.state[r]=2:o.state[r]<0||(1===o.state[r]?void 0===a[r]&&(a[r]=!0):(o.state[r]=1,i=!1,void 0===a[r]&&(a[r]=!0),void 0===s[r]&&(s[r]=!0),void 0===c[t]&&(c[t]=!0)))})),i||(r[e]=!0)})),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(r),toLoadNamespaces:Object.keys(c)}}},{key:"loaded",value:function(e,t,n){var i=e.split("|"),o=i[0],s=i[1];t&&this.emit("failedLoading",o,s,t),n&&this.store.addResourceBundle(o,s,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){var i,r,c,u,l,d,p;i=n.loaded,r=s,(u=(c=im(i,[o],Object)).obj)[l=c.k]=u[l]||[],u[l].push(r),p=e,void 0!==(d=n).pending[p]&&(delete d.pending[p],d.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:o,wait:s,callback:a});else{this.readingCalls++;var r=function(r,c){if(i.readingCalls--,i.waitingReads.length>0){var u=i.waitingReads.shift();i.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}r&&c&&o<i.maxRetries?setTimeout((function(){i.read.call(i,e,t,n,o+1,2*s,a)}),s):a(r,c)},c=this.backend[n].bind(this.backend);if(2!==c.length)return c(e,t,r);try{var u=c(e,t);u&&"function"==typeof u.then?u.then((function(e){return r(null,e)})).catch(r):r(null,u)}catch(l){r(l)}}}},{key:"prepareLoading",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var s=this.queueLoad(e,t,i,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split("|"),o=i[0],s=i[1];this.read(o,s,"read",void 0,void 0,(function(i,a){i&&t.logger.warn("".concat(n,"loading namespace ").concat(s," for language ").concat(o," failed"),i),!i&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(s," for language ").concat(o),a),t.loaded(e,i,a)}))}},{key:"saveMissing",value:function(e,t,n,i,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var r=Gm(Gm({},s),{},{isUpdate:o}),c=this.backend.create.bind(this.backend);if(c.length<6)try{var u;(u=5===c.length?c(e,t,n,i,r):c(e,t,n,i))&&"function"==typeof u.then?u.then((function(e){return a(null,e)})).catch(a):a(null,u)}catch(l){a(l)}else c(e,t,n,i,a,r)}e&&e[0]&&this.store.addResource(e[0],t,n,i)}}}]),t}();function Fm(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===xf(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===xf(e[2])||"object"===xf(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Bm(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function qm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Vm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qm(Object(n),!0).forEach((function(t){Yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jm(){}var Hm=function(){Kf(t,em);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Wf(e);if(t){var o=Wf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return zf(this,n)}}(t);function t(){var n,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Ff(this,t),n=e.call(this),lm&&em.call(jf(n)),n.options=Bm(o),n.services={},n.logger=Zf,n.modules={external:[]},i=jf(n),Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((function(e){"function"==typeof i[e]&&(i[e]=i[e].bind(i))})),s&&!n.isInitialized&&!o.isClone){if(!n.options.initImmediate)return n.init(o,s),zf(n,jf(n));setTimeout((function(){n.init(o,s)}),0)}return n}return Vf(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var i=Fm();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=Vm(Vm(Vm({},i),this.options),Bm(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=Vm(Vm({},i.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var s;this.modules.logger?Zf.init(o(this.modules.logger),this.options):Zf.init(null,this.options),this.modules.formatter?s=this.modules.formatter:"undefined"!=typeof Intl&&(s=wm);var a=new Cm(this.options);this.store=new fm(this.options.resources,this.options);var r=this.services;r.logger=Zf,r.resourceStore=this.store,r.languageUtils=a,r.pluralResolver=new Dm(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!s||this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format||(r.formatter=o(s),r.formatter.init(r,this.options),this.options.interpolation.format=r.formatter.format.bind(r.formatter)),r.interpolator=new Am(this.options),r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},r.backendConnector=new xm(o(this.modules.backend),r.resourceStore,r,this.options),r.backendConnector.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];e.emit.apply(e,[t].concat(i))})),this.modules.languageDetector&&(r.languageDetector=o(this.modules.languageDetector),r.languageDetector.init&&r.languageDetector.init(r,this.options.detection,this.options)),this.modules.i18nFormat&&(r.i18nFormat=o(this.modules.i18nFormat),r.i18nFormat.init&&r.i18nFormat.init(this)),this.translator=new Im(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];e.emit.apply(e,[t].concat(i))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=jm),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&"dev"!==c[0]&&(this.options.lng=c[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var u=tm(),l=function(){var t=function(t,i){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(i),n(t,i)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?l():setTimeout(l,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jm,i="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return n();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return s(e)})),this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,n){var i=tm();return e||(e=this.languages),t||(t=this.options.ns),n||(n=jm),this.services.backendConnector.reload(e,t,(function(e){i.resolve(),n(e)})),i}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&mm.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var i=tm();this.emit("languageChanging",e);var o=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},s=function(s){e||s||!n.services.languageDetector||(s=[]);var a="string"==typeof s?s:n.services.languageUtils.getBestMatchFromCodes(s);a&&(n.language||o(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){var s,r;s=e,(r=a)?(o(r),n.translator.changeLanguage(r),n.isLanguageChangingTo=void 0,n.emit("languageChanged",r),n.logger.log("languageChanged",r)):n.isLanguageChangingTo=void 0,i.resolve((function(){return n.t.apply(n,arguments)})),t&&t(s,(function(){return n.t.apply(n,arguments)}))}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),i}},{key:"getFixedT",value:function(e,t,n){var i=this,o=function e(t,o){var s;if("object"!==xf(o)){for(var a=arguments.length,r=new Array(a>2?a-2:0),c=2;c<a;c++)r[c-2]=arguments[c];s=i.options.overloadTranslationOptionHandler([t,o].concat(r))}else s=Vm({},o);s.lng=s.lng||e.lng,s.lngs=s.lngs||e.lngs,s.ns=s.ns||e.ns,s.keyPrefix=s.keyPrefix||n||e.keyPrefix;var u,l=i.options.keySeparator||".";return u=s.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(s.keyPrefix).concat(l).concat(e)})):s.keyPrefix?"".concat(s.keyPrefix).concat(l).concat(t):t,i.t(u,s)};return"string"==typeof e?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var i=n.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,s=this.languages[this.languages.length-1];if("cimode"===i.toLowerCase())return!0;var a=function(e,n){var i=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===i||2===i};if(n.precheck){var r=n.precheck(this,a);if(void 0!==r)return r}return!(!this.hasResourceBundle(i,e)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!a(i,e)||o&&!a(s,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,i=tm();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=tm();"string"==typeof e&&(e=[e]);var i=this.options.preload||[],o=e.filter((function(e){return i.indexOf(e)<0}));return o.length?(this.options.preload=i.concat(o),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new Cm(Fm());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jm,o=Vm(Vm(Vm({},this.options),n),{isClone:!0}),s=new t(o);return void 0===n.debug&&void 0===n.prefix||(s.logger=s.logger.clone(n)),["store","services","language"].forEach((function(t){s[t]=e[t]})),s.services=Vm({},this.services),s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s.translator=new Im(s.services,s.options),s.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];s.emit.apply(s,[e].concat(n))})),s.init(o,i),s.translator.options=s.options,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),t}();Yf(Hm,"createInstance",(function(){return new Hm(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var Km=Hm.createInstance();Km.createInstance=Hm.createInstance,Km.createInstance,Km.dir,Km.init,Km.loadResources,Km.reloadResources,Km.use,Km.changeLanguage,Km.getFixedT,Km.t,Km.exists,Km.setDefaultNamespace,Km.hasLoadedNamespace,Km.loadNamespaces,Km.loadLanguages;class zm extends Tf{constructor(){super(),this.languages=null,this.keyMap={}}static getInstance(){return zm.instance||(zm.instance=new zm),zm.instance}provideLanguages(e){var t;uf||(this.languages=e,(null===(t=e["zh-CN"])||void 0===t?void 0:t.Chat)&&this.setKeyMap(e["zh-CN"]),console.log("TUITranslateService.provideLanguages ok."))}useI18n(e){var t;if(uf)return;if(!this.languages)return void console.warn("TUITranslateService.useI18next not have messages.");const n={};for(const[o,s]of Object.entries(this.languages))n["zh_cn"===o?"zh":o]={translation:s};Km.init({compatibilityJSON:"v3",lng:e||"zh",fallbackLng:"zh",detection:{order:["querystring","navigator"],caches:["localStorage","cookie"]},resources:n});let i=this.normalizeLanguageKey(e||"zh");null===(t=this.getEngine().TUIReport)||void 0===t||t.reportFeature(201,i)}changeLanguage(e){let t=this.normalizeLanguageKey(e);return this.getEngine().TUIReport.reportFeature(201,t),Km.changeLanguage(e)}normalizeLanguageKey(e){return e.includes("en")?"en-us":e.includes("tw")?"zh-tw":e.includes("zh")||e.includes("cn")?"zh-cn":e.includes("ko")||e.includes("kr")?"ko-kr":e.includes("ja")||e.includes("jp")?"ja-jp":"other-"+e}t(e){if(!this.languages){let t=e;return!Qg(e)&&e.indexOf(".")>-1&&(t=e.split(".").pop()||""),t}const t=this.keyMap[e];return t?Km.t(t):Km.t(e)}setKeyMap(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=t?`${t}.${n}`:n;if(e[n]&&"object"==typeof e[n]&&!Array.isArray(e[n])&&null!==e[n])this.setKeyMap(e[n],i);else{let i=t?`${t}.${e[n]}`:e[n];i=this.replaceKey(i),this.keyMap[i]=`${t}.${n}`}}}replaceKey(e){return e.startsWith("Chat")?e.replace("Chat","TUIChat"):e.startsWith("Conversation")?e.replace("Conversation","TUIConversation"):e.startsWith("Message")?e.replace("Message","message.tip"):e.startsWith("Call")?e.replace("Call","message.custom"):e}}class Wm extends Tf{constructor(){super(),this.serv="TUIConversationService"}static getInstance(){return Wm.instance||(Wm.instance=new Wm),Wm.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalUnreadCountUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getConversationInitData()}onConversationListUpdated(e){const t=this.filterSystemConversation(e);this.getEngine().TUIStore.update(jg.CONV,"conversationList",t),this.updateCurrentConversation()}onTotalUnreadCountUpdated(e){this.getEngine().TUIStore.update(jg.CONV,"totalUnreadCount",e)}onMessageReceived(e){const t=this.getEngine(),n=this.getEngine().TUIStore.getData(jg.CONV,"conversationList");let i=!1;for(let o=0;o<e.length;o++){if(e[o].type!==t.TYPES.MSG_GRP_SYS_NOTICE)continue;const{operationType:s}=e[o].payload,a=`GROUP${e[o].to}`,r=4===s||5===s||8===s,c=2===s||6===s||7===s;if(r||c)for(let e=0;e<n.length;e++)if(n[e].type!==t.TYPES.CONV_C2C&&n[e].conversationID===a){if(r){this.getEngine().TUIStore.update(jg.CONV,"operationTypeMap",{conversationID:a,operationType:s}),i=!0;break}if(c&&n[e].operationType>0){this.getEngine().TUIStore.update(jg.CONV,"operationTypeMap",{conversationID:a,operationType:0}),i=!0;break}}}if(i){this.getEngine().TUIStore.update(jg.CONV,"conversationList",n);const e=this.getEngine().TUIStore.getData(jg.CONV,"currentConversationID")||"",t=this.findConversation(e);t&&this.getEngine().TUIStore.update(jg.CONV,"currentConversation",t)}}getConversationInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getConversationList().then((t=>{const{conversationList:n,isSyncCompleted:i}=t.data;if(console.log(`${this.serv}.init, getConversationList count:${n.length} isSyncCompleted:${i}`),n.length>0){this.onConversationListUpdated(n);const t=e.chat.getTotalUnreadMessageCount();this.onTotalUnreadCountUpdated(t)}}))}switchConversation(e){return Bg(this,void 0,void 0,(function*(){const t=`${this.serv}.switchConversation`,n=this.getEngine();if(!e)return n.TUIStore.reset(jg.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(jg.CONV,"currentConversationID",""),n.TUIStore.update(jg.CONV,"currentConversation",null),console.log(`${t} conversationID is empty, conversationID:${e}`),Promise.resolve({});if(!e.startsWith(n.TYPES.CONV_C2C)&&!e.startsWith(n.TYPES.CONV_GROUP))return console.warn(`${t} conversationID is invalid, conversationID:${e}`),Promise.reject({code:Yg.INVALID_CONV_ID,message:Jg.INVALID_CONV_ID});const i=n.TUIStore.getData(jg.CONV,"currentConversationID");if(i&&i===e)return this.setMessageRead(i),console.warn(`${t} please check conversationID, conversationID:${e}`),Promise.resolve({code:Yg.CONV_ID_SAME,message:Jg.CONV_ID_SAME});const o=yield this.getConversationModel(e);return Qg(o)?(console.warn(`${t} target conversation is not exist, conversationID:${e}`),Promise.reject({code:Yg.CONV_NOT_EXIST,message:Jg.CONV_NOT_EXIST})):(i&&this.setMessageRead(i),e&&this.setMessageRead(e),n.TUIStore.reset(jg.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(jg.CONV,"currentConversationID",e),n.TUIStore.update(jg.CONV,"currentConversation",o),Promise.resolve(o))}))}getConversationModel(e){return Bg(this,void 0,void 0,(function*(){let t=this.findConversation(e);if(Qg(t))try{const n=yield this.getConversationProfile(e);n.data&&n.data.conversation&&(t=new Rf(n.data.conversation))}catch(n){t=void 0}return t}))}findConversation(e){let t;const n=this.getEngine().TUIStore.getData(jg.CONV,"conversationList");for(let i=0;i<n.length;i++)if(n[i].conversationID===e){t=n[i];break}return t}updateCurrentConversation(){const e=this.getEngine(),t=e.TUIStore.getData(jg.CONV,"currentConversationID"),n=this.findConversation(t);n&&e.TUIStore.update(jg.CONV,"currentConversation",n)}getConversationList(){return this.getEngine().chat.getConversationList()}getConversationProfile(e){return this.getEngine().chat.getConversationProfile(e)}deleteConversation(e){return this.getEngine().chat.deleteConversation(e).then((t=>{const n=this.getEngine().TUIStore.getData(jg.CONV,"currentConversationID");return console.log(`${this.serv}.deleteConversation conversationID:${e} currentConversationID:${n}`),e===n&&(this.getEngine().TUIStore.update(jg.CONV,"currentConversationID",""),this.getEngine().TUIStore.update(jg.CONV,"currentConversation",null)),t}))}pinConversation(e){return this.getEngine().chat.pinConversation(e)}muteConversation(e){return this.getEngine().chat.setMessageRemindType(e)}clearHistoryMessage(e){return this.getEngine().chat.clearHistoryMessage(e).then((e=>(this.getEngine().TUIStore.update(jg.CHAT,"messageList",[]),this.getEngine().TUIStore.update(jg.CHAT,"nextReqMessageID",""),this.getEngine().TUIStore.update(jg.CHAT,"isCompleted",!0),e)))}setMessageRead(e){return this.getEngine().chat.setMessageRead({conversationID:e})}setConversationDraft(e){const{conversationID:t,draftInfo:n}=e;let i="";return n&&(i=JSON.stringify(n)),this.getEngine().chat.setConversationDraft({conversationID:t,draftText:i}).then((e=>{const{conversation:t}=e.data;this.updateConversation(t)}))}updateConversation(e){let t=!1;const n=this.getEngine().TUIStore.getData(jg.CONV,"conversationList");for(let i=0;i<n.length;i++)if(n[i].conversationID===e.conversationID){n[i]=e,t=!0;break}t&&this.getEngine().TUIStore.update(jg.CONV,"conversationList",n)}filterSystemConversation(e){return e.filter((e=>e.type!==this.getEngine().TYPES.CONV_SYSTEM))}}class Ym{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.PROFILE_UPDATED,this.onProfileUpdated.bind(this)),this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated.bind(this)),this.getUserProfileInitData()}onProfileUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.USER,"userProfile");e.forEach((e=>{e.userID===n.userID&&t.TUIStore.update(jg.USER,"userProfile",e)}))}onBlacklistUpdated(e){const t=this.getEngine();this.getBlacklistProfile(e).then((e=>{t.TUIStore.update(jg.USER,"userBlacklist",e)}))}getUserProfileInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getBlacklist().then((e=>{const t=e.data||[];console.log(`TUIUserProfileHandler.init, getBlacklist count:${t.length}`),t.length>0&&this.onBlacklistUpdated(t)}))}getBlacklistProfile(e){const t=[];let n=0;for(;n<e.length;)t.push(e.slice(n,n+=100));const i=[];t.forEach((e=>{i.push(this.TUIUserService.getUserProfile({userIDList:e}))}));const o=[];return Promise.all(i).then((e=>(e.forEach((e=>{const t=e.data.map((e=>{const{userID:t,nick:n,avatar:i}=e;return{userID:t,nick:n,avatar:i}}));o.push(...t)})),o)))}getUserProfile(e){const t=this.getEngine();return Qg(e)?t.chat.getMyProfile().then((e=>(t.TUIStore.update(jg.USER,"userProfile",e.data),e))).catch((e=>Promise.reject(e))):t.chat.getUserProfile(e)}updateMyProfile(e){return this.getEngine().chat.updateMyProfile(e)}addToBlacklist(e){return this.getEngine().chat.addToBlacklist(e)}removeFromBlacklist(e){return this.getEngine().chat.removeFromBlacklist(e)}}function $m(e,t,n=!0){var i,o;i=n?Xm(e):e,o=t,df?hf.setStorageSync(i,o):Qm()&&localStorage.setItem(i,JSON.stringify(o))}function Jm(e,t=!0){try{return function(e){if(df)return hf.getStorageSync(e);if(Qm()){const t=localStorage.getItem(e);if("undefined"!==t)return JSON.parse(t)}}(t?Xm(e):e)}catch(n){return void console.warn("Storage.getStorageItem error:",n)}}function Xm(e){return`chat_engine_${e}`}function Qm(){return navigator&&navigator.cookieEnabled&&localStorage}class Zm{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){const e=this.getEngine(),t=Jm("displayOnlineStatus")||!1;e.TUIStore.update(jg.USER,"displayOnlineStatus",t),e.eventCenter.addEvent(e.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated.bind(this)),this.onConversationListUpdated()}onConversationListUpdated(){const e=this.getEngine();e.TUIStore.watch(jg.CONV,{conversationList:()=>{const t=e.TUIStore.getData(jg.APP,"enabledOnlineStatus"),n=e.TUIStore.getData(jg.USER,"displayOnlineStatus");t&&n&&this.startToSubscribe()}})}onUserStatusUpdated(e){this.getEngine().TUIStore.update(jg.USER,"userStatusList",e)}switchUserStatus(e){const t=this.getEngine(),{displayOnlineStatus:n=!1}=e;t.TUIStore.update(jg.USER,"displayOnlineStatus",n),$m("displayOnlineStatus",n);const i=t.TUIStore.getData(jg.APP,"enabledOnlineStatus");i?!0===n?this.startToSubscribe():this.unsubscribeUserStatus():console.warn(`UserStatusHandler.switchUserStatus enabledOnlineStatus:${i} displayOnlineStatus:${n}`)}getUserStatus(e){const t=this.getEngine();return t.chat.getUserStatus(e).then((e=>{const{successUserList:n}=e.data;return n.length>0&&t.TUIStore.update(jg.USER,"userStatusList",n),e})).catch((e=>Promise.reject(e)))}subscribeUserStatus(e){var t;const n=(null===(t=null==e?void 0:e.userIDList)||void 0===t?void 0:t.length)||0;return 0===n?(console.warn(`UserStatusHandler.subscribeUserStatus userID count:${n}`),Promise.resolve()):this.getEngine().chat.subscribeUserStatus(e)}unsubscribeUserStatus(e){const t=this.getEngine(),{userIDList:n=[]}=e||{};return t.chat.unsubscribeUserStatus({userIDList:n}).then((e=>{const{failureUserList:i}=e.data,o=[];return n.forEach((e=>{i.includes(e)||o.push({userID:e,statusType:Hg.UNSUB_USER})})),t.TUIStore.update(jg.USER,"userStatusList",o),e})).catch((e=>Promise.reject(e)))}startToSubscribe(){const e=this.getEngine(),t=e.TUIStore.getData(jg.CONV,"conversationList"),n=e.TUIStore.getData(jg.USER,"userStatusList"),i=[];t.forEach((t=>{if(t.type===e.TYPES.CONV_C2C){const o=t.conversationID.replace(e.TYPES.CONV_C2C,"");n.has(o)||i.push(o)}})),0!==i.length&&e.chat.isReady()&&(this.subscribeUserStatus({userIDList:i}),this.getUserStatus({userIDList:i}))}}class e_ extends Tf{constructor(){super(),this.userProfileHandler=new Ym(this),this.userStatusHandler=new Zm(this)}static getInstance(){return e_.instance||(e_.instance=new e_),e_.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.KICKED_OUT,this.onKickedOut.bind(this)),e.eventCenter.addEvent(e.EVENT.NET_STATE_CHANGE,this.onNetStateChange.bind(this)),this.userProfileHandler.init(),this.userStatusHandler.init(),this.initMessageReadReceipt()}onKickedOut(e){this.getEngine().TUIStore.update(jg.USER,"kickedOut",e.type)}onNetStateChange(e){this.getEngine().TUIStore.update(jg.USER,"netStateChange",e.state)}initMessageReadReceipt(){const e=Jm("displayMessageReadReceipt")||!0;this.getEngine().TUIStore.update(jg.USER,"displayMessageReadReceipt",e)}switchUserStatus(e){return this.userStatusHandler.switchUserStatus(e)}switchMessageReadStatus(e){this.getEngine().TUIStore.update(jg.USER,"displayMessageReadReceipt",e),$m("displayMessageReadReceipt",e)}getUserProfile(e){return this.userProfileHandler.getUserProfile(e)}updateMyProfile(e){return this.userProfileHandler.updateMyProfile(e)}addToBlacklist(e){return this.userProfileHandler.addToBlacklist(e)}removeFromBlacklist(e){return this.userProfileHandler.removeFromBlacklist(e)}getUserStatus(e){return this.userStatusHandler.getUserStatus(e)}subscribeUserStatus(e){return this.userStatusHandler.subscribeUserStatus(e)}unsubscribeUserStatus(e){return this.userStatusHandler.unsubscribeUserStatus(e)}}class t_{constructor(e){this.TUIChatService=e,this.userShowNameMap=new Map,this.requestedUserMap=new Map}getEngine(){return this.TUIChatService.getEngine()}t(e){return this.getEngine().TUITranslate.t(e)}handleTextMessage(e){return{text:this.decodeText(e.payload)}}handleFaceMessage(e){const t={name:"",url:"",type:""};return e.payload.data.indexOf("@custom")>-1?(t.name=e.payload.data,t.type="custom",t):(t.name=e.payload.data.indexOf("@2x")<0?`${e.payload.data}@2x`:e.payload.data,t.url=`https://web.sdk.qcloud.com/im/assets/face-elem/${t.name}.png`,t)}handleLocationMessage(e){const t={lon:"",lat:"",href:"",url:"",description:""};return t.lon=e.payload.longitude.toFixed(6),t.lat=e.payload.latitude.toFixed(6),t.href=`https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=${t.lon}&pointy=${t.lat}&name=${e.payload.description}`,t.url=`https://apis.map.qq.com/ws/staticmap/v2/?center=${t.lat},${t.lon}&zoom=10&size=300*150&maptype=roadmap&markers=size:large|color:0xFFCCFF|label:k|${t.lat},${t.lon}&key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD`,t.description=e.payload.description,t}handleImageMessage(e){return{url:e.payload.imageInfoArray[0].url,width:e.payload.imageInfoArray[0].width,height:e.payload.imageInfoArray[0].height}}handleAudioMessage(e){return{url:e.payload.url,second:e.payload.second}}handleVideoMessage(e){return{url:e.payload.videoUrl,snapshotUrl:e.payload.snapshotUrl,snapshotWidth:e.payload.snapshotWidth,snapshotHeight:e.payload.snapshotHeight}}handleFileMessage(e){return{url:e.payload.fileUrl,name:e.payload.fileName,size:nf(e.payload.fileSize)}}handleCustomMessage(e){var t;const n=this.handleCreateGroupCustomMessage(e);return{custom:this.handleCallKitSignaling(e)||n||(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.extension)||`${this.t("TUIChat.[自定义消息]")}`,businessID:n?"group_create":""}}handleMergeMessage(e){return Object.assign({},e.payload)}handleGroupTipsMessage(e){var t,n,i,o,s,a;const r=this.getEngine(),c={text:""};let u=(null==e?void 0:e.nick)||(null===(n=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.userIDList)||void 0===n?void 0:n.join(","));switch((null===(o=null===(i=null==e?void 0:e.payload)||void 0===i?void 0:i.memberList)||void 0===o?void 0:o.length)>0&&(u="",null===(a=null===(s=null==e?void 0:e.payload)||void 0===s?void 0:s.memberList)||void 0===a||a.map((e=>{const t=(null==e?void 0:e.nick)||(null==e?void 0:e.userID);return u+=`${this.substringByLength(t)},`,e})),u=null==u?void 0:u.slice(0,-1)),e.payload.operationType){case r.TYPES.GRP_TIP_MBR_JOIN:c.text=`${u} ${this.t("message.tip.加入群组")}`;break;case r.TYPES.GRP_TIP_MBR_QUIT:c.text=`${this.t("message.tip.群成员")}${u} ${this.t("message.tip.退出群组")}`;break;case r.TYPES.GRP_TIP_MBR_KICKED_OUT:c.text=`${this.t("message.tip.群成员")}${u} ${this.t("message.tip.被")}${this.t("message.tip.踢出群组")}`;break;case r.TYPES.GRP_TIP_MBR_SET_ADMIN:c.text=`${this.t("message.tip.群成员")}${u} ${this.t("message.tip.成为管理员")}`;break;case r.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:c.text=`${this.t("message.tip.群成员")}${u} ${this.t("message.tip.被撤销管理员")}`;break;case r.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:c.text=this.handleGroupProfileUpdated(e);break;case r.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:for(const t of e.payload.memberList)t.muteTime>0?c.text=`${this.t("message.tip.群成员")}${u} ${this.t("message.tip.被禁言")}`:c.text=`${this.t("message.tip.群成员")}${u} ${this.t("message.tip.被取消禁言")}`;break;default:c.text=`[${this.t("message.tip.群提示消息")}]`}return c}handleGroupSystemMessage(e){const t=e.payload.groupProfile.name||e.payload.groupProfile.groupID,n={text:""};switch(e.payload.operationType){case 1:n.text=`${e.payload.operatorID} ${this.t("message.tip.申请加入群组")}${t}`;break;case 2:n.text=`${this.t("message.tip.成功加入群组")}${t}`;break;case 3:n.text=`${this.t("message.tip.申请加入群组")}${t} ${this.t("message.tip.被拒绝")}`;break;case 4:n.text=`${this.t("message.tip.你被管理员")}${e.payload.operatorID} ${this.t("message.tip.踢出群组")}${t}`;break;case 5:n.text=`${this.t("message.tip.群")}${t} ${this.t("message.tip.被")} ${e.payload.operatorID} ${this.t("message.tip.解散")}`;break;case 6:n.text=`${e.payload.operatorID} ${this.t("message.tip.创建群")}${t}`;break;case 7:case 12:n.text=`${e.payload.operatorID} ${this.t("message.tip.邀请你加群")}${t}`;break;case 8:n.text=`${this.t("message.tip.你退出群组")}${t}`;break;case 9:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.设置为群")}${t} ${this.t("message.tip.的管理员")}`;break;case 10:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.撤销群")}${t} ${this.t("message.tip.的管理员身份")}`;break;case 13:n.text=`${e.payload.operatorID} ${this.t("message.tip.同意加群")}${t}`;break;case 14:n.text=`${e.payload.operatorID} ${this.t("message.tip.拒接加群")}${t}`;break;case 255:n.text=`${this.t("message.tip.自定义群系统通知")}: ${e.payload.userDefinedField}`;break;default:n.text="未解析的群系统通知"}return n}handleCallKitSignaling(e){var t,n,i,o,s,a,r,c,u,l;const d=tf(e.payload.data);if(1!==(null==d?void 0:d.businessID))return"";const p=tf(null==d?void 0:d.data),h=e.fromAccount||e.from,g=this.getEngine().TUIFriend.getFriendRemark([h]),f=this.getEngine().getMyUserID();let m=g[h]||e.nameCard||e.nick||h;switch(m=this.substringByLength(m),null==d?void 0:d.actionType){case 1:return"audioCall"!==(null===(t=null==p?void 0:p.data)||void 0===t?void 0:t.cmd)&&"videoCall"!==(null===(n=null==p?void 0:p.data)||void 0===n?void 0:n.cmd)||!(null==d?void 0:d.groupID)?"hangup"===(null===(i=null==p?void 0:p.data)||void 0===i?void 0:i.cmd)?(null==d?void 0:d.groupID)?`${this.t("message.custom.通话结束")}`:`${this.t("message.custom.通话时长")}${function(e){const t=e;let n,i,o,s="";return t>=3600?(n=parseInt(""+t/3600,10)<10?`0${parseInt(""+t/3600,10)}`:parseInt(""+t/3600,10),i=parseInt(""+t%60/60,10)<10?`0${parseInt(""+t%60/60,10)}`:parseInt(""+t%60/60,10),o=t%3600<10?"0"+t%3600:t%3600,o>60&&(i=parseInt(""+o/60,10)<10?`0${parseInt(""+o/60,10)}`:parseInt(""+o/60,10),o=o%60<10?"0"+o%60:o%60),s=`${n}:${i}:${o}`):t>=60&&t<3600?(i=parseInt(""+t/60,10)<10?`0${parseInt(""+t/60,10)}`:parseInt(""+t/60,10),o=t%60<10?"0"+t%60:t%60,s=`00:${i}:${o}`):t<60&&(o=t<10?`0${t}`:t,s=`00:00:${o}`),s}(null==p?void 0:p.call_end)}`:"switchToAudio"===(null===(o=null==p?void 0:p.data)||void 0===o?void 0:o.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(s=null==p?void 0:p.data)||void 0===s?void 0:s.cmd)?`${this.t("message.custom.切换视频通话")}`:`${this.t("message.custom.发起通话")}`:`${m} ${this.t("message.custom.发起通话")}`;case 2:return(null==d?void 0:d.groupID)?`${m} ${this.t("message.custom.取消通话")}`:this.isOldUIKit("message.custom.已取消")?this.t("message.custom.取消通话"):(null==d?void 0:d.inviter)===f?this.t("message.custom.已取消"):this.t("message.custom.对方已取消");case 3:return"switchToAudio"===(null===(a=null==p?void 0:p.data)||void 0===a?void 0:a.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(r=null==p?void 0:p.data)||void 0===r?void 0:r.cmd)?`${this.t("message.custom.切换视频通话")}`:(null==d?void 0:d.groupID)?`${m} ${this.t("message.custom.已接听")}`:this.t("message.custom.已接听");case 4:return(null==d?void 0:d.groupID)?`${m} ${this.t("message.custom.拒绝通话")}`:this.isOldUIKit("message.custom.已拒绝")?this.t("message.custom.拒绝通话"):"line_busy"===(null==p?void 0:p.line_busy)||"lineBusy"===(null==p?void 0:p.data.message)?(null==d?void 0:d.inviter)===f?this.t("message.custom.对方忙线中"):this.t("message.custom.忙线未接听"):(null==d?void 0:d.inviter)===f?this.t("message.custom.对方已拒绝"):this.t("message.custom.已拒绝");case 5:if("switchToAudio"===(null===(c=null==p?void 0:p.data)||void 0===c?void 0:c.cmd))return`${this.t("message.custom.切换语音通话")}`;if("switchToVideo"===(null===(u=null==p?void 0:p.data)||void 0===u?void 0:u.cmd))return`${this.t("message.custom.切换视频通话")}`;if(null==d?void 0:d.groupID){if(h===(null==d?void 0:d.inviter)){this.handleCallkitTimeoutSignaling(d.inviteeList);let e="";return null===(l=d.inviteeList)||void 0===l||l.forEach((t=>{const n=this.userShowNameMap.get(t)||t;e+=`${this.substringByLength(n)}、`})),e=e.substring(0,e.lastIndexOf("、")),`${e} ${this.t("message.custom.无应答")}`}return`${m} ${this.t("message.custom.无应答")}`}return this.isOldUIKit("message.custom.对方无应答")?this.t("message.custom.无应答"):(null==d?void 0:d.inviter)===f?this.t("message.custom.对方无应答"):this.t("message.custom.超时无应答");default:return""}}handleCreateGroupCustomMessage(e){let t;const n=tf(e.payload.data);return"group_create"===(null==n?void 0:n.businessID)&&(t=`${n.opUser} ${n.content}`),t}decodeText(e){const t=[];let n=e.text,i=-1,o=-1;for(;""!==n;)switch(i=n.indexOf("["),o=n.indexOf("]"),i){case 0:if(-1===o)t.push({name:"text",text:n}),n="";else{const e=n.slice(0,o+1);e.indexOf("@custom")>-1?(t.push({name:"img",src:"",type:"custom",emojiKey:e}),n=n.substring(o+1)):of[e]?(t.push({name:"img",src:"https://web.sdk.qcloud.com/im/assets/emoji-plugin/"+of[e],emojiKey:e}),n=n.substring(o+1)):(t.push({name:"text",text:"["}),n=n.slice(1))}break;case-1:t.push({name:"text",text:n}),n="";break;default:t.push({name:"text",text:n.slice(0,i)}),n=n.substring(i)}return t}handleGroupProfileUpdated(e){const{nick:t,payload:n}=e,{newGroupProfile:i,memberList:o,operatorID:s}=n;let a="";const r=t||s,c=Object.keys(i)[0];switch(c){case"muteAllMembers":a=i[c]?`${this.t("message.tip.管理员")} ${r} ${this.t("message.tip.开启全员禁言")}`:`${this.t("message.tip.管理员")} ${r} ${this.t("message.tip.取消全员禁言")}`;break;case"ownerID":a=`${o[0].nick||o[0].userID} ${this.t("message.tip.成为新的群主")}`;break;case"groupName":a=`${r} ${this.t("message.tip.修改群名为")} ${i[c]}`;break;case"notification":a=this.isOldUIKit("message.tip.把群公告修改为")?`${r} ${this.t("message.tip.发布新公告")}`:`${r} ${this.t("message.tip.把群公告修改为")} "${i[c]}"`}return a}handleCallkitTimeoutSignaling(e=[]){if(0===e.length)return;const t=this.getEngine().TUIFriend.getFriendRemark(e),n=[];e.forEach((e=>{const i=t[e];i?this.userShowNameMap.set(e,i):this.requestedUserMap.has(e)||(n.push(e),this.requestedUserMap.set(e,1))})),n.length>0&&this.getEngine().TUIUser.getUserProfile({userIDList:n}).then((e=>{(e.data||[]).forEach((e=>{const{userID:t,nick:n}=e,i=n||t;this.userShowNameMap.set(t,i)}))})).catch((()=>{}))}substringByLength(e,t=12){return e.length>t?`${e.slice(0,t)}...`:e}isOldUIKit(e){var t;const n=e.lastIndexOf("."),i=e.slice(0,n+1);return null===(t=this.t(e))||void 0===t?void 0:t.startsWith(i)}}class n_{constructor(e){this.TUIChatService=e,this.typingTo="",this.timer=null}getEngine(){return this.TUIChatService.getEngine()}clearTypingStatus(){this.getEngine().TUIStore.getData(jg.CHAT,"typingStatus")&&this.getEngine().TUIStore.update(jg.CHAT,"typingStatus",!1),this.timer&&clearTimeout(this.timer),this.timer=null}handleLastMessage(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.CHAT,"typingStatus");if(e.type===this.getEngine().TYPES.MSG_CUSTOM&&"in"===e.flow){const i=tf(e.payload.data);if(i.businessID===Kg.BUSINESS_ID){const{typingStatus:e,userAction:o}=i;if(e===Kg.STATUS_START||o===Kg.ACTION_START_ID)return n?(this.timer&&clearTimeout(this.timer),this.timer=null):t.TUIStore.update(jg.CHAT,"typingStatus",!0),this.timer=setTimeout((()=>{this.clearTypingStatus()}),3e4),t.TUIStore.getData(jg.CHAT,"typingStatus");e!==Kg.STATUS_END&&o!==Kg.ACTION_END_ID||this.clearTypingStatus()}}}filterTypingMessage(e=[]){return 0===e.length?[]:(this.getEngine().TUIStore.getData(jg.APP,"enableTyping")&&this.handleLastMessage(e[e.length-1]),e.filter((e=>e.type!==this.getEngine().TYPES.MSG_CUSTOM||tf(e.payload.data).businessID!==Kg.BUSINESS_ID)))}createTypingMessage(e=Kg.STATUS_END,t=""){const{BUSINESS_ID:n,STATUS_START:i,VERSION:o,ACTION_START_ID:s,ACTION_END_ID:a,ACTION_START:r,ACTION_END:c,NEED_TYPING:u}=Kg;return{to:t,conversationType:this.getEngine().TYPES.CONV_C2C,payload:{data:JSON.stringify({businessID:n,typingStatus:e,version:o,userAction:e===i?s:a,actionParam:e===i?r:c}),description:"",extension:""},cloudCustomData:JSON.stringify({messageFeature:{needTyping:u,version:o}})}}sendTyping(e=!1,t=""){if(e){this.typingTo=t;const e=this.createTypingMessage(Kg.STATUS_START,t);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}else this.sendTypingEnd()}sendTypingEnd(){if(this.typingTo){const e=this.createTypingMessage(Kg.STATUS_END,this.typingTo);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}this.typingTo=""}}class i_{constructor(e){this.TUIChatService=e}getEngine(){return this.TUIChatService.getEngine()}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived.bind(this))}onMessageReadReceiptReceived(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.CONV,"currentConversationID"),i=[];e.forEach((e=>{const{messageID:o}=e,s=t.chat.findMessage(o);s&&n===s.conversationID&&i.push(s)})),i.length>0&&t.TUIChat.updateMessageList(i,"edit")}sendMessageReadReceipt(e){const t=[];return e.forEach((e=>{const n=e.getMessage();t.push(n)})),this.getEngine().chat.sendMessageReadReceipt(t)}getGroupMessageReadMemberList(e){const t=e.message.getMessage(),n=Object.assign(Object.assign({},e),{message:t});return this.getEngine().chat.getGroupMessageReadMemberList(n)}getMessageReadReceiptList(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.APP,"enabledMessageReadReceipt"),i=t.TUIStore.getData(jg.USER,"displayMessageReadReceipt");!n||!i||0===e.length||e[0].conversationType!==t.TYPES.CONV_GROUP||t.chat.getMessageReadReceiptList(e).then((e=>{const{messageList:t}=e.data;this.TUIChatService.updateMessageList(t,"edit")})).catch((e=>{console.warn(`ReadReceiptHandler.getMessageReadReceiptList error:${e.message}`)}))}}class o_ extends Tf{constructor(){super(),this.serv="TUIChatService",this.messageHandler=new t_(this),this.typingHandler=new n_(this),this.readReceiptHandler=new i_(this),this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap=new Map}static getInstance(){return o_.instance||(o_.instance=new o_),o_.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_MODIFIED,this.onMessageModified.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REVOKED,this.onMessageRevoked.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated.bind(this)),this.onCurrentConversationIDUpdated(),this.onMessageSource(),this.readReceiptHandler.init()}onMessageReceived(e){this.updateMessageList(e,"received"),this.getEngine().TUIStore.update(jg.CHAT,"newMessageList",e)}onMessageModified(e){this.updateMessageList(e,"edit")}onMessageRevoked(e){this.updateMessageList(e,"edit")}onMessageReadByPeer(e){this.updateMessageList(e,"edit")}onMessageReactionsUpdated(e){this.updateMessageReactionList([e])}onCurrentConversationIDUpdated(){const e=this.getEngine();e.TUIStore.watch(jg.CONV,{currentConversationID:t=>{this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.clear(),e.TUIStore.reset(jg.CHAT),this.typingHandler.clearTypingStatus(),this.typingHandler.sendTypingEnd(),kf(t)||this.getMessageList().finally((()=>{this.isSwitching=!1,this.delayGetHoppingFunction&&this.delayGetHoppingFunction()}))}})}onMessageSource(){const e=this.getEngine();e.TUIStore.watch(jg.CHAT,{messageSource:t=>{const n=this.getStoreData(jg.CONV,"currentConversationID");if(!n||t&&t.conversationID!==n)return;if(Qg(t))return this.hoppingConfigMap.clear(),e.TUIStore.update(jg.CHAT,"messageList",[]),e.TUIStore.update(jg.CHAT,"nextReqMessageID",""),e.TUIStore.update(jg.CHAT,"isCompleted",!1),void this.getMessageList();const i=this.getStoreData(jg.CHAT,"messageList");i&&i.find((e=>t&&e.ID===t.ID))||(this.isSwitching?this.delayGetHoppingFunction=this.getMessageListHoppingForDown:this.getMessageListHoppingForDown())}})}getMessageListHoppingForDown(){const e=this.getStoreData(jg.CHAT,"messageList"),{conversationID:t,sequence:n,time:i,ID:o}=this.getStoreData(jg.CHAT,"messageSource");if(e&&e.find((e=>o&&e.ID===o)))return;const s=this.getEngine();s.TUIStore.update(jg.CHAT,"messageList",[]),s.TUIStore.update(jg.CHAT,"nextReqMessageID",""),s.TUIStore.update(jg.CHAT,"isCompleted",!1),this.getMessageListHopping({conversationID:t,sequence:n,time:i,direction:1})}getStoreData(e,t){return this.getEngine().TUIStore.getData(e,t)}sendMessage(e,t){this.updateMessageList([e],"send");const n=this.getEngine().chat.sendMessage(e,t);return this.getResponse(n)}getResponse(e,t=!0,n=!0){return e.then((e=>{const n=e.data.messageList?e.data.messageList:[e.data.message];return t&&this.updateMessageList(n,"edit"),e})).catch((e=>{var t;return n&&(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.message)&&this.updateMessageList([e.data.message],"edit"),Promise.reject(e)}))}updateMessageList(e,t=""){if(this.getStoreData(jg.CHAT,"messageSource")&&"unshift"!==t&&"edit"!==t)return;const n=this.getStoreData(jg.CHAT,"messageList"),i=this.updateTargetMessageList(e,n,t);this.getEngine().TUIStore.update(jg.CHAT,"messageList",i)}updateTargetMessageList(e,t,n=""){const i=this.getStoreData(jg.CONV,"currentConversationID");let o=e.filter((e=>e.conversationID===i));if(o=this.handleC2CCallSignaling(o),!n||0===o.length)return t;const s=t||[];let a=[];if("send"===n||"push"===n){const e=this.getStoreData(jg.CHAT,"userInfo");Object.keys(e).length>0&&this.updateLocalMessage(o,e)}switch(n){case"edit":for(const e of t){const t=o.find((t=>t.ID===e.ID));a.push(t||e)}break;case"resend":a=s.filter((e=>e.ID!==o[0].ID)).concat(o);break;case"send":a=s.concat(this.typingHandler.filterTypingMessage(o));break;case"push":a=s.concat(this.typingHandler.filterTypingMessage(o)),this.getEngine().chat.setMessageRead({conversationID:i});break;case"received":a=s.concat(this.typingHandler.filterTypingMessage(o)),a=this.sortMessageList(a),this.getEngine().chat.setMessageRead({conversationID:i});break;case"unshift":a=o.filter((e=>0===s.length||!s.find((t=>t.ID===e.ID)))),a.push(...s),a=this.sortMessageList(a)}return a}enterTypingState(){this.getStoreData(jg.APP,"enableTyping")&&this.sendTyping(!0)}leaveTypingState(){this.getStoreData(jg.APP,"enableTyping")&&this.sendTyping(!1)}sendTyping(e){const t=this.getEngine(),n=this.getStoreData(jg.CONV,"currentConversationID");if(!n.startsWith(t.TYPES.CONV_C2C))return;const i=n.replace(t.TYPES.CONV_C2C,"");if(e){const e=this.getStoreData(jg.CHAT,"messageList").filter((e=>"in"===e.flow));if(0===e.length)return;const t=1e3*e[e.length-1].time;if((new Date).getTime()-t>3e4)return}this.typingHandler.sendTyping(e,i)}quoteMessage(e){var t;return this.getEngine().TUIStore.update(jg.CHAT,"quoteMessage",{message:e,type:"quote"}),null===(t=this.getEngine().TUIReport)||void 0===t||t.reportFeature(205),e}replyMessage(e){return this.getEngine().TUIStore.update(jg.CHAT,"quoteMessage",{message:e,type:"reply"}),e}getCurrentConvInfo(){const{conversationID:e="",type:t}=this.getStoreData(jg.CONV,"currentConversation")||{};return{to:e.replace(t,""),conversationType:t}}t(e){return this.getEngine().TUITranslate.t(e)||e}getMessageAbstractAndType(e){var t,n;const i=this.getEngine(),o={abstract:"",type:0};switch(e.type){case i.TYPES.MSG_TEXT:o.abstract=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text,o.type=1;break;case i.TYPES.MSG_CUSTOM:o.abstract="[自定义消息]",o.type=2;break;case i.TYPES.MSG_IMAGE:o.abstract="[图片]",o.type=3;break;case i.TYPES.MSG_AUDIO:o.abstract="[语音]",o.type=4;break;case i.TYPES.MSG_VIDEO:o.abstract="[视频]",o.type=5;break;case i.TYPES.MSG_FILE:o.abstract="[文件]",o.type=6;break;case i.TYPES.MSG_LOCATION:o.type=7;break;case i.TYPES.MSG_FACE:o.abstract="[表情]",o.type=8;break;case i.TYPES.MSG_GRP_TIP:o.type=9;break;case i.TYPES.MSG_MERGER:o.abstract=null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.title,o.type=10}return o}genMessageReply(e,t){if("reply"!==t&&"quote"!==t)return{};const{abstract:n,type:i}=this.getMessageAbstractAndType(e),o={messageAbstract:n,messageSender:e.nick||e.from,messageID:e.ID},s=Object.assign(Object.assign({},o),{messageType:i,messageTime:null==e?void 0:e.time,messageSequence:null==e?void 0:e.sequence,version:1});if("reply"===t&&(s.messageRootID=e.ID,e.cloudCustomData)){const t=tf(e.cloudCustomData);t.messageReply&&t.messageReply.messageRootID&&(s.messageRootID=t.messageReply.messageRootID)}return{messageReply:s,messageReplyRoot:o}}getMessageInfo(e,t,n){const{messageReply:i,messageReplyRoot:o}=this.genMessageReply(t,n),s=e.cloudCustomData?tf(e.cloudCustomData):{};let a;if(s.messageReply?s.messageReply=Object.assign(Object.assign({},i),s.messageReply):s.messageReply=i,"reply"===n){const{messageRootID:e}=i;a=this.getEngine().chat.findMessage(e);const t=(null==a?void 0:a.cloudCustomData)?tf(a.cloudCustomData):{};t.messageReplies||(t.messageReplies={}),r=t.messageReplies.replies,("function"==typeof Array.isArray?Array.isArray(r):"array"===Object.prototype.toString.call(r).match(/^\[object (.*)\]$/)[1].toLowerCase())||(t.messageReplies.replies=[]),t.messageReplies.replies.push(o),a.cloudCustomData=JSON.stringify(t)}var r;return{cloudCustomData:JSON.stringify(s),rootMessage:a}}sendTextMessage(e,t){const n=this.getEngine(),{message:i,type:o}=this.getStoreData(jg.CHAT,"quoteMessage");let s={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};i&&(s=this.getMessageInfo(e,i,o));const a=n.chat.createTextMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:s.cloudCustomData}));return this.sendMessage(a,t).then((e=>(s.rootMessage&&this.modifyMessage(s.rootMessage),n.TUIStore.reset(jg.CHAT,["quoteMessage"],!0),e)))}sendTextAtMessage(e,t){const n=this.getEngine(),{message:i,type:o}=this.getStoreData(jg.CHAT,"quoteMessage");let s={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};i&&(s=this.getMessageInfo(e,i,o));const a=n.chat.createTextAtMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:s.cloudCustomData}));return this.sendMessage(a,t).then((e=>(s.rootMessage&&this.modifyMessage(s.rootMessage),n.TUIStore.reset(jg.CHAT,["quoteMessage"],!0),e)))}sendImageMessage(e,t){const n=this.getEngine().chat.createImageMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendAudioMessage(e,t){const n=this.getEngine().chat.createAudioMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendVideoMessage(e,t){const n=this.getEngine().chat.createVideoMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendCustomMessage(e,t){const n=this.getEngine().chat.createCustomMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFaceMessage(e,t){const n=this.getEngine().chat.createFaceMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFileMessage(e,t){const n=this.getEngine().chat.createFileMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendLocationMessage(e,t){const n=this.getEngine().chat.createLocationMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}onProgress(e,t){const n=this.getEngine().TUIStore.getMessageModel(e);n&&(t-n.progress>=.1||1===t)&&(n.progress=t,this.updateMessageList([n],"edit"))}setAbstractList(e){const t=this.getEngine(),n=e.nick||e.from;let i="";switch(e.type){case t.TYPES.MSG_TEXT:i=e.payload.text||"",i.length>20&&(i=i.slice(0,20));break;case t.TYPES.MSG_MERGER:i=`${this.t("TUIChat.[聊天记录]")}`;break;case t.TYPES.MSG_IMAGE:i=`${this.t("TUIChat.[图片]")}`;break;case t.TYPES.MSG_AUDIO:i=`${this.t("TUIChat.[音频]")}`;break;case t.TYPES.MSG_VIDEO:i=`${this.t("TUIChat.[视频]")}`;break;case t.TYPES.MSG_CUSTOM:i=`${this.t("TUIChat.[自定义消息]")}`;break;case t.TYPES.MSG_FILE:i=`${this.t("TUIChat.[文件]")}`;break;case t.TYPES.MSG_FACE:i=`${this.t("TUIChat.[动画表情]")}`}return`${n}: ${i}`}genMergerForwardPayload(e,t){const{abstractList:n=[],compatibleText:i="",title:o}=t;return 0===n.length&&e.forEach((e=>{n.push(this.setAbstractList(e))})),{messageList:e,title:o,abstractList:n,compatibleText:i||this.t("TUIChat.请升级IMSDK到v2.10.1或更高版本查看此消息")}}genSendMergerForwardMessage(e){const{conversationList:t,messageList:n,params:i,mergeInfo:o,sendMessageOptions:s}=e,a=[];for(let r=0;r<t.length;r++){const{conversationID:e,type:c}=t[r],u=Object.assign({to:e.replace(`${c}`,""),conversationType:c,payload:this.genMergerForwardPayload(n,o)},i),l=this.getEngine().chat.createMergerMessage(u);a.push(this.sendMessage(l,s))}return a}genTitle(e,t){const{nick:n,from:i,to:o}=e;return`${n||i} ${this.t("TUIChat.和")} ${t||o} ${this.t("TUIChat.的聊天记录")}`}genMergeInfo(e){var t;return Bg(this,void 0,void 0,(function*(){const{messageList:n,mergeInfo:i}=e;if(i.title)return i;if(n[0].conversationType===this.getEngine().TYPES.CONV_GROUP)return i.title=this.t("TUIChat.群聊的聊天记录"),i;try{const{data:e=[]}=yield this.getEngine().TUIUser.getUserProfile({userIDList:[n[0].to]});i.title=this.genTitle(n[0],null===(t=e[0])||void 0===t?void 0:t.nick)}catch(o){i.title=this.genTitle(n[0])}return i}))}sendMergerForwardMessage(e){return Bg(this,void 0,void 0,(function*(){return e.mergeInfo=yield this.genMergeInfo(e),Promise.all(this.genSendMergerForwardMessage(e))}))}getOriginMessageList(e){return e.map((e=>e instanceof bf?e.getMessage():e))}sendForwardMessage(e,t,n){t=this.getOriginMessageList(t);const i=n||{},{needMerge:o=!1,params:s={},mergeInfo:a={}}=i,r=Fg(i,["needMerge","params","mergeInfo"]);if(o)return this.sendMergerForwardMessage({conversationList:e,messageList:t,params:s,mergeInfo:a,sendMessageOptions:r});const c=[];for(let u=0;u<e.length;u++){const{conversationID:n,type:i}=e[u],o=Object.assign({to:n.replace(`${i}`,""),conversationType:i},s),a=r[n]||r;for(let e=0;e<t.length;e++){Reflect.set(o,"payload",t[e]);const n=this.getEngine().chat.createForwardMessage(o);c.push(this.sendMessage(n,a))}}return Promise.all(c)}revokeMessage(e){const t=this.getEngine().chat.revokeMessage(e);return this.getResponse(t,!0,!1)}resendMessage(e){e.status="unSend",this.updateMessageList([e],"resend");const t=this.getEngine().chat.resendMessage(e);return this.getResponse(t,!0,!0)}deleteMessage(e){const t=this.getEngine().chat.deleteMessage(e);return this.getResponse(t,!0,!1)}setMessageExtensions(e,t){return this.getEngine().chat.setMessageExtensions(e,t)}getMessageExtensions(e){return this.getEngine().chat.getMessageExtensions(e)}deleteMessageExtensions(e,t){return this.getEngine().chat.deleteMessageExtensions(e,t)}modifyMessage(e){const t=this.getEngine().chat.modifyMessage(e);return this.getResponse(t,!0,!1).catch((e=>{const{code:t=0,data:n={}}=e.code;throw t===Wg.MSG_MODIFY_CONFLICT?console.warn(`${$g.MSG_MODIFY_CONFLICT} data.message: ${null==n?void 0:n.message}`):t===Wg.MSG_MODIFY_DISABLED_IN_AVCHATROOM?console.warn($g.MSG_MODIFY_DISABLED_IN_AVCHATROOM):t===Wg.MODIFY_MESSAGE_NOT_EXIST&&console.warn($g.MODIFY_MESSAGE_NOT_EXIST),e}))}getMessageList(e={conversationID:this.getStoreData(jg.CONV,"currentConversationID"),nextReqMessageID:this.getStoreData(jg.CHAT,"nextReqMessageID")}){const t=this.getEngine();if(!t.chat.isReady())return Promise.reject({code:Yg.GET_MSG_LIST_ERROR,message:Jg.GET_MSG_LIST_ERROR});if(this.getStoreData(jg.CHAT,"isCompleted"))return Promise.resolve({data:{messageList:[],nextReqMessageID:"",isCompleted:!0}});const n=this.getStoreData(jg.CHAT,"messageSource"),i=this.hoppingConfigMap.get("nextMessageSeq"),o=this.hoppingConfigMap.get("nextMessageTime"),s=i||o;return n&&n.conversationID===(null==e?void 0:e.conversationID)&&s?this.getMessageListHopping():t.chat.getMessageList(e).then((e=>{var n;const{messageList:i,nextReqMessageID:o,isCompleted:s}=e.data,a=this.getStoreData(jg.CHAT,"userInfo");Object.keys(a).length>0&&this.updateLocalMessage(i,a),this.updateMessageList(i,"unshift"),t.TUIStore.update(jg.CHAT,"nextReqMessageID",o),t.TUIStore.update(jg.CHAT,"isCompleted",s);const r=null===(n=i[0])||void 0===n?void 0:n.conversationID,{operationType:c=0}=this.getEngine().TUIStore.getConversationModel(r)||{};return 0===c&&(this.getMessageReactions({messageList:i}),this.readReceiptHandler.getMessageReadReceiptList(i)),e})).catch((e=>Promise.reject(e)))}getMessageListHopping(e){var t;void 0===e&&(e={conversationID:null===(t=this.getStoreData(jg.CHAT,"messageSource"))||void 0===t?void 0:t.conversationID,sequence:this.hoppingConfigMap.get("nextMessageSeq"),time:this.hoppingConfigMap.get("nextMessageTime")});const n=this.getEngine();return n.chat.getMessageListHopping(e).then((t=>{const{messageList:i,nextMessageSeq:o,nextMessageTime:s,isCompleted:a}=t.data,r=1===e.direction?e.sequence:o,c=1===e.direction?e.time:s;return this.updateMessageList(i,"unshift"),this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.set("nextMessageSeq",r),this.hoppingConfigMap.set("nextMessageTime",c),n.TUIStore.update(jg.CHAT,"isCompleted",a),t})).catch((e=>Promise.reject(e)))}sendMessageReadReceipt(e){return this.readReceiptHandler.sendMessageReadReceipt(e)}getGroupMessageReadMemberList(e){return this.readReceiptHandler.getGroupMessageReadMemberList(e).then((e=>{const{isCompleted:t,cursor:n,messageID:i,unreadUserIDList:o,readUserIDList:s}=e.data,a={code:0,data:{cursor:n,isCompleted:t,messageID:i,unreadUserInfoList:[],readUserInfoList:[]}},r=[...o,...s];return 0===r.length?a:this.getEngine().TUIUser.getUserProfile({userIDList:r}).then((e=>(o.length>0?e.data.forEach((e=>{const{userID:t,nick:n="",avatar:i=""}=e;a.data.unreadUserInfoList.push({userID:t,nick:n,avatar:i})})):e.data.forEach((e=>{const{userID:t,nick:n="",avatar:i=""}=e;a.data.readUserInfoList.push({userID:t,nick:n,avatar:i})})),a)))}))}downloadMergedMessages(e){return this.getEngine().chat.downloadMergerMessage(e)}setTranslationLanguage(e){this.getEngine().TUIStore.update(jg.USER,"targetLanguage",e)}translateText(e){const t=this.getStoreData(jg.USER,"targetLanguage"),n=Object.assign({targetLanguage:t,sourceLanguage:"auto"},e);return this.getEngine().chat.translateText(n)}searchCloudMessages(e){const t=this.getStoreData(jg.CONV,"conversationList");return this.getEngine().chat.searchCloudMessages(e).then((e=>{const{searchResultList:n}=e.data;return e.data.searchResultList=n.map((e=>{const{messageList:n,conversationID:i}=e,o=Fg(e,["messageList","conversationID"]),s=n.map((e=>new bf(e))),a=t.find((e=>e.conversationID===i));return Object.assign(Object.assign({},o),{messageList:s.sort(((e,t)=>t.time-e.time)),conversation:a})})),e}))}addMessageReaction(e,t){return this.getEngine().chat.addMessageReaction(e.getMessage(),t)}removeMessageReaction(e,t){return this.getEngine().chat.removeMessageReaction(e.getMessage(),t)}getMessageReactions(e){const{messageList:t=[]}=e,n=this.getStoreData(jg.APP,"enabledEmojiPlugin");console.log(`TUIChatService.getMessageReactions enabledEmojiPlugin:${n} messageList length:${t.length}`),n&&t.length>0&&this.getEngine().chat.getMessageReactions(e).then((e=>{const t=e.data.resultList||e.data;this.updateMessageReactionList(t)})).catch((()=>{}))}getAllUserListOfMessageReaction(e){var t;return this.getEngine().chat.getAllUserListOfMessageReaction(Object.assign(Object.assign({},e),{message:null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.getMessage()}))}updateMessageReactionList(e){const t=[];e.forEach((e=>{const{messageID:n,reactionList:i}=e,o=this.getEngine().TUIStore.getMessageModel(n);if(o){const e=[];for(let t=0;t<i.length;t++){let n=!0;for(let e=0;e<o.reactionList.length;e++)if(i[t].reactionID===o.reactionList[e].reactionID){o.reactionList[e]=i[t],n=!1;break}n&&e.push(i[t])}o.reactionList.push(...e),e.length=0,t.push(o)}})),t.length>0&&this.updateMessageList(t,"edit")}convertVoiceToText(e){const{message:t,language:n="zh"}=e,i=t.getMessage();return this.getEngine().chat.convertVoiceToText({message:i,language:n})}clearHistoryMessage(e){const t=this.getEngine();return t.chat.clearHistoryMessage(e).then((e=>(t.TUIStore.update(jg.CHAT,"messageList",[]),t.TUIStore.update(jg.CHAT,"nextReqMessageID",""),t.TUIStore.update(jg.CHAT,"isCompleted",!1),e)))}updateMessageInfo(e){const t=this.getStoreData(jg.CHAT,"userInfo");this.getEngine().TUIStore.update(jg.CHAT,"userInfo",Object.assign(t,e));const n=this.getStoreData(jg.CHAT,"messageList");n.length>0&&this.updateLocalMessage(n,e)&&this.getEngine().TUIStore.update(jg.CHAT,"messageList",n)}updateLocalMessage(e,t){let n=!1;return e.forEach((e=>{if(t[e.from]){const{nick:i,nameCard:o,avatar:s}=t[e.from];i&&(e.nick=i,n=!0),o&&(e.nameCard=o,n=!0),s&&(e.avatar=s,n=!0)}})),n}handleC2CCallSignaling(e){const t=this.getEngine(),n=t.getMyUserID();return e.filter((e=>{var i,o,s,a,r;const{conversationType:c,type:u,payload:l}=e;let d=!0;if(c===t.TYPES.CONV_C2C&&u===t.TYPES.MSG_CUSTOM&&t.chat.getSignalingInfo(e)){const t=tf(l.data);if(1===(null==t?void 0:t.businessID)){const c=tf(t.data);if(d=!(e._isExcludedFromUnreadCount&&e._isExcludedFromLastMessage),d&&!0!==(null===(i=null==c?void 0:c.data)||void 0===i?void 0:i.consumed)){let i=null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.inviter;"line_busy"!==(null==c?void 0:c.line_busy)&&"lineBusy"!==(null===(s=null==c?void 0:c.data)||void 0===s?void 0:s.message)||(i=t.inviter);const{from:u,to:l}=e;if(i!==n&&e.from===n){const t=this.getStoreData(jg.CONV,"currentConversation");e.from=l,e.to=u,e.flow="in",e.avatar=(null===(a=null==t?void 0:t.userProfile)||void 0===a?void 0:a.avatar)||""}if(i===n&&e.from!==n){const t=this.getStoreData(jg.USER,"userProfile");e.from=l,e.to=u,e.flow="out",e.avatar=null==t?void 0:t.avatar}console.log(`${this.serv}.handleC2CCallSignaling myUserID:${n} callSignaling.inviter:${t.inviter} customData.data.inviter:${null===(r=null==c?void 0:c.data)||void 0===r?void 0:r.inviter}`)}}}return d}))}sortMessageList(e){const{conversationType:t}=e[0];if(t===this.getEngine().TYPES.CONV_C2C)return e.sort(((e,t)=>e.time-t.time));const n=e.filter((e=>"success"===e.status)).sort(((e,t)=>e.sequence-t.sequence));for(let i=0;i<e.length;i++)"success"!==e[i].status&&n.splice(i,0,e[i]);return n}}class s_ extends Tf{constructor(){super(),this.groupMap=new Map}static getInstance(){return s_.instance||(s_.instance=new s_),s_.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getGroupInitData()}onGroupListUpdated(e){const t=this.getEngine();t.TUIStore.update(jg.GRP,"groupList",e);const n=t.TUIStore.getData(jg.GRP,"currentGroupID");e.forEach((e=>{e.groupID===n&&t.TUIStore.update(jg.GRP,"currentGroup",e)}))}onGroupAttributesUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.GRP,"currentGroupID");let i=t.TUIStore.getData(jg.GRP,"groupList");const{groupID:o,groupAttributes:s}=e;n===o&&t.TUIStore.update(jg.GRP,"currentGroupAttributes",s),i=i.map((e=>(e.groupID===o&&(e.groupAttributes=s),e))),t.TUIStore.update(jg.GRP,"groupList",i)}onGroupCounterUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.GRP,"currentGroupID"),i=t.TUIStore.getData(jg.GRP,"currentGroupCounters")||{};let o=t.TUIStore.getData(jg.GRP,"groupList");const{groupID:s,key:a,value:r}=e;n===s&&(i[a]=r,t.TUIStore.update(jg.GRP,"currentGroupCounters",i)),o=o.map((e=>(e.groupID===s&&(e.groupCounters=Object.assign(Object.assign({},e.groupCounters),{[a]:r})),e))),t.TUIStore.update(jg.GRP,"groupList",o)}onMessageReceived(e){const t=this.getEngine(),n=[];e.forEach((e=>{if(e.type===t.TYPES.MSG_GRP_TIP){const{payload:n}=e,{operationType:i,userIDList:o}=n;switch(i){case t.TYPES.GRP_TIP_MBR_JOIN:this.addMemberList(o);break;case t.TYPES.GRP_TIP_MBR_QUIT:case t.TYPES.GRP_TIP_MBR_KICKED_OUT:this.removeMemberList(o);break;case t.TYPES.GRP_TIP_MBR_SET_ADMIN:case t.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:this.updateGroupMember(o);break;case t.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:break;case t.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:case t.TYPES.GRP_TIP_BAN_AVCHATROOM_MEMBER:case t.TYPES.GRP_TIP_UNBAN_AVCHATROOM_MEMBER:this.updateGroupMember(o)}}e.type===t.TYPES.MSG_GRP_SYS_NOTICE&&n.push(e)})),n.length>0&&t.TUIStore.update(jg.GRP,"groupSystemNoticeList",n)}getGroupInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getGroupList().then((e=>{const{groupList:t=[]}=e.data;console.log(`TUIGroupService.init, getGroupList count:${t.length}`),t.length>0&&this.onGroupListUpdated(t)}))}updateGroupMember(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(jg.GRP,"currentGroupID");if(t){const n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:i}=n.data;this.updateMemberList(i)}}))}resetCurrentStore(){this.getEngine().TUIStore.reset(jg.GRP,["currentGroupID","currentGroup","currentGroupAttributes","currentGroupCounters","currentGroupMemberList"],!0)}switchGroup(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine();t.TUIStore.update(jg.GRP,"offset",0),t.TUIStore.update(jg.GRP,"isCompleted",!1);const n=t.TUIStore.getConversationModel(`GROUP${e}`);if((null==n?void 0:n.operationType)>0){const e=t.TUIStore.getData(jg.GRP,"currentGroup");return Promise.resolve(e)}const i=t.TUIStore.getData(jg.GRP,"currentGroupID");if(!e)return this.resetCurrentStore(),Promise.resolve({});if(i===e){const e=t.TUIStore.getData(jg.GRP,"currentGroup");return Promise.resolve(e)}this.resetCurrentStore(),t.TUIStore.update(jg.GRP,"currentGroupID",e);try{yield this.getGroupInfo(e)}catch(a){Promise.reject(a)}const o=setTimeout((()=>{this.groupMap.delete(e),clearTimeout(o)}),5e3),s=t.TUIStore.getData(jg.GRP,"currentGroup");return Promise.resolve(s)}))}getGroupInfo(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine(),n=this.groupMap.get(e);if(n)return this.updateMemberList((null==n?void 0:n.memberList)||[]),t.TUIStore.update(jg.GRP,"currentGroup",n.group),t.TUIStore.update(jg.GRP,"currentGroupAttributes",n.groupAttributes||{}),void t.TUIStore.update(jg.GRP,"currentGroupCounters",n.counters||{});const i={group:{},memberList:[],groupAttributes:void 0,counters:void 0},{data:{group:o}}=yield this.getGroupProfile({groupID:e});i.group=o;const{data:{memberList:s}}=yield this.getGroupMemberList({groupID:e});i.memberList=s;const a=yield this.getGroupAttributes({groupID:e,keyList:[]}),{groupAttributes:r}=a.data;i.groupAttributes=r,t.TUIStore.update(jg.GRP,"currentGroupAttributes",r);try{const n=yield this.getGroupCounters({groupID:e,keyList:[]}),{counters:o}=n.data;i.counters=o,t.TUIStore.update(jg.GRP,"currentGroupCounters",o)}catch(c){console.warn(null==c?void 0:c.message)}this.groupMap.set(e,i)}))}getGroupProfile(e){const t=this.getEngine();return t.chat.getGroupProfile(e).then((n=>Bg(this,void 0,void 0,(function*(){if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{group:e}=n.data;t.TUIStore.update(jg.GRP,"currentGroup",e)}return n}))))}updateGroupProfile(e){return this.getEngine().chat.updateGroupProfile(e)}createGroup(e){return this.getEngine().chat.createGroup(e)}dismissGroup(e){return this.getEngine().chat.dismissGroup(e)}searchGroupByID(e){const t=this.getEngine();return t.chat.searchGroupByID(e).then((e=>{const{group:n}=e.data,i=t.TUIStore.getData(jg.GRP,"groupList");return e.data.group.isJoinedGroup=i.some((e=>e.groupID===n.groupID)),e}))}joinGroup(e){return this.getEngine().chat.joinGroup(e)}quitGroup(e){return this.getEngine().chat.quitGroup(e)}getGroupApplicationList(){return this.getEngine().chat.getGroupApplicationList()}handleGroupApplication(e){return this.getEngine().chat.handleGroupApplication(e)}getGroupOnlineMemberCount(e){return this.getEngine().chat.getGroupOnlineMemberCount(e)}changeGroupOwner(e){return this.getEngine().chat.changeGroupOwner(e)}initGroupAttributes(e){return this.getEngine().chat.initGroupAttributes(e)}setGroupAttributes(e){return this.getEngine().chat.setGroupAttributes(e)}deleteGroupAttributes(e){return this.getEngine().chat.deleteGroupAttributes(e)}getGroupAttributes(e){return this.getEngine().chat.getGroupAttributes(e)}setGroupCounters(e){return this.getEngine().chat.setGroupCounters(e)}increaseGroupCounter(e){return this.getEngine().chat.increaseGroupCounter(e)}decreaseGroupCounter(e){return this.getEngine().chat.decreaseGroupCounter(e)}getGroupCounters(e){return this.getEngine().chat.getGroupCounters(e)}updateMemberList(e){const t=this.getEngine(),n=[...(t.TUIStore.getData(jg.GRP,"currentGroupMemberList")||[]).filter((t=>!e.find((e=>e.userID===t.userID)))),...e];t.TUIStore.update(jg.GRP,"currentGroupMemberList",n)}addMemberList(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(jg.GRP,"currentGroupID");if(t)try{const n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:i}=n.data;this.updateMemberList(i)}catch(n){const t=e.map((e=>({userID:e,avatar:"",nick:"",role:"",joinTime:0,nameCard:"",muteUntil:0,memberCustomField:[]})));this.updateMemberList(t)}}))}removeMemberList(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.GRP,"currentGroupMemberList").filter((t=>-1===e.indexOf(t.userID)));t.TUIStore.update(jg.GRP,"currentGroupMemberList",n)}getGroupMemberList(e){const t=this.getEngine();if(Qg(e.offset)){const n=t.TUIStore.getData(jg.GRP,"offset");e.offset=n}return t.chat.getGroupMemberList(e).then((n=>{if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{memberList:e,offset:i=0}=n.data;this.updateMemberList(e),t.TUIStore.update(jg.GRP,"offset",i),0===i&&t.TUIStore.update(jg.GRP,"isCompleted",!0)}return n}))}getGroupMemberProfile(e){return this.getEngine().chat.getGroupMemberProfile(e)}addGroupMember(e){const t=this.getEngine();return t.chat.addGroupMember(e).then((n=>Bg(this,void 0,void 0,(function*(){if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{successUserIDList:e,group:i}=n.data;t.TUIStore.update(jg.GRP,"currentGroup",i),this.addMemberList(e)}return n}))))}deleteGroupMember(e){const t=this.getEngine();return t.chat.deleteGroupMember(e).then((n=>{if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{userIDList:e,group:i}=n.data;this.removeMemberList(e),t.TUIStore.update(jg.GRP,"currentGroup",i)}return n}))}setGroupMemberMuteTime(e){return this.getEngine().chat.setGroupMemberMuteTime(e)}setGroupMemberRole(e){return this.getEngine().chat.setGroupMemberRole(e)}setGroupMemberNameCard(e){return this.getEngine().chat.setGroupMemberNameCard(e)}setGroupMemberCustomField(e){return this.getEngine().chat.setGroupMemberCustomField(e)}markGroupMemberList(e){return this.getEngine().chat.markGroupMemberList(e)}}class a_ extends Tf{constructor(){super()}static getInstance(){return a_.instance||(a_.instance=new a_),a_.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated.bind(this)),this.getFriendInitData()}onFriendListUpdated(e){this.getEngine().TUIStore.update(jg.FRIEND,"friendList",e)}onFriendApplicationListUpdated(e){const{friendApplicationList:t,unreadCount:n=0}=e,i=this.getEngine();i.TUIStore.update(jg.FRIEND,"friendApplicationList",t),i.TUIStore.update(jg.FRIEND,"friendApplicationUnreadCount",n)}getFriendInitData(){const e=this.getEngine();e.chat.isReady()&&(e.chat.getFriendList().then((e=>{const t=e.data||[];console.log(`TUIFriendService.init, getFriendList count:${t.length}`),t.length>0&&this.onFriendListUpdated(t)})),e.chat.getFriendApplicationList().then((e=>{this.onFriendApplicationListUpdated(e.data)})))}getFriendList(){return this.getEngine().chat.getFriendList()}getFriendRemark(e){const t=this.getEngine().TUIStore.getData(jg.FRIEND,"friendList"),n={};return e.forEach((e=>{for(let i=0;i<t.length;i++)t[i].userID!==e||(n[e]=t[i].remark)})),n}addFriend(e){return this.getEngine().chat.addFriend(e)}deleteFriend(e){return this.getEngine().chat.deleteFriend(e)}checkFriend(e){return this.getEngine().chat.checkFriend(e)}getFriendProfile(e){return this.getEngine().chat.getFriendProfile(e)}updateFriend(e){return this.getEngine().chat.updateFriend(e)}acceptFriendApplication(e){return this.getEngine().chat.acceptFriendApplication(e)}refuseFriendApplication(e){return this.getEngine().chat.refuseFriendApplication({userID:e})}deleteFriendApplication(e){return this.getEngine().chat.deleteFriendApplication(e)}setFriendApplicationRead(){return this.getEngine().chat.setFriendApplicationRead()}}class r_ extends Tf{static getInstance(){return r_.instance||(r_.instance=new r_),r_.instance}reportFeature(e,t){var n;return null===(n=this.getEngine().chat)||void 0===n?void 0:n.callExperimentalAPI("statTUIKeyFeatures",{code:e,msg:t?`${e}-${t}`:""})}}class c_{constructor(){this.cache=[],this.middlewares=[],this.options=null}use(e){return"function"!=typeof e&&console.error("middleware must be a function"),this.cache.push(e),this}next(){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}run(e){return this.middlewares=this.cache.map((e=>e)),this.options=e,this.next()}}function u_(e,t,n){const i=Object.create(null);Object.keys(n).forEach((n=>{if(!t[n])return;i[n]=t[n];const o=new c_;t[n]=function(){const s=Array.from(arguments);return o.use(((t,i)=>e.isInited?i():Promise.reject({code:Yg.NOT_INIT,message:`${n} | ${Jg.NOT_INIT}`}))).use((e=>i[n].apply(t,e))),o.run(s)}}))}console.log("TUIChatEngine.VERSION:2.4.4");const l_=Cf.getInstance();Mf.getInstance();const d_=Gf.getInstance(),p_=zm.getInstance(),h_=Wm.getInstance(),g_=e_.getInstance(),f_=o_.getInstance(),m_=s_.getInstance(),__=a_.getInstance(),v_=r_.getInstance();l_.mount(Vg.TUIStore,d_),l_.mount(Vg.TUITranslate,p_),l_.mount(Vg.TUIConversation,h_),l_.mount(Vg.TUIUser,g_),l_.mount(Vg.TUIChat,f_),l_.mount(Vg.TUIGroup,m_),l_.mount(Vg.TUIFriend,__),l_.mount(Vg.TUIReport,v_),u_(l_,l_,Xg),u_(l_,h_,{deleteConversation:1,pinConversation:1,muteConversation:1,switchConversation:1,getConversationProfile:1,clearHistoryMessage:1}),u_(l_,f_,{modifyMessage:1,revokeMessage:1,resendMessage:1,deleteMessage:1,quoteMessage:1,replyMessage:1,setMessageExtensions:1,deleteMessageExtensions:1,getMessageExtensions:1,sendTextMessage:1,sendTextAtMessage:1,sendImageMessage:1,sendAudioMessage:1,sendVideoMessage:1,sendFileMessage:1,sendCustomMessage:1,sendFaceMessage:1,sendLocationMessage:1,sendForwardMessage:1,enterTypingState:1,leaveTypingState:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageList:1,downloadMergedMessages:1,setTranslationLanguage:1,translateText:1,searchCloudMessages:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1}),u_(l_,m_,{switchGroup:1,getGroupProfile:1,updateGroupProfile:1,createGroup:1,dismissGroup:1,searchGroupByID:1,joinGroup:1,quitGroup:1,getGroupApplicationList:1,handleGroupApplication:1,getGroupOnlineMemberCount:1,changeGroupOwner:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getGroupMemberList:1,getGroupMemberProfile:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberNameCard:1,setGroupMemberCustomField:1,markGroupMemberList:1}),u_(l_,g_,{switchUserStatus:1,switchMessageReadStatus:1,getUserProfile:1,updateMyProfile:1,addToBlacklist:1,removeFromBlacklist:1}),u_(l_,__,{getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,getFriendProfile:1,updateFriend:1,acceptFriendApplication:1,refuseFriendApplication:1,deleteFriendApplication:1,setFriendApplicationRead:1}),u_(l_,v_,Xg),exports.COS=Lg,exports._export_sfc=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},exports.createPinia=function(){const e=xn(!0),t=e.run((()=>io({})));let n=[],i=[];const o=Ji({install(e){Lr(o),o._a=e,e.provide(Pr,o),e.config.globalProperties.$pinia=o,i.forEach((e=>n.push(e))),i=[]},use(e){return this._a?n.push(e):i.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o},exports.createSSRApp=ja,exports.defineStore=function(e,t,n){let i,o;const s="function"==typeof t;function a(e,n){(e=e||(!!(qs||wo||Wo)?Yo(Pr,null):null))&&Lr(e),(e=Ar)._s.has(i)||(s?Kr(i,t,o,e):Hr(i,o,e));return e._s.get(i)}return"string"==typeof e?(i=e,o=s?n:t):(o=e,i=e.id),a.$id=i,a},exports.e=(e,...t)=>r(e,...t),exports.f=(e,t)=>function(e,t){let n;if(d(e)||f(e)){n=new Array(e.length);for(let i=0,o=e.length;i<o;i++)n[i]=t(e[i],i,i)}else if("number"==typeof e){n=new Array(e);for(let i=0;i<e;i++)n[i]=t(i+1,i,i)}else if(_(e))if(e[Symbol.iterator])n=Array.from(e,((e,n)=>t(e,n,n)));else{const i=Object.keys(e);n=new Array(i.length);for(let o=0,s=i.length;o<s;o++){const s=i[o];n[o]=t(e[s],s,o)}}else n=[];return n}(e,t),exports.getCurrentInstance=Vs,exports.index=Nn,exports.initVueI18n=function(e,t={},n,i){if("string"!=typeof e){const n=[t,e];e=n[0],t=n[1]}"string"!=typeof e&&(e=void 0!==Nn&&Nn.getLocale?Nn.getLocale():"undefined"!=typeof global&&global.getLocale?global.getLocale():Ue),"string"!=typeof n&&(n="undefined"!=typeof __uniConfig&&__uniConfig.fallbackLocale||Ue);const o=new qe({locale:e,fallbackLocale:n,messages:t,watcher:i});let s=(e,t)=>{if("function"!=typeof getApp)s=function(e,t){return o.t(e,t)};else{let e=!1;s=function(t,n){const i=getApp().$vm;return i&&(i.$locale,e||(e=!0,function(e,t){e.$watchLocale?e.$watchLocale((e=>{t.setLocale(e)})):e.$watch((()=>e.$locale),(e=>{t.setLocale(e)}))}(i,o))),o.t(t,n)}}return s(e,t)};return{i18n:o,f:(e,t,n)=>o.f(e,t,n),t:(e,t)=>s(e,t),add:(e,t,n=!0)=>o.add(e,t,n),watch:e=>o.watchLocale(e),getLocale:()=>o.getLocale(),setLocale:e=>o.setLocale(e)}},exports.jo=Rg,exports.n=e=>F(e),exports.o=(e,t)=>qa(e,t),exports.onMounted=ns,exports.p=e=>function(e){const{uid:t,__counter:n}=Vs();return t+","+((Ua[t]||(Ua[t]=[])).push(Gs(e))-1)+","+n}(e),exports.reactive=ji,exports.ref=io,exports.resolveComponent=function(e,t){return function(e,t,n=!0,i=!1){const o=wo||qs;if(o){const n=o.type;if(e===Go){const e=function(e,t=!0){return g(e)?e.displayName||e.name:e.name||t&&e.__name}(n,!1);if(e&&(e===t||e===k(t)||e===O(k(t))))return n}const s=xo(o[e]||n[e],t)||xo(o.appContext[e],t);return!s&&i?n:s}}(Go,e,!0,t)||e},exports.s=e=>Ba(e),exports.sr=(e,t,n)=>function(e,t,n={}){const{$templateRefs:i}=Vs();i.push({i:t,r:e,k:n.k,f:n.f})}(e,t,n),exports.t=e=>(e=>f(e)?e:null==e?"":d(e)||_(e)&&(e.toString===y||!g(e.toString))?JSON.stringify(e,B,2):String(e))(e),exports.unref=so,exports.wx$1=Pn;